function q8(e,t){for(var n=0;nr[i]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const u of o.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();var Si=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function wt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var IE={exports:{}},Ph={},PE={exports:{}},Ye={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var Cc=Symbol.for("react.element"),K8=Symbol.for("react.portal"),Z8=Symbol.for("react.fragment"),Q8=Symbol.for("react.strict_mode"),J8=Symbol.for("react.profiler"),eN=Symbol.for("react.provider"),tN=Symbol.for("react.context"),nN=Symbol.for("react.forward_ref"),rN=Symbol.for("react.suspense"),iN=Symbol.for("react.memo"),aN=Symbol.for("react.lazy"),_v=Symbol.iterator;function oN(e){return e===null||typeof e!="object"?null:(e=_v&&e[_v]||e["@@iterator"],typeof e=="function"?e:null)}var RE={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ME=Object.assign,kE={};function el(e,t,n){this.props=e,this.context=t,this.refs=kE,this.updater=n||RE}el.prototype.isReactComponent={};el.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")};el.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function DE(){}DE.prototype=el.prototype;function Xm(e,t,n){this.props=e,this.context=t,this.refs=kE,this.updater=n||RE}var Ym=Xm.prototype=new DE;Ym.constructor=Xm;ME(Ym,el.prototype);Ym.isPureReactComponent=!0;var Tv=Array.isArray,jE=Object.prototype.hasOwnProperty,qm={current:null},LE={key:!0,ref:!0,__self:!0,__source:!0};function BE(e,t,n){var r,i={},o=null,u=null;if(t!=null)for(r in t.ref!==void 0&&(u=t.ref),t.key!==void 0&&(o=""+t.key),t)jE.call(t,r)&&!LE.hasOwnProperty(r)&&(i[r]=t[r]);var f=arguments.length-2;if(f===1)i.children=n;else if(1>>1,le=ee[me];if(0>>1;mei(Je,ue))Sei(Ue,Je)?(ee[me]=Ue,ee[Se]=ue,me=Se):(ee[me]=Je,ee[Pe]=ue,me=Pe);else if(Sei(Ue,ue))ee[me]=Ue,ee[Se]=ue,me=Se;else break e}}return oe}function i(ee,oe){var ue=ee.sortIndex-oe.sortIndex;return ue!==0?ue:ee.id-oe.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],p=[],x=1,m=null,w=3,A=!1,_=!1,T=!1,N=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function O(ee){for(var oe=n(p);oe!==null;){if(oe.callback===null)r(p);else if(oe.startTime<=ee)r(p),oe.sortIndex=oe.expirationTime,t(h,oe);else break;oe=n(p)}}function M(ee){if(T=!1,O(ee),!_)if(n(h)!==null)_=!0,re(P);else{var oe=n(p);oe!==null&&te(M,oe.startTime-ee)}}function P(ee,oe){_=!1,T&&(T=!1,E(B),B=-1),A=!0;var ue=w;try{for(O(oe),m=n(h);m!==null&&(!(m.expirationTime>oe)||ee&&!K());){var me=m.callback;if(typeof me=="function"){m.callback=null,w=m.priorityLevel;var le=me(m.expirationTime<=oe);oe=e.unstable_now(),typeof le=="function"?m.callback=le:m===n(h)&&r(h),O(oe)}else r(h);m=n(h)}if(m!==null)var Ee=!0;else{var Pe=n(p);Pe!==null&&te(M,Pe.startTime-oe),Ee=!1}return Ee}finally{m=null,w=ue,A=!1}}var I=!1,k=null,B=-1,F=5,q=-1;function K(){return!(e.unstable_now()-qee||125me?(ee.sortIndex=ue,t(p,ee),n(h)===null&&ee===n(p)&&(T?(E(B),B=-1):T=!0,te(M,ue-me))):(ee.sortIndex=le,t(h,ee),_||A||(_=!0,re(P))),ee},e.unstable_shouldYield=K,e.unstable_wrapCallback=function(ee){var oe=w;return function(){var ue=w;w=oe;try{return ee.apply(this,arguments)}finally{w=ue}}}})(WE);zE.exports=WE;var xN=zE.exports;/** * @license React * react-dom.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var vN=W,hr=xN;function he(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xp=Object.prototype.hasOwnProperty,wN=/^[: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]*$/,Iv={},Pv={};function bN(e){return xp.call(Pv,e)?!0:xp.call(Iv,e)?!1:wN.test(e)?Pv[e]=!0:(Iv[e]=!0,!1)}function AN(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function SN(e,t,n,r){if(t===null||typeof t>"u"||AN(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.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 Wn(e,t,n,r,i,o,u){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=u}var En={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){En[e]=new Wn(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];En[t]=new Wn(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){En[e]=new Wn(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){En[e]=new Wn(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){En[e]=new Wn(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){En[e]=new Wn(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){En[e]=new Wn(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){En[e]=new Wn(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){En[e]=new Wn(e,5,!1,e.toLowerCase(),null,!1,!1)});var Zm=/[\-:]([a-z])/g;function Qm(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(Zm,Qm);En[t]=new Wn(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(Zm,Qm);En[t]=new Wn(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(Zm,Qm);En[t]=new Wn(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){En[e]=new Wn(e,1,!1,e.toLowerCase(),null,!1,!1)});En.xlinkHref=new Wn("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){En[e]=new Wn(e,1,!1,e.toLowerCase(),null,!0,!0)});function Jm(e,t,n,r){var i=En.hasOwnProperty(t)?En[t]:null;(i!==null?i.type!==0:r||!(2f||i[u]!==o[f]){var h=` `+i[u].replace(" at new "," at ");return e.displayName&&h.includes("")&&(h=h.replace("",e.displayName)),h}while(1<=u&&0<=f);break}}}finally{u1=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?tu(e):""}function EN(e){switch(e.tag){case 5:return tu(e.type);case 16:return tu("Lazy");case 13:return tu("Suspense");case 19:return tu("SuspenseList");case 0:case 2:case 15:return e=c1(e.type,!1),e;case 11:return e=c1(e.type.render,!1),e;case 1:return e=c1(e.type,!0),e;default:return""}}function Ap(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 Jo:return"Fragment";case Qo:return"Portal";case vp:return"Profiler";case ey:return"StrictMode";case wp:return"Suspense";case bp:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case GE:return(e.displayName||"Context")+".Consumer";case VE:return(e._context.displayName||"Context")+".Provider";case ty:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case ny:return t=e.displayName||null,t!==null?t:Ap(e.type)||"Memo";case na:t=e._payload,e=e._init;try{return Ap(e(t))}catch{}}return null}function CN(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 Ap(t);case 8:return t===ey?"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 Sa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function YE(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function ON(e){var t=YE(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var i=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(u){r=""+u,o.call(this,u)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(u){r=""+u},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function rf(e){e._valueTracker||(e._valueTracker=ON(e))}function qE(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=YE(e)?e.checked?"true":"false":e.value),e=r,e!==n?(t.setValue(e),!0):!1}function Kf(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 Sp(e,t){var n=t.checked;return jt({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function Mv(e,t){var n=t.defaultValue==null?"":t.defaultValue,r=t.checked!=null?t.checked:t.defaultChecked;n=Sa(t.value!=null?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function KE(e,t){t=t.checked,t!=null&&Jm(e,"checked",t,!1)}function Ep(e,t){KE(e,t);var n=Sa(t.value),r=t.type;if(n!=null)r==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(r==="submit"||r==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Cp(e,t.type,n):t.hasOwnProperty("defaultValue")&&Cp(e,t.type,Sa(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function kv(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!(r!=="submit"&&r!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Cp(e,t,n){(t!=="number"||Kf(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var nu=Array.isArray;function gs(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"+t.valueOf().toString()+"",t=af.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function Su(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var su={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},_N=["Webkit","ms","Moz","O"];Object.keys(su).forEach(function(e){_N.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),su[t]=su[e]})});function e3(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||su.hasOwnProperty(e)&&su[e]?(""+t).trim():t+"px"}function t3(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var r=n.indexOf("--")===0,i=e3(n,t[n],r);n==="float"&&(n="cssFloat"),r?e.setProperty(n,i):e[n]=i}}var TN=jt({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 Tp(e,t){if(t){if(TN[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(he(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(he(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(he(61))}if(t.style!=null&&typeof t.style!="object")throw Error(he(62))}}function Np(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 Ip=null;function ry(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Pp=null,ms=null,ys=null;function Lv(e){if(e=Tc(e)){if(typeof Pp!="function")throw Error(he(280));var t=e.stateNode;t&&(t=jh(t),Pp(e.stateNode,e.type,t))}}function n3(e){ms?ys?ys.push(e):ys=[e]:ms=e}function r3(){if(ms){var e=ms,t=ys;if(ys=ms=null,Lv(e),t)for(e=0;e>>=0,e===0?32:31-(FN(e)/$N|0)|0}var of=64,sf=4194304;function ru(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 ed(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,o=e.pingedLanes,u=n&268435455;if(u!==0){var f=u&~i;f!==0?r=ru(f):(o&=u,o!==0&&(r=ru(o)))}else u=n&~i,u!==0?r=ru(u):o!==0&&(r=ru(o));if(r===0)return 0;if(t!==0&&t!==r&&!(t&i)&&(i=r&-r,o=t&-t,i>=o||i===16&&(o&4194240)!==0))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function Oc(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Qr(t),e[t]=n}function HN(e,t){var n=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 r=e.eventTimes;for(e=e.expirationTimes;0=uu),Gv=" ",Xv=!1;function S3(e,t){switch(e){case"keyup":return xI.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function E3(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var es=!1;function wI(e,t){switch(e){case"compositionend":return E3(t);case"keypress":return t.which!==32?null:(Xv=!0,Gv);case"textInput":return e=t.data,e===Gv&&Xv?null:e;default:return null}}function bI(e,t){if(es)return e==="compositionend"||!fy&&S3(e,t)?(e=b3(),jf=ly=la=null,es=!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)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Zv(n)}}function T3(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?T3(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function N3(){for(var e=window,t=Kf();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Kf(e.document)}return t}function dy(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 II(e){var t=N3(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&T3(n.ownerDocument.documentElement,n)){if(r!==null&&dy(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,o=Math.min(r.start,i);r=r.end===void 0?o:Math.min(r.end,i),!e.extend&&o>r&&(i=r,r=o,o=i),i=Qv(n,o);var u=Qv(n,r);i&&u&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==u.node||e.focusOffset!==u.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),o>r?(e.addRange(t),e.extend(u.node,u.offset)):(t.setEnd(u.node,u.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,ts=null,Lp=null,fu=null,Bp=!1;function Jv(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Bp||ts==null||ts!==Kf(r)||(r=ts,"selectionStart"in r&&dy(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),fu&&Nu(fu,r)||(fu=r,r=rd(Lp,"onSelect"),0is||(e.current=Hp[is],Hp[is]=null,is--)}function St(e,t){is++,Hp[is]=e.current,e.current=t}var Ea={},Dn=_a(Ea),Qn=_a(!1),co=Ea;function Os(e,t){var n=e.type.contextTypes;if(!n)return Ea;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},o;for(o in n)i[o]=t[o];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Jn(e){return e=e.childContextTypes,e!=null}function ad(){Tt(Qn),Tt(Dn)}function o2(e,t,n){if(Dn.current!==Ea)throw Error(he(168));St(Dn,t),St(Qn,n)}function B3(e,t,n){var r=e.stateNode;if(t=t.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var i in r)if(!(i in t))throw Error(he(108,CN(e)||"Unknown",i));return jt({},n,r)}function od(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Ea,co=Dn.current,St(Dn,e),St(Qn,Qn.current),!0}function s2(e,t,n){var r=e.stateNode;if(!r)throw Error(he(169));n?(e=B3(e,t,co),r.__reactInternalMemoizedMergedChildContext=e,Tt(Qn),Tt(Dn),St(Dn,e)):Tt(Qn),St(Qn,n)}var Ai=null,Lh=!1,E1=!1;function F3(e){Ai===null?Ai=[e]:Ai.push(e)}function zI(e){Lh=!0,F3(e)}function Ta(){if(!E1&&Ai!==null){E1=!0;var e=0,t=dt;try{var n=Ai;for(dt=1;e>=u,i-=u,Ei=1<<32-Qr(t)+i|n<B?(F=k,k=null):F=k.sibling;var q=w(E,k,O[B],M);if(q===null){k===null&&(k=F);break}e&&k&&q.alternate===null&&t(E,k),C=o(q,C,B),I===null?P=q:I.sibling=q,I=q,k=F}if(B===O.length)return n(E,k),It&&Wa(E,B),P;if(k===null){for(;BB?(F=k,k=null):F=k.sibling;var K=w(E,k,q.value,M);if(K===null){k===null&&(k=F);break}e&&k&&K.alternate===null&&t(E,k),C=o(K,C,B),I===null?P=K:I.sibling=K,I=K,k=F}if(q.done)return n(E,k),It&&Wa(E,B),P;if(k===null){for(;!q.done;B++,q=O.next())q=m(E,q.value,M),q!==null&&(C=o(q,C,B),I===null?P=q:I.sibling=q,I=q);return It&&Wa(E,B),P}for(k=r(E,k);!q.done;B++,q=O.next())q=A(k,E,B,q.value,M),q!==null&&(e&&q.alternate!==null&&k.delete(q.key===null?B:q.key),C=o(q,C,B),I===null?P=q:I.sibling=q,I=q);return e&&k.forEach(function(H){return t(E,H)}),It&&Wa(E,B),P}function N(E,C,O,M){if(typeof O=="object"&&O!==null&&O.type===Jo&&O.key===null&&(O=O.props.children),typeof O=="object"&&O!==null){switch(O.$$typeof){case nf:e:{for(var P=O.key,I=C;I!==null;){if(I.key===P){if(P=O.type,P===Jo){if(I.tag===7){n(E,I.sibling),C=i(I,O.props.children),C.return=E,E=C;break e}}else if(I.elementType===P||typeof P=="object"&&P!==null&&P.$$typeof===na&&c2(P)===I.type){n(E,I.sibling),C=i(I,O.props),C.ref=jl(E,I,O),C.return=E,E=C;break e}n(E,I);break}else t(E,I);I=I.sibling}O.type===Jo?(C=ao(O.props.children,E.mode,M,O.key),C.return=E,E=C):(M=Hf(O.type,O.key,O.props,null,E.mode,M),M.ref=jl(E,C,O),M.return=E,E=M)}return u(E);case Qo:e:{for(I=O.key;C!==null;){if(C.key===I)if(C.tag===4&&C.stateNode.containerInfo===O.containerInfo&&C.stateNode.implementation===O.implementation){n(E,C.sibling),C=i(C,O.children||[]),C.return=E,E=C;break e}else{n(E,C);break}else t(E,C);C=C.sibling}C=R1(O,E.mode,M),C.return=E,E=C}return u(E);case na:return I=O._init,N(E,C,I(O._payload),M)}if(nu(O))return _(E,C,O,M);if(Pl(O))return T(E,C,O,M);pf(E,O)}return typeof O=="string"&&O!==""||typeof O=="number"?(O=""+O,C!==null&&C.tag===6?(n(E,C.sibling),C=i(C,O),C.return=E,E=C):(n(E,C),C=P1(O,E.mode,M),C.return=E,E=C),u(E)):n(E,C)}return N}var Ts=W3(!0),H3=W3(!1),ud=_a(null),cd=null,ss=null,my=null;function yy(){my=ss=cd=null}function xy(e){var t=ud.current;Tt(ud),e._currentValue=t}function Xp(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===n)break;e=e.return}}function vs(e,t){cd=e,my=ss=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(Kn=!0),e.firstContext=null)}function Rr(e){var t=e._currentValue;if(my!==e)if(e={context:e,memoizedValue:t,next:null},ss===null){if(cd===null)throw Error(he(308));ss=e,cd.dependencies={lanes:0,firstContext:e}}else ss=ss.next=e;return t}var Za=null;function vy(e){Za===null?Za=[e]:Za.push(e)}function V3(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,vy(t)):(n.next=i.next,i.next=n),t.interleaved=n,Di(e,r)}function Di(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var ra=!1;function wy(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function G3(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 Ni(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function ma(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,nt&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,Di(e,n)}return i=r.interleaved,i===null?(t.next=t,vy(r)):(t.next=i.next,i.next=t),r.interleaved=t,Di(e,n)}function Bf(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ay(e,n)}}function f2(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var u={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?i=o=u:o=o.next=u,n=n.next}while(n!==null);o===null?i=o=t:o=o.next=t}else i=o=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:o,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function fd(e,t,n,r){var i=e.updateQueue;ra=!1;var o=i.firstBaseUpdate,u=i.lastBaseUpdate,f=i.shared.pending;if(f!==null){i.shared.pending=null;var h=f,p=h.next;h.next=null,u===null?o=p:u.next=p,u=h;var x=e.alternate;x!==null&&(x=x.updateQueue,f=x.lastBaseUpdate,f!==u&&(f===null?x.firstBaseUpdate=p:f.next=p,x.lastBaseUpdate=h))}if(o!==null){var m=i.baseState;u=0,x=p=h=null,f=o;do{var w=f.lane,A=f.eventTime;if((r&w)===w){x!==null&&(x=x.next={eventTime:A,lane:0,tag:f.tag,payload:f.payload,callback:f.callback,next:null});e:{var _=e,T=f;switch(w=t,A=n,T.tag){case 1:if(_=T.payload,typeof _=="function"){m=_.call(A,m,w);break e}m=_;break e;case 3:_.flags=_.flags&-65537|128;case 0:if(_=T.payload,w=typeof _=="function"?_.call(A,m,w):_,w==null)break e;m=jt({},m,w);break e;case 2:ra=!0}}f.callback!==null&&f.lane!==0&&(e.flags|=64,w=i.effects,w===null?i.effects=[f]:w.push(f))}else A={eventTime:A,lane:w,tag:f.tag,payload:f.payload,callback:f.callback,next:null},x===null?(p=x=A,h=m):x=x.next=A,u|=w;if(f=f.next,f===null){if(f=i.shared.pending,f===null)break;w=f,f=w.next,w.next=null,i.lastBaseUpdate=w,i.shared.pending=null}}while(!0);if(x===null&&(h=m),i.baseState=h,i.firstBaseUpdate=p,i.lastBaseUpdate=x,t=i.shared.interleaved,t!==null){i=t;do u|=i.lane,i=i.next;while(i!==t)}else o===null&&(i.shared.lanes=0);po|=u,e.lanes=u,e.memoizedState=m}}function d2(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=O1.transition;O1.transition={};try{e(!1),t()}finally{dt=n,O1.transition=r}}function uC(){return Mr().memoizedState}function GI(e,t,n){var r=xa(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},cC(e))fC(t,n);else if(n=V3(e,t,n,r),n!==null){var i=Un();Jr(n,e,r,i),dC(n,t,r)}}function XI(e,t,n){var r=xa(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(cC(e))fC(t,i);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var u=t.lastRenderedState,f=o(u,n);if(i.hasEagerState=!0,i.eagerState=f,ei(f,u)){var h=t.interleaved;h===null?(i.next=i,vy(t)):(i.next=h.next,h.next=i),t.interleaved=i;return}}catch{}finally{}n=V3(e,t,i,r),n!==null&&(i=Un(),Jr(n,e,r,i),dC(n,t,r))}}function cC(e){var t=e.alternate;return e===Dt||t!==null&&t===Dt}function fC(e,t){du=hd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function dC(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,ay(e,n)}}var pd={readContext:Rr,useCallback:_n,useContext:_n,useEffect:_n,useImperativeHandle:_n,useInsertionEffect:_n,useLayoutEffect:_n,useMemo:_n,useReducer:_n,useRef:_n,useState:_n,useDebugValue:_n,useDeferredValue:_n,useTransition:_n,useMutableSource:_n,useSyncExternalStore:_n,useId:_n,unstable_isNewReconciler:!1},YI={readContext:Rr,useCallback:function(e,t){return ui().memoizedState=[e,t===void 0?null:t],e},useContext:Rr,useEffect:p2,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,$f(4194308,4,iC.bind(null,t,e),n)},useLayoutEffect:function(e,t){return $f(4194308,4,e,t)},useInsertionEffect:function(e,t){return $f(4,2,e,t)},useMemo:function(e,t){var n=ui();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=ui();return t=n!==void 0?n(t):t,r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=GI.bind(null,Dt,e),[r.memoizedState,e]},useRef:function(e){var t=ui();return e={current:e},t.memoizedState=e},useState:h2,useDebugValue:Ty,useDeferredValue:function(e){return ui().memoizedState=e},useTransition:function(){var e=h2(!1),t=e[0];return e=VI.bind(null,e[1]),ui().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var r=Dt,i=ui();if(It){if(n===void 0)throw Error(he(407));n=n()}else{if(n=t(),gn===null)throw Error(he(349));ho&30||K3(r,t,n)}i.memoizedState=n;var o={value:n,getSnapshot:t};return i.queue=o,p2(Q3.bind(null,r,o,e),[e]),r.flags|=2048,Lu(9,Z3.bind(null,r,o,n,t),void 0,null),n},useId:function(){var e=ui(),t=gn.identifierPrefix;if(It){var n=Ci,r=Ei;n=(r&~(1<<32-Qr(r)-1)).toString(32)+n,t=":"+t+"R"+n,n=Du++,0<\/script>",e=e.removeChild(e.firstChild)):typeof r.is=="string"?e=u.createElement(n,{is:r.is}):(e=u.createElement(n),n==="select"&&(u=e,r.multiple?u.multiple=!0:r.size&&(u.size=r.size))):e=u.createElementNS(e,n),e[ci]=t,e[Ru]=r,AC(e,t,!1,!1),t.stateNode=e;e:{switch(u=Np(n,r),n){case"dialog":Ct("cancel",e),Ct("close",e),i=r;break;case"iframe":case"object":case"embed":Ct("load",e),i=r;break;case"video":case"audio":for(i=0;iPs&&(t.flags|=128,r=!0,Ll(o,!1),t.lanes=4194304)}else{if(!r)if(e=dd(u),e!==null){if(t.flags|=128,r=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),Ll(o,!0),o.tail===null&&o.tailMode==="hidden"&&!u.alternate&&!It)return Tn(t),null}else 2*Ht()-o.renderingStartTime>Ps&&n!==1073741824&&(t.flags|=128,r=!0,Ll(o,!1),t.lanes=4194304);o.isBackwards?(u.sibling=t.child,t.child=u):(n=o.last,n!==null?n.sibling=u:t.child=u,o.last=u)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=Ht(),t.sibling=null,n=kt.current,St(kt,r?n&1|2:n&1),t):(Tn(t),null);case 22:case 23:return ky(),r=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==r&&(t.flags|=8192),r&&t.mode&1?lr&1073741824&&(Tn(t),t.subtreeFlags&6&&(t.flags|=8192)):Tn(t),null;case 24:return null;case 25:return null}throw Error(he(156,t.tag))}function nP(e,t){switch(py(t),t.tag){case 1:return Jn(t.type)&&ad(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ns(),Tt(Qn),Tt(Dn),Sy(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ay(t),null;case 13:if(Tt(kt),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(he(340));_s()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Tt(kt),null;case 4:return Ns(),null;case 10:return xy(t.type._context),null;case 22:case 23:return ky(),null;case 24:return null;default:return null}}var mf=!1,Pn=!1,rP=typeof WeakSet=="function"?WeakSet:Set,_e=null;function ls(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Ut(e,t,r)}else n.current=null}function ng(e,t,n){try{n()}catch(r){Ut(e,t,r)}}var C2=!1;function iP(e,t){if(Fp=td,e=N3(),dy(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var u=0,f=-1,h=-1,p=0,x=0,m=e,w=null;t:for(;;){for(var A;m!==n||i!==0&&m.nodeType!==3||(f=u+i),m!==o||r!==0&&m.nodeType!==3||(h=u+r),m.nodeType===3&&(u+=m.nodeValue.length),(A=m.firstChild)!==null;)w=m,m=A;for(;;){if(m===e)break t;if(w===n&&++p===i&&(f=u),w===o&&++x===r&&(h=u),(A=m.nextSibling)!==null)break;m=w,w=m.parentNode}m=A}n=f===-1||h===-1?null:{start:f,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for($p={focusedElem:e,selectionRange:n},td=!1,_e=t;_e!==null;)if(t=_e,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,_e=e;else for(;_e!==null;){t=_e;try{var _=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(_!==null){var T=_.memoizedProps,N=_.memoizedState,E=t.stateNode,C=E.getSnapshotBeforeUpdate(t.elementType===t.type?T:Hr(t.type,T),N);E.__reactInternalSnapshotBeforeUpdate=C}break;case 3:var O=t.stateNode.containerInfo;O.nodeType===1?O.textContent="":O.nodeType===9&&O.documentElement&&O.removeChild(O.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(he(163))}}catch(M){Ut(t,t.return,M)}if(e=t.sibling,e!==null){e.return=t.return,_e=e;break}_e=t.return}return _=C2,C2=!1,_}function hu(e,t,n){var r=t.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var o=i.destroy;i.destroy=void 0,o!==void 0&&ng(t,n,o)}i=i.next}while(i!==r)}}function $h(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function rg(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function CC(e){var t=e.alternate;t!==null&&(e.alternate=null,CC(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[ci],delete t[Ru],delete t[Wp],delete t[$I],delete t[UI])),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 OC(e){return e.tag===5||e.tag===3||e.tag===4}function O2(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||OC(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 ig(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=id));else if(r!==4&&(e=e.child,e!==null))for(ig(e,t,n),e=e.sibling;e!==null;)ig(e,t,n),e=e.sibling}function ag(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(ag(e,t,n),e=e.sibling;e!==null;)ag(e,t,n),e=e.sibling}var bn=null,Vr=!1;function ea(e,t,n){for(n=n.child;n!==null;)_C(e,t,n),n=n.sibling}function _C(e,t,n){if(di&&typeof di.onCommitFiberUnmount=="function")try{di.onCommitFiberUnmount(Rh,n)}catch{}switch(n.tag){case 5:Pn||ls(n,t);case 6:var r=bn,i=Vr;bn=null,ea(e,t,n),bn=r,Vr=i,bn!==null&&(Vr?(e=bn,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):bn.removeChild(n.stateNode));break;case 18:bn!==null&&(Vr?(e=bn,n=n.stateNode,e.nodeType===8?S1(e.parentNode,n):e.nodeType===1&&S1(e,n),_u(e)):S1(bn,n.stateNode));break;case 4:r=bn,i=Vr,bn=n.stateNode.containerInfo,Vr=!0,ea(e,t,n),bn=r,Vr=i;break;case 0:case 11:case 14:case 15:if(!Pn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var o=i,u=o.destroy;o=o.tag,u!==void 0&&(o&2||o&4)&&ng(n,t,u),i=i.next}while(i!==r)}ea(e,t,n);break;case 1:if(!Pn&&(ls(n,t),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(f){Ut(n,t,f)}ea(e,t,n);break;case 21:ea(e,t,n);break;case 22:n.mode&1?(Pn=(r=Pn)||n.memoizedState!==null,ea(e,t,n),Pn=r):ea(e,t,n);break;default:ea(e,t,n)}}function _2(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new rP),t.forEach(function(r){var i=hP.bind(null,e,r);n.has(r)||(n.add(r),r.then(i,i))})}}function zr(e,t){var n=t.deletions;if(n!==null)for(var r=0;ri&&(i=u),r&=~o}if(r=i,r=Ht()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*oP(r/1960))-r,10e?16:e,ua===null)var r=!1;else{if(e=ua,ua=null,yd=0,nt&6)throw Error(he(331));var i=nt;for(nt|=4,_e=e.current;_e!==null;){var o=_e,u=o.child;if(_e.flags&16){var f=o.deletions;if(f!==null){for(var h=0;hHt()-Ry?io(e,0):Py|=n),er(e,t)}function DC(e,t){t===0&&(e.mode&1?(t=sf,sf<<=1,!(sf&130023424)&&(sf=4194304)):t=1);var n=Un();e=Di(e,t),e!==null&&(Oc(e,t,n),er(e,n))}function dP(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),DC(e,n)}function hP(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;default:throw Error(he(314))}r!==null&&r.delete(t),DC(e,n)}var jC;jC=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Qn.current)Kn=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return Kn=!1,eP(e,t,n);Kn=!!(e.flags&131072)}else Kn=!1,It&&t.flags&1048576&&$3(t,ld,t.index);switch(t.lanes=0,t.tag){case 2:var r=t.type;Uf(e,t),e=t.pendingProps;var i=Os(t,Dn.current);vs(t,n),i=Cy(null,t,r,e,i,n);var o=Oy();return t.flags|=1,typeof i=="object"&&i!==null&&typeof i.render=="function"&&i.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Jn(r)?(o=!0,od(t)):o=!1,t.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,wy(t),i.updater=Fh,t.stateNode=i,i._reactInternals=t,qp(t,r,e,n),t=Qp(null,t,r,!0,o,n)):(t.tag=0,It&&o&&hy(t),Fn(null,t,i,n),t=t.child),t;case 16:r=t.elementType;e:{switch(Uf(e,t),e=t.pendingProps,i=r._init,r=i(r._payload),t.type=r,i=t.tag=gP(r),e=Hr(r,e),i){case 0:t=Zp(null,t,r,e,n);break e;case 1:t=A2(null,t,r,e,n);break e;case 11:t=w2(null,t,r,e,n);break e;case 14:t=b2(null,t,r,Hr(r.type,e),n);break e}throw Error(he(306,r,""))}return t;case 0:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Hr(r,i),Zp(e,t,r,i,n);case 1:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Hr(r,i),A2(e,t,r,i,n);case 3:e:{if(vC(t),e===null)throw Error(he(387));r=t.pendingProps,o=t.memoizedState,i=o.element,G3(e,t),fd(t,r,null,n);var u=t.memoizedState;if(r=u.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:u.cache,pendingSuspenseBoundaries:u.pendingSuspenseBoundaries,transitions:u.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){i=Is(Error(he(423)),t),t=S2(e,t,r,n,i);break e}else if(r!==i){i=Is(Error(he(424)),t),t=S2(e,t,r,n,i);break e}else for(fr=ga(t.stateNode.containerInfo.firstChild),dr=t,It=!0,Yr=null,n=H3(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(_s(),r===i){t=ji(e,t,n);break e}Fn(e,t,r,n)}t=t.child}return t;case 5:return X3(t),e===null&&Gp(t),r=t.type,i=t.pendingProps,o=e!==null?e.memoizedProps:null,u=i.children,Up(r,i)?u=null:o!==null&&Up(r,o)&&(t.flags|=32),xC(e,t),Fn(e,t,u,n),t.child;case 6:return e===null&&Gp(t),null;case 13:return wC(e,t,n);case 4:return by(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Ts(t,null,r,n):Fn(e,t,r,n),t.child;case 11:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Hr(r,i),w2(e,t,r,i,n);case 7:return Fn(e,t,t.pendingProps,n),t.child;case 8:return Fn(e,t,t.pendingProps.children,n),t.child;case 12:return Fn(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(r=t.type._context,i=t.pendingProps,o=t.memoizedProps,u=i.value,St(ud,r._currentValue),r._currentValue=u,o!==null)if(ei(o.value,u)){if(o.children===i.children&&!Qn.current){t=ji(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var f=o.dependencies;if(f!==null){u=o.child;for(var h=f.firstContext;h!==null;){if(h.context===r){if(o.tag===1){h=Ni(-1,n&-n),h.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?h.next=h:(h.next=x.next,x.next=h),p.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Xp(o.return,n,t),f.lanes|=n;break}h=h.next}}else if(o.tag===10)u=o.type===t.type?null:o.child;else if(o.tag===18){if(u=o.return,u===null)throw Error(he(341));u.lanes|=n,f=u.alternate,f!==null&&(f.lanes|=n),Xp(u,n,t),u=o.sibling}else u=o.child;if(u!==null)u.return=o;else for(u=o;u!==null;){if(u===t){u=null;break}if(o=u.sibling,o!==null){o.return=u.return,u=o;break}u=u.return}o=u}Fn(e,t,i.children,n),t=t.child}return t;case 9:return i=t.type,r=t.pendingProps.children,vs(t,n),i=Rr(i),r=r(i),t.flags|=1,Fn(e,t,r,n),t.child;case 14:return r=t.type,i=Hr(r,t.pendingProps),i=Hr(r.type,i),b2(e,t,r,i,n);case 15:return mC(e,t,t.type,t.pendingProps,n);case 17:return r=t.type,i=t.pendingProps,i=t.elementType===r?i:Hr(r,i),Uf(e,t),t.tag=1,Jn(r)?(e=!0,od(t)):e=!1,vs(t,n),hC(t,r,i),qp(t,r,i,n),Qp(null,t,r,!0,e,n);case 19:return bC(e,t,n);case 22:return yC(e,t,n)}throw Error(he(156,t.tag))};function LC(e,t){return c3(e,t)}function pP(e,t,n,r){this.tag=e,this.key=n,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=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function _r(e,t,n,r){return new pP(e,t,n,r)}function jy(e){return e=e.prototype,!(!e||!e.isReactComponent)}function gP(e){if(typeof e=="function")return jy(e)?1:0;if(e!=null){if(e=e.$$typeof,e===ty)return 11;if(e===ny)return 14}return 2}function va(e,t){var n=e.alternate;return n===null?(n=_r(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function Hf(e,t,n,r,i,o){var u=2;if(r=e,typeof e=="function")jy(e)&&(u=1);else if(typeof e=="string")u=5;else e:switch(e){case Jo:return ao(n.children,i,o,t);case ey:u=8,i|=8;break;case vp:return e=_r(12,n,t,i|2),e.elementType=vp,e.lanes=o,e;case wp:return e=_r(13,n,t,i),e.elementType=wp,e.lanes=o,e;case bp:return e=_r(19,n,t,i),e.elementType=bp,e.lanes=o,e;case XE:return zh(n,i,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case VE:u=10;break e;case GE:u=9;break e;case ty:u=11;break e;case ny:u=14;break e;case na:u=16,r=null;break e}throw Error(he(130,e==null?e:typeof e,""))}return t=_r(u,n,t,i),t.elementType=e,t.type=r,t.lanes=o,t}function ao(e,t,n,r){return e=_r(7,e,r,t),e.lanes=n,e}function zh(e,t,n,r){return e=_r(22,e,r,t),e.elementType=XE,e.lanes=n,e.stateNode={isHidden:!1},e}function P1(e,t,n){return e=_r(6,e,null,t),e.lanes=n,e}function R1(e,t,n){return t=_r(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function mP(e,t,n,r,i){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=d1(0),this.expirationTimes=d1(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=d1(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function Ly(e,t,n,r,i,o,u,f,h){return e=new mP(e,t,n,f,h),t===1?(t=1,o===!0&&(t|=8)):t=0,o=_r(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},wy(o),e}function yP(e,t,n){var r=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(UC)}catch(e){console.error(e)}}UC(),UE.exports=gr;var AP=UE.exports,D2=AP;yp.createRoot=D2.createRoot,yp.hydrateRoot=D2.hydrateRoot;/** * @remix-run/router v1.23.4 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Fu(){return Fu=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function zC(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function EP(){return Math.random().toString(36).substr(2,8)}function L2(e,t){return{usr:e.state,key:e.key,idx:t}}function cg(e,t,n,r){return n===void 0&&(n=null),Fu({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?rl(t):t,{state:n,key:t&&t.key||r||EP()})}function wd(e){let{pathname:t="/",search:n="",hash:r=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(t+=r.charAt(0)==="#"?r:"#"+r),t}function rl(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf("?");r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function CP(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:o=!1}=r,u=i.history,f=ca.Pop,h=null,p=x();p==null&&(p=0,u.replaceState(Fu({},u.state,{idx:p}),""));function x(){return(u.state||{idx:null}).idx}function m(){f=ca.Pop;let N=x(),E=N==null?null:N-p;p=N,h&&h({action:f,location:T.location,delta:E})}function w(N,E){f=ca.Push;let C=cg(T.location,N,E);p=x()+1;let O=L2(C,p),M=T.createHref(C);try{u.pushState(O,"",M)}catch(P){if(P instanceof DOMException&&P.name==="DataCloneError")throw P;i.location.assign(M)}o&&h&&h({action:f,location:T.location,delta:1})}function A(N,E){f=ca.Replace;let C=cg(T.location,N,E);p=x();let O=L2(C,p),M=T.createHref(C);u.replaceState(O,"",M),o&&h&&h({action:f,location:T.location,delta:0})}function _(N){let E=i.location.origin!=="null"?i.location.origin:i.location.href,C=typeof N=="string"?N:wd(N);return C=C.replace(/ $/,"%20"),Gt(E,"No window.location.(origin|href) available to create URL for href: "+C),new URL(C,E)}let T={get action(){return f},get location(){return e(i,u)},listen(N){if(h)throw new Error("A history only accepts one active listener");return i.addEventListener(j2,m),h=N,()=>{i.removeEventListener(j2,m),h=null}},createHref(N){return t(i,N)},createURL:_,encodeLocation(N){let E=_(N);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:w,replace:A,go(N){return u.go(N)}};return T}var B2;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(B2||(B2={}));function OP(e,t,n){return n===void 0&&(n="/"),_P(e,t,n)}function _P(e,t,n,r){let i=typeof t=="string"?rl(t):t,o=Uy(i.pathname||"/",n);if(o==null)return null;let u=WC(e);TP(u);let f=null,h=$P(o);for(let p=0;f==null&&p{let h={relativePath:f===void 0?o.path||"":f,caseSensitive:o.caseSensitive===!0,childrenIndex:u,route:o};h.relativePath.startsWith("/")&&(Gt(h.relativePath.startsWith(r),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(r.length));let p=wa([r,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(Gt(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),WC(o.children,t,x,p)),!(o.path==null&&!o.index)&&t.push({path:p,score:DP(p,o.index),routesMeta:x})};return e.forEach((o,u)=>{var f;if(o.path===""||!((f=o.path)!=null&&f.includes("?")))i(o,u);else for(let h of HC(o.path))i(o,u,h)}),t}function HC(e){let t=e.split("/");if(t.length===0)return[];let[n,...r]=t,i=n.endsWith("?"),o=n.replace(/\?$/,"");if(r.length===0)return i?[o,""]:[o];let u=HC(r.join("/")),f=[];return f.push(...u.map(h=>h===""?o:[o,h].join("/"))),i&&f.push(...u),f.map(h=>e.startsWith("/")&&h===""?"/":h)}function TP(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:jP(t.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const NP=/^:[\w-]+$/,IP=3,PP=2,RP=1,MP=10,kP=-2,F2=e=>e==="*";function DP(e,t){let n=e.split("/"),r=n.length;return n.some(F2)&&(r+=kP),t&&(r+=PP),n.filter(i=>!F2(i)).reduce((i,o)=>i+(NP.test(o)?IP:o===""?RP:MP),r)}function jP(e,t){return e.length===t.length&&e.slice(0,-1).every((r,i)=>r===t[i])?e[e.length-1]-t[t.length-1]:0}function LP(e,t,n){let{routesMeta:r}=e,i={},o="/",u=[];for(let f=0;f{let{paramName:w,isOptional:A}=x;if(w==="*"){let T=f[m]||"";u=o.slice(0,o.length-T.length).replace(/(.)\/+$/,"$1")}const _=f[m];return A&&!_?p[w]=void 0:p[w]=(_||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:u,pattern:e}}function FP(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),zC(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let r=[],i="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,f,h)=>(r.push({paramName:f,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(r.push({paramName:"*"}),i+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?i+="\\/*$":e!==""&&e!=="/"&&(i+="(?:(?=\\/|$))"),[new RegExp(i,t?void 0:"i"),r]}function $P(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return zC(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function Uy(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,r=e.charAt(n);return r&&r!=="/"?null:e.slice(n)||"/"}function UP(e,t){t===void 0&&(t="/");let{pathname:n,search:r="",hash:i=""}=typeof e=="string"?rl(e):e,o;return n?(n=VC(n),n.startsWith("/")?o=$2(n.substring(1),"/"):o=$2(n,t)):o=t,{pathname:o,search:HP(r),hash:VP(i)}}function $2(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(i=>{i===".."?n.length>1&&n.pop():i!=="."&&n.push(i)}),n.length>1?n.join("/"):"/"}function M1(e,t,n,r){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` field ["+JSON.stringify(r)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function zP(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function zy(e,t){let n=zP(e);return t?n.map((r,i)=>i===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function Wy(e,t,n,r){r===void 0&&(r=!1);let i;typeof e=="string"?i=rl(e):(i=Fu({},e),Gt(!i.pathname||!i.pathname.includes("?"),M1("?","pathname","search",i)),Gt(!i.pathname||!i.pathname.includes("#"),M1("#","pathname","hash",i)),Gt(!i.search||!i.search.includes("#"),M1("#","search","hash",i)));let o=e===""||i.pathname==="",u=o?"/":i.pathname,f;if(u==null)f=n;else{let m=t.length-1;if(!r&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),m-=1;i.pathname=w.join("/")}f=m>=0?t[m]:"/"}let h=UP(i,f),p=u&&u!=="/"&&u.endsWith("/"),x=(o||u===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||x)&&(h.pathname+="/"),h}const VC=e=>e.replace(/\/\/+/g,"/"),wa=e=>VC(e.join("/")),WP=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),HP=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,VP=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function GP(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const GC=["post","put","patch","delete"];new Set(GC);const XP=["get",...GC];new Set(XP);/** * React Router v6.30.6 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function $u(){return $u=Object.assign?Object.assign.bind():function(e){for(var t=1;t{f.current=!0}),W.useCallback(function(p,x){if(x===void 0&&(x={}),!f.current)return;if(typeof p=="number"){r.go(p);return}let m=Wy(p,JSON.parse(u),o,x.relative==="path");e==null&&t!=="/"&&(m.pathname=m.pathname==="/"?t:wa([t,m.pathname])),(x.replace?r.replace:r.push)(m,x.state,x)},[t,r,u,o,e])}function qC(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=W.useContext(Na),{matches:i}=W.useContext(Ia),{pathname:o}=al(),u=JSON.stringify(zy(i,r.v7_relativeSplatPath));return W.useMemo(()=>Wy(e,JSON.parse(u),o,n==="path"),[e,u,o,n])}function ZP(e,t){return QP(e,t)}function QP(e,t,n,r){il()||Gt(!1);let{navigator:i}=W.useContext(Na),{matches:o}=W.useContext(Ia),u=o[o.length-1],f=u?u.params:{};u&&u.pathname;let h=u?u.pathnameBase:"/";u&&u.route;let p=al(),x;if(t){var m;let N=typeof t=="string"?rl(t):t;h==="/"||(m=N.pathname)!=null&&m.startsWith(h)||Gt(!1),x=N}else x=p;let w=x.pathname||"/",A=w;if(h!=="/"){let N=h.replace(/^\//,"").split("/");A="/"+w.replace(/^\//,"").split("/").slice(N.length).join("/")}let _=OP(e,{pathname:A}),T=r6(_&&_.map(N=>Object.assign({},N,{params:Object.assign({},f,N.params),pathname:wa([h,i.encodeLocation?i.encodeLocation(N.pathname).pathname:N.pathname]),pathnameBase:N.pathnameBase==="/"?h:wa([h,i.encodeLocation?i.encodeLocation(N.pathnameBase).pathname:N.pathnameBase])})),o,n,r);return t&&T?W.createElement(Xh.Provider,{value:{location:$u({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:ca.Pop}},T):T}function JP(){let e=s6(),t=GP(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,i={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return W.createElement(W.Fragment,null,W.createElement("h2",null,"Unexpected Application Error!"),W.createElement("h3",{style:{fontStyle:"italic"}},t),n?W.createElement("pre",{style:i},n):null,null)}const e6=W.createElement(JP,null);class t6 extends W.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?W.createElement(Ia.Provider,{value:this.props.routeContext},W.createElement(XC.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function n6(e){let{routeContext:t,match:n,children:r}=e,i=W.useContext(Hy);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),W.createElement(Ia.Provider,{value:t},r)}function r6(e,t,n,r){var i;if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=r)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let u=e,f=(i=n)==null?void 0:i.errors;if(f!=null){let x=u.findIndex(m=>m.route.id&&(f==null?void 0:f[m.route.id])!==void 0);x>=0||Gt(!1),u=u.slice(0,Math.min(u.length,x+1))}let h=!1,p=-1;if(n&&r&&r.v7_partialHydration)for(let x=0;x=0?u=u.slice(0,p+1):u=[u[0]];break}}}return u.reduceRight((x,m,w)=>{let A,_=!1,T=null,N=null;n&&(A=f&&m.route.id?f[m.route.id]:void 0,T=m.route.errorElement||e6,h&&(p<0&&w===0?(u6("route-fallback"),_=!0,N=null):p===w&&(_=!0,N=m.route.hydrateFallbackElement||null)));let E=t.concat(u.slice(0,w+1)),C=()=>{let O;return A?O=T:_?O=N:m.route.Component?O=W.createElement(m.route.Component,null):m.route.element?O=m.route.element:O=x,W.createElement(n6,{match:m,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:O})};return n&&(m.route.ErrorBoundary||m.route.errorElement||w===0)?W.createElement(t6,{location:n.location,revalidation:n.revalidation,component:T,error:A,children:C(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):C()},null)}var KC=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(KC||{}),ZC=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(ZC||{});function i6(e){let t=W.useContext(Hy);return t||Gt(!1),t}function a6(e){let t=W.useContext(YP);return t||Gt(!1),t}function o6(e){let t=W.useContext(Ia);return t||Gt(!1),t}function QC(e){let t=o6(),n=t.matches[t.matches.length-1];return n.route.id||Gt(!1),n.route.id}function s6(){var e;let t=W.useContext(XC),n=a6(),r=QC();return t!==void 0?t:(e=n.errors)==null?void 0:e[r]}function l6(){let{router:e}=i6(KC.UseNavigateStable),t=QC(ZC.UseNavigateStable),n=W.useRef(!1);return YC(()=>{n.current=!0}),W.useCallback(function(i,o){o===void 0&&(o={}),n.current&&(typeof i=="number"?e.navigate(i):e.navigate(i,$u({fromRouteId:t},o)))},[e,t])}const U2={};function u6(e,t,n){U2[e]||(U2[e]=!0)}function c6(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function fg(e){let{to:t,replace:n,state:r,relative:i}=e;il()||Gt(!1);let{future:o,static:u}=W.useContext(Na),{matches:f}=W.useContext(Ia),{pathname:h}=al(),p=Yh(),x=Wy(t,zy(f,o.v7_relativeSplatPath),h,i==="path"),m=JSON.stringify(x);return W.useEffect(()=>p(JSON.parse(m),{replace:n,state:r,relative:i}),[p,m,i,n,r]),null}function ir(e){Gt(!1)}function f6(e){let{basename:t="/",children:n=null,location:r,navigationType:i=ca.Pop,navigator:o,static:u=!1,future:f}=e;il()&&Gt(!1);let h=t.replace(/^\/*/,"/"),p=W.useMemo(()=>({basename:h,navigator:o,static:u,future:$u({v7_relativeSplatPath:!1},f)}),[h,f,o,u]);typeof r=="string"&&(r=rl(r));let{pathname:x="/",search:m="",hash:w="",state:A=null,key:_="default"}=r,T=W.useMemo(()=>{let N=Uy(x,h);return N==null?null:{location:{pathname:N,search:m,hash:w,state:A,key:_},navigationType:i}},[h,x,m,w,A,_,i]);return T==null?null:W.createElement(Na.Provider,{value:p},W.createElement(Xh.Provider,{children:n,value:T}))}function d6(e){let{children:t,location:n}=e;return ZP(dg(t),n)}new Promise(()=>{});function dg(e,t){t===void 0&&(t=[]);let n=[];return W.Children.forEach(e,(r,i)=>{if(!W.isValidElement(r))return;let o=[...t,i];if(r.type===W.Fragment){n.push.apply(n,dg(r.props.children,o));return}r.type!==ir&&Gt(!1),!r.props.index||!r.props.children||Gt(!1);let u={id:r.props.id||o.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(u.children=dg(r.props.children,o)),n.push(u)}),n}/** * React Router DOM v6.30.6 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function hg(){return hg=Object.assign?Object.assign.bind():function(e){for(var t=1;t{p&&z2?z2(()=>h(m)):h(m)},[h,p]);return W.useLayoutEffect(()=>u.listen(x),[u,x]),W.useEffect(()=>c6(r),[r]),W.createElement(f6,{basename:t,children:n,location:f.location,navigationType:f.action,navigator:u,future:r})}const w6=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",b6=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,W2=W.forwardRef(function(t,n){let{onClick:r,relative:i,reloadDocument:o,replace:u,state:f,target:h,to:p,preventScrollReset:x,viewTransition:m}=t,w=h6(t,m6),{basename:A}=W.useContext(Na),_,T=!1;if(typeof p=="string"&&b6.test(p)&&(_=p,w6))try{let O=new URL(window.location.href),M=p.startsWith("//")?new URL(O.protocol+p):new URL(p),P=Uy(M.pathname,A);M.origin===O.origin&&P!=null?p=P+M.search+M.hash:T=!0}catch{}let N=qP(p,{relative:i}),E=A6(p,{replace:u,state:f,target:h,preventScrollReset:x,relative:i,viewTransition:m});function C(O){r&&r(O),O.defaultPrevented||E(O)}return W.createElement("a",hg({},w,{href:_||N,onClick:T||o?r:C,ref:n,target:h}))});var H2;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(H2||(H2={}));var V2;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(V2||(V2={}));function A6(e,t){let{target:n,replace:r,state:i,preventScrollReset:o,relative:u,viewTransition:f}=t===void 0?{}:t,h=Yh(),p=al(),x=qC(e,{relative:u});return W.useCallback(m=>{if(g6(m,n)){m.preventDefault();let w=r!==void 0?r:wd(p)===wd(x);h(e,{replace:w,state:i,preventScrollReset:o,relative:u,viewTransition:f})}},[p,h,x,r,i,n,e,o,u,f])}const G2=e=>{let t;const n=new Set,r=(p,x)=>{const m=typeof p=="function"?p(t):p;if(!Object.is(m,t)){const w=t;t=x??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(A=>A(t,w))}},i=()=>t,f={setState:r,getState:i,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=t=e(r,i,f);return f},S6=e=>e?G2(e):G2,E6=e=>e;function C6(e,t=E6){const n=Y.useSyncExternalStore(e.subscribe,Y.useCallback(()=>t(e.getState()),[e,t]),Y.useCallback(()=>t(e.getInitialState()),[e,t]));return Y.useDebugValue(n),n}const X2=e=>{const t=S6(e),n=r=>C6(t,r);return Object.assign(n,t),n},JC=e=>e?X2(e):X2;function O6(e,t){let n;try{n=e()}catch{return}return{getItem:i=>{var o;const u=h=>h===null?null:JSON.parse(h,void 0),f=(o=n.getItem(i))!=null?o:null;return f instanceof Promise?f.then(u):u(f)},setItem:(i,o)=>n.setItem(i,JSON.stringify(o,void 0)),removeItem:i=>n.removeItem(i)}}const pg=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(r){return pg(r)(n)},catch(r){return this}}}catch(n){return{then(r){return this},catch(r){return pg(r)(n)}}}},_6=(e,t)=>(n,r,i)=>{let o={storage:O6(()=>window.localStorage),partialize:N=>N,version:0,merge:(N,E)=>({...E,...N}),...t},u=!1,f=0;const h=new Set,p=new Set;let x=o.storage;if(!x)return e((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...N)},r,i);const m=()=>{const N=o.partialize({...r()});return x.setItem(o.name,{state:N,version:o.version})},w=i.setState;i.setState=(N,E)=>(w(N,E),m());const A=e((...N)=>(n(...N),m()),r,i);i.getInitialState=()=>A;let _;const T=()=>{var N,E;if(!x)return;const C=++f;u=!1,h.forEach(M=>{var P;return M((P=r())!=null?P:A)});const O=((E=o.onRehydrateStorage)==null?void 0:E.call(o,(N=r())!=null?N:A))||void 0;return pg(x.getItem.bind(x))(o.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==o.version){if(o.migrate){const P=o.migrate(M.state,M.version);return P instanceof Promise?P.then(I=>[!0,I]):[!0,P]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,M.state];return[!1,void 0]}).then(M=>{var P;if(C!==f)return;const[I,k]=M;if(_=o.merge(k,(P=r())!=null?P:A),n(_,!0),I)return m()}).then(()=>{C===f&&(O==null||O(r(),void 0),_=r(),u=!0,p.forEach(M=>M(_)))}).catch(M=>{C===f&&(O==null||O(void 0,M))})};return i.persist={setOptions:N=>{o={...o,...N},N.storage&&(x=N.storage)},clearStorage:()=>{++f,x==null||x.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>T(),hasHydrated:()=>u,onHydrate:N=>(h.add(N),()=>{h.delete(N)}),onFinishHydration:N=>(p.add(N),()=>{p.delete(N)})},o.skipHydration||T(),_||A},T6=_6;function eO(e,t){return function(){return e.apply(t,arguments)}}const{toString:N6}=Object.prototype,{getPrototypeOf:Ca}=Object,{iterator:Ic,toStringTag:tO}=Symbol,Uu=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),nO=e=>typeof e=="string"&&(e==="__proto__"||e==="constructor"||e==="prototype"),rO=(e,t,n)=>e===Object.prototype||!n&&t===null,I6=e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every(n=>{if(nO(n))return!1;const r=Object.getOwnPropertyDescriptor(e,n);return!!r&&r.configurable&&r.writable===!0})},zu=(e,t)=>{let n=e;const r=[];for(;n!=null;){if(r.indexOf(n)!==-1)return!1;r.push(n);const i=Ca(n);if(rO(n,i,n===e))return!1;if(Uu(n,t))return!0;n=i}return!1},P6=(e,t)=>e!=null&&zu(e,t)?e[t]:void 0,R6=e=>{if(e==null||typeof e!="object"&&typeof e!="function")return e;const t=Ca(e);if(t===null&&I6(e))return e;const n=Object.create(null),r=Object.create(null),i=[];let o=e;for(;o!=null&&i.indexOf(o)===-1;){i.push(o);const u=o===e?t:Ca(o);if(rO(o,u,o===e))break;const f=Object.getOwnPropertyNames(o);Object.getOwnPropertySymbols&&f.push(...Object.getOwnPropertySymbols(o));for(const h of f)nO(h)||Uu(r,h)||(n[h]=e[h],r[h]=!0);o=u}return n},Vy=(e=>t=>{const n=N6.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),Dr=e=>(e=e.toLowerCase(),t=>Vy(t)===e),qh=e=>t=>typeof t===e,{isArray:mo}=Array,yo=qh("undefined");function ol(e){return e!==null&&!yo(e)&&e.constructor!==null&&!yo(e.constructor)&&tr(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const iO=Dr("ArrayBuffer");function M6(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&iO(e.buffer),t}const k6=qh("string"),tr=qh("function"),aO=qh("number"),sl=e=>e!==null&&typeof e=="object",D6=e=>e===!0||e===!1,Vf=e=>{if(!sl(e))return!1;const t=Ca(e);return(t===null||t===Object.prototype||Ca(t)===null)&&!zu(e,tO)&&!zu(e,Ic)},j6=e=>{if(!sl(e)||ol(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},L6=Dr("Date"),B6=Dr("File"),F6=e=>!!(e&&typeof e.uri<"u"),$6=e=>e&&typeof e.getParts<"u",U6=Dr("Blob"),z6=Dr("FileList"),W6=Dr("Set"),H6=e=>sl(e)&&tr(e.pipe);function V6(){return typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}}const Y2=V6(),q2=typeof Y2.FormData<"u"?Y2.FormData:void 0,G6=e=>{if(!e)return!1;if(q2&&e instanceof q2)return!0;const t=Ca(e);if(!t||t===Object.prototype||!tr(e.append))return!1;const n=Vy(e);return n==="formdata"||n==="object"&&tr(e.toString)&&e.toString()==="[object FormData]"},X6=Dr("URLSearchParams"),[Y6,q6,K6,Z6]=["ReadableStream","Request","Response","Headers"].map(Dr),Q6=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function Pc(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,i;if(typeof e!="object"&&(e=[e]),mo(e))for(r=0,i=e.length;r0;)if(i=n[r],t===i.toLowerCase())return i;return null}const Ja=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,sO=e=>!yo(e)&&e!==Ja;function gg(...e){const{caseless:t,skipUndefined:n}=sO(this)&&this||{},r={},i=(o,u)=>{if(u==="__proto__"||u==="constructor"||u==="prototype")return;const f=t&&typeof u=="string"&&oO(r,u)||u,h=Uu(r,f)?r[f]:void 0;Vf(h)&&Vf(o)?r[f]=gg(h,o):Vf(o)?r[f]=gg({},o):mo(o)?r[f]=o.slice():(!n||!yo(o))&&(r[f]=o)};for(let o=0,u=e.length;o(Pc(t,(i,o)=>{n&&tr(i)?Object.defineProperty(e,o,{__proto__:null,value:eO(i,n),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{__proto__:null,value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:r}),e),eR=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),tR=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),n&&Object.assign(e.prototype,n)},nR=(e,t,n,r)=>{let i,o,u;const f={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)u=i[o],(!r||r(u,e,t))&&!f[u]&&(t[u]=e[u],f[u]=!0);e=n!==!1&&Ca(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},rR=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},iR=e=>{if(!e)return null;if(mo(e))return e;let t=e.length;if(!aO(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},aR=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Ca(Uint8Array)),oR=(e,t)=>{const r=(e&&e[Ic]).call(e);let i;for(;(i=r.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},sR=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},lR=Dr("HTMLFormElement"),uR=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,i){return r.toUpperCase()+i}),{propertyIsEnumerable:cR}=Object.prototype,fR=Dr("RegExp"),lO=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};Pc(n,(i,o)=>{let u;(u=t(i,o,e))!==!1&&(r[o]=u||i)}),Object.defineProperties(e,r)},dR=e=>{lO(e,(t,n)=>{if(tr(e)&&["arguments","caller","callee"].includes(n))return!1;const r=e[n];if(tr(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},hR=(e,t)=>{const n={},r=i=>{i.forEach(o=>{n[o]=!0})};return mo(e)?r(e):r(String(e).split(t)),n},pR=()=>{},gR=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function mR(e){return!!(e&&tr(e.append)&&e[tO]==="FormData"&&e[Ic])}const yR=e=>{const t=new WeakSet,n=r=>{if(sl(r)){if(t.has(r))return;if(ol(r))return r;if(!("toJSON"in r)){t.add(r);let i;if(W6(r)){i=[];for(const o of r){const u=n(o);!yo(u)&&i.push(u)}}else i=mo(r)?[]:{},Pc(r,(o,u)=>{const f=n(o);!yo(f)&&(i[u]=f)});return t.delete(r),i}}return r};return n(e)},xR=Dr("AsyncFunction"),vR=e=>e&&(sl(e)||tr(e))&&tr(e.then)&&tr(e.catch),uO=((e,t)=>e?setImmediate:t?((n,r)=>(Ja.addEventListener("message",({source:i,data:o})=>{i===Ja&&o===n&&r.length&&r.shift()()},!1),i=>{r.push(i),Ja.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",tr(Ja.postMessage)),wR=typeof queueMicrotask<"u"?queueMicrotask.bind(Ja):typeof process<"u"&&process.nextTick||uO,cO=e=>e!=null&&tr(e[Ic]),bR=e=>e!=null&&zu(e,Ic)&&cO(e),X={isArray:mo,isArrayBuffer:iO,isBuffer:ol,isFormData:G6,isArrayBufferView:M6,isString:k6,isNumber:aO,isBoolean:D6,isObject:sl,isPlainObject:Vf,isEmptyObject:j6,isReadableStream:Y6,isRequest:q6,isResponse:K6,isHeaders:Z6,isUndefined:yo,isDate:L6,isFile:B6,isReactNativeBlob:F6,isReactNative:$6,isBlob:U6,isRegExp:fR,isFunction:tr,isStream:H6,isURLSearchParams:X6,isTypedArray:aR,isFileList:z6,forEach:Pc,merge:gg,extend:J6,trim:Q6,stripBOM:eR,inherits:tR,toFlatObject:nR,kindOf:Vy,kindOfTest:Dr,endsWith:rR,toArray:iR,forEachEntry:oR,matchAll:sR,isHTMLForm:lR,hasOwnProperty:Uu,hasOwnProp:Uu,hasOwnInPrototypeChain:zu,getSafeProp:P6,toSafeFlatObject:R6,reduceDescriptors:lO,freezeMethods:dR,toObjectSet:hR,toCamelCase:uR,noop:pR,toFiniteNumber:gR,findKey:oO,global:Ja,isContextDefined:sO,isSpecCompliantForm:mR,toJSONObject:yR,isAsyncFn:xR,isThenable:vR,setImmediate:uO,asap:wR,isIterable:cO,isSafeIterable:bR},AR=X.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),SR=e=>{const t={};let n,r,i;return e&&e.split(` `).forEach(function(u){i=u.indexOf(":"),n=u.substring(0,i).trim().toLowerCase(),r=u.substring(i+1).trim();const f=X.hasOwnProp(t,n);!n||f&&X.hasOwnProp(AR,n)||(n==="set-cookie"?f?t[n].push(r):t[n]=[r]:t[n]=f?t[n]+", "+r:r)}),t};function ER(e){let t=0,n=e.length;for(;tt;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}const CR=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),OR=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function Gy(e,t){return X.isArray(e)?e.map(n=>Gy(n,t)):ER(String(e).replace(t,""))}const _R=e=>Gy(e,CR),TR=e=>Gy(e,OR);function fO(e){const t=Object.create(null);return X.forEach(e.toJSON(),(n,r)=>{t[r]=TR(n)}),t}const K2=Symbol("internals");function Fl(e){return e&&String(e).trim().toLowerCase()}function Gf(e){return e===!1||e==null?e:X.isArray(e)?e.map(Gf):_R(String(e))}function NR(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const IR=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function k1(e){let t=0,n=e.length;for(;tt;){const r=e.charCodeAt(n-1);if(r!==9&&r!==32)break;n-=1}return t===0&&n===e.length?e:e.slice(t,n)}function PR(e){const t=e.length-1;if(t<1||e.charCodeAt(0)!==34||e.charCodeAt(t)!==34)return e;let n="";for(let r=1;r=t))return e;n+=e[r]}return n}function RR(e){const t=Object.create(null),n=String(e);let r=0,i=!1,o=!1;function u(f){const h=k1(n.slice(r,f)),p=h.indexOf("=");if(p<1)return;const x=k1(h.slice(0,p));if(!IR.test(x))return;const m=x.toLowerCase();if(m==="__proto__"||m==="constructor"||m==="prototype")return;const w=k1(h.slice(p+1));t[m]=PR(w)}for(let f=0;f/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function D1(e,t,n,r,i){if(X.isFunction(r))return r.call(this,t,n);if(i&&(t=n),!!X.isString(t)){if(X.isString(r))return t.indexOf(r)!==-1;if(X.isRegExp(r))return r.test(t)}}function kR(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function DR(e,t){const n=X.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{__proto__:null,value:function(i,o,u){return this[r].call(this,t,i,o,u)},configurable:!0})})}let kn=class{constructor(t){t&&this.set(t)}set(t,n,r){const i=this;function o(f,h,p){const x=Fl(h);if(!x)return;const m=X.findKey(i,x);(!m||i[m]===void 0||p===!0||p===void 0&&i[m]!==!1)&&(i[m||h]=Gf(f))}const u=(f,h)=>X.forEach(f,(p,x)=>o(p,x,h));if(X.isPlainObject(t)||t instanceof this.constructor)u(t,n);else if(X.isString(t)&&(t=t.trim())&&!MR(t))u(SR(t),n);else if(X.isObject(t)&&X.isSafeIterable(t)){let f=Object.create(null),h,p;for(const x of t){if(!X.isArray(x))throw new TypeError("Object iterator must return a key-value pair");p=x[0],X.hasOwnProp(f,p)?(h=f[p],f[p]=X.isArray(h)?[...h,x[1]]:[h,x[1]]):f[p]=x[1]}u(f,n)}else t!=null&&o(n,t,r);return this}get(t,n){if(t=Fl(t),t){const r=X.findKey(this,t);if(r){const i=this[r];if(!n)return i;if(n===!0)return NR(i);if(X.isFunction(n))return n.call(this,i,r);if(X.isRegExp(n))return n.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Fl(t),t){const r=X.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||D1(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let i=!1;function o(u){if(u=Fl(u),u){const f=X.findKey(r,u);f&&(!n||D1(r,r[f],f,n))&&(delete r[f],i=!0)}}return X.isArray(t)?t.forEach(o):o(t),i}clear(t){const n=Object.keys(this);let r=n.length,i=!1;for(;r--;){const o=n[r];(!t||D1(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const n=this,r={};return X.forEach(this,(i,o)=>{const u=X.findKey(r,o);if(u){n[u]=Gf(i),delete n[o];return}const f=t?kR(o):String(o).trim();f!==o&&delete n[o],n[f]=Gf(i),r[f]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return X.forEach(this,(r,i)=>{r!=null&&r!==!1&&(n[i]=t&&X.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}getSetCookie(){const t=this.get("set-cookie");return X.isArray(t)?t:t==null||t===!1?[]:[t]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static parseParameters(t){return RR(t)}static concat(t,...n){const r=new this(t);return n.forEach(i=>r.set(i)),r}static accessor(t){const r=(this[K2]=this[K2]={accessors:{}}).accessors,i=this.prototype;function o(u){const f=Fl(u);r[f]||(DR(i,u),r[f]=!0)}return X.isArray(t)?t.forEach(o):o(t),this}};kn.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);X.reduceDescriptors(kn.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});X.freezeMethods(kn);const bd="[REDACTED ****]";function jR(e){if(X.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(X.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}function LR(e,t){const n=new Set(t.map(o=>String(o).toLowerCase())),r=[],i=o=>{if(o===null||typeof o!="object"||X.isBuffer(o))return o;if(r.indexOf(o)!==-1)return;o instanceof kn&&(o=o.toJSON()),r.push(o);let u;if(X.isArray(o))u=[],o.forEach((f,h)=>{const p=i(f);X.isUndefined(p)||(u[h]=p)});else{if(!X.isPlainObject(o)&&jR(o))return r.pop(),o;u=Object.create(null);for(const[f,h]of Object.entries(o)){const p=n.has(f.toLowerCase())?bd:i(h);X.isUndefined(p)||(u[f]=p)}}return r.pop(),u};return i(e)}function Z2(e){try{return String(e)}catch{return""}}function BR(e){return e.errors.map(n=>{try{return n&&n.message?Z2(n.message):Z2(n)}catch{return""}}).filter(Boolean).join("; ")||e.name||"AggregateError"}let Ae=class dO extends Error{static from(t,n,r,i,o,u){let f=t.message;!f&&X.isArray(t.errors)&&t.errors.length&&(f=BR(t));const h=new dO(f,n||t.code,r,i,o);return Object.defineProperty(h,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),h.name=t.name,t.status!=null&&h.status==null&&(h.status=t.status),u&&Object.assign(h,u),h}constructor(t,n,r,i,o){super(t),Object.defineProperty(this,"message",{__proto__:null,value:t,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,n&&(this.code=n),r&&(this.config=r),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){const t=this.config,n=t&&X.hasOwnProp(t,"redact")?t.redact:void 0,r=X.isArray(n)&&n.length>0?LR(t,n):X.toJSONObject(t);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}};Ae.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";Ae.ERR_BAD_OPTION="ERR_BAD_OPTION";Ae.ECONNABORTED="ECONNABORTED";Ae.ETIMEDOUT="ETIMEDOUT";Ae.ECONNREFUSED="ECONNREFUSED";Ae.ERR_NETWORK="ERR_NETWORK";Ae.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";Ae.ERR_DEPRECATED="ERR_DEPRECATED";Ae.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";Ae.ERR_BAD_REQUEST="ERR_BAD_REQUEST";Ae.ERR_CANCELED="ERR_CANCELED";Ae.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";Ae.ERR_INVALID_URL="ERR_INVALID_URL";Ae.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";const FR=null,hO=100;function mg(e){return X.isPlainObject(e)||X.isArray(e)}function pO(e){return X.endsWith(e,"[]")?e.slice(0,-2):e}function j1(e,t,n){return e?e.concat(t).map(function(i,o){return i=pO(i),!n&&o?"["+i+"]":i}).join(n?".":""):t}function $R(e){return X.isArray(e)&&!e.some(mg)}const UR=X.toFlatObject(X,{},null,function(t){return/^is[A-Z]/.test(t)});function Kh(e,t,n){if(!X.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const r=(C,O)=>{const M=X.getSafeProp(n,C);return X.isUndefined(M)?O:M},i=r("metaTokens",!0),o=r("visitor")||T,u=r("dots",!1),f=r("indexes",!1),h=r("Blob")||typeof Blob<"u"&&Blob,p=r("maxDepth",hO),x=h&&X.isSpecCompliantForm(t),m=[];if(!X.isFunction(o))throw new TypeError("visitor must be a function");function w(C){if(C===null)return"";if(X.isDate(C))return C.toISOString();if(X.isBoolean(C))return C.toString();if(!x&&X.isBlob(C))throw new Ae("Blob is not supported. Use a Buffer instead.");if(X.isArrayBuffer(C)||X.isTypedArray(C)){if(x&&typeof h=="function")return new h([C]);throw new Ae("Blob is not supported. Use a Buffer instead.",Ae.ERR_NOT_SUPPORT)}return C}function A(C){if(C>p)throw new Ae("Object is too deeply nested ("+C+" levels). Max depth: "+p,Ae.ERR_FORM_DATA_DEPTH_EXCEEDED)}function _(C,O){if(p===1/0)return JSON.stringify(C);const M=[];return JSON.stringify(C,function(I,k){if(!X.isObject(k))return k;for(;M.length&&M[M.length-1]!==this;)M.pop();return M.push(k),A(O+M.length-1),k})}function T(C,O,M){let P=C;if(X.isReactNative(t)&&X.isReactNativeBlob(C))return t.append(j1(M,O,u),w(C)),!1;if(C&&!M&&typeof C=="object"){if(X.endsWith(O,"{}"))O=i?O:O.slice(0,-2),C=_(C,1);else if(X.isArray(C)&&$R(C)||(X.isFileList(C)||X.endsWith(O,"[]"))&&(P=X.toArray(C)))return O=pO(O),P.forEach(function(k,B){!(X.isUndefined(k)||k===null)&&t.append(f===!0?j1([O],B,u):f===null?O:O+"[]",w(k))}),!1}return mg(C)?!0:(t.append(j1(M,O,u),w(C)),!1)}const N=Object.assign(UR,{defaultVisitor:T,convertValue:w,isVisitable:mg});function E(C,O,M=0){if(!X.isUndefined(C)){if(A(M),m.indexOf(C)!==-1)throw new Error("Circular reference detected in "+O.join("."));m.push(C),X.forEach(C,function(I,k){(!(X.isUndefined(I)||I===null)&&o.call(t,I,X.isString(k)?k.trim():k,O,N))===!0&&E(I,O?O.concat(k):[k],M+1)}),m.pop()}}if(!X.isObject(e))throw new TypeError("data must be an object");return E(e),t}function Q2(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,function(r){return t[r]})}function Xy(e,t){this._pairs=[],e&&Kh(e,this,t)}const gO=Xy.prototype;gO.append=function(t,n){this._pairs.push([t,n])};gO.toString=function(t){const n=t?r=>t.call(this,r,Q2):Q2;return this._pairs.map(function(i){return n(i[0])+"="+n(i[1])},"").join("&")};function zR(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function mO(e,t,n){if(!t)return e;e=e||"";const r=X.isFunction(n)?{serialize:n}:n,i=X.getSafeProp(r,"encode")||zR,o=X.getSafeProp(r,"serialize");let u;if(o?u=o(t,r):u=X.isURLSearchParams(t)?t.toString():new Xy(t,r).toString(i),u){const f=e.indexOf("#");f!==-1&&(e=e.slice(0,f)),e+=(e.indexOf("?")===-1?"?":"&")+u}return e}const $l=Symbol("internals");function yO(e){return e?e.length:0}function J2(e){if(e)for(;e.length&&e[e.length-1]===null;)e.pop()}function Ul(e,t){const n=e.handlers,r=yO(n);n!==t.handlersRef?(t.handlersRef=n,t.handlerEntries.clear()):r!==t.handlersLength&&(r?t.handlerEntries.forEach(function(o,u){n[o.index]!==o.handler&&t.handlerEntries.delete(u)}):t.handlerEntries.clear()),t.handlersLength=r}class ew{constructor(){this.handlers=[],this[$l]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(t,n,r){const i={fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null},o=this[$l];this.handlers==null&&(this.handlers=[]),Ul(this,o);const u=o.nextId++;return this.handlers.push(i),o.handlerEntries.set(u,{handler:i,index:this.handlers.length-1}),o.handlersLength=this.handlers.length,u}eject(t){const n=this[$l];Ul(this,n);const r=n.handlerEntries.get(t);if(r){if(n.handlerEntries.delete(t),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,n.iterationDepth||(J2(this.handlers),n.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Ul(this,this[$l]))}forEach(t){const n=this[$l];Ul(this,n),n.iterationDepth++;try{X.forEach(this.handlers,function(i){i!==null&&t(i)})}finally{--n.iterationDepth||(Ul(this,n),J2(this.handlers),n.handlersLength=yO(this.handlers))}}}const Yy={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},WR=typeof URLSearchParams<"u"?URLSearchParams:Xy,HR=typeof FormData<"u"?FormData:null,VR=typeof Blob<"u"?Blob:null,GR={isBrowser:!0,classes:{URLSearchParams:WR,FormData:HR,Blob:VR},protocols:["http","https","file","blob","url","data"]},qy=typeof window<"u"&&typeof document<"u",yg=typeof navigator=="object"&&navigator||void 0,XR=qy&&(!yg||["ReactNative","NativeScript","NS"].indexOf(yg.product)<0),YR=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",qR=qy&&window.location.href||"http://localhost",KR=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:qy,hasStandardBrowserEnv:XR,hasStandardBrowserWebWorkerEnv:YR,navigator:yg,origin:qR},Symbol.toStringTag,{value:"Module"})),pn={...KR,...GR};function ZR(e,t){return Kh(e,new pn.classes.URLSearchParams,{visitor:function(n,r,i,o){return pn.isNode&&X.isBuffer(n)?(this.append(r,n.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}const tw=hO;function xO(e){if(e>tw)throw new Ae("FormData field is too deeply nested ("+e+" levels). Max depth: "+tw,Ae.ERR_FORM_DATA_DEPTH_EXCEEDED)}function QR(e){const t=[],n=/[^.[\]]+|\[([^.[\]]*)]/g;let r;for(;(r=n.exec(e))!==null;)xO(t.length),t.push(r[0]==="[]"?"":r[1]||r[0]);return t}function JR(e){const t={},n=Object.keys(e);let r;const i=n.length;let o;for(r=0;r=n.length;return u=!u&&X.isArray(i)?i.length:u,h?(X.hasOwnProp(i,u)?i[u]=X.isArray(i[u])?i[u].concat(r):[i[u],r]:i[u]=r,!f):((!X.hasOwnProp(i,u)||!X.isObject(i[u]))&&(i[u]=[]),t(n,r,i[u],o)&&X.isArray(i[u])&&(i[u]=JR(i[u])),!f)}if(X.isFormData(e)&&X.isFunction(e.entries)){const n={};return X.forEachEntry(e,(r,i)=>{t(QR(r),i,n,0)}),n}return null}const wO=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]),Vo=(e,t)=>e!=null&&X.hasOwnProp(e,t)?e[t]:void 0;function eM(e,t,n){if(X.isString(e))try{return(t||JSON.parse)(e),X.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const Rc={transitional:Yy,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",i=r.indexOf("application/json")>-1,o=X.isObject(t);if(o&&X.isHTMLForm(t)&&(t=new FormData(t)),X.isFormData(t))return i?JSON.stringify(vO(t)):t;if(X.isArrayBuffer(t)||X.isBuffer(t)||X.isStream(t)||X.isFile(t)||X.isBlob(t)||X.isReadableStream(t))return t;if(X.isArrayBufferView(t))return t.buffer;if(X.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let f;if(o){const h=Vo(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return ZR(t,h).toString();if((f=X.isFileList(t))||r.indexOf("multipart/form-data")>-1){const p=Vo(this,"env"),x=p&&p.FormData;return Kh(f?{"files[]":t}:t,x&&new x,h)}}return o||i?(n.setContentType("application/json",!1),eM(t)):t}],transformResponse:[function(t){const n=Vo(this,"transitional")||Rc.transitional,r=n&&n.forcedJSONParsing,i=Vo(this,"responseType"),o=i==="json";if(X.isResponse(t)||X.isReadableStream(t))return t;if(t&&X.isString(t)&&(r&&!i||o)){const f=!(n&&n.silentJSONParsing)&&o;try{return JSON.parse(t,Vo(this,"parseReviver"))}catch(h){if(f)throw h.name==="SyntaxError"?Ae.from(h,Ae.ERR_BAD_RESPONSE,this,null,Vo(this,"response")):h}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:pn.classes.FormData,Blob:pn.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};X.forEach(wO,e=>{Rc.headers[e]={}});function L1(e,t){const n=this||Rc,r=t||n,i=kn.from(r.headers);let o=r.data;return X.forEach(e,function(f){o=f.call(n,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function bO(e){return!!(e&&e.__CANCEL__)}let Mc=class extends Ae{constructor(t,n,r){super(t??"canceled",Ae.ERR_CANCELED,n,r),this.name="CanceledError",this.__CANCEL__=!0}};function AO(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new Ae("Request failed with status code "+n.status,n.status>=400&&n.status<500?Ae.ERR_BAD_REQUEST:Ae.ERR_BAD_RESPONSE,n.config,n.request,n))}const tM=/[\t\n\r]/g;function SO(e){if(typeof e!="string")return e;let t=0;for(;t{n=m,i=null,o&&(clearTimeout(o),o=null),e(...x)};return[(...x)=>{const m=Date.now(),w=m-n;w>=r?u(x,m):(i=x,o||(o=setTimeout(()=>{o=null,u(i)},r-w)))},()=>i&&u(i),(...x)=>u(x)]}const Ad=(e,t,n=3)=>{let r=0;const i=nM(50,250);return rM(o=>{if(!o||!X.isNumber(o.loaded))return;const u=o.loaded,f=o.lengthComputable?o.total:void 0,h=Math.max(0,f!=null?Math.min(u,f):u),p=Math.max(0,h-r),x=i(p);r=Math.max(r,h);const m={loaded:h,total:f,progress:f?h/f:void 0,bytes:p,rate:x||void 0,estimated:x&&f?(f-h)/x:void 0,event:o,lengthComputable:f!=null,[t?"download":"upload"]:!0};e(m)},n)},nw=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},rw=(e,t=X.asap)=>(...n)=>t(()=>e(...n)),iM=pn.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,pn.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(pn.origin),pn.navigator&&/(msie|trident)/i.test(pn.navigator.userAgent)):()=>!0,aM=pn.hasStandardBrowserEnv?{write(e,t,n,r,i,o,u){if(typeof document>"u")return;const f=[`${e}=${encodeURIComponent(t)}`];X.isNumber(n)&&f.push(`expires=${new Date(n).toUTCString()}`),X.isString(r)&&f.push(`path=${r}`),X.isString(i)&&f.push(`domain=${i}`),o===!0&&f.push("secure"),X.isString(u)&&f.push(`SameSite=${u}`),document.cookie=f.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.split(";");for(let n=0;n0&&e.charCodeAt(n-1)===47;)n--;return e.slice(0,n)+"/"+t.replace(/^\/+/,"")}const lM=/^https?:(?!\/\/)/i;function uM(e){return e&&e.replace(/(^|&)([^=&]*=)?[^&]+/g,(t,n,r="")=>`${n}${r}${bd}`)}function cM(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${bd}@`),n=t.indexOf("#"),i=(n===-1?t:t.slice(0,n)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${bd}`);return n===-1?i:`${i}#${uM(t.slice(n+1))}`}function iw(e,t){if(typeof e=="string"){const n=SO(e);if(lM.test(n))throw new Ae(`Invalid URL ${JSON.stringify(cM(n))}: missing "//" after protocol`,Ae.ERR_INVALID_URL,t)}}function EO(e,t,n,r){iw(t,r);let i=!oM(t);return e&&(i||n===!1)?(iw(e,r),sM(e,t)):t}const aw=e=>e instanceof kn?{...e}:e,fM=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)):Object.keys(e);function xo(e,t){e=e||{},t=t||{};const n=Object.create(null);Object.defineProperty(n,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});function r(x,m,w,A){return X.isPlainObject(x)&&X.isPlainObject(m)?X.merge.call({caseless:A},x,m):X.isPlainObject(m)?X.merge({},m):X.isArray(m)?m.slice():m}function i(x,m,w,A){if(X.isUndefined(m)){if(!X.isUndefined(x))return r(void 0,x,w,A)}else return r(x,m,w,A)}function o(x,m){if(!X.isUndefined(m))return r(void 0,m)}function u(x,m){if(X.isUndefined(m)){if(!X.isUndefined(x))return r(void 0,x)}else return r(void 0,m)}function f(x){const m=X.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!X.isUndefined(m))if(X.isPlainObject(m)){if(X.hasOwnProp(m,x))return m[x]}else return;const w=X.hasOwnProp(e,"transitional")?e.transitional:void 0;if(X.isPlainObject(w)&&X.hasOwnProp(w,x))return w[x]}function h(x,m,w){if(X.hasOwnProp(t,w))return r(x,m);if(X.hasOwnProp(e,w))return r(void 0,x)}const p={url:o,method:o,data:o,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutErrorMessage:u,withCredentials:u,withXSRFToken:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,allowedSocketPaths:u,responseEncoding:u,validateStatus:h,headers:(x,m,w)=>i(aw(x),aw(m),w,!0)};return X.forEach(fM({...e,...t}),function(m){if(m==="__proto__"||m==="constructor"||m==="prototype")return;const w=X.hasOwnProp(p,m)?p[m]:i,A=X.hasOwnProp(e,m)?e[m]:void 0,_=X.hasOwnProp(t,m)?t[m]:void 0,T=w(A,_,m);X.isUndefined(T)&&w!==h||(n[m]=T)}),X.hasOwnProp(t,"validateStatus")&&X.isUndefined(t.validateStatus)&&f("validateStatusUndefinedResolves")===!1&&(X.hasOwnProp(e,"validateStatus")?n.validateStatus=r(void 0,e.validateStatus):delete n.validateStatus),n}const dM=["content-type","content-length"];function hM(e,t,n){if(n!=="content-only"){e.set(t);return}Object.entries(t||{}).forEach(([r,i])=>{dM.includes(r.toLowerCase())&&e.set(r,i)})}const pM=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16)));function CO(e){const t=xo({},e),n=w=>X.hasOwnProp(t,w)?t[w]:void 0,r=n("data");let i=n("withXSRFToken");const o=n("xsrfHeaderName"),u=n("xsrfCookieName");let f=n("headers");const h=n("auth"),p=n("baseURL"),x=n("allowAbsoluteUrls"),m=n("url");if(t.headers=f=kn.from(f),t.url=mO(EO(p,m,x,t),n("params"),n("paramsSerializer")),h){const w=X.getSafeProp(h,"username")||"",A=X.getSafeProp(h,"password")||"";try{f.set("Authorization","Basic "+btoa(w+":"+(A?pM(A):"")))}catch(_){throw Ae.from(_,Ae.ERR_BAD_OPTION_VALUE,e)}}if(X.isFormData(r)){const w=X.getSafeProp(r,"getHeaders");pn.hasStandardBrowserEnv||pn.hasStandardBrowserWebWorkerEnv||X.isReactNative(r)?f.setContentType(void 0):X.isFunction(w)&&hM(f,w.call(r),n("formDataHeaderPolicy"))}if(pn.hasStandardBrowserEnv&&(X.isFunction(i)&&(i=i(t)),i===!0||i==null&&iM(t.url))){const A=o&&u&&aM.read(u);A&&f.set(o,A)}return t}const gM=typeof XMLHttpRequest<"u",mM=gM&&function(e){return new Promise(function(n,r){const i=CO(e);let o=i.data;const u=kn.from(i.headers).normalize();let{responseType:f,onUploadProgress:h,onDownloadProgress:p}=i,x,m,w,A,_,T;function N(){A&&A(),_&&_(),i.cancelToken&&i.cancelToken.unsubscribe(x),i.signal&&i.signal.removeEventListener("abort",x)}let E=new XMLHttpRequest;E.open(i.method.toUpperCase(),i.url,!0),E.timeout=i.timeout;function C(M){if(!E)return;if(E.status===0&&(B1(SO(i.url))||B1(pn.origin))!=="file"&&!(E.responseURL&&E.responseURL.startsWith("file:"))){r(new Ae("Request aborted",Ae.ECONNABORTED,e,E)),N(),E=null;return}try{M?T&&T(M):_&&_()}catch(B){setTimeout(()=>{throw B})}if(!E)return;const P=kn.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders()),k={data:!f||f==="text"||f==="json"?E.responseText:E.response,status:E.status,statusText:E.statusText,headers:P,config:e,request:E};AO(function(F){n(F),N()},function(F){r(F),N()},k),E=null}"onloadend"in E?E.onloadend=C:E.onreadystatechange=function(){!E||E.readyState!==4||E.status===0&&!(E.responseURL&&E.responseURL.startsWith("file:"))||setTimeout(C)},E.onabort=function(){E&&(r(new Ae("Request aborted",Ae.ECONNABORTED,e,E)),N(),E=null)},E.onerror=function(P){const I=P&&P.message?P.message:"Network Error",k=new Ae(I,Ae.ERR_NETWORK,e,E);k.event=P||null,r(k),N(),E=null},E.ontimeout=function(){let P=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const I=i.transitional||Yy;i.timeoutErrorMessage&&(P=i.timeoutErrorMessage),r(new Ae(P,I.clarifyTimeoutError?Ae.ETIMEDOUT:Ae.ECONNABORTED,e,E)),N(),E=null},o===void 0&&u.setContentType(null),"setRequestHeader"in E&&X.forEach(fO(u),function(P,I){E.setRequestHeader(I,P)}),X.isUndefined(i.withCredentials)||(E.withCredentials=!!i.withCredentials),f&&f!=="json"&&(E.responseType=i.responseType),p&&([w,_,T]=Ad(p,!0),E.addEventListener("progress",w)),h&&E.upload&&([m,A]=Ad(h),E.upload.addEventListener("progress",m),E.upload.addEventListener("loadend",A)),(i.cancelToken||i.signal)&&(x=M=>{E&&(r(!M||M.type?new Mc(null,e,E):M),E.abort(),N(),E=null)},i.cancelToken&&i.cancelToken.subscribe(x),i.signal&&(i.signal.aborted?x():i.signal.addEventListener("abort",x)));const O=B1(i.url);if(O&&!pn.protocols.includes(O)){r(new Ae("Unsupported protocol "+O+":",Ae.ERR_BAD_REQUEST,e)),N();return}E.send(o||null)})},yM=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const n=new AbortController;let r=!1;const i=function(h){if(!r){r=!0,u();const p=h instanceof Error?h:this.reason;n.abort(p instanceof Ae?p:new Mc(p instanceof Error?p.message:p))}};let o=t&&setTimeout(()=>{o=null,i(new Ae(`timeout of ${t}ms exceeded`,Ae.ETIMEDOUT))},t);const u=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(h=>{h.unsubscribe?h.unsubscribe(i):h.removeEventListener("abort",i)}),e=null)};e.forEach(h=>{if(!r){if(h.aborted){i.call(h);return}h.addEventListener("abort",i,{once:!0})}});const{signal:f}=n;return f.unsubscribe=()=>X.asap(u),f},xM=function*(e,t){let n=e.byteLength;if(n{const i=vM(e,t);let o=0,u,f=h=>{u||(u=!0,r&&r(h))};return new ReadableStream({async pull(h){try{const{done:p,value:x}=await i.next();if(p){f(),h.close();return}let m=x.byteLength;if(n){let w=o+=m;n(w)}h.enqueue(new Uint8Array(x))}catch(p){throw f(p),p}},cancel(h){return f(h),i.return()}},{highWaterMark:2})},sw=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,OO=(e,t,n)=>t+2e<=57?e-48:(e&223)-55,bM=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||e===43||e===47||e===45||e===95,AM=e=>e===9||e===10||e===12||e===13||e===32,SM=e=>{const t=Math.floor(e/4),n=e%4;return t*3+(n===2?1:n===3?2:0)},EM=e=>{const t=e.length;let n=0;return t>0&&e.charCodeAt(t-1)===61&&(n++,t>1&&e.charCodeAt(t-2)===61&&n++),Math.floor((t-n)*3/4)},CM=e=>{const t=e.length;let n=0,r=0,i=!1;for(let o=0;o0){i=!0;continue}n++}}return i||r>2||r>0&&(n+r)%4!==0||n%4===1?EM(e):SM(n)},OM=(e,t)=>{if(!e||typeof e!="string"||!e.startsWith("data:"))return 0;const n=e.indexOf(",");if(n<0)return 0;const r=e.slice(5,n),i=e.slice(n+1);if(/;base64/i.test(r))return t(i);let u=0;for(let f=0,h=i.length;f=55296&&p<=56319&&f+1=56320&&x<=57343?(u+=4,f++):u+=3}else u+=3}return u};function _M(e){const t=typeof e=="string"?e.indexOf("#"):-1;return OM(t===-1?e:e.slice(0,t),CM)}const Ky="1.20.0",uw=64*1024,TM={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:vf}=X,NM=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,(t,n)=>String.fromCharCode(parseInt(n,16))),cw=e=>{if(!X.isString(e))return e;try{return decodeURIComponent(e)}catch{return e}},fw=(e,...t)=>{try{return!!e(...t)}catch{return!1}},IM=e=>{const t=e.indexOf("://");let n=e;return t!==-1&&(n=n.slice(t+3)),n.includes("@")||n.includes(":")},PM=e=>{const t=X.global!==void 0&&X.global!==null?X.global:globalThis,{ReadableStream:n,TextEncoder:r}=t;e=X.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:o,Response:u}=e,f=i?vf(i):typeof fetch=="function",h=vf(o),p=vf(u);if(!f)return!1;const x=f&&vf(n),m=f&&(typeof r=="function"?(E=>C=>E.encode(C))(new r):async E=>new Uint8Array(await new o(E).arrayBuffer())),w=h&&x&&fw(()=>{let E=!1;const C=new o(pn.origin,{body:new n,method:"POST",get duplex(){return E=!0,"half"}}),O=C.headers.has("Content-Type");return C.body!=null&&C.body.cancel(),E&&!O}),A=p&&x&&fw(()=>X.isReadableStream(new u("").body)),_={stream:A&&(E=>E.body)};f&&["text","arrayBuffer","blob","formData","stream"].forEach(E=>{!_[E]&&(_[E]=(C,O)=>{let M=C&&C[E];if(M)return M.call(C);throw new Ae(`Response type '${E}' is not supported`,Ae.ERR_NOT_SUPPORT,O)})});const T=async E=>{if(E==null)return 0;if(X.isBlob(E))return E.size;if(X.isSpecCompliantForm(E))return(await new o(pn.origin,{method:"POST",body:E}).arrayBuffer()).byteLength;if(X.isArrayBufferView(E)||X.isArrayBuffer(E))return E.byteLength;if(X.isURLSearchParams(E)&&(E=E+""),X.isString(E))return(await m(E)).byteLength},N=async(E,C)=>{const O=X.toFiniteNumber(E.getContentLength());return O??T(C)};return async E=>{let{url:C,method:O,data:M,signal:P,cancelToken:I,timeout:k,onDownloadProgress:B,onUploadProgress:F,responseType:q,headers:K,withCredentials:H="same-origin",fetchOptions:ne,maxContentLength:J,maxBodyLength:$,maxRedirects:re}=CO(E);const te=X.isNumber(J)&&J>-1,ee=X.isNumber($)&&$>-1,oe=Ue=>X.hasOwnProp(E,Ue)?E[Ue]:void 0;let ue=i||fetch;q=q?(q+"").toLowerCase():"text";let me=yM([P,I&&I.toAbortSignal()],k),le=null;const Ee=me&&me.unsubscribe&&(()=>{me.unsubscribe()});let Pe,Je=null;const Se=()=>new Ae("Request body larger than maxBodyLength limit",Ae.ERR_BAD_REQUEST,E,le);try{let Ue;const $e=oe("auth");if($e){const we=X.getSafeProp($e,"username")||"",Ie=X.getSafeProp($e,"password")||"";Ue={username:we,password:Ie}}if(IM(C)){const we=new URL(C,pn.origin);if(!Ue&&(we.username||we.password)){const Ie=cw(we.username),ln=cw(we.password);Ue={username:Ie,password:ln}}(we.username||we.password)&&(we.username="",we.password="",C=we.href)}if(Ue&&(K.delete("authorization"),K.set("Authorization","Basic "+btoa(NM((Ue.username||"")+":"+(Ue.password||""))))),te&&typeof C=="string"&&C.startsWith("data:")&&_M(C)>J)throw new Ae("maxContentLength size of "+J+" exceeded",Ae.ERR_BAD_RESPONSE,E,le);if(ee&&O!=="get"&&O!=="head"){const we=await T(M);if(typeof we=="number"&&isFinite(we)&&(Pe=we,we>$))throw Se()}const ye=ee&&(X.isReadableStream(M)||X.isStream(M)),je=(we,Ie,ln)=>ow(we,uw,be=>{if(ee&&be>$)throw Je=Se();Ie&&Ie(be)},ln);if(w&&O!=="get"&&O!=="head"&&(F||ye)){if(Pe=Pe??await N(K,M),Pe!==0||ye){let we=new o(C,{method:"POST",body:M,duplex:"half"}),Ie;if(X.isFormData(M)&&(Ie=we.headers.get("content-type"))&&K.setContentType(Ie),we.body){const[ln,be]=F&&nw(Pe,Ad(rw(F)))||[];M=je(we.body,ln,be)}}}else if(ye&&!h&&x&&O!=="get"&&O!=="head")M=je(M);else if(ye&&h&&!w&&O!=="get"&&O!=="head")throw new Ae("Stream request bodies are not supported by the current fetch implementation",Ae.ERR_NOT_SUPPORT,E,le);X.isString(H)||(H=H?"include":"omit");const Re=h&&"credentials"in o.prototype;if(X.isFormData(M)){const we=K.getContentType();we&&/^multipart\/form-data/i.test(we)&&!/boundary=/i.test(we)&&K.delete("content-type")}K.set("User-Agent","axios/"+Ky,!1);const ce=ne==null?ne:Object.assign(Object.create(null),ne);ce&&(delete ce.body,delete ce.headers,delete ce.method,delete ce.signal,delete ce.duplex,delete ce.credentials);const Ne=Object.assign(Object.create(null),ce,{signal:me,method:O.toUpperCase(),headers:fO(K.normalize()),body:M,duplex:"half",credentials:Re?H:void 0});h&&(X.forEach(TM,(we,Ie)=>{Ne[Ie]===void 0&&(Ne[Ie]=we)}),Ne.signal===void 0&&(Ne.signal=null),Ne.body===void 0&&(Ne.body=null)),re===0&&(Ne.redirect="manual",ce&&(ce.redirect="manual")),le=h&&new o(C,Ne);let Le=await(h?ue(le,ce):ue(C,Ne));const et=kn.from(Le.headers);if(te){const we=X.toFiniteNumber(et.getContentLength());if(we!=null&&we>J)throw new Ae("maxContentLength size of "+J+" exceeded",Ae.ERR_BAD_RESPONSE,E,le)}const ct=A&&(q==="stream"||q==="response");if(A&&Le.body&&(B||te||ct&&Ee)){const we={};["status","statusText","headers"].forEach(un=>{we[un]=Le[un]});const Ie=X.toFiniteNumber(et.getContentLength()),[ln,be]=B&&nw(Ie,Ad(rw(B),!0))||[];let jn=0;const Gi=un=>{if(te&&(jn=un,jn>J))throw new Ae("maxContentLength size of "+J+" exceeded",Ae.ERR_BAD_RESPONSE,E,le);ln&&ln(un)};Le=new u(ow(Le.body,uw,Gi,()=>{be&&be(),Ee&&Ee()}),we)}q=q||"text";let ze=await _[X.findKey(_,q)||"text"](Le,E);if(te&&!A&&!ct){let we;if(ze!=null&&(typeof ze.byteLength=="number"?we=ze.byteLength:typeof ze.size=="number"?we=ze.size:typeof ze=="string"&&(we=typeof r=="function"?new r().encode(ze).byteLength:ze.length)),typeof we=="number"&&we>J)throw new Ae("maxContentLength size of "+J+" exceeded",Ae.ERR_BAD_RESPONSE,E,le)}return!ct&&Ee&&Ee(),await new Promise((we,Ie)=>{AO(we,Ie,{data:ze,headers:kn.from(Le.headers),status:Le.status,statusText:Le.statusText,config:E,request:le})})}catch(Ue){if(Ee&&Ee(),me&&me.aborted&&me.reason instanceof Ae){const $e=me.reason;throw $e.config=E,le&&($e.request=le),Ue!==$e&&Object.defineProperty($e,"cause",{__proto__:null,value:Ue,writable:!0,enumerable:!1,configurable:!0}),$e}if(Je)throw le&&!Je.request&&(Je.request=le),Je;if(Ue instanceof Ae)throw le&&!Ue.request&&(Ue.request=le),Ue;if(Ue&&Ue.name==="TypeError"&&/Load failed|fetch/i.test(Ue.message)){const $e=new Ae("Network Error",Ae.ERR_NETWORK,E,le,Ue&&Ue.response);throw Object.defineProperty($e,"cause",{__proto__:null,value:Ue.cause||Ue,writable:!0,enumerable:!1,configurable:!0}),$e}throw Ae.from(Ue,Ue&&Ue.code,E,le,Ue&&Ue.response)}}},RM=new Map,_O=e=>{let t=e&&e.env||{};const{fetch:n,Request:r,Response:i}=t,o=[r,i,n];let u=o.length,f=u,h,p,x=RM;for(;f--;)h=o[f],p=x.get(h),p===void 0&&x.set(h,p=f?new Map:PM(t)),x=p;return p};_O();const Zy={http:FR,xhr:mM,fetch:{get:_O}};X.forEach(Zy,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch{}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}});const dw=e=>`- ${e}`,MM=e=>X.isFunction(e)||e===null||e===!1;function kM(e,t){e=X.isArray(e)?e:[e];const{length:n}=e;let r,i;const o={};for(let u=0;u`adapter ${h} `+(p===!1?"is not supported by the environment":"is not available in the build"));let f=n?u.length>1?`since : `+u.map(dw).join(` `):" "+dw(u[0]):"as no adapter specified";throw new Ae("There is no suitable adapter to dispatch the request "+f,Ae.ERR_NOT_SUPPORT)}return i}const TO={getAdapter:kM,adapters:Zy};function F1(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Mc(null,e)}function $1(e){const t=X.toSafeFlatObject(e);return F1(t),t.headers=kn.from(X.getSafeProp(t,"headers")),t.data=L1.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),TO.getAdapter(t.adapter||Rc.adapter,t)(t).then(function(i){F1(t),t.response=i;try{i.data=L1.call(t,t.transformResponse,i)}finally{delete t.response}return i.headers=kn.from(i.headers),i},function(i){if(!bO(i)&&(F1(t),i&&i.response)){t.response=i.response;try{i.response.data=L1.call(t,t.transformResponse,i.response)}finally{delete t.response}i.response.headers=kn.from(i.response.headers)}return Promise.reject(i)})}const Zh={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Zh[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const hw={};Zh.transitional=function(t,n,r){function i(o,u){return"[Axios v"+Ky+"] Transitional option '"+o+"'"+u+(r?". "+r:"")}return(o,u,f)=>{if(t===!1)throw new Ae(i(u," has been removed"+(n?" in "+n:"")),Ae.ERR_DEPRECATED);return n&&!hw[u]&&(hw[u]=!0,console.warn(i(u," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(o,u,f):!0}};Zh.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function DM(e,t,n){if(typeof e!="object"||e===null)throw new Ae("options must be an object",Ae.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let i=r.length;for(;i-- >0;){const o=r[i],u=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(u){const f=e[o],h=f===void 0||u(f,o,e);if(h!==!0)throw new Ae("option "+o+" must be "+h,Ae.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new Ae("Unknown option "+o,Ae.ERR_BAD_OPTION)}}const Xf={assertOptions:DM,validators:Zh},Nn=Xf.validators;let oo=class{constructor(t){this.defaults=t||{},this.interceptors={request:new ew,response:new ew}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error)try{let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const o=i.stack;let u="";if(typeof o=="string"){const f=o.indexOf(` `);u=f===-1?"":o.slice(f+1)}if(!r.stack)r.stack=u;else if(u){const f=u.indexOf(` `),h=f===-1?-1:u.indexOf(` `,f+1),p=h===-1?"":u.slice(h+1);String(r.stack).endsWith(p)||(r.stack+=` `+u)}}catch{}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=xo(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:o}=n;r!==void 0&&Xf.assertOptions(r,{silentJSONParsing:Nn.transitional(Nn.boolean),forcedJSONParsing:Nn.transitional(Nn.boolean),clarifyTimeoutError:Nn.transitional(Nn.boolean),legacyInterceptorReqResOrdering:Nn.transitional(Nn.boolean),advertiseZstdAcceptEncoding:Nn.transitional(Nn.boolean),validateStatusUndefinedResolves:Nn.transitional(Nn.boolean)},!1),i!=null&&(X.isFunction(i)?n.paramsSerializer={serialize:i}:Xf.assertOptions(i,{encode:Nn.function,serialize:Nn.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Xf.assertOptions(n,{baseUrl:Nn.spelling("baseURL"),withXsrfToken:Nn.spelling("withXSRFToken")},!0),n.method=(X.getSafeProp(n,"method")||X.getSafeProp(this.defaults,"method")||"get").toLowerCase();let u=o&&X.merge(o.common,o[n.method]);o&&X.forEach(wO.concat("common"),_=>{delete o[_]}),n.headers=kn.concat(u,o);const f=[];let h=!0;this.interceptors.request.forEach(function(T){if(typeof T.runWhen=="function"&&T.runWhen(n)===!1)return;h=h&&T.synchronous;const N=n.transitional||Yy;N&&N.legacyInterceptorReqResOrdering?f.unshift(T.fulfilled,T.rejected):f.push(T.fulfilled,T.rejected)});const p=[];this.interceptors.response.forEach(function(T){p.push(T.fulfilled,T.rejected)});let x,m=0,w;if(!h){const _=[$1.bind(this),void 0];for(_.unshift(...f),_.push(...p),w=_.length,x=Promise.resolve(n);m$1.call(this,A)))}catch(E){x=Promise.reject(E)}break}}if(!x)try{x=$1.call(this,A)}catch(_){x=Promise.reject(_)}for(m=0,w=p.length;m{if(!r._listeners)return;let o=r._listeners.length;for(;o-- >0;)r._listeners[o](i);r._listeners=null}),this.promise.then=i=>{let o;const u=new Promise(f=>{r.subscribe(f),o=f}).then(i);return u.cancel=function(){r.unsubscribe(o)},u},t(function(o,u,f){r.reason||(r.reason=new Mc(o,u,f),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new NO(function(i){t=i}),cancel:t}}};function LM(e){return function(n){return e.apply(null,n)}}function BM(e){return X.isObject(e)&&e.isAxiosError===!0}const Yf={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Yf).forEach(([e,t])=>{Yf[t]===void 0&&(Yf[t]=e)});function IO(e){const t=new oo(e),n=eO(oo.prototype.request,t);return X.extend(n,oo.prototype,t,{allOwnKeys:!0}),X.extend(n,t,null,{allOwnKeys:!0}),n.create=function(i){return IO(xo(e,i))},n}const Xt=IO(Rc);Xt.Axios=oo;Xt.CanceledError=Mc;Xt.CancelToken=jM;Xt.isCancel=bO;Xt.VERSION=Ky;Xt.toFormData=Kh;Xt.AxiosError=Ae;Xt.Cancel=Xt.CanceledError;Xt.all=function(t){return Promise.all(t)};Xt.spread=LM;Xt.isAxiosError=BM;Xt.mergeConfig=xo;Xt.AxiosHeaders=kn;Xt.formToJSON=e=>vO(X.isHTMLForm(e)?new FormData(e):e);Xt.getAdapter=TO.getAdapter;Xt.HttpStatusCode=Yf;Xt.default=Xt;const{Axios:Hoe,AxiosError:Voe,CanceledError:Goe,isCancel:Xoe,CancelToken:Yoe,VERSION:qoe,all:Koe,Cancel:Zoe,isAxiosError:Qoe,spread:Joe,toFormData:ese,AxiosHeaders:tse,HttpStatusCode:nse,formToJSON:rse,getAdapter:ise,mergeConfig:ase,create:ose}=Xt,it=Xt.create({baseURL:"/api",headers:{"Content-Type":"application/json"}});it.interceptors.request.use(e=>{const t=localStorage.getItem("token");return t&&(e.headers.Authorization=`Bearer ${t}`),e});const U1={login:async(e,t)=>{const{data:n}=await it.post("/auth/login",{email:e,password:t});return n},register:async(e,t,n,r)=>{const{data:i}=await it.post("/auth/register",{name:e,email:t,password:n,tenant_name:r});return i},me:async()=>{const{data:e}=await it.get("/auth/me");return e}},cs={getAll:async e=>{const{data:t}=await it.get("/products",{params:e});return t},getById:async e=>{const{data:t}=await it.get(`/products/${e}`);return t},create:async e=>{const{data:t}=await it.post("/products",e);return t},update:async(e,t)=>{const{data:n}=await it.put(`/products/${e}`,t);return n},delete:async e=>{await it.delete(`/products/${e}`)},updateStock:async(e,t)=>{const{data:n}=await it.patch(`/products/${e}/stock`,{quantity:t});return n}},Qy={getAll:async()=>{const{data:e}=await it.get("/categories");return e},create:async e=>{const{data:t}=await it.post("/categories",e);return t},update:async(e,t)=>{const{data:n}=await it.put(`/categories/${e}`,t);return n},delete:async e=>{await it.delete(`/categories/${e}`)}},mu={getAll:async e=>{const{data:t}=await it.get("/orders",{params:e});return t},getById:async e=>{const{data:t}=await it.get(`/orders/${e}`);return t},create:async e=>{const{data:t}=await it.post("/orders",e);return t},updateStatus:async(e,t)=>{const{data:n}=await it.patch(`/orders/${e}/status`,{status:t});return n},cancel:async e=>{await it.post(`/orders/${e}/cancel`)}},qf={getStats:async e=>{const{data:t}=await it.get("/dashboard/stats",{params:{store_id:e}});return t},getRevenueChart:async(e=7,t)=>{const{data:n}=await it.get("/dashboard/revenue",{params:{days:e,store_id:t}});return n},getTopProducts:async(e=5,t)=>{const{data:n}=await it.get("/dashboard/top-products",{params:{limit:e,store_id:t}});return n}},pw={getAll:async e=>{const{data:t}=await it.get("/inventory",{params:e});return t},adjustStock:async(e,t,n)=>{const{data:r}=await it.post("/inventory/adjust",{product_id:e,quantity:t,reason:n});return r},getLowStock:async()=>{const{data:e}=await it.get("/inventory/low-stock");return e}},au={getAll:async()=>{const{data:e}=await it.get("/stores");return e},getById:async e=>{const{data:t}=await it.get(`/stores/${e}`);return t},create:async e=>{const{data:t}=await it.post("/stores",e);return t},update:async(e,t)=>{const{data:n}=await it.put(`/stores/${e}`,t);return n},delete:async e=>{await it.delete(`/stores/${e}`)}},gw={getTenant:async()=>{const{data:e}=await it.get("/settings/tenant");return e},updateTenant:async e=>{const{data:t}=await it.put("/settings/tenant",e);return t}},Qh=JC()(T6(e=>({user:null,tenant:null,token:null,isAuthenticated:!1,isLoading:!1,login:async(t,n)=>{e({isLoading:!0});try{const r=await U1.login(t,n);localStorage.setItem("token",r.token),e({user:r.user,tenant:r.tenant,token:r.token,isAuthenticated:!0,isLoading:!1})}catch(r){throw e({isLoading:!1}),r}},register:async(t,n,r,i)=>{e({isLoading:!0});try{const o=await U1.register(t,n,r,i);localStorage.setItem("token",o.token),e({user:o.user,tenant:o.tenant,token:o.token,isAuthenticated:!0,isLoading:!1})}catch(o){throw e({isLoading:!1}),o}},logout:()=>{localStorage.removeItem("token"),e({user:null,tenant:null,token:null,isAuthenticated:!1})},fetchUser:async()=>{e({isLoading:!0});try{const{user:t,tenant:n}=await U1.me();e({user:t,tenant:n,isAuthenticated:!0,isLoading:!1})}catch(t){throw e({isLoading:!1}),t}}}),{name:"auth-storage",partialize:e=>({token:e.token})})),kc=JC((e,t)=>({items:[],selectedStore:null,addItem:n=>{const r=t().items,i=r.find(o=>o.product.id===n.id);e(i?{items:r.map(o=>o.product.id===n.id?{...o,quantity:o.quantity+1}:o)}:{items:[...r,{product:n,quantity:1}]})},removeItem:n=>{e({items:t().items.filter(r=>r.product.id!==n)})},updateQuantity:(n,r)=>{r<=0?e({items:t().items.filter(i=>i.product.id!==n)}):e({items:t().items.map(i=>i.product.id===n?{...i,quantity:r}:i)})},clearCart:()=>e({items:[]}),setSelectedStore:n=>e({selectedStore:n}),getTotal:()=>t().items.reduce((r,i)=>r+i.product.price*i.quantity,0),getSubtotal:()=>t().items.reduce((r,i)=>r+i.product.price*i.quantity,0)}));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FM=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),PO=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim();/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */var $M={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UM=W.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i="",children:o,iconNode:u,...f},h)=>W.createElement("svg",{ref:h,...$M,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:PO("lucide",i),...f},[...u.map(([p,x])=>W.createElement(p,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ke=(e,t)=>{const n=W.forwardRef(({className:r,...i},o)=>W.createElement(UM,{ref:o,iconNode:t,className:PO(`lucide-${FM(e)}`,r),...i}));return n.displayName=`${e}`,n};/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zM=Ke("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WM=Ke("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HM=Ke("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=Ke("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VM=Ke("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GM=Ke("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=Ke("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yw=Ke("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XM=Ke("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YM=Ke("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qM=Ke("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=Ke("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KM=Ke("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZM=Ke("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QM=Ke("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=Ke("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JM=Ke("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e5=Ke("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t5=Ke("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n5=Ke("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=Ke("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sd=Ke("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jh=Ke("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r5=Ke("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i5=Ke("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dc=Ke("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a5=Ke("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const so=Ke("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o5=Ke("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=Ke("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ed=Ke("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jy=Ke("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s5=Ke("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=Ke("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xg=Ke("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.460.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const To=Ke("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ww=[{path:"/dashboard",label:"Dashboard",icon:e5},{path:"/pos",label:"POS",icon:so},{path:"/orders",label:"Orders",icon:YM},{path:"/products",label:"Products",icon:Sd},{path:"/inventory",label:"Inventory",icon:WM},{path:"/scanner",label:"Scanner",icon:i5},{path:"/reports",label:"Reports",icon:VM},{path:"/stores",label:"Stores",icon:Ed},{path:"/settings",label:"Settings",icon:a5}];function l5({children:e}){var E,C;const t=al(),n=Yh(),{user:r,tenant:i,logout:o}=Qh(),{items:u,selectedStore:f,setSelectedStore:h}=kc(),[p,x]=W.useState([]),[m,w]=W.useState(!0),[A,_]=W.useState(!1);W.useEffect(()=>{(async()=>{try{const M=await au.getAll();x(M),M.length>0&&!f&&h(M[0])}catch(M){console.error("Failed to fetch stores:",M)}})()},[]);const T=()=>{o(),n("/login")},N=u.reduce((O,M)=>O+M.quantity,0);return S.jsxs("div",{className:"flex h-screen bg-gray-100",children:[S.jsxs("aside",{className:`${m?"w-64":"w-20"} bg-white shadow-lg transition-all duration-300 flex flex-col`,children:[S.jsxs("div",{className:"p-4 border-b flex items-center justify-between",children:[m&&S.jsxs("div",{children:[S.jsx("h1",{className:"text-xl font-bold text-blue-600",children:"MartPOS"}),S.jsx("p",{className:"text-xs text-gray-500",children:i==null?void 0:i.name})]}),S.jsx("button",{onClick:()=>w(!m),className:"p-2 rounded hover:bg-gray-100",children:m?S.jsx(To,{size:20}):S.jsx(n5,{size:20})})]}),S.jsx("nav",{className:"flex-1 p-4 overflow-y-auto",children:S.jsx("ul",{className:"space-y-2",children:ww.map(O=>{const M=O.icon,P=t.pathname===O.path;return S.jsx("li",{children:S.jsxs(W2,{to:O.path,className:`flex items-center gap-3 px-4 py-3 rounded-lg transition-colors ${P?"bg-blue-600 text-white":"text-gray-700 hover:bg-gray-100"}`,children:[S.jsx(M,{size:20}),m&&S.jsx("span",{children:O.label})]})},O.path)})})}),S.jsx("div",{className:"p-4 border-t",children:S.jsxs("button",{onClick:T,className:"flex items-center gap-3 px-4 py-3 w-full rounded-lg text-red-600 hover:bg-red-50 transition-colors",children:[S.jsx(t5,{size:20}),m&&S.jsx("span",{children:"Logout"})]})})]}),S.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[S.jsxs("header",{className:"bg-white shadow-sm p-4 flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsx("h2",{className:"text-lg font-semibold",children:((E=ww.find(O=>O.path===t.pathname))==null?void 0:E.label)||""}),t.pathname==="/pos"&&S.jsxs("div",{className:"relative",children:[S.jsxs("button",{onClick:()=>_(!A),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 rounded-lg hover:bg-gray-200 transition-colors",children:[S.jsx(Ed,{size:18}),S.jsx("span",{children:(f==null?void 0:f.name)||"Select Store"})]}),A&&S.jsx("div",{className:"absolute top-full mt-1 left-0 bg-white shadow-lg rounded-lg py-2 min-w-48 z-10",children:p.map(O=>S.jsx("button",{onClick:()=>{h(O),_(!1)},className:`w-full text-left px-4 py-2 hover:bg-gray-100 ${(f==null?void 0:f.id)===O.id?"bg-blue-50 text-blue-600":""}`,children:O.name},O.id))})]})]}),S.jsxs("div",{className:"flex items-center gap-4",children:[t.pathname!=="/pos"&&S.jsxs(W2,{to:"/pos",className:"relative p-2 rounded-lg hover:bg-gray-100 transition-colors",children:[S.jsx(so,{size:24}),N>0&&S.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full w-5 h-5 flex items-center justify-center",children:N})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("div",{className:"w-8 h-8 bg-blue-600 rounded-full flex items-center justify-center text-white font-semibold",children:(C=r==null?void 0:r.name)==null?void 0:C.charAt(0).toUpperCase()}),S.jsxs("div",{className:"text-sm",children:[S.jsx("p",{className:"font-medium",children:r==null?void 0:r.name}),S.jsx("p",{className:"text-gray-500 text-xs",children:r==null?void 0:r.role})]})]})]})]}),S.jsx("main",{className:"flex-1 overflow-y-auto p-6",children:e})]})]})}function u5(){const e=Yh(),{login:t,register:n,isLoading:r}=Qh(),[i,o]=W.useState(!1),[u,f]=W.useState(!1),[h,p]=W.useState(""),[x,m]=W.useState({email:"",password:"",name:"",tenantName:""}),w=async _=>{var T,N;_.preventDefault(),p("");try{i?await n(x.name,x.email,x.password,x.tenantName):await t(x.email,x.password),e("/dashboard")}catch(E){p(((N=(T=E.response)==null?void 0:T.data)==null?void 0:N.message)||"An error occurred")}},A=_=>{m({...x,[_.target.name]:_.target.value})};return S.jsx("div",{className:"min-h-screen bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center p-4",children:S.jsxs("div",{className:"bg-white rounded-2xl shadow-2xl w-full max-w-md p-8",children:[S.jsxs("div",{className:"text-center mb-8",children:[S.jsx("h1",{className:"text-3xl font-bold text-gray-800",children:"MartPOS"}),S.jsx("p",{className:"text-gray-500 mt-2",children:i?"Create your account":"Welcome back"})]}),h&&S.jsx("div",{className:"bg-red-50 text-red-600 p-3 rounded-lg mb-4 text-sm",children:h}),S.jsxs("form",{onSubmit:w,className:"space-y-4",children:[i&&S.jsxs(S.Fragment,{children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Full Name"}),S.jsx("input",{type:"text",name:"name",value:x.name,onChange:A,required:!0,className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"John Doe"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Business Name"}),S.jsx("input",{type:"text",name:"tenantName",value:x.tenantName,onChange:A,required:i,className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"My Mart"})]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),S.jsx("input",{type:"email",name:"email",value:x.email,onChange:A,required:!0,className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"you@example.com"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Password"}),S.jsxs("div",{className:"relative",children:[S.jsx("input",{type:u?"text":"password",name:"password",value:x.password,onChange:A,required:!0,className:"w-full px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent pr-12",placeholder:"••••••••"}),S.jsx("button",{type:"button",onClick:()=>f(!u),className:"absolute right-4 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600",children:u?S.jsx(QM,{size:20}):S.jsx(MO,{size:20})})]})]}),S.jsx("button",{type:"submit",disabled:r,className:"w-full bg-blue-600 text-white py-3 rounded-lg font-semibold hover:bg-blue-700 transition-colors disabled:opacity-50",children:r?"Loading...":i?"Create Account":"Sign In"})]}),S.jsx("div",{className:"mt-6 text-center",children:S.jsx("button",{onClick:()=>{o(!i),p("")},className:"text-blue-600 hover:underline text-sm",children:i?"Already have an account? Sign in":"Don't have an account? Sign up"})})]})})}function jO(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var i=e.length;for(t=0;t-1}var lD=sD,uD=t0;function cD(e,t){var n=this.__data__,r=uD(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var fD=cD,dD=Yk,hD=nD,pD=aD,gD=lD,mD=fD;function fl(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},eo=function(t){return vo(t)&&t.indexOf("%")===t.length-1},xe=function(t){return j7(t)&&!Lc(t)},$7=function(t){return Xe(t)},on=function(t){return xe(t)||vo(t)},U7=0,Bc=function(t){var n=++U7;return"".concat(t||"").concat(n)},wo=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!xe(t)&&!vo(t))return r;var o;if(eo(t)){var u=t.indexOf("%");o=n*parseFloat(t.slice(0,u))/100}else o=+t;return Lc(o)&&(o=r),i&&o>n&&(o=n),o},sa=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},z7=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,r={},i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function q7(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function wg(e){"@babel/helpers - typeof";return wg=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wg(e)}var Rw={click:"onClick",mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",mouseout:"onMouseOut",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",touchcancel:"onTouchCancel",touchend:"onTouchEnd",touchmove:"onTouchMove",touchstart:"onTouchStart",contextmenu:"onContextMenu",dblclick:"onDoubleClick"},Ii=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},Mw=null,H1=null,fx=function e(t){if(t===Mw&&Array.isArray(H1))return H1;var n=[];return W.Children.forEach(t,function(r){Xe(r)||(P7.isFragment(r)?n=n.concat(e(r.props.children)):n.push(r))}),H1=n,Mw=t,n};function Pr(e,t){var n=[],r=[];return Array.isArray(t)?r=t.map(function(i){return Ii(i)}):r=[Ii(t)],fx(e).forEach(function(i){var o=Ir(i,"type.displayName")||Ir(i,"type.name");r.indexOf(o)!==-1&&n.push(i)}),n}function ur(e,t){var n=Pr(e,t);return n&&n[0]}var kw=function(t){if(!t||!t.props)return!1;var n=t.props,r=n.width,i=n.height;return!(!xe(r)||r<=0||!xe(i)||i<=0)},K7=["a","altGlyph","altGlyphDef","altGlyphItem","animate","animateColor","animateMotion","animateTransform","circle","clipPath","color-profile","cursor","defs","desc","ellipse","feBlend","feColormatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","font","font-face","font-face-format","font-face-name","font-face-url","foreignObject","g","glyph","glyphRef","hkern","image","line","lineGradient","marker","mask","metadata","missing-glyph","mpath","path","pattern","polygon","polyline","radialGradient","rect","script","set","stop","style","svg","switch","symbol","text","textPath","title","tref","tspan","use","view","vkern"],Z7=function(t){return t&&t.type&&vo(t.type)&&K7.indexOf(t.type)>=0},Q7=function(t){return t&&wg(t)==="object"&&"clipDot"in t},J7=function(t,n,r,i){var o,u=(o=W1==null?void 0:W1[i])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ge(t)&&(i&&u.includes(n)||V7.includes(n))||r&&cx.includes(n)},Qe=function(t,n,r){if(!t||typeof t=="function"||typeof t=="boolean")return null;var i=t;if(W.isValidElement(t)&&(i=t.props),!ul(i))return null;var o={};return Object.keys(i).forEach(function(u){var f;J7((f=i)===null||f===void 0?void 0:f[u],u,n,r)&&(o[u]=i[u])}),o},bg=function e(t,n){if(t===n)return!0;var r=W.Children.count(t);if(r!==W.Children.count(n))return!1;if(r===0)return!0;if(r===1)return Dw(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ij(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Sg(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,o=e.className,u=e.style,f=e.title,h=e.desc,p=rj(e,nj),x=i||{width:n,height:r,x:0,y:0},m=rt("recharts-surface",o);return Y.createElement("svg",Ag({},Qe(p,!0,"svg"),{className:m,width:n,height:r,style:u,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),Y.createElement("title",null,f),Y.createElement("desc",null,h),t)}var aj=["children","className"];function Eg(){return Eg=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sj(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var Vt=Y.forwardRef(function(e,t){var n=e.children,r=e.className,i=oj(e,aj),o=rt("recharts-layer",r);return Y.createElement("g",Eg({className:o},Qe(i,!0),{ref:t}),n)}),Pi=function(t,n){for(var r=arguments.length,i=new Array(r>2?r-2:0),o=2;oi?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(i);++r=r?e:cj(e,t,n)}var dj=fj,hj="\\ud800-\\udfff",pj="\\u0300-\\u036f",gj="\\ufe20-\\ufe2f",mj="\\u20d0-\\u20ff",yj=pj+gj+mj,xj="\\ufe0e\\ufe0f",vj="\\u200d",wj=RegExp("["+vj+hj+yj+xj+"]");function bj(e){return wj.test(e)}var qO=bj;function Aj(e){return e.split("")}var Sj=Aj,KO="\\ud800-\\udfff",Ej="\\u0300-\\u036f",Cj="\\ufe20-\\ufe2f",Oj="\\u20d0-\\u20ff",_j=Ej+Cj+Oj,Tj="\\ufe0e\\ufe0f",Nj="["+KO+"]",Cg="["+_j+"]",Og="\\ud83c[\\udffb-\\udfff]",Ij="(?:"+Cg+"|"+Og+")",ZO="[^"+KO+"]",QO="(?:\\ud83c[\\udde6-\\uddff]){2}",JO="[\\ud800-\\udbff][\\udc00-\\udfff]",Pj="\\u200d",e_=Ij+"?",t_="["+Tj+"]?",Rj="(?:"+Pj+"(?:"+[ZO,QO,JO].join("|")+")"+t_+e_+")*",Mj=t_+e_+Rj,kj="(?:"+[ZO+Cg+"?",Cg,QO,JO,Nj].join("|")+")",Dj=RegExp(Og+"(?="+Og+")|"+kj+Mj,"g");function jj(e){return e.match(Dj)||[]}var Lj=jj,Bj=Sj,Fj=qO,$j=Lj;function Uj(e){return Fj(e)?$j(e):Bj(e)}var zj=Uj,Wj=dj,Hj=qO,Vj=zj,Gj=WO;function Xj(e){return function(t){t=Gj(t);var n=Hj(t)?Vj(t):void 0,r=n?n[0]:t.charAt(0),i=n?Wj(n,1).join(""):t.slice(1);return r[e]()+i}}var Yj=Xj,qj=Yj,Kj=qj("toUpperCase"),Zj=Kj;const g0=wt(Zj);function At(e){return function(){return e}}const n_=Math.cos,Td=Math.sin,ti=Math.sqrt,Nd=Math.PI,m0=2*Nd,_g=Math.PI,Tg=2*_g,Va=1e-6,Qj=Tg-Va;function r_(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return r_;const n=10**t;return function(r){this._+=r[0];for(let i=1,o=r.length;iVa)if(!(Math.abs(m*h-p*x)>Va)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let A=r-u,_=i-f,T=h*h+p*p,N=A*A+_*_,E=Math.sqrt(T),C=Math.sqrt(w),O=o*Math.tan((_g-Math.acos((T+w-N)/(2*E*C)))/2),M=O/C,P=O/E;Math.abs(M-1)>Va&&this._append`L${t+M*x},${n+M*m}`,this._append`A${o},${o},0,0,${+(m*A>x*_)},${this._x1=t+P*h},${this._y1=n+P*p}`}}arc(t,n,r,i,o,u){if(t=+t,n=+n,r=+r,u=!!u,r<0)throw new Error(`negative radius: ${r}`);let f=r*Math.cos(i),h=r*Math.sin(i),p=t+f,x=n+h,m=1^u,w=u?i-o:o-i;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Va||Math.abs(this._y1-x)>Va)&&this._append`L${p},${x}`,r&&(w<0&&(w=w%Tg+Tg),w>Qj?this._append`A${r},${r},0,1,${m},${t-f},${n-h}A${r},${r},0,1,${m},${this._x1=p},${this._y1=x}`:w>Va&&this._append`A${r},${r},0,${+(w>=_g)},${m},${this._x1=t+r*Math.cos(o)},${this._y1=n+r*Math.sin(o)}`)}rect(t,n,r,i){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${r=+r}v${+i}h${-r}Z`}toString(){return this._}}function dx(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);t=r}return e},()=>new e9(t)}function hx(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function i_(e){this._context=e}i_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function y0(e){return new i_(e)}function a_(e){return e[0]}function o_(e){return e[1]}function s_(e,t){var n=At(!0),r=null,i=y0,o=null,u=dx(f);e=typeof e=="function"?e:e===void 0?a_:At(e),t=typeof t=="function"?t:t===void 0?o_:At(t);function f(h){var p,x=(h=hx(h)).length,m,w=!1,A;for(r==null&&(o=i(A=u())),p=0;p<=x;++p)!(p=A;--_)f.point(O[_],M[_]);f.lineEnd(),f.areaEnd()}E&&(O[w]=+e(N,w,m),M[w]=+t(N,w,m),f.point(r?+r(N,w,m):O[w],n?+n(N,w,m):M[w]))}if(C)return f=null,C+""||null}function x(){return s_().defined(i).curve(u).context(o)}return p.x=function(m){return arguments.length?(e=typeof m=="function"?m:At(+m),r=null,p):e},p.x0=function(m){return arguments.length?(e=typeof m=="function"?m:At(+m),p):e},p.x1=function(m){return arguments.length?(r=m==null?null:typeof m=="function"?m:At(+m),p):r},p.y=function(m){return arguments.length?(t=typeof m=="function"?m:At(+m),n=null,p):t},p.y0=function(m){return arguments.length?(t=typeof m=="function"?m:At(+m),p):t},p.y1=function(m){return arguments.length?(n=m==null?null:typeof m=="function"?m:At(+m),p):n},p.lineX0=p.lineY0=function(){return x().x(e).y(t)},p.lineY1=function(){return x().x(e).y(n)},p.lineX1=function(){return x().x(r).y(t)},p.defined=function(m){return arguments.length?(i=typeof m=="function"?m:At(!!m),p):i},p.curve=function(m){return arguments.length?(u=m,o!=null&&(f=u(o)),p):u},p.context=function(m){return arguments.length?(m==null?o=f=null:f=u(o=m),p):o},p}class l_{constructor(t,n){this._context=t,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function t9(e){return new l_(e,!0)}function n9(e){return new l_(e,!1)}const px={draw(e,t){const n=ti(t/Nd);e.moveTo(n,0),e.arc(0,0,n,0,m0)}},r9={draw(e,t){const n=ti(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},u_=ti(1/3),i9=u_*2,a9={draw(e,t){const n=ti(t/i9),r=n*u_;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},o9={draw(e,t){const n=ti(t),r=-n/2;e.rect(r,r,n,n)}},s9=.8908130915292852,c_=Td(Nd/10)/Td(7*Nd/10),l9=Td(m0/10)*c_,u9=-n_(m0/10)*c_,c9={draw(e,t){const n=ti(t*s9),r=l9*n,i=u9*n;e.moveTo(0,-n),e.lineTo(r,i);for(let o=1;o<5;++o){const u=m0*o/5,f=n_(u),h=Td(u);e.lineTo(h*n,-f*n),e.lineTo(f*r-h*i,h*r+f*i)}e.closePath()}},V1=ti(3),f9={draw(e,t){const n=-ti(t/(V1*3));e.moveTo(0,n*2),e.lineTo(-V1*n,-n),e.lineTo(V1*n,-n),e.closePath()}},br=-.5,Ar=ti(3)/2,Ng=1/ti(12),d9=(Ng/2+1)*3,h9={draw(e,t){const n=ti(t/d9),r=n/2,i=n*Ng,o=r,u=n*Ng+n,f=-o,h=u;e.moveTo(r,i),e.lineTo(o,u),e.lineTo(f,h),e.lineTo(br*r-Ar*i,Ar*r+br*i),e.lineTo(br*o-Ar*u,Ar*o+br*u),e.lineTo(br*f-Ar*h,Ar*f+br*h),e.lineTo(br*r+Ar*i,br*i-Ar*r),e.lineTo(br*o+Ar*u,br*u-Ar*o),e.lineTo(br*f+Ar*h,br*h-Ar*f),e.closePath()}};function p9(e,t){let n=null,r=dx(i);e=typeof e=="function"?e:At(e||px),t=typeof t=="function"?t:At(t===void 0?64:+t);function i(){let o;if(n||(n=o=r()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return i.type=function(o){return arguments.length?(e=typeof o=="function"?o:At(o),i):e},i.size=function(o){return arguments.length?(t=typeof o=="function"?o:At(+o),i):t},i.context=function(o){return arguments.length?(n=o??null,i):n},i}function Id(){}function Pd(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function f_(e){this._context=e}f_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Pd(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Pd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function g9(e){return new f_(e)}function d_(e){this._context=e}d_.prototype={areaStart:Id,areaEnd:Id,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Pd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function m9(e){return new d_(e)}function h_(e){this._context=e}h_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Pd(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function y9(e){return new h_(e)}function p_(e){this._context=e}p_.prototype={areaStart:Id,areaEnd:Id,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function x9(e){return new p_(e)}function Lw(e){return e<0?-1:1}function Bw(e,t,n){var r=e._x1-e._x0,i=t-e._x1,o=(e._y1-e._y0)/(r||i<0&&-0),u=(n-e._y1)/(i||r<0&&-0),f=(o*i+u*r)/(r+i);return(Lw(o)+Lw(u))*Math.min(Math.abs(o),Math.abs(u),.5*Math.abs(f))||0}function Fw(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function G1(e,t,n){var r=e._x0,i=e._y0,o=e._x1,u=e._y1,f=(o-r)/3;e._context.bezierCurveTo(r+f,i+f*t,o-f,u-f*n,o,u)}function Rd(e){this._context=e}Rd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:G1(this,this._t0,Fw(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,G1(this,Fw(this,n=Bw(this,e,t)),n);break;default:G1(this,this._t0,n=Bw(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function g_(e){this._context=new m_(e)}(g_.prototype=Object.create(Rd.prototype)).point=function(e,t){Rd.prototype.point.call(this,t,e)};function m_(e){this._context=e}m_.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,o){this._context.bezierCurveTo(t,e,r,n,o,i)}};function v9(e){return new Rd(e)}function w9(e){return new g_(e)}function y_(e){this._context=e}y_.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=$w(e),i=$w(t),o=0,u=1;u=0;--t)i[t]=(u[t]-i[t+1])/o[t];for(o[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function A9(e){return new x0(e,.5)}function S9(e){return new x0(e,0)}function E9(e){return new x0(e,1)}function Rs(e,t){if((u=e.length)>1)for(var n=1,r,i,o=e[t[0]],u,f=o.length;n=0;)n[t]=t;return n}function C9(e,t){return e[t]}function O9(e){const t=[];return t.key=e,t}function _9(){var e=At([]),t=Ig,n=Rs,r=C9;function i(o){var u=Array.from(e.apply(this,arguments),O9),f,h=u.length,p=-1,x;for(const m of o)for(f=0,++p;f0){for(var n,r,i=0,o=e[0].length,u;i0){for(var n=0,r=e[t[0]],i,o=r.length;n0)||!((o=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,o,u;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function j9(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var x_={symbolCircle:px,symbolCross:r9,symbolDiamond:a9,symbolSquare:o9,symbolStar:c9,symbolTriangle:f9,symbolWye:h9},L9=Math.PI/180,B9=function(t){var n="symbol".concat(g0(t));return x_[n]||px},F9=function(t,n,r){if(n==="area")return t;switch(r){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var i=18*L9;return 1.25*t*t*(Math.tan(i)-Math.tan(i*2)*Math.pow(Math.tan(i),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},$9=function(t,n){x_["symbol".concat(g0(t))]=n},gx=function(t){var n=t.type,r=n===void 0?"circle":n,i=t.size,o=i===void 0?64:i,u=t.sizeType,f=u===void 0?"area":u,h=D9(t,P9),p=zw(zw({},h),{},{type:r,size:o,sizeType:f}),x=function(){var N=B9(r),E=p9().type(N).size(F9(o,f,r));return E()},m=p.className,w=p.cx,A=p.cy,_=Qe(p,!0);return w===+w&&A===+A&&o===+o?Y.createElement("path",Pg({},_,{className:rt("recharts-symbols",m),transform:"translate(".concat(w,", ").concat(A,")"),d:x()})):null};gx.registerSymbol=$9;function Ms(e){"@babel/helpers - typeof";return Ms=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(e)}function Rg(){return Rg=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var C=A.inactive?p:A.color;return Y.createElement("li",Rg({className:N,style:m,key:"legend-item-".concat(_)},_d(r.props,A,_)),Y.createElement(Sg,{width:u,height:u,viewBox:x,style:w},r.renderIcon(A)),Y.createElement("span",{className:"recharts-legend-item-text",style:{color:C}},T?T(E,A,_):E))})}},{key:"render",value:function(){var r=this.props,i=r.payload,o=r.layout,u=r.align;if(!i||!i.length)return null;var f={padding:0,margin:0,textAlign:o==="horizontal"?u:"left"};return Y.createElement("ul",{className:"recharts-default-legend",style:f},this.renderItems())}}])}(W.PureComponent);Hu(mx,"displayName","Legend");Hu(mx,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var K9=n0;function Z9(){this.__data__=new K9,this.size=0}var Q9=Z9;function J9(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var eL=J9;function tL(e){return this.__data__.get(e)}var nL=tL;function rL(e){return this.__data__.has(e)}var iL=rL,aL=n0,oL=rx,sL=ix,lL=200;function uL(e,t){var n=this.__data__;if(n instanceof aL){var r=n.__data__;if(!oL||r.lengthf))return!1;var p=o.get(e),x=o.get(t);if(p&&x)return p==t&&x==e;var m=-1,w=!0,A=n&PL?new _L:void 0;for(o.set(e,t),o.set(t,e);++m-1&&e%1==0&&e-1&&e%1==0&&e<=DB}var wx=jB,LB=Wi,BB=wx,FB=Hi,$B="[object Arguments]",UB="[object Array]",zB="[object Boolean]",WB="[object Date]",HB="[object Error]",VB="[object Function]",GB="[object Map]",XB="[object Number]",YB="[object Object]",qB="[object RegExp]",KB="[object Set]",ZB="[object String]",QB="[object WeakMap]",JB="[object ArrayBuffer]",eF="[object DataView]",tF="[object Float32Array]",nF="[object Float64Array]",rF="[object Int8Array]",iF="[object Int16Array]",aF="[object Int32Array]",oF="[object Uint8Array]",sF="[object Uint8ClampedArray]",lF="[object Uint16Array]",uF="[object Uint32Array]",Ot={};Ot[tF]=Ot[nF]=Ot[rF]=Ot[iF]=Ot[aF]=Ot[oF]=Ot[sF]=Ot[lF]=Ot[uF]=!0;Ot[$B]=Ot[UB]=Ot[JB]=Ot[zB]=Ot[eF]=Ot[WB]=Ot[HB]=Ot[VB]=Ot[GB]=Ot[XB]=Ot[YB]=Ot[qB]=Ot[KB]=Ot[ZB]=Ot[QB]=!1;function cF(e){return FB(e)&&BB(e.length)&&!!Ot[LB(e)]}var fF=cF;function dF(e){return function(t){return e(t)}}var N_=dF,jd={exports:{}};jd.exports;(function(e,t){var n=LO,r=t&&!t.nodeType&&t,i=r&&!0&&e&&!e.nodeType&&e,o=i&&i.exports===r,u=o&&n.process,f=function(){try{var h=i&&i.require&&i.require("util").types;return h||u&&u.binding&&u.binding("util")}catch{}}();e.exports=f})(jd,jd.exports);var hF=jd.exports,pF=fF,gF=N_,qw=hF,Kw=qw&&qw.isTypedArray,mF=Kw?gF(Kw):pF,I_=mF,yF=wB,xF=xx,vF=nr,wF=T_,bF=vx,AF=I_,SF=Object.prototype,EF=SF.hasOwnProperty;function CF(e,t){var n=vF(e),r=!n&&xF(e),i=!n&&!r&&wF(e),o=!n&&!r&&!i&&AF(e),u=n||r||i||o,f=u?yF(e.length,String):[],h=f.length;for(var p in e)(t||EF.call(e,p))&&!(u&&(p=="length"||i&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||bF(p,h)))&&f.push(p);return f}var OF=CF,_F=Object.prototype;function TF(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||_F;return e===n}var NF=TF;function IF(e,t){return function(n){return e(t(n))}}var P_=IF,PF=P_,RF=PF(Object.keys,Object),MF=RF,kF=NF,DF=MF,jF=Object.prototype,LF=jF.hasOwnProperty;function BF(e){if(!kF(e))return DF(e);var t=[];for(var n in Object(e))LF.call(e,n)&&n!="constructor"&&t.push(n);return t}var FF=BF,$F=tx,UF=wx;function zF(e){return e!=null&&UF(e.length)&&!$F(e)}var Fc=zF,WF=OF,HF=FF,VF=Fc;function GF(e){return VF(e)?WF(e):HF(e)}var v0=GF,XF=lB,YF=xB,qF=v0;function KF(e){return XF(e,qF,YF)}var ZF=KF,Zw=ZF,QF=1,JF=Object.prototype,e$=JF.hasOwnProperty;function t$(e,t,n,r,i,o){var u=n&QF,f=Zw(e),h=f.length,p=Zw(t),x=p.length;if(h!=x&&!u)return!1;for(var m=h;m--;){var w=f[m];if(!(u?w in t:e$.call(t,w)))return!1}var A=o.get(e),_=o.get(t);if(A&&_)return A==t&&_==e;var T=!0;o.set(e,t),o.set(t,e);for(var N=u;++m-1}var JU=QU;function ez(e,t,n){for(var r=-1,i=e==null?0:e.length;++r=gz){var p=t?null:hz(e);if(p)return pz(p);u=!1,i=dz,h=new uz}else h=t?[]:f;e:for(;++r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Pz(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Rz(e){return e.value}function Mz(e,t){if(Y.isValidElement(e))return Y.cloneElement(e,t);if(typeof e=="function")return Y.createElement(e,t);t.ref;var n=Iz(t,Az);return Y.createElement(mx,n)}var hb=1,As=function(e){function t(){var n;Sz(this,t);for(var r=arguments.length,i=new Array(r),o=0;ohb||Math.abs(i.height-this.lastBoundingBox.height)>hb)&&(this.lastBoundingBox.width=i.width,this.lastBoundingBox.height=i.height,r&&r(i)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?xi({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var i=this.props,o=i.layout,u=i.align,f=i.verticalAlign,h=i.margin,p=i.chartWidth,x=i.chartHeight,m,w;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(u==="center"&&o==="vertical"){var A=this.getBBoxSnapshot();m={left:((p||0)-A.width)/2}}else m=u==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(f==="middle"){var _=this.getBBoxSnapshot();w={top:((x||0)-_.height)/2}}else w=f==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return xi(xi({},m),w)}},{key:"render",value:function(){var r=this,i=this.props,o=i.content,u=i.width,f=i.height,h=i.wrapperStyle,p=i.payloadUniqBy,x=i.payload,m=xi(xi({position:"absolute",width:u||"auto",height:f||"auto"},this.getDefaultPosition(h)),h);return Y.createElement("div",{className:"recharts-legend-wrapper",style:m,ref:function(A){r.wrapperNode=A}},Mz(o,xi(xi({},this.props),{},{payload:B_(x,p,Rz)})))}}],[{key:"getWithHeight",value:function(r,i){var o=xi(xi({},this.defaultProps),r.props),u=o.layout;return u==="vertical"&&xe(r.props.height)?{height:r.props.height}:u==="horizontal"?{width:r.props.width||i}:null}}])}(W.PureComponent);w0(As,"displayName","Legend");w0(As,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var pb=jc,kz=xx,Dz=nr,gb=pb?pb.isConcatSpreadable:void 0;function jz(e){return Dz(e)||kz(e)||!!(gb&&e&&e[gb])}var Lz=jz,Bz=O_,Fz=Lz;function U_(e,t,n,r,i){var o=-1,u=e.length;for(n||(n=Fz),i||(i=[]);++o0&&n(f)?t>1?U_(f,t-1,n,r,i):Bz(i,f):r||(i[i.length]=f)}return i}var z_=U_;function $z(e){return function(t,n,r){for(var i=-1,o=Object(t),u=r(t),f=u.length;f--;){var h=u[e?f:++i];if(n(o[h],h,o)===!1)break}return t}}var Uz=$z,zz=Uz,Wz=zz(),Hz=Wz,Vz=Hz,Gz=v0;function Xz(e,t){return e&&Vz(e,t,Gz)}var W_=Xz,Yz=Fc;function qz(e,t){return function(n,r){if(n==null)return n;if(!Yz(n))return e(n,r);for(var i=n.length,o=t?i:-1,u=Object(n);(t?o--:++ot||o&&u&&h&&!f&&!p||r&&u&&h||!n&&h||!i)return 1;if(!r&&!o&&!p&&e=f)return h;var p=n[r];return h*(p=="desc"?-1:1)}}return e.index-t.index}var uW=lW,K1=ox,cW=sx,fW=Ra,dW=H_,hW=iW,pW=N_,gW=uW,mW=gl,yW=nr;function xW(e,t,n){t.length?t=K1(t,function(o){return yW(o)?function(u){return cW(u,o.length===1?o[0]:o)}:o}):t=[mW];var r=-1;t=K1(t,pW(fW));var i=dW(e,function(o,u,f){var h=K1(t,function(p){return p(o)});return{criteria:h,index:++r,value:o}});return hW(i,function(o,u){return gW(o,u,n)})}var vW=xW;function wW(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var bW=wW,AW=bW,yb=Math.max;function SW(e,t,n){return t=yb(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,o=yb(r.length-t,0),u=Array(o);++i0){if(++t>=MW)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var LW=jW,BW=RW,FW=LW,$W=FW(BW),UW=$W,zW=gl,WW=EW,HW=UW;function VW(e,t){return HW(WW(e,t,zW),e+"")}var GW=VW,XW=nx,YW=Fc,qW=vx,KW=Pa;function ZW(e,t,n){if(!KW(n))return!1;var r=typeof t;return(r=="number"?YW(n)&&qW(t,n.length):r=="string"&&t in n)?XW(n[t],e):!1}var b0=ZW,QW=z_,JW=vW,eH=GW,vb=b0,tH=eH(function(e,t){if(e==null)return[];var n=t.length;return n>1&&vb(e,t[0],t[1])?t=[]:n>2&&vb(t[0],t[1],t[2])&&(t=[t[0]]),JW(e,QW(t,1),[])}),nH=tH;const Sx=wt(nH);function Vu(e){"@babel/helpers - typeof";return Vu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vu(e)}function $g(){return $g=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t.x),"".concat(Wl,"-left"),xe(n)&&t&&xe(t.x)&&n=t.y),"".concat(Wl,"-top"),xe(r)&&t&&xe(t.y)&&rT?Math.max(x,h[r]):Math.max(m,h[r])}function yH(e){var t=e.translateX,n=e.translateY,r=e.useTranslate3d;return{transform:r?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function xH(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,o=e.reverseDirection,u=e.tooltipBox,f=e.useTranslate3d,h=e.viewBox,p,x,m;return u.height>0&&u.width>0&&n?(x=Ab({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:u.width,viewBox:h,viewBoxDimension:h.width}),m=Ab({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:r,position:i,reverseDirection:o,tooltipDimension:u.height,viewBox:h,viewBoxDimension:h.height}),p=yH({translateX:x,translateY:m,useTranslate3d:f})):p=gH,{cssProperties:p,cssClasses:mH({translateX:x,translateY:m,coordinate:n})}}function Ds(e){"@babel/helpers - typeof";return Ds=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ds(e)}function Sb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Eb(e){for(var t=1;tCb||Math.abs(r.height-this.state.lastBoundingBox.height)>Cb)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,i;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((i=this.props.coordinate)===null||i===void 0?void 0:i.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,i=this.props,o=i.active,u=i.allowEscapeViewBox,f=i.animationDuration,h=i.animationEasing,p=i.children,x=i.coordinate,m=i.hasPayload,w=i.isAnimationActive,A=i.offset,_=i.position,T=i.reverseDirection,N=i.useTranslate3d,E=i.viewBox,C=i.wrapperStyle,O=xH({allowEscapeViewBox:u,coordinate:x,offsetTopLeft:A,position:_,reverseDirection:T,tooltipBox:this.state.lastBoundingBox,useTranslate3d:N,viewBox:E}),M=O.cssClasses,P=O.cssProperties,I=Eb(Eb({transition:w&&o?"transform ".concat(f,"ms ").concat(h):void 0},P),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&m?"visible":"hidden",position:"absolute",top:0,left:0},C);return Y.createElement("div",{tabIndex:-1,className:M,style:I,ref:function(B){r.wrapperNode=B}},p)}}])}(W.PureComponent),TH=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},ml={isSsr:TH()};function js(e){"@babel/helpers - typeof";return js=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},js(e)}function Ob(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function _b(e){for(var t=1;t0;return Y.createElement(_H,{allowEscapeViewBox:u,animationDuration:f,animationEasing:h,isAnimationActive:w,active:o,coordinate:x,hasPayload:I,offset:A,position:N,reverseDirection:E,useTranslate3d:C,viewBox:O,wrapperStyle:M},BH(p,_b(_b({},this.props),{},{payload:P})))}}])}(W.PureComponent);Ex(Er,"displayName","Tooltip");Ex(Er,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!ml.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var FH=yi,$H=function(){return FH.Date.now()},UH=$H,zH=/\s/;function WH(e){for(var t=e.length;t--&&zH.test(e.charAt(t)););return t}var HH=WH,VH=HH,GH=/^\s+/;function XH(e){return e&&e.slice(0,VH(e)+1).replace(GH,"")}var YH=XH,qH=YH,Tb=Pa,KH=ll,Nb=NaN,ZH=/^[-+]0x[0-9a-f]+$/i,QH=/^0b[01]+$/i,JH=/^0o[0-7]+$/i,eV=parseInt;function tV(e){if(typeof e=="number")return e;if(KH(e))return Nb;if(Tb(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Tb(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=qH(e);var n=QH.test(e);return n||JH.test(e)?eV(e.slice(2),n?2:8):ZH.test(e)?Nb:+e}var K_=tV,nV=Pa,Q1=UH,Ib=K_,rV="Expected a function",iV=Math.max,aV=Math.min;function oV(e,t,n){var r,i,o,u,f,h,p=0,x=!1,m=!1,w=!0;if(typeof e!="function")throw new TypeError(rV);t=Ib(t)||0,nV(n)&&(x=!!n.leading,m="maxWait"in n,o=m?iV(Ib(n.maxWait)||0,t):o,w="trailing"in n?!!n.trailing:w);function A(I){var k=r,B=i;return r=i=void 0,p=I,u=e.apply(B,k),u}function _(I){return p=I,f=setTimeout(E,t),x?A(I):u}function T(I){var k=I-h,B=I-p,F=t-k;return m?aV(F,o-B):F}function N(I){var k=I-h,B=I-p;return h===void 0||k>=t||k<0||m&&B>=o}function E(){var I=Q1();if(N(I))return C(I);f=setTimeout(E,T(I))}function C(I){return f=void 0,w&&r?A(I):(r=i=void 0,u)}function O(){f!==void 0&&clearTimeout(f),p=0,r=h=i=f=void 0}function M(){return f===void 0?u:C(Q1())}function P(){var I=Q1(),k=N(I);if(r=arguments,i=this,h=I,k){if(f===void 0)return _(h);if(m)return clearTimeout(f),f=setTimeout(E,t),A(h)}return f===void 0&&(f=setTimeout(E,t)),u}return P.cancel=O,P.flush=M,P}var sV=oV,lV=sV,uV=Pa,cV="Expected a function";function fV(e,t,n){var r=!0,i=!0;if(typeof e!="function")throw new TypeError(cV);return uV(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),lV(e,t,{leading:r,maxWait:t,trailing:i})}var dV=fV;const Z_=wt(dV);function Xu(e){"@babel/helpers - typeof";return Xu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xu(e)}function Pb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Sf(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(ne=Z_(ne,T,{trailing:!0,leading:!1}));var J=new ResizeObserver(ne),$=P.current.getBoundingClientRect(),re=$.width,te=$.height;return K(re,te),J.observe(P.current),function(){J.disconnect()}},[K,T]);var H=W.useMemo(function(){var ne=F.containerWidth,J=F.containerHeight;if(ne<0||J<0)return null;Pi(eo(u)||eo(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,u,h),Pi(!n||n>0,"The aspect(%s) must be greater than zero.",n);var $=eo(u)?ne:u,re=eo(h)?J:h;n&&n>0&&($?re=$/n:re&&($=re*n),w&&re>w&&(re=w)),Pi($>0||re>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,$,re,u,h,x,m,n);var te=!Array.isArray(A)&&Ii(A.type).endsWith("Chart");return Y.Children.map(A,function(ee){return Y.isValidElement(ee)?W.cloneElement(ee,Sf({width:$,height:re},te?{style:Sf({height:"100%",width:"100%",maxHeight:re,maxWidth:$},ee.props.style)}:{})):ee})},[n,A,h,w,m,x,F,u]);return Y.createElement("div",{id:N?"".concat(N):void 0,className:rt("recharts-responsive-container",E),style:Sf(Sf({},M),{},{width:u,height:h,minWidth:x,minHeight:m,maxHeight:w}),ref:P},H)}),Q_=function(t){return null};Q_.displayName="Cell";function Yu(e){"@babel/helpers - typeof";return Yu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yu(e)}function Mb(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Vg(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||ml.isSsr)return{width:0,height:0};var r=OV(n),i=JSON.stringify({text:t,copyStyle:r});if(Go.widthCache[i])return Go.widthCache[i];try{var o=document.getElementById(kb);o||(o=document.createElement("span"),o.setAttribute("id",kb),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var u=Vg(Vg({},CV),r);Object.assign(o.style,u),o.textContent="".concat(t);var f=o.getBoundingClientRect(),h={width:f.width,height:f.height};return Go.widthCache[i]=h,++Go.cacheCount>EV&&(Go.cacheCount=0,Go.widthCache={}),h}catch{return{width:0,height:0}}},_V=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function qu(e){"@babel/helpers - typeof";return qu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qu(e)}function $d(e,t){return PV(e)||IV(e,t)||NV(e,t)||TV()}function TV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function NV(e,t){if(e){if(typeof e=="string")return Db(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Db(e,t)}}function Db(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function VV(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ub(e,t){return qV(e)||YV(e,t)||XV(e,t)||GV()}function GV(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function XV(e,t){if(e){if(typeof e=="string")return zb(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zb(e,t)}}function zb(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return $.reduce(function(re,te){var ee=te.word,oe=te.width,ue=re[re.length-1];if(ue&&(i==null||o||ue.width+oe+rte.width?re:te})};if(!x)return A;for(var T="…",N=function($){var re=m.slice(0,$),te=nT({breakAll:p,style:h,children:re+T}).wordsWithComputedWidth,ee=w(te),oe=ee.length>u||_(ee).width>Number(i);return[oe,ee]},E=0,C=m.length-1,O=0,M;E<=C&&O<=m.length-1;){var P=Math.floor((E+C)/2),I=P-1,k=N(I),B=Ub(k,2),F=B[0],q=B[1],K=N(P),H=Ub(K,1),ne=H[0];if(!F&&!ne&&(E=P+1),F&&ne&&(C=P-1),!F&&ne){M=q;break}O++}return M||A},Wb=function(t){var n=Xe(t)?[]:t.toString().split(tT);return[{words:n}]},ZV=function(t){var n=t.width,r=t.scaleToFit,i=t.children,o=t.style,u=t.breakAll,f=t.maxLines;if((n||r)&&!ml.isSsr){var h,p,x=nT({breakAll:u,children:i,style:o});if(x){var m=x.wordsWithComputedWidth,w=x.spaceWidth;h=m,p=w}else return Wb(i);return KV({breakAll:u,children:i,maxLines:f,style:o},h,p,n,r)}return Wb(i)},Hb="#808080",Ud=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,o=i===void 0?0:i,u=t.lineHeight,f=u===void 0?"1em":u,h=t.capHeight,p=h===void 0?"0.71em":h,x=t.scaleToFit,m=x===void 0?!1:x,w=t.textAnchor,A=w===void 0?"start":w,_=t.verticalAnchor,T=_===void 0?"end":_,N=t.fill,E=N===void 0?Hb:N,C=$b(t,WV),O=W.useMemo(function(){return ZV({breakAll:C.breakAll,children:C.children,maxLines:C.maxLines,scaleToFit:m,style:C.style,width:C.width})},[C.breakAll,C.children,C.maxLines,m,C.style,C.width]),M=C.dx,P=C.dy,I=C.angle,k=C.className,B=C.breakAll,F=$b(C,HV);if(!on(r)||!on(o))return null;var q=r+(xe(M)?M:0),K=o+(xe(P)?P:0),H;switch(T){case"start":H=J1("calc(".concat(p,")"));break;case"middle":H=J1("calc(".concat((O.length-1)/2," * -").concat(f," + (").concat(p," / 2))"));break;default:H=J1("calc(".concat(O.length-1," * -").concat(f,")"));break}var ne=[];if(m){var J=O[0].width,$=C.width;ne.push("scale(".concat((xe($)?$/J:1)/J,")"))}return I&&ne.push("rotate(".concat(I,", ").concat(q,", ").concat(K,")")),ne.length&&(F.transform=ne.join(" ")),Y.createElement("text",Gg({},Qe(F,!0),{x:q,y:K,className:rt("recharts-text",k),textAnchor:A,fill:E.includes("url")?Hb:E}),O.map(function(re,te){var ee=re.words.join(B?"":" ");return Y.createElement("tspan",{x:q,dy:te===0?H:f,key:"".concat(ee,"-").concat(te)},ee)}))};function ba(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function QV(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function Cx(e){let t,n,r;e.length!==2?(t=ba,n=(f,h)=>ba(e(f),h),r=(f,h)=>e(f)-h):(t=e===ba||e===QV?e:JV,n=e,r=e);function i(f,h,p=0,x=f.length){if(p>>1;n(f[m],h)<0?p=m+1:x=m}while(p>>1;n(f[m],h)<=0?p=m+1:x=m}while(pp&&r(f[m-1],h)>-r(f[m],h)?m-1:m}return{left:i,center:u,right:o}}function JV(){return 0}function rT(e){return e===null?NaN:+e}function*eG(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const tG=Cx(ba),$c=tG.right;Cx(rT).center;class Vb extends Map{constructor(t,n=iG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,i]of t)this.set(r,i)}get(t){return super.get(Gb(this,t))}has(t){return super.has(Gb(this,t))}set(t,n){return super.set(nG(this,t),n)}delete(t){return super.delete(rG(this,t))}}function Gb({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function nG({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function rG({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function iG(e){return e!==null&&typeof e=="object"?e.valueOf():e}function aG(e=ba){if(e===ba)return iT;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function iT(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const oG=Math.sqrt(50),sG=Math.sqrt(10),lG=Math.sqrt(2);function zd(e,t,n){const r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),o=r/Math.pow(10,i),u=o>=oG?10:o>=sG?5:o>=lG?2:1;let f,h,p;return i<0?(p=Math.pow(10,-i)/u,f=Math.round(e*p),h=Math.round(t*p),f/pt&&--h,p=-p):(p=Math.pow(10,i)*u,f=Math.round(e/p),h=Math.round(t/p),f*pt&&--h),h0))return[];if(e===t)return[e];const r=t=i))return[];const f=o-i+1,h=new Array(f);if(r)if(u<0)for(let p=0;p=r)&&(n=r);return n}function Yb(e,t){let n;for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function aT(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?iT:aG(i);r>n;){if(r-n>600){const h=r-n+1,p=t-n+1,x=Math.log(h),m=.5*Math.exp(2*x/3),w=.5*Math.sqrt(x*m*(h-m)/h)*(p-h/2<0?-1:1),A=Math.max(n,Math.floor(t-p*m/h+w)),_=Math.min(r,Math.floor(t+(h-p)*m/h+w));aT(e,t,A,_,i)}const o=e[t];let u=n,f=r;for(Hl(e,n,t),i(e[r],o)>0&&Hl(e,n,r);u0;)--f}i(e[n],o)===0?Hl(e,n,f):(++f,Hl(e,f,r)),f<=t&&(n=f+1),t<=f&&(r=f-1)}return e}function Hl(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function uG(e,t,n){if(e=Float64Array.from(eG(e)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return Yb(e);if(t>=1)return Xb(e);var r,i=(r-1)*t,o=Math.floor(i),u=Xb(aT(e,o).subarray(0,o+1)),f=Yb(e.subarray(o+1));return u+(f-u)*(i-o)}}function cG(e,t,n=rT){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,o=Math.floor(i),u=+n(e[o],o,e),f=+n(e[o+1],o+1,e);return u+(f-u)*(i-o)}}function fG(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Cf(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Cf(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=hG.exec(e))?new Zn(t[1],t[2],t[3],1):(t=pG.exec(e))?new Zn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=gG.exec(e))?Cf(t[1],t[2],t[3],t[4]):(t=mG.exec(e))?Cf(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=yG.exec(e))?tA(t[1],t[2]/100,t[3]/100,1):(t=xG.exec(e))?tA(t[1],t[2]/100,t[3]/100,t[4]):qb.hasOwnProperty(e)?Qb(qb[e]):e==="transparent"?new Zn(NaN,NaN,NaN,0):null}function Qb(e){return new Zn(e>>16&255,e>>8&255,e&255,1)}function Cf(e,t,n,r){return r<=0&&(e=t=n=NaN),new Zn(e,t,n,r)}function bG(e){return e instanceof Uc||(e=Ju(e)),e?(e=e.rgb(),new Zn(e.r,e.g,e.b,e.opacity)):new Zn}function Zg(e,t,n,r){return arguments.length===1?bG(e):new Zn(e,t,n,r??1)}function Zn(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}_x(Zn,Zg,sT(Uc,{brighter(e){return e=e==null?Wd:Math.pow(Wd,e),new Zn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Zu:Math.pow(Zu,e),new Zn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Zn(lo(this.r),lo(this.g),lo(this.b),Hd(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Jb,formatHex:Jb,formatHex8:AG,formatRgb:eA,toString:eA}));function Jb(){return`#${to(this.r)}${to(this.g)}${to(this.b)}`}function AG(){return`#${to(this.r)}${to(this.g)}${to(this.b)}${to((isNaN(this.opacity)?1:this.opacity)*255)}`}function eA(){const e=Hd(this.opacity);return`${e===1?"rgb(":"rgba("}${lo(this.r)}, ${lo(this.g)}, ${lo(this.b)}${e===1?")":`, ${e})`}`}function Hd(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function lo(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function to(e){return e=lo(e),(e<16?"0":"")+e.toString(16)}function tA(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new Kr(e,t,n,r)}function lT(e){if(e instanceof Kr)return new Kr(e.h,e.s,e.l,e.opacity);if(e instanceof Uc||(e=Ju(e)),!e)return new Kr;if(e instanceof Kr)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),o=Math.max(t,n,r),u=NaN,f=o-i,h=(o+i)/2;return f?(t===o?u=(n-r)/f+(n0&&h<1?0:u,new Kr(u,f,h,e.opacity)}function SG(e,t,n,r){return arguments.length===1?lT(e):new Kr(e,t,n,r??1)}function Kr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}_x(Kr,SG,sT(Uc,{brighter(e){return e=e==null?Wd:Math.pow(Wd,e),new Kr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Zu:Math.pow(Zu,e),new Kr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new Zn(ep(e>=240?e-240:e+120,i,r),ep(e,i,r),ep(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new Kr(nA(this.h),Of(this.s),Of(this.l),Hd(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Hd(this.opacity);return`${e===1?"hsl(":"hsla("}${nA(this.h)}, ${Of(this.s)*100}%, ${Of(this.l)*100}%${e===1?")":`, ${e})`}`}}));function nA(e){return e=(e||0)%360,e<0?e+360:e}function Of(e){return Math.max(0,Math.min(1,e||0))}function ep(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const Tx=e=>()=>e;function EG(e,t){return function(n){return e+n*t}}function CG(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function OG(e){return(e=+e)==1?uT:function(t,n){return n-t?CG(t,n,e):Tx(isNaN(t)?n:t)}}function uT(e,t){var n=t-e;return n?EG(e,n):Tx(isNaN(e)?t:e)}const rA=function e(t){var n=OG(t);function r(i,o){var u=n((i=Zg(i)).r,(o=Zg(o)).r),f=n(i.g,o.g),h=n(i.b,o.b),p=uT(i.opacity,o.opacity);return function(x){return i.r=u(x),i.g=f(x),i.b=h(x),i.opacity=p(x),i+""}}return r.gamma=e,r}(1);function _G(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(o){for(i=0;in&&(o=t.slice(n,o),f[u]?f[u]+=o:f[++u]=o),(r=r[0])===(i=i[0])?f[u]?f[u]+=i:f[++u]=i:(f[++u]=null,h.push({i:u,x:Vd(r,i)})),n=tp.lastIndex;return nt&&(n=e,e=t,t=n),function(r){return Math.max(e,Math.min(t,r))}}function BG(e,t,n){var r=e[0],i=e[1],o=t[0],u=t[1];return i2?FG:BG,h=p=null,m}function m(w){return w==null||isNaN(w=+w)?o:(h||(h=f(e.map(r),t,n)))(r(u(w)))}return m.invert=function(w){return u(i((p||(p=f(t,e.map(r),Vd)))(w)))},m.domain=function(w){return arguments.length?(e=Array.from(w,Gd),x()):e.slice()},m.range=function(w){return arguments.length?(t=Array.from(w),x()):t.slice()},m.rangeRound=function(w){return t=Array.from(w),n=Nx,x()},m.clamp=function(w){return arguments.length?(u=w?!0:$n,x()):u!==$n},m.interpolate=function(w){return arguments.length?(n=w,x()):n},m.unknown=function(w){return arguments.length?(o=w,m):o},function(w,A){return r=w,i=A,x()}}function Ix(){return A0()($n,$n)}function $G(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function Xd(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Ls(e){return e=Xd(Math.abs(e)),e?e[1]:NaN}function UG(e,t){return function(n,r){for(var i=n.length,o=[],u=0,f=e[0],h=0;i>0&&f>0&&(h+f+1>r&&(f=Math.max(1,r-h)),o.push(n.substring(i-=f,i+f)),!((h+=f+1)>r));)f=e[u=(u+1)%e.length];return o.reverse().join(t)}}function zG(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var WG=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ec(e){if(!(t=WG.exec(e)))throw new Error("invalid format: "+e);var t;return new Px({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ec.prototype=Px.prototype;function Px(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Px.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function HG(e){e:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Yd;function VG(e,t){var n=Xd(e,t);if(!n)return Yd=void 0,e.toPrecision(t);var r=n[0],i=n[1],o=i-(Yd=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,u=r.length;return o===u?r:o>u?r+new Array(o-u+1).join("0"):o>0?r.slice(0,o)+"."+r.slice(o):"0."+new Array(1-o).join("0")+Xd(e,Math.max(0,t+o-1))[0]}function aA(e,t){var n=Xd(e,t);if(!n)return e+"";var r=n[0],i=n[1];return i<0?"0."+new Array(-i).join("0")+r:r.length>i+1?r.slice(0,i+1)+"."+r.slice(i+1):r+new Array(i-r.length+2).join("0")}const oA={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:$G,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>aA(e*100,t),r:aA,s:VG,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function sA(e){return e}var lA=Array.prototype.map,uA=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function GG(e){var t=e.grouping===void 0||e.thousands===void 0?sA:UG(lA.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",r=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?sA:zG(lA.call(e.numerals,String)),u=e.percent===void 0?"%":e.percent+"",f=e.minus===void 0?"−":e.minus+"",h=e.nan===void 0?"NaN":e.nan+"";function p(m,w){m=ec(m);var A=m.fill,_=m.align,T=m.sign,N=m.symbol,E=m.zero,C=m.width,O=m.comma,M=m.precision,P=m.trim,I=m.type;I==="n"?(O=!0,I="g"):oA[I]||(M===void 0&&(M=12),P=!0,I="g"),(E||A==="0"&&_==="=")&&(E=!0,A="0",_="=");var k=(w&&w.prefix!==void 0?w.prefix:"")+(N==="$"?n:N==="#"&&/[boxX]/.test(I)?"0"+I.toLowerCase():""),B=(N==="$"?r:/[%p]/.test(I)?u:"")+(w&&w.suffix!==void 0?w.suffix:""),F=oA[I],q=/[defgprs%]/.test(I);M=M===void 0?6:/[gprs]/.test(I)?Math.max(1,Math.min(21,M)):Math.max(0,Math.min(20,M));function K(H){var ne=k,J=B,$,re,te;if(I==="c")J=F(H)+J,H="";else{H=+H;var ee=H<0||1/H<0;if(H=isNaN(H)?h:F(Math.abs(H),M),P&&(H=HG(H)),ee&&+H==0&&T!=="+"&&(ee=!1),ne=(ee?T==="("?T:f:T==="-"||T==="("?"":T)+ne,J=(I==="s"&&!isNaN(H)&&Yd!==void 0?uA[8+Yd/3]:"")+J+(ee&&T==="("?")":""),q){for($=-1,re=H.length;++$te||te>57){J=(te===46?i+H.slice($+1):H.slice($))+J,H=H.slice(0,$);break}}}O&&!E&&(H=t(H,1/0));var oe=ne.length+H.length+J.length,ue=oe>1)+ne+H+J+ue.slice(oe);break;default:H=ue+ne+H+J;break}return o(H)}return K.toString=function(){return m+""},K}function x(m,w){var A=Math.max(-8,Math.min(8,Math.floor(Ls(w)/3)))*3,_=Math.pow(10,-A),T=p((m=ec(m),m.type="f",m),{suffix:uA[8+A/3]});return function(N){return T(_*N)}}return{format:p,formatPrefix:x}}var _f,Rx,cT;XG({thousands:",",grouping:[3],currency:["$",""]});function XG(e){return _f=GG(e),Rx=_f.format,cT=_f.formatPrefix,_f}function YG(e){return Math.max(0,-Ls(Math.abs(e)))}function qG(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Ls(t)/3)))*3-Ls(Math.abs(e)))}function KG(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Ls(t)-Ls(e))+1}function fT(e,t,n,r){var i=qg(e,t,n),o;switch(r=ec(r??",f"),r.type){case"s":{var u=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(o=qG(i,u))&&(r.precision=o),cT(r,u)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(o=KG(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=o-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(o=YG(i))&&(r.precision=o-(r.type==="%")*2);break}}return Rx(r)}function Ma(e){var t=e.domain;return e.ticks=function(n){var r=t();return Xg(r[0],r[r.length-1],n??10)},e.tickFormat=function(n,r){var i=t();return fT(i[0],i[i.length-1],n??10,r)},e.nice=function(n){n==null&&(n=10);var r=t(),i=0,o=r.length-1,u=r[i],f=r[o],h,p,x=10;for(f0;){if(p=Yg(u,f,n),p===h)return r[i]=u,r[o]=f,t(r);if(p>0)u=Math.floor(u/p)*p,f=Math.ceil(f/p)*p;else if(p<0)u=Math.ceil(u*p)/p,f=Math.floor(f*p)/p;else break;h=p}return e},e}function qd(){var e=Ix();return e.copy=function(){return zc(e,qd())},Lr.apply(e,arguments),Ma(e)}function dT(e){var t;function n(r){return r==null||isNaN(r=+r)?t:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(e=Array.from(r,Gd),n):e.slice()},n.unknown=function(r){return arguments.length?(t=r,n):t},n.copy=function(){return dT(e).unknown(t)},e=arguments.length?Array.from(e,Gd):[0,1],Ma(n)}function hT(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],o=e[r],u;return oMath.pow(e,t)}function tX(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function dA(e){return(t,n)=>-e(-t,n)}function Mx(e){const t=e(cA,fA),n=t.domain;let r=10,i,o;function u(){return i=tX(r),o=eX(r),n()[0]<0?(i=dA(i),o=dA(o),e(ZG,QG)):e(cA,fA),t}return t.base=function(f){return arguments.length?(r=+f,u()):r},t.domain=function(f){return arguments.length?(n(f),u()):n()},t.ticks=f=>{const h=n();let p=h[0],x=h[h.length-1];const m=x0){for(;w<=A;++w)for(_=1;_x)break;E.push(T)}}else for(;w<=A;++w)for(_=r-1;_>=1;--_)if(T=w>0?_/o(-w):_*o(w),!(Tx)break;E.push(T)}E.length*2{if(f==null&&(f=10),h==null&&(h=r===10?"s":","),typeof h!="function"&&(!(r%1)&&(h=ec(h)).precision==null&&(h.trim=!0),h=Rx(h)),f===1/0)return h;const p=Math.max(1,r*f/t.ticks().length);return x=>{let m=x/o(Math.round(i(x)));return m*rn(hT(n(),{floor:f=>o(Math.floor(i(f))),ceil:f=>o(Math.ceil(i(f)))})),t}function pT(){const e=Mx(A0()).domain([1,10]);return e.copy=()=>zc(e,pT()).base(e.base()),Lr.apply(e,arguments),e}function hA(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function pA(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function kx(e){var t=1,n=e(hA(t),pA(t));return n.constant=function(r){return arguments.length?e(hA(t=+r),pA(t)):t},Ma(n)}function gT(){var e=kx(A0());return e.copy=function(){return zc(e,gT()).constant(e.constant())},Lr.apply(e,arguments)}function gA(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function nX(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function rX(e){return e<0?-e*e:e*e}function Dx(e){var t=e($n,$n),n=1;function r(){return n===1?e($n,$n):n===.5?e(nX,rX):e(gA(n),gA(1/n))}return t.exponent=function(i){return arguments.length?(n=+i,r()):n},Ma(t)}function jx(){var e=Dx(A0());return e.copy=function(){return zc(e,jx()).exponent(e.exponent())},Lr.apply(e,arguments),e}function iX(){return jx.apply(null,arguments).exponent(.5)}function mA(e){return Math.sign(e)*e*e}function aX(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function mT(){var e=Ix(),t=[0,1],n=!1,r;function i(o){var u=aX(e(o));return isNaN(u)?r:n?Math.round(u):u}return i.invert=function(o){return e.invert(mA(o))},i.domain=function(o){return arguments.length?(e.domain(o),i):e.domain()},i.range=function(o){return arguments.length?(e.range((t=Array.from(o,Gd)).map(mA)),i):t.slice()},i.rangeRound=function(o){return i.range(o).round(!0)},i.round=function(o){return arguments.length?(n=!!o,i):n},i.clamp=function(o){return arguments.length?(e.clamp(o),i):e.clamp()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return mT(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},Lr.apply(i,arguments),Ma(i)}function yT(){var e=[],t=[],n=[],r;function i(){var u=0,f=Math.max(1,t.length);for(n=new Array(f-1);++u0?n[f-1]:e[0],f=n?[r[n-1],t]:[r[p-1],r[p]]},u.unknown=function(h){return arguments.length&&(o=h),u},u.thresholds=function(){return r.slice()},u.copy=function(){return xT().domain([e,t]).range(i).unknown(o)},Lr.apply(Ma(u),arguments)}function vT(){var e=[.5],t=[0,1],n,r=1;function i(o){return o!=null&&o<=o?t[$c(e,o,0,r)]:n}return i.domain=function(o){return arguments.length?(e=Array.from(o),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var u=t.indexOf(o);return[e[u-1],e[u]]},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return vT().domain(e).range(t).unknown(n)},Lr.apply(i,arguments)}const np=new Date,rp=new Date;function sn(e,t,n,r){function i(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return i.floor=o=>(e(o=new Date(+o)),o),i.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),i.round=o=>{const u=i(o),f=i.ceil(o);return o-u(t(o=new Date(+o),u==null?1:Math.floor(u)),o),i.range=(o,u,f)=>{const h=[];if(o=i.ceil(o),f=f==null?1:Math.floor(f),!(o0))return h;let p;do h.push(p=new Date(+o)),t(o,f),e(o);while(psn(u=>{if(u>=u)for(;e(u),!o(u);)u.setTime(u-1)},(u,f)=>{if(u>=u)if(f<0)for(;++f<=0;)for(;t(u,-1),!o(u););else for(;--f>=0;)for(;t(u,1),!o(u););}),n&&(i.count=(o,u)=>(np.setTime(+o),rp.setTime(+u),e(np),e(rp),Math.floor(n(np,rp))),i.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?i.filter(r?u=>r(u)%o===0:u=>i.count(0,u)%o===0):i)),i}const Kd=sn(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);Kd.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?sn(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):Kd);Kd.range;const Oi=1e3,Tr=Oi*60,_i=Tr*60,Li=_i*24,Lx=Li*7,yA=Li*30,ip=Li*365,no=sn(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*Oi)},(e,t)=>(t-e)/Oi,e=>e.getUTCSeconds());no.range;const Bx=sn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Oi)},(e,t)=>{e.setTime(+e+t*Tr)},(e,t)=>(t-e)/Tr,e=>e.getMinutes());Bx.range;const Fx=sn(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*Tr)},(e,t)=>(t-e)/Tr,e=>e.getUTCMinutes());Fx.range;const $x=sn(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*Oi-e.getMinutes()*Tr)},(e,t)=>{e.setTime(+e+t*_i)},(e,t)=>(t-e)/_i,e=>e.getHours());$x.range;const Ux=sn(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*_i)},(e,t)=>(t-e)/_i,e=>e.getUTCHours());Ux.range;const Wc=sn(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*Tr)/Li,e=>e.getDate()-1);Wc.range;const S0=sn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Li,e=>e.getUTCDate()-1);S0.range;const wT=sn(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Li,e=>Math.floor(e/Li));wT.range;function Io(e){return sn(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*Tr)/Lx)}const E0=Io(0),Zd=Io(1),oX=Io(2),sX=Io(3),Bs=Io(4),lX=Io(5),uX=Io(6);E0.range;Zd.range;oX.range;sX.range;Bs.range;lX.range;uX.range;function Po(e){return sn(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/Lx)}const C0=Po(0),Qd=Po(1),cX=Po(2),fX=Po(3),Fs=Po(4),dX=Po(5),hX=Po(6);C0.range;Qd.range;cX.range;fX.range;Fs.range;dX.range;hX.range;const zx=sn(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());zx.range;const Wx=sn(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());Wx.range;const Bi=sn(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Bi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sn(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Bi.range;const Fi=sn(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());Fi.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:sn(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});Fi.range;function bT(e,t,n,r,i,o){const u=[[no,1,Oi],[no,5,5*Oi],[no,15,15*Oi],[no,30,30*Oi],[o,1,Tr],[o,5,5*Tr],[o,15,15*Tr],[o,30,30*Tr],[i,1,_i],[i,3,3*_i],[i,6,6*_i],[i,12,12*_i],[r,1,Li],[r,2,2*Li],[n,1,Lx],[t,1,yA],[t,3,3*yA],[e,1,ip]];function f(p,x,m){const w=xN).right(u,w);if(A===u.length)return e.every(qg(p/ip,x/ip,m));if(A===0)return Kd.every(Math.max(qg(p,x,m),1));const[_,T]=u[w/u[A-1][2]53)return null;"w"in ce||(ce.w=1),"Z"in ce?(Le=op(Vl(ce.y,0,1)),et=Le.getUTCDay(),Le=et>4||et===0?Qd.ceil(Le):Qd(Le),Le=S0.offset(Le,(ce.V-1)*7),ce.y=Le.getUTCFullYear(),ce.m=Le.getUTCMonth(),ce.d=Le.getUTCDate()+(ce.w+6)%7):(Le=ap(Vl(ce.y,0,1)),et=Le.getDay(),Le=et>4||et===0?Zd.ceil(Le):Zd(Le),Le=Wc.offset(Le,(ce.V-1)*7),ce.y=Le.getFullYear(),ce.m=Le.getMonth(),ce.d=Le.getDate()+(ce.w+6)%7)}else("W"in ce||"U"in ce)&&("w"in ce||(ce.w="u"in ce?ce.u%7:"W"in ce?1:0),et="Z"in ce?op(Vl(ce.y,0,1)).getUTCDay():ap(Vl(ce.y,0,1)).getDay(),ce.m=0,ce.d="W"in ce?(ce.w+6)%7+ce.W*7-(et+5)%7:ce.w+ce.U*7-(et+6)%7);return"Z"in ce?(ce.H+=ce.Z/100|0,ce.M+=ce.Z%100,op(ce)):ap(ce)}}function B(ye,je,Re,ce){for(var Ne=0,Le=je.length,et=Re.length,ct,ze;Ne=et)return-1;if(ct=je.charCodeAt(Ne++),ct===37){if(ct=je.charAt(Ne++),ze=P[ct in xA?je.charAt(Ne++):ct],!ze||(ce=ze(ye,Re,ce))<0)return-1}else if(ct!=Re.charCodeAt(ce++))return-1}return ce}function F(ye,je,Re){var ce=p.exec(je.slice(Re));return ce?(ye.p=x.get(ce[0].toLowerCase()),Re+ce[0].length):-1}function q(ye,je,Re){var ce=A.exec(je.slice(Re));return ce?(ye.w=_.get(ce[0].toLowerCase()),Re+ce[0].length):-1}function K(ye,je,Re){var ce=m.exec(je.slice(Re));return ce?(ye.w=w.get(ce[0].toLowerCase()),Re+ce[0].length):-1}function H(ye,je,Re){var ce=E.exec(je.slice(Re));return ce?(ye.m=C.get(ce[0].toLowerCase()),Re+ce[0].length):-1}function ne(ye,je,Re){var ce=T.exec(je.slice(Re));return ce?(ye.m=N.get(ce[0].toLowerCase()),Re+ce[0].length):-1}function J(ye,je,Re){return B(ye,t,je,Re)}function $(ye,je,Re){return B(ye,n,je,Re)}function re(ye,je,Re){return B(ye,r,je,Re)}function te(ye){return u[ye.getDay()]}function ee(ye){return o[ye.getDay()]}function oe(ye){return h[ye.getMonth()]}function ue(ye){return f[ye.getMonth()]}function me(ye){return i[+(ye.getHours()>=12)]}function le(ye){return 1+~~(ye.getMonth()/3)}function Ee(ye){return u[ye.getUTCDay()]}function Pe(ye){return o[ye.getUTCDay()]}function Je(ye){return h[ye.getUTCMonth()]}function Se(ye){return f[ye.getUTCMonth()]}function Ue(ye){return i[+(ye.getUTCHours()>=12)]}function $e(ye){return 1+~~(ye.getUTCMonth()/3)}return{format:function(ye){var je=I(ye+="",O);return je.toString=function(){return ye},je},parse:function(ye){var je=k(ye+="",!1);return je.toString=function(){return ye},je},utcFormat:function(ye){var je=I(ye+="",M);return je.toString=function(){return ye},je},utcParse:function(ye){var je=k(ye+="",!0);return je.toString=function(){return ye},je}}}var xA={"-":"",_:" ",0:"0"},mn=/^\s*\d+/,vX=/^%/,wX=/[\\^$*+?|[\]().{}]/g;function at(e,t,n){var r=e<0?"-":"",i=(r?-e:e)+"",o=i.length;return r+(o[t.toLowerCase(),n]))}function AX(e,t,n){var r=mn.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function SX(e,t,n){var r=mn.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function EX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function CX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function OX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function vA(e,t,n){var r=mn.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function wA(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function _X(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function TX(e,t,n){var r=mn.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function NX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function bA(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function IX(e,t,n){var r=mn.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function AA(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function PX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function RX(e,t,n){var r=mn.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function MX(e,t,n){var r=mn.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function kX(e,t,n){var r=mn.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function DX(e,t,n){var r=vX.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function jX(e,t,n){var r=mn.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function LX(e,t,n){var r=mn.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function SA(e,t){return at(e.getDate(),t,2)}function BX(e,t){return at(e.getHours(),t,2)}function FX(e,t){return at(e.getHours()%12||12,t,2)}function $X(e,t){return at(1+Wc.count(Bi(e),e),t,3)}function AT(e,t){return at(e.getMilliseconds(),t,3)}function UX(e,t){return AT(e,t)+"000"}function zX(e,t){return at(e.getMonth()+1,t,2)}function WX(e,t){return at(e.getMinutes(),t,2)}function HX(e,t){return at(e.getSeconds(),t,2)}function VX(e){var t=e.getDay();return t===0?7:t}function GX(e,t){return at(E0.count(Bi(e)-1,e),t,2)}function ST(e){var t=e.getDay();return t>=4||t===0?Bs(e):Bs.ceil(e)}function XX(e,t){return e=ST(e),at(Bs.count(Bi(e),e)+(Bi(e).getDay()===4),t,2)}function YX(e){return e.getDay()}function qX(e,t){return at(Zd.count(Bi(e)-1,e),t,2)}function KX(e,t){return at(e.getFullYear()%100,t,2)}function ZX(e,t){return e=ST(e),at(e.getFullYear()%100,t,2)}function QX(e,t){return at(e.getFullYear()%1e4,t,4)}function JX(e,t){var n=e.getDay();return e=n>=4||n===0?Bs(e):Bs.ceil(e),at(e.getFullYear()%1e4,t,4)}function eY(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+at(t/60|0,"0",2)+at(t%60,"0",2)}function EA(e,t){return at(e.getUTCDate(),t,2)}function tY(e,t){return at(e.getUTCHours(),t,2)}function nY(e,t){return at(e.getUTCHours()%12||12,t,2)}function rY(e,t){return at(1+S0.count(Fi(e),e),t,3)}function ET(e,t){return at(e.getUTCMilliseconds(),t,3)}function iY(e,t){return ET(e,t)+"000"}function aY(e,t){return at(e.getUTCMonth()+1,t,2)}function oY(e,t){return at(e.getUTCMinutes(),t,2)}function sY(e,t){return at(e.getUTCSeconds(),t,2)}function lY(e){var t=e.getUTCDay();return t===0?7:t}function uY(e,t){return at(C0.count(Fi(e)-1,e),t,2)}function CT(e){var t=e.getUTCDay();return t>=4||t===0?Fs(e):Fs.ceil(e)}function cY(e,t){return e=CT(e),at(Fs.count(Fi(e),e)+(Fi(e).getUTCDay()===4),t,2)}function fY(e){return e.getUTCDay()}function dY(e,t){return at(Qd.count(Fi(e)-1,e),t,2)}function hY(e,t){return at(e.getUTCFullYear()%100,t,2)}function pY(e,t){return e=CT(e),at(e.getUTCFullYear()%100,t,2)}function gY(e,t){return at(e.getUTCFullYear()%1e4,t,4)}function mY(e,t){var n=e.getUTCDay();return e=n>=4||n===0?Fs(e):Fs.ceil(e),at(e.getUTCFullYear()%1e4,t,4)}function yY(){return"+0000"}function CA(){return"%"}function OA(e){return+e}function _A(e){return Math.floor(+e/1e3)}var Xo,OT,_T;xY({dateTime:"%x, %X",date:"%-m/%-d/%Y",time:"%-I:%M:%S %p",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function xY(e){return Xo=xX(e),OT=Xo.format,Xo.parse,_T=Xo.utcFormat,Xo.utcParse,Xo}function vY(e){return new Date(e)}function wY(e){return e instanceof Date?+e:+new Date(+e)}function Hx(e,t,n,r,i,o,u,f,h,p){var x=Ix(),m=x.invert,w=x.domain,A=p(".%L"),_=p(":%S"),T=p("%I:%M"),N=p("%I %p"),E=p("%a %d"),C=p("%b %d"),O=p("%B"),M=p("%Y");function P(I){return(h(I)t(i/(e.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(i,o)=>uG(e,o/r))},n.copy=function(){return PT(t).domain(e)},Vi.apply(n,arguments)}function _0(){var e=0,t=.5,n=1,r=1,i,o,u,f,h,p=$n,x,m=!1,w;function A(T){return isNaN(T=+T)?w:(T=.5+((T=+x(T))-o)*(r*Tt}var TY=_Y,NY=DT,IY=TY,PY=gl;function RY(e){return e&&e.length?NY(e,PY,IY):void 0}var MY=RY;const T0=wt(MY);function kY(e,t){return ee.e^o.s<0?1:-1;for(r=o.d.length,i=e.d.length,t=0,n=re.d[t]^o.s<0?1:-1;return r===i?0:r>i^o.s<0?1:-1};Te.decimalPlaces=Te.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*_t;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};Te.dividedBy=Te.div=function(e){return Ri(this,new this.constructor(e))};Te.dividedToIntegerBy=Te.idiv=function(e){var t=this,n=t.constructor;return vt(Ri(t,new n(e),0,1),n.precision)};Te.equals=Te.eq=function(e){return!this.cmp(e)};Te.exponent=function(){return Zt(this)};Te.greaterThan=Te.gt=function(e){return this.cmp(e)>0};Te.greaterThanOrEqualTo=Te.gte=function(e){return this.cmp(e)>=0};Te.isInteger=Te.isint=function(){return this.e>this.d.length-2};Te.isNegative=Te.isneg=function(){return this.s<0};Te.isPositive=Te.ispos=function(){return this.s>0};Te.isZero=function(){return this.s===0};Te.lessThan=Te.lt=function(e){return this.cmp(e)<0};Te.lessThanOrEqualTo=Te.lte=function(e){return this.cmp(e)<1};Te.logarithm=Te.log=function(e){var t,n=this,r=n.constructor,i=r.precision,o=i+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(cr))throw Error(kr+"NaN");if(n.s<1)throw Error(kr+(n.s?"NaN":"-Infinity"));return n.eq(cr)?new r(0):(Pt=!1,t=Ri(tc(n,o),tc(e,o),o),Pt=!0,vt(t,i))};Te.minus=Te.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?FT(t,e):LT(t,(e.s=-e.s,e))};Te.modulo=Te.mod=function(e){var t,n=this,r=n.constructor,i=r.precision;if(e=new r(e),!e.s)throw Error(kr+"NaN");return n.s?(Pt=!1,t=Ri(n,e,0,1).times(e),Pt=!0,n.minus(t)):vt(new r(n),i)};Te.naturalExponential=Te.exp=function(){return BT(this)};Te.naturalLogarithm=Te.ln=function(){return tc(this)};Te.negated=Te.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};Te.plus=Te.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?LT(t,e):FT(t,(e.s=-e.s,e))};Te.precision=Te.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(uo+e);if(t=Zt(i)+1,r=i.d.length-1,n=r*_t+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n};Te.squareRoot=Te.sqrt=function(){var e,t,n,r,i,o,u,f=this,h=f.constructor;if(f.s<1){if(!f.s)return new h(0);throw Error(kr+"NaN")}for(e=Zt(f),Pt=!1,i=Math.sqrt(+f),i==0||i==1/0?(t=fi(f.d),(t.length+e)%2==0&&(t+="0"),i=Math.sqrt(t),e=vl((e+1)/2)-(e<0||e%2),i==1/0?t="5e"+e:(t=i.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),r=new h(t)):r=new h(i.toString()),n=h.precision,i=u=n+3;;)if(o=r,r=o.plus(Ri(f,o,u+2)).times(.5),fi(o.d).slice(0,u)===(t=fi(r.d)).slice(0,u)){if(t=t.slice(u-3,u+1),i==u&&t=="4999"){if(vt(o,n+1,0),o.times(o).eq(f)){r=o;break}}else if(t!="9999")break;u+=4}return Pt=!0,vt(r,n)};Te.times=Te.mul=function(e){var t,n,r,i,o,u,f,h,p,x=this,m=x.constructor,w=x.d,A=(e=new m(e)).d;if(!x.s||!e.s)return new m(0);for(e.s*=x.s,n=x.e+e.e,h=w.length,p=A.length,h=0;){for(t=0,i=h+r;i>r;)f=o[i]+A[r]*w[i-r-1]+t,o[i--]=f%dn|0,t=f/dn|0;o[i]=(o[i]+t)%dn|0}for(;!o[--u];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,Pt?vt(e,m.precision):e};Te.toDecimalPlaces=Te.todp=function(e,t){var n=this,r=n.constructor;return n=new r(n),e===void 0?n:(mi(e,0,xl),t===void 0?t=r.rounding:mi(t,0,8),vt(n,e+Zt(n)+1,t))};Te.toExponential=function(e,t){var n,r=this,i=r.constructor;return e===void 0?n=bo(r,!0):(mi(e,0,xl),t===void 0?t=i.rounding:mi(t,0,8),r=vt(new i(r),e+1,t),n=bo(r,!0,e+1)),n};Te.toFixed=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?bo(i):(mi(e,0,xl),t===void 0?t=o.rounding:mi(t,0,8),r=vt(new o(i),e+Zt(i)+1,t),n=bo(r.abs(),!1,e+Zt(r)+1),i.isneg()&&!i.isZero()?"-"+n:n)};Te.toInteger=Te.toint=function(){var e=this,t=e.constructor;return vt(new t(e),Zt(e)+1,t.rounding)};Te.toNumber=function(){return+this};Te.toPower=Te.pow=function(e){var t,n,r,i,o,u,f=this,h=f.constructor,p=12,x=+(e=new h(e));if(!e.s)return new h(cr);if(f=new h(f),!f.s){if(e.s<1)throw Error(kr+"Infinity");return f}if(f.eq(cr))return f;if(r=h.precision,e.eq(cr))return vt(f,r);if(t=e.e,n=e.d.length-1,u=t>=n,o=f.s,u){if((n=x<0?-x:x)<=jT){for(i=new h(cr),t=Math.ceil(r/_t+4),Pt=!1;n%2&&(i=i.times(f),IA(i.d,t)),n=vl(n/2),n!==0;)f=f.times(f),IA(f.d,t);return Pt=!0,e.s<0?new h(cr).div(i):vt(i,r)}}else if(o<0)throw Error(kr+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,f.s=1,Pt=!1,i=e.times(tc(f,r+p)),Pt=!0,i=BT(i),i.s=o,i};Te.toPrecision=function(e,t){var n,r,i=this,o=i.constructor;return e===void 0?(n=Zt(i),r=bo(i,n<=o.toExpNeg||n>=o.toExpPos)):(mi(e,1,xl),t===void 0?t=o.rounding:mi(t,0,8),i=vt(new o(i),e,t),n=Zt(i),r=bo(i,e<=n||n<=o.toExpNeg,e)),r};Te.toSignificantDigits=Te.tosd=function(e,t){var n=this,r=n.constructor;return e===void 0?(e=r.precision,t=r.rounding):(mi(e,1,xl),t===void 0?t=r.rounding:mi(t,0,8)),vt(new r(n),e,t)};Te.toString=Te.valueOf=Te.val=Te.toJSON=Te[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Zt(e),n=e.constructor;return bo(e,t<=n.toExpNeg||t>=n.toExpPos)};function LT(e,t){var n,r,i,o,u,f,h,p,x=e.constructor,m=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),Pt?vt(t,m):t;if(h=e.d,p=t.d,u=e.e,i=t.e,h=h.slice(),o=u-i,o){for(o<0?(r=h,o=-o,f=p.length):(r=p,i=u,f=h.length),u=Math.ceil(m/_t),f=u>f?u+1:f+1,o>f&&(o=f,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(f=h.length,o=p.length,f-o<0&&(o=f,r=p,p=h,h=r),n=0;o;)n=(h[--o]=h[o]+p[o]+n)/dn|0,h[o]%=dn;for(n&&(h.unshift(n),++i),f=h.length;h[--f]==0;)h.pop();return t.d=h,t.e=i,Pt?vt(t,m):t}function mi(e,t,n){if(e!==~~e||en)throw Error(uo+e)}function fi(e){var t,n,r,i=e.length-1,o="",u=e[0];if(i>0){for(o+=u,t=1;tu?1:-1;else for(f=h=0;fi[f]?1:-1;break}return h}function n(r,i,o){for(var u=0;o--;)r[o]-=u,u=r[o]1;)r.shift()}return function(r,i,o,u){var f,h,p,x,m,w,A,_,T,N,E,C,O,M,P,I,k,B,F=r.constructor,q=r.s==i.s?1:-1,K=r.d,H=i.d;if(!r.s)return new F(r);if(!i.s)throw Error(kr+"Division by zero");for(h=r.e-i.e,k=H.length,P=K.length,A=new F(q),_=A.d=[],p=0;H[p]==(K[p]||0);)++p;if(H[p]>(K[p]||0)&&--h,o==null?C=o=F.precision:u?C=o+(Zt(r)-Zt(i))+1:C=o,C<0)return new F(0);if(C=C/_t+2|0,p=0,k==1)for(x=0,H=H[0],C++;(p1&&(H=e(H,x),K=e(K,x),k=H.length,P=K.length),M=k,T=K.slice(0,k),N=T.length;N=dn/2&&++I;do x=0,f=t(H,T,k,N),f<0?(E=T[0],k!=N&&(E=E*dn+(T[1]||0)),x=E/I|0,x>1?(x>=dn&&(x=dn-1),m=e(H,x),w=m.length,N=T.length,f=t(m,T,w,N),f==1&&(x--,n(m,k16)throw Error(Xx+Zt(e));if(!e.s)return new x(cr);for(Pt=!1,f=m,u=new x(.03125);e.abs().gte(.1);)e=e.times(u),p+=5;for(r=Math.log(Xa(2,p))/Math.LN10*2+5|0,f+=r,n=i=o=new x(cr),x.precision=f;;){if(i=vt(i.times(e),f),n=n.times(++h),u=o.plus(Ri(i,n,f)),fi(u.d).slice(0,f)===fi(o.d).slice(0,f)){for(;p--;)o=vt(o.times(o),f);return x.precision=m,t==null?(Pt=!0,vt(o,m)):o}o=u}}function Zt(e){for(var t=e.e*_t,n=e.d[0];n>=10;n/=10)t++;return t}function sp(e,t,n){if(t>e.LN10.sd())throw Pt=!0,n&&(e.precision=n),Error(kr+"LN10 precision limit exceeded");return vt(new e(e.LN10),t)}function ia(e){for(var t="";e--;)t+="0";return t}function tc(e,t){var n,r,i,o,u,f,h,p,x,m=1,w=10,A=e,_=A.d,T=A.constructor,N=T.precision;if(A.s<1)throw Error(kr+(A.s?"NaN":"-Infinity"));if(A.eq(cr))return new T(0);if(t==null?(Pt=!1,p=N):p=t,A.eq(10))return t==null&&(Pt=!0),sp(T,p);if(p+=w,T.precision=p,n=fi(_),r=n.charAt(0),o=Zt(A),Math.abs(o)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)A=A.times(e),n=fi(A.d),r=n.charAt(0),m++;o=Zt(A),r>1?(A=new T("0."+n),o++):A=new T(r+"."+n.slice(1))}else return h=sp(T,p+2,N).times(o+""),A=tc(new T(r+"."+n.slice(1)),p-w).plus(h),T.precision=N,t==null?(Pt=!0,vt(A,N)):A;for(f=u=A=Ri(A.minus(cr),A.plus(cr),p),x=vt(A.times(A),p),i=3;;){if(u=vt(u.times(x),p),h=f.plus(Ri(u,new T(i),p)),fi(h.d).slice(0,p)===fi(f.d).slice(0,p))return f=f.times(2),o!==0&&(f=f.plus(sp(T,p+2,N).times(o+""))),f=Ri(f,new T(m),p),T.precision=N,t==null?(Pt=!0,vt(f,N)):f;f=h,i+=2}}function NA(e,t){var n,r,i;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(i=t.length;t.charCodeAt(i-1)===48;)--i;if(t=t.slice(r,i),t){if(i-=r,n=n-r-1,e.e=vl(n/_t),e.d=[],r=(n+1)%_t,n<0&&(r+=_t),rJd||e.e<-Jd))throw Error(Xx+n)}else e.s=0,e.e=0,e.d=[0];return e}function vt(e,t,n){var r,i,o,u,f,h,p,x,m=e.d;for(u=1,o=m[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=_t,i=t,p=m[x=0];else{if(x=Math.ceil((r+1)/_t),o=m.length,x>=o)return e;for(p=o=m[x],u=1;o>=10;o/=10)u++;r%=_t,i=r-_t+u}if(n!==void 0&&(o=Xa(10,u-i-1),f=p/o%10|0,h=t<0||m[x+1]!==void 0||p%o,h=n<4?(f||h)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||h||n==6&&(r>0?i>0?p/Xa(10,u-i):0:m[x-1])%10&1||n==(e.s<0?8:7))),t<1||!m[0])return h?(o=Zt(e),m.length=1,t=t-o-1,m[0]=Xa(10,(_t-t%_t)%_t),e.e=vl(-t/_t)||0):(m.length=1,m[0]=e.e=e.s=0),e;if(r==0?(m.length=x,o=1,x--):(m.length=x+1,o=Xa(10,_t-r),m[x]=i>0?(p/Xa(10,u-i)%Xa(10,i)|0)*o:0),h)for(;;)if(x==0){(m[0]+=o)==dn&&(m[0]=1,++e.e);break}else{if(m[x]+=o,m[x]!=dn)break;m[x--]=0,o=1}for(r=m.length;m[--r]===0;)m.pop();if(Pt&&(e.e>Jd||e.e<-Jd))throw Error(Xx+Zt(e));return e}function FT(e,t){var n,r,i,o,u,f,h,p,x,m,w=e.constructor,A=w.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new w(e),Pt?vt(t,A):t;if(h=e.d,m=t.d,r=t.e,p=e.e,h=h.slice(),u=p-r,u){for(x=u<0,x?(n=h,u=-u,f=m.length):(n=m,r=p,f=h.length),i=Math.max(Math.ceil(A/_t),f)+2,u>i&&(u=i,n.length=1),n.reverse(),i=u;i--;)n.push(0);n.reverse()}else{for(i=h.length,f=m.length,x=i0;--i)h[f++]=0;for(i=m.length;i>u;){if(h[--i]0?o=o.charAt(0)+"."+o.slice(1)+ia(r):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(i<0?"e":"e+")+i):i<0?(o="0."+ia(-i-1)+o,n&&(r=n-u)>0&&(o+=ia(r))):i>=u?(o+=ia(i+1-u),n&&(r=n-i-1)>0&&(o=o+"."+ia(r))):((r=i+1)0&&(i+1===u&&(o+="."),o+=ia(r))),e.s<0?"-"+o:o}function IA(e,t){if(e.length>t)return e.length=t,!0}function $T(e){var t,n,r;function i(o){var u=this;if(!(u instanceof i))return new i(o);if(u.constructor=i,o instanceof i){u.s=o.s,u.e=o.e,u.d=(o=o.d)?o.slice():o;return}if(typeof o=="number"){if(o*0!==0)throw Error(uo+o);if(o>0)u.s=1;else if(o<0)o=-o,u.s=-1;else{u.s=0,u.e=0,u.d=[0];return}if(o===~~o&&o<1e7){u.e=0,u.d=[o];return}return NA(u,o.toString())}else if(typeof o!="string")throw Error(uo+o);if(o.charCodeAt(0)===45?(o=o.slice(1),u.s=-1):u.s=1,nq.test(o))NA(u,o);else throw Error(uo+o)}if(i.prototype=Te,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=$T,i.config=i.set=rq,e===void 0&&(e={}),e)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=i[t+1]&&r<=i[t+2])this[n]=r;else throw Error(uo+n+": "+r);if((r=e[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(uo+n+": "+r);return this}var Yx=$T(tq);cr=new Yx(1);const gt=Yx;function iq(e){return lq(e)||sq(e)||oq(e)||aq()}function aq(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function oq(e,t){if(e){if(typeof e=="string")return em(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return em(e,t)}}function sq(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function lq(e){if(Array.isArray(e))return em(e)}function em(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=t?n.apply(void 0,i):e(t-u,PA(function(){for(var f=arguments.length,h=new Array(f),p=0;pe.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,o=void 0;try{for(var u=e[Symbol.iterator](),f;!(r=(f=u.next()).done)&&(n.push(f.value),!(t&&n.length===t));r=!0);}catch(h){i=!0,o=h}finally{try{!r&&u.return!=null&&u.return()}finally{if(i)throw o}}return n}}function Sq(e){if(Array.isArray(e))return e}function VT(e){var t=nc(e,2),n=t[0],r=t[1],i=n,o=r;return n>r&&(i=r,o=n),[i,o]}function GT(e,t,n){if(e.lte(0))return new gt(0);var r=R0.getDigitCount(e.toNumber()),i=new gt(10).pow(r),o=e.div(i),u=r!==1?.05:.1,f=new gt(Math.ceil(o.div(u).toNumber())).add(n).mul(u),h=f.mul(i);return t?h:new gt(Math.ceil(h))}function Eq(e,t,n){var r=1,i=new gt(e);if(!i.isint()&&n){var o=Math.abs(e);o<1?(r=new gt(10).pow(R0.getDigitCount(e)-1),i=new gt(Math.floor(i.div(r).toNumber())).mul(r)):o>1&&(i=new gt(Math.floor(e)))}else e===0?i=new gt(Math.floor((t-1)/2)):n||(i=new gt(Math.floor(e)));var u=Math.floor((t-1)/2),f=dq(fq(function(h){return i.add(new gt(h-u).mul(r)).toNumber()}),tm);return f(0,t)}function XT(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new gt(0),tickMin:new gt(0),tickMax:new gt(0)};var o=GT(new gt(t).sub(e).div(n-1),r,i),u;e<=0&&t>=0?u=new gt(0):(u=new gt(e).add(t).div(2),u=u.sub(new gt(u).mod(o)));var f=Math.ceil(u.sub(e).div(o).toNumber()),h=Math.ceil(new gt(t).sub(u).div(o).toNumber()),p=f+h+1;return p>n?XT(e,t,n,r,i+1):(p0?h+(n-p):h,f=t>0?f:f+(n-p)),{step:o,tickMin:u.sub(new gt(f).mul(o)),tickMax:u.add(new gt(h).mul(o))})}function Cq(e){var t=nc(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,u=Math.max(i,2),f=VT([n,r]),h=nc(f,2),p=h[0],x=h[1];if(p===-1/0||x===1/0){var m=x===1/0?[p].concat(rm(tm(0,i-1).map(function(){return 1/0}))):[].concat(rm(tm(0,i-1).map(function(){return-1/0})),[x]);return n>r?nm(m):m}if(p===x)return Eq(p,i,o);var w=XT(p,x,u,o),A=w.step,_=w.tickMin,T=w.tickMax,N=R0.rangeStep(_,T.add(new gt(.1).mul(A)),A);return n>r?nm(N):N}function Oq(e,t){var n=nc(e,2),r=n[0],i=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,u=VT([r,i]),f=nc(u,2),h=f[0],p=f[1];if(h===-1/0||p===1/0)return[r,i];if(h===p)return[h];var x=Math.max(t,2),m=GT(new gt(p).sub(h).div(x-1),o,0),w=[].concat(rm(R0.rangeStep(new gt(h),new gt(p).sub(new gt(.99).mul(m)),m)),[p]);return r>i?nm(w):w}var _q=WT(Cq),Tq=WT(Oq),Nq="Invariant failed";function Ao(e,t){throw new Error(Nq)}var Iq=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function $s(e){"@babel/helpers - typeof";return $s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$s(e)}function eh(){return eh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lq(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Bq(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Fq(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,u=-1,f=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(f<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,p=0;p0?i[p-1].coordinate:i[f-1].coordinate,m=i[p].coordinate,w=p>=f-1?i[0].coordinate:i[p+1].coordinate,A=void 0;if(Zr(m-x)!==Zr(w-m)){var _=[];if(Zr(w-m)===Zr(h[1]-h[0])){A=w;var T=m+h[1]-h[0];_[0]=Math.min(T,(T+x)/2),_[1]=Math.max(T,(T+x)/2)}else{A=x;var N=w+h[1]-h[0];_[0]=Math.min(m,(N+m)/2),_[1]=Math.max(m,(N+m)/2)}var E=[Math.min(m,(A+m)/2),Math.max(m,(A+m)/2)];if(t>E[0]&&t<=E[1]||t>=_[0]&&t<=_[1]){u=i[p].index;break}}else{var C=Math.min(x,w),O=Math.max(x,w);if(t>(C+m)/2&&t<=(O+m)/2){u=i[p].index;break}}}else for(var M=0;M0&&M(r[M].coordinate+r[M-1].coordinate)/2&&t<=(r[M].coordinate+r[M+1].coordinate)/2||M===f-1&&t>(r[M].coordinate+r[M-1].coordinate)/2){u=r[M].index;break}return u},qx=function(t){var n,r=t,i=r.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?zt(zt({},t.type.defaultProps),t.props):t.props,u=o.stroke,f=o.fill,h;switch(i){case"Line":h=u;break;case"Area":case"Radar":h=u&&u!=="none"?u:f;break;default:h=f;break}return h},nK=function(t){var n=t.barSize,r=t.totalSize,i=t.stackGroups,o=i===void 0?{}:i;if(!o)return{};for(var u={},f=Object.keys(o),h=0,p=f.length;h=0});if(E&&E.length){var C=E[0].type.defaultProps,O=C!==void 0?zt(zt({},C),E[0].props):E[0].props,M=O.barSize,P=O[N];u[P]||(u[P]=[]);var I=Xe(M)?n:M;u[P].push({item:E[0],stackList:E.slice(1),barSize:Xe(I)?void 0:wo(I,r,0)})}}return u},rK=function(t){var n=t.barGap,r=t.barCategoryGap,i=t.bandSize,o=t.sizeList,u=o===void 0?[]:o,f=t.maxBarSize,h=u.length;if(h<1)return null;var p=wo(n,i,0,!0),x,m=[];if(u[0].barSize===+u[0].barSize){var w=!1,A=i/h,_=u.reduce(function(M,P){return M+P.barSize||0},0);_+=(h-1)*p,_>=i&&(_-=(h-1)*p,p=0),_>=i&&A>0&&(w=!0,A*=.9,_=h*A);var T=(i-_)/2>>0,N={offset:T-p,size:0};x=u.reduce(function(M,P){var I={item:P.item,position:{offset:N.offset+N.size+p,size:w?A:P.barSize}},k=[].concat(kA(M),[I]);return N=k[k.length-1].position,P.stackList&&P.stackList.length&&P.stackList.forEach(function(B){k.push({item:B,position:N})}),k},m)}else{var E=wo(r,i,0,!0);i-2*E-(h-1)*p<=0&&(p=0);var C=(i-2*E-(h-1)*p)/h;C>1&&(C>>=0);var O=f===+f?Math.min(C,f):C;x=u.reduce(function(M,P,I){var k=[].concat(kA(M),[{item:P.item,position:{offset:E+(C+p)*I+(C-O)/2,size:O}}]);return P.stackList&&P.stackList.length&&P.stackList.forEach(function(B){k.push({item:B,position:k[k.length-1].position})}),k},m)}return x},iK=function(t,n,r,i){var o=r.children,u=r.width,f=r.margin,h=u-(f.left||0)-(f.right||0),p=ZT({children:o,legendWidth:h});if(p){var x=i||{},m=x.width,w=x.height,A=p.align,_=p.verticalAlign,T=p.layout;if((T==="vertical"||T==="horizontal"&&_==="middle")&&A!=="center"&&xe(t[A]))return zt(zt({},t),{},Es({},A,t[A]+(m||0)));if((T==="horizontal"||T==="vertical"&&A==="center")&&_!=="middle"&&xe(t[_]))return zt(zt({},t),{},Es({},_,t[_]+(w||0)))}return t},aK=function(t,n,r){return Xe(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},QT=function(t,n,r,i,o){var u=n.props.children,f=Pr(u,Hc).filter(function(p){return aK(i,o,p.props.direction)});if(f&&f.length){var h=f.map(function(p){return p.props.dataKey});return t.reduce(function(p,x){var m=pr(x,r);if(Xe(m))return p;var w=Array.isArray(m)?[N0(m),T0(m)]:[m,m],A=h.reduce(function(_,T){var N=pr(x,T,0),E=w[0]-Math.abs(Array.isArray(N)?N[0]:N),C=w[1]+Math.abs(Array.isArray(N)?N[1]:N);return[Math.min(E,_[0]),Math.max(C,_[1])]},[1/0,-1/0]);return[Math.min(A[0],p[0]),Math.max(A[1],p[1])]},[1/0,-1/0])}return null},oK=function(t,n,r,i,o){var u=n.map(function(f){return QT(t,f,r,o,i)}).filter(function(f){return!Xe(f)});return u&&u.length?u.reduce(function(f,h){return[Math.min(f[0],h[0]),Math.max(f[1],h[1])]},[1/0,-1/0]):null},JT=function(t,n,r,i,o){var u=n.map(function(h){var p=h.props.dataKey;return r==="number"&&p&&QT(t,h,p,i)||vu(t,p,r,o)});if(r==="number")return u.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var f={};return u.reduce(function(h,p){for(var x=0,m=p.length;x=2?Zr(f[0]-f[1])*2*p:p,n&&(t.ticks||t.niceTicks)){var x=(t.ticks||t.niceTicks).map(function(m){var w=o?o.indexOf(m):m;return{coordinate:i(w)+p,value:m,offset:p}});return x.filter(function(m){return!Lc(m.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(m,w){return{coordinate:i(m)+p,value:m,index:w,offset:p}}):i.ticks&&!r?i.ticks(t.tickCount).map(function(m){return{coordinate:i(m)+p,value:m,offset:p}}):i.domain().map(function(m,w){return{coordinate:i(m)+p,value:o?o[m]:m,index:w,offset:p}})},lp=new WeakMap,Tf=function(t,n){if(typeof n!="function")return t;lp.has(t)||lp.set(t,new WeakMap);var r=lp.get(t);if(r.has(n))return r.get(n);var i=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,i),i},sK=function(t,n,r){var i=t.scale,o=t.type,u=t.layout,f=t.axisType;if(i==="auto")return u==="radial"&&f==="radiusAxis"?{scale:Ku(),realScaleType:"band"}:u==="radial"&&f==="angleAxis"?{scale:qd(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:xu(),realScaleType:"point"}:o==="category"?{scale:Ku(),realScaleType:"band"}:{scale:qd(),realScaleType:"linear"};if(vo(i)){var h="scale".concat(g0(i));return{scale:(TA[h]||xu)(),realScaleType:TA[h]?h:"point"}}return Ge(i)?{scale:i}:{scale:xu(),realScaleType:"point"}},jA=1e-4,lK=function(t){var n=t.domain();if(!(!n||n.length<=2)){var r=n.length,i=t.range(),o=Math.min(i[0],i[1])-jA,u=Math.max(i[0],i[1])+jA,f=t(n[0]),h=t(n[r-1]);(fu||hu)&&t.domain([n[0],n[r-1]])}},uK=function(t,n){if(!t)return null;for(var r=0,i=t.length;ri)&&(o[1]=i),o[0]>i&&(o[0]=i),o[1]=0?(t[f][r][0]=o,t[f][r][1]=o+h,o=t[f][r][1]):(t[f][r][0]=u,t[f][r][1]=u+h,u=t[f][r][1])}},dK=function(t){var n=t.length;if(!(n<=0))for(var r=0,i=t[0].length;r=0?(t[u][r][0]=o,t[u][r][1]=o+f,o=t[u][r][1]):(t[u][r][0]=0,t[u][r][1]=0)}},hK={sign:fK,expand:T9,none:Rs,silhouette:N9,wiggle:I9,positive:dK},pK=function(t,n,r){var i=n.map(function(f){return f.props.dataKey}),o=hK[r],u=_9().keys(i).value(function(f,h){return+pr(f,h,0)}).order(Ig).offset(o);return u(t)},gK=function(t,n,r,i,o,u){if(!t)return null;var f=u?n.reverse():n,h={},p=f.reduce(function(m,w){var A,_=(A=w.type)!==null&&A!==void 0&&A.defaultProps?zt(zt({},w.type.defaultProps),w.props):w.props,T=_.stackId,N=_.hide;if(N)return m;var E=_[r],C=m[E]||{hasStack:!1,stackGroups:{}};if(on(T)){var O=C.stackGroups[T]||{numericAxisId:r,cateAxisId:i,items:[]};O.items.push(w),C.hasStack=!0,C.stackGroups[T]=O}else C.stackGroups[Bc("_stackId_")]={numericAxisId:r,cateAxisId:i,items:[w]};return zt(zt({},m),{},Es({},E,C))},h),x={};return Object.keys(p).reduce(function(m,w){var A=p[w];if(A.hasStack){var _={};A.stackGroups=Object.keys(A.stackGroups).reduce(function(T,N){var E=A.stackGroups[N];return zt(zt({},T),{},Es({},N,{numericAxisId:r,cateAxisId:i,items:E.items,stackedData:pK(t,E.items,o)}))},_)}return zt(zt({},m),{},Es({},w,A))},x)},mK=function(t,n){var r=n.realScaleType,i=n.type,o=n.tickCount,u=n.originalDomain,f=n.allowDecimals,h=r||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&i==="number"&&u&&(u[0]==="auto"||u[1]==="auto")){var p=t.domain();if(!p.length)return null;var x=_q(p,o,f);return t.domain([N0(x),T0(x)]),{niceTicks:x}}if(o&&i==="number"){var m=t.domain(),w=Tq(m,o,f);return{niceTicks:w}}return null};function LA(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,o=e.index,u=e.dataKey;if(t.type==="category"){if(!t.allowDuplicatedCategory&&t.dataKey&&!Xe(i[t.dataKey])){var f=Cd(n,"value",i[t.dataKey]);if(f)return f.coordinate+r/2}return n[o]?n[o].coordinate+r/2:null}var h=pr(i,Xe(u)?t.dataKey:u);return Xe(h)?null:t.scale(h)}var BA=function(t){var n=t.axis,r=t.ticks,i=t.offset,o=t.bandSize,u=t.entry,f=t.index;if(n.type==="category")return r[f]?r[f].coordinate+i:null;var h=pr(u,n.dataKey,n.domain[f]);return Xe(h)?null:n.scale(h)-o/2+i},yK=function(t){var n=t.numericAxis,r=n.scale.domain();if(n.type==="number"){var i=Math.min(r[0],r[1]),o=Math.max(r[0],r[1]);return i<=0&&o>=0?0:o<0?o:i}return r[0]},xK=function(t,n){var r,i=(r=t.type)!==null&&r!==void 0&&r.defaultProps?zt(zt({},t.type.defaultProps),t.props):t.props,o=i.stackId;if(on(o)){var u=n[o];if(u){var f=u.items.indexOf(t);return f>=0?u.stackedData[f]:null}}return null},vK=function(t){return t.reduce(function(n,r){return[N0(r.concat([n[0]]).filter(xe)),T0(r.concat([n[1]]).filter(xe))]},[1/0,-1/0])},n4=function(t,n,r){return Object.keys(t).reduce(function(i,o){var u=t[o],f=u.stackedData,h=f.reduce(function(p,x){var m=vK(x.slice(n,r+1));return[Math.min(p[0],m[0]),Math.max(p[1],m[1])]},[1/0,-1/0]);return[Math.min(h[0],i[0]),Math.max(h[1],i[1])]},[1/0,-1/0]).map(function(i){return i===1/0||i===-1/0?0:i})},FA=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,$A=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,sm=function(t,n,r){if(Ge(t))return t(n,r);if(!Array.isArray(t))return n;var i=[];if(xe(t[0]))i[0]=r?t[0]:Math.min(t[0],n[0]);else if(FA.test(t[0])){var o=+FA.exec(t[0])[1];i[0]=n[0]-o}else Ge(t[0])?i[0]=t[0](n[0]):i[0]=n[0];if(xe(t[1]))i[1]=r?t[1]:Math.max(t[1],n[1]);else if($A.test(t[1])){var u=+$A.exec(t[1])[1];i[1]=n[1]+u}else Ge(t[1])?i[1]=t[1](n[1]):i[1]=n[1];return i},nh=function(t,n,r){if(t&&t.scale&&t.scale.bandwidth){var i=t.scale.bandwidth();if(!r||i>0)return i}if(t&&n&&n.length>=2){for(var o=Sx(n,function(m){return m.coordinate}),u=1/0,f=1,h=o.length;fu&&(p=2*Math.PI-p),{radius:f,angle:SK(p),angleInRadian:p}},OK=function(t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),o=Math.floor(r/360),u=Math.min(i,o);return{startAngle:n-u*360,endAngle:r-u*360}},_K=function(t,n){var r=n.startAngle,i=n.endAngle,o=Math.floor(r/360),u=Math.floor(i/360),f=Math.min(o,u);return t+f*360},HA=function(t,n){var r=t.x,i=t.y,o=CK({x:r,y:i},n),u=o.radius,f=o.angle,h=n.innerRadius,p=n.outerRadius;if(up)return!1;if(u===0)return!0;var x=OK(n),m=x.startAngle,w=x.endAngle,A=f,_;if(m<=w){for(;A>w;)A-=360;for(;A=m&&A<=w}else{for(;A>m;)A-=360;for(;A=w&&A<=m}return _?WA(WA({},n),{},{radius:u,angle:_K(A,n)}):null};function oc(e){"@babel/helpers - typeof";return oc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},oc(e)}var TK=["offset"];function NK(e){return MK(e)||RK(e)||PK(e)||IK()}function IK(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function PK(e,t){if(e){if(typeof e=="string")return lm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lm(e,t)}}function RK(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function MK(e){if(Array.isArray(e))return lm(e)}function lm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function DK(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function VA(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function nn(e){for(var t=1;t=0?1:-1,O,M;i==="insideStart"?(O=A+C*u,M=T):i==="insideEnd"?(O=_-C*u,M=!T):i==="end"&&(O=_+C*u,M=T),M=E<=0?M:!M;var P=An(p,x,N,O),I=An(p,x,N,O+(M?1:-1)*359),k="M".concat(P.x,",").concat(P.y,` A`).concat(N,",").concat(N,",0,1,").concat(M?0:1,`, `).concat(I.x,",").concat(I.y),B=Xe(t.id)?Bc("recharts-radial-line-"):t.id;return Y.createElement("text",sc({},r,{dominantBaseline:"central",className:rt("recharts-radial-bar-label",f)}),Y.createElement("defs",null,Y.createElement("path",{id:B,d:k})),Y.createElement("textPath",{xlinkHref:"#".concat(B)},n))},zK=function(t){var n=t.viewBox,r=t.offset,i=t.position,o=n,u=o.cx,f=o.cy,h=o.innerRadius,p=o.outerRadius,x=o.startAngle,m=o.endAngle,w=(x+m)/2;if(i==="outside"){var A=An(u,f,p+r,w),_=A.x,T=A.y;return{x:_,y:T,textAnchor:_>=u?"start":"end",verticalAnchor:"middle"}}if(i==="center")return{x:u,y:f,textAnchor:"middle",verticalAnchor:"middle"};if(i==="centerTop")return{x:u,y:f,textAnchor:"middle",verticalAnchor:"start"};if(i==="centerBottom")return{x:u,y:f,textAnchor:"middle",verticalAnchor:"end"};var N=(h+p)/2,E=An(u,f,N,w),C=E.x,O=E.y;return{x:C,y:O,textAnchor:"middle",verticalAnchor:"middle"}},WK=function(t){var n=t.viewBox,r=t.parentViewBox,i=t.offset,o=t.position,u=n,f=u.x,h=u.y,p=u.width,x=u.height,m=x>=0?1:-1,w=m*i,A=m>0?"end":"start",_=m>0?"start":"end",T=p>=0?1:-1,N=T*i,E=T>0?"end":"start",C=T>0?"start":"end";if(o==="top"){var O={x:f+p/2,y:h-m*i,textAnchor:"middle",verticalAnchor:A};return nn(nn({},O),r?{height:Math.max(h-r.y,0),width:p}:{})}if(o==="bottom"){var M={x:f+p/2,y:h+x+w,textAnchor:"middle",verticalAnchor:_};return nn(nn({},M),r?{height:Math.max(r.y+r.height-(h+x),0),width:p}:{})}if(o==="left"){var P={x:f-N,y:h+x/2,textAnchor:E,verticalAnchor:"middle"};return nn(nn({},P),r?{width:Math.max(P.x-r.x,0),height:x}:{})}if(o==="right"){var I={x:f+p+N,y:h+x/2,textAnchor:C,verticalAnchor:"middle"};return nn(nn({},I),r?{width:Math.max(r.x+r.width-I.x,0),height:x}:{})}var k=r?{width:p,height:x}:{};return o==="insideLeft"?nn({x:f+N,y:h+x/2,textAnchor:C,verticalAnchor:"middle"},k):o==="insideRight"?nn({x:f+p-N,y:h+x/2,textAnchor:E,verticalAnchor:"middle"},k):o==="insideTop"?nn({x:f+p/2,y:h+w,textAnchor:"middle",verticalAnchor:_},k):o==="insideBottom"?nn({x:f+p/2,y:h+x-w,textAnchor:"middle",verticalAnchor:A},k):o==="insideTopLeft"?nn({x:f+N,y:h+w,textAnchor:C,verticalAnchor:_},k):o==="insideTopRight"?nn({x:f+p-N,y:h+w,textAnchor:E,verticalAnchor:_},k):o==="insideBottomLeft"?nn({x:f+N,y:h+x-w,textAnchor:C,verticalAnchor:A},k):o==="insideBottomRight"?nn({x:f+p-N,y:h+x-w,textAnchor:E,verticalAnchor:A},k):ul(o)&&(xe(o.x)||eo(o.x))&&(xe(o.y)||eo(o.y))?nn({x:f+wo(o.x,p),y:h+wo(o.y,x),textAnchor:"end",verticalAnchor:"end"},k):nn({x:f+p/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},k)},HK=function(t){return"cx"in t&&xe(t.cx)};function Rn(e){var t=e.offset,n=t===void 0?5:t,r=kK(e,TK),i=nn({offset:n},r),o=i.viewBox,u=i.position,f=i.value,h=i.children,p=i.content,x=i.className,m=x===void 0?"":x,w=i.textBreakAll;if(!o||Xe(f)&&Xe(h)&&!W.isValidElement(p)&&!Ge(p))return null;if(W.isValidElement(p))return W.cloneElement(p,i);var A;if(Ge(p)){if(A=W.createElement(p,i),W.isValidElement(A))return A}else A=FK(i);var _=HK(o),T=Qe(i,!0);if(_&&(u==="insideStart"||u==="insideEnd"||u==="end"))return UK(i,A,T);var N=_?zK(i):WK(i);return Y.createElement(Ud,sc({className:rt("recharts-label",m)},T,N,{breakAll:w}),A)}Rn.displayName="Label";var i4=function(t){var n=t.cx,r=t.cy,i=t.angle,o=t.startAngle,u=t.endAngle,f=t.r,h=t.radius,p=t.innerRadius,x=t.outerRadius,m=t.x,w=t.y,A=t.top,_=t.left,T=t.width,N=t.height,E=t.clockWise,C=t.labelViewBox;if(C)return C;if(xe(T)&&xe(N)){if(xe(m)&&xe(w))return{x:m,y:w,width:T,height:N};if(xe(A)&&xe(_))return{x:A,y:_,width:T,height:N}}return xe(m)&&xe(w)?{x:m,y:w,width:0,height:0}:xe(n)&&xe(r)?{cx:n,cy:r,startAngle:o||i||0,endAngle:u||i||0,innerRadius:p||0,outerRadius:x||h||f||0,clockWise:E}:t.viewBox?t.viewBox:{}},VK=function(t,n){return t?t===!0?Y.createElement(Rn,{key:"label-implicit",viewBox:n}):on(t)?Y.createElement(Rn,{key:"label-implicit",viewBox:n,value:t}):W.isValidElement(t)?t.type===Rn?W.cloneElement(t,{key:"label-implicit",viewBox:n}):Y.createElement(Rn,{key:"label-implicit",content:t,viewBox:n}):Ge(t)?Y.createElement(Rn,{key:"label-implicit",content:t,viewBox:n}):ul(t)?Y.createElement(Rn,sc({viewBox:n},t,{key:"label-implicit"})):null:null},GK=function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&r&&!t.label)return null;var i=t.children,o=i4(t),u=Pr(i,Rn).map(function(h,p){return W.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!r)return u;var f=VK(t.label,n||o);return[f].concat(NK(u))};Rn.parseViewBox=i4;Rn.renderCallByParent=GK;function XK(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var YK=XK;const qK=wt(YK);function lc(e){"@babel/helpers - typeof";return lc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lc(e)}var KK=["valueAccessor"],ZK=["data","dataKey","clockWise","id","textBreakAll"];function QK(e){return nZ(e)||tZ(e)||eZ(e)||JK()}function JK(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function eZ(e,t){if(e){if(typeof e=="string")return um(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return um(e,t)}}function tZ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function nZ(e){if(Array.isArray(e))return um(e)}function um(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function oZ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var sZ=function(t){return Array.isArray(t.value)?qK(t.value):t.value};function Aa(e){var t=e.valueAccessor,n=t===void 0?sZ:t,r=YA(e,KK),i=r.data,o=r.dataKey,u=r.clockWise,f=r.id,h=r.textBreakAll,p=YA(r,ZK);return!i||!i.length?null:Y.createElement(Vt,{className:"recharts-label-list"},i.map(function(x,m){var w=Xe(o)?n(x,m):pr(x&&x.payload,o),A=Xe(f)?{}:{id:"".concat(f,"-").concat(m)};return Y.createElement(Rn,ih({},Qe(x,!0),p,A,{parentViewBox:x.parentViewBox,value:w,textBreakAll:h,viewBox:Rn.parseViewBox(Xe(u)?x:XA(XA({},x),{},{clockWise:u})),key:"label-".concat(m),index:m}))}))}Aa.displayName="LabelList";function lZ(e,t){return e?e===!0?Y.createElement(Aa,{key:"labelList-implicit",data:t}):Y.isValidElement(e)||Ge(e)?Y.createElement(Aa,{key:"labelList-implicit",data:t,content:e}):ul(e)?Y.createElement(Aa,ih({data:t},e,{key:"labelList-implicit"})):null:null}function uZ(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=Pr(r,Aa).map(function(u,f){return W.cloneElement(u,{data:t,key:"labelList-".concat(f)})});if(!n)return i;var o=lZ(e.label,t);return[o].concat(QK(i))}Aa.renderCallByParent=uZ;function uc(e){"@babel/helpers - typeof";return uc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},uc(e)}function cm(){return cm=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(u>p),`, `).concat(m.x,",").concat(m.y,` `);if(i>0){var A=An(n,r,i,u),_=An(n,r,i,p);w+="L ".concat(_.x,",").concat(_.y,` A `).concat(i,",").concat(i,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(u<=p),`, `).concat(A.x,",").concat(A.y," Z")}else w+="L ".concat(n,",").concat(r," Z");return w},pZ=function(t){var n=t.cx,r=t.cy,i=t.innerRadius,o=t.outerRadius,u=t.cornerRadius,f=t.forceCornerRadius,h=t.cornerIsExternal,p=t.startAngle,x=t.endAngle,m=Zr(x-p),w=Nf({cx:n,cy:r,radius:o,angle:p,sign:m,cornerRadius:u,cornerIsExternal:h}),A=w.circleTangency,_=w.lineTangency,T=w.theta,N=Nf({cx:n,cy:r,radius:o,angle:x,sign:-m,cornerRadius:u,cornerIsExternal:h}),E=N.circleTangency,C=N.lineTangency,O=N.theta,M=h?Math.abs(p-x):Math.abs(p-x)-T-O;if(M<0)return f?"M ".concat(_.x,",").concat(_.y,` a`).concat(u,",").concat(u,",0,0,1,").concat(u*2,`,0 a`).concat(u,",").concat(u,",0,0,1,").concat(-u*2,`,0 `):a4({cx:n,cy:r,innerRadius:i,outerRadius:o,startAngle:p,endAngle:x});var P="M ".concat(_.x,",").concat(_.y,` A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(A.x,",").concat(A.y,` A`).concat(o,",").concat(o,",0,").concat(+(M>180),",").concat(+(m<0),",").concat(E.x,",").concat(E.y,` A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(C.x,",").concat(C.y,` `);if(i>0){var I=Nf({cx:n,cy:r,radius:i,angle:p,sign:m,isExternal:!0,cornerRadius:u,cornerIsExternal:h}),k=I.circleTangency,B=I.lineTangency,F=I.theta,q=Nf({cx:n,cy:r,radius:i,angle:x,sign:-m,isExternal:!0,cornerRadius:u,cornerIsExternal:h}),K=q.circleTangency,H=q.lineTangency,ne=q.theta,J=h?Math.abs(p-x):Math.abs(p-x)-F-ne;if(J<0&&u===0)return"".concat(P,"L").concat(n,",").concat(r,"Z");P+="L".concat(H.x,",").concat(H.y,` A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(K.x,",").concat(K.y,` A`).concat(i,",").concat(i,",0,").concat(+(J>180),",").concat(+(m>0),",").concat(k.x,",").concat(k.y,` A`).concat(u,",").concat(u,",0,0,").concat(+(m<0),",").concat(B.x,",").concat(B.y,"Z")}else P+="L".concat(n,",").concat(r,"Z");return P},gZ={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},o4=function(t){var n=KA(KA({},gZ),t),r=n.cx,i=n.cy,o=n.innerRadius,u=n.outerRadius,f=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,m=n.endAngle,w=n.className;if(u0&&Math.abs(x-m)<360?N=pZ({cx:r,cy:i,innerRadius:o,outerRadius:u,cornerRadius:Math.min(T,_/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:x,endAngle:m}):N=a4({cx:r,cy:i,innerRadius:o,outerRadius:u,startAngle:x,endAngle:m}),Y.createElement("path",cm({},Qe(n,!0),{className:A,d:N,role:"img"}))};function cc(e){"@babel/helpers - typeof";return cc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cc(e)}function fm(){return fm=Object.assign?Object.assign.bind():function(e){for(var t=1;tTZ.call(e,t));function Ro(e,t){return e===t||!e&&!t&&e!==e&&t!==t}const PZ="__v",RZ="__o",MZ="_owner",kZ=typeof Float16Array<"u",{getOwnPropertyDescriptor:tS,keys:nS}=Object;function DZ(e,t){return e.byteLength===t.byteLength&&ah(new Uint8Array(e),new Uint8Array(t))}function jZ(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function LZ(e,t){return e.byteLength===t.byteLength&&ah(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function BZ(e,t){return Ro(e.getTime(),t.getTime())}function rS(e,t,n){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&n.equals(e.cause,t.cause,"cause","cause",e,t,n)}function FZ(e,t){return e===t}function iS(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.entries();let u,f,h=0;for(;(u=o.next())&&!u.done;){const p=t.entries();let x=!1,m=0;for(;(f=p.next())&&!f.done;){if(i[m]){m++;continue}const w=u.value,A=f.value;if(n.equals(w[0],A[0],h,m,e,t,n)&&n.equals(w[1],A[1],w[0],A[0],e,t,n)){x=i[m]=!0;break}m++}if(!x)return!1;h++}return!0}const $Z=Ro;function aS(e,t,n){const r=nS(e);let i=r.length;if(nS(t).length!==i)return!1;for(;i-- >0;)if(!c4(e,t,n,r[i]))return!1;return!0}function Yo(e,t,n){const r=eS(e);let i=r.length;if(eS(t).length!==i)return!1;let o,u,f;for(;i-- >0;)if(o=r[i],!c4(e,t,n,o)||(u=tS(e,o),f=tS(t,o),(u||f)&&(!u||!f||u.configurable!==f.configurable||u.enumerable!==f.enumerable||u.writable!==f.writable)))return!1;return!0}function UZ(e,t){return Ro(e.valueOf(),t.valueOf())}function zZ(e,t){return e.source===t.source&&e.flags===t.flags}function oS(e,t,n){const r=e.size;if(r!==t.size)return!1;if(!r)return!0;const i=new Array(r),o=e.values();let u,f;for(;(u=o.next())&&!u.done;){const h=t.values();let p=!1,x=0;for(;(f=h.next())&&!f.done;){if(!i[x]&&n.equals(u.value,f.value,u.value,f.value,e,t,n)){p=i[x]=!0;break}x++}if(!p)return!1}return!0}function ah(e,t){let n=e.length;if(t.length!==n||e.byteOffset!==t.byteOffset)return!1;if(e instanceof Float64Array||e instanceof Float32Array||kZ&&e instanceof Float16Array){for(;n-- >0;)if(e[n]!==t[n]&&(e[n]===e[n]||t[n]===t[n]))return!1;return!0}for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function WZ(e,t){return e.href===t.href?!0:e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&HZ(e.searchParams,t.searchParams)}function HZ(e,t){const n=e.toString(),r=t.toString();return n===r||sS(n)===sS(r)}function sS(e){return e.split("&").sort().join("&")}function c4(e,t,n,r){return(r===MZ||r===RZ||r===PZ)&&(e.$$typeof||t.$$typeof)?!0:IZ(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}const VZ="[object ArrayBuffer]",GZ="[object Arguments]",XZ="[object Boolean]",YZ="[object DataView]",qZ="[object Date]",KZ="[object Error]",ZZ="[object Map]",QZ="[object Number]",JZ="[object Object]",eQ="[object RegExp]",tQ="[object Set]",nQ="[object String]",rQ={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},iQ="[object URL]",aQ=Object.prototype.toString;function oQ({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:u,areNumbersEqual:f,areObjectsEqual:h,arePrimitiveWrappersEqual:p,areRegExpsEqual:x,areSetsEqual:m,areTypedArraysEqual:w,areUrlsEqual:A,unknownTagComparators:_}){return function(N,E,C){if(N===E)return!0;if(N==null||E==null)return!1;const O=typeof N;if(O!==typeof E)return!1;if(O!=="object")return O==="number"?f(N,E,C):O==="function"?o(N,E,C):!1;const M=N.constructor;if(M!==E.constructor)return!1;if(M===Object)return h(N,E,C);if(Array.isArray(N))return t(N,E,C);if(M===Date)return r(N,E,C);if(M===RegExp)return x(N,E,C);if(M===Map)return u(N,E,C);if(M===Set)return m(N,E,C);const P=aQ.call(N);if(P===qZ)return r(N,E,C);if(P===eQ)return x(N,E,C);if(P===ZZ)return u(N,E,C);if(P===tQ)return m(N,E,C);if(P===JZ)return typeof N.then!="function"&&typeof E.then!="function"&&h(N,E,C);if(P===iQ)return A(N,E,C);if(P===KZ)return i(N,E,C);if(P===GZ)return h(N,E,C);if(rQ[P])return w(N,E,C);if(P===VZ)return e(N,E,C);if(P===YZ)return n(N,E,C);if(P===XZ||P===QZ||P===nQ)return p(N,E,C);if(_){let I=_[P];if(!I){const k=NZ(N);k&&(I=_[k])}if(I)return I(N,E,C)}return!1}}function sQ({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:DZ,areArraysEqual:n?Yo:jZ,areDataViewsEqual:LZ,areDatesEqual:BZ,areErrorsEqual:n?Kl(rS,Yo):Kl(rS,aS),areFunctionsEqual:FZ,areMapsEqual:n?Kl(iS,Yo):iS,areNumbersEqual:$Z,areObjectsEqual:n?Yo:aS,arePrimitiveWrappersEqual:UZ,areRegExpsEqual:zZ,areSetsEqual:n?Kl(oS,Yo):oS,areTypedArraysEqual:n?Kl(ah,Yo):ah,areUrlsEqual:WZ,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){const i=Zl(r.areArraysEqual),o=Zl(r.areErrorsEqual),u=Zl(r.areMapsEqual),f=Zl(r.areObjectsEqual),h=Zl(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areErrorsEqual:o,areMapsEqual:u,areObjectsEqual:f,areSetsEqual:h})}return r}function lQ(e){return function(t,n,r,i,o,u,f){return e(t,n,f)}}function uQ({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(f,h){const{cache:p=e?new WeakMap:void 0,meta:x}=n();return t(f,h,{cache:p,equals:r,meta:x,strict:i})};if(e)return function(f,h){return t(f,h,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(f,h){return t(f,h,o)}}const cQ=Da();Da({strict:!0});Da({circular:!0});Da({circular:!0,strict:!0});Da({createInternalComparator:()=>Ro});Da({strict:!0,createInternalComparator:()=>Ro});Da({circular:!0,createInternalComparator:()=>Ro});Da({circular:!0,createInternalComparator:()=>Ro,strict:!0});function Da(e={}){const{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,o=sQ(e),u=oQ(o),f=n?n(u):lQ(u);return uQ({circular:t,comparator:u,createState:r,equals:f,strict:i})}function fQ(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function lS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function i(o){n<0&&(n=o),o-n>t?(e(o),n=-1):fQ(i)};requestAnimationFrame(r)}function hm(e){"@babel/helpers - typeof";return hm=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hm(e)}function dQ(e){return mQ(e)||gQ(e)||pQ(e)||hQ()}function hQ(){throw new TypeError(`Invalid attempt to destructure non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function pQ(e,t){if(e){if(typeof e=="string")return uS(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return uS(e,t)}}function uS(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n1?1:E<0?0:E},T=function(E){for(var C=E>1?1:E,O=C,M=0;M<8;++M){var P=m(O)-C,I=A(O);if(Math.abs(P-C)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,r=n===void 0?100:n,i=t.damping,o=i===void 0?8:i,u=t.dt,f=u===void 0?17:u,h=function(x,m,w){var A=-(x-m)*r,_=w*o,T=w+(A-_)*f/1e3,N=w*f/1e3+x;return Math.abs(N-m)e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function XQ(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o=0)&&(n[i]=e[i]);return n}function up(e){return ZQ(e)||KQ(e)||qQ(e)||YQ()}function YQ(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function qQ(e,t){if(e){if(typeof e=="string")return xm(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return xm(e,t)}}function KQ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ZQ(e){if(Array.isArray(e))return xm(e)}function xm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function lh(e){return lh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},lh(e)}var $i=function(e){nJ(n,e);var t=rJ(n);function n(r,i){var o;QQ(this,n),o=t.call(this,r,i);var u=o.props,f=u.isActive,h=u.attributeName,p=u.from,x=u.to,m=u.steps,w=u.children,A=u.duration;if(o.handleStyleChange=o.handleStyleChange.bind(bm(o)),o.changeStyle=o.changeStyle.bind(bm(o)),!f||A<=0)return o.state={style:{}},typeof w=="function"&&(o.state={style:x}),wm(o);if(m&&m.length)o.state={style:m[0].style};else if(p){if(typeof w=="function")return o.state={style:p},wm(o);o.state={style:h?ou({},h,p):p}}else o.state={style:{}};return o}return eJ(n,[{key:"componentDidMount",value:function(){var i=this.props,o=i.isActive,u=i.canBegin;this.mounted=!0,!(!o||!u)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(i){var o=this.props,u=o.isActive,f=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,x=o.to,m=o.from,w=this.state.style;if(f){if(!u){var A={style:h?ou({},h,x):x};this.state&&w&&(h&&w[h]!==x||!h&&w!==x)&&this.setState(A);return}if(!(cQ(i.to,x)&&i.canBegin&&i.isActive)){var _=!i.canBegin||!i.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var T=_||p?m:i.to;if(this.state&&w){var N={style:h?ou({},h,T):T};(h&&w[h]!==T||!h&&w!==T)&&this.setState(N)}this.runAnimation(Wr(Wr({},this.props),{},{from:T,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var i=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),i&&i()}},{key:"handleStyleChange",value:function(i){this.changeStyle(i)}},{key:"changeStyle",value:function(i){this.mounted&&this.setState({style:i})}},{key:"runJSAnimation",value:function(i){var o=this,u=i.from,f=i.to,h=i.duration,p=i.easing,x=i.begin,m=i.onAnimationEnd,w=i.onAnimationStart,A=HQ(u,f,MQ(p),h,this.changeStyle),_=function(){o.stopJSAnimation=A()};this.manager.start([w,x,_,h,m])}},{key:"runStepAnimation",value:function(i){var o=this,u=i.steps,f=i.begin,h=i.onAnimationStart,p=u[0],x=p.style,m=p.duration,w=m===void 0?0:m,A=function(T,N,E){if(E===0)return T;var C=N.duration,O=N.easing,M=O===void 0?"ease":O,P=N.style,I=N.properties,k=N.onAnimationEnd,B=E>0?u[E-1]:N,F=I||Object.keys(P);if(typeof M=="function"||M==="spring")return[].concat(up(T),[o.runJSAnimation.bind(o,{from:B.style,to:P,duration:C,easing:M}),C]);var q=dS(F,C,M),K=Wr(Wr(Wr({},B.style),P),{},{transition:q});return[].concat(up(T),[K,C,k]).filter(bQ)};return this.manager.start([h].concat(up(u.reduce(A,[x,Math.max(w,f)])),[i.onAnimationEnd]))}},{key:"runAnimation",value:function(i){this.manager||(this.manager=yQ());var o=i.begin,u=i.duration,f=i.attributeName,h=i.to,p=i.easing,x=i.onAnimationStart,m=i.onAnimationEnd,w=i.steps,A=i.children,_=this.manager;if(this.unSubscribe=_.subscribe(this.handleStyleChange),typeof p=="function"||typeof A=="function"||p==="spring"){this.runJSAnimation(i);return}if(w.length>1){this.runStepAnimation(i);return}var T=f?ou({},f,h):h,N=dS(Object.keys(T),u,p);_.start([x,o,Wr(Wr({},T),{},{transition:N}),u,m])}},{key:"render",value:function(){var i=this.props,o=i.children;i.begin;var u=i.duration;i.attributeName,i.easing;var f=i.isActive;i.steps,i.from,i.to,i.canBegin,i.onAnimationEnd,i.shouldReAnimate,i.onAnimationReStart;var h=GQ(i,VQ),p=W.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!f||p===0||u<=0)return o;var m=function(A){var _=A.props,T=_.style,N=T===void 0?{}:T,E=_.className,C=W.cloneElement(A,Wr(Wr({},h),{},{style:Wr(Wr({},N),x),className:E}));return C};return p===1?m(W.Children.only(o)):Y.createElement("div",null,W.Children.map(o,function(w){return m(w)}))}}]),n}(W.PureComponent);$i.displayName="Animate";$i.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};$i.propTypes={from:ut.oneOfType([ut.object,ut.string]),to:ut.oneOfType([ut.object,ut.string]),attributeName:ut.string,duration:ut.number,begin:ut.number,easing:ut.oneOfType([ut.string,ut.func]),steps:ut.arrayOf(ut.shape({duration:ut.number.isRequired,style:ut.object.isRequired,easing:ut.oneOfType([ut.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),ut.func]),properties:ut.arrayOf("string"),onAnimationEnd:ut.func})),children:ut.oneOfType([ut.node,ut.func]),isActive:ut.bool,canBegin:ut.bool,onAnimationEnd:ut.func,shouldReAnimate:ut.bool,onAnimationStart:ut.func,onAnimationReStart:ut.func};function hc(e){"@babel/helpers - typeof";return hc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},hc(e)}function uh(){return uh=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0?1:-1,h=r>=0?1:-1,p=i>=0&&r>=0||i<0&&r<0?1:0,x;if(u>0&&o instanceof Array){for(var m=[0,0,0,0],w=0,A=4;wu?u:o[w];x="M".concat(t,",").concat(n+f*m[0]),m[0]>0&&(x+="A ".concat(m[0],",").concat(m[0],",0,0,").concat(p,",").concat(t+h*m[0],",").concat(n)),x+="L ".concat(t+r-h*m[1],",").concat(n),m[1]>0&&(x+="A ".concat(m[1],",").concat(m[1],",0,0,").concat(p,`, `).concat(t+r,",").concat(n+f*m[1])),x+="L ".concat(t+r,",").concat(n+i-f*m[2]),m[2]>0&&(x+="A ".concat(m[2],",").concat(m[2],",0,0,").concat(p,`, `).concat(t+r-h*m[2],",").concat(n+i)),x+="L ".concat(t+h*m[3],",").concat(n+i),m[3]>0&&(x+="A ".concat(m[3],",").concat(m[3],",0,0,").concat(p,`, `).concat(t,",").concat(n+i-f*m[3])),x+="Z"}else if(u>0&&o===+o&&o>0){var _=Math.min(u,o);x="M ".concat(t,",").concat(n+f*_,` A `).concat(_,",").concat(_,",0,0,").concat(p,",").concat(t+h*_,",").concat(n,` L `).concat(t+r-h*_,",").concat(n,` A `).concat(_,",").concat(_,",0,0,").concat(p,",").concat(t+r,",").concat(n+f*_,` L `).concat(t+r,",").concat(n+i-f*_,` A `).concat(_,",").concat(_,",0,0,").concat(p,",").concat(t+r-h*_,",").concat(n+i,` L `).concat(t+h*_,",").concat(n+i,` A `).concat(_,",").concat(_,",0,0,").concat(p,",").concat(t,",").concat(n+i-f*_," Z")}else x="M ".concat(t,",").concat(n," h ").concat(r," v ").concat(i," h ").concat(-r," Z");return x},hJ=function(t,n){if(!t||!n)return!1;var r=t.x,i=t.y,o=n.x,u=n.y,f=n.width,h=n.height;if(Math.abs(f)>0&&Math.abs(h)>0){var p=Math.min(o,o+f),x=Math.max(o,o+f),m=Math.min(u,u+h),w=Math.max(u,u+h);return r>=p&&r<=x&&i>=m&&i<=w}return!1},pJ={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},Kx=function(t){var n=wS(wS({},pJ),t),r=W.useRef(),i=W.useState(-1),o=aJ(i,2),u=o[0],f=o[1];W.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var M=r.current.getTotalLength();M&&f(M)}catch{}},[]);var h=n.x,p=n.y,x=n.width,m=n.height,w=n.radius,A=n.className,_=n.animationEasing,T=n.animationDuration,N=n.animationBegin,E=n.isAnimationActive,C=n.isUpdateAnimationActive;if(h!==+h||p!==+p||x!==+x||m!==+m||x===0||m===0)return null;var O=rt("recharts-rectangle",A);return C?Y.createElement($i,{canBegin:u>0,from:{width:x,height:m,x:h,y:p},to:{width:x,height:m,x:h,y:p},duration:T,animationEasing:_,isActive:C},function(M){var P=M.width,I=M.height,k=M.x,B=M.y;return Y.createElement($i,{canBegin:u>0,from:"0px ".concat(u===-1?1:u,"px"),to:"".concat(u,"px 0px"),attributeName:"strokeDasharray",begin:N,duration:T,isActive:E,easing:_},Y.createElement("path",uh({},Qe(n,!0),{className:O,d:bS(k,B,P,I,w),ref:r})))}):Y.createElement("path",uh({},Qe(n,!0),{className:O,d:bS(h,p,x,m,w)}))};function Am(){return Am=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bJ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var AJ=function(t,n,r,i,o,u){return"M".concat(t,",").concat(o,"v").concat(i,"M").concat(u,",").concat(n,"h").concat(r)},SJ=function(t){var n=t.x,r=n===void 0?0:n,i=t.y,o=i===void 0?0:i,u=t.top,f=u===void 0?0:u,h=t.left,p=h===void 0?0:h,x=t.width,m=x===void 0?0:x,w=t.height,A=w===void 0?0:w,_=t.className,T=wJ(t,gJ),N=mJ({x:r,y:o,top:f,left:p,width:m,height:A},T);return!xe(r)||!xe(o)||!xe(m)||!xe(A)||!xe(f)||!xe(p)?null:Y.createElement("path",Sm({},Qe(N,!0),{className:rt("recharts-cross",_),d:AJ(r,o,m,A,f,p)}))},EJ=P_,CJ=EJ(Object.getPrototypeOf,Object),OJ=CJ,_J=Wi,TJ=OJ,NJ=Hi,IJ="[object Object]",PJ=Function.prototype,RJ=Object.prototype,y4=PJ.toString,MJ=RJ.hasOwnProperty,kJ=y4.call(Object);function DJ(e){if(!NJ(e)||_J(e)!=IJ)return!1;var t=TJ(e);if(t===null)return!0;var n=MJ.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&y4.call(n)==kJ}var jJ=DJ;const LJ=wt(jJ);var BJ=Wi,FJ=Hi,$J="[object Boolean]";function UJ(e){return e===!0||e===!1||FJ(e)&&BJ(e)==$J}var zJ=UJ;const WJ=wt(zJ);function gc(e){"@babel/helpers - typeof";return gc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gc(e)}function ch(){return ch=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:w,x:h,y:p},to:{upperWidth:x,lowerWidth:m,height:w,x:h,y:p},duration:T,animationEasing:_,isActive:E},function(O){var M=O.upperWidth,P=O.lowerWidth,I=O.height,k=O.x,B=O.y;return Y.createElement($i,{canBegin:u>0,from:"0px ".concat(u===-1?1:u,"px"),to:"".concat(u,"px 0px"),attributeName:"strokeDasharray",begin:N,duration:T,easing:_},Y.createElement("path",ch({},Qe(n,!0),{className:C,d:OS(k,B,M,P,I),ref:r})))}):Y.createElement("g",null,Y.createElement("path",ch({},Qe(n,!0),{className:C,d:OS(h,p,x,m,w)})))},eee=["option","shapeType","propTransformer","activeClassName","isActive"];function mc(e){"@babel/helpers - typeof";return mc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mc(e)}function tee(e,t){if(e==null)return{};var n=nee(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function nee(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function fh(e){for(var t=1;t0&&r.handleDrag(i.changedTouches[0])}),sr(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var i=r.props,o=i.endIndex,u=i.onDragEnd,f=i.startIndex;u==null||u({endIndex:o,startIndex:f})}),r.detachDragEndListener()}),sr(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),sr(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),sr(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),sr(r,"handleSlideDragStart",function(i){var o=kS(i)?i.changedTouches[0]:i;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:o.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return $ee(t,e),jee(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var i=r.startX,o=r.endX,u=this.state.scaleValues,f=this.props,h=f.gap,p=f.data,x=p.length-1,m=Math.min(i,o),w=Math.max(i,o),A=t.getIndexInRange(u,m),_=t.getIndexInRange(u,w);return{startIndex:A-A%h,endIndex:_===x?x:_-_%h}}},{key:"getTextOfTick",value:function(r){var i=this.props,o=i.data,u=i.tickFormatter,f=i.dataKey,h=pr(o[r],f,r);return Ge(u)?u(h,r):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var i=this.state,o=i.slideMoveStartX,u=i.startX,f=i.endX,h=this.props,p=h.x,x=h.width,m=h.travellerWidth,w=h.startIndex,A=h.endIndex,_=h.onChange,T=r.pageX-o;T>0?T=Math.min(T,p+x-m-f,p+x-m-u):T<0&&(T=Math.max(T,p-u,p-f));var N=this.getIndex({startX:u+T,endX:f+T});(N.startIndex!==w||N.endIndex!==A)&&_&&_(N),this.setState({startX:u+T,endX:f+T,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,i){var o=kS(i)?i.changedTouches[0]:i;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var i=this.state,o=i.brushMoveStartX,u=i.movingTravellerId,f=i.endX,h=i.startX,p=this.state[u],x=this.props,m=x.x,w=x.width,A=x.travellerWidth,_=x.onChange,T=x.gap,N=x.data,E={startX:this.state.startX,endX:this.state.endX},C=r.pageX-o;C>0?C=Math.min(C,m+w-A-p):C<0&&(C=Math.max(C,m-p)),E[u]=p+C;var O=this.getIndex(E),M=O.startIndex,P=O.endIndex,I=function(){var B=N.length-1;return u==="startX"&&(f>h?M%T===0:P%T===0)||fh?P%T===0:M%T===0)||f>h&&P===B};this.setState(sr(sr({},u,p+C),"brushMoveStartX",r.pageX),function(){_&&I()&&_(O)})}},{key:"handleTravellerMoveKeyboard",value:function(r,i){var o=this,u=this.state,f=u.scaleValues,h=u.startX,p=u.endX,x=this.state[i],m=f.indexOf(x);if(m!==-1){var w=m+r;if(!(w===-1||w>=f.length)){var A=f[w];i==="startX"&&A>=p||i==="endX"&&A<=h||this.setState(sr({},i,A),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,i=r.x,o=r.y,u=r.width,f=r.height,h=r.fill,p=r.stroke;return Y.createElement("rect",{stroke:p,fill:h,x:i,y:o,width:u,height:f})}},{key:"renderPanorama",value:function(){var r=this.props,i=r.x,o=r.y,u=r.width,f=r.height,h=r.data,p=r.children,x=r.padding,m=W.Children.only(p);return m?Y.cloneElement(m,{x:i,y:o,width:u,height:f,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(r,i){var o,u,f=this,h=this.props,p=h.y,x=h.travellerWidth,m=h.height,w=h.traveller,A=h.ariaLabel,_=h.data,T=h.startIndex,N=h.endIndex,E=Math.max(r,this.props.x),C=fp(fp({},Qe(this.props,!1)),{},{x:E,y:p,width:x,height:m}),O=A||"Min value: ".concat((o=_[T])===null||o===void 0?void 0:o.name,", Max value: ").concat((u=_[N])===null||u===void 0?void 0:u.name);return Y.createElement(Vt,{tabIndex:0,role:"slider","aria-label":O,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[i],onTouchStart:this.travellerDragStartHandlers[i],onKeyDown:function(P){["ArrowLeft","ArrowRight"].includes(P.key)&&(P.preventDefault(),P.stopPropagation(),f.handleTravellerMoveKeyboard(P.key==="ArrowRight"?1:-1,i))},onFocus:function(){f.setState({isTravellerFocused:!0})},onBlur:function(){f.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(w,C))}},{key:"renderSlide",value:function(r,i){var o=this.props,u=o.y,f=o.height,h=o.stroke,p=o.travellerWidth,x=Math.min(r,i)+p,m=Math.max(Math.abs(i-r)-p,0);return Y.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x,y:u,width:m,height:f})}},{key:"renderText",value:function(){var r=this.props,i=r.startIndex,o=r.endIndex,u=r.y,f=r.height,h=r.travellerWidth,p=r.stroke,x=this.state,m=x.startX,w=x.endX,A=5,_={pointerEvents:"none",fill:p};return Y.createElement(Vt,{className:"recharts-brush-texts"},Y.createElement(Ud,hh({textAnchor:"end",verticalAnchor:"middle",x:Math.min(m,w)-A,y:u+f/2},_),this.getTextOfTick(i)),Y.createElement(Ud,hh({textAnchor:"start",verticalAnchor:"middle",x:Math.max(m,w)+h+A,y:u+f/2},_),this.getTextOfTick(o)))}},{key:"render",value:function(){var r=this.props,i=r.data,o=r.className,u=r.children,f=r.x,h=r.y,p=r.width,x=r.height,m=r.alwaysShowText,w=this.state,A=w.startX,_=w.endX,T=w.isTextActive,N=w.isSlideMoving,E=w.isTravellerMoving,C=w.isTravellerFocused;if(!i||!i.length||!xe(f)||!xe(h)||!xe(p)||!xe(x)||p<=0||x<=0)return null;var O=rt("recharts-brush",o),M=Y.Children.count(u)===1,P=kee("userSelect","none");return Y.createElement(Vt,{className:O,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:P},this.renderBackground(),M&&this.renderPanorama(),this.renderSlide(A,_),this.renderTravellerLayer(A,"startX"),this.renderTravellerLayer(_,"endX"),(T||N||E||C||m)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var i=r.x,o=r.y,u=r.width,f=r.height,h=r.stroke,p=Math.floor(o+f/2)-1;return Y.createElement(Y.Fragment,null,Y.createElement("rect",{x:i,y:o,width:u,height:f,fill:h,stroke:"none"}),Y.createElement("line",{x1:i+1,y1:p,x2:i+u-1,y2:p,fill:"none",stroke:"#fff"}),Y.createElement("line",{x1:i+1,y1:p+2,x2:i+u-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,i){var o;return Y.isValidElement(r)?o=Y.cloneElement(r,i):Ge(r)?o=r(i):o=t.renderDefaultTraveller(i),o}},{key:"getDerivedStateFromProps",value:function(r,i){var o=r.data,u=r.width,f=r.x,h=r.travellerWidth,p=r.updateId,x=r.startIndex,m=r.endIndex;if(o!==i.prevData||p!==i.prevUpdateId)return fp({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:f,prevWidth:u},o&&o.length?zee({data:o,width:u,x:f,travellerWidth:h,startIndex:x,endIndex:m}):{scale:null,scaleValues:null});if(i.scale&&(u!==i.prevWidth||f!==i.prevX||h!==i.prevTravellerWidth)){i.scale.range([f,f+u-h]);var w=i.scale.domain().map(function(A){return i.scale(A)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:f,prevWidth:u,startX:i.scale(r.startIndex),endX:i.scale(r.endIndex),scaleValues:w}}return null}},{key:"getIndexInRange",value:function(r,i){for(var o=r.length,u=0,f=o-1;f-u>1;){var h=Math.floor((u+f)/2);r[h]>i?f=h:u=h}return i>=r[f]?f:u}}])}(W.PureComponent);sr(Ws,"displayName","Brush");sr(Ws,"defaultProps",{height:40,travellerWidth:5,gap:1,fill:"#fff",stroke:"#666",padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Wee=Ax;function Hee(e,t){var n;return Wee(e,function(r,i,o){return n=t(r,i,o),!n}),!!n}var Vee=Hee,Gee=S_,Xee=Ra,Yee=Vee,qee=nr,Kee=b0;function Zee(e,t,n){var r=qee(e)?Gee:Yee;return n&&Kee(e,t,n)&&(t=void 0),r(e,Xee(t))}var Qee=Zee;const Jee=wt(Qee);var gi=function(t,n){var r=t.alwaysShow,i=t.ifOverflow;return r&&(i="extendDomain"),i===n},DS=V_;function ete(e,t,n){t=="__proto__"&&DS?DS(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var tte=ete,nte=tte,rte=W_,ite=Ra;function ate(e,t){var n={};return t=ite(t),rte(e,function(r,i,o){nte(n,i,t(r,i,o))}),n}var ote=ate;const ste=wt(ote);function lte(e,t){for(var n=-1,r=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Cte(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Ote(e,t){var n=e.x,r=e.y,i=Ete(e,wte),o="".concat(n),u=parseInt(o,10),f="".concat(r),h=parseInt(f,10),p="".concat(t.height||i.height),x=parseInt(p,10),m="".concat(t.width||i.width),w=parseInt(m,10);return Ql(Ql(Ql(Ql(Ql({},t),i),u?{x:u}:{}),h?{y:h}:{}),{},{height:x,width:w,name:t.name,radius:t.radius})}function LS(e){return Y.createElement(uee,Cm({shapeType:"rectangle",propTransformer:Ote,activeClassName:"recharts-active-bar"},e))}var _te=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,i){if(typeof t=="number")return t;var o=xe(r)||$7(r);return o?t(r,i):(o||Ao(),n)}},Tte=["value","background"],S4;function Hs(e){"@babel/helpers - typeof";return Hs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hs(e)}function Nte(e,t){if(e==null)return{};var n=Ite(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ite(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gh(){return gh=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs($)0&&Math.abs(J)0&&(ne=Math.min((Pe||0)-(J[Je-1]||0),ne))}),Number.isFinite(ne)){var $=ne/H,re=T.layout==="vertical"?r.height:r.width;if(T.padding==="gap"&&(k=$*re/2),T.padding==="no-gap"){var te=wo(t.barCategoryGap,$*re),ee=$*re/2;k=ee-te-(ee-te)/re*te}}}i==="xAxis"?B=[r.left+(O.left||0)+(k||0),r.left+r.width-(O.right||0)-(k||0)]:i==="yAxis"?B=h==="horizontal"?[r.top+r.height-(O.bottom||0),r.top+(O.top||0)]:[r.top+(O.top||0)+(k||0),r.top+r.height-(O.bottom||0)-(k||0)]:B=T.range,P&&(B=[B[1],B[0]]);var oe=sK(T,o,w),ue=oe.scale,me=oe.realScaleType;ue.domain(E).range(B),lK(ue);var le=mK(ue,Gr(Gr({},T),{},{realScaleType:me}));i==="xAxis"?(K=N==="top"&&!M||N==="bottom"&&M,F=r.left,q=m[I]-K*T.height):i==="yAxis"&&(K=N==="left"&&!M||N==="right"&&M,F=m[I]-K*T.width,q=r.top);var Ee=Gr(Gr(Gr({},T),le),{},{realScaleType:me,x:F,y:q,scale:ue,width:i==="xAxis"?r.width:T.width,height:i==="yAxis"?r.height:T.height});return Ee.bandSize=nh(Ee,le),!T.hide&&i==="xAxis"?m[I]+=(K?-1:1)*Ee.height:T.hide||(m[I]+=(K?-1:1)*Ee.width),Gr(Gr({},A),{},D0({},_,Ee))},{})},T4=function(t,n){var r=t.x,i=t.y,o=n.x,u=n.y;return{x:Math.min(r,o),y:Math.min(i,u),width:Math.abs(o-r),height:Math.abs(u-i)}},Ute=function(t){var n=t.x1,r=t.y1,i=t.x2,o=t.y2;return T4({x:n,y:r},{x:i,y:o})},N4=function(){function e(t){Bte(this,e),this.scale=t}return Fte(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=r.bandAware,o=r.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+u}case"end":{var f=this.bandwidth?this.bandwidth():0;return this.scale(n)+f}default:return this.scale(n)}if(i){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),i=r[0],o=r[r.length-1];return i<=o?n>=i&&n<=o:n>=o&&n<=i}}],[{key:"create",value:function(n){return new e(n)}}])}();D0(N4,"EPS",1e-4);var Qx=function(t){var n=Object.keys(t).reduce(function(r,i){return Gr(Gr({},r),{},D0({},i,N4.create(t[i])))},{});return Gr(Gr({},n),{},{apply:function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},u=o.bandAware,f=o.position;return ste(i,function(h,p){return n[p].apply(h,{bandAware:u,position:f})})},isInRange:function(i){return A4(i,function(o,u){return n[u].isInRange(o)})}})};function zte(e){return(e%180+180)%180}var Wte=function(t){var n=t.width,r=t.height,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=zte(i),u=o*Math.PI/180,f=Math.atan(r/n),h=u>f&&u-1?i[o?t[u]:u]:void 0}}var Yte=Xte,qte=x4;function Kte(e){var t=qte(e),n=t%1;return t===t?n?t-n:t:0}var Zte=Kte,Qte=L_,Jte=Ra,ene=Zte,tne=Math.max;function nne(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:ene(n);return i<0&&(i=tne(r+i,0)),Qte(e,Jte(t),i)}var rne=nne,ine=Yte,ane=rne,one=ine(ane),sne=one;const lne=wt(sne);var une=GD(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),Jx=W.createContext(void 0),ev=W.createContext(void 0),I4=W.createContext(void 0),P4=W.createContext({}),R4=W.createContext(void 0),M4=W.createContext(0),k4=W.createContext(0),zS=function(t){var n=t.state,r=n.xAxisMap,i=n.yAxisMap,o=n.offset,u=t.clipPathId,f=t.children,h=t.width,p=t.height,x=une(o);return Y.createElement(Jx.Provider,{value:r},Y.createElement(ev.Provider,{value:i},Y.createElement(P4.Provider,{value:o},Y.createElement(I4.Provider,{value:x},Y.createElement(R4.Provider,{value:u},Y.createElement(M4.Provider,{value:p},Y.createElement(k4.Provider,{value:h},f)))))))},cne=function(){return W.useContext(R4)},D4=function(t){var n=W.useContext(Jx);n==null&&Ao();var r=n[t];return r==null&&Ao(),r},fne=function(){var t=W.useContext(Jx);return sa(t)},dne=function(){var t=W.useContext(ev),n=lne(t,function(r){return A4(r.domain,Number.isFinite)});return n||sa(t)},j4=function(t){var n=W.useContext(ev);n==null&&Ao();var r=n[t];return r==null&&Ao(),r},hne=function(){var t=W.useContext(I4);return t},pne=function(){return W.useContext(P4)},tv=function(){return W.useContext(k4)},nv=function(){return W.useContext(M4)};function Vs(e){"@babel/helpers - typeof";return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vs(e)}function gne(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function mne(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);ne*i)return!1;var o=n();return e*(t-e*o/2-r)>=0&&e*(t+e*o/2-i)<=0}function Zne(e,t){return W4(e,t+1)}function Qne(e,t,n,r,i){for(var o=(r||[]).slice(),u=t.start,f=t.end,h=0,p=1,x=u,m=function(){var _=r==null?void 0:r[h];if(_===void 0)return{v:W4(r,p)};var T=h,N,E=function(){return N===void 0&&(N=n(_,T)),N},C=_.coordinate,O=h===0||wh(e,C,E,x,f);O||(h=0,x=u,p+=1),O&&(x=C+e*(E()/2+i),h+=p)},w;p<=o.length;)if(w=m(),w)return w.v;return[]}function bc(e){"@babel/helpers - typeof";return bc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bc(e)}function KS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function In(e){for(var t=1;t0?A.coordinate-N*e:A.coordinate})}else o[w]=A=In(In({},A),{},{tickCoord:A.coordinate});var E=wh(e,A.tickCoord,T,f,h);E&&(h=A.tickCoord-e*(T()/2+i),o[w]=In(In({},A),{},{isShow:!0}))},x=u-1;x>=0;x--)p(x);return o}function rre(e,t,n,r,i,o){var u=(r||[]).slice(),f=u.length,h=t.start,p=t.end;if(o){var x=r[f-1],m=n(x,f-1),w=e*(x.coordinate+e*m/2-p);u[f-1]=x=In(In({},x),{},{tickCoord:w>0?x.coordinate-w*e:x.coordinate});var A=wh(e,x.tickCoord,function(){return m},h,p);A&&(p=x.tickCoord-e*(m/2+i),u[f-1]=In(In({},x),{},{isShow:!0}))}for(var _=o?f-1:f,T=function(C){var O=u[C],M,P=function(){return M===void 0&&(M=n(O,C)),M};if(C===0){var I=e*(O.coordinate-e*P()/2-h);u[C]=O=In(In({},O),{},{tickCoord:I<0?O.coordinate-I*e:O.coordinate})}else u[C]=O=In(In({},O),{},{tickCoord:O.coordinate});var k=wh(e,O.tickCoord,P,h,p);k&&(h=O.tickCoord+e*(P()/2+i),u[C]=In(In({},O),{},{isShow:!0}))},N=0;N<_;N++)T(N);return u}function av(e,t,n){var r=e.tick,i=e.ticks,o=e.viewBox,u=e.minTickGap,f=e.orientation,h=e.interval,p=e.tickFormatter,x=e.unit,m=e.angle;if(!i||!i.length||!r)return[];if(xe(h)||ml.isSsr)return Zne(i,typeof h=="number"&&xe(h)?h:0);var w=[],A=f==="top"||f==="bottom"?"width":"height",_=x&&A==="width"?yu(x,{fontSize:t,letterSpacing:n}):{width:0,height:0},T=function(O,M){var P=Ge(p)?p(O.value,M):O.value;return A==="width"?qne(yu(P,{fontSize:t,letterSpacing:n}),_,m):yu(P,{fontSize:t,letterSpacing:n})[A]},N=i.length>=2?Zr(i[1].coordinate-i[0].coordinate):1,E=Kne(o,N,A);return h==="equidistantPreserveStart"?Qne(N,E,T,i,u):(h==="preserveStart"||h==="preserveStartEnd"?w=rre(N,E,T,i,u,h==="preserveStartEnd"):w=nre(N,E,T,i,u),w.filter(function(C){return C.isShow}))}var ire=["viewBox"],are=["viewBox"],ore=["ticks"];function Ys(e){"@babel/helpers - typeof";return Ys=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ys(e)}function ds(){return ds=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function sre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function lre(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function QS(e,t){for(var n=0;n0?h(this.props):h(A)),u<=0||f<=0||!_||!_.length?null:Y.createElement(Vt,{className:rt("recharts-cartesian-axis",p),ref:function(N){r.layerReference=N}},o&&this.renderAxisLine(),this.renderTicks(_,this.state.fontSize,this.state.letterSpacing),Rn.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,i,o){var u,f=rt(i.className,"recharts-cartesian-axis-tick-value");return Y.isValidElement(r)?u=Y.cloneElement(r,tn(tn({},i),{},{className:f})):Ge(r)?u=r(tn(tn({},i),{},{className:f})):u=Y.createElement(Ud,ds({},i,{className:"recharts-cartesian-axis-tick-value"}),o),u}}])}(W.Component);ov(wl,"displayName","CartesianAxis");ov(wl,"defaultProps",{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:"bottom",ticks:[],stroke:"#666",tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:"preserveEnd"});var gre=["x1","y1","x2","y2","key"],mre=["offset"];function So(e){"@babel/helpers - typeof";return So=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},So(e)}function JS(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Mn(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function wre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bre=function(t){var n=t.fill;if(!n||n==="none")return null;var r=t.fillOpacity,i=t.x,o=t.y,u=t.width,f=t.height,h=t.ry;return Y.createElement("rect",{x:i,y:o,ry:h,width:u,height:f,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function G4(e,t){var n;if(Y.isValidElement(e))n=Y.cloneElement(e,t);else if(Ge(e))n=e(t);else{var r=t.x1,i=t.y1,o=t.x2,u=t.y2,f=t.key,h=eE(t,gre),p=Qe(h,!1);p.offset;var x=eE(p,mre);n=Y.createElement("line",ro({},x,{x1:r,y1:i,x2:o,y2:u,fill:"none",key:f}))}return n}function Are(e){var t=e.x,n=e.width,r=e.horizontal,i=r===void 0?!0:r,o=e.horizontalPoints;if(!i||!o||!o.length)return null;var u=o.map(function(f,h){var p=Mn(Mn({},e),{},{x1:t,y1:f,x2:t+n,y2:f,key:"line-".concat(h),index:h});return G4(i,p)});return Y.createElement("g",{className:"recharts-cartesian-grid-horizontal"},u)}function Sre(e){var t=e.y,n=e.height,r=e.vertical,i=r===void 0?!0:r,o=e.verticalPoints;if(!i||!o||!o.length)return null;var u=o.map(function(f,h){var p=Mn(Mn({},e),{},{x1:f,y1:t,x2:f,y2:t+n,key:"line-".concat(h),index:h});return G4(i,p)});return Y.createElement("g",{className:"recharts-cartesian-grid-vertical"},u)}function Ere(e){var t=e.horizontalFill,n=e.fillOpacity,r=e.x,i=e.y,o=e.width,u=e.height,f=e.horizontalPoints,h=e.horizontal,p=h===void 0?!0:h;if(!p||!t||!t.length)return null;var x=f.map(function(w){return Math.round(w+i-i)}).sort(function(w,A){return w-A});i!==x[0]&&x.unshift(0);var m=x.map(function(w,A){var _=!x[A+1],T=_?i+u-w:x[A+1]-w;if(T<=0)return null;var N=A%t.length;return Y.createElement("rect",{key:"react-".concat(A),y:w,x:r,height:T,width:o,stroke:"none",fill:t[N],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return Y.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},m)}function Cre(e){var t=e.vertical,n=t===void 0?!0:t,r=e.verticalFill,i=e.fillOpacity,o=e.x,u=e.y,f=e.width,h=e.height,p=e.verticalPoints;if(!n||!r||!r.length)return null;var x=p.map(function(w){return Math.round(w+o-o)}).sort(function(w,A){return w-A});o!==x[0]&&x.unshift(0);var m=x.map(function(w,A){var _=!x[A+1],T=_?o+f-w:x[A+1]-w;if(T<=0)return null;var N=A%r.length;return Y.createElement("rect",{key:"react-".concat(A),x:w,y:u,width:T,height:h,stroke:"none",fill:r[N],fillOpacity:i,className:"recharts-cartesian-grid-bg"})});return Y.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},m)}var Ore=function(t,n){var r=t.xAxis,i=t.width,o=t.height,u=t.offset;return t4(av(Mn(Mn(Mn({},wl.defaultProps),r),{},{ticks:Ti(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),u.left,u.left+u.width,n)},_re=function(t,n){var r=t.yAxis,i=t.width,o=t.height,u=t.offset;return t4(av(Mn(Mn(Mn({},wl.defaultProps),r),{},{ticks:Ti(r,!0),viewBox:{x:0,y:0,width:i,height:o}})),u.top,u.top+u.height,n)},qo={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function Ah(e){var t,n,r,i,o,u,f=tv(),h=nv(),p=pne(),x=Mn(Mn({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:qo.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:qo.fill,horizontal:(r=e.horizontal)!==null&&r!==void 0?r:qo.horizontal,horizontalFill:(i=e.horizontalFill)!==null&&i!==void 0?i:qo.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:qo.vertical,verticalFill:(u=e.verticalFill)!==null&&u!==void 0?u:qo.verticalFill,x:xe(e.x)?e.x:p.left,y:xe(e.y)?e.y:p.top,width:xe(e.width)?e.width:p.width,height:xe(e.height)?e.height:p.height}),m=x.x,w=x.y,A=x.width,_=x.height,T=x.syncWithTicks,N=x.horizontalValues,E=x.verticalValues,C=fne(),O=dne();if(!xe(A)||A<=0||!xe(_)||_<=0||!xe(m)||m!==+m||!xe(w)||w!==+w)return null;var M=x.verticalCoordinatesGenerator||Ore,P=x.horizontalCoordinatesGenerator||_re,I=x.horizontalPoints,k=x.verticalPoints;if((!I||!I.length)&&Ge(P)){var B=N&&N.length,F=P({yAxis:O?Mn(Mn({},O),{},{ticks:B?N:O.ticks}):void 0,width:f,height:h,offset:p},B?!0:T);Pi(Array.isArray(F),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(So(F),"]")),Array.isArray(F)&&(I=F)}if((!k||!k.length)&&Ge(M)){var q=E&&E.length,K=M({xAxis:C?Mn(Mn({},C),{},{ticks:q?E:C.ticks}):void 0,width:f,height:h,offset:p},q?!0:T);Pi(Array.isArray(K),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(So(K),"]")),Array.isArray(K)&&(k=K)}return Y.createElement("g",{className:"recharts-cartesian-grid"},Y.createElement(bre,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),Y.createElement(Are,ro({},x,{offset:p,horizontalPoints:I,xAxis:C,yAxis:O})),Y.createElement(Sre,ro({},x,{offset:p,verticalPoints:k,xAxis:C,yAxis:O})),Y.createElement(Ere,ro({},x,{horizontalPoints:I})),Y.createElement(Cre,ro({},x,{verticalPoints:k})))}Ah.displayName="CartesianGrid";var Tre=["type","layout","connectNulls","ref"],Nre=["key"];function qs(e){"@babel/helpers - typeof";return qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qs(e)}function tE(e,t){if(e==null)return{};var n=Ire(e,t),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Ire(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function bu(){return bu=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);nm){A=[].concat(Ko(h.slice(0,_)),[m-T]);break}var N=A.length%2===0?[0,w]:[w];return[].concat(Ko(t.repeat(h,x)),Ko(A),N).map(function(E){return"".concat(E,"px")}).join(", ")}),Xr(n,"id",Bc("recharts-line-")),Xr(n,"pathRef",function(u){n.mainCurve=u}),Xr(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Xr(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return $re(t,e),jre(t,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,i){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var o=this.props,u=o.points,f=o.xAxis,h=o.yAxis,p=o.layout,x=o.children,m=Pr(x,Hc);if(!m)return null;var w=function(T,N){return{x:T.x,y:T.y,value:T.value,errorVal:pr(T.payload,N)}},A={clipPath:r?"url(#clipPath-".concat(i,")"):null};return Y.createElement(Vt,A,m.map(function(_){return Y.cloneElement(_,{key:"bar-".concat(_.props.dataKey),data:u,xAxis:f,yAxis:h,layout:p,dataPointFormatter:w})}))}},{key:"renderDots",value:function(r,i,o){var u=this.props.isAnimationActive;if(u&&!this.state.isAnimationFinished)return null;var f=this.props,h=f.dot,p=f.points,x=f.dataKey,m=Qe(this.props,!1),w=Qe(h,!0),A=p.map(function(T,N){var E=ar(ar(ar({key:"dot-".concat(N),r:3},m),w),{},{index:N,cx:T.x,cy:T.y,value:T.value,dataKey:x,payload:T.payload,points:p});return t.renderDotItem(h,E)}),_={clipPath:r?"url(#clipPath-".concat(i?"":"dots-").concat(o,")"):null};return Y.createElement(Vt,bu({className:"recharts-line-dots",key:"dots"},_),A)}},{key:"renderCurveStatically",value:function(r,i,o,u){var f=this.props,h=f.type,p=f.layout,x=f.connectNulls;f.ref;var m=tE(f,Tre),w=ar(ar(ar({},Qe(m,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:i?"url(#clipPath-".concat(o,")"):null,points:r},u),{},{type:h,layout:p,connectNulls:x});return Y.createElement(dm,bu({},w,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,i){var o=this,u=this.props,f=u.points,h=u.strokeDasharray,p=u.isAnimationActive,x=u.animationBegin,m=u.animationDuration,w=u.animationEasing,A=u.animationId,_=u.animateNewValues,T=u.width,N=u.height,E=this.state,C=E.prevPoints,O=E.totalLength;return Y.createElement($i,{begin:x,duration:m,isActive:p,easing:w,from:{t:0},to:{t:1},key:"line-".concat(A),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(M){var P=M.t;if(C){var I=C.length/f.length,k=f.map(function(H,ne){var J=Math.floor(ne*I);if(C[J]){var $=C[J],re=qr($.x,H.x),te=qr($.y,H.y);return ar(ar({},H),{},{x:re(P),y:te(P)})}if(_){var ee=qr(T*2,H.x),oe=qr(N/2,H.y);return ar(ar({},H),{},{x:ee(P),y:oe(P)})}return ar(ar({},H),{},{x:H.x,y:H.y})});return o.renderCurveStatically(k,r,i)}var B=qr(0,O),F=B(P),q;if(h){var K="".concat(h).split(/[,\s]+/gim).map(function(H){return parseFloat(H)});q=o.getStrokeDasharray(F,O,K)}else q=o.generateSimpleStrokeDasharray(O,F);return o.renderCurveStatically(f,r,i,{strokeDasharray:q})})}},{key:"renderCurve",value:function(r,i){var o=this.props,u=o.points,f=o.isAnimationActive,h=this.state,p=h.prevPoints,x=h.totalLength;return f&&u&&u.length&&(!p&&x>0||!I0(p,u))?this.renderCurveWithAnimation(r,i):this.renderCurveStatically(u,r,i)}},{key:"render",value:function(){var r,i=this.props,o=i.hide,u=i.dot,f=i.points,h=i.className,p=i.xAxis,x=i.yAxis,m=i.top,w=i.left,A=i.width,_=i.height,T=i.isAnimationActive,N=i.id;if(o||!f||!f.length)return null;var E=this.state.isAnimationFinished,C=f.length===1,O=rt("recharts-line",h),M=p&&p.allowDataOverflow,P=x&&x.allowDataOverflow,I=M||P,k=Xe(N)?this.id:N,B=(r=Qe(u,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},F=B.r,q=F===void 0?3:F,K=B.strokeWidth,H=K===void 0?2:K,ne=Q7(u)?u:{},J=ne.clipDot,$=J===void 0?!0:J,re=q*2+H;return Y.createElement(Vt,{className:O},M||P?Y.createElement("defs",null,Y.createElement("clipPath",{id:"clipPath-".concat(k)},Y.createElement("rect",{x:M?w:w-A/2,y:P?m:m-_/2,width:M?A:A*2,height:P?_:_*2})),!$&&Y.createElement("clipPath",{id:"clipPath-dots-".concat(k)},Y.createElement("rect",{x:w-re/2,y:m-re/2,width:A+re,height:_+re}))):null,!C&&this.renderCurve(I,k),this.renderErrorBar(I,k),(C||u)&&this.renderDots(I,$,k),(!T||E)&&Aa.renderCallByParent(this.props,f))}}],[{key:"getDerivedStateFromProps",value:function(r,i){return r.animationId!==i.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:i.curPoints}:r.points!==i.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,i){for(var o=r.length%2!==0?[].concat(Ko(r),[0]):r,u=[],f=0;fe.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Nie(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Iie(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pie(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0?u:t&&t.length&&xe(i)&&xe(o)?t.slice(i,o+1):[]};function l8(e){return e==="number"?[0,"auto"]:void 0}var Hm=function(t,n,r,i){var o=t.graphicalItems,u=t.tooltipAxis,f=$0(n,t);return r<0||!o||!o.length||r>=f.length?null:o.reduce(function(h,p){var x,m=(x=p.props.data)!==null&&x!==void 0?x:n;m&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=r&&(m=m.slice(t.dataStartIndex,t.dataEndIndex+1));var w;if(u.dataKey&&!u.allowDuplicatedCategory){var A=m===void 0?f:m;w=Cd(A,u.dataKey,i)}else w=m&&m[r]||f[r];return w?[].concat(Js(h),[r4(p,w)]):h},[])},uE=function(t,n,r,i){var o=i||{x:t.chartX,y:t.chartY},u=Wie(o,r),f=t.orderedTooltipTicks,h=t.tooltipAxis,p=t.tooltipTicks,x=tK(u,f,p,h);if(x>=0&&p){var m=p[x]&&p[x].value,w=Hm(t,n,x,m),A=Hie(r,f,x,o);return{activeTooltipIndex:x,activeLabel:m,activePayload:w,activeCoordinate:A}}return null},Vie=function(t,n){var r=n.axes,i=n.graphicalItems,o=n.axisType,u=n.axisIdKey,f=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,m=t.children,w=t.stackOffset,A=e4(x,o);return r.reduce(function(_,T){var N,E=T.type.defaultProps!==void 0?se(se({},T.type.defaultProps),T.props):T.props,C=E.type,O=E.dataKey,M=E.allowDataOverflow,P=E.allowDuplicatedCategory,I=E.scale,k=E.ticks,B=E.includeHidden,F=E[u];if(_[F])return _;var q=$0(t.data,{graphicalItems:i.filter(function(le){var Ee,Pe=u in le.props?le.props[u]:(Ee=le.type.defaultProps)===null||Ee===void 0?void 0:Ee[u];return Pe===F}),dataStartIndex:h,dataEndIndex:p}),K=q.length,H,ne,J;yie(E.domain,M,C)&&(H=sm(E.domain,null,M),A&&(C==="number"||I!=="auto")&&(J=vu(q,O,"category")));var $=l8(C);if(!H||H.length===0){var re,te=(re=E.domain)!==null&&re!==void 0?re:$;if(O){if(H=vu(q,O,C),C==="category"&&A){var ee=z7(H);P&&ee?(ne=H,H=dh(0,K)):P||(H=UA(te,H,T).reduce(function(le,Ee){return le.indexOf(Ee)>=0?le:[].concat(Js(le),[Ee])},[]))}else if(C==="category")P?H=H.filter(function(le){return le!==""&&!Xe(le)}):H=UA(te,H,T).reduce(function(le,Ee){return le.indexOf(Ee)>=0||Ee===""||Xe(Ee)?le:[].concat(Js(le),[Ee])},[]);else if(C==="number"){var oe=oK(q,i.filter(function(le){var Ee,Pe,Je=u in le.props?le.props[u]:(Ee=le.type.defaultProps)===null||Ee===void 0?void 0:Ee[u],Se="hide"in le.props?le.props.hide:(Pe=le.type.defaultProps)===null||Pe===void 0?void 0:Pe.hide;return Je===F&&(B||!Se)}),O,o,x);oe&&(H=oe)}A&&(C==="number"||I!=="auto")&&(J=vu(q,O,"category"))}else A?H=dh(0,K):f&&f[F]&&f[F].hasStack&&C==="number"?H=w==="expand"?[0,1]:n4(f[F].stackGroups,h,p):H=JT(q,i.filter(function(le){var Ee=u in le.props?le.props[u]:le.type.defaultProps[u],Pe="hide"in le.props?le.props.hide:le.type.defaultProps.hide;return Ee===F&&(B||!Pe)}),C,x,!0);if(C==="number")H=Um(m,H,F,o,k),te&&(H=sm(te,H,M));else if(C==="category"&&te){var ue=te,me=H.every(function(le){return ue.indexOf(le)>=0});me&&(H=ue)}}return se(se({},_),{},Be({},F,se(se({},E),{},{axisType:o,domain:H,categoricalDomain:J,duplicateDomain:ne,originalDomain:(N=E.domain)!==null&&N!==void 0?N:$,isCategorical:A,layout:x})))},{})},Gie=function(t,n){var r=n.graphicalItems,i=n.Axis,o=n.axisType,u=n.axisIdKey,f=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,m=t.children,w=$0(t.data,{graphicalItems:r,dataStartIndex:h,dataEndIndex:p}),A=w.length,_=e4(x,o),T=-1;return r.reduce(function(N,E){var C=E.type.defaultProps!==void 0?se(se({},E.type.defaultProps),E.props):E.props,O=C[u],M=l8("number");if(!N[O]){T++;var P;return _?P=dh(0,A):f&&f[O]&&f[O].hasStack?(P=n4(f[O].stackGroups,h,p),P=Um(m,P,O,o)):(P=sm(M,JT(w,r.filter(function(I){var k,B,F=u in I.props?I.props[u]:(k=I.type.defaultProps)===null||k===void 0?void 0:k[u],q="hide"in I.props?I.props.hide:(B=I.type.defaultProps)===null||B===void 0?void 0:B.hide;return F===O&&!q}),"number",x),i.defaultProps.allowDataOverflow),P=Um(m,P,O,o)),se(se({},N),{},Be({},O,se(se({axisType:o},i.defaultProps),{},{hide:!0,orientation:Ir(Uie,"".concat(o,".").concat(T%2),null),domain:P,originalDomain:M,isCategorical:_,layout:x})))}return N},{})},Xie=function(t,n){var r=n.axisType,i=r===void 0?"xAxis":r,o=n.AxisComp,u=n.graphicalItems,f=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=t.children,m="".concat(i,"Id"),w=Pr(x,o),A={};return w&&w.length?A=Vie(t,{axes:w,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:f,dataStartIndex:h,dataEndIndex:p}):u&&u.length&&(A=Gie(t,{Axis:o,graphicalItems:u,axisType:i,axisIdKey:m,stackGroups:f,dataStartIndex:h,dataEndIndex:p})),A},Yie=function(t){var n=sa(t),r=Ti(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Sx(r,function(i){return i.coordinate}),tooltipAxis:n,tooltipAxisBandSize:nh(n,r)}},cE=function(t){var n=t.children,r=t.defaultShowTooltip,i=ur(n,Ws),o=0,u=0;return t.data&&t.data.length!==0&&(u=t.data.length-1),i&&i.props&&(i.props.startIndex>=0&&(o=i.props.startIndex),i.props.endIndex>=0&&(u=i.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:o,dataEndIndex:u,activeTooltipIndex:-1,isTooltipActive:!!r}},qie=function(t){return!t||!t.length?!1:t.some(function(n){var r=Ii(n&&n.type);return r&&r.indexOf("Bar")>=0})},fE=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},Kie=function(t,n){var r=t.props,i=t.graphicalItems,o=t.xAxisMap,u=o===void 0?{}:o,f=t.yAxisMap,h=f===void 0?{}:f,p=r.width,x=r.height,m=r.children,w=r.margin||{},A=ur(m,Ws),_=ur(m,As),T=Object.keys(h).reduce(function(P,I){var k=h[I],B=k.orientation;return!k.mirror&&!k.hide?se(se({},P),{},Be({},B,P[B]+k.width)):P},{left:w.left||0,right:w.right||0}),N=Object.keys(u).reduce(function(P,I){var k=u[I],B=k.orientation;return!k.mirror&&!k.hide?se(se({},P),{},Be({},B,Ir(P,"".concat(B))+k.height)):P},{top:w.top||0,bottom:w.bottom||0}),E=se(se({},N),T),C=E.bottom;A&&(E.bottom+=A.props.height||Ws.defaultProps.height),_&&n&&(E=iK(E,i,r,n));var O=p-E.left-E.right,M=x-E.top-E.bottom;return se(se({brushBottom:C},E),{},{width:Math.max(O,0),height:Math.max(M,0)})},Zie=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},u8=function(t){var n=t.chartName,r=t.GraphicalChild,i=t.defaultTooltipEventType,o=i===void 0?"axis":i,u=t.validateTooltipEventTypes,f=u===void 0?["axis"]:u,h=t.axisComponents,p=t.legendContent,x=t.formatAxisMap,m=t.defaultProps,w=function(E,C){var O=C.graphicalItems,M=C.stackGroups,P=C.offset,I=C.updateId,k=C.dataStartIndex,B=C.dataEndIndex,F=E.barSize,q=E.layout,K=E.barGap,H=E.barCategoryGap,ne=E.maxBarSize,J=fE(q),$=J.numericAxisName,re=J.cateAxisName,te=qie(O),ee=[];return O.forEach(function(oe,ue){var me=$0(E.data,{graphicalItems:[oe],dataStartIndex:k,dataEndIndex:B}),le=oe.type.defaultProps!==void 0?se(se({},oe.type.defaultProps),oe.props):oe.props,Ee=le.dataKey,Pe=le.maxBarSize,Je=le["".concat($,"Id")],Se=le["".concat(re,"Id")],Ue={},$e=h.reduce(function(be,jn){var Gi=C["".concat(jn.axisType,"Map")],un=le["".concat(jn.axisType,"Id")];Gi&&Gi[un]||jn.axisType==="zAxis"||Ao();var ko=Gi[un];return se(se({},be),{},Be(Be({},jn.axisType,ko),"".concat(jn.axisType,"Ticks"),Ti(ko)))},Ue),ye=$e[re],je=$e["".concat(re,"Ticks")],Re=M&&M[Je]&&M[Je].hasStack&&xK(oe,M[Je].stackGroups),ce=Ii(oe.type).indexOf("Bar")>=0,Ne=nh(ye,je),Le=[],et=te&&nK({barSize:F,stackGroups:M,totalSize:Zie($e,re)});if(ce){var ct,ze,we=Xe(Pe)?ne:Pe,Ie=(ct=(ze=nh(ye,je,!0))!==null&&ze!==void 0?ze:we)!==null&&ct!==void 0?ct:0;Le=rK({barGap:K,barCategoryGap:H,bandSize:Ie!==Ne?Ie:Ne,sizeList:et[Se],maxBarSize:we}),Ie!==Ne&&(Le=Le.map(function(be){return se(se({},be),{},{position:se(se({},be.position),{},{offset:be.position.offset-Ie/2})})}))}var ln=oe&&oe.type&&oe.type.getComposedData;ln&&ee.push({props:se(se({},ln(se(se({},$e),{},{displayedData:me,props:E,dataKey:Ee,item:oe,bandSize:Ne,barPosition:Le,offset:P,stackedData:Re,layout:q,dataStartIndex:k,dataEndIndex:B}))),{},Be(Be(Be({key:oe.key||"item-".concat(ue)},$,$e[$]),re,$e[re]),"animationId",I)),childIndex:tj(oe,E.children),item:oe})}),ee},A=function(E,C){var O=E.props,M=E.dataStartIndex,P=E.dataEndIndex,I=E.updateId;if(!kw({props:O}))return null;var k=O.children,B=O.layout,F=O.stackOffset,q=O.data,K=O.reverseStackOrder,H=fE(B),ne=H.numericAxisName,J=H.cateAxisName,$=Pr(k,r),re=gK(q,$,"".concat(ne,"Id"),"".concat(J,"Id"),F,K),te=h.reduce(function(le,Ee){var Pe="".concat(Ee.axisType,"Map");return se(se({},le),{},Be({},Pe,Xie(O,se(se({},Ee),{},{graphicalItems:$,stackGroups:Ee.axisType===ne&&re,dataStartIndex:M,dataEndIndex:P}))))},{}),ee=Kie(se(se({},te),{},{props:O,graphicalItems:$}),C==null?void 0:C.legendBBox);Object.keys(te).forEach(function(le){te[le]=x(O,te[le],ee,le.replace("Map",""),n)});var oe=te["".concat(J,"Map")],ue=Yie(oe),me=w(O,se(se({},te),{},{dataStartIndex:M,dataEndIndex:P,updateId:I,graphicalItems:$,stackGroups:re,offset:ee}));return se(se({formattedGraphicalItems:me,graphicalItems:$,offset:ee,stackGroups:re},ue),te)},_=function(N){function E(C){var O,M,P;return Iie(this,E),P=Mie(this,E,[C]),Be(P,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Be(P,"accessibilityManager",new mie),Be(P,"handleLegendBBoxUpdate",function(I){if(I){var k=P.state,B=k.dataStartIndex,F=k.dataEndIndex,q=k.updateId;P.setState(se({legendBBox:I},A({props:P.props,dataStartIndex:B,dataEndIndex:F,updateId:q},se(se({},P.state),{},{legendBBox:I}))))}}),Be(P,"handleReceiveSyncEvent",function(I,k,B){if(P.props.syncId===I){if(B===P.eventEmitterSymbol&&typeof P.props.syncMethod!="function")return;P.applySyncEvent(k)}}),Be(P,"handleBrushChange",function(I){var k=I.startIndex,B=I.endIndex;if(k!==P.state.dataStartIndex||B!==P.state.dataEndIndex){var F=P.state.updateId;P.setState(function(){return se({dataStartIndex:k,dataEndIndex:B},A({props:P.props,dataStartIndex:k,dataEndIndex:B,updateId:F},P.state))}),P.triggerSyncEvent({dataStartIndex:k,dataEndIndex:B})}}),Be(P,"handleMouseEnter",function(I){var k=P.getMouseInfo(I);if(k){var B=se(se({},k),{},{isTooltipActive:!0});P.setState(B),P.triggerSyncEvent(B);var F=P.props.onMouseEnter;Ge(F)&&F(B,I)}}),Be(P,"triggeredAfterMouseMove",function(I){var k=P.getMouseInfo(I),B=k?se(se({},k),{},{isTooltipActive:!0}):{isTooltipActive:!1};P.setState(B),P.triggerSyncEvent(B);var F=P.props.onMouseMove;Ge(F)&&F(B,I)}),Be(P,"handleItemMouseEnter",function(I){P.setState(function(){return{isTooltipActive:!0,activeItem:I,activePayload:I.tooltipPayload,activeCoordinate:I.tooltipPosition||{x:I.cx,y:I.cy}}})}),Be(P,"handleItemMouseLeave",function(){P.setState(function(){return{isTooltipActive:!1}})}),Be(P,"handleMouseMove",function(I){I.persist(),P.throttleTriggeredAfterMouseMove(I)}),Be(P,"handleMouseLeave",function(I){P.throttleTriggeredAfterMouseMove.cancel();var k={isTooltipActive:!1};P.setState(k),P.triggerSyncEvent(k);var B=P.props.onMouseLeave;Ge(B)&&B(k,I)}),Be(P,"handleOuterEvent",function(I){var k=ej(I),B=Ir(P.props,"".concat(k));if(k&&Ge(B)){var F,q;/.*touch.*/i.test(k)?q=P.getMouseInfo(I.changedTouches[0]):q=P.getMouseInfo(I),B((F=q)!==null&&F!==void 0?F:{},I)}}),Be(P,"handleClick",function(I){var k=P.getMouseInfo(I);if(k){var B=se(se({},k),{},{isTooltipActive:!0});P.setState(B),P.triggerSyncEvent(B);var F=P.props.onClick;Ge(F)&&F(B,I)}}),Be(P,"handleMouseDown",function(I){var k=P.props.onMouseDown;if(Ge(k)){var B=P.getMouseInfo(I);k(B,I)}}),Be(P,"handleMouseUp",function(I){var k=P.props.onMouseUp;if(Ge(k)){var B=P.getMouseInfo(I);k(B,I)}}),Be(P,"handleTouchMove",function(I){I.changedTouches!=null&&I.changedTouches.length>0&&P.throttleTriggeredAfterMouseMove(I.changedTouches[0])}),Be(P,"handleTouchStart",function(I){I.changedTouches!=null&&I.changedTouches.length>0&&P.handleMouseDown(I.changedTouches[0])}),Be(P,"handleTouchEnd",function(I){I.changedTouches!=null&&I.changedTouches.length>0&&P.handleMouseUp(I.changedTouches[0])}),Be(P,"handleDoubleClick",function(I){var k=P.props.onDoubleClick;if(Ge(k)){var B=P.getMouseInfo(I);k(B,I)}}),Be(P,"handleContextMenu",function(I){var k=P.props.onContextMenu;if(Ge(k)){var B=P.getMouseInfo(I);k(B,I)}}),Be(P,"triggerSyncEvent",function(I){P.props.syncId!==void 0&&hp.emit(pp,P.props.syncId,I,P.eventEmitterSymbol)}),Be(P,"applySyncEvent",function(I){var k=P.props,B=k.layout,F=k.syncMethod,q=P.state.updateId,K=I.dataStartIndex,H=I.dataEndIndex;if(I.dataStartIndex!==void 0||I.dataEndIndex!==void 0)P.setState(se({dataStartIndex:K,dataEndIndex:H},A({props:P.props,dataStartIndex:K,dataEndIndex:H,updateId:q},P.state)));else if(I.activeTooltipIndex!==void 0){var ne=I.chartX,J=I.chartY,$=I.activeTooltipIndex,re=P.state,te=re.offset,ee=re.tooltipTicks;if(!te)return;if(typeof F=="function")$=F(ee,I);else if(F==="value"){$=-1;for(var oe=0;oe=0){var Re,ce;if(ne.dataKey&&!ne.allowDuplicatedCategory){var Ne=typeof ne.dataKey=="function"?je:"payload.".concat(ne.dataKey.toString());Re=Cd(oe,Ne,$),ce=ue&&me&&Cd(me,Ne,$)}else Re=oe==null?void 0:oe[J],ce=ue&&me&&me[J];if(Se||Je){var Le=I.props.activeIndex!==void 0?I.props.activeIndex:J;return[W.cloneElement(I,se(se(se({},F.props),$e),{},{activeIndex:Le})),null,null]}if(!Xe(Re))return[ye].concat(Js(P.renderActivePoints({item:F,activePoint:Re,basePoint:ce,childIndex:J,isRange:ue})))}else{var et,ct=(et=P.getItemByXY(P.state.activeCoordinate))!==null&&et!==void 0?et:{graphicalItem:ye},ze=ct.graphicalItem,we=ze.item,Ie=we===void 0?I:we,ln=ze.childIndex,be=se(se(se({},F.props),$e),{},{activeIndex:ln});return[W.cloneElement(Ie,be),null,null]}return ue?[ye,null,null]:[ye,null]}),Be(P,"renderCustomized",function(I,k,B){return W.cloneElement(I,se(se({key:"recharts-customized-".concat(B)},P.props),P.state))}),Be(P,"renderMap",{CartesianGrid:{handler:Rf,once:!0},ReferenceArea:{handler:P.renderReferenceElement},ReferenceLine:{handler:Rf},ReferenceDot:{handler:P.renderReferenceElement},XAxis:{handler:Rf},YAxis:{handler:Rf},Brush:{handler:P.renderBrush,once:!0},Bar:{handler:P.renderGraphicChild},Line:{handler:P.renderGraphicChild},Area:{handler:P.renderGraphicChild},Radar:{handler:P.renderGraphicChild},RadialBar:{handler:P.renderGraphicChild},Scatter:{handler:P.renderGraphicChild},Pie:{handler:P.renderGraphicChild},Funnel:{handler:P.renderGraphicChild},Tooltip:{handler:P.renderCursor,once:!0},PolarGrid:{handler:P.renderPolarGrid,once:!0},PolarAngleAxis:{handler:P.renderPolarAxis},PolarRadiusAxis:{handler:P.renderPolarAxis},Customized:{handler:P.renderCustomized}}),P.clipPathId="".concat((O=C.id)!==null&&O!==void 0?O:Bc("recharts"),"-clip"),P.throttleTriggeredAfterMouseMove=Z_(P.triggeredAfterMouseMove,(M=C.throttleDelay)!==null&&M!==void 0?M:1e3/60),P.state={},P}return jie(E,N),Rie(E,[{key:"componentDidMount",value:function(){var O,M;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(O=this.props.margin.left)!==null&&O!==void 0?O:0,top:(M=this.props.margin.top)!==null&&M!==void 0?M:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var O=this.props,M=O.children,P=O.data,I=O.height,k=O.layout,B=ur(M,Er);if(B){var F=B.props.defaultIndex;if(!(typeof F!="number"||F<0||F>this.state.tooltipTicks.length-1)){var q=this.state.tooltipTicks[F]&&this.state.tooltipTicks[F].value,K=Hm(this.state,P,F,q),H=this.state.tooltipTicks[F].coordinate,ne=(this.state.offset.top+I)/2,J=k==="horizontal",$=J?{x:H,y:ne}:{y:H,x:ne},re=this.state.formattedGraphicalItems.find(function(ee){var oe=ee.item;return oe.type.name==="Scatter"});re&&($=se(se({},$),re.props.points[F].tooltipPosition),K=re.props.points[F].tooltipPayload);var te={activeTooltipIndex:F,isTooltipActive:!0,activeLabel:q,activePayload:K,activeCoordinate:$};this.setState(te),this.renderCursor(B),this.accessibilityManager.setIndex(F)}}}},{key:"getSnapshotBeforeUpdate",value:function(O,M){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==M.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==O.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==O.margin){var P,I;this.accessibilityManager.setDetails({offset:{left:(P=this.props.margin.left)!==null&&P!==void 0?P:0,top:(I=this.props.margin.top)!==null&&I!==void 0?I:0}})}return null}},{key:"componentDidUpdate",value:function(O){bg([ur(O.children,Er)],[ur(this.props.children,Er)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var O=ur(this.props.children,Er);if(O&&typeof O.props.shared=="boolean"){var M=O.props.shared?"axis":"item";return f.indexOf(M)>=0?M:o}return o}},{key:"getMouseInfo",value:function(O){if(!this.container)return null;var M=this.container,P=M.getBoundingClientRect(),I=_V(P),k={chartX:Math.round(O.pageX-I.left),chartY:Math.round(O.pageY-I.top)},B=P.width/M.offsetWidth||1,F=this.inRange(k.chartX,k.chartY,B);if(!F)return null;var q=this.state,K=q.xAxisMap,H=q.yAxisMap,ne=this.getTooltipEventType(),J=uE(this.state,this.props.data,this.props.layout,F);if(ne!=="axis"&&K&&H){var $=sa(K).scale,re=sa(H).scale,te=$&&$.invert?$.invert(k.chartX):null,ee=re&&re.invert?re.invert(k.chartY):null;return se(se({},k),{},{xValue:te,yValue:ee},J)}return J?se(se({},k),J):null}},{key:"inRange",value:function(O,M){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,I=this.props.layout,k=O/P,B=M/P;if(I==="horizontal"||I==="vertical"){var F=this.state.offset,q=k>=F.left&&k<=F.left+F.width&&B>=F.top&&B<=F.top+F.height;return q?{x:k,y:B}:null}var K=this.state,H=K.angleAxisMap,ne=K.radiusAxisMap;if(H&&ne){var J=sa(H);return HA({x:k,y:B},J)}return null}},{key:"parseEventsOfWrapper",value:function(){var O=this.props.children,M=this.getTooltipEventType(),P=ur(O,Er),I={};P&&M==="axis"&&(P.props.trigger==="click"?I={onClick:this.handleClick}:I={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var k=Od(this.props,this.handleOuterEvent);return se(se({},k),I)}},{key:"addListener",value:function(){hp.on(pp,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){hp.removeListener(pp,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(O,M,P){for(var I=this.state.formattedGraphicalItems,k=0,B=I.length;k{(async()=>{try{h(!0);const A=e==null?void 0:e.id,[_,T,N]=await Promise.all([qf.getStats(A),qf.getRevenueChart(7,A),qf.getTopProducts(5,A)]);n(_),i(T),u(N)}catch(A){console.error("Failed to fetch dashboard data:",A)}finally{h(!1)}})()},[e]),f)return S.jsx("div",{className:"flex items-center justify-center h-64",children:S.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})});const p=[{label:"Today's Sales",value:`$${((x=t==null?void 0:t.today_sales)==null?void 0:x.toFixed(2))||"0.00"}`,change:(t==null?void 0:t.revenue_change)||0,icon:KM,color:"bg-green-500"},{label:"Today's Orders",value:(t==null?void 0:t.today_orders)||0,change:(t==null?void 0:t.orders_change)||0,icon:so,color:"bg-blue-500"},{label:"Today's Profit",value:`$${((m=t==null?void 0:t.today_profit)==null?void 0:m.toFixed(2))||"0.00"}`,icon:vw,color:"bg-purple-500"},{label:"Total Products",value:(t==null?void 0:t.total_products)||0,icon:Sd,color:"bg-orange-500"},{label:"Total Stores",value:(t==null?void 0:t.total_stores)||0,icon:Sd,color:"bg-indigo-500"},{label:"Low Stock Items",value:(t==null?void 0:t.low_stock_count)||0,icon:xg,color:"bg-red-500"}];return S.jsxs("div",{className:"space-y-6",children:[S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-6 gap-4",children:p.map((w,A)=>{const _=w.icon;return S.jsx("div",{className:"bg-white rounded-xl shadow-sm p-6",children:S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-500",children:w.label}),S.jsx("p",{className:"text-2xl font-bold mt-1",children:w.value}),w.change!==void 0&&S.jsxs("div",{className:"flex items-center mt-2 text-sm",children:[w.change>=0?S.jsx(vw,{size:16,className:"text-green-500 mr-1"}):S.jsx(s5,{size:16,className:"text-red-500 mr-1"}),S.jsxs("span",{className:w.change>=0?"text-green-500":"text-red-500",children:[Math.abs(w.change),"%"]}),S.jsx("span",{className:"text-gray-400 ml-1",children:"vs yesterday"})]})]}),S.jsx("div",{className:`${w.color} p-3 rounded-lg`,children:S.jsx(_,{className:"text-white",size:24})})]})},A)})}),S.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Revenue Trend (Last 7 Days)"}),S.jsx("div",{className:"h-64",children:S.jsx(Hg,{width:"100%",height:"100%",children:S.jsxs(c8,{data:r,children:[S.jsx(Ah,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),S.jsx(Eo,{dataKey:"date",stroke:"#9ca3af",fontSize:12}),S.jsx(Co,{stroke:"#9ca3af",fontSize:12}),S.jsx(Er,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"}}),S.jsx(bl,{type:"monotone",dataKey:"revenue",stroke:"#3b82f6",strokeWidth:2,dot:{fill:"#3b82f6",strokeWidth:2}})]})})})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Top Selling Products"}),S.jsxs("div",{className:"space-y-4",children:[o.map((w,A)=>S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center text-sm font-semibold",children:A+1}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:w.product.name}),S.jsx("p",{className:"text-sm text-gray-500",children:w.product.sku})]})]}),S.jsxs("div",{className:"text-right",children:[S.jsxs("p",{className:"font-semibold",children:[w.total_sold," sold"]}),S.jsxs("p",{className:"text-sm text-gray-500",children:["$",(w.total_sold*w.product.price).toFixed(2)]})]})]},w.product.id)),o.length===0&&S.jsx("p",{className:"text-center text-gray-500 py-8",children:"No sales data yet"})]})]})]})]})}function eae(){const{selectedStore:e,items:t,addItem:n,removeItem:r,updateQuantity:i,clearCart:o,getSubtotal:u}=kc(),[f,h]=W.useState([]),[p,x]=W.useState([]),[m,w]=W.useState(""),[A,_]=W.useState(null),[T,N]=W.useState(!0),[E,C]=W.useState(!1),[O,M]=W.useState("cash"),[P,I]=W.useState(""),[k,B]=W.useState(!1);W.useEffect(()=>{(async()=>{try{const[re,te]=await Promise.all([cs.getAll({store_id:e==null?void 0:e.id,limit:100}),Qy.getAll()]);h(re.data),x(te)}catch(re){console.error("Failed to fetch data:",re)}finally{N(!1)}})()},[e]);const F=f.filter($=>{const re=$.name.toLowerCase().includes(m.toLowerCase())||$.sku.toLowerCase().includes(m.toLowerCase()),te=A?$.category_id===A:!0;return re&&te&&$.is_active&&$.stock_quantity>0}),q=u(),K=q*.1,H=q+K,ne=async()=>{if(!e){alert("Please select a store");return}B(!0);try{const $=t.map(re=>({product_id:re.product.id,quantity:re.quantity,unit_price:re.product.price}));await mu.create({store_id:e.id,items:$,payment_method:O,subtotal:q,tax_amount:K,total:H}),o(),C(!1),alert("Order completed successfully!")}catch($){console.error("Failed to create order:",$),alert("Failed to process order")}finally{B(!1)}},J=O==="cash"&&P?parseFloat(P)-H:0;return T?S.jsx("div",{className:"flex items-center justify-center h-64",children:S.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):S.jsxs("div",{className:"flex gap-6 h-[calc(100vh-140px)]",children:[S.jsxs("div",{className:"flex-1 flex flex-col",children:[S.jsx("div",{className:"mb-4 flex gap-4",children:S.jsxs("div",{className:"flex-1 relative",children:[S.jsx(Dc,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:20}),S.jsx("input",{type:"text",placeholder:"Search products by name or SKU...",value:m,onChange:$=>w($.target.value),className:"w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})}),S.jsxs("div",{className:"flex gap-2 mb-4 overflow-x-auto pb-2",children:[S.jsx("button",{onClick:()=>_(null),className:`px-4 py-2 rounded-lg whitespace-nowrap transition-colors ${A===null?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-100"}`,children:"All"}),p.map($=>S.jsx("button",{onClick:()=>_($.id),className:`px-4 py-2 rounded-lg whitespace-nowrap transition-colors ${A===$.id?"bg-blue-600 text-white":"bg-white text-gray-700 hover:bg-gray-100"}`,children:$.name},$.id))]}),S.jsx("div",{className:"flex-1 overflow-y-auto grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4 pr-2",children:F.map($=>S.jsxs("button",{onClick:()=>n($),className:"bg-white rounded-xl shadow-sm p-4 hover:shadow-md transition-shadow text-left",children:[S.jsx("div",{className:"aspect-square bg-gray-100 rounded-lg mb-3 flex items-center justify-center overflow-hidden",children:$.image_url?S.jsx("img",{src:$.image_url,alt:$.name,className:"w-full h-full object-cover"}):S.jsx(so,{className:"text-gray-400",size:32})}),S.jsx("h3",{className:"font-medium text-gray-800 truncate",children:$.name}),S.jsx("p",{className:"text-sm text-gray-500",children:$.sku}),S.jsxs("div",{className:"flex justify-between items-center mt-2",children:[S.jsxs("span",{className:"text-lg font-bold text-blue-600",children:["$",$.price.toFixed(2)]}),S.jsxs("span",{className:"text-xs text-gray-500",children:["Stock: ",$.stock_quantity]})]})]},$.id))})]}),S.jsxs("div",{className:"w-96 bg-white rounded-xl shadow-sm flex flex-col",children:[S.jsx("div",{className:"p-4 border-b",children:S.jsxs("h3",{className:"font-semibold text-lg flex items-center gap-2",children:[S.jsx(so,{size:20}),"Cart (",t.length,")"]})}),S.jsx("div",{className:"flex-1 overflow-y-auto p-4",children:t.length===0?S.jsxs("div",{className:"text-center text-gray-500 py-8",children:[S.jsx(so,{size:48,className:"mx-auto mb-4 opacity-30"}),S.jsx("p",{children:"Cart is empty"})]}):S.jsx("div",{className:"space-y-4",children:t.map($=>S.jsxs("div",{className:"flex gap-3",children:[S.jsxs("div",{className:"flex-1",children:[S.jsx("h4",{className:"font-medium text-sm",children:$.product.name}),S.jsxs("p",{className:"text-xs text-gray-500",children:["$",$.product.price.toFixed(2)," each"]})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>i($.product.id,$.quantity-1),className:"w-7 h-7 rounded bg-gray-100 flex items-center justify-center hover:bg-gray-200",children:S.jsx(kO,{size:14})}),S.jsx("span",{className:"w-8 text-center font-medium",children:$.quantity}),S.jsx("button",{onClick:()=>i($.product.id,$.quantity+1),className:"w-7 h-7 rounded bg-gray-100 flex items-center justify-center hover:bg-gray-200",children:S.jsx(Jh,{size:14})})]}),S.jsxs("div",{className:"text-right",children:[S.jsxs("p",{className:"font-medium",children:["$",($.product.price*$.quantity).toFixed(2)]}),S.jsx("button",{onClick:()=>r($.product.id),className:"text-red-500 hover:text-red-700",children:S.jsx(Jy,{size:16})})]})]},$.product.id))})}),S.jsxs("div",{className:"border-t p-4 space-y-3",children:[S.jsxs("div",{className:"flex justify-between text-sm",children:[S.jsx("span",{className:"text-gray-600",children:"Subtotal"}),S.jsxs("span",{children:["$",q.toFixed(2)]})]}),S.jsxs("div",{className:"flex justify-between text-sm",children:[S.jsx("span",{className:"text-gray-600",children:"Tax (10%)"}),S.jsxs("span",{children:["$",K.toFixed(2)]})]}),S.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[S.jsx("span",{children:"Total"}),S.jsxs("span",{children:["$",H.toFixed(2)]})]}),S.jsx("button",{onClick:()=>C(!0),disabled:t.length===0,className:"w-full bg-blue-600 text-white py-3 rounded-lg font-semibold hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"Checkout"}),t.length>0&&S.jsx("button",{onClick:o,className:"w-full text-red-600 py-2 hover:underline text-sm",children:"Clear Cart"})]})]}),E&&S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:S.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-md p-6",children:[S.jsxs("div",{className:"flex justify-between items-center mb-4",children:[S.jsx("h3",{className:"text-xl font-semibold",children:"Payment"}),S.jsx("button",{onClick:()=>C(!1),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:24})})]}),S.jsxs("div",{className:"mb-6",children:[S.jsx("p",{className:"text-sm text-gray-600",children:"Total Amount"}),S.jsxs("p",{className:"text-3xl font-bold",children:["$",H.toFixed(2)]})]}),S.jsxs("div",{className:"mb-6",children:[S.jsx("p",{className:"text-sm text-gray-600 mb-2",children:"Payment Method"}),S.jsx("div",{className:"grid grid-cols-3 gap-2",children:[{value:"cash",label:"Cash",icon:zM},{value:"card",label:"Card",icon:qM},{value:"digital",label:"Digital",icon:o5}].map($=>{const re=$.icon;return S.jsxs("button",{onClick:()=>M($.value),className:`p-3 rounded-lg border-2 flex flex-col items-center gap-1 transition-colors ${O===$.value?"border-blue-600 bg-blue-50 text-blue-600":"border-gray-200 hover:border-gray-300"}`,children:[S.jsx(re,{size:24}),S.jsx("span",{className:"text-sm font-medium",children:$.label})]},$.value)})})]}),O==="cash"&&S.jsxs("div",{className:"mb-6",children:[S.jsx("label",{className:"block text-sm text-gray-600 mb-2",children:"Cash Received"}),S.jsx("input",{type:"number",value:P,onChange:$=>I($.target.value),className:"w-full px-4 py-3 border rounded-lg text-xl font-semibold",placeholder:"0.00"}),J>0&&S.jsxs("p",{className:"mt-2 text-green-600 font-semibold",children:["Change: $",J.toFixed(2)]})]}),S.jsx("button",{onClick:ne,disabled:k||O==="cash"&&(!P||J<0),className:"w-full bg-green-600 text-white py-4 rounded-lg font-semibold hover:bg-green-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed text-lg",children:k?"Processing...":`Complete Payment - $${H.toFixed(2)}`})]})})]})}const f8=6048e5,tae=864e5,dE=Symbol.for("constructDateFrom");function Ui(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&dE in e?e[dE](t):e instanceof Date?new e.constructor(t):new Date(t)}function Br(e,t){return Ui(t||e,e)}function nae(e,t,n){const r=Br(e,n==null?void 0:n.in);return isNaN(t)?Ui(e,NaN):(t&&r.setDate(r.getDate()+t),r)}let rae={};function U0(){return rae}function Ec(e,t){var f,h,p,x;const n=U0(),r=(t==null?void 0:t.weekStartsOn)??((h=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,i=Br(e,t==null?void 0:t.in),o=i.getDay(),u=(o=o.getTime()?r+1:n.getTime()>=f.getTime()?r:r-1}function hE(e){const t=Br(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function iae(e,...t){const n=Ui.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function pE(e,t){const n=Br(e,t==null?void 0:t.in);return n.setHours(0,0,0,0),n}function aae(e,t,n){const[r,i]=iae(n==null?void 0:n.in,e,t),o=pE(r),u=pE(i),f=+o-hE(o),h=+u-hE(u);return Math.round((f-h)/tae)}function oae(e,t){const n=d8(e,t),r=Ui(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),_h(r)}function sae(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function lae(e){return!(!sae(e)&&typeof e!="number"||isNaN(+Br(e)))}function uae(e,t){const n=Br(e,t==null?void 0:t.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const cae={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},fae=(e,t,n)=>{let r;const i=cae[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function mp(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const dae={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},hae={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},pae={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},gae={date:mp({formats:dae,defaultWidth:"full"}),time:mp({formats:hae,defaultWidth:"full"}),dateTime:mp({formats:pae,defaultWidth:"full"})},mae={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},yae=(e,t,n,r)=>mae[e];function Jl(e){return(t,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const u=e.defaultFormattingWidth||e.defaultWidth,f=n!=null&&n.width?String(n.width):u;i=e.formattingValues[f]||e.formattingValues[u]}else{const u=e.defaultWidth,f=n!=null&&n.width?String(n.width):e.defaultWidth;i=e.values[f]||e.values[u]}const o=e.argumentCallback?e.argumentCallback(t):t;return i[o]}}const xae={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},vae={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},wae={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},bae={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Aae={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Sae={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},Eae=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},Cae={ordinalNumber:Eae,era:Jl({values:xae,defaultWidth:"wide"}),quarter:Jl({values:vae,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Jl({values:wae,defaultWidth:"wide"}),day:Jl({values:bae,defaultWidth:"wide"}),dayPeriod:Jl({values:Aae,defaultWidth:"wide",formattingValues:Sae,defaultFormattingWidth:"wide"})};function eu(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],o=t.match(i);if(!o)return null;const u=o[0],f=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],h=Array.isArray(f)?_ae(f,m=>m.test(u)):Oae(f,m=>m.test(u));let p;p=e.valueCallback?e.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const x=t.slice(u.length);return{value:p,rest:x}}}function Oae(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function _ae(e,t){for(let n=0;n{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],o=t.match(e.parsePattern);if(!o)return null;let u=e.valueCallback?e.valueCallback(o[0]):o[0];u=n.valueCallback?n.valueCallback(u):u;const f=t.slice(i.length);return{value:u,rest:f}}}const Nae=/^(\d+)(th|st|nd|rd)?/i,Iae=/\d+/i,Pae={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Rae={any:[/^b/i,/^(a|c)/i]},Mae={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},kae={any:[/1/i,/2/i,/3/i,/4/i]},Dae={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},jae={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},Lae={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},Bae={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},Fae={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},$ae={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},Uae={ordinalNumber:Tae({matchPattern:Nae,parsePattern:Iae,valueCallback:e=>parseInt(e,10)}),era:eu({matchPatterns:Pae,defaultMatchWidth:"wide",parsePatterns:Rae,defaultParseWidth:"any"}),quarter:eu({matchPatterns:Mae,defaultMatchWidth:"wide",parsePatterns:kae,defaultParseWidth:"any",valueCallback:e=>e+1}),month:eu({matchPatterns:Dae,defaultMatchWidth:"wide",parsePatterns:jae,defaultParseWidth:"any"}),day:eu({matchPatterns:Lae,defaultMatchWidth:"wide",parsePatterns:Bae,defaultParseWidth:"any"}),dayPeriod:eu({matchPatterns:Fae,defaultMatchWidth:"any",parsePatterns:$ae,defaultParseWidth:"any"})},zae={code:"en-US",formatDistance:fae,formatLong:gae,formatRelative:yae,localize:Cae,match:Uae,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Wae(e,t){const n=Br(e,t==null?void 0:t.in);return aae(n,uae(n))+1}function Hae(e,t){const n=Br(e,t==null?void 0:t.in),r=+_h(n)-+oae(n);return Math.round(r/f8)+1}function h8(e,t){var x,m,w,A;const n=Br(e,t==null?void 0:t.in),r=n.getFullYear(),i=U0(),o=(t==null?void 0:t.firstWeekContainsDate)??((m=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:m.firstWeekContainsDate)??i.firstWeekContainsDate??((A=(w=i.locale)==null?void 0:w.options)==null?void 0:A.firstWeekContainsDate)??1,u=Ui((t==null?void 0:t.in)||e,0);u.setFullYear(r+1,0,o),u.setHours(0,0,0,0);const f=Ec(u,t),h=Ui((t==null?void 0:t.in)||e,0);h.setFullYear(r,0,o),h.setHours(0,0,0,0);const p=Ec(h,t);return+n>=+f?r+1:+n>=+p?r:r-1}function Vae(e,t){var f,h,p,x;const n=U0(),r=(t==null?void 0:t.firstWeekContainsDate)??((h=(f=t==null?void 0:t.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,i=h8(e,t),o=Ui((t==null?void 0:t.in)||e,0);return o.setFullYear(i,0,r),o.setHours(0,0,0,0),Ec(o,t)}function Gae(e,t){const n=Br(e,t==null?void 0:t.in),r=+Ec(n,t)-+Vae(n,t);return Math.round(r/f8)+1}function ft(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const ta={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return ft(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):ft(n+1,2)},d(e,t){return ft(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return ft(e.getHours()%12||12,t.length)},H(e,t){return ft(e.getHours(),t.length)},m(e,t){return ft(e.getMinutes(),t.length)},s(e,t){return ft(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return ft(i,t.length)}},Zo={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},gE={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return ta.y(e,t)},Y:function(e,t,n,r){const i=h8(e,r),o=i>0?i:1-i;if(t==="YY"){const u=o%100;return ft(u,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):ft(o,t.length)},R:function(e,t){const n=d8(e);return ft(n,t.length)},u:function(e,t){const n=e.getFullYear();return ft(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return ft(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return ft(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return ta.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return ft(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=Gae(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):ft(i,t.length)},I:function(e,t,n){const r=Hae(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):ft(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):ta.d(e,t)},D:function(e,t,n){const r=Wae(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):ft(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return ft(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),o=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return ft(o,t.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return ft(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=Zo.noon:r===0?i=Zo.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=Zo.evening:r>=12?i=Zo.afternoon:r>=4?i=Zo.morning:i=Zo.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return ta.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):ta.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):ft(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):ft(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):ta.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):ta.s(e,t)},S:function(e,t){return ta.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return yE(r);case"XXXX":case"XX":return Ya(r);case"XXXXX":case"XXX":default:return Ya(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return yE(r);case"xxxx":case"xx":return Ya(r);case"xxxxx":case"xxx":default:return Ya(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+mE(r,":");case"OOOO":default:return"GMT"+Ya(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+mE(r,":");case"zzzz":default:return"GMT"+Ya(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return ft(r,t.length)},T:function(e,t,n){return ft(+e,t.length)}};function mE(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),o=r%60;return o===0?n+String(i):n+String(i)+t+ft(o,2)}function yE(e,t){return e%60===0?(e>0?"-":"+")+ft(Math.abs(e)/60,2):Ya(e,t)}function Ya(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=ft(Math.trunc(r/60),2),o=ft(r%60,2);return n+i+t+o}const xE=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},p8=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Xae=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return xE(e,t);let o;switch(r){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",xE(r,t)).replace("{{time}}",p8(i,t))},Yae={p:p8,P:Xae},qae=/^D+$/,Kae=/^Y+$/,Zae=["D","DD","YY","YYYY"];function Qae(e){return qae.test(e)}function Jae(e){return Kae.test(e)}function eoe(e,t,n){const r=toe(e,t,n);if(console.warn(r),Zae.includes(e))throw new RangeError(r)}function toe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const noe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,roe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,ioe=/^'([^]*?)'?$/,aoe=/''/g,ooe=/[a-zA-Z]/;function qa(e,t,n){var x,m,w,A;const r=U0(),i=r.locale??zae,o=r.firstWeekContainsDate??((m=(x=r.locale)==null?void 0:x.options)==null?void 0:m.firstWeekContainsDate)??1,u=r.weekStartsOn??((A=(w=r.locale)==null?void 0:w.options)==null?void 0:A.weekStartsOn)??0,f=Br(e,n==null?void 0:n.in);if(!lae(f))throw new RangeError("Invalid time value");let h=t.match(roe).map(_=>{const T=_[0];if(T==="p"||T==="P"){const N=Yae[T];return N(_,i.formatLong)}return _}).join("").match(noe).map(_=>{if(_==="''")return{isToken:!1,value:"'"};const T=_[0];if(T==="'")return{isToken:!1,value:soe(_)};if(gE[T])return{isToken:!0,value:_};if(T.match(ooe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+T+"`");return{isToken:!1,value:_}});i.localize.preprocessor&&(h=i.localize.preprocessor(f,h));const p={firstWeekContainsDate:o,weekStartsOn:u,locale:i};return h.map(_=>{if(!_.isToken)return _.value;const T=_.value;(Jae(T)||Qae(T))&&eoe(T,t,String(e));const N=gE[T[0]];return N(f,T,i.localize,p)}).join("")}function soe(e){const t=e.match(ioe);return t?t[1].replace(aoe,"'"):e}function loe(e,t,n){return nae(e,-t,n)}function uoe(){var E,C,O;const[e,t]=W.useState([]),[n,r]=W.useState(!0),[i,o]=W.useState(""),[u,f]=W.useState(""),[h,p]=W.useState(null),[x,m]=W.useState(1),[w,A]=W.useState(1);W.useEffect(()=>{(async()=>{try{r(!0);const P={page:x,limit:10};u&&(P.status=u),i&&(P.search=i);const I=await mu.getAll(P);t(I.data),A(I.total_pages)}catch(P){console.error("Failed to fetch orders:",P)}finally{r(!1)}})()},[x,u]);const _=async M=>{try{const P=await mu.getById(M.id);p(P)}catch(P){console.error("Failed to fetch order details:",P)}},T=async(M,P)=>{try{await mu.updateStatus(M,P),t(e.map(I=>I.id===M?{...I,status:P}:I)),(h==null?void 0:h.id)===M&&p({...h,status:P})}catch(I){console.error("Failed to update status:",I)}},N={pending:"bg-yellow-100 text-yellow-800",completed:"bg-green-100 text-green-800",cancelled:"bg-red-100 text-red-800",refunded:"bg-gray-100 text-gray-800"};return S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"flex flex-col md:flex-row gap-4",children:[S.jsxs("div",{className:"flex-1 relative",children:[S.jsx(Dc,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:20}),S.jsx("input",{type:"text",placeholder:"Search orders...",value:i,onChange:M=>o(M.target.value),className:"w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsx("div",{className:"flex gap-2",children:S.jsxs("select",{value:u,onChange:M=>f(M.target.value),className:"px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[S.jsx("option",{value:"",children:"All Status"}),S.jsx("option",{value:"pending",children:"Pending"}),S.jsx("option",{value:"completed",children:"Completed"}),S.jsx("option",{value:"cancelled",children:"Cancelled"}),S.jsx("option",{value:"refunded",children:"Refunded"})]})})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:[S.jsx("div",{className:"overflow-x-auto",children:S.jsxs("table",{className:"w-full",children:[S.jsx("thead",{className:"bg-gray-50",children:S.jsxs("tr",{children:[S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Order #"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Date"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Store"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Total"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Payment"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),S.jsx("tbody",{className:"divide-y divide-gray-200",children:n?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center",children:S.jsx("div",{className:"flex justify-center",children:S.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):e.length===0?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500",children:"No orders found"})}):e.map(M=>{var P;return S.jsxs("tr",{className:"hover:bg-gray-50",children:[S.jsx("td",{className:"px-6 py-4 whitespace-nowrap font-medium",children:M.order_number}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:qa(new Date(M.created_at),"MMM dd, yyyy HH:mm")}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:((P=M.store)==null?void 0:P.name)||"-"}),S.jsxs("td",{className:"px-6 py-4 whitespace-nowrap font-semibold",children:["$",M.total.toFixed(2)]}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600 capitalize",children:M.payment_method}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${N[M.status]}`,children:M.status})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsxs("button",{onClick:()=>_(M),className:"text-blue-600 hover:text-blue-800 flex items-center gap-1",children:[S.jsx(MO,{size:16}),"View"]})})]},M.id)})})]})}),w>1&&S.jsxs("div",{className:"px-6 py-4 border-t flex justify-center gap-2",children:[S.jsx("button",{onClick:()=>m(Math.max(1,x-1)),disabled:x===1,className:"px-4 py-2 border rounded-lg disabled:opacity-50",children:"Previous"}),S.jsxs("span",{className:"px-4 py-2",children:["Page ",x," of ",w]}),S.jsx("button",{onClick:()=>m(Math.min(w,x+1)),disabled:x===w,className:"px-4 py-2 border rounded-lg disabled:opacity-50",children:"Next"})]})]}),h&&S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:S.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[S.jsxs("div",{className:"p-6 border-b flex justify-between items-center sticky top-0 bg-white",children:[S.jsxs("div",{children:[S.jsxs("h3",{className:"text-xl font-semibold",children:["Order #",h.order_number]}),S.jsx("p",{className:"text-sm text-gray-500",children:qa(new Date(h.created_at),"MMMM dd, yyyy HH:mm")})]}),S.jsx("button",{onClick:()=>p(null),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:24})})]}),S.jsxs("div",{className:"p-6 space-y-6",children:[S.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Store"}),S.jsx("p",{className:"font-medium",children:(E=h.store)==null?void 0:E.name})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Cashier"}),S.jsx("p",{className:"font-medium",children:(C=h.user)==null?void 0:C.name})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Payment Method"}),S.jsx("p",{className:"font-medium capitalize",children:h.payment_method})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Status"}),S.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${N[h.status]}`,children:h.status})]})]}),S.jsxs("div",{children:[S.jsx("h4",{className:"font-semibold mb-3",children:"Items"}),S.jsx("div",{className:"space-y-2",children:(O=h.items)==null?void 0:O.map(M=>S.jsxs("div",{className:"flex justify-between py-2 border-b",children:[S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:M.product_name}),S.jsxs("p",{className:"text-sm text-gray-500",children:[M.quantity," x $",M.unit_price.toFixed(2)]})]}),S.jsxs("p",{className:"font-semibold",children:["$",M.total_price.toFixed(2)]})]},M.id))})]}),S.jsxs("div",{className:"border-t pt-4 space-y-2",children:[S.jsxs("div",{className:"flex justify-between",children:[S.jsx("span",{className:"text-gray-600",children:"Subtotal"}),S.jsxs("span",{children:["$",h.subtotal.toFixed(2)]})]}),S.jsxs("div",{className:"flex justify-between",children:[S.jsx("span",{className:"text-gray-600",children:"Tax"}),S.jsxs("span",{children:["$",h.tax_amount.toFixed(2)]})]}),h.discount_amount>0&&S.jsxs("div",{className:"flex justify-between",children:[S.jsx("span",{className:"text-gray-600",children:"Discount"}),S.jsxs("span",{className:"text-green-600",children:["-$",h.discount_amount.toFixed(2)]})]}),S.jsxs("div",{className:"flex justify-between text-lg font-bold",children:[S.jsx("span",{children:"Total"}),S.jsxs("span",{children:["$",h.total.toFixed(2)]})]})]}),S.jsxs("div",{className:"flex gap-2 border-t pt-4",children:[h.status==="pending"&&S.jsxs(S.Fragment,{children:[S.jsxs("button",{onClick:()=>T(h.id,"completed"),className:"flex-1 bg-green-600 text-white py-2 rounded-lg flex items-center justify-center gap-2 hover:bg-green-700",children:[S.jsx(GM,{size:18}),"Complete"]}),S.jsxs("button",{onClick:()=>T(h.id,"cancelled"),className:"flex-1 bg-red-600 text-white py-2 rounded-lg flex items-center justify-center gap-2 hover:bg-red-700",children:[S.jsx(XM,{size:18}),"Cancel"]})]}),h.status==="completed"&&S.jsxs("button",{onClick:()=>T(h.id,"refunded"),className:"flex-1 bg-gray-600 text-white py-2 rounded-lg flex items-center justify-center gap-2 hover:bg-gray-700",children:[S.jsx(r5,{size:18}),"Refund"]})]})]})]})})]})}function coe(){const[e,t]=W.useState([]),[n,r]=W.useState([]),[i,o]=W.useState(!0),[u,f]=W.useState(""),[h,p]=W.useState(""),[x,m]=W.useState(!1),[w,A]=W.useState(null),[_,T]=W.useState(!1),[N,E]=W.useState({name:"",sku:"",barcode:"",description:"",price:"",cost_price:"",stock_quantity:"",low_stock_threshold:"",category_id:"",is_active:!0});W.useEffect(()=>{(async()=>{try{o(!0);const[k,B]=await Promise.all([cs.getAll({limit:100}),Qy.getAll()]);t(k.data),r(B)}catch(k){console.error("Failed to fetch data:",k)}finally{o(!1)}})()},[]);const C=e.filter(I=>{const k=I.name.toLowerCase().includes(u.toLowerCase())||I.sku.toLowerCase().includes(u.toLowerCase()),B=h?I.category_id===Number(h):!0;return k&&B}),O=I=>{var k;I?(A(I),E({name:I.name,sku:I.sku,barcode:I.barcode||"",description:I.description||"",price:I.price.toString(),cost_price:((k=I.cost_price)==null?void 0:k.toString())||"",stock_quantity:I.stock_quantity.toString(),low_stock_threshold:I.low_stock_threshold.toString(),category_id:I.category_id.toString(),is_active:I.is_active})):(A(null),E({name:"",sku:"",barcode:"",description:"",price:"",cost_price:"",stock_quantity:"0",low_stock_threshold:"10",category_id:"",is_active:!0})),m(!0)},M=async I=>{I.preventDefault(),T(!0);try{const k={name:N.name,sku:N.sku,barcode:N.barcode||void 0,description:N.description||void 0,price:parseFloat(N.price),cost_price:N.cost_price?parseFloat(N.cost_price):void 0,stock_quantity:parseInt(N.stock_quantity),low_stock_threshold:parseInt(N.low_stock_threshold),category_id:parseInt(N.category_id),is_active:N.is_active};if(w){const B=await cs.update(w.id,k);t(e.map(F=>F.id===w.id?B:F))}else{const B=await cs.create(k);t([...e,B])}m(!1)}catch(k){console.error("Failed to save product:",k),alert("Failed to save product")}finally{T(!1)}},P=async I=>{if(confirm("Are you sure you want to delete this product?"))try{await cs.delete(I),t(e.filter(k=>k.id!==I))}catch(k){console.error("Failed to delete product:",k),alert("Failed to delete product")}};return S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsxs("div",{className:"flex gap-4 flex-1",children:[S.jsxs("div",{className:"flex-1 relative",children:[S.jsx(Dc,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:20}),S.jsx("input",{type:"text",placeholder:"Search products...",value:u,onChange:I=>f(I.target.value),className:"w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("select",{value:h,onChange:I=>p(I.target.value),className:"px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[S.jsx("option",{value:"",children:"All Categories"}),n.map(I=>S.jsx("option",{value:I.id,children:I.name},I.id))]})]}),S.jsxs("button",{onClick:()=>O(),className:"flex items-center gap-2 px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[S.jsx(Jh,{size:20}),"Add Product"]})]}),S.jsx("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:S.jsx("div",{className:"overflow-x-auto",children:S.jsxs("table",{className:"w-full",children:[S.jsx("thead",{className:"bg-gray-50",children:S.jsxs("tr",{children:[S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Product"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"SKU"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Category"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Price"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Stock"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),S.jsx("tbody",{className:"divide-y divide-gray-200",children:i?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center",children:S.jsx("div",{className:"flex justify-center",children:S.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):C.length===0?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500",children:"No products found"})}):C.map(I=>{var k;return S.jsxs("tr",{className:"hover:bg-gray-50",children:[S.jsx("td",{className:"px-6 py-4",children:S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-10 h-10 bg-gray-100 rounded-lg flex items-center justify-center",children:I.image_url?S.jsx("img",{src:I.image_url,alt:I.name,className:"w-full h-full object-cover rounded-lg"}):S.jsx(JM,{className:"text-gray-400",size:20})}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:I.name}),I.description&&S.jsx("p",{className:"text-xs text-gray-500 truncate max-w-xs",children:I.description})]})]})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:I.sku}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:((k=I.category)==null?void 0:k.name)||"-"}),S.jsxs("td",{className:"px-6 py-4 whitespace-nowrap font-semibold",children:["$",I.price.toFixed(2)]}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsx("span",{className:I.stock_quantity<=I.low_stock_threshold?"text-red-600 font-medium":"",children:I.stock_quantity})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsx("span",{className:`px-3 py-1 rounded-full text-xs font-medium ${I.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:I.is_active?"Active":"Inactive"})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>O(I),className:"text-blue-600 hover:text-blue-800",children:S.jsx(DO,{size:18})}),S.jsx("button",{onClick:()=>P(I.id),className:"text-red-600 hover:text-red-800",children:S.jsx(Jy,{size:18})})]})})]},I.id)})})]})})}),x&&S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:S.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-2xl max-h-[90vh] overflow-y-auto",children:[S.jsxs("div",{className:"p-6 border-b flex justify-between items-center sticky top-0 bg-white",children:[S.jsx("h3",{className:"text-xl font-semibold",children:w?"Edit Product":"Add Product"}),S.jsx("button",{onClick:()=>m(!1),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:24})})]}),S.jsxs("form",{onSubmit:M,className:"p-6 space-y-4",children:[S.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Name *"}),S.jsx("input",{type:"text",value:N.name,onChange:I=>E({...N,name:I.target.value}),required:!0,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"SKU *"}),S.jsx("input",{type:"text",value:N.sku,onChange:I=>E({...N,sku:I.target.value}),required:!0,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Barcode"}),S.jsx("input",{type:"text",value:N.barcode,onChange:I=>E({...N,barcode:I.target.value}),className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Category *"}),S.jsxs("select",{value:N.category_id,onChange:I=>E({...N,category_id:I.target.value}),required:!0,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",children:[S.jsx("option",{value:"",children:"Select category"}),n.map(I=>S.jsx("option",{value:I.id,children:I.name},I.id))]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Price *"}),S.jsx("input",{type:"number",step:"0.01",value:N.price,onChange:I=>E({...N,price:I.target.value}),required:!0,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Cost Price"}),S.jsx("input",{type:"number",step:"0.01",value:N.cost_price,onChange:I=>E({...N,cost_price:I.target.value}),className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Stock Quantity"}),S.jsx("input",{type:"number",value:N.stock_quantity,onChange:I=>E({...N,stock_quantity:I.target.value}),className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Low Stock Threshold"}),S.jsx("input",{type:"number",value:N.low_stock_threshold,onChange:I=>E({...N,low_stock_threshold:I.target.value}),className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),S.jsx("textarea",{value:N.description,onChange:I=>E({...N,description:I.target.value}),rows:3,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("input",{type:"checkbox",id:"is_active",checked:N.is_active,onChange:I=>E({...N,is_active:I.target.checked}),className:"rounded"}),S.jsx("label",{htmlFor:"is_active",className:"text-sm text-gray-700",children:"Active"})]}),S.jsxs("div",{className:"flex gap-3 pt-4",children:[S.jsx("button",{type:"button",onClick:()=>m(!1),className:"flex-1 px-4 py-2 border rounded-lg hover:bg-gray-50",children:"Cancel"}),S.jsx("button",{type:"submit",disabled:_,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:_?"Saving...":w?"Update":"Create"})]})]})]})})]})}function foe(){const[e,t]=W.useState([]),[n,r]=W.useState([]),[i,o]=W.useState(!0),[u,f]=W.useState(""),[h,p]=W.useState(!1),[x,m]=W.useState(!1),[w,A]=W.useState(null),[_,T]=W.useState(0),[N,E]=W.useState(""),[C,O]=W.useState(!1);W.useEffect(()=>{(async()=>{try{o(!0);const[F,q]=await Promise.all([pw.getAll({low_stock:h||void 0}),Qy.getAll()]);t(F),r(q)}catch(F){console.error("Failed to fetch data:",F)}finally{o(!1)}})()},[h]);const M=e.filter(B=>{const F=B.name.toLowerCase().includes(u.toLowerCase())||B.sku.toLowerCase().includes(u.toLowerCase()),q=h?B.stock_quantity<=B.low_stock_threshold:!0;return F&&q}),P=B=>{A(B),T(0),E(""),m(!0)},I=async B=>{if(w){O(!0);try{const F=B==="add"?Math.abs(_):-Math.abs(_),q=await pw.adjustStock(w.id,F,N);t(e.map(K=>K.id===w.id?q:K)),m(!1)}catch(F){console.error("Failed to adjust stock:",F),alert("Failed to adjust stock")}finally{O(!1)}}},k=B=>{var F;return((F=n.find(q=>q.id===B))==null?void 0:F.name)||"-"};return S.jsxs("div",{className:"space-y-6",children:[S.jsx("div",{className:"flex justify-between items-center",children:S.jsxs("div",{className:"flex gap-4 flex-1",children:[S.jsxs("div",{className:"flex-1 relative",children:[S.jsx(Dc,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:20}),S.jsx("input",{type:"text",placeholder:"Search products...",value:u,onChange:B=>f(B.target.value),className:"w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("label",{className:"flex items-center gap-2 px-4 py-3 bg-white border rounded-lg cursor-pointer hover:bg-gray-50",children:[S.jsx("input",{type:"checkbox",checked:h,onChange:B=>p(B.target.checked),className:"rounded"}),S.jsx(xg,{size:18,className:"text-yellow-600"}),"Low Stock Only"]})]})}),S.jsx("div",{className:"bg-white rounded-xl shadow-sm overflow-hidden",children:S.jsx("div",{className:"overflow-x-auto",children:S.jsxs("table",{className:"w-full",children:[S.jsx("thead",{className:"bg-gray-50",children:S.jsxs("tr",{children:[S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Product"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"SKU"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Category"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Stock"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Threshold"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Status"}),S.jsx("th",{className:"px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Actions"})]})}),S.jsx("tbody",{className:"divide-y divide-gray-200",children:i?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center",children:S.jsx("div",{className:"flex justify-center",children:S.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"})})})}):M.length===0?S.jsx("tr",{children:S.jsx("td",{colSpan:7,className:"px-6 py-12 text-center text-gray-500",children:"No products found"})}):M.map(B=>{const F=B.stock_quantity<=B.low_stock_threshold;return S.jsxs("tr",{className:"hover:bg-gray-50",children:[S.jsx("td",{className:"px-6 py-4",children:S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-10 h-10 bg-gray-100 rounded-lg flex items-center justify-center",children:S.jsx(Sd,{className:"text-gray-400",size:20})}),S.jsxs("div",{children:[S.jsx("p",{className:"font-medium",children:B.name}),B.barcode&&S.jsx("p",{className:"text-xs text-gray-500",children:B.barcode})]})]})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:B.sku}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:k(B.category_id)}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsx("span",{className:`font-semibold ${F?"text-red-600":""}`,children:B.stock_quantity})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-gray-600",children:B.low_stock_threshold}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:F?S.jsxs("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-red-100 text-red-800 flex items-center gap-1 w-fit",children:[S.jsx(xg,{size:12}),"Low Stock"]}):S.jsx("span",{className:"px-3 py-1 rounded-full text-xs font-medium bg-green-100 text-green-800",children:"In Stock"})}),S.jsx("td",{className:"px-6 py-4 whitespace-nowrap",children:S.jsx("button",{onClick:()=>P(B),className:"text-blue-600 hover:text-blue-800 text-sm font-medium",children:"Adjust Stock"})})]},B.id)})})]})})}),x&&w&&S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:S.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-md",children:[S.jsxs("div",{className:"p-6 border-b flex justify-between items-center",children:[S.jsx("h3",{className:"text-xl font-semibold",children:"Adjust Stock"}),S.jsx("button",{onClick:()=>m(!1),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:24})})]}),S.jsxs("div",{className:"p-6 space-y-4",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-gray-600",children:"Product"}),S.jsx("p",{className:"font-medium text-lg",children:w.name}),S.jsxs("p",{className:"text-sm text-gray-500",children:["Current stock: ",w.stock_quantity]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-2",children:"Adjustment"}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs("button",{onClick:()=>T(Math.abs(_)||1),className:`flex-1 py-3 rounded-lg border flex items-center justify-center gap-2 transition-colors ${_>=0?"bg-green-50 border-green-500 text-green-700":"border-gray-300 hover:bg-gray-50"}`,children:[S.jsx(Jh,{size:18}),"Add"]}),S.jsxs("button",{onClick:()=>T(-Math.abs(_)||-1),className:`flex-1 py-3 rounded-lg border flex items-center justify-center gap-2 transition-colors ${_<0?"bg-red-50 border-red-500 text-red-700":"border-gray-300 hover:bg-gray-50"}`,children:[S.jsx(kO,{size:18}),"Remove"]})]}),S.jsx("input",{type:"number",value:Math.abs(_),onChange:B=>{const F=parseInt(B.target.value)||0;T(_>=0?F:-F)},className:"w-full mt-2 px-4 py-3 border rounded-lg text-center text-lg",placeholder:"0"}),_!==0&&S.jsxs("p",{className:`mt-2 text-center font-medium ${_>0?"text-green-600":"text-red-600"}`,children:["New stock: ",w.stock_quantity+_]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Reason"}),S.jsx("input",{type:"text",value:N,onChange:B=>E(B.target.value),placeholder:"e.g., Restock, Damaged, Sold",className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]}),S.jsxs("div",{className:"flex gap-3 pt-4",children:[S.jsx("button",{onClick:()=>m(!1),className:"flex-1 px-4 py-2 border rounded-lg hover:bg-gray-50",children:"Cancel"}),S.jsx("button",{onClick:()=>I(_>=0?"add":"remove"),disabled:C||_===0,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:C?"Adjusting...":"Apply"})]})]})]})})]})}var Oe;(function(e){e[e.QR_CODE=0]="QR_CODE",e[e.AZTEC=1]="AZTEC",e[e.CODABAR=2]="CODABAR",e[e.CODE_39=3]="CODE_39",e[e.CODE_93=4]="CODE_93",e[e.CODE_128=5]="CODE_128",e[e.DATA_MATRIX=6]="DATA_MATRIX",e[e.MAXICODE=7]="MAXICODE",e[e.ITF=8]="ITF",e[e.EAN_13=9]="EAN_13",e[e.EAN_8=10]="EAN_8",e[e.PDF_417=11]="PDF_417",e[e.RSS_14=12]="RSS_14",e[e.RSS_EXPANDED=13]="RSS_EXPANDED",e[e.UPC_A=14]="UPC_A",e[e.UPC_E=15]="UPC_E",e[e.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Oe||(Oe={}));var vE=new Map([[Oe.QR_CODE,"QR_CODE"],[Oe.AZTEC,"AZTEC"],[Oe.CODABAR,"CODABAR"],[Oe.CODE_39,"CODE_39"],[Oe.CODE_93,"CODE_93"],[Oe.CODE_128,"CODE_128"],[Oe.DATA_MATRIX,"DATA_MATRIX"],[Oe.MAXICODE,"MAXICODE"],[Oe.ITF,"ITF"],[Oe.EAN_13,"EAN_13"],[Oe.EAN_8,"EAN_8"],[Oe.PDF_417,"PDF_417"],[Oe.RSS_14,"RSS_14"],[Oe.RSS_EXPANDED,"RSS_EXPANDED"],[Oe.UPC_A,"UPC_A"],[Oe.UPC_E,"UPC_E"],[Oe.UPC_EAN_EXTENSION,"UPC_EAN_EXTENSION"]]),wE;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.URL=1]="URL"})(wE||(wE={}));function doe(e){return Object.values(Oe).includes(e)}var Th;(function(e){e[e.SCAN_TYPE_CAMERA=0]="SCAN_TYPE_CAMERA",e[e.SCAN_TYPE_FILE=1]="SCAN_TYPE_FILE"})(Th||(Th={}));var hoe=function(){function e(){}return e.GITHUB_PROJECT_URL="https://github.com/mebjas/html5-qrcode",e.SCAN_DEFAULT_FPS=2,e.DEFAULT_DISABLE_FLIP=!1,e.DEFAULT_REMEMBER_LAST_CAMERA_USED=!0,e.DEFAULT_SUPPORTED_SCAN_TYPE=[Th.SCAN_TYPE_CAMERA,Th.SCAN_TYPE_FILE],e}(),g8=function(){function e(t,n){this.format=t,this.formatName=n}return e.prototype.toString=function(){return this.formatName},e.create=function(t){if(!vE.has(t))throw"".concat(t," not in html5QrcodeSupportedFormatsTextMap");return new e(t,vE.get(t))},e}(),bE=function(){function e(){}return e.createFromText=function(t){var n={text:t};return{decodedText:t,result:n}},e.createFromQrcodeResult=function(t){return{decodedText:t.text,result:t}},e}(),Vm;(function(e){e[e.UNKWOWN_ERROR=0]="UNKWOWN_ERROR",e[e.IMPLEMENTATION_ERROR=1]="IMPLEMENTATION_ERROR",e[e.NO_CODE_FOUND_ERROR=2]="NO_CODE_FOUND_ERROR"})(Vm||(Vm={}));var poe=function(){function e(){}return e.createFrom=function(t){return{errorMessage:t,type:Vm.UNKWOWN_ERROR}},e}(),goe=function(){function e(t){this.verbose=t}return e.prototype.log=function(t){this.verbose&&console.log(t)},e.prototype.warn=function(t){this.verbose&&console.warn(t)},e.prototype.logError=function(t,n){(this.verbose||n===!0)&&console.error(t)},e.prototype.logErrors=function(t){if(t.length===0)throw"Logger#logError called without arguments";this.verbose&&console.error(t)},e}();function wi(e){return typeof e>"u"||e===null}var ps=function(){function e(){}return e.codeParseError=function(t){return"QR code parse error, error = ".concat(t)},e.errorGettingUserMedia=function(t){return"Error getting userMedia, error = ".concat(t)},e.onlyDeviceSupportedError=function(){return"The device doesn't support navigator.mediaDevices , only supported cameraIdOrConfig in this case is deviceId parameter (string)."},e.cameraStreamingNotSupported=function(){return"Camera streaming not supported by the browser."},e.unableToQuerySupportedDevices=function(){return"Unable to query supported devices, unknown error."},e.insecureContextCameraQueryError=function(){return"Camera access is only supported in secure context like https or localhost."},e.scannerPaused=function(){return"Scanner paused"},e}(),m8=function(){function e(){}return e.isMediaStreamConstraintsValid=function(t,n){if(typeof t!="object"){var r=typeof t;return n.logError("videoConstraints should be of type object, the "+"object passed is of type ".concat(r,"."),!0),!1}for(var i=["autoGainControl","channelCount","echoCancellation","latency","noiseSuppression","sampleRate","sampleSize","volume"],o=new Set(i),u=Object.keys(t),f=0,h=u;fl)throw new m("fromIndex("+s+") > toIndex("+l+")");if(s<0)throw new E(s);if(l>a)throw new E(l)}static asList(...a){return a}static create(a,s,l){return Array.from({length:a}).map(d=>Array.from({length:s}).fill(l))}static createInt32Array(a,s,l){return Array.from({length:a}).map(d=>Int32Array.from({length:s}).fill(l))}static equals(a,s){if(!a||!s||!a.length||!s.length||a.length!==s.length)return!1;for(let l=0,c=a.length;l>1,y=l(s,a[g]);if(y>0)c=g+1;else if(y<0)d=g-1;else return g}return-c-1}static numberComparator(a,s){return a-s}}class O{static numberOfTrailingZeros(a){let s;if(a===0)return 32;let l=31;return s=a<<16,s!==0&&(l-=16,a=s),s=a<<8,s!==0&&(l-=8,a=s),s=a<<4,s!==0&&(l-=4,a=s),s=a<<2,s!==0&&(l-=2,a=s),l-(a<<1>>>31)}static numberOfLeadingZeros(a){if(a===0)return 32;let s=1;return a>>>16||(s+=16,a<<=16),a>>>24||(s+=8,a<<=8),a>>>28||(s+=4,a<<=4),a>>>30||(s+=2,a<<=2),s-=a>>>31,s}static toHexString(a){return a.toString(16)}static toBinaryString(a){return String(parseInt(String(a),2))}static bitCount(a){return a=a-(a>>>1&1431655765),a=(a&858993459)+(a>>>2&858993459),a=a+(a>>>4)&252645135,a=a+(a>>>8),a=a+(a>>>16),a&63}static truncDivision(a,s){return Math.trunc(a/s)}static parseInt(a,s=void 0){return parseInt(a,s)}}O.MIN_VALUE_32_BITS=-2147483648,O.MAX_VALUE=Number.MAX_SAFE_INTEGER;class M{constructor(a,s){a===void 0?(this.size=0,this.bits=new Int32Array(1)):(this.size=a,s==null?this.bits=M.makeArray(a):this.bits=s)}getSize(){return this.size}getSizeInBytes(){return Math.floor((this.size+7)/8)}ensureCapacity(a){if(a>this.bits.length*32){const s=M.makeArray(a);T.arraycopy(this.bits,0,s,0,this.bits.length),this.bits=s}}get(a){return(this.bits[Math.floor(a/32)]&1<<(a&31))!==0}set(a){this.bits[Math.floor(a/32)]|=1<<(a&31)}flip(a){this.bits[Math.floor(a/32)]^=1<<(a&31)}getNextSet(a){const s=this.size;if(a>=s)return s;const l=this.bits;let c=Math.floor(a/32),d=l[c];d&=~((1<<(a&31))-1);const g=l.length;for(;d===0;){if(++c===g)return s;d=l[c]}const y=c*32+O.numberOfTrailingZeros(d);return y>s?s:y}getNextUnset(a){const s=this.size;if(a>=s)return s;const l=this.bits;let c=Math.floor(a/32),d=~l[c];d&=~((1<<(a&31))-1);const g=l.length;for(;d===0;){if(++c===g)return s;d=~l[c]}const y=c*32+O.numberOfTrailingZeros(d);return y>s?s:y}setBulk(a,s){this.bits[Math.floor(a/32)]=s}setRange(a,s){if(sthis.size)throw new m;if(s===a)return;s--;const l=Math.floor(a/32),c=Math.floor(s/32),d=this.bits;for(let g=l;g<=c;g++){const y=g>l?0:a&31,b=(2<<(gthis.size)throw new m;if(s===a)return!0;s--;const c=Math.floor(a/32),d=Math.floor(s/32),g=this.bits;for(let y=c;y<=d;y++){const v=y>c?0:a&31,R=(2<<(y32)throw new m("Num bits must be between 0 and 32");this.ensureCapacity(this.size+s);for(let l=s;l>0;l--)this.appendBit((a>>l-1&1)===1)}appendBitArray(a){const s=a.size;this.ensureCapacity(this.size+s);for(let l=0;l>1&1431655765|(g&1431655765)<<1,g=g>>2&858993459|(g&858993459)<<2,g=g>>4&252645135|(g&252645135)<<4,g=g>>8&16711935|(g&16711935)<<8,g=g>>16&65535|(g&65535)<<16,a[s-d]=g}if(this.size!==l*32){const d=l*32-this.size;let g=a[0]>>>d;for(let y=1;y>>d}a[l-1]=g}this.bits=a}static makeArray(a){return new Int32Array(Math.floor((a+31)/32))}equals(a){if(!(a instanceof M))return!1;const s=a;return this.size===s.size&&C.equals(this.bits,s.bits)}hashCode(){return 31*this.size+C.hashCode(this.bits)}toString(){let a="";for(let s=0,l=this.size;s=900)throw new k("incorect value");const s=F.VALUES_TO_ECI.get(a);if(s===void 0)throw new k("incorect value");return s}static getCharacterSetECIByName(a){const s=F.NAME_TO_ECI.get(a);if(s===void 0)throw new k("incorect value");return s}equals(a){if(!(a instanceof F))return!1;const s=a;return this.getName()===s.getName()}}F.VALUE_IDENTIFIER_TO_ECI=new Map,F.VALUES_TO_ECI=new Map,F.NAME_TO_ECI=new Map,F.Cp437=new F(B.Cp437,Int32Array.from([0,2]),"Cp437"),F.ISO8859_1=new F(B.ISO8859_1,Int32Array.from([1,3]),"ISO-8859-1","ISO88591","ISO8859_1"),F.ISO8859_2=new F(B.ISO8859_2,4,"ISO-8859-2","ISO88592","ISO8859_2"),F.ISO8859_3=new F(B.ISO8859_3,5,"ISO-8859-3","ISO88593","ISO8859_3"),F.ISO8859_4=new F(B.ISO8859_4,6,"ISO-8859-4","ISO88594","ISO8859_4"),F.ISO8859_5=new F(B.ISO8859_5,7,"ISO-8859-5","ISO88595","ISO8859_5"),F.ISO8859_6=new F(B.ISO8859_6,8,"ISO-8859-6","ISO88596","ISO8859_6"),F.ISO8859_7=new F(B.ISO8859_7,9,"ISO-8859-7","ISO88597","ISO8859_7"),F.ISO8859_8=new F(B.ISO8859_8,10,"ISO-8859-8","ISO88598","ISO8859_8"),F.ISO8859_9=new F(B.ISO8859_9,11,"ISO-8859-9","ISO88599","ISO8859_9"),F.ISO8859_10=new F(B.ISO8859_10,12,"ISO-8859-10","ISO885910","ISO8859_10"),F.ISO8859_11=new F(B.ISO8859_11,13,"ISO-8859-11","ISO885911","ISO8859_11"),F.ISO8859_13=new F(B.ISO8859_13,15,"ISO-8859-13","ISO885913","ISO8859_13"),F.ISO8859_14=new F(B.ISO8859_14,16,"ISO-8859-14","ISO885914","ISO8859_14"),F.ISO8859_15=new F(B.ISO8859_15,17,"ISO-8859-15","ISO885915","ISO8859_15"),F.ISO8859_16=new F(B.ISO8859_16,18,"ISO-8859-16","ISO885916","ISO8859_16"),F.SJIS=new F(B.SJIS,20,"SJIS","Shift_JIS"),F.Cp1250=new F(B.Cp1250,21,"Cp1250","windows-1250"),F.Cp1251=new F(B.Cp1251,22,"Cp1251","windows-1251"),F.Cp1252=new F(B.Cp1252,23,"Cp1252","windows-1252"),F.Cp1256=new F(B.Cp1256,24,"Cp1256","windows-1256"),F.UnicodeBigUnmarked=new F(B.UnicodeBigUnmarked,25,"UnicodeBigUnmarked","UTF-16BE","UnicodeBig"),F.UTF8=new F(B.UTF8,26,"UTF8","UTF-8"),F.ASCII=new F(B.ASCII,Int32Array.from([27,170]),"ASCII","US-ASCII"),F.Big5=new F(B.Big5,28,"Big5"),F.GB18030=new F(B.GB18030,29,"GB18030","GB2312","EUC_CN","GBK"),F.EUC_KR=new F(B.EUC_KR,30,"EUC_KR","EUC-KR");class q extends p{}q.kind="UnsupportedOperationException";class K{static decode(a,s){const l=this.encodingName(s);return this.customDecoder?this.customDecoder(a,l):typeof TextDecoder>"u"||this.shouldDecodeOnFallback(l)?this.decodeFallback(a,l):new TextDecoder(l).decode(a)}static shouldDecodeOnFallback(a){return!K.isBrowser()&&a==="ISO-8859-1"}static encode(a,s){const l=this.encodingName(s);return this.customEncoder?this.customEncoder(a,l):typeof TextEncoder>"u"?this.encodeFallback(a):new TextEncoder().encode(a)}static isBrowser(){return typeof window<"u"&&{}.toString.call(window)==="[object Window]"}static encodingName(a){return typeof a=="string"?a:a.getName()}static encodingCharacterSet(a){return a instanceof F?a:F.getCharacterSetECIByName(a)}static decodeFallback(a,s){const l=this.encodingCharacterSet(s);if(K.isDecodeFallbackSupported(l)){let c="";for(let d=0,g=a.length;d3&&a[0]===239&&a[1]===187&&a[2]===191;for(let ge=0;ge0?de&128?y--:g=!1:de&128&&(de&64?(y++,de&32?(y++,de&16?(y++,de&8?g=!1:R++):b++):v++):g=!1)),c&&(de>127&&de<160?c=!1:de>159&&(de<192||de===215||de===247)&&ae++),d&&(j>0?de<64||de===127||de>252?d=!1:j--:de===128||de===160||de>239?d=!1:de>160&&de<224?(L++,V=0,z++,z>G&&(G=z)):de>127?(j++,z=0,V++,V>Z&&(Z=V)):(z=0,V=0))}return g&&y>0&&(g=!1),d&&j>0&&(d=!1),g&&(pe||v+b+R>0)?H.UTF8:d&&(H.ASSUME_SHIFT_JIS||G>=3||Z>=3)?H.SHIFT_JIS:c&&d?G===2&&L===2||ae*10>=l?H.SHIFT_JIS:H.ISO88591:c?H.ISO88591:d?H.SHIFT_JIS:g?H.UTF8:H.PLATFORM_DEFAULT_ENCODING}static format(a,...s){let l=-1;function c(g,y,v,b,R,j){if(g==="%%")return"%";if(s[++l]===void 0)return;g=b?parseInt(b.substr(1)):void 0;let L=R?parseInt(R.substr(1)):void 0,z;switch(j){case"s":z=s[l];break;case"c":z=s[l][0];break;case"f":z=parseFloat(s[l]).toFixed(g);break;case"p":z=parseFloat(s[l]).toPrecision(g);break;case"e":z=parseFloat(s[l]).toExponential(g);break;case"x":z=parseInt(s[l]).toString(L||16);break;case"d":z=parseFloat(parseInt(s[l],L||10).toPrecision(g)).toFixed(0);break}z=typeof z=="object"?JSON.stringify(z):(+z).toString(L);let V=parseInt(v),G=v&&v[0]+""=="0"?"0":" ";for(;z.lengthg){if(y===-1)y=d-g;else if(d-g!==y)throw new m("row lengths do not match");g=d,v++}b++}else if(a.substring(b,b+s.length)===s)b+=s.length,c[d]=!0,d++;else if(a.substring(b,b+l.length)===l)b+=l.length,c[d]=!1,d++;else throw new m("illegal character encountered: "+a.substring(b));if(d>g){if(y===-1)y=d-g;else if(d-g!==y)throw new m("row lengths do not match");v++}const R=new J(y,v);for(let j=0;j>>(a&31)&1)!==0}set(a,s){const l=s*this.rowSize+Math.floor(a/32);this.bits[l]|=1<<(a&31)&4294967295}unset(a,s){const l=s*this.rowSize+Math.floor(a/32);this.bits[l]&=~(1<<(a&31)&4294967295)}flip(a,s){const l=s*this.rowSize+Math.floor(a/32);this.bits[l]^=1<<(a&31)&4294967295}xor(a){if(this.width!==a.getWidth()||this.height!==a.getHeight()||this.rowSize!==a.getRowSize())throw new m("input matrix dimensions do not match");const s=new M(Math.floor(this.width/32)+1),l=this.rowSize,c=this.bits;for(let d=0,g=this.height;dthis.height||d>this.width)throw new m("The region must fit inside the matrix");const y=this.rowSize,v=this.bits;for(let b=s;bv&&(v=b),R*32y){let L=31;for(;!(j>>>L);)L--;R*32+L>y&&(y=R*32+L)}}}return y=0&&s[l]===0;)l--;if(l<0)return null;const c=Math.floor(l/a);let d=Math.floor(l%a)*32;const g=s[l];let y=31;for(;!(g>>>y);)y--;return d+=y,Int32Array.from([d,c])}getWidth(){return this.width}getHeight(){return this.height}getRowSize(){return this.rowSize}equals(a){if(!(a instanceof J))return!1;const s=a;return this.width===s.width&&this.height===s.height&&this.rowSize===s.rowSize&&C.equals(this.bits,s.bits)}hashCode(){let a=this.width;return a=31*a+this.width,a=31*a+this.height,a=31*a+this.rowSize,a=31*a+C.hashCode(this.bits),a}toString(a="X ",s=" ",l=` `){return this.buildToString(a,s,l)}buildToString(a,s,l){let c=new ne;for(let d=0,g=this.height;d>re.LUMINANCE_SHIFT]++;const y=re.estimateBlackPoint(g);if(c<3)for(let v=0;v>re.LUMINANCE_SHIFT]++}}const g=re.estimateBlackPoint(d),y=a.getMatrix();for(let v=0;vd&&(c=R,d=a[R]),a[R]>l&&(l=a[R]);let g=0,y=0;for(let R=0;Ry&&(g=R,y=L)}if(c>g){const R=c;c=g,g=R}if(g-c<=s/16)throw new $;let v=g-1,b=-1;for(let R=g-1;R>c;R--){const j=R-c,L=j*j*(g-R)*(l-a[R]);L>b&&(v=R,b=L)}return v<=te.MINIMUM_DIMENSION&&l>=te.MINIMUM_DIMENSION){const c=a.getMatrix();let d=s>>te.BLOCK_SIZE_POWER;s&te.BLOCK_SIZE_MASK&&d++;let g=l>>te.BLOCK_SIZE_POWER;l&te.BLOCK_SIZE_MASK&&g++;const y=te.calculateBlackPoints(c,d,g,s,l),v=new J(s,l);te.calculateThresholdForBlock(c,d,g,s,l,y,v),this.matrix=v}else this.matrix=super.getBlackMatrix();return this.matrix}createBinarizer(a){return new te(a)}static calculateThresholdForBlock(a,s,l,c,d,g,y){const v=d-te.BLOCK_SIZE,b=c-te.BLOCK_SIZE;for(let R=0;Rv&&(j=v);const L=te.cap(R,2,l-3);for(let z=0;zb&&(V=b);const G=te.cap(z,2,s-3);let Z=0;for(let pe=-2;pe<=2;pe++){const ge=g[L+pe];Z+=ge[G-2]+ge[G-1]+ge[G]+ge[G+1]+ge[G+2]}const ae=Z/25;te.thresholdBlock(a,V,j,ae,c,y)}}}static cap(a,s,l){return al?l:a}static thresholdBlock(a,s,l,c,d,g){for(let y=0,v=l*d+s;yg&&(R=g);for(let j=0;jy&&(L=y);let z=0,V=255,G=0;for(let ae=0,pe=R*c+L;aeG&&(G=de)}if(G-V>te.MIN_DYNAMIC_RANGE)for(ae++,pe+=c;ae>te.BLOCK_SIZE_POWER*2;if(G-V<=te.MIN_DYNAMIC_RANGE&&(Z=V/2,b>0&&j>0)){const ae=(v[b-1][j]+2*v[b][j-1]+v[b-1][j-1])/4;V>10}c[g]=v}return c}getRow(a,s){if(a<0||a>=this.getHeight())throw new m("Requested row is outside the image: "+a);const l=this.getWidth(),c=a*l;return s===null?s=this.buffer.slice(c,c+l):(s.lengthnew me(s.deviceId,s.label))})}findDeviceById(a){return le(this,void 0,void 0,function*(){const s=yield this.listVideoInputDevices();return s?s.find(l=>l.deviceId===a):null})}decodeFromInputVideoDevice(a,s){return le(this,void 0,void 0,function*(){return yield this.decodeOnceFromVideoDevice(a,s)})}decodeOnceFromVideoDevice(a,s){return le(this,void 0,void 0,function*(){this.reset();let l;a?l={deviceId:{exact:a}}:l={facingMode:"environment"};const c={video:l};return yield this.decodeOnceFromConstraints(c,s)})}decodeOnceFromConstraints(a,s){return le(this,void 0,void 0,function*(){const l=yield navigator.mediaDevices.getUserMedia(a);return yield this.decodeOnceFromStream(l,s)})}decodeOnceFromStream(a,s){return le(this,void 0,void 0,function*(){this.reset();const l=yield this.attachStreamToVideo(a,s);return yield this.decodeOnce(l)})}decodeFromInputVideoDeviceContinuously(a,s,l){return le(this,void 0,void 0,function*(){return yield this.decodeFromVideoDevice(a,s,l)})}decodeFromVideoDevice(a,s,l){return le(this,void 0,void 0,function*(){let c;a?c={deviceId:{exact:a}}:c={facingMode:"environment"};const d={video:c};return yield this.decodeFromConstraints(d,s,l)})}decodeFromConstraints(a,s,l){return le(this,void 0,void 0,function*(){const c=yield navigator.mediaDevices.getUserMedia(a);return yield this.decodeFromStream(c,s,l)})}decodeFromStream(a,s,l){return le(this,void 0,void 0,function*(){this.reset();const c=yield this.attachStreamToVideo(a,s);return yield this.decodeContinuously(c,l)})}stopAsyncDecode(){this._stopAsyncDecode=!0}stopContinuousDecode(){this._stopContinuousDecode=!0}attachStreamToVideo(a,s){return le(this,void 0,void 0,function*(){const l=this.prepareVideoElement(s);return this.addVideoSource(l,a),this.videoElement=l,this.stream=a,yield this.playVideoOnLoadAsync(l),l})}playVideoOnLoadAsync(a){return new Promise((s,l)=>this.playVideoOnLoad(a,()=>s()))}playVideoOnLoad(a,s){this.videoEndedListener=()=>this.stopStreams(),this.videoCanPlayListener=()=>this.tryPlayVideo(a),a.addEventListener("ended",this.videoEndedListener),a.addEventListener("canplay",this.videoCanPlayListener),a.addEventListener("playing",s),this.tryPlayVideo(a)}isVideoPlaying(a){return a.currentTime>0&&!a.paused&&!a.ended&&a.readyState>2}tryPlayVideo(a){return le(this,void 0,void 0,function*(){if(this.isVideoPlaying(a)){console.warn("Trying to play video that is already playing.");return}try{yield a.play()}catch{console.warn("It was not possible to play the video.")}})}getMediaElement(a,s){const l=document.getElementById(a);if(!l)throw new x(`element with id '${a}' not found`);if(l.nodeName.toLowerCase()!==s.toLowerCase())throw new x(`element with id '${a}' must be an ${s} element`);return l}decodeFromImage(a,s){if(!a&&!s)throw new x("either imageElement with a src set or an url must be provided");return s&&!a?this.decodeFromImageUrl(s):this.decodeFromImageElement(a)}decodeFromVideo(a,s){if(!a&&!s)throw new x("Either an element with a src set or an URL must be provided");return s&&!a?this.decodeFromVideoUrl(s):this.decodeFromVideoElement(a)}decodeFromVideoContinuously(a,s,l){if(a===void 0&&s===void 0)throw new x("Either an element with a src set or an URL must be provided");return s&&!a?this.decodeFromVideoUrlContinuously(s,l):this.decodeFromVideoElementContinuously(a,l)}decodeFromImageElement(a){if(!a)throw new x("An image element must be provided.");this.reset();const s=this.prepareImageElement(a);this.imageElement=s;let l;return this.isImageLoaded(s)?l=this.decodeOnce(s,!1,!0):l=this._decodeOnLoadImage(s),l}decodeFromVideoElement(a){const s=this._decodeFromVideoElementSetup(a);return this._decodeOnLoadVideo(s)}decodeFromVideoElementContinuously(a,s){const l=this._decodeFromVideoElementSetup(a);return this._decodeOnLoadVideoContinuously(l,s)}_decodeFromVideoElementSetup(a){if(!a)throw new x("A video element must be provided.");this.reset();const s=this.prepareVideoElement(a);return this.videoElement=s,s}decodeFromImageUrl(a){if(!a)throw new x("An URL must be provided.");this.reset();const s=this.prepareImageElement();this.imageElement=s;const l=this._decodeOnLoadImage(s);return s.src=a,l}decodeFromVideoUrl(a){if(!a)throw new x("An URL must be provided.");this.reset();const s=this.prepareVideoElement(),l=this.decodeFromVideoElement(s);return s.src=a,l}decodeFromVideoUrlContinuously(a,s){if(!a)throw new x("An URL must be provided.");this.reset();const l=this.prepareVideoElement(),c=this.decodeFromVideoElementContinuously(l,s);return l.src=a,c}_decodeOnLoadImage(a){return new Promise((s,l)=>{this.imageLoadedListener=()=>this.decodeOnce(a,!1,!0).then(s,l),a.addEventListener("load",this.imageLoadedListener)})}_decodeOnLoadVideo(a){return le(this,void 0,void 0,function*(){return yield this.playVideoOnLoadAsync(a),yield this.decodeOnce(a)})}_decodeOnLoadVideoContinuously(a,s){return le(this,void 0,void 0,function*(){yield this.playVideoOnLoadAsync(a),this.decodeContinuously(a,s)})}isImageLoaded(a){return!(!a.complete||a.naturalWidth===0)}prepareImageElement(a){let s;return typeof a>"u"&&(s=document.createElement("img"),s.width=200,s.height=200),typeof a=="string"&&(s=this.getMediaElement(a,"img")),a instanceof HTMLImageElement&&(s=a),s}prepareVideoElement(a){let s;return!a&&typeof document<"u"&&(s=document.createElement("video"),s.width=200,s.height=200),typeof a=="string"&&(s=this.getMediaElement(a,"video")),a instanceof HTMLVideoElement&&(s=a),s.setAttribute("autoplay","true"),s.setAttribute("muted","true"),s.setAttribute("playsinline","true"),s}decodeOnce(a,s=!0,l=!0){this._stopAsyncDecode=!1;const c=(d,g)=>{if(this._stopAsyncDecode){g(new $("Video stream has ended before any code could be detected.")),this._stopAsyncDecode=void 0;return}try{const y=this.decode(a);d(y)}catch(y){const v=s&&y instanceof $,R=(y instanceof A||y instanceof k)&&l;if(v||R)return setTimeout(c,this._timeBetweenDecodingAttempts,d,g);g(y)}};return new Promise((d,g)=>c(d,g))}decodeContinuously(a,s){this._stopContinuousDecode=!1;const l=()=>{if(this._stopContinuousDecode){this._stopContinuousDecode=void 0;return}try{const c=this.decode(a);s(c,null),setTimeout(l,this.timeBetweenScansMillis)}catch(c){s(null,c);const d=c instanceof A||c instanceof k,g=c instanceof $;(d||g)&&setTimeout(l,this._timeBetweenDecodingAttempts)}};l()}decode(a){const s=this.createBinaryBitmap(a);return this.decodeBitmap(s)}_isHTMLVideoElement(a){return a.videoWidth!==0}drawFrameOnCanvas(a,s,l){s||(s={sx:0,sy:0,sWidth:a.videoWidth,sHeight:a.videoHeight,dx:0,dy:0,dWidth:a.videoWidth,dHeight:a.videoHeight}),l||(l=this.captureCanvasContext),l.drawImage(a,s.sx,s.sy,s.sWidth,s.sHeight,s.dx,s.dy,s.dWidth,s.dHeight)}drawImageOnCanvas(a,s,l=this.captureCanvasContext){s||(s={sx:0,sy:0,sWidth:a.naturalWidth,sHeight:a.naturalHeight,dx:0,dy:0,dWidth:a.naturalWidth,dHeight:a.naturalHeight}),l||(l=this.captureCanvasContext),l.drawImage(a,s.sx,s.sy,s.sWidth,s.sHeight,s.dx,s.dy,s.dWidth,s.dHeight)}createBinaryBitmap(a){this.getCaptureCanvasContext(a),this._isHTMLVideoElement(a)?this.drawFrameOnCanvas(a):this.drawImageOnCanvas(a);const s=this.getCaptureCanvas(a),l=new ue(s),c=new te(l);return new w(c)}getCaptureCanvasContext(a){if(!this.captureCanvasContext){const l=this.getCaptureCanvas(a).getContext("2d");this.captureCanvasContext=l}return this.captureCanvasContext}getCaptureCanvas(a){if(!this.captureCanvas){const s=this.createCaptureCanvas(a);this.captureCanvas=s}return this.captureCanvas}decodeBitmap(a){return this.reader.decode(a,this._hints)}createCaptureCanvas(a){if(typeof document>"u")return this._destroyCaptureCanvas(),null;const s=document.createElement("canvas");let l,c;return typeof a<"u"&&(a instanceof HTMLVideoElement?(l=a.videoWidth,c=a.videoHeight):a instanceof HTMLImageElement&&(l=a.naturalWidth||a.width,c=a.naturalHeight||a.height)),s.style.width=l+"px",s.style.height=c+"px",s.width=l,s.height=c,s}stopStreams(){this.stream&&(this.stream.getVideoTracks().forEach(a=>a.stop()),this.stream=void 0),this._stopAsyncDecode===!1&&this.stopAsyncDecode(),this._stopContinuousDecode===!1&&this.stopContinuousDecode()}reset(){this.stopStreams(),this._destroyVideoElement(),this._destroyImageElement(),this._destroyCaptureCanvas()}_destroyVideoElement(){this.videoElement&&(typeof this.videoEndedListener<"u"&&this.videoElement.removeEventListener("ended",this.videoEndedListener),typeof this.videoPlayingEventListener<"u"&&this.videoElement.removeEventListener("playing",this.videoPlayingEventListener),typeof this.videoCanPlayListener<"u"&&this.videoElement.removeEventListener("loadedmetadata",this.videoCanPlayListener),this.cleanVideoSource(this.videoElement),this.videoElement=void 0)}_destroyImageElement(){this.imageElement&&(this.imageLoadedListener!==void 0&&this.imageElement.removeEventListener("load",this.imageLoadedListener),this.imageElement.src=void 0,this.imageElement.removeAttribute("src"),this.imageElement=void 0)}_destroyCaptureCanvas(){this.captureCanvasContext=void 0,this.captureCanvas=void 0}addVideoSource(a,s){try{a.srcObject=s}catch{a.src=URL.createObjectURL(s)}}cleanVideoSource(a){try{a.srcObject=null}catch{a.src=""}this.videoElement.removeAttribute("src")}}class Pe{constructor(a,s,l=s==null?0:8*s.length,c,d,g=T.currentTimeMillis()){this.text=a,this.rawBytes=s,this.numBits=l,this.resultPoints=c,this.format=d,this.timestamp=g,this.text=a,this.rawBytes=s,l==null?this.numBits=s==null?0:8*s.length:this.numBits=l,this.resultPoints=c,this.format=d,this.resultMetadata=null,g==null?this.timestamp=T.currentTimeMillis():this.timestamp=g}getText(){return this.text}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}getResultPoints(){return this.resultPoints}getBarcodeFormat(){return this.format}getResultMetadata(){return this.resultMetadata}putMetadata(a,s){this.resultMetadata===null&&(this.resultMetadata=new Map),this.resultMetadata.set(a,s)}putAllMetadata(a){a!==null&&(this.resultMetadata===null?this.resultMetadata=a:this.resultMetadata=new Map(a))}addResultPoints(a){const s=this.resultPoints;if(s===null)this.resultPoints=a;else if(a!==null&&a.length>0){const l=new Array(s.length+a.length);T.arraycopy(s,0,l,0,s.length),T.arraycopy(a,0,l,s.length,a.length),this.resultPoints=l}}getTimestamp(){return this.timestamp}toString(){return this.text}}var Je;(function(D){D[D.AZTEC=0]="AZTEC",D[D.CODABAR=1]="CODABAR",D[D.CODE_39=2]="CODE_39",D[D.CODE_93=3]="CODE_93",D[D.CODE_128=4]="CODE_128",D[D.DATA_MATRIX=5]="DATA_MATRIX",D[D.EAN_8=6]="EAN_8",D[D.EAN_13=7]="EAN_13",D[D.ITF=8]="ITF",D[D.MAXICODE=9]="MAXICODE",D[D.PDF_417=10]="PDF_417",D[D.QR_CODE=11]="QR_CODE",D[D.RSS_14=12]="RSS_14",D[D.RSS_EXPANDED=13]="RSS_EXPANDED",D[D.UPC_A=14]="UPC_A",D[D.UPC_E=15]="UPC_E",D[D.UPC_EAN_EXTENSION=16]="UPC_EAN_EXTENSION"})(Je||(Je={}));var Se=Je,Ue;(function(D){D[D.OTHER=0]="OTHER",D[D.ORIENTATION=1]="ORIENTATION",D[D.BYTE_SEGMENTS=2]="BYTE_SEGMENTS",D[D.ERROR_CORRECTION_LEVEL=3]="ERROR_CORRECTION_LEVEL",D[D.ISSUE_NUMBER=4]="ISSUE_NUMBER",D[D.SUGGESTED_PRICE=5]="SUGGESTED_PRICE",D[D.POSSIBLE_COUNTRY=6]="POSSIBLE_COUNTRY",D[D.UPC_EAN_EXTENSION=7]="UPC_EAN_EXTENSION",D[D.PDF417_EXTRA_METADATA=8]="PDF417_EXTRA_METADATA",D[D.STRUCTURED_APPEND_SEQUENCE=9]="STRUCTURED_APPEND_SEQUENCE",D[D.STRUCTURED_APPEND_PARITY=10]="STRUCTURED_APPEND_PARITY"})(Ue||(Ue={}));var $e=Ue;class ye{constructor(a,s,l,c,d=-1,g=-1){this.rawBytes=a,this.text=s,this.byteSegments=l,this.ecLevel=c,this.structuredAppendSequenceNumber=d,this.structuredAppendParity=g,this.numBits=a==null?0:8*a.length}getRawBytes(){return this.rawBytes}getNumBits(){return this.numBits}setNumBits(a){this.numBits=a}getText(){return this.text}getByteSegments(){return this.byteSegments}getECLevel(){return this.ecLevel}getErrorsCorrected(){return this.errorsCorrected}setErrorsCorrected(a){this.errorsCorrected=a}getErasures(){return this.erasures}setErasures(a){this.erasures=a}getOther(){return this.other}setOther(a){this.other=a}hasStructuredAppend(){return this.structuredAppendParity>=0&&this.structuredAppendSequenceNumber>=0}getStructuredAppendParity(){return this.structuredAppendParity}getStructuredAppendSequenceNumber(){return this.structuredAppendSequenceNumber}}class je{exp(a){return this.expTable[a]}log(a){if(a===0)throw new m;return this.logTable[a]}static addOrSubtract(a,s){return a^s}}class Re{constructor(a,s){if(s.length===0)throw new m;this.field=a;const l=s.length;if(l>1&&s[0]===0){let c=1;for(;cl.length){const g=s;s=l,l=g}let c=new Int32Array(l.length);const d=l.length-s.length;T.arraycopy(l,0,c,0,d);for(let g=d;g=a.getDegree()&&!c.isZero();){const y=c.getDegree()-a.getDegree(),v=s.multiply(c.getCoefficient(c.getDegree()),g),b=a.multiplyByMonomial(y,v),R=s.buildMonomial(y,v);l=l.addOrSubtract(R),c=c.addOrSubtract(b)}return[l,c]}toString(){let a="";for(let s=this.getDegree();s>=0;s--){let l=this.getCoefficient(s);if(l!==0){if(l<0?(a+=" - ",l=-l):a.length>0&&(a+=" + "),s===0||l!==1){const c=this.field.log(l);c===0?a+="1":c===1?a+="a":(a+="a^",a+=c)}s!==0&&(s===1?a+="x":(a+="x^",a+=s))}}return a}}class ce extends p{}ce.kind="ArithmeticException";class Ne extends je{constructor(a,s,l){super(),this.primitive=a,this.size=s,this.generatorBase=l;const c=new Int32Array(s);let d=1;for(let y=0;y=s&&(d^=a,d&=s-1);this.expTable=c;const g=new Int32Array(s);for(let y=0;y=(l/2|0);){let z=d,V=y;if(d=g,y=v,d.isZero())throw new Le("r_{i-1} was zero");g=z;let G=c.getZero();const Z=d.getCoefficient(d.getDegree()),ae=c.inverse(Z);for(;g.getDegree()>=d.getDegree()&&!g.isZero();){const pe=g.getDegree()-d.getDegree(),ge=c.multiply(g.getCoefficient(g.getDegree()),ae);G=G.addOrSubtract(c.buildMonomial(pe,ge)),g=g.addOrSubtract(d.multiplyByMonomial(pe,ge))}if(v=G.multiply(y).addOrSubtract(V),g.getDegree()>=d.getDegree())throw new et("Division algorithm failed to reduce polynomial?")}const b=v.getCoefficient(0);if(b===0)throw new Le("sigmaTilde(0) was zero");const R=c.inverse(b),j=v.multiplyScalar(R),L=g.multiplyScalar(R);return[j,L]}findErrorLocations(a){const s=a.getDegree();if(s===1)return Int32Array.from([a.getCoefficient(1)]);const l=new Int32Array(s);let c=0;const d=this.field;for(let g=1;g1,j,j+l-1),j+=l-1;else for(let V=l-1;V>=0;--V)R[j++]=(z&1<=8?we.readCode(a,s,8):we.readCode(a,s,l)<<8-l}static convertBoolArrayToByteArray(a){let s=new Uint8Array((a.length+7)/8);for(let l=0;l","?","[","]","{","}","CTRL_UL"],we.DIGIT_TABLE=["CTRL_PS"," ","0","1","2","3","4","5","6","7","8","9",",",".","CTRL_UL","CTRL_US"];class Ie{constructor(){}static round(a){return a===NaN?0:a<=Number.MIN_SAFE_INTEGER?Number.MIN_SAFE_INTEGER:a>=Number.MAX_SAFE_INTEGER?Number.MAX_SAFE_INTEGER:a+(a<0?-.5:.5)|0}static distance(a,s,l,c){const d=a-l,g=s-c;return Math.sqrt(d*d+g*g)}static sum(a){let s=0;for(let l=0,c=a.length;l!==c;l++){const d=a[l];s+=d}return s}}class ln{static floatToIntBits(a){return a}}ln.MAX_VALUE=Number.MAX_SAFE_INTEGER;class be{constructor(a,s){this.x=a,this.y=s}getX(){return this.x}getY(){return this.y}equals(a){if(a instanceof be){const s=a;return this.x===s.x&&this.y===s.y}return!1}hashCode(){return 31*ln.floatToIntBits(this.x)+ln.floatToIntBits(this.y)}toString(){return"("+this.x+","+this.y+")"}static orderBestPatterns(a){const s=this.distance(a[0],a[1]),l=this.distance(a[1],a[2]),c=this.distance(a[0],a[2]);let d,g,y;if(l>=s&&l>=c?(g=a[0],d=a[1],y=a[2]):c>=l&&c>=s?(g=a[1],d=a[0],y=a[2]):(g=a[2],d=a[0],y=a[1]),this.crossProductZ(d,g,y)<0){const v=d;d=y,y=v}a[0]=d,a[1]=g,a[2]=y}static distance(a,s){return Ie.distance(a.x,a.y,s.x,s.y)}static crossProductZ(a,s,l){const c=s.x,d=s.y;return(l.x-c)*(a.y-d)-(l.y-d)*(a.x-c)}}class jn{constructor(a,s){this.bits=a,this.points=s}getBits(){return this.bits}getPoints(){return this.points}}class Gi extends jn{constructor(a,s,l,c,d){super(a,s),this.compact=l,this.nbDatablocks=c,this.nbLayers=d}getNbLayers(){return this.nbLayers}getNbDatablocks(){return this.nbDatablocks}isCompact(){return this.compact}}class un{constructor(a,s,l,c){this.image=a,this.height=a.getHeight(),this.width=a.getWidth(),s==null&&(s=un.INIT_SIZE),l==null&&(l=a.getWidth()/2|0),c==null&&(c=a.getHeight()/2|0);const d=s/2|0;if(this.leftInit=l-d,this.rightInit=l+d,this.upInit=c-d,this.downInit=c+d,this.upInit<0||this.leftInit<0||this.downInit>=this.height||this.rightInit>=this.width)throw new $}detect(){let a=this.leftInit,s=this.rightInit,l=this.upInit,c=this.downInit,d=!1,g=!0,y=!1,v=!1,b=!1,R=!1,j=!1;const L=this.width,z=this.height;for(;g;){g=!1;let V=!0;for(;(V||!v)&&s=L){d=!0;break}let G=!0;for(;(G||!b)&&c=z){d=!0;break}let Z=!0;for(;(Z||!R)&&a>=0;)Z=this.containsBlackPoint(l,c,a,!1),Z?(a--,g=!0,R=!0):R||a--;if(a<0){d=!0;break}let ae=!0;for(;(ae||!j)&&l>=0;)ae=this.containsBlackPoint(a,s,l,!0),ae?(l--,g=!0,j=!0):j||l--;if(l<0){d=!0;break}g&&(y=!0)}if(!d&&y){const V=s-a;let G=null;for(let ge=1;G===null&&gel||v<-1||v>c)throw new $;d=!1,y===-1?(s[g]=0,d=!0):y===l&&(s[g]=l-1,d=!0),v===-1?(s[g+1]=0,d=!0):v===c&&(s[g+1]=c-1,d=!0)}d=!0;for(let g=s.length-2;g>=0&&d;g-=2){const y=Math.floor(s[g]),v=Math.floor(s[g+1]);if(y<-1||y>l||v<-1||v>c)throw new $;d=!1,y===-1?(s[g]=0,d=!0):y===l&&(s[g]=l-1,d=!0),v===-1?(s[g+1]=0,d=!0):v===c&&(s[g+1]=c-1,d=!0)}}}class Fr{constructor(a,s,l,c,d,g,y,v,b){this.a11=a,this.a21=s,this.a31=l,this.a12=c,this.a22=d,this.a32=g,this.a13=y,this.a23=v,this.a33=b}static quadrilateralToQuadrilateral(a,s,l,c,d,g,y,v,b,R,j,L,z,V,G,Z){const ae=Fr.quadrilateralToSquare(a,s,l,c,d,g,y,v);return Fr.squareToQuadrilateral(b,R,j,L,z,V,G,Z).times(ae)}transformPoints(a){const s=a.length,l=this.a11,c=this.a12,d=this.a13,g=this.a21,y=this.a22,v=this.a23,b=this.a31,R=this.a32,j=this.a33;for(let L=0;L>1&127):(c<<=10,c+=(y>>2&992)+(y>>1&31))}let d=this.getCorrectedParameterData(c,this.compact);this.compact?(this.nbLayers=(d>>6)+1,this.nbDataBlocks=(d&63)+1):(this.nbLayers=(d>>11)+1,this.nbDataBlocks=(d&2047)+1)}getRotation(a,s){let l=0;a.forEach((c,d,g)=>{let y=(c>>s-2<<1)+(c&1);l=(l<<3)+y}),l=((l&1)<<11)+(l>>1);for(let c=0;c<4;c++)if(O.bitCount(l^this.EXPECTED_CORNER_BITS[c])<=2)return c;throw new $}getCorrectedParameterData(a,s){let l,c;s?(l=7,c=2):(l=10,c=4);let d=l-c,g=new Int32Array(l);for(let v=l-1;v>=0;--v)g[v]=a&15,a>>=4;try{new ct(Ne.AZTEC_PARAM).decode(g,d)}catch{throw new $}let y=0;for(let v=0;v2){let G=this.distancePoint(V,j)*this.nbCenterLayers/(this.distancePoint(d,s)*(this.nbCenterLayers+2));if(G<.75||G>1.25||!this.isWhiteOrBlackRectangle(j,L,z,V))break}s=j,l=L,c=z,d=V,g=!g}if(this.nbCenterLayers!==5&&this.nbCenterLayers!==7)throw new $;this.compact=this.nbCenterLayers===5;let y=new be(s.getX()+.5,s.getY()-.5),v=new be(l.getX()+.5,l.getY()+.5),b=new be(c.getX()-.5,c.getY()+.5),R=new be(d.getX()-.5,d.getY()-.5);return this.expandSquare([y,v,b,R],2*this.nbCenterLayers-3,2*this.nbCenterLayers)}getMatrixCenter(){let a,s,l,c;try{let y=new un(this.image).detect();a=y[0],s=y[1],l=y[2],c=y[3]}catch{let v=this.image.getWidth()/2,b=this.image.getHeight()/2;a=this.getFirstDifferent(new Ln(v+7,b-7),!1,1,-1).toResultPoint(),s=this.getFirstDifferent(new Ln(v+7,b+7),!1,1,1).toResultPoint(),l=this.getFirstDifferent(new Ln(v-7,b+7),!1,-1,1).toResultPoint(),c=this.getFirstDifferent(new Ln(v-7,b-7),!1,-1,-1).toResultPoint()}let d=Ie.round((a.getX()+c.getX()+s.getX()+l.getX())/4),g=Ie.round((a.getY()+c.getY()+s.getY()+l.getY())/4);try{let y=new un(this.image,15,d,g).detect();a=y[0],s=y[1],l=y[2],c=y[3]}catch{a=this.getFirstDifferent(new Ln(d+7,g-7),!1,1,-1).toResultPoint(),s=this.getFirstDifferent(new Ln(d+7,g+7),!1,1,1).toResultPoint(),l=this.getFirstDifferent(new Ln(d-7,g+7),!1,-1,1).toResultPoint(),c=this.getFirstDifferent(new Ln(d-7,g-7),!1,-1,-1).toResultPoint()}return d=Ie.round((a.getX()+c.getX()+s.getX()+l.getX())/4),g=Ie.round((a.getY()+c.getY()+s.getY()+l.getY())/4),new Ln(d,g)}getMatrixCornerPoints(a){return this.expandSquare(a,2*this.nbCenterLayers,this.getDimension())}sampleGrid(a,s,l,c,d){let g=Xi.getInstance(),y=this.getDimension(),v=y/2-this.nbCenterLayers,b=y/2+this.nbCenterLayers;return g.sampleGrid(a,y,y,v,v,b,v,b,b,v,b,s.getX(),s.getY(),l.getX(),l.getY(),c.getX(),c.getY(),d.getX(),d.getY())}sampleLine(a,s,l){let c=0,d=this.distanceResultPoint(a,s),g=d/l,y=a.getX(),v=a.getY(),b=g*(s.getX()-a.getX())/d,R=g*(s.getY()-a.getY())/d;for(let j=0;j.1&&j<.9?0:j<=.1===b?1:-1}getFirstDifferent(a,s,l,c){let d=a.getX()+l,g=a.getY()+c;for(;this.isValid(d,g)&&this.image.get(d,g)===s;)d+=l,g+=c;for(d-=l,g-=c;this.isValid(d,g)&&this.image.get(d,g)===s;)d+=l;for(d-=l;this.isValid(d,g)&&this.image.get(d,g)===s;)g+=c;return g-=c,new Ln(d,g)}expandSquare(a,s,l){let c=l/(2*s),d=a[0].getX()-a[2].getX(),g=a[0].getY()-a[2].getY(),y=(a[0].getX()+a[2].getX())/2,v=(a[0].getY()+a[2].getY())/2,b=new be(y+c*d,v+c*g),R=new be(y-c*d,v-c*g);d=a[1].getX()-a[3].getX(),g=a[1].getY()-a[3].getY(),y=(a[1].getX()+a[3].getX())/2,v=(a[1].getY()+a[3].getY())/2;let j=new be(y+c*d,v+c*g),L=new be(y-c*d,v-c*g);return[b,j,R,L]}isValid(a,s){return a>=0&&a0&&s{l.foundPossibleResultPoint(c)})}}reset(){}}class x8 extends Ee{constructor(a=500){super(new Vc,a)}}class Yt{decode(a,s){try{return this.doDecode(a,s)}catch{if(s&&s.get(I.TRY_HARDER)===!0&&a.isRotateSupported()){const d=a.rotateCounterClockwise(),g=this.doDecode(d,s),y=g.getResultMetadata();let v=270;y!==null&&y.get($e.ORIENTATION)===!0&&(v=v+y.get($e.ORIENTATION)%360),g.putMetadata($e.ORIENTATION,v);const b=g.getResultPoints();if(b!==null){const R=d.getHeight();for(let j=0;j>(g?8:5));let v;g?v=c:v=15;const b=Math.trunc(c/2);for(let R=0;R=c)break;try{d=a.getBlackRow(z,d)}catch{continue}for(let V=0;V<2;V++){if(V===1&&(d.reverse(),s&&s.get(I.NEED_RESULT_POINT_CALLBACK)===!0)){const G=new Map;s.forEach((Z,ae)=>G.set(ae,Z)),G.delete(I.NEED_RESULT_POINT_CALLBACK),s=G}try{const G=this.decodeRow(z,d,s);if(V===1){G.putMetadata($e.ORIENTATION,180);const Z=G.getResultPoints();Z!==null&&(Z[0]=new be(l-Z[0].getX()-1,Z[0].getY()),Z[1]=new be(l-Z[1].getX()-1,Z[1].getY()))}return G}catch{}}}throw new $}static recordPattern(a,s,l){const c=l.length;for(let b=0;b=d)throw new $;let g=!a.get(s),y=0,v=s;for(;v0&&c>=0;)a.get(--s)!==d&&(c--,d=!d);if(c>=0)throw new $;Yt.recordPattern(a,s+1,l)}static patternMatchVariance(a,s,l){const c=a.length;let d=0,g=0;for(let b=0;bj?R-j:j-R;if(L>l)return Number.POSITIVE_INFINITY;v+=L}return v/d}}class ve extends Yt{static findStartPattern(a){const s=a.getSize(),l=a.getNextSet(0);let c=0,d=Int32Array.from([0,0,0,0,0,0]),g=l,y=!1;const v=6;for(let b=l;b=0&&a.isRange(Math.max(0,g-(b-g)/2),g,!1))return Int32Array.from([g,b,j]);g+=d[0]+d[1],d=d.slice(2,d.length-1),d[c-1]=0,d[c]=0,c--}else c++;d[c]=1,y=!y}throw new $}static decodeCode(a,s,l){Yt.recordPattern(a,l,s);let c=ve.MAX_AVG_VARIANCE,d=-1;for(let g=0;g=0)return d;throw new $}decodeRow(a,s,l){const c=l&&l.get(I.ASSUME_GS1)===!0,d=ve.findStartPattern(s),g=d[2];let y=0;const v=new Uint8Array(20);v[y++]=g;let b;switch(g){case ve.CODE_START_A:b=ve.CODE_CODE_A;break;case ve.CODE_START_B:b=ve.CODE_CODE_B;break;case ve.CODE_START_C:b=ve.CODE_CODE_C;break;default:throw new k}let R=!1,j=!1,L="",z=d[0],V=d[1];const G=Int32Array.from([0,0,0,0,0,0]);let Z=0,ae=0,pe=g,ge=0,de=!0,qe=!1,We=!1;for(;!R;){const Wo=j;switch(j=!1,Z=ae,ae=ve.decodeCode(s,G,V),v[y++]=ae,ae!==ve.CODE_STOP&&(de=!0),ae!==ve.CODE_STOP&&(ge++,pe+=ge*ae),z=V,V+=G.reduce((X8,Y8)=>X8+Y8,0),ae){case ve.CODE_START_A:case ve.CODE_START_B:case ve.CODE_START_C:throw new k}switch(b){case ve.CODE_CODE_A:if(ae<64)We===qe?L+=String.fromCharCode(32+ae):L+=String.fromCharCode(32+ae+128),We=!1;else if(ae<96)We===qe?L+=String.fromCharCode(ae-64):L+=String.fromCharCode(ae+64),We=!1;else switch(ae!==ve.CODE_STOP&&(de=!1),ae){case ve.CODE_FNC_1:c&&(L.length===0?L+="]C1":L+="");break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_A:!qe&&We?(qe=!0,We=!1):qe&&We?(qe=!1,We=!1):We=!0;break;case ve.CODE_SHIFT:j=!0,b=ve.CODE_CODE_B;break;case ve.CODE_CODE_B:b=ve.CODE_CODE_B;break;case ve.CODE_CODE_C:b=ve.CODE_CODE_C;break;case ve.CODE_STOP:R=!0;break}break;case ve.CODE_CODE_B:if(ae<96)We===qe?L+=String.fromCharCode(32+ae):L+=String.fromCharCode(32+ae+128),We=!1;else switch(ae!==ve.CODE_STOP&&(de=!1),ae){case ve.CODE_FNC_1:c&&(L.length===0?L+="]C1":L+="");break;case ve.CODE_FNC_2:case ve.CODE_FNC_3:break;case ve.CODE_FNC_4_B:!qe&&We?(qe=!0,We=!1):qe&&We?(qe=!1,We=!1):We=!0;break;case ve.CODE_SHIFT:j=!0,b=ve.CODE_CODE_A;break;case ve.CODE_CODE_A:b=ve.CODE_CODE_A;break;case ve.CODE_CODE_C:b=ve.CODE_CODE_C;break;case ve.CODE_STOP:R=!0;break}break;case ve.CODE_CODE_C:if(ae<100)ae<10&&(L+="0"),L+=ae;else switch(ae!==ve.CODE_STOP&&(de=!1),ae){case ve.CODE_FNC_1:c&&(L.length===0?L+="]C1":L+="");break;case ve.CODE_CODE_A:b=ve.CODE_CODE_A;break;case ve.CODE_CODE_B:b=ve.CODE_CODE_B;break;case ve.CODE_STOP:R=!0;break}break}Wo&&(b=b===ve.CODE_CODE_A?ve.CODE_CODE_B:ve.CODE_CODE_A)}const Xn=V-z;if(V=s.getNextUnset(V),!s.isRange(V,Math.min(s.getSize(),V+(V-z)/2),!1))throw new $;if(pe-=ge*Z,pe%103!==Z)throw new A;const Ur=L.length;if(Ur===0)throw new $;Ur>0&&de&&(b===ve.CODE_CODE_C?L=L.substring(0,Ur-2):L=L.substring(0,Ur-1));const Yn=(d[1]+d[0])/2,xt=z+Xn/2,vn=v.length,rr=new Uint8Array(vn);for(let Wo=0;Wol&&(d=v);l=d,c=0;let g=0,y=0;for(let v=0;vl&&(y|=1<0;v++){let b=a[v];if(b>l&&(c--,b*2>=g))return-1}return y}}while(c>3);return-1}static patternToChar(a){for(let s=0;s="A"&&g<="Z")y=String.fromCharCode(g.charCodeAt(0)+32);else throw new k;break;case"$":if(g>="A"&&g<="Z")y=String.fromCharCode(g.charCodeAt(0)-64);else throw new k;break;case"%":if(g>="A"&&g<="E")y=String.fromCharCode(g.charCodeAt(0)-38);else if(g>="F"&&g<="J")y=String.fromCharCode(g.charCodeAt(0)-11);else if(g>="K"&&g<="O")y=String.fromCharCode(g.charCodeAt(0)+16);else if(g>="P"&&g<="T")y=String.fromCharCode(g.charCodeAt(0)+43);else if(g==="U")y="\0";else if(g==="V")y="@";else if(g==="W")y="`";else if(g==="X"||g==="Y"||g==="Z")y="";else throw new k;break;case"/":if(g>="A"&&g<="O")y=String.fromCharCode(g.charCodeAt(0)-32);else if(g==="Z")y=":";else throw new k;break}l+=y,c++}else l+=d}return l}}Qt.ALPHABET_STRING="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%",Qt.CHARACTER_ENCODINGS=[52,289,97,352,49,304,112,37,292,100,265,73,328,25,280,88,13,268,76,28,259,67,322,19,274,82,7,262,70,22,385,193,448,145,400,208,133,388,196,168,162,138,42],Qt.ASTERISK_ENCODING=148;class mt extends Yt{constructor(){super(...arguments),this.narrowLineWidth=-1}decodeRow(a,s,l){let c=this.decodeStart(s),d=this.decodeEnd(s),g=new ne;mt.decodeMiddle(s,c[1],d[0],g);let y=g.toString(),v=null;l!=null&&(v=l.get(I.ALLOWED_LENGTHS)),v==null&&(v=mt.DEFAULT_ALLOWED_LENGTHS);let b=y.length,R=!1,j=0;for(let V of v){if(b===V){R=!0;break}V>j&&(j=V)}if(!R&&b>j&&(R=!0),!R)throw new k;const L=[new be(c[1],a),new be(d[0],a)];return new Pe(y,null,0,L,Se.ITF,new Date().getTime())}static decodeMiddle(a,s,l,c){let d=new Int32Array(10),g=new Int32Array(5),y=new Int32Array(5);for(d.fill(0),g.fill(0),y.fill(0);s0&&c>=0&&!a.get(c);c--)l--;if(l!==0)throw new $}static skipWhiteSpace(a){const s=a.getSize(),l=a.getNextSet(0);if(l===s)throw new $;return l}decodeEnd(a){a.reverse();try{let s=mt.skipWhiteSpace(a),l;try{l=mt.findGuardPattern(a,s,mt.END_PATTERN_REVERSED[0])}catch(d){d instanceof $&&(l=mt.findGuardPattern(a,s,mt.END_PATTERN_REVERSED[1]))}this.validateQuietZone(a,l[0]);let c=l[0];return l[0]=a.getSize()-l[1],l[1]=a.getSize()-c,l}finally{a.reverse()}}static findGuardPattern(a,s,l){let c=l.length,d=new Int32Array(c),g=a.getSize(),y=!1,v=0,b=s;d.fill(0);for(let R=s;R=0)return l%10;throw new $}}mt.PATTERNS=[Int32Array.from([1,1,2,2,1]),Int32Array.from([2,1,1,1,2]),Int32Array.from([1,2,1,1,2]),Int32Array.from([2,2,1,1,1]),Int32Array.from([1,1,2,1,2]),Int32Array.from([2,1,2,1,1]),Int32Array.from([1,2,2,1,1]),Int32Array.from([1,1,1,2,2]),Int32Array.from([2,1,1,2,1]),Int32Array.from([1,2,1,2,1]),Int32Array.from([1,1,3,3,1]),Int32Array.from([3,1,1,1,3]),Int32Array.from([1,3,1,1,3]),Int32Array.from([3,3,1,1,1]),Int32Array.from([1,1,3,1,3]),Int32Array.from([3,1,3,1,1]),Int32Array.from([1,3,3,1,1]),Int32Array.from([1,1,1,3,3]),Int32Array.from([3,1,1,3,1]),Int32Array.from([1,3,1,3,1])],mt.MAX_AVG_VARIANCE=.38,mt.MAX_INDIVIDUAL_VARIANCE=.5,mt.DEFAULT_ALLOWED_LENGTHS=[6,8,10,12,14],mt.START_PATTERN=Int32Array.from([1,1,1,1]),mt.END_PATTERN_REVERSED=[Int32Array.from([1,1,2]),Int32Array.from([1,1,3])];class Lt extends Yt{constructor(){super(...arguments),this.decodeRowStringBuffer=""}static findStartGuardPattern(a){let s=!1,l,c=0,d=Int32Array.from([0,0,0]);for(;!s;){d=Int32Array.from([0,0,0]),l=Lt.findGuardPattern(a,c,!1,this.START_END_PATTERN,d);let g=l[0];c=l[1];let y=g-(c-g);y>=0&&(s=a.isRange(y,g,!1))}return l}static checkChecksum(a){return Lt.checkStandardUPCEANChecksum(a)}static checkStandardUPCEANChecksum(a){let s=a.length;if(s===0)return!1;let l=parseInt(a.charAt(s-1),10);return Lt.getStandardUPCEANChecksum(a.substring(0,s-1))===l}static getStandardUPCEANChecksum(a){let s=a.length,l=0;for(let c=s-1;c>=0;c-=2){let d=a.charAt(c).charCodeAt(0)-48;if(d<0||d>9)throw new k;l+=d}l*=3;for(let c=s-2;c>=0;c-=2){let d=a.charAt(c).charCodeAt(0)-48;if(d<0||d>9)throw new k;l+=d}return(1e3-l)%10}static decodeEnd(a,s){return Lt.findGuardPattern(a,s,!1,Lt.START_END_PATTERN,new Int32Array(Lt.START_END_PATTERN.length).fill(0))}static findGuardPatternWithoutCounters(a,s,l,c){return this.findGuardPattern(a,s,l,c,new Int32Array(c.length))}static findGuardPattern(a,s,l,c,d){let g=a.getSize();s=l?a.getNextUnset(s):a.getNextSet(s);let y=0,v=s,b=c.length,R=l;for(let j=s;j=0)return g;throw new $}}Lt.MAX_AVG_VARIANCE=.48,Lt.MAX_INDIVIDUAL_VARIANCE=.7,Lt.START_END_PATTERN=Int32Array.from([1,1,1]),Lt.MIDDLE_PATTERN=Int32Array.from([1,1,1,1,1]),Lt.END_PATTERN=Int32Array.from([1,1,1,1,1,1]),Lt.L_PATTERNS=[Int32Array.from([3,2,1,1]),Int32Array.from([2,2,2,1]),Int32Array.from([2,1,2,2]),Int32Array.from([1,4,1,1]),Int32Array.from([1,1,3,2]),Int32Array.from([1,2,3,1]),Int32Array.from([1,1,1,4]),Int32Array.from([1,3,1,2]),Int32Array.from([1,2,1,3]),Int32Array.from([3,1,1,2])];class Al{constructor(){this.CHECK_DIGIT_ENCODINGS=[24,20,18,17,12,6,3,10,9,5],this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(a,s,l){let c=this.decodeRowStringBuffer,d=this.decodeMiddle(s,l,c),g=c.toString(),y=Al.parseExtensionString(g),v=[new be((l[0]+l[1])/2,a),new be(d,a)],b=new Pe(g,null,0,v,Se.UPC_EAN_EXTENSION,new Date().getTime());return y!=null&&b.putAllMetadata(y),b}decodeMiddle(a,s,l){let c=this.decodeMiddleCounters;c[0]=0,c[1]=0,c[2]=0,c[3]=0;let d=a.getSize(),g=s[1],y=0;for(let b=0;b<5&&g=10&&(y|=1<<4-b),b!==4&&(g=a.getNextSet(g),g=a.getNextUnset(g))}if(l.length!==5)throw new $;let v=this.determineCheckDigit(y);if(Al.extensionChecksum(l.toString())!==v)throw new $;return g}static extensionChecksum(a){let s=a.length,l=0;for(let c=s-2;c>=0;c-=2)l+=a.charAt(c).charCodeAt(0)-48;l*=3;for(let c=s-1;c>=0;c-=2)l+=a.charAt(c).charCodeAt(0)-48;return l*=3,l%10}determineCheckDigit(a){for(let s=0;s<10;s++)if(a===this.CHECK_DIGIT_ENCODINGS[s])return s;throw new $}static parseExtensionString(a){if(a.length!==5)return null;let s=Al.parseExtension5String(a);return s==null?null:new Map([[$e.SUGGESTED_PRICE,s]])}static parseExtension5String(a){let s;switch(a.charAt(0)){case"0":s="£";break;case"5":s="$";break;case"9":switch(a){case"90000":return null;case"99991":return"0.00";case"99990":return"Used"}s="";break;default:s="";break}let l=parseInt(a.substring(1)),c=(l/100).toString(),d=l%100,g=d<10?"0"+d:d.toString();return s+c+"."+g}}class z0{constructor(){this.decodeMiddleCounters=Int32Array.from([0,0,0,0]),this.decodeRowStringBuffer=""}decodeRow(a,s,l){let c=this.decodeRowStringBuffer,d=this.decodeMiddle(s,l,c),g=c.toString(),y=z0.parseExtensionString(g),v=[new be((l[0]+l[1])/2,a),new be(d,a)],b=new Pe(g,null,0,v,Se.UPC_EAN_EXTENSION,new Date().getTime());return y!=null&&b.putAllMetadata(y),b}decodeMiddle(a,s,l){let c=this.decodeMiddleCounters;c[0]=0,c[1]=0,c[2]=0,c[3]=0;let d=a.getSize(),g=s[1],y=0;for(let v=0;v<2&&g=10&&(y|=1<<1-v),v!==1&&(g=a.getNextSet(g),g=a.getNextUnset(g))}if(l.length!==2)throw new $;if(parseInt(l.toString())%4!==y)throw new $;return g}static parseExtensionString(a){return a.length!==2?null:new Map([[$e.ISSUE_NUMBER,parseInt(a)]])}}class cv{static decodeRow(a,s,l){let c=Lt.findGuardPattern(s,l,!1,this.EXTENSION_START_PATTERN,new Int32Array(this.EXTENSION_START_PATTERN.length).fill(0));try{return new Al().decodeRow(a,s,c)}catch{return new z0().decodeRow(a,s,c)}}}cv.EXTENSION_START_PATTERN=Int32Array.from([1,1,2]);class ot extends Lt{constructor(){super(),this.decodeRowStringBuffer="",ot.L_AND_G_PATTERNS=ot.L_PATTERNS.map(a=>Int32Array.from(a));for(let a=10;a<20;a++){let s=ot.L_PATTERNS[a-10],l=new Int32Array(s.length);for(let c=0;c=s.getSize()||!s.isRange(R,j,!1))throw new $;let L=v.toString();if(L.length<8)throw new k;if(!ot.checkChecksum(L))throw new A;let z=(c[1]+c[0])/2,V=(b[1]+b[0])/2,G=this.getBarcodeFormat(),Z=[new be(z,a),new be(V,a)],ae=new Pe(L,null,0,Z,G,new Date().getTime()),pe=0;try{let de=cv.decodeRow(a,s,b[1]);ae.putMetadata($e.UPC_EAN_EXTENSION,de.getText()),ae.putAllMetadata(de.getResultMetadata()),ae.addResultPoints(de.getResultPoints()),pe=de.getText().length}catch{}let ge=l==null?null:l.get(I.ALLOWED_EAN_EXTENSIONS);if(ge!=null){let de=!1;for(let qe in ge)if(pe.toString()===qe){de=!0;break}if(!de)throw new $}return ae}decodeEnd(a,s){return ot.findGuardPattern(a,s,!1,ot.START_END_PATTERN,new Int32Array(ot.START_END_PATTERN.length).fill(0))}static checkChecksum(a){return ot.checkStandardUPCEANChecksum(a)}static checkStandardUPCEANChecksum(a){let s=a.length;if(s===0)return!1;let l=parseInt(a.charAt(s-1),10);return ot.getStandardUPCEANChecksum(a.substring(0,s-1))===l}static getStandardUPCEANChecksum(a){let s=a.length,l=0;for(let c=s-1;c>=0;c-=2){let d=a.charAt(c).charCodeAt(0)-48;if(d<0||d>9)throw new k;l+=d}l*=3;for(let c=s-2;c>=0;c-=2){let d=a.charAt(c).charCodeAt(0)-48;if(d<0||d>9)throw new k;l+=d}return(1e3-l)%10}}class ja extends ot{constructor(){super(),this.decodeMiddleCounters=Int32Array.from([0,0,0,0])}decodeMiddle(a,s,l){let c=this.decodeMiddleCounters;c[0]=0,c[1]=0,c[2]=0,c[3]=0;let d=a.getSize(),g=s[1],y=0;for(let b=0;b<6&&g=10&&(y|=1<<5-b)}l=ja.determineFirstDigit(l,y),g=ot.findGuardPattern(a,g,!0,ot.MIDDLE_PATTERN,new Int32Array(ot.MIDDLE_PATTERN.length).fill(0))[1];for(let b=0;b<6&&gb);c[0]=0,c[1]=0,c[2]=0,c[3]=0;const d=a.getSize();let g=s[1],y=0;for(let b=0;b<6&&g=10&&(y|=1<<5-b)}let v=$r.determineNumSysAndCheckDigit(l,y);return{rowOffset:g,resultString:v}}decodeEnd(a,s){return $r.findGuardPatternWithoutCounters(a,s,!0,$r.MIDDLE_END_PATTERN)}checkChecksum(a){return ot.checkChecksum($r.convertUPCEtoUPCA(a))}static determineNumSysAndCheckDigit(a,s){for(let l=0;l<=1;l++)for(let c=0;c<10;c++)if(s===this.NUMSYS_AND_CHECK_DIGIT_PATTERNS[l][c]){let d=String.fromCharCode(48+l),g=String.fromCharCode(48+c);return d+a+g}throw $.getNotFoundInstance()}getBarcodeFormat(){return Se.UPC_E}static convertUPCEtoUPCA(a){const s=a.slice(1,7).split("").map(d=>d.charCodeAt(0)),l=new ne;l.append(a.charAt(0));let c=s[5];switch(c){case 0:case 1:case 2:l.appendChars(s,0,2),l.append(c),l.append("0000"),l.appendChars(s,2,3);break;case 3:l.appendChars(s,0,3),l.append("00000"),l.appendChars(s,3,2);break;case 4:l.appendChars(s,0,4),l.append("00000"),l.append(s[4]);break;default:l.appendChars(s,0,5),l.append("0000"),l.append(c);break}return a.length>=8&&l.append(a.charAt(7)),l.toString()}}$r.MIDDLE_END_PATTERN=Int32Array.from([1,1,1,1,1,1]),$r.NUMSYS_AND_CHECK_DIGIT_PATTERNS=[Int32Array.from([56,52,50,49,44,38,35,42,41,37]),Int32Array.from([7,11,13,14,19,25,28,21,22,26])];class W0 extends Yt{constructor(a){super();let s=a==null?null:a.get(I.POSSIBLE_FORMATS),l=[];r(s)?(l.push(new ja),l.push(new dv),l.push(new fv),l.push(new $r)):(s.indexOf(Se.EAN_13)>-1&&l.push(new ja),s.indexOf(Se.UPC_A)>-1&&l.push(new dv),s.indexOf(Se.EAN_8)>-1&&l.push(new fv),s.indexOf(Se.UPC_E)>-1&&l.push(new $r)),this.readers=l}decodeRow(a,s,l){for(let c of this.readers)try{const d=c.decodeRow(a,s,l),g=d.getBarcodeFormat()===Se.EAN_13&&d.getText().charAt(0)==="0",y=l==null?null:l.get(I.POSSIBLE_FORMATS),v=y==null||y.includes(Se.UPC_A);if(g&&v){const b=d.getRawBytes(),R=new Pe(d.getText().substring(1),b,b?b.length:null,d.getResultPoints(),Se.UPC_A);return R.putAllMetadata(d.getResultMetadata()),R}return d}catch{}throw new $}reset(){for(let a of this.readers)a.reset()}}class Cn extends Yt{constructor(){super(),this.decodeFinderCounters=new Int32Array(4),this.dataCharacterCounters=new Int32Array(8),this.oddRoundingErrors=new Array(4),this.evenRoundingErrors=new Array(4),this.oddCounts=new Array(this.dataCharacterCounters.length/2),this.evenCounts=new Array(this.dataCharacterCounters.length/2)}getDecodeFinderCounters(){return this.decodeFinderCounters}getDataCharacterCounters(){return this.dataCharacterCounters}getOddRoundingErrors(){return this.oddRoundingErrors}getEvenRoundingErrors(){return this.evenRoundingErrors}getOddCounts(){return this.oddCounts}getEvenCounts(){return this.evenCounts}parseFinderValue(a,s){for(let l=0;lc&&(c=s[d],l=d);a[l]++}static decrement(a,s){let l=0,c=s[0];for(let d=1;d=Cn.MIN_FINDER_PATTERN_RATIO&&c<=Cn.MAX_FINDER_PATTERN_RATIO){let d=Number.MAX_SAFE_INTEGER,g=Number.MIN_SAFE_INTEGER;for(let y of a)y>g&&(g=y),y=y-v-1&&(R-=ni.combins(c-b-(y-v),y-v-2)),y-v-1>1){let j=0;for(let L=c-b-(y-v-2);L>s;L--)j+=ni.combins(c-b-L-1,y-v-3);R-=j*(y-1-v)}else c-b>s&&R--;d+=R}c-=b}return d}static combins(a,s){let l,c;a-s>s?(c=s,l=a-s):(c=a-s,l=s);let d=1,g=1;for(let y=a;y>l;y--)d*=y,g<=c&&(d/=g,g++);for(;g<=c;)d/=g,g++;return d}}class v8{static buildBitArray(a){let s=a.length*2-1;a[a.length-1].getRightChar()==null&&(s-=1);let l=12*s,c=new M(l),d=0,y=a[0].getRightChar().getValue();for(let v=11;v>=0;--v)y&1<=0;--j)R&1<=0;--L)j&1<10||l<0||l>10)throw new k;this.firstDigit=s,this.secondDigit=l}getFirstDigit(){return this.firstDigit}getSecondDigit(){return this.secondDigit}getValue(){return this.firstDigit*10+this.secondDigit}isFirstDigitFNC1(){return this.firstDigit===yr.FNC1}isSecondDigitFNC1(){return this.secondDigit===yr.FNC1}isAnyFNC1(){return this.firstDigit===yr.FNC1||this.secondDigit===yr.FNC1}}yr.FNC1=10;class Ce{constructor(){}static parseFieldsInGeneralPurpose(a){if(!a)return null;if(a.length<2)throw new $;let s=a.substring(0,2);for(let d of Ce.TWO_DIGIT_DATA_LENGTH)if(d[0]===s)return d[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(2,d[2],a):Ce.processFixedAI(2,d[1],a);if(a.length<3)throw new $;let l=a.substring(0,3);for(let d of Ce.THREE_DIGIT_DATA_LENGTH)if(d[0]===l)return d[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(3,d[2],a):Ce.processFixedAI(3,d[1],a);for(let d of Ce.THREE_DIGIT_PLUS_DIGIT_DATA_LENGTH)if(d[0]===l)return d[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,d[2],a):Ce.processFixedAI(4,d[1],a);if(a.length<4)throw new $;let c=a.substring(0,4);for(let d of Ce.FOUR_DIGIT_DATA_LENGTH)if(d[0]===c)return d[1]===Ce.VARIABLE_LENGTH?Ce.processVariableAI(4,d[2],a):Ce.processFixedAI(4,d[1],a);throw new $}static processFixedAI(a,s,l){if(l.lengththis.information.getSize())return a+4<=this.information.getSize();for(let s=a;sthis.information.getSize()){let d=this.extractNumericValueFromBitArray(a,4);return d===0?new yr(this.information.getSize(),yr.FNC1,yr.FNC1):new yr(this.information.getSize(),d-1,yr.FNC1)}let s=this.extractNumericValueFromBitArray(a,7),l=(s-8)/11,c=(s-8)%11;return new yr(a+7,l,c)}extractNumericValueFromBitArray(a,s){return jo.extractNumericValueFromBitArray(this.information,a,s)}static extractNumericValueFromBitArray(a,s,l){let c=0;for(let d=0;dthis.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(a,5);if(s>=5&&s<16)return!0;if(a+7>this.information.getSize())return!1;let l=this.extractNumericValueFromBitArray(a,7);if(l>=64&&l<116)return!0;if(a+8>this.information.getSize())return!1;let c=this.extractNumericValueFromBitArray(a,8);return c>=232&&c<253}decodeIsoIec646(a){let s=this.extractNumericValueFromBitArray(a,5);if(s===15)return new Hn(a+5,Hn.FNC1);if(s>=5&&s<15)return new Hn(a+5,"0"+(s-5));let l=this.extractNumericValueFromBitArray(a,7);if(l>=64&&l<90)return new Hn(a+7,""+(l+1));if(l>=90&&l<116)return new Hn(a+7,""+(l+7));let c=this.extractNumericValueFromBitArray(a,8),d;switch(c){case 232:d="!";break;case 233:d='"';break;case 234:d="%";break;case 235:d="&";break;case 236:d="'";break;case 237:d="(";break;case 238:d=")";break;case 239:d="*";break;case 240:d="+";break;case 241:d=",";break;case 242:d="-";break;case 243:d=".";break;case 244:d="/";break;case 245:d=":";break;case 246:d=";";break;case 247:d="<";break;case 248:d="=";break;case 249:d=">";break;case 250:d="?";break;case 251:d="_";break;case 252:d=" ";break;default:throw new k}return new Hn(a+8,d)}isStillAlpha(a){if(a+5>this.information.getSize())return!1;let s=this.extractNumericValueFromBitArray(a,5);if(s>=5&&s<16)return!0;if(a+6>this.information.getSize())return!1;let l=this.extractNumericValueFromBitArray(a,6);return l>=16&&l<63}decodeAlphanumeric(a){let s=this.extractNumericValueFromBitArray(a,5);if(s===15)return new Hn(a+5,Hn.FNC1);if(s>=5&&s<15)return new Hn(a+5,"0"+(s-5));let l=this.extractNumericValueFromBitArray(a,6);if(l>=32&&l<58)return new Hn(a+6,""+(l+33));let c;switch(l){case 58:c="*";break;case 59:c=",";break;case 60:c="-";break;case 61:c=".";break;case 62:c="/";break;default:throw new et("Decoding invalid alphanumeric value: "+l)}return new Hn(a+6,c)}isAlphaTo646ToAlphaLatch(a){if(a+1>this.information.getSize())return!1;for(let s=0;s<5&&s+athis.information.getSize())return!1;for(let s=a;sthis.information.getSize())return!1;for(let s=0;s<4&&s+a{s.forEach(g=>{c.getLeftChar().getValue()===g.getLeftChar().getValue()&&c.getRightChar().getValue()===g.getRightChar().getValue()&&c.getFinderPatter().getValue()===g.getFinderPatter().getValue()&&(l=!0)})}),l}}class fe extends Cn{constructor(a){super(...arguments),this.pairs=new Array(fe.MAX_PAIRS),this.rows=new Array,this.startEnd=[2],this.verbose=a===!0}decodeRow(a,s,l){this.pairs.length=0,this.startFromEven=!1;try{return fe.constructResult(this.decodeRow2pairs(a,s))}catch(c){this.verbose&&console.log(c)}return this.pairs.length=0,this.startFromEven=!0,fe.constructResult(this.decodeRow2pairs(a,s))}reset(){this.pairs.length=0,this.rows.length=0}decodeRow2pairs(a,s){let l=!1;for(;!l;)try{this.pairs.push(this.retrieveNextPair(s,this.pairs,a))}catch(d){if(d instanceof $){if(!this.pairs.length)throw new $;l=!0}}if(this.checkChecksum())return this.pairs;let c;if(this.rows.length?c=!0:c=!1,this.storeRow(a,!1),c){let d=this.checkRowsBoolean(!1);if(d!=null||(d=this.checkRowsBoolean(!0),d!=null))return d}throw new $}checkRowsBoolean(a){if(this.rows.length>25)return this.rows.length=0,null;this.pairs.length=0,a&&(this.rows=this.rows.reverse());let s=null;try{s=this.checkRows(new Array,0)}catch(l){this.verbose&&console.log(l)}return a&&(this.rows=this.rows.reverse()),s}checkRows(a,s){for(let l=s;ls.length)continue;let l=!0;for(let c=0;ca){d=g.isEquivalent(this.pairs);break}c=g.isEquivalent(this.pairs),l++}d||c||fe.isPartialRow(this.pairs,this.rows)||(this.rows.push(l,new G0(this.pairs,a,s)),this.removePartialRows(this.pairs,this.rows))}removePartialRows(a,s){for(let l of s)if(l.getPairs().length!==a.length){for(let c of l.getPairs())for(let d of a)if(Yi.equals(c,d))break}}static isPartialRow(a,s){for(let l of s){let c=!0;for(let d of a){let g=!1;for(let y of l.getPairs())if(d.equals(y)){g=!0;break}if(!g){c=!1;break}}if(c)return!0}return!1}getRows(){return this.rows}static constructResult(a){let s=v8.buildBitArray(a),c=hv(s).parseInformation(),d=a[0].getFinderPattern().getResultPoints(),g=a[a.length-1].getFinderPattern().getResultPoints(),y=[d[0],d[1],g[0],g[1]];return new Pe(c,null,null,y,Se.RSS_EXPANDED,null)}checkChecksum(){let a=this.pairs.get(0),s=a.getLeftChar(),l=a.getRightChar();if(l==null)return!1;let c=l.getChecksumPortion(),d=2;for(let y=1;y=0?g=l:this.isEmptyPair(s)?g=0:g=s[s.length-1].getFinderPattern().getStartEnd()[1];let y=s.length%2!=0;this.startFromEven&&(y=!y);let v=!1;for(;g=0&&!a.get(b);)b--;b++,c=this.startEnd[0]-b,d=b,g=this.startEnd[1]}else d=this.startEnd[0],g=a.getNextUnset(this.startEnd[1]+1),c=g-this.startEnd[1];let y=this.getDecodeFinderCounters();T.arraycopy(y,0,y,1,y.length-1),y[0]=c;let v;try{v=this.parseFinderValue(y,fe.FINDER_PATTERNS)}catch{return null}return new Gc(v,[d,g],d,g,s)}decodeDataCharacter(a,s,l,c){let d=this.getDataCharacterCounters();for(let xt=0;xt.3)throw new $;let b=this.getOddCounts(),R=this.getEvenCounts(),j=this.getOddRoundingErrors(),L=this.getEvenRoundingErrors();for(let xt=0;xt8){if(vn>8.7)throw new $;rr=8}let zo=xt/2;xt&1?(R[zo]=rr,L[zo]=vn-rr):(b[zo]=rr,j[zo]=vn-rr)}this.adjustOddEvenCounts(g);let z=4*s.getValue()+(l?0:2)+(c?0:1)-1,V=0,G=0;for(let xt=b.length-1;xt>=0;xt--){if(fe.isNotA1left(s,l,c)){let vn=fe.WEIGHTS[z][2*xt];G+=b[xt]*vn}V+=b[xt]}let Z=0;for(let xt=R.length-1;xt>=0;xt--)if(fe.isNotA1left(s,l,c)){let vn=fe.WEIGHTS[z][2*xt+1];Z+=R[xt]*vn}let ae=G+Z;if(V&1||V>13||V<4)throw new $;let pe=(13-V)/2,ge=fe.SYMBOL_WIDEST[pe],de=9-ge,qe=ni.getRSSvalue(b,ge,!0),We=ni.getRSSvalue(R,de,!1),Xn=fe.EVEN_TOTAL_SUBSET[pe],Ur=fe.GSUM[pe],Yn=qe*Xn+We+Ur;return new Do(Yn,ae)}static isNotA1left(a,s,l){return!(a.getValue()==0&&s&&l)}adjustOddEvenCounts(a){let s=Ie.sum(new Int32Array(this.getOddCounts())),l=Ie.sum(new Int32Array(this.getEvenCounts())),c=!1,d=!1;s>13?d=!0:s<4&&(c=!0);let g=!1,y=!1;l>13?y=!0:l<4&&(g=!0);let v=s+l-a,b=(s&1)==1,R=(l&1)==0;if(v==1)if(b){if(R)throw new $;d=!0}else{if(!R)throw new $;y=!0}else if(v==-1)if(b){if(R)throw new $;c=!0}else{if(!R)throw new $;g=!0}else if(v==0){if(b){if(!R)throw new $;s1){for(let y of this.possibleRightPairs)if(y.getCount()>1&&Bt.checkChecksum(g,y))return Bt.constructResult(g,y)}throw new $}static addOrTally(a,s){if(s==null)return;let l=!1;for(let c of a)if(c.getValue()===s.getValue()){c.incrementCount(),l=!0;break}l||a.push(s)}reset(){this.possibleLeftPairs.length=0,this.possibleRightPairs.length=0}static constructResult(a,s){let l=4537077*a.getValue()+s.getValue(),c=new String(l).toString(),d=new ne;for(let b=13-c.length;b>0;b--)d.append("0");d.append(c);let g=0;for(let b=0;b<13;b++){let R=d.charAt(b).charCodeAt(0)-48;g+=b&1?R:3*R}g=10-g%10,g===10&&(g=0),d.append(g.toString());let y=a.getFinderPattern().getResultPoints(),v=s.getFinderPattern().getResultPoints();return new Pe(d.toString(),null,0,[y[0],y[1],v[0],v[1]],Se.RSS_14,new Date().getTime())}static checkChecksum(a,s){let l=(a.getChecksumPortion()+16*s.getChecksumPortion())%79,c=9*a.getFinderPattern().getValue()+s.getFinderPattern().getValue();return c>72&&c--,c>8&&c--,l===c}decodePair(a,s,l,c){try{let d=this.findFinderPattern(a,s),g=this.parseFoundFinderPattern(a,l,s,d),y=c==null?null:c.get(I.NEED_RESULT_POINT_CALLBACK);if(y!=null){let R=(d[0]+d[1])/2;s&&(R=a.getSize()-1-R),y.foundPossibleResultPoint(new be(R,l))}let v=this.decodeDataCharacter(a,g,!0),b=this.decodeDataCharacter(a,g,!1);return new A8(1597*v.getValue()+b.getValue(),v.getChecksumPortion()+4*b.getChecksumPortion(),g)}catch{return null}}decodeDataCharacter(a,s,l){let c=this.getDataCharacterCounters();for(let Z=0;Z8&&(pe=8);let ge=Math.floor(Z/2);Z&1?(v[ge]=pe,R[ge]=ae-pe):(y[ge]=pe,b[ge]=ae-pe)}this.adjustOddEvenCounts(l,d);let j=0,L=0;for(let Z=y.length-1;Z>=0;Z--)L*=9,L+=y[Z],j+=y[Z];let z=0,V=0;for(let Z=v.length-1;Z>=0;Z--)z*=9,z+=v[Z],V+=v[Z];let G=L+3*z;if(l){if(j&1||j>12||j<4)throw new $;let Z=(12-j)/2,ae=Bt.OUTSIDE_ODD_WIDEST[Z],pe=9-ae,ge=ni.getRSSvalue(y,ae,!1),de=ni.getRSSvalue(v,pe,!0),qe=Bt.OUTSIDE_EVEN_TOTAL_SUBSET[Z],We=Bt.OUTSIDE_GSUM[Z];return new Do(ge*qe+de+We,G)}else{if(V&1||V>10||V<4)throw new $;let Z=(10-V)/2,ae=Bt.INSIDE_ODD_WIDEST[Z],pe=9-ae,ge=ni.getRSSvalue(y,ae,!0),de=ni.getRSSvalue(v,pe,!1),qe=Bt.INSIDE_ODD_TOTAL_SUBSET[Z],We=Bt.INSIDE_GSUM[Z];return new Do(de*qe+ge+We,G)}}findFinderPattern(a,s){let l=this.getDecodeFinderCounters();l[0]=0,l[1]=0,l[2]=0,l[3]=0;let c=a.getSize(),d=!1,g=0;for(;g=0&&d!==a.get(g);)g--;g++;const y=c[0]-g,v=this.getDecodeFinderCounters(),b=new Int32Array(v.length);T.arraycopy(v,0,b,1,v.length-1),b[0]=y;const R=this.parseFinderValue(b,Bt.FINDER_PATTERNS);let j=g,L=c[1];return l&&(j=a.getSize()-1-j,L=a.getSize()-1-L),new Gc(R,[g,c[1]],j,L,s)}adjustOddEvenCounts(a,s){let l=Ie.sum(new Int32Array(this.getOddCounts())),c=Ie.sum(new Int32Array(this.getEvenCounts())),d=!1,g=!1,y=!1,v=!1;a?(l>12?g=!0:l<4&&(d=!0),c>12?v=!0:c<4&&(y=!0)):(l>11?g=!0:l<5&&(d=!0),c>10?v=!0:c<4&&(y=!0));let b=l+c-s,R=(l&1)===(a?1:0),j=(c&1)===1;if(b===1)if(R){if(j)throw new $;g=!0}else{if(!j)throw new $;v=!0}else if(b===-1)if(R){if(j)throw new $;d=!0}else{if(!j)throw new $;y=!0}else if(b===0){if(R){if(!j)throw new $;la.reset())}}class S8 extends Ee{constructor(a=500,s){super(new Bo(s),a,s)}}class lt{constructor(a,s,l){this.ecCodewords=a,this.ecBlocks=[s],l&&this.ecBlocks.push(l)}getECCodewords(){return this.ecCodewords}getECBlocks(){return this.ecBlocks}}class st{constructor(a,s){this.count=a,this.dataCodewords=s}getCount(){return this.count}getDataCodewords(){return this.dataCodewords}}class Ze{constructor(a,s,l,c,d,g){this.versionNumber=a,this.symbolSizeRows=s,this.symbolSizeColumns=l,this.dataRegionSizeRows=c,this.dataRegionSizeColumns=d,this.ecBlocks=g;let y=0;const v=g.getECCodewords(),b=g.getECBlocks();for(let R of b)y+=R.getCount()*(R.getDataCodewords()+v);this.totalCodewords=y}getVersionNumber(){return this.versionNumber}getSymbolSizeRows(){return this.symbolSizeRows}getSymbolSizeColumns(){return this.symbolSizeColumns}getDataRegionSizeRows(){return this.dataRegionSizeRows}getDataRegionSizeColumns(){return this.dataRegionSizeColumns}getTotalCodewords(){return this.totalCodewords}getECBlocks(){return this.ecBlocks}static getVersionForDimensions(a,s){if(a&1||s&1)throw new k;for(let l of Ze.VERSIONS)if(l.symbolSizeRows===a&&l.symbolSizeColumns===s)return l;throw new k}toString(){return""+this.versionNumber}static buildVersions(){return[new Ze(1,10,10,8,8,new lt(5,new st(1,3))),new Ze(2,12,12,10,10,new lt(7,new st(1,5))),new Ze(3,14,14,12,12,new lt(10,new st(1,8))),new Ze(4,16,16,14,14,new lt(12,new st(1,12))),new Ze(5,18,18,16,16,new lt(14,new st(1,18))),new Ze(6,20,20,18,18,new lt(18,new st(1,22))),new Ze(7,22,22,20,20,new lt(20,new st(1,30))),new Ze(8,24,24,22,22,new lt(24,new st(1,36))),new Ze(9,26,26,24,24,new lt(28,new st(1,44))),new Ze(10,32,32,14,14,new lt(36,new st(1,62))),new Ze(11,36,36,16,16,new lt(42,new st(1,86))),new Ze(12,40,40,18,18,new lt(48,new st(1,114))),new Ze(13,44,44,20,20,new lt(56,new st(1,144))),new Ze(14,48,48,22,22,new lt(68,new st(1,174))),new Ze(15,52,52,24,24,new lt(42,new st(2,102))),new Ze(16,64,64,14,14,new lt(56,new st(2,140))),new Ze(17,72,72,16,16,new lt(36,new st(4,92))),new Ze(18,80,80,18,18,new lt(48,new st(4,114))),new Ze(19,88,88,20,20,new lt(56,new st(4,144))),new Ze(20,96,96,22,22,new lt(68,new st(4,174))),new Ze(21,104,104,24,24,new lt(56,new st(6,136))),new Ze(22,120,120,18,18,new lt(68,new st(6,175))),new Ze(23,132,132,20,20,new lt(62,new st(8,163))),new Ze(24,144,144,22,22,new lt(62,new st(8,156),new st(2,155))),new Ze(25,8,18,6,16,new lt(7,new st(1,5))),new Ze(26,8,32,6,14,new lt(11,new st(1,10))),new Ze(27,12,26,10,24,new lt(14,new st(1,16))),new Ze(28,12,36,10,16,new lt(18,new st(1,22))),new Ze(29,16,36,14,16,new lt(24,new st(1,32))),new Ze(30,16,48,14,22,new lt(28,new st(1,49)))]}}Ze.VERSIONS=Ze.buildVersions();class X0{constructor(a){const s=a.getHeight();if(s<8||s>144||s&1)throw new k;this.version=X0.readVersion(a),this.mappingBitMatrix=this.extractDataRegion(a),this.readMappingMatrix=new J(this.mappingBitMatrix.getWidth(),this.mappingBitMatrix.getHeight())}getVersion(){return this.version}static readVersion(a){const s=a.getHeight(),l=a.getWidth();return Ze.getVersionForDimensions(s,l)}readCodewords(){const a=new Int8Array(this.version.getTotalCodewords());let s=0,l=4,c=0;const d=this.mappingBitMatrix.getHeight(),g=this.mappingBitMatrix.getWidth();let y=!1,v=!1,b=!1,R=!1;do if(l===d&&c===0&&!y)a[s++]=this.readCorner1(d,g)&255,l-=2,c+=2,y=!0;else if(l===d-2&&c===0&&g&3&&!v)a[s++]=this.readCorner2(d,g)&255,l-=2,c+=2,v=!0;else if(l===d+4&&c===2&&!(g&7)&&!b)a[s++]=this.readCorner3(d,g)&255,l-=2,c+=2,b=!0;else if(l===d-2&&c===0&&(g&7)===4&&!R)a[s++]=this.readCorner4(d,g)&255,l-=2,c+=2,R=!0;else{do l=0&&!this.readMappingMatrix.get(c,l)&&(a[s++]=this.readUtah(l,c,d,g)&255),l-=2,c+=2;while(l>=0&&c=0&&c=0);l+=3,c+=1}while(l7?G-1:G;g[ae].codewords[pe]=a[j++]}if(j!==a.length)throw new m;return g}getNumDataCodewords(){return this.numDataCodewords}getCodewords(){return this.codewords}}class q0{constructor(a){this.bytes=a,this.byteOffset=0,this.bitOffset=0}getBitOffset(){return this.bitOffset}getByteOffset(){return this.byteOffset}readBits(a){if(a<1||a>32||a>this.available())throw new m(""+a);let s=0,l=this.bitOffset,c=this.byteOffset;const d=this.bytes;if(l>0){const g=8-l,y=a>8-y<>v,a-=y,l+=y,l===8&&(l=0,c++)}if(a>0){for(;a>=8;)s=s<<8|d[c]&255,c++,a-=8;if(a>0){const g=8-a,y=255>>g<>g,l+=a}}return this.bitOffset=l,this.byteOffset=c,s}available(){return 8*(this.bytes.length-this.byteOffset)-this.bitOffset}}var Jt;(function(D){D[D.PAD_ENCODE=0]="PAD_ENCODE",D[D.ASCII_ENCODE=1]="ASCII_ENCODE",D[D.C40_ENCODE=2]="C40_ENCODE",D[D.TEXT_ENCODE=3]="TEXT_ENCODE",D[D.ANSIX12_ENCODE=4]="ANSIX12_ENCODE",D[D.EDIFACT_ENCODE=5]="EDIFACT_ENCODE",D[D.BASE256_ENCODE=6]="BASE256_ENCODE"})(Jt||(Jt={}));class qi{static decode(a){const s=new q0(a),l=new ne,c=new ne,d=new Array;let g=Jt.ASCII_ENCODE;do if(g===Jt.ASCII_ENCODE)g=this.decodeAsciiSegment(s,l,c);else{switch(g){case Jt.C40_ENCODE:this.decodeC40Segment(s,l);break;case Jt.TEXT_ENCODE:this.decodeTextSegment(s,l);break;case Jt.ANSIX12_ENCODE:this.decodeAnsiX12Segment(s,l);break;case Jt.EDIFACT_ENCODE:this.decodeEdifactSegment(s,l);break;case Jt.BASE256_ENCODE:this.decodeBase256Segment(s,l,d);break;default:throw new k}g=Jt.ASCII_ENCODE}while(g!==Jt.PAD_ENCODE&&s.available()>0);return c.length()>0&&l.append(c.toString()),new ye(a,l.toString(),d.length===0?null:d,null)}static decodeAsciiSegment(a,s,l){let c=!1;do{let d=a.readBits(8);if(d===0)throw new k;if(d<=128)return c&&(d+=128),s.append(String.fromCharCode(d-1)),Jt.ASCII_ENCODE;if(d===129)return Jt.PAD_ENCODE;if(d<=229){const g=d-130;g<10&&s.append("0"),s.append(""+g)}else switch(d){case 230:return Jt.C40_ENCODE;case 231:return Jt.BASE256_ENCODE;case 232:s.append("");break;case 233:case 234:break;case 235:c=!0;break;case 236:s.append("[)>05"),l.insert(0,"");break;case 237:s.append("[)>06"),l.insert(0,"");break;case 238:return Jt.ANSIX12_ENCODE;case 239:return Jt.TEXT_ENCODE;case 240:return Jt.EDIFACT_ENCODE;case 241:break;default:if(d!==254||a.available()!==0)throw new k;break}}while(a.available()>0);return Jt.ASCII_ENCODE}static decodeC40Segment(a,s){let l=!1;const c=[];let d=0;do{if(a.available()===8)return;const g=a.readBits(8);if(g===254)return;this.parseTwoBytes(g,a.readBits(8),c);for(let y=0;y<3;y++){const v=c[y];switch(d){case 0:if(v<3)d=v+1;else if(v0)}static decodeTextSegment(a,s){let l=!1,c=[],d=0;do{if(a.available()===8)return;const g=a.readBits(8);if(g===254)return;this.parseTwoBytes(g,a.readBits(8),c);for(let y=0;y<3;y++){const v=c[y];switch(d){case 0:if(v<3)d=v+1;else if(v0)}static decodeAnsiX12Segment(a,s){const l=[];do{if(a.available()===8)return;const c=a.readBits(8);if(c===254)return;this.parseTwoBytes(c,a.readBits(8),l);for(let d=0;d<3;d++){const g=l[d];switch(g){case 0:s.append("\r");break;case 1:s.append("*");break;case 2:s.append(">");break;case 3:s.append(" ");break;default:if(g<14)s.append(String.fromCharCode(g+44));else if(g<40)s.append(String.fromCharCode(g+51));else throw new k;break}}}while(a.available()>0)}static parseTwoBytes(a,s,l){let c=(a<<8)+s-1,d=Math.floor(c/1600);l[0]=d,c-=d*1600,d=Math.floor(c/40),l[1]=d,l[2]=c-d*40}static decodeEdifactSegment(a,s){do{if(a.available()<=16)return;for(let l=0;l<4;l++){let c=a.readBits(6);if(c===31){const d=8-a.getBitOffset();d!==8&&a.readBits(d);return}c&32||(c|=64),s.append(String.fromCharCode(c))}}while(a.available()>0)}static decodeBase256Segment(a,s,l){let c=1+a.getByteOffset();const d=this.unrandomize255State(a.readBits(8),c++);let g;if(d===0?g=a.available()/8|0:d<250?g=d:g=250*(d-249)+this.unrandomize255State(a.readBits(8),c++),g<0)throw new k;const y=new Uint8Array(g);for(let v=0;v=0?c:c+256}}qi.C40_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],qi.C40_SHIFT2_SET_CHARS=["!",'"',"#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_"],qi.TEXT_BASIC_SET_CHARS=["*","*","*"," ","0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],qi.TEXT_SHIFT2_SET_CHARS=qi.C40_SHIFT2_SET_CHARS,qi.TEXT_SHIFT3_SET_CHARS=["`","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","|","}","~",""];class E8{constructor(){this.rsDecoder=new ct(Ne.DATA_MATRIX_FIELD_256)}decode(a){const s=new X0(a),l=s.getVersion(),c=s.readCodewords(),d=Y0.getDataBlocks(c,l);let g=0;for(let b of d)g+=b.getNumDataCodewords();const y=new Uint8Array(g),v=d.length;for(let b=0;by&&(R=y,j[0]=s,j[1]=l,j[2]=c,j[3]=d),R>v&&(R=v,j[0]=l,j[1]=c,j[2]=d,j[3]=s),R>b&&(j[0]=c,j[1]=d,j[2]=s,j[3]=l),j}detectSolid2(a){let s=a[0],l=a[1],c=a[2],d=a[3],g=this.transitionsBetween(s,d),y=Wt.shiftPoint(l,c,(g+1)*4),v=Wt.shiftPoint(c,l,(g+1)*4),b=this.transitionsBetween(y,s),R=this.transitionsBetween(v,d);return bz?R:j}shiftToModuleCenter(a){let s=a[0],l=a[1],c=a[2],d=a[3],g=this.transitionsBetween(s,d)+1,y=this.transitionsBetween(c,d)+1,v=Wt.shiftPoint(s,l,y*4),b=Wt.shiftPoint(c,l,g*4);g=this.transitionsBetween(v,d)+1,y=this.transitionsBetween(b,d)+1,(g&1)===1&&(g+=1),(y&1)===1&&(y+=1);let R=(s.getX()+l.getX()+c.getX()+d.getX())/4,j=(s.getY()+l.getY()+c.getY()+d.getY())/4;s=Wt.moveAway(s,R,j),l=Wt.moveAway(l,R,j),c=Wt.moveAway(c,R,j),d=Wt.moveAway(d,R,j);let L,z;return v=Wt.shiftPoint(s,l,y*4),v=Wt.shiftPoint(v,d,g*4),L=Wt.shiftPoint(l,s,y*4),L=Wt.shiftPoint(L,c,g*4),b=Wt.shiftPoint(c,d,y*4),b=Wt.shiftPoint(b,l,g*4),z=Wt.shiftPoint(d,c,y*4),z=Wt.shiftPoint(z,s,g*4),[v,L,b,z]}isValid(a){return a.getX()>=0&&a.getX()0&&a.getY()Math.abs(d-l);if(y){let G=l;l=c,c=G,G=d,d=g,g=G}let v=Math.abs(d-l),b=Math.abs(g-c),R=-v/2,j=c0){if(Z===g)break;Z+=j,R-=v}}return z}}class Ki{constructor(){this.decoder=new E8}decode(a,s=null){let l,c;if(s!=null&&s.has(I.PURE_BARCODE)){const b=Ki.extractPureBits(a.getBlackMatrix());l=this.decoder.decode(b),c=Ki.NO_POINTS}else{const b=new Wt(a.getBlackMatrix()).detect();l=this.decoder.decode(b.getBits()),c=b.getPoints()}const d=l.getRawBytes(),g=new Pe(l.getText(),d,8*d.length,c,Se.DATA_MATRIX,T.currentTimeMillis()),y=l.getByteSegments();y!=null&&g.putMetadata($e.BYTE_SEGMENTS,y);const v=l.getECLevel();return v!=null&&g.putMetadata($e.ERROR_CORRECTION_LEVEL,v),g}reset(){}static extractPureBits(a){const s=a.getTopLeftOnBit(),l=a.getBottomRightOnBit();if(s==null||l==null)throw new $;const c=this.moduleSize(s,a);let d=s[1];const g=l[1];let y=s[0];const b=(l[0]-y+1)/c,R=(g-d+1)/c;if(b<=0||R<=0)throw new $;const j=c/2;d+=j,y+=j;const L=new J(b,R);for(let z=0;z=bt.FOR_BITS.size)throw new m;return bt.FOR_BITS.get(a)}}bt.FOR_BITS=new Map,bt.FOR_VALUE=new Map,bt.L=new bt(Fo.L,"L",1),bt.M=new bt(Fo.M,"M",0),bt.Q=new bt(Fo.Q,"Q",3),bt.H=new bt(Fo.H,"H",2);class On{constructor(a){this.errorCorrectionLevel=bt.forBits(a>>3&3),this.dataMask=a&7}static numBitsDiffering(a,s){return O.bitCount(a^s)}static decodeFormatInformation(a,s){const l=On.doDecodeFormatInformation(a,s);return l!==null?l:On.doDecodeFormatInformation(a^On.FORMAT_INFO_MASK_QR,s^On.FORMAT_INFO_MASK_QR)}static doDecodeFormatInformation(a,s){let l=Number.MAX_SAFE_INTEGER,c=0;for(const d of On.FORMAT_INFO_DECODE_LOOKUP){const g=d[0];if(g===a||g===s)return new On(d[1]);let y=On.numBitsDiffering(a,g);y40)throw new m;return Me.VERSIONS[a-1]}static decodeVersionInformation(a){let s=Number.MAX_SAFE_INTEGER,l=0;for(let c=0;c6&&(s.setRegion(a-11,0,3,6),s.setRegion(0,a-11,6,3)),s}toString(){return""+this.versionNumber}}Me.VERSION_DECODE_INFO=Int32Array.from([31892,34236,39577,42195,48118,51042,55367,58893,63784,68472,70749,76311,79154,84390,87683,92361,96236,102084,102881,110507,110734,117786,119615,126325,127568,133589,136944,141498,145311,150283,152622,158308,161089,167017]),Me.VERSIONS=[new Me(1,new Int32Array(0),new Q(7,new U(1,19)),new Q(10,new U(1,16)),new Q(13,new U(1,13)),new Q(17,new U(1,9))),new Me(2,Int32Array.from([6,18]),new Q(10,new U(1,34)),new Q(16,new U(1,28)),new Q(22,new U(1,22)),new Q(28,new U(1,16))),new Me(3,Int32Array.from([6,22]),new Q(15,new U(1,55)),new Q(26,new U(1,44)),new Q(18,new U(2,17)),new Q(22,new U(2,13))),new Me(4,Int32Array.from([6,26]),new Q(20,new U(1,80)),new Q(18,new U(2,32)),new Q(26,new U(2,24)),new Q(16,new U(4,9))),new Me(5,Int32Array.from([6,30]),new Q(26,new U(1,108)),new Q(24,new U(2,43)),new Q(18,new U(2,15),new U(2,16)),new Q(22,new U(2,11),new U(2,12))),new Me(6,Int32Array.from([6,34]),new Q(18,new U(2,68)),new Q(16,new U(4,27)),new Q(24,new U(4,19)),new Q(28,new U(4,15))),new Me(7,Int32Array.from([6,22,38]),new Q(20,new U(2,78)),new Q(18,new U(4,31)),new Q(18,new U(2,14),new U(4,15)),new Q(26,new U(4,13),new U(1,14))),new Me(8,Int32Array.from([6,24,42]),new Q(24,new U(2,97)),new Q(22,new U(2,38),new U(2,39)),new Q(22,new U(4,18),new U(2,19)),new Q(26,new U(4,14),new U(2,15))),new Me(9,Int32Array.from([6,26,46]),new Q(30,new U(2,116)),new Q(22,new U(3,36),new U(2,37)),new Q(20,new U(4,16),new U(4,17)),new Q(24,new U(4,12),new U(4,13))),new Me(10,Int32Array.from([6,28,50]),new Q(18,new U(2,68),new U(2,69)),new Q(26,new U(4,43),new U(1,44)),new Q(24,new U(6,19),new U(2,20)),new Q(28,new U(6,15),new U(2,16))),new Me(11,Int32Array.from([6,30,54]),new Q(20,new U(4,81)),new Q(30,new U(1,50),new U(4,51)),new Q(28,new U(4,22),new U(4,23)),new Q(24,new U(3,12),new U(8,13))),new Me(12,Int32Array.from([6,32,58]),new Q(24,new U(2,92),new U(2,93)),new Q(22,new U(6,36),new U(2,37)),new Q(26,new U(4,20),new U(6,21)),new Q(28,new U(7,14),new U(4,15))),new Me(13,Int32Array.from([6,34,62]),new Q(26,new U(4,107)),new Q(22,new U(8,37),new U(1,38)),new Q(24,new U(8,20),new U(4,21)),new Q(22,new U(12,11),new U(4,12))),new Me(14,Int32Array.from([6,26,46,66]),new Q(30,new U(3,115),new U(1,116)),new Q(24,new U(4,40),new U(5,41)),new Q(20,new U(11,16),new U(5,17)),new Q(24,new U(11,12),new U(5,13))),new Me(15,Int32Array.from([6,26,48,70]),new Q(22,new U(5,87),new U(1,88)),new Q(24,new U(5,41),new U(5,42)),new Q(30,new U(5,24),new U(7,25)),new Q(24,new U(11,12),new U(7,13))),new Me(16,Int32Array.from([6,26,50,74]),new Q(24,new U(5,98),new U(1,99)),new Q(28,new U(7,45),new U(3,46)),new Q(24,new U(15,19),new U(2,20)),new Q(30,new U(3,15),new U(13,16))),new Me(17,Int32Array.from([6,30,54,78]),new Q(28,new U(1,107),new U(5,108)),new Q(28,new U(10,46),new U(1,47)),new Q(28,new U(1,22),new U(15,23)),new Q(28,new U(2,14),new U(17,15))),new Me(18,Int32Array.from([6,30,56,82]),new Q(30,new U(5,120),new U(1,121)),new Q(26,new U(9,43),new U(4,44)),new Q(28,new U(17,22),new U(1,23)),new Q(28,new U(2,14),new U(19,15))),new Me(19,Int32Array.from([6,30,58,86]),new Q(28,new U(3,113),new U(4,114)),new Q(26,new U(3,44),new U(11,45)),new Q(26,new U(17,21),new U(4,22)),new Q(26,new U(9,13),new U(16,14))),new Me(20,Int32Array.from([6,34,62,90]),new Q(28,new U(3,107),new U(5,108)),new Q(26,new U(3,41),new U(13,42)),new Q(30,new U(15,24),new U(5,25)),new Q(28,new U(15,15),new U(10,16))),new Me(21,Int32Array.from([6,28,50,72,94]),new Q(28,new U(4,116),new U(4,117)),new Q(26,new U(17,42)),new Q(28,new U(17,22),new U(6,23)),new Q(30,new U(19,16),new U(6,17))),new Me(22,Int32Array.from([6,26,50,74,98]),new Q(28,new U(2,111),new U(7,112)),new Q(28,new U(17,46)),new Q(30,new U(7,24),new U(16,25)),new Q(24,new U(34,13))),new Me(23,Int32Array.from([6,30,54,78,102]),new Q(30,new U(4,121),new U(5,122)),new Q(28,new U(4,47),new U(14,48)),new Q(30,new U(11,24),new U(14,25)),new Q(30,new U(16,15),new U(14,16))),new Me(24,Int32Array.from([6,28,54,80,106]),new Q(30,new U(6,117),new U(4,118)),new Q(28,new U(6,45),new U(14,46)),new Q(30,new U(11,24),new U(16,25)),new Q(30,new U(30,16),new U(2,17))),new Me(25,Int32Array.from([6,32,58,84,110]),new Q(26,new U(8,106),new U(4,107)),new Q(28,new U(8,47),new U(13,48)),new Q(30,new U(7,24),new U(22,25)),new Q(30,new U(22,15),new U(13,16))),new Me(26,Int32Array.from([6,30,58,86,114]),new Q(28,new U(10,114),new U(2,115)),new Q(28,new U(19,46),new U(4,47)),new Q(28,new U(28,22),new U(6,23)),new Q(30,new U(33,16),new U(4,17))),new Me(27,Int32Array.from([6,34,62,90,118]),new Q(30,new U(8,122),new U(4,123)),new Q(28,new U(22,45),new U(3,46)),new Q(30,new U(8,23),new U(26,24)),new Q(30,new U(12,15),new U(28,16))),new Me(28,Int32Array.from([6,26,50,74,98,122]),new Q(30,new U(3,117),new U(10,118)),new Q(28,new U(3,45),new U(23,46)),new Q(30,new U(4,24),new U(31,25)),new Q(30,new U(11,15),new U(31,16))),new Me(29,Int32Array.from([6,30,54,78,102,126]),new Q(30,new U(7,116),new U(7,117)),new Q(28,new U(21,45),new U(7,46)),new Q(30,new U(1,23),new U(37,24)),new Q(30,new U(19,15),new U(26,16))),new Me(30,Int32Array.from([6,26,52,78,104,130]),new Q(30,new U(5,115),new U(10,116)),new Q(28,new U(19,47),new U(10,48)),new Q(30,new U(15,24),new U(25,25)),new Q(30,new U(23,15),new U(25,16))),new Me(31,Int32Array.from([6,30,56,82,108,134]),new Q(30,new U(13,115),new U(3,116)),new Q(28,new U(2,46),new U(29,47)),new Q(30,new U(42,24),new U(1,25)),new Q(30,new U(23,15),new U(28,16))),new Me(32,Int32Array.from([6,34,60,86,112,138]),new Q(30,new U(17,115)),new Q(28,new U(10,46),new U(23,47)),new Q(30,new U(10,24),new U(35,25)),new Q(30,new U(19,15),new U(35,16))),new Me(33,Int32Array.from([6,30,58,86,114,142]),new Q(30,new U(17,115),new U(1,116)),new Q(28,new U(14,46),new U(21,47)),new Q(30,new U(29,24),new U(19,25)),new Q(30,new U(11,15),new U(46,16))),new Me(34,Int32Array.from([6,34,62,90,118,146]),new Q(30,new U(13,115),new U(6,116)),new Q(28,new U(14,46),new U(23,47)),new Q(30,new U(44,24),new U(7,25)),new Q(30,new U(59,16),new U(1,17))),new Me(35,Int32Array.from([6,30,54,78,102,126,150]),new Q(30,new U(12,121),new U(7,122)),new Q(28,new U(12,47),new U(26,48)),new Q(30,new U(39,24),new U(14,25)),new Q(30,new U(22,15),new U(41,16))),new Me(36,Int32Array.from([6,24,50,76,102,128,154]),new Q(30,new U(6,121),new U(14,122)),new Q(28,new U(6,47),new U(34,48)),new Q(30,new U(46,24),new U(10,25)),new Q(30,new U(2,15),new U(64,16))),new Me(37,Int32Array.from([6,28,54,80,106,132,158]),new Q(30,new U(17,122),new U(4,123)),new Q(28,new U(29,46),new U(14,47)),new Q(30,new U(49,24),new U(10,25)),new Q(30,new U(24,15),new U(46,16))),new Me(38,Int32Array.from([6,32,58,84,110,136,162]),new Q(30,new U(4,122),new U(18,123)),new Q(28,new U(13,46),new U(32,47)),new Q(30,new U(48,24),new U(14,25)),new Q(30,new U(42,15),new U(32,16))),new Me(39,Int32Array.from([6,26,54,82,110,138,166]),new Q(30,new U(20,117),new U(4,118)),new Q(28,new U(40,47),new U(7,48)),new Q(30,new U(43,24),new U(22,25)),new Q(30,new U(10,15),new U(67,16))),new Me(40,Int32Array.from([6,30,58,86,114,142,170]),new Q(30,new U(19,118),new U(6,119)),new Q(28,new U(18,47),new U(31,48)),new Q(30,new U(34,24),new U(34,25)),new Q(30,new U(20,15),new U(61,16)))];var cn;(function(D){D[D.DATA_MASK_000=0]="DATA_MASK_000",D[D.DATA_MASK_001=1]="DATA_MASK_001",D[D.DATA_MASK_010=2]="DATA_MASK_010",D[D.DATA_MASK_011=3]="DATA_MASK_011",D[D.DATA_MASK_100=4]="DATA_MASK_100",D[D.DATA_MASK_101=5]="DATA_MASK_101",D[D.DATA_MASK_110=6]="DATA_MASK_110",D[D.DATA_MASK_111=7]="DATA_MASK_111"})(cn||(cn={}));class xr{constructor(a,s){this.value=a,this.isMasked=s}unmaskBitMatrix(a,s){for(let l=0;l(D+a&1)===0)],[cn.DATA_MASK_001,new xr(cn.DATA_MASK_001,(D,a)=>(D&1)===0)],[cn.DATA_MASK_010,new xr(cn.DATA_MASK_010,(D,a)=>a%3===0)],[cn.DATA_MASK_011,new xr(cn.DATA_MASK_011,(D,a)=>(D+a)%3===0)],[cn.DATA_MASK_100,new xr(cn.DATA_MASK_100,(D,a)=>(Math.floor(D/2)+Math.floor(a/3)&1)===0)],[cn.DATA_MASK_101,new xr(cn.DATA_MASK_101,(D,a)=>D*a%6===0)],[cn.DATA_MASK_110,new xr(cn.DATA_MASK_110,(D,a)=>D*a%6<3)],[cn.DATA_MASK_111,new xr(cn.DATA_MASK_111,(D,a)=>(D+a+D*a%3&1)===0)]]);class O8{constructor(a){const s=a.getHeight();if(s<21||(s&3)!==1)throw new k;this.bitMatrix=a}readFormatInformation(){if(this.parsedFormatInfo!==null&&this.parsedFormatInfo!==void 0)return this.parsedFormatInfo;let a=0;for(let d=0;d<6;d++)a=this.copyBit(d,8,a);a=this.copyBit(7,8,a),a=this.copyBit(8,8,a),a=this.copyBit(8,7,a);for(let d=5;d>=0;d--)a=this.copyBit(8,d,a);const s=this.bitMatrix.getHeight();let l=0;const c=s-7;for(let d=s-1;d>=c;d--)l=this.copyBit(8,d,l);for(let d=s-8;d=0;g--)for(let y=a-9;y>=c;y--)l=this.copyBit(y,g,l);let d=Me.decodeVersionInformation(l);if(d!==null&&d.getDimensionForVersion()===a)return this.parsedVersion=d,d;l=0;for(let g=5;g>=0;g--)for(let y=a-9;y>=c;y--)l=this.copyBit(g,y,l);if(d=Me.decodeVersionInformation(l),d!==null&&d.getDimensionForVersion()===a)return this.parsedVersion=d,d;throw new k}copyBit(a,s,l){return(this.isMirror?this.bitMatrix.get(s,a):this.bitMatrix.get(a,s))?l<<1|1:l<<1}readCodewords(){const a=this.readFormatInformation(),s=this.readVersion(),l=xr.values.get(a.getDataMask()),c=this.bitMatrix.getHeight();l.unmaskBitMatrix(this.bitMatrix,c);const d=s.buildFunctionPattern();let g=!0;const y=new Uint8Array(s.getTotalCodewords());let v=0,b=0,R=0;for(let j=c-1;j>0;j-=2){j===6&&j--;for(let L=0;L=0&&y[R].codewords.length!==b;)R--;R++;const j=b-c.getECCodewordsPerBlock();let L=0;for(let V=0;Va.available())throw new k;const c=new Uint8Array(2*l);let d=0;for(;l>0;){const g=a.readBits(13);let y=g/96<<8&4294967295|g%96;y<959?y+=41377:y+=42657,c[d]=y>>8&255,c[d+1]=y&255,d+=2,l--}try{s.append(K.decode(c,H.GB2312))}catch(g){throw new k(g)}}static decodeKanjiSegment(a,s,l){if(l*13>a.available())throw new k;const c=new Uint8Array(2*l);let d=0;for(;l>0;){const g=a.readBits(13);let y=g/192<<8&4294967295|g%192;y<7936?y+=33088:y+=49472,c[d]=y>>8,c[d+1]=y,d+=2,l--}try{s.append(K.decode(c,H.SHIFT_JIS))}catch(g){throw new k(g)}}static decodeByteSegment(a,s,l,c,d,g){if(8*l>a.available())throw new k;const y=new Uint8Array(l);for(let b=0;b=Rt.ALPHANUMERIC_CHARS.length)throw new k;return Rt.ALPHANUMERIC_CHARS[a]}static decodeAlphanumericSegment(a,s,l,c){const d=s.length();for(;l>1;){if(a.available()<11)throw new k;const g=a.readBits(11);s.append(Rt.toAlphaNumericChar(Math.floor(g/45))),s.append(Rt.toAlphaNumericChar(g%45)),l-=2}if(l===1){if(a.available()<6)throw new k;s.append(Rt.toAlphaNumericChar(a.readBits(6)))}if(c)for(let g=d;g=3;){if(a.available()<10)throw new k;const c=a.readBits(10);if(c>=1e3)throw new k;s.append(Rt.toAlphaNumericChar(Math.floor(c/100))),s.append(Rt.toAlphaNumericChar(Math.floor(c/10)%10)),s.append(Rt.toAlphaNumericChar(c%10)),l-=3}if(l===2){if(a.available()<7)throw new k;const c=a.readBits(7);if(c>=100)throw new k;s.append(Rt.toAlphaNumericChar(Math.floor(c/10))),s.append(Rt.toAlphaNumericChar(c%10))}else if(l===1){if(a.available()<4)throw new k;const c=a.readBits(4);if(c>=10)throw new k;s.append(Rt.toAlphaNumericChar(c))}}static parseECIValue(a){const s=a.readBits(8);if(!(s&128))return s&127;if((s&192)===128){const l=a.readBits(8);return(s&63)<<8&4294967295|l}if((s&224)===192){const l=a.readBits(16);return(s&31)<<16&4294967295|l}throw new k}}Rt.ALPHANUMERIC_CHARS="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:",Rt.GB2312_SUBSET=1;class pv{constructor(a){this.mirrored=a}isMirrored(){return this.mirrored}applyMirroredCorrection(a){if(!this.mirrored||a===null||a.length<3)return;const s=a[0];a[0]=a[2],a[2]=s}}class _8{constructor(){this.rsDecoder=new ct(Ne.QR_CODE_FIELD_256)}decodeBooleanArray(a,s){return this.decodeBitMatrix(J.parseFromBooleanArray(a),s)}decodeBitMatrix(a,s){const l=new O8(a);let c=null;try{return this.decodeBitMatrixParser(l,s)}catch(d){c=d}try{l.remask(),l.setMirror(!0),l.readVersion(),l.readFormatInformation(),l.mirror();const d=this.decodeBitMatrixParser(l,s);return d.setOther(new pv(!0)),d}catch(d){throw c!==null?c:d}}decodeBitMatrixParser(a,s){const l=a.readVersion(),c=a.readFormatInformation().getErrorCorrectionLevel(),d=a.readCodewords(),g=K0.getDataBlocks(d,l,c);let y=0;for(const R of g)y+=R.getNumDataCodewords();const v=new Uint8Array(y);let b=0;for(const R of g){const j=R.getCodewords(),L=R.getNumDataCodewords();this.correctErrors(j,L);for(let z=0;z=l)return!1;return!0}crossCheckVertical(a,s,l,c){const d=this.image,g=d.getHeight(),y=this.crossCheckStateCount;y[0]=0,y[1]=0,y[2]=0;let v=a;for(;v>=0&&d.get(s,v)&&y[1]<=l;)y[1]++,v--;if(v<0||y[1]>l)return NaN;for(;v>=0&&!d.get(s,v)&&y[0]<=l;)y[0]++,v--;if(y[0]>l)return NaN;for(v=a+1;vl)return NaN;for(;vl)return NaN;const b=y[0]+y[1]+y[2];return 5*Math.abs(b-c)>=2*c?NaN:this.foundPatternCross(y)?qc.centerFromEnd(y,v):NaN}handlePossibleCenter(a,s,l){const c=a[0]+a[1]+a[2],d=qc.centerFromEnd(a,l),g=this.crossCheckVertical(s,d,2*a[1],c);if(!isNaN(g)){const y=(a[0]+a[1]+a[2])/3;for(const b of this.possibleCenters)if(b.aboutEquals(y,g,d))return b.combineEstimate(g,d,y);const v=new Z0(d,g,y);this.possibleCenters.push(v),this.resultPointCallback!==null&&this.resultPointCallback!==void 0&&this.resultPointCallback.foundPossibleResultPoint(v)}return null}}class Q0 extends be{constructor(a,s,l,c){super(a,s),this.estimatedModuleSize=l,this.count=c,c===void 0&&(this.count=1)}getEstimatedModuleSize(){return this.estimatedModuleSize}getCount(){return this.count}aboutEquals(a,s,l){if(Math.abs(s-this.getY())<=a&&Math.abs(l-this.getX())<=a){const c=Math.abs(a-this.estimatedModuleSize);return c<=1||c<=this.estimatedModuleSize}return!1}combineEstimate(a,s,l){const c=this.count+1,d=(this.count*this.getX()+s)/c,g=(this.count*this.getY()+a)/c,y=(this.count*this.estimatedModuleSize+l)/c;return new Q0(d,g,y,c)}}class T8{constructor(a){this.bottomLeft=a[0],this.topLeft=a[1],this.topRight=a[2]}getBottomLeft(){return this.bottomLeft}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}}class fn{constructor(a,s){this.image=a,this.resultPointCallback=s,this.possibleCenters=[],this.crossCheckStateCount=new Int32Array(5),this.resultPointCallback=s}getImage(){return this.image}getPossibleCenters(){return this.possibleCenters}find(a){const s=a!=null&&a.get(I.TRY_HARDER)!==void 0,l=a!=null&&a.get(I.PURE_BARCODE)!==void 0,c=this.image,d=c.getHeight(),g=c.getWidth();let y=Math.floor(3*d/(4*fn.MAX_MODULES));(yb[2]&&(j+=G-b[2]-y,z=g-1)}else{b[0]=b[2],b[1]=b[3],b[2]=b[4],b[3]=1,b[4]=0,L=3;continue}L=0,b[0]=0,b[1]=0,b[2]=0,b[3]=0,b[4]=0}else b[0]=b[2],b[1]=b[3],b[2]=b[4],b[3]=1,b[4]=0,L=3;else b[++L]++;fn.foundPatternCross(b)&&this.handlePossibleCenter(b,j,g,l)===!0&&(y=b[0],this.hasSkipped&&(v=this.haveMultiplyConfirmedCenters()))}const R=this.selectBestPatterns();return be.orderBestPatterns(R),new T8(R)}static centerFromEnd(a,s){return s-a[4]-a[3]-a[2]/2}static foundPatternCross(a){let s=0;for(let d=0;d<5;d++){const g=a[d];if(g===0)return!1;s+=g}if(s<7)return!1;const l=s/7,c=l/2;return Math.abs(l-a[0])=g&&s>=g&&y.get(s-g,a-g);)d[2]++,g++;if(a=g&&s>=g&&!y.get(s-g,a-g)&&d[1]<=l;)d[1]++,g++;if(al)return!1;for(;a>=g&&s>=g&&y.get(s-g,a-g)&&d[0]<=l;)d[0]++,g++;if(d[0]>l)return!1;const v=y.getHeight(),b=y.getWidth();for(g=1;a+g=v||s+g>=b)return!1;for(;a+g=v||s+g>=b||d[3]>=l)return!1;for(;a+g=l)return!1;const R=d[0]+d[1]+d[2]+d[3]+d[4];return Math.abs(R-c)<2*c&&fn.foundPatternCross(d)}crossCheckVertical(a,s,l,c){const d=this.image,g=d.getHeight(),y=this.getCrossCheckStateCount();let v=a;for(;v>=0&&d.get(s,v);)y[2]++,v--;if(v<0)return NaN;for(;v>=0&&!d.get(s,v)&&y[1]<=l;)y[1]++,v--;if(v<0||y[1]>l)return NaN;for(;v>=0&&d.get(s,v)&&y[0]<=l;)y[0]++,v--;if(y[0]>l)return NaN;for(v=a+1;v=l)return NaN;for(;v=l)return NaN;const b=y[0]+y[1]+y[2]+y[3]+y[4];return 5*Math.abs(b-c)>=2*c?NaN:fn.foundPatternCross(y)?fn.centerFromEnd(y,v):NaN}crossCheckHorizontal(a,s,l,c){const d=this.image,g=d.getWidth(),y=this.getCrossCheckStateCount();let v=a;for(;v>=0&&d.get(v,s);)y[2]++,v--;if(v<0)return NaN;for(;v>=0&&!d.get(v,s)&&y[1]<=l;)y[1]++,v--;if(v<0||y[1]>l)return NaN;for(;v>=0&&d.get(v,s)&&y[0]<=l;)y[0]++,v--;if(y[0]>l)return NaN;for(v=a+1;v=l)return NaN;for(;v=l)return NaN;const b=y[0]+y[1]+y[2]+y[3]+y[4];return 5*Math.abs(b-c)>=c?NaN:fn.foundPatternCross(y)?fn.centerFromEnd(y,v):NaN}handlePossibleCenter(a,s,l,c){const d=a[0]+a[1]+a[2]+a[3]+a[4];let g=fn.centerFromEnd(a,l),y=this.crossCheckVertical(s,Math.floor(g),a[2],d);if(!isNaN(y)&&(g=this.crossCheckHorizontal(Math.floor(g),Math.floor(y),a[2],d),!isNaN(g)&&(!c||this.crossCheckDiagonal(Math.floor(y),Math.floor(g),a[2],d)))){const v=d/7;let b=!1;const R=this.possibleCenters;for(let j=0,L=R.length;j=fn.CENTER_QUORUM)if(s==null)s=l;else return this.hasSkipped=!0,Math.floor((Math.abs(s.getX()-l.getX())-Math.abs(s.getY()-l.getY()))/2);return 0}haveMultiplyConfirmedCenters(){let a=0,s=0;const l=this.possibleCenters.length;for(const g of this.possibleCenters)g.getCount()>=fn.CENTER_QUORUM&&(a++,s+=g.getEstimatedModuleSize());if(a<3)return!1;const c=s/l;let d=0;for(const g of this.possibleCenters)d+=Math.abs(g.getEstimatedModuleSize()-c);return d<=.05*s}selectBestPatterns(){const a=this.possibleCenters.length;if(a<3)throw new $;const s=this.possibleCenters;let l;if(a>3){let c=0,d=0;for(const v of this.possibleCenters){const b=v.getEstimatedModuleSize();c+=b,d+=b*b}l=c/a;let g=Math.sqrt(d/a-l*l);s.sort((v,b)=>{const R=Math.abs(b.getEstimatedModuleSize()-l),j=Math.abs(v.getEstimatedModuleSize()-l);return Rj?1:0});const y=Math.max(.2*l,g);for(let v=0;v3;v++){const b=s[v];Math.abs(b.getEstimatedModuleSize()-l)>y&&(s.splice(v,1),v--)}}if(s.length>3){let c=0;for(const d of s)c+=d.getEstimatedModuleSize();l=c/s.length,s.sort((d,g)=>{if(g.getCount()===d.getCount()){const y=Math.abs(g.getEstimatedModuleSize()-l),v=Math.abs(d.getEstimatedModuleSize()-l);return yv?-1:0}else return g.getCount()-d.getCount()}),s.splice(3)}return[s[0],s[1],s[2]]}}fn.CENTER_QUORUM=2,fn.MIN_SKIP=3,fn.MAX_MODULES=57;class Sl{constructor(a){this.image=a}getImage(){return this.image}getResultPointCallback(){return this.resultPointCallback}detect(a){this.resultPointCallback=a==null?null:a.get(I.NEED_RESULT_POINT_CALLBACK);const l=new fn(this.image,this.resultPointCallback).find(a);return this.processFinderPatternInfo(l)}processFinderPatternInfo(a){const s=a.getTopLeft(),l=a.getTopRight(),c=a.getBottomLeft(),d=this.calculateModuleSize(s,l,c);if(d<1)throw new $("No pattern found in proccess finder.");const g=Sl.computeDimension(s,l,c,d),y=Me.getProvisionalVersionForDimension(g),v=y.getDimensionForVersion()-7;let b=null;if(y.getAlignmentPatternCenters().length>0){const z=l.getX()-s.getX()+c.getX(),V=l.getY()-s.getY()+c.getY(),G=1-3/v,Z=Math.floor(s.getX()+G*(z-s.getX())),ae=Math.floor(s.getY()+G*(V-s.getY()));for(let pe=4;pe<=16;pe<<=1)try{b=this.findAlignmentInRegion(d,Z,ae,pe);break}catch(ge){if(!(ge instanceof $))throw ge}}const R=Sl.createTransform(s,l,c,b,g),j=Sl.sampleGrid(this.image,R,g);let L;return b===null?L=[c,s,l]:L=[c,s,l,b],new jn(j,L)}static createTransform(a,s,l,c,d){const g=d-3.5;let y,v,b,R;return c!==null?(y=c.getX(),v=c.getY(),b=g-3,R=b):(y=s.getX()-a.getX()+l.getX(),v=s.getY()-a.getY()+l.getY(),b=g,R=g),Fr.quadrilateralToQuadrilateral(3.5,3.5,g,3.5,b,R,3.5,g,a.getX(),a.getY(),s.getX(),s.getY(),y,v,l.getX(),l.getY())}static sampleGrid(a,s,l){return Xi.getInstance().sampleGridWithTransform(a,l,l,s)}static computeDimension(a,s,l,c){const d=Ie.round(be.distance(a,s)/c),g=Ie.round(be.distance(a,l)/c);let y=Math.floor((d+g)/2)+7;switch(y&3){case 0:y++;break;case 2:y--;break;case 3:throw new $("Dimensions could be not found.")}return y}calculateModuleSize(a,s,l){return(this.calculateModuleSizeOneWay(a,s)+this.calculateModuleSizeOneWay(a,l))/2}calculateModuleSizeOneWay(a,s){const l=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(a.getX()),Math.floor(a.getY()),Math.floor(s.getX()),Math.floor(s.getY())),c=this.sizeOfBlackWhiteBlackRunBothWays(Math.floor(s.getX()),Math.floor(s.getY()),Math.floor(a.getX()),Math.floor(a.getY()));return isNaN(l)?c/7:isNaN(c)?l/7:(l+c)/14}sizeOfBlackWhiteBlackRunBothWays(a,s,l,c){let d=this.sizeOfBlackWhiteBlackRun(a,s,l,c),g=1,y=a-(l-a);y<0?(g=a/(a-y),y=0):y>=this.image.getWidth()&&(g=(this.image.getWidth()-1-a)/(y-a),y=this.image.getWidth()-1);let v=Math.floor(s-(c-s)*g);return g=1,v<0?(g=s/(s-v),v=0):v>=this.image.getHeight()&&(g=(this.image.getHeight()-1-s)/(v-s),v=this.image.getHeight()-1),y=Math.floor(a+(y-a)*g),d+=this.sizeOfBlackWhiteBlackRun(a,s,y,v),d-1}sizeOfBlackWhiteBlackRun(a,s,l,c){const d=Math.abs(c-s)>Math.abs(l-a);if(d){let z=a;a=s,s=z,z=l,l=c,c=z}const g=Math.abs(l-a),y=Math.abs(c-s);let v=-g/2;const b=a0){if(V===c)break;V+=R,v-=g}}return j===2?Ie.distance(l+b,c,a,s):NaN}findAlignmentInRegion(a,s,l,c){const d=Math.floor(c*a),g=Math.max(0,s-d),y=Math.min(this.image.getWidth()-1,s+d);if(y-g=v||d>=g)throw new $;if(g-d!==v-y&&(v=y+(g-d),v>=a.getWidth()))throw new $;const b=Math.round((v-y+1)/c),R=Math.round((g-d+1)/c);if(b<=0||R<=0)throw new $;if(R!==b)throw new $;const j=Math.floor(c/2);d+=j,y+=j;const L=y+Math.floor((b-1)*c)-v;if(L>0){if(L>j)throw new $;y-=L}const z=d+Math.floor((R-1)*c)-g;if(z>0){if(z>j)throw new $;d-=z}const V=new J(b,R);for(let G=0;G0;){const L=He.findGuardPattern(a,d,--c,l,!1,g,b);if(L!=null)j=L;else{c++;break}}y[0]=new be(j[0],c),y[1]=new be(j[1],c),v=!0;break}}let R=c+1;if(v){let j=0,L=Int32Array.from([Math.trunc(y[0].getX()),Math.trunc(y[1].getX())]);for(;RHe.SKIPPED_ROW_COUNT_MAX)break;j++}}R-=j+1,y[2]=new be(L[0],R),y[3]=new be(L[1],R)}return R-c0&&b++j?R-j:j-R;if(L>l)return 1/0;v+=L}return v/d}}He.INDEXES_START_PATTERN=Int32Array.from([0,4,1,5]),He.INDEXES_STOP_PATTERN=Int32Array.from([6,2,7,3]),He.MAX_AVG_VARIANCE=.42,He.MAX_INDIVIDUAL_VARIANCE=.8,He.START_PATTERN=Int32Array.from([8,1,1,1,1,1,1,3]),He.STOP_PATTERN=Int32Array.from([7,1,1,3,1,1,1,2,1]),He.MAX_PIXEL_DRIFT=3,He.MAX_PATTERN_DRIFT=5,He.SKIPPED_ROW_COUNT_MAX=25,He.ROW_STEP=5,He.BARCODE_MIN_HEIGHT=10;class yn{constructor(a,s){if(s.length===0)throw new m;this.field=a;let l=s.length;if(l>1&&s[0]===0){let c=1;for(;cl.length){let g=s;s=l,l=g}let c=new Int32Array(l.length),d=l.length-s.length;T.arraycopy(l,0,c,0,d);for(let g=d;g=0;s--){let l=this.getCoefficient(s);l!==0&&(l<0?(a.append(" - "),l=-l):a.length()>0&&a.append(" + "),(s===0||l!==1)&&a.append(l),s!==0&&(s===1?a.append("x"):(a.append("x^"),a.append(s))))}return a.toString()}}class I8{add(a,s){return(a+s)%this.modulus}subtract(a,s){return(this.modulus+a-s)%this.modulus}exp(a){return this.expTable[a]}log(a){if(a===0)throw new m;return this.logTable[a]}inverse(a){if(a===0)throw new ce;return this.expTable[this.modulus-this.logTable[a]-1]}multiply(a,s){return a===0||s===0?0:this.expTable[(this.logTable[a]+this.logTable[s])%(this.modulus-1)]}getSize(){return this.modulus}equals(a){return a===this}}class J0 extends I8{constructor(a,s){super(),this.modulus=a,this.expTable=new Int32Array(a),this.logTable=new Int32Array(a);let l=1;for(let c=0;c0;V--){let G=c.evaluateAt(this.field.exp(V));d[s-V]=G,G!==0&&(g=!0)}if(!g)return 0;let y=this.field.getOne();if(l!=null)for(const V of l){let G=this.field.exp(a.length-1-V),Z=new yn(this.field,new Int32Array([this.field.subtract(0,G),1]));y=y.multiply(Z)}let v=new yn(this.field,d),b=this.runEuclideanAlgorithm(this.field.buildMonomial(s,1),v,s),R=b[0],j=b[1],L=this.findErrorLocations(R),z=this.findErrorMagnitudes(j,R,L);for(let V=0;V=Math.round(l/2);){let L=c,z=g;if(c=d,g=y,c.isZero())throw A.getChecksumInstance();d=L;let V=this.field.getZero(),G=c.getCoefficient(c.getDegree()),Z=this.field.inverse(G);for(;d.getDegree()>=c.getDegree()&&!d.isZero();){let ae=d.getDegree()-c.getDegree(),pe=this.field.multiply(d.getCoefficient(d.getDegree()),Z);V=V.add(this.field.buildMonomial(ae,pe)),d=d.subtract(c.multiplyByMonomial(ae,pe))}y=V.multiply(g).subtract(z).negative()}let v=y.getCoefficient(0);if(v===0)throw A.getChecksumInstance();let b=this.field.inverse(v),R=y.multiply(b),j=d.multiply(b);return[R,j]}findErrorLocations(a){let s=a.getDegree(),l=new Int32Array(s),c=0;for(let d=1;d0){let v=l?this.topLeft:this.topRight,b=Math.trunc(v.getY()-a);b<0&&(b=0);let R=new be(v.getX(),b);l?c=R:g=R}if(s>0){let v=l?this.bottomLeft:this.bottomRight,b=Math.trunc(v.getY()+s);b>=this.image.getHeight()&&(b=this.image.getHeight()-1);let R=new be(v.getX(),b);l?d=R:y=R}return new Fa(this.image,c,d,g,y)}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getTopLeft(){return this.topLeft}getTopRight(){return this.topRight}getBottomLeft(){return this.bottomLeft}getBottomRight(){return this.bottomRight}}class P8{constructor(a,s,l,c){this.columnCount=a,this.errorCorrectionLevel=c,this.rowCountUpperPart=s,this.rowCountLowerPart=l,this.rowCount=s+l}getColumnCount(){return this.columnCount}getErrorCorrectionLevel(){return this.errorCorrectionLevel}getRowCount(){return this.rowCount}getRowCountUpperPart(){return this.rowCountUpperPart}getRowCountLowerPart(){return this.rowCountLowerPart}}class El{constructor(){this.buffer=""}static form(a,s){let l=-1;function c(g,y,v,b,R,j){if(g==="%%")return"%";if(s[++l]===void 0)return;g=b?parseInt(b.substr(1)):void 0;let L=R?parseInt(R.substr(1)):void 0,z;switch(j){case"s":z=s[l];break;case"c":z=s[l][0];break;case"f":z=parseFloat(s[l]).toFixed(g);break;case"p":z=parseFloat(s[l]).toPrecision(g);break;case"e":z=parseFloat(s[l]).toExponential(g);break;case"x":z=parseInt(s[l]).toString(L||16);break;case"d":z=parseFloat(parseInt(s[l],L||10).toPrecision(g)).toFixed(0);break}z=typeof z=="object"?JSON.stringify(z):(+z).toString(L);let V=parseInt(v),G=v&&v[0]+""=="0"?"0":" ";for(;z.length=0&&(s=this.codewords[c],s!=null)||(c=this.imageRowToCodewordIndex(a)+l,cl,getValue:()=>c};d.getValue()>a?(a=d.getValue(),s=[],s.push(d.getKey())):d.getValue()===a&&s.push(d.getKey())}return Fe.toIntArray(s)}getConfidence(a){return this.values.get(a)}}class mv extends Cl{constructor(a,s){super(a),this._isLeft=s}setRowNumbers(){for(let a of this.getCodewords())a!=null&&a.setRowNumberAsRowIndicatorColumn()}adjustCompleteIndicatorColumnRowNumbers(a){let s=this.getCodewords();this.setRowNumbers(),this.removeIncorrectCodewords(s,a);let l=this.getBoundingBox(),c=this._isLeft?l.getTopLeft():l.getTopRight(),d=this._isLeft?l.getBottomLeft():l.getBottomRight(),g=this.imageRowToCodewordIndex(Math.trunc(c.getY())),y=this.imageRowToCodewordIndex(Math.trunc(d.getY())),v=-1,b=1,R=0;for(let j=g;j=a.getRowCount()||z>j)s[j]=null;else{let V;b>2?V=(b-2)*z:V=z;let G=V>=j;for(let Z=1;Z<=V&&!G;Z++)G=s[j-Z]!=null;G?s[j]=null:(v=L.getRowNumber(),R=1)}}}getRowHeights(){let a=this.getBarcodeMetadata();if(a==null)return null;this.adjustIncompleteIndicatorColumnRowNumbers(a);let s=new Int32Array(a.getRowCount());for(let l of this.getCodewords())if(l!=null){let c=l.getRowNumber();if(c>=s.length)continue;s[c]++}return s}adjustIncompleteIndicatorColumnRowNumbers(a){let s=this.getBoundingBox(),l=this._isLeft?s.getTopLeft():s.getTopRight(),c=this._isLeft?s.getBottomLeft():s.getBottomRight(),d=this.imageRowToCodewordIndex(Math.trunc(l.getY())),g=this.imageRowToCodewordIndex(Math.trunc(c.getY())),y=this.getCodewords(),v=-1;for(let b=d;b=a.getRowCount()?y[b]=null:v=R.getRowNumber())}}getBarcodeMetadata(){let a=this.getCodewords(),s=new Ol,l=new Ol,c=new Ol,d=new Ol;for(let y of a){if(y==null)continue;y.setRowNumberAsRowIndicatorColumn();let v=y.getValue()%30,b=y.getRowNumber();switch(this._isLeft||(b+=2),b%3){case 0:l.setValue(v*3+1);break;case 1:d.setValue(v/3),c.setValue(v%3);break;case 2:s.setValue(v+1);break}}if(s.getValue().length===0||l.getValue().length===0||c.getValue().length===0||d.getValue().length===0||s.getValue()[0]<1||l.getValue()[0]+c.getValue()[0]Fe.MAX_ROWS_IN_BARCODE)return null;let g=new P8(s.getValue()[0],l.getValue()[0],c.getValue()[0],d.getValue()[0]);return this.removeIncorrectCodewords(a,g),g}removeIncorrectCodewords(a,s){for(let l=0;ls.getRowCount()){a[l]=null;continue}switch(this._isLeft||(g+=2),g%3){case 0:d*3+1!==s.getRowCountUpperPart()&&(a[l]=null);break;case 1:(Math.trunc(d/3)!==s.getErrorCorrectionLevel()||d%3!==s.getRowCountLowerPart())&&(a[l]=null);break;case 2:d+1!==s.getColumnCount()&&(a[l]=null);break}}}isLeft(){return this._isLeft}toString(){return"IsLeft: "+this._isLeft+` `+super.toString()}}class _l{constructor(a,s){this.ADJUST_ROW_NUMBER_SKIP=2,this.barcodeMetadata=a,this.barcodeColumnCount=a.getColumnCount(),this.boundingBox=s,this.detectionResultColumns=new Array(this.barcodeColumnCount+2)}getDetectionResultColumns(){this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[0]),this.adjustIndicatorColumnRowNumbers(this.detectionResultColumns[this.barcodeColumnCount+1]);let a=Fe.MAX_CODEWORDS_IN_BARCODE,s;do s=a,a=this.adjustRowNumbersAndGetCount();while(a>0&&a0&&d0&&(y[0]=l[s-1],y[4]=d[s-1],y[5]=g[s-1]),s>1&&(y[8]=l[s-2],y[10]=d[s-2],y[11]=g[s-2]),s>=1;l=s&1,Gn.RATIOS_TABLE[a]||(Gn.RATIOS_TABLE[a]=new Array(Fe.BARS_IN_MODULE)),Gn.RATIOS_TABLE[a][Fe.BARS_IN_MODULE-c-1]=Math.fround(d/Fe.MODULES_IN_CODEWORD)}}this.bSymbolTableReady=!0}static getDecodedValue(a){let s=Gn.getDecodedCodewordValue(Gn.sampleBitCounts(a));return s!==-1?s:Gn.getClosestDecodedValue(a)}static sampleBitCounts(a){let s=Ie.sum(a),l=new Int32Array(Fe.BARS_IN_MODULE),c=0,d=0;for(let g=0;g1)for(let g=0;g=c)break}ynew Array(Fe.BARS_IN_MODULE));class yv{constructor(){this.segmentCount=-1,this.fileSize=-1,this.timestamp=-1,this.checksum=-1}getSegmentIndex(){return this.segmentIndex}setSegmentIndex(a){this.segmentIndex=a}getFileId(){return this.fileId}setFileId(a){this.fileId=a}getOptionalData(){return this.optionalData}setOptionalData(a){this.optionalData=a}isLastSegment(){return this.lastSegment}setLastSegment(a){this.lastSegment=a}getSegmentCount(){return this.segmentCount}setSegmentCount(a){this.segmentCount=a}getSender(){return this.sender||null}setSender(a){this.sender=a}getAddressee(){return this.addressee||null}setAddressee(a){this.addressee=a}getFileName(){return this.fileName}setFileName(a){this.fileName=a}getFileSize(){return this.fileSize}setFileSize(a){this.fileSize=a}getChecksum(){return this.checksum}setChecksum(a){this.checksum=a}getTimestamp(){return this.timestamp}setTimestamp(a){this.timestamp=a}}class xv{static parseLong(a,s=void 0){return parseInt(a,s)}}class vv extends p{}vv.kind="NullPointerException";class R8{writeBytes(a){this.writeBytesOffset(a,0,a.length)}writeBytesOffset(a,s,l){if(a==null)throw new vv;if(s<0||s>a.length||l<0||s+l>a.length||s+l<0)throw new N;if(l===0)return;for(let c=0;c0&&this.grow(a)}grow(a){let l=this.buf.length<<1;if(l-a<0&&(l=a),l<0){if(a<0)throw new M8;l=O.MAX_VALUE}this.buf=C.copyOfUint8Array(this.buf,l)}write(a){this.ensureCapacity(this.count+1),this.buf[this.count]=a,this.count+=1}writeBytesOffset(a,s,l){if(s<0||s>a.length||l<0||s+l-a.length>0)throw new N;this.ensureCapacity(this.count+l),T.arraycopy(a,s,this.buf,this.count,l),this.count+=l}writeTo(a){a.writeBytesOffset(this.buf,0,this.count)}reset(){this.count=0}toByteArray(){return C.copyOfUint8Array(this.buf,this.count)}size(){return this.count}toString(a){return a?typeof a=="string"?this.toString_string(a):this.toString_number(a):this.toString_void()}toString_void(){return new String(this.buf).toString()}toString_string(a){return new String(this.buf).toString()}toString_number(a){return new String(this.buf).toString()}close(){}}var pt;(function(D){D[D.ALPHA=0]="ALPHA",D[D.LOWER=1]="LOWER",D[D.MIXED=2]="MIXED",D[D.PUNCT=3]="PUNCT",D[D.ALPHA_SHIFT=4]="ALPHA_SHIFT",D[D.PUNCT_SHIFT=5]="PUNCT_SHIFT"})(pt||(pt={}));function wv(){if(typeof window<"u")return window.BigInt||null;if(typeof Si<"u")return Si.BigInt||null;if(typeof self<"u")return self.BigInt||null;throw new Error("Can't search globals for BigInt!")}let Kc;function Qi(D){if(typeof Kc>"u"&&(Kc=wv()),Kc===null)throw new Error("BigInt is not supported!");return Kc(D)}function D8(){let D=[];D[0]=Qi(1);let a=Qi(900);D[1]=a;for(let s=2;s<16;s++)D[s]=D[s-1]*a;return D}class ie{static decode(a,s){let l=new ne(""),c=F.ISO8859_1;l.enableDecoding(c);let d=1,g=a[d++],y=new yv;for(;da[0])throw k.getFormatInstance();let c=new Int32Array(ie.NUMBER_OF_SEQUENCE_CODEWORDS);for(let y=0;y0){for(let L=0;L<6;++L)g.write(Number(Qi(v)>>Qi(8*(5-L))));v=0,y=0}break}c===s[0]&&j0){for(let z=0;z<6;++z)g.write(Number(Qi(v)>>Qi(8*(5-z))));v=0,y=0}}break}return d.append(K.decode(g.toByteArray(),l)),c}static numericCompaction(a,s,l){let c=0,d=!1,g=new Int32Array(ie.MAX_NUMERIC_CODEWORDS);for(;s0&&(l.append(ie.decodeBase900toBase10(g,c)),c=0)}return s}static decodeBase900toBase10(a,s){let l=Qi(0);for(let d=0;d@[\\]_\`~!\r ,: -.$/"|*()?{}'`,ie.MIXED_CHARS="0123456789&\r ,:#-.$/+%*=^",ie.EXP900=wv()?D8():[],ie.NUMBER_OF_SEQUENCE_CODEWORDS=2;class Ve{constructor(){}static decode(a,s,l,c,d,g,y){let v=new Fa(a,s,l,c,d),b=null,R=null,j;for(let V=!0;;V=!1){if(s!=null&&(b=Ve.getRowIndicatorColumn(a,v,s,!0,g,y)),c!=null&&(R=Ve.getRowIndicatorColumn(a,v,c,!1,g,y)),j=Ve.merge(b,R),j==null)throw $.getNotFoundInstance();let G=j.getBoundingBox();if(V&&G!=null&&(G.getMinY()v.getMaxY()))v=G;else break}j.setBoundingBox(v);let L=j.getBarcodeColumnCount()+1;j.setDetectionResultColumn(0,b),j.setDetectionResultColumn(L,R);let z=b!=null;for(let V=1;V<=L;V++){let G=z?V:L-V;if(j.getDetectionResultColumn(G)!==void 0)continue;let Z;G===0||G===L?Z=new mv(v,G===0):Z=new Cl(v),j.setDetectionResultColumn(G,Z);let ae=-1,pe=ae;for(let ge=v.getMinY();ge<=v.getMaxY();ge++){if(ae=Ve.getStartColumn(j,G,ge,z),ae<0||ae>v.getMaxX()){if(pe===-1)continue;ae=pe}let de=Ve.detectCodeword(a,v.getMinX(),v.getMaxX(),z,ae,ge,g,y);de!=null&&(Z.setCodeword(ge,de),pe=ae,g=Math.min(g,de.getWidth()),y=Math.max(y,de.getWidth()))}}return Ve.createDecoderResult(j)}static merge(a,s){if(a==null&&s==null)return null;let l=Ve.getBarcodeMetadata(a,s);if(l==null)return null;let c=Fa.merge(Ve.adjustBoundingBox(a),Ve.adjustBoundingBox(s));return new _l(l,c)}static adjustBoundingBox(a){if(a==null)return null;let s=a.getRowHeights();if(s==null)return null;let l=Ve.getMax(s),c=0;for(let y of s)if(c+=l-y,y>0)break;let d=a.getCodewords();for(let y=0;c>0&&d[y]==null;y++)c--;let g=0;for(let y=s.length-1;y>=0&&(g+=l-s[y],!(s[y]>0));y--);for(let y=d.length-1;g>0&&d[y]==null;y--)g--;return a.getBoundingBox().addMissingRows(c,g,a.isLeft())}static getMax(a){let s=-1;for(let l of a)s=Math.max(s,l);return s}static getBarcodeMetadata(a,s){let l;if(a==null||(l=a.getBarcodeMetadata())==null)return s==null?null:s.getBarcodeMetadata();let c;return s==null||(c=s.getBarcodeMetadata())==null?l:l.getColumnCount()!==c.getColumnCount()&&l.getErrorCorrectionLevel()!==c.getErrorCorrectionLevel()&&l.getRowCount()!==c.getRowCount()?null:l}static getRowIndicatorColumn(a,s,l,c,d,g){let y=new mv(s,c);for(let v=0;v<2;v++){let b=v===0?1:-1,R=Math.trunc(Math.trunc(l.getX()));for(let j=Math.trunc(Math.trunc(l.getY()));j<=s.getMaxY()&&j>=s.getMinY();j+=b){let L=Ve.detectCodeword(a,0,a.getWidth(),c,R,j,d,g);L!=null&&(y.setCodeword(j,L),c?R=L.getStartX():R=L.getEndX())}}return y}static adjustCodewordCount(a,s){let l=s[0][1],c=l.getValue(),d=a.getBarcodeColumnCount()*a.getBarcodeRowCount()-Ve.getNumberOfECCodeWords(a.getBarcodeECLevel());if(c.length===0){if(d<1||d>Fe.MAX_CODEWORDS_IN_BARCODE)throw $.getNotFoundInstance();l.setValue(d)}else c[0]!==d&&l.setValue(d)}static createDecoderResult(a){let s=Ve.createBarcodeMatrix(a);Ve.adjustCodewordCount(a,s);let l=new Array,c=new Int32Array(a.getBarcodeRowCount()*a.getBarcodeColumnCount()),d=[],g=new Array;for(let v=0;v0;){for(let v=0;vnew Array(a.getBarcodeColumnCount()+2));for(let c=0;c=0){if(g>=s.length)continue;s[g][l].setValue(d.getValue())}}}l++}return s}static isValidBarcodeColumn(a,s){return s>=0&&s<=a.getBarcodeColumnCount()+1}static getStartColumn(a,s,l,c){let d=c?1:-1,g=null;if(Ve.isValidBarcodeColumn(a,s-d)&&(g=a.getDetectionResultColumn(s-d).getCodeword(l)),g!=null)return c?g.getEndX():g.getStartX();if(g=a.getDetectionResultColumn(s).getCodewordNearby(l),g!=null)return c?g.getStartX():g.getEndX();if(Ve.isValidBarcodeColumn(a,s-d)&&(g=a.getDetectionResultColumn(s-d).getCodewordNearby(l)),g!=null)return c?g.getEndX():g.getStartX();let y=0;for(;Ve.isValidBarcodeColumn(a,s-d);){s-=d;for(let v of a.getDetectionResultColumn(s).getCodewords())if(v!=null)return(c?v.getEndX():v.getStartX())+d*y*(v.getEndX()-v.getStartX());y++}return c?a.getBoundingBox().getMinX():a.getBoundingBox().getMaxX()}static detectCodeword(a,s,l,c,d,g,y,v){d=Ve.adjustCodewordStartColumn(a,s,l,c,d,g);let b=Ve.getModuleBitCount(a,s,l,c,d,g);if(b==null)return null;let R,j=Ie.sum(b);if(c)R=d+j;else{for(let V=0;V=s)&&b=s:yVe.CODEWORD_SKEW_SIZE)return d;y+=v}v=-v,c=!c}return y}static checkCodewordSkew(a,s,l){return s-Ve.CODEWORD_SKEW_SIZE<=a&&a<=l+Ve.CODEWORD_SKEW_SIZE}static decodeCodewords(a,s,l){if(a.length===0)throw k.getFormatInstance();let c=1<l/2+Ve.MAX_ERRORS||l<0||l>Ve.MAX_EC_CODEWORDS)throw A.getChecksumInstance();return Ve.errorCorrection.decode(a,l,s)}static verifyCodewordCount(a,s){if(a.length<4)throw k.getFormatInstance();let l=a[0];if(l>a.length)throw k.getFormatInstance();if(l===0)if(s>=1;return s}static getCodewordBucketNumber(a){return a instanceof Int32Array?this.getCodewordBucketNumber_Int32Array(a):this.getCodewordBucketNumber_number(a)}static getCodewordBucketNumber_number(a){return Ve.getCodewordBucketNumber(Ve.getBitCountForCodeword(a))}static getCodewordBucketNumber_Int32Array(a){return(a[0]-a[2]+a[4]-a[6]+9)%9}static toString(a){let s=new El;for(let l=0;lg)}static getMaxWidth(a,s){return a==null||s==null?0:Math.trunc(Math.abs(a.getX()-s.getX()))}static getMinWidth(a,s){return a==null||s==null?O.MAX_VALUE:Math.trunc(Math.abs(a.getX()-s.getX()))}static getMaxCodewordWidth(a){return Math.floor(Math.max(Math.max(xn.getMaxWidth(a[0],a[4]),xn.getMaxWidth(a[6],a[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.max(xn.getMaxWidth(a[1],a[5]),xn.getMaxWidth(a[7],a[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}static getMinCodewordWidth(a){return Math.floor(Math.min(Math.min(xn.getMinWidth(a[0],a[4]),xn.getMinWidth(a[6],a[2])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN),Math.min(xn.getMinWidth(a[1],a[5]),xn.getMinWidth(a[7],a[3])*Fe.MODULES_IN_CODEWORD/Fe.MODULES_IN_STOP_PATTERN)))}reset(){}}class Zc extends p{}Zc.kind="ReaderException";class bv{constructor(a,s){this.verbose=a===!0,s&&this.setHints(s)}decode(a,s){return s&&this.setHints(s),this.decodeInternal(a)}decodeWithState(a){return(this.readers===null||this.readers===void 0)&&this.setHints(null),this.decodeInternal(a)}setHints(a){this.hints=a;const s=!r(a)&&a.get(I.TRY_HARDER)===!0,l=r(a)?null:a.get(I.POSSIBLE_FORMATS),c=new Array;if(!r(l)){const d=l.some(g=>g===Se.UPC_A||g===Se.UPC_E||g===Se.EAN_13||g===Se.EAN_8||g===Se.CODABAR||g===Se.CODE_39||g===Se.CODE_93||g===Se.CODE_128||g===Se.ITF||g===Se.RSS_14||g===Se.RSS_EXPANDED);d&&!s&&c.push(new Bo(a,this.verbose)),l.includes(Se.QR_CODE)&&c.push(new Zi),l.includes(Se.DATA_MATRIX)&&c.push(new Ki),l.includes(Se.AZTEC)&&c.push(new Vc),l.includes(Se.PDF_417)&&c.push(new xn),d&&s&&c.push(new Bo(a,this.verbose))}c.length===0&&(s||c.push(new Bo(a,this.verbose)),c.push(new Zi),c.push(new Ki),c.push(new Vc),c.push(new xn),s&&c.push(new Bo(a,this.verbose))),this.readers=c}reset(){if(this.readers!==null)for(const a of this.readers)a.reset()}decodeInternal(a){if(this.readers===null)throw new Zc("No readers where selected, nothing can be read.");for(const s of this.readers)try{return s.decode(a,this.hints)}catch(l){if(l instanceof Zc)continue}throw new $("No MultiFormat Readers were able to detect the code.")}}class j8 extends Ee{constructor(a=null,s=500){const l=new bv;l.setHints(a),super(l,s)}decodeBitmap(a){return this.reader.decodeWithState(a)}}class L8 extends Ee{constructor(a=500){super(new xn,a)}}class B8 extends Ee{constructor(a=500){super(new Zi,a)}}var e1;(function(D){D[D.ERROR_CORRECTION=0]="ERROR_CORRECTION",D[D.CHARACTER_SET=1]="CHARACTER_SET",D[D.DATA_MATRIX_SHAPE=2]="DATA_MATRIX_SHAPE",D[D.MIN_SIZE=3]="MIN_SIZE",D[D.MAX_SIZE=4]="MAX_SIZE",D[D.MARGIN=5]="MARGIN",D[D.PDF417_COMPACT=6]="PDF417_COMPACT",D[D.PDF417_COMPACTION=7]="PDF417_COMPACTION",D[D.PDF417_DIMENSIONS=8]="PDF417_DIMENSIONS",D[D.AZTEC_LAYERS=9]="AZTEC_LAYERS",D[D.QR_VERSION=10]="QR_VERSION"})(e1||(e1={}));var en=e1;class t1{constructor(a){this.field=a,this.cachedGenerators=[],this.cachedGenerators.push(new Re(a,Int32Array.from([1])))}buildGenerator(a){const s=this.cachedGenerators;if(a>=s.length){let l=s[s.length-1];const c=this.field;for(let d=s.length;d<=a;d++){const g=l.multiply(new Re(c,Int32Array.from([1,c.exp(d-1+c.getGeneratorBase())])));s.push(g),l=g}}return s[a]}encode(a,s){if(s===0)throw new m("No error correction bytes");const l=a.length-s;if(l<=0)throw new m("No data bytes provided");const c=this.buildGenerator(s),d=new Int32Array(l);T.arraycopy(a,0,d,0,l);let g=new Re(this.field,d);g=g.multiplyByMonomial(s,1);const v=g.divide(c)[1].getCoefficients(),b=s-v.length;for(let R=0;R=5&&(l+=Ft.N1+(v-5)),v=1,b=j)}v>=5&&(l+=Ft.N1+(v-5))}return l}}Ft.N1=3,Ft.N2=3,Ft.N3=40,Ft.N4=10;class Qc{constructor(a,s){this.width=a,this.height=s;const l=new Array(s);for(let c=0;c!==s;c++)l[c]=new Uint8Array(a);this.bytes=l}getHeight(){return this.height}getWidth(){return this.width}get(a,s){return this.bytes[s][a]}getArray(){return this.bytes}setNumber(a,s,l){this.bytes[s][a]=l}setBoolean(a,s,l){this.bytes[s][a]=l?1:0}clear(a){for(const s of this.bytes)C.fill(s,a)}equals(a){if(!(a instanceof Qc))return!1;const s=a;if(this.width!==s.width||this.height!==s.height)return!1;for(let l=0,c=this.height;l> `),a.toString()}setMode(a){this.mode=a}setECLevel(a){this.ecLevel=a}setVersion(a){this.version=a}setMaskPattern(a){this.maskPattern=a}setMatrix(a){this.matrix=a}static isValidMaskPattern(a){return a>=0&&a<$a.NUM_MASK_PATTERNS}}$a.NUM_MASK_PATTERNS=8;class yt extends p{}yt.kind="WriterException";class De{constructor(){}static clearMatrix(a){a.clear(255)}static buildMatrix(a,s,l,c,d){De.clearMatrix(d),De.embedBasicPatterns(l,d),De.embedTypeInfo(s,c,d),De.maybeEmbedVersionInfo(l,d),De.embedDataBits(a,c,d)}static embedBasicPatterns(a,s){De.embedPositionDetectionPatternsAndSeparators(s),De.embedDarkDotAtLeftBottomCorner(s),De.maybeEmbedPositionAdjustmentPatterns(a,s),De.embedTimingPatterns(s)}static embedTypeInfo(a,s,l){const c=new M;De.makeTypeInfoBits(a,s,c);for(let d=0,g=c.getSize();d0;){for(g===6&&(g-=1);y>=0&&y=l;)a^=s<=0)for(let v=0;v!==g;v++){const b=c[v];b>=0&&De.isEmpty(s.get(b,y))&&De.embedPositionAdjustmentPattern(b-2,y-2,s)}}}}De.POSITION_DETECTION_PATTERN=Array.from([Int32Array.from([1,1,1,1,1,1,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,1,1,1,0,1]),Int32Array.from([1,0,0,0,0,0,1]),Int32Array.from([1,1,1,1,1,1,1])]),De.POSITION_ADJUSTMENT_PATTERN=Array.from([Int32Array.from([1,1,1,1,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,0,1,0,1]),Int32Array.from([1,0,0,0,1]),Int32Array.from([1,1,1,1,1])]),De.POSITION_ADJUSTMENT_PATTERN_COORDINATE_TABLE=Array.from([Int32Array.from([-1,-1,-1,-1,-1,-1,-1]),Int32Array.from([6,18,-1,-1,-1,-1,-1]),Int32Array.from([6,22,-1,-1,-1,-1,-1]),Int32Array.from([6,26,-1,-1,-1,-1,-1]),Int32Array.from([6,30,-1,-1,-1,-1,-1]),Int32Array.from([6,34,-1,-1,-1,-1,-1]),Int32Array.from([6,22,38,-1,-1,-1,-1]),Int32Array.from([6,24,42,-1,-1,-1,-1]),Int32Array.from([6,26,46,-1,-1,-1,-1]),Int32Array.from([6,28,50,-1,-1,-1,-1]),Int32Array.from([6,30,54,-1,-1,-1,-1]),Int32Array.from([6,32,58,-1,-1,-1,-1]),Int32Array.from([6,34,62,-1,-1,-1,-1]),Int32Array.from([6,26,46,66,-1,-1,-1]),Int32Array.from([6,26,48,70,-1,-1,-1]),Int32Array.from([6,26,50,74,-1,-1,-1]),Int32Array.from([6,30,54,78,-1,-1,-1]),Int32Array.from([6,30,56,82,-1,-1,-1]),Int32Array.from([6,30,58,86,-1,-1,-1]),Int32Array.from([6,34,62,90,-1,-1,-1]),Int32Array.from([6,28,50,72,94,-1,-1]),Int32Array.from([6,26,50,74,98,-1,-1]),Int32Array.from([6,30,54,78,102,-1,-1]),Int32Array.from([6,28,54,80,106,-1,-1]),Int32Array.from([6,32,58,84,110,-1,-1]),Int32Array.from([6,30,58,86,114,-1,-1]),Int32Array.from([6,34,62,90,118,-1,-1]),Int32Array.from([6,26,50,74,98,122,-1]),Int32Array.from([6,30,54,78,102,126,-1]),Int32Array.from([6,26,52,78,104,130,-1]),Int32Array.from([6,30,56,82,108,134,-1]),Int32Array.from([6,34,60,86,112,138,-1]),Int32Array.from([6,30,58,86,114,142,-1]),Int32Array.from([6,34,62,90,118,146,-1]),Int32Array.from([6,30,54,78,102,126,150]),Int32Array.from([6,24,50,76,102,128,154]),Int32Array.from([6,28,54,80,106,132,158]),Int32Array.from([6,32,58,84,110,136,162]),Int32Array.from([6,26,54,82,110,138,166]),Int32Array.from([6,30,58,86,114,142,170])]),De.TYPE_INFO_COORDINATES=Array.from([Int32Array.from([8,0]),Int32Array.from([8,1]),Int32Array.from([8,2]),Int32Array.from([8,3]),Int32Array.from([8,4]),Int32Array.from([8,5]),Int32Array.from([8,7]),Int32Array.from([8,8]),Int32Array.from([7,8]),Int32Array.from([5,8]),Int32Array.from([4,8]),Int32Array.from([3,8]),Int32Array.from([2,8]),Int32Array.from([1,8]),Int32Array.from([0,8])]),De.VERSION_INFO_POLY=7973,De.TYPE_INFO_POLY=1335,De.TYPE_INFO_MASK_PATTERN=21522;class F8{constructor(a,s){this.dataBytes=a,this.errorCorrectionBytes=s}getDataBytes(){return this.dataBytes}getErrorCorrectionBytes(){return this.errorCorrectionBytes}}class Et{constructor(){}static calculateMaskPenalty(a){return Ft.applyMaskPenaltyRule1(a)+Ft.applyMaskPenaltyRule2(a)+Ft.applyMaskPenaltyRule3(a)+Ft.applyMaskPenaltyRule4(a)}static encode(a,s,l=null){let c=Et.DEFAULT_BYTE_MODE_ENCODING;const d=l!==null&&l.get(en.CHARACTER_SET)!==void 0;d&&(c=l.get(en.CHARACTER_SET).toString());const g=this.chooseMode(a,c),y=new M;if(g===ke.BYTE&&(d||Et.DEFAULT_BYTE_MODE_ENCODING!==c)){const ge=F.getCharacterSetECIByName(c);ge!==void 0&&this.appendECI(ge,y)}this.appendModeInfo(g,y);const v=new M;this.appendBytes(a,g,v,c);let b;if(l!==null&&l.get(en.QR_VERSION)!==void 0){const ge=Number.parseInt(l.get(en.QR_VERSION).toString(),10);b=Me.getVersionForNumber(ge);const de=this.calculateBitsNeeded(g,y,v,b);if(!this.willFit(de,b,s))throw new yt("Data too big for requested version")}else b=this.recommendVersion(s,g,y,v);const R=new M;R.appendBitArray(y);const j=g===ke.BYTE?v.getSizeInBytes():a.length;this.appendLengthInfo(j,b,g,R),R.appendBitArray(v);const L=b.getECBlocksForLevel(s),z=b.getTotalCodewords()-L.getTotalECCodewords();this.terminateBits(z,R);const V=this.interleaveWithECBytes(R,b.getTotalCodewords(),z,L.getNumBlocks()),G=new $a;G.setECLevel(s),G.setMode(g),G.setVersion(b);const Z=b.getDimensionForVersion(),ae=new Qc(Z,Z),pe=this.chooseMaskPattern(V,s,b,ae);return G.setMaskPattern(pe),De.buildMatrix(V,s,b,pe,ae),G.setMatrix(ae),G}static recommendVersion(a,s,l,c){const d=this.calculateBitsNeeded(s,l,c,Me.getVersionForNumber(1)),g=this.chooseVersion(d,a),y=this.calculateBitsNeeded(s,l,c,g);return this.chooseVersion(y,a)}static calculateBitsNeeded(a,s,l,c){return s.getSize()+a.getCharacterCountBits(c)+l.getSize()}static getAlphanumericCode(a){return a159)&&(d<224||d>235))return!1}return!0}static chooseMaskPattern(a,s,l,c){let d=Number.MAX_SAFE_INTEGER,g=-1;for(let y=0;y<$a.NUM_MASK_PATTERNS;y++){De.buildMatrix(a,s,l,y,c);let v=this.calculateMaskPenalty(c);v=v}static terminateBits(a,s){const l=a*8;if(s.getSize()>l)throw new yt("data bits cannot fit in the QR Code"+s.getSize()+" > "+l);for(let g=0;g<4&&s.getSize()0)for(let g=c;g<8;g++)s.appendBit(!1);const d=a-s.getSizeInBytes();for(let g=0;g=l)throw new yt("Block ID too large");const y=a%l,v=l-y,b=Math.floor(a/l),R=b+1,j=Math.floor(s/l),L=j+1,z=b-j,V=R-L;if(z!==V)throw new yt("EC bytes mismatch");if(l!==v+y)throw new yt("RS blocks mismatch");if(a!==(j+z)*v+(L+V)*y)throw new yt("Total bytes mismatch");c=1<=0&&s<=9}static appendNumericBytes(a,s){const l=a.length;let c=0;for(;c=33088&&v<=40956?b=v-33088:v>=57408&&v<=60351&&(b=v-49472),b===-1)throw new yt("Invalid byte sequence");const R=(b>>8)*192+(b&255);s.appendBits(R,13)}}static appendECI(a,s){s.appendBits(ke.ECI.getBits(),4),s.appendBits(a.getValue(),8)}}Et.ALPHANUMERIC_TABLE=Int32Array.from([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,36,-1,-1,-1,37,38,-1,-1,-1,-1,39,40,-1,41,42,43,0,1,2,3,4,5,6,7,8,9,44,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,-1,-1,-1,-1,-1]),Et.DEFAULT_BYTE_MODE_ENCODING=F.UTF8.getName();class Ua{write(a,s,l,c=null){if(a.length===0)throw new m("Found empty contents");if(s<0||l<0)throw new m("Requested dimensions are too small: "+s+"x"+l);let d=bt.L,g=Ua.QUIET_ZONE_SIZE;c!==null&&(c.get(en.ERROR_CORRECTION)!==void 0&&(d=bt.fromString(c.get(en.ERROR_CORRECTION).toString())),c.get(en.MARGIN)!==void 0&&(g=Number.parseInt(c.get(en.MARGIN).toString(),10)));const y=Et.encode(a,d,c);return this.renderResult(y,s,l,g)}writeToDom(a,s,l,c,d=null){typeof a=="string"&&(a=document.querySelector(a));const g=this.write(s,l,c,d);a&&a.appendChild(g)}renderResult(a,s,l,c){const d=a.getMatrix();if(d===null)throw new et;const g=d.getWidth(),y=d.getHeight(),v=g+c*2,b=y+c*2,R=Math.max(s,v),j=Math.max(l,b),L=Math.min(Math.floor(R/v),Math.floor(j/b)),z=Math.floor((R-g*L)/2),V=Math.floor((j-y*L)/2),G=this.createSVGElement(R,j);for(let Z=0,ae=V;Zs||d+y>l)throw new m("Crop rectangle does not fit within image data.");v&&this.reverseHorizontal(g,y)}getRow(a,s){if(a<0||a>=this.getHeight())throw new m("Requested row is outside the image: "+a);const l=this.getWidth();(s==null||s.length>16&255,z=j>>7&510,V=j&255;b[R]=(L+z+V)/4&255}this.luminances=b}else this.luminances=a;if(c===void 0&&(this.dataWidth=s),d===void 0&&(this.dataHeight=l),g===void 0&&(this.left=0),y===void 0&&(this.top=0),this.left+s>this.dataWidth||this.top+l>this.dataHeight)throw new m("Crop rectangle does not fit within image data.")}getRow(a,s){if(a<0||a>=this.getHeight())throw new m("Requested row is outside the image: "+a);const l=this.getWidth();(s==null||s.length"}}class i1 extends Uo{constructor(a,s,l){super(a,0,0),this.binaryShiftStart=s,this.binaryShiftByteCount=l}appendTo(a,s){for(let l=0;l62?a.appendBits(this.binaryShiftByteCount-31,16):l===0?a.appendBits(Math.min(this.binaryShiftByteCount,31),5):a.appendBits(this.binaryShiftByteCount-31,5)),a.appendBits(s[this.binaryShiftStart+l],8)}addBinaryShift(a,s){return new i1(this,a,s)}toString(){return"<"+this.binaryShiftStart+"::"+(this.binaryShiftStart+this.binaryShiftByteCount-1)+">"}}function z8(D,a,s){return new i1(D,a,s)}function Nl(D,a,s){return new Uo(D,a,s)}const W8=["UPPER","LOWER","DIGIT","MIXED","PUNCT"],Ji=0,Jc=1,wr=2,Cv=3,oi=4,H8=new Uo(null,0,0),a1=[Int32Array.from([0,(5<<16)+28,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(9<<16)+480+14,0,(5<<16)+30,(5<<16)+29,656318]),Int32Array.from([(4<<16)+14,(9<<16)+448+28,0,(9<<16)+448+29,932798]),Int32Array.from([(5<<16)+29,(5<<16)+28,656318,0,(5<<16)+30]),Int32Array.from([(5<<16)+31,656380,656382,656381,0])];function V8(D){for(let a of D)C.fill(a,-1);return D[Ji][oi]=0,D[Jc][oi]=0,D[Jc][Ji]=28,D[Cv][oi]=0,D[wr][oi]=0,D[wr][Ji]=15,D}const Ov=V8(C.createInt32Array(6,6));class si{constructor(a,s,l,c){this.token=a,this.mode=s,this.binaryShiftByteCount=l,this.bitCount=c}getMode(){return this.mode}getToken(){return this.token}getBinaryShiftByteCount(){return this.binaryShiftByteCount}getBitCount(){return this.bitCount}latchAndAppend(a,s){let l=this.bitCount,c=this.token;if(a!==this.mode){let g=a1[this.mode][a];c=Nl(c,g&65535,g>>16),l+=g>>16}let d=a===wr?4:5;return c=Nl(c,s,d),new si(c,a,0,l+d)}shiftAndAppend(a,s){let l=this.token,c=this.mode===wr?4:5;return l=Nl(l,Ov[this.mode][a],c),l=Nl(l,s,5),new si(l,this.mode,0,this.bitCount+c+5)}addBinaryShiftChar(a){let s=this.token,l=this.mode,c=this.bitCount;if(this.mode===oi||this.mode===wr){let y=a1[l][Ji];s=Nl(s,y&65535,y>>16),c+=y>>16,l=Ji}let d=this.binaryShiftByteCount===0||this.binaryShiftByteCount===31?18:this.binaryShiftByteCount===62?9:8,g=new si(s,l,this.binaryShiftByteCount+1,c+d);return g.binaryShiftByteCount===2078&&(g=g.endBinaryShift(a+1)),g}endBinaryShift(a){if(this.binaryShiftByteCount===0)return this;let s=this.token;return s=z8(s,a-this.binaryShiftByteCount,this.binaryShiftByteCount),new si(s,this.mode,0,this.bitCount)}isBetterThanOrEqualTo(a){let s=this.bitCount+(a1[this.mode][a.mode]>>16);return this.binaryShiftByteCounta.binaryShiftByteCount&&a.binaryShiftByteCount>0&&(s+=10),s<=a.bitCount}toBitArray(a){let s=[];for(let c=this.endBinaryShift(a.length).token;c!==null;c=c.getPrevious())s.unshift(c);let l=new M;for(const c of s)c.appendTo(l,a);return l}toString(){return H.format("%s bits=%d bytes=%d",W8[this.mode],this.bitCount,this.binaryShiftByteCount)}static calculateBinaryShiftCost(a){return a.binaryShiftByteCount>62?21:a.binaryShiftByteCount>31?20:a.binaryShiftByteCount>0?10:0}}si.INITIAL_STATE=new si(H8,Ji,0,0);function G8(D){const a=H.getCharCode(" "),s=H.getCharCode("."),l=H.getCharCode(",");D[Ji][a]=1;const c=H.getCharCode("Z"),d=H.getCharCode("A");for(let L=d;L<=c;L++)D[Ji][L]=L-d+2;D[Jc][a]=1;const g=H.getCharCode("z"),y=H.getCharCode("a");for(let L=y;L<=g;L++)D[Jc][L]=L-y+2;D[wr][a]=1;const v=H.getCharCode("9"),b=H.getCharCode("0");for(let L=b;L<=v;L++)D[wr][L]=L-b+2;D[wr][l]=12,D[wr][s]=13;const R=["\0"," ","","","","","","","\x07","\b"," ",` `,"\v","\f","\r","\x1B","","","","","@","\\","^","_","`","|","~",""];for(let L=0;L","?","[","]","{","}"];for(let L=0;L0&&(D[oi][H.getCharCode(j[L])]=L);return D}const o1=G8(C.createInt32Array(5,256));class Il{constructor(a){this.text=a}encode(){const a=H.getCharCode(" "),s=H.getCharCode(` `);let l=Ev.singletonList(si.INITIAL_STATE);for(let d=0;d0?(l=Il.updateStateListForPair(l,d,g),d++):l=this.updateStateListForChar(l,d)}return Ev.min(l,(d,g)=>d.getBitCount()-g.getBitCount()).toBitArray(this.text)}updateStateListForChar(a,s){const l=[];for(let c of a)this.updateStateForChar(c,s,l);return Il.simplifyStates(l)}updateStateForChar(a,s,l){let c=this.text[s]&255,d=o1[a.getMode()][c]>0,g=null;for(let y=0;y<=oi;y++){let v=o1[y][c];if(v>0){if(g==null&&(g=a.endBinaryShift(s)),!d||y===a.getMode()||y===wr){const b=g.latchAndAppend(y,v);l.push(b)}if(!d&&Ov[a.getMode()][y]>=0){const b=g.shiftAndAppend(y,v);l.push(b)}}}if(a.getBinaryShiftByteCount()>0||o1[a.getMode()][c]===0){let y=a.addBinaryShiftChar(s);l.push(y)}}static updateStateListForPair(a,s,l){const c=[];for(let d of a)this.updateStateForPair(d,s,l,c);return this.simplifyStates(c)}static updateStateForPair(a,s,l,c){let d=a.endBinaryShift(s);if(c.push(d.latchAndAppend(oi,l)),a.getMode()!==oi&&c.push(d.shiftAndAppend(oi,l)),l===3||l===4){let g=d.latchAndAppend(wr,16-l).latchAndAppend(wr,1);c.push(g)}if(a.getBinaryShiftByteCount()>0){let g=a.addBinaryShiftChar(s).addBinaryShiftChar(s+1);c.push(g)}}static simplifyStates(a){let s=[];for(const l of a){let c=!0;for(const d of s){if(d.isBetterThanOrEqualTo(l)){c=!1;break}l.isBetterThanOrEqualTo(d)&&(s=s.filter(g=>g!==d))}c&&s.push(l)}return s}}class tt{constructor(){}static encodeBytes(a){return tt.encode(a,tt.DEFAULT_EC_PERCENT,tt.DEFAULT_AZTEC_LAYERS)}static encode(a,s,l){let c=new Il(a).encode(),d=O.truncDivision(c.getSize()*s,100)+11,g=c.getSize()+d,y,v,b,R,j;if(l!==tt.DEFAULT_AZTEC_LAYERS){if(y=l<0,v=Math.abs(l),v>(y?tt.MAX_NB_BITS_COMPACT:tt.MAX_NB_BITS))throw new m(H.format("Illegal value %s for layers",l));b=tt.totalBitsInLayer(v,y),R=tt.WORD_SIZE[v];let de=b-b%R;if(j=tt.stuffBits(c,R),j.getSize()+d>de)throw new m("Data to large for user specified layer");if(y&&j.getSize()>R*64)throw new m("Data to large for user specified layer")}else{R=0,j=null;for(let de=0;;de++){if(de>tt.MAX_NB_BITS)throw new m("Data too large for an Aztec code");if(y=de<=3,v=y?de+1:de,b=tt.totalBitsInLayer(v,y),g>b)continue;(j==null||R!==tt.WORD_SIZE[v])&&(R=tt.WORD_SIZE[v],j=tt.stuffBits(c,R));let qe=b-b%R;if(!(y&&j.getSize()>R*64)&&j.getSize()+d<=qe)break}}let L=tt.generateCheckWords(j,b,R),z=j.getSize()/R,V=tt.generateModeMessage(y,v,z),G=(y?11:14)+v*4,Z=new Int32Array(G),ae;if(y){ae=G;for(let de=0;de=c||a.get(g+v))&&(y|=1<0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]r&&(r=f,n=u)}if(!n)throw"No largest barcode found";return n},e.prototype.createBarcodeDetectorFormats=function(t){for(var n=[],r=0,i=t;r0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]=o&&(t.isClosed=!0,t.parentElement.removeChild(t.surface),n())})})},e.prototype.getCapabilities=function(){return new Soe(this.getFirstTrackOrFail())},e}(),Coe=function(){function e(t){this.mediaStream=t}return e.prototype.render=function(t,n,r){return Nh(this,void 0,void 0,function(){return Ih(this,function(i){return[2,Eoe.create(t,this.mediaStream,n,r)]})})},e.create=function(t){return Nh(this,void 0,void 0,function(){var n,r;return Ih(this,function(i){switch(i.label){case 0:if(!navigator.mediaDevices)throw"navigator.mediaDevices not supported";return n={audio:!1,video:t},[4,navigator.mediaDevices.getUserMedia(n)];case 1:return r=i.sent(),[2,new e(r)]}})})},e}(),OE=function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(u){u(o)})}return new(n||(n=Promise))(function(o,u){function f(x){try{p(r.next(x))}catch(m){u(m)}}function h(x){try{p(r.throw(x))}catch(m){u(m)}}function p(x){x.done?o(x.value):i(x.value).then(f,h)}p((r=r.apply(e,t||[])).next())})},_E=function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,u;return u={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(u[Symbol.iterator]=function(){return this}),u;function f(p){return function(x){return h([p,x])}}function h(p){if(r)throw new TypeError("Generator is already executing.");for(;u&&(u=0,p[0]&&(n=0)),n;)try{if(r=1,i&&(o=p[0]&2?i.return:p[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,p[1])).done)return o;switch(i=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return n.label++,{value:p[1],done:!1};case 5:n.label++,i=p[1],p=[0];continue;case 7:p=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]t&&(i.logger.warn("`qrbox.width` or `qrbox` is larger than the width of the root element. The width will be truncated to the width of root element."),p=t),p};f(u.width),f(u.height),u.width=h(u.width)},e.prototype.validateQrboxConfig=function(t){if(typeof t!="number"&&typeof t!="function"&&(t.width===void 0||t.height===void 0))throw"Invalid instance of QrDimensions passed for 'config.qrbox'. Both 'width' and 'height' should be set."},e.prototype.toQrdimensions=function(t,n,r){if(typeof r=="number")return{width:r,height:r};if(typeof r=="function")try{return r(t,n)}catch(i){throw new Error("qrbox config was passed as a function but it failed with unknown error"+i)}return r},e.prototype.setupUi=function(t,n,r){r.isShadedBoxEnabled()&&this.validateQrboxSize(t,n,r);var i=wi(r.qrbox)?{width:t,height:n}:r.qrbox;this.validateQrboxConfig(i);var o=this.toQrdimensions(t,n,i);o.height>n&&this.logger.warn("[Html5Qrcode] config.qrbox has height that isgreater than the height of the video stream. Shading will be ignored");var u=r.isShadedBoxEnabled()&&o.height<=n,f={x:0,y:0,width:t,height:n},h=u?this.getShadedRegionBounds(t,n,o):f,p=this.createCanvasElement(h.width,h.height),x={willReadFrequently:!0},m=p.getContext("2d",x);m.canvas.width=h.width,m.canvas.height=h.height,this.element.append(p),u&&this.possiblyInsertShadingElement(this.element,t,n,o),this.createScannerPausedUiElement(this.element),this.qrRegion=h,this.context=m,this.canvasElement=p},e.prototype.createScannerPausedUiElement=function(t){var n=document.createElement("div");n.innerText=ps.scannerPaused(),n.style.display="none",n.style.position="absolute",n.style.top="0px",n.style.zIndex="1",n.style.background="rgba(9, 9, 9, 0.46)",n.style.color="#FFECEC",n.style.textAlign="center",n.style.width="100%",t.appendChild(n),this.scannerPausedUiElement=n},e.prototype.scanContext=function(t,n){var r=this;return this.stateManagerProxy.isPaused()?Promise.resolve(!1):this.qrcode.decodeAsync(this.canvasElement).then(function(i){return t(i.text,bE.createFromQrcodeResult(i)),r.possiblyUpdateShaders(!0),!0}).catch(function(i){r.possiblyUpdateShaders(!1);var o=ps.codeParseError(i);return n(o,poe.createFrom(o)),!1})},e.prototype.foreverScan=function(t,n,r){var i=this;if(this.shouldScan&&this.renderedCamera){var o=this.renderedCamera.getSurface(),u=o.videoWidth/o.clientWidth,f=o.videoHeight/o.clientHeight;if(!this.qrRegion)throw"qrRegion undefined when localMediaStream is ready.";var h=this.qrRegion.width*u,p=this.qrRegion.height*f,x=this.qrRegion.x*u,m=this.qrRegion.y*f;this.context.drawImage(o,x,m,h,p,0,0,this.qrRegion.width,this.qrRegion.height);var w=function(){i.foreverScanTimeout=setTimeout(function(){i.foreverScan(t,n,r)},i.getTimeoutFps(t.fps))};this.scanContext(n,r).then(function(A){!A&&t.disableFlip!==!0?(i.context.translate(i.context.canvas.width,0),i.context.scale(-1,1),i.scanContext(n,r).finally(function(){w()})):w()}).catch(function(A){i.logger.logError("Error happend while scanning context",A),w()})}},e.prototype.createVideoConstraints=function(t){if(typeof t=="string")return{deviceId:{exact:t}};if(typeof t=="object"){var n="facingMode",r="deviceId",i={user:!0,environment:!0},o="exact",u=function(_){if(_ in i)return!0;throw"config has invalid 'facingMode' value = "+"'".concat(_,"'")},f=Object.keys(t);if(f.length!==1)throw"'cameraIdOrConfig' object should have exactly 1 key,"+" if passed as an object, found ".concat(f.length," keys");var h=Object.keys(t)[0];if(h!==n&&h!==r)throw"Only '".concat(n,"' and '").concat(r,"' ")+" are supported for 'cameraIdOrConfig'";if(h===n){var p=t.facingMode;if(typeof p=="string"){if(u(p))return{facingMode:p}}else if(typeof p=="object")if(o in p){if(u(p["".concat(o)]))return{facingMode:{exact:p["".concat(o)]}}}else throw"'facingMode' should be string or object with"+" ".concat(o," as key.");else{var x=typeof p;throw"Invalid type of 'facingMode' = ".concat(x)}}else{var m=t.deviceId;if(typeof m=="string")return{deviceId:m};if(typeof m=="object"){if(o in m)return{deviceId:{exact:m["".concat(o)]}};throw"'deviceId' should be string or object with"+" ".concat(o," as key.")}else{var w=typeof m;throw"Invalid type of 'deviceId' = ".concat(w)}}}var A=typeof t;throw"Invalid type of 'cameraIdOrConfig' = ".concat(A)},e.prototype.computeCanvasDrawConfig=function(t,n,r,i){if(t<=r&&n<=i){var o=(r-t)/2,u=(i-n)/2;return{x:o,y:u,width:t,height:n}}else{var f=t,h=n;return t>r&&(n=r/t*n,t=r),n>i&&(t=i/n*t,n=i),this.logger.log("Image downsampled from "+"".concat(f,"X").concat(h)+" to ".concat(t,"X").concat(n,".")),this.computeCanvasDrawConfig(t,n,r,i)}},e.prototype.clearElement=function(){if(this.stateManagerProxy.isScanning())throw"Cannot clear while scan is ongoing, close it first.";var t=document.getElementById(this.elementId);t&&(t.innerHTML="")},e.prototype.possiblyUpdateShaders=function(t){this.qrMatch!==t&&(this.hasBorderShaders&&this.borderShaders&&this.borderShaders.length&&this.borderShaders.forEach(function(n){n.style.backgroundColor=t?or.BORDER_SHADER_MATCH_COLOR:or.BORDER_SHADER_DEFAULT_COLOR}),this.qrMatch=t)},e.prototype.possiblyCloseLastScanImageFile=function(){this.lastScanImageFile&&(URL.revokeObjectURL(this.lastScanImageFile),this.lastScanImageFile=null)},e.prototype.createCanvasElement=function(t,n,r){var i=t,o=n,u=document.createElement("canvas");return u.style.width="".concat(i,"px"),u.style.height="".concat(o,"px"),u.style.display="none",u.id=wi(r)?"qr-canvas":r,u},e.prototype.getShadedRegionBounds=function(t,n,r){if(r.width>t||r.height>n)throw"'config.qrbox' dimensions should not be greater than the dimensions of the root HTML element.";return{x:(t-r.width)/2,y:(n-r.height)/2,width:r.width,height:r.height}},e.prototype.possiblyInsertShadingElement=function(t,n,r,i){if(!(n-i.width<1||r-i.height<1)){var o=document.createElement("div");o.style.position="absolute";var u=(n-i.width)/2,f=(r-i.height)/2;if(o.style.borderLeft="".concat(u,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderRight="".concat(u,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderTop="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),o.style.borderBottom="".concat(f,"px solid rgba(0, 0, 0, 0.48)"),o.style.boxSizing="border-box",o.style.top="0px",o.style.bottom="0px",o.style.left="0px",o.style.right="0px",o.id="".concat(or.SHADED_REGION_ELEMENT_ID),n-i.width<11||r-i.height<11)this.hasBorderShaders=!1;else{var h=5,p=40;this.insertShaderBorders(o,p,h,-h,null,0,!0),this.insertShaderBorders(o,p,h,-h,null,0,!1),this.insertShaderBorders(o,p,h,null,-h,0,!0),this.insertShaderBorders(o,p,h,null,-h,0,!1),this.insertShaderBorders(o,h,p+h,-h,null,-h,!0),this.insertShaderBorders(o,h,p+h,null,-h,-h,!0),this.insertShaderBorders(o,h,p+h,-h,null,-h,!1),this.insertShaderBorders(o,h,p+h,null,-h,-h,!1),this.hasBorderShaders=!0}t.append(o)}},e.prototype.insertShaderBorders=function(t,n,r,i,o,u,f){var h=document.createElement("div");h.style.position="absolute",h.style.backgroundColor=or.BORDER_SHADER_DEFAULT_COLOR,h.style.width="".concat(n,"px"),h.style.height="".concat(r,"px"),i!==null&&(h.style.top="".concat(i,"px")),o!==null&&(h.style.bottom="".concat(o,"px")),f?h.style.left="".concat(u,"px"):h.style.right="".concat(u,"px"),this.borderShaders||(this.borderShaders=[]),this.borderShaders.push(h),t.appendChild(h)},e.prototype.showPausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="block"},e.prototype.hidePausedState=function(){if(!this.scannerPausedUiElement)throw"[internal error] scanner paused UI element not found";this.scannerPausedUiElement.style.display="none"},e.prototype.getTimeoutFps=function(t){return 1e3/t},e}(),TE;(function(e){e[e.STATUS_DEFAULT=0]="STATUS_DEFAULT",e[e.STATUS_SUCCESS=1]="STATUS_SUCCESS",e[e.STATUS_WARNING=2]="STATUS_WARNING",e[e.STATUS_REQUESTING_PERMISSION=3]="STATUS_REQUESTING_PERMISSION"})(TE||(TE={}));function joe(){const{addItem:e,selectedStore:t}=kc(),[n,r]=W.useState(!1),[i,o]=W.useState(null),[u,f]=W.useState(""),[h,p]=W.useState(1),x=W.useRef(null),m=W.useRef(null);W.useEffect(()=>()=>{x.current&&x.current.stop().catch(console.error)},[]);const w=async()=>{if(m.current)try{f(""),r(!0);const E=new Doe("scanner-container");x.current=E,await E.start({facingMode:"environment"},{fps:10,qrbox:{width:250,height:250}},async C=>{await _(C)},()=>{})}catch(E){console.error("Scanner error:",E),f("Failed to start camera. Please ensure camera permissions are granted."),r(!1)}},A=async()=>{if(x.current)try{await x.current.stop(),x.current=null}catch(E){console.error("Error stopping scanner:",E)}r(!1)},_=async E=>{try{await A();const C=await cs.getAll({search:E,limit:1});C.data.length>0?(o(C.data[0]),p(1)):(f(`Product not found for code: ${E}`),r(!1))}catch(C){console.error("Error looking up product:",C),f("Failed to look up product")}},T=()=>{if(i){for(let E=0;E{E.preventDefault();const O=new FormData(E.currentTarget).get("code");O&&await _(O)};return S.jsxs("div",{className:"max-w-2xl mx-auto space-y-6",children:[S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[S.jsx(mw,{size:20}),"Scan Product"]}),t?S.jsxs(S.Fragment,{children:[S.jsx("div",{id:"scanner-container",ref:m,className:"bg-black rounded-lg overflow-hidden mb-4",style:{minHeight:"300px"},children:!n&&S.jsx("div",{className:"h-72 flex items-center justify-center",children:S.jsxs("div",{className:"text-center text-white",children:[S.jsx(mw,{size:48,className:"mx-auto mb-2 opacity-50"}),S.jsx("p",{children:"Camera preview will appear here"})]})})}),S.jsx("div",{className:"flex gap-3",children:n?S.jsx("button",{onClick:A,className:"flex-1 bg-red-600 text-white py-3 rounded-lg font-semibold hover:bg-red-700 transition-colors",children:"Stop Scanning"}):S.jsx("button",{onClick:w,className:"flex-1 bg-blue-600 text-white py-3 rounded-lg font-semibold hover:bg-blue-700 transition-colors",children:"Start Scanning"})}),S.jsxs("div",{className:"mt-6 pt-6 border-t",children:[S.jsx("p",{className:"text-sm text-gray-600 mb-3",children:"Or enter barcode manually:"}),S.jsxs("form",{onSubmit:N,className:"flex gap-2",children:[S.jsx("input",{name:"code",type:"text",placeholder:"Enter barcode or SKU...",className:"flex-1 px-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),S.jsx("button",{type:"submit",className:"px-6 bg-gray-800 text-white rounded-lg hover:bg-gray-900",children:"Search"})]})]})]}):S.jsxs("div",{className:"text-center py-8 text-gray-500",children:[S.jsx(RO,{size:48,className:"mx-auto mb-4 text-yellow-500"}),S.jsx("p",{children:"Please select a store from the header before scanning"})]}),u&&S.jsx("div",{className:"mt-4 p-4 bg-red-50 border border-red-200 rounded-lg text-red-700",children:u})]}),i&&S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("div",{className:"flex justify-between items-start mb-4",children:[S.jsx("h3",{className:"text-lg font-semibold",children:"Scanned Product"}),S.jsx("button",{onClick:()=>o(null),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:20})})]}),S.jsxs("div",{className:"flex gap-4 mb-6",children:[S.jsx("div",{className:"w-20 h-20 bg-gray-100 rounded-lg flex items-center justify-center",children:i.image_url?S.jsx("img",{src:i.image_url,alt:i.name,className:"w-full h-full object-cover rounded-lg"}):S.jsx(so,{className:"text-gray-400",size:32})}),S.jsxs("div",{className:"flex-1",children:[S.jsx("h4",{className:"font-semibold text-lg",children:i.name}),S.jsx("p",{className:"text-gray-600",children:i.sku}),S.jsxs("p",{className:"text-2xl font-bold text-blue-600 mt-1",children:["$",i.price.toFixed(2)]}),S.jsxs("p",{className:"text-sm text-gray-500",children:["Stock: ",i.stock_quantity]})]})]}),S.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[S.jsx("label",{className:"text-sm text-gray-600",children:"Quantity:"}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("button",{onClick:()=>p(Math.max(1,h-1)),className:"w-10 h-10 rounded-lg border flex items-center justify-center hover:bg-gray-50",children:"-"}),S.jsx("input",{type:"number",value:h,onChange:E=>p(Math.max(1,parseInt(E.target.value)||1)),className:"w-20 px-4 py-2 border rounded-lg text-center",min:"1"}),S.jsx("button",{onClick:()=>p(h+1),className:"w-10 h-10 rounded-lg border flex items-center justify-center hover:bg-gray-50",children:"+"})]})]}),S.jsxs("button",{onClick:T,disabled:i.stock_quantity{(async()=>{try{i(!0);const A=e==null?void 0:e.id,_=await qf.getRevenueChart(t,A);u(_);const T=new Date,N=loe(T,t),E=await mu.getAll({store_id:A,start_date:qa(N,"yyyy-MM-dd"),end_date:qa(T,"yyyy-MM-dd"),limit:1e3}),C={};let O=0,M=E.data.length;E.data.forEach(P=>{const I=qa(new Date(P.created_at),"yyyy-MM-dd");C[I]||(C[I]={date:I,orders:0,revenue:0,profit:0}),C[I].orders+=1,C[I].revenue+=P.total,C[I].profit+=P.total-P.subtotal*.3,O+=P.total}),h(Object.values(C).sort((P,I)=>P.date.localeCompare(I.date))),x({totalRevenue:O,totalOrders:M,avgOrderValue:M>0?O/M:0,topCategory:"General"})}catch(A){console.error("Failed to fetch reports:",A)}finally{i(!1)}})()},[e,t]);const m=()=>{const w=[["Date","Orders","Revenue","Profit"],...f.map(N=>[N.date,N.orders,N.revenue.toFixed(2),N.profit.toFixed(2)])].map(N=>N.join(",")).join(` `),A=new Blob([w],{type:"text/csv"}),_=window.URL.createObjectURL(A),T=document.createElement("a");T.href=_,T.download=`sales-report-${qa(new Date,"yyyy-MM-dd")}.csv`,T.click(),window.URL.revokeObjectURL(_)};return r?S.jsx("div",{className:"flex items-center justify-center h-64",children:S.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx("div",{className:"flex items-center gap-4",children:S.jsx("div",{className:"flex items-center gap-2 bg-white rounded-lg p-1 border",children:[7,30,90].map(w=>S.jsxs("button",{onClick:()=>n(w),className:`px-4 py-2 rounded-lg transition-colors ${t===w?"bg-blue-600 text-white":"text-gray-600 hover:bg-gray-100"}`,children:[w," Days"]},w))})}),S.jsxs("button",{onClick:m,className:"flex items-center gap-2 px-4 py-2 bg-green-600 text-white rounded-lg hover:bg-green-700",children:[S.jsx(ZM,{size:18}),"Export CSV"]})]}),S.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Total Revenue"}),S.jsxs("p",{className:"text-3xl font-bold text-green-600 mt-1",children:["$",p.totalRevenue.toFixed(2)]})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Total Orders"}),S.jsx("p",{className:"text-3xl font-bold text-blue-600 mt-1",children:p.totalOrders})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("p",{className:"text-sm text-gray-500",children:"Avg Order Value"}),S.jsxs("p",{className:"text-3xl font-bold text-purple-600 mt-1",children:["$",p.avgOrderValue.toFixed(2)]})]})]}),S.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Revenue Trend"}),S.jsx("div",{className:"h-64",children:S.jsx(Hg,{width:"100%",height:"100%",children:S.jsxs(c8,{data:o,children:[S.jsx(Ah,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),S.jsx(Eo,{dataKey:"date",stroke:"#9ca3af",fontSize:12}),S.jsx(Co,{stroke:"#9ca3af",fontSize:12}),S.jsx(Er,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"},formatter:w=>[`$${w.toFixed(2)}`,"Revenue"]}),S.jsx(bl,{type:"monotone",dataKey:"revenue",stroke:"#3b82f6",strokeWidth:2,dot:{fill:"#3b82f6",strokeWidth:2}})]})})})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Sales by Day"}),S.jsx("div",{className:"h-64",children:S.jsx(Hg,{width:"100%",height:"100%",children:S.jsxs(Qie,{data:f,children:[S.jsx(Ah,{strokeDasharray:"3 3",stroke:"#f0f0f0"}),S.jsx(Eo,{dataKey:"date",stroke:"#9ca3af",fontSize:12}),S.jsx(Co,{stroke:"#9ca3af",fontSize:12}),S.jsx(Er,{contentStyle:{backgroundColor:"#fff",border:"1px solid #e5e7eb",borderRadius:"8px"}}),S.jsx(Mo,{dataKey:"orders",fill:"#10b981",radius:[4,4,0,0]})]})})})]})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Daily Sales Report"}),S.jsx("div",{className:"overflow-x-auto",children:S.jsxs("table",{className:"w-full",children:[S.jsx("thead",{className:"bg-gray-50",children:S.jsxs("tr",{children:[S.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Date"}),S.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Orders"}),S.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Revenue"}),S.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Profit"}),S.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase",children:"Avg Order"})]})}),S.jsxs("tbody",{className:"divide-y divide-gray-200",children:[f.map(w=>S.jsxs("tr",{className:"hover:bg-gray-50",children:[S.jsx("td",{className:"px-4 py-3 font-medium",children:qa(new Date(w.date),"MMM dd, yyyy")}),S.jsx("td",{className:"px-4 py-3",children:w.orders}),S.jsxs("td",{className:"px-4 py-3 font-semibold",children:["$",w.revenue.toFixed(2)]}),S.jsxs("td",{className:"px-4 py-3 text-green-600",children:["$",w.profit.toFixed(2)]}),S.jsxs("td",{className:"px-4 py-3 text-gray-600",children:["$",w.orders>0?(w.revenue/w.orders).toFixed(2):"0.00"]})]},w.date)),f.length===0&&S.jsx("tr",{children:S.jsx("td",{colSpan:5,className:"px-4 py-8 text-center text-gray-500",children:"No sales data for this period"})})]})]})})]})]})}function Boe(){const[e,t]=W.useState([]),[n,r]=W.useState(!0),[i,o]=W.useState(""),[u,f]=W.useState(!1),[h,p]=W.useState(null),[x,m]=W.useState(!1),[w,A]=W.useState({name:"",address:"",phone:"",is_active:!0});W.useEffect(()=>{(async()=>{try{r(!0);const O=await au.getAll();t(O)}catch(O){console.error("Failed to fetch stores:",O)}finally{r(!1)}})()},[]);const _=e.filter(C=>C.name.toLowerCase().includes(i.toLowerCase())||C.address.toLowerCase().includes(i.toLowerCase())),T=C=>{C?(p(C),A({name:C.name,address:C.address,phone:C.phone,is_active:C.is_active})):(p(null),A({name:"",address:"",phone:"",is_active:!0})),f(!0)},N=async C=>{C.preventDefault(),m(!0);try{if(h){const O=await au.update(h.id,w);t(e.map(M=>M.id===h.id?O:M))}else{const O=await au.create(w);t([...e,O])}f(!1)}catch(O){console.error("Failed to save store:",O),alert("Failed to save store")}finally{m(!1)}},E=async C=>{if(confirm("Are you sure you want to delete this store?"))try{await au.delete(C),t(e.filter(O=>O.id!==C))}catch(O){console.error("Failed to delete store:",O),alert("Failed to delete store")}};return S.jsxs("div",{className:"space-y-6",children:[S.jsxs("div",{className:"flex justify-between items-center",children:[S.jsx("div",{className:"flex-1 max-w-md",children:S.jsxs("div",{className:"relative",children:[S.jsx(Dc,{className:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400",size:20}),S.jsx("input",{type:"text",placeholder:"Search stores...",value:i,onChange:C=>o(C.target.value),className:"w-full pl-10 pr-4 py-3 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"})]})}),S.jsxs("button",{onClick:()=>T(),className:"flex items-center gap-2 px-4 py-3 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:[S.jsx(Jh,{size:20}),"Add Store"]})]}),S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:n?S.jsx("div",{className:"col-span-full flex justify-center py-12",children:S.jsx("div",{className:"animate-spin rounded-full h-12 w-12 border-b-2 border-blue-600"})}):_.length===0?S.jsx("div",{className:"col-span-full text-center py-12 text-gray-500",children:"No stores found"}):_.map(C=>S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("div",{className:"flex items-start justify-between mb-4",children:[S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("div",{className:"w-12 h-12 bg-blue-100 rounded-lg flex items-center justify-center",children:S.jsx(Ed,{className:"text-blue-600",size:24})}),S.jsxs("div",{children:[S.jsx("h3",{className:"font-semibold text-lg",children:C.name}),S.jsx("span",{className:`px-2 py-1 rounded-full text-xs font-medium ${C.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:C.is_active?"Active":"Inactive"})]})]}),S.jsxs("div",{className:"flex items-center gap-1",children:[S.jsx("button",{onClick:()=>T(C),className:"p-2 text-gray-400 hover:text-blue-600 hover:bg-blue-50 rounded-lg",children:S.jsx(DO,{size:18})}),S.jsx("button",{onClick:()=>E(C.id),className:"p-2 text-gray-400 hover:text-red-600 hover:bg-red-50 rounded-lg",children:S.jsx(Jy,{size:18})})]})]}),S.jsxs("div",{className:"space-y-2 text-sm text-gray-600",children:[S.jsxs("p",{className:"flex items-center gap-2",children:[S.jsx(Ed,{size:16}),C.address||"No address"]}),S.jsxs("p",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"w-4",children:"📞"}),C.phone||"No phone"]})]})]},C.id))}),u&&S.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:S.jsxs("div",{className:"bg-white rounded-xl shadow-2xl w-full max-w-md",children:[S.jsxs("div",{className:"p-6 border-b flex justify-between items-center",children:[S.jsx("h3",{className:"text-xl font-semibold",children:h?"Edit Store":"Add Store"}),S.jsx("button",{onClick:()=>f(!1),className:"text-gray-400 hover:text-gray-600",children:S.jsx(To,{size:24})})]}),S.jsxs("form",{onSubmit:N,className:"p-6 space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Name *"}),S.jsx("input",{type:"text",value:w.name,onChange:C=>A({...w,name:C.target.value}),required:!0,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Main Store"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Address"}),S.jsx("textarea",{value:w.address,onChange:C=>A({...w,address:C.target.value}),rows:3,className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"123 Main St, City"})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Phone"}),S.jsx("input",{type:"tel",value:w.phone,onChange:C=>A({...w,phone:C.target.value}),className:"w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+1 234 567 8900"})]}),S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("input",{type:"checkbox",id:"is_active",checked:w.is_active,onChange:C=>A({...w,is_active:C.target.checked}),className:"rounded"}),S.jsx("label",{htmlFor:"is_active",className:"text-sm text-gray-700",children:"Active"})]}),S.jsxs("div",{className:"flex gap-3 pt-4",children:[S.jsx("button",{type:"button",onClick:()=>f(!1),className:"flex-1 px-4 py-2 border rounded-lg hover:bg-gray-50",children:"Cancel"}),S.jsx("button",{type:"submit",disabled:x,className:"flex-1 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:x?"Saving...":h?"Update":"Create"})]})]})]})})]})}const NE={free:{name:"Free",price:0,features:["1 Store","100 Products","Basic Reports"]},basic:{name:"Basic",price:29,features:["3 Stores","1000 Products","Advanced Reports","Priority Support"]},premium:{name:"Premium",price:79,features:["10 Stores","Unlimited Products","All Reports","Priority Support","API Access"]},enterprise:{name:"Enterprise",price:199,features:["Unlimited Stores","Unlimited Products","Custom Features","Dedicated Support","API Access","Custom Integrations"]}};function Foe(){const{user:e,tenant:t}=Qh(),[n,r]=W.useState(t),[i,o]=W.useState(!1),[u,f]=W.useState(!1),[h,p]=W.useState((t==null?void 0:t.name)||"");W.useEffect(()=>{(async()=>{try{const _=await gw.getTenant();r(_),p(_.name)}catch(_){console.error("Failed to fetch tenant:",_)}})()},[]);const x=async()=>{o(!0);try{const A=await gw.updateTenant({name:h});r(A),f(!1)}catch(A){console.error("Failed to update tenant:",A),alert("Failed to update business name")}finally{o(!1)}},m=A=>{alert(`Upgrade to ${A} - This would integrate with a payment provider in production`)},w=NE[(n==null?void 0:n.subscription_plan)||"free"];return S.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[S.jsx(HM,{size:20}),"Business Information"]}),S.jsxs("div",{className:"space-y-4",children:[S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Business Name"}),u?S.jsxs("div",{className:"flex gap-2",children:[S.jsx("input",{type:"text",value:h,onChange:A=>p(A.target.value),className:"flex-1 px-4 py-2 border rounded-lg focus:ring-2 focus:ring-blue-500 focus:border-transparent"}),S.jsx("button",{onClick:x,disabled:i,className:"px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 disabled:opacity-50",children:"Save"}),S.jsx("button",{onClick:()=>f(!1),className:"px-4 py-2 border rounded-lg hover:bg-gray-50",children:"Cancel"})]}):S.jsxs("div",{className:"flex items-center gap-3",children:[S.jsx("p",{className:"text-lg font-medium",children:n==null?void 0:n.name}),S.jsx("button",{onClick:()=>f(!0),className:"text-blue-600 hover:underline text-sm",children:"Edit"})]})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Your Role"}),S.jsx("p",{className:"capitalize",children:e==null?void 0:e.role})]}),S.jsxs("div",{children:[S.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:"Email"}),S.jsx("p",{children:e==null?void 0:e.email})]})]})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[S.jsx(xw,{size:20}),"Subscription Plan"]}),S.jsxs("div",{className:"flex items-center gap-4 mb-6 p-4 bg-blue-50 rounded-lg",children:[S.jsx("div",{className:"w-12 h-12 bg-blue-600 rounded-full flex items-center justify-center",children:S.jsx(xw,{className:"text-white",size:24})}),S.jsxs("div",{className:"flex-1",children:[S.jsxs("p",{className:"font-semibold text-lg",children:[w.name," Plan"]}),S.jsxs("p",{className:"text-gray-600",children:["$",w.price,"/month"]})]}),S.jsx("div",{children:S.jsx("span",{className:`px-3 py-1 rounded-full text-sm font-medium ${(n==null?void 0:n.subscription_status)==="active"?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:(n==null?void 0:n.subscription_status)==="active"?"Active":"Inactive"})})]}),S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4",children:Object.entries(NE).map(([A,_])=>S.jsxs("div",{className:`border-2 rounded-xl p-4 ${(n==null?void 0:n.subscription_plan)===A?"border-blue-600 bg-blue-50":"border-gray-200 hover:border-gray-300"}`,children:[S.jsx("h4",{className:"font-semibold text-lg",children:_.name}),S.jsxs("p",{className:"text-2xl font-bold text-gray-800 mt-1",children:["$",_.price,S.jsx("span",{className:"text-sm font-normal text-gray-500",children:"/mo"})]}),S.jsx("ul",{className:"mt-4 space-y-2",children:_.features.map((T,N)=>S.jsxs("li",{className:"text-sm text-gray-600 flex items-center gap-2",children:[S.jsx(yw,{size:14,className:"text-green-500"}),T]},N))}),(n==null?void 0:n.subscription_plan)!==A&&S.jsx("button",{onClick:()=>m(A),className:"w-full mt-4 px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors",children:"Upgrade"})]},A))})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Plan Features"}),S.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:w.features.map((A,_)=>S.jsxs("div",{className:"flex items-center gap-3 p-3 bg-gray-50 rounded-lg",children:[S.jsx(yw,{className:"text-green-500",size:20}),S.jsx("span",{children:A})]},_))})]}),S.jsxs("div",{className:"bg-white rounded-xl shadow-sm p-6",children:[S.jsxs("h3",{className:"text-lg font-semibold mb-4 flex items-center gap-2",children:[S.jsx(RO,{size:20}),"Need Help?"]}),S.jsx("p",{className:"text-gray-600 mb-4",children:"If you have any questions about your subscription or need assistance, please contact our support team."}),S.jsx("button",{className:"px-4 py-2 bg-gray-800 text-white rounded-lg hover:bg-gray-900",children:"Contact Support"})]})]})}function vi({children:e}){const{isAuthenticated:t}=Qh();return t?S.jsx(l5,{children:e}):S.jsx(fg,{to:"/login",replace:!0})}function $oe(){return S.jsx(v6,{children:S.jsxs(d6,{children:[S.jsx(ir,{path:"/login",element:S.jsx(u5,{})}),S.jsx(ir,{path:"/dashboard",element:S.jsx(vi,{children:S.jsx(Jie,{})})}),S.jsx(ir,{path:"/pos",element:S.jsx(vi,{children:S.jsx(eae,{})})}),S.jsx(ir,{path:"/orders",element:S.jsx(vi,{children:S.jsx(uoe,{})})}),S.jsx(ir,{path:"/products",element:S.jsx(vi,{children:S.jsx(coe,{})})}),S.jsx(ir,{path:"/inventory",element:S.jsx(vi,{children:S.jsx(foe,{})})}),S.jsx(ir,{path:"/scanner",element:S.jsx(vi,{children:S.jsx(joe,{})})}),S.jsx(ir,{path:"/reports",element:S.jsx(vi,{children:S.jsx(Loe,{})})}),S.jsx(ir,{path:"/stores",element:S.jsx(vi,{children:S.jsx(Boe,{})})}),S.jsx(ir,{path:"/settings",element:S.jsx(vi,{children:S.jsx(Foe,{})})}),S.jsx(ir,{path:"/",element:S.jsx(fg,{to:"/dashboard",replace:!0})}),S.jsx(ir,{path:"*",element:S.jsx(fg,{to:"/dashboard",replace:!0})})]})})}yp.createRoot(document.getElementById("root")).render(S.jsx(Y.StrictMode,{children:S.jsx($oe,{})}));