@edgex-web/components 0.1.0-beta.12 → 0.1.0-beta.14
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/Withdraw/index.d.ts +2 -1
- package/dist/components/Withdraw/index.d.ts.map +1 -1
- package/dist/components/Withdraw/src/constants.d.ts +13 -0
- package/dist/components/Withdraw/src/constants.d.ts.map +1 -0
- package/dist/components/Withdraw/src/evm/WalletView.d.ts +5 -2
- package/dist/components/Withdraw/src/evm/WalletView.d.ts.map +1 -1
- package/dist/components/Withdraw/src/evm/index.d.ts +3 -2
- package/dist/components/Withdraw/src/evm/index.d.ts.map +1 -1
- package/dist/components/Withdraw/types/index.d.ts +1 -0
- package/dist/components/Withdraw/types/index.d.ts.map +1 -1
- package/dist/index.esm.js +2217 -2185
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +25 -25
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(Z,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],f):(Z=typeof globalThis<"u"?globalThis:Z||self,f(Z.EdgeXComponents={},Z.React,Z.ReactDOM))})(this,function(Z,f,de){"use strict";var
|
|
1
|
+
(function(Z,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],f):(Z=typeof globalThis<"u"?globalThis:Z||self,f(Z.EdgeXComponents={},Z.React,Z.ReactDOM))})(this,function(Z,f,de){"use strict";var Uf=Object.defineProperty;var zf=(Z,f,de)=>f in Z?Uf(Z,f,{enumerable:!0,configurable:!0,writable:!0,value:de}):Z[f]=de;var Be=(Z,f,de)=>zf(Z,typeof f!="symbol"?f+"":f,de);function pr(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 L=pr(f),Mt=pr(de);var sn={exports:{}},ht={};/**
|
|
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 mr;function ss(){if(mr)return ht;mr=1;var e=f,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 c(a,i,l){var u,p={},m=null,d=null;l!==void 0&&(m=""+l),i.key!==void 0&&(m=""+i.key),i.ref!==void 0&&(d=i.ref);for(u in i)r.call(i,u)&&!s.hasOwnProperty(u)&&(p[u]=i[u]);if(a&&a.defaultProps)for(u in i=a.defaultProps,i)p[u]===void 0&&(p[u]=i[u]);return{$$typeof:t,type:a,key:m,ref:d,props:p,_owner:o.current}}return ht.Fragment=n,ht.jsx=c,ht.jsxs=c,ht}var gt={};/**
|
|
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
|
-
`),ie=
|
|
21
|
-
`+
|
|
17
|
+
*/var hr;function ls(){return hr||(hr=1,process.env.NODE_ENV!=="production"&&function(){var e=f,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"),c=Symbol.for("react.provider"),a=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),d=Symbol.for("react.offscreen"),h=Symbol.iterator,g="@@iterator";function b(v){if(v===null||typeof v!="object")return null;var $=h&&v[h]||v[g];return typeof $=="function"?$:null}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(v){{for(var $=arguments.length,P=new Array($>1?$-1:0),k=1;k<$;k++)P[k-1]=arguments[k];x("error",v,P)}}function x(v,$,P){{var k=w.ReactDebugCurrentFrame,J=k.getStackAddendum();J!==""&&($+="%s",P=P.concat([J]));var ee=P.map(function(X){return String(X)});ee.unshift("Warning: "+$),Function.prototype.apply.call(console[v],console,ee)}}var C=!1,S=!1,M=!1,F=!1,W=!1,V;V=Symbol.for("react.module.reference");function A(v){return!!(typeof v=="string"||typeof v=="function"||v===r||v===s||W||v===o||v===l||v===u||F||v===d||C||S||M||typeof v=="object"&&v!==null&&(v.$$typeof===m||v.$$typeof===p||v.$$typeof===c||v.$$typeof===a||v.$$typeof===i||v.$$typeof===V||v.getModuleId!==void 0))}function O(v,$,P){var k=v.displayName;if(k)return k;var J=$.displayName||$.name||"";return J!==""?P+"("+J+")":P}function j(v){return v.displayName||"Context"}function D(v){if(v==null)return null;if(typeof v.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof v=="function")return v.displayName||v.name||null;if(typeof v=="string")return v;switch(v){case r:return"Fragment";case n:return"Portal";case s:return"Profiler";case o:return"StrictMode";case l:return"Suspense";case u:return"SuspenseList"}if(typeof v=="object")switch(v.$$typeof){case a:var $=v;return j($)+".Consumer";case c:var P=v;return j(P._context)+".Provider";case i:return O(v,v.render,"ForwardRef");case p:var k=v.displayName||null;return k!==null?k:D(v.type)||"Memo";case m:{var J=v,ee=J._payload,X=J._init;try{return D(X(ee))}catch{return null}}}return null}var I=Object.assign,B=0,z,U,T,_,N,H,G;function q(){}q.__reactDisabledLog=!0;function pe(){{if(B===0){z=console.log,U=console.info,T=console.warn,_=console.error,N=console.group,H=console.groupCollapsed,G=console.groupEnd;var v={configurable:!0,enumerable:!0,value:q,writable:!0};Object.defineProperties(console,{info:v,log:v,warn:v,error:v,group:v,groupCollapsed:v,groupEnd:v})}B++}}function We(){{if(B--,B===0){var v={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},v,{value:z}),info:I({},v,{value:U}),warn:I({},v,{value:T}),error:I({},v,{value:_}),group:I({},v,{value:N}),groupCollapsed:I({},v,{value:H}),groupEnd:I({},v,{value:G})})}B<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var nt=w.ReactCurrentDispatcher,R;function ne(v,$,P){{if(R===void 0)try{throw Error()}catch(J){var k=J.stack.trim().match(/\n( *(at )?)/);R=k&&k[1]||""}return`
|
|
18
|
+
`+R+v}}var fe=!1,Ke;{var bf=typeof WeakMap=="function"?WeakMap:Map;Ke=new bf}function zi(v,$){if(!v||fe)return"";{var P=Ke.get(v);if(P!==void 0)return P}var k;fe=!0;var J=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var ee;ee=nt.current,nt.current=null,pe();try{if($){var X=function(){throw Error()};if(Object.defineProperty(X.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(X,[])}catch(ge){k=ge}Reflect.construct(v,[],X)}else{try{X.call()}catch(ge){k=ge}v.call(X.prototype)}}else{try{throw Error()}catch(ge){k=ge}v()}}catch(ge){if(ge&&k&&typeof ge.stack=="string"){for(var K=ge.stack.split(`
|
|
19
|
+
`),me=k.stack.split(`
|
|
20
|
+
`),ie=K.length-1,se=me.length-1;ie>=1&&se>=0&&K[ie]!==me[se];)se--;for(;ie>=1&&se>=0;ie--,se--)if(K[ie]!==me[se]){if(ie!==1||se!==1)do if(ie--,se--,se<0||K[ie]!==me[se]){var Se=`
|
|
21
|
+
`+K[ie].replace(" at new "," at ");return v.displayName&&Se.includes("<anonymous>")&&(Se=Se.replace("<anonymous>",v.displayName)),typeof v=="function"&&Ke.set(v,Se),Se}while(ie>=1&&se>=0);break}}}finally{fe=!1,nt.current=ee,We(),Error.prepareStackTrace=J}var mt=v?v.displayName||v.name:"",rt=mt?ne(mt):"";return typeof v=="function"&&Ke.set(v,rt),rt}function xf(v,$,P){return zi(v,!1)}function yf(v){var $=v.prototype;return!!($&&$.isReactComponent)}function rn(v,$,P){if(v==null)return"";if(typeof v=="function")return zi(v,yf(v));if(typeof v=="string")return ne(v);switch(v){case l:return ne("Suspense");case u:return ne("SuspenseList")}if(typeof v=="object")switch(v.$$typeof){case i:return xf(v.render);case p:return rn(v.type,$,P);case m:{var k=v,J=k._payload,ee=k._init;try{return rn(ee(J),$,P)}catch{}}}return""}var At=Object.prototype.hasOwnProperty,Hi={},Gi=w.ReactDebugCurrentFrame;function on(v){if(v){var $=v._owner,P=rn(v.type,v._source,$?$.type:null);Gi.setExtraStackFrame(P)}else Gi.setExtraStackFrame(null)}function wf(v,$,P,k,J){{var ee=Function.call.bind(At);for(var X in v)if(ee(v,X)){var K=void 0;try{if(typeof v[X]!="function"){var me=Error((k||"React class")+": "+P+" type `"+X+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof v[X]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw me.name="Invariant Violation",me}K=v[X]($,X,k,P,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(ie){K=ie}K&&!(K instanceof Error)&&(on(J),E("%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).",k||"React class",P,X,typeof K),on(null)),K instanceof Error&&!(K.message in Hi)&&(Hi[K.message]=!0,on(J),E("Failed %s type: %s",P,K.message),on(null))}}}var Ef=Array.isArray;function ar(v){return Ef(v)}function Cf(v){{var $=typeof Symbol=="function"&&Symbol.toStringTag,P=$&&v[Symbol.toStringTag]||v.constructor.name||"Object";return P}}function Sf(v){try{return Yi(v),!1}catch{return!0}}function Yi(v){return""+v}function Ki(v){if(Sf(v))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Cf(v)),Yi(v)}var Qi=w.ReactCurrentOwner,$f={key:!0,ref:!0,__self:!0,__source:!0},qi,Xi;function Of(v){if(At.call(v,"ref")){var $=Object.getOwnPropertyDescriptor(v,"ref").get;if($&&$.isReactWarning)return!1}return v.ref!==void 0}function Tf(v){if(At.call(v,"key")){var $=Object.getOwnPropertyDescriptor(v,"key").get;if($&&$.isReactWarning)return!1}return v.key!==void 0}function Nf(v,$){typeof v.ref=="string"&&Qi.current}function Af(v,$){{var P=function(){qi||(qi=!0,E("%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)",$))};P.isReactWarning=!0,Object.defineProperty(v,"key",{get:P,configurable:!0})}}function Mf(v,$){{var P=function(){Xi||(Xi=!0,E("%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)",$))};P.isReactWarning=!0,Object.defineProperty(v,"ref",{get:P,configurable:!0})}}var Pf=function(v,$,P,k,J,ee,X){var K={$$typeof:t,type:v,key:$,ref:P,props:X,_owner:ee};return K._store={},Object.defineProperty(K._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(K,"_self",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.defineProperty(K,"_source",{configurable:!1,enumerable:!1,writable:!1,value:J}),Object.freeze&&(Object.freeze(K.props),Object.freeze(K)),K};function Lf(v,$,P,k,J){{var ee,X={},K=null,me=null;P!==void 0&&(Ki(P),K=""+P),Tf($)&&(Ki($.key),K=""+$.key),Of($)&&(me=$.ref,Nf($,J));for(ee in $)At.call($,ee)&&!$f.hasOwnProperty(ee)&&(X[ee]=$[ee]);if(v&&v.defaultProps){var ie=v.defaultProps;for(ee in ie)X[ee]===void 0&&(X[ee]=ie[ee])}if(K||me){var se=typeof v=="function"?v.displayName||v.name||"Unknown":v;K&&Af(X,se),me&&Mf(X,se)}return Pf(v,K,me,J,k,Qi.current,X)}}var ur=w.ReactCurrentOwner,Ji=w.ReactDebugCurrentFrame;function pt(v){if(v){var $=v._owner,P=rn(v.type,v._source,$?$.type:null);Ji.setExtraStackFrame(P)}else Ji.setExtraStackFrame(null)}var cr;cr=!1;function fr(v){return typeof v=="object"&&v!==null&&v.$$typeof===t}function Zi(){{if(ur.current){var v=D(ur.current.type);if(v)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+v+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+v+"`."}return""}}function Ff(v){return""}var es={};function If(v){{var $=Zi();if(!$){var P=typeof v=="string"?v:v.displayName||v.name;P&&($=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+P+">.")}return $}}function ts(v,$){{if(!v._store||v._store.validated||v.key!=null)return;v._store.validated=!0;var P=If($);if(es[P])return;es[P]=!0;var k="";v&&v._owner&&v._owner!==ur.current&&(k=" It was passed a child from "+D(v._owner.type)+"."),pt(v),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',P,k),pt(null)}}function ns(v,$){{if(typeof v!="object")return;if(ar(v))for(var P=0;P<v.length;P++){var k=v[P];fr(k)&&ts(k,$)}else if(fr(v))v._store&&(v._store.validated=!0);else if(v){var J=b(v);if(typeof J=="function"&&J!==v.entries)for(var ee=J.call(v),X;!(X=ee.next()).done;)fr(X.value)&&ts(X.value,$)}}}function jf(v){{var $=v.type;if($==null||typeof $=="string")return;var P;if(typeof $=="function")P=$.propTypes;else if(typeof $=="object"&&($.$$typeof===i||$.$$typeof===p))P=$.propTypes;else return;if(P){var k=D($);wf(P,v.props,"prop",k,v)}else if($.PropTypes!==void 0&&!cr){cr=!0;var J=D($);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",J||"Unknown")}typeof $.getDefaultProps=="function"&&!$.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Df(v){{for(var $=Object.keys(v.props),P=0;P<$.length;P++){var k=$[P];if(k!=="children"&&k!=="key"){pt(v),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",k),pt(null);break}}v.ref!==null&&(pt(v),E("Invalid attribute `ref` supplied to `React.Fragment`."),pt(null))}}var rs={};function os(v,$,P,k,J,ee){{var X=A(v);if(!X){var K="";(v===void 0||typeof v=="object"&&v!==null&&Object.keys(v).length===0)&&(K+=" 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 me=Ff();me?K+=me:K+=Zi();var ie;v===null?ie="null":ar(v)?ie="array":v!==void 0&&v.$$typeof===t?(ie="<"+(D(v.type)||"Unknown")+" />",K=" Did you accidentally export a JSX literal instead of a component?"):ie=typeof v,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",ie,K)}var se=Lf(v,$,P,J,ee);if(se==null)return se;if(X){var Se=$.children;if(Se!==void 0)if(k)if(ar(Se)){for(var mt=0;mt<Se.length;mt++)ns(Se[mt],v);Object.freeze&&Object.freeze(Se)}else E("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 ns(Se,v)}if(At.call($,"key")){var rt=D(v),ge=Object.keys($).filter(function(Vf){return Vf!=="key"}),dr=ge.length>0?"{key: someKey, "+ge.join(": ..., ")+": ...}":"{key: someKey}";if(!rs[rt+dr]){var Bf=ge.length>0?"{"+ge.join(": ..., ")+": ...}":"{}";E(`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} />`,dr,rt,Bf,rt),rs[rt+dr]=!0}}return v===r?Df(se):jf(se),se}}function _f(v,$,P){return os(v,$,P,!0)}function kf(v,$,P){return os(v,$,P,!1)}var Rf=kf,Wf=_f;gt.Fragment=r,gt.jsx=Rf,gt.jsxs=Wf}()),gt}process.env.NODE_ENV==="production"?sn.exports=ss():sn.exports=ls();var y=sn.exports;const as=f.createContext(null),us=({config:e,children:t})=>y.jsx(as.Provider,{value:e,children:t}),cs=()=>({openDeposit:f.useCallback(t=>{},[])}),fs=()=>({openWithdraw:f.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 ds=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ps=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(t,n,r)=>r?r.toUpperCase():n.toLowerCase()),gr=e=>{const t=ps(e);return t.charAt(0).toUpperCase()+t.slice(1)},vr=(...e)=>e.filter((t,n,r)=>!!t&&t.trim()!==""&&r.indexOf(t)===n).join(" ").trim(),ms=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 hs={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 gs=f.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:o="",children:s,iconNode:c,...a},i)=>f.createElement("svg",{ref:i,...hs,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:vr("lucide",o),...!s&&!ms(a)&&{"aria-hidden":"true"},...a},[...c.map(([l,u])=>f.createElement(l,u)),...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 vs=(e,t)=>{const n=f.forwardRef(({className:r,...o},s)=>f.createElement(gs,{ref:s,iconNode:t,className:vr(`lucide-${ds(gr(e))}`,`lucide-${e}`,r),...o}));return n.displayName=gr(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 vr=gs("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);class br{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 vs extends br{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 bs extends br{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 xr(e,t,n,r,o,s){switch(e==null?void 0:e.wallet){case"mpc":return new vs(t,e);default:return new bs(e,!1,r||1,o,s)}}const yr=typeof document<"u"?f.useLayoutEffect:()=>{};var ln;const xs=(ln=f.useInsertionEffect)!==null&&ln!==void 0?ln:yr;function ys(e){const t=f.useRef(null);return xs(()=>{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 ws(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function Es(e){return ws(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}let Cs=!1;function an(){return Cs}function wr(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:Es(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 Er(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)}),Ss=_e(function(){return cn(/^iPhone/i)}),$s=_e(function(){return cn(/^iPad/i)||fn()&&navigator.maxTouchPoints>1}),Os=_e(function(){return Ss()||$s()});_e(function(){return fn()||Os()}),_e(function(){return Pt(/AppleWebKit/i)&&!Ts()});const Ts=_e(function(){return Pt(/Chrome/i)}),As=_e(function(){return Pt(/Android/i)});_e(function(){return Pt(/Firefox/i)});function Cr(){let e=f.useRef(new Map),t=f.useCallback((o,s,c,u)=>{let i=u!=null&&u.once?(...l)=>{e.current.delete(c),c(...l)}:c;e.current.set(c,{type:s,eventTarget:o,fn:i,options:u}),o.addEventListener(s,i,u)},[]),n=f.useCallback((o,s,c,u)=>{var i;let l=((i=e.current.get(c))===null||i===void 0?void 0:i.fn)||c;o.removeEventListener(s,l,u),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 Ns(e){return e.mozInputSource===0&&e.isTrusted?!0:As()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Sr(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function Ms(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function $r(e){let t=f.useRef({isFocused:!1,observer:null});yr(()=>{const r=t.current;return()=>{r.observer&&(r.observer.disconnect(),r.observer=null)}},[]);let n=ys(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 u=Sr(c);n(u)}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 u=o===document.activeElement?null:document.activeElement;o.dispatchEvent(new FocusEvent("blur",{relatedTarget:u})),o.dispatchEvent(new FocusEvent("focusout",{bubbles:!0,relatedTarget:u}))}}),t.current.observer.observe(o,{attributes:!0,attributeFilter:["disabled"]})}},[n])}let Ps=!1,vt=null,dn=new Set,bt=new Map,qe=!1,pn=!1;const Ls={Tab:!0,Escape:!0};function mn(e,t){for(let n of dn)n(e,t)}function Fs(e){return!(e.metaKey||!fn()&&e.altKey||e.ctrlKey||e.key==="Control"||e.key==="Shift"||e.key==="Meta")}function Lt(e){qe=!0,Fs(e)&&(vt="keyboard",mn("keyboard",e))}function be(e){vt="pointer",(e.type==="mousedown"||e.type==="pointerdown")&&(qe=!0,mn("pointer",e))}function Or(e){Ns(e)&&(qe=!0,vt="virtual")}function Tr(e){e.target===window||e.target===document||Ps||!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",Or,!0),t.addEventListener("focus",Tr,!0),t.addEventListener("blur",Ar,!1),typeof PointerEvent<"u"?(n.addEventListener("pointerdown",be,!0),n.addEventListener("pointermove",be,!0),n.addEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(n.addEventListener("mousedown",be,!0),n.addEventListener("mousemove",be,!0),n.addEventListener("mouseup",be,!0)),t.addEventListener("beforeunload",()=>{Nr(e)},{once:!0}),bt.set(t,{focus:r})}const Nr=(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",Or,!0),n.removeEventListener("focus",Tr,!0),n.removeEventListener("blur",Ar,!1),typeof PointerEvent<"u"?(r.removeEventListener("pointerdown",be,!0),r.removeEventListener("pointermove",be,!0),r.removeEventListener("pointerup",be,!0)):process.env.NODE_ENV==="test"&&(r.removeEventListener("mousedown",be,!0),r.removeEventListener("mousemove",be,!0),r.removeEventListener("mouseup",be,!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)),()=>Nr(e,n)}typeof document<"u"&&js();function Mr(){return vt!=="pointer"}const Is=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Ds(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,u=typeof window<"u"?Qe(n==null?void 0:n.target).KeyboardEvent:KeyboardEvent;return e=e||r.activeElement instanceof o&&!Is.has(r.activeElement.type)||r.activeElement instanceof s||r.activeElement instanceof c&&r.activeElement.isContentEditable,!(e&&t==="keyboard"&&n instanceof u&&!Ls[n.key])}function _s(e,t,n){hn(),f.useEffect(()=>{let r=(o,s)=>{Ds(!!(n!=null&&n.isTextInput),o,s)&&e(Mr())};return dn.add(r),()=>{dn.delete(r)}},t)}function ks(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=$r(s),u=f.useCallback(i=>{const l=Ve(i.target),a=l?un(l):un();i.target===i.currentTarget&&a===Er(i.nativeEvent)&&(n&&n(i),o&&o(!0),c(i))},[o,n,c]);return{focusProps:{onFocus:!t&&(n||o||r)?u:void 0,onBlur:!t&&(r||o)?s:void 0}}}function Rs(e){let{isDisabled:t,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:o}=e,s=f.useRef({isFocusWithin:!1}),{addGlobalListener:c,removeAllGlobalListeners:u}=Cr(),i=f.useCallback(p=>{p.currentTarget.contains(p.target)&&s.current.isFocusWithin&&!p.currentTarget.contains(p.relatedTarget)&&(s.current.isFocusWithin=!1,u(),n&&n(p),o&&o(!1))},[n,o,s,u]),l=$r(i),a=f.useCallback(p=>{if(!p.currentTarget.contains(p.target))return;const m=Ve(p.target),d=un(m);if(!s.current.isFocusWithin&&d===Er(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&&!wr(h,g.target)){let b=new m.defaultView.FocusEvent("blur",{relatedTarget:g.target});Ms(b,h);let w=Sr(b);i(w)}},{capture:!0})}},[r,o,l,c,i]);return t?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:a,onBlur:i}}}let Ft=!1,jt=0;function gn(){Ft=!0,setTimeout(()=>{Ft=!1},50)}function Pr(e){e.pointerType==="touch"&&gn()}function Ws(){if(!(typeof document>"u"))return jt===0&&(typeof PointerEvent<"u"?document.addEventListener("pointerup",Pr):process.env.NODE_ENV==="test"&&document.addEventListener("touchend",gn)),jt++,()=>{jt--,!(jt>0)&&(typeof PointerEvent<"u"?document.removeEventListener("pointerup",Pr):process.env.NODE_ENV==="test"&&document.removeEventListener("touchend",gn))}}function Bs(e){let{onHoverStart:t,onHoverChange:n,onHoverEnd:r,isDisabled:o}=e,[s,c]=f.useState(!1),u=f.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;f.useEffect(Ws,[]);let{addGlobalListener:i,removeAllGlobalListeners:l}=Cr(),{hoverProps:a,triggerHoverEnd:p}=f.useMemo(()=>{let m=(g,b)=>{if(u.pointerType=b,o||b==="touch"||u.isHovered||!g.currentTarget.contains(g.target))return;u.isHovered=!0;let w=g.currentTarget;u.target=w,i(Ve(g.target),"pointerover",E=>{u.isHovered&&u.target&&!wr(u.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=u.target;u.pointerType="",u.target=null,!(b==="touch"||!u.isHovered||!w)&&(u.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=()=>{u.ignoreEmulatedMouseEvents=!0},h.onMouseEnter=g=>{!u.ignoreEmulatedMouseEvents&&!Ft&&m(g,"mouse"),u.ignoreEmulatedMouseEvents=!1},h.onMouseLeave=g=>{!o&&g.currentTarget.contains(g.target)&&d(g,"mouse")}),{hoverProps:h,triggerHoverEnd:d}},[t,n,r,o,u,i,l]);return f.useEffect(()=>{o&&p({currentTarget:u.target},u.pointerType)},[o]),{hoverProps:a,isHovered:s}}function Vs(e={}){let{autoFocus:t=!1,isTextInput:n,within:r}=e,o=f.useRef({isFocused:!1,isFocusVisible:t||Mr()}),[s,c]=f.useState(!1),[u,i]=f.useState(()=>o.current.isFocused&&o.current.isFocusVisible),l=f.useCallback(()=>i(o.current.isFocused&&o.current.isFocusVisible),[]),a=f.useCallback(d=>{o.current.isFocused=d,c(d),l()},[l]);_s(d=>{o.current.isFocusVisible=d,l()},[],{isTextInput:n});let{focusProps:p}=ks({isDisabled:r,onFocusChange:a}),{focusWithinProps:m}=Rs({isDisabled:!r,onFocusWithinChange:a});return{isFocused:s,isFocusVisible:u,focusProps:r?m:p}}var Us=Object.defineProperty,zs=(e,t,n)=>t in e?Us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,vn=(e,t,n)=>(zs(e,typeof t!="symbol"?t+"":t,n),n);let Hs=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"}},Ne=new Hs;function xt(e){var t,n;return Ne.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 Lr(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Se(){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 Lr(()=>{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=Se();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(Se);return f.useEffect(()=>()=>e.dispose(),[e]),e}let te=(e,t)=>{Ne.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 G=function(e){let t=Xe(e);return f.useCallback((...n)=>t.current(...n),[t])};function Gs(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 Ys(e,t){return!(!e||!t||e.right<t.left||e.left>t.right||e.bottom<t.top||e.top>t.bottom)}function Ks({disabled:e=!1}={}){let t=f.useRef(null),[n,r]=f.useState(!1),o=ot(),s=G(()=>{t.current=null,r(!1),o.dispose()}),c=G(u=>{if(o.dispose(),t.current===null){t.current=u.currentTarget,r(!0);{let i=xt(u.currentTarget);o.addEventListener(i,"pointerup",s,!1),o.addEventListener(i,"pointermove",l=>{if(t.current){let a=Gs(l);r(Ys(a,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 xe(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,xe),r}var It=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(It||{}),Ue=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Ue||{});function ge(){let e=Xs();return f.useCallback(t=>qs({mergeRefs:e,...t}),[e])}function qs({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:c,mergeRefs:u}){u=u??Js;let i=Fr(t,e);if(s)return Dt(i,n,r,c,u);let l=o??0;if(l&2){let{static:a=!1,...p}=i;if(a)return Dt(p,n,r,c,u)}if(l&1){let{unmount:a=!0,...p}=i;return xe(a?0:1,{0(){return null},1(){return Dt({...p,hidden:!0,style:{display:"none"}},n,r,c,u)}})}return Dt(i,n,r,c,u)}function Dt(e,t={},n,r,o){let{as:s=n,children:c,refName:u="ref",...i}=yn(e,["unmount","static"]),l=e.ref!==void 0?{[u]:e.ref}:{},a=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(a)||Array.isArray(a)&&a.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 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(`
|
|
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=a.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=Fr(a.props,ze(yn(i,["ref"])));for(let w in p)w in b&&delete p[w];return f.cloneElement(a,Object.assign({},b,p,l,{ref:o(Zs(a),l.ref)},g))}return f.createElement(s,Object.assign({},yn(i,["ref"]),s!==f.Fragment&&l,s!==f.Fragment&&p),a)}function Xs(){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 Js(...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 Fr(...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 u of c){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;u(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 me(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 Zs(e){return f.version.split(".")[0]>="19"?e.props.ref:e.ref}function el(e,t,n){let[r,o]=f.useState(n),s=e!==void 0,c=f.useRef(s),u=f.useRef(!1),i=f.useRef(!1);return s&&!c.current&&!u.current?(u.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,G(l=>(s||o(l),t==null?void 0:t(l)))]}function tl(e){let[t]=f.useState(e);return t}function Ir(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))_r(n,Dr(t,r),o);return n}function Dr(e,t){return e?e+"["+t+"]":t}function _r(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())_r(e,Dr(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,""]):Ir(n,t,e)}function nl(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 rl="span";var wn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(wn||{});function ol(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 ge()({ourProps:s,theirProps:o,slot:{},defaultTag:rl,name:"Hidden"})}let kr=me(ol),il=f.createContext(null);function sl({children:e}){let t=f.useContext(il);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 ll({data:e,form:t,disabled:n,onReset:r,overrides:o}){let[s,c]=f.useState(null),u=ot();return f.useEffect(()=>{if(r&&s)return u.addEventListener(s,"reset",r)},[s,t,r]),f.createElement(sl,null,f.createElement(al,{setForm:c,formId:t}),Ir(e).map(([i,l])=>f.createElement(kr,{features:wn.Hidden,...ze({key:i,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:t,disabled:n,name:i,value:l,...o})})))}function al({setForm:e,formId:t}){return f.useEffect(()=>{if(t){let n=document.getElementById(t);n&&e(n)}},[e,t]),t?null:f.createElement(kr,{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 ul=f.createContext(void 0);function Rr(){return f.useContext(ul)}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 cl(e){return _t(e)&&"style"in e}function fl(e){return ke(e)&&e.nodeName==="IFRAME"}function Wr(e){return ke(e)&&e.nodeName==="INPUT"}function Br(e){return ke(e)&&e.nodeName==="LABEL"}function dl(e){return ke(e)&&e.nodeName==="FIELDSET"}function Vr(e){return ke(e)&&e.nodeName==="LEGEND"}function pl(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 ml(e){let t=e.parentElement,n=null;for(;t&&!dl(t);)Vr(t)&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&hl(n)?!1:r}function hl(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(Vr(t))return!1;t=t.previousElementSibling}return!0}let Ur=Symbol();function gl(e,t=!0){return Object.assign(e,{[Ur]:t})}function ye(...e){let t=f.useRef(e);f.useEffect(()=>{t.current=e},[e]);let n=G(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[Ur]))?void 0:n}let Cn=f.createContext(null);Cn.displayName="DescriptionContext";function zr(){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,zr),t}return e}function vl(){var e,t;return(t=(e=f.useContext(Cn))==null?void 0:e.value)!=null?t:void 0}let bl="p";function xl(e,t){let n=f.useId(),r=bn(),{id:o=`headlessui-description-${n}`,...s}=e,c=zr(),u=ye(t);te(()=>c.register(o),[o,c.register]);let i=r||!1,l=f.useMemo(()=>({...c.slot,disabled:i}),[c.slot,i]),a={ref:u,...c.props,id:o};return ge()({ourProps:a,theirProps:s,slot:l,defaultTag:bl,name:c.name||"Description"})}let yl=me(xl);Object.assign(yl,{});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 Hr(){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,Hr),t}return e}function Gr(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 wl({inherit:e=!1}={}){let t=Gr(),[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=G(i=>(r(l=>[...l,i]),()=>r(l=>{let a=l.slice(),p=a.indexOf(i);return p!==-1&&a.splice(p,1),a}))),u=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:u},s.children)},[r])]}let El="label";function Cl(e,t){var n;let r=f.useId(),o=Hr(),s=Rr(),c=bn(),{id:u=`headlessui-label-${r}`,htmlFor:i=s??((n=o.props)==null?void 0:n.htmlFor),passive:l=!1,...a}=e,p=ye(t);te(()=>o.register(u),[u,o.register]);let m=G(b=>{let w=b.currentTarget;if(!(b.target!==b.currentTarget&&pl(b.target))&&(Br(w)&&b.preventDefault(),o.props&&"onClick"in o.props&&typeof o.props.onClick=="function"&&o.props.onClick(b),Br(w))){let E=document.getElementById(w.htmlFor);if(E){let y=E.getAttribute("disabled");if(y==="true"||y==="")return;let C=E.getAttribute("aria-disabled");if(C==="true"||C==="")return;(Wr(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:u,htmlFor:i,onClick:m};return l&&("onClick"in g&&(delete g.htmlFor,delete g.onClick),"onClick"in a&&delete a.onClick),ge()({ourProps:g,theirProps:a,slot:h,defaultTag:i?El:"div",name:o.name||"Label"})}let Sl=me(Cl),$l=Object.assign(Sl,{});function Ol(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 Tl(e=Ol){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 Nl(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 Yr=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 Ml=Object.defineProperty,Pl=(e,t,n)=>t in e?Ml(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ll=(e,t,n)=>(Pl(e,t+"",n),n),Kr=(e,t,n)=>{if(!t.has(e))throw TypeError("Cannot "+n)},we=(e,t,n)=>(Kr(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)=>(Kr(e,t,"write to private field"),t.set(e,n),n),Me,yt,wt;let qr=class{constructor(t){Sn(this,Me,{}),Sn(this,yt,new Yr(()=>new Set)),Sn(this,wt,new Set),Ll(this,"disposables",Se()),Qr(this,Me,t),Ne.isServer&&this.disposables.microTask(()=>{this.dispose()})}dispose(){this.disposables.dispose()}get state(){return we(this,Me)}subscribe(t,n){if(Ne.isServer)return()=>{};let r={selector:t,callback:n,current:t(we(this,Me))};return we(this,wt).add(r),this.disposables.add(()=>{we(this,wt).delete(r)})}on(t,n){return Ne.isServer?()=>{}:(we(this,yt).get(t).add(n),this.disposables.add(()=>{we(this,yt).get(t).delete(n)}))}send(t){let n=this.reduce(we(this,Me),t);if(n!==we(this,Me)){Qr(this,Me,n);for(let r of we(this,wt)){let o=r.selector(we(this,Me));Xr(r.current,o)||(r.current=o,r.callback(o))}for(let r of we(this,yt).get(t.type))r(we(this,Me),t)}}};Me=new WeakMap,yt=new WeakMap,wt=new WeakMap;function Xr(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()):Jr(e)&&Jr(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 Jr(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=Se();return(...o)=>{t(...o),r.dispose(),r.microTask(n)}}var Fl=Object.defineProperty,jl=(e,t,n)=>t in e?Fl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t,n)=>(jl(e,typeof t!="symbol"?t+"":t,n),n),eo=(e=>(e[e.Push=0]="Push",e[e.Pop=1]="Pop",e))(eo||{});let Il={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}}},Dl=class os extends qr{constructor(){super(...arguments),Zr(this,"actions",{push:t=>this.send({type:0,id:t}),pop:t=>this.send({type:1,id:t})}),Zr(this,"selectors",{isTop:(t,n)=>t.stack[t.stack.length-1]===n,inStack:(t,n)=>t.stack.includes(n)})}static new(){return new os({stack:[]})}reduce(t,n){return xe(n.type,Il,t,n)}};const Tn=new Yr(()=>Dl.new());var An={exports:{}},Nn={};/**
|
|
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={};/**
|
|
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 no;function kl(){if(no)return An;no=1;var e=f;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,c=e.useMemo,a=e.useDebugValue;return An.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},An}var Mn={};/**
|
|
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 no;function kl(){return no||(no=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,u=t.useDebugValue;Mn.useSyncExternalStoreWithSelector=function(i,l,a,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 A=h.value;if(m(A,S))return y=A}return y=S}if(A=y,n(E,S))return A;var L=p(S);return m!==void 0&&m(A,L)?(E=S,A):(E=S,y=L)}var w=!1,E,y,C=a===void 0?null:a;return[function(){return b(l())},C===null?void 0:function(){return b(C())}]},[l,a,p,m]);var g=r(i,d[0],d[1]);return s(function(){h.hasValue=!0,h.value=g},[g]),u(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"?An.exports=_l():An.exports=kl();var Rl=An.exports;function Ee(e,t,n=Xr){return Rl.useSyncExternalStoreWithSelector(G(r=>e.subscribe(Wl,r)),G(()=>e.state),G(()=>e.state),G(t),n)}function Wl(e){return e}function ro(e,t){let n=f.useId(),r=Tn.get(t),[o,s]=Ee(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 oo(e){var t;let n=(t=Et.get(e))!=null?t:0;return Et.set(e,n+1),n!==0?()=>io(e):(Pn.set(e,{"aria-hidden":e.getAttribute("aria-hidden"),inert:e.inert}),e.setAttribute("aria-hidden","true"),e.inert=!0,()=>io(e))}function io(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 Bl(e,{allowed:t,disallowed:n}={}){let r=ro(e,"inert-others");te(()=>{var o,s;if(!r)return;let c=Se();for(let i of(o=n==null?void 0:n())!=null?o:[])i&&c.add(oo(i));let u=(s=t==null?void 0:t())!=null?s:[];for(let i of u){if(!i)continue;let l=xt(i);if(!l)continue;let a=i.parentElement;for(;a&&a!==l.body;){for(let p of a.children)u.some(m=>p.contains(m))||c.add(oo(p));a=a.parentElement}}return c.dispose},[r,t,n])}function Vl(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=Se();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(","),Ul=["[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||{}),zl=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(zl||{}),Hl=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Hl||{});function so(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 Gl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Ul)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var jn=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(jn||{});function lo(e,t=0){var n;return e===((n=xt(e))==null?void 0:n.body)?!1:xe(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 Yl=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(Yl||{});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 Kl=["textarea","input"].join(",");function Ql(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,Kl))!=null?n:!1}function ao(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 ql(e,t){return Xl(so(),t,{relativeTo:e})}function Xl(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?ao(e):e:t&64?Gl(e):so(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 u=(()=>{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}:{},a=0,p=c.length,m;do{if(a>=p||a+p<=0)return 0;let d=i+a;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),a+=u}while(m!==s.activeElement);return t&6&&Ql(m)&&m.select(),2}function uo(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function Jl(){return/Android/gi.test(window.navigator.userAgent)}function co(){return uo()||Jl()}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 Zl(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 fo=30;function ea(e,t,n){let r=Xe(n),o=f.useCallback(function(u,i){if(u.defaultPrevented)return;let l=i(u);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let a=function p(m){return typeof m=="function"?p(m()):Array.isArray(m)||m instanceof Set?m:[m]}(t);for(let p of a)if(p!==null&&(p.contains(l)||u.composed&&u.composedPath().includes(p)))return;return!lo(l,jn.Loose)&&l.tabIndex!==-1&&u.preventDefault(),r.current(u,l)},[r,t]),s=f.useRef(null);st(e,"pointerdown",u=>{var i,l;co()||(s.current=((l=(i=u.composedPath)==null?void 0:i.call(u))==null?void 0:l[0])||u.target)},!0),st(e,"pointerup",u=>{if(co()||!s.current)return;let i=s.current;return s.current=null,o(u,()=>i)},!0);let c=f.useRef({x:0,y:0});st(e,"touchstart",u=>{c.current.x=u.touches[0].clientX,c.current.y=u.touches[0].clientY},!0),st(e,"touchend",u=>{let i={x:u.changedTouches[0].clientX,y:u.changedTouches[0].clientY};if(!(Math.abs(i.x-c.current.x)>=fo||Math.abs(i.y-c.current.y)>=fo))return o(u,()=>it(u.target)?u.target:null)},!0),Zl(e,"blur",u=>o(u,()=>fl(window.document.activeElement)?window.document.activeElement:null),!0)}function In(...e){return f.useMemo(()=>xt(...e),[...e])}var ta=(e=>(e[e.Ignore=0]="Ignore",e[e.Select=1]="Select",e[e.Close=2]="Close",e))(ta||{});const Rt={Ignore:{kind:0},Select:e=>({kind:1,target:e}),Close:{kind:2}},na=200,po=5;function ra(e,{trigger:t,action:n,close:r,select:o}){let s=f.useRef(null),c=f.useRef(null),u=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,u.current=i.y,s.current=i.timeStamp)}),st(e&&t!==null,"pointerup",i=>{var l,a;let p=s.current;if(p===null||(s.current=null,!it(i.target))||Math.abs(i.x-((l=c.current)!=null?l:i.x))<po&&Math.abs(i.y-((a=u.current)!=null?a:i.y))<po)return;let m=n(i);switch(m.kind){case 0:return;case 1:{i.timeStamp-p>na&&(o(m.target),r());break}case 2:{r();break}}},{capture:!0})}function oa(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 ia(e){return f.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot)}function sa(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(u=>u()))}}}function la(){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 aa(){return uo()?{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 u=Se();u.style(e.documentElement,"scrollBehavior","auto"),t.add(()=>t.microTask(()=>u.dispose()))}let s=(o=window.scrollY)!=null?o:window.pageYOffset,c=null;t.addEventListener(e,"click",u=>{if(it(u.target))try{let i=u.target.closest("a");if(!i)return;let{hash:l}=new URL(i.href),a=e.querySelector(l);it(a)&&!r(a)&&(c=a)}catch{}},!0),t.addEventListener(e,"touchstart",u=>{if(it(u.target)&&cl(u.target))if(r(u.target)){let i=u.target;for(;i.parentElement&&r(i.parentElement);)i=i.parentElement;t.style(i,"overscrollBehavior","contain")}else t.style(u.target,"touchAction","none")}),t.addEventListener(e,"touchmove",u=>{if(it(u.target)){if(Wr(u.target))return;if(r(u.target)){let i=u.target;for(;i.parentElement&&i.dataset.headlessuiPortal!==""&&!(i.scrollHeight>i.clientHeight||i.scrollWidth>i.clientWidth);)i=i.parentElement;i.dataset.headlessuiPortal===""&&u.preventDefault()}else u.preventDefault()}},{passive:!1}),t.add(()=>{var u;let i=(u=window.scrollY)!=null?u:window.pageYOffset;s!==i&&window.scrollTo(0,s),c&&c.isConnected&&(c.scrollIntoView({block:"nearest"}),c=null)})})}}:{}}function ua(){return{before({doc:e,d:t}){t.style(e.documentElement,"overflow","hidden")}}}function ca(e){let t={};for(let n of e)Object.assign(t,n(t));return t}let Je=sa(()=>new Map,{PUSH(e,t){var n;let r=(n=this.get(e))!=null?n:{doc:e,count:0,d:Se(),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:ca(n)},o=[aa(),la(),ua()];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 fa(e,t,n=()=>({containers:[]})){let r=ia(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 da(e,t,n=()=>[document.body]){let r=ro(e,"scroll-lock");fa(r,t,o=>{var s;return{containers:[...(s=o.containers)!=null?s:[],n]}})}function mo(e){return[e.screenX,e.screenY]}function pa(){let e=f.useRef([-1,-1]);return{wasMoved(t){let n=mo(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=mo(t)}}}function ma(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]),u=f.useCallback(i=>n(l=>l^i),[n]);return{flags:t,setFlag:r,addFlag:o,hasFlag:s,removeFlag:c,toggleFlag:u}}var ho,go;typeof process<"u"&&typeof globalThis<"u"&&typeof Element<"u"&&((ho=process==null?void 0:process.env)==null?void 0:ho.NODE_ENV)==="test"&&typeof((go=Element==null?void 0:Element.prototype)==null?void 0:go.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 ha=(e=>(e[e.None=0]="None",e[e.Closed=1]="Closed",e[e.Enter=2]="Enter",e[e.Leave=4]="Leave",e))(ha||{});function vo(e){let t={};for(let n in e)e[n]===!0&&(t[`data-${n}`]="");return t}function bo(e,t,n,r){let[o,s]=f.useState(n),{hasFlag:c,addFlag:u,removeFlag:i}=ma(e&&o?3:0),l=f.useRef(!1),a=f.useRef(!1),p=ot();return te(()=>{var m;if(e){if(n&&s(!0),!t){n&&u(3);return}return(m=r==null?void 0:r.start)==null||m.call(r,n),ga(t,{inFlight:l,prepare(){a.current?a.current=!1:a.current=l.current,l.current=!0,!a.current&&(n?(u(3),i(4)):(u(4),i(2)))},run(){a.current?n?(i(3),u(4)):(i(4),u(3)):n?i(1):u(1)},done(){var d;a.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 ga(e,{prepare:t,run:n,done:r,inFlight:o}){let s=Se();return ba(e,{prepare:t,inFlight:o}),s.nextFrame(()=>{n(),s.requestAnimationFrame(()=>{s.add(va(e,r))})}),s.dispose}function va(e,t){var n,r;let o=Se();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(u=>u instanceof CSSTransition))!=null?r:[];return c.length===0?(t(),o.dispose):(Promise.allSettled(c.map(u=>u.finished)).then(()=>{s||t()}),o.dispose)}function ba(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 xo(e)?(e.nodeName||"").toLowerCase():"#document"}function ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Pe(e){var t;return(t=(xo(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function xo(e){return Wt()?e instanceof Node||e instanceof ve(e).Node:!1}function ue(e){return Wt()?e instanceof Element||e instanceof ve(e).Element:!1}function Le(e){return Wt()?e instanceof HTMLElement||e instanceof ve(e).HTMLElement:!1}function yo(e){return!Wt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ve(e).ShadowRoot}const xa=new Set(["inline","contents"]);function Ct(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=$e(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!xa.has(o)}const ya=new Set(["table","td","th"]);function wa(e){return ya.has(lt(e))}const Ea=[":popover-open",":modal"];function Bt(e){return Ea.some(t=>{try{return e.matches(t)}catch{return!1}})}const Ca=["transform","translate","scale","rotate","perspective"],Sa=["transform","translate","scale","rotate","perspective","filter"],$a=["paint","layout","strict","content"];function Dn(e){const t=_n(),n=ue(e)?$e(e):e;return Ca.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)||Sa.some(r=>(n.willChange||"").includes(r))||$a.some(r=>(n.contain||"").includes(r))}function Oa(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 Ta=new Set(["html","body","#document"]);function at(e){return Ta.has(lt(e))}function $e(e){return ve(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||yo(e)&&e.host||Pe(e);return yo(t)?t.host:t}function wo(e){const t=He(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:Le(t)&&Ct(t)?t:wo(t)}function St(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=wo(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),c=ve(o);if(s){const u=kn(c);return t.concat(c,c.visualViewport||[],Ct(o)?o:[],u&&n?St(u):[])}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}),Na={left:"right",right:"left",bottom:"top",top:"bottom"},Ma={start:"end",end:"start"};function Eo(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 Co(e){return e==="x"?"y":"x"}function So(e){return e==="y"?"height":"width"}const Pa=new Set(["top","bottom"]);function Re(e){return Pa.has(Ge(e))?"y":"x"}function $o(e){return Co(Re(e))}function La(e,t,n){n===void 0&&(n=!1);const r=Ot(e),o=$o(e),s=So(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 Fa(e){const t=zt(e);return[Rn(e),t,Rn(t)]}function Rn(e){return e.replace(/start|end/g,t=>Ma[t])}const Oo=["left","right"],To=["right","left"],ja=["top","bottom"],Ia=["bottom","top"];function Da(e,t,n){switch(e){case"top":case"bottom":return n?t?To:Oo:t?Oo:To;case"left":case"right":return t?ja:Ia;default:return[]}}function _a(e,t,n,r){const o=Ot(e);let s=Da(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=>Na[t])}function ka(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ra(e){return typeof e!="number"?ka(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=$o(t),u=So(c),i=Ge(t),l=s==="y",a=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[u]/2-o[u]/2;let d;switch(i){case"top":d={x:a,y:r.y-o.height};break;case"bottom":d={x:a,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 Wa=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:c}=n,u=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:a,y:p}=Ao(l,r,i),m=r,d={},h=0;for(let g=0;g<u.length;g++){const{name:b,fn:w}=u[g],{x:E,y,data:C,reset:S}=await w({x:a,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:d,rects:l,platform:c,elements:{reference:e,floating:t}});a=E??a,p=y??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:a,y:p}=Ao(l,m,i)),g=-1)}return{x:a,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:u,strategy:i}=e,{boundary:l="clippingAncestors",rootBoundary:a="viewport",elementContext:p="floating",altBoundary:m=!1,padding:d=0}=ut(t,e),h=Ra(d),b=u[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(u.floating)),boundary:l,rootBoundary:a,strategy:i})),E=p==="floating"?{x:r,y:o,width:c.floating.width,height:c.floating.height}:c.reference,y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u.floating)),C=await(s.isElement==null?void 0:s.isElement(y))?await(s.getScale==null?void 0:s.getScale(y))||{x:1,y:1}:{x:1,y:1},S=Ht(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:E,offsetParent:y,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 Ba=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:u,platform:i,elements:l}=t,{mainAxis:a=!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(u),y=Ge(u)===u,C=await(i.isRTL==null?void 0:i.isRTL(l.floating)),S=m||(y||!g?[zt(u)]:Fa(u)),A=h!=="none";!m&&A&&S.push(..._a(u,g,h,C));const L=[u,...S],_=await Gt(t,b),j=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(a&&j.push(_[w]),p){const I=La(o,c,C);j.push(_[I[0]],_[I[1]])}if(N=[...N,{placement:o,overflows:j}],!j.every(I=>I<=0)){var T,K;const I=(((T=s.flip)==null?void 0:T.index)||0)+1,V=L[I];if(V&&(!(p==="alignment"?E!==Re(V):!1)||N.every(O=>Re(O.placement)===E?O.overflows[0]>0:!0)))return{data:{index:I,overflows:N},reset:{placement:V}};let U=(K=N.filter(F=>F.overflows[0]<=0).sort((F,O)=>F.overflows[1]-O.overflows[1])[0])==null?void 0:K.placement;if(!U)switch(d){case"bestFit":{var R;const F=(R=N.filter(O=>{if(A){const k=Re(O.placement);return k===E||k==="y"}return!0}).map(O=>[O.placement,O.overflows.filter(k=>k>0).reduce((k,D)=>k+D,0)]).sort((O,k)=>O[1]-k[1])[0])==null?void 0:R[0];F&&(U=F);break}case"initialPlacement":U=u;break}if(o!==U)return{reset:{placement:U}}}return{}}}},Va=new Set(["left","top"]);async function Ua(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),c=Ge(n),u=Ot(n),i=Re(n)==="y",l=Va.has(c)?-1:1,a=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 u&&typeof h=="number"&&(d=u==="end"?h*-1:h),i?{x:d*a,y:m*l}:{x:m*l,y:d*a}}const za=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:u}=t,i=await Ua(t,e);return c===((n=u.offset)==null?void 0:n.placement)&&(r=u.arrow)!=null&&r.alignmentOffset?{}:{x:o+i.x,y:s+i.y,data:{...i,placement:c}}}}},Ha=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:u={fn:b=>{let{x:w,y:E}=b;return{x:w,y:E}}},...i}=ut(e,t),l={x:n,y:r},a=await Gt(t,i),p=Re(Ge(o)),m=Co(p);let d=l[m],h=l[p];if(s){const b=m==="y"?"top":"left",w=m==="y"?"bottom":"right",E=d+a[b],y=d-a[w];d=Eo(E,d,y)}if(c){const b=p==="y"?"top":"left",w=p==="y"?"bottom":"right",E=h+a[b],y=h-a[w];h=Eo(E,h,y)}const g=u.fn({...t,[m]:d,[p]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[m]:s,[p]:c}}}}}},Ga=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:u}=t,{apply:i=()=>{},...l}=ut(e,t),a=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(u.floating))?"start":"end")?"left":"right"):(w=p,b=m==="end"?"top":"bottom");const E=g-a.top-a.bottom,y=h-a.left-a.right,C=Ze(g-a[b],E),S=Ze(h-a[w],y),A=!t.middlewareData.shift;let L=C,_=S;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(L=E),A&&!m){const N=ce(a.left,0),T=ce(a.right,0),K=ce(a.top,0),R=ce(a.bottom,0);d?_=h-2*(N!==0||T!==0?N+T:ce(a.left,a.right)):L=g-2*(K!==0||R!==0?K+R:ce(a.top,a.bottom))}await i({...t,availableWidth:_,availableHeight:L});const j=await c.getDimensions(u.floating);return h!==j.width||g!==j.height?{reset:{rects:!0}}:{}}}};function No(e){const t=$e(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,u=$t(n)!==s||$t(r)!==c;return u&&(n=s,r=c),{width:n,height:r,$:u}}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}=No(t);let c=(s?$t(n.width):n.width)/r,u=(s?$t(n.height):n.height)/o;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const Ya=Fe(0);function Mo(e){const t=ve(e);return!_n()||!t.visualViewport?Ya:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Ka(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ve(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 u=Ka(s,n,r)?Mo(s):Fe(0);let i=(o.left+u.x)/c.x,l=(o.top+u.y)/c.y,a=o.width/c.x,p=o.height/c.y;if(s){const m=ve(s),d=r&&ue(r)?ve(r):r;let h=m,g=kn(h);for(;g&&r&&d!==h;){const b=ct(g),w=g.getBoundingClientRect(),E=$e(g),y=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,a*=b.x,p*=b.y,i+=y,l+=C,h=ve(g),g=kn(h)}}return Ht({width:a,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 Po(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),u=t?Bt(t.floating):!1;if(r===c||u&&s)return n;let i={scrollLeft:0,scrollTop:0},l=Fe(1);const a=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),a.x=d.x+r.clientLeft,a.y=d.y+r.clientTop}const m=c&&!p&&!s?Po(c,i):Fe(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-i.scrollLeft*l.x+a.x+m.x,y:n.y*l.y-i.scrollTop*l.y+a.y+m.y}}function qa(e){return Array.from(e.getClientRects())}function Xa(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 u=-n.scrollTop;return $e(r).direction==="rtl"&&(c+=ce(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:c,y:u}}const Lo=25;function Ja(e,t){const n=ve(e),r=Pe(e),o=n.visualViewport;let s=r.clientWidth,c=r.clientHeight,u=0,i=0;if(o){s=o.width,c=o.height;const a=_n();(!a||a&&t==="fixed")&&(u=o.offsetLeft,i=o.offsetTop)}const l=Yt(r);if(l<=0){const a=r.ownerDocument,p=a.body,m=getComputedStyle(p),d=a.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,h=Math.abs(r.clientWidth-p.clientWidth-d);h<=Lo&&(s-=h)}else l<=Lo&&(s+=l);return{width:s,height:c,x:u,y:i}}const Za=new Set(["absolute","fixed"]);function eu(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,u=e.clientHeight*s.y,i=o*s.x,l=r*s.y;return{width:c,height:u,x:i,y:l}}function Fo(e,t,n){let r;if(t==="viewport")r=Ja(e,n);else if(t==="document")r=Xa(Pe(e));else if(ue(t))r=eu(t,n);else{const o=Mo(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:$e(n).position==="fixed"||jo(n,t)}function tu(e,t){const n=t.get(e);if(n)return n;let r=St(e,[],!1).filter(u=>ue(u)&<(u)!=="body"),o=null;const s=$e(e).position==="fixed";let c=s?He(e):e;for(;ue(c)&&!at(c);){const u=$e(c),i=Dn(c);!i&&u.position==="fixed"&&(o=null),(s?!i&&!o:!i&&u.position==="static"&&!!o&&Za.has(o.position)||Ct(c)&&!i&&jo(e,c))?r=r.filter(a=>a!==c):o=u,c=He(c)}return t.set(e,r),r}function nu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const c=[...n==="clippingAncestors"?Bt(t)?[]:tu(t,this._c):[].concat(n),r],u=c[0],i=c.reduce((l,a)=>{const p=Fo(t,a,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},Fo(t,u,o));return{width:i.right-i.left,height:i.bottom-i.top,x:i.left,y:i.top}}function ru(e){const{width:t,height:n}=No(e);return{width:t,height:n}}function ou(e,t,n){const r=Le(t),o=Pe(t),s=n==="fixed",c=et(e,!0,s,t);let u={scrollLeft:0,scrollTop:0};const i=Fe(0);function l(){i.x=Yt(o)}if(r||!r&&!s)if((lt(t)!=="body"||Ct(o))&&(u=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 a=o&&!r&&!s?Po(o,u):Fe(0),p=c.left+u.scrollLeft-i.x-a.x,m=c.top+u.scrollTop-i.y-a.y;return{x:p,y:m,width:c.width,height:c.height}}function Bn(e){return $e(e).position==="static"}function Io(e,t){if(!Le(e)||$e(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Pe(e)===n&&(n=n.ownerDocument.body),n}function Do(e,t){const n=ve(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=Io(e,t);for(;r&&wa(r)&&Bn(r);)r=Io(r,t);return r&&at(r)&&Bn(r)&&!Dn(r)?n:r||Oa(e)||n}const iu=async function(e){const t=this.getOffsetParent||Do,n=this.getDimensions,r=await n(e.floating);return{reference:ou(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function su(e){return $e(e).direction==="rtl"}const lu={convertOffsetParentRelativeRectToViewportRelativeRect:Qa,getDocumentElement:Pe,getClippingRect:nu,getOffsetParent:Do,getElementRects:iu,getClientRects:qa,getDimensions:ru,getScale:ct,isElement:ue,isRTL:su};function _o(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function au(e,t){let n=null,r;const o=Pe(e);function s(){var u;clearTimeout(r),(u=n)==null||u.disconnect(),n=null}function c(u,i){u===void 0&&(u=!1),i===void 0&&(i=1),s();const l=e.getBoundingClientRect(),{left:a,top:p,width:m,height:d}=l;if(u||t(),!m||!d)return;const h=Ut(p),g=Ut(o.clientWidth-(a+m)),b=Ut(o.clientHeight-(p+d)),w=Ut(a),y={rootMargin:-h+"px "+-g+"px "+-b+"px "+-w+"px",threshold:ce(0,Ze(1,i))||1};let C=!0;function S(A){const L=A[0].intersectionRatio;if(L!==i){if(!C)return c();L?c(!1,L):r=setTimeout(()=>{c(!1,1e-7)},1e3)}L===1&&!_o(l,e.getBoundingClientRect())&&c(),C=!1}try{n=new IntersectionObserver(S,{...y,root:o.ownerDocument})}catch{n=new IntersectionObserver(S,y)}n.observe(e)}return c(!0),s}function uu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:i=!1}=r,l=Wn(e),a=o||s?[...l?St(l):[],...St(t)]:[];a.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=l&&u?au(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 y;(y=d)==null||y.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&&!_o(g,w)&&n(),g=w,h=requestAnimationFrame(b)}return n(),()=>{var w;a.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,cu=za,fu=Ha,du=Ba,pu=Ga,mu=(e,t,n)=>{const r=new Map,o={platform:lu,...n},s={...o.platform,_c:r};return Wa(e,t,{...o,platform:s})};var hu=typeof document<"u",gu=function(){},Kt=hu?f.useLayoutEffect:gu;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 ko(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ro(e,t){const n=ko(e);return Math.round(t*n)/n}function Un(e){const t=P.useRef(e);return Kt(()=>{t.current=e}),t}function vu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:c}={},transform:u=!0,whileElementsMounted:i,open:l}=e,[a,p]=P.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,d]=P.useState(r);Qt(m,r)||d(r);const[h,g]=P.useState(null),[b,w]=P.useState(null),E=P.useCallback(O=>{O!==A.current&&(A.current=O,g(O))},[]),y=P.useCallback(O=>{O!==L.current&&(L.current=O,w(O))},[]),C=s||h,S=c||b,A=P.useRef(null),L=P.useRef(null),_=P.useRef(a),j=i!=null,N=Un(i),T=Un(o),K=Un(l),R=P.useCallback(()=>{if(!A.current||!L.current)return;const O={placement:t,strategy:n,middleware:m};T.current&&(O.platform=T.current),mu(A.current,L.current,O).then(k=>{const D={...k,isPositioned:K.current!==!1};I.current&&!Qt(_.current,D)&&(_.current=D,Mt.flushSync(()=>{p(D)}))})},[m,t,n,T,K]);Kt(()=>{l===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,p(O=>({...O,isPositioned:!1})))},[l]);const I=P.useRef(!1);Kt(()=>(I.current=!0,()=>{I.current=!1}),[]),Kt(()=>{if(C&&(A.current=C),S&&(L.current=S),C&&S){if(N.current)return N.current(C,S,R);R()}},[C,S,R,N,j]);const V=P.useMemo(()=>({reference:A,floating:L,setReference:E,setFloating:y}),[E,y]),U=P.useMemo(()=>({reference:C,floating:S}),[C,S]),F=P.useMemo(()=>{const O={position:n,left:0,top:0};if(!U.floating)return O;const k=Ro(U.floating,a.x),D=Ro(U.floating,a.y);return u?{...O,transform:"translate("+k+"px, "+D+"px)",...ko(U.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:k,top:D}},[n,u,U.floating,a.x,a.y]);return P.useMemo(()=>({...a,update:R,refs:V,elements:U,floatingStyles:F}),[a,R,V,U,F])}const Wo=(e,t)=>({...cu(e),options:[e,t]}),bu=(e,t)=>({...fu(e),options:[e,t]}),xu=(e,t)=>({...du(e),options:[e,t]}),yu=(e,t)=>({...pu(e),options:[e,t]}),Bo={...P},wu=Bo.useInsertionEffect||(e=>e());function Vo(e){const t=P.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return wu(()=>{t.current=e}),P.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 Uo=!1,Eu=0;const zo=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Eu++;function Cu(){const[e,t]=P.useState(()=>Uo?zo():void 0);return zn(()=>{e==null&&t(zo())},[]),P.useEffect(()=>{Uo=!0},[]),e}const Su=Bo.useId||Cu;let Tt;process.env.NODE_ENV!=="production"&&(Tt=new Set);function $u(){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 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.error(o)}}function Tu(){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=P.createContext(null),Nu=P.createContext(null),Mu=()=>{var e;return((e=P.useContext(Au))==null?void 0:e.id)||null},Pu=()=>P.useContext(Nu),Lu="data-floating-ui-focusable";function Fu(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=Su(),s=P.useRef({}),[c]=P.useState(()=>Tu()),u=Mu()!=null;if(process.env.NODE_ENV!=="production"){const d=r.reference;d&&!ue(d)&&Ou("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]=P.useState(r.reference),a=Vo((d,h,g)=>{s.current.openEvent=d?h:void 0,c.emit("openchange",{open:d,event:h,reason:g,nested:u}),n==null||n(d,h,g)}),p=P.useMemo(()=>({setPositionReference:l}),[]),m=P.useMemo(()=>({reference:i||r.reference||null,floating:r.floating||null,domReference:r.reference}),[i,r.reference,r.floating]);return P.useMemo(()=>({dataRef:s,open:t,onOpenChange:a,elements:m,events:c,floatingId:o,refs:p}),[t,a,m,c,o,p])}function ju(e){e===void 0&&(e={});const{nodeId:t}=e,n=Fu({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[s,c]=P.useState(null),[u,i]=P.useState(null),a=(o==null?void 0:o.domReference)||s,p=P.useRef(null),m=Pu();zn(()=>{a&&(p.current=a)},[a]);const d=vu({...e,elements:{...o,...u&&{reference:u}}}),h=P.useCallback(y=>{const C=ue(y)?{getBoundingClientRect:()=>y.getBoundingClientRect(),contextElement:y}:y;i(C),d.refs.setReference(C)},[d.refs]),g=P.useCallback(y=>{(ue(y)||y===null)&&(p.current=y,c(y)),(ue(d.refs.reference.current)||d.refs.reference.current===null||y!==null&&!ue(y))&&d.refs.setReference(y)},[d.refs]),b=P.useMemo(()=>({...d.refs,setReference:g,setPositionReference:h,domReference:p}),[d.refs,g,h]),w=P.useMemo(()=>({...d.elements,domReference:a}),[d.elements,a]),E=P.useMemo(()=>({...d,...r,refs:b,elements:w,nodeId:t}),[d,b,w,t,r]);return zn(()=>{r.dataRef.current.floatingContext=E;const y=m==null?void 0:m.nodesRef.current.find(C=>C.id===t);y&&(y.context=E)}),P.useMemo(()=>({...d,context:E,refs:b,elements:w}),[d,b,w,E])}const Ho="active",Go="selected";function Hn(e,t,n){const r=new Map,o=n==="item";let s=e;if(o&&e){const{[Ho]:c,[Go]:u,...i}=e;s=i}return{...n==="floating"&&{tabIndex:-1,[Lu]:""},...s,...t.map(c=>{const u=c?c[n]:null;return typeof u=="function"?e?u(e):null:u}).concat(e).reduce((c,u)=>(u&&Object.entries(u).forEach(i=>{let[l,a]=i;if(!(o&&[Ho,Go].includes(l)))if(l.indexOf("on")===0){if(r.has(l)||r.set(l,[]),typeof a=="function"){var p;(p=r.get(l))==null||p.push(a),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]=a}),c),{})}}function Iu(e){e===void 0&&(e=[]);const t=e.map(u=>u==null?void 0:u.reference),n=e.map(u=>u==null?void 0:u.floating),r=e.map(u=>u==null?void 0:u.item),o=P.useCallback(u=>Hn(u,e,"reference"),t),s=P.useCallback(u=>Hn(u,e,"floating"),n),c=P.useCallback(u=>Hn(u,e,"item"),r);return P.useMemo(()=>({getReferenceProps:o,getFloatingProps:s,getItemProps:c}),[o,s,c])}function Yo(e,t){return{...e,rects:{...e.rects,floating:{...e.rects.floating,height:t}}}}const Du=e=>({name:"inner",options:e,async fn(t){const{listRef:n,overflowRef:r,onFallbackChange:o,offset:s=0,index:c=0,minItemsVisible:u=4,referenceOverflowThreshold:i=0,scrollRef:l,...a}=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")||$u('`placement` side must be "bottom" when using the `inner`',"middleware.")),!d)return{};const y={...t,...await Wo(-d.offsetTop-m.clientTop-p.reference.height/2-d.offsetHeight/2-s).fn(t)},C=await Vn(Yo(y,h.scrollHeight+g+m.clientTop),a),S=await Vn(y,{...a,elementContext:"reference"}),A=ce(0,C.top),L=y.y+A,N=(h.scrollHeight>h.clientHeight?T=>T:$t)(ce(0,h.scrollHeight+(b&&E||w?g*2:0)-A-ce(0,C.bottom)));if(h.style.maxHeight=N+"px",h.scrollTop=A,o){const T=h.offsetHeight<d.offsetHeight*Ze(u,n.current.length)-1||S.top>=-i||S.bottom>=-i;Mt.flushSync(()=>o(T))}return r&&(r.current=await Vn(Yo({...y,y:L},h.offsetHeight+g+m.clientTop),a)),{y:L}}});function _u(e,t){const{open:n,elements:r}=e,{enabled:o=!0,overflowRef:s,scrollRef:c,onChange:u}=t,i=Vo(u),l=P.useRef(!1),a=P.useRef(null),p=P.useRef(null);P.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,y=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(A=>A+Math[S](b,y*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(()=>{a.current=h.scrollTop,s.current!=null&&(p.current={...s.current})}),()=>{a.current=null,p.current=null,h.removeEventListener("wheel",d)}},[o,n,r.floating,s,c,i]);const m=P.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(a.current!==null){const h=d.scrollTop-a.current;(s.current.bottom<-.5&&h<-1||s.current.top<-.5&&h>1)&&Mt.flushSync(()=>i(g=>g+h))}requestAnimationFrame(()=>{a.current=d.scrollTop})}}}),[r.floating,i,s,c]);return P.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 ku(e){return f.useMemo(()=>e?typeof e=="string"?{to:e}:e:null,[e])}function Ru(){return f.useContext(ft).setReference}function Wu(){return f.useContext(ft).getReferenceProps}function Bu(){let{getFloatingProps:e,slot:t}=f.useContext(ft);return f.useCallback((...n)=>Object.assign({},e(...n),{"data-anchor":t.anchor}),[e,t])}function Vu(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 Ko=4;function Uu({children:e,enabled:t=!0}){let[n,r]=f.useState(null),[o,s]=f.useState(0),c=f.useRef(null),[u,i]=f.useState(null);zu(u);let l=t&&n!==null&&u!==null,{to:a="bottom",gap:p=0,offset:m=0,padding:d=0,inner:h}=Hu(n,u),[g,b="center"]=a.split(" ");te(()=>{l&&s(0)},[l]);let{refs:w,floatingStyles:E,context:y}=ju({open:l,placement:g==="selection"?b==="center"?"bottom":`bottom-${b}`:b==="center"?`${g}`:`${g}-${b}`,strategy:"absolute",transform:!1,middleware:[Wo({mainAxis:g==="selection"?0:p,crossAxis:m}),bu({padding:d}),g!=="selection"&&xu({padding:d}),g==="selection"&&h?Du({...h,padding:d,overflowRef:c,offset:o,minItemsVisible:Ko,referenceOverflowThreshold:d,onFallbackChange(T){var K,R;if(!T)return;let I=y.elements.floating;if(!I)return;let V=parseFloat(getComputedStyle(I).scrollPaddingBottom)||0,U=Math.min(Ko,I.childElementCount),F=0,O=0;for(let k of(R=(K=y.elements.floating)==null?void 0:K.childNodes)!=null?R:[])if(ke(k)){let D=k.offsetTop,X=D+k.clientHeight+V,Q=I.scrollTop,q=Q+I.clientHeight;if(D>=Q&&X<=q)U--;else{O=Math.max(0,Math.min(X,q)-Math.max(D,Q)),F=k.clientHeight;break}}U>=1&&s(k=>{let D=F*U-O+V;return k>=D?k:D})}}):null,yu({padding:d,apply({availableWidth:T,availableHeight:K,elements:R}){Object.assign(R.floating.style,{overflow:"auto",maxWidth:`${T}px`,maxHeight:`min(var(--anchor-max-height, 100vh), ${K}px)`})}})].filter(Boolean),whileElementsMounted:uu}),[C=g,S=b]=y.placement.split("-");g==="selection"&&(C="selection");let A=f.useMemo(()=>({anchor:[C,S].filter(Boolean).join(" ")}),[C,S]),L=_u(y,{overflowRef:c,onChange:s}),{getReferenceProps:_,getFloatingProps:j}=Iu([L]),N=G(T=>{i(T),w.setFloating(T)});return P.createElement(Gn.Provider,{value:r},P.createElement(ft.Provider,{value:{setFloating:N,setReference:w.setReference,styles:E,getReferenceProps:_,getFloatingProps:j,slot:A}},e))}function zu(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 Hu(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),u=Yn((o=e==null?void 0:e.padding)!=null?o:"var(--anchor-padding, 0)",t);return{...e,gap:s,offset:c,padding:u}}function Yn(e,t,n=void 0){let r=ot(),o=G((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 a=qo(i,l);return[a,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 y=window.getComputedStyle(l).getPropertyValue(E);if(d[w]!==y){d[w]=y,g=!0;break}}if(!g)return;let b=qo(i,l);a!==b&&(p(b),a=b)})}return r.dispose}]}return[n,null]}),s=f.useMemo(()=>o(e,t)[0],[e,t]),[c=s,u]=f.useState();return te(()=>{let[i,l]=o(e,t);if(u(i),!!l)return l(u)},[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 qo(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 Gu(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 Oe=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(Oe||{});function Qn(){return f.useContext(Kn)}function Xo({value:e,children:t}){return f.createElement(Kn.Provider,{value:e},t)}function Yu(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:Yu(e)}}var Jo=(e=>(e[e.Left=0]="Left",e[e.Right=2]="Right",e))(Jo||{});function Zo(e){let t=G(e),n=f.useRef(!1);f.useEffect(()=>(n.current=!1,()=>{n.current=!0,Lr(()=>{n.current&&t()})}),[t])}function Ku(){let e=typeof document>"u";return"useSyncExternalStore"in P?(t=>t.useSyncExternalStore)(P)(()=>()=>{},()=>!1,()=>!e):!1}function qn(){let e=Ku(),[t,n]=P.useState(Ne.isHandoffComplete);return t&&Ne.isHandoffComplete===!1&&n(!1),P.useEffect(()=>{t!==!0&&n(!0)},[t]),P.useEffect(()=>Ne.handoff(),[]),e?!1:t}let Qu=f.createContext(!1);function qu(){return f.useContext(Qu)}function Xu(e){let t=qu(),n=f.useContext(ti),[r,o]=f.useState(()=>{var s;if(!t&&n!==null)return(s=n.current)!=null?s:null;if(Ne.isServer)return null;let c=e==null?void 0:e.getElementById("headlessui-portal-root");if(c)return c;if(e===null)return null;let u=e.createElement("div");return u.setAttribute("id","headlessui-portal-root"),e.body.appendChild(u)});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 ei=f.Fragment,Ju=me(function(e,t){let{ownerDocument:n=null,...r}=e,o=f.useRef(null),s=ye(gl(d=>{o.current=d}),t),c=In(o),u=n??c,i=Xu(u),[l]=f.useState(()=>{var d;return Ne.isServer?null:(d=u==null?void 0:u.createElement("div"))!=null?d:null}),a=f.useContext(nc),p=qn();te(()=>{!i||!l||i.contains(l)||(l.setAttribute("data-headlessui-portal",""),i.appendChild(l))},[i,l]),te(()=>{if(l&&a)return a.register(l)},[a,l]),Zo(()=>{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=ge();return p?!i||!l?null:de.createPortal(m({ourProps:{ref:s},theirProps:r,slot:{},defaultTag:ei,name:"Portal"}),l):null});function Zu(e,t){let n=ye(t),{enabled:r=!0,ownerDocument:o,...s}=e,c=ge();return r?f.createElement(Ju,{...s,ownerDocument:o,ref:n}):c({ourProps:{ref:n},theirProps:s,slot:{},defaultTag:ei,name:"Portal"})}let ec=f.Fragment,ti=f.createContext(null);function tc(e,t){let{target:n,...r}=e,o={ref:ye(t)},s=ge();return f.createElement(ti.Provider,{value:n},s({ourProps:o,theirProps:r,defaultTag:ec,name:"Popover.Group"}))}let nc=f.createContext(null),rc=me(Zu),oc=me(tc),ic=Object.assign(rc,{Group:oc});function sc(){let e=f.useRef(!1);return te(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function ni(e){var t;return!!(e.enter||e.enterFrom||e.enterTo||e.leave||e.leaveFrom||e.leaveTo)||((t=e.as)!=null?t:oi)!==f.Fragment||f.Children.count(e.children)===1}let Xt=f.createContext(null);Xt.displayName="TransitionContext";var lc=(e=>(e.Visible="visible",e.Hidden="hidden",e))(lc||{});function ac(){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 uc(){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 ri(e,t){let n=Xe(e),r=f.useRef([]),o=sc(),s=ot(),c=G((d,h=Ue.Hidden)=>{let g=r.current.findIndex(({el:b})=>b===d);g!==-1&&(xe(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))}))}),u=G(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()),a=f.useRef({enter:[],leave:[]}),p=G((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(a.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=G((d,h,g)=>{Promise.all(a.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:u,unregister:c,onStart:p,onStop:m,wait:l,chains:a}),[u,c,r,p,m,a,l])}let oi=f.Fragment,ii=It.RenderStrategy;function cc(e,t){var n,r;let{transition:o=!0,beforeEnter:s,afterEnter:c,beforeLeave:u,afterLeave:i,enter:l,enterFrom:a,enterTo:p,entered:m,leave:d,leaveFrom:h,leaveTo:g,...b}=e,[w,E]=f.useState(null),y=f.useRef(null),C=ni(e),S=ye(...C?[y,t,E]:t===null?[]:[t]),A=(n=b.unmount)==null||n?Ue.Unmount:Ue.Hidden,{show:L,appear:_,initial:j}=ac(),[N,T]=f.useState(L?"visible":"hidden"),K=uc(),{register:R,unregister:I}=K;te(()=>R(y),[R,y]),te(()=>{if(A===Ue.Hidden&&y.current){if(L&&N!=="visible"){T("visible");return}return xe(N,{hidden:()=>I(y),visible:()=>R(y)})}},[N,y,R,I,L,A]);let V=qn();te(()=>{if(C&&V&&N==="visible"&&y.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[y,N,V,C]);let U=j&&!_,F=_&&L&&j,O=f.useRef(!1),k=ri(()=>{O.current||(T("hidden"),I(y))},K),D=G(B=>{O.current=!0;let ne=B?"enter":"leave";k.onStart(y,ne,fe=>{fe==="enter"?s==null||s():fe==="leave"&&(u==null||u())})}),X=G(B=>{let ne=B?"enter":"leave";O.current=!1,k.onStop(y,ne,fe=>{fe==="enter"?c==null||c():fe==="leave"&&(i==null||i())}),ne==="leave"&&!Zt(k)&&(T("hidden"),I(y))});f.useEffect(()=>{C&&o||(D(L),X(L))},[L,C,o]);let Q=!(!o||!C||!V||U),[,q]=bo(Q,w,L,{start:D,end:X}),Ae=ze({ref:S,className:((r=xn(b.className,F&&l,F&&a,q.enter&&l,q.enter&&q.closed&&a,q.enter&&!q.closed&&p,q.leave&&d,q.leave&&!q.closed&&h,q.leave&&q.closed&&g,!q.transition&&L&&m))==null?void 0:r.trim())||void 0,...vo(q)}),We=0;N==="visible"&&(We|=Oe.Open),N==="hidden"&&(We|=Oe.Closed),L&&N==="hidden"&&(We|=Oe.Opening),!L&&N==="visible"&&(We|=Oe.Closing);let nt=ge();return f.createElement(Jt.Provider,{value:k},f.createElement(Xo,{value:We},nt({ourProps:Ae,theirProps:b,defaultTag:oi,features:ii,visible:N==="visible",name:"Transition.Child"})))}function fc(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,c=f.useRef(null),u=ni(e),i=ye(...u?[c,t]:t===null?[]:[t]);qn();let l=Qn();if(n===void 0&&l!==null&&(n=(l&Oe.Open)===Oe.Open),n===void 0)throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[a,p]=f.useState(n?"visible":"hidden"),m=ri(()=>{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=G(()=>{var S;d&&h(!1),(S=e.beforeEnter)==null||S.call(e)}),y=G(()=>{var S;d&&h(!1),(S=e.beforeLeave)==null||S.call(e)}),C=ge();return f.createElement(Jt.Provider,{value:m},f.createElement(Xt.Provider,{value:b},C({ourProps:{...w,as:f.Fragment,children:f.createElement(si,{ref:i,...w,...s,beforeEnter:E,beforeLeave:y})},theirProps:{},defaultTag:f.Fragment,features:ii,visible:a==="visible",name:"Transition"})))}function dc(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(si,{ref:t,...e}))}let Xn=me(fc),si=me(cc),pc=me(dc),li=Object.assign(Xn,{Child:pc,Root:Xn});function mc(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 ai=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function ui(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 u of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))u.remove(),s=!0;let c=s?(n=o.innerText)!=null?n:"":r;return ai.test(c)&&(c=c.replace(ai,"")),c}function hc(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():ui(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return ui(e).trim()}function gc(e){let t=f.useRef(""),n=f.useRef("");return G(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=hc(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var vc=Object.defineProperty,bc=(e,t,n)=>t in e?vc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ci=(e,t,n)=>(bc(e,typeof t!="symbol"?t+"":t,n),n),ae=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(ae||{}),je=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(je||{}),en=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(en||{}),fi=(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))(fi||{});function di(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=ao(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 xc={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 u={...e,searchQuery:"",activationTrigger:(n=t.trigger)!=null?n:1,__demoMode:!1};if(t.focus===re.Nothing)return{...u,activeOptionIndex:null};if(t.focus===re.Specific)return{...u,activeOptionIndex:e.options.findIndex(a=>a.id===t.id)};if(t.focus===re.Previous){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].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{...u,activeOptionIndex:m}}}}else if(t.focus===re.Next){let a=e.activeOptionIndex;if(a!==null){let p=e.options[a].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{...u,activeOptionIndex:m}}}}let i=di(e),l=qt(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:a=>a.id,resolveDisabled:a=>a.dataRef.current.disabled});return{...u,...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 u;return!c.dataRef.current.disabled&&((u=c.dataRef.current.textValue)==null?void 0:u.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,...di(e),pendingShouldSort:!1}:e};class Jn extends qr{constructor(t){super(t),ci(this,"actions",{onChange:n=>{let{onChange:r,compare:o,mode:s,value:c}=this.state.dataRef.current;return xe(s,{0:()=>r==null?void 0:r(n),1:()=>{let u=c.slice(),i=u.findIndex(l=>o(l,n));return i===-1?u.push(n):u.splice(i,1),r==null?void 0:r(u)}})},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})}}),ci(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(eo.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 xe(n.type,xc,t,n)}}const pi=f.createContext(null);function Zn(e){let t=f.useContext(pi);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,mi),n}return t}function mi({id:e,__demoMode:t=!1}){let n=f.useMemo(()=>Jn.new({id:e,__demoMode:t}),[]);return Zo(()=>n.dispose()),n}let tn=f.createContext(null);tn.displayName="ListboxDataContext";function At(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,At),n}return t}let yc=f.Fragment;function wc(e,t){let n=f.useId(),r=bn(),{value:o,defaultValue:s,form:c,name:u,onChange:i,by:l,invalid:a=!1,disabled:p=r||!1,horizontal:m=!1,multiple:d=!1,__demoMode:h=!1,...g}=e;const b=m?"horizontal":"vertical";let w=ye(t),E=tl(s),[y=d?[]:void 0,C]=el(o,i,E),S=mi({id:n,__demoMode:h}),A=f.useRef({static:!1,hold:!1}),L=f.useRef(new Map),_=Tl(l),j=f.useCallback(Q=>xe(N.mode,{[je.Multi]:()=>y.some(q=>_(q,Q)),[je.Single]:()=>_(y,Q)}),[y]),N=f.useMemo(()=>({value:y,disabled:p,invalid:a,mode:d?je.Multi:je.Single,orientation:b,onChange:C,compare:_,isSelected:j,optionsPropsRef:A,listRef:L}),[y,p,a,d,b,C,_,j,A,L]);te(()=>{S.state.dataRef.current=N},[N]);let T=Ee(S,Q=>Q.listboxState),K=Tn.get(null),R=Ee(K,f.useCallback(Q=>K.selectors.isTop(Q,n),[K,n])),[I,V]=Ee(S,Q=>[Q.buttonElement,Q.optionsElement]);ea(R,[I,V],(Q,q)=>{S.send({type:fi.CloseListbox}),lo(q,jn.Loose)||(Q.preventDefault(),I==null||I.focus())});let U=f.useMemo(()=>({open:T===ae.Open,disabled:p,invalid:a,value:y}),[T,p,a,y]),[F,O]=wl({inherit:!0}),k={ref:w},D=f.useCallback(()=>{if(E!==void 0)return C==null?void 0:C(E)},[C,E]),X=ge();return f.createElement(O,{value:F,props:{htmlFor:I==null?void 0:I.id},slot:{open:T===ae.Open,disabled:p}},f.createElement(Uu,null,f.createElement(pi.Provider,{value:S},f.createElement(tn.Provider,{value:N},f.createElement(Xo,{value:xe(T,{[ae.Open]:Oe.Open,[ae.Closed]:Oe.Closed})},u!=null&&y!=null&&f.createElement(ll,{disabled:p,data:{[u]:y},form:c,onReset:D}),X({ourProps:k,theirProps:g,slot:U,defaultTag:yc,name:"Listbox"}))))))}let Ec="button";function Cc(e,t){let n=f.useId(),r=Rr(),o=At("Listbox.Button"),s=Zn("Listbox.Button"),{id:c=r||`headlessui-listbox-button-${n}`,disabled:u=o.disabled||!1,autoFocus:i=!1,...l}=e,a=ye(t,Ru(),s.actions.setButtonElement),p=Wu(),[m,d,h]=Ee(s,O=>[O.listboxState,O.buttonElement,O.optionsElement]),g=m===ae.Open;ra(g,{trigger:d,action:f.useCallback(O=>{if(d!=null&&d.contains(O.target))return Rt.Ignore;let k=O.target.closest('[role="option"]:not([data-disabled])');return ke(k)?Rt.Select(k):h!=null&&h.contains(O.target)?Rt.Ignore:Rt.Close},[d,h]),close:s.actions.closeListbox,select:s.actions.selectActiveOption});let b=G(O=>{switch(O.key){case le.Enter:nl(O.currentTarget);break;case le.Space:case le.ArrowDown:O.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.First});break;case le.ArrowUp:O.preventDefault(),s.actions.openListbox({focus:o.value?re.Nothing:re.Last});break}}),w=G(O=>{switch(O.key){case le.Space:O.preventDefault();break}}),E=G(O=>{var k;if(O.button===Jo.Left){if(ml(O.currentTarget))return O.preventDefault();s.state.listboxState===ae.Open?(de.flushSync(()=>s.actions.closeListbox()),(k=s.state.buttonElement)==null||k.focus({preventScroll:!0})):(O.preventDefault(),s.actions.openListbox({focus:re.Nothing}))}}),y=f.useRef(null),C=G(O=>{y.current=O.pointerType,O.pointerType==="mouse"&&E(O)}),S=G(O=>{y.current!=="mouse"&&E(O)}),A=G(O=>O.preventDefault()),L=Gr([c]),_=vl(),{isFocusVisible:j,focusProps:N}=Vs({autoFocus:i}),{isHovered:T,hoverProps:K}=Bs({isDisabled:u}),{pressed:R,pressProps:I}=Ks({disabled:u}),V=f.useMemo(()=>({open:m===ae.Open,active:R||m===ae.Open,disabled:u,invalid:o.invalid,value:o.value,hover:T,focus:j,autofocus:i}),[m,o.value,u,T,j,R,o.invalid,i]),U=Ee(s,O=>O.listboxState===ae.Open),F=jr(p(),{ref:a,id:c,type:oa(e,d),"aria-haspopup":"listbox","aria-controls":h==null?void 0:h.id,"aria-expanded":U,"aria-labelledby":L,"aria-describedby":_,disabled:u||void 0,autoFocus:i,onKeyDown:b,onKeyUp:w,onKeyPress:A,onPointerDown:C,onClick:S},N,K,I);return ge()({ourProps:F,theirProps:l,slot:V,defaultTag:Ec,name:"Listbox.Button"})}let hi=f.createContext(!1),Sc="div",$c=It.RenderStrategy|It.Static;function Oc(e,t){let n=f.useId(),{id:r=`headlessui-listbox-options-${n}`,anchor:o,portal:s=!1,modal:c=!0,transition:u=!1,...i}=e,l=ku(o),[a,p]=f.useState(null);l&&(s=!0);let m=At("Listbox.Options"),d=Zn("Listbox.Options"),[h,g,b,w]=Ee(d,B=>[B.listboxState,B.buttonElement,B.optionsElement,B.__demoMode]),E=In(g),y=In(b),C=Qn(),[S,A]=bo(u,a,C!==null?(C&Oe.Open)===Oe.Open:h===ae.Open);Vl(S,g,d.actions.closeListbox);let L=w?!1:c&&h===ae.Open;da(L,y);let _=w?!1:c&&h===ae.Open;Bl(_,{allowed:f.useCallback(()=>[g,b],[g,b])});let j=h!==ae.Open,N=mc(j,g)?!1:S,T=S&&h===ae.Closed,K=Gu(T,m.value),R=G(B=>m.compare(K,B)),I=Ee(d,B=>{var ne;if(l==null||!((ne=l==null?void 0:l.to)!=null&&ne.includes("selection")))return null;let fe=B.options.findIndex(Ke=>R(Ke.dataRef.current.value));return fe===-1&&(fe=0),fe}),V=(()=>{if(l==null)return;if(I===null)return{...l,inner:void 0};let B=Array.from(m.listRef.current.values());return{...l,inner:{listRef:{current:B},index:I}}})(),[U,F]=Vu(V),O=Bu(),k=ye(t,l?U:null,d.actions.setOptionsElement,p),D=ot();f.useEffect(()=>{var B;let ne=b;ne&&h===ae.Open&&ne!==((B=xt(ne))==null?void 0:B.activeElement)&&(ne==null||ne.focus({preventScroll:!0}))},[h,b]);let X=G(B=>{var ne,fe;switch(D.dispose(),B.key){case le.Space:if(d.state.searchQuery!=="")return B.preventDefault(),B.stopPropagation(),d.actions.search(B.key);case le.Enter:if(B.preventDefault(),B.stopPropagation(),d.state.activeOptionIndex!==null){let{dataRef:Ke}=d.state.options[d.state.activeOptionIndex];d.actions.onChange(Ke.current.value)}m.mode===je.Single&&(de.flushSync(()=>d.actions.closeListbox()),(ne=d.state.buttonElement)==null||ne.focus({preventScroll:!0}));break;case xe(m.orientation,{vertical:le.ArrowDown,horizontal:le.ArrowRight}):return B.preventDefault(),B.stopPropagation(),d.actions.goToOption({focus:re.Next});case xe(m.orientation,{vertical:le.ArrowUp,horizontal:le.ArrowLeft}):return B.preventDefault(),B.stopPropagation(),d.actions.goToOption({focus:re.Previous});case le.Home:case le.PageUp:return B.preventDefault(),B.stopPropagation(),d.actions.goToOption({focus:re.First});case le.End:case le.PageDown:return B.preventDefault(),B.stopPropagation(),d.actions.goToOption({focus:re.Last});case le.Escape:B.preventDefault(),B.stopPropagation(),de.flushSync(()=>d.actions.closeListbox()),(fe=d.state.buttonElement)==null||fe.focus({preventScroll:!0});return;case le.Tab:B.preventDefault(),B.stopPropagation(),de.flushSync(()=>d.actions.closeListbox()),ql(d.state.buttonElement,B.shiftKey?Fn.Previous:Fn.Next);break;default:B.key.length===1&&(d.actions.search(B.key),D.setTimeout(()=>d.actions.clearSearch(),350));break}}),Q=Ee(d,B=>{var ne;return(ne=B.buttonElement)==null?void 0:ne.id}),q=f.useMemo(()=>({open:h===ae.Open}),[h]),Ae=jr(l?O():{},{id:r,ref:k,"aria-activedescendant":Ee(d,d.selectors.activeDescendantId),"aria-multiselectable":m.mode===je.Multi?!0:void 0,"aria-labelledby":Q,"aria-orientation":m.orientation,onKeyDown:X,role:"listbox",tabIndex:h===ae.Open?0:void 0,style:{...i.style,...F,"--button-width":Nl(g,!0).width},...vo(A)}),We=ge(),nt=f.useMemo(()=>m.mode===je.Multi?m:{...m,isSelected:R},[m,R]);return f.createElement(ic,{enabled:s?e.static||S:!1,ownerDocument:E},f.createElement(tn.Provider,{value:nt},We({ourProps:Ae,theirProps:i,slot:q,defaultTag:Sc,features:$c,visible:N,name:"Listbox.Options"})))}let Tc="div";function Ac(e,t){let n=f.useId(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...c}=e,u=f.useContext(hi)===!0,i=At("Listbox.Option"),l=Zn("Listbox.Option"),a=Ee(l,N=>l.selectors.isActive(N,r)),p=i.isSelected(s),m=f.useRef(null),d=gc(m),h=Xe({disabled:o,value:s,domRef:m,get textValue(){return d()}}),g=ye(t,m,N=>{N?i.listRef.current.set(r,N):i.listRef.current.delete(r)}),b=Ee(l,N=>l.selectors.shouldScrollIntoView(N,r));te(()=>{if(b)return Se().requestAnimationFrame(()=>{var N,T;(T=(N=m.current)==null?void 0:N.scrollIntoView)==null||T.call(N,{block:"nearest"})})},[b,m]),te(()=>{if(!u)return l.actions.registerOption(r,h),()=>l.actions.unregisterOption(r)},[h,r,u]);let w=G(N=>{var T;if(o)return N.preventDefault();l.actions.onChange(s),i.mode===je.Single&&(de.flushSync(()=>l.actions.closeListbox()),(T=l.state.buttonElement)==null||T.focus({preventScroll:!0}))}),E=G(()=>{if(o)return l.actions.goToOption({focus:re.Nothing});l.actions.goToOption({focus:re.Specific,id:r})}),y=pa(),C=G(N=>y.update(N)),S=G(N=>{y.wasMoved(N)&&(o||a&&l.state.activationTrigger===en.Pointer||l.actions.goToOption({focus:re.Specific,id:r},en.Pointer))}),A=G(N=>{y.wasMoved(N)&&(o||a&&l.state.activationTrigger===en.Pointer&&l.actions.goToOption({focus:re.Nothing}))}),L=f.useMemo(()=>({active:a,focus:a,selected:p,disabled:o,selectedOption:p&&u}),[a,p,o,u]),_=u?{}:{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:A,onMouseLeave:A},j=ge();return!p&&u?null:j({ourProps:_,theirProps:c,slot:L,defaultTag:Tc,name:"Listbox.Option"})}let Nc=f.Fragment;function Mc(e,t){let{options:n,placeholder:r,...o}=e,s={ref:ye(t)},c=At("ListboxSelectedOption"),u=f.useMemo(()=>({}),[]),i=c.value===void 0||c.value===null||c.mode===je.Multi&&Array.isArray(c.value)&&c.value.length===0,l=ge();return f.createElement(hi.Provider,{value:!0},l({ourProps:s,theirProps:{...o,children:f.createElement(f.Fragment,null,r&&i?r:n)},slot:u,defaultTag:Nc,name:"ListboxSelectedOption"}))}let Pc=me(wc),Lc=me(Cc),Fc=$l,jc=me(Oc),Ic=me(Ac),Dc=me(Mc),Ye=Object.assign(Pc,{Button:Lc,Label:Fc,Options:jc,Option:Ic,SelectedOption:Dc});function _c({title:e,titleId:t,...n},r){return P.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?P.createElement("title",{id:t},e):null,P.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 gi=P.forwardRef(_c);function kc({title:e,titleId:t,...n},r){return P.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?P.createElement("title",{id:t},e):null,P.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 vi=P.forwardRef(kc),Rc=({tokens:e,selectedToken:t,onTokenChange:n,disabled:r=!1,className:o="",walletType:s="mpc"})=>x.jsx("div",{className:`relative ${o}`,children:x.jsx(Ye,{value:t,onChange:n,disabled:r,children:({open:c})=>x.jsxs(x.Fragment,{children:[x.jsxs(Ye.Button,{className:`
|
|
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:`
|
|
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
78
|
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
79
79
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
80
80
|
${c?"ring-2 ring-blue-500":""}
|
|
81
|
-
`,children:[
|
|
81
|
+
`,children:[y.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Asset"}),y.jsxs("div",{className:"flex items-center",children:[t.iconUrl?y.jsx("img",{src:t.iconUrl,alt:t.token,className:"w-4 h-4 rounded-full"}):y.jsx("div",{className:"w-4 h-4 rounded-full bg-green-500 flex items-center justify-center",children:y.jsx("span",{className:"text-xs text-white font-bold",children:t.token.charAt(0)})}),y.jsx("span",{className:"text-sm text-white ml-1",children:t.symbol||t.token}),y.jsx(bi,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${c?"rotate-180":""}`})]})]}),y.jsx(ai,{as:f.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:y.jsx(Ye.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(
|
|
85
|
+
`,children:e.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.iconUrl?y.jsx("img",{src:a.iconUrl,alt:a.token,className:"w-5 h-5 rounded-full"}):y.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:y.jsx("span",{className:"text-xs text-white font-bold",children:a.token.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.symbol||a.token})})]}),i&&y.jsx(vi,{className:"w-4 h-4 text-blue-400"})]})},a.tokenAddress))})})]})})}),Bc=({chains:e,selectedChain:t,onChainChange: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:`
|
|
86
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
88
|
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
|
|
89
89
|
${r?"opacity-50 cursor-not-allowed":"cursor-pointer hover:bg-fill-btn-secondary-hover"}
|
|
90
90
|
${c?"ring-2 ring-blue-500":""}
|
|
91
|
-
`,children:[
|
|
91
|
+
`,children:[y.jsx("span",{className:"text-sm leading-[18px] font-medium",children:"Chain"}),y.jsxs("div",{className:"flex items-center space-x-2",children:[t.chainIconUrl?y.jsx("img",{src:t.chainIconUrl,alt:t.chain,className:"w-4 h-4 rounded-full"}):y.jsx("div",{className:"w-4 h-4 rounded-full bg-blue-500 flex items-center justify-center",children:y.jsx("span",{className:"text-xs text-white font-bold",children:t.chain.charAt(0)})}),y.jsx("span",{className:"text-sm text-white ml-1",children:t.chain}),y.jsx(bi,{className:`w-4 h-4 ml-2 text-gray-400 transition-transform duration-200 ${c?"rotate-180":""}`})]})]}),y.jsx(ai,{as:f.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:y.jsx(Ye.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(
|
|
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};/**
|
|
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 z{constructor(i,l,a,p){if(this.version=i,this.errorCorrectionLevel=l,this.modules=[],this.isFunction=[],i<z.MIN_VERSION||i>z.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(a);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 a=e.QrSegment.makeSegments(i);return z.encodeSegments(a,l)}static encodeBinary(i,l){const a=e.QrSegment.makeBytes(i);return z.encodeSegments([a],l)}static encodeSegments(i,l,a=1,p=40,m=-1,d=!0){if(!(z.MIN_VERSION<=a&&a<=p&&p<=z.MAX_VERSION)||m<-1||m>7)throw new RangeError("Invalid value");let h,g;for(h=a;;h++){const y=z.getNumDataCodewords(h,l)*8,C=c.getTotalBits(i,h);if(C<=y){g=C;break}if(h>=p)throw new RangeError("Data too long")}for(const y of[z.Ecc.MEDIUM,z.Ecc.QUARTILE,z.Ecc.HIGH])d&&g<=z.getNumDataCodewords(h,y)*8&&(l=y);let b=[];for(const y of i){n(y.mode.modeBits,4,b),n(y.numChars,y.mode.numCharCountBits(h),b);for(const C of y.getData())b.push(C)}o(b.length==g);const w=z.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 y=236;b.length<w;y^=253)n(y,8,b);let E=[];for(;E.length*8<b.length;)E.push(0);return b.forEach((y,C)=>E[C>>>3]|=y<<7-(C&7)),new z(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 a=0;a<this.size;a++)this.setFunctionModule(6,a,a%2==0),this.setFunctionModule(a,6,a%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 a=0;a<l;a++)for(let p=0;p<l;p++)a==0&&p==0||a==0&&p==l-1||a==l-1&&p==0||this.drawAlignmentPattern(i[a],i[p]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(i){const l=this.errorCorrectionLevel.formatBits<<3|i;let a=l;for(let m=0;m<10;m++)a=a<<1^(a>>>9)*1335;const p=(l<<10|a)^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 a=0;a<12;a++)i=i<<1^(i>>>11)*7973;const l=this.version<<12|i;o(l>>>18==0);for(let a=0;a<18;a++){const p=r(l,a),m=this.size-11+a%3,d=Math.floor(a/3);this.setFunctionModule(m,d,p),this.setFunctionModule(d,m,p)}}drawFinderPattern(i,l){for(let a=-4;a<=4;a++)for(let p=-4;p<=4;p++){const m=Math.max(Math.abs(p),Math.abs(a)),d=i+p,h=l+a;0<=d&&d<this.size&&0<=h&&h<this.size&&this.setFunctionModule(d,h,m!=2&&m!=4)}}drawAlignmentPattern(i,l){for(let a=-2;a<=2;a++)for(let p=-2;p<=2;p++)this.setFunctionModule(i+p,l+a,Math.max(Math.abs(p),Math.abs(a))!=1)}setFunctionModule(i,l,a){this.modules[l][i]=a,this.isFunction[l][i]=!0}addEccAndInterleave(i){const l=this.version,a=this.errorCorrectionLevel;if(i.length!=z.getNumDataCodewords(l,a))throw new RangeError("Invalid argument");const p=z.NUM_ERROR_CORRECTION_BLOCKS[a.ordinal][l],m=z.ECC_CODEWORDS_PER_BLOCK[a.ordinal][l],d=Math.floor(z.getNumRawDataModules(l)/8),h=p-d%p,g=Math.floor(d/p);let b=[];const w=z.reedSolomonComputeDivisor(m);for(let y=0,C=0;y<p;y++){let S=i.slice(C,C+g-m+(y<h?0:1));C+=S.length;const A=z.reedSolomonComputeRemainder(S,w);y<h&&S.push(0),b.push(S.concat(A))}let E=[];for(let y=0;y<b[0].length;y++)b.forEach((C,S)=>{(y!=g-m||S>=h)&&E.push(C[y])});return o(E.length==d),E}drawCodewords(i){if(i.length!=Math.floor(z.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let l=0;for(let a=this.size-1;a>=1;a-=2){a==6&&(a=5);for(let p=0;p<this.size;p++)for(let m=0;m<2;m++){const d=a-m,g=(a+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 a=0;a<this.size;a++){let p;switch(i){case 0:p=(a+l)%2==0;break;case 1:p=l%2==0;break;case 2:p=a%3==0;break;case 3:p=(a+l)%3==0;break;case 4:p=(Math.floor(a/3)+Math.floor(l/2))%2==0;break;case 5:p=a*l%2+a*l%3==0;break;case 6:p=(a*l%2+a*l%3)%2==0;break;case 7:p=((a+l)%2+a*l%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[l][a]&&p&&(this.modules[l][a]=!this.modules[l][a])}}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+=z.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),d||(i+=this.finderPenaltyCountPatterns(g)*z.PENALTY_N3),d=this.modules[m][b],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,g)*z.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+=z.PENALTY_N1:h>5&&i++):(this.finderPenaltyAddHistory(h,g),d||(i+=this.finderPenaltyCountPatterns(g)*z.PENALTY_N3),d=this.modules[b][m],h=1);i+=this.finderPenaltyTerminateAndCount(d,h,g)*z.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+=z.PENALTY_N2)}let l=0;for(const m of this.modules)l=m.reduce((d,h)=>d+(h?1:0),l);const a=this.size*this.size,p=Math.ceil(Math.abs(l*20-a*10)/a)-1;return o(0<=p&&p<=9),i+=p*z.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 a=[6];for(let p=this.size-7;a.length<i;p-=l)a.splice(1,0,p);return a}}static getNumRawDataModules(i){if(i<z.MIN_VERSION||i>z.MAX_VERSION)throw new RangeError("Version number out of range");let l=(16*i+128)*i+64;if(i>=2){const a=Math.floor(i/7)+2;l-=(25*a-10)*a-55,i>=7&&(l-=36)}return o(208<=l&&l<=29648),l}static getNumDataCodewords(i,l){return Math.floor(z.getNumRawDataModules(i)/8)-z.ECC_CODEWORDS_PER_BLOCK[l.ordinal][i]*z.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 a=1;for(let p=0;p<i;p++){for(let m=0;m<l.length;m++)l[m]=z.reedSolomonMultiply(l[m],a),m+1<l.length&&(l[m]^=l[m+1]);a=z.reedSolomonMultiply(a,2)}return l}static reedSolomonComputeRemainder(i,l){let a=l.map(p=>0);for(const p of i){const m=p^a.shift();a.push(0),l.forEach((d,h)=>a[h]^=z.reedSolomonMultiply(d,m))}return a}static reedSolomonMultiply(i,l){if(i>>>8||l>>>8)throw new RangeError("Byte out of range");let a=0;for(let p=7;p>=0;p--)a=a<<1^(a>>>7)*285,a^=(l>>>p&1)*i;return o(a>>>8==0),a}finderPenaltyCountPatterns(i){const l=i[1];o(l<=this.size*3);const a=l>0&&i[2]==l&&i[3]==l*3&&i[4]==l&&i[5]==l;return(a&&i[0]>=l*4&&i[6]>=l?1:0)+(a&&i[6]>=l*4&&i[0]>=l?1:0)}finderPenaltyTerminateAndCount(i,l,a){return i&&(this.finderPenaltyAddHistory(l,a),l=0),l+=this.size,this.finderPenaltyAddHistory(l,a),this.finderPenaltyCountPatterns(a)}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(u,i,l){if(i<0||i>31||u>>>i)throw new RangeError("Value out of range");for(let a=i-1;a>=0;a--)l.push(u>>>a&1)}function r(u,i){return(u>>>i&1)!=0}function o(u){if(!u)throw new Error("Assertion error")}const s=class oe{constructor(i,l,a){if(this.mode=i,this.numChars=l,this.bitData=a,l<0)throw new RangeError("Invalid argument");this.bitData=a.slice()}static makeBytes(i){let l=[];for(const a of i)n(a,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 a=0;a<i.length;){const p=Math.min(i.length-a,3);n(parseInt(i.substring(a,a+p),10),p*3+1,l),a+=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=[],a;for(a=0;a+2<=i.length;a+=2){let p=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a))*45;p+=oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a+1)),n(p,11,l)}return a<i.length&&n(oe.ALPHANUMERIC_CHARSET.indexOf(i.charAt(a)),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 a=0;for(const p of i){const m=p.mode.numCharCountBits(l);if(p.numChars>=1<<m)return 1/0;a+=4+m+p.bitData.length}return a}static toUtf8ByteArray(i){i=encodeURI(i);let l=[];for(let a=0;a<i.length;a++)i.charAt(a)!="%"?l.push(i.charCodeAt(a)):(l.push(parseInt(i.substring(a+1,a+3),16)),a+=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 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;/**
|
|
100
100
|
* @license qrcode.react
|
|
101
101
|
* Copyright (c) Paul O'Shannessy
|
|
102
102
|
* SPDX-License-Identifier: ISC
|
|
103
|
-
*/var Vc={L:dt.QrCode.Ecc.LOW,M:dt.QrCode.Ecc.MEDIUM,Q:dt.QrCode.Ecc.QUARTILE,H:dt.QrCode.Ecc.HIGH},wi=128,Ei="L",Ci="#FFFFFF",Si="#000000",$i=!1,Oi=1,Uc=4,zc=0,Hc=.1;function Ti(e,t=0){const n=[];return e.forEach(function(r,o){let s=null;r.forEach(function(c,u){if(!c&&s!==null){n.push(`M${s+t} ${o+t}h${u-s}v1H${s+t}z`),s=null;return}if(u===r.length-1){if(!c)return;s===null?n.push(`M${u+t},${o+t} h1v1H${u+t}z`):n.push(`M${s+t},${o+t} h${u+1-s}v1H${s+t}z`);return}c&&s===null&&(s=u)})}),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 Gc(e,t,n,r){if(r==null)return null;const o=e.length+n*2,s=Math.floor(t*Hc),c=o/t,u=(r.width||s)*c,i=(r.height||s)*c,l=r.x==null?e.length/2-u/2:r.x*c,a=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(a),b=Math.ceil(u+l-h),w=Math.ceil(i+a-g);m={x:h,y:g,w:b,h:w}}const d=r.crossOrigin;return{x:l,y:a,h:i,w:u,excavation:m,opacity:p,crossOrigin:d}}function Yc(e,t){return t!=null?Math.max(Math.floor(t),0):e?Uc:zc}function Ni({value:e,level:t,minVersion:n,includeMargin:r,marginSize:o,imageSettings:s,size:c,boostLevel:u}){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,Vc[t],n,void 0,void 0,u)},[e,t,n,u]);const{cells:l,margin:a,numCells:p,calculatedImageSettings:m}=f.useMemo(()=>{let d=i.getModules();const h=Yc(r,o),g=d.length+h*2,b=Gc(d,c,h,s);return{cells:d,margin:h,numCells:g,calculatedImageSettings:b}},[i,c,s,r,o]);return{qrcode:i,margin:a,cells:l,numCells:p,calculatedImageSettings:m}}var Kc=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=wi,level:c=Ei,bgColor:u=Ci,fgColor:i=Si,includeMargin:l=$i,minVersion:a=Oi,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,y=f.useRef(null),C=f.useRef(null),S=f.useCallback(I=>{y.current=I,typeof n=="function"?n(I):n&&(n.current=I)},[n]),[A,L]=f.useState(!1),{margin:_,cells:j,numCells:N,calculatedImageSettings:T}=Ni({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:m,imageSettings:d,size:s});f.useEffect(()=>{if(y.current!=null){const I=y.current,V=I.getContext("2d");if(!V)return;let U=j;const F=C.current,O=T!=null&&F!==null&&F.complete&&F.naturalHeight!==0&&F.naturalWidth!==0;O&&T.excavation!=null&&(U=Ai(j,T.excavation));const k=window.devicePixelRatio||1;I.height=I.width=s*k;const D=s/N*k;V.scale(D,D),V.fillStyle=u,V.fillRect(0,0,N,N),V.fillStyle=i,Kc?V.fill(new Path2D(Ti(U,_))):j.forEach(function(X,Q){X.forEach(function(q,Ae){q&&V.fillRect(Ae+_,Q+_,1,1)})}),T&&(V.globalAlpha=T.opacity),O&&V.drawImage(F,T.x+_,T.y+_,T.w,T.h)}}),f.useEffect(()=>{L(!1)},[E]);const K=tr({height:s,width:s},b);let R=null;return E!=null&&(R=f.createElement("img",{src:E,key:E,style:{display:"none"},onLoad:()=>{L(!0)},ref:C,crossOrigin:T==null?void 0:T.crossOrigin})),f.createElement(f.Fragment,null,f.createElement("canvas",tr({style:K,height:s,width:s,ref:S,role:"img"},w)),R)});Qc.displayName="QRCodeCanvas";var Mi=f.forwardRef(function(t,n){const r=t,{value:o,size:s=wi,level:c=Ei,bgColor:u=Ci,fgColor:i=Si,includeMargin:l=$i,minVersion:a=Oi,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:y}=Ni({value:o,level:c,minVersion:a,boostLevel:p,includeMargin:l,marginSize:d,imageSettings:h,size:s});let C=w,S=null;h!=null&&y!=null&&(y.excavation!=null&&(C=Ai(w,y.excavation)),S=f.createElement("image",{href:h.src,height:y.h,width:y.w,x:y.x+b,y:y.y+b,preserveAspectRatio:"none",opacity:y.opacity,crossOrigin:y.crossOrigin}));const A=Ti(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:u,d:`M0,0 h${E}v${E}H0z`,shapeRendering:"crispEdges"}),f.createElement("path",{fill:i,d:A,shapeRendering:"crispEdges"}),S)});Mi.displayName="QRCodeSVG";const qc=(e,t)=>Number(e)>Number(t),Te=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:Te(t),errorType:"auto_adjusted_to_max"};let u=e;return!isNaN(s)&&!e.endsWith(".")&&e.includes(".")&&(u=e.replace(/\.?0+$/,""),u.includes(".")||(u=u)),{isValid:!0,formattedValue:u}},Xc=(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)},Pi={ETHEREUM:1,SEPOLIA:11155111},Jc=[Pi.ETHEREUM,Pi.SEPOLIA],Zc=e=>{if(e.chainId!==void 0){const t=typeof e.chainId=="string"?parseInt(e.chainId,10):e.chainId;return!Jc.includes(t)}return!0},ef=[{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}},tf=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r})=>{var s;const o=f.useMemo(()=>Zc(n||{}),[n]);return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex justify-center mt-4 mb-3",children:x.jsx("div",{className:"bg-white rounded-lg",children:x.jsx(Mi,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",marginSize:0})})}),x.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[x.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),x.jsx("div",{onClick:()=>{navigator.clipboard.writeText((e==null?void 0:e.getDisplayAddress())||"")},style:{cursor:"pointer"},children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[x.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),x.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),x.jsxs("div",{className:"flex items-start",children:[x.jsx("div",{className:"w-5",children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:x.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"})})}),x.jsxs("div",{className:"flex-1",children:[x.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."]}),x.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),o&&x.jsxs(x.Fragment,{children:[x.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."}),x.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"})]}),x.jsxs("div",{className:"text-sm",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[x.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),x.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"]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),x.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]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},nf=({chains:e,defaultChainId:t,defaultTokenAddress:n,walletAdapter:r,metadata:o,onDeposit:s,onClose:c})=>{var d;const[u,i]=f.useState(()=>{var h;return!e||e.length===0?1:t||((h=e[0])==null?void 0:h.chainId)||1}),[l,a]=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===u)||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?x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"No chains available"})}):p?x.jsxs(x.Fragment,{children:[x.jsx(er,{currentActiveChain:p,chainList:e,onChainChange:i,curSelectToken:l,onTokenChange:a,walletType:"mpc"}),x.jsx(tf,{walletAdapter:r,curSelectToken:l,currentActiveChain:p,metadata:o}),x.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:u,tokenAddress:(m==null?void 0:m.tokenAddress)||"",tokenSymbol:l}),c()},children:"Deposit"})]}):x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"Loading..."})})},rf=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,tokenBalance:i,platformBalance:l="0",onDepositAmountChange:a,onApprove:p})=>{const m=h=>{const g=h.target.value,w=rr(g,i||"0");if(w.isValid)a(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=Te(Math.max(0,b).toString());return`${Te(i||"0")} → ${w} ${t}`}return`${Te(i||"0")} ${t}`};return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[x.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"}),x.jsx("button",{onClick:()=>{a(i||"0")},className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),x.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),x.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:d()})]})]}),!r&&qc(e||"0",0)&&x.jsxs("div",{className:"flex justify-center flex-col items-center",children:[x.jsxs("h3",{className:"text-text-primary text-sm leading-4 font-medium",children:["Enable ",t," on ",o==null?void 0:o.chain]}),x.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,"."]}),x.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]})]}),x.jsx("div",{className:"border-t border-line-divider-secondary border-dashed py-4",children:x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-sm leading-[18px] text-text-tertiary",children:"总资产"}),x.jsx("span",{className:"text-sm leading-[18px] text-text-primary font-medium",children:e?`${Te(l)} → ${Te((parseFloat(l)+parseFloat(e)).toString())} ${t}`:`${Te(l)} ${t}`})]})})]})},of=({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)}}),u=(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:u})},[c,u,e.tokenAddress,s]),null},Li=({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,u]=f.useState({}),i=f.useCallback((g,b)=>{u(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)}}),a=f.useMemo(()=>s.map(g=>f.createElement(of,{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(y=>{const C=c[y.tokenAddress],S=C==null?void 0:C.balance,A=S==null?void 0:S.data;return{address:y.tokenAddress,value:(A==null?void 0:A.value)||BigInt(0),formatted:(A==null?void 0:A.formatted)||"0",decimals:(A==null?void 0:A.decimals)||y.decimals}}).filter(y=>y.address),w=s.map(y=>{const C=c[y.tokenAddress],S=C==null?void 0:C.allowance,A=S==null?void 0:S.data,L=BigInt(A?A.toString():0);return{address:y.tokenAddress,value:L,formatted:(L/BigInt(10)**BigInt(y.decimals)).toString(),decimals:y.decimals}}).filter(y=>y.address),E=b.reduce((y,C)=>{const S=w.find(A=>A.address===C.address);return{...y,[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,y;return((E=w.balance)==null?void 0:E.isLoading)||((y=w.allowance)==null?void 0:y.isLoading)});return g||b},[l==null?void 0:l.isLoading,c]);return{multicallRun:m,multicallResult:p,validErcTokens:s,isLoading:d,queryComponents:a}},sf=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,platformBalance:u="0",wagmiHooks:i,approved:l,onApproved:a,onDeposit:p,onClose:m,onChainChange:d,onTokenChange:h})=>{var k;const[g,b]=f.useState(()=>{var D;return!e||e.length===0?1:t||((D=e[0])==null?void 0:D.chainId)||1}),[w,E]=f.useState(()=>{var q;if(!e||e.length===0)return"";const D=t||((q=e[0])==null?void 0:q.chainId),X=e.find(Ae=>Ae.chainId===D);if(!X||!X.tokenList||X.tokenList.length===0)return"";const Q=X.tokenList.find(Ae=>Ae.tokenAddress===n)||X.tokenList[0];return(Q==null?void 0:Q.token)||""}),[y,C]=f.useState(r),S=f.useCallback(D=>{b(D),d==null||d(D)},[d]),A=f.useCallback(D=>{E(D),h==null||h(D)},[h]),L=f.useRef(!0),_=f.useRef(w),j=f.useRef(g);f.useEffect(()=>{if(L.current){L.current=!1,_.current=w,j.current=g;return}(_.current!==w||j.current!==g)&&(C(""),_.current=w,j.current=g)},[w,g]);const N=e&&e.length>0?e.find(D=>D.chainId===g)||e[0]:null,T=(k=N==null?void 0:N.tokenList)==null?void 0:k.find(D=>D.token===w),K=o==null?void 0:o.getDisplayAddress(),{multicallResult:R,queryComponents:I}=Li({account:K,chainId:g,contractAddress:void 0,tokens:(N==null?void 0:N.tokenList)||[],wagmiHooks:i}),V=f.useMemo(()=>{var X;if(!T)return;if(!T.tokenAddress||T.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return R.baseTokenBalance.formatted;const D=R.combinedData[T.tokenAddress];return((X=D==null?void 0:D.balance)==null?void 0:X.formatted)||"0"},[T,R]),U=l??!1,F=f.useMemo(()=>{const D=parseFloat(y||"0"),X=10,Q=V||"0",q=Xc(y,Q,U);return!y||D===0?{text:"Confirm Deposit",disabled:!0}:U?D>parseFloat(Q)?{text:"Insufficient Balance",disabled:!0}:D<X?{text:`Min Deposit ${X} ${w}`,disabled:!0}:{text:"Confirm Deposit",disabled:!q}:{text:"Confirm Deposit",disabled:!0}},[y,w,V,U]),O=f.useCallback(async()=>{p&&p({amount:y,chainId:g,tokenAddress:(T==null?void 0:T.tokenAddress)||"",tokenSymbol:w})},[p,y,g,T==null?void 0:T.tokenAddress,w]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?x.jsxs("div",{className:"p-6 text-center",children:[x.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),x.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"No chains available"})}):N?x.jsxs(x.Fragment,{children:[I,x.jsx(er,{currentActiveChain:N,chainList:e,onChainChange:S,curSelectToken:w,onTokenChange:A,walletType:"evm"}),x.jsx(rf,{depositAmount:y,curSelectToken:w,curSelectTokenData:{balance:T==null?void 0:T.balance,allowance:T==null?void 0:T.allowance},approved:U,currentActiveChain:N,currentEquity:c||0,amount:y,decimals:(T==null?void 0:T.decimals)||6,tokenBalance:V,platformBalance:u,onDepositAmountChange:C,onApprove:async()=>{a&&await a()}}),x.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${F.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:O,disabled:F.disabled,children:F.text})]}):x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"Loading..."})})},Fi=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=or,smartWallet:o=ir,chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i="",metadata:l=sr,currentEquity:a=5e3,platformBalance:p="0",wagmiHooks:m,approved:d,onApproved:h,onDeposit:g,onChainChange:b,onTokenChange:w})=>{const E=f.useMemo(()=>{var C;return r?xr(r,o,!1,(C=s[0])==null?void 0:C.chainId,"0","0"):null},[r,o,s]),y=(E==null?void 0:E.getWalletType())==="mpc";return e?de.createPortal(x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:x.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:x.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:[x.jsxs("div",{className:"flex items-center justify-between mb-4",children:[x.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),x.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:x.jsx(vr,{className:"h-4 w-4"})})]}),y?x.jsx(nf,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:a,onDeposit:g,onClose:t}):x.jsx(sf,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:E,metadata:l,currentEquity:a,platformBalance:p,wagmiHooks:m,approved:d,onApproved:h,onDeposit:g,onClose:t,onChainChange:b,onTokenChange:w})]})})}),document.body):null};let Ie=null;const lf={symbol:"USDT"},ji=f.forwardRef((e,t)=>{const[n,r]=f.useState(!1),[o,s]=f.useState({chains:[]}),c=f.useCallback(a=>{s(a),r(!0)},[]),u=f.useCallback(a=>{s(p=>({...p,...a}))},[]),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:u,isOpen:l}),[c,i,u,l]),f.useEffect(()=>(Ie={openDeposit:c,closeDeposit:i,updateDepositOptions:u,isOpen:l},()=>{Ie=null}),[c,i,u,l]),x.jsx(Fi,{isOpen:n,onClose:i,config:o.config||lf,currentActiveAccount:o.currentActiveAccount||or,smartWallet:o.smartWallet||ir,chains:o.chains||ef,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 Ii=e=>{if(!Ie){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ie.openDeposit(e||{chains:[]})},Di=()=>{if(!Ie){console.error("DepositManager not initialized. Make sure to render <DepositManager /> in your app.");return}Ie.closeDeposit()},_i=e=>{Ie&&Ie.updateDepositOptions(e)},af=()=>Ie?Ie.isOpen():!1,uf=()=>({openDeposit:Ii,closeDeposit:Di,updateDepositOptions:_i,isOpen:af});f.createContext(null);const cf=({withdrawAmount:e,curSelectToken:t,platformBalance:n="0",onWithdrawAmountChange:r})=>{const o=u=>{const i=u.target.value,a=rr(i,n||"0");if(a.isValid)r(a.formattedValue),a.errorType;else return a.errorType==="exceed_balance",void 0},s=()=>{r(n)},c=()=>{const u=parseFloat(n||"0"),i=parseFloat(e||"0");if(i>0){const l=u-i,a=Te(Math.max(0,l).toString());return`${Te(n||"0")} → ${a} ${t}`}return`${Te(n||"0")} ${t}`};return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"bg-fill-input-primary rounded-lg px-3 py-3 my-4",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mb-3",children:[x.jsx("input",{type:"text",placeholder:"Amount",value:e,onChange:o,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"}),x.jsx("button",{onClick:s,className:"text-theme-normal text-xs font-medium cursor-pointer hover:opacity-80 transition-opacity h-full flex items-center",children:"MAX"})]}),x.jsx("div",{className:"h-[1px] bg-line-divider-secondary mb-2"}),x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-text-tertiary text-xs leading-[14px]",children:"Available"}),x.jsx("span",{className:"text-text-primary text-xs leading-[14px]",children:c()})]})]}),x.jsx("div",{className:"bg-fill-page-secondary rounded-lg mb-4",children:x.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."})}),x.jsxs("div",{className:"space-y-3 py-4 border-t border-line-divider-secondary border-dashed",children:[x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("span",{className:"text-text-tertiary text-xs",children:"Speed"}),x.jsxs("div",{className:"flex items-center space-x-1",children:[x.jsx("span",{className:"text-theme-normal",children:"⚡"}),x.jsx("span",{className:"text-theme-normal",children:"⚡"}),x.jsx("span",{className:"text-theme-normal",children:"⚡"})]})]}),x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("span",{className:"text-text-tertiary text-xs",children:"Fee"}),x.jsxs("span",{className:"text-text-primary text-xs font-medium",children:["0.00 ",t]})]}),x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsx("span",{className:"text-text-tertiary text-xs",children:"Amount to receive"}),x.jsxs("span",{className:"text-text-primary text-xs font-medium",children:[Te(e)," ",t]})]})]})]})},ff=({chains:e,defaultChainId:t,defaultTokenAddress:n,defaultAmount:r="",walletAdapter:o,metadata:s,currentEquity:c,platformBalance:u="0",wagmiHooks:i,onWithdraw:l,onClose:a,onChainChange:p,onTokenChange:m})=>{var U;const[d,h]=f.useState(()=>{var F;return!e||e.length===0?1:t||((F=e[0])==null?void 0:F.chainId)||1}),[g,b]=f.useState(()=>{var D;if(!e||e.length===0)return"";const F=t||((D=e[0])==null?void 0:D.chainId),O=e.find(X=>X.chainId===F);if(!O||!O.tokenList||O.tokenList.length===0)return"";const k=O.tokenList.find(X=>X.tokenAddress===n)||O.tokenList[0];return(k==null?void 0:k.token)||""}),[w,E]=f.useState(r),y=f.useCallback(F=>{h(F),p==null||p(F)},[p]),C=f.useCallback(F=>{b(F),m==null||m(F)},[m]),S=f.useRef(!0),A=f.useRef(g),L=f.useRef(d);f.useEffect(()=>{if(S.current){S.current=!1,A.current=g,L.current=d;return}(A.current!==g||L.current!==d)&&(E(""),A.current=g,L.current=d)},[g,d]);const _=e&&e.length>0?e.find(F=>F.chainId===d)||e[0]:null,j=(U=_==null?void 0:_.tokenList)==null?void 0:U.find(F=>F.token===g),N=o==null?void 0:o.getDisplayAddress(),{multicallResult:T,queryComponents:K}=Li({account:N,chainId:d,contractAddress:void 0,tokens:(_==null?void 0:_.tokenList)||[],wagmiHooks:i}),R=f.useMemo(()=>{var O;if(!j)return;if(!j.tokenAddress||j.tokenAddress.toLowerCase()==="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")return T.baseTokenBalance.formatted;const F=T.combinedData[j.tokenAddress];return((O=F==null?void 0:F.balance)==null?void 0:O.formatted)||"0"},[j,T]),I=f.useMemo(()=>{const F=parseFloat(w||"0"),O=1,k=parseFloat(u||"0");return!w||F===0?{text:"Confirm Withdraw",disabled:!0}:F>k?{text:"Insufficient Balance",disabled:!0}:F<O?{text:`Min Withdraw ${O} ${g}`,disabled:!0}:{text:"Confirm Withdraw",disabled:!1}},[w,g,u]),V=f.useCallback(async()=>{l&&l({amount:w,chainId:d,tokenAddress:(j==null?void 0:j.tokenAddress)||"",tokenSymbol:g})},[l,w,d,j==null?void 0:j.tokenAddress,g]);return!(i!=null&&i.useBalance)||!(i!=null&&i.useReadContract)||!(i!=null&&i.useAccount)?x.jsxs("div",{className:"p-6 text-center",children:[x.jsx("p",{className:"text-red-500",children:"缺少必要的 wagmi hooks"}),x.jsx("p",{className:"text-sm text-gray-500 mt-2",children:"请确保传入了 useBalance, useReadContract, useAccount"})]}):!e||e.length===0?x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"No chains available"})}):_?x.jsxs(x.Fragment,{children:[K,x.jsx(er,{currentActiveChain:_,chainList:e,onChainChange:y,curSelectToken:g,onTokenChange:C,walletType:"evm"}),x.jsx(cf,{withdrawAmount:w,curSelectToken:g,curSelectTokenData:{balance:j==null?void 0:j.balance,allowance:j==null?void 0:j.allowance},currentActiveChain:_,currentEquity:c||0,amount:w,decimals:(j==null?void 0:j.decimals)||6,tokenBalance:R,platformBalance:u,onWithdrawAmountChange:E}),x.jsx("button",{className:`w-full h-[38px] text-sm rounded-xl font-medium transition-colors ${I.disabled?"bg-text-disabled text-text-secondary cursor-not-allowed":"bg-fill-btn-primary text-text-on-sec-btn"}`,onClick:V,disabled:I.disabled,children:I.text})]}):x.jsx("div",{className:"text-center py-8",children:x.jsx("p",{className:"text-gray-400",children:"Loading..."})})},ki=({isOpen:e,onClose:t,config:n,currentActiveAccount:r=or,smartWallet:o=ir,chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i="",metadata:l=sr,currentEquity:a=5e3,platformBalance:p="0",wagmiHooks:m,onWithdraw:d,onChainChange:h,onTokenChange:g})=>{const b=f.useMemo(()=>{var w;return r?xr(r,o,!1,(w=s[0])==null?void 0:w.chainId,"0","0"):null},[r,o,s]);return e?de.createPortal(x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:x.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:x.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:[x.jsxs("div",{className:"flex items-center justify-between mb-4",children:[x.jsx("h2",{className:"text-lg font-semibold text-white",children:"Withdraw"}),x.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:x.jsx(vr,{className:"h-4 w-4"})})]}),x.jsx(ff,{chains:s,defaultChainId:c,defaultTokenAddress:u,defaultAmount:i,walletAdapter:b,metadata:l,currentEquity:a,platformBalance:p,wagmiHooks:m,onWithdraw:d,onClose:t,onChainChange:h,onTokenChange:g})]})})}),document.body):null},df=[],pf={};let De=null;const Ri=f.forwardRef((e,t)=>{const[n,r]=f.useState(!1),[o,s]=f.useState({chains:[]}),c=f.useCallback(a=>{s(a||{chains:[]}),r(!0)},[]),u=f.useCallback(a=>{s(p=>({...p,...a}))},[]),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:u,isOpen:l}),[c,i,u,l]),f.useEffect(()=>(De={openWithdraw:c,closeWithdraw:i,updateWithdrawOptions:u,isOpen:l},()=>{De=null}),[c,i,u,l]),x.jsx(ki,{isOpen:n,onClose:i,config:o.config||{symbol:"USDT"},currentActiveAccount:o.currentActiveAccount,smartWallet:o.smartWallet,chains:o.chains||df,defaultChainId:o.defaultChainId,defaultTokenAddress:o.defaultTokenAddress,defaultAmount:o.defaultAmount,metadata:o.metadata||pf,currentEquity:o.currentEquity??5e3,platformBalance:o.platformBalance||"0",wagmiHooks:o.wagmiHooks,onWithdraw:o.onWithdraw,onChainChange:o.onChainChange,onTokenChange:o.onTokenChange})});Ri.displayName="WithdrawManager";const Wi=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.openWithdraw(e||{chains:[]})},Bi=()=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.closeWithdraw()},Vi=e=>{if(!De){console.error("WithdrawManager not initialized. Make sure to render <WithdrawManager /> in your app.");return}De.updateWithdrawOptions(e)},mf=()=>De?De.isOpen():!1,hf=()=>({openWithdraw:Wi,closeWithdraw:Bi,updateWithdrawOptions:Vi,isOpen:mf});Z.ComponentProvider=as,Z.Deposit=Fi,Z.DepositManager=ji,Z.Withdraw=ki,Z.WithdrawManager=Ri,Z.closeDeposit=Di,Z.closeWithdraw=Bi,Z.openDeposit=Ii,Z.openWithdraw=Wi,Z.updateDepositOptions=_i,Z.updateWithdrawOptions=Vi,Z.useDeposit=us,Z.useDepositManager=uf,Z.useWithdraw=cs,Z.useWithdrawManager=hf,Object.defineProperty(Z,Symbol.toStringTag,{value:"Module"})});
|
|
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"})});
|
|
104
104
|
//# sourceMappingURL=index.umd.js.map
|