@edgex-web/components 0.1.0-beta.13 → 0.1.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Deposit/src/DepositManager.d.ts.map +1 -1
- package/dist/components/Deposit/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Deposit/src/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/mpc/WalletView.d.ts +1 -0
- package/dist/components/Deposit/src/mpc/WalletView.d.ts.map +1 -1
- package/dist/components/Deposit/src/mpc/index.d.ts +1 -0
- package/dist/components/Deposit/src/mpc/index.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/Asset.d.ts +0 -1
- package/dist/components/Deposit/src/selector/Asset.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/Chain.d.ts.map +1 -1
- package/dist/components/Deposit/src/selector/index.d.ts.map +1 -1
- package/dist/components/Deposit/types/index.d.ts +2 -0
- package/dist/components/Deposit/types/index.d.ts.map +1 -1
- package/dist/components/Withdraw/src/constants.d.ts +1 -1
- package/dist/components/Withdraw/src/constants.d.ts.map +1 -1
- package/dist/index.esm.js +4017 -3160
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +30 -30
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -6
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(oe,d){typeof exports=="object"&&typeof module<"u"?d(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],d):(oe=typeof globalThis<"u"?globalThis:oe||self,d(oe.EdgeXComponents={},oe.React,oe.ReactDOM))})(this,function(oe,d,xe){"use strict";var Ud=Object.defineProperty;var Vd=(oe,d,xe)=>d in oe?Ud(oe,d,{enumerable:!0,configurable:!0,writable:!0,value:xe}):oe[d]=xe;var nt=(oe,d,xe)=>Vd(oe,typeof d!="symbol"?d+"":d,xe);function Br(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const H=Br(d),Gt=Br(xe);function Ws(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nn={exports:{}},Mt={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Wr;function Us(){if(Wr)return Mt;Wr=1;var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function u(a,i,l){var c,p={},m=null,f=null;l!==void 0&&(m=""+l),i.key!==void 0&&(m=""+i.key),i.ref!==void 0&&(f=i.ref);for(c in i)r.call(i,c)&&!s.hasOwnProperty(c)&&(p[c]=i[c]);if(a&&a.defaultProps)for(c in i=a.defaultProps,i)p[c]===void 0&&(p[c]=i[c]);return{$$typeof:t,type:a,key:m,ref:f,props:p,_owner:o.current}}return Mt.Fragment=n,Mt.jsx=u,Mt.jsxs=u,Mt}var Lt={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,48 +14,48 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var Ur;function Vs(){return Ur||(Ur=1,process.env.NODE_ENV!=="production"&&function(){var e=d,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),u=Symbol.for("react.provider"),a=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),f=Symbol.for("react.offscreen"),b=Symbol.iterator,y="@@iterator";function N(O){if(O===null||typeof O!="object")return null;var k=b&&O[b]||O[y];return typeof k=="function"?k:null}var I=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(O){{for(var k=arguments.length,V=new Array(k>1?k-1:0),Y=1;Y<k;Y++)V[Y-1]=arguments[Y];T("error",O,V)}}function T(O,k,V){{var Y=I.ReactDebugCurrentFrame,ne=Y.getStackAddendum();ne!==""&&(k+="%s",V=V.concat([ne]));var se=V.map(function(te){return String(te)});se.unshift("Warning: "+k),Function.prototype.apply.call(console[O],console,se)}}var j=!1,_=!1,B=!1,W=!1,h=!1,v;v=Symbol.for("react.module.reference");function g(O){return!!(typeof O=="string"||typeof O=="function"||O===r||O===s||h||O===o||O===l||O===c||W||O===f||j||_||B||typeof O=="object"&&O!==null&&(O.$$typeof===m||O.$$typeof===p||O.$$typeof===u||O.$$typeof===a||O.$$typeof===i||O.$$typeof===v||O.getModuleId!==void 0))}function x(O,k,V){var Y=O.displayName;if(Y)return Y;var ne=k.displayName||k.name||"";return ne!==""?V+"("+ne+")":V}function C(O){return O.displayName||"Context"}function A(O){if(O==null)return null;if(typeof O.tag=="number"&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof O=="function")return O.displayName||O.name||null;if(typeof O=="string")return O;switch(O){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case c:return"SuspenseList"}if(typeof O=="object")switch(O.$$typeof){case a:var k=O;return C(k)+".Consumer";case u:var V=O;return C(V._context)+".Provider";case i:return x(O,O.render,"ForwardRef");case p:var Y=O.displayName||null;return Y!==null?Y:A(O.type)||"Memo";case m:{var ne=O,se=ne._payload,te=ne._init;try{return A(te(se))}catch{return null}}}return null}var P=Object.assign,S=0,$,L,E,D,F,R,U;function G(){}G.__reactDisabledLog=!0;function ee(){{if(S===0){$=console.log,L=console.info,E=console.warn,D=console.error,F=console.group,R=console.groupCollapsed,U=console.groupEnd;var O={configurable:!0,enumerable:!0,value:G,writable:!0};Object.defineProperties(console,{info:O,log:O,warn:O,error:O,group:O,groupCollapsed:O,groupEnd:O})}S++}}function q(){{if(S--,S===0){var O={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:P({},O,{value:$}),info:P({},O,{value:L}),warn:P({},O,{value:E}),error:P({},O,{value:D}),group:P({},O,{value:F}),groupCollapsed:P({},O,{value:R}),groupEnd:P({},O,{value:U})})}S<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var X=I.ReactCurrentDispatcher,z;function re(O,k,V){{if(z===void 0)try{throw Error()}catch(ne){var Y=ne.stack.trim().match(/\n( *(at )?)/);z=Y&&Y[1]||""}return`
|
|
18
|
+
`+z+O}}var de=!1,_e;{var je=typeof WeakMap=="function"?WeakMap:Map;_e=new je}function ct(O,k){if(!O||de)return"";{var V=_e.get(O);if(V!==void 0)return V}var Y;de=!0;var ne=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var se;se=X.current,X.current=null,ee();try{if(k){var te=function(){throw Error()};if(Object.defineProperty(te.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(te,[])}catch(Oe){Y=Oe}Reflect.construct(O,[],te)}else{try{te.call()}catch(Oe){Y=Oe}O.call(te.prototype)}}else{try{throw Error()}catch(Oe){Y=Oe}O()}}catch(Oe){if(Oe&&Y&&typeof Oe.stack=="string"){for(var J=Oe.stack.split(`
|
|
19
|
+
`),we=Y.stack.split(`
|
|
20
|
+
`),fe=J.length-1,pe=we.length-1;fe>=1&&pe>=0&&J[fe]!==we[pe];)pe--;for(;fe>=1&&pe>=0;fe--,pe--)if(J[fe]!==we[pe]){if(fe!==1||pe!==1)do if(fe--,pe--,pe<0||J[fe]!==we[pe]){var ke=`
|
|
21
|
+
`+J[fe].replace(" at new "," at ");return O.displayName&&ke.includes("<anonymous>")&&(ke=ke.replace("<anonymous>",O.displayName)),typeof O=="function"&&_e.set(O,ke),ke}while(fe>=1&&pe>=0);break}}}finally{de=!1,X.current=se,q(),Error.prepareStackTrace=ne}var Pt=O?O.displayName||O.name:"",yt=Pt?re(Pt):"";return typeof O=="function"&&_e.set(O,yt),yt}function Se(O,k,V){return ct(O,!1)}function ve(O){var k=O.prototype;return!!(k&&k.isReactComponent)}function ie(O,k,V){if(O==null)return"";if(typeof O=="function")return ct(O,ve(O));if(typeof O=="string")return re(O);switch(O){case l:return re("Suspense");case c:return re("SuspenseList")}if(typeof O=="object")switch(O.$$typeof){case i:return Se(O.render);case p:return ie(O.type,k,V);case m:{var Y=O,ne=Y._payload,se=Y._init;try{return ie(se(ne),k,V)}catch{}}}return""}var Ht=Object.prototype.hasOwnProperty,As={},Ns=I.ReactDebugCurrentFrame;function An(O){if(O){var k=O._owner,V=ie(O.type,O._source,k?k.type:null);Ns.setExtraStackFrame(V)}else Ns.setExtraStackFrame(null)}function xd(O,k,V,Y,ne){{var se=Function.call.bind(Ht);for(var te in O)if(se(O,te)){var J=void 0;try{if(typeof O[te]!="function"){var we=Error((Y||"React class")+": "+V+" type `"+te+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof O[te]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw we.name="Invariant Violation",we}J=O[te](k,te,Y,V,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(fe){J=fe}J&&!(J instanceof Error)&&(An(ne),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",Y||"React class",V,te,typeof J),An(null)),J instanceof Error&&!(J.message in As)&&(As[J.message]=!0,An(ne),w("Failed %s type: %s",V,J.message),An(null))}}}var wd=Array.isArray;function Fr(O){return wd(O)}function Ed(O){{var k=typeof Symbol=="function"&&Symbol.toStringTag,V=k&&O[Symbol.toStringTag]||O.constructor.name||"Object";return V}}function Cd(O){try{return $s(O),!1}catch{return!0}}function $s(O){return""+O}function Ts(O){if(Cd(O))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ed(O)),$s(O)}var Ps=I.ReactCurrentOwner,Sd={key:!0,ref:!0,__self:!0,__source:!0},Ms,Ls;function Od(O){if(Ht.call(O,"ref")){var k=Object.getOwnPropertyDescriptor(O,"ref").get;if(k&&k.isReactWarning)return!1}return O.ref!==void 0}function Ad(O){if(Ht.call(O,"key")){var k=Object.getOwnPropertyDescriptor(O,"key").get;if(k&&k.isReactWarning)return!1}return O.key!==void 0}function Nd(O,k){typeof O.ref=="string"&&Ps.current}function $d(O,k){{var V=function(){Ms||(Ms=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};V.isReactWarning=!0,Object.defineProperty(O,"key",{get:V,configurable:!0})}}function Td(O,k){{var V=function(){Ls||(Ls=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",k))};V.isReactWarning=!0,Object.defineProperty(O,"ref",{get:V,configurable:!0})}}var Pd=function(O,k,V,Y,ne,se,te){var J={$$typeof:t,type:O,key:k,ref:V,props:te,_owner:se};return J._store={},Object.defineProperty(J._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(J,"_self",{configurable:!1,enumerable:!1,writable:!1,value:Y}),Object.defineProperty(J,"_source",{configurable:!1,enumerable:!1,writable:!1,value:ne}),Object.freeze&&(Object.freeze(J.props),Object.freeze(J)),J};function Md(O,k,V,Y,ne){{var se,te={},J=null,we=null;V!==void 0&&(Ts(V),J=""+V),Ad(k)&&(Ts(k.key),J=""+k.key),Od(k)&&(we=k.ref,Nd(k,ne));for(se in k)Ht.call(k,se)&&!Sd.hasOwnProperty(se)&&(te[se]=k[se]);if(O&&O.defaultProps){var fe=O.defaultProps;for(se in fe)te[se]===void 0&&(te[se]=fe[se])}if(J||we){var pe=typeof O=="function"?O.displayName||O.name||"Unknown":O;J&&$d(te,pe),we&&Td(te,pe)}return Pd(O,J,we,ne,Y,Ps.current,te)}}var _r=I.ReactCurrentOwner,Is=I.ReactDebugCurrentFrame;function Tt(O){if(O){var k=O._owner,V=ie(O.type,O._source,k?k.type:null);Is.setExtraStackFrame(V)}else Is.setExtraStackFrame(null)}var jr;jr=!1;function kr(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function Ds(){{if(_r.current){var O=A(_r.current.type);if(O)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+
|
|
23
|
+
Check the render method of \``+O+"`."}return""}}function Ld(O){return""}var Fs={};function Id(O){{var k=Ds();if(!k){var V=typeof O=="string"?O:O.displayName||O.name;V&&(k=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+V+">.")}return k}}function _s(O,k){{if(!O._store||O._store.validated||O.key!=null)return;O._store.validated=!0;var V=Id(k);if(Fs[V])return;Fs[V]=!0;var Y="";O&&O._owner&&O._owner!==_r.current&&(Y=" It was passed a child from "+A(O._owner.type)+"."),Tt(O),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',V,Y),Tt(null)}}function js(O,k){{if(typeof O!="object")return;if(Fr(O))for(var V=0;V<O.length;V++){var Y=O[V];kr(Y)&&_s(Y,k)}else if(kr(O))O._store&&(O._store.validated=!0);else if(O){var ne=N(O);if(typeof ne=="function"&&ne!==O.entries)for(var se=ne.call(O),te;!(te=se.next()).done;)kr(te.value)&&_s(te.value,k)}}}function Dd(O){{var k=O.type;if(k==null||typeof k=="string")return;var V;if(typeof k=="function")V=k.propTypes;else if(typeof k=="object"&&(k.$$typeof===i||k.$$typeof===p))V=k.propTypes;else return;if(V){var Y=A(k);xd(V,O.props,"prop",Y,O)}else if(k.PropTypes!==void 0&&!jr){jr=!0;var ne=A(k);w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ne||"Unknown")}typeof k.getDefaultProps=="function"&&!k.getDefaultProps.isReactClassApproved&&w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Fd(O){{for(var k=Object.keys(O.props),V=0;V<k.length;V++){var Y=k[V];if(Y!=="children"&&Y!=="key"){Tt(O),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",Y),Tt(null);break}}O.ref!==null&&(Tt(O),w("Invalid attribute `ref` supplied to `React.Fragment`."),Tt(null))}}var ks={};function Rs(O,k,V,Y,ne,se){{var te=g(O);if(!te){var J="";(O===void 0||typeof O=="object"&&O!==null&&Object.keys(O).length===0)&&(J+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var we=Ld();we?J+=we:J+=Ds();var fe;O===null?fe="null":Fr(O)?fe="array":O!==void 0&&O.$$typeof===t?(fe="<"+(A(O.type)||"Unknown")+" />",J=" Did you accidentally export a JSX literal instead of a component?"):fe=typeof O,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",fe,J)}var pe=Md(O,k,V,ne,se);if(pe==null)return pe;if(te){var ke=k.children;if(ke!==void 0)if(Y)if(Fr(ke)){for(var Pt=0;Pt<ke.length;Pt++)js(ke[Pt],O);Object.freeze&&Object.freeze(ke)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else js(ke,O)}if(Ht.call(k,"key")){var yt=A(O),Oe=Object.keys(k).filter(function(Wd){return Wd!=="key"}),Rr=Oe.length>0?"{key: someKey, "+Oe.join(": ..., ")+": ...}":"{key: someKey}";if(!ks[yt+Rr]){var Bd=Oe.length>0?"{"+Oe.join(": ..., ")+": ...}":"{}";w(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,
|
|
30
|
+
<%s key={someKey} {...props} />`,Rr,yt,Bd,yt),ks[yt+Rr]=!0}}return O===r?Fd(pe):Dd(pe),pe}}function _d(O,k,V){return Rs(O,k,V,!0)}function jd(O,k,V){return Rs(O,k,V,!1)}var kd=jd,Rd=_d;Lt.Fragment=r,Lt.jsx=kd,Lt.jsxs=Rd}()),Lt}process.env.NODE_ENV==="production"?Nn.exports=Us():Nn.exports=Vs();var M=Nn.exports;const zs=d.createContext(null),Hs=({config:e,children:t})=>M.jsx(zs.Provider,{value:e,children:t}),Gs=()=>({openDeposit:d.useCallback(t=>{},[])}),Ys=()=>({openWithdraw:d.useCallback(t=>{},[])});/**
|
|
31
31
|
* @license lucide-react v0.540.0 - ISC
|
|
32
32
|
*
|
|
33
33
|
* This source code is licensed under the ISC license.
|
|
34
34
|
* See the LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/const
|
|
35
|
+
*/const Ks=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),qs=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),Vr=e=>{const t=qs(e);return t.charAt(0).toUpperCase()+t.slice(1)},zr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),Qs=e=>{for(const t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0};/**
|
|
36
36
|
* @license lucide-react v0.540.0 - ISC
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the ISC license.
|
|
39
39
|
* See the LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/var
|
|
40
|
+
*/var Xs={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"};/**
|
|
41
41
|
* @license lucide-react v0.540.0 - ISC
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the ISC license.
|
|
44
44
|
* See the LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/const
|
|
45
|
+
*/const Js=d.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:u,...a},i)=>d.createElement("svg",{ref:i,...Xs,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:zr("lucide",o),...!s&&!Qs(a)&&{"aria-hidden":"true"},...a},[...u.map(([l,c])=>d.createElement(l,c)),...Array.isArray(s)?s:[s]]));/**
|
|
46
46
|
* @license lucide-react v0.540.0 - ISC
|
|
47
47
|
*
|
|
48
48
|
* This source code is licensed under the ISC license.
|
|
49
49
|
* See the LICENSE file in the root directory of this source tree.
|
|
50
|
-
*/const
|
|
50
|
+
*/const Zs=(e,t)=>{const n=d.forwardRef(({className:r,...o},s)=>d.createElement(Js,{ref:s,iconNode:t,className:zr(`lucide-${Ks(Vr(e))}`,`lucide-${e}`,r),...o}));return n.displayName=Vr(e),n};/**
|
|
51
51
|
* @license lucide-react v0.540.0 - ISC
|
|
52
52
|
*
|
|
53
53
|
* This source code is licensed under the ISC license.
|
|
54
54
|
* See the LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/const br=vs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class xr{constructor(){Be(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class bs extends xr{constructor(n,r){super();Be(this,"smartWallet");Be(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class xs extends xr{constructor(n,r,o,s="0",c="0"){super();Be(this,"currentActiveAccount");Be(this,"approved");Be(this,"chainId");Be(this,"balance");Be(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=c}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function yr(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new bs(t,e);default:return new xs(e,!1,r||1,o,s)}}const wr=typeof document<"u"?f.useLayoutEffect:()=>{};var ln;const ys=(ln=f.useInsertionEffect)!==null&&ln!==void 0?ln:wr;function ws(e){const t=f.useRef(null);return ys(()=>{t.current=e},[e]),f.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const Ve=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},Qe=e=>e&&"window"in e&&e.window===e?e:Ve(e).defaultView||window;function Es(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Cs(e){return Es(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Ss=!1;function an(){return Ss}function Er(e,t){if(!an())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:Cs(n)?n=n.host:n=n.parentNode}return!1}const un=(e=document)=>{var t;if(!an())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Cr(e){return an()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Pt(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function cn(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function _e(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const fn=_e(function(){return cn(/^Mac/i)}),$s=_e(function(){return cn(/^iPhone/i)}),Os=_e(function(){return cn(/^iPad/i)||fn()&&navigator.maxTouchPoints>1}),Ts=_e(function(){return $s()||Os()});_e(function(){return fn()||Ts()}),_e(function(){return Pt(/AppleWebKit/i)&&!Ns()});const Ns=_e(function(){return Pt(/Chrome/i)}),As=_e(function(){return Pt(/Android/i)});_e(function(){return Pt(/Firefox/i)});function Sr(){let e=f.useRef(new Map),t=f.useCallback((o,s,c,a)=>{let i=a!=null&&a.once?(...l)=>{e.current.delete(c),c(...l)}:c;e.current.set(c,{type:s,eventTarget:o,fn:i,options:a}),o.addEventListener(s,i,a)},[]),n=f.useCallback((o,s,c,a)=>{var i;let l=((i=e.current.get(c))===null||i===void 0?void 0:i.fn)||c;o.removeEventListener(s,l,a),e.current.delete(c)},[]),r=f.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return f.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function Ms(e){return e.mozInputSource===0&&e.isTrusted?!0:As()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function $r(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ps(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Or(e){let t=f.useRef({isFocused:!1,observer:null});wr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=ws(r=>{e==null||e(r)});return f.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=c=>{if(t.current.isFocused=!1,o.disabled){let a=$r(c);n(a)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var c;(c=t.current.observer)===null||c===void 0||c.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Ls=!1,vt=null,dn=new Set,bt=new Map,qe=!1,pn=!1;const Fs={Tab:!0,Escape:!0};function mn(e,t){for(let n of dn)n(e,t)}function Is(e){return!(e.metaKey||!fn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Lt(e){qe=!0,Is(e)&&(vt="keyboard",mn("keyboard",e))}function xe(e){vt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(qe=!0,mn("pointer",e))}function Tr(e){Ms(e)&&(qe=!0,vt="virtual")}function Nr(e){e.target===window||e.target===document||Ls||!e.isTrusted||(!qe&&!pn&&(vt="virtual",mn("virtual",e)),qe=!1,pn=!1)}function Ar(){qe=!1,pn=!0}function hn(e){if(typeof window>"u"||typeof document>"u"||bt.get(Qe(e)))return;const t=Qe(e),n=Ve(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){qe=!0,r.apply(this,arguments)},n.addEventListener("keydown",Lt,!0),n.addEventListener("keyup",Lt,!0),n.addEventListener("click",Tr,!0),t.addEventListener("focus",Nr,!0),t.addEventListener("blur",Ar,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",xe,!0),n.addEventListener("pointermove",xe,!0),n.addEventListener("pointerup",xe,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",xe,!0),n.addEventListener("mousemove",xe,!0),n.addEventListener("mouseup",xe,!0)),t.addEventListener("beforeunload",()=>{Mr(e)},{once:!0}),bt.set(t,{focus:r})}const Mr=(e,t)=>{const n=Qe(e),r=Ve(e);t&&r.removeEventListener("DOMContentLoaded",t),bt.has(n)&&(n.HTMLElement.prototype.focus=bt.get(n).focus,r.removeEventListener("keydown",Lt,!0),r.removeEventListener("keyup",Lt,!0),r.removeEventListener("click",Tr,!0),n.removeEventListener("focus",Nr,!0),n.removeEventListener("blur",Ar,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",xe,!0),r.removeEventListener("pointermove",xe,!0),r.removeEventListener("pointerup",xe,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",xe,!0),r.removeEventListener("mousemove",xe,!0),r.removeEventListener("mouseup",xe,!0)),bt.delete(n))};function js(e){const t=Ve(e);let n;return t.readyState!=="loading"?hn(e):(n=()=>{hn(e)},t.addEventListener("DOMContentLoaded",n)),()=>Mr(e,n)}typeof document<"u"&&js();function Pr(){return vt!=="pointer"}const Ds=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function _s(e,t,n){let r=Ve(n==null?void 0:n.target);const o=typeof window<"u"?Qe(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?Qe(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,c=typeof window<"u"?Qe(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?Qe(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Ds.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!Fs[n.key])}function ks(e,t,n){hn(),f.useEffect(()=>{let r=(o,s)=>{_s(!!(n!=null&&n.isTextInput),o,s)&&e(Pr())};return dn.add(r),()=>{dn.delete(r)}},t)}function Rs(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=f.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),c=Or(s),a=f.useCallback(i=>{const l=Ve(i.target),u=l?un(l):un();i.target===i.currentTarget&&u===Cr(i.nativeEvent)&&(n&&n(i),o&&o(!0),c(i))},[o,n,c]);return{focusProps:{onFocus:!t&&(n||o||r)?a:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Ws(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=f.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:a}=Sr(),i=f.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(p),o&&o(!1))},[n,o,s,a]),l=Or(i),u=f.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=Ve(p.target),d=un(m);if(!s.current.isFocusWithin&&d===Cr(p.nativeEvent)){r&&r(p),o&&o(!0),s.current.isFocusWithin=!0,l(p);let h=p.currentTarget;c(m,"focus",g=>{if(s.current.isFocusWithin&&!Er(h,g.target)){let b=new m.defaultView.FocusEvent("blur",{relatedTarget:g.target});Ps(b,h);let w=$r(b);i(w)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:u,onBlur:i}}}let Ft=!1,It=0;function gn(){Ft=!0,setTimeout(()=>{Ft=!1},50)}function Lr(e){e.pointerType==="touch"&&gn()}function Bs(){if(!(typeof document>"u"))return It===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Lr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",gn)),It++,()=>{It--,!(It>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Lr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",gn))}}function Vs(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=f.useState(!1),a=f.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;f.useEffect(Bs,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Sr(),{hoverProps:u,triggerHoverEnd:p}=f.useMemo(()=>{let m=(g,b)=>{if(a.pointerType=b,o||b==="touch"||a.isHovered||!g.currentTarget.contains(g.target))return;a.isHovered=!0;let w=g.currentTarget;a.target=w,i(Ve(g.target),"pointerover",E=>{a.isHovered&&a.target&&!Er(a.target,E.target)&&d(E,E.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:w,pointerType:b}),n&&n(!0),c(!0)},d=(g,b)=>{let w=a.target;a.pointerType="",a.target=null,!(b==="touch"||!a.isHovered||!w)&&(a.isHovered=!1,l(),r&&r({type:"hoverend",target:w,pointerType:b}),n&&n(!1),c(!1))},h={};return typeof PointerEvent<"u"?(h.onPointerEnter=g=>{Ft&&g.pointerType==="mouse"||m(g,g.pointerType)},h.onPointerLeave=g=>{!o&&g.currentTarget.contains(g.target)&&d(g,g.pointerType)}):process.env.NODE_ENV==="test"&&(h.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=g=>{!a.ignoreEmulatedMouseEvents&&!Ft&&m(g,"mouse"),a.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=g=>{!o&&g.currentTarget.contains(g.target)&&d(g,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,a,i,l]);return f.useEffect(()=>{o&&p({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:u,isHovered:s}}function Us(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=f.useRef({isFocused:!1,isFocusVisible:t||Pr()}),[s,c]=f.useState(!1),[a,i]=f.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=f.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),u=f.useCallback(d=>{o.current.isFocused=d,c(d),l()},[l]);ks(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:p}=Rs({isDisabled:r,onFocusChange:u}),{focusWithinProps:m}=Ws({isDisabled:!r,onFocusWithinChange:u});return{isFocused:s,isFocusVisible:a,focusProps:r?m:p}}var zs=Object.defineProperty,Hs=(e,t,n)=>t in e?zs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t,n)=>(Hs(e,typeof t!="symbol"?t+"":t,n),n);let Gs=class{constructor(){vn(this,"current",this.detect()),vn(this,"handoffState","pending"),vn(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},Ae=new Gs;function xt(e){var t,n;return Ae.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function Fr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function $e(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Fr(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=$e();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function ot(){let[e]=f.useState($e);return f.useEffect(()=>()=>e.dispose(),[e]),e}let te=(e,t)=>{Ae.isServer?f.useEffect(e,t):f.useLayoutEffect(e,t)};function Xe(e){let t=f.useRef(e);return te(()=>{t.current=e},[e]),t}let Q=function(e){let t=Xe(e);return f.useCallback((...n)=>t.current(...n),[t])};function Ys(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Ks(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Qs({disabled:e=!1}={}){let t=f.useRef(null),[n,r]=f.useState(!1),o=ot(),s=Q(()=>{t.current=null,r(!1),o.dispose()}),c=Q(a=>{if(o.dispose(),t.current===null){t.current=a.currentTarget,r(!0);{let i=xt(a.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let u=Ys(l);r(Ks(u,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:c,onPointerUp:s,onClick:s}}}let qs=f.createContext(void 0);function bn(){return f.useContext(qs)}function xn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function ye(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ye),r}var jt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(jt||{}),Ue=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ue||{});function ve(){let e=Js();return f.useCallback(t=>Xs({mergeRefs:e,...t}),[e])}function Xs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:a}){a=a??Zs;let i=Ir(t,e);if(s)return Dt(i,n,r,c,a);let l=o??0;if(l&2){let{static:u=!1,...p}=i;if(u)return Dt(p,n,r,c,a)}if(l&1){let{unmount:u=!0,...p}=i;return ye(u?0:1,{0(){return null},1(){return Dt({...p,hidden:!0,style:{display:"none"}},n,r,c,a)}})}return Dt(i,n,r,c,a)}function Dt(e,t={},n,r,o){let{as:s=n,children:c,refName:a="ref",...i}=yn(e,["unmount","static"]),l=e.ref!==void 0?{[a]:e.ref}:{},u=typeof c=="function"?c(t):c;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t)),i["aria-labelledby"]&&i["aria-labelledby"]===i.id&&(i["aria-labelledby"]=void 0);let p={};if(t){let m=!1,d=[];for(let[h,g]of Object.entries(t))typeof g=="boolean"&&(m=!0),g===!0&&d.push(h.replace(/([A-Z])/g,b=>`-${b.toLowerCase()}`));if(m){p["data-headlessui-state"]=d.join(" ");for(let h of d)p[`data-${h}`]=""}}if(s===f.Fragment&&(Object.keys(ze(i)).length>0||Object.keys(ze(p)).length>0))if(!f.isValidElement(u)||Array.isArray(u)&&u.length>1){if(Object.keys(ze(i)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(ze(i)).concat(Object.keys(ze(p))).map(m=>` - ${m}`).join(`
|
|
55
|
+
*/const Hr=Zs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class Gr{constructor(){nt(this,"state");this.state={isLoading:!1,isApproving:!1,isDepositing:!1,error:null,txHash:null}}getState(){return{...this.state}}setState(t){this.state={...this.state,...t}}}class el extends Gr{constructor(n,r){super();nt(this,"smartWallet");nt(this,"currentActiveAccount");this.smartWallet=n,this.currentActiveAccount=r}getWalletType(){return"mpc"}getDisplayAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}isApprovalRequired(){return!1}getApprovalStatus(){return!0}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){}async getBalance(n){return"0"}async approve(n,r){return""}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{const o=`mpc_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`mpc_signature_${Date.now()}`}getAAWalletAddress(){var n,r;return((n=this.smartWallet)==null?void 0:n.address)||((r=this.currentActiveAccount)==null?void 0:r.ethAddress)||""}}class tl extends Gr{constructor(n,r,o,s="0",u="0"){super();nt(this,"currentActiveAccount");nt(this,"approved");nt(this,"chainId");nt(this,"balance");nt(this,"allowance");this.currentActiveAccount=n,this.approved=r,this.chainId=o,this.balance=s,this.allowance=u}getWalletType(){return"evm"}getDisplayAddress(){var n;return((n=this.currentActiveAccount)==null?void 0:n.ethAddress)||""}isApprovalRequired(){return!0}getApprovalStatus(){return this.approved}async connect(){this.setState({isLoading:!0,error:null});try{this.setState({isLoading:!1})}catch(n){throw this.setState({isLoading:!1,error:n instanceof Error?n.message:"Connection failed"}),n}}async disconnect(){}async switchChain(n){this.setState({isLoading:!0,error:null});try{this.chainId=n,this.setState({isLoading:!1})}catch(r){throw this.setState({isLoading:!1,error:r instanceof Error?r.message:"Chain switch failed"}),r}}async getBalance(n){return this.balance}async approve(n,r){this.setState({isApproving:!0,error:null});try{const o=`evm_approve_${Date.now()}`;return this.approved=!0,this.setState({isApproving:!1,txHash:o}),o}catch(o){throw this.setState({isApproving:!1,error:o instanceof Error?o.message:"Approval failed"}),o}}async deposit(n,r){this.setState({isDepositing:!0,error:null});try{if(!this.approved)throw new Error("Token approval required");const o=`evm_deposit_${Date.now()}`;return this.setState({isDepositing:!1,txHash:o}),o}catch(o){throw this.setState({isDepositing:!1,error:o instanceof Error?o.message:"Deposit failed"}),o}}async signMessage(n){return`evm_signature_${Date.now()}`}updateApprovalStatus(n){this.approved=n}updateBalance(n){this.balance=n}updateAllowance(n){this.allowance=n}}function Yr(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new el(t,e);default:return new tl(e,!1,r||1,o,s)}}const Kr=typeof document<"u"?d.useLayoutEffect:()=>{};var $n;const nl=($n=d.useInsertionEffect)!==null&&$n!==void 0?$n:Kr;function rl(e){const t=d.useRef(null);return nl(()=>{t.current=e},[e]),d.useCallback((...n)=>{const r=t.current;return r==null?void 0:r(...n)},[])}const rt=e=>{var t;return(t=e==null?void 0:e.ownerDocument)!==null&&t!==void 0?t:document},ft=e=>e&&"window"in e&&e.window===e?e:rt(e).defaultView||window;function ol(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function il(e){return ol(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let sl=!1;function Tn(){return sl}function qr(e,t){if(!Tn())return t&&e?e.contains(t):!1;if(!e||!t)return!1;let n=t;for(;n!==null;){if(n===e)return!0;n.tagName==="SLOT"&&n.assignedSlot?n=n.assignedSlot.parentNode:il(n)?n=n.host:n=n.parentNode}return!1}const Pn=(e=document)=>{var t;if(!Tn())return e.activeElement;let n=e.activeElement;for(;n&&"shadowRoot"in n&&(!((t=n.shadowRoot)===null||t===void 0)&&t.activeElement);)n=n.shadowRoot.activeElement;return n};function Qr(e){return Tn()&&e.target.shadowRoot&&e.composedPath?e.composedPath()[0]:e.target}function Yt(e){var t;if(typeof window>"u"||window.navigator==null)return!1;let n=(t=window.navigator.userAgentData)===null||t===void 0?void 0:t.brands;return Array.isArray(n)&&n.some(r=>e.test(r.brand))||e.test(window.navigator.userAgent)}function Mn(e){var t;return typeof window<"u"&&window.navigator!=null?e.test(((t=window.navigator.userAgentData)===null||t===void 0?void 0:t.platform)||window.navigator.platform):!1}function Je(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const Ln=Je(function(){return Mn(/^Mac/i)}),ll=Je(function(){return Mn(/^iPhone/i)}),al=Je(function(){return Mn(/^iPad/i)||Ln()&&navigator.maxTouchPoints>1}),ul=Je(function(){return ll()||al()});Je(function(){return Ln()||ul()}),Je(function(){return Yt(/AppleWebKit/i)&&!cl()});const cl=Je(function(){return Yt(/Chrome/i)}),fl=Je(function(){return Yt(/Android/i)});Je(function(){return Yt(/Firefox/i)});function Xr(){let e=d.useRef(new Map),t=d.useCallback((o,s,u,a)=>{let i=a!=null&&a.once?(...l)=>{e.current.delete(u),u(...l)}:u;e.current.set(u,{type:s,eventTarget:o,fn:i,options:a}),o.addEventListener(s,i,a)},[]),n=d.useCallback((o,s,u,a)=>{var i;let l=((i=e.current.get(u))===null||i===void 0?void 0:i.fn)||u;o.removeEventListener(s,l,a),e.current.delete(u)},[]),r=d.useCallback(()=>{e.current.forEach((o,s)=>{n(o.eventTarget,o.type,s,o.options)})},[n]);return d.useEffect(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function dl(e){return e.mozInputSource===0&&e.isTrusted?!0:fl()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Jr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function pl(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function Zr(e){let t=d.useRef({isFocused:!1,observer:null});Kr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=rl(r=>{e==null||e(r)});return d.useCallback(r=>{if(r.target instanceof HTMLButtonElement||r.target instanceof HTMLInputElement||r.target instanceof HTMLTextAreaElement||r.target instanceof HTMLSelectElement){t.current.isFocused=!0;let o=r.target,s=u=>{if(t.current.isFocused=!1,o.disabled){let a=Jr(u);n(a)}t.current.observer&&(t.current.observer.disconnect(),t.current.observer=null)};o.addEventListener("focusout",s,{once:!0}),t.current.observer=new MutationObserver(()=>{if(t.current.isFocused&&o.disabled){var u;(u=t.current.observer)===null||u===void 0||u.disconnect();let a=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:a})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:a}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let hl=!1,It=null,In=new Set,Dt=new Map,dt=!1,Dn=!1;const ml={Tab:!0,Escape:!0};function Fn(e,t){for(let n of In)n(e,t)}function gl(e){return!(e.metaKey||!Ln()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Kt(e){dt=!0,gl(e)&&(It="keyboard",Fn("keyboard",e))}function $e(e){It="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(dt=!0,Fn("pointer",e))}function eo(e){dl(e)&&(dt=!0,It="virtual")}function to(e){e.target===window||e.target===document||hl||!e.isTrusted||(!dt&&!Dn&&(It="virtual",Fn("virtual",e)),dt=!1,Dn=!1)}function no(){dt=!1,Dn=!0}function _n(e){if(typeof window>"u"||typeof document>"u"||Dt.get(ft(e)))return;const t=ft(e),n=rt(e);let r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){dt=!0,r.apply(this,arguments)},n.addEventListener("keydown",Kt,!0),n.addEventListener("keyup",Kt,!0),n.addEventListener("click",eo,!0),t.addEventListener("focus",to,!0),t.addEventListener("blur",no,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",$e,!0),n.addEventListener("pointermove",$e,!0),n.addEventListener("pointerup",$e,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",$e,!0),n.addEventListener("mousemove",$e,!0),n.addEventListener("mouseup",$e,!0)),t.addEventListener("beforeunload",()=>{ro(e)},{once:!0}),Dt.set(t,{focus:r})}const ro=(e,t)=>{const n=ft(e),r=rt(e);t&&r.removeEventListener("DOMContentLoaded",t),Dt.has(n)&&(n.HTMLElement.prototype.focus=Dt.get(n).focus,r.removeEventListener("keydown",Kt,!0),r.removeEventListener("keyup",Kt,!0),r.removeEventListener("click",eo,!0),n.removeEventListener("focus",to,!0),n.removeEventListener("blur",no,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",$e,!0),r.removeEventListener("pointermove",$e,!0),r.removeEventListener("pointerup",$e,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",$e,!0),r.removeEventListener("mousemove",$e,!0),r.removeEventListener("mouseup",$e,!0)),Dt.delete(n))};function vl(e){const t=rt(e);let n;return t.readyState!=="loading"?_n(e):(n=()=>{_n(e)},t.addEventListener("DOMContentLoaded",n)),()=>ro(e,n)}typeof document<"u"&&vl();function oo(){return It!=="pointer"}const bl=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function yl(e,t,n){let r=rt(n==null?void 0:n.target);const o=typeof window<"u"?ft(n==null?void 0:n.target).HTMLInputElement:HTMLInputElement,s=typeof window<"u"?ft(n==null?void 0:n.target).HTMLTextAreaElement:HTMLTextAreaElement,u=typeof window<"u"?ft(n==null?void 0:n.target).HTMLElement:HTMLElement,a=typeof window<"u"?ft(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!bl.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof u&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof a&&!ml[n.key])}function xl(e,t,n){_n(),d.useEffect(()=>{let r=(o,s)=>{yl(!!(n!=null&&n.isTextInput),o,s)&&e(oo())};return In.add(r),()=>{In.delete(r)}},t)}function wl(e){let{isDisabled:t,onFocus:n,onBlur:r,onFocusChange:o}=e;const s=d.useCallback(i=>{if(i.target===i.currentTarget)return r&&r(i),o&&o(!1),!0},[r,o]),u=Zr(s),a=d.useCallback(i=>{const l=rt(i.target),c=l?Pn(l):Pn();i.target===i.currentTarget&&c===Qr(i.nativeEvent)&&(n&&n(i),o&&o(!0),u(i))},[o,n,u]);return{focusProps:{onFocus:!t&&(n||o||r)?a:void 0,onBlur:!t&&(r||o)?s:void 0}}}function El(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=d.useRef({isFocusWithin:!1}),{addGlobalListener:u,removeAllGlobalListeners:a}=Xr(),i=d.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(p),o&&o(!1))},[n,o,s,a]),l=Zr(i),c=d.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=rt(p.target),f=Pn(m);if(!s.current.isFocusWithin&&f===Qr(p.nativeEvent)){r&&r(p),o&&o(!0),s.current.isFocusWithin=!0,l(p);let b=p.currentTarget;u(m,"focus",y=>{if(s.current.isFocusWithin&&!qr(b,y.target)){let N=new m.defaultView.FocusEvent("blur",{relatedTarget:y.target});pl(N,b);let I=Jr(N);i(I)}},{capture:!0})}},[r,o,l,u,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:c,onBlur:i}}}let qt=!1,Qt=0;function jn(){qt=!0,setTimeout(()=>{qt=!1},50)}function io(e){e.pointerType==="touch"&&jn()}function Cl(){if(!(typeof document>"u"))return Qt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",io):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",jn)),Qt++,()=>{Qt--,!(Qt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",io):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",jn))}}function Sl(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,u]=d.useState(!1),a=d.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;d.useEffect(Cl,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Xr(),{hoverProps:c,triggerHoverEnd:p}=d.useMemo(()=>{let m=(y,N)=>{if(a.pointerType=N,o||N==="touch"||a.isHovered||!y.currentTarget.contains(y.target))return;a.isHovered=!0;let I=y.currentTarget;a.target=I,i(rt(y.target),"pointerover",w=>{a.isHovered&&a.target&&!qr(a.target,w.target)&&f(w,w.pointerType)},{capture:!0}),t&&t({type:"hoverstart",target:I,pointerType:N}),n&&n(!0),u(!0)},f=(y,N)=>{let I=a.target;a.pointerType="",a.target=null,!(N==="touch"||!a.isHovered||!I)&&(a.isHovered=!1,l(),r&&r({type:"hoverend",target:I,pointerType:N}),n&&n(!1),u(!1))},b={};return typeof PointerEvent<"u"?(b.onPointerEnter=y=>{qt&&y.pointerType==="mouse"||m(y,y.pointerType)},b.onPointerLeave=y=>{!o&&y.currentTarget.contains(y.target)&&f(y,y.pointerType)}):process.env.NODE_ENV==="test"&&(b.onTouchStart=()=>{a.ignoreEmulatedMouseEvents=!0},b.onMouseEnter=y=>{!a.ignoreEmulatedMouseEvents&&!qt&&m(y,"mouse"),a.ignoreEmulatedMouseEvents=!1},b.onMouseLeave=y=>{!o&&y.currentTarget.contains(y.target)&&f(y,"mouse")}),{hoverProps:b,triggerHoverEnd:f}},[t,n,r,o,a,i,l]);return d.useEffect(()=>{o&&p({currentTarget:a.target},a.pointerType)},[o]),{hoverProps:c,isHovered:s}}function Ol(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=d.useRef({isFocused:!1,isFocusVisible:t||oo()}),[s,u]=d.useState(!1),[a,i]=d.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=d.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),c=d.useCallback(f=>{o.current.isFocused=f,u(f),l()},[l]);xl(f=>{o.current.isFocusVisible=f,l()},[],{isTextInput:n});let{focusProps:p}=wl({isDisabled:r,onFocusChange:c}),{focusWithinProps:m}=El({isDisabled:!r,onFocusWithinChange:c});return{isFocused:s,isFocusVisible:a,focusProps:r?m:p}}var Al=Object.defineProperty,Nl=(e,t,n)=>t in e?Al(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kn=(e,t,n)=>(Nl(e,typeof t!="symbol"?t+"":t,n),n);let $l=class{constructor(){kn(this,"current",this.detect()),kn(this,"handoffState","pending"),kn(this,"currentId",0)}set(t){this.current!==t&&(this.handoffState="pending",this.currentId=0,this.current=t)}reset(){this.set(this.detect())}nextId(){return++this.currentId}get isServer(){return this.current==="server"}get isClient(){return this.current==="client"}detect(){return typeof window>"u"||typeof document>"u"?"server":"client"}handoff(){this.handoffState==="pending"&&(this.handoffState="complete")}get isHandoffComplete(){return this.handoffState==="complete"}},ze=new $l;function Ft(e){var t,n;return ze.isServer?null:e?"ownerDocument"in e?e.ownerDocument:"current"in e?(n=(t=e.current)==null?void 0:t.ownerDocument)!=null?n:document:null:document}function so(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Re(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return so(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Re();return n(r),this.add(()=>r.dispose())},add(n){return e.includes(n)||e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function xt(){let[e]=d.useState(Re);return d.useEffect(()=>()=>e.dispose(),[e]),e}let le=(e,t)=>{ze.isServer?d.useEffect(e,t):d.useLayoutEffect(e,t)};function pt(e){let t=d.useRef(e);return le(()=>{t.current=e},[e]),t}let Z=function(e){let t=pt(e);return d.useCallback((...n)=>t.current(...n),[t])};function Tl(e){let t=e.width/2,n=e.height/2;return{top:e.clientY-n,right:e.clientX+t,bottom:e.clientY+n,left:e.clientX-t}}function Pl(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ml({disabled:e=!1}={}){let t=d.useRef(null),[n,r]=d.useState(!1),o=xt(),s=Z(()=>{t.current=null,r(!1),o.dispose()}),u=Z(a=>{if(o.dispose(),t.current===null){t.current=a.currentTarget,r(!0);{let i=Ft(a.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let c=Tl(l);r(Pl(c,t.current.getBoundingClientRect()))}},!1),o.addEventListener(i,"pointercancel",s,!1)}}});return{pressed:n,pressProps:e?{}:{onPointerDown:u,onPointerUp:s,onClick:s}}}let Ll=d.createContext(void 0);function Rn(){return d.useContext(Ll)}function Bn(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}function Te(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Te),r}var Xt=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(Xt||{}),ot=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ot||{});function Ae(){let e=Dl();return d.useCallback(t=>Il({mergeRefs:e,...t}),[e])}function Il({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:u,mergeRefs:a}){a=a??Fl;let i=lo(t,e);if(s)return Jt(i,n,r,u,a);let l=o??0;if(l&2){let{static:c=!1,...p}=i;if(c)return Jt(p,n,r,u,a)}if(l&1){let{unmount:c=!0,...p}=i;return Te(c?0:1,{0(){return null},1(){return Jt({...p,hidden:!0,style:{display:"none"}},n,r,u,a)}})}return Jt(i,n,r,u,a)}function Jt(e,t={},n,r,o){let{as:s=n,children:u,refName:a="ref",...i}=Wn(e,["unmount","static"]),l=e.ref!==void 0?{[a]:e.ref}:{},c=typeof u=="function"?u(t):u;"className"in i&&i.className&&typeof i.className=="function"&&(i.className=i.className(t)),i["aria-labelledby"]&&i["aria-labelledby"]===i.id&&(i["aria-labelledby"]=void 0);let p={};if(t){let m=!1,f=[];for(let[b,y]of Object.entries(t))typeof y=="boolean"&&(m=!0),y===!0&&f.push(b.replace(/([A-Z])/g,N=>`-${N.toLowerCase()}`));if(m){p["data-headlessui-state"]=f.join(" ");for(let b of f)p[`data-${b}`]=""}}if(s===d.Fragment&&(Object.keys(it(i)).length>0||Object.keys(it(p)).length>0))if(!d.isValidElement(c)||Array.isArray(c)&&c.length>1){if(Object.keys(it(i)).length>0)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(it(i)).concat(Object.keys(it(p))).map(m=>` - ${m}`).join(`
|
|
56
56
|
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(m=>` - ${m}`).join(`
|
|
57
57
|
`)].join(`
|
|
58
|
-
`))}else{let m=u.props,d=m==null?void 0:m.className,h=typeof d=="function"?(...w)=>xn(d(...w),i.className):xn(d,i.className),g=h?{className:h}:{},b=Ir(u.props,ze(yn(i,["ref"])));for(let w in p)w in b&&delete p[w];return f.cloneElement(u,Object.assign({},b,p,l,{ref:o(el(u),l.ref)},g))}return f.createElement(s,Object.assign({},yn(i,["ref"]),s!==f.Fragment&&l,s!==f.Fragment&&p),u)}function Js(){let e=f.useRef([]),t=f.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Zs(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function Ir(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let c=n[r];for(let a of c){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...s)}}});return t}function jr(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let c of s)c==null||c(...o)}});return t}function he(e){var t;return Object.assign(f.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ze(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function yn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function el(e){return f.version.split(".")[0]>="19"?e.props.ref:e.ref}function tl(e,t,n){let[r,o]=f.useState(n),s=e!==void 0,c=f.useRef(s),a=f.useRef(!1),i=f.useRef(!1);return s&&!c.current&&!a.current?(a.current=!0,c.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&c.current&&!i.current&&(i.current=!0,c.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,Q(l=>(s||o(l),t==null?void 0:t(l)))]}function nl(e){let[t]=f.useState(e);return t}function Dr(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))kr(n,_r(t,r),o);return n}function _r(e,t){return e?e+"["+t+"]":t}function kr(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())kr(e,_r(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Dr(n,t,e)}function rl(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let ol="span";var wn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(wn||{});function il(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return ve()({ourProps:s,theirProps:o,slot:{},defaultTag:ol,name:"Hidden"})}let Rr=he(il),sl=f.createContext(null);function ll({children:e}){let t=f.useContext(sl);if(!t)return f.createElement(f.Fragment,null,e);let{target:n}=t;return n?de.createPortal(f.createElement(f.Fragment,null,e),n):null}function al({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=f.useState(null),a=ot();return f.useEffect(()=>{if(r&&s)return a.addEventListener(s,"reset",r)},[s,t,r]),f.createElement(ll,null,f.createElement(ul,{setForm:c,formId:t}),Dr(e).map(([i,l])=>f.createElement(Rr,{features:wn.Hidden,...ze({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function ul({setForm:e,formId:t}){return f.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:f.createElement(Rr,{features:wn.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let cl=f.createContext(void 0);function Wr(){return f.useContext(cl)}function En(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function _t(e){return En(e)&&"tagName"in e}function ke(e){return _t(e)&&"accessKey"in e}function it(e){return _t(e)&&"tabIndex"in e}function fl(e){return _t(e)&&"style"in e}function dl(e){return ke(e)&&e.nodeName==="IFRAME"}function Br(e){return ke(e)&&e.nodeName==="INPUT"}function Vr(e){return ke(e)&&e.nodeName==="LABEL"}function pl(e){return ke(e)&&e.nodeName==="FIELDSET"}function Ur(e){return ke(e)&&e.nodeName==="LEGEND"}function ml(e){return _t(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function hl(e){let t=e.parentElement,n=null;for(;t&&!pl(t);)Ur(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&gl(n)?!1:r}function gl(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Ur(t))return!1;t=t.previousElementSibling}return!0}let zr=Symbol();function vl(e,t=!0){return Object.assign(e,{[zr]:t})}function we(...e){let t=f.useRef(e);f.useEffect(()=>{t.current=e},[e]);let n=Q(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[zr]))?void 0:n}let Cn=f.createContext(null);Cn.displayName="DescriptionContext";function Hr(){let e=f.useContext(Cn);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Hr),t}return e}function bl(){var e,t;return(t=(e=f.useContext(Cn))==null?void 0:e.value)!=null?t:void 0}let xl="p";function yl(e,t){let n=f.useId(),r=bn(),{id:o=`headlessui-description-${n}`,...s}=e,c=Hr(),a=we(t);te(()=>c.register(o),[o,c.register]);let i=r||!1,l=f.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),u={ref:a,...c.props,id:o};return ve()({ourProps:u,theirProps:s,slot:l,defaultTag:xl,name:c.name||"Description"})}let wl=he(yl);Object.assign(wl,{});var le=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(le||{});let kt=f.createContext(null);kt.displayName="LabelContext";function Gr(){let e=f.useContext(kt);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Gr),t}return e}function Yr(e){var t,n,r;let o=(n=(t=f.useContext(kt))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function El({inherit:e=!1}={}){let t=Yr(),[n,r]=f.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,f.useMemo(()=>function(s){let c=Q(i=>(r(l=>[...l,i]),()=>r(l=>{let u=l.slice(),p=u.indexOf(i);return p!==-1&&u.splice(p,1),u}))),a=f.useMemo(()=>({register:c,slot:s.slot,name:s.name,props:s.props,value:s.value}),[c,s.slot,s.name,s.props,s.value]);return f.createElement(kt.Provider,{value:a},s.children)},[r])]}let Cl="label";function Sl(e,t){var n;let r=f.useId(),o=Gr(),s=Wr(),c=bn(),{id:a=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...u}=e,p=we(t);te(()=>o.register(a),[a,o.register]);let m=Q(b=>{let w=b.currentTarget;if(!(b.target!==b.currentTarget&&ml(b.target))&&(Vr(w)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),Vr(w))){let E=document.getElementById(w.htmlFor);if(E){let x=E.getAttribute("disabled");if(x==="true"||x==="")return;let C=E.getAttribute("aria-disabled");if(C==="true"||C==="")return;(Br(E)&&(E.type==="file"||E.type==="radio"||E.type==="checkbox")||E.role==="radio"||E.role==="checkbox"||E.role==="switch")&&E.click(),E.focus({preventScroll:!0})}}}),d=c||!1,h=f.useMemo(()=>({...o.slot,disabled:d}),[o.slot,d]),g={ref:p,...o.props,id:a,htmlFor:i,onClick:m};return l&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in u&&delete u.onClick),ve()({ourProps:g,theirProps:u,slot:h,defaultTag:i?Cl:"div",name:o.name||"Label"})}let $l=he(Sl),Ol=Object.assign($l,{});function Tl(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function Nl(e=Tl){return f.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function Al(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function Ml(e,t=!1){let[n,r]=f.useReducer(()=>({}),{}),o=f.useMemo(()=>Al(e),[e,n]);return te(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Kr=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var Pl=Object.defineProperty,Ll=(e,t,n)=>t in e?Pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fl=(e,t,n)=>(Ll(e,t+"",n),n),Qr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Ee=(e,t,n)=>(Qr(e,t,"read from private field"),n?n.call(e):t.get(e)),Sn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},qr=(e,t,n,r)=>(Qr(e,t,"write to private field"),t.set(e,n),n),Me,yt,wt;let Xr=class{constructor(t){Sn(this,Me,{}),Sn(this,yt,new Kr(()=>new Set)),Sn(this,wt,new Set),Fl(this,"disposables",$e()),qr(this,Me,t),Ae.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Ee(this,Me)}subscribe(t,n){if(Ae.isServer)return()=>{};let r={selector:t,callback:n,current:t(Ee(this,Me))};return Ee(this,wt).add(r),this.disposables.add(()=>{Ee(this,wt).delete(r)})}on(t,n){return Ae.isServer?()=>{}:(Ee(this,yt).get(t).add(n),this.disposables.add(()=>{Ee(this,yt).get(t).delete(n)}))}send(t){let n=this.reduce(Ee(this,Me),t);if(n!==Ee(this,Me)){qr(this,Me,n);for(let r of Ee(this,wt)){let o=r.selector(Ee(this,Me));Jr(r.current,o)||(r.current=o,r.callback(o))}for(let r of Ee(this,yt).get(t.type))r(Ee(this,Me),t)}}};Me=new WeakMap,yt=new WeakMap,wt=new WeakMap;function Jr(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:$n(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:$n(e.entries(),t.entries()):Zr(e)&&Zr(t)?$n(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function $n(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function Zr(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function On(e){let[t,n]=e(),r=$e();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Il=Object.defineProperty,jl=(e,t,n)=>t in e?Il(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eo=(e,t,n)=>(jl(e,typeof t!="symbol"?t+"":t,n),n),to=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(to||{});let Dl={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},_l=class is extends Xr{constructor(){super(...arguments),eo(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),eo(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new is({stack:[]})}reduce(t,n){return ye(n.type,Dl,t,n)}};const Tn=new Kr(()=>_l.new());var Nn={exports:{}},An={};/**
|
|
58
|
+
`))}else{let m=c.props,f=m==null?void 0:m.className,b=typeof f=="function"?(...I)=>Bn(f(...I),i.className):Bn(f,i.className),y=b?{className:b}:{},N=lo(c.props,it(Wn(i,["ref"])));for(let I in p)I in N&&delete p[I];return d.cloneElement(c,Object.assign({},N,p,l,{ref:o(_l(c),l.ref)},y))}return d.createElement(s,Object.assign({},Wn(i,["ref"]),s!==d.Fragment&&l,s!==d.Fragment&&p),c)}function Dl(){let e=d.useRef([]),t=d.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function Fl(...e){return e.every(t=>t==null)?void 0:t=>{for(let n of e)n!=null&&(typeof n=="function"?n(t):n.current=t)}}function lo(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])for(let r in n)/^(on(?:Click|Pointer|Mouse|Key)(?:Down|Up|Press)?)$/.test(r)&&(n[r]=[o=>{var s;return(s=o==null?void 0:o.preventDefault)==null?void 0:s.call(o)}]);for(let r in n)Object.assign(t,{[r](o,...s){let u=n[r];for(let a of u){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;a(o,...s)}}});return t}function ao(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];for(let r in n)Object.assign(t,{[r](...o){let s=n[r];for(let u of s)u==null||u(...o)}});return t}function Ee(e){var t;return Object.assign(d.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function it(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Wn(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}function _l(e){return d.version.split(".")[0]>="19"?e.props.ref:e.ref}function jl(e,t,n){let[r,o]=d.useState(n),s=e!==void 0,u=d.useRef(s),a=d.useRef(!1),i=d.useRef(!1);return s&&!u.current&&!a.current?(a.current=!0,u.current=s,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!s&&u.current&&!i.current&&(i.current=!0,u.current=s,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[s?e:r,Z(l=>(s||o(l),t==null?void 0:t(l)))]}function kl(e){let[t]=d.useState(e);return t}function uo(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))fo(n,co(t,r),o);return n}function co(e,t){return e?e+"["+t+"]":t}function fo(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())fo(e,co(t,r.toString()),o);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):uo(n,t,e)}function Rl(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}let Bl="span";var Un=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Un||{});function Wl(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Ae()({ourProps:s,theirProps:o,slot:{},defaultTag:Bl,name:"Hidden"})}let po=Ee(Wl),Ul=d.createContext(null);function Vl({children:e}){let t=d.useContext(Ul);if(!t)return d.createElement(d.Fragment,null,e);let{target:n}=t;return n?xe.createPortal(d.createElement(d.Fragment,null,e),n):null}function zl({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,u]=d.useState(null),a=xt();return d.useEffect(()=>{if(r&&s)return a.addEventListener(s,"reset",r)},[s,t,r]),d.createElement(Vl,null,d.createElement(Hl,{setForm:u,formId:t}),uo(e).map(([i,l])=>d.createElement(po,{features:Un.Hidden,...it({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function Hl({setForm:e,formId:t}){return d.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:d.createElement(po,{features:Un.Hidden,as:"input",type:"hidden",hidden:!0,readOnly:!0,ref:n=>{if(!n)return;let r=n.closest("form");r&&e(r)}})}let Gl=d.createContext(void 0);function ho(){return d.useContext(Gl)}function Vn(e){return typeof e!="object"||e===null?!1:"nodeType"in e}function Zt(e){return Vn(e)&&"tagName"in e}function Ze(e){return Zt(e)&&"accessKey"in e}function wt(e){return Zt(e)&&"tabIndex"in e}function Yl(e){return Zt(e)&&"style"in e}function Kl(e){return Ze(e)&&e.nodeName==="IFRAME"}function mo(e){return Ze(e)&&e.nodeName==="INPUT"}function go(e){return Ze(e)&&e.nodeName==="LABEL"}function ql(e){return Ze(e)&&e.nodeName==="FIELDSET"}function vo(e){return Ze(e)&&e.nodeName==="LEGEND"}function Ql(e){return Zt(e)?e.matches('a[href],audio[controls],button,details,embed,iframe,img[usemap],input:not([type="hidden"]),label,select,textarea,video[controls]'):!1}function Xl(e){let t=e.parentElement,n=null;for(;t&&!ql(t);)vo(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&Jl(n)?!1:r}function Jl(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(vo(t))return!1;t=t.previousElementSibling}return!0}let bo=Symbol();function Zl(e,t=!0){return Object.assign(e,{[bo]:t})}function Pe(...e){let t=d.useRef(e);d.useEffect(()=>{t.current=e},[e]);let n=Z(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[bo]))?void 0:n}let zn=d.createContext(null);zn.displayName="DescriptionContext";function yo(){let e=d.useContext(zn);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,yo),t}return e}function ea(){var e,t;return(t=(e=d.useContext(zn))==null?void 0:e.value)!=null?t:void 0}let ta="p";function na(e,t){let n=d.useId(),r=Rn(),{id:o=`headlessui-description-${n}`,...s}=e,u=yo(),a=Pe(t);le(()=>u.register(o),[o,u.register]);let i=r||!1,l=d.useMemo(()=>({...u.slot,disabled:i}),[u.slot,i]),c={ref:a,...u.props,id:o};return Ae()({ourProps:c,theirProps:s,slot:l,defaultTag:ta,name:u.name||"Description"})}let ra=Ee(na);Object.assign(ra,{});var he=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(he||{});let en=d.createContext(null);en.displayName="LabelContext";function xo(){let e=d.useContext(en);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,xo),t}return e}function wo(e){var t,n,r;let o=(n=(t=d.useContext(en))==null?void 0:t.value)!=null?n:void 0;return((r=e==null?void 0:e.length)!=null?r:0)>0?[o,...e].filter(Boolean).join(" "):o}function oa({inherit:e=!1}={}){let t=wo(),[n,r]=d.useState([]),o=e?[t,...n].filter(Boolean):n;return[o.length>0?o.join(" "):void 0,d.useMemo(()=>function(s){let u=Z(i=>(r(l=>[...l,i]),()=>r(l=>{let c=l.slice(),p=c.indexOf(i);return p!==-1&&c.splice(p,1),c}))),a=d.useMemo(()=>({register:u,slot:s.slot,name:s.name,props:s.props,value:s.value}),[u,s.slot,s.name,s.props,s.value]);return d.createElement(en.Provider,{value:a},s.children)},[r])]}let ia="label";function sa(e,t){var n;let r=d.useId(),o=xo(),s=ho(),u=Rn(),{id:a=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...c}=e,p=Pe(t);le(()=>o.register(a),[a,o.register]);let m=Z(N=>{let I=N.currentTarget;if(!(N.target!==N.currentTarget&&Ql(N.target))&&(go(I)&&N.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(N),go(I))){let w=document.getElementById(I.htmlFor);if(w){let T=w.getAttribute("disabled");if(T==="true"||T==="")return;let j=w.getAttribute("aria-disabled");if(j==="true"||j==="")return;(mo(w)&&(w.type==="file"||w.type==="radio"||w.type==="checkbox")||w.role==="radio"||w.role==="checkbox"||w.role==="switch")&&w.click(),w.focus({preventScroll:!0})}}}),f=u||!1,b=d.useMemo(()=>({...o.slot,disabled:f}),[o.slot,f]),y={ref:p,...o.props,id:a,htmlFor:i,onClick:m};return l&&("onClick"in y&&(delete y.htmlFor,delete y.onClick),"onClick"in c&&delete c.onClick),Ae()({ourProps:y,theirProps:c,slot:b,defaultTag:i?ia:"div",name:o.name||"Label"})}let la=Ee(sa),aa=Object.assign(la,{});function ua(e,t){return e!==null&&t!==null&&typeof e=="object"&&typeof t=="object"&&"id"in e&&"id"in t?e.id===t.id:e===t}function ca(e=ua){return d.useCallback((t,n)=>{if(typeof e=="string"){let r=e;return(t==null?void 0:t[r])===(n==null?void 0:n[r])}return e(t,n)},[e])}function fa(e){if(e===null)return{width:0,height:0};let{width:t,height:n}=e.getBoundingClientRect();return{width:t,height:n}}function da(e,t=!1){let[n,r]=d.useReducer(()=>({}),{}),o=d.useMemo(()=>fa(e),[e,n]);return le(()=>{if(!e)return;let s=new ResizeObserver(r);return s.observe(e),()=>{s.disconnect()}},[e]),t?{width:`${o.width}px`,height:`${o.height}px`}:o}let Eo=class extends Map{constructor(t){super(),this.factory=t}get(t){let n=super.get(t);return n===void 0&&(n=this.factory(t),this.set(t,n)),n}};var pa=Object.defineProperty,ha=(e,t,n)=>t in e?pa(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ma=(e,t,n)=>(ha(e,t+"",n),n),Co=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},Me=(e,t,n)=>(Co(e,t,"read from private field"),n?n.call(e):t.get(e)),Hn=(e,t,n)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,n)},So=(e,t,n,r)=>(Co(e,t,"write to private field"),t.set(e,n),n),He,_t,jt;let Oo=class{constructor(t){Hn(this,He,{}),Hn(this,_t,new Eo(()=>new Set)),Hn(this,jt,new Set),ma(this,"disposables",Re()),So(this,He,t),ze.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return Me(this,He)}subscribe(t,n){if(ze.isServer)return()=>{};let r={selector:t,callback:n,current:t(Me(this,He))};return Me(this,jt).add(r),this.disposables.add(()=>{Me(this,jt).delete(r)})}on(t,n){return ze.isServer?()=>{}:(Me(this,_t).get(t).add(n),this.disposables.add(()=>{Me(this,_t).get(t).delete(n)}))}send(t){let n=this.reduce(Me(this,He),t);if(n!==Me(this,He)){So(this,He,n);for(let r of Me(this,jt)){let o=r.selector(Me(this,He));Ao(r.current,o)||(r.current=o,r.callback(o))}for(let r of Me(this,_t).get(t.type))r(Me(this,He),t)}}};He=new WeakMap,_t=new WeakMap,jt=new WeakMap;function Ao(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null?!1:Array.isArray(e)&&Array.isArray(t)?e.length!==t.length?!1:Gn(e[Symbol.iterator](),t[Symbol.iterator]()):e instanceof Map&&t instanceof Map||e instanceof Set&&t instanceof Set?e.size!==t.size?!1:Gn(e.entries(),t.entries()):No(e)&&No(t)?Gn(Object.entries(e)[Symbol.iterator](),Object.entries(t)[Symbol.iterator]()):!1}function Gn(e,t){do{let n=e.next(),r=t.next();if(n.done&&r.done)return!0;if(n.done||r.done||!Object.is(n.value,r.value))return!1}while(!0)}function No(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;let t=Object.getPrototypeOf(e);return t===null||Object.getPrototypeOf(t)===null}function Yn(e){let[t,n]=e(),r=Re();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var ga=Object.defineProperty,va=(e,t,n)=>t in e?ga(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$o=(e,t,n)=>(va(e,typeof t!="symbol"?t+"":t,n),n),To=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(To||{});let ba={0(e,t){let n=t.id,r=e.stack,o=e.stack.indexOf(n);if(o!==-1){let s=e.stack.slice();return s.splice(o,1),s.push(n),r=s,{...e,stack:r}}return{...e,stack:[...e.stack,n]}},1(e,t){let n=t.id,r=e.stack.indexOf(n);if(r===-1)return e;let o=e.stack.slice();return o.splice(r,1),{...e,stack:o}}},ya=class Bs extends Oo{constructor(){super(...arguments),$o(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),$o(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new Bs({stack:[]})}reduce(t,n){return Te(n.type,ba,t,n)}};const Kn=new Eo(()=>ya.new());var qn={exports:{}},Qn={};/**
|
|
59
59
|
* @license React
|
|
60
60
|
* use-sync-external-store-with-selector.production.js
|
|
61
61
|
*
|
|
@@ -63,7 +63,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
63
63
|
*
|
|
64
64
|
* This source code is licensed under the MIT license found in the
|
|
65
65
|
* LICENSE file in the root directory of this source tree.
|
|
66
|
-
*/var
|
|
66
|
+
*/var Po;function xa(){if(Po)return Qn;Po=1;var e=d;function t(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var n=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=e.useRef,s=e.useEffect,u=e.useMemo,a=e.useDebugValue;return Qn.useSyncExternalStoreWithSelector=function(i,l,c,p,m){var f=o(null);if(f.current===null){var b={hasValue:!1,value:null};f.current=b}else b=f.current;f=u(function(){function N(_){if(!I){if(I=!0,w=_,_=p(_),m!==void 0&&b.hasValue){var B=b.value;if(m(B,_))return T=B}return T=_}if(B=T,n(w,_))return B;var W=p(_);return m!==void 0&&m(B,W)?(w=_,B):(w=_,T=W)}var I=!1,w,T,j=c===void 0?null:c;return[function(){return N(l())},j===null?void 0:function(){return N(j())}]},[l,c,p,m]);var y=r(i,f[0],f[1]);return s(function(){b.hasValue=!0,b.value=y},[y]),a(y),y},Qn}var Xn={};/**
|
|
67
67
|
* @license React
|
|
68
68
|
* use-sync-external-store-with-selector.development.js
|
|
69
69
|
*
|
|
@@ -71,34 +71,34 @@ React keys must be passed directly to JSX without using spread:
|
|
|
71
71
|
*
|
|
72
72
|
* This source code is licensed under the MIT license found in the
|
|
73
73
|
* LICENSE file in the root directory of this source tree.
|
|
74
|
-
*/var ro;function Rl(){return ro||(ro=1,process.env.NODE_ENV!=="production"&&function(){function e(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,c=t.useMemo,a=t.useDebugValue;Mn.useSyncExternalStoreWithSelector=function(i,l,u,p,m){var d=o(null);if(d.current===null){var h={hasValue:!1,value:null};d.current=h}else h=d.current;d=c(function(){function b(S){if(!w){if(w=!0,E=S,S=p(S),m!==void 0&&h.hasValue){var M=h.value;if(m(M,S))return x=M}return x=S}if(M=x,n(E,S))return M;var F=p(S);return m!==void 0&&m(M,F)?(E=S,M):(E=S,x=F)}var w=!1,E,x,C=u===void 0?null:u;return[function(){return b(l())},C===null?void 0:function(){return b(C())}]},[l,u,p,m]);var g=r(i,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=g},[g]),a(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Mn}process.env.NODE_ENV==="production"?Nn.exports=kl():Nn.exports=Rl();var Wl=Nn.exports;function Ce(e,t,n=Jr){return Wl.useSyncExternalStoreWithSelector(Q(r=>e.subscribe(Bl,r)),Q(()=>e.state),Q(()=>e.state),Q(t),n)}function Bl(e){return e}function oo(e,t){let n=f.useId(),r=Tn.get(t),[o,s]=Ce(r,f.useCallback(c=>[r.selectors.isTop(c,n),r.selectors.inStack(c,n)],[r,n]));return te(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Pn=new Map,Et=new Map;function io(e){var t;let n=(t=Et.get(e))!=null?t:0;return Et.set(e,n+1),n!==0?()=>so(e):(Pn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>so(e))}function so(e){var t;let n=(t=Et.get(e))!=null?t:1;if(n===1?Et.delete(e):Et.set(e,n-1),n!==1)return;let r=Pn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Pn.delete(e))}function Vl(e,{allowed:t,disallowed:n}={}){let r=oo(e,"inert-others");te(()=>{var o,s;if(!r)return;let c=$e();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(io(i));let a=(s=t==null?void 0:t())!=null?s:[];for(let i of a){if(!i)continue;let l=xt(i);if(!l)continue;let u=i.parentElement;for(;u&&u!==l.body;){for(let p of u.children)a.some(m=>p.contains(m))||c.add(io(p));u=u.parentElement}}return c.dispose},[r,t,n])}function Ul(e,t,n){let r=Xe(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});f.useEffect(()=>{if(!e)return;let o=t===null?null:ke(t)?t:t.current;if(!o)return;let s=$e();if(typeof ResizeObserver<"u"){let c=new ResizeObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}if(typeof IntersectionObserver<"u"){let c=new IntersectionObserver(()=>r.current(o));c.observe(o),s.add(()=>c.disconnect())}return()=>s.dispose()},[t,r,e])}let Ln=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),zl=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var Fn=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(Fn||{}),Hl=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Hl||{}),Gl=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Gl||{});function lo(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ln)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Yl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(zl)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var In=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(In||{});function ao(e,t=0){var n;return e===((n=xt(e))==null?void 0:n.body)?!1:ye(t,{0(){return e.matches(Ln)},1(){let r=e;for(;r!==null;){if(r.matches(Ln))return!0;r=r.parentElement}return!1}})}var Kl=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Kl||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let Ql=["textarea","input"].join(",");function ql(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Ql))!=null?n:!1}function uo(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let c=o.compareDocumentPosition(s);return c&Node.DOCUMENT_POSITION_FOLLOWING?-1:c&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Xl(e,t){return Jl(lo(),t,{relativeTo:e})}function Jl(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,c=Array.isArray(e)?n?uo(e):e:t&64?Yl(e):lo(e);o.length>0&&c.length>1&&(c=c.filter(d=>!o.some(h=>h!=null&&"current"in h?(h==null?void 0:h.current)===d:h===d))),r=r??s.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,c.indexOf(r))-1;if(t&4)return Math.max(0,c.indexOf(r))+1;if(t&8)return c.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},u=0,p=c.length,m;do{if(u>=p||u+p<=0)return 0;let d=i+u;if(t&16)d=(d+p)%p;else{if(d<0)return 3;if(d>=p)return 1}m=c[d],m==null||m.focus(l),u+=a}while(m!==s.activeElement);return t&6&&ql(m)&&m.select(),2}function co(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Zl(){return/Android/gi.test(window.navigator.userAgent)}function fo(){return co()||Zl()}function st(e,t,n,r){let o=Xe(n);f.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function ea(e,t,n,r){let o=Xe(n);f.useEffect(()=>{if(!e)return;function s(c){o.current(c)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const po=30;function ta(e,t,n){let r=Xe(n),o=f.useCallback(function(a,i){if(a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of u)if(p!==null&&(p.contains(l)||a.composed&&a.composedPath().includes(p)))return;return!ao(l,In.Loose)&&l.tabIndex!==-1&&a.preventDefault(),r.current(a,l)},[r,t]),s=f.useRef(null);st(e,"pointerdown",a=>{var i,l;fo()||(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),st(e,"pointerup",a=>{if(fo()||!s.current)return;let i=s.current;return s.current=null,o(a,()=>i)},!0);let c=f.useRef({x:0,y:0});st(e,"touchstart",a=>{c.current.x=a.touches[0].clientX,c.current.y=a.touches[0].clientY},!0),st(e,"touchend",a=>{let i={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=po||Math.abs(i.y-c.current.y)>=po))return o(a,()=>it(a.target)?a.target:null)},!0),ea(e,"blur",a=>o(a,()=>dl(window.document.activeElement)?window.document.activeElement:null),!0)}function jn(...e){return f.useMemo(()=>xt(...e),[...e])}var na=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(na||{});const Rt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},ra=200,mo=5;function oa(e,{trigger:t,action:n,close:r,select:o}){let s=f.useRef(null),c=f.useRef(null),a=f.useRef(null);st(e&&t!==null,"pointerdown",i=>{En(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(c.current=i.x,a.current=i.y,s.current=i.timeStamp)}),st(e&&t!==null,"pointerup",i=>{var l,u;let p=s.current;if(p===null||(s.current=null,!it(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<mo&&Math.abs(i.y-((u=a.current)!=null?u:i.y))<mo)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>ra&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function ia(e,t){return f.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function sa(e){return f.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function la(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let c=t[o].call(n,...s);c&&(n=c,r.forEach(a=>a()))}}}function aa(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function ua(){return co()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=$e();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,c=null;t.addEventListener(e,"click",a=>{if(it(a.target))try{let i=a.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),u=e.querySelector(l);it(u)&&!r(u)&&(c=u)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(it(a.target)&&fl(a.target))if(r(a.target)){let i=a.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(it(a.target)){if(Br(a.target))return;if(r(a.target)){let i=a.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let i=(a=window.scrollY)!=null?a:window.pageYOffset;s!==i&&window.scrollTo(0,s),c&&c.isConnected&&(c.scrollIntoView({block:"nearest"}),c=null)})})}}:{}}function ca(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function fa(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Je=la(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:$e(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:fa(n)},o=[ua(),aa(),ca()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});Je.subscribe(()=>{let e=Je.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&Je.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&Je.dispatch("TEARDOWN",n)}});function da(e,t,n=()=>({containers:[]})){let r=sa(Je),o=t?r.get(t):void 0,s=o?o.count>0:!1;return te(()=>{if(!(!t||!e))return Je.dispatch("PUSH",t,n),()=>Je.dispatch("POP",t,n)},[e,t]),s}function pa(e,t,n=()=>[document.body]){let r=oo(e,"scroll-lock");da(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function ho(e){return[e.screenX,e.screenY]}function ma(){let e=f.useRef([-1,-1]);return{wasMoved(t){let n=ho(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=ho(t)}}}function ha(e=0){let[t,n]=f.useState(e),r=f.useCallback(i=>n(i),[t]),o=f.useCallback(i=>n(l=>l|i),[t]),s=f.useCallback(i=>(t&i)===i,[t]),c=f.useCallback(i=>n(l=>l&~i),[n]),a=f.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:a}}var go,vo;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((go=process==null?void 0:process.env)==null?void 0:go.NODE_ENV)==="test"&&typeof((vo=Element==null?void 0:Element.prototype)==null?void 0:vo.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
75
|
-
`)),[]});var ga=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(ga||{});function bo(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function xo(e,t,n,r){let[o,s]=f.useState(n),{hasFlag:c,addFlag:a,removeFlag:i}=ha(e&&o?3:0),l=f.useRef(!1),u=f.useRef(!1),p=ot();return te(()=>{var m;if(e){if(n&&s(!0),!t){n&&a(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),va(t,{inFlight:l,prepare(){u.current?u.current=!1:u.current=l.current,l.current=!0,!u.current&&(n?(a(3),i(4)):(a(4),i(2)))},run(){u.current?n?(i(3),a(4)):(i(4),a(3)):n?i(1):a(1)},done(){var d;u.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(d=r==null?void 0:r.end)==null||d.call(r,n))}})}},[e,n,t,p]),e?[o,{closed:c(1),enter:c(2),leave:c(4),transition:c(2)||c(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function va(e,{prepare:t,run:n,done:r,inFlight:o}){let s=$e();return xa(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(ba(e,r))})}),s.dispose}function ba(e,t){var n,r;let o=$e();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let c=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return c.length===0?(t(),o.dispose):(Promise.allSettled(c.map(a=>a.finished)).then(()=>{s||t()}),o.dispose)}function xa(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function Wt(){return typeof window<"u"}function lt(e){return yo(e)?(e.nodeName||"").toLowerCase():"#document"}function be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){var t;return(t=(yo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function yo(e){return Wt()?e instanceof Node||e instanceof be(e).Node:!1}function ue(e){return Wt()?e instanceof Element||e instanceof be(e).Element:!1}function Le(e){return Wt()?e instanceof HTMLElement||e instanceof be(e).HTMLElement:!1}function wo(e){return!Wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof be(e).ShadowRoot}const ya=new Set(["inline","contents"]);function Ct(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Oe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!ya.has(o)}const wa=new Set(["table","td","th"]);function Ea(e){return wa.has(lt(e))}const Ca=[":popover-open",":modal"];function Bt(e){return Ca.some(t=>{try{return e.matches(t)}catch{return!1}})}const Sa=["transform","translate","scale","rotate","perspective"],$a=["transform","translate","scale","rotate","perspective","filter"],Oa=["paint","layout","strict","content"];function Dn(e){const t=_n(),n=ue(e)?Oe(e):e;return Sa.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||$a.some(r=>(n.willChange||"").includes(r))||Oa.some(r=>(n.contain||"").includes(r))}function Ta(e){let t=He(e);for(;Le(t)&&!at(t);){if(Dn(t))return t;if(Bt(t))return null;t=He(t)}return null}function _n(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Na=new Set(["html","body","#document"]);function at(e){return Na.has(lt(e))}function Oe(e){return be(e).getComputedStyle(e)}function Vt(e){return ue(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function He(e){if(lt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||wo(e)&&e.host||Pe(e);return wo(t)?t.host:t}function Eo(e){const t=He(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:Le(t)&&Ct(t)?t:Eo(t)}function St(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=Eo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=be(o);if(s){const a=kn(c);return t.concat(c,c.visualViewport||[],Ct(o)?o:[],a&&n?St(a):[])}return t.concat(o,St(o,[],n))}function kn(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Aa(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const Ze=Math.min,ce=Math.max,$t=Math.round,Ut=Math.floor,Fe=e=>({x:e,y:e}),Ma={left:"right",right:"left",bottom:"top",top:"bottom"},Pa={start:"end",end:"start"};function Co(e,t,n){return ce(e,Ze(t,n))}function ut(e,t){return typeof e=="function"?e(t):e}function Ge(e){return e.split("-")[0]}function Ot(e){return e.split("-")[1]}function So(e){return e==="x"?"y":"x"}function $o(e){return e==="y"?"height":"width"}const La=new Set(["top","bottom"]);function Re(e){return La.has(Ge(e))?"y":"x"}function Oo(e){return So(Re(e))}function Fa(e,t,n){n===void 0&&(n=!1);const r=Ot(e),o=Oo(e),s=$o(o);let c=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(c=zt(c)),[c,zt(c)]}function Ia(e){const t=zt(e);return[Rn(e),t,Rn(t)]}function Rn(e){return e.replace(/start|end/g,t=>Pa[t])}const To=["left","right"],No=["right","left"],ja=["top","bottom"],Da=["bottom","top"];function _a(e,t,n){switch(e){case"top":case"bottom":return n?t?No:To:t?To:No;case"left":case"right":return t?ja:Da;default:return[]}}function ka(e,t,n,r){const o=Ot(e);let s=_a(Ge(e),n==="start",r);return o&&(s=s.map(c=>c+"-"+o),t&&(s=s.concat(s.map(Rn)))),s}function zt(e){return e.replace(/left|right|bottom|top/g,t=>Ma[t])}function Ra(e){return{top:0,right:0,bottom:0,left:0,...e}}function Wa(e){return typeof e!="number"?Ra(e):{top:e,right:e,bottom:e,left:e}}function Ht(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function Ao(e,t,n){let{reference:r,floating:o}=e;const s=Re(t),c=Oo(t),a=$o(c),i=Ge(t),l=s==="y",u=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let d;switch(i){case"top":d={x:u,y:r.y-o.height};break;case"bottom":d={x:u,y:r.y+r.height};break;case"right":d={x:r.x+r.width,y:p};break;case"left":d={x:r.x-o.width,y:p};break;default:d={x:r.x,y:r.y}}switch(Ot(t)){case"start":d[c]-=m*(n&&l?-1:1);break;case"end":d[c]+=m*(n&&l?-1:1);break}return d}const Ba=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,a=s.filter(Boolean),i=await(c.isRTL==null?void 0:c.isRTL(t));let l=await c.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:p}=Ao(l,r,i),m=r,d={},h=0;for(let g=0;g<a.length;g++){const{name:b,fn:w}=a[g],{x:E,y:x,data:C,reset:S}=await w({x:u,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});u=E??u,p=x??p,d={...d,[b]:{...d[b],...C}},S&&h<=50&&(h++,typeof S=="object"&&(S.placement&&(m=S.placement),S.rects&&(l=S.rects===!0?await c.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:u,y:p}=Ao(l,m,i)),g=-1)}return{x:u,y:p,placement:m,strategy:o,middlewareData:d}};async function Gt(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:c,elements:a,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:d=0}=ut(t,e),h=Wa(d),b=a[m?p==="floating"?"reference":"floating":p],w=Ht(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:u,strategy:i})),E=p==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,x=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),C=await(s.isElement==null?void 0:s.isElement(x))?await(s.getScale==null?void 0:s.getScale(x))||{x:1,y:1}:{x:1,y:1},S=Ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:x,strategy:i}):E);return{top:(w.top-S.top+h.top)/C.y,bottom:(S.bottom-w.bottom+h.bottom)/C.y,left:(w.left-S.left+h.left)/C.x,right:(S.right-w.right+h.right)/C.x}}const Va=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:c,initialPlacement:a,platform:i,elements:l}=t,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:d="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:g=!0,...b}=ut(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Ge(o),E=Re(a),x=Ge(a)===a,C=await(i.isRTL==null?void 0:i.isRTL(l.floating)),S=m||(x||!g?[zt(a)]:Ia(a)),M=h!=="none";!m&&M&&S.push(...ka(a,g,h,C));const F=[a,...S],W=await Gt(t,b),V=[];let A=((r=s.flip)==null?void 0:r.overflows)||[];if(u&&V.push(W[w]),p){const I=Fa(o,c,C);V.push(W[I[0]],W[I[1]])}if(A=[...A,{placement:o,overflows:V}],!V.every(I=>I<=0)){var O,j;const I=(((O=s.flip)==null?void 0:O.index)||0)+1,B=F[I];if(B&&(!(p==="alignment"?E!==Re(B):!1)||A.every(T=>Re(T.placement)===E?T.overflows[0]>0:!0)))return{data:{index:I,overflows:A},reset:{placement:B}};let z=(j=A.filter(U=>U.overflows[0]<=0).sort((U,T)=>U.overflows[1]-T.overflows[1])[0])==null?void 0:j.placement;if(!z)switch(d){case"bestFit":{var D;const U=(D=A.filter(T=>{if(M){const _=Re(T.placement);return _===E||_==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(_=>_>0).reduce((_,N)=>_+N,0)]).sort((T,_)=>T[1]-_[1])[0])==null?void 0:D[0];U&&(z=U);break}case"initialPlacement":z=a;break}if(o!==z)return{reset:{placement:z}}}return{}}}},Ua=new Set(["left","top"]);async function za(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Ge(n),a=Ot(n),i=Re(n)==="y",l=Ua.has(c)?-1:1,u=s&&i?-1:1,p=ut(t,e);let{mainAxis:m,crossAxis:d,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof h=="number"&&(d=a==="end"?h*-1:h),i?{x:d*u,y:m*l}:{x:m*l,y:d*u}}const Ha=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:c,middlewareData:a}=t,i=await za(t,e);return c===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:c}}}}},Ga=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:a={fn:b=>{let{x:w,y:E}=b;return{x:w,y:E}}},...i}=ut(e,t),l={x:n,y:r},u=await Gt(t,i),p=Re(Ge(o)),m=So(p);let d=l[m],h=l[p];if(s){const b=m==="y"?"top":"left",w=m==="y"?"bottom":"right",E=d+u[b],x=d-u[w];d=Co(E,d,x)}if(c){const b=p==="y"?"top":"left",w=p==="y"?"bottom":"right",E=h+u[b],x=h-u[w];h=Co(E,h,x)}const g=a.fn({...t,[m]:d,[p]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:s,[p]:c}}}}}},Ya=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:c,elements:a}=t,{apply:i=()=>{},...l}=ut(e,t),u=await Gt(t,l),p=Ge(o),m=Ot(o),d=Re(o)==="y",{width:h,height:g}=s.floating;let b,w;p==="top"||p==="bottom"?(b=p,w=m===(await(c.isRTL==null?void 0:c.isRTL(a.floating))?"start":"end")?"left":"right"):(w=p,b=m==="end"?"top":"bottom");const E=g-u.top-u.bottom,x=h-u.left-u.right,C=Ze(g-u[b],E),S=Ze(h-u[w],x),M=!t.middlewareData.shift;let F=C,W=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(W=x),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=E),M&&!m){const A=ce(u.left,0),O=ce(u.right,0),j=ce(u.top,0),D=ce(u.bottom,0);d?W=h-2*(A!==0||O!==0?A+O:ce(u.left,u.right)):F=g-2*(j!==0||D!==0?j+D:ce(u.top,u.bottom))}await i({...t,availableWidth:W,availableHeight:F});const V=await c.getDimensions(a.floating);return h!==V.width||g!==V.height?{reset:{rects:!0}}:{}}}};function Mo(e){const t=Oe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Le(e),s=o?e.offsetWidth:n,c=o?e.offsetHeight:r,a=$t(n)!==s||$t(r)!==c;return a&&(n=s,r=c),{width:n,height:r,$:a}}function Wn(e){return ue(e)?e:e.contextElement}function ct(e){const t=Wn(e);if(!Le(t))return Fe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=Mo(t);let c=(s?$t(n.width):n.width)/r,a=(s?$t(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!a||!Number.isFinite(a))&&(a=1),{x:c,y:a}}const Ka=Fe(0);function Po(e){const t=be(e);return!_n()||!t.visualViewport?Ka:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Qa(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==be(e)?!1:t}function et(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Wn(e);let c=Fe(1);t&&(r?ue(r)&&(c=ct(r)):c=ct(e));const a=Qa(s,n,r)?Po(s):Fe(0);let i=(o.left+a.x)/c.x,l=(o.top+a.y)/c.y,u=o.width/c.x,p=o.height/c.y;if(s){const m=be(s),d=r&&ue(r)?be(r):r;let h=m,g=kn(h);for(;g&&r&&d!==h;){const b=ct(g),w=g.getBoundingClientRect(),E=Oe(g),x=w.left+(g.clientLeft+parseFloat(E.paddingLeft))*b.x,C=w.top+(g.clientTop+parseFloat(E.paddingTop))*b.y;i*=b.x,l*=b.y,u*=b.x,p*=b.y,i+=x,l+=C,h=be(g),g=kn(h)}}return Ht({width:u,height:p,x:i,y:l})}function Yt(e,t){const n=Vt(e).scrollLeft;return t?t.left+n:et(Pe(e)).left+n}function Lo(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-Yt(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function qa(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",c=Pe(r),a=t?Bt(t.floating):!1;if(r===c||a&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Fe(1);const u=Fe(0),p=Le(r);if((p||!p&&!s)&&((lt(r)!=="body"||Ct(c))&&(i=Vt(r)),Le(r))){const d=et(r);l=ct(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}const m=c&&!p&&!s?Lo(c,i):Fe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+u.x+m.x,y:n.y*l.y-i.scrollTop*l.y+u.y+m.y}}function Xa(e){return Array.from(e.getClientRects())}function Ja(e){const t=Pe(e),n=Vt(e),r=e.ownerDocument.body,o=ce(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ce(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+Yt(e);const a=-n.scrollTop;return Oe(r).direction==="rtl"&&(c+=ce(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:a}}const Fo=25;function Za(e,t){const n=be(e),r=Pe(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,a=0,i=0;if(o){s=o.width,c=o.height;const u=_n();(!u||u&&t==="fixed")&&(a=o.offsetLeft,i=o.offsetTop)}const l=Yt(r);if(l<=0){const u=r.ownerDocument,p=u.body,m=getComputedStyle(p),d=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(r.clientWidth-p.clientWidth-d);h<=Fo&&(s-=h)}else l<=Fo&&(s+=l);return{width:s,height:c,x:a,y:i}}const eu=new Set(["absolute","fixed"]);function tu(e,t){const n=et(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Le(e)?ct(e):Fe(1),c=e.clientWidth*s.x,a=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:c,height:a,x:i,y:l}}function Io(e,t,n){let r;if(t==="viewport")r=Za(e,n);else if(t==="document")r=Ja(Pe(e));else if(ue(t))r=tu(t,n);else{const o=Po(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Ht(r)}function jo(e,t){const n=He(e);return n===t||!ue(n)||at(n)?!1:Oe(n).position==="fixed"||jo(n,t)}function nu(e,t){const n=t.get(e);if(n)return n;let r=St(e,[],!1).filter(a=>ue(a)&<(a)!=="body"),o=null;const s=Oe(e).position==="fixed";let c=s?He(e):e;for(;ue(c)&&!at(c);){const a=Oe(c),i=Dn(c);!i&&a.position==="fixed"&&(o=null),(s?!i&&!o:!i&&a.position==="static"&&!!o&&eu.has(o.position)||Ct(c)&&!i&&jo(e,c))?r=r.filter(u=>u!==c):o=a,c=He(c)}return t.set(e,r),r}function ru(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Bt(t)?[]:nu(t,this._c):[].concat(n),r],a=c[0],i=c.reduce((l,u)=>{const p=Io(t,u,o);return l.top=ce(p.top,l.top),l.right=Ze(p.right,l.right),l.bottom=Ze(p.bottom,l.bottom),l.left=ce(p.left,l.left),l},Io(t,a,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function ou(e){const{width:t,height:n}=Mo(e);return{width:t,height:n}}function iu(e,t,n){const r=Le(t),o=Pe(t),s=n==="fixed",c=et(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const i=Fe(0);function l(){i.x=Yt(o)}if(r||!r&&!s)if((lt(t)!=="body"||Ct(o))&&(a=Vt(t)),r){const d=et(t,!0,s,t);i.x=d.x+t.clientLeft,i.y=d.y+t.clientTop}else o&&l();s&&!r&&o&&l();const u=o&&!r&&!s?Lo(o,a):Fe(0),p=c.left+a.scrollLeft-i.x-u.x,m=c.top+a.scrollTop-i.y-u.y;return{x:p,y:m,width:c.width,height:c.height}}function Bn(e){return Oe(e).position==="static"}function Do(e,t){if(!Le(e)||Oe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function _o(e,t){const n=be(e);if(Bt(e))return n;if(!Le(e)){let o=He(e);for(;o&&!at(o);){if(ue(o)&&!Bn(o))return o;o=He(o)}return n}let r=Do(e,t);for(;r&&Ea(r)&&Bn(r);)r=Do(r,t);return r&&at(r)&&Bn(r)&&!Dn(r)?n:r||Ta(e)||n}const su=async function(e){const t=this.getOffsetParent||_o,n=this.getDimensions,r=await n(e.floating);return{reference:iu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function lu(e){return Oe(e).direction==="rtl"}const au={convertOffsetParentRelativeRectToViewportRelativeRect:qa,getDocumentElement:Pe,getClippingRect:ru,getOffsetParent:_o,getElementRects:su,getClientRects:Xa,getDimensions:ou,getScale:ct,isElement:ue,isRTL:lu};function ko(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function uu(e,t){let n=null,r;const o=Pe(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function c(a,i){a===void 0&&(a=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:u,top:p,width:m,height:d}=l;if(a||t(),!m||!d)return;const h=Ut(p),g=Ut(o.clientWidth-(u+m)),b=Ut(o.clientHeight-(p+d)),w=Ut(u),x={rootMargin:-h+"px "+-g+"px "+-b+"px "+-w+"px",threshold:ce(0,Ze(1,i))||1};let C=!0;function S(M){const F=M[0].intersectionRatio;if(F!==i){if(!C)return c();F?c(!1,F):r=setTimeout(()=>{c(!1,1e-7)},1e3)}F===1&&!ko(l,e.getBoundingClientRect())&&c(),C=!1}try{n=new IntersectionObserver(S,{...x,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,x)}n.observe(e)}return c(!0),s}function cu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=Wn(e),u=o||s?[...l?St(l):[],...St(t)]:[];u.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=l&&a?uu(l,n):null;let m=-1,d=null;c&&(d=new ResizeObserver(w=>{let[E]=w;E&&E.target===l&&d&&(d.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var x;(x=d)==null||x.observe(t)})),n()}),l&&!i&&d.observe(l),d.observe(t));let h,g=i?et(e):null;i&&b();function b(){const w=et(e);g&&!ko(g,w)&&n(),g=w,h=requestAnimationFrame(b)}return n(),()=>{var w;u.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),p==null||p(),(w=d)==null||w.disconnect(),d=null,i&&cancelAnimationFrame(h)}}const Vn=Gt,fu=Ha,du=Ga,pu=Va,mu=Ya,hu=(e,t,n)=>{const r=new Map,o={platform:au,...n},s={...o.platform,_c:r};return Ba(e,t,{...o,platform:s})};var gu=typeof document<"u",vu=function(){},Kt=gu?f.useLayoutEffect:vu;function Qt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Qt(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Qt(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function Ro(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Wo(e,t){const n=Ro(e);return Math.round(t*n)/n}function Un(e){const t=L.useRef(e);return Kt(()=>{t.current=e}),t}function bu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:a=!0,whileElementsMounted:i,open:l}=e,[u,p]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,d]=L.useState(r);Qt(m,r)||d(r);const[h,g]=L.useState(null),[b,w]=L.useState(null),E=L.useCallback(T=>{T!==M.current&&(M.current=T,g(T))},[]),x=L.useCallback(T=>{T!==F.current&&(F.current=T,w(T))},[]),C=s||h,S=c||b,M=L.useRef(null),F=L.useRef(null),W=L.useRef(u),V=i!=null,A=Un(i),O=Un(o),j=Un(l),D=L.useCallback(()=>{if(!M.current||!F.current)return;const T={placement:t,strategy:n,middleware:m};O.current&&(T.platform=O.current),hu(M.current,F.current,T).then(_=>{const N={..._,isPositioned:j.current!==!1};I.current&&!Qt(W.current,N)&&(W.current=N,Mt.flushSync(()=>{p(N)}))})},[m,t,n,O,j]);Kt(()=>{l===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,p(T=>({...T,isPositioned:!1})))},[l]);const I=L.useRef(!1);Kt(()=>(I.current=!0,()=>{I.current=!1}),[]),Kt(()=>{if(C&&(M.current=C),S&&(F.current=S),C&&S){if(A.current)return A.current(C,S,D);D()}},[C,S,D,A,V]);const B=L.useMemo(()=>({reference:M,floating:F,setReference:E,setFloating:x}),[E,x]),z=L.useMemo(()=>({reference:C,floating:S}),[C,S]),U=L.useMemo(()=>{const T={position:n,left:0,top:0};if(!z.floating)return T;const _=Wo(z.floating,u.x),N=Wo(z.floating,u.y);return a?{...T,transform:"translate("+_+"px, "+N+"px)",...Ro(z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_,top:N}},[n,a,z.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:D,refs:B,elements:z,floatingStyles:U}),[u,D,B,z,U])}const Bo=(e,t)=>({...fu(e),options:[e,t]}),xu=(e,t)=>({...du(e),options:[e,t]}),yu=(e,t)=>({...pu(e),options:[e,t]}),wu=(e,t)=>({...mu(e),options:[e,t]}),Vo={...L},Eu=Vo.useInsertionEffect||(e=>e());function Uo(e){const t=L.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Eu(()=>{t.current=e}),L.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var zn=typeof document<"u"?f.useLayoutEffect:f.useEffect;let zo=!1,Cu=0;const Ho=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Cu++;function Su(){const[e,t]=L.useState(()=>zo?Ho():void 0);return zn(()=>{e==null&&t(Ho())},[]),L.useEffect(()=>{zo=!0},[]),e}const $u=Vo.useId||Su;let Tt;process.env.NODE_ENV!=="production"&&(Tt=new Set);function Ou(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Tt)!=null&&e.has(o))){var s;(s=Tt)==null||s.add(o),console.warn(o)}}function Tu(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Tt)!=null&&e.has(o))){var s;(s=Tt)==null||s.add(o),console.error(o)}}function Nu(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const Au=L.createContext(null),Mu=L.createContext(null),Pu=()=>{var e;return((e=L.useContext(Au))==null?void 0:e.id)||null},Lu=()=>L.useContext(Mu),Fu="data-floating-ui-focusable";function Iu(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=$u(),s=L.useRef({}),[c]=L.useState(()=>Nu()),a=Pu()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ue(d)&&Tu("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[i,l]=L.useState(r.reference),u=Uo((d,h,g)=>{s.current.openEvent=d?h:void 0,c.emit("openchange",{open:d,event:h,reason:g,nested:a}),n==null||n(d,h,g)}),p=L.useMemo(()=>({setPositionReference:l}),[]),m=L.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return L.useMemo(()=>({dataRef:s,open:t,onOpenChange:u,elements:m,events:c,floatingId:o,refs:p}),[t,u,m,c,o,p])}function ju(e){e===void 0&&(e={});const{nodeId:t}=e,n=Iu({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=L.useState(null),[a,i]=L.useState(null),u=(o==null?void 0:o.domReference)||s,p=L.useRef(null),m=Lu();zn(()=>{u&&(p.current=u)},[u]);const d=bu({...e,elements:{...o,...a&&{reference:a}}}),h=L.useCallback(x=>{const C=ue(x)?{getBoundingClientRect:()=>x.getBoundingClientRect(),contextElement:x}:x;i(C),d.refs.setReference(C)},[d.refs]),g=L.useCallback(x=>{(ue(x)||x===null)&&(p.current=x,c(x)),(ue(d.refs.reference.current)||d.refs.reference.current===null||x!==null&&!ue(x))&&d.refs.setReference(x)},[d.refs]),b=L.useMemo(()=>({...d.refs,setReference:g,setPositionReference:h,domReference:p}),[d.refs,g,h]),w=L.useMemo(()=>({...d.elements,domReference:u}),[d.elements,u]),E=L.useMemo(()=>({...d,...r,refs:b,elements:w,nodeId:t}),[d,b,w,t,r]);return zn(()=>{r.dataRef.current.floatingContext=E;const x=m==null?void 0:m.nodesRef.current.find(C=>C.id===t);x&&(x.context=E)}),L.useMemo(()=>({...d,context:E,refs:b,elements:w}),[d,b,w,E])}const Go="active",Yo="selected";function Hn(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Go]:c,[Yo]:a,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[Fu]:""},...s,...t.map(c=>{const a=c?c[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((c,a)=>(a&&Object.entries(a).forEach(i=>{let[l,u]=i;if(!(o&&[Go,Yo].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof u=="function"){var p;(p=r.get(l))==null||p.push(u),c[l]=function(){for(var m,d=arguments.length,h=new Array(d),g=0;g<d;g++)h[g]=arguments[g];return(m=r.get(l))==null?void 0:m.map(b=>b(...h)).find(b=>b!==void 0)}}}else c[l]=u}),c),{})}}function Du(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=L.useCallback(a=>Hn(a,e,"reference"),t),s=L.useCallback(a=>Hn(a,e,"floating"),n),c=L.useCallback(a=>Hn(a,e,"item"),r);return L.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function Ko(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const _u=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:c=0,minItemsVisible:a=4,referenceOverflowThreshold:i=0,scrollRef:l,...u}=ut(e,t),{rects:p,elements:{floating:m}}=t,d=n.current[c],h=(l==null?void 0:l.current)||m,g=m.clientTop||h.clientTop,b=m.clientTop!==0,w=h.clientTop!==0,E=m===h;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||Ou('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const x={...t,...await Bo(-d.offsetTop-m.clientTop-p.reference.height/2-d.offsetHeight/2-s).fn(t)},C=await Vn(Ko(x,h.scrollHeight+g+m.clientTop),u),S=await Vn(x,{...u,elementContext:"reference"}),M=ce(0,C.top),F=x.y+M,A=(h.scrollHeight>h.clientHeight?O=>O:$t)(ce(0,h.scrollHeight+(b&&E||w?g*2:0)-M-ce(0,C.bottom)));if(h.style.maxHeight=A+"px",h.scrollTop=M,o){const O=h.offsetHeight<d.offsetHeight*Ze(a,n.current.length)-1||S.top>=-i||S.bottom>=-i;Mt.flushSync(()=>o(O))}return r&&(r.current=await Vn(Ko({...x,y:F},h.offsetHeight+g+m.clientTop),u)),{y:F}}});function ku(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:a}=t,i=Uo(a),l=L.useRef(!1),u=L.useRef(null),p=L.useRef(null);L.useEffect(()=>{if(!o)return;function d(g){if(g.ctrlKey||!h||s.current==null)return;const b=g.deltaY,w=s.current.top>=-.5,E=s.current.bottom>=-.5,x=h.scrollHeight-h.clientHeight,C=b<0?-1:1,S=b<0?"max":"min";h.scrollHeight<=h.clientHeight||(!w&&b>0||!E&&b<0?(g.preventDefault(),Mt.flushSync(()=>{i(M=>M+Math[S](b,x*C))})):/firefox/i.test(Aa())&&(h.scrollTop+=b))}const h=(c==null?void 0:c.current)||r.floating;if(n&&h)return h.addEventListener("wheel",d),requestAnimationFrame(()=>{u.current=h.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{u.current=null,p.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,c,i]);const m=L.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const d=(c==null?void 0:c.current)||r.floating;if(!(!s.current||!d||!l.current)){if(u.current!==null){const h=d.scrollTop-u.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Mt.flushSync(()=>i(g=>g+h))}requestAnimationFrame(()=>{u.current=d.scrollTop})}}}),[r.floating,i,s,c]);return L.useMemo(()=>o?{floating:m}:{},[o,m])}let ft=f.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});ft.displayName="FloatingContext";let Gn=f.createContext(null);Gn.displayName="PlacementContext";function Ru(e){return f.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Wu(){return f.useContext(ft).setReference}function Bu(){return f.useContext(ft).getReferenceProps}function Vu(){let{getFloatingProps:e,slot:t}=f.useContext(ft);return f.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Uu(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=f.useContext(Gn),n=f.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var c;return(c=s==null?void 0:s.outerHTML)!=null?c:s})]);te(()=>{t==null||t(n??null)},[t,n]);let r=f.useContext(ft);return f.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Qo=4;function zu({children:e,enabled:t=!0}){let[n,r]=f.useState(null),[o,s]=f.useState(0),c=f.useRef(null),[a,i]=f.useState(null);Hu(a);let l=t&&n!==null&&a!==null,{to:u="bottom",gap:p=0,offset:m=0,padding:d=0,inner:h}=Gu(n,a),[g,b="center"]=u.split(" ");te(()=>{l&&s(0)},[l]);let{refs:w,floatingStyles:E,context:x}=ju({open:l,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[Bo({mainAxis:g==="selection"?0:p,crossAxis:m}),xu({padding:d}),g!=="selection"&&yu({padding:d}),g==="selection"&&h?_u({...h,padding:d,overflowRef:c,offset:o,minItemsVisible:Qo,referenceOverflowThreshold:d,onFallbackChange(O){var j,D;if(!O)return;let I=x.elements.floating;if(!I)return;let B=parseFloat(getComputedStyle(I).scrollPaddingBottom)||0,z=Math.min(Qo,I.childElementCount),U=0,T=0;for(let _ of(D=(j=x.elements.floating)==null?void 0:j.childNodes)!=null?D:[])if(ke(_)){let N=_.offsetTop,H=N+_.clientHeight+B,G=I.scrollTop,q=G+I.clientHeight;if(N>=G&&H<=q)z--;else{T=Math.max(0,Math.min(H,q)-Math.max(N,G)),U=_.clientHeight;break}}z>=1&&s(_=>{let N=U*z-T+B;return _>=N?_:N})}}):null,wu({padding:d,apply({availableWidth:O,availableHeight:j,elements:D}){Object.assign(D.floating.style,{overflow:"auto",maxWidth:`${O}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${j}px)`})}})].filter(Boolean),whileElementsMounted:cu}),[C=g,S=b]=x.placement.split("-");g==="selection"&&(C="selection");let M=f.useMemo(()=>({anchor:[C,S].filter(Boolean).join(" ")}),[C,S]),F=ku(x,{overflowRef:c,onChange:s}),{getReferenceProps:W,getFloatingProps:V}=Du([F]),A=Q(O=>{i(O),w.setFloating(O)});return L.createElement(Gn.Provider,{value:r},L.createElement(ft.Provider,{value:{setFloating:A,setReference:w.setReference,styles:E,getReferenceProps:W,getFloatingProps:V,slot:M}},e))}function Hu(e){te(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function Gu(e,t){var n,r,o;let s=Yn((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),c=Yn((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=Yn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:a}}function Yn(e,t,n=void 0){let r=ot(),o=Q((i,l)=>{if(i==null)return[n,null];if(typeof i=="number")return[i,null];if(typeof i=="string"){if(!l)return[n,null];let u=Xo(i,l);return[u,p=>{let m=qo(i);{let d=m.map(h=>window.getComputedStyle(l).getPropertyValue(h));r.requestAnimationFrame(function h(){r.nextFrame(h);let g=!1;for(let[w,E]of m.entries()){let x=window.getComputedStyle(l).getPropertyValue(E);if(d[w]!==x){d[w]=x,g=!0;break}}if(!g)return;let b=Xo(i,l);u!==b&&(p(b),u=b)})}return r.dispose}]}return[n,null]}),s=f.useMemo(()=>o(e,t)[0],[e,t]),[c=s,a]=f.useState();return te(()=>{let[i,l]=o(e,t);if(a(i),!!l)return l(a)},[e,t]),c}function qo(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...qo(o)]:[r]}return[]}function Xo(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function Yu(e,t){let[n,r]=f.useState(t);return!e&&n!==t&&r(t),e?n:t}let Kn=f.createContext(null);Kn.displayName="OpenClosedContext";var Te=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Te||{});function Qn(){return f.useContext(Kn)}function Jo({value:e,children:t}){return f.createElement(Kn.Provider,{value:e},t)}function Ku(e){throw new Error("Unexpected object: "+e)}var re=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(re||{});function qt(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:Ku(e)}}var Zo=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Zo||{});function ei(e){let t=Q(e),n=f.useRef(!1);f.useEffect(()=>(n.current=!1,()=>{n.current=!0,Fr(()=>{n.current&&t()})}),[t])}function Qu(){let e=typeof document>"u";return"useSyncExternalStore"in L?(t=>t.useSyncExternalStore)(L)(()=>()=>{},()=>!1,()=>!e):!1}function qn(){let e=Qu(),[t,n]=L.useState(Ae.isHandoffComplete);return t&&Ae.isHandoffComplete===!1&&n(!1),L.useEffect(()=>{t!==!0&&n(!0)},[t]),L.useEffect(()=>Ae.handoff(),[]),e?!1:t}let qu=f.createContext(!1);function Xu(){return f.useContext(qu)}function Ju(e){let t=Xu(),n=f.useContext(ni),[r,o]=f.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ae.isServer)return null;let c=e==null?void 0:e.getElementById("headlessui-portal-root");if(c)return c;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return f.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),f.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let ti=f.Fragment,Zu=he(function(e,t){let{ownerDocument:n=null,...r}=e,o=f.useRef(null),s=we(vl(d=>{o.current=d}),t),c=jn(o),a=n??c,i=Ju(a),[l]=f.useState(()=>{var d;return Ae.isServer?null:(d=a==null?void 0:a.createElement("div"))!=null?d:null}),u=f.useContext(rc),p=qn();te(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),te(()=>{if(l&&u)return u.register(l)},[u,l]),ei(()=>{var d;!i||!l||(En(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((d=i.parentElement)==null||d.removeChild(i)))});let m=ve();return p?!i||!l?null:de.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:ti,name:"Portal"}),l):null});function ec(e,t){let n=we(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=ve();return r?f.createElement(Zu,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:ti,name:"Portal"})}let tc=f.Fragment,ni=f.createContext(null);function nc(e,t){let{target:n,...r}=e,o={ref:we(t)},s=ve();return f.createElement(ni.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:tc,name:"Popover.Group"}))}let rc=f.createContext(null),oc=he(ec),ic=he(nc),sc=Object.assign(oc,{Group:ic});function lc(){let e=f.useRef(!1);return te(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ri(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:ii)!==f.Fragment||f.Children.count(e.children)===1}let Xt=f.createContext(null);Xt.displayName="TransitionContext";var ac=(e=>(e.Visible="visible",e.Hidden="hidden",e))(ac||{});function uc(){let e=f.useContext(Xt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function cc(){let e=f.useContext(Jt);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Jt=f.createContext(null);Jt.displayName="NestingContext";function Zt(e){return"children"in e?Zt(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function oi(e,t){let n=Xe(e),r=f.useRef([]),o=lc(),s=ot(),c=Q((d,h=Ue.Hidden)=>{let g=r.current.findIndex(({el:b})=>b===d);g!==-1&&(ye(h,{[Ue.Unmount](){r.current.splice(g,1)},[Ue.Hidden](){r.current[g].state="hidden"}}),s.microTask(()=>{var b;!Zt(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),a=Q(d=>{let h=r.current.find(({el:g})=>g===d);return h?h.state!=="visible"&&(h.state="visible"):r.current.push({el:d,state:"visible"}),()=>c(d,Ue.Unmount)}),i=f.useRef([]),l=f.useRef(Promise.resolve()),u=f.useRef({enter:[],leave:[]}),p=Q((d,h,g)=>{i.current.splice(0),t&&(t.chains.current[h]=t.chains.current[h].filter(([b])=>b!==d)),t==null||t.chains.current[h].push([d,new Promise(b=>{i.current.push(b)})]),t==null||t.chains.current[h].push([d,new Promise(b=>{Promise.all(u.current[h].map(([w,E])=>E)).then(()=>b())})]),h==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>g(h)):g(h)}),m=Q((d,h,g)=>{Promise.all(u.current[h].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=i.current.shift())==null||b()}).then(()=>g(h))});return f.useMemo(()=>({children:r,register:a,unregister:c,onStart:p,onStop:m,wait:l,chains:u}),[a,c,r,p,m,u,l])}let ii=f.Fragment,si=jt.RenderStrategy;function fc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:p,entered:m,leave:d,leaveFrom:h,leaveTo:g,...b}=e,[w,E]=f.useState(null),x=f.useRef(null),C=ri(e),S=we(...C?[x,t,E]:t===null?[]:[t]),M=(n=b.unmount)==null||n?Ue.Unmount:Ue.Hidden,{show:F,appear:W,initial:V}=uc(),[A,O]=f.useState(F?"visible":"hidden"),j=cc(),{register:D,unregister:I}=j;te(()=>D(x),[D,x]),te(()=>{if(M===Ue.Hidden&&x.current){if(F&&A!=="visible"){O("visible");return}return ye(A,{hidden:()=>I(x),visible:()=>D(x)})}},[A,x,D,I,F,M]);let B=qn();te(()=>{if(C&&B&&A==="visible"&&x.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[x,A,B,C]);let z=V&&!W,U=W&&F&&V,T=f.useRef(!1),_=oi(()=>{T.current||(O("hidden"),I(x))},j),N=Q(R=>{T.current=!0;let ne=R?"enter":"leave";_.onStart(x,ne,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(a==null||a())})}),H=Q(R=>{let ne=R?"enter":"leave";T.current=!1,_.onStop(x,ne,fe=>{fe==="enter"?c==null||c():fe==="leave"&&(i==null||i())}),ne==="leave"&&!Zt(_)&&(O("hidden"),I(x))});f.useEffect(()=>{C&&o||(N(F),H(F))},[F,C,o]);let G=!(!o||!C||!B||z),[,q]=xo(G,w,F,{start:N,end:H}),pe=ze({ref:S,className:((r=xn(b.className,U&&l,U&&u,q.enter&&l,q.enter&&q.closed&&u,q.enter&&!q.closed&&p,q.leave&&d,q.leave&&!q.closed&&h,q.leave&&q.closed&&g,!q.transition&&F&&m))==null?void 0:r.trim())||void 0,...bo(q)}),We=0;A==="visible"&&(We|=Te.Open),A==="hidden"&&(We|=Te.Closed),F&&A==="hidden"&&(We|=Te.Opening),!F&&A==="visible"&&(We|=Te.Closing);let nt=ve();return f.createElement(Jt.Provider,{value:_},f.createElement(Jo,{value:We},nt({ourProps:pe,theirProps:b,defaultTag:ii,features:si,visible:A==="visible",name:"Transition.Child"})))}function dc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=f.useRef(null),a=ri(e),i=we(...a?[c,t]:t===null?[]:[t]);qn();let l=Qn();if(n===void 0&&l!==null&&(n=(l&Te.Open)===Te.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,p]=f.useState(n?"visible":"hidden"),m=oi(()=>{n||p("hidden")}),[d,h]=f.useState(!0),g=f.useRef([n]);te(()=>{d!==!1&&g.current[g.current.length-1]!==n&&(g.current.push(n),h(!1))},[g,n]);let b=f.useMemo(()=>({show:n,appear:r,initial:d}),[n,r,d]);te(()=>{n?p("visible"):!Zt(m)&&c.current!==null&&p("hidden")},[n,m]);let w={unmount:o},E=Q(()=>{var S;d&&h(!1),(S=e.beforeEnter)==null||S.call(e)}),x=Q(()=>{var S;d&&h(!1),(S=e.beforeLeave)==null||S.call(e)}),C=ve();return f.createElement(Jt.Provider,{value:m},f.createElement(Xt.Provider,{value:b},C({ourProps:{...w,as:f.Fragment,children:f.createElement(li,{ref:i,...w,...s,beforeEnter:E,beforeLeave:x})},theirProps:{},defaultTag:f.Fragment,features:si,visible:u==="visible",name:"Transition"})))}function pc(e,t){let n=f.useContext(Xt)!==null,r=Qn()!==null;return f.createElement(f.Fragment,null,!n&&r?f.createElement(Xn,{ref:t,...e}):f.createElement(li,{ref:t,...e}))}let Xn=he(dc),li=he(fc),mc=he(pc),ai=Object.assign(Xn,{Child:mc,Root:Xn});function hc(e,t){let n=f.useRef({left:0,top:0});if(te(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let ui=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ci(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!ke(o))return r;let s=!1;for(let a of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),s=!0;let c=s?(n=o.innerText)!=null?n:"":r;return ui.test(c)&&(c=c.replace(ui,"")),c}function gc(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let c=s.getAttribute("aria-label");return typeof c=="string"?c.trim():ci(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ci(e).trim()}function vc(e){let t=f.useRef(""),n=f.useRef("");return Q(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=gc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var bc=Object.defineProperty,xc=(e,t,n)=>t in e?bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fi=(e,t,n)=>(xc(e,typeof t!="symbol"?t+"":t,n),n),ae=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ae||{}),Ie=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(Ie||{}),en=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(en||{}),di=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(di||{});function pi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=uo(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let yc={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:re.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,c;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===re.Nothing)return{...a,activeOptionIndex:null};if(t.focus===re.Specific)return{...a,activeOptionIndex:e.options.findIndex(u=>u.id===t.id)};if(t.focus===re.Previous){let u=e.activeOptionIndex;if(u!==null){let p=e.options[u].dataRef.current.domRef,m=qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(m!==null){let d=e.options[m].dataRef.current.domRef;if(((r=p.current)==null?void 0:r.previousElementSibling)===d.current||((o=d.current)==null?void 0:o.previousElementSibling)===null)return{...a,activeOptionIndex:m}}}}else if(t.focus===re.Next){let u=e.activeOptionIndex;if(u!==null){let p=e.options[u].dataRef.current.domRef,m=qt(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled});if(m!==null){let d=e.options[m].dataRef.current.domRef;if(((s=p.current)==null?void 0:s.nextElementSibling)===d.current||((c=d.current)==null?void 0:c.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let i=pi(e),l=qt(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:u=>u.id,resolveDisabled:u=>u.dataRef.current.disabled});return{...a,...i,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(c=>{var a;return!c.dataRef.current.disabled&&((a=c.dataRef.current.textValue)==null?void 0:a.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==re.Nothing&&(r=qt(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(c=>o==null?void 0:o(c.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:re.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,c]of n.entries())if(o.has(c.id)&&(r.push(s),o.delete(c.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...pi(e),pendingShouldSort:!1}:e};class Jn extends Xr{constructor(t){super(t),fi(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return ye(s,{0:()=>r==null?void 0:r(n),1:()=>{let a=c.slice(),i=a.findIndex(l=>o(l,n));return i===-1?a.push(n):a.splice(i,1),r==null?void 0:r(a)}})},registerOption:On(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:On(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:On(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:re.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),fi(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,c=n.options;return s!==null?((o=c[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Tn.get(null);this.disposables.add(r.on(to.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new Jn({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:re.Nothing},__demoMode:n})}reduce(t,n){return ye(n.type,yc,t,n)}}const mi=f.createContext(null);function Zn(e){let t=f.useContext(mi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hi),n}return t}function hi({id:e,__demoMode:t=!1}){let n=f.useMemo(()=>Jn.new({id:e,__demoMode:t}),[]);return ei(()=>n.dispose()),n}let tn=f.createContext(null);tn.displayName="ListboxDataContext";function Nt(e){let t=f.useContext(tn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Nt),n}return t}let wc=f.Fragment;function Ec(e,t){let n=f.useId(),r=bn(),{value:o,defaultValue:s,form:c,name:a,onChange:i,by:l,invalid:u=!1,disabled:p=r||!1,horizontal:m=!1,multiple:d=!1,__demoMode:h=!1,...g}=e;const b=m?"horizontal":"vertical";let w=we(t),E=nl(s),[x=d?[]:void 0,C]=tl(o,i,E),S=hi({id:n,__demoMode:h}),M=f.useRef({static:!1,hold:!1}),F=f.useRef(new Map),W=Nl(l),V=f.useCallback(G=>ye(A.mode,{[Ie.Multi]:()=>x.some(q=>W(q,G)),[Ie.Single]:()=>W(x,G)}),[x]),A=f.useMemo(()=>({value:x,disabled:p,invalid:u,mode:d?Ie.Multi:Ie.Single,orientation:b,onChange:C,compare:W,isSelected:V,optionsPropsRef:M,listRef:F}),[x,p,u,d,b,C,W,V,M,F]);te(()=>{S.state.dataRef.current=A},[A]);let O=Ce(S,G=>G.listboxState),j=Tn.get(null),D=Ce(j,f.useCallback(G=>j.selectors.isTop(G,n),[j,n])),[I,B]=Ce(S,G=>[G.buttonElement,G.optionsElement]);ta(D,[I,B],(G,q)=>{S.send({type:di.CloseListbox}),ao(q,In.Loose)||(G.preventDefault(),I==null||I.focus())});let z=f.useMemo(()=>({open:O===ae.Open,disabled:p,invalid:u,value:x}),[O,p,u,x]),[U,T]=El({inherit:!0}),_={ref:w},N=f.useCallback(()=>{if(E!==void 0)return C==null?void 0:C(E)},[C,E]),H=ve();return f.createElement(T,{value:U,props:{htmlFor:I==null?void 0:I.id},slot:{open:O===ae.Open,disabled:p}},f.createElement(zu,null,f.createElement(mi.Provider,{value:S},f.createElement(tn.Provider,{value:A},f.createElement(Jo,{value:ye(O,{[ae.Open]:Te.Open,[ae.Closed]:Te.Closed})},a!=null&&x!=null&&f.createElement(al,{disabled:p,data:{[a]:x},form:c,onReset:N}),H({ourProps:_,theirProps:g,slot:z,defaultTag:wc,name:"Listbox"}))))))}let Cc="button";function Sc(e,t){let n=f.useId(),r=Wr(),o=Nt("Listbox.Button"),s=Zn("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:a=o.disabled||!1,autoFocus:i=!1,...l}=e,u=we(t,Wu(),s.actions.setButtonElement),p=Bu(),[m,d,h]=Ce(s,T=>[T.listboxState,T.buttonElement,T.optionsElement]),g=m===ae.Open;oa(g,{trigger:d,action:f.useCallback(T=>{if(d!=null&&d.contains(T.target))return Rt.Ignore;let _=T.target.closest('[role="option"]:not([data-disabled])');return ke(_)?Rt.Select(_):h!=null&&h.contains(T.target)?Rt.Ignore:Rt.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=Q(T=>{switch(T.key){case le.Enter:rl(T.currentTarget);break;case le.Space:case le.ArrowDown:T.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.First});break;case le.ArrowUp:T.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.Last});break}}),w=Q(T=>{switch(T.key){case le.Space:T.preventDefault();break}}),E=Q(T=>{var _;if(T.button===Zo.Left){if(hl(T.currentTarget))return T.preventDefault();s.state.listboxState===ae.Open?(de.flushSync(()=>s.actions.closeListbox()),(_=s.state.buttonElement)==null||_.focus({preventScroll:!0})):(T.preventDefault(),s.actions.openListbox({focus:re.Nothing}))}}),x=f.useRef(null),C=Q(T=>{x.current=T.pointerType,T.pointerType==="mouse"&&E(T)}),S=Q(T=>{x.current!=="mouse"&&E(T)}),M=Q(T=>T.preventDefault()),F=Yr([c]),W=bl(),{isFocusVisible:V,focusProps:A}=Us({autoFocus:i}),{isHovered:O,hoverProps:j}=Vs({isDisabled:a}),{pressed:D,pressProps:I}=Qs({disabled:a}),B=f.useMemo(()=>({open:m===ae.Open,active:D||m===ae.Open,disabled:a,invalid:o.invalid,value:o.value,hover:O,focus:V,autofocus:i}),[m,o.value,a,O,V,D,o.invalid,i]),z=Ce(s,T=>T.listboxState===ae.Open),U=jr(p(),{ref:u,id:c,type:ia(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":z,"aria-labelledby":F,"aria-describedby":W,disabled:a||void 0,autoFocus:i,onKeyDown:b,onKeyUp:w,onKeyPress:M,onPointerDown:C,onClick:S},A,j,I);return ve()({ourProps:U,theirProps:l,slot:B,defaultTag:Cc,name:"Listbox.Button"})}let gi=f.createContext(!1),$c="div",Oc=jt.RenderStrategy|jt.Static;function Tc(e,t){let n=f.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:a=!1,...i}=e,l=Ru(o),[u,p]=f.useState(null);l&&(s=!0);let m=Nt("Listbox.Options"),d=Zn("Listbox.Options"),[h,g,b,w]=Ce(d,R=>[R.listboxState,R.buttonElement,R.optionsElement,R.__demoMode]),E=jn(g),x=jn(b),C=Qn(),[S,M]=xo(a,u,C!==null?(C&Te.Open)===Te.Open:h===ae.Open);Ul(S,g,d.actions.closeListbox);let F=w?!1:c&&h===ae.Open;pa(F,x);let W=w?!1:c&&h===ae.Open;Vl(W,{allowed:f.useCallback(()=>[g,b],[g,b])});let V=h!==ae.Open,A=hc(V,g)?!1:S,O=S&&h===ae.Closed,j=Yu(O,m.value),D=Q(R=>m.compare(j,R)),I=Ce(d,R=>{var ne;if(l==null||!((ne=l==null?void 0:l.to)!=null&&ne.includes("selection")))return null;let fe=R.options.findIndex(Ke=>D(Ke.dataRef.current.value));return fe===-1&&(fe=0),fe}),B=(()=>{if(l==null)return;if(I===null)return{...l,inner:void 0};let R=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:R},index:I}}})(),[z,U]=Uu(B),T=Vu(),_=we(t,l?z:null,d.actions.setOptionsElement,p),N=ot();f.useEffect(()=>{var R;let ne=b;ne&&h===ae.Open&&ne!==((R=xt(ne))==null?void 0:R.activeElement)&&(ne==null||ne.focus({preventScroll:!0}))},[h,b]);let H=Q(R=>{var ne,fe;switch(N.dispose(),R.key){case le.Space:if(d.state.searchQuery!=="")return R.preventDefault(),R.stopPropagation(),d.actions.search(R.key);case le.Enter:if(R.preventDefault(),R.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:Ke}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(Ke.current.value)}m.mode===Ie.Single&&(de.flushSync(()=>d.actions.closeListbox()),(ne=d.state.buttonElement)==null||ne.focus({preventScroll:!0}));break;case ye(m.orientation,{vertical:le.ArrowDown,horizontal:le.ArrowRight}):return R.preventDefault(),R.stopPropagation(),d.actions.goToOption({focus:re.Next});case ye(m.orientation,{vertical:le.ArrowUp,horizontal:le.ArrowLeft}):return R.preventDefault(),R.stopPropagation(),d.actions.goToOption({focus:re.Previous});case le.Home:case le.PageUp:return R.preventDefault(),R.stopPropagation(),d.actions.goToOption({focus:re.First});case le.End:case le.PageDown:return R.preventDefault(),R.stopPropagation(),d.actions.goToOption({focus:re.Last});case le.Escape:R.preventDefault(),R.stopPropagation(),de.flushSync(()=>d.actions.closeListbox()),(fe=d.state.buttonElement)==null||fe.focus({preventScroll:!0});return;case le.Tab:R.preventDefault(),R.stopPropagation(),de.flushSync(()=>d.actions.closeListbox()),Xl(d.state.buttonElement,R.shiftKey?Fn.Previous:Fn.Next);break;default:R.key.length===1&&(d.actions.search(R.key),N.setTimeout(()=>d.actions.clearSearch(),350));break}}),G=Ce(d,R=>{var ne;return(ne=R.buttonElement)==null?void 0:ne.id}),q=f.useMemo(()=>({open:h===ae.Open}),[h]),pe=jr(l?T():{},{id:r,ref:_,"aria-activedescendant":Ce(d,d.selectors.activeDescendantId),"aria-multiselectable":m.mode===Ie.Multi?!0:void 0,"aria-labelledby":G,"aria-orientation":m.orientation,onKeyDown:H,role:"listbox",tabIndex:h===ae.Open?0:void 0,style:{...i.style,...U,"--button-width":Ml(g,!0).width},...bo(M)}),We=ve(),nt=f.useMemo(()=>m.mode===Ie.Multi?m:{...m,isSelected:D},[m,D]);return f.createElement(sc,{enabled:s?e.static||S:!1,ownerDocument:E},f.createElement(tn.Provider,{value:nt},We({ourProps:pe,theirProps:i,slot:q,defaultTag:$c,features:Oc,visible:A,name:"Listbox.Options"})))}let Nc="div";function Ac(e,t){let n=f.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,a=f.useContext(gi)===!0,i=Nt("Listbox.Option"),l=Zn("Listbox.Option"),u=Ce(l,A=>l.selectors.isActive(A,r)),p=i.isSelected(s),m=f.useRef(null),d=vc(m),h=Xe({disabled:o,value:s,domRef:m,get textValue(){return d()}}),g=we(t,m,A=>{A?i.listRef.current.set(r,A):i.listRef.current.delete(r)}),b=Ce(l,A=>l.selectors.shouldScrollIntoView(A,r));te(()=>{if(b)return $e().requestAnimationFrame(()=>{var A,O;(O=(A=m.current)==null?void 0:A.scrollIntoView)==null||O.call(A,{block:"nearest"})})},[b,m]),te(()=>{if(!a)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,a]);let w=Q(A=>{var O;if(o)return A.preventDefault();l.actions.onChange(s),i.mode===Ie.Single&&(de.flushSync(()=>l.actions.closeListbox()),(O=l.state.buttonElement)==null||O.focus({preventScroll:!0}))}),E=Q(()=>{if(o)return l.actions.goToOption({focus:re.Nothing});l.actions.goToOption({focus:re.Specific,id:r})}),x=ma(),C=Q(A=>x.update(A)),S=Q(A=>{x.wasMoved(A)&&(o||u&&l.state.activationTrigger===en.Pointer||l.actions.goToOption({focus:re.Specific,id:r},en.Pointer))}),M=Q(A=>{x.wasMoved(A)&&(o||u&&l.state.activationTrigger===en.Pointer&&l.actions.goToOption({focus:re.Nothing}))}),F=f.useMemo(()=>({active:u,focus:u,selected:p,disabled:o,selectedOption:p&&a}),[u,p,o,a]),W=a?{}:{id:r,ref:g,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:w,onFocus:E,onPointerEnter:C,onMouseEnter:C,onPointerMove:S,onMouseMove:S,onPointerLeave:M,onMouseLeave:M},V=ve();return!p&&a?null:V({ourProps:W,theirProps:c,slot:F,defaultTag:Nc,name:"Listbox.Option"})}let Mc=f.Fragment;function Pc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:we(t)},c=Nt("ListboxSelectedOption"),a=f.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===Ie.Multi&&Array.isArray(c.value)&&c.value.length===0,l=ve();return f.createElement(gi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:f.createElement(f.Fragment,null,r&&i?r:n)},slot:a,defaultTag:Mc,name:"ListboxSelectedOption"}))}let Lc=he(Ec),Fc=he(Sc),Ic=Ol,jc=he(Tc),Dc=he(Ac),_c=he(Pc),Ye=Object.assign(Lc,{Button:Fc,Label:Ic,Options:jc,Option:Dc,SelectedOption:_c});function kc({title:e,titleId:t,...n},r){return L.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?L.createElement("title",{id:t},e):null,L.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const vi=L.forwardRef(kc);function Rc({title:e,titleId:t,...n},r){return L.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?L.createElement("title",{id:t},e):null,L.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const bi=L.forwardRef(Rc),Wc=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>y.jsx("div",{className:`relative ${o}`,children:y.jsx(Ye,{value:t,onChange:n,disabled:r,children:({open:c})=>y.jsxs(y.Fragment,{children:[y.jsxs(Ye.Button,{className:`
|
|
74
|
+
*/var Mo;function wa(){return Mo||(Mo=1,process.env.NODE_ENV!=="production"&&function(){function e(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=d,n=typeof Object.is=="function"?Object.is:e,r=t.useSyncExternalStore,o=t.useRef,s=t.useEffect,u=t.useMemo,a=t.useDebugValue;Xn.useSyncExternalStoreWithSelector=function(i,l,c,p,m){var f=o(null);if(f.current===null){var b={hasValue:!1,value:null};f.current=b}else b=f.current;f=u(function(){function N(_){if(!I){if(I=!0,w=_,_=p(_),m!==void 0&&b.hasValue){var B=b.value;if(m(B,_))return T=B}return T=_}if(B=T,n(w,_))return B;var W=p(_);return m!==void 0&&m(B,W)?(w=_,B):(w=_,T=W)}var I=!1,w,T,j=c===void 0?null:c;return[function(){return N(l())},j===null?void 0:function(){return N(j())}]},[l,c,p,m]);var y=r(i,f[0],f[1]);return s(function(){b.hasValue=!0,b.value=y},[y]),a(y),y},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Xn}process.env.NODE_ENV==="production"?qn.exports=xa():qn.exports=wa();var Ea=qn.exports;function Le(e,t,n=Ao){return Ea.useSyncExternalStoreWithSelector(Z(r=>e.subscribe(Ca,r)),Z(()=>e.state),Z(()=>e.state),Z(t),n)}function Ca(e){return e}function Lo(e,t){let n=d.useId(),r=Kn.get(t),[o,s]=Le(r,d.useCallback(u=>[r.selectors.isTop(u,n),r.selectors.inStack(u,n)],[r,n]));return le(()=>{if(e)return r.actions.push(n),()=>r.actions.pop(n)},[r,e,n]),e?s?o:!0:!1}let Jn=new Map,kt=new Map;function Io(e){var t;let n=(t=kt.get(e))!=null?t:0;return kt.set(e,n+1),n!==0?()=>Do(e):(Jn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>Do(e))}function Do(e){var t;let n=(t=kt.get(e))!=null?t:1;if(n===1?kt.delete(e):kt.set(e,n-1),n!==1)return;let r=Jn.get(e);r&&(r["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",r["aria-hidden"]),e.inert=r.inert,Jn.delete(e))}function Sa(e,{allowed:t,disallowed:n}={}){let r=Lo(e,"inert-others");le(()=>{var o,s;if(!r)return;let u=Re();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&u.add(Io(i));let a=(s=t==null?void 0:t())!=null?s:[];for(let i of a){if(!i)continue;let l=Ft(i);if(!l)continue;let c=i.parentElement;for(;c&&c!==l.body;){for(let p of c.children)a.some(m=>p.contains(m))||u.add(Io(p));c=c.parentElement}}return u.dispose},[r,t,n])}function Oa(e,t,n){let r=pt(o=>{let s=o.getBoundingClientRect();s.x===0&&s.y===0&&s.width===0&&s.height===0&&n()});d.useEffect(()=>{if(!e)return;let o=t===null?null:Ze(t)?t:t.current;if(!o)return;let s=Re();if(typeof ResizeObserver<"u"){let u=new ResizeObserver(()=>r.current(o));u.observe(o),s.add(()=>u.disconnect())}if(typeof IntersectionObserver<"u"){let u=new IntersectionObserver(()=>r.current(o));u.observe(o),s.add(()=>u.disconnect())}return()=>s.dispose()},[t,r,e])}let Zn=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(","),Aa=["[data-autofocus]"].map(e=>`${e}:not([tabindex='-1'])`).join(",");var er=(e=>(e[e.First=1]="First",e[e.Previous=2]="Previous",e[e.Next=4]="Next",e[e.Last=8]="Last",e[e.WrapAround=16]="WrapAround",e[e.NoScroll=32]="NoScroll",e[e.AutoFocus=64]="AutoFocus",e))(er||{}),Na=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Na||{}),$a=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))($a||{});function Fo(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Zn)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}function Ta(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Aa)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var tr=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(tr||{});function _o(e,t=0){var n;return e===((n=Ft(e))==null?void 0:n.body)?!1:Te(t,{0(){return e.matches(Zn)},1(){let r=e;for(;r!==null;){if(r.matches(Zn))return!0;r=r.parentElement}return!1}})}var Pa=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Pa||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let Ma=["textarea","input"].join(",");function La(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Ma))!=null?n:!1}function jo(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let u=o.compareDocumentPosition(s);return u&Node.DOCUMENT_POSITION_FOLLOWING?-1:u&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Ia(e,t){return Da(Fo(),t,{relativeTo:e})}function Da(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,u=Array.isArray(e)?n?jo(e):e:t&64?Ta(e):Fo(e);o.length>0&&u.length>1&&(u=u.filter(f=>!o.some(b=>b!=null&&"current"in b?(b==null?void 0:b.current)===f:b===f))),r=r??s.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,u.indexOf(r))-1;if(t&4)return Math.max(0,u.indexOf(r))+1;if(t&8)return u.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=t&32?{preventScroll:!0}:{},c=0,p=u.length,m;do{if(c>=p||c+p<=0)return 0;let f=i+c;if(t&16)f=(f+p)%p;else{if(f<0)return 3;if(f>=p)return 1}m=u[f],m==null||m.focus(l),c+=a}while(m!==s.activeElement);return t&6&&La(m)&&m.select(),2}function ko(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Fa(){return/Android/gi.test(window.navigator.userAgent)}function Ro(){return ko()||Fa()}function Et(e,t,n,r){let o=pt(n);d.useEffect(()=>{if(!e)return;function s(u){o.current(u)}return document.addEventListener(t,s,r),()=>document.removeEventListener(t,s,r)},[e,t,r])}function _a(e,t,n,r){let o=pt(n);d.useEffect(()=>{if(!e)return;function s(u){o.current(u)}return window.addEventListener(t,s,r),()=>window.removeEventListener(t,s,r)},[e,t,r])}const Bo=30;function ja(e,t,n){let r=pt(n),o=d.useCallback(function(a,i){if(a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let c=function p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of c)if(p!==null&&(p.contains(l)||a.composed&&a.composedPath().includes(p)))return;return!_o(l,tr.Loose)&&l.tabIndex!==-1&&a.preventDefault(),r.current(a,l)},[r,t]),s=d.useRef(null);Et(e,"pointerdown",a=>{var i,l;Ro()||(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),Et(e,"pointerup",a=>{if(Ro()||!s.current)return;let i=s.current;return s.current=null,o(a,()=>i)},!0);let u=d.useRef({x:0,y:0});Et(e,"touchstart",a=>{u.current.x=a.touches[0].clientX,u.current.y=a.touches[0].clientY},!0),Et(e,"touchend",a=>{let i={x:a.changedTouches[0].clientX,y:a.changedTouches[0].clientY};if(!(Math.abs(i.x-u.current.x)>=Bo||Math.abs(i.y-u.current.y)>=Bo))return o(a,()=>wt(a.target)?a.target:null)},!0),_a(e,"blur",a=>o(a,()=>Kl(window.document.activeElement)?window.document.activeElement:null),!0)}function nr(...e){return d.useMemo(()=>Ft(...e),[...e])}var ka=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ka||{});const tn={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},Ra=200,Wo=5;function Ba(e,{trigger:t,action:n,close:r,select:o}){let s=d.useRef(null),u=d.useRef(null),a=d.useRef(null);Et(e&&t!==null,"pointerdown",i=>{Vn(i==null?void 0:i.target)&&t!=null&&t.contains(i.target)&&(u.current=i.x,a.current=i.y,s.current=i.timeStamp)}),Et(e&&t!==null,"pointerup",i=>{var l,c;let p=s.current;if(p===null||(s.current=null,!wt(i.target))||Math.abs(i.x-((l=u.current)!=null?l:i.x))<Wo&&Math.abs(i.y-((c=a.current)!=null?c:i.y))<Wo)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>Ra&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function Wa(e,t){return d.useMemo(()=>{var n;if(e.type)return e.type;let r=(n=e.as)!=null?n:"button";if(typeof r=="string"&&r.toLowerCase()==="button"||(t==null?void 0:t.tagName)==="BUTTON"&&!t.hasAttribute("type"))return"button"},[e.type,e.as,t])}function Ua(e){return d.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function Va(e,t){let n=e(),r=new Set;return{getSnapshot(){return n},subscribe(o){return r.add(o),()=>r.delete(o)},dispatch(o,...s){let u=t[o].call(n,...s);u&&(n=u,r.forEach(a=>a()))}}}function za(){let e;return{before({doc:t}){var n;let r=t.documentElement,o=(n=t.defaultView)!=null?n:window;e=Math.max(0,o.innerWidth-r.clientWidth)},after({doc:t,d:n}){let r=t.documentElement,o=Math.max(0,r.clientWidth-r.offsetWidth),s=Math.max(0,e-o);n.style(r,"paddingRight",`${s}px`)}}}function Ha(){return ko()?{before({doc:e,d:t,meta:n}){function r(o){return n.containers.flatMap(s=>s()).some(s=>s.contains(o))}t.microTask(()=>{var o;if(window.getComputedStyle(e.documentElement).scrollBehavior!=="auto"){let a=Re();a.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>a.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,u=null;t.addEventListener(e,"click",a=>{if(wt(a.target))try{let i=a.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),c=e.querySelector(l);wt(c)&&!r(c)&&(u=c)}catch{}},!0),t.addEventListener(e,"touchstart",a=>{if(wt(a.target)&&Yl(a.target))if(r(a.target)){let i=a.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(a.target,"touchAction","none")}),t.addEventListener(e,"touchmove",a=>{if(wt(a.target)){if(mo(a.target))return;if(r(a.target)){let i=a.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&a.preventDefault()}else a.preventDefault()}},{passive:!1}),t.add(()=>{var a;let i=(a=window.scrollY)!=null?a:window.pageYOffset;s!==i&&window.scrollTo(0,s),u&&u.isConnected&&(u.scrollIntoView({block:"nearest"}),u=null)})})}}:{}}function Ga(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function Ya(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let ht=Va(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Re(),meta:new Set};return r.count++,r.meta.add(t),this.set(e,r),this},POP(e,t){let n=this.get(e);return n&&(n.count--,n.meta.delete(t)),this},SCROLL_PREVENT({doc:e,d:t,meta:n}){let r={doc:e,d:t,meta:Ya(n)},o=[Ha(),za(),Ga()];o.forEach(({before:s})=>s==null?void 0:s(r)),o.forEach(({after:s})=>s==null?void 0:s(r))},SCROLL_ALLOW({d:e}){e.dispose()},TEARDOWN({doc:e}){this.delete(e)}});ht.subscribe(()=>{let e=ht.getSnapshot(),t=new Map;for(let[n]of e)t.set(n,n.documentElement.style.overflow);for(let n of e.values()){let r=t.get(n.doc)==="hidden",o=n.count!==0;(o&&!r||!o&&r)&&ht.dispatch(n.count>0?"SCROLL_PREVENT":"SCROLL_ALLOW",n),n.count===0&&ht.dispatch("TEARDOWN",n)}});function Ka(e,t,n=()=>({containers:[]})){let r=Ua(ht),o=t?r.get(t):void 0,s=o?o.count>0:!1;return le(()=>{if(!(!t||!e))return ht.dispatch("PUSH",t,n),()=>ht.dispatch("POP",t,n)},[e,t]),s}function qa(e,t,n=()=>[document.body]){let r=Lo(e,"scroll-lock");Ka(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function Uo(e){return[e.screenX,e.screenY]}function Qa(){let e=d.useRef([-1,-1]);return{wasMoved(t){let n=Uo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Uo(t)}}}function Xa(e=0){let[t,n]=d.useState(e),r=d.useCallback(i=>n(i),[t]),o=d.useCallback(i=>n(l=>l|i),[t]),s=d.useCallback(i=>(t&i)===i,[t]),u=d.useCallback(i=>n(l=>l&~i),[n]),a=d.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:u,toggleFlag:a}}var Vo,zo;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((Vo=process==null?void 0:process.env)==null?void 0:Vo.NODE_ENV)==="test"&&typeof((zo=Element==null?void 0:Element.prototype)==null?void 0:zo.getAnimations)>"u"&&(Element.prototype.getAnimations=function(){return console.warn(["Headless UI has polyfilled `Element.prototype.getAnimations` for your tests.","Please install a proper polyfill e.g. `jsdom-testing-mocks`, to silence these warnings.","","Example usage:","```js","import { mockAnimationsApi } from 'jsdom-testing-mocks'","mockAnimationsApi()","```"].join(`
|
|
75
|
+
`)),[]});var Ja=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(Ja||{});function Ho(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function Go(e,t,n,r){let[o,s]=d.useState(n),{hasFlag:u,addFlag:a,removeFlag:i}=Xa(e&&o?3:0),l=d.useRef(!1),c=d.useRef(!1),p=xt();return le(()=>{var m;if(e){if(n&&s(!0),!t){n&&a(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),Za(t,{inFlight:l,prepare(){c.current?c.current=!1:c.current=l.current,l.current=!0,!c.current&&(n?(a(3),i(4)):(a(4),i(2)))},run(){c.current?n?(i(3),a(4)):(i(4),a(3)):n?i(1):a(1)},done(){var f;c.current&&typeof t.getAnimations=="function"&&t.getAnimations().length>0||(l.current=!1,i(7),n||s(!1),(f=r==null?void 0:r.end)==null||f.call(r,n))}})}},[e,n,t,p]),e?[o,{closed:u(1),enter:u(2),leave:u(4),transition:u(2)||u(4)}]:[n,{closed:void 0,enter:void 0,leave:void 0,transition:void 0}]}function Za(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Re();return tu(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(eu(e,r))})}),s.dispose}function eu(e,t){var n,r;let o=Re();if(!e)return o.dispose;let s=!1;o.add(()=>{s=!0});let u=(r=(n=e.getAnimations)==null?void 0:n.call(e).filter(a=>a instanceof CSSTransition))!=null?r:[];return u.length===0?(t(),o.dispose):(Promise.allSettled(u.map(a=>a.finished)).then(()=>{s||t()}),o.dispose)}function tu(e,{inFlight:t,prepare:n}){if(t!=null&&t.current){n();return}let r=e.style.transition;e.style.transition="none",n(),e.offsetHeight,e.style.transition=r}function nn(){return typeof window<"u"}function Ct(e){return Yo(e)?(e.nodeName||"").toLowerCase():"#document"}function Ne(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){var t;return(t=(Yo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Yo(e){return nn()?e instanceof Node||e instanceof Ne(e).Node:!1}function be(e){return nn()?e instanceof Element||e instanceof Ne(e).Element:!1}function Ye(e){return nn()?e instanceof HTMLElement||e instanceof Ne(e).HTMLElement:!1}function Ko(e){return!nn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Ne(e).ShadowRoot}const nu=new Set(["inline","contents"]);function Rt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Be(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!nu.has(o)}const ru=new Set(["table","td","th"]);function ou(e){return ru.has(Ct(e))}const iu=[":popover-open",":modal"];function rn(e){return iu.some(t=>{try{return e.matches(t)}catch{return!1}})}const su=["transform","translate","scale","rotate","perspective"],lu=["transform","translate","scale","rotate","perspective","filter"],au=["paint","layout","strict","content"];function rr(e){const t=or(),n=be(e)?Be(e):e;return su.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||lu.some(r=>(n.willChange||"").includes(r))||au.some(r=>(n.contain||"").includes(r))}function uu(e){let t=st(e);for(;Ye(t)&&!St(t);){if(rr(t))return t;if(rn(t))return null;t=st(t)}return null}function or(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const cu=new Set(["html","body","#document"]);function St(e){return cu.has(Ct(e))}function Be(e){return Ne(e).getComputedStyle(e)}function on(e){return be(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function st(e){if(Ct(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ko(e)&&e.host||Ge(e);return Ko(t)?t.host:t}function qo(e){const t=st(e);return St(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ye(t)&&Rt(t)?t:qo(t)}function Bt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=qo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),u=Ne(o);if(s){const a=ir(u);return t.concat(u,u.visualViewport||[],Rt(o)?o:[],a&&n?Bt(a):[])}return t.concat(o,Bt(o,[],n))}function ir(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function fu(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}const mt=Math.min,ye=Math.max,Wt=Math.round,sn=Math.floor,Ke=e=>({x:e,y:e}),du={left:"right",right:"left",bottom:"top",top:"bottom"},pu={start:"end",end:"start"};function Qo(e,t,n){return ye(e,mt(t,n))}function Ot(e,t){return typeof e=="function"?e(t):e}function lt(e){return e.split("-")[0]}function Ut(e){return e.split("-")[1]}function Xo(e){return e==="x"?"y":"x"}function Jo(e){return e==="y"?"height":"width"}const hu=new Set(["top","bottom"]);function et(e){return hu.has(lt(e))?"y":"x"}function Zo(e){return Xo(et(e))}function mu(e,t,n){n===void 0&&(n=!1);const r=Ut(e),o=Zo(e),s=Jo(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(u=ln(u)),[u,ln(u)]}function gu(e){const t=ln(e);return[sr(e),t,sr(t)]}function sr(e){return e.replace(/start|end/g,t=>pu[t])}const ei=["left","right"],ti=["right","left"],vu=["top","bottom"],bu=["bottom","top"];function yu(e,t,n){switch(e){case"top":case"bottom":return n?t?ti:ei:t?ei:ti;case"left":case"right":return t?vu:bu;default:return[]}}function xu(e,t,n,r){const o=Ut(e);let s=yu(lt(e),n==="start",r);return o&&(s=s.map(u=>u+"-"+o),t&&(s=s.concat(s.map(sr)))),s}function ln(e){return e.replace(/left|right|bottom|top/g,t=>du[t])}function wu(e){return{top:0,right:0,bottom:0,left:0,...e}}function Eu(e){return typeof e!="number"?wu(e):{top:e,right:e,bottom:e,left:e}}function an(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ni(e,t,n){let{reference:r,floating:o}=e;const s=et(t),u=Zo(t),a=Jo(u),i=lt(t),l=s==="y",c=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let f;switch(i){case"top":f={x:c,y:r.y-o.height};break;case"bottom":f={x:c,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-o.width,y:p};break;default:f={x:r.x,y:r.y}}switch(Ut(t)){case"start":f[u]-=m*(n&&l?-1:1);break;case"end":f[u]+=m*(n&&l?-1:1);break}return f}const Cu=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:u}=n,a=s.filter(Boolean),i=await(u.isRTL==null?void 0:u.isRTL(t));let l=await u.getElementRects({reference:e,floating:t,strategy:o}),{x:c,y:p}=ni(l,r,i),m=r,f={},b=0;for(let y=0;y<a.length;y++){const{name:N,fn:I}=a[y],{x:w,y:T,data:j,reset:_}=await I({x:c,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:f,rects:l,platform:u,elements:{reference:e,floating:t}});c=w??c,p=T??p,f={...f,[N]:{...f[N],...j}},_&&b<=50&&(b++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(l=_.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:o}):_.rects),{x:c,y:p}=ni(l,m,i)),y=-1)}return{x:c,y:p,placement:m,strategy:o,middlewareData:f}};async function un(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:u,elements:a,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:c="viewport",elementContext:p="floating",altBoundary:m=!1,padding:f=0}=Ot(t,e),b=Eu(f),N=a[m?p==="floating"?"reference":"floating":p],I=an(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(N)))==null||n?N:N.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:l,rootBoundary:c,strategy:i})),w=p==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),j=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},_=an(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:T,strategy:i}):w);return{top:(I.top-_.top+b.top)/j.y,bottom:(_.bottom-I.bottom+b.bottom)/j.y,left:(I.left-_.left+b.left)/j.x,right:(_.right-I.right+b.right)/j.x}}const Su=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:u,initialPlacement:a,platform:i,elements:l}=t,{mainAxis:c=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:y=!0,...N}=Ot(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const I=lt(o),w=et(a),T=lt(a)===a,j=await(i.isRTL==null?void 0:i.isRTL(l.floating)),_=m||(T||!y?[ln(a)]:gu(a)),B=b!=="none";!m&&B&&_.push(...xu(a,y,b,j));const W=[a,..._],h=await un(t,N),v=[];let g=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&v.push(h[I]),p){const P=mu(o,u,j);v.push(h[P[0]],h[P[1]])}if(g=[...g,{placement:o,overflows:v}],!v.every(P=>P<=0)){var x,C;const P=(((x=s.flip)==null?void 0:x.index)||0)+1,S=W[P];if(S&&(!(p==="alignment"?w!==et(S):!1)||g.every(E=>et(E.placement)===w?E.overflows[0]>0:!0)))return{data:{index:P,overflows:g},reset:{placement:S}};let $=(C=g.filter(L=>L.overflows[0]<=0).sort((L,E)=>L.overflows[1]-E.overflows[1])[0])==null?void 0:C.placement;if(!$)switch(f){case"bestFit":{var A;const L=(A=g.filter(E=>{if(B){const D=et(E.placement);return D===w||D==="y"}return!0}).map(E=>[E.placement,E.overflows.filter(D=>D>0).reduce((D,F)=>D+F,0)]).sort((E,D)=>E[1]-D[1])[0])==null?void 0:A[0];L&&($=L);break}case"initialPlacement":$=a;break}if(o!==$)return{reset:{placement:$}}}return{}}}},Ou=new Set(["left","top"]);async function Au(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=lt(n),a=Ut(n),i=et(n)==="y",l=Ou.has(u)?-1:1,c=s&&i?-1:1,p=Ot(t,e);let{mainAxis:m,crossAxis:f,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof b=="number"&&(f=a==="end"?b*-1:b),i?{x:f*c,y:m*l}:{x:m*l,y:f*c}}const Nu=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:u,middlewareData:a}=t,i=await Au(t,e);return u===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:u}}}}},$u=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:u=!1,limiter:a={fn:N=>{let{x:I,y:w}=N;return{x:I,y:w}}},...i}=Ot(e,t),l={x:n,y:r},c=await un(t,i),p=et(lt(o)),m=Xo(p);let f=l[m],b=l[p];if(s){const N=m==="y"?"top":"left",I=m==="y"?"bottom":"right",w=f+c[N],T=f-c[I];f=Qo(w,f,T)}if(u){const N=p==="y"?"top":"left",I=p==="y"?"bottom":"right",w=b+c[N],T=b-c[I];b=Qo(w,b,T)}const y=a.fn({...t,[m]:f,[p]:b});return{...y,data:{x:y.x-n,y:y.y-r,enabled:{[m]:s,[p]:u}}}}}},Tu=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:u,elements:a}=t,{apply:i=()=>{},...l}=Ot(e,t),c=await un(t,l),p=lt(o),m=Ut(o),f=et(o)==="y",{width:b,height:y}=s.floating;let N,I;p==="top"||p==="bottom"?(N=p,I=m===(await(u.isRTL==null?void 0:u.isRTL(a.floating))?"start":"end")?"left":"right"):(I=p,N=m==="end"?"top":"bottom");const w=y-c.top-c.bottom,T=b-c.left-c.right,j=mt(y-c[N],w),_=mt(b-c[I],T),B=!t.middlewareData.shift;let W=j,h=_;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(h=T),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(W=w),B&&!m){const g=ye(c.left,0),x=ye(c.right,0),C=ye(c.top,0),A=ye(c.bottom,0);f?h=b-2*(g!==0||x!==0?g+x:ye(c.left,c.right)):W=y-2*(C!==0||A!==0?C+A:ye(c.top,c.bottom))}await i({...t,availableWidth:h,availableHeight:W});const v=await u.getDimensions(a.floating);return b!==v.width||y!==v.height?{reset:{rects:!0}}:{}}}};function ri(e){const t=Be(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=Ye(e),s=o?e.offsetWidth:n,u=o?e.offsetHeight:r,a=Wt(n)!==s||Wt(r)!==u;return a&&(n=s,r=u),{width:n,height:r,$:a}}function lr(e){return be(e)?e:e.contextElement}function At(e){const t=lr(e);if(!Ye(t))return Ke(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ri(t);let u=(s?Wt(n.width):n.width)/r,a=(s?Wt(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!a||!Number.isFinite(a))&&(a=1),{x:u,y:a}}const Pu=Ke(0);function oi(e){const t=Ne(e);return!or()||!t.visualViewport?Pu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Mu(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Ne(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=lr(e);let u=Ke(1);t&&(r?be(r)&&(u=At(r)):u=At(e));const a=Mu(s,n,r)?oi(s):Ke(0);let i=(o.left+a.x)/u.x,l=(o.top+a.y)/u.y,c=o.width/u.x,p=o.height/u.y;if(s){const m=Ne(s),f=r&&be(r)?Ne(r):r;let b=m,y=ir(b);for(;y&&r&&f!==b;){const N=At(y),I=y.getBoundingClientRect(),w=Be(y),T=I.left+(y.clientLeft+parseFloat(w.paddingLeft))*N.x,j=I.top+(y.clientTop+parseFloat(w.paddingTop))*N.y;i*=N.x,l*=N.y,c*=N.x,p*=N.y,i+=T,l+=j,b=Ne(y),y=ir(b)}}return an({width:c,height:p,x:i,y:l})}function cn(e,t){const n=on(e).scrollLeft;return t?t.left+n:gt(Ge(e)).left+n}function ii(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-cn(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Lu(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",u=Ge(r),a=t?rn(t.floating):!1;if(r===u||a&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Ke(1);const c=Ke(0),p=Ye(r);if((p||!p&&!s)&&((Ct(r)!=="body"||Rt(u))&&(i=on(r)),Ye(r))){const f=gt(r);l=At(r),c.x=f.x+r.clientLeft,c.y=f.y+r.clientTop}const m=u&&!p&&!s?ii(u,i):Ke(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+c.x+m.x,y:n.y*l.y-i.scrollTop*l.y+c.y+m.y}}function Iu(e){return Array.from(e.getClientRects())}function Du(e){const t=Ge(e),n=on(e),r=e.ownerDocument.body,o=ye(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ye(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+cn(e);const a=-n.scrollTop;return Be(r).direction==="rtl"&&(u+=ye(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:u,y:a}}const si=25;function Fu(e,t){const n=Ne(e),r=Ge(e),o=n.visualViewport;let s=r.clientWidth,u=r.clientHeight,a=0,i=0;if(o){s=o.width,u=o.height;const c=or();(!c||c&&t==="fixed")&&(a=o.offsetLeft,i=o.offsetTop)}const l=cn(r);if(l<=0){const c=r.ownerDocument,p=c.body,m=getComputedStyle(p),f=c.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,b=Math.abs(r.clientWidth-p.clientWidth-f);b<=si&&(s-=b)}else l<=si&&(s+=l);return{width:s,height:u,x:a,y:i}}const _u=new Set(["absolute","fixed"]);function ju(e,t){const n=gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=Ye(e)?At(e):Ke(1),u=e.clientWidth*s.x,a=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:u,height:a,x:i,y:l}}function li(e,t,n){let r;if(t==="viewport")r=Fu(e,n);else if(t==="document")r=Du(Ge(e));else if(be(t))r=ju(t,n);else{const o=oi(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return an(r)}function ai(e,t){const n=st(e);return n===t||!be(n)||St(n)?!1:Be(n).position==="fixed"||ai(n,t)}function ku(e,t){const n=t.get(e);if(n)return n;let r=Bt(e,[],!1).filter(a=>be(a)&&Ct(a)!=="body"),o=null;const s=Be(e).position==="fixed";let u=s?st(e):e;for(;be(u)&&!St(u);){const a=Be(u),i=rr(u);!i&&a.position==="fixed"&&(o=null),(s?!i&&!o:!i&&a.position==="static"&&!!o&&_u.has(o.position)||Rt(u)&&!i&&ai(e,u))?r=r.filter(c=>c!==u):o=a,u=st(u)}return t.set(e,r),r}function Ru(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const u=[...n==="clippingAncestors"?rn(t)?[]:ku(t,this._c):[].concat(n),r],a=u[0],i=u.reduce((l,c)=>{const p=li(t,c,o);return l.top=ye(p.top,l.top),l.right=mt(p.right,l.right),l.bottom=mt(p.bottom,l.bottom),l.left=ye(p.left,l.left),l},li(t,a,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function Bu(e){const{width:t,height:n}=ri(e);return{width:t,height:n}}function Wu(e,t,n){const r=Ye(t),o=Ge(t),s=n==="fixed",u=gt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const i=Ke(0);function l(){i.x=cn(o)}if(r||!r&&!s)if((Ct(t)!=="body"||Rt(o))&&(a=on(t)),r){const f=gt(t,!0,s,t);i.x=f.x+t.clientLeft,i.y=f.y+t.clientTop}else o&&l();s&&!r&&o&&l();const c=o&&!r&&!s?ii(o,a):Ke(0),p=u.left+a.scrollLeft-i.x-c.x,m=u.top+a.scrollTop-i.y-c.y;return{x:p,y:m,width:u.width,height:u.height}}function ar(e){return Be(e).position==="static"}function ui(e,t){if(!Ye(e)||Be(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function ci(e,t){const n=Ne(e);if(rn(e))return n;if(!Ye(e)){let o=st(e);for(;o&&!St(o);){if(be(o)&&!ar(o))return o;o=st(o)}return n}let r=ui(e,t);for(;r&&ou(r)&&ar(r);)r=ui(r,t);return r&&St(r)&&ar(r)&&!rr(r)?n:r||uu(e)||n}const Uu=async function(e){const t=this.getOffsetParent||ci,n=this.getDimensions,r=await n(e.floating);return{reference:Wu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Vu(e){return Be(e).direction==="rtl"}const zu={convertOffsetParentRelativeRectToViewportRelativeRect:Lu,getDocumentElement:Ge,getClippingRect:Ru,getOffsetParent:ci,getElementRects:Uu,getClientRects:Iu,getDimensions:Bu,getScale:At,isElement:be,isRTL:Vu};function fi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Hu(e,t){let n=null,r;const o=Ge(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function u(a,i){a===void 0&&(a=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:c,top:p,width:m,height:f}=l;if(a||t(),!m||!f)return;const b=sn(p),y=sn(o.clientWidth-(c+m)),N=sn(o.clientHeight-(p+f)),I=sn(c),T={rootMargin:-b+"px "+-y+"px "+-N+"px "+-I+"px",threshold:ye(0,mt(1,i))||1};let j=!0;function _(B){const W=B[0].intersectionRatio;if(W!==i){if(!j)return u();W?u(!1,W):r=setTimeout(()=>{u(!1,1e-7)},1e3)}W===1&&!fi(l,e.getBoundingClientRect())&&u(),j=!1}try{n=new IntersectionObserver(_,{...T,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,T)}n.observe(e)}return u(!0),s}function Gu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=lr(e),c=o||s?[...l?Bt(l):[],...Bt(t)]:[];c.forEach(I=>{o&&I.addEventListener("scroll",n,{passive:!0}),s&&I.addEventListener("resize",n)});const p=l&&a?Hu(l,n):null;let m=-1,f=null;u&&(f=new ResizeObserver(I=>{let[w]=I;w&&w.target===l&&f&&(f.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var T;(T=f)==null||T.observe(t)})),n()}),l&&!i&&f.observe(l),f.observe(t));let b,y=i?gt(e):null;i&&N();function N(){const I=gt(e);y&&!fi(y,I)&&n(),y=I,b=requestAnimationFrame(N)}return n(),()=>{var I;c.forEach(w=>{o&&w.removeEventListener("scroll",n),s&&w.removeEventListener("resize",n)}),p==null||p(),(I=f)==null||I.disconnect(),f=null,i&&cancelAnimationFrame(b)}}const ur=un,Yu=Nu,Ku=$u,qu=Su,Qu=Tu,Xu=(e,t,n)=>{const r=new Map,o={platform:zu,...n},s={...o.platform,_c:r};return Cu(e,t,{...o,platform:s})};var Ju=typeof document<"u",Zu=function(){},fn=Ju?d.useLayoutEffect:Zu;function dn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!dn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!dn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function di(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function pi(e,t){const n=di(e);return Math.round(t*n)/n}function cr(e){const t=H.useRef(e);return fn(()=>{t.current=e}),t}function ec(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:u}={},transform:a=!0,whileElementsMounted:i,open:l}=e,[c,p]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,f]=H.useState(r);dn(m,r)||f(r);const[b,y]=H.useState(null),[N,I]=H.useState(null),w=H.useCallback(E=>{E!==B.current&&(B.current=E,y(E))},[]),T=H.useCallback(E=>{E!==W.current&&(W.current=E,I(E))},[]),j=s||b,_=u||N,B=H.useRef(null),W=H.useRef(null),h=H.useRef(c),v=i!=null,g=cr(i),x=cr(o),C=cr(l),A=H.useCallback(()=>{if(!B.current||!W.current)return;const E={placement:t,strategy:n,middleware:m};x.current&&(E.platform=x.current),Xu(B.current,W.current,E).then(D=>{const F={...D,isPositioned:C.current!==!1};P.current&&!dn(h.current,F)&&(h.current=F,Gt.flushSync(()=>{p(F)}))})},[m,t,n,x,C]);fn(()=>{l===!1&&h.current.isPositioned&&(h.current.isPositioned=!1,p(E=>({...E,isPositioned:!1})))},[l]);const P=H.useRef(!1);fn(()=>(P.current=!0,()=>{P.current=!1}),[]),fn(()=>{if(j&&(B.current=j),_&&(W.current=_),j&&_){if(g.current)return g.current(j,_,A);A()}},[j,_,A,g,v]);const S=H.useMemo(()=>({reference:B,floating:W,setReference:w,setFloating:T}),[w,T]),$=H.useMemo(()=>({reference:j,floating:_}),[j,_]),L=H.useMemo(()=>{const E={position:n,left:0,top:0};if(!$.floating)return E;const D=pi($.floating,c.x),F=pi($.floating,c.y);return a?{...E,transform:"translate("+D+"px, "+F+"px)",...di($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:D,top:F}},[n,a,$.floating,c.x,c.y]);return H.useMemo(()=>({...c,update:A,refs:S,elements:$,floatingStyles:L}),[c,A,S,$,L])}const hi=(e,t)=>({...Yu(e),options:[e,t]}),tc=(e,t)=>({...Ku(e),options:[e,t]}),nc=(e,t)=>({...qu(e),options:[e,t]}),rc=(e,t)=>({...Qu(e),options:[e,t]}),mi={...H},oc=mi.useInsertionEffect||(e=>e());function gi(e){const t=H.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return oc(()=>{t.current=e}),H.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}var fr=typeof document<"u"?d.useLayoutEffect:d.useEffect;let vi=!1,ic=0;const bi=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+ic++;function sc(){const[e,t]=H.useState(()=>vi?bi():void 0);return fr(()=>{e==null&&t(bi())},[]),H.useEffect(()=>{vi=!0},[]),e}const lc=mi.useId||sc;let Vt;process.env.NODE_ENV!=="production"&&(Vt=new Set);function ac(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vt)!=null&&e.has(o))){var s;(s=Vt)==null||s.add(o),console.warn(o)}}function uc(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=Vt)!=null&&e.has(o))){var s;(s=Vt)==null||s.add(o),console.error(o)}}function cc(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.set(t,[...e.get(t)||[],n])},off(t,n){var r;e.set(t,((r=e.get(t))==null?void 0:r.filter(o=>o!==n))||[])}}}const fc=H.createContext(null),dc=H.createContext(null),pc=()=>{var e;return((e=H.useContext(fc))==null?void 0:e.id)||null},hc=()=>H.useContext(dc),mc="data-floating-ui-focusable";function gc(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=lc(),s=H.useRef({}),[u]=H.useState(()=>cc()),a=pc()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!be(f)&&uc("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[i,l]=H.useState(r.reference),c=gi((f,b,y)=>{s.current.openEvent=f?b:void 0,u.emit("openchange",{open:f,event:b,reason:y,nested:a}),n==null||n(f,b,y)}),p=H.useMemo(()=>({setPositionReference:l}),[]),m=H.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return H.useMemo(()=>({dataRef:s,open:t,onOpenChange:c,elements:m,events:u,floatingId:o,refs:p}),[t,c,m,u,o,p])}function vc(e){e===void 0&&(e={});const{nodeId:t}=e,n=gc({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,u]=H.useState(null),[a,i]=H.useState(null),c=(o==null?void 0:o.domReference)||s,p=H.useRef(null),m=hc();fr(()=>{c&&(p.current=c)},[c]);const f=ec({...e,elements:{...o,...a&&{reference:a}}}),b=H.useCallback(T=>{const j=be(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),contextElement:T}:T;i(j),f.refs.setReference(j)},[f.refs]),y=H.useCallback(T=>{(be(T)||T===null)&&(p.current=T,u(T)),(be(f.refs.reference.current)||f.refs.reference.current===null||T!==null&&!be(T))&&f.refs.setReference(T)},[f.refs]),N=H.useMemo(()=>({...f.refs,setReference:y,setPositionReference:b,domReference:p}),[f.refs,y,b]),I=H.useMemo(()=>({...f.elements,domReference:c}),[f.elements,c]),w=H.useMemo(()=>({...f,...r,refs:N,elements:I,nodeId:t}),[f,N,I,t,r]);return fr(()=>{r.dataRef.current.floatingContext=w;const T=m==null?void 0:m.nodesRef.current.find(j=>j.id===t);T&&(T.context=w)}),H.useMemo(()=>({...f,context:w,refs:N,elements:I}),[f,N,I,w])}const yi="active",xi="selected";function dr(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[yi]:u,[xi]:a,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[mc]:""},...s,...t.map(u=>{const a=u?u[n]:null;return typeof a=="function"?e?a(e):null:a}).concat(e).reduce((u,a)=>(a&&Object.entries(a).forEach(i=>{let[l,c]=i;if(!(o&&[yi,xi].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof c=="function"){var p;(p=r.get(l))==null||p.push(c),u[l]=function(){for(var m,f=arguments.length,b=new Array(f),y=0;y<f;y++)b[y]=arguments[y];return(m=r.get(l))==null?void 0:m.map(N=>N(...b)).find(N=>N!==void 0)}}}else u[l]=c}),u),{})}}function bc(e){e===void 0&&(e=[]);const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=H.useCallback(a=>dr(a,e,"reference"),t),s=H.useCallback(a=>dr(a,e,"floating"),n),u=H.useCallback(a=>dr(a,e,"item"),r);return H.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:u}),[o,s,u])}function wi(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const yc=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:u=0,minItemsVisible:a=4,referenceOverflowThreshold:i=0,scrollRef:l,...c}=Ot(e,t),{rects:p,elements:{floating:m}}=t,f=n.current[u],b=(l==null?void 0:l.current)||m,y=m.clientTop||b.clientTop,N=m.clientTop!==0,I=b.clientTop!==0,w=m===b;if(process.env.NODE_ENV!=="production"&&(t.placement.startsWith("bottom")||ac('`placement` side must be "bottom" when using the `inner`',"middleware.")),!f)return{};const T={...t,...await hi(-f.offsetTop-m.clientTop-p.reference.height/2-f.offsetHeight/2-s).fn(t)},j=await ur(wi(T,b.scrollHeight+y+m.clientTop),c),_=await ur(T,{...c,elementContext:"reference"}),B=ye(0,j.top),W=T.y+B,g=(b.scrollHeight>b.clientHeight?x=>x:Wt)(ye(0,b.scrollHeight+(N&&w||I?y*2:0)-B-ye(0,j.bottom)));if(b.style.maxHeight=g+"px",b.scrollTop=B,o){const x=b.offsetHeight<f.offsetHeight*mt(a,n.current.length)-1||_.top>=-i||_.bottom>=-i;Gt.flushSync(()=>o(x))}return r&&(r.current=await ur(wi({...T,y:W},b.offsetHeight+y+m.clientTop),c)),{y:W}}});function xc(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:u,onChange:a}=t,i=gi(a),l=H.useRef(!1),c=H.useRef(null),p=H.useRef(null);H.useEffect(()=>{if(!o)return;function f(y){if(y.ctrlKey||!b||s.current==null)return;const N=y.deltaY,I=s.current.top>=-.5,w=s.current.bottom>=-.5,T=b.scrollHeight-b.clientHeight,j=N<0?-1:1,_=N<0?"max":"min";b.scrollHeight<=b.clientHeight||(!I&&N>0||!w&&N<0?(y.preventDefault(),Gt.flushSync(()=>{i(B=>B+Math[_](N,T*j))})):/firefox/i.test(fu())&&(b.scrollTop+=N))}const b=(u==null?void 0:u.current)||r.floating;if(n&&b)return b.addEventListener("wheel",f),requestAnimationFrame(()=>{c.current=b.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{c.current=null,p.current=null,b.removeEventListener("wheel",f)}},[o,n,r.floating,s,u,i]);const m=H.useMemo(()=>({onKeyDown(){l.current=!0},onWheel(){l.current=!1},onPointerMove(){l.current=!1},onScroll(){const f=(u==null?void 0:u.current)||r.floating;if(!(!s.current||!f||!l.current)){if(c.current!==null){const b=f.scrollTop-c.current;(s.current.bottom<-.5&&b<-1||s.current.top<-.5&&b>1)&&Gt.flushSync(()=>i(y=>y+b))}requestAnimationFrame(()=>{c.current=f.scrollTop})}}}),[r.floating,i,s,u]);return H.useMemo(()=>o?{floating:m}:{},[o,m])}let Nt=d.createContext({styles:void 0,setReference:()=>{},setFloating:()=>{},getReferenceProps:()=>({}),getFloatingProps:()=>({}),slot:{}});Nt.displayName="FloatingContext";let pr=d.createContext(null);pr.displayName="PlacementContext";function wc(e){return d.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Ec(){return d.useContext(Nt).setReference}function Cc(){return d.useContext(Nt).getReferenceProps}function Sc(){let{getFloatingProps:e,slot:t}=d.useContext(Nt);return d.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Oc(e=null){e===!1&&(e=null),typeof e=="string"&&(e={to:e});let t=d.useContext(pr),n=d.useMemo(()=>e,[JSON.stringify(e,(o,s)=>{var u;return(u=s==null?void 0:s.outerHTML)!=null?u:s})]);le(()=>{t==null||t(n??null)},[t,n]);let r=d.useContext(Nt);return d.useMemo(()=>[r.setFloating,e?r.styles:{}],[r.setFloating,e,r.styles])}let Ei=4;function Ac({children:e,enabled:t=!0}){let[n,r]=d.useState(null),[o,s]=d.useState(0),u=d.useRef(null),[a,i]=d.useState(null);Nc(a);let l=t&&n!==null&&a!==null,{to:c="bottom",gap:p=0,offset:m=0,padding:f=0,inner:b}=$c(n,a),[y,N="center"]=c.split(" ");le(()=>{l&&s(0)},[l]);let{refs:I,floatingStyles:w,context:T}=vc({open:l,placement:y==="selection"?N==="center"?"bottom":`bottom-${N}`:N==="center"?`${y}`:`${y}-${N}`,strategy:"absolute",transform:!1,middleware:[hi({mainAxis:y==="selection"?0:p,crossAxis:m}),tc({padding:f}),y!=="selection"&&nc({padding:f}),y==="selection"&&b?yc({...b,padding:f,overflowRef:u,offset:o,minItemsVisible:Ei,referenceOverflowThreshold:f,onFallbackChange(x){var C,A;if(!x)return;let P=T.elements.floating;if(!P)return;let S=parseFloat(getComputedStyle(P).scrollPaddingBottom)||0,$=Math.min(Ei,P.childElementCount),L=0,E=0;for(let D of(A=(C=T.elements.floating)==null?void 0:C.childNodes)!=null?A:[])if(Ze(D)){let F=D.offsetTop,R=F+D.clientHeight+S,U=P.scrollTop,G=U+P.clientHeight;if(F>=U&&R<=G)$--;else{E=Math.max(0,Math.min(R,G)-Math.max(F,U)),L=D.clientHeight;break}}$>=1&&s(D=>{let F=L*$-E+S;return D>=F?D:F})}}):null,rc({padding:f,apply({availableWidth:x,availableHeight:C,elements:A}){Object.assign(A.floating.style,{overflow:"auto",maxWidth:`${x}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${C}px)`})}})].filter(Boolean),whileElementsMounted:Gu}),[j=y,_=N]=T.placement.split("-");y==="selection"&&(j="selection");let B=d.useMemo(()=>({anchor:[j,_].filter(Boolean).join(" ")}),[j,_]),W=xc(T,{overflowRef:u,onChange:s}),{getReferenceProps:h,getFloatingProps:v}=bc([W]),g=Z(x=>{i(x),I.setFloating(x)});return H.createElement(pr.Provider,{value:r},H.createElement(Nt.Provider,{value:{setFloating:g,setReference:I.setReference,styles:w,getReferenceProps:h,getFloatingProps:v,slot:B}},e))}function Nc(e){le(()=>{if(!e)return;let t=new MutationObserver(()=>{let n=window.getComputedStyle(e).maxHeight,r=parseFloat(n);if(isNaN(r))return;let o=parseInt(n);isNaN(o)||r!==o&&(e.style.maxHeight=`${Math.ceil(r)}px`)});return t.observe(e,{attributes:!0,attributeFilter:["style"]}),()=>{t.disconnect()}},[e])}function $c(e,t){var n,r,o;let s=hr((n=e==null?void 0:e.gap)!=null?n:"var(--anchor-gap, 0)",t),u=hr((r=e==null?void 0:e.offset)!=null?r:"var(--anchor-offset, 0)",t),a=hr((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:u,padding:a}}function hr(e,t,n=void 0){let r=xt(),o=Z((i,l)=>{if(i==null)return[n,null];if(typeof i=="number")return[i,null];if(typeof i=="string"){if(!l)return[n,null];let c=Si(i,l);return[c,p=>{let m=Ci(i);{let f=m.map(b=>window.getComputedStyle(l).getPropertyValue(b));r.requestAnimationFrame(function b(){r.nextFrame(b);let y=!1;for(let[I,w]of m.entries()){let T=window.getComputedStyle(l).getPropertyValue(w);if(f[I]!==T){f[I]=T,y=!0;break}}if(!y)return;let N=Si(i,l);c!==N&&(p(N),c=N)})}return r.dispose}]}return[n,null]}),s=d.useMemo(()=>o(e,t)[0],[e,t]),[u=s,a]=d.useState();return le(()=>{let[i,l]=o(e,t);if(a(i),!!l)return l(a)},[e,t]),u}function Ci(e){let t=/var\((.*)\)/.exec(e);if(t){let n=t[1].indexOf(",");if(n===-1)return[t[1]];let r=t[1].slice(0,n).trim(),o=t[1].slice(n+1).trim();return o?[r,...Ci(o)]:[r]}return[]}function Si(e,t){let n=document.createElement("div");t.appendChild(n),n.style.setProperty("margin-top","0px","important"),n.style.setProperty("margin-top",e,"important");let r=parseFloat(window.getComputedStyle(n).marginTop)||0;return t.removeChild(n),r}function Tc(e,t){let[n,r]=d.useState(t);return!e&&n!==t&&r(t),e?n:t}let mr=d.createContext(null);mr.displayName="OpenClosedContext";var We=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(We||{});function gr(){return d.useContext(mr)}function Oi({value:e,children:t}){return d.createElement(mr.Provider,{value:e},t)}function Pc(e){throw new Error("Unexpected object: "+e)}var ae=(e=>(e[e.First=0]="First",e[e.Previous=1]="Previous",e[e.Next=2]="Next",e[e.Last=3]="Last",e[e.Specific=4]="Specific",e[e.Nothing=5]="Nothing",e))(ae||{});function pn(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{o===-1&&(o=n.length);for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:Pc(e)}}var Ai=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Ai||{});function Ni(e){let t=Z(e),n=d.useRef(!1);d.useEffect(()=>(n.current=!1,()=>{n.current=!0,so(()=>{n.current&&t()})}),[t])}function Mc(){let e=typeof document>"u";return"useSyncExternalStore"in H?(t=>t.useSyncExternalStore)(H)(()=>()=>{},()=>!1,()=>!e):!1}function vr(){let e=Mc(),[t,n]=H.useState(ze.isHandoffComplete);return t&&ze.isHandoffComplete===!1&&n(!1),H.useEffect(()=>{t!==!0&&n(!0)},[t]),H.useEffect(()=>ze.handoff(),[]),e?!1:t}let Lc=d.createContext(!1);function Ic(){return d.useContext(Lc)}function Dc(e){let t=Ic(),n=d.useContext(Ti),[r,o]=d.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(ze.isServer)return null;let u=e==null?void 0:e.getElementById("headlessui-portal-root");if(u)return u;if(e===null)return null;let a=e.createElement("div");return a.setAttribute("id","headlessui-portal-root"),e.body.appendChild(a)});return d.useEffect(()=>{r!==null&&(e!=null&&e.body.contains(r)||e==null||e.body.appendChild(r))},[r,e]),d.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let $i=d.Fragment,Fc=Ee(function(e,t){let{ownerDocument:n=null,...r}=e,o=d.useRef(null),s=Pe(Zl(f=>{o.current=f}),t),u=nr(o),a=n??u,i=Dc(a),[l]=d.useState(()=>{var f;return ze.isServer?null:(f=a==null?void 0:a.createElement("div"))!=null?f:null}),c=d.useContext(Rc),p=vr();le(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),le(()=>{if(l&&c)return c.register(l)},[c,l]),Ni(()=>{var f;!i||!l||(Vn(l)&&i.contains(l)&&i.removeChild(l),i.childNodes.length<=0&&((f=i.parentElement)==null||f.removeChild(i)))});let m=Ae();return p?!i||!l?null:xe.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:$i,name:"Portal"}),l):null});function _c(e,t){let n=Pe(t),{enabled:r=!0,ownerDocument:o,...s}=e,u=Ae();return r?d.createElement(Fc,{...s,ownerDocument:o,ref:n}):u({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:$i,name:"Portal"})}let jc=d.Fragment,Ti=d.createContext(null);function kc(e,t){let{target:n,...r}=e,o={ref:Pe(t)},s=Ae();return d.createElement(Ti.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:jc,name:"Popover.Group"}))}let Rc=d.createContext(null),Bc=Ee(_c),Wc=Ee(kc),Uc=Object.assign(Bc,{Group:Wc});function Vc(){let e=d.useRef(!1);return le(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function Pi(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:Li)!==d.Fragment||d.Children.count(e.children)===1}let hn=d.createContext(null);hn.displayName="TransitionContext";var zc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(zc||{});function Hc(){let e=d.useContext(hn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function Gc(){let e=d.useContext(mn);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let mn=d.createContext(null);mn.displayName="NestingContext";function gn(e){return"children"in e?gn(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Mi(e,t){let n=pt(e),r=d.useRef([]),o=Vc(),s=xt(),u=Z((f,b=ot.Hidden)=>{let y=r.current.findIndex(({el:N})=>N===f);y!==-1&&(Te(b,{[ot.Unmount](){r.current.splice(y,1)},[ot.Hidden](){r.current[y].state="hidden"}}),s.microTask(()=>{var N;!gn(r)&&o.current&&((N=n.current)==null||N.call(n))}))}),a=Z(f=>{let b=r.current.find(({el:y})=>y===f);return b?b.state!=="visible"&&(b.state="visible"):r.current.push({el:f,state:"visible"}),()=>u(f,ot.Unmount)}),i=d.useRef([]),l=d.useRef(Promise.resolve()),c=d.useRef({enter:[],leave:[]}),p=Z((f,b,y)=>{i.current.splice(0),t&&(t.chains.current[b]=t.chains.current[b].filter(([N])=>N!==f)),t==null||t.chains.current[b].push([f,new Promise(N=>{i.current.push(N)})]),t==null||t.chains.current[b].push([f,new Promise(N=>{Promise.all(c.current[b].map(([I,w])=>w)).then(()=>N())})]),b==="enter"?l.current=l.current.then(()=>t==null?void 0:t.wait.current).then(()=>y(b)):y(b)}),m=Z((f,b,y)=>{Promise.all(c.current[b].splice(0).map(([N,I])=>I)).then(()=>{var N;(N=i.current.shift())==null||N()}).then(()=>y(b))});return d.useMemo(()=>({children:r,register:a,unregister:u,onStart:p,onStop:m,wait:l,chains:c}),[a,u,r,p,m,c,l])}let Li=d.Fragment,Ii=Xt.RenderStrategy;function Yc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:u,beforeLeave:a,afterLeave:i,enter:l,enterFrom:c,enterTo:p,entered:m,leave:f,leaveFrom:b,leaveTo:y,...N}=e,[I,w]=d.useState(null),T=d.useRef(null),j=Pi(e),_=Pe(...j?[T,t,w]:t===null?[]:[t]),B=(n=N.unmount)==null||n?ot.Unmount:ot.Hidden,{show:W,appear:h,initial:v}=Hc(),[g,x]=d.useState(W?"visible":"hidden"),C=Gc(),{register:A,unregister:P}=C;le(()=>A(T),[A,T]),le(()=>{if(B===ot.Hidden&&T.current){if(W&&g!=="visible"){x("visible");return}return Te(g,{hidden:()=>P(T),visible:()=>A(T)})}},[g,T,A,P,W,B]);let S=vr();le(()=>{if(j&&S&&g==="visible"&&T.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[T,g,S,j]);let $=v&&!h,L=h&&W&&v,E=d.useRef(!1),D=Mi(()=>{E.current||(x("hidden"),P(T))},C),F=Z(z=>{E.current=!0;let re=z?"enter":"leave";D.onStart(T,re,de=>{de==="enter"?s==null||s():de==="leave"&&(a==null||a())})}),R=Z(z=>{let re=z?"enter":"leave";E.current=!1,D.onStop(T,re,de=>{de==="enter"?u==null||u():de==="leave"&&(i==null||i())}),re==="leave"&&!gn(D)&&(x("hidden"),P(T))});d.useEffect(()=>{j&&o||(F(W),R(W))},[W,j,o]);let U=!(!o||!j||!S||$),[,G]=Go(U,I,W,{start:F,end:R}),ee=it({ref:_,className:((r=Bn(N.className,L&&l,L&&c,G.enter&&l,G.enter&&G.closed&&c,G.enter&&!G.closed&&p,G.leave&&f,G.leave&&!G.closed&&b,G.leave&&G.closed&&y,!G.transition&&W&&m))==null?void 0:r.trim())||void 0,...Ho(G)}),q=0;g==="visible"&&(q|=We.Open),g==="hidden"&&(q|=We.Closed),W&&g==="hidden"&&(q|=We.Opening),!W&&g==="visible"&&(q|=We.Closing);let X=Ae();return d.createElement(mn.Provider,{value:D},d.createElement(Oi,{value:q},X({ourProps:ee,theirProps:N,defaultTag:Li,features:Ii,visible:g==="visible",name:"Transition.Child"})))}function Kc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,u=d.useRef(null),a=Pi(e),i=Pe(...a?[u,t]:t===null?[]:[t]);vr();let l=gr();if(n===void 0&&l!==null&&(n=(l&We.Open)===We.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[c,p]=d.useState(n?"visible":"hidden"),m=Mi(()=>{n||p("hidden")}),[f,b]=d.useState(!0),y=d.useRef([n]);le(()=>{f!==!1&&y.current[y.current.length-1]!==n&&(y.current.push(n),b(!1))},[y,n]);let N=d.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);le(()=>{n?p("visible"):!gn(m)&&u.current!==null&&p("hidden")},[n,m]);let I={unmount:o},w=Z(()=>{var _;f&&b(!1),(_=e.beforeEnter)==null||_.call(e)}),T=Z(()=>{var _;f&&b(!1),(_=e.beforeLeave)==null||_.call(e)}),j=Ae();return d.createElement(mn.Provider,{value:m},d.createElement(hn.Provider,{value:N},j({ourProps:{...I,as:d.Fragment,children:d.createElement(Di,{ref:i,...I,...s,beforeEnter:w,beforeLeave:T})},theirProps:{},defaultTag:d.Fragment,features:Ii,visible:c==="visible",name:"Transition"})))}function qc(e,t){let n=d.useContext(hn)!==null,r=gr()!==null;return d.createElement(d.Fragment,null,!n&&r?d.createElement(br,{ref:t,...e}):d.createElement(Di,{ref:t,...e}))}let br=Ee(Kc),Di=Ee(Yc),Qc=Ee(qc),Fi=Object.assign(br,{Child:Qc,Root:br});function Xc(e,t){let n=d.useRef({left:0,top:0});if(le(()=>{if(!t)return;let o=t.getBoundingClientRect();o&&(n.current=o)},[e,t]),t==null||!e||t===document.activeElement)return!1;let r=t.getBoundingClientRect();return r.top!==n.current.top||r.left!==n.current.left}let _i=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ji(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!Ze(o))return r;let s=!1;for(let a of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),s=!0;let u=s?(n=o.innerText)!=null?n:"":r;return _i.test(u)&&(u=u.replace(_i,"")),u}function Jc(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let u=s.getAttribute("aria-label");return typeof u=="string"?u.trim():ji(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ji(e).trim()}function Zc(e){let t=d.useRef(""),n=d.useRef("");return Z(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=Jc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var ef=Object.defineProperty,tf=(e,t,n)=>t in e?ef(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ki=(e,t,n)=>(tf(e,typeof t!="symbol"?t+"":t,n),n),me=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(me||{}),qe=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(qe||{}),vn=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(vn||{}),Ri=(e=>(e[e.OpenListbox=0]="OpenListbox",e[e.CloseListbox=1]="CloseListbox",e[e.GoToOption=2]="GoToOption",e[e.Search=3]="Search",e[e.ClearSearch=4]="ClearSearch",e[e.RegisterOptions=5]="RegisterOptions",e[e.UnregisterOptions=6]="UnregisterOptions",e[e.SetButtonElement=7]="SetButtonElement",e[e.SetOptionsElement=8]="SetOptionsElement",e[e.SortOptions=9]="SortOptions",e))(Ri||{});function Bi(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=jo(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let nf={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,pendingFocus:{focus:ae.Nothing},listboxState:1,__demoMode:!1}},0(e,t){if(e.dataRef.current.disabled||e.listboxState===0)return e;let n=e.activeOptionIndex,{isSelected:r}=e.dataRef.current,o=e.options.findIndex(s=>r(s.dataRef.current.value));return o!==-1&&(n=o),{...e,pendingFocus:t.focus,listboxState:0,activeOptionIndex:n,__demoMode:!1}},2(e,t){var n,r,o,s,u;if(e.dataRef.current.disabled||e.listboxState===1)return e;let a={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===ae.Nothing)return{...a,activeOptionIndex:null};if(t.focus===ae.Specific)return{...a,activeOptionIndex:e.options.findIndex(c=>c.id===t.id)};if(t.focus===ae.Previous){let c=e.activeOptionIndex;if(c!==null){let p=e.options[c].dataRef.current.domRef,m=pn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((r=p.current)==null?void 0:r.previousElementSibling)===f.current||((o=f.current)==null?void 0:o.previousElementSibling)===null)return{...a,activeOptionIndex:m}}}}else if(t.focus===ae.Next){let c=e.activeOptionIndex;if(c!==null){let p=e.options[c].dataRef.current.domRef,m=pn(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:f=>f.id,resolveDisabled:f=>f.dataRef.current.disabled});if(m!==null){let f=e.options[m].dataRef.current.domRef;if(((s=p.current)==null?void 0:s.nextElementSibling)===f.current||((u=f.current)==null?void 0:u.nextElementSibling)===null)return{...a,activeOptionIndex:m}}}}let i=Bi(e),l=pn(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:c=>c.id,resolveDisabled:c=>c.dataRef.current.disabled});return{...a,...i,activeOptionIndex:l}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(u=>{var a;return!u.dataRef.current.disabled&&((a=u.dataRef.current.textValue)==null?void 0:a.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n=e.options.concat(t.options),r=e.activeOptionIndex;if(e.pendingFocus.focus!==ae.Nothing&&(r=pn(e.pendingFocus,{resolveItems:()=>n,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled})),e.activeOptionIndex===null){let{isSelected:o}=e.dataRef.current;if(o){let s=n.findIndex(u=>o==null?void 0:o(u.dataRef.current.value));s!==-1&&(r=s)}}return{...e,options:n,activeOptionIndex:r,pendingFocus:{focus:ae.Nothing},pendingShouldSort:!0}},6:(e,t)=>{let n=e.options,r=[],o=new Set(t.options);for(let[s,u]of n.entries())if(o.has(u.id)&&(r.push(s),o.delete(u.id),o.size===0))break;if(r.length>0){n=n.slice();for(let s of r.reverse())n.splice(s,1)}return{...e,options:n,activationTrigger:1}},7:(e,t)=>e.buttonElement===t.element?e:{...e,buttonElement:t.element},8:(e,t)=>e.optionsElement===t.element?e:{...e,optionsElement:t.element},9:e=>e.pendingShouldSort?{...e,...Bi(e),pendingShouldSort:!1}:e};class yr extends Oo{constructor(t){super(t),ki(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:u}=this.state.dataRef.current;return Te(s,{0:()=>r==null?void 0:r(n),1:()=>{let a=u.slice(),i=a.findIndex(l=>o(l,n));return i===-1?a.push(n):a.splice(i,1),r==null?void 0:r(a)}})},registerOption:Yn(()=>{let n=[],r=new Set;return[(o,s)=>{r.has(s)||(r.add(s),n.push({id:o,dataRef:s}))},()=>(r.clear(),this.send({type:5,options:n.splice(0)}))]}),unregisterOption:Yn(()=>{let n=[];return[r=>n.push(r),()=>{this.send({type:6,options:n.splice(0)})}]}),goToOption:Yn(()=>{let n=null;return[(r,o)=>{n={type:2,...r,trigger:o}},()=>n&&this.send(n)]}),closeListbox:()=>{this.send({type:1})},openListbox:n=>{this.send({type:0,focus:n})},selectActiveOption:()=>{if(this.state.activeOptionIndex!==null){let{dataRef:n,id:r}=this.state.options[this.state.activeOptionIndex];this.actions.onChange(n.current.value),this.send({type:2,focus:ae.Specific,id:r})}},selectOption:n=>{let r=this.state.options.find(o=>o.id===n);r&&this.actions.onChange(r.dataRef.current.value)},search:n=>{this.send({type:3,value:n})},clearSearch:()=>{this.send({type:4})},setButtonElement:n=>{this.send({type:7,element:n})},setOptionsElement:n=>{this.send({type:8,element:n})}}),ki(this,"selectors",{activeDescendantId(n){var r;let o=n.activeOptionIndex,s=n.options;return o===null||(r=s[o])==null?void 0:r.id},isActive(n,r){var o;let s=n.activeOptionIndex,u=n.options;return s!==null?((o=u[s])==null?void 0:o.id)===r:!1},shouldScrollIntoView(n,r){return n.__demoMode||n.listboxState!==0||n.activationTrigger===0?!1:this.isActive(n,r)}}),this.on(5,()=>{requestAnimationFrame(()=>{this.send({type:9})})});{let n=this.state.id,r=Kn.get(null);this.disposables.add(r.on(To.Push,o=>{!r.selectors.isTop(o,n)&&this.state.listboxState===0&&this.actions.closeListbox()})),this.on(0,()=>r.actions.push(n)),this.on(1,()=>r.actions.pop(n))}}static new({id:t,__demoMode:n=!1}){return new yr({id:t,dataRef:{current:{}},listboxState:n?0:1,options:[],searchQuery:"",activeOptionIndex:null,activationTrigger:1,buttonElement:null,optionsElement:null,pendingShouldSort:!1,pendingFocus:{focus:ae.Nothing},__demoMode:n})}reduce(t,n){return Te(n.type,nf,t,n)}}const Wi=d.createContext(null);function xr(e){let t=d.useContext(Wi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ui),n}return t}function Ui({id:e,__demoMode:t=!1}){let n=d.useMemo(()=>yr.new({id:e,__demoMode:t}),[]);return Ni(()=>n.dispose()),n}let bn=d.createContext(null);bn.displayName="ListboxDataContext";function zt(e){let t=d.useContext(bn);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zt),n}return t}let rf=d.Fragment;function of(e,t){let n=d.useId(),r=Rn(),{value:o,defaultValue:s,form:u,name:a,onChange:i,by:l,invalid:c=!1,disabled:p=r||!1,horizontal:m=!1,multiple:f=!1,__demoMode:b=!1,...y}=e;const N=m?"horizontal":"vertical";let I=Pe(t),w=kl(s),[T=f?[]:void 0,j]=jl(o,i,w),_=Ui({id:n,__demoMode:b}),B=d.useRef({static:!1,hold:!1}),W=d.useRef(new Map),h=ca(l),v=d.useCallback(U=>Te(g.mode,{[qe.Multi]:()=>T.some(G=>h(G,U)),[qe.Single]:()=>h(T,U)}),[T]),g=d.useMemo(()=>({value:T,disabled:p,invalid:c,mode:f?qe.Multi:qe.Single,orientation:N,onChange:j,compare:h,isSelected:v,optionsPropsRef:B,listRef:W}),[T,p,c,f,N,j,h,v,B,W]);le(()=>{_.state.dataRef.current=g},[g]);let x=Le(_,U=>U.listboxState),C=Kn.get(null),A=Le(C,d.useCallback(U=>C.selectors.isTop(U,n),[C,n])),[P,S]=Le(_,U=>[U.buttonElement,U.optionsElement]);ja(A,[P,S],(U,G)=>{_.send({type:Ri.CloseListbox}),_o(G,tr.Loose)||(U.preventDefault(),P==null||P.focus())});let $=d.useMemo(()=>({open:x===me.Open,disabled:p,invalid:c,value:T}),[x,p,c,T]),[L,E]=oa({inherit:!0}),D={ref:I},F=d.useCallback(()=>{if(w!==void 0)return j==null?void 0:j(w)},[j,w]),R=Ae();return d.createElement(E,{value:L,props:{htmlFor:P==null?void 0:P.id},slot:{open:x===me.Open,disabled:p}},d.createElement(Ac,null,d.createElement(Wi.Provider,{value:_},d.createElement(bn.Provider,{value:g},d.createElement(Oi,{value:Te(x,{[me.Open]:We.Open,[me.Closed]:We.Closed})},a!=null&&T!=null&&d.createElement(zl,{disabled:p,data:{[a]:T},form:u,onReset:F}),R({ourProps:D,theirProps:y,slot:$,defaultTag:rf,name:"Listbox"}))))))}let sf="button";function lf(e,t){let n=d.useId(),r=ho(),o=zt("Listbox.Button"),s=xr("Listbox.Button"),{id:u=r||`headlessui-listbox-button-${n}`,disabled:a=o.disabled||!1,autoFocus:i=!1,...l}=e,c=Pe(t,Ec(),s.actions.setButtonElement),p=Cc(),[m,f,b]=Le(s,E=>[E.listboxState,E.buttonElement,E.optionsElement]),y=m===me.Open;Ba(y,{trigger:f,action:d.useCallback(E=>{if(f!=null&&f.contains(E.target))return tn.Ignore;let D=E.target.closest('[role="option"]:not([data-disabled])');return Ze(D)?tn.Select(D):b!=null&&b.contains(E.target)?tn.Ignore:tn.Close},[f,b]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let N=Z(E=>{switch(E.key){case he.Enter:Rl(E.currentTarget);break;case he.Space:case he.ArrowDown:E.preventDefault(),s.actions.openListbox({focus:o.value?ae.Nothing:ae.First});break;case he.ArrowUp:E.preventDefault(),s.actions.openListbox({focus:o.value?ae.Nothing:ae.Last});break}}),I=Z(E=>{switch(E.key){case he.Space:E.preventDefault();break}}),w=Z(E=>{var D;if(E.button===Ai.Left){if(Xl(E.currentTarget))return E.preventDefault();s.state.listboxState===me.Open?(xe.flushSync(()=>s.actions.closeListbox()),(D=s.state.buttonElement)==null||D.focus({preventScroll:!0})):(E.preventDefault(),s.actions.openListbox({focus:ae.Nothing}))}}),T=d.useRef(null),j=Z(E=>{T.current=E.pointerType,E.pointerType==="mouse"&&w(E)}),_=Z(E=>{T.current!=="mouse"&&w(E)}),B=Z(E=>E.preventDefault()),W=wo([u]),h=ea(),{isFocusVisible:v,focusProps:g}=Ol({autoFocus:i}),{isHovered:x,hoverProps:C}=Sl({isDisabled:a}),{pressed:A,pressProps:P}=Ml({disabled:a}),S=d.useMemo(()=>({open:m===me.Open,active:A||m===me.Open,disabled:a,invalid:o.invalid,value:o.value,hover:x,focus:v,autofocus:i}),[m,o.value,a,x,v,A,o.invalid,i]),$=Le(s,E=>E.listboxState===me.Open),L=ao(p(),{ref:c,id:u,type:Wa(e,f),"aria-haspopup":"listbox","aria-controls":b==null?void 0:b.id,"aria-expanded":$,"aria-labelledby":W,"aria-describedby":h,disabled:a||void 0,autoFocus:i,onKeyDown:N,onKeyUp:I,onKeyPress:B,onPointerDown:j,onClick:_},g,C,P);return Ae()({ourProps:L,theirProps:l,slot:S,defaultTag:sf,name:"Listbox.Button"})}let Vi=d.createContext(!1),af="div",uf=Xt.RenderStrategy|Xt.Static;function cf(e,t){let n=d.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:u=!0,transition:a=!1,...i}=e,l=wc(o),[c,p]=d.useState(null);l&&(s=!0);let m=zt("Listbox.Options"),f=xr("Listbox.Options"),[b,y,N,I]=Le(f,z=>[z.listboxState,z.buttonElement,z.optionsElement,z.__demoMode]),w=nr(y),T=nr(N),j=gr(),[_,B]=Go(a,c,j!==null?(j&We.Open)===We.Open:b===me.Open);Oa(_,y,f.actions.closeListbox);let W=I?!1:u&&b===me.Open;qa(W,T);let h=I?!1:u&&b===me.Open;Sa(h,{allowed:d.useCallback(()=>[y,N],[y,N])});let v=b!==me.Open,g=Xc(v,y)?!1:_,x=_&&b===me.Closed,C=Tc(x,m.value),A=Z(z=>m.compare(C,z)),P=Le(f,z=>{var re;if(l==null||!((re=l==null?void 0:l.to)!=null&&re.includes("selection")))return null;let de=z.options.findIndex(_e=>A(_e.dataRef.current.value));return de===-1&&(de=0),de}),S=(()=>{if(l==null)return;if(P===null)return{...l,inner:void 0};let z=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:z},index:P}}})(),[$,L]=Oc(S),E=Sc(),D=Pe(t,l?$:null,f.actions.setOptionsElement,p),F=xt();d.useEffect(()=>{var z;let re=N;re&&b===me.Open&&re!==((z=Ft(re))==null?void 0:z.activeElement)&&(re==null||re.focus({preventScroll:!0}))},[b,N]);let R=Z(z=>{var re,de;switch(F.dispose(),z.key){case he.Space:if(f.state.searchQuery!=="")return z.preventDefault(),z.stopPropagation(),f.actions.search(z.key);case he.Enter:if(z.preventDefault(),z.stopPropagation(),f.state.activeOptionIndex!==null){let{dataRef:_e}=f.state.options[f.state.activeOptionIndex];f.actions.onChange(_e.current.value)}m.mode===qe.Single&&(xe.flushSync(()=>f.actions.closeListbox()),(re=f.state.buttonElement)==null||re.focus({preventScroll:!0}));break;case Te(m.orientation,{vertical:he.ArrowDown,horizontal:he.ArrowRight}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Next});case Te(m.orientation,{vertical:he.ArrowUp,horizontal:he.ArrowLeft}):return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Previous});case he.Home:case he.PageUp:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.First});case he.End:case he.PageDown:return z.preventDefault(),z.stopPropagation(),f.actions.goToOption({focus:ae.Last});case he.Escape:z.preventDefault(),z.stopPropagation(),xe.flushSync(()=>f.actions.closeListbox()),(de=f.state.buttonElement)==null||de.focus({preventScroll:!0});return;case he.Tab:z.preventDefault(),z.stopPropagation(),xe.flushSync(()=>f.actions.closeListbox()),Ia(f.state.buttonElement,z.shiftKey?er.Previous:er.Next);break;default:z.key.length===1&&(f.actions.search(z.key),F.setTimeout(()=>f.actions.clearSearch(),350));break}}),U=Le(f,z=>{var re;return(re=z.buttonElement)==null?void 0:re.id}),G=d.useMemo(()=>({open:b===me.Open}),[b]),ee=ao(l?E():{},{id:r,ref:D,"aria-activedescendant":Le(f,f.selectors.activeDescendantId),"aria-multiselectable":m.mode===qe.Multi?!0:void 0,"aria-labelledby":U,"aria-orientation":m.orientation,onKeyDown:R,role:"listbox",tabIndex:b===me.Open?0:void 0,style:{...i.style,...L,"--button-width":da(y,!0).width},...Ho(B)}),q=Ae(),X=d.useMemo(()=>m.mode===qe.Multi?m:{...m,isSelected:A},[m,A]);return d.createElement(Uc,{enabled:s?e.static||_:!1,ownerDocument:w},d.createElement(bn.Provider,{value:X},q({ourProps:ee,theirProps:i,slot:G,defaultTag:af,features:uf,visible:g,name:"Listbox.Options"})))}let ff="div";function df(e,t){let n=d.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...u}=e,a=d.useContext(Vi)===!0,i=zt("Listbox.Option"),l=xr("Listbox.Option"),c=Le(l,g=>l.selectors.isActive(g,r)),p=i.isSelected(s),m=d.useRef(null),f=Zc(m),b=pt({disabled:o,value:s,domRef:m,get textValue(){return f()}}),y=Pe(t,m,g=>{g?i.listRef.current.set(r,g):i.listRef.current.delete(r)}),N=Le(l,g=>l.selectors.shouldScrollIntoView(g,r));le(()=>{if(N)return Re().requestAnimationFrame(()=>{var g,x;(x=(g=m.current)==null?void 0:g.scrollIntoView)==null||x.call(g,{block:"nearest"})})},[N,m]),le(()=>{if(!a)return l.actions.registerOption(r,b),()=>l.actions.unregisterOption(r)},[b,r,a]);let I=Z(g=>{var x;if(o)return g.preventDefault();l.actions.onChange(s),i.mode===qe.Single&&(xe.flushSync(()=>l.actions.closeListbox()),(x=l.state.buttonElement)==null||x.focus({preventScroll:!0}))}),w=Z(()=>{if(o)return l.actions.goToOption({focus:ae.Nothing});l.actions.goToOption({focus:ae.Specific,id:r})}),T=Qa(),j=Z(g=>T.update(g)),_=Z(g=>{T.wasMoved(g)&&(o||c&&l.state.activationTrigger===vn.Pointer||l.actions.goToOption({focus:ae.Specific,id:r},vn.Pointer))}),B=Z(g=>{T.wasMoved(g)&&(o||c&&l.state.activationTrigger===vn.Pointer&&l.actions.goToOption({focus:ae.Nothing}))}),W=d.useMemo(()=>({active:c,focus:c,selected:p,disabled:o,selectedOption:p&&a}),[c,p,o,a]),h=a?{}:{id:r,ref:y,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:I,onFocus:w,onPointerEnter:j,onMouseEnter:j,onPointerMove:_,onMouseMove:_,onPointerLeave:B,onMouseLeave:B},v=Ae();return!p&&a?null:v({ourProps:h,theirProps:u,slot:W,defaultTag:ff,name:"Listbox.Option"})}let pf=d.Fragment;function hf(e,t){let{options:n,placeholder:r,...o}=e,s={ref:Pe(t)},u=zt("ListboxSelectedOption"),a=d.useMemo(()=>({}),[]),i=u.value===void 0||u.value===null||u.mode===qe.Multi&&Array.isArray(u.value)&&u.value.length===0,l=Ae();return d.createElement(Vi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:d.createElement(d.Fragment,null,r&&i?r:n)},slot:a,defaultTag:pf,name:"ListboxSelectedOption"}))}let mf=Ee(of),gf=Ee(lf),vf=aa,bf=Ee(cf),yf=Ee(df),xf=Ee(hf),at=Object.assign(mf,{Button:gf,Label:vf,Options:bf,Option:yf,SelectedOption:xf});function wf({title:e,titleId:t,...n},r){return H.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":t},n),e?H.createElement("title",{id:t},e):null,H.createElement("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z",clipRule:"evenodd"}))}const zi=H.forwardRef(wf),Ef=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o=""})=>M.jsx("div",{className:`relative ${o}`,children:M.jsx(at,{value:t,onChange:n,disabled:r,children:({open:s})=>M.jsxs(M.Fragment,{children:[M.jsxs(at.Button,{className:`
|
|
76
76
|
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
77
77
|
items-center justify-between flex px-3 rounded-lg
|
|
78
|
-
focus:outline-none
|
|
78
|
+
focus:outline-none
|
|
79
79
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
80
|
-
${
|
|
81
|
-
`,children:[
|
|
80
|
+
${s?"ring-1 ring-white":""}
|
|
81
|
+
`,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),M.jsxs("div",{className:"flex items-center",children:[t.iconUrl?M.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${s?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(Fi,{as:d.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(at.Options,{className:`
|
|
82
82
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
83
83
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
84
84
|
focus:outline-none
|
|
85
|
-
`,children:e.map(
|
|
86
|
-
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
85
|
+
`,children:e.map(u=>M.jsx(at.Option,{value:u,className:({active:a,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${i?"bg-fill-btn-secondary":a?"bg-fill-input-secondary":""}`,children:({selected:a,active:i})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[u.iconUrl?M.jsx("img",{src:u.iconUrl,alt:u.token,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:u.token.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${a||i?"text-text-primary":"text-text-tertiary"}`,children:u.symbol||u.token})})]}),a&&M.jsx(zi,{className:"w-4 h-4 text-blue-400"})]})},u.tokenAddress))})})]})})}),Cf=({chains:e,selectedChain:t,onChainChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>M.jsx("div",{className:`relative ${o}`,children:M.jsx(at,{value:t,onChange:n,disabled:r,children:({open:u})=>M.jsxs(M.Fragment,{children:[M.jsxs(at.Button,{className:`
|
|
86
|
+
relative w-full h-9 text-text-primary bg-fill-input-primary
|
|
87
87
|
items-center justify-between flex px-3 rounded-lg
|
|
88
|
-
focus:outline-none
|
|
88
|
+
focus:outline-none
|
|
89
89
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
90
|
-
${
|
|
91
|
-
`,children:[
|
|
90
|
+
${u?"ring-1 ring-white":""}
|
|
91
|
+
`,children:[M.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),M.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?M.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):M.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),M.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),M.jsxs("svg",{className:`w-3 h-3 ml-2 transition-transform duration-200 ${u?"rotate-180":""}`,xmlns:"http://www.w3.org/2000/svg",width:"10",height:"11",viewBox:"0 0 10 11",fill:"none",children:[M.jsx("g",{clipPath:"url(#clip0_12919_27745)",children:M.jsx("path",{d:"M5.32733 7.6716C5.13944 7.83432 4.86056 7.83432 4.67267 7.6716L1.68366 5.08304C1.33371 4.77997 1.54804 4.20508 2.01099 4.20508L7.98901 4.20508C8.45196 4.20508 8.66629 4.77998 8.31634 5.08304L5.32733 7.6716Z",fill:"#F9F9F9"})}),M.jsx("defs",{children:M.jsx("clipPath",{id:"clip0_12919_27745",children:M.jsx("rect",{width:"10",height:"10",fill:"white",transform:"translate(0 0.955078)"})})})]})]})]}),M.jsx(Fi,{as:d.Fragment,enter:"transition ease-out duration-100",enterFrom:"transform opacity-0 scale-95",enterTo:"transform opacity-100 scale-100",leave:"transition ease-in duration-75",leaveFrom:"transform opacity-100 scale-100",leaveTo:"transform opacity-0 scale-95",children:M.jsx(at.Options,{className:`
|
|
92
92
|
absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
|
|
93
93
|
bg-fill-input-primary border border-line-divider-secondary shadow-lg
|
|
94
94
|
focus:outline-none
|
|
95
|
-
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>y.jsx(Ye.Option,{value:a,className:({active:i,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":i?"bg-fill-input-secondary":""}`,children:({selected:i,active:l})=>y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?y.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):y.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:y.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),y.jsx("div",{className:"flex flex-col",children:y.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),i&&y.jsx(vi,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})}),er=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const c=f.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),a=d=>{if(n(d.chainId),d.tokenList&&d.tokenList.length>0&&!d.tokenList.some(g=>g.token===r||g.symbol===r)){const g=d.tokenList[0];o(g.symbol||g.token)}},i=d=>{o(d.symbol||d.token)},l=f.useMemo(()=>t.map(d=>d),[t]),u=f.useMemo(()=>l.find(d=>d.chainId===e.chainId)||l[0],[l,e.chainId]),p=f.useMemo(()=>c.map(d=>({token:d.token,symbol:d.symbol,iconUrl:d.iconUrl,decimals:d.decimals,tokenAddress:d.tokenAddress})),[c]),m=f.useMemo(()=>{if(p.length!==0)return p.find(d=>d.token===r||d.symbol===r)||p[0]},[p,r]);return y.jsxs("div",{className:"space-y-4",children:[y.jsx(Bc,{chains:l,selectedChain:u,onChainChange:d=>{const h=t.find(g=>g.chainId===d.chainId);h&&a(h)},walletType:s,className:"w-full"}),p.length>0?m&&y.jsx(Wc,{tokens:p,selectedToken:m,onTokenChange:i,walletType:s,className:"w-full"}):y.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:y.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})};var Vc=Object.defineProperty,nn=Object.getOwnPropertySymbols,xi=Object.prototype.hasOwnProperty,yi=Object.prototype.propertyIsEnumerable,wi=(e,t,n)=>t in e?Vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,tr=(e,t)=>{for(var n in t||(t={}))xi.call(t,n)&&wi(e,n,t[n]);if(nn)for(var n of nn(t))yi.call(t,n)&&wi(e,n,t[n]);return e},nr=(e,t)=>{var n={};for(var r in e)xi.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&nn)for(var r of nn(e))t.indexOf(r)<0&&yi.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
95
|
+
`,children:e.filter(a=>a[s==="mpc"?"allowAaDeposit":"allowDeposit"]!==!1).map(a=>M.jsx(at.Option,{value:a,className:({active:i,selected:l})=>`relative cursor-pointer select-none py-3 px-3 ${l?"bg-fill-btn-secondary":i?"bg-fill-input-secondary":""}`,children:({selected:i,active:l})=>M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsxs("div",{className:"flex items-center space-x-3",children:[a.chainIconUrl?M.jsx("img",{src:a.chainIconUrl,alt:a.chain,className:"w-5 h-5 rounded-full"}):M.jsx("div",{className:"w-5 h-5 rounded-full bg-blue-500 flex items-center justify-center",children:M.jsx("span",{className:"text-xs text-white font-bold",children:a.chain.charAt(0)})}),M.jsx("div",{className:"flex flex-col",children:M.jsx("span",{className:`text-sm font-medium ${i||l?"text-text-primary":"text-text-tertiary"}`,children:a.chain})})]}),i&&M.jsx(zi,{className:"w-4 h-4 text-blue-400"})]})},a.chainId))})})]})})}),wr=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,walletType:s="mpc"})=>{const u=d.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),a=f=>{if(n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(y=>y.token===r||y.symbol===r)){const y=f.tokenList[0];o(y.symbol||y.token)}},i=f=>{o(f.symbol||f.token)},l=d.useMemo(()=>t.map(f=>f),[t]),c=d.useMemo(()=>l.find(f=>f.chainId===e.chainId)||l[0],[l,e.chainId]),p=d.useMemo(()=>u.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[u]),m=d.useMemo(()=>{if(p.length!==0)return p.find(f=>f.token===r||f.symbol===r)||p[0]},[p,r]);return M.jsxs("div",{className:"space-y-4",children:[M.jsx(Cf,{chains:l,selectedChain:c,onChainChange:f=>{const b=t.find(y=>y.chainId===f.chainId);b&&a(b)},walletType:s,className:"w-full"}),p.length>0?m&&M.jsx(Ef,{tokens:p,selectedToken:m,onTokenChange:i,className:"w-full"}):M.jsx("div",{className:"w-full h-9 bg-fill-input-primary rounded-lg flex items-center justify-center",children:M.jsx("span",{className:"text-sm text-gray-400",children:"No tokens available"})})]})},Sf=(e,t)=>Number(e)>Number(t),Ue=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},Er=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const i=o[0]+"."+o[1].substring(0,6);return Er(i,t)}const s=parseFloat(e),u=parseFloat(t);if(!isNaN(s)&&!isNaN(u)&&s>u)return{isValid:!0,formattedValue:Ue(t),errorType:"auto_adjusted_to_max"};let a=e;return!isNaN(s)&&!e.endsWith(".")&&e.includes(".")&&(a=e.replace(/\.?0+$/,""),a.includes(".")||(a=a)),{isValid:!0,formattedValue:a}},Of=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},Hi={ETHEREUM:1,SEPOLIA:11155111},Af=[Hi.ETHEREUM,Hi.SEPOLIA],Nf=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!Af.includes(t)}return!0},$f=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],Cr={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Sr={address:"0x1234567890123456789012345678901234567890"},Or={multiChain:{minDeposit:10}};var yn={},Tf=function(){var e=document.getSelection();if(!e.rangeCount)return function(){};for(var t=document.activeElement,n=[],r=0;r<e.rangeCount;r++)n.push(e.getRangeAt(r));switch(t.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":t.blur();break;default:t=null;break}return e.removeAllRanges(),function(){e.type==="Caret"&&e.removeAllRanges(),e.rangeCount||n.forEach(function(o){e.addRange(o)}),t&&t.focus()}},Pf=Tf,Gi={"text/plain":"Text","text/html":"Url",default:"Text"},Mf="Copy to clipboard: #{key}, Enter";function Lf(e){var t=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return e.replace(/#{\s*key\s*}/g,t)}function If(e,t){var n,r,o,s,u,a,i=!1;t||(t={}),n=t.debug||!1;try{o=Pf(),s=document.createRange(),u=document.getSelection(),a=document.createElement("span"),a.textContent=e,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(c){if(c.stopPropagation(),t.format)if(c.preventDefault(),typeof c.clipboardData>"u"){n&&console.warn("unable to use e.clipboardData"),n&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var p=Gi[t.format]||Gi.default;window.clipboardData.setData(p,e)}else c.clipboardData.clearData(),c.clipboardData.setData(t.format,e);t.onCopy&&(c.preventDefault(),t.onCopy(c.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),u.addRange(s);var l=document.execCommand("copy");if(!l)throw new Error("copy command was unsuccessful");i=!0}catch(c){n&&console.error("unable to copy using execCommand: ",c),n&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(t.format||"text",e),t.onCopy&&t.onCopy(window.clipboardData),i=!0}catch(p){n&&console.error("unable to copy using clipboardData: ",p),n&&console.error("falling back to prompt"),r=Lf("message"in t?t.message:Mf),window.prompt(r,e)}}finally{u&&(typeof u.removeRange=="function"?u.removeRange(s):u.removeAllRanges()),a&&document.body.removeChild(a),o()}return i}var Df=If;function Ar(e){"@babel/helpers - typeof";return Ar=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},Ar(e)}Object.defineProperty(yn,"__esModule",{value:!0}),yn.CopyToClipboard=void 0;var xn=Yi(d),Ff=Yi(Df),_f=["text","onCopy","options","children"];function Yi(e){return e&&e.__esModule?e:{default:e}}function Ki(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function qi(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ki(Object(n),!0).forEach(function(r){$r(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ki(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jf(e,t){if(e==null)return{};var n=kf(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function kf(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function Rf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Bf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Wf(e,t,n){return t&&Bf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Uf(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Nr(e,t)}function Nr(e,t){return Nr=Object.setPrototypeOf||function(r,o){return r.__proto__=o,r},Nr(e,t)}function Vf(e){var t=Hf();return function(){var r=wn(e),o;if(t){var s=wn(this).constructor;o=Reflect.construct(r,arguments,s)}else o=r.apply(this,arguments);return zf(this,o)}}function zf(e,t){if(t&&(Ar(t)==="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Qi(e)}function Qi(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Hf(){if(typeof Reflect>"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 wn(e){return wn=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},wn(e)}function $r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var Xi=function(e){Uf(n,e);var t=Vf(n);function n(){var r;Rf(this,n);for(var o=arguments.length,s=new Array(o),u=0;u<o;u++)s[u]=arguments[u];return r=t.call.apply(t,[this].concat(s)),$r(Qi(r),"onClick",function(a){var i=r.props,l=i.text,c=i.onCopy,p=i.children,m=i.options,f=xn.default.Children.only(p),b=(0,Ff.default)(l,m);c&&c(l,b),f&&f.props&&typeof f.props.onClick=="function"&&f.props.onClick(a)}),r}return Wf(n,[{key:"render",value:function(){var o=this.props;o.text,o.onCopy,o.options;var s=o.children,u=jf(o,_f),a=xn.default.Children.only(s);return xn.default.cloneElement(a,qi(qi({},u),{},{onClick:this.onClick}))}}]),n}(xn.default.PureComponent);yn.CopyToClipboard=Xi,$r(Xi,"defaultProps",{onCopy:void 0,options:void 0});var Gf=yn,Tr=Gf.CopyToClipboard;Tr.CopyToClipboard=Tr;var Yf=Tr;const Kf=Ws(Yf);var qf=Object.defineProperty,En=Object.getOwnPropertySymbols,Ji=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,es=(e,t,n)=>t in e?qf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Pr=(e,t)=>{for(var n in t||(t={}))Ji.call(t,n)&&es(e,n,t[n]);if(En)for(var n of En(t))Zi.call(t,n)&&es(e,n,t[n]);return e},Mr=(e,t)=>{var n={};for(var r in e)Ji.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&En)for(var r of En(e))t.indexOf(r)<0&&Zi.call(e,r)&&(n[r]=e[r]);return n};/**
|
|
96
96
|
* @license QR Code generator library (TypeScript)
|
|
97
97
|
* Copyright (c) Project Nayuki.
|
|
98
98
|
* SPDX-License-Identifier: MIT
|
|
99
|
-
*/var tt;(e=>{const t=class Y{constructor(i,l,u,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<Y.MIN_VERSION||i>Y.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let h=0;h<this.size;h++)m.push(!1);for(let h=0;h<this.size;h++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const d=this.addEccAndInterleave(u);if(this.drawCodewords(d),p==-1){let h=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const b=this.getPenaltyScore();b<h&&(p=g,h=b),this.applyMask(g)}}o(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(i,l){const u=e.QrSegment.makeSegments(i);return Y.encodeSegments(u,l)}static encodeBinary(i,l){const u=e.QrSegment.makeBytes(i);return Y.encodeSegments([u],l)}static encodeSegments(i,l,u=1,p=40,m=-1,d=!0){if(!(Y.MIN_VERSION<=u&&u<=p&&p<=Y.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,g;for(h=u;;h++){const x=Y.getNumDataCodewords(h,l)*8,C=c.getTotalBits(i,h);if(C<=x){g=C;break}if(h>=p)throw new RangeError("Data too long")}for(const x of[Y.Ecc.MEDIUM,Y.Ecc.QUARTILE,Y.Ecc.HIGH])d&&g<=Y.getNumDataCodewords(h,x)*8&&(l=x);let b=[];for(const x of i){n(x.mode.modeBits,4,b),n(x.numChars,x.mode.numCharCountBits(h),b);for(const C of x.getData())b.push(C)}o(b.length==g);const w=Y.getNumDataCodewords(h,l)*8;o(b.length<=w),n(0,Math.min(4,w-b.length),b),n(0,(8-b.length%8)%8,b),o(b.length%8==0);for(let x=236;b.length<w;x^=253)n(x,8,b);let E=[];for(;E.length*8<b.length;)E.push(0);return b.forEach((x,C)=>E[C>>>3]|=x<<7-(C&7)),new Y(h,l,E,m)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let u=0;u<this.size;u++)this.setFunctionModule(6,u,u%2==0),this.setFunctionModule(u,6,u%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let u=0;u<l;u++)for(let p=0;p<l;p++)u==0&&p==0||u==0&&p==l-1||u==l-1&&p==0||this.drawAlignmentPattern(i[u],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let u=l;for(let m=0;m<10;m++)u=u<<1^(u>>>9)*1335;const p=(l<<10|u)^21522;o(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(p,m));this.setFunctionModule(8,7,r(p,6)),this.setFunctionModule(8,8,r(p,7)),this.setFunctionModule(7,8,r(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let u=0;u<12;u++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let u=0;u<18;u++){const p=r(l,u),m=this.size-11+u%3,d=Math.floor(u/3);this.setFunctionModule(m,d,p),this.setFunctionModule(d,m,p)}}drawFinderPattern(i,l){for(let u=-4;u<=4;u++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(u)),d=i+p,h=l+u;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let u=-2;u<=2;u++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+u,Math.max(Math.abs(p),Math.abs(u))!=1)}setFunctionModule(i,l,u){this.modules[l][i]=u,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,u=this.errorCorrectionLevel;if(i.length!=Y.getNumDataCodewords(l,u))throw new RangeError("Invalid argument");const p=Y.NUM_ERROR_CORRECTION_BLOCKS[u.ordinal][l],m=Y.ECC_CODEWORDS_PER_BLOCK[u.ordinal][l],d=Math.floor(Y.getNumRawDataModules(l)/8),h=p-d%p,g=Math.floor(d/p);let b=[];const w=Y.reedSolomonComputeDivisor(m);for(let x=0,C=0;x<p;x++){let S=i.slice(C,C+g-m+(x<h?0:1));C+=S.length;const M=Y.reedSolomonComputeRemainder(S,w);x<h&&S.push(0),b.push(S.concat(M))}let E=[];for(let x=0;x<b[0].length;x++)b.forEach((C,S)=>{(x!=g-m||S>=h)&&E.push(C[x])});return o(E.length==d),E}drawCodewords(i){if(i.length!=Math.floor(Y.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let u=this.size-1;u>=1;u-=2){u==6&&(u=5);for(let p=0;p<this.size;p++)for(let m=0;m<2;m++){const d=u-m,g=(u+1&2)==0?this.size-1-p:p;!this.isFunction[g][d]&&l<i.length*8&&(this.modules[g][d]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let u=0;u<this.size;u++){let p;switch(i){case 0:p=(u+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=u%3==0;break;case 3:p=(u+l)%3==0;break;case 4:p=(Math.floor(u/3)+Math.floor(l/2))%2==0;break;case 5:p=u*l%2+u*l%3==0;break;case 6:p=(u*l%2+u*l%3)%2==0;break;case 7:p=((u+l)%2+u*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][u]&&p&&(this.modules[l][u]=!this.modules[l][u])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let d=!1,h=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[m][b]==d?(h++,h==5?i+=Y.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),d||(i+=this.finderPenaltyCountPatterns(g)*Y.PENALTY_N3),d=this.modules[m][b],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,g)*Y.PENALTY_N3}for(let m=0;m<this.size;m++){let d=!1,h=0,g=[0,0,0,0,0,0,0];for(let b=0;b<this.size;b++)this.modules[b][m]==d?(h++,h==5?i+=Y.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),d||(i+=this.finderPenaltyCountPatterns(g)*Y.PENALTY_N3),d=this.modules[b][m],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,g)*Y.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let d=0;d<this.size-1;d++){const h=this.modules[m][d];h==this.modules[m][d+1]&&h==this.modules[m+1][d]&&h==this.modules[m+1][d+1]&&(i+=Y.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((d,h)=>d+(h?1:0),l);const u=this.size*this.size,p=Math.ceil(Math.abs(l*20-u*10)/u)-1;return o(0<=p&&p<=9),i+=p*Y.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let u=[6];for(let p=this.size-7;u.length<i;p-=l)u.splice(1,0,p);return u}}static getNumRawDataModules(i){if(i<Y.MIN_VERSION||i>Y.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const u=Math.floor(i/7)+2;l-=(25*u-10)*u-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(Y.getNumRawDataModules(i)/8)-Y.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*Y.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let p=0;p<i-1;p++)l.push(0);l.push(1);let u=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=Y.reedSolomonMultiply(l[m],u),m+1<l.length&&(l[m]^=l[m+1]);u=Y.reedSolomonMultiply(u,2)}return l}static reedSolomonComputeRemainder(i,l){let u=l.map(p=>0);for(const p of i){const m=p^u.shift();u.push(0),l.forEach((d,h)=>u[h]^=Y.reedSolomonMultiply(d,m))}return u}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let u=0;for(let p=7;p>=0;p--)u=u<<1^(u>>>7)*285,u^=(l>>>p&1)*i;return o(u>>>8==0),u}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const u=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(u&&i[0]>=l*4&&i[6]>=l?1:0)+(u&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,u){return i&&(this.finderPenaltyAddHistory(l,u),l=0),l+=this.size,this.finderPenaltyAddHistory(l,u),this.finderPenaltyCountPatterns(u)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,i,l){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let u=i-1;u>=0;u--)l.push(a>>>u&1)}function r(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}const s=class oe{constructor(i,l,u){if(this.mode=i,this.numChars=l,this.bitData=u,l<0)throw new RangeError("Invalid argument");this.bitData=u.slice()}static makeBytes(i){let l=[];for(const u of i)n(u,8,l);return new oe(oe.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!oe.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let u=0;u<i.length;){const p=Math.min(i.length-u,3);n(parseInt(i.substring(u,u+p),10),p*3+1,l),u+=p}return new oe(oe.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!oe.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],u;for(u=0;u+2<=i.length;u+=2){let p=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u))*45;p+=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u+1)),n(p,11,l)}return u<i.length&&n(oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(u)),6,l),new oe(oe.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:oe.isNumeric(i)?[oe.makeNumeric(i)]:oe.isAlphanumeric(i)?[oe.makeAlphanumeric(i)]:[oe.makeBytes(oe.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)n(i,8,l);else if(i<16384)n(2,2,l),n(i,14,l);else if(i<1e6)n(6,3,l),n(i,21,l);else throw new RangeError("ECI assignment value out of range");return new oe(oe.Mode.ECI,0,l)}static isNumeric(i){return oe.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return oe.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let u=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;u+=4+m+p.bitData.length}return u}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let u=0;u<i.length;u++)i.charAt(u)!="%"?l.push(i.charCodeAt(u)):(l.push(parseInt(i.substring(u+1,u+3),16)),u+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let c=s;e.QrSegment=s})(tt||(tt={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(tt||(tt={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(tt||(tt={}));var dt=tt;/**
|
|
99
|
+
*/var vt;(e=>{const t=class Q{constructor(i,l,c,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<Q.MIN_VERSION||i>Q.MAX_VERSION)throw new RangeError("Version value out of range");if(p<-1||p>7)throw new RangeError("Mask value out of range");this.size=i*4+17;let m=[];for(let b=0;b<this.size;b++)m.push(!1);for(let b=0;b<this.size;b++)this.modules.push(m.slice()),this.isFunction.push(m.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(c);if(this.drawCodewords(f),p==-1){let b=1e9;for(let y=0;y<8;y++){this.applyMask(y),this.drawFormatBits(y);const N=this.getPenaltyScore();N<b&&(p=y,b=N),this.applyMask(y)}}o(0<=p&&p<=7),this.mask=p,this.applyMask(p),this.drawFormatBits(p),this.isFunction=[]}static encodeText(i,l){const c=e.QrSegment.makeSegments(i);return Q.encodeSegments(c,l)}static encodeBinary(i,l){const c=e.QrSegment.makeBytes(i);return Q.encodeSegments([c],l)}static encodeSegments(i,l,c=1,p=40,m=-1,f=!0){if(!(Q.MIN_VERSION<=c&&c<=p&&p<=Q.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let b,y;for(b=c;;b++){const T=Q.getNumDataCodewords(b,l)*8,j=u.getTotalBits(i,b);if(j<=T){y=j;break}if(b>=p)throw new RangeError("Data too long")}for(const T of[Q.Ecc.MEDIUM,Q.Ecc.QUARTILE,Q.Ecc.HIGH])f&&y<=Q.getNumDataCodewords(b,T)*8&&(l=T);let N=[];for(const T of i){n(T.mode.modeBits,4,N),n(T.numChars,T.mode.numCharCountBits(b),N);for(const j of T.getData())N.push(j)}o(N.length==y);const I=Q.getNumDataCodewords(b,l)*8;o(N.length<=I),n(0,Math.min(4,I-N.length),N),n(0,(8-N.length%8)%8,N),o(N.length%8==0);for(let T=236;N.length<I;T^=253)n(T,8,N);let w=[];for(;w.length*8<N.length;)w.push(0);return N.forEach((T,j)=>w[j>>>3]|=T<<7-(j&7)),new Q(b,l,w,m)}getModule(i,l){return 0<=i&&i<this.size&&0<=l&&l<this.size&&this.modules[l][i]}getModules(){return this.modules}drawFunctionPatterns(){for(let c=0;c<this.size;c++)this.setFunctionModule(6,c,c%2==0),this.setFunctionModule(c,6,c%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const i=this.getAlignmentPatternPositions(),l=i.length;for(let c=0;c<l;c++)for(let p=0;p<l;p++)c==0&&p==0||c==0&&p==l-1||c==l-1&&p==0||this.drawAlignmentPattern(i[c],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let c=l;for(let m=0;m<10;m++)c=c<<1^(c>>>9)*1335;const p=(l<<10|c)^21522;o(p>>>15==0);for(let m=0;m<=5;m++)this.setFunctionModule(8,m,r(p,m));this.setFunctionModule(8,7,r(p,6)),this.setFunctionModule(8,8,r(p,7)),this.setFunctionModule(7,8,r(p,8));for(let m=9;m<15;m++)this.setFunctionModule(14-m,8,r(p,m));for(let m=0;m<8;m++)this.setFunctionModule(this.size-1-m,8,r(p,m));for(let m=8;m<15;m++)this.setFunctionModule(8,this.size-15+m,r(p,m));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let i=this.version;for(let c=0;c<12;c++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let c=0;c<18;c++){const p=r(l,c),m=this.size-11+c%3,f=Math.floor(c/3);this.setFunctionModule(m,f,p),this.setFunctionModule(f,m,p)}}drawFinderPattern(i,l){for(let c=-4;c<=4;c++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(c)),f=i+p,b=l+c;0<=f&&f<this.size&&0<=b&&b<this.size&&this.setFunctionModule(f,b,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let c=-2;c<=2;c++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+c,Math.max(Math.abs(p),Math.abs(c))!=1)}setFunctionModule(i,l,c){this.modules[l][i]=c,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,c=this.errorCorrectionLevel;if(i.length!=Q.getNumDataCodewords(l,c))throw new RangeError("Invalid argument");const p=Q.NUM_ERROR_CORRECTION_BLOCKS[c.ordinal][l],m=Q.ECC_CODEWORDS_PER_BLOCK[c.ordinal][l],f=Math.floor(Q.getNumRawDataModules(l)/8),b=p-f%p,y=Math.floor(f/p);let N=[];const I=Q.reedSolomonComputeDivisor(m);for(let T=0,j=0;T<p;T++){let _=i.slice(j,j+y-m+(T<b?0:1));j+=_.length;const B=Q.reedSolomonComputeRemainder(_,I);T<b&&_.push(0),N.push(_.concat(B))}let w=[];for(let T=0;T<N[0].length;T++)N.forEach((j,_)=>{(T!=y-m||_>=b)&&w.push(j[T])});return o(w.length==f),w}drawCodewords(i){if(i.length!=Math.floor(Q.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let c=this.size-1;c>=1;c-=2){c==6&&(c=5);for(let p=0;p<this.size;p++)for(let m=0;m<2;m++){const f=c-m,y=(c+1&2)==0?this.size-1-p:p;!this.isFunction[y][f]&&l<i.length*8&&(this.modules[y][f]=r(i[l>>>3],7-(l&7)),l++)}}o(l==i.length*8)}applyMask(i){if(i<0||i>7)throw new RangeError("Mask value out of range");for(let l=0;l<this.size;l++)for(let c=0;c<this.size;c++){let p;switch(i){case 0:p=(c+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=c%3==0;break;case 3:p=(c+l)%3==0;break;case 4:p=(Math.floor(c/3)+Math.floor(l/2))%2==0;break;case 5:p=c*l%2+c*l%3==0;break;case 6:p=(c*l%2+c*l%3)%2==0;break;case 7:p=((c+l)%2+c*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][c]&&p&&(this.modules[l][c]=!this.modules[l][c])}}getPenaltyScore(){let i=0;for(let m=0;m<this.size;m++){let f=!1,b=0,y=[0,0,0,0,0,0,0];for(let N=0;N<this.size;N++)this.modules[m][N]==f?(b++,b==5?i+=Q.PENALTY_N1:b>5&&i++):(this.finderPenaltyAddHistory(b,y),f||(i+=this.finderPenaltyCountPatterns(y)*Q.PENALTY_N3),f=this.modules[m][N],b=1);i+=this.finderPenaltyTerminateAndCount(f,b,y)*Q.PENALTY_N3}for(let m=0;m<this.size;m++){let f=!1,b=0,y=[0,0,0,0,0,0,0];for(let N=0;N<this.size;N++)this.modules[N][m]==f?(b++,b==5?i+=Q.PENALTY_N1:b>5&&i++):(this.finderPenaltyAddHistory(b,y),f||(i+=this.finderPenaltyCountPatterns(y)*Q.PENALTY_N3),f=this.modules[N][m],b=1);i+=this.finderPenaltyTerminateAndCount(f,b,y)*Q.PENALTY_N3}for(let m=0;m<this.size-1;m++)for(let f=0;f<this.size-1;f++){const b=this.modules[m][f];b==this.modules[m][f+1]&&b==this.modules[m+1][f]&&b==this.modules[m+1][f+1]&&(i+=Q.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((f,b)=>f+(b?1:0),l);const c=this.size*this.size,p=Math.ceil(Math.abs(l*20-c*10)/c)-1;return o(0<=p&&p<=9),i+=p*Q.PENALTY_N4,o(0<=i&&i<=2568888),i}getAlignmentPatternPositions(){if(this.version==1)return[];{const i=Math.floor(this.version/7)+2,l=this.version==32?26:Math.ceil((this.version*4+4)/(i*2-2))*2;let c=[6];for(let p=this.size-7;c.length<i;p-=l)c.splice(1,0,p);return c}}static getNumRawDataModules(i){if(i<Q.MIN_VERSION||i>Q.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const c=Math.floor(i/7)+2;l-=(25*c-10)*c-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(Q.getNumRawDataModules(i)/8)-Q.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*Q.NUM_ERROR_CORRECTION_BLOCKS[l.ordinal][i]}static reedSolomonComputeDivisor(i){if(i<1||i>255)throw new RangeError("Degree out of range");let l=[];for(let p=0;p<i-1;p++)l.push(0);l.push(1);let c=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=Q.reedSolomonMultiply(l[m],c),m+1<l.length&&(l[m]^=l[m+1]);c=Q.reedSolomonMultiply(c,2)}return l}static reedSolomonComputeRemainder(i,l){let c=l.map(p=>0);for(const p of i){const m=p^c.shift();c.push(0),l.forEach((f,b)=>c[b]^=Q.reedSolomonMultiply(f,m))}return c}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let c=0;for(let p=7;p>=0;p--)c=c<<1^(c>>>7)*285,c^=(l>>>p&1)*i;return o(c>>>8==0),c}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const c=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(c&&i[0]>=l*4&&i[6]>=l?1:0)+(c&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,c){return i&&(this.finderPenaltyAddHistory(l,c),l=0),l+=this.size,this.finderPenaltyAddHistory(l,c),this.finderPenaltyCountPatterns(c)}finderPenaltyAddHistory(i,l){l[0]==0&&(i+=this.size),l.pop(),l.unshift(i)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(a,i,l){if(i<0||i>31||a>>>i)throw new RangeError("Value out of range");for(let c=i-1;c>=0;c--)l.push(a>>>c&1)}function r(a,i){return(a>>>i&1)!=0}function o(a){if(!a)throw new Error("Assertion error")}const s=class ce{constructor(i,l,c){if(this.mode=i,this.numChars=l,this.bitData=c,l<0)throw new RangeError("Invalid argument");this.bitData=c.slice()}static makeBytes(i){let l=[];for(const c of i)n(c,8,l);return new ce(ce.Mode.BYTE,i.length,l)}static makeNumeric(i){if(!ce.isNumeric(i))throw new RangeError("String contains non-numeric characters");let l=[];for(let c=0;c<i.length;){const p=Math.min(i.length-c,3);n(parseInt(i.substring(c,c+p),10),p*3+1,l),c+=p}return new ce(ce.Mode.NUMERIC,i.length,l)}static makeAlphanumeric(i){if(!ce.isAlphanumeric(i))throw new RangeError("String contains unencodable characters in alphanumeric mode");let l=[],c;for(c=0;c+2<=i.length;c+=2){let p=ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c))*45;p+=ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c+1)),n(p,11,l)}return c<i.length&&n(ce.ALPHANUMERIC_CHARSET.indexOf(i.charAt(c)),6,l),new ce(ce.Mode.ALPHANUMERIC,i.length,l)}static makeSegments(i){return i==""?[]:ce.isNumeric(i)?[ce.makeNumeric(i)]:ce.isAlphanumeric(i)?[ce.makeAlphanumeric(i)]:[ce.makeBytes(ce.toUtf8ByteArray(i))]}static makeEci(i){let l=[];if(i<0)throw new RangeError("ECI assignment value out of range");if(i<128)n(i,8,l);else if(i<16384)n(2,2,l),n(i,14,l);else if(i<1e6)n(6,3,l),n(i,21,l);else throw new RangeError("ECI assignment value out of range");return new ce(ce.Mode.ECI,0,l)}static isNumeric(i){return ce.NUMERIC_REGEX.test(i)}static isAlphanumeric(i){return ce.ALPHANUMERIC_REGEX.test(i)}getData(){return this.bitData.slice()}static getTotalBits(i,l){let c=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;c+=4+m+p.bitData.length}return c}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let c=0;c<i.length;c++)i.charAt(c)!="%"?l.push(i.charCodeAt(c)):(l.push(parseInt(i.substring(c+1,c+3),16)),c+=2);return l}};s.NUMERIC_REGEX=/^[0-9]*$/,s.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,s.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let u=s;e.QrSegment=s})(vt||(vt={})),(e=>{(t=>{const n=class{constructor(o,s){this.ordinal=o,this.formatBits=s}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(vt||(vt={})),(e=>{(t=>{const n=class{constructor(o,s){this.modeBits=o,this.numBitsCharCount=s}numCharCountBits(o){return this.numBitsCharCount[Math.floor((o+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(vt||(vt={}));var $t=vt;/**
|
|
100
100
|
* @license qrcode.react
|
|
101
101
|
* Copyright (c) Paul O'Shannessy
|
|
102
102
|
* SPDX-License-Identifier: ISC
|
|
103
|
-
*/var Uc={L:dt.QrCode.Ecc.LOW,M:dt.QrCode.Ecc.MEDIUM,Q:dt.QrCode.Ecc.QUARTILE,H:dt.QrCode.Ecc.HIGH},Ei=128,Ci="L",Si="#FFFFFF",$i="#000000",Oi=!1,Ti=1,zc=4,Hc=0,Gc=.1;function Ni(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(c,a){if(!c&&s!==null){n.push(`M${s+t} ${o+t}h${a-s}v1H${s+t}z`),s=null;return}if(a===r.length-1){if(!c)return;s===null?n.push(`M${a+t},${o+t} h1v1H${a+t}z`):n.push(`M${s+t},${o+t} h${a+1-s}v1H${s+t}z`);return}c&&s===null&&(s=a)})}),n.join("")}function Ai(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function Yc(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Gc),c=o/t,a=(r.width||s)*c,i=(r.height||s)*c,l=r.x==null?e.length/2-a/2:r.x*c,u=r.y==null?e.length/2-i/2:r.y*c,p=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let h=Math.floor(l),g=Math.floor(u),b=Math.ceil(a+l-h),w=Math.ceil(i+u-g);m={x:h,y:g,w:b,h:w}}const d=r.crossOrigin;return{x:l,y:u,h:i,w:a,excavation:m,opacity:p,crossOrigin:d}}function Kc(e,t){return t!=null?Math.max(Math.floor(t),0):e?zc:Hc}function Mi({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:a}){let i=f.useMemo(()=>{const h=(Array.isArray(e)?e:[e]).reduce((g,b)=>(g.push(...dt.QrSegment.makeSegments(b)),g),[]);return dt.QrCode.encodeSegments(h,Uc[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:l,margin:u,numCells:p,calculatedImageSettings:m}=f.useMemo(()=>{let d=i.getModules();const h=Kc(r,o),g=d.length+h*2,b=Yc(d,c,h,s);return{cells:d,margin:h,numCells:g,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:u,cells:l,numCells:p,calculatedImageSettings:m}}var Qc=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),qc=f.forwardRef(function(t,n){const r=t,{value:o,size:s=Ei,level:c=Ci,bgColor:a=Si,fgColor:i=$i,includeMargin:l=Oi,minVersion:u=Ti,boostLevel:p,marginSize:m,imageSettings:d}=r,g=nr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:b}=g,w=nr(g,["style"]),E=d==null?void 0:d.src,x=f.useRef(null),C=f.useRef(null),S=f.useCallback(I=>{x.current=I,typeof n=="function"?n(I):n&&(n.current=I)},[n]),[M,F]=f.useState(!1),{margin:W,cells:V,numCells:A,calculatedImageSettings:O}=Mi({value:o,level:c,minVersion:u,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:d,size:s});f.useEffect(()=>{if(x.current!=null){const I=x.current,B=I.getContext("2d");if(!B)return;let z=V;const U=C.current,T=O!=null&&U!==null&&U.complete&&U.naturalHeight!==0&&U.naturalWidth!==0;T&&O.excavation!=null&&(z=Ai(V,O.excavation));const _=window.devicePixelRatio||1;I.height=I.width=s*_;const N=s/A*_;B.scale(N,N),B.fillStyle=a,B.fillRect(0,0,A,A),B.fillStyle=i,Qc?B.fill(new Path2D(Ni(z,W))):V.forEach(function(H,G){H.forEach(function(q,pe){q&&B.fillRect(pe+W,G+W,1,1)})}),O&&(B.globalAlpha=O.opacity),T&&B.drawImage(U,O.x+W,O.y+W,O.w,O.h)}}),f.useEffect(()=>{F(!1)},[E]);const j=tr({height:s,width:s},b);let D=null;return E!=null&&(D=f.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{F(!0)},ref:C,crossOrigin:O==null?void 0:O.crossOrigin})),f.createElement(f.Fragment,null,f.createElement("canvas",tr({style:j,height:s,width:s,ref:S,role:"img"},w)),D)});qc.displayName="QRCodeCanvas";var Pi=f.forwardRef(function(t,n){const r=t,{value:o,size:s=Ei,level:c=Ci,bgColor:a=Si,fgColor:i=$i,includeMargin:l=Oi,minVersion:u=Ti,boostLevel:p,title:m,marginSize:d,imageSettings:h}=r,g=nr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:b,cells:w,numCells:E,calculatedImageSettings:x}=Mi({value:o,level:c,minVersion:u,boostLevel:p,includeMargin:l,marginSize:d,imageSettings:h,size:s});let C=w,S=null;h!=null&&x!=null&&(x.excavation!=null&&(C=Ai(w,x.excavation)),S=f.createElement("image",{href:h.src,height:x.h,width:x.w,x:x.x+b,y:x.y+b,preserveAspectRatio:"none",opacity:x.opacity,crossOrigin:x.crossOrigin}));const M=Ni(C,b);return f.createElement("svg",tr({height:s,width:s,viewBox:`0 0 ${E} ${E}`,ref:n,role:"img"},g),!!m&&f.createElement("title",null,m),f.createElement("path",{fill:a,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),f.createElement("path",{fill:i,d:M,shapeRendering:"crispEdges"}),S)});Pi.displayName="QRCodeSVG";const Xc=(e,t)=>Number(e)>Number(t),Ne=e=>{if(!e||e===""||isNaN(Number(e)))return"0.00";const t=Number(e);if(t===0)return"0.00";let n=t.toString();n.includes("e")&&(n=t.toFixed(20));const r=n.split("."),o=r[0];let s=r[1]||"";return s.length>6&&(s=s.substring(0,6)),s=s.replace(/0+$/,""),s?(s.length===1&&(s+="0"),o+"."+s):o+".00"},rr=(e,t="0")=>{if(/[^0-9.]/.test(e))return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(e===".")return{isValid:!0,formattedValue:"0."};if((e.match(/\./g)||[]).length>1)return{isValid:!1,formattedValue:"",errorType:"invalid_char"};if(!e||e==="")return{isValid:!0,formattedValue:""};const o=e.split(".");if(o.length===2&&o[1].length>6){const i=o[0]+"."+o[1].substring(0,6);return rr(i,t)}const s=parseFloat(e),c=parseFloat(t);if(!isNaN(s)&&!isNaN(c)&&s>c)return{isValid:!0,formattedValue:Ne(t),errorType:"auto_adjusted_to_max"};let a=e;return!isNaN(s)&&!e.endsWith(".")&&e.includes(".")&&(a=e.replace(/\.?0+$/,""),a.includes(".")||(a=a)),{isValid:!0,formattedValue:a}},Jc=(e,t,n)=>{if(!e||e===""||e==="0"||e==="0.00")return!1;const r=parseFloat(e),o=parseFloat(t);return!(isNaN(r)||isNaN(o)||r>o||!n)},Li={ETHEREUM:1,SEPOLIA:11155111},Zc=[Li.ETHEREUM,Li.SEPOLIA],ef=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!Zc.includes(t)}return!0},tf=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],or={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},ir={address:"0x1234567890123456789012345678901234567890"},sr={multiChain:{minDeposit:10}},nf=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var s;const o=f.useMemo(()=>ef(n||{}),[n]);return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"flex justify-center mt-4 mb-3",children:y.jsx("div",{className:"bg-white rounded-lg",children:y.jsx(Pi,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),y.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[y.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),y.jsx("div",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.getDisplayAddress())||"")},style:{cursor:"pointer"},children:y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[y.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),y.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),y.jsxs("div",{className:"flex items-start",children:[y.jsx("div",{className:"w-5",children:y.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:y.jsx("path",{d:"M8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8C14.6668 4.31809 11.6821 1.33333 8.00016 1.33333C4.31826 1.33333 1.3335 4.31809 1.3335 8C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z",fill:"#FF8F34",stroke:"#FF8F34",strokeWidth:"1.33333",strokeLinejoin:"round"})})}),y.jsxs("div",{className:"flex-1",children:[y.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]}),y.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),o&&y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"flex items-start pl-5 pt-2 text-functional-orange-1 text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."}),y.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),y.jsxs("div",{className:"text-sm",children:[y.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[y.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),y.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["≈"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),y.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[y.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),y.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((s=r==null?void 0:r.multiChain)==null?void 0:s.minDeposit)||10," ",t]})]}),y.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[y.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),y.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},rf=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onClose:c})=>{var d;const[a,i]=f.useState(()=>{var h;return!e||e.length===0?1:t||((h=e[0])==null?void 0:h.chainId)||1}),[l,u]=f.useState(()=>{var w;if(!e||e.length===0)return"";const h=t||((w=e[0])==null?void 0:w.chainId),g=e.find(E=>E.chainId===h);if(!g||!g.tokenList||g.tokenList.length===0)return"";const b=g.tokenList.find(E=>E.tokenAddress===n)||g.tokenList[0];return(b==null?void 0:b.token)||""}),p=e&&e.length>0?e.find(h=>h.chainId===a)||e[0]:null,m=(d=p==null?void 0:p.tokenList)==null?void 0:d.find(h=>h.token===l);return!e||e.length===0?y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"No chains available"})}):p?y.jsxs(y.Fragment,{children:[y.jsx(er,{currentActiveChain:p,chainList:e,onChainChange:i,curSelectToken:l,onTokenChange:u,walletType:"mpc"}),y.jsx(nf,{walletAdapter:r,curSelectToken:l,currentActiveChain:p,metadata:o}),y.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{s&&s({amount:"",chainId:a,tokenAddress:(m==null?void 0:m.tokenAddress)||"",tokenSymbol:l}),c()},children:"Deposit"})]}):y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"Loading..."})})},of=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:a,tokenBalance:i,platformBalance:l="0",onDepositAmountChange:u,onApprove:p})=>{const m=h=>{const g=h.target.value,w=rr(g,i||"0");if(w.isValid)u(w.formattedValue),w.errorType;else return w.errorType==="exceed_balance",void 0},d=()=>{const h=parseFloat(i||"0"),g=parseFloat(e||"0");if(g>0){const b=h-g,w=Ne(Math.max(0,b).toString());return`${Ne(i||"0")} → ${w} ${t}`}return`${Ne(i||"0")} ${t}`};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[y.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[y.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:m,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),y.jsx("button",{onClick:()=>{u(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),y.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),y.jsxs("div",{className:"flex justify-between items-center",children:[y.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),y.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:d()})]})]}),!r&&Xc(e||"0",0)&&y.jsxs("div",{className:"flex justify-center flex-col items-center",children:[y.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),y.jsxs("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),y.jsxs("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4",onClick:p,children:["Enable ",t]})]}),y.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:y.jsxs("div",{className:"flex justify-between items-center",children:[y.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),y.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${Ne(l)} → ${Ne((parseFloat(l)+parseFloat(e)).toString())} ${t}`:`${Ne(l)} ${t}`})]})})]})},sf=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var i,l;const c=(i=o==null?void 0:o.useBalance)==null?void 0:i.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),a=(l=o==null?void 0:o.useReadContract)==null?void 0:l.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return f.useEffect(()=>{s(e.tokenAddress,{balance:c,allowance:a})},[c,a,e.tokenAddress,s]),null},Fi=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var h;const s=f.useMemo(()=>r.filter(g=>g.tokenAddress&&g.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[c,a]=f.useState({}),i=f.useCallback((g,b)=>{a(w=>({...w,[g]:b}))},[]),l=(h=o==null?void 0:o.useBalance)==null?void 0:h.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),u=f.useMemo(()=>s.map(g=>f.createElement(sf,{key:g.tokenAddress,token:g,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:i})),[s,e,t,n,o,i]),p=f.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const g=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},b=s.map(x=>{const C=c[x.tokenAddress],S=C==null?void 0:C.balance,M=S==null?void 0:S.data;return{address:x.tokenAddress,value:(M==null?void 0:M.value)||BigInt(0),formatted:(M==null?void 0:M.formatted)||"0",decimals:(M==null?void 0:M.decimals)||x.decimals}}).filter(x=>x.address),w=s.map(x=>{const C=c[x.tokenAddress],S=C==null?void 0:C.allowance,M=S==null?void 0:S.data,F=BigInt(M?M.toString():0);return{address:x.tokenAddress,value:F,formatted:(F/BigInt(10)**BigInt(x.decimals)).toString(),decimals:x.decimals}}).filter(x=>x.address),E=b.reduce((x,C)=>{const S=w.find(M=>M.address===C.address);return{...x,[C.address]:{balance:C,allowance:S||{address:C.address,value:BigInt(0),formatted:"0",decimals:C.decimals}}}},{});return{balanceList:b,allowanceList:w,baseTokenBalance:g,combinedData:E}},[l,c,s,o==null?void 0:o.useBalance]),m=f.useCallback(async()=>p,[p]),d=f.useMemo(()=>{const g=(l==null?void 0:l.isLoading)||!1,b=Object.values(c).some(w=>{var E,x;return((E=w.balance)==null?void 0:E.isLoading)||((x=w.allowance)==null?void 0:x.isLoading)});return g||b},[l==null?void 0:l.isLoading,c]);return{multicallRun:m,multicallResult:p,validErcTokens:s,isLoading:d,queryComponents:u}},lf=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,platformBalance:a="0",wagmiHooks:i,approved:l,onApproved:u,onDeposit:p,onClose:m,onChainChange:d,onTokenChange:h})=>{var _;const[g,b]=f.useState(()=>{var N;return!e||e.length===0?1:t||((N=e[0])==null?void 0:N.chainId)||1}),[w,E]=f.useState(()=>{var q;if(!e||e.length===0)return"";const N=t||((q=e[0])==null?void 0:q.chainId),H=e.find(pe=>pe.chainId===N);if(!H||!H.tokenList||H.tokenList.length===0)return"";const G=H.tokenList.find(pe=>pe.tokenAddress===n)||H.tokenList[0];return(G==null?void 0:G.token)||""}),[x,C]=f.useState(r),S=f.useCallback(N=>{b(N),d==null||d(N)},[d]),M=f.useCallback(N=>{E(N),h==null||h(N)},[h]),F=f.useRef(!0),W=f.useRef(w),V=f.useRef(g);f.useEffect(()=>{if(F.current){F.current=!1,W.current=w,V.current=g;return}(W.current!==w||V.current!==g)&&(C(""),W.current=w,V.current=g)},[w,g]);const A=e&&e.length>0?e.find(N=>N.chainId===g)||e[0]:null,O=(_=A==null?void 0:A.tokenList)==null?void 0:_.find(N=>N.token===w),j=o==null?void 0:o.getDisplayAddress(),{multicallResult:D,queryComponents:I}=Fi({account:j,chainId:g,contractAddress:void 0,tokens:(A==null?void 0:A.tokenList)||[],wagmiHooks:i}),B=f.useMemo(()=>{var H;if(!O)return;if(!O.tokenAddress||O.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return D.baseTokenBalance.formatted;const N=D.combinedData[O.tokenAddress];return((H=N==null?void 0:N.balance)==null?void 0:H.formatted)||"0"},[O,D]),z=l??!1,U=f.useMemo(()=>{const N=parseFloat(x||"0"),H=10,G=B||"0",q=Jc(x,G,z);return!x||N===0?{text:"Confirm Deposit",disabled:!0}:z?N>parseFloat(G)?{text:"Insufficient Balance",disabled:!0}:N<H?{text:`Min Deposit ${H} ${w}`,disabled:!0}:{text:"Confirm Deposit",disabled:!q}:{text:"Confirm Deposit",disabled:!0}},[x,w,B,z]),T=f.useCallback(async()=>{p&&p({amount:x,chainId:g,tokenAddress:(O==null?void 0:O.tokenAddress)||"",tokenSymbol:w})},[p,x,g,O==null?void 0:O.tokenAddress,w]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?y.jsxs("div",{className:"p-6 text-center",children:[y.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),y.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"No chains available"})}):A?y.jsxs(y.Fragment,{children:[I,y.jsx(er,{currentActiveChain:A,chainList:e,onChainChange:S,curSelectToken:w,onTokenChange:M,walletType:"evm"}),y.jsx(of,{depositAmount:x,curSelectToken:w,curSelectTokenData:{balance:O==null?void 0:O.balance,allowance:O==null?void 0:O.allowance},approved:z,currentActiveChain:A,currentEquity:c||0,amount:x,decimals:(O==null?void 0:O.decimals)||6,tokenBalance:B,platformBalance:a,onDepositAmountChange:C,onApprove:async()=>{u&&await u()}}),y.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${U.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:T,disabled:U.disabled,children:U.text})]}):y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Ii=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=or,smartWallet:o=ir,chains:s,defaultChainId:c,defaultTokenAddress:a,defaultAmount:i="",metadata:l=sr,currentEquity:u=5e3,platformBalance:p="0",wagmiHooks:m,approved:d,onApproved:h,onDeposit:g,onChainChange:b,onTokenChange:w})=>{const E=f.useMemo(()=>{var C;return r?yr(r,o,!1,(C=s[0])==null?void 0:C.chainId,"0","0"):null},[r,o,s]),x=(E==null?void 0:E.getWalletType())==="mpc";return e?de.createPortal(y.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:y.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-50 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:y.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:C=>{C.stopPropagation()},children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),y.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:y.jsx(br,{className:"h-4 w-4"})})]}),x?y.jsx(rf,{chains:s,defaultChainId:c,defaultTokenAddress:a,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:u,onDeposit:g,onClose:t}):y.jsx(lf,{chains:s,defaultChainId:c,defaultTokenAddress:a,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:u,platformBalance:p,wagmiHooks:m,approved:d,onApproved:h,onDeposit:g,onClose:t,onChainChange:b,onTokenChange:w})]})})}),document.body):null};let je=null;const af={symbol:"USDT"},ji=f.forwardRef((e,t)=>{const[n,r]=f.useState(!1),[o,s]=f.useState({chains:[]}),c=f.useCallback(u=>{s(u),r(!0)},[]),a=f.useCallback(u=>{s(p=>({...p,...u}))},[]),i=f.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=f.useCallback(()=>n,[n]);return f.useImperativeHandle(t,()=>({openDeposit:c,closeDeposit:i,updateDepositOptions:a,isOpen:l}),[c,i,a,l]),f.useEffect(()=>(je={openDeposit:c,closeDeposit:i,updateDepositOptions:a,isOpen:l},()=>{je=null}),[c,i,a,l]),y.jsx(Ii,{isOpen:n,onClose:i,config:o.config||af,currentActiveAccount:o.currentActiveAccount||or,smartWallet:o.smartWallet||ir,chains:o.chains||tf,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||sr,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});ji.displayName="DepositManager";const Di=e=>{if(!je){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}je.openDeposit(e||{chains:[]})},_i=()=>{if(!je){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}je.closeDeposit()},ki=e=>{je&&je.updateDepositOptions(e)},uf=()=>je?je.isOpen():!1,cf=()=>({openDeposit:Di,closeDeposit:_i,updateDepositOptions:ki,isOpen:uf});f.createContext(null);const ff=Object.values({MAINNET:1,SEPOLIA:11155111}),lr=e=>ff.includes(e),df=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",walletType:o="evm",receiverAddress:s="",onWithdrawAmountChange:c,onReceiverAddressChange:a})=>{const i=p=>{const m=p.target.value,h=rr(m,r||"0");if(h.isValid)c(h.formattedValue),h.errorType;else return h.errorType==="exceed_balance",void 0},l=()=>{c(r)},u=()=>{const p=parseFloat(r||"0"),m=parseFloat(e||"0");if(m>0){const d=p-m,h=Ne(Math.max(0,d).toString());return`${Ne(r||"0")} → ${h} ${t}`}return`${Ne(r||"0")} ${t}`};return y.jsxs(y.Fragment,{children:[y.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[y.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[y.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:i,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),y.jsx("button",{onClick:l,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),y.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),y.jsxs("div",{className:"flex justify-between items-center",children:[y.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),y.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:u()})]})]}),o==="mpc"&&!lr(n==null?void 0:n.chainId)&&y.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:y.jsx("input",{type:"text",placeholder:"Receiver Address",value:s,onChange:p=>a==null?void 0:a(p.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),y.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:y.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this."})}),y.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"text-text-tertiary text-xs",children:"Speed"}),y.jsxs("div",{className:"flex items-center space-x-1",children:[y.jsx("span",{className:"text-theme-normal",children:"⚡"}),y.jsx("span",{className:"text-theme-normal",children:"⚡"}),y.jsx("span",{className:"text-theme-normal",children:"⚡"})]})]}),y.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[y.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:"Amount to receive"}),y.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Ne(e)," ",t]})]})]})]})},pf=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,platformBalance:a="0",wagmiHooks:i,onWithdraw:l,onClose:u,onChainChange:p,onTokenChange:m})=>{var _;const[d,h]=f.useState(()=>{var N;return!e||e.length===0?1:t||((N=e[0])==null?void 0:N.chainId)||1}),[g,b]=f.useState(()=>{var q;if(!e||e.length===0)return"";const N=t||((q=e[0])==null?void 0:q.chainId),H=e.find(pe=>pe.chainId===N);if(!H||!H.tokenList||H.tokenList.length===0)return"";const G=H.tokenList.find(pe=>pe.tokenAddress===n)||H.tokenList[0];return(G==null?void 0:G.token)||""}),[w,E]=f.useState(r),[x,C]=f.useState(""),S=(o==null?void 0:o.getWalletType())||"evm",M=f.useCallback(N=>{h(N),p==null||p(N)},[p]),F=f.useCallback(N=>{b(N),m==null||m(N)},[m]),W=f.useRef(!0),V=f.useRef(g),A=f.useRef(d);f.useEffect(()=>{if(W.current){W.current=!1,V.current=g,A.current=d;return}(V.current!==g||A.current!==d)&&(E(""),V.current=g,A.current=d)},[g,d]);const O=e&&e.length>0?e.find(N=>N.chainId===d)||e[0]:null,j=(_=O==null?void 0:O.tokenList)==null?void 0:_.find(N=>N.token===g),D=o==null?void 0:o.getDisplayAddress(),{multicallResult:I,queryComponents:B}=Fi({account:D,chainId:d,contractAddress:void 0,tokens:(O==null?void 0:O.tokenList)||[],wagmiHooks:i}),z=f.useMemo(()=>{var H;if(!j)return;if(!j.tokenAddress||j.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return I.baseTokenBalance.formatted;const N=I.combinedData[j.tokenAddress];return((H=N==null?void 0:N.balance)==null?void 0:H.formatted)||"0"},[j,I]),U=f.useMemo(()=>{const N=parseFloat(w||"0"),H=1,G=parseFloat(a||"0");return!w||N===0?{text:"Confirm Withdraw",disabled:!0}:S==="mpc"&&!lr(d)&&!x.trim()?{text:"Enter Receiver Address",disabled:!0}:N>G?{text:"Insufficient Balance",disabled:!0}:N<H?{text:`Min Withdraw ${H} ${g}`,disabled:!0}:{text:"Confirm Withdraw",disabled:!1}},[w,g,a,S,x]),T=f.useCallback(async()=>{if(l){const N={amount:w,chainId:d,tokenAddress:(j==null?void 0:j.tokenAddress)||"",tokenSymbol:g};S==="mpc"&&!lr(d)&&(N.receiverAddress=x),l(N)}},[l,w,d,j==null?void 0:j.tokenAddress,g,S,x]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?y.jsxs("div",{className:"p-6 text-center",children:[y.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),y.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"No chains available"})}):O?y.jsxs(y.Fragment,{children:[B,y.jsx(er,{currentActiveChain:O,chainList:e,onChainChange:M,curSelectToken:g,onTokenChange:F,walletType:"evm"}),y.jsx(df,{withdrawAmount:w,curSelectToken:g,curSelectTokenData:{balance:j==null?void 0:j.balance,allowance:j==null?void 0:j.allowance},currentActiveChain:O,currentEquity:c||0,amount:w,decimals:(j==null?void 0:j.decimals)||6,tokenBalance:z,platformBalance:a,walletType:S,receiverAddress:x,onWithdrawAmountChange:E,onReceiverAddressChange:C}),y.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${U.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:T,disabled:U.disabled,children:U.text})]}):y.jsx("div",{className:"text-center py-8",children:y.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Ri=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=or,smartWallet:o=ir,chains:s,defaultChainId:c,defaultTokenAddress:a,defaultAmount:i="",metadata:l=sr,currentEquity:u=5e3,platformBalance:p="0",wagmiHooks:m,onWithdraw:d,onChainChange:h,onTokenChange:g})=>{const b=f.useMemo(()=>{var w;return r?yr(r,o,!1,(w=s[0])==null?void 0:w.chainId,"0","0"):null},[r,o,s]);return e?de.createPortal(y.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:y.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:y.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:w=>{w.stopPropagation()},children:[y.jsxs("div",{className:"flex items-center justify-between mb-4",children:[y.jsx("h2",{className:"text-lg font-semibold text-white",children:"Withdraw"}),y.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:y.jsx(br,{className:"h-4 w-4"})})]}),y.jsx(pf,{chains:s,defaultChainId:c,defaultTokenAddress:a,defaultAmount:i,walletAdapter:b,metadata:l,currentEquity:u,platformBalance:p,wagmiHooks:m,onWithdraw:d,onClose:t,onChainChange:h,onTokenChange:g})]})})}),document.body):null},mf=[],hf={};let De=null;const Wi=f.forwardRef((e,t)=>{const[n,r]=f.useState(!1),[o,s]=f.useState({chains:[]}),c=f.useCallback(u=>{s(u||{chains:[]}),r(!0)},[]),a=f.useCallback(u=>{s(p=>({...p,...u}))},[]),i=f.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=f.useCallback(()=>n,[n]);return f.useImperativeHandle(t,()=>({openWithdraw:c,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l}),[c,i,a,l]),f.useEffect(()=>(De={openWithdraw:c,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l},()=>{De=null}),[c,i,a,l]),y.jsx(Ri,{isOpen:n,onClose:i,config:o.config||{symbol:"USDT"},currentActiveAccount:o.currentActiveAccount,smartWallet:o.smartWallet,chains:o.chains||mf,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||hf,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,onWithdraw:o.onWithdraw,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Wi.displayName="WithdrawManager";const Bi=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.openWithdraw(e||{chains:[]})},Vi=()=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.closeWithdraw()},Ui=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.updateWithdrawOptions(e)},gf=()=>De?De.isOpen():!1,vf=()=>({openWithdraw:Bi,closeWithdraw:Vi,updateWithdrawOptions:Ui,isOpen:gf});Z.ComponentProvider=us,Z.Deposit=Ii,Z.DepositManager=ji,Z.Withdraw=Ri,Z.WithdrawManager=Wi,Z.closeDeposit=_i,Z.closeWithdraw=Vi,Z.openDeposit=Di,Z.openWithdraw=Bi,Z.updateDepositOptions=ki,Z.updateWithdrawOptions=Ui,Z.useDeposit=cs,Z.useDepositManager=cf,Z.useWithdraw=fs,Z.useWithdrawManager=vf,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
|
|
103
|
+
*/var Qf={L:$t.QrCode.Ecc.LOW,M:$t.QrCode.Ecc.MEDIUM,Q:$t.QrCode.Ecc.QUARTILE,H:$t.QrCode.Ecc.HIGH},ts=128,ns="L",rs="#FFFFFF",os="#000000",is=!1,ss=1,Xf=4,Jf=0,Zf=.1;function ls(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(u,a){if(!u&&s!==null){n.push(`M${s+t} ${o+t}h${a-s}v1H${s+t}z`),s=null;return}if(a===r.length-1){if(!u)return;s===null?n.push(`M${a+t},${o+t} h1v1H${a+t}z`):n.push(`M${s+t},${o+t} h${a+1-s}v1H${s+t}z`);return}u&&s===null&&(s=a)})}),n.join("")}function as(e,t){return e.slice().map((n,r)=>r<t.y||r>=t.y+t.h?n:n.map((o,s)=>s<t.x||s>=t.x+t.w?o:!1))}function ed(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Zf),u=o/t,a=(r.width||s)*u,i=(r.height||s)*u,l=r.x==null?e.length/2-a/2:r.x*u,c=r.y==null?e.length/2-i/2:r.y*u,p=r.opacity==null?1:r.opacity;let m=null;if(r.excavate){let b=Math.floor(l),y=Math.floor(c),N=Math.ceil(a+l-b),I=Math.ceil(i+c-y);m={x:b,y,w:N,h:I}}const f=r.crossOrigin;return{x:l,y:c,h:i,w:a,excavation:m,opacity:p,crossOrigin:f}}function td(e,t){return t!=null?Math.max(Math.floor(t),0):e?Xf:Jf}function us({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:u,boostLevel:a}){let i=d.useMemo(()=>{const b=(Array.isArray(e)?e:[e]).reduce((y,N)=>(y.push(...$t.QrSegment.makeSegments(N)),y),[]);return $t.QrCode.encodeSegments(b,Qf[t],n,void 0,void 0,a)},[e,t,n,a]);const{cells:l,margin:c,numCells:p,calculatedImageSettings:m}=d.useMemo(()=>{let f=i.getModules();const b=td(r,o),y=f.length+b*2,N=ed(f,u,b,s);return{cells:f,margin:b,numCells:y,calculatedImageSettings:N}},[i,u,s,r,o]);return{qrcode:i,margin:c,cells:l,numCells:p,calculatedImageSettings:m}}var nd=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),rd=d.forwardRef(function(t,n){const r=t,{value:o,size:s=ts,level:u=ns,bgColor:a=rs,fgColor:i=os,includeMargin:l=is,minVersion:c=ss,boostLevel:p,marginSize:m,imageSettings:f}=r,y=Mr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:N}=y,I=Mr(y,["style"]),w=f==null?void 0:f.src,T=d.useRef(null),j=d.useRef(null),_=d.useCallback(P=>{T.current=P,typeof n=="function"?n(P):n&&(n.current=P)},[n]),[B,W]=d.useState(!1),{margin:h,cells:v,numCells:g,calculatedImageSettings:x}=us({value:o,level:u,minVersion:c,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:f,size:s});d.useEffect(()=>{if(T.current!=null){const P=T.current,S=P.getContext("2d");if(!S)return;let $=v;const L=j.current,E=x!=null&&L!==null&&L.complete&&L.naturalHeight!==0&&L.naturalWidth!==0;E&&x.excavation!=null&&($=as(v,x.excavation));const D=window.devicePixelRatio||1;P.height=P.width=s*D;const F=s/g*D;S.scale(F,F),S.fillStyle=a,S.fillRect(0,0,g,g),S.fillStyle=i,nd?S.fill(new Path2D(ls($,h))):v.forEach(function(R,U){R.forEach(function(G,ee){G&&S.fillRect(ee+h,U+h,1,1)})}),x&&(S.globalAlpha=x.opacity),E&&S.drawImage(L,x.x+h,x.y+h,x.w,x.h)}}),d.useEffect(()=>{W(!1)},[w]);const C=Pr({height:s,width:s},N);let A=null;return w!=null&&(A=d.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{W(!0)},ref:j,crossOrigin:x==null?void 0:x.crossOrigin})),d.createElement(d.Fragment,null,d.createElement("canvas",Pr({style:C,height:s,width:s,ref:_,role:"img"},I)),A)});rd.displayName="QRCodeCanvas";var cs=d.forwardRef(function(t,n){const r=t,{value:o,size:s=ts,level:u=ns,bgColor:a=rs,fgColor:i=os,includeMargin:l=is,minVersion:c=ss,boostLevel:p,title:m,marginSize:f,imageSettings:b}=r,y=Mr(r,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:N,cells:I,numCells:w,calculatedImageSettings:T}=us({value:o,level:u,minVersion:c,boostLevel:p,includeMargin:l,marginSize:f,imageSettings:b,size:s});let j=I,_=null;b!=null&&T!=null&&(T.excavation!=null&&(j=as(I,T.excavation)),_=d.createElement("image",{href:b.src,height:T.h,width:T.w,x:T.x+N,y:T.y+N,preserveAspectRatio:"none",opacity:T.opacity,crossOrigin:T.crossOrigin}));const B=ls(j,N);return d.createElement("svg",Pr({height:s,width:s,viewBox:`0 0 ${w} ${w}`,ref:n,role:"img"},y),!!m&&d.createElement("title",null,m),d.createElement("path",{fill:a,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),d.createElement("path",{fill:i,d:B,shapeRendering:"crispEdges"}),_)});cs.displayName="QRCodeSVG";const fs="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAIcSURBVHgBxZc/T8JAGMafA4mDEXFw0DiQmDi4CP5JHGFx0qizg8QvIHwCZHYAvwEm7mji5CJuJv7DxcWYYMLmIEYXY/R8j6tQaBvuaCm/pOlbSu99+rZ97zlgwDBowvNLCdrF6NJ50891OvNC+wrL3JShgZIAnl+JAj97FKXoMNLl7ySGnQDBHMtcVeFGAM8nKNlnlsI0eoIVuwlhzsmXqcwoURSFK1iVRCSdRDDn5PwC3cutingsJOK60nkiYE0unrdi8uFRIDwFBSJiTKOqzgKMl00teXgS2D0Fto+BiVkoIMYs8Xws4iiAkmeVn/n0oqyA2NQEQI4dytoKMEqfQt/haZmrQ4C8e7/4TtsI4JvwDbYDswCjvXr1yakQMXI2KxCD/8RMAtx2ux5gcjIzBAT8LH8bAQwYbwR8fUAb/vtuEsAr0OX5Eng8o30ZqN1BHzFLAkPGkb4AcdfnObigkbM5HdN3+Qb/ekGdrNu4CMyd8Ag6iElo/QBYzcpYByYsm8QkIFSADmI2nEkAc2sUL0ALHsxZBEjLxA+hSu22tb0+KV9Gd18027M2SybNQui+f53R6g/b+gDLVMi7YQsND+c5dTtzamlE0jiyJLwVYZhSqzO27YRSxFD8v1m4Q4xh74gdBUgRQm2QKsH0Ps82xEs9EndK3sgDlWGkW96naANqSzMSHSy4XprZi2kuTqN09VjrBH9AD4vTgfMHJt+rxIFF7EgAAAAASUVORK5CYII=",od=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,onCopy:o})=>{var u;const s=d.useMemo(()=>Nf(n||{}),[n]);return M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"flex justify-center mt-4 mb-3",children:M.jsx("div",{className:"bg-white rounded-lg",children:M.jsx(cs,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),M.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[M.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),M.jsx(Kf,{onCopy:()=>{const a=(e==null?void 0:e.getDisplayAddress())||"";o&&o(a)},text:e==null?void 0:e.getDisplayAddress(),children:M.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[M.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),M.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})},"copy")]}),M.jsxs("div",{className:"border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsxs("div",{className:"flex items-start",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:fs,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1",children:M.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]})})]}),s&&M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"my-2 ml-5 h-[1px] border-b border-dashed border-line-divider-secondary"}),M.jsx("div",{className:"flex items-start pl-5 text-functional-orange-1 text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."})]})]}),M.jsxs("div",{className:"text-sm",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[M.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),M.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["≈"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((u=r==null?void 0:r.multiChain)==null?void 0:u.minDeposit)||10," ",t]})]}),M.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[M.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),M.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},id=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onCopy:u,onClose:a})=>{var b;const[i,l]=d.useState(()=>{var y;return!e||e.length===0?1:t||((y=e[0])==null?void 0:y.chainId)||1}),[c,p]=d.useState(()=>{var w;if(!e||e.length===0)return"";const y=t||((w=e[0])==null?void 0:w.chainId),N=e.find(T=>T.chainId===y);if(!N||!N.tokenList||N.tokenList.length===0)return"";const I=N.tokenList.find(T=>T.tokenAddress===n)||N.tokenList[0];return(I==null?void 0:I.token)||""}),m=e&&e.length>0?e.find(y=>y.chainId===i)||e[0]:null,f=(b=m==null?void 0:m.tokenList)==null?void 0:b.find(y=>y.token===c);return!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):m?M.jsxs(M.Fragment,{children:[M.jsx(wr,{currentActiveChain:m,chainList:e,onChainChange:l,curSelectToken:c,onTokenChange:p,walletType:"mpc"}),M.jsx(od,{walletAdapter:r,curSelectToken:c,currentActiveChain:m,metadata:o,onCopy:u}),M.jsx("button",{className:"w-full h-[38px] bg-fill-btn-primary rounded-xl text-sm font-medium text-text-on-sec-btn mt-4",onClick:()=>{s&&s({amount:"",chainId:i,tokenAddress:(f==null?void 0:f.tokenAddress)||"",tokenSymbol:c}),a()},children:"Deposit"})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})};var sd=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Lr=Math.ceil,Ie=Math.floor,Ce="[BigNumber Error] ",ds=Ce+"Number primitive has more than 15 significant digits: ",Ve=1e14,K=14,Ir=9007199254740991,Dr=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],ut=1e7,ge=1e9;function ps(e){var t,n,r,o=w.prototype={constructor:w,toString:null,valueOf:null},s=new w(1),u=20,a=4,i=-7,l=21,c=-1e7,p=1e7,m=!1,f=1,b=0,y={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},N="0123456789abcdefghijklmnopqrstuvwxyz",I=!0;function w(h,v){var g,x,C,A,P,S,$,L,E=this;if(!(E instanceof w))return new w(h,v);if(v==null){if(h&&h._isBigNumber===!0){E.s=h.s,!h.c||h.e>p?E.c=E.e=null:h.e<c?E.c=[E.e=0]:(E.e=h.e,E.c=h.c.slice());return}if((S=typeof h=="number")&&h*0==0){if(E.s=1/h<0?(h=-h,-1):1,h===~~h){for(A=0,P=h;P>=10;P/=10,A++);A>p?E.c=E.e=null:(E.e=A,E.c=[h]);return}L=String(h)}else{if(!sd.test(L=String(h)))return r(E,L,S);E.s=L.charCodeAt(0)==45?(L=L.slice(1),-1):1}(A=L.indexOf("."))>-1&&(L=L.replace(".","")),(P=L.search(/e/i))>0?(A<0&&(A=P),A+=+L.slice(P+1),L=L.substring(0,P)):A<0&&(A=L.length)}else{if(ue(v,2,N.length,"Base"),v==10&&I)return E=new w(h),B(E,u+E.e+1,a);if(L=String(h),S=typeof h=="number"){if(h*0!=0)return r(E,L,S,v);if(E.s=1/h<0?(L=L.slice(1),-1):1,w.DEBUG&&L.replace(/^0\.0*|\./,"").length>15)throw Error(ds+h)}else E.s=L.charCodeAt(0)===45?(L=L.slice(1),-1):1;for(g=N.slice(0,v),A=P=0,$=L.length;P<$;P++)if(g.indexOf(x=L.charAt(P))<0){if(x=="."){if(P>A){A=$;continue}}else if(!C&&(L==L.toUpperCase()&&(L=L.toLowerCase())||L==L.toLowerCase()&&(L=L.toUpperCase()))){C=!0,P=-1,A=0;continue}return r(E,String(h),S,v)}S=!1,L=n(L,v,10,E.s),(A=L.indexOf("."))>-1?L=L.replace(".",""):A=L.length}for(P=0;L.charCodeAt(P)===48;P++);for($=L.length;L.charCodeAt(--$)===48;);if(L=L.slice(P,++$)){if($-=P,S&&w.DEBUG&&$>15&&(h>Ir||h!==Ie(h)))throw Error(ds+E.s*h);if((A=A-P-1)>p)E.c=E.e=null;else if(A<c)E.c=[E.e=0];else{if(E.e=A,E.c=[],P=(A+1)%K,A<0&&(P+=K),P<$){for(P&&E.c.push(+L.slice(0,P)),$-=K;P<$;)E.c.push(+L.slice(P,P+=K));P=K-(L=L.slice(P)).length}else P-=$;for(;P--;L+="0");E.c.push(+L)}}else E.c=[E.e=0]}w.clone=ps,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(h){var v,g;if(h!=null)if(typeof h=="object"){if(h.hasOwnProperty(v="DECIMAL_PLACES")&&(g=h[v],ue(g,0,ge,v),u=g),h.hasOwnProperty(v="ROUNDING_MODE")&&(g=h[v],ue(g,0,8,v),a=g),h.hasOwnProperty(v="EXPONENTIAL_AT")&&(g=h[v],g&&g.pop?(ue(g[0],-ge,0,v),ue(g[1],0,ge,v),i=g[0],l=g[1]):(ue(g,-ge,ge,v),i=-(l=g<0?-g:g))),h.hasOwnProperty(v="RANGE"))if(g=h[v],g&&g.pop)ue(g[0],-ge,-1,v),ue(g[1],1,ge,v),c=g[0],p=g[1];else if(ue(g,-ge,ge,v),g)c=-(p=g<0?-g:g);else throw Error(Ce+v+" cannot be zero: "+g);if(h.hasOwnProperty(v="CRYPTO"))if(g=h[v],g===!!g)if(g)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=g;else throw m=!g,Error(Ce+"crypto unavailable");else m=g;else throw Error(Ce+v+" not true or false: "+g);if(h.hasOwnProperty(v="MODULO_MODE")&&(g=h[v],ue(g,0,9,v),f=g),h.hasOwnProperty(v="POW_PRECISION")&&(g=h[v],ue(g,0,ge,v),b=g),h.hasOwnProperty(v="FORMAT"))if(g=h[v],typeof g=="object")y=g;else throw Error(Ce+v+" not an object: "+g);if(h.hasOwnProperty(v="ALPHABET"))if(g=h[v],typeof g=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(g))I=g.slice(0,10)=="0123456789",N=g;else throw Error(Ce+v+" invalid: "+g)}else throw Error(Ce+"Object expected: "+h);return{DECIMAL_PLACES:u,ROUNDING_MODE:a,EXPONENTIAL_AT:[i,l],RANGE:[c,p],CRYPTO:m,MODULO_MODE:f,POW_PRECISION:b,FORMAT:y,ALPHABET:N}},w.isBigNumber=function(h){if(!h||h._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var v,g,x=h.c,C=h.e,A=h.s;e:if({}.toString.call(x)=="[object Array]"){if((A===1||A===-1)&&C>=-ge&&C<=ge&&C===Ie(C)){if(x[0]===0){if(C===0&&x.length===1)return!0;break e}if(v=(C+1)%K,v<1&&(v+=K),String(x[0]).length==v){for(v=0;v<x.length;v++)if(g=x[v],g<0||g>=Ve||g!==Ie(g))break e;if(g!==0)return!0}}}else if(x===null&&C===null&&(A===null||A===1||A===-1))return!0;throw Error(Ce+"Invalid BigNumber: "+h)},w.maximum=w.max=function(){return j(arguments,-1)},w.minimum=w.min=function(){return j(arguments,1)},w.random=function(){var h=9007199254740992,v=Math.random()*h&2097151?function(){return Ie(Math.random()*h)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(g){var x,C,A,P,S,$=0,L=[],E=new w(s);if(g==null?g=u:ue(g,0,ge),P=Lr(g/K),m)if(crypto.getRandomValues){for(x=crypto.getRandomValues(new Uint32Array(P*=2));$<P;)S=x[$]*131072+(x[$+1]>>>11),S>=9e15?(C=crypto.getRandomValues(new Uint32Array(2)),x[$]=C[0],x[$+1]=C[1]):(L.push(S%1e14),$+=2);$=P/2}else if(crypto.randomBytes){for(x=crypto.randomBytes(P*=7);$<P;)S=(x[$]&31)*281474976710656+x[$+1]*1099511627776+x[$+2]*4294967296+x[$+3]*16777216+(x[$+4]<<16)+(x[$+5]<<8)+x[$+6],S>=9e15?crypto.randomBytes(7).copy(x,$):(L.push(S%1e14),$+=7);$=P/7}else throw m=!1,Error(Ce+"crypto unavailable");if(!m)for(;$<P;)S=v(),S<9e15&&(L[$++]=S%1e14);for(P=L[--$],g%=K,P&&g&&(S=Dr[K-g],L[$]=Ie(P/S)*S);L[$]===0;L.pop(),$--);if($<0)L=[A=0];else{for(A=-1;L[0]===0;L.splice(0,1),A-=K);for($=1,S=L[0];S>=10;S/=10,$++);$<K&&(A-=K-$)}return E.e=A,E.c=L,E}}(),w.sum=function(){for(var h=1,v=arguments,g=new w(v[0]);h<v.length;)g=g.plus(v[h++]);return g},n=function(){var h="0123456789";function v(g,x,C,A){for(var P,S=[0],$,L=0,E=g.length;L<E;){for($=S.length;$--;S[$]*=x);for(S[0]+=A.indexOf(g.charAt(L++)),P=0;P<S.length;P++)S[P]>C-1&&(S[P+1]==null&&(S[P+1]=0),S[P+1]+=S[P]/C|0,S[P]%=C)}return S.reverse()}return function(g,x,C,A,P){var S,$,L,E,D,F,R,U,G=g.indexOf("."),ee=u,q=a;for(G>=0&&(E=b,b=0,g=g.replace(".",""),U=new w(x),F=U.pow(g.length-G),b=E,U.c=v(tt(Fe(F.c),F.e,"0"),10,C,h),U.e=U.c.length),R=v(g,x,C,P?(S=N,h):(S=h,N)),L=E=R.length;R[--E]==0;R.pop());if(!R[0])return S.charAt(0);if(G<0?--L:(F.c=R,F.e=L,F.s=A,F=t(F,U,ee,q,C),R=F.c,D=F.r,L=F.e),$=L+ee+1,G=R[$],E=C/2,D=D||$<0||R[$+1]!=null,D=q<4?(G!=null||D)&&(q==0||q==(F.s<0?3:2)):G>E||G==E&&(q==4||D||q==6&&R[$-1]&1||q==(F.s<0?8:7)),$<1||!R[0])g=D?tt(S.charAt(1),-ee,S.charAt(0)):S.charAt(0);else{if(R.length=$,D)for(--C;++R[--$]>C;)R[$]=0,$||(++L,R=[1].concat(R));for(E=R.length;!R[--E];);for(G=0,g="";G<=E;g+=S.charAt(R[G++]));g=tt(g,L,S.charAt(0))}return g}}(),t=function(){function h(x,C,A){var P,S,$,L,E=0,D=x.length,F=C%ut,R=C/ut|0;for(x=x.slice();D--;)$=x[D]%ut,L=x[D]/ut|0,P=R*$+L*F,S=F*$+P%ut*ut+E,E=(S/A|0)+(P/ut|0)+R*L,x[D]=S%A;return E&&(x=[E].concat(x)),x}function v(x,C,A,P){var S,$;if(A!=P)$=A>P?1:-1;else for(S=$=0;S<A;S++)if(x[S]!=C[S]){$=x[S]>C[S]?1:-1;break}return $}function g(x,C,A,P){for(var S=0;A--;)x[A]-=S,S=x[A]<C[A]?1:0,x[A]=S*P+x[A]-C[A];for(;!x[0]&&x.length>1;x.splice(0,1));}return function(x,C,A,P,S){var $,L,E,D,F,R,U,G,ee,q,X,z,re,de,_e,je,ct,Se=x.s==C.s?1:-1,ve=x.c,ie=C.c;if(!ve||!ve[0]||!ie||!ie[0])return new w(!x.s||!C.s||(ve?ie&&ve[0]==ie[0]:!ie)?NaN:ve&&ve[0]==0||!ie?Se*0:Se/0);for(G=new w(Se),ee=G.c=[],L=x.e-C.e,Se=A+L+1,S||(S=Ve,L=De(x.e/K)-De(C.e/K),Se=Se/K|0),E=0;ie[E]==(ve[E]||0);E++);if(ie[E]>(ve[E]||0)&&L--,Se<0)ee.push(1),D=!0;else{for(de=ve.length,je=ie.length,E=0,Se+=2,F=Ie(S/(ie[0]+1)),F>1&&(ie=h(ie,F,S),ve=h(ve,F,S),je=ie.length,de=ve.length),re=je,q=ve.slice(0,je),X=q.length;X<je;q[X++]=0);ct=ie.slice(),ct=[0].concat(ct),_e=ie[0],ie[1]>=S/2&&_e++;do{if(F=0,$=v(ie,q,je,X),$<0){if(z=q[0],je!=X&&(z=z*S+(q[1]||0)),F=Ie(z/_e),F>1)for(F>=S&&(F=S-1),R=h(ie,F,S),U=R.length,X=q.length;v(R,q,U,X)==1;)F--,g(R,je<U?ct:ie,U,S),U=R.length,$=1;else F==0&&($=F=1),R=ie.slice(),U=R.length;if(U<X&&(R=[0].concat(R)),g(q,R,X,S),X=q.length,$==-1)for(;v(ie,q,je,X)<1;)F++,g(q,je<X?ct:ie,X,S),X=q.length}else $===0&&(F++,q=[0]);ee[E++]=F,q[0]?q[X++]=ve[re]||0:(q=[ve[re]],X=1)}while((re++<de||q[0]!=null)&&Se--);D=q[0]!=null,ee[0]||ee.splice(0,1)}if(S==Ve){for(E=1,Se=ee[0];Se>=10;Se/=10,E++);B(G,A+(G.e=E+L*K-1)+1,P,D)}else G.e=L,G.r=+D;return G}}();function T(h,v,g,x){var C,A,P,S,$;if(g==null?g=a:ue(g,0,8),!h.c)return h.toString();if(C=h.c[0],P=h.e,v==null)$=Fe(h.c),$=x==1||x==2&&(P<=i||P>=l)?Sn($,P):tt($,P,"0");else if(h=B(new w(h),v,g),A=h.e,$=Fe(h.c),S=$.length,x==1||x==2&&(v<=A||A<=i)){for(;S<v;$+="0",S++);$=Sn($,A)}else if(v-=P+(x===2&&A>P),$=tt($,A,"0"),A+1>S){if(--v>0)for($+=".";v--;$+="0");}else if(v+=A-S,v>0)for(A+1==S&&($+=".");v--;$+="0");return h.s<0&&C?"-"+$:$}function j(h,v){for(var g,x,C=1,A=new w(h[0]);C<h.length;C++)x=new w(h[C]),(!x.s||(g=bt(A,x))===v||g===0&&A.s===v)&&(A=x);return A}function _(h,v,g){for(var x=1,C=v.length;!v[--C];v.pop());for(C=v[0];C>=10;C/=10,x++);return(g=x+g*K-1)>p?h.c=h.e=null:g<c?h.c=[h.e=0]:(h.e=g,h.c=v),h}r=function(){var h=/^(-?)0([xbo])(?=\w[\w.]*$)/i,v=/^([^.]+)\.$/,g=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(A,P,S,$){var L,E=S?P:P.replace(C,"");if(x.test(E))A.s=isNaN(E)?null:E<0?-1:1;else{if(!S&&(E=E.replace(h,function(D,F,R){return L=(R=R.toLowerCase())=="x"?16:R=="b"?2:8,!$||$==L?F:D}),$&&(L=$,E=E.replace(v,"$1").replace(g,"0.$1")),P!=E))return new w(E,L);if(w.DEBUG)throw Error(Ce+"Not a"+($?" base "+$:"")+" number: "+P);A.s=null}A.c=A.e=null}}();function B(h,v,g,x){var C,A,P,S,$,L,E,D=h.c,F=Dr;if(D){e:{for(C=1,S=D[0];S>=10;S/=10,C++);if(A=v-C,A<0)A+=K,P=v,$=D[L=0],E=Ie($/F[C-P-1]%10);else if(L=Lr((A+1)/K),L>=D.length)if(x){for(;D.length<=L;D.push(0));$=E=0,C=1,A%=K,P=A-K+1}else break e;else{for($=S=D[L],C=1;S>=10;S/=10,C++);A%=K,P=A-K+C,E=P<0?0:Ie($/F[C-P-1]%10)}if(x=x||v<0||D[L+1]!=null||(P<0?$:$%F[C-P-1]),x=g<4?(E||x)&&(g==0||g==(h.s<0?3:2)):E>5||E==5&&(g==4||x||g==6&&(A>0?P>0?$/F[C-P]:0:D[L-1])%10&1||g==(h.s<0?8:7)),v<1||!D[0])return D.length=0,x?(v-=h.e+1,D[0]=F[(K-v%K)%K],h.e=-v||0):D[0]=h.e=0,h;if(A==0?(D.length=L,S=1,L--):(D.length=L+1,S=F[K-A],D[L]=P>0?Ie($/F[C-P]%F[P])*S:0),x)for(;;)if(L==0){for(A=1,P=D[0];P>=10;P/=10,A++);for(P=D[0]+=S,S=1;P>=10;P/=10,S++);A!=S&&(h.e++,D[0]==Ve&&(D[0]=1));break}else{if(D[L]+=S,D[L]!=Ve)break;D[L--]=0,S=1}for(A=D.length;D[--A]===0;D.pop());}h.e>p?h.c=h.e=null:h.e<c&&(h.c=[h.e=0])}return h}function W(h){var v,g=h.e;return g===null?h.toString():(v=Fe(h.c),v=g<=i||g>=l?Sn(v,g):tt(v,g,"0"),h.s<0?"-"+v:v)}return o.absoluteValue=o.abs=function(){var h=new w(this);return h.s<0&&(h.s=1),h},o.comparedTo=function(h,v){return bt(this,new w(h,v))},o.decimalPlaces=o.dp=function(h,v){var g,x,C,A=this;if(h!=null)return ue(h,0,ge),v==null?v=a:ue(v,0,8),B(new w(A),h+A.e+1,v);if(!(g=A.c))return null;if(x=((C=g.length-1)-De(this.e/K))*K,C=g[C])for(;C%10==0;C/=10,x--);return x<0&&(x=0),x},o.dividedBy=o.div=function(h,v){return t(this,new w(h,v),u,a)},o.dividedToIntegerBy=o.idiv=function(h,v){return t(this,new w(h,v),0,1)},o.exponentiatedBy=o.pow=function(h,v){var g,x,C,A,P,S,$,L,E,D=this;if(h=new w(h),h.c&&!h.isInteger())throw Error(Ce+"Exponent not an integer: "+W(h));if(v!=null&&(v=new w(v)),S=h.e>14,!D.c||!D.c[0]||D.c[0]==1&&!D.e&&D.c.length==1||!h.c||!h.c[0])return E=new w(Math.pow(+W(D),S?h.s*(2-Cn(h)):+W(h))),v?E.mod(v):E;if($=h.s<0,v){if(v.c?!v.c[0]:!v.s)return new w(NaN);x=!$&&D.isInteger()&&v.isInteger(),x&&(D=D.mod(v))}else{if(h.e>9&&(D.e>0||D.e<-1||(D.e==0?D.c[0]>1||S&&D.c[1]>=24e7:D.c[0]<8e13||S&&D.c[0]<=9999975e7)))return A=D.s<0&&Cn(h)?-0:0,D.e>-1&&(A=1/A),new w($?1/A:A);b&&(A=Lr(b/K+2))}for(S?(g=new w(.5),$&&(h.s=1),L=Cn(h)):(C=Math.abs(+W(h)),L=C%2),E=new w(s);;){if(L){if(E=E.times(D),!E.c)break;A?E.c.length>A&&(E.c.length=A):x&&(E=E.mod(v))}if(C){if(C=Ie(C/2),C===0)break;L=C%2}else if(h=h.times(g),B(h,h.e+1,1),h.e>14)L=Cn(h);else{if(C=+W(h),C===0)break;L=C%2}D=D.times(D),A?D.c&&D.c.length>A&&(D.c.length=A):x&&(D=D.mod(v))}return x?E:($&&(E=s.div(E)),v?E.mod(v):A?B(E,b,a,P):E)},o.integerValue=function(h){var v=new w(this);return h==null?h=a:ue(h,0,8),B(v,v.e+1,h)},o.isEqualTo=o.eq=function(h,v){return bt(this,new w(h,v))===0},o.isFinite=function(){return!!this.c},o.isGreaterThan=o.gt=function(h,v){return bt(this,new w(h,v))>0},o.isGreaterThanOrEqualTo=o.gte=function(h,v){return(v=bt(this,new w(h,v)))===1||v===0},o.isInteger=function(){return!!this.c&&De(this.e/K)>this.c.length-2},o.isLessThan=o.lt=function(h,v){return bt(this,new w(h,v))<0},o.isLessThanOrEqualTo=o.lte=function(h,v){return(v=bt(this,new w(h,v)))===-1||v===0},o.isNaN=function(){return!this.s},o.isNegative=function(){return this.s<0},o.isPositive=function(){return this.s>0},o.isZero=function(){return!!this.c&&this.c[0]==0},o.minus=function(h,v){var g,x,C,A,P=this,S=P.s;if(h=new w(h,v),v=h.s,!S||!v)return new w(NaN);if(S!=v)return h.s=-v,P.plus(h);var $=P.e/K,L=h.e/K,E=P.c,D=h.c;if(!$||!L){if(!E||!D)return E?(h.s=-v,h):new w(D?P:NaN);if(!E[0]||!D[0])return D[0]?(h.s=-v,h):new w(E[0]?P:a==3?-0:0)}if($=De($),L=De(L),E=E.slice(),S=$-L){for((A=S<0)?(S=-S,C=E):(L=$,C=D),C.reverse(),v=S;v--;C.push(0));C.reverse()}else for(x=(A=(S=E.length)<(v=D.length))?S:v,S=v=0;v<x;v++)if(E[v]!=D[v]){A=E[v]<D[v];break}if(A&&(C=E,E=D,D=C,h.s=-h.s),v=(x=D.length)-(g=E.length),v>0)for(;v--;E[g++]=0);for(v=Ve-1;x>S;){if(E[--x]<D[x]){for(g=x;g&&!E[--g];E[g]=v);--E[g],E[x]+=Ve}E[x]-=D[x]}for(;E[0]==0;E.splice(0,1),--L);return E[0]?_(h,E,L):(h.s=a==3?-1:1,h.c=[h.e=0],h)},o.modulo=o.mod=function(h,v){var g,x,C=this;return h=new w(h,v),!C.c||!h.s||h.c&&!h.c[0]?new w(NaN):!h.c||C.c&&!C.c[0]?new w(C):(f==9?(x=h.s,h.s=1,g=t(C,h,0,3),h.s=x,g.s*=x):g=t(C,h,0,f),h=C.minus(g.times(h)),!h.c[0]&&f==1&&(h.s=C.s),h)},o.multipliedBy=o.times=function(h,v){var g,x,C,A,P,S,$,L,E,D,F,R,U,G,ee,q=this,X=q.c,z=(h=new w(h,v)).c;if(!X||!z||!X[0]||!z[0])return!q.s||!h.s||X&&!X[0]&&!z||z&&!z[0]&&!X?h.c=h.e=h.s=null:(h.s*=q.s,!X||!z?h.c=h.e=null:(h.c=[0],h.e=0)),h;for(x=De(q.e/K)+De(h.e/K),h.s*=q.s,$=X.length,D=z.length,$<D&&(U=X,X=z,z=U,C=$,$=D,D=C),C=$+D,U=[];C--;U.push(0));for(G=Ve,ee=ut,C=D;--C>=0;){for(g=0,F=z[C]%ee,R=z[C]/ee|0,P=$,A=C+P;A>C;)L=X[--P]%ee,E=X[P]/ee|0,S=R*L+E*F,L=F*L+S%ee*ee+U[A]+g,g=(L/G|0)+(S/ee|0)+R*E,U[A--]=L%G;U[A]=g}return g?++x:U.splice(0,1),_(h,U,x)},o.negated=function(){var h=new w(this);return h.s=-h.s||null,h},o.plus=function(h,v){var g,x=this,C=x.s;if(h=new w(h,v),v=h.s,!C||!v)return new w(NaN);if(C!=v)return h.s=-v,x.minus(h);var A=x.e/K,P=h.e/K,S=x.c,$=h.c;if(!A||!P){if(!S||!$)return new w(C/0);if(!S[0]||!$[0])return $[0]?h:new w(S[0]?x:C*0)}if(A=De(A),P=De(P),S=S.slice(),C=A-P){for(C>0?(P=A,g=$):(C=-C,g=S),g.reverse();C--;g.push(0));g.reverse()}for(C=S.length,v=$.length,C-v<0&&(g=$,$=S,S=g,v=C),C=0;v;)C=(S[--v]=S[v]+$[v]+C)/Ve|0,S[v]=Ve===S[v]?0:S[v]%Ve;return C&&(S=[C].concat(S),++P),_(h,S,P)},o.precision=o.sd=function(h,v){var g,x,C,A=this;if(h!=null&&h!==!!h)return ue(h,1,ge),v==null?v=a:ue(v,0,8),B(new w(A),h,v);if(!(g=A.c))return null;if(C=g.length-1,x=C*K+1,C=g[C]){for(;C%10==0;C/=10,x--);for(C=g[0];C>=10;C/=10,x++);}return h&&A.e+1>x&&(x=A.e+1),x},o.shiftedBy=function(h){return ue(h,-Ir,Ir),this.times("1e"+h)},o.squareRoot=o.sqrt=function(){var h,v,g,x,C,A=this,P=A.c,S=A.s,$=A.e,L=u+4,E=new w("0.5");if(S!==1||!P||!P[0])return new w(!S||S<0&&(!P||P[0])?NaN:P?A:1/0);if(S=Math.sqrt(+W(A)),S==0||S==1/0?(v=Fe(P),(v.length+$)%2==0&&(v+="0"),S=Math.sqrt(+v),$=De(($+1)/2)-($<0||$%2),S==1/0?v="5e"+$:(v=S.toExponential(),v=v.slice(0,v.indexOf("e")+1)+$),g=new w(v)):g=new w(S+""),g.c[0]){for($=g.e,S=$+L,S<3&&(S=0);;)if(C=g,g=E.times(C.plus(t(A,C,L,1))),Fe(C.c).slice(0,S)===(v=Fe(g.c)).slice(0,S))if(g.e<$&&--S,v=v.slice(S-3,S+1),v=="9999"||!x&&v=="4999"){if(!x&&(B(C,C.e+u+2,0),C.times(C).eq(A))){g=C;break}L+=4,S+=4,x=1}else{(!+v||!+v.slice(1)&&v.charAt(0)=="5")&&(B(g,g.e+u+2,1),h=!g.times(g).eq(A));break}}return B(g,g.e+u+1,a,h)},o.toExponential=function(h,v){return h!=null&&(ue(h,0,ge),h++),T(this,h,v,1)},o.toFixed=function(h,v){return h!=null&&(ue(h,0,ge),h=h+this.e+1),T(this,h,v)},o.toFormat=function(h,v,g){var x,C=this;if(g==null)h!=null&&v&&typeof v=="object"?(g=v,v=null):h&&typeof h=="object"?(g=h,h=v=null):g=y;else if(typeof g!="object")throw Error(Ce+"Argument not an object: "+g);if(x=C.toFixed(h,v),C.c){var A,P=x.split("."),S=+g.groupSize,$=+g.secondaryGroupSize,L=g.groupSeparator||"",E=P[0],D=P[1],F=C.s<0,R=F?E.slice(1):E,U=R.length;if($&&(A=S,S=$,$=A,U-=A),S>0&&U>0){for(A=U%S||S,E=R.substr(0,A);A<U;A+=S)E+=L+R.substr(A,S);$>0&&(E+=L+R.slice(A)),F&&(E="-"+E)}x=D?E+(g.decimalSeparator||"")+(($=+g.fractionGroupSize)?D.replace(new RegExp("\\d{"+$+"}\\B","g"),"$&"+(g.fractionGroupSeparator||"")):D):E}return(g.prefix||"")+x+(g.suffix||"")},o.toFraction=function(h){var v,g,x,C,A,P,S,$,L,E,D,F,R=this,U=R.c;if(h!=null&&(S=new w(h),!S.isInteger()&&(S.c||S.s!==1)||S.lt(s)))throw Error(Ce+"Argument "+(S.isInteger()?"out of range: ":"not an integer: ")+W(S));if(!U)return new w(R);for(v=new w(s),L=g=new w(s),x=$=new w(s),F=Fe(U),A=v.e=F.length-R.e-1,v.c[0]=Dr[(P=A%K)<0?K+P:P],h=!h||S.comparedTo(v)>0?A>0?v:L:S,P=p,p=1/0,S=new w(F),$.c[0]=0;E=t(S,v,0,1),C=g.plus(E.times(x)),C.comparedTo(h)!=1;)g=x,x=C,L=$.plus(E.times(C=L)),$=C,v=S.minus(E.times(C=v)),S=C;return C=t(h.minus(g),x,0,1),$=$.plus(C.times(L)),g=g.plus(C.times(x)),$.s=L.s=R.s,A=A*2,D=t(L,x,A,a).minus(R).abs().comparedTo(t($,g,A,a).minus(R).abs())<1?[L,x]:[$,g],p=P,D},o.toNumber=function(){return+W(this)},o.toPrecision=function(h,v){return h!=null&&ue(h,1,ge),T(this,h,v,2)},o.toString=function(h){var v,g=this,x=g.s,C=g.e;return C===null?x?(v="Infinity",x<0&&(v="-"+v)):v="NaN":(h==null?v=C<=i||C>=l?Sn(Fe(g.c),C):tt(Fe(g.c),C,"0"):h===10&&I?(g=B(new w(g),u+C+1,a),v=tt(Fe(g.c),g.e,"0")):(ue(h,2,N.length,"Base"),v=n(tt(Fe(g.c),C,"0"),10,h,x,!0)),x<0&&g.c[0]&&(v="-"+v)),v},o.valueOf=o.toJSON=function(){return W(this)},o._isBigNumber=!0,o[Symbol.toStringTag]="BigNumber",o[Symbol.for("nodejs.util.inspect.custom")]=o.valueOf,e!=null&&w.set(e),w}function De(e){var t=e|0;return e>0||e===t?t:t-1}function Fe(e){for(var t,n,r=1,o=e.length,s=e[0]+"";r<o;){for(t=e[r++]+"",n=K-t.length;n--;t="0"+t);s+=t}for(o=s.length;s.charCodeAt(--o)===48;);return s.slice(0,o+1||1)}function bt(e,t){var n,r,o=e.c,s=t.c,u=e.s,a=t.s,i=e.e,l=t.e;if(!u||!a)return null;if(n=o&&!o[0],r=s&&!s[0],n||r)return n?r?0:-a:u;if(u!=a)return u;if(n=u<0,r=i==l,!o||!s)return r?0:!o^n?1:-1;if(!r)return i>l^n?1:-1;for(a=(i=o.length)<(l=s.length)?i:l,u=0;u<a;u++)if(o[u]!=s[u])return o[u]>s[u]^n?1:-1;return i==l?0:i>l^n?1:-1}function ue(e,t,n,r){if(e<t||e>n||e!==Ie(e))throw Error(Ce+(r||"Argument")+(typeof e=="number"?e<t||e>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Cn(e){var t=e.c.length-1;return De(e.e/K)==t&&e.c[t]%2!=0}function Sn(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function tt(e,t,n){var r,o;if(t<0){for(o=n+".";++t;o+=n);e=o+e}else if(r=e.length,++t>r){for(o=n,t-=r;--t;o+=n);e+=o}else t<r&&(e=e.slice(0,t)+"."+e.slice(t));return e}var hs=ps();const ld=Object.values({MAINNET:1,SEPOLIA:11155111}),On=e=>ld.includes(+e),ad=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:u,decimals:a,tokenBalance:i,platformBalance:l="0",onDepositAmountChange:c,onApprove:p})=>{const m=d.useMemo(()=>{if(On(o==null?void 0:o.chainId))return!1;try{const y=new hs(e||"0"),N=new hs("250000");return y.isNaN()||N.isNaN()?!1:y.gte(N)}catch{return!1}},[o,e]),f=y=>{const N=y.target.value,w=Er(N,i||"0");if(w.isValid)c(w.formattedValue),w.errorType;else return w.errorType==="exceed_balance",void 0},b=()=>{const y=parseFloat(i||"0"),N=parseFloat(e||"0");if(N>0){const I=y-N,w=Ue(Math.max(0,I).toString());return`${Ue(i||"0")} → ${w} ${t}`}return`${Ue(i||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:f,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:()=>{c(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:b()})]})]}),m&&M.jsxs("div",{className:"flex mb-4 border-b border-dashed border-line-divider-secondary pb-4",children:[M.jsx("div",{className:"w-5",children:M.jsx("img",{src:fs,className:"w-4 h-4",alt:"Warning"})}),M.jsx("div",{className:"flex-1 text-xs text-functional-orange-1",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."})]}),!r&&Sf(e||"0",0)&&M.jsxs("div",{className:"flex justify-center flex-col items-center",children:[M.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),M.jsxs("p",{className:"text-text-secondary text-xs leading-3 mt-4",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),M.jsxs("button",{className:"w-[180px] h-8 bg-fill-btn-primary hover:bg-fill-btn-primary-hover text-text-on-sec-btn rounded-xl text-sm font-medium transition-colors my-4",onClick:p,children:["Enable ",t]})]}),M.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),M.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${Ue(l)} → ${Ue((parseFloat(l)+parseFloat(e)).toString())} ${t}`:`${Ue(l)} ${t}`})]})})]})},ud=({token:e,account:t,chainId:n,contractAddress:r,wagmiHooks:o,onResult:s})=>{var i,l;const u=(i=o==null?void 0:o.useBalance)==null?void 0:i.call(o,{address:t,token:e.tokenAddress,chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!(o!=null&&o.useBalance)}}),a=(l=o==null?void 0:o.useReadContract)==null?void 0:l.call(o,{address:e.tokenAddress,abi:[{name:"allowance",type:"function",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]}],functionName:"allowance",args:[t,r],chainId:n,query:{enabled:!!t&&!!n&&!!e.tokenAddress&&!!r&&!!(o!=null&&o.useReadContract)}});return d.useEffect(()=>{s(e.tokenAddress,{balance:u,allowance:a})},[u,a,e.tokenAddress,s]),null},ms=({account:e,chainId:t,contractAddress:n,tokens:r=[],wagmiHooks:o})=>{var b;const s=d.useMemo(()=>r.filter(y=>y.tokenAddress&&y.tokenAddress!=="0x0000000000000000000000000000000000000000"),[r]),[u,a]=d.useState({}),i=d.useCallback((y,N)=>{a(I=>({...I,[y]:N}))},[]),l=(b=o==null?void 0:o.useBalance)==null?void 0:b.call(o,{address:e,chainId:t,query:{enabled:!!e&&!!t&&!!(o!=null&&o.useBalance)}}),c=d.useMemo(()=>s.map(y=>d.createElement(ud,{key:y.tokenAddress,token:y,account:e,chainId:t,contractAddress:n,wagmiHooks:o,onResult:i})),[s,e,t,n,o,i]),p=d.useMemo(()=>{if(!(o!=null&&o.useBalance))return{balanceList:[],allowanceList:[],baseTokenBalance:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},combinedData:{}};const y=l!=null&&l.data?{value:l.data.value,formatted:l.data.formatted,decimals:l.data.decimals,symbol:l.data.symbol}:{value:BigInt(0),formatted:"0",decimals:18,symbol:"ETH"},N=s.map(T=>{const j=u[T.tokenAddress],_=j==null?void 0:j.balance,B=_==null?void 0:_.data;return{address:T.tokenAddress,value:(B==null?void 0:B.value)||BigInt(0),formatted:(B==null?void 0:B.formatted)||"0",decimals:(B==null?void 0:B.decimals)||T.decimals}}).filter(T=>T.address),I=s.map(T=>{const j=u[T.tokenAddress],_=j==null?void 0:j.allowance,B=_==null?void 0:_.data,W=BigInt(B?B.toString():0);return{address:T.tokenAddress,value:W,formatted:(W/BigInt(10)**BigInt(T.decimals)).toString(),decimals:T.decimals}}).filter(T=>T.address),w=N.reduce((T,j)=>{const _=I.find(B=>B.address===j.address);return{...T,[j.address]:{balance:j,allowance:_||{address:j.address,value:BigInt(0),formatted:"0",decimals:j.decimals}}}},{});return{balanceList:N,allowanceList:I,baseTokenBalance:y,combinedData:w}},[l,u,s,o==null?void 0:o.useBalance]),m=d.useCallback(async()=>p,[p]),f=d.useMemo(()=>{const y=(l==null?void 0:l.isLoading)||!1,N=Object.values(u).some(I=>{var w,T;return((w=I.balance)==null?void 0:w.isLoading)||((T=I.allowance)==null?void 0:T.isLoading)});return y||N},[l==null?void 0:l.isLoading,u]);return{multicallRun:m,multicallResult:p,validErcTokens:s,isLoading:f,queryComponents:c}},cd=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:u,platformBalance:a="0",wagmiHooks:i,approved:l,onApproved:c,onDeposit:p,onClose:m,onChainChange:f,onTokenChange:b})=>{var D;const[y,N]=d.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[I,w]=d.useState(()=>{var G;if(!e||e.length===0)return"";const F=t||((G=e[0])==null?void 0:G.chainId),R=e.find(ee=>ee.chainId===F);if(!R||!R.tokenList||R.tokenList.length===0)return"";const U=R.tokenList.find(ee=>ee.tokenAddress===n)||R.tokenList[0];return(U==null?void 0:U.token)||""}),[T,j]=d.useState(r),_=d.useCallback(F=>{N(F),f==null||f(F)},[f]),B=d.useCallback(F=>{w(F),b==null||b(F)},[b]),W=d.useRef(!0),h=d.useRef(I),v=d.useRef(y);d.useEffect(()=>{if(W.current){W.current=!1,h.current=I,v.current=y;return}(h.current!==I||v.current!==y)&&(j(""),h.current=I,v.current=y)},[I,y]);const g=e&&e.length>0?e.find(F=>F.chainId===y)||e[0]:null,x=(D=g==null?void 0:g.tokenList)==null?void 0:D.find(F=>F.token===I),C=o==null?void 0:o.getDisplayAddress(),{multicallResult:A,queryComponents:P}=ms({account:C,chainId:y,contractAddress:void 0,tokens:(g==null?void 0:g.tokenList)||[],wagmiHooks:i}),S=d.useMemo(()=>{var R;if(!x)return;if(!x.tokenAddress||x.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return A.baseTokenBalance.formatted;const F=A.combinedData[x.tokenAddress];return((R=F==null?void 0:F.balance)==null?void 0:R.formatted)||"0"},[x,A]),$=l??!1,L=d.useMemo(()=>{const F=parseFloat(T||"0"),R=10,U=S||"0",G=Of(T,U,$);return!T||F===0?{text:"Confirm Deposit",disabled:!0}:$?F>parseFloat(U)?{text:"Insufficient Balance",disabled:!0}:F<R?{text:`Min Deposit ${R} ${I}`,disabled:!0}:{text:"Confirm Deposit",disabled:!G}:{text:"Confirm Deposit",disabled:!0}},[T,I,S,$]),E=d.useCallback(async()=>{p&&p({amount:T,chainId:y,tokenAddress:(x==null?void 0:x.tokenAddress)||"",tokenSymbol:I})},[p,T,y,x==null?void 0:x.tokenAddress,I]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):g?M.jsxs(M.Fragment,{children:[P,M.jsx(wr,{currentActiveChain:g,chainList:e,onChainChange:_,curSelectToken:I,onTokenChange:B,walletType:"evm"}),M.jsx(ad,{depositAmount:T,curSelectToken:I,curSelectTokenData:{balance:x==null?void 0:x.balance,allowance:x==null?void 0:x.allowance},approved:$,currentActiveChain:g,currentEquity:u||0,amount:T,decimals:(x==null?void 0:x.decimals)||6,tokenBalance:S,platformBalance:a,onDepositAmountChange:j,onApprove:async()=>{c&&await c()}}),M.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${L.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:E,disabled:L.disabled,children:L.text})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},gs=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Cr,smartWallet:o=Sr,chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i="",metadata:l=Or,currentEquity:c=5e3,platformBalance:p="0",wagmiHooks:m,approved:f,onApproved:b,onDeposit:y,onCopy:N,onChainChange:I,onTokenChange:w})=>{const T=d.useMemo(()=>{var _;return r?Yr(r,o,!1,(_=s[0])==null?void 0:_.chainId,"0","0"):null},[r,o,s]),j=(T==null?void 0:T.getWalletType())==="mpc";return e?xe.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:_=>{_.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:M.jsx(Hr,{className:"h-4 w-4"})})]}),j?M.jsx(id,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:T,metadata:l,currentEquity:c,onDeposit:y,onCopy:N,onClose:t}):M.jsx(cd,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:T,metadata:l,currentEquity:c,platformBalance:p,wagmiHooks:m,approved:f,onApproved:b,onDeposit:y,onClose:t,onChainChange:I,onTokenChange:w})]})})}),document.body):null};let Qe=null;const fd={symbol:"USDT"},vs=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),u=d.useCallback(c=>{s(c),r(!0)},[]),a=d.useCallback(c=>{s(p=>({...p,...c}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openDeposit:u,closeDeposit:i,updateDepositOptions:a,isOpen:l}),[u,i,a,l]),d.useEffect(()=>(Qe={openDeposit:u,closeDeposit:i,updateDepositOptions:a,isOpen:l},()=>{Qe=null}),[u,i,a,l]),M.jsx(gs,{isOpen:n,onClose:i,config:o.config||fd,currentActiveAccount:o.currentActiveAccount||Cr,smartWallet:o.smartWallet||Sr,chains:o.chains||$f,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||Or,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,approved:o.approved,onApproved:o.onApproved,onDeposit:o.onDeposit,onCopy:o.onCopy,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});vs.displayName="DepositManager";const bs=e=>{if(!Qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Qe.openDeposit(e||{chains:[]})},ys=()=>{if(!Qe){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Qe.closeDeposit()},xs=e=>{Qe&&Qe.updateDepositOptions(e)},dd=()=>Qe?Qe.isOpen():!1,pd=()=>({openDeposit:bs,closeDeposit:ys,updateDepositOptions:xs,isOpen:dd});d.createContext(null);const hd=({withdrawAmount:e,curSelectToken:t,currentActiveChain:n,platformBalance:r="0",walletType:o="evm",receiverAddress:s="",onWithdrawAmountChange:u,onReceiverAddressChange:a})=>{const i=p=>{const m=p.target.value,b=Er(m,r||"0");if(b.isValid)u(b.formattedValue),b.errorType;else return b.errorType==="exceed_balance",void 0},l=()=>{u(r)},c=()=>{const p=parseFloat(r||"0"),m=parseFloat(e||"0");if(m>0){const f=p-m,b=Ue(Math.max(0,f).toString());return`${Ue(r||"0")} → ${b} ${t}`}return`${Ue(r||"0")} ${t}`};return M.jsxs(M.Fragment,{children:[M.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[M.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[M.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:i,className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"}),M.jsx("button",{onClick:l,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),M.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),M.jsxs("div",{className:"flex justify-between items-center",children:[M.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),M.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:c()})]})]}),o==="mpc"&&!On(n==null?void 0:n.chainId)&&M.jsx("div",{className:"bg-fill-input-primary rounded-lg my-4 h-9 flex items-center px-3",children:M.jsx("input",{type:"text",placeholder:"Receiver Address",value:s,onChange:p=>a==null?void 0:a(p.target.value),className:"flex-1 bg-transparent text-text-primary text-sm font-medium placeholder-text-tertiary placeholder:font-normal focus:outline-none border-none p-0 h-full"})}),M.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:M.jsx("p",{className:"text-text-tertiary text-xs leading-[18px]",children:"Cross-chain withdrawals require verification at L2 (via ZK proofs) and the withdrawal process may take up to 2 hours. Sufficient funds in the corresponding chain's asset pool are required to process cross-chain withdrawals. Gas fees will also be incurred. edgeX will charge a fee to cover this."})}),M.jsxs("div",{className:"py-4 border-t border-line-divider-secondary border-dashed",children:[M.jsxs("div",{className:"flex items-center justify-between",children:[M.jsx("span",{className:"text-text-tertiary text-xs",children:"Speed"}),M.jsxs("div",{className:"flex items-center space-x-1",children:[M.jsx("span",{className:"text-theme-normal",children:"⚡"}),M.jsx("span",{className:"text-theme-normal",children:"⚡"}),M.jsx("span",{className:"text-theme-normal",children:"⚡"})]})]}),M.jsxs("div",{className:"flex items-center justify-between mt-2 h-[18px]",children:[M.jsx("span",{className:"text-text-tertiary text-sm leading-4",children:"Amount to receive"}),M.jsxs("span",{className:"text-text-primary text-sm leading-4 font-medium",children:[Ue(e)," ",t]})]})]})]})},md=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:u,platformBalance:a="0",wagmiHooks:i,onWithdraw:l,onClose:c,onChainChange:p,onTokenChange:m})=>{var D;const[f,b]=d.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[y,N]=d.useState(()=>{var G;if(!e||e.length===0)return"";const F=t||((G=e[0])==null?void 0:G.chainId),R=e.find(ee=>ee.chainId===F);if(!R||!R.tokenList||R.tokenList.length===0)return"";const U=R.tokenList.find(ee=>ee.tokenAddress===n)||R.tokenList[0];return(U==null?void 0:U.token)||""}),[I,w]=d.useState(r),[T,j]=d.useState(""),_=(o==null?void 0:o.getWalletType())||"evm",B=d.useCallback(F=>{b(F),p==null||p(F)},[p]),W=d.useCallback(F=>{N(F),m==null||m(F)},[m]),h=d.useRef(!0),v=d.useRef(y),g=d.useRef(f);d.useEffect(()=>{if(h.current){h.current=!1,v.current=y,g.current=f;return}(v.current!==y||g.current!==f)&&(w(""),v.current=y,g.current=f)},[y,f]);const x=e&&e.length>0?e.find(F=>F.chainId===f)||e[0]:null,C=(D=x==null?void 0:x.tokenList)==null?void 0:D.find(F=>F.token===y),A=o==null?void 0:o.getDisplayAddress(),{multicallResult:P,queryComponents:S}=ms({account:A,chainId:f,contractAddress:void 0,tokens:(x==null?void 0:x.tokenList)||[],wagmiHooks:i}),$=d.useMemo(()=>{var R;if(!C)return;if(!C.tokenAddress||C.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return P.baseTokenBalance.formatted;const F=P.combinedData[C.tokenAddress];return((R=F==null?void 0:F.balance)==null?void 0:R.formatted)||"0"},[C,P]),L=d.useMemo(()=>{const F=parseFloat(I||"0"),R=1,U=parseFloat(a||"0");return!I||F===0?{text:"Confirm Withdraw",disabled:!0}:_==="mpc"&&!On(f)&&!T.trim()?{text:"Enter Receiver Address",disabled:!0}:F>U?{text:"Insufficient Balance",disabled:!0}:F<R?{text:`Min Withdraw ${R} ${y}`,disabled:!0}:{text:"Confirm Withdraw",disabled:!1}},[I,y,a,_,T]),E=d.useCallback(async()=>{if(l){const F={amount:I,chainId:f,tokenAddress:(C==null?void 0:C.tokenAddress)||"",tokenSymbol:y};_==="mpc"&&!On(f)&&(F.receiverAddress=T),l(F)}},[l,I,f,C==null?void 0:C.tokenAddress,y,_,T]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?M.jsxs("div",{className:"p-6 text-center",children:[M.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),M.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"No chains available"})}):x?M.jsxs(M.Fragment,{children:[S,M.jsx(wr,{currentActiveChain:x,chainList:e,onChainChange:B,curSelectToken:y,onTokenChange:W,walletType:"evm"}),M.jsx(hd,{withdrawAmount:I,curSelectToken:y,curSelectTokenData:{balance:C==null?void 0:C.balance,allowance:C==null?void 0:C.allowance},currentActiveChain:x,currentEquity:u||0,amount:I,decimals:(C==null?void 0:C.decimals)||6,tokenBalance:$,platformBalance:a,walletType:_,receiverAddress:T,onWithdrawAmountChange:w,onReceiverAddressChange:j}),M.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${L.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:E,disabled:L.disabled,children:L.text})]}):M.jsx("div",{className:"text-center py-8",children:M.jsx("p",{className:"text-gray-400",children:"Loading..."})})},ws=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=Cr,smartWallet:o=Sr,chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i="",metadata:l=Or,currentEquity:c=5e3,platformBalance:p="0",wagmiHooks:m,onWithdraw:f,onChainChange:b,onTokenChange:y})=>{const N=d.useMemo(()=>{var I;return r?Yr(r,o,!1,(I=s[0])==null?void 0:I.chainId,"0","0"):null},[r,o,s]);return e?xe.createPortal(M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 w-screen h-screen",style:{zIndex:49},children:M.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-49 flex items-center justify-center",style:{background:"rgba(0, 0, 0, 0.6)"},onClick:()=>{t()},"aria-hidden":"true",children:M.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",onClick:I=>{I.stopPropagation()},children:[M.jsxs("div",{className:"flex items-center justify-between mb-4",children:[M.jsx("h2",{className:"text-lg font-semibold text-white",children:"Withdraw"}),M.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:M.jsx(Hr,{className:"h-4 w-4"})})]}),M.jsx(md,{chains:s,defaultChainId:u,defaultTokenAddress:a,defaultAmount:i,walletAdapter:N,metadata:l,currentEquity:c,platformBalance:p,wagmiHooks:m,onWithdraw:f,onClose:t,onChainChange:b,onTokenChange:y})]})})}),document.body):null},gd=[],vd={};let Xe=null;const Es=d.forwardRef((e,t)=>{const[n,r]=d.useState(!1),[o,s]=d.useState({chains:[]}),u=d.useCallback(c=>{s(c||{chains:[]}),r(!0)},[]),a=d.useCallback(c=>{s(p=>({...p,...c}))},[]),i=d.useCallback(()=>{r(!1),o.onClose&&o.onClose()},[o.onClose]),l=d.useCallback(()=>n,[n]);return d.useImperativeHandle(t,()=>({openWithdraw:u,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l}),[u,i,a,l]),d.useEffect(()=>(Xe={openWithdraw:u,closeWithdraw:i,updateWithdrawOptions:a,isOpen:l},()=>{Xe=null}),[u,i,a,l]),M.jsx(ws,{isOpen:n,onClose:i,config:o.config||{symbol:"USDT"},currentActiveAccount:o.currentActiveAccount,smartWallet:o.smartWallet,chains:o.chains||gd,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||vd,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,onWithdraw:o.onWithdraw,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Es.displayName="WithdrawManager";const Cs=e=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.openWithdraw(e||{chains:[]})},Ss=()=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.closeWithdraw()},Os=e=>{if(!Xe){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}Xe.updateWithdrawOptions(e)},bd=()=>Xe?Xe.isOpen():!1,yd=()=>({openWithdraw:Cs,closeWithdraw:Ss,updateWithdrawOptions:Os,isOpen:bd});oe.ComponentProvider=Hs,oe.Deposit=gs,oe.DepositManager=vs,oe.Withdraw=ws,oe.WithdrawManager=Es,oe.closeDeposit=ys,oe.closeWithdraw=Ss,oe.openDeposit=bs,oe.openWithdraw=Cs,oe.updateDepositOptions=xs,oe.updateWithdrawOptions=Os,oe.useDeposit=Gs,oe.useDepositManager=pd,oe.useWithdraw=Ys,oe.useWithdrawManager=yd,Object.defineProperty(oe,Symbol.toStringTag,{value:"Module"})});
|
|
104
104
|
//# sourceMappingURL=index.umd.js.map
|