@fileverse-dev/ddoc 1.4.5 → 1.4.6
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/README.md +2 -2
- package/dist/constants/index.d.ts +1 -0
- package/dist/index.es.js +431 -437
- package/dist/index.umd.js +6 -6
- package/dist/packages/ddoc/types.d.ts +1 -1
- package/dist/packages/ddoc/use-ddoc-editor.d.ts +2 -2
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
(function(it,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],P):(it=typeof globalThis<"u"?globalThis:it||self,P(it.ddoc={},it.React,it.ReactDOM))})(this,function(it,P,kt){"use strict";var
|
1
|
+
(function(it,P){typeof exports=="object"&&typeof module<"u"?P(exports,require("react"),require("react-dom")):typeof define=="function"&&define.amd?define(["exports","react","react-dom"],P):(it=typeof globalThis<"u"?globalThis:it||self,P(it.ddoc={},it.React,it.ReactDOM))})(this,function(it,P,kt){"use strict";var uie=Object.defineProperty;var sF=it=>{throw TypeError(it)};var fie=(it,P,kt)=>P in it?uie(it,P,{enumerable:!0,configurable:!0,writable:!0,value:kt}):it[P]=kt;var G=(it,P,kt)=>fie(it,typeof P!="symbol"?P+"":P,kt),EE=(it,P,kt)=>P.has(it)||sF("Cannot "+kt);var T=(it,P,kt)=>(EE(it,P,"read from private field"),kt?kt.call(it):P.get(it)),J=(it,P,kt)=>P.has(it)?sF("Cannot add the same private member more than once"):P instanceof WeakSet?P.add(it):P.set(it,kt),L=(it,P,kt,wa)=>(EE(it,P,"write to private field"),wa?wa.call(it,kt):P.set(it,kt),kt),fe=(it,P,kt)=>(EE(it,P,"access private method"),kt);var Xh=(it,P,kt,wa)=>({set _(V){L(it,P,V,kt)},get _(){return T(it,P,wa)}});var Pu,Tl,Xo,Du,Iu,xs,Wi,Lu,Bu,mn,Nr,Ki,Ol,Nl,Ml,ni,Es,Zo,Rl,Zh,_h,Fh,jh,Mr,_u,Pl,Fu,Qi,Dl,Uu,y0,cr,Rr,Il,Ll,ea,Bl,NE,oF,Vu,Hu,zu,_l,Ji,jl,ri,$u,Gu,Wu,Ku,Qu,Ju,qu,Yu,Xu,Zu,ef,Ul,ta,Yi,na,tf,b0,Uh,Zi,nf,f0,aF,Cn,ks,Vh,ME,rf,w0,ra,Tf,si,ii,oi,Pn,ai,A0,v0,eo,Hh,sa,sf,zh,$h,tF,ia,Hl,oa,Of,p0,lF,Wh,Kh,af,lf,aa,to,Xr,la,li,uf,x0,zl,$l,ca,ff,no,m0,df,ro,hf,pf,ua,Zr,g0,cF,Dn,fa,In,mf,Pr,Gl,da,so,Qh,es,gf,yf,rt,Dr,RE,PE,ep,DE,tp,E0,Kn,ci,Wl,ha,Kl,bf,pa,IE,LE,Ql,Jl,wf,io,ui,Ss,ts,ur,Jh,BE,ma,Af,vf,fi,qh,ga,ql,ya,Yh,Yl,xf,ba,Xl,Ts,fr,oo,Ef,dr,uF,_E,fF,dF,FE;function wa(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const V=wa(P),C0=wa(kt);var Yn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function k0(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var S0={exports:{}},Nf={};/**
|
2
2
|
* @license React
|
3
3
|
* react-jsx-runtime.production.min.js
|
4
4
|
*
|
@@ -22,12 +22,12 @@
|
|
22
22
|
|
23
23
|
Check the render method of \``+j+"`."}return""}}function pr(j){return""}var mr={};function Cf(j){{var ie=Os();if(!ie){var ge=typeof j=="string"?j:j.displayName||j.name;ge&&(ie=`
|
24
24
|
|
25
|
-
Check the top-level render call using <`+ge+">.")}return ie}}function kf(j,ie){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var ge=Cf(ie);if(mr[ge])return;mr[ge]=!0;var $e="";j&&j._owner&&j._owner!==Qe.current&&($e=" It was passed a child from "+U(j._owner.type)+"."),mt(j),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ge,$e),mt(null)}}function Zl(j,ie){{if(typeof j!="object")return;if(N(j))for(var ge=0;ge<j.length;ge++){var $e=j[ge];_t($e)&&kf($e,ie)}else if(_t(j))j._store&&(j._store.validated=!0);else if(j){var ht=y(j);if(typeof ht=="function"&&ht!==j.entries)for(var wt=ht.call(j),lt;!(lt=wt.next()).done;)_t(lt.value)&&kf(lt.value,ie)}}}function
|
25
|
+
Check the top-level render call using <`+ge+">.")}return ie}}function kf(j,ie){{if(!j._store||j._store.validated||j.key!=null)return;j._store.validated=!0;var ge=Cf(ie);if(mr[ge])return;mr[ge]=!0;var $e="";j&&j._owner&&j._owner!==Qe.current&&($e=" It was passed a child from "+U(j._owner.type)+"."),mt(j),v('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',ge,$e),mt(null)}}function Zl(j,ie){{if(typeof j!="object")return;if(N(j))for(var ge=0;ge<j.length;ge++){var $e=j[ge];_t($e)&&kf($e,ie)}else if(_t(j))j._store&&(j._store.validated=!0);else if(j){var ht=y(j);if(typeof ht=="function"&&ht!==j.entries)for(var wt=ht.call(j),lt;!(lt=wt.next()).done;)_t(lt.value)&&kf(lt.value,ie)}}}function nie(j){{var ie=j.type;if(ie==null||typeof ie=="string")return;var ge;if(typeof ie=="function")ge=ie.propTypes;else if(typeof ie=="object"&&(ie.$$typeof===l||ie.$$typeof===f))ge=ie.propTypes;else return;if(ge){var $e=U(ie);g(ge,j.props,"prop",$e,j)}else if(ie.PropTypes!==void 0&&!nn){nn=!0;var ht=U(ie);v("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",ht||"Unknown")}typeof ie.getDefaultProps=="function"&&!ie.getDefaultProps.isReactClassApproved&&v("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function rie(j){{for(var ie=Object.keys(j.props),ge=0;ge<ie.length;ge++){var $e=ie[ge];if($e!=="children"&&$e!=="key"){mt(j),v("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",$e),mt(null);break}}j.ref!==null&&(mt(j),v("Invalid attribute `ref` supplied to `React.Fragment`."),mt(null))}}var nF={};function rF(j,ie,ge,$e,ht,wt){{var lt=R(j);if(!lt){var st="";(j===void 0||typeof j=="object"&&j!==null&&Object.keys(j).length===0)&&(st+=" 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 Jn=pr();Jn?st+=Jn:st+=Os();var Qt;j===null?Qt="null":N(j)?Qt="array":j!==void 0&&j.$$typeof===e?(Qt="<"+(U(j.type)||"Unknown")+" />",st=" Did you accidentally export a JSX literal instead of a component?"):Qt=typeof j,v("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",Qt,st)}var Zt=pe(j,ie,ge,ht,wt);if(Zt==null)return Zt;if(lt){var ns=ie.children;if(ns!==void 0)if($e)if(N(ns)){for(var Sf=0;Sf<ns.length;Sf++)Zl(ns[Sf],j);Object.freeze&&Object.freeze(ns)}else v("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 Zl(ns,j)}if(Q.call(ie,"key")){var ec=U(j),gr=Object.keys(ie).filter(function(cie){return cie!=="key"}),xE=gr.length>0?"{key: someKey, "+gr.join(": ..., ")+": ...}":"{key: someKey}";if(!nF[ec+xE]){var lie=gr.length>0?"{"+gr.join(": ..., ")+": ...}":"{}";v(`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} />`,xE,ec,aie,ec),nF[ec+xE]=!0}}return j===r?nie(Zt):tie(Zt),Zt}}function rie(j,ie,ge){return rF(j,ie,ge,!0)}function sie(j,ie,ge){return rF(j,ie,ge,!1)}var iie=sie,oie=rie;Mf.Fragment=r,Mf.jsx=iie,Mf.jsxs=oie}()),Mf}process.env.NODE_ENV==="production"?S0.exports=hF():S0.exports=pF();var k=S0.exports;function gn(n){this.content=n}gn.prototype={constructor:gn,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new gn(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new gn(t)},addToStart:function(n,e){return new gn([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new gn(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new gn(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=gn.from(n),n.size?new gn(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=gn.from(n),n.size?new gn(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=gn.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},gn.from=function(n){if(n instanceof gn)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new gn(e)};function VE(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=VE(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function HE(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=HE(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}let oe=class qn{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new qn(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=l}return new qn(r,s)}cutByIndex(e,t){return e==t?qn.empty:e==0&&t==this.content.length?this:new qn(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new qn(s,i)}addToStart(e){return new qn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new qn(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return VE(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return HE(this,e,t,r)}findIndex(e,t=-1){if(e==0)return np(0,e);if(e==this.size)return np(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,s=0;;r++){let i=this.child(r),o=s+i.nodeSize;if(o>=e)return o==e||t>0?np(r+1,o):np(r,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return qn.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new qn(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return qn.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new qn(t||e,r)}static from(e){if(!e)return qn.empty;if(e instanceof qn)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new qn([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};oe.empty=new oe([],0);const T0={index:0,offset:0};function np(n,e){return T0.index=n,T0.offset=e,T0}function rp(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!rp(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!rp(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let gt=class CE{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rp(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return CE.none;if(e instanceof CE)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};gt.none=[];class sp extends Error{}class ue{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$E(this.content,e+this.openStart,t);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(e,t){return new ue(zE(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ue.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(oe.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new ue(e,r,s)}}ue.empty=new ue(oe.empty,0,0);function zE(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(zE(i.content,e-s-1,t-s-1)))}function $E(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return n.cut(0,e).append(t).append(n.cut(e));let a=$E(o.content,e-i-1,t);return a&&n.replaceChild(s,o.copy(a))}function mF(n,e,t){if(t.openStart>n.depth)throw new sp("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new sp("Inconsistent open depths");return GE(n,e,t,0)}function GE(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=GE(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return va(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=gF(t,n);return va(i,KE(n,o,a,e,r))}else return va(i,ip(n,e,r))}function WE(n,e){if(!e.type.compatibleContent(n.type))throw new sp("Cannot join "+e.type.name+" onto "+n.type.name)}function O0(n,e,t){let r=n.node(t);return WE(r,e.node(t)),r}function Aa(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Rf(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Aa(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Aa(s.child(a),r);e&&e.depth==t&&e.textOffset&&Aa(e.nodeBefore,r)}function va(n,e){return n.type.checkContent(e),n.copy(e)}function KE(n,e,t,r,s){let i=n.depth>s&&O0(n,e,s+1),o=r.depth>s&&O0(t,r,s+1),a=[];return Rf(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(WE(i,o),Aa(va(i,KE(n,e,t,r,s+1)),a)):(i&&Aa(va(i,ip(n,e,s+1)),a),Rf(e,t,s,a),o&&Aa(va(o,ip(t,r,s+1)),a)),Rf(r,null,s,a),new oe(a)}function ip(n,e,t){let r=[];if(Rf(null,n,t,r),n.depth>t){let s=O0(n,e,t+1);Aa(va(s,ip(n,e,t+1)),r)}return Rf(e,null,t,r),new oe(r)}function gF(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(oe.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Pf{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return gt.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new op(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new Pf(t,r,i)}static resolveCached(e,t){for(let s=0;s<N0.length;s++){let i=N0[s];if(i.pos==t&&i.doc==e)return i}let r=N0[M0]=Pf.resolve(e,t);return M0=(M0+1)%yF,r}}let N0=[],M0=0,yF=12;class op{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const bF=Object.create(null);let xa=class kE{constructor(e,t,r,s=gt.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||oe.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&rp(this.attrs,t||e.defaultAttrs||bF)&>.sameSet(this.marks,r||gt.none)}copy(e=null){return e==this.content?this:new kE(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kE(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return ue.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ue(c,s.depth-o,i.depth-o)}replace(e,t,r){return mF(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Pf.resolveCached(this,e)}resolveNoCache(e){return Pf.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),QE(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=oe.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=gt.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!gt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=oe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,s,r)}};xa.prototype.text=void 0;class ap extends xa{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):QE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ap(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ap(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function QE(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ea{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new wF(e,t);if(r.next==null)return Ea.empty;let s=JE(r);r.next&&r.err("Unexpected trailing text");let i=SF(kF(s));return TF(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return oe.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let d=i(f,a.concat(u));if(d)return d}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
30
|
+
<%s key={someKey} {...props} />`,xE,ec,lie,ec),nF[ec+xE]=!0}}return j===r?rie(Zt):nie(Zt),Zt}}function sie(j,ie,ge){return rF(j,ie,ge,!0)}function iie(j,ie,ge){return rF(j,ie,ge,!1)}var oie=iie,aie=sie;Mf.Fragment=r,Mf.jsx=oie,Mf.jsxs=aie}()),Mf}process.env.NODE_ENV==="production"?S0.exports=hF():S0.exports=pF();var k=S0.exports;function gn(n){this.content=n}gn.prototype={constructor:gn,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),i=r.content.slice();return s==-1?i.push(t||n,e):(i[s+1]=e,t&&(i[s]=t)),new gn(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new gn(t)},addToStart:function(n,e){return new gn([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new gn(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),i=r.find(n);return s.splice(i==-1?s.length:i,0,e,t),new gn(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=gn.from(n),n.size?new gn(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=gn.from(n),n.size?new gn(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=gn.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},gn.from=function(n){if(n instanceof gn)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new gn(e)};function VE(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),i=e.child(r);if(s==i){t+=s.nodeSize;continue}if(!s.sameMarkup(i))return t;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)t++;return t}if(s.content.size||i.content.size){let o=VE(s.content,i.content,t+1);if(o!=null)return o}t+=s.nodeSize}}function HE(n,e,t,r){for(let s=n.childCount,i=e.childCount;;){if(s==0||i==0)return s==i?null:{a:t,b:r};let o=n.child(--s),a=e.child(--i),l=o.nodeSize;if(o==a){t-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:t,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,t--,r--;return{a:t,b:r}}if(o.content.size||a.content.size){let c=HE(o.content,a.content,t-1,r-1);if(c)return c}t-=l,r-=l}}let oe=class qn{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,i){for(let o=0,a=0;a<t;o++){let l=this.content[o],c=a+l.nodeSize;if(c>e&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,e-u),Math.min(l.content.size,t-u),r,s+u)}a=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let i="",o=!0;return this.nodesBetween(e,t,(a,l)=>{let c=a.isText?a.text.slice(Math.max(e,l)-l,t-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),i=1);i<e.content.length;i++)s.push(e.content[i]);return new qn(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let i=0,o=0;o<t;i++){let a=this.content[i],l=o+a.nodeSize;l>e&&((o<e||l>t)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,t-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,t-o-1))),r.push(a),s+=a.nodeSize),o=l}return new qn(r,s)}cutByIndex(e,t){return e==t?qn.empty:e==0&&t==this.content.length?this:new qn(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),i=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new qn(s,i)}addToStart(e){return new qn([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new qn(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return VE(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return HE(this,e,t,r)}findIndex(e,t=-1){if(e==0)return np(0,e);if(e==this.size)return np(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,s=0;;r++){let i=this.child(r),o=s+i.nodeSize;if(o>=e)return o==e||t>0?np(r+1,o):np(r,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return qn.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new qn(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return qn.empty;let t,r=0;for(let s=0;s<e.length;s++){let i=e[s];r+=i.nodeSize,s&&i.isText&&e[s-1].sameMarkup(i)?(t||(t=e.slice(0,s)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new qn(t||e,r)}static from(e){if(!e)return qn.empty;if(e instanceof qn)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new qn([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};oe.empty=new oe([],0);const T0={index:0,offset:0};function np(n,e){return T0.index=n,T0.offset=e,T0}function rp(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!rp(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!rp(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let gt=class CE{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let i=e[s];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,s));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(i)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&rp(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return CE.none;if(e instanceof CE)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};gt.none=[];class sp extends Error{}class ue{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=$E(this.content,e+this.openStart,t);return r&&new ue(r,this.openStart,this.openEnd)}removeBetween(e,t){return new ue(zE(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return ue.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(oe.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)s++;return new ue(e,r,s)}}ue.empty=new ue(oe.empty,0,0);function zE(n,e,t){let{index:r,offset:s}=n.findIndex(e),i=n.maybeChild(r),{index:o,offset:a}=n.findIndex(t);if(s==e||i.isText){if(a!=t&&!n.child(o).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=o)throw new RangeError("Removing non-flat range");return n.replaceChild(r,i.copy(zE(i.content,e-s-1,t-s-1)))}function $E(n,e,t,r){let{index:s,offset:i}=n.findIndex(e),o=n.maybeChild(s);if(i==e||o.isText)return n.cut(0,e).append(t).append(n.cut(e));let a=$E(o.content,e-i-1,t);return a&&n.replaceChild(s,o.copy(a))}function mF(n,e,t){if(t.openStart>n.depth)throw new sp("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new sp("Inconsistent open depths");return GE(n,e,t,0)}function GE(n,e,t,r){let s=n.index(r),i=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let o=GE(n,e,t,r+1);return i.copy(i.content.replaceChild(s,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let o=n.parent,a=o.content;return va(o,a.cut(0,n.parentOffset).append(t.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=gF(t,n);return va(i,KE(n,o,a,e,r))}else return va(i,ip(n,e,r))}function WE(n,e){if(!e.type.compatibleContent(n.type))throw new sp("Cannot join "+e.type.name+" onto "+n.type.name)}function O0(n,e,t){let r=n.node(t);return WE(r,e.node(t)),r}function Aa(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Rf(n,e,t,r){let s=(e||n).node(t),i=0,o=e?e.index(t):s.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(Aa(n.nodeAfter,r),i++));for(let a=i;a<o;a++)Aa(s.child(a),r);e&&e.depth==t&&e.textOffset&&Aa(e.nodeBefore,r)}function va(n,e){return n.type.checkContent(e),n.copy(e)}function KE(n,e,t,r,s){let i=n.depth>s&&O0(n,e,s+1),o=r.depth>s&&O0(t,r,s+1),a=[];return Rf(null,n,s,a),i&&o&&e.index(s)==t.index(s)?(WE(i,o),Aa(va(i,KE(n,e,t,r,s+1)),a)):(i&&Aa(va(i,ip(n,e,s+1)),a),Rf(e,t,s,a),o&&Aa(va(o,ip(t,r,s+1)),a)),Rf(r,null,s,a),new oe(a)}function ip(n,e,t){let r=[];if(Rf(null,n,t,r),n.depth>t){let s=O0(n,e,t+1);Aa(va(s,ip(n,e,t+1)),r)}return Rf(e,null,t,r),new oe(r)}function gF(n,e){let t=e.depth-n.openStart,s=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)s=e.node(i).copy(oe.from(s));return{start:s.resolveNoCache(n.openStart+t),end:s.resolveNoCache(s.content.size-n.openEnd-t)}}class Pf{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)s+=r.child(i).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return gt.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new op(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,i=t;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new Pf(t,r,i)}static resolveCached(e,t){for(let s=0;s<N0.length;s++){let i=N0[s];if(i.pos==t&&i.doc==e)return i}let r=N0[M0]=Pf.resolve(e,t);return M0=(M0+1)%yF,r}}let N0=[],M0=0,yF=12;class op{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const bF=Object.create(null);let xa=class kE{constructor(e,t,r,s=gt.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||oe.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&rp(this.attrs,t||e.defaultAttrs||bF)&>.sameSet(this.marks,r||gt.none)}copy(e=null){return e==this.content?this:new kE(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new kE(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return ue.empty;let s=this.resolve(e),i=this.resolve(t),o=r?0:s.sharedDepth(t),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new ue(c,s.depth-o,i.depth-o)}replace(e,t,r){return mF(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Pf.resolveCached(this,e)}resolveNoCache(e){return Pf.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),QE(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=oe.empty,s=0,i=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,t);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(e).matchType(r),o=i&&i.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content);let e=gt.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!gt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=oe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,s,r)}};xa.prototype.text=void 0;class ap extends xa{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):QE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ap(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ap(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function QE(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Ea{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new wF(e,t);if(r.next==null)return Ea.empty;let s=JE(r);r.next&&r.err("Unexpected trailing text");let i=SF(kF(s));return TF(i,r),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let i=t;s&&i<r;i++)s=s.matchType(e.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(e,r);if(l&&(!t||l.validEnd))return oe.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:f}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(f)==-1){s.push(f);let d=i(f,a.concat(u));if(d)return d}}return null}return i(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(e)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in t)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),t[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return i}).join(`
|
31
31
|
`)}}Ea.empty=new Ea(!0);class wF{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function JE(n){let e=[];do e.push(AF(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function AF(n){let e=[];do e.push(vF(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function vF(n){let e=CF(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=xF(n,e);else break;return e}function qE(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function xF(n,e){let t=qE(n),r=t;return n.eat(",")&&(n.next!="}"?r=qE(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function EF(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let i in t){let o=t[i];o.groups.indexOf(e)>-1&&s.push(o)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function CF(n){if(n.eat("(")){let e=JE(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=EF(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function kF(n){let e=[[]];return s(i(n,0),t()),e;function t(){return e.push([])-1}function r(o,a,l){let c={term:l,to:a};return e[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=t())}else if(o.type=="star"){let l=t();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=t();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=t();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=t();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function YE(n,e){return e-n}function XE(n,e){let t=[];return r(e),t.sort(YE);function r(s){let i=n[s];if(i.length==1&&!i[0].term)return r(i[0].to);t.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&t.indexOf(l)==-1&&r(l)}}}function SF(n){let e=Object.create(null);return t(XE(n,0));function t(r){let s=[];r.forEach(o=>{n[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);XE(n,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new Ea(r.indexOf(n.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(YE);i.next.push({type:s[o][0],next:e[a.join(",")]||t(a)})}return i}}function TF(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ZE(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function eC(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let i=n[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function tC(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new OF(n[t]);return e}let nC=class iF{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=tC(r.attrs),this.defaultAttrs=ZE(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ea.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:eC(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new xa(this,this.computeAttrs(e),oe.from(t),gt.setFrom(r))}createChecked(e=null,t,r){return t=oe.from(t),this.checkContent(t),new xa(this,this.computeAttrs(e),t,gt.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=oe.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let s=this.contentMatch.matchFragment(t),i=s&&s.fillBefore(oe.empty,!0);return i?new xa(this,e,t.append(i),gt.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:gt.none:e}static compile(e,t){let r=Object.create(null);e.forEach((i,o)=>r[i]=new iF(i,t,o));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class OF{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class lp{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=tC(s.attrs),this.excluded=null;let i=ZE(this.attrs);this.instance=i?new gt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new gt(this,eC(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((i,o)=>r[i]=new lp(i,s++,t,o)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}excludes(e){return this.excluded.indexOf(e)>-1}}class NF{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=gn.from(e.nodes),t.marks=gn.from(e.marks||{}),this.nodes=nC.compile(this.spec.nodes,this),this.marks=lp.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Ea.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?rC(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:rC(this,o.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nC){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new ap(r,r.defaultAttrs,e,gt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return xa.fromJSON(this,e)}markFromJSON(e){return gt.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function rC(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],i=n.marks[s],o=i;if(i)t.push(i);else for(let a in n.marks){let l=n.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&t.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function MF(n){return n.tag!=null}function RF(n){return n.style!=null}let R0=class SE{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{MF(r)?this.tags.push(r):RF(r)&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let s=e.nodes[r.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let r=new aC(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new aC(this,t,!0);return r.addAll(e,t.from,t.to),ue.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(IF(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(e);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(e,t,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=t))){if(o.getAttrs){let l=o.getAttrs(t);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let t=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<t.length;o++){let a=t[o];if((a.priority==null?50:a.priority)<i)break}t.splice(o,0,s)}for(let s in e.marks){let i=e.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=lC(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in e.nodes){let i=e.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=lC(o)),o.node||o.ignore||o.mark||(o.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new SE(e,SE.schemaRules(e)))}};const sC={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},PF={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},iC={ol:!0,ul:!0},cp=1,up=2,Df=4;function oC(n,e,t){return e!=null?(e?cp:0)|(e==="full"?up:0):n&&n.whitespace=="pre"?cp|up:t&~Df}class fp{constructor(e,t,r,s,i,o,a){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=s,this.solid=i,this.options=a,this.content=[],this.activeMarks=gt.none,this.stashMarks=[],this.match=o||(a&Df?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(oe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&cp)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let t=oe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let s=r[t];(this.type?this.type.allowsMarkType(s.type):LF(s.type,e))&&!s.isInSet(this.activeMarks)&&(this.activeMarks=s.addToSet(this.activeMarks),this.pendingMarks=s.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!sC.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class aC{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let s=t.topNode,i,o=oC(null,t.preserveWhitespace,0)|(r?Df:0);s?i=new fp(s.type,s.attrs,gt.none,gt.none,!0,t.topMatch||s.type.contentMatch,o):r?i=new fp(null,null,gt.none,gt.none,!0,null,o):i=new fp(e.schema.topNodeType,null,gt.none,gt.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.style;if(!r||!r.length)return t();let s=this.readStyles(e.style);if(!s)return;let[i,o]=s,a=this.top;for(let l=0;l<o.length;l++)this.removePendingMark(o[l],a);for(let l=0;l<i.length;l++)this.addPendingMark(i[l]);t();for(let l=0;l<i.length;l++)this.removePendingMark(i[l],a);for(let l=0;l<o.length;l++)this.addPendingMark(o[l])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&up||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&cp)r.options&up?t=t.replace(/\r\n?/g,`
|
32
32
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let s=r.content[r.content.length-1],i=e.previousSibling;(!s||i&&i.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),s;iC.hasOwnProperty(r)&&this.parser.normalizeLists&&DF(e);let i=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,t));if(i?i.ignore:PF.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!i||i.skip||i.closeParent){i&&i.closeParent?this.open=Math.max(0,this.open-1):i&&i.skip.nodeType&&(e=i.skip);let o,a=this.top,l=this.needsBlock;if(sC.hasOwnProperty(r))a.content.length&&a.content[0].isInline&&this.open&&(this.open--,a=this.top),o=!0,a.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}i&&i.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),o&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?s:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
33
33
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=gt.none,r=gt.none;for(let s=0,i=e.length;s<i;s++){let o=e.item(s);for(let a=void 0;;){let l=this.parser.matchStyle(o,e.getPropertyValue(o),this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(c=>{l.clearMark(c)&&(r=c.addToSet(r))}):t=this.parser.schema.marks[l.mark].create(l.attrs).addToSet(t),l.consuming===!1)a=l;else break}}return[t,r]}addElementByRule(e,t,r){let s,i,o;t.node?(i=this.parser.schema.nodes[t.node],i.isLeaf?this.insertNode(i.create(t.attrs))||this.leafFallback(e):s=this.enter(i,t.attrs||null,t.preserveWhitespace)):(o=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(o));let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof t.contentElement=="string"?l=e.querySelector(t.contentElement):typeof t.contentElement=="function"?l=t.contentElement(e):t.contentElement&&(l=t.contentElement),this.findAround(e,l,!0),this.addAll(l)}s&&this.sync(a)&&this.open--,o&&this.removePendingMark(o,a)}addAll(e,t,r){let s=t||0;for(let i=t?e.childNodes[t]:e.firstChild,o=r==null?null:e.childNodes[r];i!=o;i=i.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(i);this.findAtPoint(e,s)}findPlace(e){let t,r;for(let s=this.open;s>=0;s--){let i=this.nodes[s],o=i.findWrapping(e);if(o&&(!t||t.length>o.length)&&(t=o,r=i,!o.length)||i.solid)break}if(!t)return!1;this.sync(r);for(let s=0;s<t.length;s++)this.enterInner(t[s],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let s=0;s<e.marks.length;s++)(!t.type||t.type.allowsMarkType(e.marks[s].type))&&(r=e.marks[s].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let s=this.findPlace(e.create(t));return s&&this.enterInner(e,t,!0,r),s}enterInner(e,t=null,r=!1,s){this.closeExtra();let i=this.top;i.applyPending(e),i.match=i.match&&i.match.matchType(e);let o=oC(e,s,i.options);i.options&Df&&i.content.length==0&&(o|=Df),this.nodes.push(new fp(e,t,i.activeMarks,i.pendingMarks,r,null,o)),this.open++}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=t[a];if(c==""){if(a==t.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&u.groups.indexOf(c)==-1)return!1;l--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=BF(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let s=this.nodes[r];if(s.pendingMarks.lastIndexOf(e)>-1)s.pendingMarks=e.removeFromSet(s.pendingMarks);else{s.activeMarks=e.removeFromSet(s.activeMarks);let o=s.popFromStashMark(e);o&&s.type&&s.type.allowsMarkType(o.type)&&(s.activeMarks=o.addToSet(s.activeMarks))}if(s==t)break}}}function DF(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&iC.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function IF(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function lC(n){let e={};for(let t in n)e[t]=n[t];return e}function LF(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==e||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}function BF(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Ns{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=P0(t).createDocumentFragment());let s=r,i=[];return e.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,t);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Ns.renderSpec(P0(t),this.nodes[e.type.name](e));if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let i=this.serializeMark(e.marks[s],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Ns.renderSpec(P0(r),s(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let s=t[0],i=s.indexOf(" ");i>0&&(r=s.slice(0,i),s=s.slice(i+1));let o,a=r?e.createElementNS(r,s):e.createElement(s),l=t[1],c=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){c=2;for(let u in l)if(l[u]!=null){let f=u.indexOf(" ");f>0?a.setAttributeNS(u.slice(0,f),u.slice(f+1),l[u]):a.setAttribute(u,l[u])}}for(let u=c;u<t.length;u++){let f=t[u];if(f===0){if(u<t.length-1||u>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:h}=Ns.renderSpec(e,f,r);if(a.appendChild(d),h){if(o)throw new RangeError("Multiple content holes");o=h}}}return{dom:a,contentDOM:o}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ns(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=cC(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return cC(e.marks)}}function cC(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function P0(n){return n.document||window.document}const uC=65535,fC=Math.pow(2,16);function _F(n,e){return n+e*fC}function dC(n){return n&uC}function FF(n){return(n-(n&uC))/fC}const hC=1,pC=2,dp=4,mC=8;class D0{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&mC)>0}get deletedBefore(){return(this.delInfo&(hC|dp))>0}get deletedAfter(){return(this.delInfo&(pC|dp))>0}get deletedAcross(){return(this.delInfo&dp)>0}}class yr{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&yr.empty)return yr.empty}recover(e){let t=0,r=dC(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+FF(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>e)break;let c=this.ranges[a+i],u=this.ranges[a+o],f=l+c;if(e<=f){let d=c?e==l?-1:e==f?1:t:t,h=l+s+(d<0?0:u);if(r)return h;let p=e==(t<0?l:f)?null:_F(a/3,e-l),m=e==l?pC:e==f?hC:dp;return(t<0?e!=l:e!=f)&&(m|=mC),new D0(h,m,p)}s+=u-c}return r?e+s:new D0(e+s,0,null)}touches(e,t){let r=0,s=dC(t),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let c=this.ranges[a+i],u=l+c;if(e<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+t],u=this.ranges[s+r];e(a,a+c,l,l+u),i+=u-c}}invert(){return new yr(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?yr.empty:new yr(e<0?[0,-e,0]:[0,0,e])}}yr.empty=new yr([]);class tc{constructor(e=[],t,r=0,s=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=s}slice(e=0,t=this.maps.length){return new tc(this.maps,this.mirror,e,t)}copy(){return new tc(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let s=e.getMirror(t);this.appendMap(e.maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this.maps.length+e.maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e.maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new tc;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this.maps[i],a=o.mapResult(e,t);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,e=this.maps[l].recover(a.recover);continue}}s|=a.delInfo,e=a.pos}return r?e:new D0(e,s,null)}}const I0=Object.create(null);class kn{getMap(){return yr.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=I0[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in I0)throw new RangeError("Duplicate use of step JSON ID "+e);return I0[e]=t,t.prototype.jsonID=e,t}}class Jt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Jt(e,null)}static fail(e){return new Jt(null,e)}static fromReplace(e,t,r,s){try{return Jt.ok(e.replace(t,r,s))}catch(i){if(i instanceof sp)return Jt.fail(i.message);throw i}}}function L0(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let i=n.child(s);i.content.size&&(i=i.copy(L0(i.content,e,i))),i.isInline&&(i=e(i,t,s)),r.push(i)}return oe.fromArray(r)}class ao extends kn{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new ue(L0(t.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),t.openStart,t.openEnd);return Jt.fromReplace(e,this.from,this.to,i)}invert(){return new Ms(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new ao(t.pos,r.pos,this.mark)}merge(e){return e instanceof ao&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ao(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ao(t.from,t.to,e.markFromJSON(t.mark))}}kn.jsonID("addMark",ao);class Ms extends kn{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new ue(L0(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return Jt.fromReplace(e,this.from,this.to,r)}invert(){return new ao(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Ms(t.pos,r.pos,this.mark)}merge(e){return e instanceof Ms&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ms(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ms(t.from,t.to,e.markFromJSON(t.mark))}}kn.jsonID("removeMark",Ms);class lo extends kn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Jt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return Jt.fromReplace(e,this.pos,this.pos+1,new ue(oe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new lo(this.pos,t.marks[s]);return new lo(this.pos,this.mark)}}return new nc(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new lo(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new lo(t.pos,e.markFromJSON(t.mark))}}kn.jsonID("addNodeMark",lo);class nc extends kn{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return Jt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return Jt.fromReplace(e,this.pos,this.pos+1,new ue(oe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new lo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nc(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new nc(t.pos,e.markFromJSON(t.mark))}}kn.jsonID("removeNodeMark",nc);class rn extends kn{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&B0(e,this.from,this.to)?Jt.fail("Structure replace would overwrite content"):Jt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new yr([this.from,this.to-this.from,this.slice.size])}invert(e){return new rn(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new rn(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof rn)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new rn(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new rn(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new rn(t.from,t.to,ue.fromJSON(e,t.slice),!!t.structure)}}kn.jsonID("replace",rn);class sn extends kn{constructor(e,t,r,s,i,o,a=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(e){if(this.structure&&(B0(e,this.from,this.gapFrom)||B0(e,this.gapTo,this.to)))return Jt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return Jt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?Jt.fromReplace(e,this.from,this.to,r):Jt.fail("Content does not fit in gap")}getMap(){return new yr([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new sn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||i>r.pos?null:new sn(t.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new sn(t.from,t.to,t.gapFrom,t.gapTo,ue.fromJSON(e,t.slice),t.insert,!!t.structure)}}kn.jsonID("replaceAround",sn);function B0(n,e,t){let r=n.resolve(e),s=t-e,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function jF(n,e,t,r){let s=[],i=[],o,a;n.doc.nodesBetween(e,t,(l,c,u)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&u.type.allowsMarkType(r.type)){let d=Math.max(c,e),h=Math.min(c+l.nodeSize,t),p=r.addToSet(f);for(let m=0;m<f.length;m++)f[m].isInSet(p)||(o&&o.to==d&&o.mark.eq(f[m])?o.to=h:s.push(o=new Ms(d,h,f[m])));a&&a.to==d?a.to=h:i.push(a=new ao(d,h,r))}}),s.forEach(l=>n.step(l)),i.forEach(l=>n.step(l))}function UF(n,e,t,r){let s=[],i=0;n.doc.nodesBetween(e,t,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof lp){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,t);for(let u=0;u<l.length;u++){let f=l[u],d;for(let h=0;h<s.length;h++){let p=s[h];p.step==i-1&&f.eq(s[h].style)&&(d=p)}d?(d.to=c,d.step=i):s.push({style:f,from:Math.max(a,e),to:c,step:i})}}}),s.forEach(o=>n.step(new Ms(o.from,o.to,o.style)))}function gC(n,e,t,r=t.contentMatch,s=!0){let i=n.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,f=r.matchType(c.type);if(!f)o.push(new rn(a,u,ue.empty));else{r=f;for(let d=0;d<c.marks.length;d++)t.allowsMarkType(c.marks[d].type)||n.step(new Ms(a,u,c.marks[d]));if(s&&c.isText&&t.whitespace!="pre"){let d,h=/\r?\n|\r/g,p;for(;d=h.exec(c.text);)p||(p=new ue(oe.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new rn(a+d.index,a+d.index+d[0].length,p))}}a=u}if(!r.validEnd){let l=r.fillBefore(oe.empty,!0);n.replace(a,a,new ue(l,0,0))}for(let l=o.length-1;l>=0;l--)n.step(o[l])}function VF(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function rc(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let s=n.$from.node(r),i=n.$from.index(r),o=n.$to.indexAfter(r);if(r<n.depth&&s.canReplace(i,o,t))return r;if(r==0||s.type.spec.isolating||!VF(s,i,o))break}return null}function HF(n,e,t){let{$from:r,$to:s,depth:i}=e,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=oe.empty,f=0;for(let p=i,m=!1;p>t;p--)m||r.index(p)>0?(m=!0,u=oe.from(r.node(p).copy(u)),f++):l--;let d=oe.empty,h=0;for(let p=i,m=!1;p>t;p--)m||s.after(p+1)<s.end(p)?(m=!0,d=oe.from(s.node(p).copy(d)),h++):c++;n.step(new sn(l,c,o,a,new ue(u.append(d),f,h),u.size-f,!0))}function _0(n,e,t=null,r=n){let s=zF(n,e),i=s&&$F(r,e);return i?s.map(yC).concat({type:e,attrs:t}).concat(i.map(yC)):null}function yC(n){return{type:n,attrs:null}}function zF(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.contentMatchAt(r).findWrapping(e);if(!i)return null;let o=i.length?i[0]:e;return t.canReplaceWith(r,s,o)?i:null}function $F(n,e){let{parent:t,startIndex:r,endIndex:s}=n,i=t.child(r),o=e.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(t.child(c).type);return!l||!l.validEnd?null:o}function GF(n,e,t){let r=oe.empty;for(let o=t.length-1;o>=0;o--){if(r.size){let a=t[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=oe.from(t[o].type.create(t[o].attrs,r))}let s=e.start,i=e.end;n.step(new sn(s,i,s,i,new ue(r,0,0),t.length,!0))}function WF(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(o,a)=>{if(o.isTextblock&&!o.hasMarkup(r,s)&&JF(n.doc,n.mapping.slice(i).map(a),r)){let l=null;if(r.schema.linebreakReplacement){let d=r.whitespace=="pre",h=!!r.contentMatch.matchType(r.schema.linebreakReplacement);d&&!h?l=!1:!d&&h&&(l=!0)}l===!1&&QF(n,o,a,i),gC(n,n.mapping.slice(i).map(a,1),r,void 0,l===null);let c=n.mapping.slice(i),u=c.map(a,1),f=c.map(a+o.nodeSize,1);return n.step(new sn(u,f,u+1,f-1,new ue(oe.from(r.create(s,null,o.marks)),0,0),1,!0)),l===!0&&KF(n,o,a,i),!1}})}function KF(n,e,t,r){e.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=n.mapping.slice(r).map(t+1+i+o.index);n.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function QF(n,e,t,r){e.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=n.mapping.slice(r).map(t+1+i);n.replaceWith(o,o+1,e.type.schema.text(`
|
@@ -419,7 +419,7 @@ img.ProseMirror-separator {
|
|
419
419
|
`)},FT=function(){var n=parseInt(document.body.getAttribute(Cc)||"0",10);return isFinite(n)?n:0},A5=function(){V.useEffect(function(){return document.body.setAttribute(Cc,(FT()+1).toString()),function(){var n=FT()-1;n<=0?document.body.removeAttribute(Cc):document.body.setAttribute(Cc,n.toString())}},[])},v5=function(n){var e=n.noRelative,t=n.noImportant,r=n.gapMode,s=r===void 0?"margin":r;A5();var i=V.useMemo(function(){return y5(s)},[s]);return V.createElement(b5,{styles:w5(i,!e,s,t?"":"!important")})},vw=!1;if(typeof window<"u")try{var tm=Object.defineProperty({},"passive",{get:function(){return vw=!0,!0}});window.addEventListener("test",tm,tm),window.removeEventListener("test",tm,tm)}catch{vw=!1}var kc=vw?{passive:!1}:!1,x5=function(n){return n.tagName==="TEXTAREA"},jT=function(n,e){var t=window.getComputedStyle(n);return t[e]!=="hidden"&&!(t.overflowY===t.overflowX&&!x5(n)&&t[e]==="visible")},E5=function(n){return jT(n,"overflowY")},C5=function(n){return jT(n,"overflowX")},UT=function(n,e){var t=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=VT(n,r);if(s){var i=HT(n,r),o=i[1],a=i[2];if(o>a)return!0}r=r.parentNode}while(r&&r!==t.body);return!1},k5=function(n){var e=n.scrollTop,t=n.scrollHeight,r=n.clientHeight;return[e,t,r]},S5=function(n){var e=n.scrollLeft,t=n.scrollWidth,r=n.clientWidth;return[e,t,r]},VT=function(n,e){return n==="v"?E5(e):C5(e)},HT=function(n,e){return n==="v"?k5(e):S5(e)},T5=function(n,e){return n==="h"&&e==="rtl"?-1:1},O5=function(n,e,t,r,s){var i=T5(n,window.getComputedStyle(e).direction),o=i*r,a=t.target,l=e.contains(a),c=!1,u=o>0,f=0,d=0;do{var h=HT(n,a),p=h[0],m=h[1],y=h[2],b=m-y-i*p;(p||b)&&VT(n,a)&&(f+=b,d+=p),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(e.contains(a)||e===a));return(u&&(Math.abs(f)<1||!s)||!u&&(Math.abs(d)<1||!s))&&(c=!0),c},nm=function(n){return"changedTouches"in n?[n.changedTouches[0].clientX,n.changedTouches[0].clientY]:[0,0]},zT=function(n){return[n.deltaX,n.deltaY]},$T=function(n){return n&&"current"in n?n.current:n},N5=function(n,e){return n[0]===e[0]&&n[1]===e[1]},M5=function(n){return`
|
420
420
|
.block-interactivity-`.concat(n,` {pointer-events: none;}
|
421
421
|
.allow-interactivity-`).concat(n,` {pointer-events: all;}
|
422
|
-
`)},R5=0,Sc=[];function P5(n){var e=V.useRef([]),t=V.useRef([0,0]),r=V.useRef(),s=V.useState(R5++)[0],i=V.useState(_T)[0],o=V.useRef(n);V.useEffect(function(){o.current=n},[n]),V.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var m=Z8([n.lockRef.current],(n.shards||[]).map($T),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var a=V.useCallback(function(m,y){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var b=nm(m),v=t.current,A="deltaX"in m?m.deltaX:v[0]-b[0],w="deltaY"in m?m.deltaY:v[1]-b[1],x,C=m.target,S=Math.abs(A)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&C.type==="range")return!1;var M=UT(S,C);if(!M)return!0;if(M?x=S:(x=S==="v"?"h":"v",M=UT(S,C)),!M)return!1;if(!r.current&&"changedTouches"in m&&(A||w)&&(r.current=x),!x)return!0;var O=r.current||x;return O5(O,y,m,O==="h"?A:w,!0)},[]),l=V.useCallback(function(m){var y=m;if(!(!Sc.length||Sc[Sc.length-1]!==i)){var b="deltaY"in y?zT(y):nm(y),v=e.current.filter(function(x){return x.name===y.type&&(x.target===y.target||y.target===x.shadowParent)&&N5(x.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var A=(o.current.shards||[]).map($T).filter(Boolean).filter(function(x){return x.contains(y.target)}),w=A.length>0?a(y,A[0]):!o.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),c=V.useCallback(function(m,y,b,v){var A={name:m,delta:y,target:b,should:v,shadowParent:D5(b)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(w){return w!==A})},1)},[]),u=V.useCallback(function(m){t.current=nm(m),r.current=void 0},[]),f=V.useCallback(function(m){c(m.type,zT(m),m.target,a(m,n.lockRef.current))},[]),d=V.useCallback(function(m){c(m.type,nm(m),m.target,a(m,n.lockRef.current))},[]);V.useEffect(function(){return Sc.push(i),n.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,kc),document.addEventListener("touchmove",l,kc),document.addEventListener("touchstart",u,kc),function(){Sc=Sc.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,kc),document.removeEventListener("touchmove",l,kc),document.removeEventListener("touchstart",u,kc)}},[]);var h=n.removeScrollBar,p=n.inert;return V.createElement(V.Fragment,null,p?V.createElement(i,{styles:M5(s)}):null,h?V.createElement(v5,{gapMode:n.gapMode}):null)}function D5(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const I5=l5(BT,P5);var xw=V.forwardRef(function(n,e){return V.createElement(em,_s({},n,{ref:e,sideCar:I5}))});xw.classNames=em.classNames;var L5=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Tc=new WeakMap,rm=new WeakMap,sm={},Ew=0,GT=function(n){return n&&(n.host||GT(n.parentNode))},B5=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=GT(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},_5=function(n,e,t,r){var s=B5(e,Array.isArray(n)?n:[n]);sm[t]||(sm[t]=new WeakMap);var i=sm[t],o=[],a=new Set,l=new Set(s),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};s.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(a.has(d))u(d);else try{var h=d.getAttribute(r),p=h!==null&&h!=="false",m=(Tc.get(d)||0)+1,y=(i.get(d)||0)+1;Tc.set(d,m),i.set(d,y),o.push(d),m===1&&p&&rm.set(d,!0),y===1&&d.setAttribute(t,"true"),p||d.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return u(e),a.clear(),Ew++,function(){o.forEach(function(f){var d=Tc.get(f)-1,h=i.get(f)-1;Tc.set(f,d),i.set(f,h),d||(rm.has(f)||f.removeAttribute(r),rm.delete(f)),h||f.removeAttribute(t)}),Ew--,Ew||(Tc=new WeakMap,Tc=new WeakMap,rm=new WeakMap,sm={})}},WT=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),s=L5(n);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),_5(r,s,t,"aria-hidden")):function(){return null}},Cw="Dialog",[KT,
|
422
|
+
`)},R5=0,Sc=[];function P5(n){var e=V.useRef([]),t=V.useRef([0,0]),r=V.useRef(),s=V.useState(R5++)[0],i=V.useState(_T)[0],o=V.useRef(n);V.useEffect(function(){o.current=n},[n]),V.useEffect(function(){if(n.inert){document.body.classList.add("block-interactivity-".concat(s));var m=Z8([n.lockRef.current],(n.shards||[]).map($T),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(s))})}}},[n.inert,n.lockRef.current,n.shards]);var a=V.useCallback(function(m,y){if("touches"in m&&m.touches.length===2)return!o.current.allowPinchZoom;var b=nm(m),v=t.current,A="deltaX"in m?m.deltaX:v[0]-b[0],w="deltaY"in m?m.deltaY:v[1]-b[1],x,C=m.target,S=Math.abs(A)>Math.abs(w)?"h":"v";if("touches"in m&&S==="h"&&C.type==="range")return!1;var M=UT(S,C);if(!M)return!0;if(M?x=S:(x=S==="v"?"h":"v",M=UT(S,C)),!M)return!1;if(!r.current&&"changedTouches"in m&&(A||w)&&(r.current=x),!x)return!0;var O=r.current||x;return O5(O,y,m,O==="h"?A:w,!0)},[]),l=V.useCallback(function(m){var y=m;if(!(!Sc.length||Sc[Sc.length-1]!==i)){var b="deltaY"in y?zT(y):nm(y),v=e.current.filter(function(x){return x.name===y.type&&(x.target===y.target||y.target===x.shadowParent)&&N5(x.delta,b)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var A=(o.current.shards||[]).map($T).filter(Boolean).filter(function(x){return x.contains(y.target)}),w=A.length>0?a(y,A[0]):!o.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),c=V.useCallback(function(m,y,b,v){var A={name:m,delta:y,target:b,should:v,shadowParent:D5(b)};e.current.push(A),setTimeout(function(){e.current=e.current.filter(function(w){return w!==A})},1)},[]),u=V.useCallback(function(m){t.current=nm(m),r.current=void 0},[]),f=V.useCallback(function(m){c(m.type,zT(m),m.target,a(m,n.lockRef.current))},[]),d=V.useCallback(function(m){c(m.type,nm(m),m.target,a(m,n.lockRef.current))},[]);V.useEffect(function(){return Sc.push(i),n.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:d}),document.addEventListener("wheel",l,kc),document.addEventListener("touchmove",l,kc),document.addEventListener("touchstart",u,kc),function(){Sc=Sc.filter(function(m){return m!==i}),document.removeEventListener("wheel",l,kc),document.removeEventListener("touchmove",l,kc),document.removeEventListener("touchstart",u,kc)}},[]);var h=n.removeScrollBar,p=n.inert;return V.createElement(V.Fragment,null,p?V.createElement(i,{styles:M5(s)}):null,h?V.createElement(v5,{gapMode:n.gapMode}):null)}function D5(n){for(var e=null;n!==null;)n instanceof ShadowRoot&&(e=n.host,n=n.host),n=n.parentNode;return e}const I5=l5(BT,P5);var xw=V.forwardRef(function(n,e){return V.createElement(em,_s({},n,{ref:e,sideCar:I5}))});xw.classNames=em.classNames;var L5=function(n){if(typeof document>"u")return null;var e=Array.isArray(n)?n[0]:n;return e.ownerDocument.body},Tc=new WeakMap,rm=new WeakMap,sm={},Ew=0,GT=function(n){return n&&(n.host||GT(n.parentNode))},B5=function(n,e){return e.map(function(t){if(n.contains(t))return t;var r=GT(t);return r&&n.contains(r)?r:(console.error("aria-hidden",t,"in not contained inside",n,". Doing nothing"),null)}).filter(function(t){return!!t})},_5=function(n,e,t,r){var s=B5(e,Array.isArray(n)?n:[n]);sm[t]||(sm[t]=new WeakMap);var i=sm[t],o=[],a=new Set,l=new Set(s),c=function(f){!f||a.has(f)||(a.add(f),c(f.parentNode))};s.forEach(c);var u=function(f){!f||l.has(f)||Array.prototype.forEach.call(f.children,function(d){if(a.has(d))u(d);else try{var h=d.getAttribute(r),p=h!==null&&h!=="false",m=(Tc.get(d)||0)+1,y=(i.get(d)||0)+1;Tc.set(d,m),i.set(d,y),o.push(d),m===1&&p&&rm.set(d,!0),y===1&&d.setAttribute(t,"true"),p||d.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",d,b)}})};return u(e),a.clear(),Ew++,function(){o.forEach(function(f){var d=Tc.get(f)-1,h=i.get(f)-1;Tc.set(f,d),i.set(f,h),d||(rm.has(f)||f.removeAttribute(r),rm.delete(f)),h||f.removeAttribute(t)}),Ew--,Ew||(Tc=new WeakMap,Tc=new WeakMap,rm=new WeakMap,sm={})}},WT=function(n,e,t){t===void 0&&(t="data-aria-hidden");var r=Array.from(Array.isArray(n)?n:[n]),s=L5(n);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),_5(r,s,t,"aria-hidden")):function(){return null}},Cw="Dialog",[KT,xie]=fw(Cw),[F5,as]=KT(Cw),QT=n=>{const{__scopeDialog:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=n,a=V.useRef(null),l=V.useRef(null),[c=!1,u]=AT({prop:r,defaultProp:s,onChange:i});return k.jsx(F5,{scope:e,triggerRef:a,contentRef:l,contentId:Jp(),titleId:Jp(),descriptionId:Jp(),open:c,onOpenChange:u,onOpenToggle:V.useCallback(()=>u(f=>!f),[u]),modal:o,children:t})};QT.displayName=Cw;var JT="DialogTrigger",qT=V.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=as(JT,t),i=jr(e,s.triggerRef);return k.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Tw(s.open),...r,ref:i,onClick:Ar(n.onClick,s.onOpenToggle)})});qT.displayName=JT;var kw="DialogPortal",[j5,YT]=KT(kw,{forceMount:void 0}),XT=n=>{const{__scopeDialog:e,forceMount:t,children:r,container:s}=n,i=as(kw,e);return k.jsx(j5,{scope:e,forceMount:t,children:V.Children.map(r,o=>k.jsx(fd,{present:t||i.open,children:k.jsx(MT,{asChild:!0,container:s,children:o})}))})};XT.displayName=kw;var im="DialogOverlay",ZT=V.forwardRef((n,e)=>{const t=YT(im,n.__scopeDialog),{forceMount:r=t.forceMount,...s}=n,i=as(im,n.__scopeDialog);return i.modal?k.jsx(fd,{present:r||i.open,children:k.jsx(U5,{...s,ref:e})}):null});ZT.displayName=im;var U5=V.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=as(im,t);return k.jsx(xw,{as:qp,allowPinchZoom:!0,shards:[s.contentRef],children:k.jsx(nr.div,{"data-state":Tw(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),ja="DialogContent",eO=V.forwardRef((n,e)=>{const t=YT(ja,n.__scopeDialog),{forceMount:r=t.forceMount,...s}=n,i=as(ja,n.__scopeDialog);return k.jsx(fd,{present:r||i.open,children:i.modal?k.jsx(V5,{...s,ref:e}):k.jsx(H5,{...s,ref:e})})});eO.displayName=ja;var V5=V.forwardRef((n,e)=>{const t=as(ja,n.__scopeDialog),r=V.useRef(null),s=jr(e,t.contentRef,r);return V.useEffect(()=>{const i=r.current;if(i)return WT(i)},[]),k.jsx(tO,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ar(n.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=t.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Ar(n.onPointerDownOutside,i=>{const o=i.detail.originalEvent,a=o.button===0&&o.ctrlKey===!0;(o.button===2||a)&&i.preventDefault()}),onFocusOutside:Ar(n.onFocusOutside,i=>i.preventDefault())})}),H5=V.forwardRef((n,e)=>{const t=as(ja,n.__scopeDialog),r=V.useRef(!1),s=V.useRef(!1);return k.jsx(tO,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),tO=V.forwardRef((n,e)=>{const{__scopeDialog:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=n,a=as(ja,t),l=V.useRef(null),c=jr(e,l);return RT(),k.jsxs(k.Fragment,{children:[k.jsx(ud,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:k.jsx(pw,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":Tw(a.open),...o,ref:c,onDismiss:()=>a.onOpenChange(!1)})}),k.jsxs(k.Fragment,{children:[k.jsx(z5,{titleId:a.titleId}),k.jsx(G5,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Sw="DialogTitle",nO=V.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=as(Sw,t);return k.jsx(nr.h2,{id:s.titleId,...r,ref:e})});nO.displayName=Sw;var rO="DialogDescription",sO=V.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=as(rO,t);return k.jsx(nr.p,{id:s.descriptionId,...r,ref:e})});sO.displayName=rO;var iO="DialogClose",oO=V.forwardRef((n,e)=>{const{__scopeDialog:t,...r}=n,s=as(iO,t);return k.jsx(nr.button,{type:"button",...r,ref:e,onClick:Ar(n.onClick,()=>s.onOpenChange(!1))})});oO.displayName=iO;function Tw(n){return n?"open":"closed"}var aO="DialogTitleWarning",[Eie,lO]=E8(aO,{contentName:ja,titleName:Sw,docsSlug:"dialog"}),z5=({titleId:n})=>{const e=lO(aO),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
|
423
423
|
|
424
424
|
If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
|
425
425
|
|
@@ -434,7 +434,7 @@ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,i("_proc
|
|
434
434
|
`,WW="️",KW="";let Rg=null,Pg=null;function QW(n){n===void 0&&(n=[]);const e={};ir.groups=e;const t=new ir;Rg==null&&(Rg=zM(UW)),Pg==null&&(Pg=zM(VW)),de(t,"'",yg),de(t,"{",zd),de(t,"}",$d),de(t,"[",ng),de(t,"]",rg),de(t,"(",sg),de(t,")",ig),de(t,"<",og),de(t,">",ag),de(t,"(",lg),de(t,")",cg),de(t,"「",ug),de(t,"」",fg),de(t,"『",dg),de(t,"』",hg),de(t,"<",pg),de(t,">",mg),de(t,"&",gg),de(t,"*",bg),de(t,"@",Ro),de(t,"`",Ag),de(t,"^",vg),de(t,":",Po),de(t,",",yv),de(t,"$",xg),de(t,".",Gs),de(t,"=",Eg),de(t,"!",bv),de(t,"-",Ws),de(t,"%",Cg),de(t,"|",kg),de(t,"+",Sg),de(t,"#",Tg),de(t,"?",Og),de(t,'"',wv),de(t,"/",Ks),de(t,";",Av),de(t,"~",Gd),de(t,"_",Ng),de(t,"\\",wg);const r=zr(t,Ev,mv,{[lv]:!0});zr(r,Ev,r);const s=zr(t,Wc,Si,{[cv]:!0});zr(s,Wc,s);const i=zr(t,vv,dv,{[uv]:!0});zr(i,Wc),zr(i,vv,i);const o=zr(t,VM,FM,{[BM]:!0});de(t,HM,gv,{[BM]:!0}),de(o,HM),zr(o,VM,o);const a=zr(t,xv,jM,{[LM]:!0});zr(a,xv,a),de(a,WW,a);const l=de(a,KW);zr(l,xv,a);const c=[[Wc,s]],u=[[Wc,null],[vv,i]];for(let f=0;f<Rg.length;f++)Do(t,Rg[f],hv,Si,c);for(let f=0;f<Pg.length;f++)Do(t,Pg[f],pv,dv,u);tl(hv,{tld:!0,ascii:!0},e),tl(pv,{utld:!0,alpha:!0},e),Do(t,"file",tg,Si,c),Do(t,"mailto",tg,Si,c),Do(t,"http",Gc,Si,c),Do(t,"https",Gc,Si,c),Do(t,"ftp",Gc,Si,c),Do(t,"ftps",Gc,Si,c),tl(tg,{scheme:!0,ascii:!0},e),tl(Gc,{slashscheme:!0,ascii:!0},e),n=n.sort((f,d)=>f[0]>d[0]?1:-1);for(let f=0;f<n.length;f++){const d=n[f][0],p=n[f][1]?{[HW]:!0}:{[zW]:!0};d.indexOf("-")>=0?p[fv]=!0:Wc.test(d)?Ev.test(d)?p[Zm]=!0:p[cv]=!0:p[lv]=!0,_M(t,d,d,p)}return _M(t,"localhost",Hd,{ascii:!0}),t.jd=new ir(Mg),{start:t,tokens:$c({groups:e},UM)}}function JW(n,e){const t=qW(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=t.length,s=[];let i=0,o=0;for(;o<r;){let a=n,l=null,c=0,u=null,f=-1,d=-1;for(;o<r&&(l=a.go(t[o]));)a=l,a.accepts()?(f=0,d=0,u=a):f>=0&&(f+=t[o].length,d++),c+=t[o].length,i+=t[o].length,o++;i-=f,o-=d,c-=f,s.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return s}function qW(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),i,o=s<55296||s>56319||r+1===t||(i=n.charCodeAt(r+1))<56320||i>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function Do(n,e,t,r,s){let i;const o=e.length;for(let a=0;a<o-1;a++){const l=e[a];n.j[l]?i=n.j[l]:(i=new ir(r),i.jr=s.slice(),n.j[l]=i),n=i}return i=new ir(t),i.jr=s.slice(),n.j[e[o-1]]=i,i}function zM(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let i=0;for(;s.indexOf(n[r+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+i),10);o>0;o--)t.pop();r+=i}else t.push(n[r]),r++}return e}const Wd={defaultProtocol:"http",events:null,format:$M,formatHref:$M,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Cv(n,e){e===void 0&&(e=null);let t=$c({},Wd);n&&(t=$c(t,n instanceof Cv?n.o:n));const r=t.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Cv.prototype={o:Wd,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:Wd[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function $M(n){return n}function GM(n,e){this.t="token",this.v=n,this.tk=e}GM.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=Wd.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),i=this.toFormattedString(n),o={},a=n.get("className",t,e),l=n.get("target",t,e),c=n.get("rel",t,e),u=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&$c(o,u),{tagName:s,attributes:o,content:i,eventListeners:f}}};function Dg(n,e){class t extends GM{constructor(s,i){super(s,i),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const WM=Dg("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),KM=Dg("text"),YW=Dg("nl"),Ig=Dg("url",{isLink:!0,toHref(n){return n===void 0&&(n=Wd.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Hd&&n[1].t===Po}}),$r=n=>new ir(n);function XW(n){let{groups:e}=n;const t=e.domain.concat([gg,bg,Ro,wg,Ag,vg,xg,Eg,Ws,mv,Cg,kg,Sg,Tg,Ks,Mg,Gd,Ng]),r=[yg,Po,yv,Gs,bv,Og,wv,Av,og,ag,zd,$d,rg,ng,sg,ig,lg,cg,ug,fg,dg,hg,pg,mg],s=[gg,yg,bg,wg,Ag,vg,xg,Eg,Ws,zd,$d,Cg,kg,Sg,Tg,Og,Ks,Mg,Gd,Ng],i=$r(),o=de(i,Gd);Xe(o,s,o),Xe(o,e.domain,o);const a=$r(),l=$r(),c=$r();Xe(i,e.domain,a),Xe(i,e.scheme,l),Xe(i,e.slashscheme,c),Xe(a,s,o),Xe(a,e.domain,a);const u=de(a,Ro);de(o,Ro,u),de(l,Ro,u),de(c,Ro,u);const f=de(o,Gs);Xe(f,s,o),Xe(f,e.domain,o);const d=$r();Xe(u,e.domain,d),Xe(d,e.domain,d);const h=de(d,Gs);Xe(h,e.domain,d);const p=$r(WM);Xe(h,e.tld,p),Xe(h,e.utld,p),de(u,Hd,p);const m=de(d,Ws);Xe(m,e.domain,d),Xe(p,e.domain,d),de(p,Gs,h),de(p,Ws,m);const y=de(p,Po);Xe(y,e.numeric,WM);const b=de(a,Ws),v=de(a,Gs);Xe(b,e.domain,a),Xe(v,s,o),Xe(v,e.domain,a);const A=$r(Ig);Xe(v,e.tld,A),Xe(v,e.utld,A),Xe(A,e.domain,a),Xe(A,s,o),de(A,Gs,v),de(A,Ws,b),de(A,Ro,u);const w=de(A,Po),x=$r(Ig);Xe(w,e.numeric,x);const C=$r(Ig),S=$r();Xe(C,t,C),Xe(C,r,S),Xe(S,t,C),Xe(S,r,S),de(A,Ks,C),de(x,Ks,C);const M=de(l,Po),O=de(c,Po),R=de(O,Ks),D=de(R,Ks);Xe(l,e.domain,a),de(l,Gs,v),de(l,Ws,b),Xe(c,e.domain,a),de(c,Gs,v),de(c,Ws,b),Xe(M,e.domain,C),de(M,Ks,C),Xe(D,e.domain,C),Xe(D,t,C),de(D,Ks,C);const _=[[zd,$d],[ng,rg],[sg,ig],[og,ag],[lg,cg],[ug,fg],[dg,hg],[pg,mg]];for(let U=0;U<_.length;U++){const[K,B]=_[U],$=de(C,K);de(S,K,$),de($,B,C);const q=$r(Ig);Xe($,t,q);const ne=$r();Xe($,r),Xe(q,t,q),Xe(q,r,ne),Xe(ne,t,q),Xe(ne,r,ne),de(q,B,C),de(ne,B,C)}return de(i,Hd,A),de(i,gv,YW),{start:i,tokens:UM}}function ZW(n,e,t){let r=t.length,s=0,i=[],o=[];for(;s<r;){let a=n,l=null,c=null,u=0,f=null,d=-1;for(;s<r&&!(l=a.go(t[s].t));)o.push(t[s++]);for(;s<r&&(c=l||a.go(t[s].t));)l=null,a=c,a.accepts()?(d=0,f=a):d>=0&&d++,s++,u++;if(d<0)s-=u,s<r&&(o.push(t[s]),s++);else{o.length>0&&(i.push(kv(KM,e,o)),o=[]),s-=d,u-=d;const h=f.t,p=t.slice(s-u,s);i.push(kv(h,e,p))}}return o.length>0&&i.push(kv(KM,e,o)),i}function kv(n,e,t){const r=t[0].s,s=t[t.length-1].e,i=e.slice(r,s);return new n(i,t)}const eK=typeof console<"u"&&console&&console.warn||(()=>{}),tK="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",It={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nK(){ir.groups={},It.scanner=null,It.parser=null,It.tokenQueue=[],It.pluginQueue=[],It.customSchemes=[],It.initialized=!1}function QM(n,e){if(e===void 0&&(e=!1),It.initialized&&eK(`linkifyjs: already initialized - will not register custom scheme "${n}" ${tK}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
435
435
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
436
436
|
2. Cannot start or end with "-"
|
437
|
-
3. "-" cannot repeat`);It.customSchemes.push([n,e])}function rK(){It.scanner=QW(It.customSchemes);for(let n=0;n<It.tokenQueue.length;n++)It.tokenQueue[n][1]({scanner:It.scanner});It.parser=XW(It.scanner.tokens);for(let n=0;n<It.pluginQueue.length;n++)It.pluginQueue[n][1]({scanner:It.scanner,parser:It.parser});It.initialized=!0}function JM(n){return It.initialized||rK(),ZW(It.parser.start,n,JW(It.scanner.start,n))}function qM(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Cv(t),s=JM(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function sK(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function iK(n){return new At({key:new Rt("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=TU(t.doc,[...e]);if(LU(a).forEach(({newRange:c})=>{const u=NU(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(b=>b!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const y=JM(p).map(b=>b.toObject());if(!sK(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate?n.validate(b.value):!0).forEach(b=>{Nb(b.from,b.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function oK(n){return new At({key:new Rt("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(n.whenNotEditable&&e.editable||r.button!==0)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(d=>d.nodeName==="A"))return!1;const l=uS(e.state,n.type.name),c=r.target,u=(s=c==null?void 0:c.href)!==null&&s!==void 0?s:l.href,f=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:l.target;return c&&u?(window.open(u,f),!0):!1}}})}function aK(n){return new At({key:new Rt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:i}=s,{empty:o}=i;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=qM(a).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}const lK=Zn.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){QM(n);return}QM(n.scheme,n.optionalSlashes)})},onDestroy(){nK()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",nt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vo({find:n=>{const e=[];if(n){const t=qM(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(iK({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(oK({type:this.type,whenNotEditable:this.options.openOnClick==="whenNotEditable"})),this.options.linkOnPaste&&n.push(aK({editor:this.editor,type:this.type})),n}}),cK=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new At({key:new Rt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=e,i=[];if(!r)return null;const{firstChild:o}=n.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return n.descendants((f,d)=>{const h=s>=d&&s<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const y=en.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});i.push(y)}return this.options.includeChildren}),vt.create(n,i)}}})]}}),uK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,fK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,dK=Zn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Pa({find:uK,type:this.type})]},addPasteRules(){return[vo({find:fK,type:this.type})]}}),hK=xt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",nt(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),pK=/^\s*(\[([( |x])?\])\s$/,mK=xt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",nt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const d=t(),h=f.doc.nodeAt(d);return f.setNodeMarkup(d,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{s.setAttribute(c,u)}),s.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,o),s.append(i,l),Object.entries(e).forEach(([c,u])=>{s.setAttribute(c,u)}),{dom:s,contentDOM:l,update:c=>c.type!==this.type?!1:(s.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[gc({find:pK,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),gK=Zn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function yK(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=n,a=iV(t),l=new RegExp(`\\s${a}$`),c=i?"^":"",u=r?new RegExp(`${c}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(u)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const y=d+h.index;let b=y+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:h[0].slice(t.length),text:h[0]}:null}const bK=new Rt("suggestion");function wK({pluginKey:n=bK,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:c=()=>[],render:u=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=yK}){let h;const p=u==null?void 0:u(),m=new At({key:n,view(){return{update:async(y,b)=>{var v,A,w,x,C,S,M;const O=(v=this.key)===null||v===void 0?void 0:v.getState(b),R=(A=this.key)===null||A===void 0?void 0:A.getState(y.state),D=O.active&&R.active&&O.range.from!==R.range.from,_=!O.active&&R.active,U=O.active&&!R.active,K=!_&&!U&&O.query!==R.query,B=_||D,$=K&&!D,q=U||D;if(!B&&!$&&!q)return;const ne=q&&!B?O:R,Z=y.dom.querySelector(`[data-decoration-id="${ne.decorationId}"]`);h={editor:e,range:ne.range,query:ne.query,text:ne.text,items:[],command:me=>l({editor:e,range:ne.range,props:me}),decorationNode:Z,clientRect:Z?()=>{var me;const{decorationId:Ce}=(me=this.key)===null||me===void 0?void 0:me.getState(e.state),De=y.dom.querySelector(`[data-decoration-id="${Ce}"]`);return(De==null?void 0:De.getBoundingClientRect())||null}:null},B&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),$&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),($||B)&&(h.items=await c({editor:e,query:ne.query})),q&&((C=p==null?void 0:p.onExit)===null||C===void 0||C.call(p,h)),$&&((S=p==null?void 0:p.onUpdate)===null||S===void 0||S.call(p,h)),B&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,h))},destroy:()=>{var y;h&&((y=p==null?void 0:p.onExit)===null||y===void 0||y.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:C}=y,{empty:S,from:M}=C,O={...b};if(O.composing=x,w&&(S||e.view.composing)){(M<b.range.from||M>b.range.to)&&!x&&!b.composing&&(O.active=!1);const R=d({char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;R&&f({editor:e,state:A,range:R.range})?(O.active=!0,O.decorationId=b.decorationId?b.decorationId:D,O.range=R.range,O.query=R.query,O.text=R.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(y,b){var v;const{active:A,range:w}=m.getState(y.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:y,event:b,range:w}))||!1},decorations(y){const{active:b,range:v,decorationId:A}=m.getState(y);return b?vt.create(y.doc,[en.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var AK=typeof Yn=="object"&&Yn&&Yn.Object===Object&&Yn,vK=typeof self=="object"&&self&&self.Object===Object&&self;AK||vK||Function("return this")();var xK=typeof window<"u"?P.useLayoutEffect:P.useEffect,EK=typeof window>"u";function YM(n,{defaultValue:e=!1,initializeWithValue:t=!0}={}){const r=a=>EK?e:window.matchMedia(a).matches,[s,i]=P.useState(()=>t?r(n):e);function o(){i(r(n))}return xK(()=>{const a=window.matchMedia(n);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[n]),s}const CK=Ot.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[wK({editor:this.editor,...this.options.suggestion})]}}),kK=({query:n})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:k.jsx(gT,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:k.jsx(mT,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:k.jsx(zp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:k.jsx($p,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:k.jsx(Gp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:k.jsx(Wp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:k.jsx(Ec,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:k.jsx(l8,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:k.jsx(Kp,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:k.jsx(cd,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:k.jsx(ow,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:k.jsx(o8,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const r=document.createElement("input");r.type="file",r.accept="image/*",r.onchange=async()=>{var s;if((s=r.files)!=null&&s.length){const i=r.files[0],o=e.view.state.selection.from;uw(i,e.view,o)}},r.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:k.jsx(bT,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:k.jsx(yT,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:k.jsx(dT,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(2).focus(e.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:k.jsx(n8,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(3).focus(e.state.selection.head-1).run()}}].filter(e=>{if(typeof n=="string"&&n.length>0){const t=n.toLowerCase();return e.title.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.searchTerms&&e.searchTerms.some(r=>r.includes(t))}return!0}),SK=(n,e)=>{const t=n.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<n.scrollTop?n.scrollTop-=n.scrollTop-s+5:i>t+n.scrollTop&&(n.scrollTop+=i-t-n.scrollTop+5)},TK=({items:n,command:e,editor:t})=>{const[r,s]=P.useState(0),[i,o]=P.useState(n),a=YM("(max-width: 640px)"),l=P.useCallback(u=>{const f=i[u];f&&(f.title==="Continue writing"||e(f))},[e,t,i]);P.useEffect(()=>{if(a){const u=i.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(u)}else o(n)},[n,a]),P.useEffect(()=>{const u=["ArrowUp","ArrowDown","Enter"],f=d=>{if(u.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),P.useEffect(()=>{s(0)},[i]);const c=P.useRef(null);return P.useLayoutEffect(()=>{const u=c==null?void 0:c.current,f=u==null?void 0:u.children[r];f&&u&&SK(u,f)},[r]),i.length>0?k.jsx("div",{id:"slash-command",ref:c,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((u,f)=>k.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:u.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:u.title}),k.jsx("p",{className:"text-xs text-neutral-500",children:u.description})]})]},f))}):null},OK=()=>{let n=null,e=null;return{onStart:t=>{n=new lT(TK,{props:t,editor:t.editor}),e=Ba("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:t=>{n==null||n.updateProps(t),e&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown:t=>{var r;return t.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=n==null?void 0:n.ref)==null?void 0:r.onKeyDown(t)},onExit:()=>{e==null||e[0].destroy(),n==null||n.destroy()}}},NK=CK.configure({suggestion:{items:kK,render:OK}}),MK=PM.extend({renderHTML(){return["div",nt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),RK=Ot.create({name:"columnExtension",addExtensions(){const n=[];return this.options.column!==!1&&n.push(nN),this.options.columns!==!1&&n.push(mm),n}}),PK=Ot.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:n,commands:e})=>{const{state:t}=n,{tr:r}=t,s=r.selection.$from.start(),i=r.selection.$to.end();return e.setTextSelection({from:s,to:i})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:n})=>{const{state:e}=n,{tr:t}=e,r=t.selection.from,s=t.selection.to,i=t.selection.$from.start(),o=t.selection.$to.end();return r>i||s<o?(n.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),DK=Ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),XM=[{tooltip:"Align left",action:n=>n({dataAlign:"start",dataFloat:null}),icon:"AlignLeft",isActive:n=>n.dataAlign==="start"},{tooltip:"Align center",action:n=>n({dataAlign:"center",dataFloat:null}),icon:"AlignCenter",isActive:n=>n.dataAlign==="center"},{tooltip:"Align right",action:n=>n({dataAlign:"end",dataFloat:null}),icon:"AlignRight",isActive:n=>n.dataAlign==="end"},{tooltip:"Delete",icon:"Trash2",delete:n=>n()}];let Kc;const ZM=({node:n,updateAttributes:e,deleteNode:t})=>{const r=gm(),[s,i]=P.useState(),[o,a]=P.useState(0),[l,c]=P.useState(0),[u,f]=P.useState({}),d=P.useRef(null),[h,p]=P.useState(!1),m=()=>{const U={};XM.forEach(({tooltip:K,isActive:B})=>{U[K]=!!(B!=null&&B(n.attrs))}),f(U)},y=()=>{const U=document.querySelector(".ProseMirror");if(U&&c(U==null?void 0:U.clientWidth),!!d.current){if(s==="video"){const K=d.current;K.addEventListener("loadeddata",function(){a(K.videoWidth/K.videoHeight),C("left",0)})}else if(s==="iframe"){const K=d.current;K.onload=()=>{a(K.offsetWidth/K.offsetHeight),C("left",0)}}else d.current.onload=()=>{a(d.current.naturalWidth/d.current.naturalHeight)};setTimeout(()=>m(),200)}},b=U=>{Kc=U};P.useEffect(()=>{y()},[]);const v=({width:U,height:K})=>U<200||K<200,A=U=>{setTimeout(()=>S(U))},w=U=>{Kc=U.clientX,setTimeout(()=>{document.addEventListener("mousemove",A),document.addEventListener("mouseup",x)}),p(!0)},x=()=>{Kc=-1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),p(!1)},C=(U,K)=>{var q,ne;if(!d.current){console.error("Media ref is undefined|null",{resizableImg:d.current});return}const B={width:(q=d.current)==null?void 0:q.width,height:(ne=d.current)==null?void 0:ne.height},$={width:-1,height:-1};U==="left"?$.width=B.width-Math.abs(K):(typeof B.width=="string"&&(B.width=Number(B.width)),$.width=B.width+Math.abs(K)),$.width>l&&($.width=l),s==="iframe"?$.height=$.width/(16/9):$.height=$.width/o,!v($)&&e($)},S=U=>{if(Kc===-1)return;const{clientX:K}=U,B=Kc-K;if(B===0)return;const $=B>0?"left":"right";setTimeout(()=>{C($,Math.abs(B)),Kc=K})},[M,O]=P.useState(),[R,D]=P.useState();P.useEffect(()=>{i(n.attrs["media-type"]),m(),O(n.attrs.dataFloat),D(n.attrs.dataAlign)},[n.attrs]);const _=U=>{switch(U){case"AlignLeft":return k.jsx(ad,{size:16});case"AlignCenter":return k.jsx(Xb,{size:16});case"AlignRight":return k.jsx(Zb,{size:16});case"Trash2":return k.jsx(aw,{size:16});default:return null}};return k.jsx(od,{as:"article",className:he("media-node-view not-prose transition-all ease-in-out w-full",M&&`f-${n.attrs.dataFloat}`,R&&`justify-${n.attrs.dataAlign}`),children:k.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[s==="img"&&k.jsx("img",{src:n.attrs.src,ref:d,className:"rounded-lg",alt:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),s==="video"&&k.jsx("video",{ref:d,className:"rounded-lg",controls:!0,width:n.attrs.width,height:n.attrs.height,children:k.jsx("source",{src:n.attrs.src})}),s==="iframe"&&k.jsx("iframe",{ref:d,className:he("rounded-lg max-w-full",h&&"pointer-events-none"),src:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),!r&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:U})=>b(U),onMouseDown:w,onMouseUp:x}),k.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex",children:XM.map((U,K)=>k.jsx("div",{className:"tooltip","data-tip":U.tooltip,children:k.jsx("button",{type:"button",className:he("btn rounded-none h-8 px-2 py-1 transition",u[U.tooltip]&&"active"),onClick:()=>{var B;return U.tooltip==="Delete"?t():(B=U.action)==null?void 0:B.call(U,e)},children:U.icon&&_(U.icon)})},K))})]})]})})},IK=xt.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return _a(ZM)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,dispatch:t})=>{const{selection:r}=e,s=this.type.create(n);return t&&e.replaceRangeWith(r.from-1,r.to,s),!0}}}});var LK="https://platform.twitter.com/widgets.js",Sv="createTweet",BK=function(e){var t=P.useRef(null),r=P.useState(!0),s=r[0],i=r[1];return P.useEffect(function(){var o=!0,a=require("scriptjs");return a(LK,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(o){if(!window.twttr.widgets[Sv]){console.error("Method "+Sv+" is not present anymore in twttr.widget api");return}window.twttr.widgets[Sv](e.tweetId,t==null?void 0:t.current,e.options).then(function(l){i(!1),e.onLoad&&e.onLoad(l)})}}),function(){o=!1}},[]),P.createElement(P.Fragment,null,s&&P.createElement(P.Fragment,null,e.placeholder),P.createElement("div",{ref:t}))};const _K=({node:n,editor:e})=>{const[t,r]=P.useState(!0);return P.useEffect(()=>{e==null||e.chain().focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:k.jsxs("div",{className:"w-full max-w-sm",children:[t&&k.jsx(hN,{width:5,height:5}),k.jsx(BK,{tweetId:n.attrs.tweetId,onLoad:()=>r(!1)})]})})},FK=xt.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(this.options.HTMLAttributes,n)]},addNodeView(){return _a(_K)},addCommands(){return{setTweetEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:n.tweetId,align:"center"},content:[]})}}}),jK=n=>new At({key:new Rt("media-paste-drop"),props:{handlePaste(e,t){var s;return Array.from(((s=t.clipboardData)==null?void 0:s.items)||[]).forEach(i=>{const o=i.getAsFile();if(((o==null?void 0:o.type.indexOf("image"))===0||(o==null?void 0:o.type.indexOf("video"))===0)&&(t.preventDefault(),o&&o.size>1024*1024))throw new Error("Image too large")}),!1},handleDrop(e,t){var a;if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const s=Array.from(((a=t.dataTransfer)==null?void 0:a.files)??[]).filter(({type:l})=>/image|video/i.test(l));if(s.length===0)return!1;t.preventDefault();const{schema:i}=e.state,o=e.posAtCoords({left:t.clientX,top:t.clientY});return o?(s.forEach(async l=>{const c=new FileReader;if(n){const u=i.nodes.resizableMedia.create({src:await n(l),"media-type":l.type.includes("image")?"img":"video"}),f=e.state.tr.insert(o.pos,u);e.dispatch(f)}else c.onload=u=>{var h;const f=i.nodes.resizableMedia.create({src:(h=u.target)==null?void 0:h.result,"media-type":l.type.includes("image")?"img":"video"}),d=e.state.tr.insert(o.pos,f);e.dispatch(d)},c.readAsDataURL(l)}),!0):!1}}}),UK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VK=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,HK=xt.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:n=>({src:n.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:n}){const{"media-type":e}=n;return e==="img"?["img",nt(this.options.HTMLAttributes,n)]:e==="video"?["video",{controls:"true",style:"width: 100%",...n},["source",n]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",nt(this.options.HTMLAttributes,n)])},addCommands(){return{setMedia:n=>({commands:e})=>{const{"media-type":t}=n;return t==="img"?e.insertContent({type:this.name,attrs:n}):t==="video"?e.insertContent({type:this.name,attrs:{...n,controls:"true"}}):(t||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:n}))}}},addNodeView(){return _a(ZM)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state;if(e.empty)return!1;const t=e.$to.pos;return n.commands.insertContentAt(t,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[Db({find:UK,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r,"media-type":"img"}}}),Db({find:VK,type:this.type,getAttributes:n=>{const[,,e]=n;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[jK(this.options.uploadFn),w8()]}});function Tv(n,e){let t;return(...s)=>{clearTimeout(t),t=setTimeout(()=>n(...s),e)}}const zK=["top","right","bottom","left"],Qs=Math.min,kr=Math.max,Lg=Math.round,Bg=Math.floor,Io=n=>({x:n,y:n}),$K={left:"right",right:"left",bottom:"top",top:"bottom"},GK={start:"end",end:"start"};function Ov(n,e,t){return kr(n,Qs(e,t))}function Ti(n,e){return typeof n=="function"?n(e):n}function Oi(n){return n.split("-")[0]}function Qc(n){return n.split("-")[1]}function Nv(n){return n==="x"?"y":"x"}function Mv(n){return n==="y"?"height":"width"}function Jc(n){return["top","bottom"].includes(Oi(n))?"y":"x"}function Rv(n){return Nv(Jc(n))}function WK(n,e,t){t===void 0&&(t=!1);const r=Qc(n),s=Rv(n),i=Mv(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=_g(o)),[o,_g(o)]}function KK(n){const e=_g(n);return[Pv(n),e,Pv(e)]}function Pv(n){return n.replace(/start|end/g,e=>GK[e])}function QK(n,e,t){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?i:o;default:return[]}}function JK(n,e,t,r){const s=Qc(n);let i=QK(Oi(n),t==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Pv)))),i}function _g(n){return n.replace(/left|right|bottom|top/g,e=>$K[e])}function qK(n){return{top:0,right:0,bottom:0,left:0,...n}}function eR(n){return typeof n!="number"?qK(n):{top:n,right:n,bottom:n,left:n}}function Fg(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function tR(n,e,t){let{reference:r,floating:s}=n;const i=Jc(e),o=Rv(e),a=Mv(o),l=Oi(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Qc(e)){case"start":h[o]-=d*(t&&c?-1:1);break;case"end":h[o]+=d*(t&&c?-1:1);break}return h}const YK=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=t,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:u,y:f}=tR(c,r,l),d=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:y,fn:b}=a[m],{x:v,y:A,data:w,reset:x}=await b({x:u,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});u=v??u,f=A??f,h={...h,[y]:{...h[y],...w}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(d=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):x.rects),{x:u,y:f}=tR(c,d,l)),m=-1)}return{x:u,y:f,placement:d,strategy:s,middlewareData:h}};async function Kd(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Ti(e,n),p=eR(h),y=a[d?f==="floating"?"reference":"floating":f],b=Fg(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},x=Fg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:A,strategy:l}):v);return{top:(b.top-x.top+p.top)/w.y,bottom:(x.bottom-b.bottom+p.bottom)/w.y,left:(b.left-x.left+p.left)/w.x,right:(x.right-b.right+p.right)/w.x}}const XK=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ti(n,e)||{};if(c==null)return{};const f=eR(u),d={x:t,y:r},h=Rv(s),p=Mv(h),m=await o.getDimensions(c),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",A=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],x=d[h]-i.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=C?C[A]:0;(!S||!await(o.isElement==null?void 0:o.isElement(C)))&&(S=a.floating[A]||i.floating[p]);const M=w/2-x/2,O=S/2-m[p]/2-1,R=Qs(f[b],O),D=Qs(f[v],O),_=R,U=S-m[p]-D,K=S/2-m[p]/2+M,B=Ov(_,K,U),$=!l.arrow&&Qc(s)!=null&&K!==B&&i.reference[p]/2-(K<_?R:D)-m[p]/2<0,q=$?K<_?K-_:K-U:0;return{[h]:d[h]+q,data:{[h]:B,centerOffset:K-B-q,...$&&{alignmentOffset:q}},reset:$}}}),ZK=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Ti(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Oi(s),v=Oi(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=d||(v||!m?[_g(a)]:KK(a));!d&&p!=="none"&&w.push(...JK(a,m,p,A));const x=[a,...w],C=await Kd(e,y),S=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&S.push(C[b]),f){const _=WK(s,o,A);S.push(C[_[0]],C[_[1]])}if(M=[...M,{placement:s,overflows:S}],!S.every(_=>_<=0)){var O,R;const _=(((O=i.flip)==null?void 0:O.index)||0)+1,U=x[_];if(U)return{data:{index:_,overflows:M},reset:{placement:U}};let K=(R=M.filter(B=>B.overflows[0]<=0).sort((B,$)=>B.overflows[1]-$.overflows[1])[0])==null?void 0:R.placement;if(!K)switch(h){case"bestFit":{var D;const B=(D=M.map($=>[$.placement,$.overflows.filter(q=>q>0).reduce((q,ne)=>q+ne,0)]).sort(($,q)=>$[1]-q[1])[0])==null?void 0:D[0];B&&(K=B);break}case"initialPlacement":K=a;break}if(s!==K)return{reset:{placement:K}}}return{}}}};function nR(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function rR(n){return zK.some(e=>n[e]>=0)}const eQ=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...s}=Ti(n,e);switch(r){case"referenceHidden":{const i=await Kd(e,{...s,elementContext:"reference"}),o=nR(i,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:rR(o)}}}case"escaped":{const i=await Kd(e,{...s,altBoundary:!0}),o=nR(i,t.floating);return{data:{escapedOffsets:o,escaped:rR(o)}}}default:return{}}}}};async function tQ(n,e){const{placement:t,platform:r,elements:s}=n,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Oi(t),a=Qc(t),l=Jc(t)==="y",c=["left","top"].includes(o)?-1:1,u=i&&l?-1:1,f=Ti(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:d*c}:{x:d*c,y:h*u}}const nQ=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await tQ(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},rQ=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...l}=Ti(n,e),c={x:t,y:r},u=await Kd(e,l),f=Jc(Oi(s)),d=Nv(f);let h=c[d],p=c[f];if(i){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=h+u[y],A=h-u[b];h=Ov(v,h,A)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=p+u[y],A=p-u[b];p=Ov(v,p,A)}const m=a.fn({...e,[d]:h,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r}}}}},sQ=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ti(n,e),u={x:t,y:r},f=Jc(s),d=Nv(f);let h=u[d],p=u[f];const m=Ti(a,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const A=d==="y"?"height":"width",w=i.reference[d]-i.floating[A]+y.mainAxis,x=i.reference[d]+i.reference[A]-y.mainAxis;h<w?h=w:h>x&&(h=x)}if(c){var b,v;const A=d==="y"?"width":"height",w=["top","left"].includes(Oi(s)),x=i.reference[f]-i.floating[A]+(w&&((b=o.offset)==null?void 0:b[f])||0)+(w?0:y.crossAxis),C=i.reference[f]+i.reference[A]+(w?0:((v=o.offset)==null?void 0:v[f])||0)-(w?y.crossAxis:0);p<x?p=x:p>C&&(p=C)}return{[d]:h,[f]:p}}}},iQ=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=Ti(n,e),l=await Kd(e,a),c=Oi(t),u=Qc(t),f=Jc(t)==="y",{width:d,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const y=h-l.top-l.bottom,b=d-l.left-l.right,v=Qs(h-l[p],y),A=Qs(d-l[m],b),w=!e.middlewareData.shift;let x=v,C=A;if(f?C=u||w?Qs(A,b):b:x=u||w?Qs(v,y):y,w&&!u){const M=kr(l.left,0),O=kr(l.right,0),R=kr(l.top,0),D=kr(l.bottom,0);f?C=d-2*(M!==0||O!==0?M+O:kr(l.left,l.right)):x=h-2*(R!==0||D!==0?R+D:kr(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:x});const S=await s.getDimensions(i.floating);return d!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}};function qc(n){return sR(n)?(n.nodeName||"").toLowerCase():"#document"}function Sr(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Ni(n){var e;return(e=(sR(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function sR(n){return n instanceof Node||n instanceof Sr(n).Node}function Js(n){return n instanceof Element||n instanceof Sr(n).Element}function qs(n){return n instanceof HTMLElement||n instanceof Sr(n).HTMLElement}function iR(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Sr(n).ShadowRoot}function Qd(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=ms(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function oQ(n){return["table","td","th"].includes(qc(n))}function Dv(n){const e=Iv(),t=ms(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function aQ(n){let e=Lo(n);for(;qs(e)&&!Yc(e);){if(Dv(e))return e;e=Lo(e)}return null}function Iv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yc(n){return["html","body","#document"].includes(qc(n))}function ms(n){return Sr(n).getComputedStyle(n)}function jg(n){return Js(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Lo(n){if(qc(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iR(n)&&n.host||Ni(n);return iR(e)?e.host:e}function oR(n){const e=Lo(n);return Yc(e)?n.ownerDocument?n.ownerDocument.body:n.body:qs(e)&&Qd(e)?e:oR(e)}function Jd(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=oR(n),i=s===((r=n.ownerDocument)==null?void 0:r.body),o=Sr(s);return i?e.concat(o,o.visualViewport||[],Qd(s)?s:[],o.frameElement&&t?Jd(o.frameElement):[]):e.concat(s,Jd(s,[],t))}function aR(n){const e=ms(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=qs(n),i=s?n.offsetWidth:t,o=s?n.offsetHeight:r,a=Lg(t)!==i||Lg(r)!==o;return a&&(t=i,r=o),{width:t,height:r,$:a}}function Lv(n){return Js(n)?n:n.contextElement}function Xc(n){const e=Lv(n);if(!qs(e))return Io(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:i}=aR(e);let o=(i?Lg(t.width):t.width)/r,a=(i?Lg(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const lQ=Io(0);function lR(n){const e=Sr(n);return!Iv()||!e.visualViewport?lQ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function cQ(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Sr(n)?!1:e}function nl(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),i=Lv(n);let o=Io(1);e&&(r?Js(r)&&(o=Xc(r)):o=Xc(n));const a=cQ(i,t,r)?lR(i):Io(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=Sr(i),h=r&&Js(r)?Sr(r):r;let p=d,m=p.frameElement;for(;m&&r&&h!==p;){const y=Xc(m),b=m.getBoundingClientRect(),v=ms(m),A=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=A,c+=w,p=Sr(m),m=p.frameElement}}return Fg({width:u,height:f,x:l,y:c})}const uQ=[":popover-open",":modal"];function Bv(n){return uQ.some(e=>{try{return n.matches(e)}catch{return!1}})}function fQ(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const i=s==="fixed",o=Ni(r),a=e?Bv(e.floating):!1;if(r===o||a&&i)return t;let l={scrollLeft:0,scrollTop:0},c=Io(1);const u=Io(0),f=qs(r);if((f||!f&&!i)&&((qc(r)!=="body"||Qd(o))&&(l=jg(r)),qs(r))){const d=nl(r);c=Xc(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function dQ(n){return Array.from(n.getClientRects())}function cR(n){return nl(Ni(n)).left+jg(n).scrollLeft}function hQ(n){const e=Ni(n),t=jg(n),r=n.ownerDocument.body,s=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+cR(n);const a=-t.scrollTop;return ms(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}function pQ(n,e){const t=Sr(n),r=Ni(n),s=t.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const c=Iv();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:i,height:o,x:a,y:l}}function mQ(n,e){const t=nl(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,i=qs(n)?Xc(n):Io(1),o=n.clientWidth*i.x,a=n.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function uR(n,e,t){let r;if(e==="viewport")r=pQ(n,t);else if(e==="document")r=hQ(Ni(n));else if(Js(e))r=mQ(e,t);else{const s=lR(n);r={...e,x:e.x-s.x,y:e.y-s.y}}return Fg(r)}function fR(n,e){const t=Lo(n);return t===e||!Js(t)||Yc(t)?!1:ms(t).position==="fixed"||fR(t,e)}function gQ(n,e){const t=e.get(n);if(t)return t;let r=Jd(n,[],!1).filter(a=>Js(a)&&qc(a)!=="body"),s=null;const i=ms(n).position==="fixed";let o=i?Lo(n):n;for(;Js(o)&&!Yc(o);){const a=ms(o),l=Dv(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Qd(o)&&!l&&fR(n,o))?r=r.filter(u=>u!==o):s=a,o=Lo(o)}return e.set(n,r),r}function yQ(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const o=[...t==="clippingAncestors"?Bv(e)?[]:gQ(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{const f=uR(e,u,s);return c.top=kr(f.top,c.top),c.right=Qs(f.right,c.right),c.bottom=Qs(f.bottom,c.bottom),c.left=kr(f.left,c.left),c},uR(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bQ(n){const{width:e,height:t}=aR(n);return{width:e,height:t}}function wQ(n,e,t){const r=qs(e),s=Ni(e),i=t==="fixed",o=nl(n,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Io(0);if(r||!r&&!i)if((qc(e)!=="body"||Qd(s))&&(a=jg(e)),r){const f=nl(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&(l.x=cR(s));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function _v(n){return ms(n).position==="static"}function dR(n,e){return!qs(n)||ms(n).position==="fixed"?null:e?e(n):n.offsetParent}function hR(n,e){const t=Sr(n);if(Bv(n))return t;if(!qs(n)){let s=Lo(n);for(;s&&!Yc(s);){if(Js(s)&&!_v(s))return s;s=Lo(s)}return t}let r=dR(n,e);for(;r&&oQ(r)&&_v(r);)r=dR(r,e);return r&&Yc(r)&&_v(r)&&!Dv(r)?t:r||aQ(n)||t}const AQ=async function(n){const e=this.getOffsetParent||hR,t=this.getDimensions,r=await t(n.floating);return{reference:wQ(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vQ(n){return ms(n).direction==="rtl"}const xQ={convertOffsetParentRelativeRectToViewportRelativeRect:fQ,getDocumentElement:Ni,getClippingRect:yQ,getOffsetParent:hR,getElementRects:AQ,getClientRects:dQ,getDimensions:bQ,getScale:Xc,isElement:Js,isRTL:vQ};function EQ(n,e){let t=null,r;const s=Ni(n);function i(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:d}=n.getBoundingClientRect();if(a||e(),!f||!d)return;const h=Bg(u),p=Bg(s.clientWidth-(c+f)),m=Bg(s.clientHeight-(u+d)),y=Bg(c),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-y+"px",threshold:kr(0,Qs(1,l))||1};let A=!0;function w(x){const C=x[0].intersectionRatio;if(C!==l){if(!A)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A=!1}try{t=new IntersectionObserver(w,{...v,root:s.ownerDocument})}catch{t=new IntersectionObserver(w,v)}t.observe(n)}return o(!0),i}function CQ(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Lv(n),u=s||i?[...c?Jd(c):[],...Jd(e)]:[];u.forEach(b=>{s&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=c&&a?EQ(c,t):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?nl(n):null;l&&y();function y(){const b=nl(n);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&t(),m=b,p=requestAnimationFrame(y)}return t(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const kQ=nQ,SQ=rQ,TQ=ZK,OQ=iQ,NQ=eQ,pR=XK,MQ=sQ,RQ=(n,e,t)=>{const r=new Map,s={platform:xQ,...t},i={...s.platform,_c:r};return YK(n,e,{...s,platform:i})};var Ug=typeof document<"u"?P.useLayoutEffect:P.useEffect;function Vg(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Vg(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&n.$$typeof)&&!Vg(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function mR(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function gR(n,e){const t=mR(n);return Math.round(e*t)/t}function yR(n){const e=V.useRef(n);return Ug(()=>{e.current=n}),e}function PQ(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,f]=V.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=V.useState(r);Vg(d,r)||h(r);const[p,m]=V.useState(null),[y,b]=V.useState(null),v=V.useCallback(q=>{q!==C.current&&(C.current=q,m(q))},[]),A=V.useCallback(q=>{q!==S.current&&(S.current=q,b(q))},[]),w=i||p,x=o||y,C=V.useRef(null),S=V.useRef(null),M=V.useRef(u),O=l!=null,R=yR(l),D=yR(s),_=V.useCallback(()=>{if(!C.current||!S.current)return;const q={placement:e,strategy:t,middleware:d};D.current&&(q.platform=D.current),RQ(C.current,S.current,q).then(ne=>{const Z={...ne,isPositioned:!0};U.current&&!Vg(M.current,Z)&&(M.current=Z,C0.flushSync(()=>{f(Z)}))})},[d,e,t,D]);Ug(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[c]);const U=V.useRef(!1);Ug(()=>(U.current=!0,()=>{U.current=!1}),[]),Ug(()=>{if(w&&(C.current=w),x&&(S.current=x),w&&x){if(R.current)return R.current(w,x,_);_()}},[w,x,_,R,O]);const K=V.useMemo(()=>({reference:C,floating:S,setReference:v,setFloating:A}),[v,A]),B=V.useMemo(()=>({reference:w,floating:x}),[w,x]),$=V.useMemo(()=>{const q={position:t,left:0,top:0};if(!B.floating)return q;const ne=gR(B.floating,u.x),Z=gR(B.floating,u.y);return a?{...q,transform:"translate("+ne+"px, "+Z+"px)",...mR(B.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ne,top:Z}},[t,a,B.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:_,refs:K,elements:B,floatingStyles:$}),[u,_,K,B,$])}const DQ=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?pR({element:r.current,padding:s}).fn(t):{}:r?pR({element:r,padding:s}).fn(t):{}}}},IQ=(n,e)=>({...kQ(n),options:[n,e]}),LQ=(n,e)=>({...SQ(n),options:[n,e]}),BQ=(n,e)=>({...MQ(n),options:[n,e]}),_Q=(n,e)=>({...TQ(n),options:[n,e]}),FQ=(n,e)=>({...OQ(n),options:[n,e]}),jQ=(n,e)=>({...NQ(n),options:[n,e]}),UQ=(n,e)=>({...DQ(n),options:[n,e]});var VQ="Arrow",bR=V.forwardRef((n,e)=>{const{children:t,width:r=10,height:s=5,...i}=n;return k.jsx(nr.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:k.jsx("polygon",{points:"0,0 30,0 15,10"})})});bR.displayName=VQ;var HQ=bR;function zQ(n){const[e,t]=V.useState(void 0);return Fa(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var Fv="Popper",[wR,AR]=fw(Fv),[$Q,vR]=wR(Fv),xR=n=>{const{__scopePopper:e,children:t}=n,[r,s]=V.useState(null);return k.jsx($Q,{scope:e,anchor:r,onAnchorChange:s,children:t})};xR.displayName=Fv;var ER="PopperAnchor",CR=V.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...s}=n,i=vR(ER,t),o=V.useRef(null),a=jr(e,o);return V.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:k.jsx(nr.div,{...s,ref:a})});CR.displayName=ER;var jv="PopperContent",[GQ,WQ]=wR(jv),kR=V.forwardRef((n,e)=>{var He,Be,et,le,ze,ae;const{__scopePopper:t,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=n,y=vR(jv,t),[b,v]=V.useState(null),A=jr(e,be=>v(be)),[w,x]=V.useState(null),C=zQ(w),S=(C==null?void 0:C.width)??0,M=(C==null?void 0:C.height)??0,O=r+(i!=="center"?"-"+i:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],_=D.length>0,U={padding:R,boundary:D.filter(QQ),altBoundary:_},{refs:K,floatingStyles:B,placement:$,isPositioned:q,middlewareData:ne}=PQ({strategy:"fixed",placement:O,whileElementsMounted:(...be)=>CQ(...be,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[IQ({mainAxis:s+M,alignmentAxis:o}),l&&LQ({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?BQ():void 0,...U}),l&&_Q({...U}),FQ({...U,apply:({elements:be,rects:_e,availableWidth:H,availableHeight:Q})=>{const{width:re,height:ce}=_e.reference,I=be.floating.style;I.setProperty("--radix-popper-available-width",`${H}px`),I.setProperty("--radix-popper-available-height",`${Q}px`),I.setProperty("--radix-popper-anchor-width",`${re}px`),I.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),w&&UQ({element:w,padding:a}),JQ({arrowWidth:S,arrowHeight:M}),d&&jQ({strategy:"referenceHidden",...U})]}),[Z,me]=OR($),Ce=Eo(p);Fa(()=>{q&&(Ce==null||Ce())},[q,Ce]);const De=(He=ne.arrow)==null?void 0:He.x,ke=(Be=ne.arrow)==null?void 0:Be.y,Ee=((et=ne.arrow)==null?void 0:et.centerOffset)!==0,[Ve,je]=V.useState();return Fa(()=>{b&&je(window.getComputedStyle(b).zIndex)},[b]),k.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ve,"--radix-popper-transform-origin":[(le=ne.transformOrigin)==null?void 0:le.x,(ze=ne.transformOrigin)==null?void 0:ze.y].join(" "),...((ae=ne.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:k.jsx(GQ,{scope:t,placedSide:Z,onArrowChange:x,arrowX:De,arrowY:ke,shouldHideArrow:Ee,children:k.jsx(nr.div,{"data-side":Z,"data-align":me,...m,ref:A,style:{...m.style,animation:q?void 0:"none"}})})})});kR.displayName=jv;var SR="PopperArrow",KQ={top:"bottom",right:"left",bottom:"top",left:"right"},TR=V.forwardRef(function(e,t){const{__scopePopper:r,...s}=e,i=WQ(SR,r),o=KQ[i.placedSide];return k.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:k.jsx(HQ,{...s,ref:t,style:{...s.style,display:"block"}})})});TR.displayName=SR;function QQ(n){return n!==null}var JQ=n=>({name:"transformOrigin",options:n,fn(e){var y,b,v;const{placement:t,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=OR(t),f={start:"0%",center:"50%",end:"100%"}[u],d=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return c==="bottom"?(p=o?f:`${d}px`,m=`${-l}px`):c==="top"?(p=o?f:`${d}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=o?f:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=o?f:`${h}px`),{data:{x:p,y:m}}}});function OR(n){const[e,t="center"]=n.split("-");return[e,t]}var qQ=xR,NR=CR,YQ=kR,XQ=TR,Uv="Popover",[MR,Iie]=fw(Uv,[AR]),qd=AR(),[ZQ,rl]=MR(Uv),RR=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=qd(e),l=V.useRef(null),[c,u]=V.useState(!1),[f=!1,d]=AT({prop:r,defaultProp:s,onChange:i});return k.jsx(qQ,{...a,children:k.jsx(ZQ,{scope:e,contentId:Jp(),triggerRef:l,open:f,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:c,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:t})})};RR.displayName=Uv;var PR="PopoverAnchor",e7=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(PR,t),i=qd(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return V.useEffect(()=>(o(),()=>a()),[o,a]),k.jsx(NR,{...i,...r,ref:e})});e7.displayName=PR;var DR="PopoverTrigger",IR=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(DR,t),i=qd(t),o=jr(e,s.triggerRef),a=k.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":jR(s.open),...r,ref:o,onClick:Ar(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:k.jsx(NR,{asChild:!0,...i,children:a})});IR.displayName=DR;var t7="PopoverPortal",[Lie,n7]=MR(t7,{forceMount:void 0}),Zc="PopoverContent",LR=V.forwardRef((n,e)=>{const t=n7(Zc,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=rl(Zc,n.__scopePopover);return k.jsx(fd,{present:r||i.open,children:i.modal?k.jsx(r7,{...s,ref:e}):k.jsx(s7,{...s,ref:e})})});LR.displayName=Zc;var r7=V.forwardRef((n,e)=>{const t=rl(Zc,n.__scopePopover),r=V.useRef(null),s=jr(e,r),i=V.useRef(!1);return V.useEffect(()=>{const o=r.current;if(o)return WT(o)},[]),k.jsx(xw,{as:qp,allowPinchZoom:!0,children:k.jsx(BR,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ar(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ar(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ar(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),s7=V.forwardRef((n,e)=>{const t=rl(Zc,n.__scopePopover),r=V.useRef(!1),s=V.useRef(!1);return k.jsx(BR,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BR=V.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=n,d=rl(Zc,t),h=qd(t);return RT(),k.jsx(ud,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:k.jsx(pw,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>d.onOpenChange(!1),children:k.jsx(YQ,{"data-state":jR(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_R="PopoverClose",FR=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(_R,t);return k.jsx(nr.button,{type:"button",...r,ref:e,onClick:Ar(n.onClick,()=>s.onOpenChange(!1))})});FR.displayName=_R;var i7="PopoverArrow",o7=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=qd(t);return k.jsx(XQ,{...s,...r,ref:e})});o7.displayName=i7;function jR(n){return n?"open":"closed"}var a7=RR,l7=IR,c7=LR,Hg=FR;const zg=({children:n,isActive:e,onClick:t,disabled:r,className:s})=>{const i=he("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",s);return k.jsx("button",{className:i,disabled:r,onClick:t,children:n})},u7=(n,e,t)=>{const r=P.useCallback(()=>{const a=n.chain();a.setNodeSelection(t).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&a.setParagraph(),a.run()},[n,t,e==null?void 0:e.type.name]),s=P.useCallback(()=>{n.commands.setNodeSelection(t);const{$anchor:a}=n.state.selection,l=a.node(1)||n.state.selection.node;n.chain().setMeta("hideDragHandle",!0).insertContentAt(t+((e==null?void 0:e.nodeSize)||0),l.toJSON()).run()},[n,t,e==null?void 0:e.nodeSize]),i=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).run(),document.execCommand("copy"),alert("copied")},[n,t]),o=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).deleteSelection().run()},[n,t]);return{resetTextFormatting:r,duplicateNode:s,copyNodeToClipboard:i,deleteNode:o}},f7=({node:n,getPos:e,editor:t,deleteNode:r})=>{const[s,i]=P.useState(!1),o=u7(t,n,e()),a=gm(),l=["https://twitter.com","https://x.com"],c=P.useMemo(()=>{const{content:O}=n.content;return O[0].type.name==="table"},[n.content]),u=P.useMemo(()=>{var R;const{content:O}=n.content;return(R=O[0].content.content[0])==null?void 0:R.text},[n.content]),f=P.useMemo(()=>{var R;const{content:O}=n.content;return(R=O[0].content.content[1])==null?void 0:R.text},[n.content]),d=P.useMemo(()=>{const{content:O}=n.content;return O[0].content.content.find(R=>{var D;return(D=R==null?void 0:R.text)==null?void 0:D.match(/\/status\/([0-9]*)/)})},[n.content]),h=()=>{if(!u)return;let O=u;if(u.includes("<iframe"))O=f;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(u):{const K=u.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);K&&K.length>0&&(O=`https://www.youtube.com/embed/${K[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(u):{const K=u.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);K&&K.length>0&&(O=`https://player.vimeo.com/video/${K[1]}`);break}default:return}const R=640,D=360,_=e(),U=_+n.nodeSize;O&&(t==null||t.chain().focus(_).deleteRange({from:_===0?_:_+1,to:U}).setIframe({src:O,width:R,height:D}).run())},p=O=>{const R=O.match(/\/status\/([0-9]*)/);return R&&R.length>0?R[1]:null},m=()=>{if(!u)return;let O=u;const R=l.some(K=>u.includes(K)),D=p(u);R&&D?O=D:d&&(O=p(d.text));const _=e(),U=_+n.nodeSize;O&&(t==null||t.chain().focus(_).deleteRange({from:_===2?_:_+1,to:U}).setTweetEmbed({tweetId:O}).run())},y=()=>{const O=e()+n.nodeSize;t.commands.insertContentAt(O,{type:"dBlock",content:[{type:"paragraph"}]})},b=()=>{const O=e();t.commands.insertContentAt(O,{type:"dBlock",content:[{type:"paragraph"}]})},v=()=>{r()},A=O=>{O.altKey?x():w()},w=()=>{y()},x=()=>{b()},C=O=>{O.altKey&&v()},M=Tv(()=>{if(l.some(O=>u.includes(O))||d!=null&&d.text){m();return}else{h();return}},1e3);return P.useEffect(()=>{u&&M()},[u]),k.jsxs(od,{as:"div",className:he("flex gap-2 group w-full relative justify-center items-start",a&&"pointer-events-none",c&&"2xl:ml-4 pointer-events-auto"),children:[k.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[k.jsx(lN,{content:k.jsxs("div",{className:"flex flex-col w-40",children:[k.jsx("div",{className:"text-xs",children:"Click to add below"}),k.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:A,children:k.jsx(f8,{size:18})})}),k.jsxs(a7,{open:s,onOpenChange:i,children:[k.jsx(l7,{asChild:!0,children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:C,children:k.jsx(i8,{size:18})})}),k.jsx(c7,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:k.jsxs(Jw,{className:"p-2 flex flex-col min-w-[16rem]",children:[k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.resetTextFormatting,children:[k.jsx(d8,{size:18}),"Clear formatting"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.copyNodeToClipboard,children:[k.jsx(t8,{size:18}),"Copy to clipboard"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.duplicateNode,children:[k.jsx(r8,{size:18}),"Duplicate"]})}),k.jsx(Nc.Divider,{horizontal:!0}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[k.jsx(aw,{size:18}),"Delete"]})})]})})]})]}),k.jsx(aT,{className:he("node-view-content w-full break-all",{"is-table min-w-auto":c})})]})},d7=xt.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:n=>({state:e,chain:t})=>{const{selection:{from:r}}=e,s=n!==void 0||n!==null?r:n;return t().insertContentAt(s,{type:this.name,content:[{type:"paragraph"}]}).focus(s+2).run()}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:n})=>{var c;const{selection:{$head:e,from:t,to:r},doc:s}=n.state,i=e.node(e.depth-1);if((i==null?void 0:i.type.name)!=="dBlock"){const f=e.toString().split("/"),d=f.some(p=>p.includes("taskList")),h=f.some(p=>p.includes("bulletList")||p.includes("orderedList"));return d?n.chain().insertContent({type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph"}]}).focus().run():h?n.chain().insertContent({type:"listItem",content:[{type:"paragraph"}]}).focus().run():!1}let o=-1,a="";s.descendants((u,f)=>{if(o!==-1)return!1;if(u.type.name===this.name)return;const[d,h]=[f,f+u.nodeSize];return d<=t&&r<=h&&(o=h,a=u.type.name),!1});const l=(c=s.slice(t,o))==null?void 0:c.toJSON().content;try{return a==="codeBlock"?n.chain().newlineInCode().focus().run():["columns","heading"].includes(a)?n.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():n.chain().insertContentAt({from:t,to:o},{type:this.name,content:l}).focus(t+4).run()}catch(u){return console.error(`Error inserting content into dBlock node: ${u}`),!1}}}},addNodeView(){return _a(f7)}});let Vv,Hv;if(typeof WeakMap<"u"){let n=new WeakMap;Vv=e=>n.get(e),Hv=(e,t)=>(n.set(e,t),t)}else{let n=[],e=10,t=0;Vv=r=>{for(let s=0;s<n.length;s+=2)if(n[s]==r)return n[s+1]},Hv=(r,s)=>(t==e&&(t=0),n[t++]=r,n[t++]=s)}class eu{constructor(e,t,r,s){this.left=e,this.top=t,this.right=r,this.bottom=s}}class Ut{constructor(e,t,r,s){this.width=e,this.height=t,this.map=r,this.problems=s}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let s=t%this.width,i=t/this.width|0,o=s+1,a=i+1;for(let l=1;o<this.width&&this.map[t+l]==r;l++)o++;for(let l=1;a<this.height&&this.map[t+this.width*l]==r;l++)a++;return new eu(s,i,o,a)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,t,r){let{left:s,right:i,top:o,bottom:a}=this.findCell(e);return t=="horiz"?(r<0?s==0:i==this.width)?null:this.map[o*this.width+(r<0?s-1:i)]:(r<0?o==0:a==this.height)?null:this.map[s+this.width*(r<0?o-1:a)]}rectBetween(e,t){let{left:r,right:s,top:i,bottom:o}=this.findCell(e),{left:a,right:l,top:c,bottom:u}=this.findCell(t);return new eu(Math.min(r,a),Math.min(i,c),Math.max(s,l),Math.max(o,u))}cellsInRect(e){let t=[],r={};for(let s=e.top;s<e.bottom;s++)for(let i=e.left;i<e.right;i++){let o=s*this.width+i,a=this.map[o];r[a]||(r[a]=!0,(i!=e.left||!i||this.map[o-1]!=a)&&(s!=e.top||!s||this.map[o-this.width]!=a)&&t.push(a))}return t}positionAt(e,t,r){for(let s=0,i=0;;s++){let o=i+r.child(s).nodeSize;if(s==e){let a=t+e*this.width,l=(e+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?o-1:this.map[a]}i=o}}static get(e){return Vv(e)||Hv(e,h7(e))}}function h7(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=p7(n),t=n.childCount,r=[],s=0,i=null,o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let f=n.child(c);u++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==f.childCount)break;let m=f.child(p),{colspan:y,rowspan:b,colwidth:v}=m.attrs;for(let A=0;A<b;A++){if(A+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-A});break}let w=s+A*e;for(let x=0;x<y;x++){r[w+x]==0?r[w+x]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-x});let C=v&&v[x];if(C){let S=(w+x)%e*2,M=o[S];M==null||M!=C&&o[S+1]==1?(o[S]=C,o[S+1]=1):M==C&&o[S+1]++}}}s+=y,u+=m.nodeSize}let d=(c+1)*e,h=0;for(;s<d;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}let a=new Ut(e,t,r,i),l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&m7(a,o,n),a}function p7(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let s=n.child(r),i=0;if(t)for(let o=0;o<r;o++){let a=n.child(o);for(let l=0;l<a.childCount;l++){let c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){let a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function m7(n,e,t){n.problems||(n.problems=[]);for(let r=0,s={};r<n.map.length;r++){let i=n.map[r];if(s[i])continue;s[i]=!0;let o=t.nodeAt(i),a=null;for(let l=0;l<o.attrs.colspan;l++){let c=(r+l)%n.width,u=e[c*2];u!=null&&(!o.attrs.colwidth||o.attrs.colwidth[l]!=u)&&((a||(a=g7(o.attrs)))[l]=u)}a&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function g7(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Tn(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const Bo=new Rt("selectingCells");function tu(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function y7(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function gs(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $g(n){let e=n.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:tu(e.$head)||b7(e.$head)}function b7(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function zv(n){return n.parent.type.spec.tableRole=="row"&&n.nodeAfter}function w7(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function $v(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function UR(n,e,t){let r=n.start(-1),i=Ut.get(n.node(-1)).nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function fn(n,e,t){let r={};for(let s in n)r[s]=n[s];return r[e]=t,r}function sl(n,e,t=1){let r=fn(n,"colspan",n.colspan-t);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function VR(n,e,t=1){let r=fn(n,"colspan",n.colspan+t);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<t;s++)r.colwidth.splice(e,0,0)}return r}function A7(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.height;s++)if(e.nodeAt(n.map[t+s*n.width]).type!=r)return!1;return!0}class ot extends Ie{constructor(e,t=e){let r=e.node(-1),s=Ut.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,t.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=t.pos-i);l.unshift(t.pos-i);let c=l.map(u=>{let f=r.nodeAt(u),d=u+i+1;return new H0(a.resolve(d),a.resolve(d+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(zv(r)&&zv(s)&&$v(r,s)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ot.rowSelection(r,s):i&&this.isColSelection()?ot.colSelection(r,s):new ot(r,s)}return Re.between(r,s)}content(){let e=this.$anchorCell.node(-1),t=Ut.get(e),r=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){let c=[];for(let u=l*t.width+s.left,f=s.left;f<s.right;f++,u++){let d=t.map[u];if(!i[d]){i[d]=!0;let h=t.findCell(d),p=e.nodeAt(d),m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let b=p.attrs;m>0&&(b=sl(b,0,m)),y>0&&(b=sl(b,b.colspan-y,y)),h.left<s.left?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}if(h.top<s.top||h.bottom>s.bottom){let b=fn(p.attrs,"rowspan",Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top));h.top<s.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}}o.push(e.child(l).copy(oe.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ue(oe.from(a),1,1)}replace(e,t=ue.empty){let r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ue.empty:t)}let i=Ie.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new ue(oe.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=Ut.get(t),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(t.nodeAt(i[o]),s+i[o])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.top<=o.top?(i.top>0&&(e=a.resolve(s+r.map[i.left])),o.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))):(o.top>0&&(t=a.resolve(s+r.map[o.left])),i.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+i.right-1]))),new ot(e,t)}isRowSelection(){let e=Ut.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-t),s=e.colCount(this.$headCell.pos-t);if(Math.min(r,s)>0)return!1;let i=r+this.$anchorCell.nodeAfter.attrs.colspan,o=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,o)==e.width}eq(e){return e instanceof ot&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.left<=o.left?(i.left>0&&(e=a.resolve(s+r.map[i.top*r.width])),o.right<r.width&&(t=a.resolve(s+r.map[r.width*(o.top+1)-1]))):(o.left>0&&(t=a.resolve(s+r.map[o.top*r.width])),i.right<r.width&&(e=a.resolve(s+r.map[r.width*(i.top+1)-1]))),new ot(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ot(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ot(e.resolve(t),e.resolve(r))}getBookmark(){return new Gv(this.$anchorCell.pos,this.$headCell.pos)}}ot.prototype.visible=!1,Ie.jsonID("cell",ot);class Gv{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gv(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&$v(t,r)?new ot(t,r):Ie.near(r,1)}}function v7(n){if(!(n.selection instanceof ot))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(en.node(r,r+t.nodeSize,{class:"selectedCell"}))}),vt.create(n.doc,e)}function x7({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(s).type.spec.tableRole)}function E7({$from:n,$to:e}){let t,r;for(let s=n.depth;s>0;s--){let i=n.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let s=e.depth;s>0;s--){let i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function C7(n,e,t){let r=(e||n).selection,s=(e||n).doc,i,o;if(r instanceof Oe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=ot.create(s,r.from);else if(o=="row"){let a=s.resolve(r.from+1);i=ot.rowSelection(a,a)}else if(!t){let a=Ut.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=ot.create(s,l+1,c)}}else r instanceof Re&&x7(r)?i=Re.create(s,r.from):r instanceof Re&&E7(r)&&(i=Re.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function k7(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.firstChild.type.spec.tableRole=="table");)t--,r--,e=e.firstChild.content;let s=e.firstChild,i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,u=l?0:Math.max(0,t-1),f=l<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Wv(Tn(o).row,new ue(c,u,f)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(t||r?Wv(Tn(o).row,new ue(e,t,r)).content:e);else return null;return S7(o,a)}function S7(n,e){let t=[];for(let s=0;s<e.length;s++){let i=e[s];for(let o=i.childCount-1;o>=0;o--){let{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)t[c]=(t[c]||0)+l}}let r=0;for(let s=0;s<t.length;s++)r=Math.max(r,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(oe.empty),t[s]<r){let i=Tn(n).cell.createAndFill(),o=[];for(let a=t[s];a<r;a++)o.push(i);e[s]=e[s].append(oe.from(o))}return{height:e.length,width:r,rows:e}}function Wv(n,e){let t=n.createAndFill();return new U0(t).replace(0,t.content.size,e).doc}function T7({width:n,height:e,rows:t},r,s){if(n!=r){let i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a],c=[];for(let u=i[a]||0,f=0;u<r;f++){let d=l.child(f%l.childCount);u+d.attrs.colspan>r&&(d=d.type.create(sl(d.attrs,d.attrs.colspan,u+d.attrs.colspan-r),d.content)),c.push(d),u+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+d.attrs.colspan}o.push(oe.from(c))}t=o,n=r}if(e!=s){let i=[];for(let o=0,a=0;o<s;o++,a++){let l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);o+f.attrs.rowspan>s&&(f=f.type.create(fn(f.attrs,"rowspan",Math.max(1,s-f.attrs.rowspan)),f.content)),l.push(f)}i.push(oe.from(l))}t=i,e=s}return{width:n,height:e,rows:t}}function O7(n,e,t,r,s,i,o){let a=n.doc.type.schema,l=Tn(a),c,u;if(s>e.width)for(let f=0,d=0;f<e.height;f++){let h=t.child(f);d+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=u||(u=l.header_cell.createAndFill());for(let y=e.width;y<s;y++)p.push(m);n.insert(n.mapping.slice(o).map(d-1+r),p)}if(i>e.height){let f=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,s);p++){let y=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==l.header_cell;f.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}let d=l.row.create(null,oe.from(f)),h=[];for(let p=e.height;p<i;p++)h.push(d);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),h)}return!!(c||u)}function HR(n,e,t,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){let u=o*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){l=!0;let d=t.nodeAt(f),{top:h,left:p}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,fn(d.attrs,"rowspan",o-h)),n.insert(n.mapping.slice(a).map(e.positionAt(o,p,t)),d.type.createAndFill(fn(d.attrs,"rowspan",h+d.attrs.rowspan-o))),c+=d.attrs.colspan-1}}return l}function zR(n,e,t,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){let u=c*e.width+o,f=e.map[u];if(e.map[u-1]==f){l=!0;let d=t.nodeAt(f),h=e.colCount(f),p=n.mapping.slice(a).map(f+r);n.setNodeMarkup(p,null,sl(d.attrs,o-h,d.attrs.colspan-(o-h))),n.insert(p+d.nodeSize,d.type.createAndFill(sl(d.attrs,0,o-h))),c+=d.attrs.rowspan-1}}return l}function $R(n,e,t,r,s){let i=t?n.doc.nodeAt(t-1):n.doc,o=Ut.get(i),{top:a,left:l}=r,c=l+s.width,u=a+s.height,f=n.tr,d=0;function h(){i=t?f.doc.nodeAt(t-1):f.doc,o=Ut.get(i),d=f.mapping.maps.length}O7(f,o,i,t,c,u,d)&&h(),HR(f,o,i,t,l,c,a,d)&&h(),HR(f,o,i,t,l,c,u,d)&&h(),zR(f,o,i,t,a,u,l,d)&&h(),zR(f,o,i,t,a,u,c,d)&&h();for(let p=a;p<u;p++){let m=o.positionAt(p,l,i),y=o.positionAt(p,c,i);f.replace(f.mapping.slice(d).map(m+t),f.mapping.slice(d).map(y+t),new ue(s.rows[p-a],0,0))}h(),f.setSelection(new ot(f.doc.resolve(t+o.positionAt(a,l,i)),f.doc.resolve(t+o.positionAt(u-1,c-1,i)))),e(f)}const N7=yb({ArrowLeft:Wg("horiz",-1),ArrowRight:Wg("horiz",1),ArrowUp:Wg("vert",-1),ArrowDown:Wg("vert",1),"Shift-ArrowLeft":Kg("horiz",-1),"Shift-ArrowRight":Kg("horiz",1),"Shift-ArrowUp":Kg("vert",-1),"Shift-ArrowDown":Kg("vert",1),Backspace:Qg,"Mod-Backspace":Qg,Delete:Qg,"Mod-Delete":Qg});function Gg(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Wg(n,e){return(t,r,s)=>{let i=t.selection;if(i instanceof ot)return Gg(t,r,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let o=GR(s,n,e);if(o==null)return!1;if(n=="horiz")return Gg(t,r,Ie.near(t.doc.resolve(i.head+e),e));{let a=t.doc.resolve(o),l=UR(a,n,e),c;return l?c=Ie.near(l,1):e<0?c=Ie.near(t.doc.resolve(a.before(-1)),-1):c=Ie.near(t.doc.resolve(a.after(-1)),1),Gg(t,r,c)}}}function Kg(n,e){return(t,r,s)=>{let i=t.selection;if(!(i instanceof ot)){let a=GR(s,n,e);if(a==null)return!1;i=new ot(t.doc.resolve(a))}let o=UR(i.$headCell,n,e);return o?Gg(t,r,new ot(i.$anchorCell,o)):!1}}function Qg(n,e){let t=n.selection;if(!(t instanceof ot))return!1;if(e){let r=n.tr,s=Tn(n.schema).cell.createAndFill().content;t.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ue(s,0,0))}),r.docChanged&&e(r)}return!0}function M7(n,e){let t=n.state.doc,r=tu(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ot(r))),!0):!1}function R7(n,e,t){if(!gs(n.state))return!1;let r=k7(t),s=n.state.selection;if(s instanceof ot){r||(r={width:1,height:1,rows:[oe.from(Wv(Tn(n.state.schema).cell,t))]});let i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ut.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=T7(r,a.right-a.left,a.bottom-a.top),$R(n.state,n.dispatch,o,a,r),!0}else if(r){let i=$g(n.state),o=i.start(-1);return $R(n.state,n.dispatch,o,Ut.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function P7(n,e){if(e.ctrlKey||e.metaKey)return;let t=WR(n,e.target),r;if(e.shiftKey&&n.state.selection instanceof ot)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&t&&(r=tu(n.state.selection.$anchor))!=null&&Kv(n,e).pos!=r.pos)s(r,e),e.preventDefault();else if(!t)return;function s(a,l){let c=Kv(n,l),u=Bo.getState(n.state)==null;if(!c||!$v(a,c))if(u)c=a;else return;let f=new ot(a,c);if(u||!n.state.selection.eq(f)){let d=n.state.tr.setSelection(f);u&&d.setMeta(Bo,a.pos),n.dispatch(d)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",o),Bo.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Bo,-1))}function o(a){let l=Bo.getState(n.state),c;if(l!=null)c=n.state.doc.resolve(l);else if(WR(n,a.target)!=t&&(c=Kv(n,e),!c))return i();c&&s(c,a)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",o)}function GR(n,e,t){if(!(n.state.selection instanceof Re))return null;let{$head:r}=n.state.selection;for(let s=r.depth-1;s>=0;s--){let i=r.node(s);if((t<0?r.index(s):r.indexAfter(s))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let a=r.before(s),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function WR(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function Kv(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?tu(n.state.doc.resolve(t.pos)):null}const D7=new Rt("fix-tables");function KR(n,e,t,r){let s=n.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){let l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(n.child(c)==l){a=c+1,t+=l.nodeSize;continue e}r(l,t),a<s&&n.child(a).sameMarkup(l)?KR(n.child(a),l,t+1,r):l.nodesBetween(0,l.content.size,r,t+1),t+=l.nodeSize}}function QR(n,e){let t,r=(s,i)=>{s.type.spec.tableRole=="table"&&(t=I7(n,s,i,t))};return e?e.doc!=n.doc&&KR(e.doc,n.doc,0,r):n.doc.descendants(r),t}function I7(n,e,t,r){let s=Ut.get(e);if(!s.problems)return r;r||(r=n.tr);let i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){let c=s.problems[l];if(c.type=="collision"){let u=e.nodeAt(c.pos);for(let f=0;f<u.attrs.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,sl(u.attrs,u.attrs.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"rowspan",u.attrs.rowspan-c.n))}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"colwidth",c.colwidth))}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<s.height;l++){let u=e.child(l),f=c+u.nodeSize,d=i[l];if(d>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<d;y++)p.push(Tn(n.schema)[h].createAndFill());let m=(l==0||o==l-1)&&a==l?c+1:f-1;r.insert(r.mapping.map(m),p)}c=f}return r.setMeta(D7,{fixTables:!0})}function Ys(n){let e=n.selection,t=$g(n),r=t.node(-1),s=t.start(-1),i=Ut.get(r),o;return e instanceof ot?o=i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):o=i.findCell(t.pos-s),o.tableStart=s,o.map=i,o.table=r,o}function JR(n,{map:e,tableStart:t,table:r},s){let i=s>0?-1:0;A7(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){let a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);n.setNodeMarkup(n.mapping.map(t+l),null,VR(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{let l=i==null?Tn(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);n.insert(n.mapping.map(t+c),l.createAndFill())}}return n}function L7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.left))}return!0}function B7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.right))}return!0}function _7(n,{map:e,table:t,tableStart:r},s){let i=n.mapping.maps.length;for(let o=0;o<e.height;){let a=o*e.width+s,l=e.map[a],c=t.nodeAt(l);if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)n.setNodeMarkup(n.mapping.slice(i).map(r+l),null,sl(c.attrs,s-e.colCount(l)));else{let u=n.mapping.slice(i).map(r+l);n.delete(u,u+c.nodeSize)}o+=c.attrs.rowspan}}function F7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let s=t.right-1;_7(r,t,s),s!=t.left;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function j7(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(e.nodeAt(n.map[s+t*n.width]).type!=r)return!1;return!0}function qR(n,{map:e,tableStart:t,table:r},s){let i=t;for(let l=0;l<s;l++)i+=r.child(l).nodeSize;let o=[],a=s>0?-1:0;j7(e,r,s+a)&&(a=s==0||s==e.height?null:0);for(let l=0,c=e.width*s;l<e.width;l++,c++)if(s>0&&s<e.height&&e.map[c]==e.map[c-e.width]){let u=e.map[c],f=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,fn(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{let u=a==null?Tn(r.type.schema).cell:r.nodeAt(e.map[c+a*e.width]).type;o.push(u.createAndFill())}return n.insert(i,Tn(r.type.schema).row.create(null,o)),n}function U7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.top))}return!0}function V7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.bottom))}return!0}function H7(n,{map:e,table:t,tableStart:r},s){let i=0;for(let l=0;l<s;l++)i+=t.child(l).nodeSize;let o=i+t.child(s).nodeSize,a=n.mapping.maps.length;n.delete(i+r,o+r);for(let l=0,c=s*e.width;l<e.width;l++,c++){let u=e.map[c];if(s>0&&u==e.map[c-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,fn(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(s<e.width&&u==e.map[c+e.width]){let f=t.nodeAt(u),d=f.type.create(fn(f.attrs,"rowspan",f.attrs.rowspan-1),f.content),h=e.positionAt(s+1,l,t);n.insert(n.mapping.slice(a).map(r+h),d),l+=f.attrs.colspan-1}}}function z7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let s=t.bottom-1;H7(r,t,s),s!=t.top;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function YR(n){let e=n.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function $7({width:n,height:e,map:t},r){let s=r.top*n+r.left,i=s,o=(r.bottom-1)*n+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[a]==t[a+1])return!0;i+=n,a+=n}for(let l=r.left;l<r.right;l++){if(r.top>0&&t[s]==t[s-n]||r.bottom<e&&t[o]==t[o+n])return!0;s++,o++}return!1}function XR(n,e){let t=n.selection;if(!(t instanceof ot)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=Ys(n),{map:s}=r;if($7(s,r))return!1;if(e){let i=n.tr,o={},a=oe.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){let d=s.map[u*s.width+f],h=r.table.nodeAt(d);if(!o[d])if(o[d]=!0,l==null)l=d,c=h;else{YR(h)||(a=a.append(h.content));let p=i.mapping.map(d+r.tableStart);i.delete(p,p+h.nodeSize)}}if(i.setNodeMarkup(l+r.tableStart,null,fn(VR(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),"rowspan",r.bottom-r.top)),a.size){let u=l+1+c.content.size,f=YR(c)?l+1:u;i.replaceWith(f+r.tableStart,u+r.tableStart,a)}i.setSelection(new ot(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function ZR(n,e){const t=Tn(n.schema);return G7(({node:r})=>t[r.type.spec.tableRole])(n,e)}function G7(n){return(e,t)=>{let r=e.selection,s,i;if(r instanceof ot){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{if(s=y7(r.$from),!s)return!1;i=tu(r.$from).pos}if(s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let o=s.attrs,a=[],l=o.colwidth;o.rowspan>1&&(o=fn(o,"rowspan",1)),o.colspan>1&&(o=fn(o,"colspan",1));let c=Ys(e),u=e.tr;for(let d=0;d<c.right-c.left;d++)a.push(l?fn(o,"colwidth",l&&l[d]?[l[d]]:null):o);let f;for(let d=c.top;d<c.bottom;d++){let h=c.map.positionAt(d,c.left,c.table);d==c.top&&(h+=s.nodeSize);for(let p=c.left,m=0;p<c.right;p++,m++)p==c.left&&d==c.top||u.insert(f=u.mapping.map(h+c.tableStart,1),n({node:s,row:d,col:p}).createAndFill(a[m]))}u.setNodeMarkup(i,n({node:s,row:c.top,col:c.left}),a[0]),r instanceof ot&&u.setSelection(new ot(u.doc.resolve(r.$anchorCell.pos),f&&u.doc.resolve(f))),t(u)}return!0}}function W7(n,e){return function(t,r){if(!gs(t))return!1;let s=$g(t);if(s.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ot?t.selection.forEachCell((o,a)=>{o.attrs[n]!==e&&i.setNodeMarkup(a,null,fn(o.attrs,n,e))}):i.setNodeMarkup(s.pos,null,fn(s.nodeAfter.attrs,n,e)),r(i)}return!0}}function K7(n){return function(e,t){if(!gs(e))return!1;if(t){let r=Tn(e.schema),s=Ys(e),i=e.tr,o=s.map.cellsInRect(n=="column"?new eu(s.left,0,s.right,s.map.height):n=="row"?new eu(0,s.top,s.map.width,s.bottom):s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);t(i)}return!0}}function eP(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==t.header_cell)return!1}return!0}function Yd(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?K7(n):function(t,r){if(!gs(t))return!1;if(r){let s=Tn(t.schema),i=Ys(t),o=t.tr,a=eP("row",i,s),l=eP("column",i,s),u=(n==="column"?a:n==="row"?l:!1)?1:0,f=n=="column"?new eu(0,u,1,i.map.height):n=="row"?new eu(u,0,i.map.width,1):i,d=n=="column"?l?s.cell:s.header_cell:n=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(f).forEach(h=>{const p=h+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,d,m.attrs)}),r(o)}return!0}}Yd("row",{useDeprecatedLogic:!0}),Yd("column",{useDeprecatedLogic:!0});let Q7=Yd("cell",{useDeprecatedLogic:!0});function J7(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,s=n.before();r>=0;r--){let i=n.node(-1).child(r);if(i.childCount)return s-1-i.lastChild.nodeSize;s-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),s=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}}function tP(n){return function(e,t){if(!gs(e))return!1;let r=J7($g(e),n);if(r!=null){if(t){let s=e.doc.resolve(r);t(e.tr.setSelection(Re.between(s,w7(s))).scrollIntoView())}return!0}}}function q7(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}let Y7=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Qv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qv(n,e,t,r,s,i){let o=0,a=!0,l=e.firstChild,c=n.firstChild;for(let u=0,f=0;u<c.childCount;u++){let{colspan:d,colwidth:h}=c.child(u).attrs;for(let p=0;p<d;p++,f++){let m=s==f?i:h&&h[p],y=m?m+"px":"";o+=m||r,m||(a=!1),l?(l.style.width!=y&&(l.style.width=y),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;l;){let u=l.nextSibling;l.parentNode.removeChild(l),l=u}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}const Gr=new Rt("tableColumnResizing");function X7({handleWidth:n=5,cellMinWidth:e=25,View:t=Y7,lastColumnResizable:r=!0}={}){return new At({key:Gr,state:{init(i,o){return this.spec.props.nodeViews[Tn(o.schema).table.name]=(a,l)=>new t(a,e,l),new Xd(-1,!1)},apply(i,o){return o.apply(i)}},props:{attributes(i){return Gr.getState(i).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(i,o){Z7(i,o,n,e,r)},mouseleave(i){eJ(i)},mousedown(i,o){tJ(i,o,e)}},decorations(i){let o=Gr.getState(i);if(o.activeHandle>-1)return aJ(i,o.activeHandle)},nodeViews:{}}})}class Xd{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(Gr);if(r&&r.setHandle!=null)return new Xd(r.setHandle,null);if(r&&r.setDragging!==void 0)return new Xd(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);zv(e.doc.resolve(s))||(s=null),t=new Xd(s,t.dragging)}return t}}function Z7(n,e,t,r,s){let i=Gr.getState(n.state);if(!i.dragging){let o=rJ(e.target),a=-1;if(o){let{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=nP(n,e,"left"):c-e.clientX<=t&&(a=nP(n,e,"right"))}if(a!=i.activeHandle){if(!s&&a!==-1){let l=n.state.doc.resolve(a),c=l.node(-1),u=Ut.get(c),f=l.start(-1);if(u.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==u.width-1)return}sP(n,a)}}}function eJ(n){let e=Gr.getState(n.state);e.activeHandle>-1&&!e.dragging&&sP(n,-1)}function tJ(n,e,t){let r=Gr.getState(n.state);if(r.activeHandle==-1||r.dragging)return!1;let s=n.state.doc.nodeAt(r.activeHandle),i=nJ(n,r.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Gr,{setDragging:{startX:e.clientX,startWidth:i}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);let c=Gr.getState(n.state);c.dragging&&(sJ(n,c.activeHandle,rP(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(Gr,{setDragging:null})))}function a(l){if(!l.which)return o(l);let c=Gr.getState(n.state),u=rP(c.dragging,l,t);iJ(n,c.activeHandle,u,t)}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function nJ(n,e,{colspan:t,colwidth:r}){let s=r&&r[r.length-1];if(s)return s;let i=n.domAtPos(e),a=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let c=0;c<t;c++)r[c]&&(a-=r[c],l--);return a/l}function rJ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nP(n,e,t){let r=n.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:s}=r,i=tu(n.state.doc.resolve(s));if(!i)return-1;if(t=="right")return i.pos;let o=Ut.get(i.node(-1)),a=i.start(-1),l=o.map.indexOf(i.pos-a);return l%o.width==0?-1:a+o.map[l-1]}function rP(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function sP(n,e){n.dispatch(n.state.tr.setMeta(Gr,{setHandle:e}))}function sJ(n,e,t){let r=n.state.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;let f=i.map[u],{attrs:d}=s.nodeAt(f),h=d.colspan==1?0:a-i.colCount(f);if(d.colwidth&&d.colwidth[h]==t)continue;let p=d.colwidth?d.colwidth.slice():oJ(d.colspan);p[h]=t,l.setNodeMarkup(o+f,null,fn(d,"colwidth",p))}l.docChanged&&n.dispatch(l)}function iJ(n,e,t,r){let s=n.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=Ut.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1,l=n.domAtPos(s.start(-1)).node;for(;l.nodeName!="TABLE";)l=l.parentNode;Qv(i,l.firstChild,l,r,a,t)}function oJ(n){let e=[];for(let t=0;t<n;t++)e.push(0);return e}function aJ(n,e){let t=[],r=n.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan;for(let l=0;l<i.height;l++){let c=a+l*i.width-1;if((a==i.width||i.map[c]!=i.map[c+1])&&(l==0||i.map[c-1]!=i.map[c-1-i.width])){let u=i.map[c],f=o+u+s.nodeAt(u).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(en.widget(f,d))}}return vt.create(n.doc,t)}function lJ({allowTableNodeSelection:n=!1}={}){return new At({key:Bo,state:{init(){return null},apply(e,t){let r=e.getMeta(Bo);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:s,pos:i}=e.mapping.mapResult(t);return s?null:i}},props:{decorations:v7,handleDOMEvents:{mousedown:P7},createSelectionBetween(e){if(Bo.getState(e.state)!=null)return e.state.selection},handleTripleClick:M7,handleKeyDown:N7,handlePaste:R7},appendTransaction(e,t,r){return C7(r,QR(r,t),n)}})}function iP(n,e,t,r,s,i){var u;let o=0,a=!0,l=e.firstChild;const c=n.firstChild;if(c)for(let f=0,d=0;f<c.childCount;f+=1){const{colspan:h,colwidth:p}=c.child(f).attrs;for(let m=0;m<h;m+=1,d+=1){const y=s===d?i:p&&p[m],b=y?`${y}px`:"";o+=y||r,y||(a=!1),l?(l.style.width!==b&&(l.style.width=b),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=b}}for(;l;){const f=l.nextSibling;(u=l==null?void 0:l.parentNode)==null||u.removeChild(l),l=f}a?(t.style.width=`${o}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${o}px`)}class cJ{constructor(e,t){G(this,"node");G(this,"cellMinWidth");G(this,"dom");G(this,"table");G(this,"colgroup");G(this,"contentDOM");this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),iP(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,iP(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function oP(n,e){return n.createAndFill()}function uJ(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function fJ(n,e,t,r,s){const i=uJ(n),o=[],a=[];for(let c=0;c<t;c+=1){const u=oP(i.cell);if(u&&a.push(u),r){const f=oP(i.header_cell);f&&o.push(f)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function dJ(n){return n instanceof ot}const Jg=({editor:n})=>{const{selection:e}=n.state;if(!dJ(e))return!1;let t=0;const r=Tb(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},hJ=xt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:cJ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let t=0,r=!0;try{n.content.firstChild.content.forEach(i=>{if(i.attrs.colwidth)i.attrs.colwidth.forEach(o=>{o?t+=o:(r=!1,t+=this.options.cellMinWidth)});else{r=!1;const o=i.attrs.colspan?i.attrs.colspan:1;t+=this.options.cellMinWidth*o}})}catch{r=!1}return r&&t>0?e.style=`width: ${t}px;`:t&&t>0?e.style=`min-width: ${t}px`:e.style=null,["div",{class:"table-wrapper"},["table",nt(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const{selection:o}=r,a=fJ(i.schema,n,e,t);if(s){const l=r.selection.anchor+1;r.replaceRangeWith(o.from-1,o.to,a).scrollIntoView().setSelection(Re.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>L7(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>B7(n,e),deleteColumn:()=>({state:n,dispatch:e})=>F7(n,e),addRowBefore:()=>({state:n,dispatch:e})=>U7(n,e),addRowAfter:()=>({state:n,dispatch:e})=>V7(n,e),deleteRow:()=>({state:n,dispatch:e})=>z7(n,e),deleteTable:()=>({state:n,dispatch:e})=>q7(n,e),mergeCells:()=>({state:n,dispatch:e})=>XR(n,e),splitCell:()=>({state:n,dispatch:e})=>ZR(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yd("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yd("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>Q7(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>XR(n,e)?!0:ZR(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>W7(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>tP(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>tP(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&QR(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ot.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Jg,"Mod-Backspace":Jg,Delete:Jg,"Mod-Delete":Jg}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[X7({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],lJ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Ye(ve(n,"tableRole",e))}}});function aP(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}var lP=typeof window<"u"&&typeof document<"u";function Jv(n,e){n&&(typeof n=="function"&&n(e),{}.hasOwnProperty.call(n,"current")&&(n.current=e))}function cP(){return lP&&document.createElement("div")}function pJ(n){var e={"data-placement":n.placement};return n.referenceHidden&&(e["data-reference-hidden"]=""),n.escaped&&(e["data-escaped"]=""),e}function uP(n,e){if(n===e)return!0;if(typeof n=="object"&&n!=null&&typeof e=="object"&&e!=null){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(var t in n)if(e.hasOwnProperty(t)){if(!uP(n[t],e[t]))return!1}else return!1;return!0}else return!1}function mJ(n){var e=[];return n.forEach(function(t){e.find(function(r){return uP(t,r)})||e.push(t)}),e}function gJ(n,e){var t,r;return Object.assign({},e,{popperOptions:Object.assign({},n.popperOptions,e.popperOptions,{modifiers:mJ([].concat(((t=n.popperOptions)==null?void 0:t.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var qv=lP?P.useLayoutEffect:P.useEffect;function yJ(n){var e=P.useRef();return e.current||(e.current=typeof n=="function"?n():n),e.current}function fP(n,e,t){t.split(/\s+/).forEach(function(r){r&&n.classList[e](r)})}var bJ={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var a;return!!((a=e.props.render)!=null&&a.$$tippy)};function s(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}fP(t,"add",e.props.className)}function i(){r()&&fP(t,"remove",e.props.className)}return{onCreate:s,onBeforeUpdate:i,onAfterUpdate:s}}};function wJ(n){function e(t){var r=t.children,s=t.content,i=t.visible,o=t.singleton,a=t.render,l=t.reference,c=t.disabled,u=c===void 0?!1:c,f=t.ignoreAttributes,d=f===void 0?!0:f;t.__source,t.__self;var h=aP(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=i!==void 0,m=o!==void 0,y=P.useState(!1),b=y[0],v=y[1],A=P.useState({}),w=A[0],x=A[1],C=P.useState(),S=C[0],M=C[1],O=yJ(function(){return{container:cP(),renders:1}}),R=Object.assign({ignoreAttributes:d},h,{content:O.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(K){R[K]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+K+"` prop in","controlled mode (`visible` prop)"].join(" "))}),R.trigger="manual",R.hideOnClick=!1),m&&(u=!0);var D=R,_=R.plugins||[];a&&(D=Object.assign({},R,{plugins:m&&o.data!=null?[].concat(_,[{fn:function(){return{onTrigger:function($,q){var ne=o.data.children.find(function(Z){var me=Z.instance;return me.reference===q.currentTarget});$.state.$$activeSingletonInstance=ne.instance,M(ne.content)}}}}]):_,render:function(){return{popper:O.container}}}));var U=[l].concat(r?[r.type]:[]);return qv(function(){var K=l;l&&l.hasOwnProperty("current")&&(K=l.current);var B=n(K||O.ref||cP(),Object.assign({},D,{plugins:[bJ].concat(R.plugins||[])}));return O.instance=B,u&&B.disable(),i&&B.show(),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M}),v(!0),function(){B.destroy(),o==null||o.cleanup(B)}},U),qv(function(){var K;if(O.renders===1){O.renders++;return}var B=O.instance;B.setProps(gJ(B.props,D)),(K=B.popperInstance)==null||K.forceUpdate(),u?B.disable():B.enable(),p&&(i?B.show():B.hide()),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M})}),qv(function(){var K;if(a){var B=O.instance;B.setProps({popperOptions:Object.assign({},B.props.popperOptions,{modifiers:[].concat((((K=B.props.popperOptions)==null?void 0:K.modifiers)||[]).filter(function($){var q=$.name;return q!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(q){var ne,Z=q.state,me=(ne=Z.modifiersData)==null?void 0:ne.hide;(w.placement!==Z.placement||w.referenceHidden!==(me==null?void 0:me.isReferenceHidden)||w.escaped!==(me==null?void 0:me.hasPopperEscaped))&&x({placement:Z.placement,referenceHidden:me==null?void 0:me.isReferenceHidden,escaped:me==null?void 0:me.hasPopperEscaped}),Z.attributes.popper={}}}])})})}},[w.placement,w.referenceHidden,w.escaped].concat(U)),P.createElement(P.Fragment,null,r?P.cloneElement(r,{ref:function(B){O.ref=B,Jv(r.ref,B)}}):null,b&&kt.createPortal(a?a(pJ(w),S,O.instance):s,O.container))}return e}var AJ=function(n,e){return P.forwardRef(function(r,s){var i=r.children,o=aP(r,["children"]);return P.createElement(n,Object.assign({},e,o),i?P.cloneElement(i,{ref:function(l){Jv(s,l),Jv(i.ref,l)}}):null)})},vJ=AJ(wJ(Ba));const xJ=[{name:"Add row above",action:n=>n.chain().focus().addRowBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:n=>n.chain().focus().addRowAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:n=>n.chain().focus().addColumnBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:n=>n.chain().focus().addColumnAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:n=>n.chain().focus().deleteRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:n=>n.chain().focus().deleteColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:n=>n.chain().focus().toggleHeaderRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:n=>n.chain().focus().toggleHeaderColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:n=>n.chain().focus().toggleHeaderCell().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:n=>n.chain().focus().deleteTable().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],dP=({node:n,getPos:e,selected:t,editor:r})=>{const[s,i]=P.useState(!1),o=gm(),a=P.useRef(null),l=()=>{const{from:u,to:f}=r.state.selection,d=e(),h=d+n.nodeSize;i(d<=u&&f<=h)};P.useEffect(()=>(r.on("selectionUpdate",l),setTimeout(l,100),()=>{r.off("selectionUpdate",l)}));const c=()=>{var d,h;let u=(d=a.current)==null?void 0:d.clientTop;u&&(u+=5);let f=(h=a.current)==null?void 0:h.clientLeft;return f&&(f+=5),{top:`${u}px`,left:`${f}px`}};return k.jsxs(od,{className:"group",children:[k.jsx(aT,{as:"span"}),(s||t)&&k.jsx(vJ,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"top-start",content:k.jsx("article",{className:"w-screen lg:w-full",contentEditable:!1,children:k.jsx("ul",{tabIndex:0,className:"fixed top-8 right-1/2 translate-x-1/2 menu menu-compact p-2 shadow bg-base-100 rounded-lg w-56",style:c(),children:xJ.map(u=>k.jsx("li",{children:k.jsx(Oc,{variant:"ghost",className:"!items-center w-full !justify-start !font-[400]",onClick:()=>u.action(r),children:k.jsx("span",{children:u.name})})},u.name))})}),children:k.jsx("label",{tabIndex:0,className:he("trigger-button",{hidden:o}),contentEditable:!1,children:k.jsx(s8,{size:20})})})]})},EJ=xt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"td",className:"relative"})}}),CJ=xt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"th",className:"relative"})}}),hP=n=>(n.stopPropagation(),n.preventDefault(),n),kJ=function(n){const e=n.scrollHeight>n.clientHeight,r=window.getComputedStyle(n).overflowY.indexOf("hidden")!==-1;return e&&!r},pP=function(n){return!n||n===document.body?document.body:kJ(n)?n:pP(n.parentNode)},Yv=(n,e,t)=>{const r=document.createElement(n);if(!r)throw new Error(`Element with name ${n} can't be created.`);return e&&Object.entries(e).forEach(([s,i])=>r.setAttribute(s,i)),t&&Object.entries(t).forEach(([s,i])=>r.addEventListener(s,i)),r},SJ=xt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return({editor:n,HTMLAttributes:e,getPos:t})=>{const r=()=>t(),s=pP(n.options.element);let i=!1;const o={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const b=r(),v=n.state.doc.resolve(b),A=new Oe(v);n.view.dispatch(n.state.tr.setSelection(A))}},a=()=>{i=!0},l=()=>{i=!1},c=Yv("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:b=>{b&&hP(b),o.selectRow()},mouseenter:()=>{a()},mouseover:()=>{a()},mouseleave:()=>{l(),d()}}),u=Yv("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:b=>{b&&hP(b),o.deleteRow()}}),f=()=>{m(),c.classList.remove("hidden")},d=()=>{setTimeout(()=>{i||c.classList.add("hidden")},100)},h=Yv("tr",{...e},{mouseenter:f,mouseover:f,mouseleave:d});c.append(u),document.body.append(c);let p="";const m=()=>{setTimeout(()=>{const b=h.getBoundingClientRect(),v=JSON.stringify(b);p!==v&&(c.style.top=`${b.top+document.documentElement.scrollTop}px`,c.style.left=`${b.x+document.documentElement.scrollLeft-8}px`,c.style.height=`${b.height+1}px`,p=v)})};return setTimeout(()=>{m()},100),n.on("selectionUpdate",m),n.on("update",m),s==null||s.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{c.remove(),n.off("selectionUpdate",m),n.off("update",m),s==null||s.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),TJ=[hJ.configure({resizable:!0}),EJ,CJ,SJ],OJ=EM.extend({content:"(dBlock|columns)+"});function mP({types:n,node:e}){return e!=null&&e.type?Array.isArray(n)&&n.includes(e.type)||e.type===n:!1}const NJ=Ot.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Rt(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new At({key:n,appendTransaction:(t,r,s)=>{const{doc:i,tr:o,schema:a}=s,l=n.getState(s),c=i.content.size,u=a.nodes[this.options.node];if(l)return o.insert(c,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!mP({node:s,types:e})},apply:(t,r)=>{var i,o,a;if(!t.docChanged)return r;const s=(a=(o=(i=t.doc.lastChild)==null?void 0:i.content)==null?void 0:o.content)==null?void 0:a[0];return!mP({node:s,types:e})}}})]}}),MJ=({node:n,editor:e,getPos:t})=>{const[r,s]=P.useState(""),i=gm(),o=["https://twitter.com","https://x.com"],a=()=>{switch(n.attrs.data){case"twitter":return k.jsx(yT,{size:20});case"iframe":return k.jsx(bT,{size:20});default:return k.jsx(h8,{size:20})}},l=()=>{switch(n.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},c=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const A=r.match(/src="([^"]*)"/);A&&A.length>0&&(p=A[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://www.youtube.com/embed/${A[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://player.vimeo.com/video/${A[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,y=360,b=t(),v=b+n.nodeSize;p&&(e==null||e.chain().focus(b).deleteRange({from:b,to:v}).setIframe({src:p,width:m,height:y}).run())},u=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=o.some(w=>r.includes(w)),y=r.match(/\/status\/([0-9]*)/),b=y&&y.length>0;if(m&&b)p=y[1];else{alert("invalid url");return}const v=t(),A=v+n.nodeSize;p&&(e==null||e.chain().focus(v).deleteRange({from:v,to:A}).setTweetEmbed({tweetId:p}).run())},d=Tv(()=>{switch(n.attrs.data){case"twitter":u();break;default:c();break}},500);P.useEffect(()=>{const p=m=>{if(m.key==="Backspace"&&r===""){const y=t(),b=y+n.nodeSize;(n.content.size===0||n.textContent==="")&&(e==null||e.chain().focus(y).deleteRange({from:y,to:b}).run(),m.preventDefault())}};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,e,t,n]),P.useEffect(()=>{r&&d()},[r]),P.useEffect(()=>{e==null||e.chain().focus()},[]);const h=P.useRef(null);return P.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!i&&k.jsxs("div",{className:"relative w-full",children:[k.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[#A1AAB1]",children:a()}),k.jsx("input",{ref:h,value:r,placeholder:l(),onChange:p=>s(p.target.value),onClick:p=>p.stopPropagation(),className:"rounded bg-[#f2f2f2] p-3 pl-10 w-full cursor-pointer transition-all ease-in-out text-sm"})]})})},RJ=xt.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{data:{default:null}}},addNodeView(){return _a(MJ)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-action-node":""}),0]},addCommands(){return{setActionButton:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:n},content:[]})}}}),PJ=[FW,BW.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bulletList:{HTMLAttributes:{class:"flex flex-col items-start list-disc list-outside space-y-4 ml-6"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},listItem:{HTMLAttributes:{class:"leading-normal"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-[#E8EBEC] p-5 font-serif italic text-black"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-black"},exitOnArrowDown:!0},code:{HTMLAttributes:{class:"rounded bg-transparent p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1}),jW.configure({types:["heading","paragraph"]}),MK,lK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),cK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),dK.configure({multicolor:!0}),NK,gK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),_W,DK,hK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),mK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),CM.configure({width:3,color:"#d1d5db"}),kM,d7,NJ,OJ,...TJ,HK.configure({uploadFn:v8}),PK,IK,FK,RJ,RK],DJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",IJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",LJ=n=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-cursor__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},BJ=n=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.classList.add("custom-cursor__label-container"),t.setAttribute("style",`border: 1px solid ${n.color}`);const r=document.createElement("img");r.src=DJ,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=n.name;const o=document.createElement("img");return o.src=IJ,o.classList.add("custom-cursor__badge"),s.appendChild(i),t.appendChild(r),t.appendChild(s),t.appendChild(o),e.appendChild(t),e},_J=n=>n.isEns?BJ(n):LJ(n),FJ="6.13.1";function jJ(n,e,t){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=n,s}async function On(n){const e=Object.keys(n);return(await Promise.all(e.map(r=>Promise.resolve(n[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Ne(n,e,t){for(let r in e){let s=e[r];const i=t?t[r]:null;i&&jJ(s,i,r),Object.defineProperty(n,r,{enumerable:!0,value:s,writable:!1})}}function nu(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(nu).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let r=0;r<n.length;r++)t+=e[n[r]>>4],t+=e[n[r]&15];return t}if(typeof n=="object"&&typeof n.toJSON=="function")return nu(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(t=>`${nu(t)}: ${nu(n[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function dn(n,e){return n&&n.code===e}function Xv(n){return dn(n,"CALL_EXCEPTION")}function Mt(n,e,t){let r=n;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${nu(t)}`);for(const o in t){if(o==="shortMessage")continue;const a=t[o];i.push(o+"="+nu(a))}}i.push(`code=${e}`),i.push(`version=${FJ}`),i.length&&(n+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(n);break;default:s=new Error(n)}return Ne(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Ne(s,{shortMessage:r}),s}function ee(n,e,t,r){if(!n)throw Mt(e,t,r)}function z(n,e,t,r){ee(n,e,"INVALID_ARGUMENT",{argument:t,value:r})}function gP(n,e,t){t==null&&(t=""),t&&(t=": "+t),ee(n>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:n,expectedCount:e}),ee(n<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((n,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(e)}catch{}return n},[]);function qg(n,e,t){if(t==null&&(t=""),n!==e){let r=t,s="new";t&&(r+=".",s+=" "+t),ee(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function yP(n,e,t){if(n instanceof Uint8Array)return t?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(n.substring(s,s+2),16),s+=2;return r}z(!1,"invalid BytesLike value",e||"value",n)}function ct(n,e){return yP(n,e,!1)}function Vn(n,e){return yP(n,e,!0)}function Ct(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&n.length!==2+2*e||e===!0&&n.length%2!==0)}function Zv(n){return Ct(n,!0)||n instanceof Uint8Array}const bP="0123456789abcdef";function we(n){const e=ct(n);let t="0x";for(let r=0;r<e.length;r++){const s=e[r];t+=bP[(s&240)>>4]+bP[s&15]}return t}function zt(n){return"0x"+n.map(e=>we(e).substring(2)).join("")}function ru(n){return Ct(n,!0)?(n.length-2)/2:ct(n).length}function Vt(n,e,t){const r=ct(n);return t!=null&&t>r.length&&ee(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:t}),we(r.slice(e??0,t??r.length))}function wP(n,e,t){const r=ct(n);ee(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(r,e-r.length):s.set(r,0),we(s)}function il(n,e){return wP(n,e,!0)}function UJ(n,e){return wP(n,e,!1)}const Yg=BigInt(0),ys=BigInt(1),su=9007199254740991;function VJ(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"width"));if(ee(t>>r===Yg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),t>>r-ys){const s=(ys<<r)-ys;return-((~t&s)+ys)}return t}function AP(n,e){let t=xe(n,"value");const r=BigInt(Je(e,"width")),s=ys<<r-ys;if(t<Yg){t=-t,ee(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const i=(ys<<r)-ys;return(~t&i)+ys}else ee(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return t}function Zd(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"bits"));return t&(ys<<r)-ys}function xe(n,e){switch(typeof n){case"bigint":return n;case"number":return z(Number.isInteger(n),"underflow",e||"value",n),z(n>=-su&&n<=su,"overflow",e||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(t){z(!1,`invalid BigNumberish string: ${t.message}`,e||"value",n)}}z(!1,"invalid BigNumberish value",e||"value",n)}function Xg(n,e){const t=xe(n,e);return ee(t>=Yg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),t}const vP="0123456789abcdef";function e1(n){if(n instanceof Uint8Array){let e="0x0";for(const t of n)e+=vP[t>>4],e+=vP[t&15];return BigInt(e)}return xe(n)}function Je(n,e){switch(typeof n){case"bigint":return z(n>=-su&&n<=su,"overflow",e||"value",n),Number(n);case"number":return z(Number.isInteger(n),"underflow",e||"value",n),z(n>=-su&&n<=su,"overflow",e||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return Je(BigInt(n),e)}catch(t){z(!1,`invalid numeric string: ${t.message}`,e||"value",n)}}z(!1,"invalid numeric value",e||"value",n)}function HJ(n){return Je(e1(n))}function _o(n,e){let r=Xg(n,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Je(e,"width");for(ee(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<s*2;)r="0"+r}return"0x"+r}function Hn(n){const e=Xg(n,"value");if(e===Yg)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const r=new Uint8Array(t.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(t.substring(i,i+2),16)}return r}function ol(n){let e=we(Zv(n)?n:Hn(n)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const xP="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const EP=BigInt(58);function zJ(n){const e=ct(n);let t=e1(e),r="";for(;t;)r=xP[Number(t%EP)]+r,t/=EP;for(let s=0;s<e.length&&!e[s];s++)r=xP[0]+r;return r}function $J(n){n=atob(n);const e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return ct(e)}function GJ(n){const e=ct(n);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}class CP{constructor(e,t,r){G(this,"filter");G(this,"emitter");J(this,Pu);L(this,Pu,t),Ne(this,{emitter:e,filter:r})}async removeListener(){T(this,Pu)!=null&&await this.emitter.off(this.filter,T(this,Pu))}}Pu=new WeakMap;function WJ(n,e,t,r,s){z(!1,`invalid codepoint at offset ${e}; ${n}`,"bytes",t)}function kP(n,e,t,r,s){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)i++;return i}return n==="OVERRUN"?t.length-e-1:0}function KJ(n,e,t,r,s){return n==="OVERLONG"?(z(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),kP(n,e,t))}const QJ=Object.freeze({error:WJ,ignore:kP,replace:KJ});function JJ(n,e){e==null&&(e=QJ.error);const t=ct(n,"bytes"),r=[];let s=0;for(;s<t.length;){const i=t[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,r):s+=e("BAD_PREFIX",s-1,t,r);continue}if(s-1+o>=t.length){s+=e("OVERRUN",s-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let c=0;c<o;c++){let u=t[s];if((u&192)!=128){s+=e("MISSING_CONTINUE",s,t,r),l=null;break}l=l<<6|u&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,t,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,t,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,t,r,l);continue}r.push(l)}}return r}function Mi(n,e){z(typeof n=="string","invalid string value","str",n);let t=[];for(let r=0;r<n.length;r++){const s=n.charCodeAt(r);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){r++;const i=n.charCodeAt(r);z(r<n.length&&(i&64512)===56320,"invalid surrogate pair","str",n);const o=65536+((s&1023)<<10)+(i&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function qJ(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function iu(n,e){return qJ(JJ(n,e))}function SP(n){async function e(t,r){ee(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();ee(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),ee(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Mt("request timeout","TIMEOUT"),o.abort()},t.timeout);r&&r.addListener(()=>{i=Mt("request cancelled","CANCELLED"),o.abort()});const l={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:o.signal};let c;try{c=await fetch(t.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const u={};c.headers.forEach((h,p)=>{u[p.toLowerCase()]=h});const f=await c.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:c.status,statusMessage:c.statusText,headers:u,body:d}}return e}const YJ=12,XJ=250;let TP=SP();const ZJ=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),eq=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let t1=!1;async function OP(n,e){try{const t=n.match(ZJ);if(!t)throw new Error("invalid data");return new Fo(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?$J(t[3]):nq(t[3]))}catch{return new Fo(599,"BAD REQUEST (invalid data: URI)",{},null,new zn(n))}}function NP(n){async function e(t,r){try{const s=t.match(eq);if(!s)throw new Error("invalid link");return new zn(`${n}${s[2]}`)}catch{return new Fo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new zn(t))}}return e}const Zg={data:OP,ipfs:NP("https://gateway.ipfs.io/ipfs/")},MP=new WeakMap;class tq{constructor(e){J(this,Tl);J(this,Xo);L(this,Tl,[]),L(this,Xo,!1),MP.set(e,()=>{if(!T(this,Xo)){L(this,Xo,!0);for(const t of T(this,Tl))setTimeout(()=>{t()},0);L(this,Tl,[])}})}addListener(e){ee(!T(this,Xo),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,Tl).push(e)}get cancelled(){return T(this,Xo)}checkSignal(){ee(!this.cancelled,"cancelled","CANCELLED",{})}}Tl=new WeakMap,Xo=new WeakMap;function ey(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}const u0=class u0{constructor(e){J(this,Rl);J(this,Du);J(this,Iu);J(this,xs);J(this,Wi);J(this,Lu);J(this,Bu);J(this,mn);J(this,Nr);J(this,Ki);J(this,Ol);J(this,Nl);J(this,Ml);J(this,ni);J(this,Es);J(this,Zo);L(this,Bu,String(e)),L(this,Du,!1),L(this,Iu,!0),L(this,xs,{}),L(this,Wi,""),L(this,Lu,3e5),L(this,Es,{slotInterval:XJ,maxAttempts:YJ}),L(this,Zo,null)}get url(){return T(this,Bu)}set url(e){L(this,Bu,String(e))}get body(){return T(this,mn)==null?null:new Uint8Array(T(this,mn))}set body(e){if(e==null)L(this,mn,void 0),L(this,Nr,void 0);else if(typeof e=="string")L(this,mn,Mi(e)),L(this,Nr,"text/plain");else if(e instanceof Uint8Array)L(this,mn,e),L(this,Nr,"application/octet-stream");else if(typeof e=="object")L(this,mn,Mi(JSON.stringify(e))),L(this,Nr,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,mn)!=null}get method(){return T(this,Wi)?T(this,Wi):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,Wi,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,xs));return T(this,Ki)&&(e.authorization=`Basic ${GJ(Mi(T(this,Ki)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Nr)&&(e["content-type"]=T(this,Nr)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){T(this,xs)[String(e).toLowerCase()]=String(t)}clearHeaders(){L(this,xs,{})}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,Ki)||null}setCredentials(e,t){z(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,Ki,`${e}:${t}`)}get allowGzip(){return T(this,Iu)}set allowGzip(e){L(this,Iu,!!e)}get allowInsecureAuthentication(){return!!T(this,Du)}set allowInsecureAuthentication(e){L(this,Du,!!e)}get timeout(){return T(this,Lu)}set timeout(e){z(e>=0,"timeout must be non-zero","timeout",e),L(this,Lu,e)}get preflightFunc(){return T(this,Ol)||null}set preflightFunc(e){L(this,Ol,e)}get processFunc(){return T(this,Nl)||null}set processFunc(e){L(this,Nl,e)}get retryFunc(){return T(this,Ml)||null}set retryFunc(e){L(this,Ml,e)}get getUrlFunc(){return T(this,Zo)||TP}set getUrlFunc(e){L(this,Zo,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,mn)?we(T(this,mn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Es).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Es).maxAttempts=e.maxAttempts)}send(){return ee(T(this,ni)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,ni,new tq(this)),fe(this,Rl,Zh).call(this,0,RP()+this.timeout,0,this,new Fo(0,"",{},null,this))}cancel(){ee(T(this,ni)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=MP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();ee(this.method==="GET"&&(t!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new u0(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,xs,Object.assign({},T(this,xs))),T(this,mn)&&L(s,mn,new Uint8Array(T(this,mn))),L(s,Nr,T(this,Nr)),s}clone(){const e=new u0(this.url);return L(e,Wi,T(this,Wi)),T(this,mn)&&L(e,mn,T(this,mn)),L(e,Nr,T(this,Nr)),L(e,xs,Object.assign({},T(this,xs))),L(e,Ki,T(this,Ki)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Ol,T(this,Ol)),L(e,Nl,T(this,Nl)),L(e,Ml,T(this,Ml)),L(e,Es,Object.assign({},T(this,Es))),L(e,Zo,T(this,Zo)),e}static lockConfig(){t1=!0}static getGateway(e){return Zg[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(t1)throw new Error("gateways locked");Zg[e]=t}static registerGetUrl(e){if(t1)throw new Error("gateways locked");TP=e}static createGetUrlFunc(e){return SP()}static createDataGateway(){return OP}static createIpfsGatewayFunc(e){return NP(e)}};Du=new WeakMap,Iu=new WeakMap,xs=new WeakMap,Wi=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,mn=new WeakMap,Nr=new WeakMap,Ki=new WeakMap,Ol=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,ni=new WeakMap,Es=new WeakMap,Zo=new WeakMap,Rl=new WeakSet,Zh=async function(e,t,r,s,i){var u,f,d;if(e>=T(this,Es).maxAttempts)return i.makeServerError("exceeded maximum retry limit");ee(RP()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await rq(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Zg){const h=await Zg[a](o.url,ey(T(s,ni)));if(h instanceof Fo){let p=h;if(this.processFunc){ey(T(s,ni));try{p=await this.processFunc(o,p)}catch(m){(m.throttle==null||typeof m.stall!="number")&&p.makeServerError("error in post-processing function",m).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,ey(T(s,ni)));let c=new Fo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(c.statusCode===301||c.statusCode===302){try{const h=c.headers.location||"";return fe(u=o.redirect(h),Rl,Zh).call(u,e+1,t,0,s,c)}catch{}return c}else if(c.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,c,e))){const h=c.headers["retry-after"];let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),fe(f=o.clone(),Rl,Zh).call(f,e+1,t,p,s,c)}if(this.processFunc){ey(T(s,ni));try{c=await this.processFunc(o,c)}catch(h){(h.throttle==null||typeof h.stall!="number")&&c.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),Rl,Zh).call(d,e+1,t,p,s,c)}}return c};let zn=u0;const wE=class wE{constructor(e,t,r,s,i){J(this,_h);J(this,Fh);J(this,jh);J(this,Mr);J(this,_u);J(this,Pl);L(this,_h,e),L(this,Fh,t),L(this,jh,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Mr,s==null?null:new Uint8Array(s)),L(this,_u,i||null),L(this,Pl,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Mr)?we(T(this,Mr)):"null"}>`}get statusCode(){return T(this,_h)}get statusMessage(){return T(this,Fh)}get headers(){return Object.assign({},T(this,jh))}get body(){return T(this,Mr)==null?null:new Uint8Array(T(this,Mr))}get bodyText(){try{return T(this,Mr)==null?"":iu(T(this,Mr))}catch{ee(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{ee(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,t){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new wE(599,r,this.headers,this.body,T(this,_u)||void 0);return L(s,Pl,{message:e,error:t}),s}throwThrottleError(e,t){t==null?t=-1:z(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw Ne(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Mr)!=null}get request(){return T(this,_u)}ok(){return T(this,Pl).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=T(this,Pl);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Mr)&&(s=iu(T(this,Mr)))}catch{}ee(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};_h=new WeakMap,Fh=new WeakMap,jh=new WeakMap,Mr=new WeakMap,_u=new WeakMap,Pl=new WeakMap;let Fo=wE;function RP(){return new Date().getTime()}function nq(n){return Mi(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function rq(n){return new Promise(e=>setTimeout(e,n))}function sq(n){let e=n.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function PP(n,e,t){let r=0;for(let s=0;s<t;s++)r=r*256+n[e+s];return r}function DP(n,e,t,r){const s=[];for(;t<e+1+r;){const i=IP(n,t);s.push(i.result),t+=i.consumed,ee(t<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:e})}return{consumed:1+r,result:s}}function IP(n,e){ee(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const t=r=>{ee(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[e]>=248){const r=n[e]-247;t(e+1+r);const s=PP(n,e+1,r);return t(e+1+r+s),DP(n,e,e+1+r,r+s)}else if(n[e]>=192){const r=n[e]-192;return t(e+1+r),DP(n,e,e+1,r)}else if(n[e]>=184){const r=n[e]-183;t(e+1+r);const s=PP(n,e+1,r);t(e+1+r+s);const i=we(n.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(n[e]>=128){const r=n[e]-128;t(e+1+r);const s=we(n.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:sq(n[e])}}function ty(n){const e=ct(n,"data"),t=IP(e,0);return z(t.consumed===e.length,"unexpected junk after rlp payload","data",n),t.result}function LP(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function BP(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(i){r=r.concat(BP(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=LP(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(n,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=LP(e.length);return t.unshift(183+t.length),t.concat(e)}const _P="0123456789abcdef";function al(n){let e="0x";for(const t of BP(n))e+=_P[t>>4],e+=_P[t&15];return e}const $n=32,n1=new Uint8Array($n),iq=["then"],ny={},FP=new WeakMap;function ll(n){return FP.get(n)}function jP(n,e){FP.set(n,e)}function eh(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw t.error=e,t}function r1(n,e,t){return n.indexOf(null)>=0?e.map((r,s)=>r instanceof ou?r1(ll(r),r,t):r):n.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(t&&o instanceof ou&&(o=r1(ll(o),o,t)),r[s]=o),r},{})}const ju=class ju extends Array{constructor(...t){const r=t[0];let s=t[1],i=(t[2]||[]).slice(),o=!0;r!==ny&&(s=t,i=[],o=!1);super(s.length);J(this,Fu);s.forEach((c,u)=>{this[u]=c});const a=i.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(jP(this,Object.freeze(s.map((c,u)=>{const f=i[u];return f!=null&&a.get(f)===1?f:null}))),L(this,Fu,[]),T(this,Fu)==null&&T(this,Fu),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(c,u,f)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const h=Je(u,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=c[h];return p instanceof Error&&eh(`index ${h}`,p),p}if(iq.indexOf(u)>=0)return Reflect.get(c,u,f);const d=c[u];if(d instanceof Function)return function(...h){return d.apply(this===f?c:this,h)};if(!(u in c))return c.getValue.apply(this===f?c:this,[u])}return Reflect.get(c,u,f)}});return jP(l,ll(this)),l}toArray(t){const r=[];return this.forEach((s,i)=>{s instanceof Error&&eh(`index ${i}`,s),t&&s instanceof ju&&(s=s.toArray(t)),r.push(s)}),r}toObject(t){const r=ll(this);return r.reduce((s,i,o)=>(ee(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),r1(r,this,t)),{})}slice(t,r){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=ll(this),i=[],o=[];for(let a=t;a<r;a++)i.push(this[a]),o.push(s[a]);return new ju(ny,i,o)}filter(t,r){const s=ll(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&eh(`index ${a}`,l),t.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new ju(ny,i,o)}map(t,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&eh(`index ${i}`,o),s.push(t.call(r,o,i,this))}return s}getValue(t){const r=ll(this).indexOf(t);if(r===-1)return;const s=this[r];return s instanceof Error&&eh(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,r){return new ju(ny,t,r)}};Fu=new WeakMap;let ou=ju;function UP(n){let e=Hn(n);return ee(e.length<=$n,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:$n,offset:e.length}),e.length!==$n&&(e=Vn(zt([n1.slice(e.length%$n),e]))),e}class Ri{constructor(e,t,r,s){G(this,"name");G(this,"type");G(this,"localName");G(this,"dynamic");Ne(this,{name:e,type:t,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){z(!1,e,this.localName,t)}}class s1{constructor(){J(this,Uu);J(this,Qi);J(this,Dl);L(this,Qi,[]),L(this,Dl,0)}get data(){return zt(T(this,Qi))}get length(){return T(this,Dl)}appendWriter(e){return fe(this,Uu,y0).call(this,Vn(e.data))}writeBytes(e){let t=Vn(e);const r=t.length%$n;return r&&(t=Vn(zt([t,n1.slice(r)]))),fe(this,Uu,y0).call(this,t)}writeValue(e){return fe(this,Uu,y0).call(this,UP(e))}writeUpdatableValue(){const e=T(this,Qi).length;return T(this,Qi).push(n1),L(this,Dl,T(this,Dl)+$n),t=>{T(this,Qi)[e]=UP(t)}}}Qi=new WeakMap,Dl=new WeakMap,Uu=new WeakSet,y0=function(e){return T(this,Qi).push(e),L(this,Dl,T(this,Dl)+e.length),e.length};const AE=class AE{constructor(e,t,r){J(this,Bl);G(this,"allowLoose");J(this,cr);J(this,Rr);J(this,Il);J(this,Ll);J(this,ea);Ne(this,{allowLoose:!!t}),L(this,cr,Vn(e)),L(this,Il,0),L(this,Ll,null),L(this,ea,r??1024),L(this,Rr,0)}get data(){return we(T(this,cr))}get dataLength(){return T(this,cr).length}get consumed(){return T(this,Rr)}get bytes(){return new Uint8Array(T(this,cr))}subReader(e){const t=new AE(T(this,cr).slice(T(this,Rr)+e),this.allowLoose,T(this,ea));return L(t,Ll,this),t}readBytes(e,t){let r=fe(this,Bl,oF).call(this,0,e,!!t);return fe(this,Bl,NE).call(this,e),L(this,Rr,T(this,Rr)+r.length),r.slice(0,e)}readValue(){return e1(this.readBytes($n))}readIndex(){return HJ(this.readBytes($n))}};cr=new WeakMap,Rr=new WeakMap,Il=new WeakMap,Ll=new WeakMap,ea=new WeakMap,Bl=new WeakSet,NE=function(e){var t;if(T(this,Ll))return fe(t=T(this,Ll),Bl,NE).call(t,e);L(this,Il,T(this,Il)+e),ee(T(this,ea)<1||T(this,Il)<=T(this,ea)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ea)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),offset:T(this,Rr),length:e,info:{bytesRead:T(this,Il),dataLength:this.dataLength}})},oF=function(e,t,r){let s=Math.ceil(t/$n)*$n;return T(this,Rr)+s>T(this,cr).length&&(this.allowLoose&&r&&T(this,Rr)+t<=T(this,cr).length?s=t:ee(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),length:T(this,cr).length,offset:T(this,Rr)+s})),T(this,cr).slice(T(this,Rr),T(this,Rr)+s)};let i1=AE;function ry(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function o1(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function oq(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ry(n.outputLen),ry(n.blockLen)}function au(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function VP(n,e){o1(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const a1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const HP=n=>n instanceof Uint8Array,aq=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),l1=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Xs=(n,e)=>n<<32-e|n>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function lq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function sy(n){if(typeof n=="string"&&(n=lq(n)),!HP(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function cq(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!HP(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}class c1{clone(){return this._cloneInto()}}function u1(n){const e=r=>n().update(sy(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function uq(n=32){if(a1&&typeof a1.getRandomValues=="function")return a1.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class zP extends c1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,oq(e);const r=sy(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return au(this),this.iHash.update(e),this}digestInto(e){au(this),o1(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const $P=(n,e,t)=>new zP(n,e).update(t).digest();$P.create=(n,e)=>new zP(n,e);function fq(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),l=r?4:0,c=r?0:4;n.setUint32(e+l,o,r),n.setUint32(e+c,a,r)}class GP extends c1{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=l1(this.buffer)}update(e){au(this);const{view:t,buffer:r,blockLen:s}=this;e=sy(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const l=l1(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){au(this),VP(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)t[f]=0;fq(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=l1(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(r),e}}const dq=(n,e,t)=>n&e^~n&t,hq=(n,e,t)=>n&e^n&t^e&t,pq=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),jo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Uo=new Uint32Array(64);class mq extends GP{constructor(){super(64,32,8,!1),this.A=jo[0]|0,this.B=jo[1]|0,this.C=jo[2]|0,this.D=jo[3]|0,this.E=jo[4]|0,this.F=jo[5]|0,this.G=jo[6]|0,this.H=jo[7]|0}get(){const{A:e,B:t,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,t,r,s,i,o,a,l]}set(e,t,r,s,i,o,a,l){this.A=e|0,this.B=t|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let f=0;f<16;f++,t+=4)Uo[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){const d=Uo[f-15],h=Uo[f-2],p=Xs(d,7)^Xs(d,18)^d>>>3,m=Xs(h,17)^Xs(h,19)^h>>>10;Uo[f]=m+Uo[f-7]+p+Uo[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const d=Xs(a,6)^Xs(a,11)^Xs(a,25),h=u+d+dq(a,l,c)+pq[f]+Uo[f]|0,m=(Xs(r,2)^Xs(r,13)^Xs(r,22))+hq(r,s,i)|0;u=c,c=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,l,c,u)}roundClean(){Uo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const WP=u1(()=>new mq),iy=BigInt(2**32-1),f1=BigInt(32);function KP(n,e=!1){return e?{h:Number(n&iy),l:Number(n>>f1&iy)}:{h:Number(n>>f1&iy)|0,l:Number(n&iy)|0}}function QP(n,e=!1){let t=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let s=0;s<n.length;s++){const{h:i,l:o}=KP(n[s],e);[t[s],r[s]]=[i,o]}return[t,r]}const gq=(n,e)=>BigInt(n>>>0)<<f1|BigInt(e>>>0),yq=(n,e,t)=>n>>>t,bq=(n,e,t)=>n<<32-t|e>>>t,wq=(n,e,t)=>n>>>t|e<<32-t,Aq=(n,e,t)=>n<<32-t|e>>>t,vq=(n,e,t)=>n<<64-t|e>>>t-32,xq=(n,e,t)=>n>>>t-32|e<<64-t,Eq=(n,e)=>e,Cq=(n,e)=>n,JP=(n,e,t)=>n<<t|e>>>32-t,qP=(n,e,t)=>e<<t|n>>>32-t,YP=(n,e,t)=>e<<t-32|n>>>64-t,XP=(n,e,t)=>n<<t-32|e>>>64-t;function kq(n,e,t,r){const s=(e>>>0)+(r>>>0);return{h:n+t+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:KP,split:QP,toBig:gq,shrSH:yq,shrSL:bq,rotrSH:wq,rotrSL:Aq,rotrBH:vq,rotrBL:xq,rotr32H:Eq,rotr32L:Cq,rotlSH:JP,rotlSL:qP,rotlBH:YP,rotlBL:XP,add:kq,add3L:(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),add3H:(n,e,t,r)=>e+t+r+(n/2**32|0)|0,add4L:(n,e,t,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0),add4H:(n,e,t,r,s)=>e+t+r+s+(n/2**32|0)|0,add5H:(n,e,t,r,s,i)=>e+t+r+s+i+(n/2**32|0)|0,add5L:(n,e,t,r,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)},[Sq,Tq]=Ze.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Vo=new Uint32Array(80),Ho=new Uint32Array(80);class Oq extends GP{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:y}=this;return[e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y]}set(e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=y|0}process(e,t){for(let A=0;A<16;A++,t+=4)Vo[A]=e.getUint32(t),Ho[A]=e.getUint32(t+=4);for(let A=16;A<80;A++){const w=Vo[A-15]|0,x=Ho[A-15]|0,C=Ze.rotrSH(w,x,1)^Ze.rotrSH(w,x,8)^Ze.shrSH(w,x,7),S=Ze.rotrSL(w,x,1)^Ze.rotrSL(w,x,8)^Ze.shrSL(w,x,7),M=Vo[A-2]|0,O=Ho[A-2]|0,R=Ze.rotrSH(M,O,19)^Ze.rotrBH(M,O,61)^Ze.shrSH(M,O,6),D=Ze.rotrSL(M,O,19)^Ze.rotrBL(M,O,61)^Ze.shrSL(M,O,6),_=Ze.add4L(S,D,Ho[A-7],Ho[A-16]),U=Ze.add4H(_,C,R,Vo[A-7],Vo[A-16]);Vo[A]=U|0,Ho[A]=_|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:y,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=Ze.rotrSH(f,d,14)^Ze.rotrSH(f,d,18)^Ze.rotrBH(f,d,41),x=Ze.rotrSL(f,d,14)^Ze.rotrSL(f,d,18)^Ze.rotrBL(f,d,41),C=f&h^~f&m,S=d&p^~d&y,M=Ze.add5L(v,x,S,Tq[A],Ho[A]),O=Ze.add5H(M,b,w,C,Sq[A],Vo[A]),R=M|0,D=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),_=Ze.rotrSL(r,s,28)^Ze.rotrBL(r,s,34)^Ze.rotrBL(r,s,39),U=r&i^r&a^i&a,K=s&o^s&l^o&l;b=m|0,v=y|0,m=h|0,y=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(c|0,u|0,O|0,R|0),c=a|0,u=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(R,_,K);r=Ze.add3H(B,O,D,U),s=B|0}({h:r,l:s}=Ze.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ze.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=Ze.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=Ze.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:f,l:d}=Ze.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=Ze.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:y}=Ze.add(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:v}=Ze.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,c,u,f,d,h,p,m,y,b,v)}roundClean(){Vo.fill(0),Ho.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Nq=u1(()=>new Oq);function Mq(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const ZP=Mq();ZP.crypto||ZP.msCrypto;function Rq(n){switch(n){case"sha256":return WP.create();case"sha512":return Nq.create()}z(!1,"invalid hashing algorithm name","algorithm",n)}const[eD,tD,nD]=[[],[],[]],Pq=BigInt(0),th=BigInt(1),Dq=BigInt(2),Iq=BigInt(7),Lq=BigInt(256),Bq=BigInt(113);for(let n=0,e=th,t=1,r=0;n<24;n++){[t,r]=[r,(2*t+3*r)%5],eD.push(2*(5*r+t)),tD.push((n+1)*(n+2)/2%64);let s=Pq;for(let i=0;i<7;i++)e=(e<<th^(e>>Iq)*Bq)%Lq,e&Dq&&(s^=th<<(th<<BigInt(i))-th);nD.push(s)}const[_q,Fq]=QP(nD,!0),rD=(n,e,t)=>t>32?YP(n,e,t):JP(n,e,t),sD=(n,e,t)=>t>32?XP(n,e,t):qP(n,e,t);function jq(n,e=24){const t=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],f=rD(c,u,1)^t[a],d=sD(c,u,1)^t[a+1];for(let h=0;h<50;h+=10)n[o+h]^=f,n[o+h+1]^=d}let s=n[2],i=n[3];for(let o=0;o<24;o++){const a=tD[o],l=rD(s,i,a),c=sD(s,i,a),u=eD[o];s=n[u],i=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=_q[r],n[1]^=Fq[r]}t.fill(0)}class d1 extends c1{constructor(e,t,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ry(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=aq(this.state)}keccak(){jq(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){au(this);const{blockLen:t,state:r}=this;e=sy(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(t-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:s}=this;e[r]^=t,t&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){au(this,!1),o1(e),this.finish();const t=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(t.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ry(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(VP(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new d1(t,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Uq=((n,e,t)=>u1(()=>new d1(e,n,t)))(1,136,256/8);let iD=!1;const oD=function(n){return Uq(n)};let aD=oD;function Xt(n){const e=ct(n,"data");return we(aD(e))}Xt._=oD,Xt.lock=function(){iD=!0},Xt.register=function(n){if(iD)throw new TypeError("keccak256 is locked");aD=n},Object.freeze(Xt);const lD=function(n){return Rq("sha256").update(n).digest()};let cD=lD,uD=!1;function lu(n){const e=ct(n,"data");return we(cD(e))}lu._=lD,lu.lock=function(){uD=!0},lu.register=function(n){if(uD)throw new Error("sha256 is locked");cD=n},Object.freeze(lu),Object.freeze(lu);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fD=BigInt(0),oy=BigInt(1),Vq=BigInt(2),ay=n=>n instanceof Uint8Array,Hq=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function cu(n){if(!ay(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Hq[n[t]];return e}function dD(n){const e=n.toString(16);return e.length&1?`0${e}`:e}function h1(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function uu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let r=0;r<t.length;r++){const s=r*2,i=n.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function cl(n){return h1(cu(n))}function p1(n){if(!ay(n))throw new Error("Uint8Array expected");return h1(cu(Uint8Array.from(n).reverse()))}function fu(n,e){return uu(n.toString(16).padStart(e*2,"0"))}function m1(n,e){return fu(n,e).reverse()}function zq(n){return uu(dD(n))}function bs(n,e,t){let r;if(typeof e=="string")try{r=uu(e)}catch(i){throw new Error(`${n} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ay(e))r=Uint8Array.from(e);else throw new Error(`${n} must be hex string or Uint8Array`);const s=r.length;if(typeof t=="number"&&s!==t)throw new Error(`${n} expected ${t} bytes, got ${s}`);return r}function nh(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!ay(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}function $q(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Gq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Wq(n){let e;for(e=0;n>fD;n>>=oy,e+=1);return e}function Kq(n,e){return n>>BigInt(e)&oy}const Qq=(n,e,t)=>n|(t?oy:fD)<<BigInt(e),g1=n=>(Vq<<BigInt(n-1))-oy,y1=n=>new Uint8Array(n),hD=n=>Uint8Array.from(n);function pD(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=y1(n),s=y1(n),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>t(s,r,...f),l=(f=y1())=>{s=a(hD([0]),f),r=a(),f.length!==0&&(s=a(hD([1]),f),r=a())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(c()));)l();return o(),h}}const Jq={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function rh(n,e,t={}){const r=(s,i,o)=>{const a=Jq[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=n[s];if(!(o&&l===void 0)&&!a(l,n))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(t))r(s,i,!0);return n}const qq=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Kq,bitLen:Wq,bitMask:g1,bitSet:Qq,bytesToHex:cu,bytesToNumberBE:cl,bytesToNumberLE:p1,concatBytes:nh,createHmacDrbg:pD,ensureBytes:bs,equalBytes:$q,hexToBytes:uu,hexToNumber:h1,numberToBytesBE:fu,numberToBytesLE:m1,numberToHexUnpadded:dD,numberToVarBytesBE:zq,utf8ToBytes:Gq,validateObject:rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hn=BigInt(0),$t=BigInt(1),ul=BigInt(2),Yq=BigInt(3),b1=BigInt(4),mD=BigInt(5),gD=BigInt(8);BigInt(9),BigInt(16);function or(n,e){const t=n%e;return t>=hn?t:e+t}function Xq(n,e,t){if(t<=hn||e<hn)throw new Error("Expected power/modulo > 0");if(t===$t)return hn;let r=$t;for(;e>hn;)e&$t&&(r=r*n%t),n=n*n%t,e>>=$t;return r}function Wr(n,e,t){let r=n;for(;e-- >hn;)r*=r,r%=t;return r}function w1(n,e){if(n===hn||e<=hn)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=or(n,e),r=e,s=hn,i=$t;for(;t!==hn;){const a=r/t,l=r%t,c=s-i*a;r=t,t=l,s=i,i=c}if(r!==$t)throw new Error("invert: does not exist");return or(s,e)}function Zq(n){const e=(n-$t)/ul;let t,r,s;for(t=n-$t,r=0;t%ul===hn;t/=ul,r++);for(s=ul;s<n&&Xq(s,e,n)!==n-$t;s++);if(r===1){const o=(n+$t)/b1;return function(l,c){const u=l.pow(c,o);if(!l.eql(l.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(t+$t)/ul;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=r,u=a.pow(a.mul(a.ONE,s),t),f=a.pow(l,i),d=a.pow(l,t);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<c&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(u,$t<<BigInt(c-h-1));u=a.sqr(p),f=a.mul(f,p),d=a.mul(d,u),c=h}return f}}function eY(n){if(n%b1===Yq){const e=(n+$t)/b1;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(n%gD===mD){const e=(n-mD)/gD;return function(r,s){const i=r.mul(s,ul),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,ul),o),c=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(c),s))throw new Error("Cannot find square root");return c}}return Zq(n)}const tY=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nY(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=tY.reduce((r,s)=>(r[s]="function",r),e);return rh(n,t)}function rY(n,e,t){if(t<hn)throw new Error("Expected power > 0");if(t===hn)return n.ONE;if(t===$t)return e;let r=n.ONE,s=e;for(;t>hn;)t&$t&&(r=n.mul(r,s)),s=n.sqr(s),t>>=$t;return r}function sY(n,e){const t=new Array(e.length),r=e.reduce((i,o,a)=>n.is0(o)?i:(t[a]=i,n.mul(i,o)),n.ONE),s=n.inv(r);return e.reduceRight((i,o,a)=>n.is0(o)?i:(t[a]=n.mul(i,t[a]),n.mul(i,o)),s),t}function yD(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function iY(n,e,t=!1,r={}){if(n<=hn)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:s,nByteLength:i}=yD(n,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=eY(n),a=Object.freeze({ORDER:n,BITS:s,BYTES:i,MASK:g1(s),ZERO:hn,ONE:$t,create:l=>or(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return hn<=l&&l<n},is0:l=>l===hn,isOdd:l=>(l&$t)===$t,neg:l=>or(-l,n),eql:(l,c)=>l===c,sqr:l=>or(l*l,n),add:(l,c)=>or(l+c,n),sub:(l,c)=>or(l-c,n),mul:(l,c)=>or(l*c,n),pow:(l,c)=>rY(a,l,c),div:(l,c)=>or(l*w1(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>w1(l,n),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>sY(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?m1(l,i):fu(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return t?p1(l):cl(l)}});return Object.freeze(a)}function bD(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function wD(n){const e=bD(n);return e+Math.ceil(e/2)}function oY(n,e,t=!1){const r=n.length,s=bD(e),i=wD(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=t?cl(n):p1(n),a=or(o,e-$t)+$t;return t?m1(a,s):fu(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const aY=BigInt(0),A1=BigInt(1);function lY(n,e){const t=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:t,unsafeLadder(s,i){let o=n.ZERO,a=s;for(;i>aY;)i&A1&&(o=o.add(a)),a=a.double(),i>>=A1;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let c=s,u=c;for(let f=0;f<o;f++){u=c,l.push(u);for(let d=1;d<a;d++)u=u.add(c),l.push(u);c=u.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let c=n.ZERO,u=n.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let y=Number(o&f);o>>=h,y>l&&(y-=d,o+=A1);const b=m,v=m+Math.abs(y)-1,A=p%2!==0,w=y<0;y===0?u=u.add(t(A,i[b])):c=c.add(t(w,i[v]))}return{p:c,f:u}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let c=i.get(s);return c||(c=this.precomputeWindow(s,l),l!==1&&i.set(s,a(c))),this.wNAF(l,c,o)}}}function AD(n){return nY(n.Fp),rh(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yD(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function cY(n){const e=AD(n);rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=e;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:uY,hexToBytes:fY}=qq,fl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=fl;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],r=n.subarray(2,t+2);if(!t||r.length!==t)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:uY(r),l:n.subarray(t+2)}},toSig(n){const{Err:e}=fl,t=typeof n=="string"?fY(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=fl._parseInt(t.subarray(2)),{d:o,l:a}=fl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(n){const e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},r=e(t(n.s)),s=e(t(n.r)),i=r.length/2,o=s.length/2,a=t(i),l=t(o);return`30${t(o+i+4)}02${l}${s}02${a}${r}`}},Pi=BigInt(0),Kr=BigInt(1);BigInt(2);const vD=BigInt(3);BigInt(4);function dY(n){const e=cY(n),{Fp:t}=e,r=e.toBytes||((p,m,y)=>{const b=m.toAffine();return nh(Uint8Array.from([4]),t.toBytes(b.x),t.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),y=t.fromBytes(m.subarray(0,t.BYTES)),b=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:y,y:b}});function i(p){const{a:m,b:y}=e,b=t.sqr(p),v=t.mul(b,p);return t.add(t.add(v,t.mul(p,m)),y)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&Pi<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:y,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=cu(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(y*2,"0")}let A;try{A=typeof p=="bigint"?p:cl(bs("private key",p,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=or(A,v)),a(A),A}const c=new Map;function u(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,y,b){if(this.px=m,this.py=y,this.pz=b,m==null||!t.isValid(m))throw new Error("x required");if(y==null||!t.isValid(y))throw new Error("y required");if(b==null||!t.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:y,y:b}=m||{};if(!m||!t.isValid(y)||!t.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>t.eql(A,t.ZERO);return v(y)&&v(b)?f.ZERO:new f(y,b,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const y=t.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(y[v])).map(f.fromAffine)}static fromHex(m){const y=f.fromAffine(s(bs("pointHex",m)));return y.assertValidity(),y}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y}=this.toAffine();if(!t.isValid(m)||!t.isValid(y))throw new Error("bad point: x or y not FE");const b=t.sqr(y),v=i(m);if(!t.eql(b,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,C=t.eql(t.mul(y,x),t.mul(A,v)),S=t.eql(t.mul(b,x),t.mul(w,v));return C&&S}negate(){return new f(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:y}=e,b=t.mul(y,vD),{px:v,py:A,pz:w}=this;let x=t.ZERO,C=t.ZERO,S=t.ZERO,M=t.mul(v,v),O=t.mul(A,A),R=t.mul(w,w),D=t.mul(v,A);return D=t.add(D,D),S=t.mul(v,w),S=t.add(S,S),x=t.mul(m,S),C=t.mul(b,R),C=t.add(x,C),x=t.sub(O,C),C=t.add(O,C),C=t.mul(x,C),x=t.mul(D,x),S=t.mul(b,S),R=t.mul(m,R),D=t.sub(M,R),D=t.mul(m,D),D=t.add(D,S),S=t.add(M,M),M=t.add(S,M),M=t.add(M,R),M=t.mul(M,D),C=t.add(C,M),R=t.mul(A,w),R=t.add(R,R),M=t.mul(R,D),x=t.sub(x,M),S=t.mul(R,O),S=t.add(S,S),S=t.add(S,S),new f(x,C,S)}add(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let C=t.ZERO,S=t.ZERO,M=t.ZERO;const O=e.a,R=t.mul(e.b,vD);let D=t.mul(y,A),_=t.mul(b,w),U=t.mul(v,x),K=t.add(y,b),B=t.add(A,w);K=t.mul(K,B),B=t.add(D,_),K=t.sub(K,B),B=t.add(y,v);let $=t.add(A,x);return B=t.mul(B,$),$=t.add(D,U),B=t.sub(B,$),$=t.add(b,v),C=t.add(w,x),$=t.mul($,C),C=t.add(_,U),$=t.sub($,C),M=t.mul(O,B),C=t.mul(R,U),M=t.add(C,M),C=t.sub(_,M),M=t.add(_,M),S=t.mul(C,M),_=t.add(D,D),_=t.add(_,D),U=t.mul(O,U),B=t.mul(R,B),_=t.add(_,U),U=t.sub(D,U),U=t.mul(O,U),B=t.add(B,U),D=t.mul(_,B),S=t.add(S,D),D=t.mul($,B),C=t.mul(K,C),C=t.sub(C,D),D=t.mul(K,_),M=t.mul($,M),M=t.add(M,D),new f(C,S,M)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,c,m,y=>{const b=t.invertBatch(y.map(v=>v.pz));return y.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const y=f.ZERO;if(m===Pi)return y;if(a(m),m===Kr)return this;const{endo:b}=e;if(!b)return h.unsafeLadder(this,m);let{k1neg:v,k1:A,k2neg:w,k2:x}=b.splitScalar(m),C=y,S=y,M=this;for(;A>Pi||x>Pi;)A&Kr&&(C=C.add(M)),x&Kr&&(S=S.add(M)),M=M.double(),A>>=Kr,x>>=Kr;return v&&(C=C.negate()),w&&(S=S.negate()),S=new f(t.mul(S.px,b.beta),S.py,S.pz),C.add(S)}multiply(m){a(m);let y=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:C,k2:S}=A.splitScalar(y);let{p:M,f:O}=this.wNAF(x),{p:R,f:D}=this.wNAF(S);M=h.constTimeNegate(w,M),R=h.constTimeNegate(C,R),R=new f(t.mul(R.px,A.beta),R.py,R.pz),b=M.add(R),v=O.add(D)}else{const{p:w,f:x}=this.wNAF(y);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,y,b){const v=f.BASE,A=(x,C)=>C===Pi||C===Kr||!x.equals(v)?x.multiplyUnsafe(C):x.multiply(C),w=A(this,y).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:y,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?t.ONE:t.inv(v));const w=t.mul(y,m),x=t.mul(b,m),C=t.mul(v,m);if(A)return{x:t.ZERO,y:t.ZERO};if(!t.eql(C,t.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:y}=e;if(m===Kr)return!0;if(y)return y(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:y}=e;return m===Kr?this:y?y(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return cu(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,t.ONE),f.ZERO=new f(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,h=lY(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function hY(n){const e=AD(n);return rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function pY(n){const e=hY(n),{Fp:t,n:r}=e,s=t.BYTES+1,i=2*t.BYTES+1;function o(B){return Pi<B&&B<t.ORDER}function a(B){return or(B,r)}function l(B){return w1(B,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:f,isWithinCurveOrder:d}=dY({...e,toBytes(B,$,q){const ne=$.toAffine(),Z=t.toBytes(ne.x),me=nh;return q?me(Uint8Array.from([$.hasEvenY()?2:3]),Z):me(Uint8Array.from([4]),Z,t.toBytes(ne.y))},fromBytes(B){const $=B.length,q=B[0],ne=B.subarray(1);if($===s&&(q===2||q===3)){const Z=cl(ne);if(!o(Z))throw new Error("Point is not on curve");const me=f(Z);let Ce=t.sqrt(me);const De=(Ce&Kr)===Kr;return(q&1)===1!==De&&(Ce=t.neg(Ce)),{x:Z,y:Ce}}else if($===i&&q===4){const Z=t.fromBytes(ne.subarray(0,t.BYTES)),me=t.fromBytes(ne.subarray(t.BYTES,2*t.BYTES));return{x:Z,y:me}}else throw new Error(`Point of length ${$} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>cu(fu(B,e.nByteLength));function p(B){const $=r>>Kr;return B>$}function m(B){return p(B)?a(-B):B}const y=(B,$,q)=>cl(B.slice($,q));class b{constructor($,q,ne){this.r=$,this.s=q,this.recovery=ne,this.assertValidity()}static fromCompact($){const q=e.nByteLength;return $=bs("compactSignature",$,q*2),new b(y($,0,q),y($,q,2*q))}static fromDER($){const{r:q,s:ne}=fl.toSig(bs("DER",$));return new b(q,ne)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit($){return new b(this.r,this.s,$)}recoverPublicKey($){const{r:q,s:ne,recovery:Z}=this,me=S(bs("msgHash",$));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const Ce=Z===2||Z===3?q+e.n:q;if(Ce>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const De=Z&1?"03":"02",ke=c.fromHex(De+h(Ce)),Ee=l(Ce),Ve=a(-me*Ee),je=a(ne*Ee),He=c.BASE.multiplyAndAddUnsafe(ke,Ve,je);if(!He)throw new Error("point at infinify");return He.assertValidity(),He}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return uu(this.toDERHex())}toDERHex(){return fl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return uu(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return u(B),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const B=wD(e.n);return oY(e.randomBytes(B),e.n)},precompute(B=8,$=c.BASE){return $._setWindowSize(B),$.multiply(BigInt(3)),$}};function A(B,$=!0){return c.fromPrivateKey(B).toRawBytes($)}function w(B){const $=B instanceof Uint8Array,q=typeof B=="string",ne=($||q)&&B.length;return $?ne===s||ne===i:q?ne===2*s||ne===2*i:B instanceof c}function x(B,$,q=!0){if(w(B))throw new Error("first arg must be private key");if(!w($))throw new Error("second arg must be public key");return c.fromHex($).multiply(u(B)).toRawBytes(q)}const C=e.bits2int||function(B){const $=cl(B),q=B.length*8-e.nBitLength;return q>0?$>>BigInt(q):$},S=e.bits2int_modN||function(B){return a(C(B))},M=g1(e.nBitLength);function O(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(Pi<=B&&B<M))throw new Error(`bigint expected < 2^${e.nBitLength}`);return fu(B,e.nByteLength)}function R(B,$,q=D){if(["recovered","canonical"].some(et=>et in q))throw new Error("sign() legacy options not supported");const{hash:ne,randomBytes:Z}=e;let{lowS:me,prehash:Ce,extraEntropy:De}=q;me==null&&(me=!0),B=bs("msgHash",B),Ce&&(B=bs("prehashed msgHash",ne(B)));const ke=S(B),Ee=u($),Ve=[O(Ee),O(ke)];if(De!=null){const et=De===!0?Z(t.BYTES):De;Ve.push(bs("extraEntropy",et))}const je=nh(...Ve),He=ke;function Be(et){const le=C(et);if(!d(le))return;const ze=l(le),ae=c.BASE.multiply(le).toAffine(),be=a(ae.x);if(be===Pi)return;const _e=a(ze*a(He+be*Ee));if(_e===Pi)return;let H=(ae.x===be?0:2)|Number(ae.y&Kr),Q=_e;return me&&p(_e)&&(Q=m(_e),H^=1),new b(be,Q,H)}return{seed:je,k2sig:Be}}const D={lowS:e.lowS,prehash:!1},_={lowS:e.lowS,prehash:!1};function U(B,$,q=D){const{seed:ne,k2sig:Z}=R(B,$,q),me=e;return pD(me.hash.outputLen,me.nByteLength,me.hmac)(ne,Z)}c.BASE._setWindowSize(8);function K(B,$,q,ne=_){var ae;const Z=B;if($=bs("msgHash",$),q=bs("publicKey",q),"strict"in ne)throw new Error("options.strict was renamed to lowS");const{lowS:me,prehash:Ce}=ne;let De,ke;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{De=b.fromDER(Z)}catch(be){if(!(be instanceof fl.Err))throw be;De=b.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:be,s:_e}=Z;De=new b(be,_e)}else throw new Error("PARSE");ke=c.fromHex(q)}catch(be){if(be.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(me&&De.hasHighS())return!1;Ce&&($=e.hash($));const{r:Ee,s:Ve}=De,je=S($),He=l(Ve),Be=a(je*He),et=a(Ee*He),le=(ae=c.BASE.multiplyAndAddUnsafe(ke,Be,et))==null?void 0:ae.toAffine();return le?a(le.x)===Ee:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:U,verify:K,ProjectivePoint:c,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function mY(n){return{hash:n,hmac:(e,...t)=>$P(n,e,cq(...t)),randomBytes:uq}}function gY(n,e){const t=r=>pY({...n,...mY(r)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xD=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ED=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yY=BigInt(1),v1=BigInt(2),CD=(n,e)=>(n+e/v1)/e;function bY(n){const e=xD,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,f=Wr(u,t,e)*u%e,d=Wr(f,t,e)*u%e,h=Wr(d,v1,e)*c%e,p=Wr(h,s,e)*h%e,m=Wr(p,i,e)*p%e,y=Wr(m,a,e)*m%e,b=Wr(y,l,e)*y%e,v=Wr(b,a,e)*m%e,A=Wr(v,t,e)*u%e,w=Wr(A,o,e)*p%e,x=Wr(w,r,e)*c%e,C=Wr(x,v1,e);if(!x1.eql(x1.sqr(C),n))throw new Error("Cannot find square root");return C}const x1=iY(xD,void 0,void 0,{sqrt:bY}),zo=gY({a:BigInt(0),b:BigInt(7),Fp:x1,n:ED,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=ED,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-yY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,o=BigInt("0x100000000000000000000000000000000"),a=CD(i*n,e),l=CD(-r*n,e);let c=or(n-a*t-l*s,e),u=or(-a*r-l*i,e);const f=c>o,d=u>o;if(f&&(c=e-c),d&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:c,k2neg:d,k2:u}}}},WP);BigInt(0),zo.ProjectivePoint;const sh="0x0000000000000000000000000000000000000000",kD="0x0000000000000000000000000000000000000000000000000000000000000000",SD=BigInt(0),TD=BigInt(1),OD=BigInt(2),ND=BigInt(27),MD=BigInt(28),ly=BigInt(35),du={};function RD(n){return il(Hn(n),32)}const Cs=class Cs{constructor(e,t,r,s){J(this,Vu);J(this,Hu);J(this,zu);J(this,_l);qg(e,du,"Signature"),L(this,Vu,t),L(this,Hu,r),L(this,zu,s),L(this,_l,null)}get r(){return T(this,Vu)}set r(e){z(ru(e)===32,"invalid r","value",e),L(this,Vu,we(e))}get s(){return T(this,Hu)}set s(e){z(ru(e)===32,"invalid s","value",e);const t=we(e);z(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),L(this,Hu,t)}get v(){return T(this,zu)}set v(e){const t=Je(e,"value");z(t===27||t===28,"invalid v","v",e),L(this,zu,t)}get networkV(){return T(this,_l)}get legacyChainId(){const e=this.networkV;return e==null?null:Cs.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),we(e)}get compactSerialized(){return zt([this.r,this.yParityAndS])}get serialized(){return zt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Cs(du,this.r,this.s,this.v);return this.networkV&&L(e,_l,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const t=xe(e,"v");return t==ND||t==MD?SD:(z(t>=ly,"invalid EIP-155 v","v",e),(t-ly)/OD)}static getChainIdV(e,t){return xe(e)*OD+BigInt(35+t-27)}static getNormalizedV(e){const t=xe(e);return t===SD||t===ND?27:t===TD||t===MD?28:(z(t>=ly,"invalid v","v",e),t&TD?27:28)}static from(e){function t(c,u){z(c,u,"signature",e)}if(e==null)return new Cs(du,kD,kD,27);if(typeof e=="string"){const c=ct(e,"signature");if(c.length===64){const u=we(c.slice(0,32)),f=c.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Cs(du,u,we(f),d)}if(c.length===65){const u=we(c.slice(0,32)),f=c.slice(32,64);t((f[0]&128)===0,"non-canonical s");const d=Cs.getNormalizedV(c[64]);return new Cs(du,u,we(f),d)}t(!1,"invalid raw signature length")}if(e instanceof Cs)return e.clone();const r=e.r;t(r!=null,"missing r");const s=RD(r),i=function(c,u){if(c!=null)return RD(c);if(u!=null){t(Ct(u,32),"invalid yParityAndS");const f=ct(u);return f[0]&=127,we(f)}t(!1,"missing s")}(e.s,e.yParityAndS);t((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(c,u,f){if(c!=null){const d=xe(c);return{networkV:d>=ly?d:void 0,v:Cs.getNormalizedV(d)}}if(u!=null)return t(Ct(u,32),"invalid yParityAndS"),{v:ct(u)[0]&128?28:27};if(f!=null){switch(Je(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Cs(du,s,i,a);return o&&L(l,_l,o),t(e.yParity==null||Je(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};Vu=new WeakMap,Hu=new WeakMap,zu=new WeakMap,_l=new WeakMap;let ws=Cs;const Fl=class Fl{constructor(e){J(this,Ji);z(ru(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,Ji,we(e))}get privateKey(){return T(this,Ji)}get publicKey(){return Fl.computePublicKey(T(this,Ji))}get compressedPublicKey(){return Fl.computePublicKey(T(this,Ji),!0)}sign(e){z(ru(e)===32,"invalid digest length","digest",e);const t=zo.sign(Vn(e),Vn(T(this,Ji)),{lowS:!0});return ws.from({r:_o(t.r,32),s:_o(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Fl.computePublicKey(e);return we(zo.getSharedSecret(Vn(T(this,Ji)),ct(t),!1))}static computePublicKey(e,t){let r=ct(e,"key");if(r.length===32){const i=zo.getPublicKey(r,!!t);return we(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=zo.ProjectivePoint.fromHex(r);return we(s.toRawBytes(t))}static recoverPublicKey(e,t){z(ru(e)===32,"invalid digest length","digest",e);const r=ws.from(t);let s=zo.Signature.fromCompact(Vn(zt([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Vn(e));return z(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(e,t,r){const s=zo.ProjectivePoint.fromHex(Fl.computePublicKey(e).substring(2)),i=zo.ProjectivePoint.fromHex(Fl.computePublicKey(t).substring(2));return"0x"+s.add(i).toHex(!!r)}};Ji=new WeakMap;let ih=Fl;const wY=BigInt(0),AY=BigInt(36);function PD(n){n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const r=ct(Xt(t));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const E1={};for(let n=0;n<10;n++)E1[String(n)]=String(n);for(let n=0;n<26;n++)E1[String.fromCharCode(65+n)]=String(10+n);const DD=15;function vY(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>E1[r]).join("");for(;e.length>=DD;){let r=e.substring(0,DD);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const xY=function(){const n={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];n[t]=BigInt(e)}return n}();function EY(n){n=n.toLowerCase();let e=wY;for(let t=0;t<n.length;t++)e=e*AY+xY[n[t]];return e}function pt(n){if(z(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const e=PD(n);return z(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===n,"bad address checksum","address",n),e}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){z(n.substring(2,4)===vY(n),"bad icap checksum","address",n);let e=EY(n.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return PD("0x"+e)}z(!1,"invalid address","address",n)}function CY(n){const e=pt(n.from);let r=xe(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,pt(Vt(Xt(al([e,r])),12))}function ID(n){return n&&typeof n.getAddress=="function"}function kY(n){try{return pt(n),!0}catch{}return!1}async function C1(n,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(ee(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),z(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),pt(t)}function Gn(n,e){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?pt(n):(ee(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),C1(n,e.resolveName(n)));if(ID(n))return C1(n,n.getAddress());if(n&&typeof n.then=="function")return C1(n,n);z(!1,"unsupported addressable value","target",n)}const Di={};function Ae(n,e){let t=!1;return e<0&&(t=!0,e*=-1),new Nn(Di,`${t?"":"u"}int${e}`,n,{signed:t,width:e})}function ft(n,e){return new Nn(Di,`bytes${e||""}`,n,{size:e})}const LD=Symbol.for("_ethers_typed"),qi=class qi{constructor(e,t,r,s){G(this,"type");G(this,"value");J(this,jl);G(this,"_typedSymbol");s==null&&(s=null),qg(Di,e,"Typed"),Ne(this,{_typedSymbol:LD,type:t,value:r}),L(this,jl,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,jl)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,jl)===!0?-1:T(this,jl)===!1?this.value.length:null}static from(e,t){return new qi(Di,e,t)}static uint8(e){return Ae(e,8)}static uint16(e){return Ae(e,16)}static uint24(e){return Ae(e,24)}static uint32(e){return Ae(e,32)}static uint40(e){return Ae(e,40)}static uint48(e){return Ae(e,48)}static uint56(e){return Ae(e,56)}static uint64(e){return Ae(e,64)}static uint72(e){return Ae(e,72)}static uint80(e){return Ae(e,80)}static uint88(e){return Ae(e,88)}static uint96(e){return Ae(e,96)}static uint104(e){return Ae(e,104)}static uint112(e){return Ae(e,112)}static uint120(e){return Ae(e,120)}static uint128(e){return Ae(e,128)}static uint136(e){return Ae(e,136)}static uint144(e){return Ae(e,144)}static uint152(e){return Ae(e,152)}static uint160(e){return Ae(e,160)}static uint168(e){return Ae(e,168)}static uint176(e){return Ae(e,176)}static uint184(e){return Ae(e,184)}static uint192(e){return Ae(e,192)}static uint200(e){return Ae(e,200)}static uint208(e){return Ae(e,208)}static uint216(e){return Ae(e,216)}static uint224(e){return Ae(e,224)}static uint232(e){return Ae(e,232)}static uint240(e){return Ae(e,240)}static uint248(e){return Ae(e,248)}static uint256(e){return Ae(e,256)}static uint(e){return Ae(e,256)}static int8(e){return Ae(e,-8)}static int16(e){return Ae(e,-16)}static int24(e){return Ae(e,-24)}static int32(e){return Ae(e,-32)}static int40(e){return Ae(e,-40)}static int48(e){return Ae(e,-48)}static int56(e){return Ae(e,-56)}static int64(e){return Ae(e,-64)}static int72(e){return Ae(e,-72)}static int80(e){return Ae(e,-80)}static int88(e){return Ae(e,-88)}static int96(e){return Ae(e,-96)}static int104(e){return Ae(e,-104)}static int112(e){return Ae(e,-112)}static int120(e){return Ae(e,-120)}static int128(e){return Ae(e,-128)}static int136(e){return Ae(e,-136)}static int144(e){return Ae(e,-144)}static int152(e){return Ae(e,-152)}static int160(e){return Ae(e,-160)}static int168(e){return Ae(e,-168)}static int176(e){return Ae(e,-176)}static int184(e){return Ae(e,-184)}static int192(e){return Ae(e,-192)}static int200(e){return Ae(e,-200)}static int208(e){return Ae(e,-208)}static int216(e){return Ae(e,-216)}static int224(e){return Ae(e,-224)}static int232(e){return Ae(e,-232)}static int240(e){return Ae(e,-240)}static int248(e){return Ae(e,-248)}static int256(e){return Ae(e,-256)}static int(e){return Ae(e,-256)}static bytes1(e){return ft(e,1)}static bytes2(e){return ft(e,2)}static bytes3(e){return ft(e,3)}static bytes4(e){return ft(e,4)}static bytes5(e){return ft(e,5)}static bytes6(e){return ft(e,6)}static bytes7(e){return ft(e,7)}static bytes8(e){return ft(e,8)}static bytes9(e){return ft(e,9)}static bytes10(e){return ft(e,10)}static bytes11(e){return ft(e,11)}static bytes12(e){return ft(e,12)}static bytes13(e){return ft(e,13)}static bytes14(e){return ft(e,14)}static bytes15(e){return ft(e,15)}static bytes16(e){return ft(e,16)}static bytes17(e){return ft(e,17)}static bytes18(e){return ft(e,18)}static bytes19(e){return ft(e,19)}static bytes20(e){return ft(e,20)}static bytes21(e){return ft(e,21)}static bytes22(e){return ft(e,22)}static bytes23(e){return ft(e,23)}static bytes24(e){return ft(e,24)}static bytes25(e){return ft(e,25)}static bytes26(e){return ft(e,26)}static bytes27(e){return ft(e,27)}static bytes28(e){return ft(e,28)}static bytes29(e){return ft(e,29)}static bytes30(e){return ft(e,30)}static bytes31(e){return ft(e,31)}static bytes32(e){return ft(e,32)}static address(e){return new qi(Di,"address",e)}static bool(e){return new qi(Di,"bool",!!e)}static bytes(e){return new qi(Di,"bytes",e)}static string(e){return new qi(Di,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new qi(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===LD}static dereference(e,t){if(qi.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};jl=new WeakMap;let Nn=qi;class SY extends Ri{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let r=Nn.dereference(t,"string");try{r=pt(r)}catch(s){return this._throwError(s.message,t)}return e.writeValue(r)}decode(e){return pt(_o(e.readValue(),20))}}class TY extends Ri{constructor(t){super(t.name,t.type,"_",t.dynamic);G(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}function BD(n,e,t){let r=[];if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const u=c.localName;return ee(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),ee(!l[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),l[u]=!0,t[u]})}else z(!1,"invalid tuple value","tuple",t);z(e.length===r.length,"types/value length mismatch","tuple",t);let s=new s1,i=new s1,o=[];e.forEach((l,c)=>{let u=r[c];if(l.dynamic){let f=i.length;l.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,u)}),o.forEach(l=>{l(s.length)});let a=n.appendWriter(s);return a+=n.appendWriter(i),a}function _D(n,e){let t=[],r=[],s=n.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=n.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(c){if(dn(c,"BUFFER_OVERRUN"))throw c;o=c,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(n)}catch(a){if(dn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");t.push(o),r.push(i.localName||null)}),ou.fromItems(t,r)}class OY extends Ri{constructor(t,r,s){const i=t.type+"["+(r>=0?r:"")+"]",o=r===-1||t.dynamic;super("array",i,s,o);G(this,"coder");G(this,"length");Ne(this,{coder:t,length:r})}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(t);return r}encode(t,r){const s=Nn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),gP(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return BD(t,o,s)}decode(t){let r=this.length;r===-1&&(r=t.readIndex(),ee(r*$n<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:r*$n,length:t.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new TY(this.coder));return _D(t,s)}}class NY extends Ri{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const r=Nn.dereference(t,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class FD extends Ri{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Vn(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class MY extends FD{constructor(e){super("bytes",e)}decode(e){return we(super.decode(e))}}class RY extends Ri{constructor(t,r){let s="bytes"+String(t);super(s,s,r,!1);G(this,"size");Ne(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let s=Vn(Nn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(s)}decode(t){return we(t.readBytes(this.size))}}const PY=new Uint8Array([]);class DY extends Ri{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(PY)}decode(e){return e.readBytes(0),null}}const IY=BigInt(0),LY=BigInt(1),BY=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class _Y extends Ri{constructor(t,r,s){const i=(r?"int":"uint")+t*8;super(i,i,s,!1);G(this,"size");G(this,"signed");Ne(this,{size:t,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,r){let s=xe(Nn.dereference(r,this.type)),i=Zd(BY,$n*8);if(this.signed){let o=Zd(i,this.size*8-1);(s>o||s<-(o+LY))&&this._throwError("value out-of-bounds",r),s=AP(s,8*$n)}else(s<IY||s>Zd(i,this.size*8))&&this._throwError("value out-of-bounds",r);return t.writeValue(s)}decode(t){let r=Zd(t.readValue(),this.size*8);return this.signed&&(r=VJ(r,this.size*8)),r}}class FY extends FD{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mi(Nn.dereference(t,"string")))}decode(e){return iu(super.decode(e))}}class cy extends Ri{constructor(t,r){let s=!1;const i=[];t.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);G(this,"coders");Ne(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,r){const s=Nn.dereference(r,"tuple");return BD(t,this.coders,s)}decode(t){return _D(t,this.coders)}}function dl(n){return Xt(Mi(n))}var jY="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";const jD=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UD=4;function UY(n){let e=0;function t(){return n[e++]<<8|n[e++]}let r=t(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=t());let o=t(),a=e;e+=o;let l=0,c=0;function u(){return l==0&&(c=c<<8|n[e++],l=8),c>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let y=0;for(let x=0;x<f;x++)y=y<<1|u();let b=[],v=0,A=d;for(;;){let x=Math.floor(((y-v+1)*s-1)/A),C=0,S=r;for(;S-C>1;){let R=C+S>>>1;x<i[R]?S=R:C=R}if(C==0)break;b.push(C);let M=v+Math.floor(A*i[C]/s),O=v+Math.floor(A*i[C+1]/s)-1;for(;!((M^O)&h);)y=y<<1&m|u(),M=M<<1&m,O=O<<1&m|1;for(;M&~O&p;)y=y&h|y<<1&m>>>1|u(),M=M<<1^h,O=(O^h)<<1|h|1;v=M,A=1+O-M}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return w+256+(n[a++]<<8|n[a++]);case 1:return w+n[a++];default:return x-1}})}function VY(n){let e=0;return()=>n[e++]}function VD(n){return VY(UY(HY(n)))}function HY(n){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let t=n.length,r=new Uint8Array(6*t>>3);for(let s=0,i=0,o=0,a=0;s<t;s++)a=a<<6|e[n.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function zY(n){return n&1?~n>>1:n>>1}function $Y(n,e){let t=Array(n);for(let r=0,s=0;r<n;r++)t[r]=s+=zY(e());return t}function oh(n,e=0){let t=[];for(;;){let r=n(),s=n();if(!s)break;e+=r;for(let i=0;i<s;i++)t.push(e+i);e+=s+1}return t}function HD(n){return ah(()=>{let e=oh(n);if(e.length)return e})}function zD(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(GY(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(WY(t,n))}return e.flat()}function ah(n){let e=[];for(;;){let t=n(e.length);if(!t)break;e.push(t)}return e}function $D(n,e,t){let r=Array(n).fill().map(()=>[]);for(let s=0;s<e;s++)$Y(n,t).forEach((i,o)=>r[o].push(i));return r}function GY(n,e){let t=1+e(),r=e(),s=ah(e);return $D(s.length,1+n,e).flatMap((o,a)=>{let[l,...c]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*r;return[l+f*t,c.map(h=>h+d)]})})}function WY(n,e){let t=1+e();return $D(t,1+n,e).map(s=>[s[0],s.slice(1)])}function KY(n){let e=[],t=oh(n);return s(r([]),[]),e;function r(i){let o=n(),a=ah(()=>{let l=oh(n).map(c=>t[c]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let c of o)for(let u of c.Q)s(c,[...a,u],l)}}}function QY(n){return n.toString(16).toUpperCase().padStart(2,"0")}function GD(n){return`{${QY(n)}}`}function JY(n){let e=[];for(let t=0,r=n.length;t<r;){let s=n.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function hu(n){let t=n.length;if(t<4096)return String.fromCodePoint(...n);let r=[];for(let s=0;s<t;)r.push(String.fromCodePoint(...n.slice(s,s+=4096)));return r.join("")}function qY(n,e){let t=n.length,r=t-e.length;for(let s=0;r==0&&s<t;s++)r=n[s]-e[s];return r}var YY="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";const lh=44032,uy=4352,fy=4449,dy=4519,WD=19,KD=21,pu=28,hy=KD*pu,XY=WD*hy,ZY=lh+XY,eX=uy+WD,tX=fy+KD,nX=dy+pu;function ch(n){return n>>24&255}function QD(n){return n&16777215}let k1,JD,S1,py;function rX(){let n=VD(YY);k1=new Map(HD(n).flatMap((e,t)=>e.map(r=>[r,t+1<<24]))),JD=new Set(oh(n)),S1=new Map,py=new Map;for(let[e,t]of zD(n)){if(!JD.has(e)&&t.length==2){let[r,s]=t,i=py.get(r);i||(i=new Map,py.set(r,i)),i.set(s,e)}S1.set(e,t.reverse())}}function qD(n){return n>=lh&&n<ZY}function sX(n,e){if(n>=uy&&n<eX&&e>=fy&&e<tX)return lh+(n-uy)*hy+(e-fy)*pu;if(qD(n)&&e>dy&&e<nX&&(n-lh)%pu==0)return n+(e-dy);{let t=py.get(n);return t&&(t=t.get(e),t)?t:-1}}function YD(n){k1||rX();let e=[],t=[],r=!1;function s(i){let o=k1.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of n)for(;;){if(i<128)e.push(i);else if(qD(i)){let o=i-lh,a=o/hy|0,l=o%hy/pu|0,c=o%pu;s(uy+a),s(fy+l),c>0&&s(dy+c)}else{let o=S1.get(i);o?t.push(...o):s(i)}if(!t.length)break;i=t.pop()}if(r&&e.length>1){let i=ch(e[0]);for(let o=1;o<e.length;o++){let a=ch(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let c=e[l+1];if(e[l+1]=e[l],e[l]=c,!l||(i=ch(e[--l]),i<=a))break}i=ch(e[o])}}return e}function iX(n){let e=[],t=[],r=-1,s=0;for(let i of n){let o=ch(i),a=QD(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...t),t.length=0,r=a):t.push(a),s=o;else{let l=sX(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(t.push(a),s=o)}}return r>=0&&e.push(r,...t),e}function XD(n){return YD(n).map(QD)}function oX(n){return iX(YD(n))}const ZD=45,eI=".",tI=65039,nI=1,my=n=>Array.from(n);function uh(n,e){return n.P.has(e)||n.Q.has(e)}class aX extends Array{get is_emoji(){return!0}}let T1,rI,hl,O1,sI,mu,N1,gu,pl,iI,M1;function R1(){if(T1)return;let n=VD(jY);const e=()=>oh(n),t=()=>new Set(e()),r=(u,f)=>f.forEach(d=>u.add(d));T1=new Map(zD(n)),rI=t(),hl=e(),O1=new Set(e().map(u=>hl[u])),hl=new Set(hl),sI=t(),t();let s=HD(n),i=n();const o=()=>{let u=new Set;return e().forEach(f=>r(u,s[f])),r(u,e()),u};mu=ah(u=>{let f=ah(n).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=hu(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!n();return{N:f,P:h,Q:p,M:m,R:d}}}),N1=t(),gu=new Map;let a=e().concat(my(N1)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=n(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),N1.has(u)||gu.set(u,h)});for(let{V:u,M:f}of new Set(gu.values())){let d=[];for(let p of u){let m=mu.filter(b=>uh(b,p)),y=d.find(({G:b})=>m.some(v=>b.has(v)));y||(y={G:new Set,V:[]},d.push(y)),y.V.push(p),r(y.G,m)}let h=d.flatMap(p=>my(p.G));for(let{G:p,V:m}of d){let y=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,y)}}pl=new Set;let l=new Set;const c=u=>pl.has(u)?l.add(u):pl.add(u);for(let u of mu){for(let f of u.P)c(f);for(let f of u.Q)c(f)}for(let u of pl)!gu.has(u)&&!l.has(u)&&gu.set(u,nI);r(pl,XD(pl)),iI=KY(n).map(u=>aX.from(u)).sort(qY),M1=new Map;for(let u of iI){let f=[M1];for(let d of u){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===tI?f.push(...h):f=h}for(let d of f)d.V=u}}function P1(n){return(oI(n)?"":`${D1(gy([n]))} `)+GD(n)}function D1(n){return`"${n}"`}function lX(n){if(n.length>=4&&n[2]==ZD&&n[3]==ZD)throw new Error(`invalid label extension: "${hu(n.slice(0,4))}"`)}function cX(n){for(let t=n.lastIndexOf(95);t>0;)if(n[--t]!==95)throw new Error("underscore allowed only at start")}function uX(n){let e=n[0],t=jD.get(e);if(t)throw fh(`leading ${t}`);let r=n.length,s=-1;for(let i=1;i<r;i++){e=n[i];let o=jD.get(e);if(o){if(s==i)throw fh(`${t} + ${o}`);s=i+1,t=o}}if(s==r)throw fh(`trailing ${t}`)}function gy(n,e=1/0,t=GD){let r=[];fX(n[0])&&r.push("◌"),n.length>e&&(e>>=1,n=[...n.slice(0,e),8230,...n.slice(-e)]);let s=0,i=n.length;for(let o=0;o<i;o++){let a=n[o];oI(a)&&(r.push(hu(n.slice(s,o))),r.push(t(a)),s=o+1)}return r.push(hu(n.slice(s,i))),r.join("")}function fX(n){return R1(),hl.has(n)}function oI(n){return R1(),sI.has(n)}function dX(n){return gX(hX(n,oX,wX))}function hX(n,e,t){if(!n)return[];R1();let r=0;return n.split(eI).map(s=>{let i=JY(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=bX(i,e,t),l=a.length,c;if(!l)throw new Error("empty label");let u=o.output=a.flat();if(cX(u),!(o.emoji=l>1||a[0].is_emoji)&&u.every(d=>d<128))lX(u),c="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)c="Emoji";else{if(hl.has(u[0]))throw fh("leading combining mark");for(let m=1;m<l;m++){let y=a[m];if(!y.is_emoji&&hl.has(y[0]))throw fh(`emoji + combining mark: "${hu(a[m-1])} + ${gy([y[0]])}"`)}uX(u);let h=my(new Set(d)),[p]=mX(h);yX(p,d),pX(p,h),c=p.N}}o.type=c}catch(a){o.error=a}return o})}function pX(n,e){let t,r=[];for(let s of e){let i=gu.get(s);if(i===nI)return;if(i){let o=i.M.get(s);if(t=t?t.filter(a=>o.has(a)):my(o),!t.length)return}else r.push(s)}if(t){for(let s of t)if(r.every(i=>uh(s,i)))throw new Error(`whole-script confusable: ${n.N}/${s.N}`)}}function mX(n){let e=mu;for(let t of n){let r=e.filter(s=>uh(s,t));if(!r.length)throw mu.some(s=>uh(s,t))?lI(e[0],t):aI(t);if(e=r,r.length==1)break}return e}function gX(n){return n.map(({input:e,error:t,output:r})=>{if(t){let s=t.message;throw new Error(n.length==1?s:`Invalid label ${D1(gy(e,63))}: ${s}`)}return hu(r)}).join(eI)}function aI(n){return new Error(`disallowed character: ${P1(n)}`)}function lI(n,e){let t=P1(e),r=mu.find(s=>s.P.has(e));return r&&(t=`${r.N} ${t}`),new Error(`illegal mixture: ${n.N} + ${t}`)}function fh(n){return new Error(`illegal placement: ${n}`)}function yX(n,e){for(let t of e)if(!uh(n,t))throw lI(n,t);if(n.M){let t=XD(e);for(let r=1,s=t.length;r<s;r++)if(O1.has(t[r])){let i=r+1;for(let o;i<s&&O1.has(o=t[i]);i++)for(let a=r;a<i;a++)if(t[a]==o)throw new Error(`duplicate non-spacing marks: ${P1(o)}`);if(i-r>UD)throw new Error(`excessive non-spacing marks: ${D1(gy(t.slice(r-1,i)))} (${i-r}/${UD})`);r=i}}}function bX(n,e,t){let r=[],s=[];for(n=n.slice().reverse();n.length;){let i=AX(n);if(i)s.length&&(r.push(e(s)),s=[]),r.push(t(i));else{let o=n.pop();if(pl.has(o))s.push(o);else{let a=T1.get(o);if(a)s.push(...a);else if(!rI.has(o))throw aI(o)}}}return s.length&&r.push(e(s)),r}function wX(n){return n.filter(e=>e!=tI)}function AX(n,e){let t=M1,r,s=n.length;for(;s&&(t=t.get(n[--s]),!!t);){let{V:i}=t;i&&(r=i,n.length=s)}return r}const cI=new Uint8Array(32);cI.fill(0);function uI(n){return z(n.length!==0,"invalid ENS name; empty component","comp",n),n}function fI(n){const e=Mi(vX(n)),t=[];if(n.length===0)return t;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(uI(e.slice(r,s))),r=s+1);return z(r<e.length,"invalid ENS name; empty component","name",n),t.push(uI(e.slice(r))),t}function vX(n){try{if(n.length===0)throw new Error("empty label");return dX(n)}catch(e){z(!1,`invalid ENS name (${e.message})`,"name",n)}}function I1(n){z(typeof n=="string","invalid ENS name; not a string","name",n),z(n.length,"invalid ENS name (empty label)","name",n);let e=cI;const t=fI(n);for(;t.length;)e=Xt(zt([e,Xt(t.pop())]));return we(e)}function xX(n,e){const t=e;return z(t<=255,"DNS encoded label cannot exceed 255","length",t),we(zt(fI(n).map(r=>{z(r.length<=t,`label ${JSON.stringify(n)} exceeds ${t} bytes`,"name",n);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function L1(n,e){return{address:pt(n),storageKeys:e.map((t,r)=>(z(Ct(t,32),"invalid slot",`storageKeys[${r}]`,t),t.toLowerCase()))}}function $o(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(z(t.length===2,"invalid slot set",`value[${r}]`,t),L1(t[0],t[1])):(z(t!=null&&typeof t=="object","invalid address-slot set","value",n),L1(t.address,t.storageKeys)));z(n!=null&&typeof n=="object","invalid access list","value",n);const e=Object.keys(n).map(t=>{const r=n[t].reduce((s,i)=>(s[i]=!0,s),{});return L1(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function EX(n){let e;return typeof n=="string"?e=ih.computePublicKey(n,!1):e=n.publicKey,pt(Xt("0x"+e.substring(4)).substring(26))}function CX(n,e){return EX(ih.recoverPublicKey(n,e))}const pn=BigInt(0),kX=BigInt(2),SX=BigInt(27),TX=BigInt(28),OX=BigInt(35),NX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B1=4096*32;function dI(n,e){let t=n.toString(16);for(;t.length<2;)t="0"+t;return t+=lu(e).substring(4),"0x"+t}function yy(n){return n==="0x"?null:pt(n)}function _1(n,e){try{return $o(n)}catch(t){z(!1,t.message,e,n)}}function dh(n,e){return n==="0x"?0:Je(n,e)}function Gt(n,e){if(n==="0x")return pn;const t=xe(n,e);return z(t<=NX,"value exceeds uint size",e,t),t}function Tt(n,e){const t=xe(n,"value"),r=Hn(t);return z(r.length<=32,"value too large",`tx.${e}`,t),r}function F1(n){return $o(n).map(e=>[e.address,e.storageKeys])}function MX(n,e){z(Array.isArray(n),`invalid ${e}`,"value",n);for(let t=0;t<n.length;t++)z(Ct(n[t],32),"invalid ${ param } hash",`value[${t}]`,n[t]);return n}function RX(n){const e=ty(n);z(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",n);const t={type:0,nonce:dh(e[0],"nonce"),gasPrice:Gt(e[1],"gasPrice"),gasLimit:Gt(e[2],"gasLimit"),to:yy(e[3]),value:Gt(e[4],"value"),data:we(e[5]),chainId:pn};if(e.length===6)return t;const r=Gt(e[6],"v"),s=Gt(e[7],"r"),i=Gt(e[8],"s");if(s===pn&&i===pn)t.chainId=r;else{let o=(r-OX)/kX;o<pn&&(o=pn),t.chainId=o,z(o!==pn||r===SX||r===TX,"non-canonical legacy v","v",e[6]),t.signature=ws.from({r:il(e[7],32),s:il(e[8],32),v:r})}return t}function PX(n,e){const t=[Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data];let r=pn;if(n.chainId!=pn)r=xe(n.chainId,"tx.chainId"),z(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(n.signature){const i=n.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==pn&&(t.push(Hn(r)),t.push("0x"),t.push("0x")),al(t);let s=BigInt(27+e.yParity);return r!==pn?s=ws.getChainIdV(r,e.v):BigInt(e.v)!==s&&z(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Hn(s)),t.push(Hn(e.r)),t.push(Hn(e.s)),al(t)}function j1(n,e){let t;try{if(t=dh(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{z(!1,"invalid yParity","yParity",e[0])}const r=il(e[1],32),s=il(e[2],32),i=ws.from({r,s,yParity:t});n.signature=i}function DX(n){const e=ty(ct(n).slice(1));z(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",we(n));const t={type:2,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:we(e[7]),accessList:_1(e[8],"accessList")};return e.length===9||j1(t,e.slice(9)),t}function IX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"yParity")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x02",al(t)])}function LX(n){const e=ty(ct(n).slice(1));z(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",we(n));const t={type:1,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),gasPrice:Gt(e[2],"gasPrice"),gasLimit:Gt(e[3],"gasLimit"),to:yy(e[4]),value:Gt(e[5],"value"),data:we(e[6]),accessList:_1(e[7],"accessList")};return e.length===8||j1(t,e.slice(8)),t}function BX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"recoveryParam")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x01",al(t)])}function _X(n){let e=ty(ct(n).slice(1)),t="3",r=null;if(e.length===4&&Array.isArray(e[0])){t="3 (network format)";const i=e[1],o=e[2],a=e[3];z(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),z(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),z(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),z(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),z(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}z(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${t}`,"data",we(n));const s={type:3,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:we(e[7]),accessList:_1(e[8],"accessList"),maxFeePerBlobGas:Gt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),z(s.to!=null,`invalid address for transaction type: ${t}`,"data",n),z(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let i=0;i<s.blobVersionedHashes.length;i++)z(Ct(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",n);return e.length===11||j1(s,e.slice(11)),s}function FX(n,e,t){const r=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||sh,Tt(n.value,"value"),n.data,F1(n.accessList||[]),Tt(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),MX(n.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Tt(e.yParity,"yParity")),r.push(Hn(e.r)),r.push(Hn(e.s)),t)?zt(["0x03",al([r,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])]):zt(["0x03",al(r)])}const Xi=class Xi{constructor(){J(this,tf);J(this,ri);J(this,$u);J(this,Gu);J(this,Wu);J(this,Ku);J(this,Qu);J(this,Ju);J(this,qu);J(this,Yu);J(this,Xu);J(this,Zu);J(this,ef);J(this,Ul);J(this,ta);J(this,Yi);J(this,na);L(this,ri,null),L(this,$u,null),L(this,Wu,0),L(this,Ku,pn),L(this,Qu,null),L(this,Ju,null),L(this,qu,null),L(this,Gu,"0x"),L(this,Yu,pn),L(this,Xu,pn),L(this,Zu,null),L(this,ef,null),L(this,Ul,null),L(this,ta,null),L(this,na,null),L(this,Yi,null)}get type(){return T(this,ri)}set type(e){switch(e){case null:L(this,ri,null);break;case 0:case"legacy":L(this,ri,0);break;case 1:case"berlin":case"eip-2930":L(this,ri,1);break;case 2:case"london":case"eip-1559":L(this,ri,2);break;case 3:case"cancun":case"eip-4844":L(this,ri,3);break;default:z(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=T(this,$u);return e==null&&this.type===3?sh:e}set to(e){L(this,$u,e==null?null:pt(e))}get nonce(){return T(this,Wu)}set nonce(e){L(this,Wu,Je(e,"value"))}get gasLimit(){return T(this,Ku)}set gasLimit(e){L(this,Ku,xe(e))}get gasPrice(){const e=T(this,Qu);return e==null&&(this.type===0||this.type===1)?pn:e}set gasPrice(e){L(this,Qu,e==null?null:xe(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,Ju);return e??(this.type===2||this.type===3?pn:null)}set maxPriorityFeePerGas(e){L(this,Ju,e==null?null:xe(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,qu);return e??(this.type===2||this.type===3?pn:null)}set maxFeePerGas(e){L(this,qu,e==null?null:xe(e,"maxFeePerGas"))}get data(){return T(this,Gu)}set data(e){L(this,Gu,we(e))}get value(){return T(this,Yu)}set value(e){L(this,Yu,xe(e,"value"))}get chainId(){return T(this,Xu)}set chainId(e){L(this,Xu,xe(e))}get signature(){return T(this,Zu)||null}set signature(e){L(this,Zu,e==null?null:ws.from(e))}get accessList(){const e=T(this,ef)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,ef,e==null?null:$o(e))}get maxFeePerBlobGas(){const e=T(this,Ul);return e==null&&this.type===3?pn:e}set maxFeePerBlobGas(e){L(this,Ul,e==null?null:xe(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ta);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){z(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)z(Ct(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}L(this,ta,e)}get blobs(){return T(this,na)==null?null:T(this,na).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,na,null);return}const t=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(Zv(i)){ee(T(this,Yi),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if(z(o.length<=B1,"blob is too large",`blobs[${s}]`,i),o.length!==B1){const c=new Uint8Array(B1);c.set(o),o=c}const a=T(this,Yi).blobToKzgCommitment(o),l=we(T(this,Yi).computeBlobKzgProof(o,a));t.push({data:we(o),commitment:we(a),proof:l}),r.push(dI(1,a))}else{const o=we(i.commitment);t.push({data:we(i.data),commitment:o,proof:we(i.proof)}),r.push(dI(1,o))}}L(this,na,t),L(this,ta,r)}get kzg(){return T(this,Yi)}set kzg(e){L(this,Yi,e)}get hash(){return this.signature==null?null:Xt(fe(this,tf,b0).call(this,!0,!1))}get unsignedHash(){return Xt(this.unsignedSerialized)}get from(){return this.signature==null?null:CX(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:ih.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return fe(this,tf,b0).call(this,!0,!0)}get unsignedSerialized(){return fe(this,tf,b0).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,Ul)!=null||T(this,ta);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&ee(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ee(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ee(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):t?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Xi.from(this)}toJSON(){const e=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Xi;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return Xi.from(RX(r));switch(r[0]){case 1:return Xi.from(LX(r));case 2:return Xi.from(DX(r));case 3:return Xi.from(_X(r))}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Xi;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=ws.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&(z(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),z(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(z(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),z(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}};ri=new WeakMap,$u=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Ju=new WeakMap,qu=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,Ul=new WeakMap,ta=new WeakMap,Yi=new WeakMap,na=new WeakMap,tf=new WeakSet,b0=function(e,t){ee(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return PX(this,r);case 1:return BX(this,r);case 2:return IX(this,r);case 3:return FX(this,r,t?this.blobs:null)}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let hh=Xi;const hI=new Uint8Array(32);hI.fill(0);const jX=BigInt(-1),pI=BigInt(0),mI=BigInt(1),UX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function VX(n){const e=ct(n),t=e.length%32;return t?zt([e,hI.slice(t)]):we(e)}const HX=_o(mI,32),zX=_o(pI,32),gI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},U1=["name","version","chainId","verifyingContract","salt"];function yI(n){return function(e){return z(typeof e=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const $X={name:yI("name"),version:yI("version"),chainId:function(n){const e=xe(n,"domain.chainId");return z(e>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(e)?Number(e):ol(e)},verifyingContract:function(n){try{return pt(n).toLowerCase()}catch{}z(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const e=ct(n,"domain.salt");return z(e.length===32,'invalid domain value "salt"',"domain.salt",n),we(e)}};function V1(n){{const e=n.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",r=parseInt(e[2]);z(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",n);const s=Zd(UX,t?r-1:r),i=t?(s+mI)*jX:pI;return function(o){const a=xe(o,"value");return z(a>=i&&a<=s,`value out-of-bounds for ${n}`,"value",a),_o(t?AP(a,256):a,32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return z(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",n),function(r){const s=ct(r);return z(s.length===t,`invalid length for ${n}`,"value",r),VX(r)}}}switch(n){case"address":return function(e){return il(pt(e),32)};case"bool":return function(e){return e?HX:zX};case"bytes":return function(e){return Xt(e)};case"string":return function(e){return dl(e)}}return null}function bI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}function by(n){const e=n.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:n}}const qr=class qr{constructor(e){J(this,f0);G(this,"primaryType");J(this,Uh);J(this,Zi);J(this,nf);L(this,Zi,new Map),L(this,nf,new Map);const t=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:c,type:u})=>{let{base:f,index:d}=by(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:c,type:f+(d||"")}}),t.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,Uh,JSON.stringify(i));for(const l in i){const c=new Set;for(const u of i[l]){z(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),c.add(u.name);const f=by(u.type).base;z(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!V1(f)&&(z(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),t.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);z(o.length!==0,"missing primary type","types",e),z(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Ne(this,{primaryType:o[0]});function a(l,c){z(!c.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),c.add(l);for(const u of t.get(l))if(r.has(u)){a(u,c);for(const f of c)s.get(f).add(u)}c.delete(l)}a(this.primaryType,new Set);for(const[l,c]of s){const u=Array.from(c);u.sort(),T(this,Zi).set(l,bI(l,i[l])+u.map(f=>bI(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,Uh))}getEncoder(e){let t=T(this,nf).get(e);return t||(t=fe(this,f0,aF).call(this,e),T(this,nf).set(e,t)),t}encodeType(e){const t=T(this,Zi).get(e);return z(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Xt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(V1(e))return r(e,t);const s=by(e).array;if(s)return z(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{});z(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new qr(e)}static getPrimaryType(e){return qr.from(e).primaryType}static hashStruct(e,t,r){return qr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(e[r]==null)continue;const s=gI[r];z(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:s})}return t.sort((r,s)=>U1.indexOf(r.name)-U1.indexOf(s.name)),qr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return zt(["0x1901",qr.hashDomain(e),qr.from(t).hash(r)])}static hash(e,t,r){return Xt(qr.encode(e,t,r))}static async resolveNames(e,t,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!Ct(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=qr.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ct(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,t,r){qr.hashDomain(e);const s={},i=[];U1.forEach(l=>{const c=e[l];c!=null&&(s[l]=$X[l](c),i.push({name:l,type:gI[l]}))});const o=qr.from(t);t=o.types;const a=Object.assign({},t);return z(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return we(ct(c));if(l.match(/^u?int/))return xe(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return z(typeof c=="string","invalid string","value",c),c}z(!1,"unsupported type","type",l)})}}};Uh=new WeakMap,Zi=new WeakMap,nf=new WeakMap,f0=new WeakSet,aF=function(e){{const s=V1(e);if(s)return s}const t=by(e).array;if(t){const s=t.prefix,i=this.getEncoder(s);return o=>{z(t.count===-1||t.count===o.length,`array length mismatch; expected length ${t.count}`,"value",o);let a=o.map(i);return T(this,Zi).has(s)&&(a=a.map(Xt)),Xt(zt(a))}}const r=this.types[e];if(r){const s=dl(T(this,Zi).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(i[a]);return T(this,Zi).has(l)?Xt(c):c});return o.unshift(s),zt(o)}}z(!1,`unknown type: ${e}`,"type",e)};let wy=qr;function Wn(n){const e=new Set;return n.forEach(t=>e.add(t)),Object.freeze(e)}const GX=Wn("external public payable override".split(" ")),wI="constant external internal payable private public pure view override",WX=Wn(wI.split(" ")),AI="constructor error event fallback function receive struct",vI=Wn(AI.split(" ")),xI="calldata memory storage payable indexed",KX=Wn(xI.split(" ")),QX=[AI,xI,"tuple returns",wI].join(" "),JX=Wn(QX.split(" ")),qX={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},YX=new RegExp("^(\\s*)"),XX=new RegExp("^([0-9]+)"),ZX=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),EI=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),CI=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),d0=class d0{constructor(e){J(this,Vh);J(this,Cn);J(this,ks);L(this,Cn,0),L(this,ks,e.slice())}get offset(){return T(this,Cn)}get length(){return T(this,ks).length-T(this,Cn)}clone(){return new d0(T(this,ks))}reset(){L(this,Cn,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=fe(this,Vh,ME).call(this,T(this,Cn)+1,e.match+1);return L(this,Cn,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;T(this,Cn)<e.match-1;){const r=this.peek().linkNext;t.push(fe(this,Vh,ME).call(this,T(this,Cn)+1,r)),L(this,Cn,r)}return L(this,Cn,e.match+1),t}peek(){if(T(this,Cn)>=T(this,ks).length)throw new Error("out-of-bounds");return T(this,ks)[T(this,Cn)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return Xh(this,Cn)._++,e}toString(){const e=[];for(let t=T(this,Cn);t<T(this,ks).length;t++){const r=T(this,ks)[t];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Cn=new WeakMap,ks=new WeakMap,Vh=new WeakSet,ME=function(e=0,t=0){return new d0(T(this,ks).slice(e,t).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let As=d0;function Go(n){const e=[],t=o=>{const a=i<n.length?JSON.stringify(n[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<n.length;){let o=n.substring(i),a=o.match(YX);a&&(i+=a[1].length,o=n.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let c=qX[o[0]]||"";if(c){if(l.type=c,l.text=o[0],i++,c==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(c=="CLOSE_PAREN")r.length===0&&t("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(c==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(c==="OPEN_BRACKET")l.type="BRACKET";else if(c==="CLOSE_BRACKET"){let u=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=Je(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(ZX),a){if(l.text=a[1],i+=l.text.length,JX.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(CI)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(XX),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new As(e.map(o=>Object.freeze(o)))}function kI(n,e){let t=[];for(const r in e.keys())n.has(r)&&t.push(r);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ay(n,e){if(e.peekKeyword(vI)){const t=e.pop().text;if(t!==n)throw new Error(`expected ${n}, got ${t}`)}return e.popType("ID")}function Ii(n,e){const t=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(n.pop(),t.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);t.add(r)}return Object.freeze(t)}function SI(n){let e=Ii(n,WX);return kI(e,Wn("constant payable nonpayable".split(" "))),kI(e,Wn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Li(n,e){return n.popParams().map(t=>An.from(t,e))}function TI(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return xe(n.pop().text);throw new Error("invalid gas")}return null}function ml(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const eZ=new RegExp(/^(.*)\[([0-9]*)\]$/);function OI(n){const e=n.match(CI);if(z(e,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(e[2]){const t=parseInt(e[2]);z(t!==0&&t<=32,"invalid bytes length","type",n)}else if(e[3]){const t=parseInt(e[3]);z(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",n)}return n}const Lt={},ar=Symbol.for("_ethers_internal"),NI="_ParamTypeInternal",MI="_ErrorInternal",RI="_EventInternal",PI="_ConstructorInternal",DI="_FallbackInternal",II="_FunctionInternal",LI="_StructInternal",Yr=class Yr{constructor(e,t,r,s,i,o,a,l){J(this,rf);G(this,"name");G(this,"type");G(this,"baseType");G(this,"indexed");G(this,"components");G(this,"arrayLength");G(this,"arrayChildren");if(qg(e,Lt,"ParamType"),Object.defineProperty(this,ar,{value:NI}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Ne(this,{name:t,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,t))}return t(this.type,e)}async walkAsync(e,t){const r=[],s=[e];return fe(this,rf,w0).call(this,r,e,t,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,t){if(Yr.isParamType(e))return e;if(typeof e=="string")try{return Yr.from(Go(e),t)}catch{z(!1,"invalid param type","obj",e)}else if(e instanceof As){let a="",l="",c=null;Ii(e,Wn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",c=e.popParams().map(m=>Yr.from(m)),a=`tuple(${c.map(m=>m.format()).join(",")})`):(a=OI(e.popType("TYPE")),l=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();u=new Yr(Lt,"",a,l,null,c,f,u),f=m.value,a+=m.text,l="array",c=null}let d=null;if(Ii(e,KX).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Yr(Lt,p,a,l,d,c,f,u)}const r=e.name;z(!r||typeof r=="string"&&r.match(EI),"invalid name","obj.name",r);let s=e.indexed;s!=null&&(z(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(eZ);if(o){const a=parseInt(o[2]||"-1"),l=Yr.from({type:o[1],components:e.components});return new Yr(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(c=>Yr.from(c)):null;return new Yr(Lt,r||"",i,"tuple",s,a,null,null)}return i=OI(e.type),new Yr(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[ar]===NI}};rf=new WeakSet,w0=function(e,t,r,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();a.forEach((l,c)=>{var u;fe(u=o,rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in t))throw new Error(`missing value for component ${l.name}`);return t[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,c)=>{var u;fe(u=o[c],rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}const i=r(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let An=Yr;class gl{constructor(e,t,r){G(this,"type");G(this,"inputs");qg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Ne(this,{type:t,inputs:r})}static from(e){if(typeof e=="string"){try{gl.from(JSON.parse(e))}catch{}return gl.from(Go(e))}if(e instanceof As)switch(e.peekKeyword(vI)){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return yl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return yl.from(e)}ee(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}z(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Bi.isFragment(e)}static isError(e){return lr.isFragment(e)}static isEvent(e){return Zs.isFragment(e)}static isFunction(e){return ei.isFragment(e)}static isStruct(e){return yl.isFragment(e)}}class vy extends gl{constructor(t,r,s,i){super(t,r,i);G(this,"name");z(typeof s=="string"&&s.match(EI),"invalid identifier","name",s),i=Object.freeze(i.slice()),Ne(this,{name:s})}}function ph(n,e){return"("+e.map(t=>t.format(n)).join(n==="full"?", ":",")+")"}class lr extends vy{constructor(e,t,r){super(e,"error",t,r),Object.defineProperty(this,ar,{value:MI})}get selector(){return dl(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+ph(e,this.inputs)),t.join(" ")}static from(e){if(lr.isFragment(e))return e;if(typeof e=="string")return lr.from(Go(e));if(e instanceof As){const t=Ay("error",e),r=Li(e);return ml(e),new lr(Lt,t,r)}return new lr(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===MI}}class Zs extends vy{constructor(t,r,s,i){super(t,"event",r,s);G(this,"anonymous");Object.defineProperty(this,ar,{value:RI}),Ne(this,{anonymous:i})}get topicHash(){return dl(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("event"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(t,r){return r=(r||[]).map(i=>An.from(i)),new Zs(Lt,t,r,!1).topicHash}static from(t){if(Zs.isFragment(t))return t;if(typeof t=="string")try{return Zs.from(Go(t))}catch{z(!1,"invalid event fragment","obj",t)}else if(t instanceof As){const r=Ay("event",t),s=Li(t,!0),i=!!Ii(t,Wn(["anonymous"])).has("anonymous");return ml(t),new Zs(Lt,r,s,i)}return new Zs(Lt,t.name,t.inputs?t.inputs.map(r=>An.from(r,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ar]===RI}}class Bi extends gl{constructor(t,r,s,i,o){super(t,r,s);G(this,"payable");G(this,"gas");Object.defineProperty(this,ar,{value:PI}),Ne(this,{payable:i,gas:o})}format(t){if(ee(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[`constructor${ph(t,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(t){if(Bi.isFragment(t))return t;if(typeof t=="string")try{return Bi.from(Go(t))}catch{z(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof As){Ii(t,Wn(["constructor"]));const r=Li(t),s=!!Ii(t,GX).has("payable"),i=TI(t);return ml(t),new Bi(Lt,"constructor",r,s,i)}return new Bi(Lt,"constructor",t.inputs?t.inputs.map(An.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===PI}}class _i extends gl{constructor(t,r,s){super(t,"fallback",r);G(this,"payable");Object.defineProperty(this,ar,{value:DI}),Ne(this,{payable:s})}format(t){const r=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(t){if(_i.isFragment(t))return t;if(typeof t=="string")try{return _i.from(Go(t))}catch{z(!1,"invalid fallback fragment","obj",t)}else if(t instanceof As){const r=t.toString(),s=t.peekKeyword(Wn(["fallback","receive"]));if(z(s,"type must be fallback or receive","obj",r),t.popKeyword(Wn(["fallback","receive"]))==="receive"){const l=Li(t);return z(l.length===0,"receive cannot have arguments","obj.inputs",l),Ii(t,Wn(["payable"])),ml(t),new _i(Lt,[],!0)}let o=Li(t);o.length?z(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[An.from("bytes")];const a=SI(t);if(z(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Ii(t,Wn(["returns"])).has("returns")){const l=Li(t);z(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(c=>c.format("minimal")).join(", "))}return ml(t),new _i(Lt,o,a==="payable")}if(t.type==="receive")return new _i(Lt,[],!0);if(t.type==="fallback"){const r=[An.from("bytes")],s=t.stateMutability==="payable";return new _i(Lt,r,s)}z(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ar]===DI}}class ei extends vy{constructor(t,r,s,i,o,a){super(t,"function",r,i);G(this,"constant");G(this,"outputs");G(this,"stateMutability");G(this,"payable");G(this,"gas");Object.defineProperty(this,ar,{value:II}),o=Object.freeze(o.slice()),Ne(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return dl(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("function"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(ph(t,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(t,r){return r=(r||[]).map(i=>An.from(i)),new ei(Lt,t,"view",r,[],null).selector}static from(t){if(ei.isFragment(t))return t;if(typeof t=="string")try{return ei.from(Go(t))}catch{z(!1,"invalid function fragment","obj",t)}else if(t instanceof As){const s=Ay("function",t),i=Li(t),o=SI(t);let a=[];Ii(t,Wn(["returns"])).has("returns")&&(a=Li(t));const l=TI(t);return ml(t),new ei(Lt,s,o,i,a,l)}let r=t.stateMutability;return r==null&&(r="payable",typeof t.constant=="boolean"?(r="view",t.constant||(r="payable",typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable")),new ei(Lt,t.name,r,t.inputs?t.inputs.map(An.from):[],t.outputs?t.outputs.map(An.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===II}}class yl extends vy{constructor(e,t,r){super(e,"struct",t,r),Object.defineProperty(this,ar,{value:LI})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return yl.from(Go(e))}catch{z(!1,"invalid struct fragment","obj",e)}else if(e instanceof As){const t=Ay("struct",e),r=Li(e);return ml(e),new yl(Lt,t,r)}return new yl(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===LI}}const vs=new Map;vs.set(0,"GENERIC_PANIC"),vs.set(1,"ASSERT_FALSE"),vs.set(17,"OVERFLOW"),vs.set(18,"DIVIDE_BY_ZERO"),vs.set(33,"ENUM_RANGE_ERROR"),vs.set(34,"BAD_STORAGE_DATA"),vs.set(49,"STACK_UNDERFLOW"),vs.set(50,"ARRAY_RANGE_ERROR"),vs.set(65,"OUT_OF_MEMORY"),vs.set(81,"UNINITIALIZED_FUNCTION_CALL");const tZ=new RegExp(/^bytes([0-9]*)$/),nZ=new RegExp(/^(u?int)([0-9]*)$/);let H1=null,BI=1024;function rZ(n,e,t,r){let s="missing revert data",i=null;const o=null;let a=null;if(t){s="execution reverted";const c=ct(t);if(t=we(t),c.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(c.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(we(c.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],c.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(we(c.slice(0,4))==="0x4e487b71")try{const u=Number(r.decode(["uint256"],c.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${vs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?pt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=pt(e.from)),Mt(s,"CALL_EXCEPTION",{action:n,data:t,reason:i,transaction:l,invocation:o,revert:a})}const h0=class h0{constructor(){J(this,ra)}getDefaultValue(e){const t=e.map(s=>fe(this,ra,Tf).call(this,An.from(s)));return new cy(t,"_").defaultValue()}encode(e,t){gP(t.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ra,Tf).call(this,An.from(o))),s=new cy(r,"_"),i=new s1;return s.encode(i,t),i.data}decode(e,t,r){const s=e.map(o=>fe(this,ra,Tf).call(this,An.from(o)));return new cy(s,"_").decode(new i1(t,r,BI))}static _setDefaultMaxInflation(e){z(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),BI=e}static defaultAbiCoder(){return H1==null&&(H1=new h0),H1}static getBuiltinCallException(e,t,r){return rZ(e,t,r,h0.defaultAbiCoder())}};ra=new WeakSet,Tf=function(e){if(e.isArray())return new OY(fe(this,ra,Tf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new cy(e.components.map(r=>fe(this,ra,Tf).call(this,r)),e.name);switch(e.baseType){case"address":return new SY(e.name);case"bool":return new NY(e.name);case"string":return new FY(e.name);case"bytes":return new MY(e.name);case"":return new DY(e.name)}let t=e.type.match(nZ);if(t){let r=parseInt(t[2]||"256");return z(r!==0&&r<=256&&r%8===0,"invalid "+t[1]+" bit length","param",e),new _Y(r/8,t[1]==="int",e.name)}if(t=e.type.match(tZ),t){let r=parseInt(t[1]);return z(r!==0&&r<=32,"invalid bytes length","param",e),new RY(r,e.name)}z(!1,"invalid type","type",e.type)};let yu=h0;class sZ{constructor(e,t,r){G(this,"fragment");G(this,"name");G(this,"signature");G(this,"topic");G(this,"args");const s=e.name,i=e.format();Ne(this,{fragment:e,name:s,signature:i,topic:t,args:r})}}class iZ{constructor(e,t,r,s){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");G(this,"value");const i=e.name,o=e.format();Ne(this,{fragment:e,name:i,args:r,signature:o,selector:t,value:s})}}class oZ{constructor(e,t,r){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");const s=e.name,i=e.format();Ne(this,{fragment:e,name:s,args:r,signature:i,selector:t})}}class _I{constructor(e){G(this,"hash");G(this,"_isIndexed");Ne(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const FI={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},jI={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let e="unknown panic code";return n>=0&&n<=255&&FI[n.toString()]&&(e=FI[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${e})`}}},Vl=class Vl{constructor(e){J(this,ai);G(this,"fragments");G(this,"deploy");G(this,"fallback");G(this,"receive");J(this,si);J(this,ii);J(this,oi);J(this,Pn);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,L(this,oi,new Map),L(this,si,new Map),L(this,ii,new Map);const r=[];for(const o of t)try{r.push(gl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Ne(this,{fragments:Object.freeze(r)});let s=null,i=!1;L(this,Pn,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ne(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:(z(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":l=T(this,oi);break;case"event":l=T(this,ii);break;case"error":l=T(this,si);break;default:return}const c=o.format();l.has(c)||l.set(c,o)}),this.deploy||Ne(this,{deploy:Bi.from("constructor()")}),Ne(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return yu.defaultAbiCoder()}getFunctionName(e){const t=fe(this,ai,A0).call(this,e,null,!1);return z(t,"no matching function","key",e),t.name}hasFunction(e){return!!fe(this,ai,A0).call(this,e,null,!1)}getFunction(e,t){return fe(this,ai,A0).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(T(this,oi).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,oi).get(s),r)}}getEventName(e){const t=fe(this,ai,v0).call(this,e,null,!1);return z(t,"no matching event","key",e),t.name}hasEvent(e){return!!fe(this,ai,v0).call(this,e,null,!1)}getEvent(e,t){return fe(this,ai,v0).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(T(this,ii).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,ii).get(s),r)}}getError(e,t){if(Ct(e)){const s=e.toLowerCase();if(jI[s])return lr.from(jI[s].signature);for(const i of T(this,si).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,si))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?lr.from("error Error(string)"):e==="Panic"?lr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");z(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=lr.from(e).format(),e==="Error(string)")return lr.from("error Error(string)");if(e==="Panic(uint256)")return lr.from("error Panic(uint256)");const r=T(this,si).get(e);return r||null}forEachError(e){const t=Array.from(T(this,si).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,si).get(s),r)}}_decodeParams(e,t){return T(this,Pn).decode(e,t)}_encodeParams(e,t){return T(this,Pn).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);z(r,"unknown error","fragment",e),e=r}return z(Vt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);z(r,"unknown error","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return z(Vt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const i=this.getFunction(e);z(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Vn(t);if(s.length%32===0)try{return T(this,Pn).decode(e.outputs,s)}catch{r="could not decode result data"}ee(!1,r,"BAD_DATA",{value:we(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const r=ct(e,"data"),s=yu.getBuiltinCallException("call",t,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=we(r.slice(0,4)),l=this.getError(a);if(l)try{const c=T(this,Pn).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:c},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(t);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return we(T(this,Pn).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);z(i,"unknown event","eventFragment",e),e=i}ee(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?dl(o):i.type==="bytes"?Xt(we(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=_o(o):i.type.match(/^bytes/)?o=UJ(o,32):i.type==="address"&&T(this,Pn).encode(["address"],[o]),il(we(o),32));for(t.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){z(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?z(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){if(typeof e=="string"){const o=this.getEvent(e);z(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),z(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(dl(l));else if(o.type==="bytes")r.push(Xt(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Pn).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Pn).encode(s,i),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"){const h=this.getEvent(e);z(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;z(Ct(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(An.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Pn).decode(s,zt(r)):null,l=T(this,Pn).decode(i,t,!0),c=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new _I(null);else if(o[p])m=new _I(a[d++]);else try{m=a[d++]}catch(y){m=y}else try{m=l[f++]}catch(y){m=y}c.push(m),u.push(h.name||null)}),ou.fromItems(c,u)}parseTransaction(e){const t=ct(e.data,"tx.data"),r=xe(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(we(t.slice(0,4)));if(!s)return null;const i=T(this,Pn).decode(s.inputs,t.slice(4));return new iZ(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new sZ(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=we(e),r=this.getError(Vt(t,0,4));if(!r)return null;const s=T(this,Pn).decode(r.inputs,Vt(t,4));return new oZ(r,r.selector,s)}static from(e){return e instanceof Vl?e:typeof e=="string"?new Vl(JSON.parse(e)):typeof e.formatJson=="function"?new Vl(e.formatJson()):typeof e.format=="function"?new Vl(e.format("json")):new Vl(e)}};si=new WeakMap,ii=new WeakMap,oi=new WeakMap,Pn=new WeakMap,ai=new WeakSet,A0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,oi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,oi))o.split("(")[0]===e&&i.push(a);if(t){const o=t.length>0?t[t.length-1]:null;let a=t.length,l=!0;Nn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let c=i.length-1;c>=0;c--){const u=i[c].inputs.length;u!==a&&(!l||u!==a-1)&&i.splice(c,1)}for(let c=i.length-1;c>=0;c--){const u=i[c].inputs;for(let f=0;f<t.length;f++)if(Nn.isTyped(t[f])){if(f>=u.length){if(t[f].type==="overrides")continue;i.splice(c,1);break}if(t[f].type!==u[f].baseType){i.splice(c,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const o=t[t.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");z(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,oi).get(ei.from(e).format());return s||null},v0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,ii).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,ii))o.split("(")[0]===e&&i.push(a);if(t){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<t.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<t.length;l++)if(Nn.isTyped(t[l])&&t[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");z(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,ii).get(Zs.from(e).format());return s||null};let z1=Vl;const UI=BigInt(0);function bu(n){return n??null}function Wt(n){return n==null?null:n.toString()}class VI{constructor(e,t,r){G(this,"gasPrice");G(this,"maxFeePerGas");G(this,"maxPriorityFeePerGas");Ne(this,{gasPrice:bu(e),maxFeePerGas:bu(t),maxPriorityFeePerGas:bu(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Wt(e),maxFeePerGas:Wt(t),maxPriorityFeePerGas:Wt(r)}}}function xy(n){const e={};n.to&&(e.to=n.to),n.from&&(e.from=n.from),n.data&&(e.data=we(n.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in n)||n[s]==null||(e[s]=xe(n[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in n)||n[s]==null||(e[s]=Je(n[s],`request.${s}`));return n.accessList&&(e.accessList=$o(n.accessList)),"blockTag"in n&&(e.blockTag=n.blockTag),"enableCcipRead"in n&&(e.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(e.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(e.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(e.kzg=n.kzg),"blobs"in n&&n.blobs&&(e.blobs=n.blobs.map(s=>Zv(s)?we(s):Object.assign({},s))),e}class aZ{constructor(e,t){G(this,"provider");G(this,"number");G(this,"hash");G(this,"timestamp");G(this,"parentHash");G(this,"parentBeaconBlockRoot");G(this,"nonce");G(this,"difficulty");G(this,"gasLimit");G(this,"gasUsed");G(this,"stateRoot");G(this,"receiptsRoot");G(this,"blobGasUsed");G(this,"excessBlobGas");G(this,"miner");G(this,"prevRandao");G(this,"extraData");G(this,"baseFeePerGas");J(this,eo);L(this,eo,e.transactions.map(r=>typeof r!="string"?new gh(r,t):r)),Ne(this,{provider:t,hash:bu(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:bu(e.prevRandao),extraData:e.extraData,baseFeePerGas:bu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,eo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,eo).slice();return e.length===0?[]:(ee(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:y}=this;return{_type:"Block",baseFeePerGas:Wt(e),difficulty:Wt(t),extraData:r,gasLimit:Wt(s),gasUsed:Wt(i),blobGasUsed:Wt(this.blobGasUsed),excessBlobGas:Wt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:y}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,eo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=T(this,eo)[e];else{const r=e.toLowerCase();for(const s of T(this,eo))if(typeof s=="string"){if(s!==r)continue;t=s;break}else{if(s.hash===r)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const r of t)if(r.hash===e)return r;z(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return lZ(this)}}eo=new WeakMap;class mh{constructor(e,t){G(this,"provider");G(this,"transactionHash");G(this,"blockHash");G(this,"blockNumber");G(this,"removed");G(this,"address");G(this,"data");G(this,"topics");G(this,"index");G(this,"transactionIndex");this.provider=t;const r=Object.freeze(e.topics.slice());Ne(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}=this;return{_type:"log",address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return ee(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return cZ(this)}}class HI{constructor(e,t){G(this,"provider");G(this,"to");G(this,"from");G(this,"contractAddress");G(this,"hash");G(this,"index");G(this,"blockHash");G(this,"blockNumber");G(this,"logsBloom");G(this,"gasUsed");G(this,"blobGasUsed");G(this,"cumulativeGasUsed");G(this,"gasPrice");G(this,"blobGasPrice");G(this,"type");G(this,"status");G(this,"root");J(this,Hh);L(this,Hh,Object.freeze(e.logs.map(s=>new mh(s,t))));let r=UI;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Ne(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,Hh)}toJSON(){const{to:e,from:t,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:c,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Wt(this.cumulativeGasUsed),from:t,gasPrice:Wt(this.gasPrice),blobGasUsed:Wt(this.blobGasUsed),blobGasPrice:Wt(this.blobGasPrice),gasUsed:Wt(this.gasUsed),hash:s,index:i,logs:c,logsBloom:l,root:f,status:u,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return $I(this)}reorderedEvent(e){return ee(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),zI(this,e)}}Hh=new WeakMap;const vE=class vE{constructor(e,t){G(this,"provider");G(this,"blockNumber");G(this,"blockHash");G(this,"index");G(this,"hash");G(this,"type");G(this,"to");G(this,"from");G(this,"nonce");G(this,"gasLimit");G(this,"gasPrice");G(this,"maxPriorityFeePerGas");G(this,"maxFeePerGas");G(this,"maxFeePerBlobGas");G(this,"data");G(this,"value");G(this,"chainId");G(this,"signature");G(this,"accessList");G(this,"blobVersionedHashes");J(this,sa);this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,L(this,sa,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:c,signature:u,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:Wt(this.chainId),data:c,from:a,gasLimit:Wt(this.gasLimit),gasPrice:Wt(this.gasPrice),hash:s,maxFeePerGas:Wt(this.maxFeePerGas),maxPriorityFeePerGas:Wt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Wt(this.maxFeePerBlobGas),nonce:l,signature:u,to:o,index:r,type:i,value:Wt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:r}=await On({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:r-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const r=e??1,s=t??0;let i=T(this,sa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await On({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){i=d;return}if(a)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(o===-1&&(o=i-3,o<T(this,sa)&&(o=T(this,sa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const y of m)if(y===this.hash)return;for(let y=0;y<m.length;y++){const b=await m.getTransaction(y);if(b.from===this.from&&b.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(b.hash);if(v==null||d-v.blockNumber+1<r)return;let A="replaced";b.data===this.data&&b.to===this.to&&b.value===this.value?A="repriced":b.data==="0x"&&b.from===b.to&&b.value===UI&&(A="cancelled"),ee(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:A==="replaced"||A==="cancelled",reason:A,replacement:b.replaceableTransaction(i),hash:b.hash,receipt:v})}}o++}},c=d=>{if(d==null||d.status!==0)return d;ee(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},u=await this.provider.getTransactionReceipt(this.hash);if(r===0)return c(u);if(u){if(await u.confirmations()>=r)return c(u)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(b=>b())};if(p.push(()=>{a=!0}),s>0){const b=setTimeout(()=>{m(),h(Mt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const y=async b=>{if(await b.confirmations()>=r){m();try{d(c(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),i>=0){const b=async()=>{try{await l()}catch(v){if(dn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",b)};p.push(()=>{this.provider.off("block",b)}),this.provider.once("block",b)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),$I(this)}reorderedEvent(e){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ee(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),zI(this,e)}replaceableTransaction(e){z(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new vE(this,this.provider);return L(t,sa,e),t}};sa=new WeakMap;let gh=vE;function lZ(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function zI(n,e){return{orphan:"reorder-transaction",tx:n,other:e}}function $I(n){return{orphan:"drop-transaction",tx:n}}function cZ(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class $1 extends mh{constructor(t,r,s){super(t,t.provider);G(this,"interface");G(this,"fragment");G(this,"args");const i=r.decodeEventLog(s,t.data,t.topics);Ne(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class GI extends mh{constructor(t,r){super(t,t.provider);G(this,"error");Ne(this,{error:r})}}class uZ extends HI{constructor(t,r,s){super(s,r);J(this,sf);L(this,sf,t)}get logs(){return super.logs.map(t=>{const r=t.topics.length?T(this,sf).getEvent(t.topics[0]):null;if(r)try{return new $1(t,T(this,sf),r)}catch(s){return new GI(t,s)}return t})}}sf=new WeakMap;class G1 extends gh{constructor(t,r,s){super(s,r);J(this,zh);L(this,zh,t)}async wait(t,r){const s=await super.wait(t,r);return s==null?null:new uZ(T(this,zh),this.provider,s)}}zh=new WeakMap;class WI extends CP{constructor(t,r,s,i){super(t,r,s);G(this,"log");Ne(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class fZ extends WI{constructor(e,t,r,s,i){super(e,t,r,new $1(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Ne(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const KI=BigInt(0);function QI(n){return n&&typeof n.call=="function"}function JI(n){return n&&typeof n.estimateGas=="function"}function Ey(n){return n&&typeof n.resolveName=="function"}function qI(n){return n&&typeof n.sendTransaction=="function"}function YI(n){if(n!=null){if(Ey(n))return n;if(n.provider)return n.provider}}class dZ{constructor(e,t,r){J(this,$h);G(this,"fragment");if(Ne(this,{fragment:t}),t.inputs.length<r.length)throw new Error("too many arguments");const s=bl(e.runner,"resolveName"),i=Ey(s)?s:null;L(this,$h,async function(){const o=await Promise.all(t.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>Gn(d,i))):Gn(f,i):f)));return e.interface.encodeFilterTopics(t,o)}())}getTopicFilter(){return T(this,$h)}}$h=new WeakMap;function bl(n,e){return n==null?null:typeof n[e]=="function"?n:n.provider&&typeof n.provider[e]=="function"?n.provider:null}function wl(n){return n==null?null:n.provider||null}async function XI(n,e){const t=Nn.dereference(n,"overrides");z(typeof t=="object","invalid overrides parameter","overrides",n);const r=xy(t);return z(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),z(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function hZ(n,e,t){const r=bl(n,"resolveName"),s=Ey(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(t[o],(a,l)=>(l=Nn.dereference(l,a),a==="address"?Gn(l,s):l))))}function pZ(n){const e=async function(o){const a=await XI(o,["data"]);a.to=await n.getAddress(),a.from&&(a.from=await Gn(a.from,YI(n.runner)));const l=n.interface,c=xe(a.value||KI,"overrides.value")===KI,u=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!u&&!c&&z(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),z(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return z(f||c,"cannot send value to non-payable fallback","overrides.value",a.value),z(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},t=async function(o){const a=bl(n.runner,"call");ee(QI(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(c){throw Xv(c)&&c.data?n.interface.makeError(c.data,l):c}},r=async function(o){const a=n.runner;ee(qI(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),c=wl(n.runner);return new G1(n.interface,c,l)},s=async function(o){const a=bl(n.runner,"estimateGas");return ee(JI(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await r(o);return Ne(i,{_contract:n,estimateGas:s,populateTransaction:e,send:r,staticCall:t}),i}function mZ(n,e){const t=function(...c){const u=n.interface.getFunction(e,c);return ee(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:c}}),u},r=async function(...c){const u=t(...c);let f={};if(u.inputs.length+1===c.length&&(f=await XI(c.pop()),f.from&&(f.from=await Gn(f.from,YI(n.runner)))),u.inputs.length!==c.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await hZ(n.runner,u.inputs,c);return Object.assign({},f,await On({to:n.getAddress(),data:n.interface.encodeFunctionData(u,d)}))},s=async function(...c){const u=await a(...c);return u.length===1?u[0]:u},i=async function(...c){const u=n.runner;ee(qI(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await r(...c)),d=wl(n.runner);return new G1(n.interface,d,f)},o=async function(...c){const u=bl(n.runner,"estimateGas");return ee(JI(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await r(...c))},a=async function(...c){const u=bl(n.runner,"call");ee(QI(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...c);let d="0x";try{d=await u.call(f)}catch(p){throw Xv(p)&&p.data?n.interface.makeError(p.data,f):p}const h=t(...c);return n.interface.decodeFunctionResult(h,d)},l=async(...c)=>t(...c).constant?await s(...c):await i(...c);return Ne(l,{name:n.interface.getFunctionName(e),_contract:n,_key:e,getFragment:t,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const c=n.interface.getFunction(e);return ee(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),c}}),l}function gZ(n,e){const t=function(...s){const i=n.interface.getEvent(e,s);return ee(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new dZ(n,t(...s),s)};return Ne(r,{name:n.interface.getEventName(e),_contract:n,_key:e,getFragment:t}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=n.interface.getEvent(e);return ee(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const Cy=Symbol.for("_ethersInternal_contract"),ZI=new WeakMap;function yZ(n,e){ZI.set(n[Cy],e)}function Tr(n){return ZI.get(n[Cy])}function bZ(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function W1(n,e){let t,r=null;if(Array.isArray(e)){const i=function(o){if(Ct(o,32))return o;const a=n.interface.getEvent(o);return z(a,"unknown fragment","name",o),a.topicHash};t=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?t=[null]:typeof e=="string"?Ct(e,32)?t=[e]:(r=n.interface.getEvent(e),z(r,"unknown fragment","event",e),t=[r.topicHash]):bZ(e)?t=await e.getTopicFilter():"fragment"in e?(r=e.fragment,t=[r.topicHash]):z(!1,"unknown event name","event",e);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:t}}async function yh(n,e){const{subs:t}=Tr(n);return t.get((await W1(n,e)).tag)||null}async function eL(n,e,t){const r=wl(n.runner);ee(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await W1(n,t),{addr:a,subs:l}=Tr(n);let c=l.get(i);if(!c){const f={address:a||n,topics:o},d=y=>{let b=s;if(b==null)try{b=n.interface.getEvent(y.topics[0])}catch{}if(b){const v=b,A=s?n.interface.decodeEventLog(s,y.data,y.topics):[];Q1(n,t,A,w=>new fZ(n,w,t,v,y))}else Q1(n,t,[],v=>new WI(n,v,t,y))};let h=[];c={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let y=h;h=[],await Promise.all(y),r.off(f,d)}},l.set(i,c)}return c}let K1=Promise.resolve();async function wZ(n,e,t,r){await K1;const s=await yh(n,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(t);r&&l.push(r(a?null:o));try{o.call(n,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Tr(n).subs.delete(s.tag)),i>0}async function Q1(n,e,t,r){try{await K1}catch{}const s=wZ(n,e,t,r);return K1=s,await s}const ky=["then"];tF=Cy;const Gh=class Gh{constructor(e,t,r,s){G(this,"target");G(this,"interface");G(this,"runner");G(this,"filters");G(this,tF);G(this,"fallback");z(typeof e=="string"||ID(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=z1.from(t);Ne(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,Cy,{value:{}});let o,a=null,l=null;if(s){const f=wl(r);l=new G1(this.interface,f,s)}let c=new Map;if(typeof e=="string")if(Ct(e))a=e,o=Promise.resolve(e);else{const f=bl(r,"resolveName");if(!Ey(f))throw Mt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Mt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Tr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Tr(this).addr=f,f});yZ(this,{addrPromise:o,addr:a,deployTx:l,subs:c});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>ky.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Ne(this,{filters:u}),Ne(this,{fallback:i.receive||i.fallback?pZ(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||ky.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Gh(this.target,this.interface,e)}attach(e){return new Gh(e,this.interface,this.runner)}async getAddress(){return await Tr(this).addrPromise}async getDeployedCode(){const e=wl(this.runner);ee(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=wl(this.runner);return ee(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Tr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),mZ(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),gZ(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,r){t==null&&(t=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Tr(this),o=s||await i,{fragment:a,topics:l}=await W1(this,e),c={address:o,topics:l,fromBlock:t,toBlock:r},u=wl(this.runner);return ee(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new $1(f,this.interface,d)}catch(h){return new GI(f,h)}return new mh(f,u)})}async on(e,t){const r=await eL(this,"on",e);return r.listeners.push({listener:t,once:!1}),r.start(),this}async once(e,t){const r=await eL(this,"once",e);return r.listeners.push({listener:t,once:!0}),r.start(),this}async emit(e,...t){return await Q1(this,e,t,null)}async listenerCount(e){if(e){const s=await yh(this,e);return s?s.listeners.length:0}const{subs:t}=Tr(this);let r=0;for(const{listeners:s}of t.values())r+=s.length;return r}async listeners(e){if(e){const s=await yh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=Tr(this);let r=[];for(const{listeners:s}of t.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,t){const r=await yh(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(t==null||r.listeners.length===0)&&(r.stop(),Tr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const t=await yh(this,e);if(!t)return this;t.stop(),Tr(this).subs.delete(t.tag)}else{const{subs:t}=Tr(this);for(const{tag:r,stop:s}of t.values())s(),t.delete(r)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends Gh{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,r){return r==null&&(r=null),new this(e,t,r)}};let J1=Gh;function AZ(){return J1}class wu extends AZ(){}function q1(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):z(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class vZ{constructor(e){G(this,"name");Ne(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const tL=new RegExp("^(ipfs)://(.*)$","i"),nL=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),tL,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],of=class of{constructor(e,t,r){J(this,oa);G(this,"provider");G(this,"address");G(this,"name");J(this,ia);J(this,Hl);Ne(this,{provider:e,address:t,name:r}),L(this,ia,null),L(this,Hl,new wu(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,ia)==null&&L(this,ia,(async()=>{try{return await T(this,Hl).supportsInterface("0x9061b923")}catch(e){if(dn(e,"CALL_EXCEPTION"))return!1;throw L(this,ia,null),e}})()),await T(this,ia)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,oa,Of).call(this,"addr(bytes32)");return i==null||i===sh?null:i}catch(i){if(dn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[i]);if(Ct(o,20))return pt(o)}let t=null;for(const i of this.provider.plugins)if(i instanceof vZ&&i.supportsCoinType(e)){t=i;break}if(t==null)return null;const r=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await t.decodeAddress(e,r);if(s!=null)return s;ee(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const t=await fe(this,oa,Of).call(this,"text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await fe(this,oa,Of).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${s}://${zJ("0x"+t[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;ee(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let r=0;r<nL.length;r++){const s=t.match(nL[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const o=q1(t);return e.push({type:"ipfs",value:t}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:t});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const c=l[1],u=new wu(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await u.ownerOf(c);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await u.balanceOf(a,c);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await u[o](c);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",_o(c,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=q1(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new zn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const b=h.body;return b&&e.push({type:"!metadata",value:we(b)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(tL)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=q1(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),r=t.getPlugin("org.ethers.plugins.network.Ens");return ee(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),r.address}static async fromName(e,t){var s;let r=t;for(;;){if(r===""||r==="."||t!=="eth"&&r==="eth")return null;const i=await fe(s=of,p0,lF).call(s,e,r);if(i!=null){const o=new of(e,i,t);return r!==t&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};ia=new WeakMap,Hl=new WeakMap,oa=new WeakSet,Of=async function(e,t){t=(t||[]).slice();const r=T(this,Hl).interface;t.unshift(I1(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),ee(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[xX(this.name,255),r.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const i=await T(this,Hl)[e](...t);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!dn(i,"CALL_EXCEPTION"))throw i}return null},p0=new WeakSet,lF=async function(e,t){const r=await of.getEnsAddress(e);try{const i=await new wu(r,["function resolver(bytes32) view returns (address)"],e).resolver(I1(t),{enableCcipRead:!0});return i===sh?null:i}catch(s){throw s}return null},J(of,p0);let Sy=of;const rL=BigInt(0);function at(n,e){return function(t){return t==null?e:n(t)}}function Ty(n,e){return t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(r=>n(r))}}function bh(n,e){return t=>{const r={};for(const s in n){let i=s;if(e&&s in e&&!(i in t)){for(const o of e[s])if(o in t){i=o;break}}try{const o=n[s](t[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";ee(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:t})}}return r}}function xZ(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}z(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function Au(n){return z(Ct(n,!0),"invalid data","value",n),n}function vn(n){return z(Ct(n,32),"invalid hash","value",n),n}const EZ=bh({address:pt,blockHash:vn,blockNumber:Je,data:Au,index:Je,removed:at(xZ,!1),topics:Ty(vn),transactionHash:vn,transactionIndex:Je},{index:["logIndex"]});function CZ(n){return EZ(n)}const kZ=bh({hash:at(vn),parentHash:vn,parentBeaconBlockRoot:at(vn,null),number:Je,timestamp:Je,nonce:at(Au),difficulty:xe,gasLimit:xe,gasUsed:xe,stateRoot:at(vn,null),receiptsRoot:at(vn,null),blobGasUsed:at(xe,null),excessBlobGas:at(xe,null),miner:at(pt),prevRandao:at(vn,null),extraData:Au,baseFeePerGas:at(xe)},{prevRandao:["mixHash"]});function SZ(n){const e=kZ(n);return e.transactions=n.transactions.map(t=>typeof t=="string"?t:sL(t)),e}const TZ=bh({transactionIndex:Je,blockNumber:Je,transactionHash:vn,address:pt,topics:Ty(vn),data:Au,index:Je,blockHash:vn},{index:["logIndex"]});function OZ(n){return TZ(n)}const NZ=bh({to:at(pt,null),from:at(pt,null),contractAddress:at(pt,null),index:Je,root:at(we),gasUsed:xe,blobGasUsed:at(xe,null),logsBloom:at(Au),blockHash:vn,hash:vn,logs:Ty(OZ),blockNumber:Je,cumulativeGasUsed:xe,effectiveGasPrice:at(xe),blobGasPrice:at(xe,null),status:at(Je),type:at(Je,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function MZ(n){return NZ(n)}function sL(n){n.to&&xe(n.to)===rL&&(n.to="0x0000000000000000000000000000000000000000");const e=bh({hash:vn,index:at(Je,void 0),type:t=>t==="0x"||t==null?0:Je(t),accessList:at($o,null),blobVersionedHashes:at(Ty(vn,!0),null),blockHash:at(vn,null),blockNumber:at(Je,null),transactionIndex:at(Je,null),from:pt,gasPrice:at(xe),maxPriorityFeePerGas:at(xe),maxFeePerGas:at(xe),maxFeePerBlobGas:at(xe,null),gasLimit:xe,to:at(pt,null),value:xe,nonce:Je,data:Au,creates:at(pt,null),chainId:at(xe,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(e.to==null&&e.creates==null&&(e.creates=CY(e)),(n.type===1||n.type===2)&&n.accessList==null&&(e.accessList=[]),n.signature?e.signature=ws.from(n.signature):e.signature=ws.from(n),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&xe(e.blockHash)===rL&&(e.blockHash=null),e}const RZ="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class wh{constructor(e){G(this,"name");Ne(this,{name:e})}clone(){return new wh(this.name)}}class Oy extends wh{constructor(t,r){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);G(this,"effectiveBlock");G(this,"txBase");G(this,"txCreate");G(this,"txDataZero");G(this,"txDataNonzero");G(this,"txAccessListStorageKey");G(this,"txAccessListAddress");const s={effectiveBlock:t};function i(o,a){let l=(r||{})[o];l==null&&(l=a),z(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Ne(this,s)}clone(){return new Oy(this.effectiveBlock,this)}}class Ny extends wh{constructor(t,r){super("org.ethers.plugins.network.Ens");G(this,"address");G(this,"targetNetwork");Ne(this,{address:t||RZ,targetNetwork:r??1})}clone(){return new Ny(this.address,this.targetNetwork)}}class PZ extends wh{constructor(t,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,Wh);J(this,Kh);L(this,Wh,t),L(this,Kh,r)}get url(){return T(this,Wh)}get processFunc(){return T(this,Kh)}clone(){return this}}Wh=new WeakMap,Kh=new WeakMap;const Y1=new Map,cf=class cf{constructor(e,t){J(this,af);J(this,lf);J(this,aa);L(this,af,e),L(this,lf,xe(t)),L(this,aa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,af)}set name(e){L(this,af,e)}get chainId(){return T(this,lf)}set chainId(e){L(this,lf,xe(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===xe(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===xe(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===xe(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,aa).values())}attachPlugin(e){if(T(this,aa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,aa).set(e.name,e.clone()),this}getPlugin(e){return T(this,aa).get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new cf(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Oy;let r=t.txBase;if(e.to==null&&(r+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=t.txDataZero:r+=t.txDataNonzero;if(e.accessList){const s=$o(e.accessList);for(const i in s)r+=t.txAccessListAddress+t.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(DZ(),e==null)return cf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Y1.get(e);if(t)return t();if(typeof e=="bigint")return new cf("unknown",e);z(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){z(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const t=new cf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Ny(e.ensAddress,e.ensNetwork)),t}z(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const r=Y1.get(e);r&&z(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),Y1.set(e,t)}};af=new WeakMap,lf=new WeakMap,aa=new WeakMap;let tn=cf;function iL(n,e){const t=String(n);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=t.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function oL(n){return new PZ(n,async(e,t,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:iL(a.maxFee,9),maxPriorityFeePerGas:iL(a.maxPriorityFee,9)}}catch(i){ee(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let aL=!1;function DZ(){if(aL)return;aL=!0;function n(e,t,r){const s=function(){const i=new tn(e,t);return r.ensNetwork!=null&&i.attachPlugin(new Ny(null,r.ensNetwork)),i.attachPlugin(new Oy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};tn.register(e,s),tn.register(t,s),r.altNames&&r.altNames.forEach(i=>{tn.register(i,s)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[oL("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[oL("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function X1(n){return JSON.parse(JSON.stringify(n))}class IZ{constructor(e){J(this,uf);J(this,to);J(this,Xr);J(this,la);J(this,li);L(this,to,e),L(this,Xr,null),L(this,la,4e3),L(this,li,-2)}get pollingInterval(){return T(this,la)}set pollingInterval(e){L(this,la,e)}start(){T(this,Xr)||(L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la))),fe(this,uf,x0).call(this))}stop(){T(this,Xr)&&(T(this,to)._clearTimeout(T(this,Xr)),L(this,Xr,null))}pause(e){this.stop(),e&&L(this,li,-2)}resume(){this.start()}}to=new WeakMap,Xr=new WeakMap,la=new WeakMap,li=new WeakMap,uf=new WeakSet,x0=async function(){try{const e=await T(this,to).getBlockNumber();if(T(this,li)===-2){L(this,li,e);return}if(e!==T(this,li)){for(let t=T(this,li)+1;t<=e;t++){if(T(this,Xr)==null)return;await T(this,to).emit("block",t)}L(this,li,e)}}catch{}T(this,Xr)!=null&&L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la)))};class Z1{constructor(e){J(this,zl);J(this,$l);J(this,ca);L(this,zl,e),L(this,ca,!1),L(this,$l,t=>{this._poll(t,T(this,zl))})}async _poll(e,t){throw new Error("sub-classes must override this")}start(){T(this,ca)||(L(this,ca,!0),T(this,$l).call(this,-2),T(this,zl).on("block",T(this,$l)))}stop(){T(this,ca)&&(L(this,ca,!1),T(this,zl).off("block",T(this,$l)))}pause(e){this.stop()}resume(){this.start()}}zl=new WeakMap,$l=new WeakMap,ca=new WeakMap;class LZ extends Z1{constructor(t,r){super(t);J(this,ff);J(this,no);L(this,ff,r),L(this,no,-2)}pause(t){t&&L(this,no,-2),super.pause(t)}async _poll(t,r){const s=await r.getBlock(T(this,ff));s!=null&&(T(this,no)===-2?L(this,no,s.number):s.number>T(this,no)&&(r.emit(T(this,ff),s.number),L(this,no,s.number)))}}ff=new WeakMap,no=new WeakMap;class BZ extends Z1{constructor(t,r){super(t);J(this,m0);L(this,m0,X1(r))}async _poll(t,r){throw new Error("@TODO")}}m0=new WeakMap;class _Z extends Z1{constructor(t,r){super(t);J(this,df);L(this,df,r)}async _poll(t,r){const s=await r.getTransactionReceipt(T(this,df));s&&r.emit(T(this,df),s)}}df=new WeakMap;class ex{constructor(e,t){J(this,g0);J(this,ro);J(this,hf);J(this,pf);J(this,ua);J(this,Zr);L(this,ro,e),L(this,hf,X1(t)),L(this,pf,fe(this,g0,cF).bind(this)),L(this,ua,!1),L(this,Zr,-2)}start(){T(this,ua)||(L(this,ua,!0),T(this,Zr)===-2&&T(this,ro).getBlockNumber().then(e=>{L(this,Zr,e)}),T(this,ro).on("block",T(this,pf)))}stop(){T(this,ua)&&(L(this,ua,!1),T(this,ro).off("block",T(this,pf)))}pause(e){this.stop(),e&&L(this,Zr,-2)}resume(){this.start()}}ro=new WeakMap,hf=new WeakMap,pf=new WeakMap,ua=new WeakMap,Zr=new WeakMap,g0=new WeakSet,cF=async function(e){if(T(this,Zr)===-2)return;const t=X1(T(this,hf));t.fromBlock=T(this,Zr)+1,t.toBlock=e;const r=await T(this,ro).getLogs(t);if(r.length===0){T(this,Zr)<e-60&&L(this,Zr,e-60);return}for(const s of r)T(this,ro).emit(T(this,hf),s),L(this,Zr,s.blockNumber)};const FZ=BigInt(2),jZ=10;function My(n){return n&&typeof n.then=="function"}function Ry(n,e){return n+":"+JSON.stringify(e,(t,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class Py{constructor(e){G(this,"name");Ne(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function UZ(n){return JSON.parse(JSON.stringify(n))}function tx(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function nx(n,e){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(Ct(n,32)){const t=n.toLowerCase();return{type:"transaction",tag:Ry("tx",{hash:t}),hash:t}}if(n.orphan){const t=n;return{type:"orphan",tag:Ry("orphan",t),filter:UZ(t)}}if(n.address||n.topics){const t=n,r={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?tx(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],i=[],o=a=>{Ct(a)?s.push(a):i.push((async()=>{s.push(await Gn(a,e))})())};Array.isArray(t.address)?t.address.forEach(o):o(t.address),i.length&&await Promise.all(i),r.address=tx(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ry("event",r),type:"event"}}z(!1,"unknown ProviderEvent","event",n)}function rx(){return new Date().getTime()}const VZ={cacheTimeout:250,pollingInterval:4e3};class Dy{constructor(e,t){J(this,rt);J(this,Dn);J(this,fa);J(this,In);J(this,mf);J(this,Pr);J(this,Gl);J(this,da);J(this,so);J(this,Qh);J(this,es);J(this,gf);J(this,yf);if(L(this,yf,Object.assign({},VZ,t||{})),e==="any")L(this,Gl,!0),L(this,Pr,null);else if(e){const r=tn.from(e);L(this,Gl,!1),L(this,Pr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,Gl,!1),L(this,Pr,null);L(this,so,-1),L(this,da,new Map),L(this,Dn,new Map),L(this,fa,new Map),L(this,In,null),L(this,mf,!1),L(this,Qh,1),L(this,es,new Map),L(this,gf,!1)}get pollingInterval(){return T(this,yf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,fa).values())}attachPlugin(e){if(T(this,fa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,fa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,fa).get(e)||null}get disableCcipRead(){return T(this,gf)}set disableCcipRead(e){L(this,gf,!!e)}async ccipReadFetch(e,t,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],c=l.replace("{sender}",s).replace("{data}",i),u=new zn(c);l.indexOf("{data}")===-1&&(u.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:u,index:a,urls:r});let f="unknown error";const d=await u.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:u,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,result:h})}catch{}ee(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:f}}),o.push(f)}ee(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,t){return new aZ(SZ(e),this)}_wrapLog(e,t){return new mh(CZ(e),this)}_wrapTransactionReceipt(e,t){return new HI(MZ(e),this)}_wrapTransactionResponse(e,t){return new gh(sL(e),this)}_detectNetwork(){ee(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){ee(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Je(await fe(this,rt,Dr).call(this,{method:"getBlockNumber"}),"%response");return T(this,so)>=0&&L(this,so,e),e}_getAddress(e){return Gn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Ct(e))return Ct(e,32)?e:ol(e);if(typeof e=="bigint"&&(e=Je(e,"blockTag")),typeof e=="number")return e>=0?ol(e):T(this,so)>=0?ol(T(this,so)+e):this.getBlockNumber().then(t=>ol(t+e));z(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?tx(l.map(c=>c.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,c,u)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(c!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),t.length&&(d.topics=t),c&&(d.fromBlock=c),u&&(d.toBlock=u),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const t=xy(e),r=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const i=Gn(t[s],this);My(i)?r.push(async function(){t[s]=await i}()):t[s]=i}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);My(s)?r.push(async function(){t.blockTag=await s}()):t.blockTag=s}return r.length?async function(){return await Promise.all(r),t}():t}async getNetwork(){if(T(this,Pr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Pr)===s&&L(this,Pr,null),i}})();return L(this,Pr,s),(await s).clone()}const e=T(this,Pr),[t,r]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==r.chainId&&(T(this,Gl)?(this.emit("network",r,t),T(this,Pr)===e&&L(this,Pr,Promise.resolve(r))):ee(!1,`network changed: ${t.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await On({_block:fe(this,rt,DE).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getGasPrice"});return xe(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getPriorityFee"});return xe(u,"%response")}catch{}return null})()});let a=null,l=null;const c=this._wrapBlock(s,e);return c&&c.baseFeePerGas&&(l=o??BigInt("1000000000"),a=c.baseFeePerGas*FZ+l),new VI(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new zn(r.url),i=await r.processFunc(t,this,s);return new VI(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return My(t)&&(t=await t),xe(await fe(this,rt,Dr).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(e){const{tx:t,blockTag:r}=await On({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,rt,PE).call(this,fe(this,rt,RE).call(this,t,r,e.enableCcipRead?0:-1))}async getBalance(e,t){return xe(await fe(this,rt,ep).call(this,{method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return Je(await fe(this,rt,ep).call(this,{method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return we(await fe(this,rt,ep).call(this,{method:"getCode"},e,t))}async getStorage(e,t,r){const s=xe(t,"position");return we(await fe(this,rt,ep).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:t,hash:r,network:s}=await On({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=hh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(t)}async getBlock(e,t){const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,DE).call(this,e,!!t)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,t)}async getTransactionReceipt(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,t)}async getTransactionResult(e){const{result:t}=await On({network:this.getNetwork(),result:fe(this,rt,Dr).call(this,{method:"getTransactionResult",hash:e})});return t==null?null:we(t)}async getLogs(e){let t=this._getFilter(e);My(t)&&(t=await t);const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getLogs",filter:t})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){ee(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Sy.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=pt(e);const t=I1(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Sy.getEnsAddress(this),i=await new wu(r,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===sh)return null;const a=await new wu(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(a)!==e?null:a}catch(r){if(dn(r,"BAD_DATA")&&r.value==="0x"||dn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,t,r){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async c=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&c-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Mt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){ee(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=T(this,es).get(e);t&&(t.timer&&clearTimeout(t.timer),T(this,es).delete(e))}_setTimeout(e,t){t==null&&(t=0);const r=Xh(this,Qh)._++,s=()=>{T(this,es).delete(r),e()};if(this.paused)T(this,es).set(r,{timer:null,func:s,time:t});else{const i=setTimeout(s,t);T(this,es).set(r,{timer:i,func:s,time:rx()})}return r}_forEachSubscriber(e){for(const t of T(this,Dn).values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Py(e.type);case"block":{const t=new IZ(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new LZ(this,e.type);case"event":return new ex(this,e.filter);case"transaction":return new _Z(this,e.hash);case"orphan":return new BZ(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const r of T(this,Dn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=t,r.started&&t.start(),T(this,In)!=null&&t.pause(T(this,In));break}}async on(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async once(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async emit(e,...t){const r=await fe(this,rt,tp).call(this,e,t);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new CP(this,o?null:i,e);try{i.call(this,...t,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.length:0}let t=0;for(const{listeners:r}of T(this,Dn).values())t+=r.length;return t}async listeners(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:r}of T(this,Dn).values())t=t.concat(r.map(({listener:s})=>s));return t}async off(e,t){const r=await fe(this,rt,tp).call(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(!t||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:r,subscriber:s}=await fe(this,rt,E0).call(this,e);r&&s.stop(),T(this,Dn).delete(t)}else for(const[t,{started:r,subscriber:s}]of T(this,Dn))r&&s.stop(),T(this,Dn).delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return T(this,mf)}destroy(){this.removeAllListeners();for(const e of T(this,es).keys())this._clearTimeout(e);L(this,mf,!0)}get paused(){return T(this,In)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,so,-1),T(this,In)!=null){if(T(this,In)==!!e)return;ee(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),L(this,In,!!e);for(const t of T(this,es).values())t.timer&&clearTimeout(t.timer),t.time=rx()-t.time}resume(){if(T(this,In)!=null){this._forEachSubscriber(e=>e.resume()),L(this,In,null);for(const e of T(this,es).values()){let t=e.time;t<0&&(t=0),e.time=rx(),setTimeout(e.func,t)}}}}Dn=new WeakMap,fa=new WeakMap,In=new WeakMap,mf=new WeakMap,Pr=new WeakMap,Gl=new WeakMap,da=new WeakMap,so=new WeakMap,Qh=new WeakMap,es=new WeakMap,gf=new WeakMap,yf=new WeakMap,rt=new WeakSet,Dr=async function(e){const t=T(this,yf).cacheTimeout;if(t<0)return await this._perform(e);const r=Ry(e.method,e);let s=T(this,da).get(r);return s||(s=this._perform(e),T(this,da).set(r,s),setTimeout(()=>{T(this,da).get(r)===s&&T(this,da).delete(r)},t)),await s},RE=async function(e,t,r){ee(r<jZ,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=xy(e);try{return we(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(i){if(!this.disableCcipRead&&Xv(i)&&i.data&&r>=0&&t==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Gn(s.to,this);let l;try{l=WZ(Vt(i.data,4))}catch(f){ee(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}ee(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const c=await this.ccipReadFetch(s,l.calldata,l.urls);ee(c!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const u={to:a,data:zt([l.selector,GZ([c,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await fe(this,rt,RE).call(this,u,t,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},PE=async function(e){const{value:t}=await On({network:this.getNetwork(),value:e});return t},ep=async function(e,t,r){let s=this._getAddress(t),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,rt,PE).call(this,fe(this,rt,Dr).call(this,Object.assign(e,{address:s,blockTag:i})))},DE=async function(e,t){if(Ct(e,32))return await fe(this,rt,Dr).call(this,{method:"getBlock",blockHash:e,includeTransactions:t});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,rt,Dr).call(this,{method:"getBlock",blockTag:r,includeTransactions:t})},tp=async function(e,t){let r=await nx(e,this);return r.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(r=await nx({orphan:"drop-log",log:t[0]},this)),T(this,Dn).get(r.tag)||null},E0=async function(e){const t=await nx(e,this),r=t.tag;let s=T(this,Dn).get(r);return s||(s={subscriber:this._getSubscriber(t),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Dn).set(r,s)),s};function HZ(n,e){try{const t=sx(n,e);if(t)return iu(t)}catch{}return null}function sx(n,e){if(n==="0x")return null;try{const t=Je(Vt(n,e,e+32)),r=Je(Vt(n,t,t+32));return Vt(n,t+32,t+32+r)}catch{}return null}function lL(n){const e=Hn(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function zZ(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}const $Z=new Uint8Array([]);function GZ(n){const e=[];let t=0;for(let r=0;r<n.length;r++)e.push($Z),t+=32;for(let r=0;r<n.length;r++){const s=ct(n[r]);e[r]=lL(t),e.push(lL(s.length)),e.push(zZ(s)),t+=32+Math.ceil(s.length/32)*32}return zt(e)}const cL="0x0000000000000000000000000000000000000000000000000000000000000000";function WZ(n){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};ee(ru(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Vt(n,0,32);ee(Vt(t,0,12)===Vt(cL,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(t,12);try{const r=[],s=Je(Vt(n,32,64)),i=Je(Vt(n,s,s+32)),o=Vt(n,s+32);for(let a=0;a<i;a++){const l=HZ(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{ee(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=sx(n,64);if(r==null)throw new Error("abort");e.calldata=r}catch{ee(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}ee(Vt(n,100,128)===Vt(cL,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(n,96,100);try{const r=sx(n,128);if(r==null)throw new Error("abort");e.extraData=r}catch{ee(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function vu(n,e){if(n.provider)return n.provider;ee(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function uL(n,e){let t=xy(e);if(t.to!=null&&(t.to=Gn(t.to,n)),t.from!=null){const r=t.from;t.from=Promise.all([n.getAddress(),Gn(r,n)]).then(([s,i])=>(z(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else t.from=n.getAddress();return await On(t)}class KZ{constructor(e){G(this,"provider");Ne(this,{provider:e||null})}async getNonce(e){return vu(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await uL(this,e)}async populateTransaction(e){const t=vu(this,"populateTransaction"),r=await uL(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const s=await this.provider.getNetwork();if(r.chainId!=null){const o=xe(r.chainId);z(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?z(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&z(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await t.getFeeData();ee(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await t.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(ee(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):ee(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await On(r)}async estimateGas(e){return vu(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return vu(this,"call").call(await this.populateCall(e))}async resolveName(e){return await vu(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=vu(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=hh.from(r);return await t.broadcastTransaction(await this.signTransaction(s))}}const fL=new Set;function xu(n){fL.has(n)||(fL.add(n),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${n} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function QZ(n){return JSON.parse(JSON.stringify(n))}class dL{constructor(e){J(this,pa);J(this,Kn);J(this,ci);J(this,Wl);J(this,ha);J(this,Kl);J(this,bf);L(this,Kn,e),L(this,ci,null),L(this,Wl,fe(this,pa,IE).bind(this)),L(this,ha,!1),L(this,Kl,null),L(this,bf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,ha)||(L(this,ha,!0),fe(this,pa,IE).call(this,-2))}stop(){T(this,ha)&&(L(this,ha,!1),L(this,bf,!0),fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Wl)))}pause(e){e&&fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Wl))}resume(){this.start()}}Kn=new WeakMap,ci=new WeakMap,Wl=new WeakMap,ha=new WeakMap,Kl=new WeakMap,bf=new WeakMap,pa=new WeakSet,IE=async function(e){try{T(this,ci)==null&&L(this,ci,this._subscribe(T(this,Kn)));let t=null;try{t=await T(this,ci)}catch(i){if(!dn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){L(this,ci,null),T(this,Kn)._recoverSubscriber(this,this._recover(T(this,Kn)));return}const r=await T(this,Kn).getNetwork();if(T(this,Kl)||L(this,Kl,r),T(this,Kl).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,bf))return;const s=await T(this,Kn).send("eth_getFilterChanges",[t]);await this._emitResults(T(this,Kn),s)}catch(t){console.log("@TODO",t)}T(this,Kn).once("block",T(this,Wl))},LE=function(){const e=T(this,ci);e&&(L(this,ci,null),e.then(t=>{T(this,Kn).destroyed||T(this,Kn).send("eth_uninstallFilter",[t])}))};class JZ extends dL{constructor(t,r){super(t);J(this,Ql);L(this,Ql,QZ(r))}_recover(t){return new ex(t,T(this,Ql))}async _subscribe(t){return await t.send("eth_newFilter",[T(this,Ql)])}async _emitResults(t,r){for(const s of r)t.emit(T(this,Ql),t._wrapLog(s,t._network))}}Ql=new WeakMap;class qZ extends dL{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const r of t)e.emit("pending",r)}}const YZ="bigint,boolean,function,number,string,symbol".split(/,/g);function Iy(n){if(n==null||YZ.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(Iy);if(typeof n=="object")return Object.keys(n).reduce((e,t)=>(e[t]=n[t],e),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function XZ(n){return new Promise(e=>{setTimeout(e,n)})}function Eu(n){return n&&n.toLowerCase()}function hL(n){return n&&typeof n.pollingInterval=="number"}const pL={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ix extends KZ{constructor(t,r){super(t);G(this,"address");r=pt(r),Ne(this,{address:r})}connect(t){ee(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const r=Iy(t),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Gn(o,this.provider);z(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Gn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const c=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(r));return}}catch(u){if(dn(u,"CANCELLED")||dn(u,"BAD_DATA")||dn(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(dn(u,"INVALID_ARGUMENT")&&(l++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,l>10)){o(u);return}this.provider.emit("error",Mt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(t){const r=Iy(t);if(r.from){const i=await Gn(r.from,this.provider);z(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("personal_sign",[we(r),this.address.toLowerCase()])}async signTypedData(t,r,s){const i=Iy(s),o=await wy.resolveNames(t,r,i,async a=>{const l=await Gn(a);return z(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(wy.getPayload(o.domain,r,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),we(r)])}}class mL extends Dy{constructor(t,r){super(t,r);J(this,Jh);J(this,Jl);J(this,wf);J(this,io);J(this,ui);J(this,Ss);J(this,ts);J(this,ur);L(this,wf,1),L(this,Jl,Object.assign({},pL,r||{})),L(this,io,[]),L(this,ui,null),L(this,ts,null),L(this,ur,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Ss,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(z(!s||t!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&t!=null&&L(this,ts,tn.from(t))):s&&(z(t==null||s.matches(t),"staticNetwork MUST match network object","options",r),L(this,ts,s))}_getOption(t){return T(this,Jl)[t]}get _network(){return ee(T(this,ts),"network is not available yet","NETWORK_ERROR"),T(this,ts)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let s=t.transaction;if(s&&s.type!=null&&xe(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(t);return r!=null?await this.send(r.method,r.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(T(this,ts))return T(this,ts)}else return t;return T(this,ur)?await T(this,ur):this.ready?(L(this,ur,(async()=>{try{const r=tn.from(xe(await this.send("eth_chainId",[])));return L(this,ur,null),r}catch(r){throw L(this,ur,null),r}})()),await T(this,ur)):(L(this,ur,(async()=>{const r={id:Xh(this,wf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],L(this,ur,null)}catch(i){throw L(this,ur,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return tn.from(xe(s.result));throw this.getRpcError(r,s)})()),await T(this,ur))}_start(){T(this,Ss)==null||T(this,Ss).resolve==null||(T(this,Ss).resolve(),L(this,Ss,null),(async()=>{for(;T(this,ts)==null&&!this.destroyed;)try{L(this,ts,await this._detectNetwork())}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Mt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await XZ(1e3)}fe(this,Jh,BE).call(this)})())}async _waitUntilReady(){if(T(this,Ss)!=null)return await T(this,Ss).promise}_getSubscriber(t){return t.type==="pending"?new qZ(this):t.type==="event"?this._getOption("polling")?new ex(this,t.filter):new JZ(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Py("orphan"):super._getSubscriber(t)}get ready(){return T(this,Ss)==null}getRpcTransaction(t){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(t[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=ol(xe(t[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{t[s]!=null&&(r[s]=we(t[s]))}),t.accessList&&(r.accessList=$o(t.accessList)),t.blobVersionedHashes&&(r.blobVersionedHashes=t.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Eu(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Eu(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Eu(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Eu(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Eu):t.filter.address=Eu(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,r){const{method:s}=t,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Mt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=ox(i),c=yu.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",t.params[0],l?l.data:null);return c.info={error:i,payload:t},c}const o=JSON.stringify(eee(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Mt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Mt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Mt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Mt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Mt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:l,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?Mt("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):Mt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,r){if(this.destroyed)return Promise.reject(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const s=Xh(this,wf)._++,i=new Promise((o,a)=>{T(this,io).push({resolve:o,reject:a,payload:{method:t,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Jh,BE).call(this),i}async getSigner(t){t==null&&(t=0);const r=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await r;if(t>=i.length)throw new Error("no such account");return new ix(this,i[t])}const{accounts:s}=await On({network:this.getNetwork(),accounts:r});t=pt(t);for(const i of s)if(pt(i)===t)return new ix(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new ix(this,r))}destroy(){T(this,ui)&&(clearTimeout(T(this,ui)),L(this,ui,null));for(const{payload:t,reject:r}of T(this,io))r(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));L(this,io,[]),super.destroy()}}Jl=new WeakMap,wf=new WeakMap,io=new WeakMap,ui=new WeakMap,Ss=new WeakMap,ts=new WeakMap,ur=new WeakMap,Jh=new WeakSet,BE=function(){if(T(this,ui))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,ui,setTimeout(()=>{L(this,ui,null);const r=T(this,io);for(L(this,io,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,Jl).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,Jl).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:c}of s){if(this.destroyed){l(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const u=o.filter(f=>f.id===c.id)[0];if(u==null){const f=Mt("missing response for request","BAD_DATA",{value:o,info:{payload:c}});this.emit("error",f),l(f);continue}if("error"in u){l(this.getRpcError(c,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},t))};class ZZ extends mL{constructor(t,r){super(t,r);J(this,ma);let s=this._getOption("pollingInterval");s==null&&(s=pL.pollingInterval),L(this,ma,s)}_getSubscriber(t){const r=super._getSubscriber(t);return hL(r)&&(r.pollingInterval=T(this,ma)),r}get pollingInterval(){return T(this,ma)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");L(this,ma,t),this._forEachSubscriber(r=>{hL(r)&&(r.pollingInterval=T(this,ma))})}}ma=new WeakMap;class Fi extends ZZ{constructor(t,r,s){t==null&&(t="http://localhost:8545");super(r,s);J(this,Af);typeof t=="string"?L(this,Af,new zn(t)):L(this,Af,t.clone())}_getConnection(){return T(this,Af).clone()}async send(t,r){return await this._start(),await super.send(t,r)}async _send(t){const r=this._getConnection();r.body=JSON.stringify(t),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Af=new WeakMap;function ox(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&Ct(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const e in n){const t=ox(n[e]);if(t)return t}return null}if(typeof n=="string")try{return ox(JSON.parse(n))}catch{}return null}function ax(n,e){if(n!=null){if(typeof n.message=="string"&&e.push(n.message),typeof n=="object")for(const t in n)ax(n[t],e);if(typeof n=="string")try{return ax(JSON.parse(n),e)}catch{}}}function eee(n){const e=[];return ax(n,e),e}const Ly="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function tee(n){switch(n){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}z(!1,"unsupported network","network",n)}class By extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Ly);const i={polling:!0,staticNetwork:s},o=By.getRequest(s,r);super(o,s,i);G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new By(t,this.apiKey)}catch{}return super._getProvider(t)}static getRequest(t,r){r==null&&(r=Ly);const s=new zn(`https://${tee(t.name)}/${r}`);return s.allowGzip=!0,r===Ly&&(s.retryFunc=async(i,o,a)=>(xu("AnkrProvider"),!0)),s}getRpcError(t,r){return t.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(t,r)}isCommunityResource(){return this.apiKey===Ly}}const _y="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function nee(n){switch(n){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}z(!1,"unsupported network","network",n)}class Fy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=_y);const i=Fy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new Fy(t,this.apiKey)}catch{}return super._getProvider(t)}async _perform(t){if(t.method==="getTransactionResult"){const{trace:r,tx:s}=await On({trace:this.send("trace_transaction",[t.hash]),tx:this.getTransaction(t.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return ee(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;ee(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(t)}isCommunityResource(){return this.apiKey===_y}static getRequest(t,r){r==null&&(r=_y);const s=new zn(`https://${nee(t.name)}/v2/${r}`);return s.allowGzip=!0,r===_y&&(s.retryFunc=async(i,o,a)=>(xu("alchemy"),!0)),s}}function jy(n){switch(n){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}z(!1,"unsupported network","network",n)}function ree(n){switch(n){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}z(!1,"unsupported network","network",n)}class Uy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=jy(s.name));const i=Uy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new Uy(t,this.apiKey)}catch{}return super._getProvider(t)}isCommunityResource(){return this.apiKey===jy(this._network.name)}static getRequest(t,r){r==null&&(r=jy(t.name));const s=new zn(`https://${ree(t.name)}/${r}`);return s.allowGzip=!0,r===jy(t.name)&&(s.retryFunc=async(i,o,a)=>(xu("ChainstackProvider"),!0)),s}}class see extends Fi{constructor(e){e==null&&(e="mainnet");const t=tn.from(e);z(t.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",t,{staticNetwork:t})}}const gL=2e3;function iee(n){return n&&typeof n.then=="function"}const oee="org.ethers.plugins.provider.Etherscan",aee=["enableCcipRead"];let lee=1;class cee extends Dy{constructor(t,r){const s=r??null;super();G(this,"network");G(this,"apiKey");J(this,vf);const i=tn.from(t);L(this,vf,i.getPlugin(oee)),Ne(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,vf))return T(this,vf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}z(!1,"unsupported network","network",this.network)}getUrl(t,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${t}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(t,r,s){const i=lee++,o=s?this.getPostUrl():this.getUrl(t,r),a=s?this.getPostData(t,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new zn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&xu("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(iu(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return t==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,gL)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,gL)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const c=await l.send();try{c.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),ee(!1,"response error","SERVER_ERROR",{request:l,response:c})}c.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),ee(!1,"missing response","SERVER_ERROR",{request:l,response:c}));const u=JSON.parse(iu(c.body));return t==="proxy"?(u.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"invalid JSON-RPC"}),ee(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:c,info:{result:u}})),u.error&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"JSON-RPC error"}),ee(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):u.status==0&&(u.message==="No records found"||u.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):((u.status!=1||typeof u.message=="string"&&!u.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:u}),ee(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result)}_getTransactionPostData(t){const r={};for(let s in t){if(aee.indexOf(s)>=0||t[s]==null)continue;let i=t[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=ol(i);else if(s==="accessList")i="["+$o(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;ee(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:t}})}else i=we(i);r[s]=i}}return r}_checkError(t,r,s){let i="";if(dn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(t.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&ee(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.transaction}),(t.method==="call"||t.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=yu.getBuiltinCallException(t.method,t.transaction,o);throw a.info={request:t,error:r},a}if(i&&t.method==="broadcastTransaction"){const o=hh.from(t.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&ee(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&ee(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ee(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(t){switch(t.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(r=>this._checkError(t,r,t.signedTransaction));case"getBlock":if("blockTag"in t)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});ee(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.hash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}}return super._perform(t)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(t){let r=this._getAddress(t);iee(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new wu(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}vf=new WeakMap;function uee(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const fee=uee().WebSocket;class lx{constructor(e,t){J(this,fi);J(this,qh);J(this,ga);J(this,ql);J(this,ya);L(this,fi,e),L(this,qh,JSON.stringify(t)),L(this,ga,null),L(this,ql,null),L(this,ya,null)}get filter(){return JSON.parse(T(this,qh))}start(){L(this,ga,T(this,fi).send("eth_subscribe",this.filter).then(e=>(T(this,fi)._register(e,this),e)))}stop(){T(this,ga).then(e=>{T(this,fi).destroyed||T(this,fi).send("eth_unsubscribe",[e])}),L(this,ga,null)}pause(e){ee(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,ql,!!e)}resume(){L(this,ql,null)}_handleMessage(e){if(T(this,ga)!=null&&T(this,ql)===null){let t=T(this,ya);t==null?t=this._emit(T(this,fi),e):t=t.then(async()=>{await this._emit(T(this,fi),e)}),L(this,ya,t.then(()=>{T(this,ya)===t&&L(this,ya,null)}))}}async _emit(e,t){throw new Error("sub-classes must implemente this; _emit")}}fi=new WeakMap,qh=new WeakMap,ga=new WeakMap,ql=new WeakMap,ya=new WeakMap;class dee extends lx{constructor(e){super(e,["newHeads"])}async _emit(e,t){e.emit("block",parseInt(t.number))}}class hee extends lx{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,t){e.emit("pending",t)}}class pee extends lx{constructor(t,r){super(t,["logs",r]);J(this,Yh);L(this,Yh,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Yh))}async _emit(t,r){t.emit(this.logFilter,t._wrapLog(r,t._network))}}Yh=new WeakMap;class mee extends mL{constructor(t,r){const s=Object.assign({},r??{});z(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(t,s);J(this,Yl);J(this,xf);J(this,ba);L(this,Yl,new Map),L(this,xf,new Map),L(this,ba,new Map)}_getSubscriber(t){switch(t.type){case"close":return new Py("close");case"block":return new dee(this);case"pending":return new hee(this);case"event":return new pee(this,t.filter);case"orphan":if(t.filter.orphan==="drop-log")return new Py("drop-log")}return super._getSubscriber(t)}_register(t,r){T(this,xf).set(t,r);const s=T(this,ba).get(t);if(s){for(const i of s)r._handleMessage(i);T(this,ba).delete(t)}}async _send(t){z(!Array.isArray(t),"WebSocket does not support batch send","payload",t);const r=new Promise((s,i)=>{T(this,Yl).set(t.id,{payload:t,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(t)),[await r]}async _processMessage(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&"id"in r){const s=T(this,Yl).get(r.id);if(s==null){this.emit("error",Mt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,Yl).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,xf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,ba).get(s);o==null&&(o=[],T(this,ba).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Mt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(t){throw new Error("sub-classes must override this")}}Yl=new WeakMap,xf=new WeakMap,ba=new WeakMap;class yL extends mee{constructor(t,r,s){super(r,s);J(this,Xl);J(this,Ts);typeof t=="string"?(L(this,Xl,()=>new fee(t)),L(this,Ts,T(this,Xl).call(this))):typeof t=="function"?(L(this,Xl,t),L(this,Ts,t())):(L(this,Xl,null),L(this,Ts,t)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ts)==null)throw new Error("websocket closed");return T(this,Ts)}async _write(t){this.websocket.send(t)}async destroy(){T(this,Ts)!=null&&(T(this,Ts).close(),L(this,Ts,null)),super.destroy()}}Xl=new WeakMap,Ts=new WeakMap;const Ah="84842078b09946638c03157f83405213";function gee(n){switch(n){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}z(!1,"unsupported network","network",n)}class yee extends yL{constructor(t,r){const s=new vh(t,r),i=s._getConnection();ee(!i.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,s._network);G(this,"projectId");G(this,"projectSecret");Ne(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Ah}}class vh extends Fi{constructor(t,r,s){t==null&&(t="mainnet");const i=tn.from(t);r==null&&(r=Ah),s==null&&(s=null);const o=vh.getRequest(i,r,s);super(o,i,{staticNetwork:i});G(this,"projectId");G(this,"projectSecret");Ne(this,{projectId:r,projectSecret:s})}_getProvider(t){try{return new vh(t,this.projectId,this.projectSecret)}catch{}return super._getProvider(t)}isCommunityResource(){return this.projectId===Ah}static getWebSocketProvider(t,r){return new yee(t,r)}static getRequest(t,r,s){r==null&&(r=Ah),s==null&&(s=null);const i=new zn(`https://${gee(t.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Ah&&(i.retryFunc=async(o,a,l)=>(xu("InfuraProvider"),!0)),i}}const Vy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function bee(n){switch(n){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}z(!1,"unsupported network","network",n)}class Hy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Vy);const i=Hy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"token");Ne(this,{token:r})}_getProvider(t){try{return new Hy(t,this.token)}catch{}return super._getProvider(t)}isCommunityResource(){return this.token===Vy}static getRequest(t,r){r==null&&(r=Vy);const s=new zn(`https://${bee(t.name)}/${r}`);return s.allowGzip=!0,r===Vy&&(s.retryFunc=async(i,o,a)=>(xu("QuickNodeProvider"),!0)),s}}const wee=BigInt("1"),Aee=BigInt("2");function vee(n){for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}}function xee(n){return new Promise(e=>{setTimeout(e,n)})}function cx(){return new Date().getTime()}function ux(n){return JSON.stringify(n,(e,t)=>typeof t=="bigint"?{type:"bigint",value:t.toString()}:t)}const bL={stallTimeout:400,priority:1,weight:1},wL={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function Eee(n,e){for(;(n.blockNumber<0||n.blockNumber<e)&&(n._updateNumber||(n._updateNumber=(async()=>{try{const t=await n.provider.getBlockNumber();t>n.blockNumber&&(n.blockNumber=t)}catch(t){n.blockNumber=-2,n._lastFatalError=t,n._lastFatalErrorTimestamp=cx()}n._updateNumber=null})()),await n._updateNumber,n.outOfSync++,!n._lastFatalError););}function xh(n){if(n==null)return"null";if(Array.isArray(n))return"["+n.map(xh).join(",")+"]";if(typeof n=="object"&&typeof n.toJSON=="function")return xh(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":case"number":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{"+e.map(t=>`${JSON.stringify(t)}:${xh(n[t])}`).join(",")+"}"}}throw console.log("Could not serialize",n),new Error("Hmm...")}function fx(n){if("error"in n){const t=n.error;return{tag:xh(t),value:t}}const e=n.result;return{tag:xh(e),value:e}}function zy(n,e){const t=new Map;for(const{value:s,tag:i,weight:o}of e){const a=t.get(i)||{value:s,weight:0};a.weight+=o,t.set(i,a)}let r=null;for(const s of t.values())s.weight>=n&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function dx(n,e){let t=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:c}of e)if(a instanceof Error){const u=r.get(l)||{value:a,weight:0};u.weight+=c,r.set(l,u),(s==null||u.weight>s.weight)&&(s=u)}else i.push(BigInt(a)),t+=c;if(t<n)return s&&s.weight>=n?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+wee)/Aee}function hx(n,e){const t=zy(n,e);if(t!==void 0)return t;for(const r of e)if(r.value)return r.value}function Cee(n,e){if(n===1)return Je(dx(n,e),"%internal");const t=new Map,r=(o,a)=>{const l=t.get(o)||{result:o,weight:0};l.weight+=a,t.set(o,l)};for(const{weight:o,value:a}of e){const l=Je(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of t.values())o>=n&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class kee extends Dy{constructor(t,r,s){super(r,s);J(this,dr);G(this,"quorum");G(this,"eventQuorum");G(this,"eventWorkers");J(this,fr);J(this,oo);J(this,Ef);L(this,fr,t.map(i=>i instanceof Dy?Object.assign({provider:i},bL,wL):Object.assign({},bL,i,wL))),L(this,oo,-2),L(this,Ef,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,fr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,z(this.quorum<=T(this,fr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,fr).map(t=>{const r=Object.assign({},t);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return tn.from(xe(await this._perform({method:"chainId"})))}async _translatePerform(t,r){switch(r.method){case"broadcastTransaction":return await t.broadcastTransaction(r.signedTransaction);case"call":return await t.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await t.getNetwork()).chainId;case"estimateGas":return await t.estimateGas(r.transaction);case"getBalance":return await t.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await t.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await t.getBlockNumber();case"getCode":return await t.getCode(r.address,r.blockTag);case"getGasPrice":return(await t.getFeeData()).gasPrice;case"getPriorityFee":return(await t.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await t.getLogs(r.filter);case"getStorage":return await t.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await t.getTransaction(r.hash);case"getTransactionCount":return await t.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await t.getTransactionReceipt(r.hash);case"getTransactionResult":return await t.getTransactionResult(r.hash)}}async _perform(t){if(t.method==="broadcastTransaction"){const o=T(this,fr).map(c=>null),a=T(this,fr).map(async({provider:c,weight:u},f)=>{try{const d=await c._perform(t);o[f]=Object.assign(fx({result:d}),{weight:u})}catch(d){o[f]=Object.assign(fx({error:d}),{weight:u})}});for(;;){const c=o.filter(d=>d!=null);for(const{value:d}of c)if(!(d instanceof Error))return d;const u=zy(this.quorum,o.filter(d=>d!=null));if(dn(u,"INSUFFICIENT_FUNDS"))throw u;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=hx(this.quorum,o);if(ee(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:t,results:o.map(ux)}}),l instanceof Error)throw l;return l}await fe(this,dr,fF).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,dr,_E).call(this,r,t);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,dr,FE).call(this,r,t);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:t}of T(this,fr))t.destroy();super.destroy()}}fr=new WeakMap,oo=new WeakMap,Ef=new WeakMap,dr=new WeakSet,uF=function(t){const r=Array.from(t).map(i=>i.config),s=T(this,fr).slice();vee(s),s.sort((i,o)=>i.priority-o.priority);for(const i of s)if(!i._lastFatalError&&r.indexOf(i)===-1)return i;return null},_E=function(t,r){const s=fe(this,dr,uF).call(this,t);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=cx();return i.perform=(async()=>{try{s.requests++;const l=await this._translatePerform(s.provider,r);i.result={result:l}}catch(l){s.errorResponses++,i.result={error:l}}const a=cx()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await xee(s.stallTimeout),i.staller=null})(),t.add(i),i},fF=async function(){let t=T(this,Ef);if(!t){const r=[];T(this,fr).forEach(s=>{r.push((async()=>{await Eee(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,Ef,t=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,fr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&ee(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await t},dF=async function(t,r){const s=[];for(const i of t)if(i.result!=null){const{tag:o,value:a}=fx(i.result);s.push({tag:o,value:a,weight:i.config.weight})}if(!(s.reduce((i,o)=>i+o.weight,0)<this.quorum)){switch(r.method){case"getBlockNumber":{T(this,oo)===-2&&L(this,oo,Math.ceil(Je(dx(this.quorum,T(this,fr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Je(o.blockNumber).toString(),weight:o.weight}))))));const i=Cee(this.quorum,s);return i===void 0?void 0:(i>T(this,oo)&&L(this,oo,i),T(this,oo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return dx(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?hx(this.quorum,s):zy(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return zy(this.quorum,s);case"broadcastTransaction":return hx(this.quorum,s)}ee(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${ux(r.method)})`})}},FE=async function(t,r){if(t.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of t){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,dr,dF).call(this,t,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,dr,_E).call(this,t,r);return ee(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(t).map(a=>ux(a.result))}}),await Promise.race(s),await fe(this,dr,FE).call(this,t,r)};function See(n){return n&&typeof n.send=="function"&&typeof n.close=="function"}const Tee="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function Oee(n,e){e==null&&(e={});const t=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(typeof n=="string"&&n.match(/^https?:/))return new Fi(n);if(typeof n=="string"&&n.match(/^wss?:/)||See(n))return new yL(n);let r=null;try{r=tn.from(n)}catch{}const s=[];if(t("publicPolygon")&&r&&(r.name==="matic"?s.push(new Fi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Fi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),t("alchemy"))try{s.push(new Fy(n,e.alchemy))}catch{}if(t("ankr")&&e.ankr!=null)try{s.push(new By(n,e.ankr))}catch{}if(t("chainstack"))try{s.push(new Uy(n,e.chainstack))}catch{}if(t("cloudflare"))try{s.push(new see(n))}catch{}if(t("etherscan"))try{s.push(new cee(n,e.etherscan))}catch{}if(t("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new vh(n,o,a))}catch{}if(t("quicknode"))try{let o=e.quicknode;s.push(new Hy(n,o))}catch{}if(ee(s.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),s.length===1)return s[0];let i=Math.floor(s.length/2);return i>2&&(i=2),r&&Tee.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new kee(s,void 0,{quorum:i})}const Nee=async(n,e)=>{const t={name:n,isEns:!1};if(!e)throw new Error("cannot fetch ens name without a provider url");if(!kY(n))return t;try{const r=await Mee(n,e);r&&(t.name=r,t.isEns=!0)}catch(r){console.log(r)}return t},Mee=async(n,e)=>await Ree(e).lookupAddress(n),Ree=n=>Oee(n),AL=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],Pee=({isPreviewMode:n,initialContent:e,enableCollaboration:t,collaborationId:r,ensProviderUrl:s,username:i,onAutoSave:o,onChange:a,onCollaboratorChange:l})=>{var S,M;const[c]=P.useState(new Wa),[u,f]=P.useState(!1),[d,h]=P.useState([...PJ]),p=P.useRef(!1),m=nT({extensions:d,editorProps:fM,autofocus:"start",onUpdate:O=>{w!=null&&w.isEmpty||a==null||a(O.editor.getJSON())}},[d]),y=nT({extensions:d,editorProps:fM,autofocus:"start",onUpdate:O=>{w!=null&&w.isEmpty||a==null||a(O.editor.getJSON())}}),b=P.useRef(()=>{}),v=(O,R=!1)=>{if(!t||!r||!O)throw new Error("docId or username is not provided");f(!0);const D=new h9(r,c,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});h([...d,j9.configure({document:c}),U9.configure({provider:D,user:{name:O,color:AL[Math.floor(Math.random()*AL.length)],isEns:R},render:_J})]);const _=setTimeout(()=>{f(!1)},100);return b.current=()=>{clearTimeout(_),D.destroy(),c.destroy(),f(!1)},b.current},A=P.useRef(null),w=P.useMemo(()=>t&&r&&m&&!u?m:y,[m,y,u]);P.useEffect(()=>{w==null||w.setEditable(!n)},[n,w]),P.useEffect(()=>{e&&w&&!p.current&&(w.commands.setContent(e),p.current=!0),setTimeout(()=>{p.current=!1})},[e,w]);const x=async()=>{if(!i)return;let O=i,R=!1;if(s){const{name:D,isEns:_}=await Nee(i,s);O=D,R=_}v(O,R)};P.useEffect(()=>{t&&i?x():b.current()},[t]);const C=P.useMemo(()=>Tv((O,R)=>{R({editorJSONData:O.getJSON()})},1e3),[o]);return P.useEffect(()=>{if(w&&o){const O=()=>{C(w,o)};return w.on("update",O),()=>{w.off("update",O)}}},[w,o,C]),P.useEffect(()=>{var O,R;l==null||l((R=(O=w==null?void 0:w.storage)==null?void 0:O.collaborationCursor)==null?void 0:R.users)},[(M=(S=w==null?void 0:w.storage)==null?void 0:S.collaborationCursor)==null?void 0:M.users]),{editor:w,ref:A,loading:u,connect:v,ydoc:c}},Dee=({title:n,content:e,contentClassName:t,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>k.jsx(m6,{open:r,onOpenChange:s,children:k.jsxs(_O,{className:"max-w-md sm:w-full w-[90%] z-20",children:[k.jsx(FO,{className:"px-4 pt-0 border-b-[1px]",children:k.jsx(UO,{className:"text-left text-base",children:n})}),k.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",t),children:e&&e}),k.jsxs(jO,{className:"px-5 pb-5 justify-end sm:",children:[o&&k.jsx(b6,{asChild:!0,children:k.jsx(Oc,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),i&&k.jsx(Oc,{disabled:i==null?void 0:i.isLoading,isLoading:i==null?void 0:i.isLoading,className:i==null?void 0:i.className,variant:(i==null?void 0:i.variant)||"primary",onClick:i==null?void 0:i.onClick,children:i==null?void 0:i.label})]})]})}),Iee=({editor:n,uploadToIpfs:e})=>{const{toolVisibilty:t,setToolVisibility:r,bottomToolbar:s}=Qw({editor:n,uploadToIpfs:e}),i=YM("(max-width: 1023px)"),[o,a]=P.useState(""),[l,c]=P.useState(""),[u,f]=P.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){n.chain().focus().extendMarkRange("link").unsetLink().run(),f(!1);return}let m=o;!o.startsWith("http://")&&!o.startsWith("https://")&&(m="https://"+o);try{m.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0),r(Me.NONE)},h=m=>{const{from:y,to:b}=m.state.selection;return m.state.doc.textBetween(y,b)},p=P.useRef(null);return P.useEffect(()=>{let m=0;const y=()=>{m=Date.now()},b=()=>{var w;if(Date.now()-m>500){const{selection:x}=n.state;x.from!==x.to&&((w=p.current)==null||w.click())}},v=()=>{var x;if(!i)return;const{selection:A}=n.state;A.from!==A.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",y),document.addEventListener("touchend",b)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",y),document.removeEventListener("touchend",b)):document.removeEventListener("mouseup",v)}},[n,i]),k.jsxs(NO,{children:[k.jsx("div",{className:"flex w-full justify-between sm:justify-evenly",children:s.map(m=>{if(m)return k.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?k.jsx(MO,{asChild:!0,children:k.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?k.jsx(MO,{asChild:!0,children:k.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):k.jsx("button",{className:he("flex items-center rounded px-2 py-1 text-black transition"),onClick:()=>m.onClick(),children:m.icon})},m.title)})}),t===Me.TEXT_FORMATING&&k.jsx(iz,{editor:n,setToolVisibility:r}),t===Me.TEXT_COLOR_PICKER&&k.jsx(oz,{editor:n,setToolVisibility:r}),t===Me.LINK_POPUP&&k.jsx(Dee,{open:t===Me.LINK_POPUP,onOpenChange:()=>r(Me.NONE),title:"Link",content:k.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[k.jsx(dm,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:h(n),onChange:m=>c(m.target.value)}),k.jsx(dm,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:n.getAttributes("link").href,onChange:m=>{a(m.target.value)},isValid:u,message:u?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(Me.NONE),className:"w-auto min-w-[80px]"}})]})},px=P.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),$y=P.createContext({}),Gy=P.createContext(null),mx=typeof document<"u",gx=mx?P.useLayoutEffect:P.useEffect,vL=P.createContext({strict:!1}),yx=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),xL="data-"+yx("framerAppearId"),Lee={skipAnimations:!1,useManualTiming:!1};class EL{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function Bee(n){let e=new EL,t=new EL,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{t.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,t]=[t,e],t.clear(),r=e.order.length,r)for(let c=0;c<r;c++){const u=e.order[c];o.has(u)&&(a.schedule(u),n()),u(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Wy=["read","resolveKeyframes","update","preRender","render","postRender"],_ee=40;function CL(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Wy.reduce((f,d)=>(f[d]=Bee(()=>t=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();t=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,_ee),1),s.timestamp=f,s.isProcessing=!0,Wy.forEach(o),s.isProcessing=!1,t&&e&&(r=!1,n(a))},l=()=>{t=!0,r=!0,s.isProcessing||n(a)};return{schedule:Wy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,y=!1)=>(t||l(),h.schedule(p,m,y)),f},{}),cancel:f=>Wy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:bx,cancel:Kie}=CL(queueMicrotask,!1);function Cu(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}const kL=P.createContext({});let SL=!1;function Fee(n,e,t,r,s){const{visualElement:i}=P.useContext($y),o=P.useContext(vL),a=P.useContext(Gy),l=P.useContext(px).reducedMotion,c=P.useRef();r=r||o.renderer,!c.current&&r&&(c.current=r(n,{visualState:e,parent:i,props:t,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,f=P.useContext(kL);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&Uee(c.current,t,s,f),P.useInsertionEffect(()=>{u&&u.update(t,a)});const d=P.useRef(!!(t[xL]&&!window.HandoffComplete));return gx(()=>{u&&(u.updateFeatures(),bx.render(u.render),d.current&&u.animationState&&u.animationState.animateChanges())}),P.useEffect(()=>{u&&(!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,SL||(SL=!0,queueMicrotask(jee))))}),u}function jee(){window.HandoffComplete=!0}function Uee(n,e,t,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:TL(n.parent)),n.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Cu(a),visualElement:n,scheduleRender:()=>n.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}function TL(n){if(n)return n.options.allowProjection!==!1?n.projection:TL(n.parent)}function Vee(n,e,t){return P.useCallback(r=>{r&&n.mount&&n.mount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):Cu(t)&&(t.current=r))},[e])}function Eh(n){return typeof n=="string"||Array.isArray(n)}function Ky(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ax=["initial",...wx];function Qy(n){return Ky(n.animate)||Ax.some(e=>Eh(n[e]))}function OL(n){return!!(Qy(n)||n.variants)}function Hee(n,e){if(Qy(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Eh(t)?t:void 0,animate:Eh(r)?r:void 0}}return n.inherit!==!1?e:{}}function zee(n){const{initial:e,animate:t}=Hee(n,P.useContext($y));return P.useMemo(()=>({initial:e,animate:t}),[NL(e),NL(t)])}function NL(n){return Array.isArray(n)?n.join(" "):n}const ML={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ku={};for(const n in ML)ku[n]={isEnabled:e=>ML[n].some(t=>!!e[t])};function $ee(n){for(const e in n)ku[e]={...ku[e],...n[e]}}const vx=P.createContext({}),Gee=Symbol.for("motionComponentSymbol"),xn=n=>n;let Su=xn,ji=xn;process.env.NODE_ENV!=="production"&&(Su=(n,e)=>{!n&&typeof console<"u"&&console.warn(e)},ji=(n,e)=>{if(!n)throw new Error(e)});function Wee({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:r,Component:s}){n&&$ee(n);function i(a,l){let c;const u={...P.useContext(px),...a,layoutId:Kee(a)},{isStatic:f}=u,d=zee(a),h=r(a,f);if(!f&&mx){Qee(u,n);const p=Jee(u);c=p.MeasureLayout,d.visualElement=Fee(s,h,u,e,p.ProjectionNode)}return k.jsxs($y.Provider,{value:d,children:[c&&d.visualElement?k.jsx(c,{visualElement:d.visualElement,...u}):null,t(s,a,Vee(h,d.visualElement,l),h,f,d.visualElement)]})}const o=P.forwardRef(i);return o[Gee]=s,o}function Kee({layoutId:n}){const e=P.useContext(vx).id;return e&&n!==void 0?e+"-"+n:n}function Qee(n,e){const t=P.useContext(vL).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?Su(!1,r):ji(!1,r)}}function Jee(n){const{drag:e,layout:t}=ku;if(!e&&!t)return{};const r={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function qee(n){function e(r,s={}){return Wee(n(r,s))}if(typeof Proxy>"u")return e;const t=new Map;return new Proxy(e,{get:(r,s)=>(t.has(s)||t.set(s,e(s)),t.get(s))})}const Yee=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xx(n){return typeof n!="string"||n.includes("-")?!1:!!(Yee.indexOf(n)>-1||/[A-Z]/u.test(n))}const Jy={};function Xee(n){Object.assign(Jy,n)}const Ch=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Al=new Set(Ch);function RL(n,{layout:e,layoutId:t}){return Al.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!Jy[n]||n==="opacity")}const Mn=n=>!!(n&&n.getVelocity),Zee={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},ete=Ch.length;function tte(n,{enableHardwareAcceleration:e=!0,allowTransformNone:t=!0},r,s){let i="";for(let o=0;o<ete;o++){const a=Ch[o];if(n[a]!==void 0){const l=Zee[a]||a;i+=`${l}(${n[a]}) `}}return e&&!n.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(n,r?"":i):t&&r&&(i="none"),i}const PL=n=>e=>typeof e=="string"&&e.startsWith(n),DL=PL("--"),nte=PL("var(--"),Ex=n=>nte(n)?rte.test(n.split("/*")[0].trim()):!1,rte=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ste=(n,e)=>e&&typeof n=="number"?e.transform(n):n,Wo=(n,e,t)=>t>e?e:t<n?n:t,Tu={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},kh={...Tu,transform:n=>Wo(0,1,n)},qy={...Tu,default:1},Sh=n=>Math.round(n*1e5)/1e5,Cx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ite=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,ote=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function Th(n){return typeof n=="string"}const Oh=n=>({test:e=>Th(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Ko=Oh("deg"),ti=Oh("%"),Le=Oh("px"),ate=Oh("vh"),lte=Oh("vw"),IL={...ti,parse:n=>ti.parse(n)/100,transform:n=>ti.transform(n*100)},LL={...Tu,transform:Math.round},BL={borderWidth:Le,borderTopWidth:Le,borderRightWidth:Le,borderBottomWidth:Le,borderLeftWidth:Le,borderRadius:Le,radius:Le,borderTopLeftRadius:Le,borderTopRightRadius:Le,borderBottomRightRadius:Le,borderBottomLeftRadius:Le,width:Le,maxWidth:Le,height:Le,maxHeight:Le,size:Le,top:Le,right:Le,bottom:Le,left:Le,padding:Le,paddingTop:Le,paddingRight:Le,paddingBottom:Le,paddingLeft:Le,margin:Le,marginTop:Le,marginRight:Le,marginBottom:Le,marginLeft:Le,rotate:Ko,rotateX:Ko,rotateY:Ko,rotateZ:Ko,scale:qy,scaleX:qy,scaleY:qy,scaleZ:qy,skew:Ko,skewX:Ko,skewY:Ko,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:kh,originX:IL,originY:IL,originZ:Le,zIndex:LL,backgroundPositionX:Le,backgroundPositionY:Le,fillOpacity:kh,strokeOpacity:kh,numOctaves:LL};function kx(n,e,t,r){const{style:s,vars:i,transform:o,transformOrigin:a}=n;let l=!1,c=!1,u=!0;for(const f in e){const d=e[f];if(DL(f)){i[f]=d;continue}const h=BL[f],p=ste(d,h);if(Al.has(f)){if(l=!0,o[f]=p,!u)continue;d!==(h.default||0)&&(u=!1)}else f.startsWith("origin")?(c=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=tte(n.transform,t,u,r):s.transform&&(s.transform="none")),c){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Sx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function _L(n,e,t){for(const r in e)!Mn(e[r])&&!RL(r,t)&&(n[r]=e[r])}function cte({transformTemplate:n},e,t){return P.useMemo(()=>{const r=Sx();return kx(r,e,{enableHardwareAcceleration:!t},n),Object.assign({},r.vars,r.style)},[e])}function ute(n,e,t){const r=n.style||{},s={};return _L(s,r,n),Object.assign(s,cte(n,e,t)),s}function fte(n,e,t){const r={},s=ute(n,e,t);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=s,r}const dte=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Yy(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||dte.has(n)}let FL=n=>!Yy(n);function hte(n){n&&(FL=e=>e.startsWith("on")?!Yy(e):n(e))}try{hte(require("@emotion/is-prop-valid").default)}catch{}function pte(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||(FL(s)||t===!0&&Yy(s)||!e&&!Yy(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}function jL(n,e,t){return typeof n=="string"?n:Le.transform(e+t*n)}function mte(n,e,t){const r=jL(e,n.x,n.width),s=jL(t,n.y,n.height);return`${r} ${s}`}const gte={offset:"stroke-dashoffset",array:"stroke-dasharray"},yte={offset:"strokeDashoffset",array:"strokeDasharray"};function bte(n,e,t=1,r=0,s=!0){n.pathLength=1;const i=s?gte:yte;n[i.offset]=Le.transform(-r);const o=Le.transform(e),a=Le.transform(t);n[i.array]=`${o} ${a}`}function Tx(n,{attrX:e,attrY:t,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,f,d){if(kx(n,c,u,d),f){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:p,dimensions:m}=n;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=mte(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),t!==void 0&&(h.y=t),r!==void 0&&(h.scale=r),o!==void 0&&bte(h,o,a,l,!1)}const UL=()=>({...Sx(),attrs:{}}),Ox=n=>typeof n=="string"&&n.toLowerCase()==="svg";function wte(n,e,t,r){const s=P.useMemo(()=>{const i=UL();return Tx(i,e,{enableHardwareAcceleration:!1},Ox(r),n.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(n.style){const i={};_L(i,n.style,n),s.style={...i,...s.style}}return s}function Ate(n=!1){return(t,r,s,{latestValues:i},o)=>{const l=(xx(t)?wte:fte)(r,i,o,t),c=pte(r,typeof t=="string",n),u=t!==P.Fragment?{...c,...l,ref:s}:{},{children:f}=r,d=P.useMemo(()=>Mn(f)?f.get():f,[f]);return P.createElement(t,{...u,children:d})}}function VL(n,{style:e,vars:t},r,s){Object.assign(n.style,e,s&&s.getProjectionStyles(r));for(const i in t)n.style.setProperty(i,t[i])}const HL=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function zL(n,e,t,r){VL(n,e,void 0,r);for(const s in e.attrs)n.setAttribute(HL.has(s)?s:yx(s),e.attrs[s])}function Nx(n,e,t){var r;const{style:s}=n,i={};for(const o in s)(Mn(s[o])||e.style&&Mn(e.style[o])||RL(o,n)||((r=t==null?void 0:t.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function $L(n,e,t){const r=Nx(n,e,t);for(const s in n)if(Mn(n[s])||Mn(e[s])){const i=Ch.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=n[s]}return r}function GL(n){const e=[{},{}];return n==null||n.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function Mx(n,e,t,r){if(typeof e=="function"){const[s,i]=GL(r);e=e(t!==void 0?t:n.custom,s,i)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,i]=GL(r);e=e(t!==void 0?t:n.custom,s,i)}return e}function WL(n){const e=P.useRef(null);return e.current===null&&(e.current=n()),e.current}const Rx=n=>Array.isArray(n),vte=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),xte=n=>Rx(n)?n[n.length-1]||0:n;function Xy(n){const e=Mn(n)?n.get():n;return vte(e)?e.toValue():e}function Ete({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},r,s,i){const o={latestValues:Cte(r,s,i,n),renderState:e()};return t&&(o.mount=a=>t(r,a,o)),o}const KL=n=>(e,t)=>{const r=P.useContext($y),s=P.useContext(Gy),i=()=>Ete(n,e,r,s);return t?i():WL(i)};function Cte(n,e,t,r){const s={},i=r(n,{});for(const d in i)s[d]=Xy(i[d]);let{initial:o,animate:a}=n;const l=Qy(n),c=OL(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!Ky(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Mx(n,h);if(!p)return;const{transitionEnd:m,transition:y,...b}=p;for(const v in b){let A=b[v];if(Array.isArray(A)){const w=u?A.length-1:0;A=A[w]}A!==null&&(s[v]=A)}for(const v in m)s[v]=m[v]}),s}const{schedule:dt,cancel:Ui,state:En,steps:Px}=CL(typeof requestAnimationFrame<"u"?requestAnimationFrame:xn,!0),kte={useVisualState:KL({scrapeMotionValuesFromProps:$L,createRenderState:UL,onMount:(n,e,{renderState:t,latestValues:r})=>{dt.read(()=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}),dt.render(()=>{Tx(t,r,{enableHardwareAcceleration:!1},Ox(e.tagName),n.transformTemplate),zL(e,t)})}})},Ste={useVisualState:KL({scrapeMotionValuesFromProps:Nx,createRenderState:Sx})};function Tte(n,{forwardMotionProps:e=!1},t,r){return{...xx(n)?kte:Ste,preloadedFeatures:t,useRender:Ate(e),createVisualElement:r,Component:n}}function Vi(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}const QL=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Zy(n,e="page"){return{point:{x:n[`${e}X`],y:n[`${e}Y`]}}}const Ote=n=>e=>QL(e)&&n(e,Zy(e));function Hi(n,e,t,r){return Vi(n,e,Ote(t),r)}const Nte=(n,e)=>t=>e(n(t)),zi=(...n)=>n.reduce(Nte);function JL(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const qL=JL("dragHorizontal"),YL=JL("dragVertical");function XL(n){let e=!1;if(n==="y")e=YL();else if(n==="x")e=qL();else{const t=qL(),r=YL();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}function ZL(){const n=XL(!0);return n?(n(),!1):!0}class Qo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function eB(n,e){const t=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||ZL())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e);const l=a[r];l&&dt.postRender(()=>l(i,o))};return Hi(n.current,t,s,{passive:!n.getProps()[r]})}class Mte extends Qo{mount(){this.unmount=zi(eB(this.node,!0),eB(this.node,!1))}unmount(){}}class Rte extends Qo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=zi(Vi(this.node.current,"focus",()=>this.onFocus()),Vi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const tB=(n,e)=>e?n===e?!0:tB(n,e.parentElement):!1;function Dx(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Zy(t))}class Pte extends Qo{constructor(){super(...arguments),this.removeStartListeners=xn,this.removeEndListeners=xn,this.removeAccessibleListeners=xn,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Hi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:u,globalTapTarget:f}=this.node.getProps(),d=!f&&!tB(this.node.current,a.target)?u:c;d&&dt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Hi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=zi(i,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||Dx("up",(l,c)=>{const{onTap:u}=this.node.getProps();u&&dt.postRender(()=>u(l,c))})};this.removeEndListeners(),this.removeEndListeners=Vi(this.node.current,"keyup",o),Dx("down",(a,l)=>{this.startPress(a,l)})},t=Vi(this.node.current,"keydown",e),r=()=>{this.isPressing&&Dx("cancel",(i,o)=>this.cancelPress(i,o))},s=Vi(this.node.current,"blur",r);this.removeAccessibleListeners=zi(t,s)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&dt.postRender(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!ZL()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&dt.postRender(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Hi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Vi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=zi(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ix=new WeakMap,Lx=new WeakMap,Dte=n=>{const e=Ix.get(n.target);e&&e(n)},Ite=n=>{n.forEach(Dte)};function Lte({root:n,...e}){const t=n||document;Lx.has(t)||Lx.set(t,{});const r=Lx.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Ite,{root:n,...e})),r[s]}function Bte(n,e,t){const r=Lte(e);return Ix.set(n,t),r.observe(n),()=>{Ix.delete(n),r.unobserve(n)}}const _te={some:0,all:1};class Fte extends Qo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:_te[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),d=c?u:f;d&&d(l)};return Bte(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(jte(e,t))&&this.startObserver()}unmount(){}}function jte({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const Ute={inView:{Feature:Fte},tap:{Feature:Pte},focus:{Feature:Rte},hover:{Feature:Mte}};function nB(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}function e0(n,e,t){const r=n.getProps();return Mx(r,e,t!==void 0?t:r.custom,n)}const $i=n=>n*1e3,Gi=n=>n/1e3,Vte={type:"spring",stiffness:500,damping:25,restSpeed:10},Hte=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),zte={type:"keyframes",duration:.8},$te={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Gte=(n,{keyframes:e})=>e.length>2?zte:Al.has(n)?n.startsWith("scale")?Hte(e[1]):Vte:$te;function Wte({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}function Bx(n,e){return n[e]||n.default||n}const Kte=n=>n!==null;function t0(n,{repeat:e,repeatType:t="loop"},r){const s=n.filter(Kte),i=e&&t!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let n0;function Qte(){n0=void 0}const Jo={now:()=>(n0===void 0&&Jo.set(En.isProcessing||Lee.useManualTiming?En.timestamp:performance.now()),n0),set:n=>{n0=n,queueMicrotask(Qte)}},rB=n=>/^0[^.\s]+$/u.test(n);function Jte(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||rB(n):!0}const sB=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),qte=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Yte(n){const e=qte.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}const Xte=4;function iB(n,e,t=1){ji(t<=Xte,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`);const[r,s]=Yte(n);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return sB(o)?parseFloat(o):o}return Ex(s)?iB(s,e,t+1):s}const Zte=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),oB=n=>n===Tu||n===Le,aB=(n,e)=>parseFloat(n.split(", ")[e]),lB=(n,e)=>(t,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return aB(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?aB(i[1],n):0}},ene=new Set(["x","y","z"]),tne=Ch.filter(n=>!ene.has(n));function nne(n){const e=[];return tne.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const Ou={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:lB(4,13),y:lB(5,14)};Ou.translateX=Ou.x,Ou.translateY=Ou.y;const cB=n=>e=>e.test(n),uB=[Tu,Le,ti,Ko,lte,ate,{test:n=>n==="auto",parse:n=>n}],fB=n=>uB.find(cB(n)),vl=new Set;let _x=!1,Fx=!1;function dB(){if(Fx){const n=Array.from(vl).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=nne(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fx=!1,_x=!1,vl.forEach(n=>n.complete()),vl.clear()}function hB(){vl.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Fx=!0)})}function rne(){hB(),dB()}class jx{constructor(e,t,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(vl.add(this),_x||(_x=!0,dt.read(hB),dt.resolveKeyframes(dB))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&t){const l=r.readValue(t,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),vl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,vl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ux=(n,e)=>t=>!!(Th(t)&&ote.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),pB=(n,e,t)=>r=>{if(!Th(r))return r;const[s,i,o,a]=r.match(Cx);return{[n]:parseFloat(s),[e]:parseFloat(i),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},sne=n=>Wo(0,255,n),Vx={...Tu,transform:n=>Math.round(sne(n))},xl={test:Ux("rgb","red"),parse:pB("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+Vx.transform(n)+", "+Vx.transform(e)+", "+Vx.transform(t)+", "+Sh(kh.transform(r))+")"};function ine(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Hx={test:Ux("#"),parse:ine,transform:xl.transform},Nu={test:Ux("hsl","hue"),parse:pB("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+ti.transform(Sh(e))+", "+ti.transform(Sh(t))+", "+Sh(kh.transform(r))+")"},Rn={test:n=>xl.test(n)||Hx.test(n)||Nu.test(n),parse:n=>xl.test(n)?xl.parse(n):Nu.test(n)?Nu.parse(n):Hx.parse(n),transform:n=>Th(n)?n:n.hasOwnProperty("red")?xl.transform(n):Nu.transform(n)};function one(n){var e,t;return isNaN(n)&&Th(n)&&(((e=n.match(Cx))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(ite))===null||t===void 0?void 0:t.length)||0)>0}const mB="number",gB="color",ane="var",lne="var(",yB="${}",cne=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Nh(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(cne,l=>(Rn.test(l)?(r.color.push(i),s.push(gB),t.push(Rn.parse(l))):l.startsWith(lne)?(r.var.push(i),s.push(ane),t.push(l)):(r.number.push(i),s.push(mB),t.push(parseFloat(l))),++i,yB)).split(yB);return{values:t,split:a,indexes:r,types:s}}function bB(n){return Nh(n).values}function wB(n){const{split:e,types:t}=Nh(n),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=t[o];a===mB?i+=Sh(s[o]):a===gB?i+=Rn.transform(s[o]):i+=s[o]}return i}}const une=n=>typeof n=="number"?0:n;function fne(n){const e=bB(n);return wB(n)(e.map(une))}const qo={test:one,parse:bB,createTransformer:wB,getAnimatableNone:fne},dne=new Set(["brightness","contrast","saturate","opacity"]);function hne(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(Cx)||[];if(!r)return n;const s=t.replace(r,"");let i=dne.has(e)?1:0;return r!==t&&(i*=100),e+"("+i+s+")"}const pne=/\b([a-z-]*)\(.*?\)/gu,zx={...qo,getAnimatableNone:n=>{const e=n.match(pne);return e?e.map(hne).join(" "):n}},mne={...BL,color:Rn,backgroundColor:Rn,outlineColor:Rn,fill:Rn,stroke:Rn,borderColor:Rn,borderTopColor:Rn,borderRightColor:Rn,borderBottomColor:Rn,borderLeftColor:Rn,filter:zx,WebkitFilter:zx},$x=n=>mne[n];function AB(n,e){let t=$x(n);return t!==zx&&(t=qo),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const gne=new Set(["auto","none","0"]);function yne(n,e,t){let r=0,s;for(;r<n.length&&!s;){const i=n[r];typeof i=="string"&&!gne.has(i)&&Nh(i).values.length&&(s=n[r]),r++}if(s&&t)for(const i of e)n[i]=AB(t,s)}class vB extends jx{constructor(e,t,r,s){super(e,t,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),Ex(c))){const u=iB(c,t.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!Zte.has(r)||e.length!==2)return;const[s,i]=e,o=fB(s),a=fB(i);if(o!==a)if(oB(o)&&oB(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)Jte(e[s])&&r.push(s);r.length&&yne(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ou[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:t,name:r,unresolvedKeyframes:s}=this;if(!t.current)return;const i=t.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Ou[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function xB(n){let e;return()=>(e===void 0&&(e=n()),e)}const EB=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(qo.test(n)||n==="0")&&!n.startsWith("url("));function bne(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function wne(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=n[n.length-1],o=EB(s,e),a=EB(i,e);return Su(o===a,`You are trying to animate ${e} from "${s}" to "${i}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${i} via the \`style\` property.`),!o||!a?!1:bne(n)||t==="spring"&&r}class CB{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:t,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&rne(),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!wne(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(t0(e,this.options,t)),a==null||a(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,t);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function kB(n,e){return e?n*(1e3/e):0}const Ane=5;function SB(n,e,t){const r=Math.max(e-Ane,0);return kB(t-n(r),e-r)}const Gx=.001,vne=.01,TB=10,xne=.05,Ene=1;function Cne({duration:n=800,bounce:e=.25,velocity:t=0,mass:r=1}){let s,i;Su(n<=$i(TB),"Spring duration must be 10 seconds or less");let o=1-e;o=Wo(xne,Ene,o),n=Wo(vne,TB,Gi(n)),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Wx(c,o),p=Math.exp(-f);return Gx-d/h*p},i=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),m=Wx(Math.pow(c,2),o);return(-s(c)+Gx>0?-1:1)*((d-h)*p)/m}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-Gx+u*f},i=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=Sne(s,i,a);if(n=$i(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:n}}}const kne=12;function Sne(n,e,t){let r=t;for(let s=1;s<kne;s++)r=r-n(r)/e(r);return r}function Wx(n,e){return n*Math.sqrt(1-e*e)}const Tne=["duration","bounce"],One=["stiffness","damping","mass"];function OB(n,e){return e.some(t=>n[t]!==void 0)}function Nne(n){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...n};if(!OB(n,One)&&OB(n,Tne)){const t=Cne(n);e={...e,...t,mass:1},e.isResolvedFromDuration=!0}return e}function NB({keyframes:n,restDelta:e,restSpeed:t,...r}){const s=n[0],i=n[n.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:f,isResolvedFromDuration:d}=Nne({...r,velocity:-Gi(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*c)),m=i-s,y=Gi(Math.sqrt(a/c)),b=Math.abs(m)<5;t||(t=b?.01:2),e||(e=b?.005:.5);let v;if(p<1){const A=Wx(y,p);v=w=>{const x=Math.exp(-p*y*w);return i-x*((h+p*y*m)/A*Math.sin(A*w)+m*Math.cos(A*w))}}else if(p===1)v=A=>i-Math.exp(-y*A)*(m+(h+y*m)*A);else{const A=y*Math.sqrt(p*p-1);v=w=>{const x=Math.exp(-p*y*w),C=Math.min(A*w,300);return i-x*((h+p*y*m)*Math.sinh(C)+A*m*Math.cosh(C))/A}}return{calculatedDuration:d&&u||null,next:A=>{const w=v(A);if(d)o.done=A>=u;else{let x=h;A!==0&&(p<1?x=SB(v,A,w):x=0);const C=Math.abs(x)<=t,S=Math.abs(i-w)<=e;o.done=C&&S}return o.value=o.done?i:w,o}}}function MB({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const f=n[0],d={done:!1,value:f},h=M=>a!==void 0&&M<a||l!==void 0&&M>l,p=M=>a===void 0?l:l===void 0||Math.abs(a-M)<Math.abs(l-M)?a:l;let m=t*e;const y=f+m,b=o===void 0?y:o(y);b!==y&&(m=b-f);const v=M=>-m*Math.exp(-M/r),A=M=>b+v(M),w=M=>{const O=v(M),R=A(M);d.done=Math.abs(O)<=c,d.value=d.done?b:R};let x,C;const S=M=>{h(d.value)&&(x=M,C=NB({keyframes:[d.value,p(d.value)],velocity:SB(A,M,d.value),damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return S(0),{calculatedDuration:null,next:M=>{let O=!1;return!C&&x===void 0&&(O=!0,w(M),S(M)),x!==void 0&&M>=x?C.next(M-x):(!O&&w(M),d)}}}const RB=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,Mne=1e-7,Rne=12;function Pne(n,e,t,r,s){let i,o,a=0;do o=e+(t-e)/2,i=RB(o,r,s)-n,i>0?t=o:e=o;while(Math.abs(i)>Mne&&++a<Rne);return o}function Mh(n,e,t,r){if(n===e&&t===r)return xn;const s=i=>Pne(i,0,1,n,t);return i=>i===0||i===1?i:RB(s(i),e,r)}const Dne=Mh(.42,0,1,1),Ine=Mh(0,0,.58,1),PB=Mh(.42,0,.58,1),Lne=n=>Array.isArray(n)&&typeof n[0]!="number",DB=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,IB=n=>e=>1-n(1-e),Kx=n=>1-Math.sin(Math.acos(n)),LB=IB(Kx),Bne=DB(Kx),BB=Mh(.33,1.53,.69,.99),Qx=IB(BB),_ne=DB(Qx),_B={linear:xn,easeIn:Dne,easeInOut:PB,easeOut:Ine,circIn:Kx,circInOut:Bne,circOut:LB,backIn:Qx,backInOut:_ne,backOut:BB,anticipate:n=>(n*=2)<1?.5*Qx(n):.5*(2-Math.pow(2,-10*(n-1)))},FB=n=>{if(Array.isArray(n)){ji(n.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,t,r,s]=n;return Mh(e,t,r,s)}else if(typeof n=="string")return ji(_B[n]!==void 0,`Invalid easing type '${n}'`),_B[n];return n},Rh=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r},Bt=(n,e,t)=>n+(e-n)*t;function Jx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function Fne({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,i=0,o=0;if(!e)s=i=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=Jx(l,a,n+1/3),i=Jx(l,a,n),o=Jx(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function r0(n,e){return t=>t>0?e:n}const qx=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},jne=[Hx,xl,Nu],Une=n=>jne.find(e=>e.test(n));function jB(n){const e=Une(n);if(Su(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let t=e.parse(n);return e===Nu&&(t=Fne(t)),t}const UB=(n,e)=>{const t=jB(n),r=jB(e);if(!t||!r)return r0(n,e);const s={...t};return i=>(s.red=qx(t.red,r.red,i),s.green=qx(t.green,r.green,i),s.blue=qx(t.blue,r.blue,i),s.alpha=Bt(t.alpha,r.alpha,i),xl.transform(s))},Yx=new Set(["none","hidden"]);function Vne(n,e){return Yx.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function Hne(n,e){return t=>Bt(n,e,t)}function Xx(n){return typeof n=="number"?Hne:typeof n=="string"?Ex(n)?r0:Rn.test(n)?UB:Gne:Array.isArray(n)?VB:typeof n=="object"?Rn.test(n)?UB:zne:r0}function VB(n,e){const t=[...n],r=t.length,s=n.map((i,o)=>Xx(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)t[o]=s[o](i);return t}}function zne(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=Xx(n[s])(n[s],e[s]));return s=>{for(const i in r)t[i]=r[i](s);return t}}function $ne(n,e){var t;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=n.indexes[o][s[o]],l=(t=n.values[a])!==null&&t!==void 0?t:0;r[i]=l,s[o]++}return r}const Gne=(n,e)=>{const t=qo.createTransformer(e),r=Nh(n),s=Nh(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Yx.has(n)&&!s.values.length||Yx.has(e)&&!r.values.length?Vne(n,e):zi(VB($ne(r,s),s.values),t):(Su(!0,`Complex values '${n}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),r0(n,e))};function HB(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Bt(n,e,t):Xx(n)(n,e)}function Wne(n,e,t){const r=[],s=t||HB,i=n.length-1;for(let o=0;o<i;o++){let a=s(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||xn:e;a=zi(l,a)}r.push(a)}return r}function Kne(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const i=n.length;if(ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&n[0]===n[1])return()=>e[1];n[0]>n[i-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=Wne(e,r,s),a=o.length,l=c=>{let u=0;if(a>1)for(;u<n.length-2&&!(c<n[u+1]);u++);const f=Rh(n[u],n[u+1],c);return o[u](f)};return t?c=>l(Wo(n[0],n[i-1],c)):l}function Qne(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=Rh(0,e,r);n.push(Bt(t,1,s))}}function Jne(n){const e=[0];return Qne(e,n.length-1),e}function qne(n,e){return n.map(t=>t*e)}function Yne(n,e){return n.map(()=>e||PB).splice(0,n.length-1)}function s0({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=Lne(r)?r.map(FB):FB(r),i={done:!1,value:e[0]},o=qne(t&&t.length===e.length?t:Jne(e),n),a=Kne(o,e,{ease:Array.isArray(s)?s:Yne(e,s)});return{calculatedDuration:n,next:l=>(i.value=a(l),i.done=l>=n,i)}}const zB=2e4;function Xne(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<zB;)e+=t,r=n.next(e);return e>=zB?1/0:e}const Zne=n=>{const e=({timestamp:t})=>n(t);return{start:()=>dt.update(e,!0),stop:()=>Ui(e),now:()=>En.isProcessing?En.timestamp:Jo.now()}},ere={decay:MB,inertia:MB,tween:s0,keyframes:s0,spring:NB},tre=n=>n/100;class Zx extends CB{constructor({KeyframeResolver:e=jx,...t}){super(t),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:s,keyframes:i}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&s&&s.owner?this.resolver=s.owner.resolveKeyframes(i,o,r,s):this.resolver=new e(i,o,r,s),this.resolver.scheduleResolve()}initPlayback(e){const{type:t="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=ere[t]||s0;let l,c;a!==s0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ji(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=zi(tre,HB(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});i==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=Xne(u));const{calculatedDuration:f}=u,d=f+s,h=d*(r+1)-s;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:u,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const b=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?b<0:b>u;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let A=this.currentTime,w=i;if(h){const M=Math.min(this.currentTime,u)/f;let O=Math.floor(M),R=M%1;!R&&M>=1&&(R=1),R===1&&O--,O=Math.min(O,h+1),!!(O%2)&&(p==="reverse"?(R=1-R,m&&(R-=m/f)):p==="mirror"&&(w=o)),A=Wo(0,1,R)*f}const x=v?{done:!1,value:l[0]}:w.next(A);a&&(x.value=a(x.value));let{done:C}=x;!v&&c!==null&&(C=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return S&&s!==void 0&&(x.value=t0(l,this.options,s)),y&&y(x.value),S&&this.finish(),x}get duration(){const{resolved:e}=this;return e?Gi(e.calculatedDuration):0}get time(){return Gi(this.currentTime)}set time(e){e=$i(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Gi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=Zne,onPlay:t}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const $B=n=>Array.isArray(n)&&typeof n[0]=="number";function GB(n){return!!(!n||typeof n=="string"&&n in eE||$B(n)||Array.isArray(n)&&n.every(GB))}const Ph=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,eE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ph([0,.65,.55,1]),circOut:Ph([.55,0,1,.45]),backIn:Ph([.31,.01,.66,-.59]),backOut:Ph([.33,1.53,.69,.99])};function nre(n){return WB(n)||eE.easeOut}function WB(n){if(n)return $B(n)?Ph(n):Array.isArray(n)?n.map(nre):eE[n]}function rre(n,e,t,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:t};l&&(c.offset=l);const u=WB(a);return Array.isArray(u)&&(c.easing=u),n.animate(c,{delay:r,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const sre=xB(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ire=new Set(["opacity","clipPath","filter","transform"]),i0=10,ore=2e4;function are(n){return n.type==="spring"||n.name==="backgroundColor"||!GB(n.ease)}function lre(n,e){const t=new Zx({...e,keyframes:n,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:n[0]};const s=[];let i=0;for(;!r.done&&i<ore;)r=t.sample(i),s.push(r.value),i+=i0;return{times:void 0,keyframes:s,duration:i-i0,ease:"linear"}}class KB extends CB{constructor(e){super(e);const{name:t,motionValue:r,keyframes:s}=this.options;this.resolver=new vB(s,(i,o)=>this.onKeyframesResolved(i,o),t,r),this.resolver.scheduleResolve()}initPlayback(e,t){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:c}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(are(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=lre(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const u=rre(l.owner.current,c,e,{...this.options,duration:s,times:i,ease:o});return u.startTime=Jo.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:f}=this.options;l.set(t0(e,this.options,t)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Gi(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Gi(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.currentTime=$i(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return xn;const{animation:r}=t;r.timeline=e,r.onfinish=null}return xn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(t.playState==="idle"||t.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:c,onComplete:u,...f}=this.options,d=new Zx({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=$i(this.time);l.setWithVelocity(d.sample(h-i0).value,d.sample(h).value,i0)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return sre()&&r&&ire.has(r)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function cre(n,e){let t;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;t!==o&&n(o),t=o};return dt.update(r,!0),()=>Ui(r)}const ure=xB(()=>window.ScrollTimeline!==void 0);class fre{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=t}attachTimeline(e){const t=this.animations.map(r=>{if(ure()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),cre(s=>{r.time=r.duration*s},e)});return()=>{t.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const tE=(n,e,t,r={},s,i)=>o=>{const a=Bx(r,n)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-$i(l);let u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:i?void 0:s};Wte(a)||(u={...u,...Gte(n,u)}),u.duration&&(u.duration=$i(u.duration)),u.repeatDelay&&(u.repeatDelay=$i(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=t0(u.keyframes,a);if(d!==void 0)return dt.update(()=>{u.onUpdate(d),u.onComplete()}),new fre([])}return!i&&KB.supports(u)?new KB(u):new Zx(u)};function o0(n){return!!(Mn(n)&&n.add)}function nE(n,e){n.indexOf(e)===-1&&n.push(e)}function rE(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class sE{constructor(){this.subscriptions=[]}add(e){return nE(this.subscriptions,e),()=>rE(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const QB=new Set;function iE(n,e,t){n||QB.has(e)||(console.warn(e),QB.add(e))}const JB=30,dre=n=>!isNaN(parseFloat(n));class hre{constructor(e,t={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Jo.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Jo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=dre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&iE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new sE);const r=this.events[e].add(t);return e==="change"?()=>{r(),dt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Jo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>JB)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,JB);return kB(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dh(n,e){return new hre(n,e)}function pre(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Dh(t))}function mre(n,e){const t=e0(n,e);let{transitionEnd:r={},transition:s={},...i}=t||{};i={...i,...r};for(const o in i){const a=xte(i[o]);pre(n,o,a)}}function qB(n){return n.getProps()[xL]}function gre({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function YB(n,e,{delay:t=0,transitionOverride:r,type:s}={}){var i;let{transition:o=n.getDefaultTransition(),transitionEnd:a,...l}=e;const c=n.getValue("willChange");r&&(o=r);const u=[],f=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const h=n.getValue(d,(i=n.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&gre(f,d))continue;const m={delay:t,elapsed:0,...Bx(o||{},d)};let y=!1;if(window.HandoffAppearAnimations){const v=qB(n);if(v){const A=window.HandoffAppearAnimations(v,d,h,dt);A!==null&&(m.elapsed=A,y=!0)}}h.start(tE(d,h,p,n.shouldReduceMotion&&Al.has(d)?{type:!1}:m,n,y));const b=h.animation;b&&(o0(c)&&(c.add(d),b.then(()=>c.remove(d))),u.push(b))}return a&&Promise.all(u).then(()=>{dt.update(()=>{a&&mre(n,a)})}),u}function oE(n,e,t={}){var r;const s=e0(n,e,t.type==="exit"?(r=n.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=n.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(i=t.transitionOverride);const o=s?()=>Promise.all(YB(n,s,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:d}=i;return yre(n,e,u+c,f,d,t)}:()=>Promise.resolve(),{when:l}=i;if(l){const[c,u]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>u())}else return Promise.all([o(),a(t.delay)])}function yre(n,e,t=0,r=0,s=1,i){const o=[],a=(n.variantChildren.size-1)*r,l=s===1?(c=0)=>c*r:(c=0)=>a-c*r;return Array.from(n.variantChildren).sort(bre).forEach((c,u)=>{c.notify("AnimationStart",e),o.push(oE(c,e,{...i,delay:t+l(u)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function bre(n,e){return n.sortNodePosition(e)}function wre(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>oE(n,i,t));r=Promise.all(s)}else if(typeof e=="string")r=oE(n,e,t);else{const s=typeof e=="function"?e0(n,e,t.custom):e;r=Promise.all(YB(n,s,t))}return r.then(()=>{dt.postRender(()=>{n.notify("AnimationComplete",e)})})}const Are=[...wx].reverse(),vre=wx.length;function xre(n){return e=>Promise.all(e.map(({animation:t,options:r})=>wre(n,t,r)))}function Ere(n){let e=xre(n),t=XB(),r=!0;const s=l=>(c,u)=>{var f;const d=e0(n,u,l==="exit"?(f=n.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;c={...c,...m,...p}}return c};function i(l){e=l(n)}function o(l){const c=n.getProps(),u=n.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let y=0;y<vre;y++){const b=Are[y],v=t[b],A=c[b]!==void 0?c[b]:u[b],w=Eh(A),x=b===l?v.isActive:null;x===!1&&(p=y);let C=A===u[b]&&A!==c[b]&&w;if(C&&r&&n.manuallyAnimateOnMount&&(C=!1),v.protectedKeys={...h},!v.isActive&&x===null||!A&&!v.prevProp||Ky(A)||typeof A=="boolean")continue;let M=Cre(v.prevProp,A)||b===l&&v.isActive&&!C&&w||y>p&&w,O=!1;const R=Array.isArray(A)?A:[A];let D=R.reduce(s(b),{});x===!1&&(D={});const{prevResolvedValues:_={}}=v,U={..._,...D},K=B=>{M=!0,d.has(B)&&(O=!0,d.delete(B)),v.needsAnimating[B]=!0;const $=n.getValue(B);$&&($.liveStyle=!1)};for(const B in U){const $=D[B],q=_[B];if(h.hasOwnProperty(B))continue;let ne=!1;Rx($)&&Rx(q)?ne=!nB($,q):ne=$!==q,ne?$!=null?K(B):d.add(B):$!==void 0&&d.has(B)?K(B):v.protectedKeys[B]=!0}v.prevProp=A,v.prevResolvedValues=D,v.isActive&&(h={...h,...D}),r&&n.blockInitialAnimation&&(M=!1),M&&(!C||O)&&f.push(...R.map(B=>({animation:B,options:{type:b}})))}if(d.size){const y={};d.forEach(b=>{const v=n.getBaseTarget(b),A=n.getValue(b);A&&(A.liveStyle=!0),y[b]=v??null}),f.push({animation:y})}let m=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,c){var u;if(t[l].isActive===c)return Promise.resolve();(u=n.variantChildren)===null||u===void 0||u.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,c)}),t[l].isActive=c;const f=o(l);for(const d in t)t[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>t,reset:()=>{t=XB(),r=!0}}}function Cre(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!nB(e,n):!1}function El(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function XB(){return{animate:El(!0),whileInView:El(),whileHover:El(),whileTap:El(),whileDrag:El(),whileFocus:El(),exit:El()}}class kre extends Qo{constructor(e){super(e),e.animationState||(e.animationState=Ere(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ky(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Sre=0;class Tre extends Qo{constructor(){super(...arguments),this.id=Sre++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Ore={animation:{Feature:kre},exit:{Feature:Tre}},ZB=(n,e)=>Math.abs(n-e);function Nre(n,e){const t=ZB(n.x,e.x),r=ZB(n.y,e.y);return Math.sqrt(t**2+r**2)}class e_{constructor(e,t,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=lE(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=Nre(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=En;this.history.push({...p,timestamp:m});const{onStart:y,onMove:b}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=aE(d,this.transformPagePoint),dt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=lE(f.type==="pointercancel"?this.lastMoveEventInfo:aE(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,y),p&&p(f,y)},!QL(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.contextWindow=s||window;const o=Zy(e),a=aE(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=En;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,lE(a,this.history)),this.removeListeners=zi(Hi(this.contextWindow,"pointermove",this.handlePointerMove),Hi(this.contextWindow,"pointerup",this.handlePointerUp),Hi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Ui(this.updatePoint)}}function aE(n,e){return e?{point:e(n.point)}:n}function t_(n,e){return{x:n.x-e.x,y:n.y-e.y}}function lE({point:n},e){return{point:n,delta:t_(n,n_(e)),offset:t_(n,Mre(e)),velocity:Rre(e,.1)}}function Mre(n){return n[0]}function n_(n){return n[n.length-1]}function Rre(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=n_(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>$i(e)));)t--;if(!r)return{x:0,y:0};const i=Gi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Or(n){return n.max-n.min}function cE(n,e=0,t=.01){return Math.abs(n-e)<=t}function r_(n,e,t,r=.5){n.origin=r,n.originPoint=Bt(e.min,e.max,n.origin),n.scale=Or(t)/Or(e),(cE(n.scale,1,1e-4)||isNaN(n.scale))&&(n.scale=1),n.translate=Bt(t.min,t.max,n.origin)-n.originPoint,(cE(n.translate)||isNaN(n.translate))&&(n.translate=0)}function Ih(n,e,t,r){r_(n.x,e.x,t.x,r?r.originX:void 0),r_(n.y,e.y,t.y,r?r.originY:void 0)}function s_(n,e,t){n.min=t.min+e.min,n.max=n.min+Or(e)}function Pre(n,e,t){s_(n.x,e.x,t.x),s_(n.y,e.y,t.y)}function i_(n,e,t){n.min=e.min-t.min,n.max=n.min+Or(e)}function Lh(n,e,t){i_(n.x,e.x,t.x),i_(n.y,e.y,t.y)}function Dre(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?Bt(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?Bt(t,n,r.max):Math.min(n,t)),n}function o_(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Ire(n,{top:e,left:t,bottom:r,right:s}){return{x:o_(n.x,t,s),y:o_(n.y,e,r)}}function a_(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function Lre(n,e){return{x:a_(n.x,e.x),y:a_(n.y,e.y)}}function Bre(n,e){let t=.5;const r=Or(n),s=Or(e);return s>r?t=Rh(e.min,e.max-r,n.min):r>s&&(t=Rh(n.min,n.max-s,e.min)),Wo(0,1,t)}function _re(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const uE=.35;function Fre(n=uE){return n===!1?n=0:n===!0&&(n=uE),{x:l_(n,"left","right"),y:l_(n,"top","bottom")}}function l_(n,e,t){return{min:c_(n,e),max:c_(n,t)}}function c_(n,e){return typeof n=="number"?n:n[e]||0}const u_=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mu=()=>({x:u_(),y:u_()}),f_=()=>({min:0,max:0}),Kt=()=>({x:f_(),y:f_()});function Qr(n){return[n("x"),n("y")]}function d_({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function jre({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Ure(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function fE(n){return n===void 0||n===1}function dE({scale:n,scaleX:e,scaleY:t}){return!fE(n)||!fE(e)||!fE(t)}function Cl(n){return dE(n)||h_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function h_(n){return p_(n.x)||p_(n.y)}function p_(n){return n&&n!=="0%"}function a0(n,e,t){const r=n-t,s=e*r;return t+s}function m_(n,e,t,r,s){return s!==void 0&&(n=a0(n,s,r)),a0(n,t,r)+e}function hE(n,e=0,t=1,r,s){n.min=m_(n.min,e,t,r,s),n.max=m_(n.max,e,t,r,s)}function g_(n,{x:e,y:t}){hE(n.x,e.translate,e.scale,e.originPoint),hE(n.y,t.translate,t.scale,t.originPoint)}function Vre(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=t[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ru(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,g_(n,o)),r&&Cl(i.latestValues)&&Ru(n,i.latestValues))}e.x=y_(e.x),e.y=y_(e.y)}function y_(n){return Number.isInteger(n)||n>1.0000000000001||n<.999999999999?n:1}function Yo(n,e){n.min=n.min+e,n.max=n.max+e}function b_(n,e,[t,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(n.min,n.max,i);hE(n,e[t],e[r],o,e.scale)}const Hre=["x","scaleX","originX"],zre=["y","scaleY","originY"];function Ru(n,e){b_(n.x,e,Hre),b_(n.y,e,zre)}function w_(n,e){return d_(Ure(n.getBoundingClientRect(),e))}function $re(n,e,t){const r=w_(n,t),{scroll:s}=e;return s&&(Yo(r.x,s.offset.x),Yo(r.y,s.offset.y)),r}const A_=({current:n})=>n?n.ownerDocument.defaultView:null,Gre=new WeakMap;class Wre{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kt(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Zy(u,"page").point)},i=(u,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=XL(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qr(y=>{let b=this.getAxisMotionValue(y).get()||0;if(ti.test(b)){const{projection:v}=this.visualElement;if(v&&v.layout){const A=v.layout.layoutBox[y];A&&(b=Or(A)*(parseFloat(b)/100))}}this.originPoint[y]=b}),p&&dt.postRender(()=>p(u,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(u,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:y}=f;if(h&&this.currentDirection===null){this.currentDirection=Kre(y),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),m&&m(u,f)},a=(u,f)=>this.stop(u,f),l=()=>Qr(u=>{var f;return this.getAnimationState(u)==="paused"&&((f=this.getAxisMotionValue(u).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new e_(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:A_(this.visualElement)})}stop(e,t){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&dt.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!l0(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Dre(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;t&&Cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=Ire(s.layoutBox,t):this.constraints=!1,this.elastic=Fre(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Qr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=_re(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Cu(e))return!1;const r=e.current;ji(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=$re(r,s.root,this.visualElement.getTransformPagePoint());let o=Lre(s.layout.layoutBox,i);if(t){const a=t(jre(o));this.hasMutatedConstraints=!!a,a&&(o=d_(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Qr(u=>{if(!l0(u,t,this.currentDirection))return;let f=l&&l[u]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return r.start(tE(e,r,0,t,this.visualElement))}stopAnimation(){Qr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Qr(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[t];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Qr(t=>{const{drag:r}=this.getProps();if(!l0(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[t];i.set(e[t]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!Cu(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Qr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=Bre({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Qr(o=>{if(!l0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Bt(l,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;Gre.set(this.visualElement,this);const e=this.visualElement.current,t=Hi(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Cu(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),dt.read(r);const o=Vi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Qr(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=l[u].translate,f.set(f.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),t(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=uE,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function l0(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function Kre(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class Qre extends Qo{constructor(e){super(e),this.removeGroupControls=xn,this.removeListeners=xn,this.controls=new Wre(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xn}unmount(){this.removeGroupControls(),this.removeListeners()}}const v_=n=>(e,t)=>{n&&dt.postRender(()=>n(e,t))};class Jre extends Qo{constructor(){super(...arguments),this.removePointerDownListener=xn}onPointerDown(e){this.session=new e_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:A_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:v_(e),onStart:v_(t),onMove:r,onEnd:(i,o)=>{delete this.session,s&&dt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Hi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function qre(){const n=P.useContext(Gy);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:r}=n,s=P.useId();return P.useEffect(()=>r(s),[]),!e&&t?[!1,()=>t&&t(s)]:[!0]}const c0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function x_(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Bh={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Le.test(n))n=parseFloat(n);else return n;const t=x_(n,e.target.x),r=x_(n,e.target.y);return`${t}% ${r}%`}},Yre={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=qo.parse(n);if(s.length>5)return r;const i=qo.createTransformer(n),o=typeof s[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const c=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};class Xre extends P.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Xee(Zre),i&&(t.group&&t.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),c0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||dt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),bx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function E_(n){const[e,t]=qre(),r=P.useContext(vx);return k.jsx(Xre,{...n,layoutGroup:r,switchLayoutGroup:P.useContext(kL),isPresent:e,safeToRemove:t})}const Zre={borderRadius:{...Bh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bh,borderTopRightRadius:Bh,borderBottomLeftRadius:Bh,borderBottomRightRadius:Bh,boxShadow:Yre},C_=["TopLeft","TopRight","BottomLeft","BottomRight"],ese=C_.length,k_=n=>typeof n=="string"?parseFloat(n):n,S_=n=>typeof n=="number"||Le.test(n);function tse(n,e,t,r,s,i){s?(n.opacity=Bt(0,t.opacity!==void 0?t.opacity:1,nse(r)),n.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,rse(r))):i&&(n.opacity=Bt(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,r));for(let o=0;o<ese;o++){const a=`border${C_[o]}Radius`;let l=T_(e,a),c=T_(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||S_(l)===S_(c)?(n[a]=Math.max(Bt(k_(l),k_(c),r),0),(ti.test(c)||ti.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=Bt(e.rotate||0,t.rotate||0,r))}function T_(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const nse=O_(0,.5,LB),rse=O_(.5,.95,xn);function O_(n,e,t){return r=>r<n?0:r>e?1:t(Rh(n,e,r))}function N_(n,e){n.min=e.min,n.max=e.max}function Jr(n,e){N_(n.x,e.x),N_(n.y,e.y)}function M_(n,e,t,r,s){return n-=e,n=a0(n,1/t,r),s!==void 0&&(n=a0(n,1/s,r)),n}function sse(n,e=0,t=1,r=.5,s,i=n,o=n){if(ti.test(e)&&(e=parseFloat(e),e=Bt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Bt(i.min,i.max,r);n===i&&(a-=e),n.min=M_(n.min,e,t,a,s),n.max=M_(n.max,e,t,a,s)}function R_(n,e,[t,r,s],i,o){sse(n,e[t],e[r],e[s],e.scale,i,o)}const ise=["x","scaleX","originX"],ose=["y","scaleY","originY"];function P_(n,e,t,r){R_(n.x,e,ise,t?t.x:void 0,r?r.x:void 0),R_(n.y,e,ose,t?t.y:void 0,r?r.y:void 0)}function D_(n){return n.translate===0&&n.scale===1}function I_(n){return D_(n.x)&&D_(n.y)}function ase(n,e){return n.x.min===e.x.min&&n.x.max===e.x.max&&n.y.min===e.y.min&&n.y.max===e.y.max}function L_(n,e){return Math.round(n.x.min)===Math.round(e.x.min)&&Math.round(n.x.max)===Math.round(e.x.max)&&Math.round(n.y.min)===Math.round(e.y.min)&&Math.round(n.y.max)===Math.round(e.y.max)}function B_(n){return Or(n.x)/Or(n.y)}class lse{constructor(){this.members=[]}add(e){nE(this.members,e),e.scheduleRender()}remove(e){if(rE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(s=>e===s);if(t===0)return!1;let r;for(let s=t;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function __(n,e,t){let r="";const s=n.x.translate/e.x,i=n.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:c,rotate:u,rotateX:f,rotateY:d,skewX:h,skewY:p}=t;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const cse=(n,e)=>n.depth-e.depth;class use{constructor(){this.children=[],this.isDirty=!1}add(e){nE(this.children,e),this.isDirty=!0}remove(e){rE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(cse),this.isDirty=!1,this.children.forEach(e)}}function fse(n,e){const t=Jo.now(),r=({timestamp:s})=>{const i=s-t;i>=e&&(Ui(r),n(i-e))};return dt.read(r,!0),()=>Ui(r)}function dse(n){window.MotionDebug&&window.MotionDebug.record(n)}function hse(n){return n instanceof SVGElement&&n.tagName!=="svg"}function pse(n,e,t){const r=Mn(n)?n:Dh(n);return r.start(tE("",r,e,t)),r.animation}const pE=["","X","Y","Z"],mse={visibility:"hidden"},F_=1e3;let gse=0;const kl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mE(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function j_(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return!1;const{visualElement:e}=n.options;return e?qB(e)?!0:n.parent&&!n.parent.hasCheckedOptimisedAppear?j_(n.parent):!1:!1}function U_({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=gse++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,kl.totalNodes=kl.resolvedTargetDeltas=kl.recalculatedProjection=0,this.nodes.forEach(wse),this.nodes.forEach(Cse),this.nodes.forEach(kse),this.nodes.forEach(Ase),dse(kl)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new use)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new sE),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=hse(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(c||l)&&(this.isLayoutDirty=!0),n){let f;const d=()=>this.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=fse(d,250),c0.hasAnimatedSinceResize&&(c0.hasAnimatedSinceResize=!1,this.nodes.forEach(H_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||Mse,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),v=!this.targetLayout||!L_(this.targetLayout,p)||h,A=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,A);const w={...Bx(m,"layout"),onPlay:y,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else d||H_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ui(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Sse),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.HandoffCancelAllAnimations&&j_(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(V_);return}this.isUpdating||this.nodes.forEach(xse),this.isUpdating=!1,this.nodes.forEach(Ese),this.nodes.forEach(yse),this.nodes.forEach(bse),this.clearAllSnapshots();const a=Jo.now();En.delta=Wo(0,1e3/60,a-En.timestamp),En.timestamp=a,En.isProcessing=!0,Px.update.process(En),Px.preRender.process(En),Px.render.process(En),En.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(vse),this.sharedNodes.forEach(Tse)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Kt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:t(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!I_(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&(a||Cl(this.latestValues)||u)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Rse(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Kt();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(Yo(a.x,l.offset.x),Yo(a.y,l.offset.y)),a}removeElementScroll(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:f}=c;if(c!==this.root&&u&&f.layoutScroll){if(u.isRoot){Jr(a,o);const{scroll:d}=this.root;d&&(Yo(a.x,-d.offset.x),Yo(a.y,-d.offset.y))}Yo(a.x,u.offset.x),Yo(a.y,u.offset.y)}}return a}applyTransform(o,a=!1){const l=Kt();Jr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ru(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Cl(u.latestValues)&&Ru(l,u.latestValues)}return Cl(this.latestValues)&&Ru(l,this.latestValues),l}removeTransform(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!Cl(c.latestValues))continue;dE(c.latestValues)&&c.updateSnapshot();const u=Kt(),f=c.measurePageBox();Jr(u,f),P_(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return Cl(this.latestValues)&&P_(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==En.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=En.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),Lh(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Kt(),this.targetWithTransforms=Kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Pre(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jr(this.target,this.layout.layoutBox),g_(this.target,this.targetDelta)):Jr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),Lh(this.relativeTargetOrigin,this.target,h.target),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}kl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dE(this.parent.latestValues)||h_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===En.timestamp&&(c=!1),c)return;const{layout:u,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||f))return;Jr(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Vre(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Kt());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=Mu(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Mu(),this.projectionDeltaWithTransform=Mu());const m=this.projectionTransform;Ih(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=__(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),kl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},f=Mu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=Kt(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,y=this.getStack(),b=!y||y.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(Nse));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const x=w/1e3;z_(f.x,o.x,x),z_(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lh(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Ose(this.relativeTarget,this.relativeTargetOrigin,d,x),A&&ase(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Kt()),Jr(A,this.relativeTarget)),m&&(this.animationValues=u,tse(u,c,this.latestValues,x,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ui(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=dt.update(()=>{c0.hasAnimatedSinceResize=!0,this.currentAnimation=pse(0,F_,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(F_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&Q_(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Kt();const f=Or(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Or(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Jr(a,l),Ru(a,u),Ih(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new lse),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&mE("z",o,c,this.animationValues);for(let u=0;u<pE.length;u++)mE(`rotate${pE[u]}`,o,c,this.animationValues),mE(`skew${pE[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return mse;const c={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,c.opacity="",c.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||"",c.transform=u?u(this.latestValues,""):"none",c;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Cl(this.latestValues)&&(m.transform=u?u({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),c.transform=__(this.projectionDeltaWithTransform,this.treeScale,d),u&&(c.transform=u(d,c.transform));const{x:h,y:p}=this.projectionDelta;c.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?c.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:c.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Jy){if(d[m]===void 0)continue;const{correct:y,applyTo:b}=Jy[m],v=c.transform==="none"?d[m]:y(d[m],f);if(b){const A=b.length;for(let w=0;w<A;w++)c[b[w]]=v}else c[m]=v}return this.options.layoutId&&(c.pointerEvents=f===this?Xy(o==null?void 0:o.pointerEvents)||"":"none"),c}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(V_),this.root.sharedNodes.clear()}}}function yse(n){n.updateLayout()}function bse(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=n.layout,{animationType:i}=n.options,o=t.source!==n.layout.source;i==="size"?Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(d);d.min=r[f].min,d.max=d.min+h}):Q_(i,t.layoutBox,r)&&Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(r[f]);d.max=d.min+h,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[f].max=n.relativeTarget[f].min+h)});const a=Mu();Ih(a,r,t.layoutBox);const l=Mu();o?Ih(l,n.applyTransform(s,!0),t.measuredBox):Ih(l,r,t.layoutBox);const c=!I_(a);let u=!1;if(!n.resumeFrom){const f=n.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Kt();Lh(p,t.layoutBox,d.layoutBox);const m=Kt();Lh(m,r,h.layoutBox),L_(p,m)||(u=!0),f.options.layoutRoot&&(n.relativeTarget=m,n.relativeTargetOrigin=p,n.relativeParent=f)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:u})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function wse(n){kl.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function Ase(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function vse(n){n.clearSnapshot()}function V_(n){n.clearMeasurements()}function xse(n){n.isLayoutDirty=!1}function Ese(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function H_(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function Cse(n){n.resolveTargetDelta()}function kse(n){n.calcProjection()}function Sse(n){n.resetSkewAndRotation()}function Tse(n){n.removeLeadSnapshot()}function z_(n,e,t){n.translate=Bt(e.translate,0,t),n.scale=Bt(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function $_(n,e,t,r){n.min=Bt(e.min,t.min,r),n.max=Bt(e.max,t.max,r)}function Ose(n,e,t,r){$_(n.x,e.x,t.x,r),$_(n.y,e.y,t.y,r)}function Nse(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Mse={duration:.45,ease:[.4,0,.1,1]},G_=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),W_=G_("applewebkit/")&&!G_("chrome/")?Math.round:xn;function K_(n){n.min=W_(n.min),n.max=W_(n.max)}function Rse(n){K_(n.x),K_(n.y)}function Q_(n,e,t){return n==="position"||n==="preserve-aspect"&&!cE(B_(e),B_(t),.2)}const Pse=U_({attachResizeListener:(n,e)=>Vi(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gE={current:void 0},J_=U_({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!gE.current){const n=new Pse({});n.mount(window),n.setOptions({layoutScroll:!0}),gE.current=n}return gE.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Dse={pan:{Feature:Jre},drag:{Feature:Qre,ProjectionNode:J_,MeasureLayout:E_}},yE={current:null},q_={current:!1};function Ise(){if(q_.current=!0,!!mx)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>yE.current=n.matches;n.addListener(e),e()}else yE.current=!1}function Lse(n,e,t){const{willChange:r}=e;for(const s in e){const i=e[s],o=t[s];if(Mn(i))n.addValue(s,i),o0(r)&&r.add(s),process.env.NODE_ENV==="development"&&iE(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Mn(o))n.addValue(s,Dh(i,{owner:n})),o0(r)&&r.remove(s);else if(o!==i)if(n.hasValue(s)){const a=n.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=n.getStaticValue(s);n.addValue(s,Dh(a!==void 0?a:i,{owner:n}))}}for(const s in t)e[s]===void 0&&n.removeValue(s);return e}const Y_=new WeakMap,Bse=[...uB,Rn,qo],_se=n=>Bse.find(cB(n)),X_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],Fse=Ax.length;class jse{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=jx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>dt.render(this.render,!1,!0);const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Qy(t),this.isVariantNode=OL(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Mn(h)&&(h.set(l[d],!1),o0(u)&&u.add(d))}}mount(e){this.current=e,Y_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,r)=>this.bindToMotionValue(r,t)),q_.current||Ise(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yE.current,process.env.NODE_ENV!=="production"&&iE(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Y_.delete(this.current),this.projection&&this.projection.unmount(),Ui(this.notifyUpdate),Ui(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const r=Al.has(e),s=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&dt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in ku){const t=ku[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<X_.length;r++){const s=X_[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=Lse(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const t={};for(let r=0;r<Fse;r++){const s=Ax[r],i=this.props[s];(Eh(i)||i===!1)&&(t[s]=i)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Dh(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(sB(s)||rB(s))?s=parseFloat(s):!_se(s)&&qo.test(t)&&(s=AB(e,t)),this.setBaseTarget(e,Mn(s)?s.get():s)),Mn(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Mx(this.props,r,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Mn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class Z_ extends jse{constructor(){super(...arguments),this.KeyframeResolver=vB}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}}function Use(n){return window.getComputedStyle(n)}class Vse extends Z_{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(Al.has(t)){const r=$x(t);return r&&r.default||0}else{const r=Use(e),s=(DL(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return w_(e,t)}build(e,t,r,s){kx(e,t,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return Nx(e,t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Mn(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,t,r,s){VL(e,t,r,s)}}class Hse extends Z_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Al.has(t)){const r=$x(t);return r&&r.default||0}return t=HL.has(t)?t:yx(t),e.getAttribute(t)}measureInstanceViewportBox(){return Kt()}scrapeMotionValuesFromProps(e,t,r){return $L(e,t,r)}build(e,t,r,s){Tx(e,t,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,t,r,s){zL(e,t,r,s)}mount(e){this.isSVGTag=Ox(e.tagName),super.mount(e)}}const zse=(n,e)=>xx(n)?new Hse(e,{enableHardwareAcceleration:!1}):new Vse(e,{allowProjection:n!==P.Fragment,enableHardwareAcceleration:!0}),$se={...Ore,...Ute,...Dse,...{layout:{ProjectionNode:J_,MeasureLayout:E_}}},Gse=qee((n,e)=>Tte(n,e,$se,zse));function eF(){const n=P.useRef(!1);return gx(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Wse(){const n=eF(),[e,t]=P.useState(0),r=P.useCallback(()=>{n.current&&t(e+1)},[e]);return[P.useCallback(()=>dt.postRender(r),[r]),e]}class Kse extends V.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Qse({children:n,isPresent:e}){const t=P.useId(),r=P.useRef(null),s=P.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=P.useContext(px);return P.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:c}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=t;const u=document.createElement("style");return i&&(u.nonce=i),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
437
|
+
3. "-" cannot repeat`);It.customSchemes.push([n,e])}function rK(){It.scanner=QW(It.customSchemes);for(let n=0;n<It.tokenQueue.length;n++)It.tokenQueue[n][1]({scanner:It.scanner});It.parser=XW(It.scanner.tokens);for(let n=0;n<It.pluginQueue.length;n++)It.pluginQueue[n][1]({scanner:It.scanner,parser:It.parser});It.initialized=!0}function JM(n){return It.initialized||rK(),ZW(It.parser.start,n,JW(It.scanner.start,n))}function qM(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Cv(t),s=JM(n),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!e||a.t===e)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}function sK(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function iK(n){return new At({key:new Rt("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),i=e.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=TU(t.doc,[...e]);if(LU(a).forEach(({newRange:c})=>{const u=NU(r.doc,c,h=>h.isTextblock);let f,d;if(u.length>1?(f=u[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):u.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(f=u[0],d=r.doc.textBetween(f.pos,c.to,void 0," ")),f&&d){const h=d.split(" ").filter(b=>b!=="");if(h.length<=0)return!1;const p=h[h.length-1],m=f.pos+d.lastIndexOf(p);if(!p)return!1;const y=JM(p).map(b=>b.toObject());if(!sK(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:m+b.start+1,to:m+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate?n.validate(b.value):!0).forEach(b=>{Nb(b.from,b.to,r.doc).some(v=>v.mark.type===n.type)||o.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!o.steps.length)return o}})}function oK(n){return new At({key:new Rt("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,i;if(n.whenNotEditable&&e.editable||r.button!==0)return!1;let o=r.target;const a=[];for(;o.nodeName!=="DIV";)a.push(o),o=o.parentNode;if(!a.find(d=>d.nodeName==="A"))return!1;const l=uS(e.state,n.type.name),c=r.target,u=(s=c==null?void 0:c.href)!==null&&s!==void 0?s:l.href,f=(i=c==null?void 0:c.target)!==null&&i!==void 0?i:l.target;return c&&u?(window.open(u,f),!0):!1}}})}function aK(n){return new At({key:new Rt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:i}=s,{empty:o}=i;if(o)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});const l=qM(a).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}const lK=Zn.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){QM(n);return}QM(n.scheme,n.optionalSlashes)})},onDestroy(){nK()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",nt(this.options.HTMLAttributes,{...n,href:""}),0]:["a",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[vo({find:n=>{const e=[];if(n){const t=qM(n).filter(r=>r.isLink);t.length&&t.forEach(r=>e.push({text:r.value,data:{href:r.href},index:r.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(iK({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(oK({type:this.type,whenNotEditable:this.options.openOnClick==="whenNotEditable"})),this.options.linkOnPaste&&n.push(aK({editor:this.editor,type:this.type})),n}}),cK=Ot.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,considerAnyAsEmpty:!1,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new At({key:new Rt("placeholder"),props:{decorations:({doc:n,selection:e})=>{var t;const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:s}=e,i=[];if(!r)return null;const{firstChild:o}=n.content,a=o&&o.type.isLeaf,l=o&&o.isAtom,c=this.options.considerAnyAsEmpty?!0:o&&o.type.name===((t=n.type.contentMatch.defaultType)===null||t===void 0?void 0:t.name),u=n.content.childCount<=1&&o&&c&&o.nodeSize<=2&&(!a||!l);return n.descendants((f,d)=>{const h=s>=d&&s<=d+f.nodeSize,p=!f.isLeaf&&!f.childCount;if((h||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];u&&m.push(this.options.emptyEditorClass);const y=en.node(d,d+f.nodeSize,{class:m.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:f,pos:d,hasAnchor:h}):this.options.placeholder});i.push(y)}return this.options.includeChildren}),vt.create(n,i)}}})]}}),uK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,fK=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,dK=Zn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Pa({find:uK,type:this.type})]},addPasteRules(){return[vo({find:fK,type:this.type})]}}),hK=xt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",nt(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),pK=/^\s*(\[([( |x])?\])\s$/,mK=xt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>n.getAttribute("data-checked")==="true",renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",nt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return i.contentEditable="false",a.type="checkbox",a.addEventListener("change",c=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:u}=c.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const d=t(),h=f.doc.nodeAt(d);return f.setNodeMarkup(d,void 0,{...h==null?void 0:h.attrs,checked:u}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,u)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([c,u])=>{s.setAttribute(c,u)}),s.dataset.checked=n.attrs.checked,n.attrs.checked&&a.setAttribute("checked","checked"),i.append(a,o),s.append(i,l),Object.entries(e).forEach(([c,u])=>{s.setAttribute(c,u)}),{dom:s,contentDOM:l,update:c=>c.type!==this.type?!1:(s.dataset.checked=c.attrs.checked,c.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[gc({find:pK,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),gK=Zn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",nt(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function yK(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:o}=n,a=iV(t),l=new RegExp(`\\s${a}$`),c=i?"^":"",u=r?new RegExp(`${c}${a}.*?(?=\\s${a}|$)`,"gm"):new RegExp(`${c}(?:^)?${a}[^\\s${a}]*`,"gm"),f=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!f)return null;const d=o.pos-f.length,h=Array.from(f.matchAll(u)).pop();if(!h||h.input===void 0||h.index===void 0)return null;const p=h.input.slice(Math.max(0,h.index-1),h.index),m=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(p);if(s!==null&&!m)return null;const y=d+h.index;let b=y+h[0].length;return r&&l.test(f.slice(b-1,b+1))&&(h[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:h[0].slice(t.length),text:h[0]}:null}const bK=new Rt("suggestion");function wK({pluginKey:n=bK,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:s=[" "],startOfLine:i=!1,decorationTag:o="span",decorationClass:a="suggestion",command:l=()=>null,items:c=()=>[],render:u=()=>({}),allow:f=()=>!0,findSuggestionMatch:d=yK}){let h;const p=u==null?void 0:u(),m=new At({key:n,view(){return{update:async(y,b)=>{var v,A,w,x,C,S,M;const O=(v=this.key)===null||v===void 0?void 0:v.getState(b),R=(A=this.key)===null||A===void 0?void 0:A.getState(y.state),D=O.active&&R.active&&O.range.from!==R.range.from,_=!O.active&&R.active,U=O.active&&!R.active,K=!_&&!U&&O.query!==R.query,B=_||D,$=K&&!D,q=U||D;if(!B&&!$&&!q)return;const ne=q&&!B?O:R,Z=y.dom.querySelector(`[data-decoration-id="${ne.decorationId}"]`);h={editor:e,range:ne.range,query:ne.query,text:ne.text,items:[],command:me=>l({editor:e,range:ne.range,props:me}),decorationNode:Z,clientRect:Z?()=>{var me;const{decorationId:Ce}=(me=this.key)===null||me===void 0?void 0:me.getState(e.state),De=y.dom.querySelector(`[data-decoration-id="${Ce}"]`);return(De==null?void 0:De.getBoundingClientRect())||null}:null},B&&((w=p==null?void 0:p.onBeforeStart)===null||w===void 0||w.call(p,h)),$&&((x=p==null?void 0:p.onBeforeUpdate)===null||x===void 0||x.call(p,h)),($||B)&&(h.items=await c({editor:e,query:ne.query})),q&&((C=p==null?void 0:p.onExit)===null||C===void 0||C.call(p,h)),$&&((S=p==null?void 0:p.onUpdate)===null||S===void 0||S.call(p,h)),B&&((M=p==null?void 0:p.onStart)===null||M===void 0||M.call(p,h))},destroy:()=>{var y;h&&((y=p==null?void 0:p.onExit)===null||y===void 0||y.call(p,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(y,b,v,A){const{isEditable:w}=e,{composing:x}=e.view,{selection:C}=y,{empty:S,from:M}=C,O={...b};if(O.composing=x,w&&(S||e.view.composing)){(M<b.range.from||M>b.range.to)&&!x&&!b.composing&&(O.active=!1);const R=d({char:t,allowSpaces:r,allowedPrefixes:s,startOfLine:i,$position:C.$from}),D=`id_${Math.floor(Math.random()*4294967295)}`;R&&f({editor:e,state:A,range:R.range})?(O.active=!0,O.decorationId=b.decorationId?b.decorationId:D,O.range=R.range,O.query=R.query,O.text=R.text):O.active=!1}else O.active=!1;return O.active||(O.decorationId=null,O.range={from:0,to:0},O.query=null,O.text=null),O}},props:{handleKeyDown(y,b){var v;const{active:A,range:w}=m.getState(y.state);return A&&((v=p==null?void 0:p.onKeyDown)===null||v===void 0?void 0:v.call(p,{view:y,event:b,range:w}))||!1},decorations(y){const{active:b,range:v,decorationId:A}=m.getState(y);return b?vt.create(y.doc,[en.inline(v.from,v.to,{nodeName:o,class:a,"data-decoration-id":A})]):null}}});return m}var AK=typeof Yn=="object"&&Yn&&Yn.Object===Object&&Yn,vK=typeof self=="object"&&self&&self.Object===Object&&self;AK||vK||Function("return this")();var xK=typeof window<"u"?P.useLayoutEffect:P.useEffect,EK=typeof window>"u";function YM(n,{defaultValue:e=!1,initializeWithValue:t=!0}={}){const r=a=>EK?e:window.matchMedia(a).matches,[s,i]=P.useState(()=>t?r(n):e);function o(){i(r(n))}return xK(()=>{const a=window.matchMedia(n);return o(),a.addListener?a.addListener(o):a.addEventListener("change",o),()=>{a.removeListener?a.removeListener(o):a.removeEventListener("change",o)}},[n]),s}const CK=Ot.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[wK({editor:this.editor,...this.options.suggestion})]}}),kK=({query:n})=>[{title:"Text",description:"Just start typing with plain text.",searchTerms:["p","paragraph"],icon:k.jsx(gT,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").run()}},{title:"To-do List",description:"Track tasks with a to-do list.",searchTerms:["todo","task","list","check","checkbox"],icon:k.jsx(mT,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleTaskList().run()}},{title:"Heading 1",description:"Big section heading.",searchTerms:["title","big","large"],icon:k.jsx(zp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:1}).run()}},{title:"Heading 2",description:"Medium section heading.",searchTerms:["subtitle","medium"],icon:k.jsx($p,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:2}).run()}},{title:"Heading 3",description:"Small section heading.",searchTerms:["subtitle","small"],icon:k.jsx(Gp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setNode("heading",{level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list.",searchTerms:["unordered","point"],icon:k.jsx(Wp,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleBulletList().run()}},{title:"Numbered List",description:"Create a list with numbering.",searchTerms:["ordered"],icon:k.jsx(Ec,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).toggleOrderedList().run()}},{title:"Divider",description:"Visually divide content.",searchTerms:["hr","divider","break","line","delimiter"],icon:k.jsx(l8,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setHorizontalRule().run()}},{title:"Quote",description:"Capture a quote.",searchTerms:["blockquote"],icon:k.jsx(Kp,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleNode("paragraph","paragraph").toggleBlockquote().run()},{title:"Code",description:"Capture a code snippet.",searchTerms:["codeblock"],icon:k.jsx(cd,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).toggleCodeBlock().run()},{title:"Table",description:"Create a table.",searchTerms:["table"],icon:k.jsx(ow,{size:18}),image:"",command:({editor:e,range:t})=>e.chain().focus().deleteRange(t).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()},{title:"Image",description:"Upload an image from your computer.",searchTerms:["photo","picture","media"],icon:k.jsx(o8,{size:18}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).run();const r=document.createElement("input");r.type="file",r.accept="image/*",r.onchange=async()=>{var s;if((s=r.files)!=null&&s.length){const i=r.files[0],o=e.view.state.selection.from;uw(i,e.view,o)}},r.click()}},{title:"Video Embed",description:"Embed a video from YouTube, Vimeo, etc.",searchTerms:["iframe","embed","video","youtube"],icon:k.jsx(bT,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("iframe").run()}},{title:"Twitter",description:"Embed a Twitter tweet.",searchTerms:["embed","twitter","tweet"],icon:k.jsx(yT,{}),image:"",command:({editor:e,range:t})=>{e.chain().focus().deleteRange(t).setActionButton("twitter").run()}},{title:"2 Columns",description:"Create 2 columns of block",searchTerms:["col","column","2","layout"],icon:k.jsx(dT,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(2).focus(e.state.selection.head-1).run()}},{title:"3 Columns",description:"Create 3 columns of block",searchTerms:["col","column","3","layout"],icon:k.jsx(n8,{}),image:"",command:({editor:e})=>{e.chain().focus().setColumns(3).focus(e.state.selection.head-1).run()}}].filter(e=>{if(typeof n=="string"&&n.length>0){const t=n.toLowerCase();return e.title.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.searchTerms&&e.searchTerms.some(r=>r.includes(t))}return!0}),SK=(n,e)=>{const t=n.offsetHeight,r=e?e.offsetHeight:0,s=e.offsetTop,i=s+r;s<n.scrollTop?n.scrollTop-=n.scrollTop-s+5:i>t+n.scrollTop&&(n.scrollTop+=i-t-n.scrollTop+5)},TK=({items:n,command:e,editor:t})=>{const[r,s]=P.useState(0),[i,o]=P.useState(n),a=YM("(max-width: 640px)"),l=P.useCallback(u=>{const f=i[u];f&&(f.title==="Continue writing"||e(f))},[e,t,i]);P.useEffect(()=>{if(a){const u=i.filter(f=>!["2 Columns","3 Columns","Twitter","Video Embed"].includes(f.title));o(u)}else o(n)},[n,a]),P.useEffect(()=>{const u=["ArrowUp","ArrowDown","Enter"],f=d=>{if(u.includes(d.key))return d.preventDefault(),d.key==="ArrowUp"?(s((r+i.length-1)%i.length),!0):d.key==="ArrowDown"?(s((r+1)%i.length),!0):d.key==="Enter"?(l(r),!0):!1};return document.addEventListener("keydown",f),()=>{document.removeEventListener("keydown",f)}},[i,r,s,l]),P.useEffect(()=>{s(0)},[i]);const c=P.useRef(null);return P.useLayoutEffect(()=>{const u=c==null?void 0:c.current,f=u==null?void 0:u.children[r];f&&u&&SK(u,f)},[r]),i.length>0?k.jsx("div",{id:"slash-command",ref:c,className:"z-50 h-auto max-h-[330px] w-72 overflow-y-auto scroll-smooth rounded-md border border-[#DDD] bg-white px-1 py-2 shadow-md transition-all",children:i.map((u,f)=>k.jsxs("button",{className:`flex w-full items-center space-x-2 rounded-md px-2 py-1 text-left text-sm text-neutral-500 hover:bg-neutral-100 hover:border-neutral-200 border border-transparent transition-all ${f===r?"bg-neutral-200 text-neutral-800":""}`,onClick:()=>l(f),children:[k.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-md border border-neutral-200 bg-white",children:u.icon}),k.jsxs("div",{children:[k.jsx("p",{className:"font-medium",children:u.title}),k.jsx("p",{className:"text-xs text-neutral-500",children:u.description})]})]},f))}):null},OK=()=>{let n=null,e=null;return{onStart:t=>{n=new lT(TK,{props:t,editor:t.editor}),e=Ba("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"})},onUpdate:t=>{n==null||n.updateProps(t),e&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown:t=>{var r;return t.event.key==="Escape"?(e==null||e[0].hide(),!0):(r=n==null?void 0:n.ref)==null?void 0:r.onKeyDown(t)},onExit:()=>{e==null||e[0].destroy(),n==null||n.destroy()}}},NK=CK.configure({suggestion:{items:kK,render:OK}}),MK=PM.extend({renderHTML(){return["div",nt(this.options.HTMLAttributes,{"data-type":this.name}),["hr"]]}}),RK=Ot.create({name:"columnExtension",addExtensions(){const n=[];return this.options.column!==!1&&n.push(nN),this.options.columns!==!1&&n.push(mm),n}}),PK=Ot.create({name:"CustomKeymap",addCommands(){return{selectTextWithinNodeBoundaries:()=>({editor:n,commands:e})=>{const{state:t}=n,{tr:r}=t,s=r.selection.$from.start(),i=r.selection.$to.end();return e.setTextSelection({from:s,to:i})}}},addKeyboardShortcuts(){return{"Mod-a":({editor:n})=>{const{state:e}=n,{tr:t}=e,r=t.selection.from,s=t.selection.to,i=t.selection.$from.start(),o=t.selection.$to.end();return r>i||s<o?(n.chain().selectTextWithinNodeBoundaries().run(),!0):!1}}}}),DK=Ot.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;return(e=n.style.color)===null||e===void 0?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),XM=[{tooltip:"Align left",action:n=>n({dataAlign:"start",dataFloat:null}),icon:"AlignLeft",isActive:n=>n.dataAlign==="start"},{tooltip:"Align center",action:n=>n({dataAlign:"center",dataFloat:null}),icon:"AlignCenter",isActive:n=>n.dataAlign==="center"},{tooltip:"Align right",action:n=>n({dataAlign:"end",dataFloat:null}),icon:"AlignRight",isActive:n=>n.dataAlign==="end"},{tooltip:"Delete",icon:"Trash2",delete:n=>n()}];let Kc;const ZM=({node:n,updateAttributes:e,deleteNode:t})=>{const r=gm(),[s,i]=P.useState(),[o,a]=P.useState(0),[l,c]=P.useState(0),[u,f]=P.useState({}),d=P.useRef(null),[h,p]=P.useState(!1),m=()=>{const U={};XM.forEach(({tooltip:K,isActive:B})=>{U[K]=!!(B!=null&&B(n.attrs))}),f(U)},y=()=>{const U=document.querySelector(".ProseMirror");if(U&&c(U==null?void 0:U.clientWidth),!!d.current){if(s==="video"){const K=d.current;K.addEventListener("loadeddata",function(){a(K.videoWidth/K.videoHeight),C("left",0)})}else if(s==="iframe"){const K=d.current;K.onload=()=>{a(K.offsetWidth/K.offsetHeight),C("left",0)}}else d.current.onload=()=>{a(d.current.naturalWidth/d.current.naturalHeight)};setTimeout(()=>m(),200)}},b=U=>{Kc=U};P.useEffect(()=>{y()},[]);const v=({width:U,height:K})=>U<200||K<200,A=U=>{setTimeout(()=>S(U))},w=U=>{Kc=U.clientX,setTimeout(()=>{document.addEventListener("mousemove",A),document.addEventListener("mouseup",x)}),p(!0)},x=()=>{Kc=-1,document.removeEventListener("mousemove",A),document.removeEventListener("mouseup",x),p(!1)},C=(U,K)=>{var q,ne;if(!d.current){console.error("Media ref is undefined|null",{resizableImg:d.current});return}const B={width:(q=d.current)==null?void 0:q.width,height:(ne=d.current)==null?void 0:ne.height},$={width:-1,height:-1};U==="left"?$.width=B.width-Math.abs(K):(typeof B.width=="string"&&(B.width=Number(B.width)),$.width=B.width+Math.abs(K)),$.width>l&&($.width=l),s==="iframe"?$.height=$.width/(16/9):$.height=$.width/o,!v($)&&e($)},S=U=>{if(Kc===-1)return;const{clientX:K}=U,B=Kc-K;if(B===0)return;const $=B>0?"left":"right";setTimeout(()=>{C($,Math.abs(B)),Kc=K})},[M,O]=P.useState(),[R,D]=P.useState();P.useEffect(()=>{i(n.attrs["media-type"]),m(),O(n.attrs.dataFloat),D(n.attrs.dataAlign)},[n.attrs]);const _=U=>{switch(U){case"AlignLeft":return k.jsx(ad,{size:16});case"AlignCenter":return k.jsx(Xb,{size:16});case"AlignRight":return k.jsx(Zb,{size:16});case"Trash2":return k.jsx(aw,{size:16});default:return null}};return k.jsx(od,{as:"article",className:he("media-node-view not-prose transition-all ease-in-out w-full",M&&`f-${n.attrs.dataFloat}`,R&&`justify-${n.attrs.dataAlign}`),children:k.jsxs("div",{className:"w-fit flex relative group transition-all ease-in-out",children:[s==="img"&&k.jsx("img",{src:n.attrs.src,ref:d,className:"rounded-lg",alt:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),s==="video"&&k.jsx("video",{ref:d,className:"rounded-lg",controls:!0,width:n.attrs.width,height:n.attrs.height,children:k.jsx("source",{src:n.attrs.src})}),s==="iframe"&&k.jsx("iframe",{ref:d,className:he("rounded-lg max-w-full",h&&"pointer-events-none"),src:n.attrs.src,width:n.attrs.width,height:n.attrs.height}),!r&&k.jsxs(k.Fragment,{children:[k.jsx("div",{className:"horizontal-resize-handle group-hover:bg-black group-hover:border-2 group-hover:border-white/80",title:"Resize",onClick:({clientX:U})=>b(U),onMouseDown:w,onMouseUp:x}),k.jsx("section",{className:"media-control-buttons opacity-0 group-hover:opacity-100 transition-opacity duration-200 flex",children:XM.map((U,K)=>k.jsx("div",{className:"tooltip","data-tip":U.tooltip,children:k.jsx("button",{type:"button",className:he("btn rounded-none h-8 px-2 py-1 transition",u[U.tooltip]&&"active"),onClick:()=>{var B;return U.tooltip==="Delete"?t():(B=U.action)==null?void 0:B.call(U,e)},children:U.icon&&_(U.icon)})},K))})]})]})})},IK=xt.create({name:"iframe",group:"block",atom:!0,draggable:!0,addOptions(){return{allowFullscreen:!0,HTMLAttributes:{class:"iframe-wrapper"}}},addAttributes(){return{src:{default:null},frameborder:{default:0},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},"media-type":{default:"iframe"},alt:{default:null},title:{default:null},width:{default:this.options.width},height:{default:this.options.height},dataAlign:{default:"left"},dataFloat:{default:null}}},addNodeView(){return _a(ZM)},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",nt(this.options.HTMLAttributes,n)]},addCommands(){return{setIframe:n=>({tr:e,dispatch:t})=>{const{selection:r}=e,s=this.type.create(n);return t&&e.replaceRangeWith(r.from-1,r.to,s),!0}}}});var LK="https://platform.twitter.com/widgets.js",Sv="createTweet",BK=function(e){var t=P.useRef(null),r=P.useState(!0),s=r[0],i=r[1];return P.useEffect(function(){var o=!0,a=require("scriptjs");return a(LK,"twitter-embed",function(){if(!window.twttr){console.error("Failure to load window.twttr, aborting load");return}if(o){if(!window.twttr.widgets[Sv]){console.error("Method "+Sv+" is not present anymore in twttr.widget api");return}window.twttr.widgets[Sv](e.tweetId,t==null?void 0:t.current,e.options).then(function(l){i(!1),e.onLoad&&e.onLoad(l)})}}),function(){o=!1}},[]),P.createElement(P.Fragment,null,s&&P.createElement(P.Fragment,null,e.placeholder),P.createElement("div",{ref:t}))};const _K=({node:n,editor:e})=>{const[t,r]=P.useState(!0);return P.useEffect(()=>{e==null||e.chain().focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:k.jsxs("div",{className:"w-full max-w-sm",children:[t&&k.jsx(hN,{width:5,height:5}),k.jsx(BK,{tweetId:n.attrs.tweetId,onLoad:()=>r(!1)})]})})},FK=xt.create({name:"embeddedTweet",group:"block",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{class:""}}},addAttributes(){return{tweetId:{default:null},align:{default:"center"}}},parseHTML(){return[{tag:"div[data-tweet-id]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(this.options.HTMLAttributes,n)]},addNodeView(){return _a(_K)},addCommands(){return{setTweetEmbed:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{tweetId:n.tweetId,align:"center"},content:[]})}}}),jK=n=>new At({key:new Rt("media-paste-drop"),props:{handlePaste(e,t){var s;return Array.from(((s=t.clipboardData)==null?void 0:s.items)||[]).forEach(i=>{const o=i.getAsFile();if(((o==null?void 0:o.type.indexOf("image"))===0||(o==null?void 0:o.type.indexOf("video"))===0)&&(t.preventDefault(),o&&o.size>1024*1024))throw new Error("Image too large")}),!1},handleDrop(e,t){var a;if(!(t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length))return!1;const s=Array.from(((a=t.dataTransfer)==null?void 0:a.files)??[]).filter(({type:l})=>/image|video/i.test(l));if(s.length===0)return!1;t.preventDefault();const{schema:i}=e.state,o=e.posAtCoords({left:t.clientX,top:t.clientY});return o?(s.forEach(async l=>{const c=new FileReader;if(n){const u=i.nodes.resizableMedia.create({src:await n(l),"media-type":l.type.includes("image")?"img":"video"}),f=e.state.tr.insert(o.pos,u);e.dispatch(f)}else c.onload=u=>{var h;const f=i.nodes.resizableMedia.create({src:(h=u.target)==null?void 0:h.result,"media-type":l.type.includes("image")?"img":"video"}),d=e.state.tr.insert(o.pos,f);e.dispatch(d)},c.readAsDataURL(l)}),!0):!1}}}),UK=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,VK=/!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\)/,HK=xt.create({name:"resizableMedia",addOptions(){return{HTMLAttributes:{class:"rounded-lg border border-stone-200"},uploadFn:async()=>""}},inline:!1,group:"block",draggable:!0,addAttributes(){return{src:{default:null},"media-type":{default:null},alt:{default:null},title:{default:null},width:{default:"100%"},height:{default:"auto"},dataAlign:{default:"left"},dataFloat:{default:null}}},selectable:!0,parseHTML(){return[{tag:'img[src]:not([src^="data:"])',getAttrs:n=>({src:n.getAttribute("src"),"media-type":"img"})},{tag:"video",getAttrs:n=>({src:n.getAttribute("src"),"media-type":"video"})}]},renderHTML({HTMLAttributes:n}){const{"media-type":e}=n;return e==="img"?["img",nt(this.options.HTMLAttributes,n)]:e==="video"?["video",{controls:"true",style:"width: 100%",...n},["source",n]]:(e||console.error("TiptapMediaExtension-renderHTML method: Media Type not set, going default with image"),["img",nt(this.options.HTMLAttributes,n)])},addCommands(){return{setMedia:n=>({commands:e})=>{const{"media-type":t}=n;return t==="img"?e.insertContent({type:this.name,attrs:n}):t==="video"?e.insertContent({type:this.name,attrs:{...n,controls:"true"}}):(t||console.error("TiptapMediaExtension-setMedia: Media Type not set, going default with image"),e.insertContent({type:this.name,attrs:n}))}}},addNodeView(){return _a(ZM)},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{selection:e}=n.state;if(e.empty)return!1;const t=e.$to.pos;return n.commands.insertContentAt(t,{type:"dBlock",content:[{type:"paragraph"}]})}}},addInputRules(){return[Db({find:UK,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r,"media-type":"img"}}}),Db({find:VK,type:this.type,getAttributes:n=>{const[,,e]=n;return{src:e,"media-type":"video"}}})]},addProseMirrorPlugins(){return[jK(this.options.uploadFn),w8()]}});function Tv(n,e){let t;return(...s)=>{clearTimeout(t),t=setTimeout(()=>n(...s),e)}}const zK=["top","right","bottom","left"],Qs=Math.min,kr=Math.max,Lg=Math.round,Bg=Math.floor,Io=n=>({x:n,y:n}),$K={left:"right",right:"left",bottom:"top",top:"bottom"},GK={start:"end",end:"start"};function Ov(n,e,t){return kr(n,Qs(e,t))}function Ti(n,e){return typeof n=="function"?n(e):n}function Oi(n){return n.split("-")[0]}function Qc(n){return n.split("-")[1]}function Nv(n){return n==="x"?"y":"x"}function Mv(n){return n==="y"?"height":"width"}function Jc(n){return["top","bottom"].includes(Oi(n))?"y":"x"}function Rv(n){return Nv(Jc(n))}function WK(n,e,t){t===void 0&&(t=!1);const r=Qc(n),s=Rv(n),i=Mv(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=_g(o)),[o,_g(o)]}function KK(n){const e=_g(n);return[Pv(n),e,Pv(e)]}function Pv(n){return n.replace(/start|end/g,e=>GK[e])}function QK(n,e,t){const r=["left","right"],s=["right","left"],i=["top","bottom"],o=["bottom","top"];switch(n){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?i:o;default:return[]}}function JK(n,e,t,r){const s=Qc(n);let i=QK(Oi(n),t==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(Pv)))),i}function _g(n){return n.replace(/left|right|bottom|top/g,e=>$K[e])}function qK(n){return{top:0,right:0,bottom:0,left:0,...n}}function eR(n){return typeof n!="number"?qK(n):{top:n,right:n,bottom:n,left:n}}function Fg(n){const{x:e,y:t,width:r,height:s}=n;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function tR(n,e,t){let{reference:r,floating:s}=n;const i=Jc(e),o=Rv(e),a=Mv(o),l=Oi(e),c=i==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,d=r[a]/2-s[a]/2;let h;switch(l){case"top":h={x:u,y:r.y-s.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:f};break;case"left":h={x:r.x-s.width,y:f};break;default:h={x:r.x,y:r.y}}switch(Qc(e)){case"start":h[o]-=d*(t&&c?-1:1);break;case"end":h[o]+=d*(t&&c?-1:1);break}return h}const YK=async(n,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=t,a=i.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:n,floating:e,strategy:s}),{x:u,y:f}=tR(c,r,l),d=r,h={},p=0;for(let m=0;m<a.length;m++){const{name:y,fn:b}=a[m],{x:v,y:A,data:w,reset:x}=await b({x:u,y:f,initialPlacement:r,placement:d,strategy:s,middlewareData:h,rects:c,platform:o,elements:{reference:n,floating:e}});u=v??u,f=A??f,h={...h,[y]:{...h[y],...w}},x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(d=x.placement),x.rects&&(c=x.rects===!0?await o.getElementRects({reference:n,floating:e,strategy:s}):x.rects),{x:u,y:f}=tR(c,d,l)),m=-1)}return{x:u,y:f,placement:d,strategy:s,middlewareData:h}};async function Kd(n,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:d=!1,padding:h=0}=Ti(e,n),p=eR(h),y=a[d?f==="floating"?"reference":"floating":f],b=Fg(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:c,rootBoundary:u,strategy:l})),v=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,A=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),w=await(i.isElement==null?void 0:i.isElement(A))?await(i.getScale==null?void 0:i.getScale(A))||{x:1,y:1}:{x:1,y:1},x=Fg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:A,strategy:l}):v);return{top:(b.top-x.top+p.top)/w.y,bottom:(x.bottom-b.bottom+p.bottom)/w.y,left:(b.left-x.left+p.left)/w.x,right:(x.right-b.right+p.right)/w.x}}const XK=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:r,placement:s,rects:i,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:u=0}=Ti(n,e)||{};if(c==null)return{};const f=eR(u),d={x:t,y:r},h=Rv(s),p=Mv(h),m=await o.getDimensions(c),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",A=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-d[h]-i.floating[p],x=d[h]-i.reference[h],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let S=C?C[A]:0;(!S||!await(o.isElement==null?void 0:o.isElement(C)))&&(S=a.floating[A]||i.floating[p]);const M=w/2-x/2,O=S/2-m[p]/2-1,R=Qs(f[b],O),D=Qs(f[v],O),_=R,U=S-m[p]-D,K=S/2-m[p]/2+M,B=Ov(_,K,U),$=!l.arrow&&Qc(s)!=null&&K!==B&&i.reference[p]/2-(K<_?R:D)-m[p]/2<0,q=$?K<_?K-_:K-U:0;return{[h]:d[h]+q,data:{[h]:B,centerOffset:K-B-q,...$&&{alignmentOffset:q}},reset:$}}}),ZK=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:a,platform:l,elements:c}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:d,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Ti(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Oi(s),v=Oi(a)===a,A=await(l.isRTL==null?void 0:l.isRTL(c.floating)),w=d||(v||!m?[_g(a)]:KK(a));!d&&p!=="none"&&w.push(...JK(a,m,p,A));const x=[a,...w],C=await Kd(e,y),S=[];let M=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&S.push(C[b]),f){const _=WK(s,o,A);S.push(C[_[0]],C[_[1]])}if(M=[...M,{placement:s,overflows:S}],!S.every(_=>_<=0)){var O,R;const _=(((O=i.flip)==null?void 0:O.index)||0)+1,U=x[_];if(U)return{data:{index:_,overflows:M},reset:{placement:U}};let K=(R=M.filter(B=>B.overflows[0]<=0).sort((B,$)=>B.overflows[1]-$.overflows[1])[0])==null?void 0:R.placement;if(!K)switch(h){case"bestFit":{var D;const B=(D=M.map($=>[$.placement,$.overflows.filter(q=>q>0).reduce((q,ne)=>q+ne,0)]).sort(($,q)=>$[1]-q[1])[0])==null?void 0:D[0];B&&(K=B);break}case"initialPlacement":K=a;break}if(s!==K)return{reset:{placement:K}}}return{}}}};function nR(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function rR(n){return zK.some(e=>n[e]>=0)}const eQ=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:r="referenceHidden",...s}=Ti(n,e);switch(r){case"referenceHidden":{const i=await Kd(e,{...s,elementContext:"reference"}),o=nR(i,t.reference);return{data:{referenceHiddenOffsets:o,referenceHidden:rR(o)}}}case"escaped":{const i=await Kd(e,{...s,altBoundary:!0}),o=nR(i,t.floating);return{data:{escapedOffsets:o,escaped:rR(o)}}}default:return{}}}}};async function tQ(n,e){const{placement:t,platform:r,elements:s}=n,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=Oi(t),a=Qc(t),l=Jc(t)==="y",c=["left","top"].includes(o)?-1:1,u=i&&l?-1:1,f=Ti(e,n);let{mainAxis:d,crossAxis:h,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...f};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*u,y:d*c}:{x:d*c,y:h*u}}const nQ=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,r;const{x:s,y:i,placement:o,middlewareData:a}=e,l=await tQ(e,n);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:i+l.y,data:{...l,placement:o}}}}},rQ=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:i=!0,crossAxis:o=!1,limiter:a={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...l}=Ti(n,e),c={x:t,y:r},u=await Kd(e,l),f=Jc(Oi(s)),d=Nv(f);let h=c[d],p=c[f];if(i){const y=d==="y"?"top":"left",b=d==="y"?"bottom":"right",v=h+u[y],A=h-u[b];h=Ov(v,h,A)}if(o){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=p+u[y],A=p-u[b];p=Ov(v,p,A)}const m=a.fn({...e,[d]:h,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r}}}}},sQ=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:a=0,mainAxis:l=!0,crossAxis:c=!0}=Ti(n,e),u={x:t,y:r},f=Jc(s),d=Nv(f);let h=u[d],p=u[f];const m=Ti(a,e),y=typeof m=="number"?{mainAxis:m,crossAxis:0}:{mainAxis:0,crossAxis:0,...m};if(l){const A=d==="y"?"height":"width",w=i.reference[d]-i.floating[A]+y.mainAxis,x=i.reference[d]+i.reference[A]-y.mainAxis;h<w?h=w:h>x&&(h=x)}if(c){var b,v;const A=d==="y"?"width":"height",w=["top","left"].includes(Oi(s)),x=i.reference[f]-i.floating[A]+(w&&((b=o.offset)==null?void 0:b[f])||0)+(w?0:y.crossAxis),C=i.reference[f]+i.reference[A]+(w?0:((v=o.offset)==null?void 0:v[f])||0)-(w?y.crossAxis:0);p<x?p=x:p>C&&(p=C)}return{[d]:h,[f]:p}}}},iQ=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){const{placement:t,rects:r,platform:s,elements:i}=e,{apply:o=()=>{},...a}=Ti(n,e),l=await Kd(e,a),c=Oi(t),u=Qc(t),f=Jc(t)==="y",{width:d,height:h}=r.floating;let p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(s.isRTL==null?void 0:s.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");const y=h-l.top-l.bottom,b=d-l.left-l.right,v=Qs(h-l[p],y),A=Qs(d-l[m],b),w=!e.middlewareData.shift;let x=v,C=A;if(f?C=u||w?Qs(A,b):b:x=u||w?Qs(v,y):y,w&&!u){const M=kr(l.left,0),O=kr(l.right,0),R=kr(l.top,0),D=kr(l.bottom,0);f?C=d-2*(M!==0||O!==0?M+O:kr(l.left,l.right)):x=h-2*(R!==0||D!==0?R+D:kr(l.top,l.bottom))}await o({...e,availableWidth:C,availableHeight:x});const S=await s.getDimensions(i.floating);return d!==S.width||h!==S.height?{reset:{rects:!0}}:{}}}};function qc(n){return sR(n)?(n.nodeName||"").toLowerCase():"#document"}function Sr(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Ni(n){var e;return(e=(sR(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function sR(n){return n instanceof Node||n instanceof Sr(n).Node}function Js(n){return n instanceof Element||n instanceof Sr(n).Element}function qs(n){return n instanceof HTMLElement||n instanceof Sr(n).HTMLElement}function iR(n){return typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Sr(n).ShadowRoot}function Qd(n){const{overflow:e,overflowX:t,overflowY:r,display:s}=ms(n);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function oQ(n){return["table","td","th"].includes(qc(n))}function Dv(n){const e=Iv(),t=ms(n);return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function aQ(n){let e=Lo(n);for(;qs(e)&&!Yc(e);){if(Dv(e))return e;e=Lo(e)}return null}function Iv(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Yc(n){return["html","body","#document"].includes(qc(n))}function ms(n){return Sr(n).getComputedStyle(n)}function jg(n){return Js(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.pageXOffset,scrollTop:n.pageYOffset}}function Lo(n){if(qc(n)==="html")return n;const e=n.assignedSlot||n.parentNode||iR(n)&&n.host||Ni(n);return iR(e)?e.host:e}function oR(n){const e=Lo(n);return Yc(e)?n.ownerDocument?n.ownerDocument.body:n.body:qs(e)&&Qd(e)?e:oR(e)}function Jd(n,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=oR(n),i=s===((r=n.ownerDocument)==null?void 0:r.body),o=Sr(s);return i?e.concat(o,o.visualViewport||[],Qd(s)?s:[],o.frameElement&&t?Jd(o.frameElement):[]):e.concat(s,Jd(s,[],t))}function aR(n){const e=ms(n);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=qs(n),i=s?n.offsetWidth:t,o=s?n.offsetHeight:r,a=Lg(t)!==i||Lg(r)!==o;return a&&(t=i,r=o),{width:t,height:r,$:a}}function Lv(n){return Js(n)?n:n.contextElement}function Xc(n){const e=Lv(n);if(!qs(e))return Io(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:i}=aR(e);let o=(i?Lg(t.width):t.width)/r,a=(i?Lg(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const lQ=Io(0);function lR(n){const e=Sr(n);return!Iv()||!e.visualViewport?lQ:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function cQ(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Sr(n)?!1:e}function nl(n,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=n.getBoundingClientRect(),i=Lv(n);let o=Io(1);e&&(r?Js(r)&&(o=Xc(r)):o=Xc(n));const a=cQ(i,t,r)?lR(i):Io(0);let l=(s.left+a.x)/o.x,c=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(i){const d=Sr(i),h=r&&Js(r)?Sr(r):r;let p=d,m=p.frameElement;for(;m&&r&&h!==p;){const y=Xc(m),b=m.getBoundingClientRect(),v=ms(m),A=b.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=b.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;l*=y.x,c*=y.y,u*=y.x,f*=y.y,l+=A,c+=w,p=Sr(m),m=p.frameElement}}return Fg({width:u,height:f,x:l,y:c})}const uQ=[":popover-open",":modal"];function Bv(n){return uQ.some(e=>{try{return n.matches(e)}catch{return!1}})}function fQ(n){let{elements:e,rect:t,offsetParent:r,strategy:s}=n;const i=s==="fixed",o=Ni(r),a=e?Bv(e.floating):!1;if(r===o||a&&i)return t;let l={scrollLeft:0,scrollTop:0},c=Io(1);const u=Io(0),f=qs(r);if((f||!f&&!i)&&((qc(r)!=="body"||Qd(o))&&(l=jg(r)),qs(r))){const d=nl(r);c=Xc(r),u.x=d.x+r.clientLeft,u.y=d.y+r.clientTop}return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+u.x,y:t.y*c.y-l.scrollTop*c.y+u.y}}function dQ(n){return Array.from(n.getClientRects())}function cR(n){return nl(Ni(n)).left+jg(n).scrollLeft}function hQ(n){const e=Ni(n),t=jg(n),r=n.ownerDocument.body,s=kr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=kr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+cR(n);const a=-t.scrollTop;return ms(r).direction==="rtl"&&(o+=kr(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:a}}function pQ(n,e){const t=Sr(n),r=Ni(n),s=t.visualViewport;let i=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){i=s.width,o=s.height;const c=Iv();(!c||c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:i,height:o,x:a,y:l}}function mQ(n,e){const t=nl(n,!0,e==="fixed"),r=t.top+n.clientTop,s=t.left+n.clientLeft,i=qs(n)?Xc(n):Io(1),o=n.clientWidth*i.x,a=n.clientHeight*i.y,l=s*i.x,c=r*i.y;return{width:o,height:a,x:l,y:c}}function uR(n,e,t){let r;if(e==="viewport")r=pQ(n,t);else if(e==="document")r=hQ(Ni(n));else if(Js(e))r=mQ(e,t);else{const s=lR(n);r={...e,x:e.x-s.x,y:e.y-s.y}}return Fg(r)}function fR(n,e){const t=Lo(n);return t===e||!Js(t)||Yc(t)?!1:ms(t).position==="fixed"||fR(t,e)}function gQ(n,e){const t=e.get(n);if(t)return t;let r=Jd(n,[],!1).filter(a=>Js(a)&&qc(a)!=="body"),s=null;const i=ms(n).position==="fixed";let o=i?Lo(n):n;for(;Js(o)&&!Yc(o);){const a=ms(o),l=Dv(o);!l&&a.position==="fixed"&&(s=null),(i?!l&&!s:!l&&a.position==="static"&&!!s&&["absolute","fixed"].includes(s.position)||Qd(o)&&!l&&fR(n,o))?r=r.filter(u=>u!==o):s=a,o=Lo(o)}return e.set(n,r),r}function yQ(n){let{element:e,boundary:t,rootBoundary:r,strategy:s}=n;const o=[...t==="clippingAncestors"?Bv(e)?[]:gQ(e,this._c):[].concat(t),r],a=o[0],l=o.reduce((c,u)=>{const f=uR(e,u,s);return c.top=kr(f.top,c.top),c.right=Qs(f.right,c.right),c.bottom=Qs(f.bottom,c.bottom),c.left=kr(f.left,c.left),c},uR(e,a,s));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function bQ(n){const{width:e,height:t}=aR(n);return{width:e,height:t}}function wQ(n,e,t){const r=qs(e),s=Ni(e),i=t==="fixed",o=nl(n,!0,i,e);let a={scrollLeft:0,scrollTop:0};const l=Io(0);if(r||!r&&!i)if((qc(e)!=="body"||Qd(s))&&(a=jg(e)),r){const f=nl(e,!0,i,e);l.x=f.x+e.clientLeft,l.y=f.y+e.clientTop}else s&&(l.x=cR(s));const c=o.left+a.scrollLeft-l.x,u=o.top+a.scrollTop-l.y;return{x:c,y:u,width:o.width,height:o.height}}function _v(n){return ms(n).position==="static"}function dR(n,e){return!qs(n)||ms(n).position==="fixed"?null:e?e(n):n.offsetParent}function hR(n,e){const t=Sr(n);if(Bv(n))return t;if(!qs(n)){let s=Lo(n);for(;s&&!Yc(s);){if(Js(s)&&!_v(s))return s;s=Lo(s)}return t}let r=dR(n,e);for(;r&&oQ(r)&&_v(r);)r=dR(r,e);return r&&Yc(r)&&_v(r)&&!Dv(r)?t:r||aQ(n)||t}const AQ=async function(n){const e=this.getOffsetParent||hR,t=this.getDimensions,r=await t(n.floating);return{reference:wQ(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function vQ(n){return ms(n).direction==="rtl"}const xQ={convertOffsetParentRelativeRectToViewportRelativeRect:fQ,getDocumentElement:Ni,getClippingRect:yQ,getOffsetParent:hR,getElementRects:AQ,getClientRects:dQ,getDimensions:bQ,getScale:Xc,isElement:Js,isRTL:vQ};function EQ(n,e){let t=null,r;const s=Ni(n);function i(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),i();const{left:c,top:u,width:f,height:d}=n.getBoundingClientRect();if(a||e(),!f||!d)return;const h=Bg(u),p=Bg(s.clientWidth-(c+f)),m=Bg(s.clientHeight-(u+d)),y=Bg(c),v={rootMargin:-h+"px "+-p+"px "+-m+"px "+-y+"px",threshold:kr(0,Qs(1,l))||1};let A=!0;function w(x){const C=x[0].intersectionRatio;if(C!==l){if(!A)return o();C?o(!1,C):r=setTimeout(()=>{o(!1,1e-7)},1e3)}A=!1}try{t=new IntersectionObserver(w,{...v,root:s.ownerDocument})}catch{t=new IntersectionObserver(w,v)}t.observe(n)}return o(!0),i}function CQ(n,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Lv(n),u=s||i?[...c?Jd(c):[],...Jd(e)]:[];u.forEach(b=>{s&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=c&&a?EQ(c,t):null;let d=-1,h=null;o&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&h&&(h.unobserve(e),cancelAnimationFrame(d),d=requestAnimationFrame(()=>{var A;(A=h)==null||A.observe(e)})),t()}),c&&!l&&h.observe(c),h.observe(e));let p,m=l?nl(n):null;l&&y();function y(){const b=nl(n);m&&(b.x!==m.x||b.y!==m.y||b.width!==m.width||b.height!==m.height)&&t(),m=b,p=requestAnimationFrame(y)}return t(),()=>{var b;u.forEach(v=>{s&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const kQ=nQ,SQ=rQ,TQ=ZK,OQ=iQ,NQ=eQ,pR=XK,MQ=sQ,RQ=(n,e,t)=>{const r=new Map,s={platform:xQ,...t},i={...s.platform,_c:r};return YK(n,e,{...s,platform:i})};var Ug=typeof document<"u"?P.useLayoutEffect:P.useEffect;function Vg(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,r,s;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(r=t;r--!==0;)if(!Vg(n[r],e[r]))return!1;return!0}if(s=Object.keys(n),t=s.length,t!==Object.keys(e).length)return!1;for(r=t;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=t;r--!==0;){const i=s[r];if(!(i==="_owner"&&n.$$typeof)&&!Vg(n[i],e[i]))return!1}return!0}return n!==n&&e!==e}function mR(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function gR(n,e){const t=mR(n);return Math.round(e*t)/t}function yR(n){const e=V.useRef(n);return Ug(()=>{e.current=n}),e}function PQ(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:a=!0,whileElementsMounted:l,open:c}=n,[u,f]=V.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[d,h]=V.useState(r);Vg(d,r)||h(r);const[p,m]=V.useState(null),[y,b]=V.useState(null),v=V.useCallback(q=>{q!==C.current&&(C.current=q,m(q))},[]),A=V.useCallback(q=>{q!==S.current&&(S.current=q,b(q))},[]),w=i||p,x=o||y,C=V.useRef(null),S=V.useRef(null),M=V.useRef(u),O=l!=null,R=yR(l),D=yR(s),_=V.useCallback(()=>{if(!C.current||!S.current)return;const q={placement:e,strategy:t,middleware:d};D.current&&(q.platform=D.current),RQ(C.current,S.current,q).then(ne=>{const Z={...ne,isPositioned:!0};U.current&&!Vg(M.current,Z)&&(M.current=Z,C0.flushSync(()=>{f(Z)}))})},[d,e,t,D]);Ug(()=>{c===!1&&M.current.isPositioned&&(M.current.isPositioned=!1,f(q=>({...q,isPositioned:!1})))},[c]);const U=V.useRef(!1);Ug(()=>(U.current=!0,()=>{U.current=!1}),[]),Ug(()=>{if(w&&(C.current=w),x&&(S.current=x),w&&x){if(R.current)return R.current(w,x,_);_()}},[w,x,_,R,O]);const K=V.useMemo(()=>({reference:C,floating:S,setReference:v,setFloating:A}),[v,A]),B=V.useMemo(()=>({reference:w,floating:x}),[w,x]),$=V.useMemo(()=>{const q={position:t,left:0,top:0};if(!B.floating)return q;const ne=gR(B.floating,u.x),Z=gR(B.floating,u.y);return a?{...q,transform:"translate("+ne+"px, "+Z+"px)",...mR(B.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ne,top:Z}},[t,a,B.floating,u.x,u.y]);return V.useMemo(()=>({...u,update:_,refs:K,elements:B,floatingStyles:$}),[u,_,K,B,$])}const DQ=n=>{function e(t){return{}.hasOwnProperty.call(t,"current")}return{name:"arrow",options:n,fn(t){const{element:r,padding:s}=typeof n=="function"?n(t):n;return r&&e(r)?r.current!=null?pR({element:r.current,padding:s}).fn(t):{}:r?pR({element:r,padding:s}).fn(t):{}}}},IQ=(n,e)=>({...kQ(n),options:[n,e]}),LQ=(n,e)=>({...SQ(n),options:[n,e]}),BQ=(n,e)=>({...MQ(n),options:[n,e]}),_Q=(n,e)=>({...TQ(n),options:[n,e]}),FQ=(n,e)=>({...OQ(n),options:[n,e]}),jQ=(n,e)=>({...NQ(n),options:[n,e]}),UQ=(n,e)=>({...DQ(n),options:[n,e]});var VQ="Arrow",bR=V.forwardRef((n,e)=>{const{children:t,width:r=10,height:s=5,...i}=n;return k.jsx(nr.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:n.asChild?t:k.jsx("polygon",{points:"0,0 30,0 15,10"})})});bR.displayName=VQ;var HQ=bR;function zQ(n){const[e,t]=V.useState(void 0);return Fa(()=>{if(n){t({width:n.offsetWidth,height:n.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,a;if("borderBoxSize"in i){const l=i.borderBoxSize,c=Array.isArray(l)?l[0]:l;o=c.inlineSize,a=c.blockSize}else o=n.offsetWidth,a=n.offsetHeight;t({width:o,height:a})});return r.observe(n,{box:"border-box"}),()=>r.unobserve(n)}else t(void 0)},[n]),e}var Fv="Popper",[wR,AR]=fw(Fv),[$Q,vR]=wR(Fv),xR=n=>{const{__scopePopper:e,children:t}=n,[r,s]=V.useState(null);return k.jsx($Q,{scope:e,anchor:r,onAnchorChange:s,children:t})};xR.displayName=Fv;var ER="PopperAnchor",CR=V.forwardRef((n,e)=>{const{__scopePopper:t,virtualRef:r,...s}=n,i=vR(ER,t),o=V.useRef(null),a=jr(e,o);return V.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:k.jsx(nr.div,{...s,ref:a})});CR.displayName=ER;var jv="PopperContent",[GQ,WQ]=wR(jv),kR=V.forwardRef((n,e)=>{var He,Be,et,le,ze,ae;const{__scopePopper:t,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:c=[],collisionPadding:u=0,sticky:f="partial",hideWhenDetached:d=!1,updatePositionStrategy:h="optimized",onPlaced:p,...m}=n,y=vR(jv,t),[b,v]=V.useState(null),A=jr(e,be=>v(be)),[w,x]=V.useState(null),C=zQ(w),S=(C==null?void 0:C.width)??0,M=(C==null?void 0:C.height)??0,O=r+(i!=="center"?"-"+i:""),R=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(c)?c:[c],_=D.length>0,U={padding:R,boundary:D.filter(QQ),altBoundary:_},{refs:K,floatingStyles:B,placement:$,isPositioned:q,middlewareData:ne}=PQ({strategy:"fixed",placement:O,whileElementsMounted:(...be)=>CQ(...be,{animationFrame:h==="always"}),elements:{reference:y.anchor},middleware:[IQ({mainAxis:s+M,alignmentAxis:o}),l&&LQ({mainAxis:!0,crossAxis:!1,limiter:f==="partial"?BQ():void 0,...U}),l&&_Q({...U}),FQ({...U,apply:({elements:be,rects:_e,availableWidth:H,availableHeight:Q})=>{const{width:re,height:ce}=_e.reference,I=be.floating.style;I.setProperty("--radix-popper-available-width",`${H}px`),I.setProperty("--radix-popper-available-height",`${Q}px`),I.setProperty("--radix-popper-anchor-width",`${re}px`),I.setProperty("--radix-popper-anchor-height",`${ce}px`)}}),w&&UQ({element:w,padding:a}),JQ({arrowWidth:S,arrowHeight:M}),d&&jQ({strategy:"referenceHidden",...U})]}),[Z,me]=OR($),Ce=Eo(p);Fa(()=>{q&&(Ce==null||Ce())},[q,Ce]);const De=(He=ne.arrow)==null?void 0:He.x,ke=(Be=ne.arrow)==null?void 0:Be.y,Ee=((et=ne.arrow)==null?void 0:et.centerOffset)!==0,[Ve,je]=V.useState();return Fa(()=>{b&&je(window.getComputedStyle(b).zIndex)},[b]),k.jsx("div",{ref:K.setFloating,"data-radix-popper-content-wrapper":"",style:{...B,transform:q?B.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ve,"--radix-popper-transform-origin":[(le=ne.transformOrigin)==null?void 0:le.x,(ze=ne.transformOrigin)==null?void 0:ze.y].join(" "),...((ae=ne.hide)==null?void 0:ae.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:n.dir,children:k.jsx(GQ,{scope:t,placedSide:Z,onArrowChange:x,arrowX:De,arrowY:ke,shouldHideArrow:Ee,children:k.jsx(nr.div,{"data-side":Z,"data-align":me,...m,ref:A,style:{...m.style,animation:q?void 0:"none"}})})})});kR.displayName=jv;var SR="PopperArrow",KQ={top:"bottom",right:"left",bottom:"top",left:"right"},TR=V.forwardRef(function(e,t){const{__scopePopper:r,...s}=e,i=WQ(SR,r),o=KQ[i.placedSide];return k.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:k.jsx(HQ,{...s,ref:t,style:{...s.style,display:"block"}})})});TR.displayName=SR;function QQ(n){return n!==null}var JQ=n=>({name:"transformOrigin",options:n,fn(e){var y,b,v;const{placement:t,rects:r,middlewareData:s}=e,o=((y=s.arrow)==null?void 0:y.centerOffset)!==0,a=o?0:n.arrowWidth,l=o?0:n.arrowHeight,[c,u]=OR(t),f={start:"0%",center:"50%",end:"100%"}[u],d=(((b=s.arrow)==null?void 0:b.x)??0)+a/2,h=(((v=s.arrow)==null?void 0:v.y)??0)+l/2;let p="",m="";return c==="bottom"?(p=o?f:`${d}px`,m=`${-l}px`):c==="top"?(p=o?f:`${d}px`,m=`${r.floating.height+l}px`):c==="right"?(p=`${-l}px`,m=o?f:`${h}px`):c==="left"&&(p=`${r.floating.width+l}px`,m=o?f:`${h}px`),{data:{x:p,y:m}}}});function OR(n){const[e,t="center"]=n.split("-");return[e,t]}var qQ=xR,NR=CR,YQ=kR,XQ=TR,Uv="Popover",[MR,Lie]=fw(Uv,[AR]),qd=AR(),[ZQ,rl]=MR(Uv),RR=n=>{const{__scopePopover:e,children:t,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=n,a=qd(e),l=V.useRef(null),[c,u]=V.useState(!1),[f=!1,d]=AT({prop:r,defaultProp:s,onChange:i});return k.jsx(qQ,{...a,children:k.jsx(ZQ,{scope:e,contentId:Jp(),triggerRef:l,open:f,onOpenChange:d,onOpenToggle:V.useCallback(()=>d(h=>!h),[d]),hasCustomAnchor:c,onCustomAnchorAdd:V.useCallback(()=>u(!0),[]),onCustomAnchorRemove:V.useCallback(()=>u(!1),[]),modal:o,children:t})})};RR.displayName=Uv;var PR="PopoverAnchor",e7=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(PR,t),i=qd(t),{onCustomAnchorAdd:o,onCustomAnchorRemove:a}=s;return V.useEffect(()=>(o(),()=>a()),[o,a]),k.jsx(NR,{...i,...r,ref:e})});e7.displayName=PR;var DR="PopoverTrigger",IR=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(DR,t),i=qd(t),o=jr(e,s.triggerRef),a=k.jsx(nr.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":jR(s.open),...r,ref:o,onClick:Ar(n.onClick,s.onOpenToggle)});return s.hasCustomAnchor?a:k.jsx(NR,{asChild:!0,...i,children:a})});IR.displayName=DR;var t7="PopoverPortal",[Bie,n7]=MR(t7,{forceMount:void 0}),Zc="PopoverContent",LR=V.forwardRef((n,e)=>{const t=n7(Zc,n.__scopePopover),{forceMount:r=t.forceMount,...s}=n,i=rl(Zc,n.__scopePopover);return k.jsx(fd,{present:r||i.open,children:i.modal?k.jsx(r7,{...s,ref:e}):k.jsx(s7,{...s,ref:e})})});LR.displayName=Zc;var r7=V.forwardRef((n,e)=>{const t=rl(Zc,n.__scopePopover),r=V.useRef(null),s=jr(e,r),i=V.useRef(!1);return V.useEffect(()=>{const o=r.current;if(o)return WT(o)},[]),k.jsx(xw,{as:qp,allowPinchZoom:!0,children:k.jsx(BR,{...n,ref:s,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Ar(n.onCloseAutoFocus,o=>{var a;o.preventDefault(),i.current||(a=t.triggerRef.current)==null||a.focus()}),onPointerDownOutside:Ar(n.onPointerDownOutside,o=>{const a=o.detail.originalEvent,l=a.button===0&&a.ctrlKey===!0,c=a.button===2||l;i.current=c},{checkForDefaultPrevented:!1}),onFocusOutside:Ar(n.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),s7=V.forwardRef((n,e)=>{const t=rl(Zc,n.__scopePopover),r=V.useRef(!1),s=V.useRef(!1);return k.jsx(BR,{...n,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,a;(o=n.onCloseAutoFocus)==null||o.call(n,i),i.defaultPrevented||(r.current||(a=t.triggerRef.current)==null||a.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var l,c;(l=n.onInteractOutside)==null||l.call(n,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((c=t.triggerRef.current)==null?void 0:c.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),BR=V.forwardRef((n,e)=>{const{__scopePopover:t,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onInteractOutside:u,...f}=n,d=rl(Zc,t),h=qd(t);return RT(),k.jsx(ud,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:k.jsx(pw,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:c,onDismiss:()=>d.onOpenChange(!1),children:k.jsx(YQ,{"data-state":jR(d.open),role:"dialog",id:d.contentId,...h,...f,ref:e,style:{...f.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),_R="PopoverClose",FR=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=rl(_R,t);return k.jsx(nr.button,{type:"button",...r,ref:e,onClick:Ar(n.onClick,()=>s.onOpenChange(!1))})});FR.displayName=_R;var i7="PopoverArrow",o7=V.forwardRef((n,e)=>{const{__scopePopover:t,...r}=n,s=qd(t);return k.jsx(XQ,{...s,...r,ref:e})});o7.displayName=i7;function jR(n){return n?"open":"closed"}var a7=RR,l7=IR,c7=LR,Hg=FR;const zg=({children:n,isActive:e,onClick:t,disabled:r,className:s})=>{const i=he("flex items-center gap-2 p-1.5 text-xs font-medium text-neutral-500 text-left w-full rounded-md border border-transparent transition-all",!e&&!r,"hover:border-neutral-200 hover:bg-neutral-100",e&&!r&&"bg-neutral-200 text-neutral-800",r&&"text-neutral-300 cursor-not-allowed",s);return k.jsx("button",{className:i,disabled:r,onClick:t,children:n})},u7=(n,e,t)=>{const r=P.useCallback(()=>{const a=n.chain();a.setNodeSelection(t).unsetAllMarks(),(e==null?void 0:e.type.name)!=="paragraph"&&a.setParagraph(),a.run()},[n,t,e==null?void 0:e.type.name]),s=P.useCallback(()=>{n.commands.setNodeSelection(t);const{$anchor:a}=n.state.selection,l=a.node(1)||n.state.selection.node;n.chain().setMeta("hideDragHandle",!0).insertContentAt(t+((e==null?void 0:e.nodeSize)||0),l.toJSON()).run()},[n,t,e==null?void 0:e.nodeSize]),i=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).run(),document.execCommand("copy"),alert("copied")},[n,t]),o=P.useCallback(()=>{n.chain().setMeta("hideDragHandle",!0).setNodeSelection(t).deleteSelection().run()},[n,t]);return{resetTextFormatting:r,duplicateNode:s,copyNodeToClipboard:i,deleteNode:o}},f7=({node:n,getPos:e,editor:t,deleteNode:r})=>{const[s,i]=P.useState(!1),o=u7(t,n,e()),a=gm(),l=["https://twitter.com","https://x.com"],c=P.useMemo(()=>{const{content:O}=n.content;return O[0].type.name==="table"},[n.content]),u=P.useMemo(()=>{var R;const{content:O}=n.content;return(R=O[0].content.content[0])==null?void 0:R.text},[n.content]),f=P.useMemo(()=>{var R;const{content:O}=n.content;return(R=O[0].content.content[1])==null?void 0:R.text},[n.content]),d=P.useMemo(()=>{const{content:O}=n.content;return O[0].content.content.find(R=>{var D;return(D=R==null?void 0:R.text)==null?void 0:D.match(/\/status\/([0-9]*)/)})},[n.content]),h=()=>{if(!u)return;let O=u;if(u.includes("<iframe"))O=f;else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(u):{const K=u.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);K&&K.length>0&&(O=`https://www.youtube.com/embed/${K[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(u):{const K=u.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);K&&K.length>0&&(O=`https://player.vimeo.com/video/${K[1]}`);break}default:return}const R=640,D=360,_=e(),U=_+n.nodeSize;O&&(t==null||t.chain().focus(_).deleteRange({from:_===0?_:_+1,to:U}).setIframe({src:O,width:R,height:D}).run())},p=O=>{const R=O.match(/\/status\/([0-9]*)/);return R&&R.length>0?R[1]:null},m=()=>{if(!u)return;let O=u;const R=l.some(K=>u.includes(K)),D=p(u);R&&D?O=D:d&&(O=p(d.text));const _=e(),U=_+n.nodeSize;O&&(t==null||t.chain().focus(_).deleteRange({from:_===2?_:_+1,to:U}).setTweetEmbed({tweetId:O}).run())},y=()=>{const O=e()+n.nodeSize;t.commands.insertContentAt(O,{type:"dBlock",content:[{type:"paragraph"}]})},b=()=>{const O=e();t.commands.insertContentAt(O,{type:"dBlock",content:[{type:"paragraph"}]})},v=()=>{r()},A=O=>{O.altKey?x():w()},w=()=>{y()},x=()=>{b()},C=O=>{O.altKey&&v()},M=Tv(()=>{if(l.some(O=>u.includes(O))||d!=null&&d.text){m();return}else{h();return}},1e3);return P.useEffect(()=>{u&&M()},[u]),k.jsxs(od,{as:"div",className:he("flex gap-2 group w-full relative justify-center items-start",a&&"pointer-events-none",c&&"2xl:ml-4 pointer-events-auto"),children:[k.jsxs("section",{className:"lg:flex gap-1 hidden","aria-label":"left-menu",contentEditable:!1,children:[k.jsx(lN,{content:k.jsxs("div",{className:"flex flex-col w-40",children:[k.jsx("div",{className:"text-xs",children:"Click to add below"}),k.jsx("div",{className:"text-xs",children:"Opt + Click to add above"})]}),children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,onClick:A,children:k.jsx(f8,{size:18})})}),k.jsxs(a7,{open:s,onOpenChange:i,children:[k.jsx(l7,{asChild:!0,children:k.jsx("div",{className:`d-block-button cursor-pointer ${!a&&"group-hover:opacity-100"}`,contentEditable:!1,draggable:!0,"data-drag-handle":!0,onClick:C,children:k.jsx(i8,{size:18})})}),k.jsx(c7,{side:"bottom",align:"start",sideOffset:8,className:"z-10",children:k.jsxs(Jw,{className:"p-2 flex flex-col min-w-[16rem]",children:[k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.resetTextFormatting,children:[k.jsx(d8,{size:18}),"Clear formatting"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.copyNodeToClipboard,children:[k.jsx(t8,{size:18}),"Copy to clipboard"]})}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.duplicateNode,children:[k.jsx(r8,{size:18}),"Duplicate"]})}),k.jsx(Nc.Divider,{horizontal:!0}),k.jsx(Hg,{children:k.jsxs(zg,{onClick:o.deleteNode,className:"text-red-500 hover:bg-red-500 bg-opacity-10 hover:bg-opacity-20",children:[k.jsx(aw,{size:18}),"Delete"]})})]})})]})]}),k.jsx(aT,{className:he("node-view-content w-full break-all",{"is-table min-w-auto":c})})]})},d7=xt.create({name:"dBlock",priority:1e3,group:"dBlock",content:"(block|columns)",draggable:!0,selectable:!1,inline:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:'div[data-type="d-block"]'}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-type":"d-block"}),0]},addCommands(){return{setDBlock:n=>({state:e,chain:t})=>{const{selection:{from:r}}=e,s=n!==void 0||n!==null?r:n;return t().insertContentAt(s,{type:this.name,content:[{type:"paragraph"}]}).focus(s+2).run()}}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setDBlock(),Enter:({editor:n})=>{var c;const{selection:{$head:e,from:t,to:r},doc:s}=n.state,i=e.node(e.depth-1);if((i==null?void 0:i.type.name)!=="dBlock"){const f=e.toString().split("/"),d=f.some(p=>p.includes("taskList")),h=f.some(p=>p.includes("bulletList")||p.includes("orderedList"));return d?n.chain().insertContent({type:"taskItem",attrs:{checked:!1},content:[{type:"paragraph"}]}).focus().run():h?n.chain().insertContent({type:"listItem",content:[{type:"paragraph"}]}).focus().run():!1}let o=-1,a="";s.descendants((u,f)=>{if(o!==-1)return!1;if(u.type.name===this.name)return;const[d,h]=[f,f+u.nodeSize];return d<=t&&r<=h&&(o=h,a=u.type.name),!1});const l=(c=s.slice(t,o))==null?void 0:c.toJSON().content;try{return a==="codeBlock"?n.chain().newlineInCode().focus().run():["columns","heading"].includes(a)?n.chain().insertContent({type:"dBlock",content:[{type:"paragraph"}]}).focus().run():n.chain().insertContentAt({from:t,to:o},{type:this.name,content:l}).focus(t+4).run()}catch(u){return console.error(`Error inserting content into dBlock node: ${u}`),!1}}}},addNodeView(){return _a(f7)}});let Vv,Hv;if(typeof WeakMap<"u"){let n=new WeakMap;Vv=e=>n.get(e),Hv=(e,t)=>(n.set(e,t),t)}else{let n=[],e=10,t=0;Vv=r=>{for(let s=0;s<n.length;s+=2)if(n[s]==r)return n[s+1]},Hv=(r,s)=>(t==e&&(t=0),n[t++]=r,n[t++]=s)}class eu{constructor(e,t,r,s){this.left=e,this.top=t,this.right=r,this.bottom=s}}class Ut{constructor(e,t,r,s){this.width=e,this.height=t,this.map=r,this.problems=s}findCell(e){for(let t=0;t<this.map.length;t++){let r=this.map[t];if(r!=e)continue;let s=t%this.width,i=t/this.width|0,o=s+1,a=i+1;for(let l=1;o<this.width&&this.map[t+l]==r;l++)o++;for(let l=1;a<this.height&&this.map[t+this.width*l]==r;l++)a++;return new eu(s,i,o,a)}throw new RangeError("No cell with offset "+e+" found")}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError("No cell with offset "+e+" found")}nextCell(e,t,r){let{left:s,right:i,top:o,bottom:a}=this.findCell(e);return t=="horiz"?(r<0?s==0:i==this.width)?null:this.map[o*this.width+(r<0?s-1:i)]:(r<0?o==0:a==this.height)?null:this.map[s+this.width*(r<0?o-1:a)]}rectBetween(e,t){let{left:r,right:s,top:i,bottom:o}=this.findCell(e),{left:a,right:l,top:c,bottom:u}=this.findCell(t);return new eu(Math.min(r,a),Math.min(i,c),Math.max(s,l),Math.max(o,u))}cellsInRect(e){let t=[],r={};for(let s=e.top;s<e.bottom;s++)for(let i=e.left;i<e.right;i++){let o=s*this.width+i,a=this.map[o];r[a]||(r[a]=!0,(i!=e.left||!i||this.map[o-1]!=a)&&(s!=e.top||!s||this.map[o-this.width]!=a)&&t.push(a))}return t}positionAt(e,t,r){for(let s=0,i=0;;s++){let o=i+r.child(s).nodeSize;if(s==e){let a=t+e*this.width,l=(e+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?o-1:this.map[a]}i=o}}static get(e){return Vv(e)||Hv(e,h7(e))}}function h7(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);let e=p7(n),t=n.childCount,r=[],s=0,i=null,o=[];for(let c=0,u=e*t;c<u;c++)r[c]=0;for(let c=0,u=0;c<t;c++){let f=n.child(c);u++;for(let p=0;;p++){for(;s<r.length&&r[s]!=0;)s++;if(p==f.childCount)break;let m=f.child(p),{colspan:y,rowspan:b,colwidth:v}=m.attrs;for(let A=0;A<b;A++){if(A+c>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:b-A});break}let w=s+A*e;for(let x=0;x<y;x++){r[w+x]==0?r[w+x]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-x});let C=v&&v[x];if(C){let S=(w+x)%e*2,M=o[S];M==null||M!=C&&o[S+1]==1?(o[S]=C,o[S+1]=1):M==C&&o[S+1]++}}}s+=y,u+=m.nodeSize}let d=(c+1)*e,h=0;for(;s<d;)r[s++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}let a=new Ut(e,t,r,i),l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<t&&(l=!0);return l&&m7(a,o,n),a}function p7(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){let s=n.child(r),i=0;if(t)for(let o=0;o<r;o++){let a=n.child(o);for(let l=0;l<a.childCount;l++){let c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){let a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function m7(n,e,t){n.problems||(n.problems=[]);for(let r=0,s={};r<n.map.length;r++){let i=n.map[r];if(s[i])continue;s[i]=!0;let o=t.nodeAt(i),a=null;for(let l=0;l<o.attrs.colspan;l++){let c=(r+l)%n.width,u=e[c*2];u!=null&&(!o.attrs.colwidth||o.attrs.colwidth[l]!=u)&&((a||(a=g7(o.attrs)))[l]=u)}a&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function g7(n){if(n.colwidth)return n.colwidth.slice();let e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Tn(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(let t in n.nodes){let r=n.nodes[t],s=r.spec.tableRole;s&&(e[s]=r)}}return e}const Bo=new Rt("selectingCells");function tu(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function y7(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function gs(n){let e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $g(n){let e=n.selection;return e.$anchorCell?e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell:e.node&&e.node.type.spec.tableRole=="cell"?e.$anchor:tu(e.$head)||b7(e.$head)}function b7(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function zv(n){return n.parent.type.spec.tableRole=="row"&&n.nodeAfter}function w7(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function $v(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function UR(n,e,t){let r=n.start(-1),i=Ut.get(n.node(-1)).nextCell(n.pos-r,e,t);return i==null?null:n.node(0).resolve(r+i)}function fn(n,e,t){let r={};for(let s in n)r[s]=n[s];return r[e]=t,r}function sl(n,e,t=1){let r=fn(n,"colspan",n.colspan-t);return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function VR(n,e,t=1){let r=fn(n,"colspan",n.colspan+t);if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<t;s++)r.colwidth.splice(e,0,0)}return r}function A7(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.height;s++)if(e.nodeAt(n.map[t+s*n.width]).type!=r)return!1;return!0}class ot extends Ie{constructor(e,t=e){let r=e.node(-1),s=Ut.get(r),i=e.start(-1),o=s.rectBetween(e.pos-i,t.pos-i),a=e.node(0),l=s.cellsInRect(o).filter(u=>u!=t.pos-i);l.unshift(t.pos-i);let c=l.map(u=>{let f=r.nodeAt(u),d=u+i+1;return new H0(a.resolve(d),a.resolve(d+f.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=t}map(e,t){let r=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(zv(r)&&zv(s)&&$v(r,s)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?ot.rowSelection(r,s):i&&this.isColSelection()?ot.colSelection(r,s):new ot(r,s)}return Re.between(r,s)}content(){let e=this.$anchorCell.node(-1),t=Ut.get(e),r=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){let c=[];for(let u=l*t.width+s.left,f=s.left;f<s.right;f++,u++){let d=t.map[u];if(!i[d]){i[d]=!0;let h=t.findCell(d),p=e.nodeAt(d),m=s.left-h.left,y=h.right-s.right;if(m>0||y>0){let b=p.attrs;m>0&&(b=sl(b,0,m)),y>0&&(b=sl(b,b.colspan-y,y)),h.left<s.left?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}if(h.top<s.top||h.bottom>s.bottom){let b=fn(p.attrs,"rowspan",Math.min(h.bottom,s.bottom)-Math.max(h.top,s.top));h.top<s.top?p=p.type.createAndFill(b):p=p.type.create(b,p.content)}c.push(p)}}o.push(e.child(l).copy(oe.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ue(oe.from(a),1,1)}replace(e,t=ue.empty){let r=e.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){let{$from:a,$to:l}=s[o],c=e.mapping.slice(r);e.replace(c.map(a.pos),c.map(l.pos),o?ue.empty:t)}let i=Ie.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new ue(oe.from(t),0,0))}forEachCell(e){let t=this.$anchorCell.node(-1),r=Ut.get(t),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)e(t.nodeAt(i[o]),s+i[o])}isColSelection(){let e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.top<=o.top?(i.top>0&&(e=a.resolve(s+r.map[i.left])),o.bottom<r.height&&(t=a.resolve(s+r.map[r.width*(r.height-1)+o.right-1]))):(o.top>0&&(t=a.resolve(s+r.map[o.left])),i.bottom<r.height&&(e=a.resolve(s+r.map[r.width*(r.height-1)+i.right-1]))),new ot(e,t)}isRowSelection(){let e=Ut.get(this.$anchorCell.node(-1)),t=this.$anchorCell.start(-1),r=e.colCount(this.$anchorCell.pos-t),s=e.colCount(this.$headCell.pos-t);if(Math.min(r,s)>0)return!1;let i=r+this.$anchorCell.nodeAfter.attrs.colspan,o=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,o)==e.width}eq(e){return e instanceof ot&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){let r=Ut.get(e.node(-1)),s=e.start(-1),i=r.findCell(e.pos-s),o=r.findCell(t.pos-s),a=e.node(0);return i.left<=o.left?(i.left>0&&(e=a.resolve(s+r.map[i.top*r.width])),o.right<r.width&&(t=a.resolve(s+r.map[r.width*(o.top+1)-1]))):(o.left>0&&(t=a.resolve(s+r.map[o.top*r.width])),i.right<r.width&&(e=a.resolve(s+r.map[r.width*(i.top+1)-1]))),new ot(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new ot(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new ot(e.resolve(t),e.resolve(r))}getBookmark(){return new Gv(this.$anchorCell.pos,this.$headCell.pos)}}ot.prototype.visible=!1,Ie.jsonID("cell",ot);class Gv{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gv(e.map(this.anchor),e.map(this.head))}resolve(e){let t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&$v(t,r)?new ot(t,r):Ie.near(r,1)}}function v7(n){if(!(n.selection instanceof ot))return null;let e=[];return n.selection.forEachCell((t,r)=>{e.push(en.node(r,r+t.nodeSize,{class:"selectedCell"}))}),vt.create(n.doc,e)}function x7({$from:n,$to:e}){if(n.pos==e.pos||n.pos<n.pos-6)return!1;let t=n.pos,r=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return t==r&&/row|table/.test(n.node(s).type.spec.tableRole)}function E7({$from:n,$to:e}){let t,r;for(let s=n.depth;s>0;s--){let i=n.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let s=e.depth;s>0;s--){let i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return t!==r&&e.parentOffset===0}function C7(n,e,t){let r=(e||n).selection,s=(e||n).doc,i,o;if(r instanceof Oe&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=ot.create(s,r.from);else if(o=="row"){let a=s.resolve(r.from+1);i=ot.rowSelection(a,a)}else if(!t){let a=Ut.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=ot.create(s,l+1,c)}}else r instanceof Re&&x7(r)?i=Re.create(s,r.from):r instanceof Re&&E7(r)&&(i=Re.create(s,r.$from.start(),r.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}function k7(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.firstChild.type.spec.tableRole=="table");)t--,r--,e=e.firstChild.content;let s=e.firstChild,i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<e.childCount;l++){let c=e.child(l).content,u=l?0:Math.max(0,t-1),f=l<e.childCount-1?0:Math.max(0,r-1);(u||f)&&(c=Wv(Tn(o).row,new ue(c,u,f)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(t||r?Wv(Tn(o).row,new ue(e,t,r)).content:e);else return null;return S7(o,a)}function S7(n,e){let t=[];for(let s=0;s<e.length;s++){let i=e[s];for(let o=i.childCount-1;o>=0;o--){let{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)t[c]=(t[c]||0)+l}}let r=0;for(let s=0;s<t.length;s++)r=Math.max(r,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(oe.empty),t[s]<r){let i=Tn(n).cell.createAndFill(),o=[];for(let a=t[s];a<r;a++)o.push(i);e[s]=e[s].append(oe.from(o))}return{height:e.length,width:r,rows:e}}function Wv(n,e){let t=n.createAndFill();return new U0(t).replace(0,t.content.size,e).doc}function T7({width:n,height:e,rows:t},r,s){if(n!=r){let i=[],o=[];for(let a=0;a<t.length;a++){let l=t[a],c=[];for(let u=i[a]||0,f=0;u<r;f++){let d=l.child(f%l.childCount);u+d.attrs.colspan>r&&(d=d.type.create(sl(d.attrs,d.attrs.colspan,u+d.attrs.colspan-r),d.content)),c.push(d),u+=d.attrs.colspan;for(let h=1;h<d.attrs.rowspan;h++)i[a+h]=(i[a+h]||0)+d.attrs.colspan}o.push(oe.from(c))}t=o,n=r}if(e!=s){let i=[];for(let o=0,a=0;o<s;o++,a++){let l=[],c=t[a%e];for(let u=0;u<c.childCount;u++){let f=c.child(u);o+f.attrs.rowspan>s&&(f=f.type.create(fn(f.attrs,"rowspan",Math.max(1,s-f.attrs.rowspan)),f.content)),l.push(f)}i.push(oe.from(l))}t=i,e=s}return{width:n,height:e,rows:t}}function O7(n,e,t,r,s,i,o){let a=n.doc.type.schema,l=Tn(a),c,u;if(s>e.width)for(let f=0,d=0;f<e.height;f++){let h=t.child(f);d+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==l.cell?m=c||(c=l.cell.createAndFill()):m=u||(u=l.header_cell.createAndFill());for(let y=e.width;y<s;y++)p.push(m);n.insert(n.mapping.slice(o).map(d-1+r),p)}if(i>e.height){let f=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,s);p++){let y=p>=e.width?!1:t.nodeAt(e.map[m+p]).type==l.header_cell;f.push(y?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}let d=l.row.create(null,oe.from(f)),h=[];for(let p=e.height;p<i;p++)h.push(d);n.insert(n.mapping.slice(o).map(r+t.nodeSize-2),h)}return!!(c||u)}function HR(n,e,t,r,s,i,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let c=s;c<i;c++){let u=o*e.width+c,f=e.map[u];if(e.map[u-e.width]==f){l=!0;let d=t.nodeAt(f),{top:h,left:p}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(a).map(f+r),null,fn(d.attrs,"rowspan",o-h)),n.insert(n.mapping.slice(a).map(e.positionAt(o,p,t)),d.type.createAndFill(fn(d.attrs,"rowspan",h+d.attrs.rowspan-o))),c+=d.attrs.colspan-1}}return l}function zR(n,e,t,r,s,i,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let c=s;c<i;c++){let u=c*e.width+o,f=e.map[u];if(e.map[u-1]==f){l=!0;let d=t.nodeAt(f),h=e.colCount(f),p=n.mapping.slice(a).map(f+r);n.setNodeMarkup(p,null,sl(d.attrs,o-h,d.attrs.colspan-(o-h))),n.insert(p+d.nodeSize,d.type.createAndFill(sl(d.attrs,0,o-h))),c+=d.attrs.rowspan-1}}return l}function $R(n,e,t,r,s){let i=t?n.doc.nodeAt(t-1):n.doc,o=Ut.get(i),{top:a,left:l}=r,c=l+s.width,u=a+s.height,f=n.tr,d=0;function h(){i=t?f.doc.nodeAt(t-1):f.doc,o=Ut.get(i),d=f.mapping.maps.length}O7(f,o,i,t,c,u,d)&&h(),HR(f,o,i,t,l,c,a,d)&&h(),HR(f,o,i,t,l,c,u,d)&&h(),zR(f,o,i,t,a,u,l,d)&&h(),zR(f,o,i,t,a,u,c,d)&&h();for(let p=a;p<u;p++){let m=o.positionAt(p,l,i),y=o.positionAt(p,c,i);f.replace(f.mapping.slice(d).map(m+t),f.mapping.slice(d).map(y+t),new ue(s.rows[p-a],0,0))}h(),f.setSelection(new ot(f.doc.resolve(t+o.positionAt(a,l,i)),f.doc.resolve(t+o.positionAt(u-1,c-1,i)))),e(f)}const N7=yb({ArrowLeft:Wg("horiz",-1),ArrowRight:Wg("horiz",1),ArrowUp:Wg("vert",-1),ArrowDown:Wg("vert",1),"Shift-ArrowLeft":Kg("horiz",-1),"Shift-ArrowRight":Kg("horiz",1),"Shift-ArrowUp":Kg("vert",-1),"Shift-ArrowDown":Kg("vert",1),Backspace:Qg,"Mod-Backspace":Qg,Delete:Qg,"Mod-Delete":Qg});function Gg(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function Wg(n,e){return(t,r,s)=>{let i=t.selection;if(i instanceof ot)return Gg(t,r,Ie.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;let o=GR(s,n,e);if(o==null)return!1;if(n=="horiz")return Gg(t,r,Ie.near(t.doc.resolve(i.head+e),e));{let a=t.doc.resolve(o),l=UR(a,n,e),c;return l?c=Ie.near(l,1):e<0?c=Ie.near(t.doc.resolve(a.before(-1)),-1):c=Ie.near(t.doc.resolve(a.after(-1)),1),Gg(t,r,c)}}}function Kg(n,e){return(t,r,s)=>{let i=t.selection;if(!(i instanceof ot)){let a=GR(s,n,e);if(a==null)return!1;i=new ot(t.doc.resolve(a))}let o=UR(i.$headCell,n,e);return o?Gg(t,r,new ot(i.$anchorCell,o)):!1}}function Qg(n,e){let t=n.selection;if(!(t instanceof ot))return!1;if(e){let r=n.tr,s=Tn(n.schema).cell.createAndFill().content;t.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new ue(s,0,0))}),r.docChanged&&e(r)}return!0}function M7(n,e){let t=n.state.doc,r=tu(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ot(r))),!0):!1}function R7(n,e,t){if(!gs(n.state))return!1;let r=k7(t),s=n.state.selection;if(s instanceof ot){r||(r={width:1,height:1,rows:[oe.from(Wv(Tn(n.state.schema).cell,t))]});let i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ut.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=T7(r,a.right-a.left,a.bottom-a.top),$R(n.state,n.dispatch,o,a,r),!0}else if(r){let i=$g(n.state),o=i.start(-1);return $R(n.state,n.dispatch,o,Ut.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function P7(n,e){if(e.ctrlKey||e.metaKey)return;let t=WR(n,e.target),r;if(e.shiftKey&&n.state.selection instanceof ot)s(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&t&&(r=tu(n.state.selection.$anchor))!=null&&Kv(n,e).pos!=r.pos)s(r,e),e.preventDefault();else if(!t)return;function s(a,l){let c=Kv(n,l),u=Bo.getState(n.state)==null;if(!c||!$v(a,c))if(u)c=a;else return;let f=new ot(a,c);if(u||!n.state.selection.eq(f)){let d=n.state.tr.setSelection(f);u&&d.setMeta(Bo,a.pos),n.dispatch(d)}}function i(){n.root.removeEventListener("mouseup",i),n.root.removeEventListener("dragstart",i),n.root.removeEventListener("mousemove",o),Bo.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(Bo,-1))}function o(a){let l=Bo.getState(n.state),c;if(l!=null)c=n.state.doc.resolve(l);else if(WR(n,a.target)!=t&&(c=Kv(n,e),!c))return i();c&&s(c,a)}n.root.addEventListener("mouseup",i),n.root.addEventListener("dragstart",i),n.root.addEventListener("mousemove",o)}function GR(n,e,t){if(!(n.state.selection instanceof Re))return null;let{$head:r}=n.state.selection;for(let s=r.depth-1;s>=0;s--){let i=r.node(s);if((t<0?r.index(s):r.indexAfter(s))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let a=r.before(s),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?a:null}}return null}function WR(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e}function Kv(n,e){let t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?tu(n.state.doc.resolve(t.pos)):null}const D7=new Rt("fix-tables");function KR(n,e,t,r){let s=n.childCount,i=e.childCount;e:for(let o=0,a=0;o<i;o++){let l=e.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(n.child(c)==l){a=c+1,t+=l.nodeSize;continue e}r(l,t),a<s&&n.child(a).sameMarkup(l)?KR(n.child(a),l,t+1,r):l.nodesBetween(0,l.content.size,r,t+1),t+=l.nodeSize}}function QR(n,e){let t,r=(s,i)=>{s.type.spec.tableRole=="table"&&(t=I7(n,s,i,t))};return e?e.doc!=n.doc&&KR(e.doc,n.doc,0,r):n.doc.descendants(r),t}function I7(n,e,t,r){let s=Ut.get(e);if(!s.problems)return r;r||(r=n.tr);let i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){let c=s.problems[l];if(c.type=="collision"){let u=e.nodeAt(c.pos);for(let f=0;f<u.attrs.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,sl(u.attrs,u.attrs.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"rowspan",u.attrs.rowspan-c.n))}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);r.setNodeMarkup(r.mapping.map(t+1+c.pos),null,fn(u.attrs,"colwidth",c.colwidth))}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=t+1;l<s.height;l++){let u=e.child(l),f=c+u.nodeSize,d=i[l];if(d>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<d;y++)p.push(Tn(n.schema)[h].createAndFill());let m=(l==0||o==l-1)&&a==l?c+1:f-1;r.insert(r.mapping.map(m),p)}c=f}return r.setMeta(D7,{fixTables:!0})}function Ys(n){let e=n.selection,t=$g(n),r=t.node(-1),s=t.start(-1),i=Ut.get(r),o;return e instanceof ot?o=i.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):o=i.findCell(t.pos-s),o.tableStart=s,o.map=i,o.table=r,o}function JR(n,{map:e,tableStart:t,table:r},s){let i=s>0?-1:0;A7(e,r,s+i)&&(i=s==0||s==e.width?null:0);for(let o=0;o<e.height;o++){let a=o*e.width+s;if(s>0&&s<e.width&&e.map[a-1]==e.map[a]){let l=e.map[a],c=r.nodeAt(l);n.setNodeMarkup(n.mapping.map(t+l),null,VR(c.attrs,s-e.colCount(l))),o+=c.attrs.rowspan-1}else{let l=i==null?Tn(r.type.schema).cell:r.nodeAt(e.map[a+i]).type,c=e.positionAt(o,s,r);n.insert(n.mapping.map(t+c),l.createAndFill())}}return n}function L7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.left))}return!0}function B7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(JR(n.tr,t,t.right))}return!0}function _7(n,{map:e,table:t,tableStart:r},s){let i=n.mapping.maps.length;for(let o=0;o<e.height;){let a=o*e.width+s,l=e.map[a],c=t.nodeAt(l);if(s>0&&e.map[a-1]==l||s<e.width-1&&e.map[a+1]==l)n.setNodeMarkup(n.mapping.slice(i).map(r+l),null,sl(c.attrs,s-e.colCount(l)));else{let u=n.mapping.slice(i).map(r+l);n.delete(u,u+c.nodeSize)}o+=c.attrs.rowspan}}function F7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let s=t.right-1;_7(r,t,s),s!=t.left;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function j7(n,e,t){let r=Tn(e.type.schema).header_cell;for(let s=0;s<n.width;s++)if(e.nodeAt(n.map[s+t*n.width]).type!=r)return!1;return!0}function qR(n,{map:e,tableStart:t,table:r},s){let i=t;for(let l=0;l<s;l++)i+=r.child(l).nodeSize;let o=[],a=s>0?-1:0;j7(e,r,s+a)&&(a=s==0||s==e.height?null:0);for(let l=0,c=e.width*s;l<e.width;l++,c++)if(s>0&&s<e.height&&e.map[c]==e.map[c-e.width]){let u=e.map[c],f=r.nodeAt(u).attrs;n.setNodeMarkup(t+u,null,fn(f,"rowspan",f.rowspan+1)),l+=f.colspan-1}else{let u=a==null?Tn(r.type.schema).cell:r.nodeAt(e.map[c+a*e.width]).type;o.push(u.createAndFill())}return n.insert(i,Tn(r.type.schema).row.create(null,o)),n}function U7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.top))}return!0}function V7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n);e(qR(n.tr,t,t.bottom))}return!0}function H7(n,{map:e,table:t,tableStart:r},s){let i=0;for(let l=0;l<s;l++)i+=t.child(l).nodeSize;let o=i+t.child(s).nodeSize,a=n.mapping.maps.length;n.delete(i+r,o+r);for(let l=0,c=s*e.width;l<e.width;l++,c++){let u=e.map[c];if(s>0&&u==e.map[c-e.width]){let f=t.nodeAt(u).attrs;n.setNodeMarkup(n.mapping.slice(a).map(u+r),null,fn(f,"rowspan",f.rowspan-1)),l+=f.colspan-1}else if(s<e.width&&u==e.map[c+e.width]){let f=t.nodeAt(u),d=f.type.create(fn(f.attrs,"rowspan",f.attrs.rowspan-1),f.content),h=e.positionAt(s+1,l,t);n.insert(n.mapping.slice(a).map(r+h),d),l+=f.attrs.colspan-1}}}function z7(n,e){if(!gs(n))return!1;if(e){let t=Ys(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let s=t.bottom-1;H7(r,t,s),s!=t.top;s--)t.table=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc,t.map=Ut.get(t.table);e(r)}return!0}function YR(n){let e=n.content;return e.childCount==1&&e.firstChild.isTextblock&&e.firstChild.childCount==0}function $7({width:n,height:e,map:t},r){let s=r.top*n+r.left,i=s,o=(r.bottom-1)*n+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&t[i]==t[i-1]||r.right<n&&t[a]==t[a+1])return!0;i+=n,a+=n}for(let l=r.left;l<r.right;l++){if(r.top>0&&t[s]==t[s-n]||r.bottom<e&&t[o]==t[o+n])return!0;s++,o++}return!1}function XR(n,e){let t=n.selection;if(!(t instanceof ot)||t.$anchorCell.pos==t.$headCell.pos)return!1;let r=Ys(n),{map:s}=r;if($7(s,r))return!1;if(e){let i=n.tr,o={},a=oe.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let f=r.left;f<r.right;f++){let d=s.map[u*s.width+f],h=r.table.nodeAt(d);if(!o[d])if(o[d]=!0,l==null)l=d,c=h;else{YR(h)||(a=a.append(h.content));let p=i.mapping.map(d+r.tableStart);i.delete(p,p+h.nodeSize)}}if(i.setNodeMarkup(l+r.tableStart,null,fn(VR(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),"rowspan",r.bottom-r.top)),a.size){let u=l+1+c.content.size,f=YR(c)?l+1:u;i.replaceWith(f+r.tableStart,u+r.tableStart,a)}i.setSelection(new ot(i.doc.resolve(l+r.tableStart))),e(i)}return!0}function ZR(n,e){const t=Tn(n.schema);return G7(({node:r})=>t[r.type.spec.tableRole])(n,e)}function G7(n){return(e,t)=>{let r=e.selection,s,i;if(r instanceof ot){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;s=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{if(s=y7(r.$from),!s)return!1;i=tu(r.$from).pos}if(s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(t){let o=s.attrs,a=[],l=o.colwidth;o.rowspan>1&&(o=fn(o,"rowspan",1)),o.colspan>1&&(o=fn(o,"colspan",1));let c=Ys(e),u=e.tr;for(let d=0;d<c.right-c.left;d++)a.push(l?fn(o,"colwidth",l&&l[d]?[l[d]]:null):o);let f;for(let d=c.top;d<c.bottom;d++){let h=c.map.positionAt(d,c.left,c.table);d==c.top&&(h+=s.nodeSize);for(let p=c.left,m=0;p<c.right;p++,m++)p==c.left&&d==c.top||u.insert(f=u.mapping.map(h+c.tableStart,1),n({node:s,row:d,col:p}).createAndFill(a[m]))}u.setNodeMarkup(i,n({node:s,row:c.top,col:c.left}),a[0]),r instanceof ot&&u.setSelection(new ot(u.doc.resolve(r.$anchorCell.pos),f&&u.doc.resolve(f))),t(u)}return!0}}function W7(n,e){return function(t,r){if(!gs(t))return!1;let s=$g(t);if(s.nodeAfter.attrs[n]===e)return!1;if(r){let i=t.tr;t.selection instanceof ot?t.selection.forEachCell((o,a)=>{o.attrs[n]!==e&&i.setNodeMarkup(a,null,fn(o.attrs,n,e))}):i.setNodeMarkup(s.pos,null,fn(s.nodeAfter.attrs,n,e)),r(i)}return!0}}function K7(n){return function(e,t){if(!gs(e))return!1;if(t){let r=Tn(e.schema),s=Ys(e),i=e.tr,o=s.map.cellsInRect(n=="column"?new eu(s.left,0,s.right,s.map.height):n=="row"?new eu(0,s.top,s.map.width,s.bottom):s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);t(i)}return!0}}function eP(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const i=e.table.nodeAt(r[s]);if(i&&i.type!==t.header_cell)return!1}return!0}function Yd(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?K7(n):function(t,r){if(!gs(t))return!1;if(r){let s=Tn(t.schema),i=Ys(t),o=t.tr,a=eP("row",i,s),l=eP("column",i,s),u=(n==="column"?a:n==="row"?l:!1)?1:0,f=n=="column"?new eu(0,u,1,i.map.height):n=="row"?new eu(u,0,i.map.width,1):i,d=n=="column"?l?s.cell:s.header_cell:n=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(f).forEach(h=>{const p=h+i.tableStart,m=o.doc.nodeAt(p);m&&o.setNodeMarkup(p,d,m.attrs)}),r(o)}return!0}}Yd("row",{useDeprecatedLogic:!0}),Yd("column",{useDeprecatedLogic:!0});let Q7=Yd("cell",{useDeprecatedLogic:!0});function J7(n,e){if(e<0){let t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,s=n.before();r>=0;r--){let i=n.node(-1).child(r);if(i.childCount)return s-1-i.lastChild.nodeSize;s-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;let t=n.node(-1);for(let r=n.indexAfter(-1),s=n.after();r<t.childCount;r++){let i=t.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}}function tP(n){return function(e,t){if(!gs(e))return!1;let r=J7($g(e),n);if(r!=null){if(t){let s=e.doc.resolve(r);t(e.tr.setSelection(Re.between(s,w7(s))).scrollIntoView())}return!0}}}function q7(n,e){let t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}let Y7=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Qv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Qv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Qv(n,e,t,r,s,i){let o=0,a=!0,l=e.firstChild,c=n.firstChild;for(let u=0,f=0;u<c.childCount;u++){let{colspan:d,colwidth:h}=c.child(u).attrs;for(let p=0;p<d;p++,f++){let m=s==f?i:h&&h[p],y=m?m+"px":"";o+=m||r,m||(a=!1),l?(l.style.width!=y&&(l.style.width=y),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=y}}for(;l;){let u=l.nextSibling;l.parentNode.removeChild(l),l=u}a?(t.style.width=o+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=o+"px")}const Gr=new Rt("tableColumnResizing");function X7({handleWidth:n=5,cellMinWidth:e=25,View:t=Y7,lastColumnResizable:r=!0}={}){return new At({key:Gr,state:{init(i,o){return this.spec.props.nodeViews[Tn(o.schema).table.name]=(a,l)=>new t(a,e,l),new Xd(-1,!1)},apply(i,o){return o.apply(i)}},props:{attributes(i){return Gr.getState(i).activeHandle>-1?{class:"resize-cursor"}:null},handleDOMEvents:{mousemove(i,o){Z7(i,o,n,e,r)},mouseleave(i){eJ(i)},mousedown(i,o){tJ(i,o,e)}},decorations(i){let o=Gr.getState(i);if(o.activeHandle>-1)return aJ(i,o.activeHandle)},nodeViews:{}}})}class Xd{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){let t=this,r=e.getMeta(Gr);if(r&&r.setHandle!=null)return new Xd(r.setHandle,null);if(r&&r.setDragging!==void 0)return new Xd(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);zv(e.doc.resolve(s))||(s=null),t=new Xd(s,t.dragging)}return t}}function Z7(n,e,t,r,s){let i=Gr.getState(n.state);if(!i.dragging){let o=rJ(e.target),a=-1;if(o){let{left:l,right:c}=o.getBoundingClientRect();e.clientX-l<=t?a=nP(n,e,"left"):c-e.clientX<=t&&(a=nP(n,e,"right"))}if(a!=i.activeHandle){if(!s&&a!==-1){let l=n.state.doc.resolve(a),c=l.node(-1),u=Ut.get(c),f=l.start(-1);if(u.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==u.width-1)return}sP(n,a)}}}function eJ(n){let e=Gr.getState(n.state);e.activeHandle>-1&&!e.dragging&&sP(n,-1)}function tJ(n,e,t){let r=Gr.getState(n.state);if(r.activeHandle==-1||r.dragging)return!1;let s=n.state.doc.nodeAt(r.activeHandle),i=nJ(n,r.activeHandle,s.attrs);n.dispatch(n.state.tr.setMeta(Gr,{setDragging:{startX:e.clientX,startWidth:i}}));function o(l){window.removeEventListener("mouseup",o),window.removeEventListener("mousemove",a);let c=Gr.getState(n.state);c.dragging&&(sJ(n,c.activeHandle,rP(c.dragging,l,t)),n.dispatch(n.state.tr.setMeta(Gr,{setDragging:null})))}function a(l){if(!l.which)return o(l);let c=Gr.getState(n.state),u=rP(c.dragging,l,t);iJ(n,c.activeHandle,u,t)}return window.addEventListener("mouseup",o),window.addEventListener("mousemove",a),e.preventDefault(),!0}function nJ(n,e,{colspan:t,colwidth:r}){let s=r&&r[r.length-1];if(s)return s;let i=n.domAtPos(e),a=i.node.childNodes[i.offset].offsetWidth,l=t;if(r)for(let c=0;c<t;c++)r[c]&&(a-=r[c],l--);return a/l}function rJ(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList.contains("ProseMirror")?null:n.parentNode;return n}function nP(n,e,t){let r=n.posAtCoords({left:e.clientX,top:e.clientY});if(!r)return-1;let{pos:s}=r,i=tu(n.state.doc.resolve(s));if(!i)return-1;if(t=="right")return i.pos;let o=Ut.get(i.node(-1)),a=i.start(-1),l=o.map.indexOf(i.pos-a);return l%o.width==0?-1:a+o.map[l-1]}function rP(n,e,t){let r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function sP(n,e){n.dispatch(n.state.tr.setMeta(Gr,{setHandle:e}))}function sJ(n,e,t){let r=n.state.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=n.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;let f=i.map[u],{attrs:d}=s.nodeAt(f),h=d.colspan==1?0:a-i.colCount(f);if(d.colwidth&&d.colwidth[h]==t)continue;let p=d.colwidth?d.colwidth.slice():oJ(d.colspan);p[h]=t,l.setNodeMarkup(o+f,null,fn(d,"colwidth",p))}l.docChanged&&n.dispatch(l)}function iJ(n,e,t,r){let s=n.state.doc.resolve(e),i=s.node(-1),o=s.start(-1),a=Ut.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1,l=n.domAtPos(s.start(-1)).node;for(;l.nodeName!="TABLE";)l=l.parentNode;Qv(i,l.firstChild,l,r,a,t)}function oJ(n){let e=[];for(let t=0;t<n;t++)e.push(0);return e}function aJ(n,e){let t=[],r=n.doc.resolve(e),s=r.node(-1),i=Ut.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan;for(let l=0;l<i.height;l++){let c=a+l*i.width-1;if((a==i.width||i.map[c]!=i.map[c+1])&&(l==0||i.map[c-1]!=i.map[c-1-i.width])){let u=i.map[c],f=o+u+s.nodeAt(u).nodeSize-1,d=document.createElement("div");d.className="column-resize-handle",t.push(en.widget(f,d))}}return vt.create(n.doc,t)}function lJ({allowTableNodeSelection:n=!1}={}){return new At({key:Bo,state:{init(){return null},apply(e,t){let r=e.getMeta(Bo);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;let{deleted:s,pos:i}=e.mapping.mapResult(t);return s?null:i}},props:{decorations:v7,handleDOMEvents:{mousedown:P7},createSelectionBetween(e){if(Bo.getState(e.state)!=null)return e.state.selection},handleTripleClick:M7,handleKeyDown:N7,handlePaste:R7},appendTransaction(e,t,r){return C7(r,QR(r,t),n)}})}function iP(n,e,t,r,s,i){var u;let o=0,a=!0,l=e.firstChild;const c=n.firstChild;if(c)for(let f=0,d=0;f<c.childCount;f+=1){const{colspan:h,colwidth:p}=c.child(f).attrs;for(let m=0;m<h;m+=1,d+=1){const y=s===d?i:p&&p[m],b=y?`${y}px`:"";o+=y||r,y||(a=!1),l?(l.style.width!==b&&(l.style.width=b),l=l.nextSibling):e.appendChild(document.createElement("col")).style.width=b}}for(;l;){const f=l.nextSibling;(u=l==null?void 0:l.parentNode)==null||u.removeChild(l),l=f}a?(t.style.width=`${o}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${o}px`)}class cJ{constructor(e,t){G(this,"node");G(this,"cellMinWidth");G(this,"dom");G(this,"table");G(this,"colgroup");G(this,"contentDOM");this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),iP(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,iP(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function oP(n,e){return n.createAndFill()}function uJ(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function fJ(n,e,t,r,s){const i=uJ(n),o=[],a=[];for(let c=0;c<t;c+=1){const u=oP(i.cell);if(u&&a.push(u),r){const f=oP(i.header_cell);f&&o.push(f)}}const l=[];for(let c=0;c<e;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function dJ(n){return n instanceof ot}const Jg=({editor:n})=>{const{selection:e}=n.state;if(!dJ(e))return!1;let t=0;const r=Tb(e.ranges[0].$from,i=>i.type.name==="table");return r==null||r.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},hJ=xt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:cJ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){let t=0,r=!0;try{n.content.firstChild.content.forEach(i=>{if(i.attrs.colwidth)i.attrs.colwidth.forEach(o=>{o?t+=o:(r=!1,t+=this.options.cellMinWidth)});else{r=!1;const o=i.attrs.colspan?i.attrs.colspan:1;t+=this.options.cellMinWidth*o}})}catch{r=!1}return r&&t>0?e.style=`width: ${t}px;`:t&&t>0?e.style=`min-width: ${t}px`:e.style=null,["div",{class:"table-wrapper"},["table",nt(this.options.HTMLAttributes,e),["tbody",0]]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const{selection:o}=r,a=fJ(i.schema,n,e,t);if(s){const l=r.selection.anchor+1;r.replaceRangeWith(o.from-1,o.to,a).scrollIntoView().setSelection(Re.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>L7(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>B7(n,e),deleteColumn:()=>({state:n,dispatch:e})=>F7(n,e),addRowBefore:()=>({state:n,dispatch:e})=>U7(n,e),addRowAfter:()=>({state:n,dispatch:e})=>V7(n,e),deleteRow:()=>({state:n,dispatch:e})=>z7(n,e),deleteTable:()=>({state:n,dispatch:e})=>q7(n,e),mergeCells:()=>({state:n,dispatch:e})=>XR(n,e),splitCell:()=>({state:n,dispatch:e})=>ZR(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Yd("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Yd("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>Q7(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>XR(n,e)?!0:ZR(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>W7(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>tP(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>tP(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&QR(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ot.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Jg,"Mod-Backspace":Jg,Delete:Jg,"Mod-Delete":Jg}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[X7({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],lJ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Ye(ve(n,"tableRole",e))}}});function aP(n,e){if(n==null)return{};var t={},r=Object.keys(n),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(t[s]=n[s]);return t}var lP=typeof window<"u"&&typeof document<"u";function Jv(n,e){n&&(typeof n=="function"&&n(e),{}.hasOwnProperty.call(n,"current")&&(n.current=e))}function cP(){return lP&&document.createElement("div")}function pJ(n){var e={"data-placement":n.placement};return n.referenceHidden&&(e["data-reference-hidden"]=""),n.escaped&&(e["data-escaped"]=""),e}function uP(n,e){if(n===e)return!0;if(typeof n=="object"&&n!=null&&typeof e=="object"&&e!=null){if(Object.keys(n).length!==Object.keys(e).length)return!1;for(var t in n)if(e.hasOwnProperty(t)){if(!uP(n[t],e[t]))return!1}else return!1;return!0}else return!1}function mJ(n){var e=[];return n.forEach(function(t){e.find(function(r){return uP(t,r)})||e.push(t)}),e}function gJ(n,e){var t,r;return Object.assign({},e,{popperOptions:Object.assign({},n.popperOptions,e.popperOptions,{modifiers:mJ([].concat(((t=n.popperOptions)==null?void 0:t.modifiers)||[],((r=e.popperOptions)==null?void 0:r.modifiers)||[]))})})}var qv=lP?P.useLayoutEffect:P.useEffect;function yJ(n){var e=P.useRef();return e.current||(e.current=typeof n=="function"?n():n),e.current}function fP(n,e,t){t.split(/\s+/).forEach(function(r){r&&n.classList[e](r)})}var bJ={name:"className",defaultValue:"",fn:function(e){var t=e.popper.firstElementChild,r=function(){var a;return!!((a=e.props.render)!=null&&a.$$tippy)};function s(){if(e.props.className&&!r()){process.env.NODE_ENV!=="production"&&console.warn(["@tippyjs/react: Cannot use `className` prop in conjunction with","`render` prop. Place the className on the element you are","rendering."].join(" "));return}fP(t,"add",e.props.className)}function i(){r()&&fP(t,"remove",e.props.className)}return{onCreate:s,onBeforeUpdate:i,onAfterUpdate:s}}};function wJ(n){function e(t){var r=t.children,s=t.content,i=t.visible,o=t.singleton,a=t.render,l=t.reference,c=t.disabled,u=c===void 0?!1:c,f=t.ignoreAttributes,d=f===void 0?!0:f;t.__source,t.__self;var h=aP(t,["children","content","visible","singleton","render","reference","disabled","ignoreAttributes","__source","__self"]),p=i!==void 0,m=o!==void 0,y=P.useState(!1),b=y[0],v=y[1],A=P.useState({}),w=A[0],x=A[1],C=P.useState(),S=C[0],M=C[1],O=yJ(function(){return{container:cP(),renders:1}}),R=Object.assign({ignoreAttributes:d},h,{content:O.container});p&&(process.env.NODE_ENV!=="production"&&["trigger","hideOnClick","showOnCreate"].forEach(function(K){R[K]!==void 0&&console.warn(["@tippyjs/react: Cannot specify `"+K+"` prop in","controlled mode (`visible` prop)"].join(" "))}),R.trigger="manual",R.hideOnClick=!1),m&&(u=!0);var D=R,_=R.plugins||[];a&&(D=Object.assign({},R,{plugins:m&&o.data!=null?[].concat(_,[{fn:function(){return{onTrigger:function($,q){var ne=o.data.children.find(function(Z){var me=Z.instance;return me.reference===q.currentTarget});$.state.$$activeSingletonInstance=ne.instance,M(ne.content)}}}}]):_,render:function(){return{popper:O.container}}}));var U=[l].concat(r?[r.type]:[]);return qv(function(){var K=l;l&&l.hasOwnProperty("current")&&(K=l.current);var B=n(K||O.ref||cP(),Object.assign({},D,{plugins:[bJ].concat(R.plugins||[])}));return O.instance=B,u&&B.disable(),i&&B.show(),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M}),v(!0),function(){B.destroy(),o==null||o.cleanup(B)}},U),qv(function(){var K;if(O.renders===1){O.renders++;return}var B=O.instance;B.setProps(gJ(B.props,D)),(K=B.popperInstance)==null||K.forceUpdate(),u?B.disable():B.enable(),p&&(i?B.show():B.hide()),m&&o.hook({instance:B,content:s,props:D,setSingletonContent:M})}),qv(function(){var K;if(a){var B=O.instance;B.setProps({popperOptions:Object.assign({},B.props.popperOptions,{modifiers:[].concat((((K=B.props.popperOptions)==null?void 0:K.modifiers)||[]).filter(function($){var q=$.name;return q!=="$$tippyReact"}),[{name:"$$tippyReact",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(q){var ne,Z=q.state,me=(ne=Z.modifiersData)==null?void 0:ne.hide;(w.placement!==Z.placement||w.referenceHidden!==(me==null?void 0:me.isReferenceHidden)||w.escaped!==(me==null?void 0:me.hasPopperEscaped))&&x({placement:Z.placement,referenceHidden:me==null?void 0:me.isReferenceHidden,escaped:me==null?void 0:me.hasPopperEscaped}),Z.attributes.popper={}}}])})})}},[w.placement,w.referenceHidden,w.escaped].concat(U)),P.createElement(P.Fragment,null,r?P.cloneElement(r,{ref:function(B){O.ref=B,Jv(r.ref,B)}}):null,b&&kt.createPortal(a?a(pJ(w),S,O.instance):s,O.container))}return e}var AJ=function(n,e){return P.forwardRef(function(r,s){var i=r.children,o=aP(r,["children"]);return P.createElement(n,Object.assign({},e,o),i?P.cloneElement(i,{ref:function(l){Jv(s,l),Jv(i.ref,l)}}):null)})},vJ=AJ(wJ(Ba));const xJ=[{name:"Add row above",action:n=>n.chain().focus().addRowBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7h2v-2h4v2h2v-2h4v2h2v-2h4v2h2v-7M4 14h4v3H4v-3m6 0h4v3h-4v-3m10 0v3h-4v-3h4m-9-4h2V7h3V5h-3V2h-2v3H8v2h3v3Z"})})},{name:"Add row below",action:n=>n.chain().focus().addRowAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V3h2v2h4V3h2v2h4V3h2v2h4V3h2v7M4 10h4V7H4v3m6 0h4V7h-4v3m10 0V7h-4v3h4m-9 4h2v3h3v2h-3v3h-2v-3H8v-2h3v-3Z"})})},{name:"Add left column",action:n=>n.chain().focus().addColumnBefore().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M13 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h9V2h-9m7 8v4h-7v-4h7m0 6v4h-7v-4h7m0-12v4h-7V4h7M9 11H6V8H4v3H1v2h3v3h2v-3h3v-2Z"})})},{name:"Add right column",action:n=>n.chain().focus().addColumnAfter().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M11 2a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H2V2h9m-7 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m11 7h3V8h2v3h3v2h-3v3h-2v-3h-3v-2Z"})})},{name:"Remove row",action:n=>n.chain().focus().deleteRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M9.41 13L12 15.59L14.59 13L16 14.41L13.41 17L16 19.59L14.59 21L12 18.41L9.41 21L8 19.59L10.59 17L8 14.41L9.41 13M22 9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3M4 9h4V6H4v3m6 0h4V6h-4v3m6 0h4V6h-4v3Z"})})},{name:"Remove column",action:n=>n.chain().focus().deleteColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M4 2h7a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h7v-4H4m0 6v4h7v-4H4M4 4v4h7V4H4m13.59 8L15 9.41L16.41 8L19 10.59L21.59 8L23 9.41L20.41 12L23 14.59L21.59 16L19 13.41L16.41 16L15 14.59L17.59 12Z"})})},{name:"Toggle header row",action:n=>n.chain().focus().toggleHeaderRow().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M22 14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4M4 14h4v-4H4v4m6 0h4v-4h-4v4m6 0h4v-4h-4v4Z"})})},{name:"Toggle header column",action:n=>n.chain().focus().toggleHeaderColumn().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M8 2h8a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2m0 8v4h8v-4H8m0 6v4h8v-4H8M8 4v4h8V4H8Z"})})},{name:"Toggle header cell",action:n=>n.chain().focus().toggleHeaderCell().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M21 19a1 1 0 0 1-1 1h-1v-2h2v1m-6 1v-2h2v2h-2m-4 0v-2h2v2h-2m-4 0v-2h2v2H7m-3 0a1 1 0 0 1-1-1v-1h2v2H4M19 4H5a2 2 0 0 0-2 2v2h18V6c0-1.11-.89-2-2-2M5 14H3v2h2v-2m0-4H3v2h2v-2m16 0h-2v2h2v-2m0 4h-2v2h2v-2m-10 2v-2h2v2h-2m0-4v-2h2v2h-2"})})},{name:"Remove table",action:n=>n.chain().focus().deleteTable().run(),icon:k.jsx("svg",{viewBox:"0 0 24 24",children:k.jsx("path",{fill:"currentColor",d:"M12.35 20H10v-3h2.09c.12-.72.37-1.39.72-2H10v-3h4v1.54c.58-.54 1.25-.93 2-1.19V12h4v.35c.75.26 1.42.65 2 1.19V5c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v15c0 1.1.9 2 2 2h9.54c-.54-.58-.93-1.25-1.19-2M16 7h4v3h-4V7m-6 0h4v3h-4V7M8 20H4v-3h4v3m0-5H4v-3h4v3m0-5H4V7h4v3m6.46 5.88l1.42-1.42L18 16.59l2.12-2.13l1.42 1.42L19.41 18l2.13 2.12l-1.42 1.42L18 19.41l-2.12 2.13l-1.42-1.42L16.59 18l-2.13-2.12"})})}],dP=({node:n,getPos:e,selected:t,editor:r})=>{const[s,i]=P.useState(!1),o=gm(),a=P.useRef(null),l=()=>{const{from:u,to:f}=r.state.selection,d=e(),h=d+n.nodeSize;i(d<=u&&f<=h)};P.useEffect(()=>(r.on("selectionUpdate",l),setTimeout(l,100),()=>{r.off("selectionUpdate",l)}));const c=()=>{var d,h;let u=(d=a.current)==null?void 0:d.clientTop;u&&(u+=5);let f=(h=a.current)==null?void 0:h.clientLeft;return f&&(f+=5),{top:`${u}px`,left:`${f}px`}};return k.jsxs(od,{className:"group",children:[k.jsx(aT,{as:"span"}),(s||t)&&k.jsx(vJ,{appendTo:document.body,trigger:"click",interactive:!0,animation:"shift-toward-subtle",placement:"top-start",content:k.jsx("article",{className:"w-screen lg:w-full",contentEditable:!1,children:k.jsx("ul",{tabIndex:0,className:"fixed top-8 right-1/2 translate-x-1/2 menu menu-compact p-2 shadow bg-base-100 rounded-lg w-56",style:c(),children:xJ.map(u=>k.jsx("li",{children:k.jsx(Oc,{variant:"ghost",className:"!items-center w-full !justify-start !font-[400]",onClick:()=>u.action(r),children:k.jsx("span",{children:u.name})})},u.name))})}),children:k.jsx("label",{tabIndex:0,className:he("trigger-button",{hidden:o}),contentEditable:!1,children:k.jsx(s8,{size:20})})})]})},EJ=xt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"td",className:"relative"})}}),CJ=xt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return _a(dP,{as:"th",className:"relative"})}}),hP=n=>(n.stopPropagation(),n.preventDefault(),n),kJ=function(n){const e=n.scrollHeight>n.clientHeight,r=window.getComputedStyle(n).overflowY.indexOf("hidden")!==-1;return e&&!r},pP=function(n){return!n||n===document.body?document.body:kJ(n)?n:pP(n.parentNode)},Yv=(n,e,t)=>{const r=document.createElement(n);if(!r)throw new Error(`Element with name ${n} can't be created.`);return e&&Object.entries(e).forEach(([s,i])=>r.setAttribute(s,i)),t&&Object.entries(t).forEach(([s,i])=>r.addEventListener(s,i)),r},SJ=xt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",nt(this.options.HTMLAttributes,n),0]},addNodeView(){return({editor:n,HTMLAttributes:e,getPos:t})=>{const r=()=>t(),s=pP(n.options.element);let i=!1;const o={deleteRow:()=>{this.editor.chain().deleteNode("tableRow").focus().run()},selectRow:()=>{const b=r(),v=n.state.doc.resolve(b),A=new Oe(v);n.view.dispatch(n.state.tr.setSelection(A))}},a=()=>{i=!0},l=()=>{i=!1},c=Yv("section",{class:"absolute hidden flex items-center w-2 bg-gray-200 z-50 cursor-pointer border-1 border-indigo-600 rounded-l opacity-25 hover:opacity-100",contenteditable:"false"},{click:b=>{b&&hP(b),o.selectRow()},mouseenter:()=>{a()},mouseover:()=>{a()},mouseleave:()=>{l(),d()}}),u=Yv("button",{class:"text-sm px-1 absolute -translate-x-[125%] hover:active:-translate-x-[125%] mr-2"},{click:b=>{b&&hP(b),o.deleteRow()}}),f=()=>{m(),c.classList.remove("hidden")},d=()=>{setTimeout(()=>{i||c.classList.add("hidden")},100)},h=Yv("tr",{...e},{mouseenter:f,mouseover:f,mouseleave:d});c.append(u),document.body.append(c);let p="";const m=()=>{setTimeout(()=>{const b=h.getBoundingClientRect(),v=JSON.stringify(b);p!==v&&(c.style.top=`${b.top+document.documentElement.scrollTop}px`,c.style.left=`${b.x+document.documentElement.scrollLeft-8}px`,c.style.height=`${b.height+1}px`,p=v)})};return setTimeout(()=>{m()},100),n.on("selectionUpdate",m),n.on("update",m),s==null||s.addEventListener("scroll",m),document.addEventListener("scroll",m),{dom:h,contentDOM:h,destroy:()=>{c.remove(),n.off("selectionUpdate",m),n.off("update",m),s==null||s.removeEventListener("scroll",m),document.removeEventListener("scroll",m)}}}}}),TJ=[hJ.configure({resizable:!0}),EJ,CJ,SJ],OJ=EM.extend({content:"(dBlock|columns)+"});function mP({types:n,node:e}){return e!=null&&e.type?Array.isArray(n)&&n.includes(e.type)||e.type===n:!1}const NJ=Ot.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:["paragraph"]}},addProseMirrorPlugins(){const n=new Rt(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>this.options.notAfter.includes(t.name));return[new At({key:n,appendTransaction:(t,r,s)=>{const{doc:i,tr:o,schema:a}=s,l=n.getState(s),c=i.content.size,u=a.nodes[this.options.node];if(l)return o.insert(c,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!mP({node:s,types:e})},apply:(t,r)=>{var i,o,a;if(!t.docChanged)return r;const s=(a=(o=(i=t.doc.lastChild)==null?void 0:i.content)==null?void 0:o.content)==null?void 0:a[0];return!mP({node:s,types:e})}}})]}}),MJ=({node:n,editor:e,getPos:t})=>{const[r,s]=P.useState(""),i=gm(),o=["https://twitter.com","https://x.com"],a=()=>{switch(n.attrs.data){case"twitter":return k.jsx(yT,{size:20});case"iframe":return k.jsx(bT,{size:20});default:return k.jsx(h8,{size:20})}},l=()=>{switch(n.attrs.data){case"twitter":return"Embed a Twitter tweet";case"iframe":return"Embed a video";default:return"Embed an URL"}},c=()=>{if(!r){alert("Please enter a url");return}let p=r;if(r.includes("<iframe")){const A=r.match(/src="([^"]*)"/);A&&A.length>0&&(p=A[1])}else switch(!0){case/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/youtu\.?be(?:\.com)?\/(?:.*v(?:\/|=)|(?:.*\/)?)([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://www.youtube.com/embed/${A[1]}`);break}case/vimeo\.com\/([a-zA-Z0-9-_]+)/.test(r):{const A=r.match(/vimeo\.com\/([a-zA-Z0-9-_]+)/);A&&A.length>0&&(p=`https://player.vimeo.com/video/${A[1]}`);break}default:{alert("Please enter a valid url");return}}const m=640,y=360,b=t(),v=b+n.nodeSize;p&&(e==null||e.chain().focus(b).deleteRange({from:b,to:v}).setIframe({src:p,width:m,height:y}).run())},u=()=>{if(!r){alert("Please enter a url");return}let p=r;const m=o.some(w=>r.includes(w)),y=r.match(/\/status\/([0-9]*)/),b=y&&y.length>0;if(m&&b)p=y[1];else{alert("invalid url");return}const v=t(),A=v+n.nodeSize;p&&(e==null||e.chain().focus(v).deleteRange({from:v,to:A}).setTweetEmbed({tweetId:p}).run())},d=Tv(()=>{switch(n.attrs.data){case"twitter":u();break;default:c();break}},500);P.useEffect(()=>{const p=m=>{if(m.key==="Backspace"&&r===""){const y=t(),b=y+n.nodeSize;(n.content.size===0||n.textContent==="")&&(e==null||e.chain().focus(y).deleteRange({from:y,to:b}).run(),m.preventDefault())}};return document.addEventListener("keydown",p),()=>{document.removeEventListener("keydown",p)}},[r,e,t,n]),P.useEffect(()=>{r&&d()},[r]),P.useEffect(()=>{e==null||e.chain().focus()},[]);const h=P.useRef(null);return P.useEffect(()=>{var p;(p=h.current)==null||p.focus()},[]),k.jsx(od,{as:"div",className:"flex gap-2 group w-full relative justify-center items-start",children:!i&&k.jsxs("div",{className:"relative w-full",children:[k.jsx("div",{className:"absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none text-[#A1AAB1]",children:a()}),k.jsx("input",{ref:h,value:r,placeholder:l(),onChange:p=>s(p.target.value),onClick:p=>p.stopPropagation(),className:"rounded bg-[#f2f2f2] p-3 pl-10 w-full cursor-pointer transition-all ease-in-out text-sm"})]})})},RJ=xt.create({name:"actionButton",group:"block",content:"block*",atom:!0,draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{data:{default:null}}},addNodeView(){return _a(MJ)},parseHTML(){return[{tag:"div[data-action-node]"}]},renderHTML({HTMLAttributes:n}){return["div",nt(n,{"data-action-node":""}),0]},addCommands(){return{setActionButton:n=>({commands:e})=>e.insertContent({type:this.name,attrs:{data:n},content:[]})}}}),PJ=[FW,BW.configure({strike:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bold:{HTMLAttributes:{class:"select-text pointer-events-auto"}},italic:{HTMLAttributes:{class:"select-text pointer-events-auto"}},heading:{HTMLAttributes:{class:"select-text pointer-events-auto"}},paragraph:{HTMLAttributes:{class:"select-text pointer-events-auto"}},bulletList:{HTMLAttributes:{class:"flex flex-col items-start list-disc list-outside space-y-4 ml-6"}},orderedList:{HTMLAttributes:{class:"flex flex-col items-start list-decimal list-outside space-y-4 ml-6"}},listItem:{HTMLAttributes:{class:"leading-normal"}},blockquote:{HTMLAttributes:{class:"rounded-lg bg-[#E8EBEC] p-5 font-serif italic text-black"}},codeBlock:{HTMLAttributes:{class:"rounded-lg bg-transparent border border-[#DDE2E4] p-5 font-mono font-medium text-black"},exitOnArrowDown:!0},code:{HTMLAttributes:{class:"rounded bg-transparent p-1.5 font-mono font-medium text-black text-sm",spellcheck:"false"}},history:!1,gapcursor:!1,dropcursor:!1,document:!1,horizontalRule:!1}),jW.configure({types:["heading","paragraph"]}),MK,lK.extend({exitable:!0}).configure({HTMLAttributes:{class:"text-blue-500 font-bold transition-colors cursor-pointer select-text pointer-events-auto"},openOnClick:!0}),cK.configure({placeholder:()=>"",includeChildren:!0,showOnlyCurrent:!0}),dK.configure({multicolor:!0}),NK,gK.configure({HTMLAttributes:{class:"select-text pointer-events-auto"}}),_W,DK,hK.configure({HTMLAttributes:{class:"not-prose space-y-4 !ml-0"}}),mK.configure({HTMLAttributes:{class:"flex items-start"},nested:!0}),CM.configure({width:3,color:"#d1d5db"}),kM,d7,NJ,OJ,...TJ,HK.configure({uploadFn:v8}),PK,IK,FK,RJ,RK],DJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAAOCAYAAAD0f5bSAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAE/SURBVHgBhVJBTsJQEH3zMcElR+gRuIF6gwYPAOwkLoQTUE6ArEA3xbWJ4gnQE8gNwBuwhMR2fPNLk9o0ZZImM/P/e39e3wgqojPXXiPFJnFovw1kWT53xSKca3C70LXlr/eySYFdZ6Fb61eCePnBCb6VF3P21UA+WX+wv+086fgfyMbh4aPlqWJSZH2/k6EINlBEJI6tdxHG2tIDrsUqxYzsO5Qi+UXfNfwUPT7w49wRU1EyZWNFqIgV9REw84Wga+P1Uj7PsW5QE9pEZMT8Aq+JQmNcYl8HwgEtEvf9fc3RR4zrMCRe84WA6dJRz8upPwyftV0FOP3ugHqu0iZGzsSbF3bYUMRlgDdWMcyE4WvVl73XRC9CNiaqaHMDpkUQrYh8kmKUmy5lVpvdBNs2mOk0tptk9a5AVKHhzML+AZaSjR/r++n9AAAAAElFTkSuQmCC",IJ="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEjSURBVHgBjZJBToNQEIb/NzTeoMbGjTeoN5Au1S7wBrqwyk5OoD1B46pRF9UbsEBc9nmEHsI08QhGZnxMpaGUEv4EwoP/mxnyj0GNTp++AoPORA+Gx+mo91r1mOJh+LL0WYwDqC8i/obJGCuSfRJ1bHLdtWtQIaY5WoiYBknYtZQfmOGjpTIvC7TAahTvpMksmUQCvK0A6itzNl1egmi2k2K+2gPsD+mvHGkh4MIVoPuSLYbIYxOk3YAJVRuktwd3DhjvggqRB0Slc3D+/D1Lw95DE5Rnq3E487ySXeyu4zooz/R9tD/QUYV5Ufke1HbKvW4RdFS9icRoKeKO1c7Fi+HUbQ/BzzPdXjmxDCy8TOIk7G2CZf1nqzEJfqOPm8Otif4AFnp3K1F5HHAAAAAASUVORK5CYII=",LJ=n=>{const e=document.createElement("span");e.classList.add("collaboration-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-cursor__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},BJ=n=>{const e=document.createElement("span");e.classList.add("custom-cursor__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.classList.add("custom-cursor__label-container"),t.setAttribute("style",`border: 1px solid ${n.color}`);const r=document.createElement("img");r.src=DJ,r.classList.add("custom-cursor__icon");const s=document.createElement("div");s.classList.add("custom-cursor__label");const i=document.createElement("span");i.classList.add("custom-cursor__text"),i.textContent=n.name;const o=document.createElement("img");return o.src=IJ,o.classList.add("custom-cursor__badge"),s.appendChild(i),t.appendChild(r),t.appendChild(s),t.appendChild(o),e.appendChild(t),e},_J=n=>n.isEns?BJ(n):LJ(n),FJ="6.13.1";function jJ(n,e,t){const r=e.split("|").map(i=>i.trim());for(let i=0;i<r.length;i++)switch(e){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof n===e)return}const s=new Error(`invalid value for type ${e}`);throw s.code="INVALID_ARGUMENT",s.argument=`value.${t}`,s.value=n,s}async function On(n){const e=Object.keys(n);return(await Promise.all(e.map(r=>Promise.resolve(n[r])))).reduce((r,s,i)=>(r[e[i]]=s,r),{})}function Ne(n,e,t){for(let r in e){let s=e[r];const i=t?t[r]:null;i&&jJ(s,i,r),Object.defineProperty(n,r,{enumerable:!0,value:s,writable:!1})}}function nu(n){if(n==null)return"null";if(Array.isArray(n))return"[ "+n.map(nu).join(", ")+" ]";if(n instanceof Uint8Array){const e="0123456789abcdef";let t="0x";for(let r=0;r<n.length;r++)t+=e[n[r]>>4],t+=e[n[r]&15];return t}if(typeof n=="object"&&typeof n.toJSON=="function")return nu(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":return BigInt(n).toString();case"number":return n.toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{ "+e.map(t=>`${nu(t)}: ${nu(n[t])}`).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function dn(n,e){return n&&n.code===e}function Xv(n){return dn(n,"CALL_EXCEPTION")}function Mt(n,e,t){let r=n;{const i=[];if(t){if("message"in t||"code"in t||"name"in t)throw new Error(`value will overwrite populated values: ${nu(t)}`);for(const o in t){if(o==="shortMessage")continue;const a=t[o];i.push(o+"="+nu(a))}}i.push(`code=${e}`),i.push(`version=${FJ}`),i.length&&(n+=" ("+i.join(", ")+")")}let s;switch(e){case"INVALID_ARGUMENT":s=new TypeError(n);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":s=new RangeError(n);break;default:s=new Error(n)}return Ne(s,{code:e}),t&&Object.assign(s,t),s.shortMessage==null&&Ne(s,{shortMessage:r}),s}function ee(n,e,t,r){if(!n)throw Mt(e,t,r)}function z(n,e,t,r){ee(n,e,"INVALID_ARGUMENT",{argument:t,value:r})}function gP(n,e,t){t==null&&(t=""),t&&(t=": "+t),ee(n>=e,"missing arguemnt"+t,"MISSING_ARGUMENT",{count:n,expectedCount:e}),ee(n<=e,"too many arguments"+t,"UNEXPECTED_ARGUMENT",{count:n,expectedCount:e})}["NFD","NFC","NFKD","NFKC"].reduce((n,e)=>{try{if("test".normalize(e)!=="test")throw new Error("bad");if(e==="NFD"&&"é".normalize("NFD")!=="é")throw new Error("broken");n.push(e)}catch{}return n},[]);function qg(n,e,t){if(t==null&&(t=""),n!==e){let r=t,s="new";t&&(r+=".",s+=" "+t),ee(!1,`private constructor; use ${r}from* methods`,"UNSUPPORTED_OPERATION",{operation:s})}}function yP(n,e,t){if(n instanceof Uint8Array)return t?new Uint8Array(n):n;if(typeof n=="string"&&n.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const r=new Uint8Array((n.length-2)/2);let s=2;for(let i=0;i<r.length;i++)r[i]=parseInt(n.substring(s,s+2),16),s+=2;return r}z(!1,"invalid BytesLike value",e||"value",n)}function ct(n,e){return yP(n,e,!1)}function Vn(n,e){return yP(n,e,!0)}function Ct(n,e){return!(typeof n!="string"||!n.match(/^0x[0-9A-Fa-f]*$/)||typeof e=="number"&&n.length!==2+2*e||e===!0&&n.length%2!==0)}function Zv(n){return Ct(n,!0)||n instanceof Uint8Array}const bP="0123456789abcdef";function we(n){const e=ct(n);let t="0x";for(let r=0;r<e.length;r++){const s=e[r];t+=bP[(s&240)>>4]+bP[s&15]}return t}function zt(n){return"0x"+n.map(e=>we(e).substring(2)).join("")}function ru(n){return Ct(n,!0)?(n.length-2)/2:ct(n).length}function Vt(n,e,t){const r=ct(n);return t!=null&&t>r.length&&ee(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:r,length:r.length,offset:t}),we(r.slice(e??0,t??r.length))}function wP(n,e,t){const r=ct(n);ee(e>=r.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(r),length:e,offset:e+1});const s=new Uint8Array(e);return s.fill(0),t?s.set(r,e-r.length):s.set(r,0),we(s)}function il(n,e){return wP(n,e,!0)}function UJ(n,e){return wP(n,e,!1)}const Yg=BigInt(0),ys=BigInt(1),su=9007199254740991;function VJ(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"width"));if(ee(t>>r===Yg,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:n}),t>>r-ys){const s=(ys<<r)-ys;return-((~t&s)+ys)}return t}function AP(n,e){let t=xe(n,"value");const r=BigInt(Je(e,"width")),s=ys<<r-ys;if(t<Yg){t=-t,ee(t<=s,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});const i=(ys<<r)-ys;return(~t&i)+ys}else ee(t<s,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:n});return t}function Zd(n,e){const t=Xg(n,"value"),r=BigInt(Je(e,"bits"));return t&(ys<<r)-ys}function xe(n,e){switch(typeof n){case"bigint":return n;case"number":return z(Number.isInteger(n),"underflow",e||"value",n),z(n>=-su&&n<=su,"overflow",e||"value",n),BigInt(n);case"string":try{if(n==="")throw new Error("empty string");return n[0]==="-"&&n[1]!=="-"?-BigInt(n.substring(1)):BigInt(n)}catch(t){z(!1,`invalid BigNumberish string: ${t.message}`,e||"value",n)}}z(!1,"invalid BigNumberish value",e||"value",n)}function Xg(n,e){const t=xe(n,e);return ee(t>=Yg,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:n}),t}const vP="0123456789abcdef";function e1(n){if(n instanceof Uint8Array){let e="0x0";for(const t of n)e+=vP[t>>4],e+=vP[t&15];return BigInt(e)}return xe(n)}function Je(n,e){switch(typeof n){case"bigint":return z(n>=-su&&n<=su,"overflow",e||"value",n),Number(n);case"number":return z(Number.isInteger(n),"underflow",e||"value",n),z(n>=-su&&n<=su,"overflow",e||"value",n),n;case"string":try{if(n==="")throw new Error("empty string");return Je(BigInt(n),e)}catch(t){z(!1,`invalid numeric string: ${t.message}`,e||"value",n)}}z(!1,"invalid numeric value",e||"value",n)}function HJ(n){return Je(e1(n))}function _o(n,e){let r=Xg(n,"value").toString(16);if(e==null)r.length%2&&(r="0"+r);else{const s=Je(e,"width");for(ee(s*2>=r.length,`value exceeds width (${s} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:n});r.length<s*2;)r="0"+r}return"0x"+r}function Hn(n){const e=Xg(n,"value");if(e===Yg)return new Uint8Array([]);let t=e.toString(16);t.length%2&&(t="0"+t);const r=new Uint8Array(t.length/2);for(let s=0;s<r.length;s++){const i=s*2;r[s]=parseInt(t.substring(i,i+2),16)}return r}function ol(n){let e=we(Zv(n)?n:Hn(n)).substring(2);for(;e.startsWith("0");)e=e.substring(1);return e===""&&(e="0"),"0x"+e}const xP="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const EP=BigInt(58);function zJ(n){const e=ct(n);let t=e1(e),r="";for(;t;)r=xP[Number(t%EP)]+r,t/=EP;for(let s=0;s<e.length&&!e[s];s++)r=xP[0]+r;return r}function $J(n){n=atob(n);const e=new Uint8Array(n.length);for(let t=0;t<n.length;t++)e[t]=n.charCodeAt(t);return ct(e)}function GJ(n){const e=ct(n);let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}class CP{constructor(e,t,r){G(this,"filter");G(this,"emitter");J(this,Pu);L(this,Pu,t),Ne(this,{emitter:e,filter:r})}async removeListener(){T(this,Pu)!=null&&await this.emitter.off(this.filter,T(this,Pu))}}Pu=new WeakMap;function WJ(n,e,t,r,s){z(!1,`invalid codepoint at offset ${e}; ${n}`,"bytes",t)}function kP(n,e,t,r,s){if(n==="BAD_PREFIX"||n==="UNEXPECTED_CONTINUE"){let i=0;for(let o=e+1;o<t.length&&t[o]>>6===2;o++)i++;return i}return n==="OVERRUN"?t.length-e-1:0}function KJ(n,e,t,r,s){return n==="OVERLONG"?(z(typeof s=="number","invalid bad code point for replacement","badCodepoint",s),r.push(s),0):(r.push(65533),kP(n,e,t))}const QJ=Object.freeze({error:WJ,ignore:kP,replace:KJ});function JJ(n,e){e==null&&(e=QJ.error);const t=ct(n,"bytes"),r=[];let s=0;for(;s<t.length;){const i=t[s++];if(!(i>>7)){r.push(i);continue}let o=null,a=null;if((i&224)===192)o=1,a=127;else if((i&240)===224)o=2,a=2047;else if((i&248)===240)o=3,a=65535;else{(i&192)===128?s+=e("UNEXPECTED_CONTINUE",s-1,t,r):s+=e("BAD_PREFIX",s-1,t,r);continue}if(s-1+o>=t.length){s+=e("OVERRUN",s-1,t,r);continue}let l=i&(1<<8-o-1)-1;for(let c=0;c<o;c++){let u=t[s];if((u&192)!=128){s+=e("MISSING_CONTINUE",s,t,r),l=null;break}l=l<<6|u&63,s++}if(l!==null){if(l>1114111){s+=e("OUT_OF_RANGE",s-1-o,t,r,l);continue}if(l>=55296&&l<=57343){s+=e("UTF16_SURROGATE",s-1-o,t,r,l);continue}if(l<=a){s+=e("OVERLONG",s-1-o,t,r,l);continue}r.push(l)}}return r}function Mi(n,e){z(typeof n=="string","invalid string value","str",n);let t=[];for(let r=0;r<n.length;r++){const s=n.charCodeAt(r);if(s<128)t.push(s);else if(s<2048)t.push(s>>6|192),t.push(s&63|128);else if((s&64512)==55296){r++;const i=n.charCodeAt(r);z(r<n.length&&(i&64512)===56320,"invalid surrogate pair","str",n);const o=65536+((s&1023)<<10)+(i&1023);t.push(o>>18|240),t.push(o>>12&63|128),t.push(o>>6&63|128),t.push(o&63|128)}else t.push(s>>12|224),t.push(s>>6&63|128),t.push(s&63|128)}return new Uint8Array(t)}function qJ(n){return n.map(e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10&1023)+55296,(e&1023)+56320))).join("")}function iu(n,e){return qJ(JJ(n,e))}function SP(n){async function e(t,r){ee(r==null||!r.cancelled,"request cancelled before sending","CANCELLED");const s=t.url.split(":")[0].toLowerCase();ee(s==="http"||s==="https",`unsupported protocol ${s}`,"UNSUPPORTED_OPERATION",{info:{protocol:s},operation:"request"}),ee(s==="https"||!t.credentials||t.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let i=null;const o=new AbortController,a=setTimeout(()=>{i=Mt("request timeout","TIMEOUT"),o.abort()},t.timeout);r&&r.addListener(()=>{i=Mt("request cancelled","CANCELLED"),o.abort()});const l={method:t.method,headers:new Headers(Array.from(t)),body:t.body||void 0,signal:o.signal};let c;try{c=await fetch(t.url,l)}catch(h){throw clearTimeout(a),i||h}clearTimeout(a);const u={};c.headers.forEach((h,p)=>{u[p.toLowerCase()]=h});const f=await c.arrayBuffer(),d=f==null?null:new Uint8Array(f);return{statusCode:c.status,statusMessage:c.statusText,headers:u,body:d}}return e}const YJ=12,XJ=250;let TP=SP();const ZJ=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),eq=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let t1=!1;async function OP(n,e){try{const t=n.match(ZJ);if(!t)throw new Error("invalid data");return new Fo(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?$J(t[3]):nq(t[3]))}catch{return new Fo(599,"BAD REQUEST (invalid data: URI)",{},null,new zn(n))}}function NP(n){async function e(t,r){try{const s=t.match(eq);if(!s)throw new Error("invalid link");return new zn(`${n}${s[2]}`)}catch{return new Fo(599,"BAD REQUEST (invalid IPFS URI)",{},null,new zn(t))}}return e}const Zg={data:OP,ipfs:NP("https://gateway.ipfs.io/ipfs/")},MP=new WeakMap;class tq{constructor(e){J(this,Tl);J(this,Xo);L(this,Tl,[]),L(this,Xo,!1),MP.set(e,()=>{if(!T(this,Xo)){L(this,Xo,!0);for(const t of T(this,Tl))setTimeout(()=>{t()},0);L(this,Tl,[])}})}addListener(e){ee(!T(this,Xo),"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),T(this,Tl).push(e)}get cancelled(){return T(this,Xo)}checkSignal(){ee(!this.cancelled,"cancelled","CANCELLED",{})}}Tl=new WeakMap,Xo=new WeakMap;function ey(n){if(n==null)throw new Error("missing signal; should not happen");return n.checkSignal(),n}const u0=class u0{constructor(e){J(this,Rl);J(this,Du);J(this,Iu);J(this,xs);J(this,Wi);J(this,Lu);J(this,Bu);J(this,mn);J(this,Nr);J(this,Ki);J(this,Ol);J(this,Nl);J(this,Ml);J(this,ni);J(this,Es);J(this,Zo);L(this,Bu,String(e)),L(this,Du,!1),L(this,Iu,!0),L(this,xs,{}),L(this,Wi,""),L(this,Lu,3e5),L(this,Es,{slotInterval:XJ,maxAttempts:YJ}),L(this,Zo,null)}get url(){return T(this,Bu)}set url(e){L(this,Bu,String(e))}get body(){return T(this,mn)==null?null:new Uint8Array(T(this,mn))}set body(e){if(e==null)L(this,mn,void 0),L(this,Nr,void 0);else if(typeof e=="string")L(this,mn,Mi(e)),L(this,Nr,"text/plain");else if(e instanceof Uint8Array)L(this,mn,e),L(this,Nr,"application/octet-stream");else if(typeof e=="object")L(this,mn,Mi(JSON.stringify(e))),L(this,Nr,"application/json");else throw new Error("invalid body")}hasBody(){return T(this,mn)!=null}get method(){return T(this,Wi)?T(this,Wi):this.hasBody()?"POST":"GET"}set method(e){e==null&&(e=""),L(this,Wi,String(e).toUpperCase())}get headers(){const e=Object.assign({},T(this,xs));return T(this,Ki)&&(e.authorization=`Basic ${GJ(Mi(T(this,Ki)))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),e["content-type"]==null&&T(this,Nr)&&(e["content-type"]=T(this,Nr)),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){T(this,xs)[String(e).toLowerCase()]=String(t)}clearHeaders(){L(this,xs,{})}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return T(this,Ki)||null}setCredentials(e,t){z(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),L(this,Ki,`${e}:${t}`)}get allowGzip(){return T(this,Iu)}set allowGzip(e){L(this,Iu,!!e)}get allowInsecureAuthentication(){return!!T(this,Du)}set allowInsecureAuthentication(e){L(this,Du,!!e)}get timeout(){return T(this,Lu)}set timeout(e){z(e>=0,"timeout must be non-zero","timeout",e),L(this,Lu,e)}get preflightFunc(){return T(this,Ol)||null}set preflightFunc(e){L(this,Ol,e)}get processFunc(){return T(this,Nl)||null}set processFunc(e){L(this,Nl,e)}get retryFunc(){return T(this,Ml)||null}set retryFunc(e){L(this,Ml,e)}get getUrlFunc(){return T(this,Zo)||TP}set getUrlFunc(e){L(this,Zo,e)}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${T(this,mn)?we(T(this,mn)):"null"}>`}setThrottleParams(e){e.slotInterval!=null&&(T(this,Es).slotInterval=e.slotInterval),e.maxAttempts!=null&&(T(this,Es).maxAttempts=e.maxAttempts)}send(){return ee(T(this,ni)==null,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),L(this,ni,new tq(this)),fe(this,Rl,Zh).call(this,0,RP()+this.timeout,0,this,new Fo(0,"",{},null,this))}cancel(){ee(T(this,ni)!=null,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=MP.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();ee(this.method==="GET"&&(t!=="https"||r!=="http")&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const s=new u0(e);return s.method="GET",s.allowGzip=this.allowGzip,s.timeout=this.timeout,L(s,xs,Object.assign({},T(this,xs))),T(this,mn)&&L(s,mn,new Uint8Array(T(this,mn))),L(s,Nr,T(this,Nr)),s}clone(){const e=new u0(this.url);return L(e,Wi,T(this,Wi)),T(this,mn)&&L(e,mn,T(this,mn)),L(e,Nr,T(this,Nr)),L(e,xs,Object.assign({},T(this,xs))),L(e,Ki,T(this,Ki)),this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),L(e,Ol,T(this,Ol)),L(e,Nl,T(this,Nl)),L(e,Ml,T(this,Ml)),L(e,Es,Object.assign({},T(this,Es))),L(e,Zo,T(this,Zo)),e}static lockConfig(){t1=!0}static getGateway(e){return Zg[e.toLowerCase()]||null}static registerGateway(e,t){if(e=e.toLowerCase(),e==="http"||e==="https")throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(t1)throw new Error("gateways locked");Zg[e]=t}static registerGetUrl(e){if(t1)throw new Error("gateways locked");TP=e}static createGetUrlFunc(e){return SP()}static createDataGateway(){return OP}static createIpfsGatewayFunc(e){return NP(e)}};Du=new WeakMap,Iu=new WeakMap,xs=new WeakMap,Wi=new WeakMap,Lu=new WeakMap,Bu=new WeakMap,mn=new WeakMap,Nr=new WeakMap,Ki=new WeakMap,Ol=new WeakMap,Nl=new WeakMap,Ml=new WeakMap,ni=new WeakMap,Es=new WeakMap,Zo=new WeakMap,Rl=new WeakSet,Zh=async function(e,t,r,s,i){var u,f,d;if(e>=T(this,Es).maxAttempts)return i.makeServerError("exceeded maximum retry limit");ee(RP()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:s}),r>0&&await rq(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Zg){const h=await Zg[a](o.url,ey(T(s,ni)));if(h instanceof Fo){let p=h;if(this.processFunc){ey(T(s,ni));try{p=await this.processFunc(o,p)}catch(m){(m.throttle==null||typeof m.stall!="number")&&p.makeServerError("error in post-processing function",m).assertOk()}}return p}o=h}this.preflightFunc&&(o=await this.preflightFunc(o));const l=await this.getUrlFunc(o,ey(T(s,ni)));let c=new Fo(l.statusCode,l.statusMessage,l.headers,l.body,s);if(c.statusCode===301||c.statusCode===302){try{const h=c.headers.location||"";return fe(u=o.redirect(h),Rl,Zh).call(u,e+1,t,0,s,c)}catch{}return c}else if(c.statusCode===429&&(this.retryFunc==null||await this.retryFunc(o,c,e))){const h=c.headers["retry-after"];let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return typeof h=="string"&&h.match(/^[1-9][0-9]*$/)&&(p=parseInt(h)),fe(f=o.clone(),Rl,Zh).call(f,e+1,t,p,s,c)}if(this.processFunc){ey(T(s,ni));try{c=await this.processFunc(o,c)}catch(h){(h.throttle==null||typeof h.stall!="number")&&c.makeServerError("error in post-processing function",h).assertOk();let p=T(this,Es).slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return h.stall>=0&&(p=h.stall),fe(d=o.clone(),Rl,Zh).call(d,e+1,t,p,s,c)}}return c};let zn=u0;const wE=class wE{constructor(e,t,r,s,i){J(this,_h);J(this,Fh);J(this,jh);J(this,Mr);J(this,_u);J(this,Pl);L(this,_h,e),L(this,Fh,t),L(this,jh,Object.keys(r).reduce((o,a)=>(o[a.toLowerCase()]=String(r[a]),o),{})),L(this,Mr,s==null?null:new Uint8Array(s)),L(this,_u,i||null),L(this,Pl,{message:""})}toString(){return`<FetchResponse status=${this.statusCode} body=${T(this,Mr)?we(T(this,Mr)):"null"}>`}get statusCode(){return T(this,_h)}get statusMessage(){return T(this,Fh)}get headers(){return Object.assign({},T(this,jh))}get body(){return T(this,Mr)==null?null:new Uint8Array(T(this,Mr))}get bodyText(){try{return T(this,Mr)==null?"":iu(T(this,Mr))}catch{ee(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch{ee(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const s=t[r++];return{value:[s,e[s]],done:!1}}return{value:void 0,done:!0}}}}makeServerError(e,t){let r;e?r=`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:(e=`${this.statusCode} ${this.statusMessage}`,r=`CLIENT ESCALATED SERVER ERROR (${e})`);const s=new wE(599,r,this.headers,this.body,T(this,_u)||void 0);return L(s,Pl,{message:e,error:t}),s}throwThrottleError(e,t){t==null?t=-1:z(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw Ne(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return T(this,Mr)!=null}get request(){return T(this,_u)}ok(){return T(this,Pl).message===""&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=T(this,Pl);e===""&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let s=null;try{T(this,Mr)&&(s=iu(T(this,Mr)))}catch{}ee(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:s,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}};_h=new WeakMap,Fh=new WeakMap,jh=new WeakMap,Mr=new WeakMap,_u=new WeakMap,Pl=new WeakMap;let Fo=wE;function RP(){return new Date().getTime()}function nq(n){return Mi(n.replace(/%([0-9a-f][0-9a-f])/gi,(e,t)=>String.fromCharCode(parseInt(t,16))))}function rq(n){return new Promise(e=>setTimeout(e,n))}function sq(n){let e=n.toString(16);for(;e.length<2;)e="0"+e;return"0x"+e}function PP(n,e,t){let r=0;for(let s=0;s<t;s++)r=r*256+n[e+s];return r}function DP(n,e,t,r){const s=[];for(;t<e+1+r;){const i=IP(n,t);s.push(i.result),t+=i.consumed,ee(t<=e+1+r,"child data too short","BUFFER_OVERRUN",{buffer:n,length:r,offset:e})}return{consumed:1+r,result:s}}function IP(n,e){ee(n.length!==0,"data too short","BUFFER_OVERRUN",{buffer:n,length:0,offset:1});const t=r=>{ee(r<=n.length,"data short segment too short","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r})};if(n[e]>=248){const r=n[e]-247;t(e+1+r);const s=PP(n,e+1,r);return t(e+1+r+s),DP(n,e,e+1+r,r+s)}else if(n[e]>=192){const r=n[e]-192;return t(e+1+r),DP(n,e,e+1,r)}else if(n[e]>=184){const r=n[e]-183;t(e+1+r);const s=PP(n,e+1,r);t(e+1+r+s);const i=we(n.slice(e+1+r,e+1+r+s));return{consumed:1+r+s,result:i}}else if(n[e]>=128){const r=n[e]-128;t(e+1+r);const s=we(n.slice(e+1,e+1+r));return{consumed:1+r,result:s}}return{consumed:1,result:sq(n[e])}}function ty(n){const e=ct(n,"data"),t=IP(e,0);return z(t.consumed===e.length,"unexpected junk after rlp payload","data",n),t.result}function LP(n){const e=[];for(;n;)e.unshift(n&255),n>>=8;return e}function BP(n){if(Array.isArray(n)){let r=[];if(n.forEach(function(i){r=r.concat(BP(i))}),r.length<=55)return r.unshift(192+r.length),r;const s=LP(r.length);return s.unshift(247+s.length),s.concat(r)}const e=Array.prototype.slice.call(ct(n,"object"));if(e.length===1&&e[0]<=127)return e;if(e.length<=55)return e.unshift(128+e.length),e;const t=LP(e.length);return t.unshift(183+t.length),t.concat(e)}const _P="0123456789abcdef";function al(n){let e="0x";for(const t of BP(n))e+=_P[t>>4],e+=_P[t&15];return e}const $n=32,n1=new Uint8Array($n),iq=["then"],ny={},FP=new WeakMap;function ll(n){return FP.get(n)}function jP(n,e){FP.set(n,e)}function eh(n,e){const t=new Error(`deferred error during ABI decoding triggered accessing ${n}`);throw t.error=e,t}function r1(n,e,t){return n.indexOf(null)>=0?e.map((r,s)=>r instanceof ou?r1(ll(r),r,t):r):n.reduce((r,s,i)=>{let o=e.getValue(s);return s in r||(t&&o instanceof ou&&(o=r1(ll(o),o,t)),r[s]=o),r},{})}const ju=class ju extends Array{constructor(...t){const r=t[0];let s=t[1],i=(t[2]||[]).slice(),o=!0;r!==ny&&(s=t,i=[],o=!1);super(s.length);J(this,Fu);s.forEach((c,u)=>{this[u]=c});const a=i.reduce((c,u)=>(typeof u=="string"&&c.set(u,(c.get(u)||0)+1),c),new Map);if(jP(this,Object.freeze(s.map((c,u)=>{const f=i[u];return f!=null&&a.get(f)===1?f:null}))),L(this,Fu,[]),T(this,Fu)==null&&T(this,Fu),!o)return;Object.freeze(this);const l=new Proxy(this,{get:(c,u,f)=>{if(typeof u=="string"){if(u.match(/^[0-9]+$/)){const h=Je(u,"%index");if(h<0||h>=this.length)throw new RangeError("out of result range");const p=c[h];return p instanceof Error&&eh(`index ${h}`,p),p}if(iq.indexOf(u)>=0)return Reflect.get(c,u,f);const d=c[u];if(d instanceof Function)return function(...h){return d.apply(this===f?c:this,h)};if(!(u in c))return c.getValue.apply(this===f?c:this,[u])}return Reflect.get(c,u,f)}});return jP(l,ll(this)),l}toArray(t){const r=[];return this.forEach((s,i)=>{s instanceof Error&&eh(`index ${i}`,s),t&&s instanceof ju&&(s=s.toArray(t)),r.push(s)}),r}toObject(t){const r=ll(this);return r.reduce((s,i,o)=>(ee(i!=null,`value at index ${o} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),r1(r,this,t)),{})}slice(t,r){t==null&&(t=0),t<0&&(t+=this.length,t<0&&(t=0)),r==null&&(r=this.length),r<0&&(r+=this.length,r<0&&(r=0)),r>this.length&&(r=this.length);const s=ll(this),i=[],o=[];for(let a=t;a<r;a++)i.push(this[a]),o.push(s[a]);return new ju(ny,i,o)}filter(t,r){const s=ll(this),i=[],o=[];for(let a=0;a<this.length;a++){const l=this[a];l instanceof Error&&eh(`index ${a}`,l),t.call(r,l,a,this)&&(i.push(l),o.push(s[a]))}return new ju(ny,i,o)}map(t,r){const s=[];for(let i=0;i<this.length;i++){const o=this[i];o instanceof Error&&eh(`index ${i}`,o),s.push(t.call(r,o,i,this))}return s}getValue(t){const r=ll(this).indexOf(t);if(r===-1)return;const s=this[r];return s instanceof Error&&eh(`property ${JSON.stringify(t)}`,s.error),s}static fromItems(t,r){return new ju(ny,t,r)}};Fu=new WeakMap;let ou=ju;function UP(n){let e=Hn(n);return ee(e.length<=$n,"value out-of-bounds","BUFFER_OVERRUN",{buffer:e,length:$n,offset:e.length}),e.length!==$n&&(e=Vn(zt([n1.slice(e.length%$n),e]))),e}class Ri{constructor(e,t,r,s){G(this,"name");G(this,"type");G(this,"localName");G(this,"dynamic");Ne(this,{name:e,type:t,localName:r,dynamic:s},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){z(!1,e,this.localName,t)}}class s1{constructor(){J(this,Uu);J(this,Qi);J(this,Dl);L(this,Qi,[]),L(this,Dl,0)}get data(){return zt(T(this,Qi))}get length(){return T(this,Dl)}appendWriter(e){return fe(this,Uu,y0).call(this,Vn(e.data))}writeBytes(e){let t=Vn(e);const r=t.length%$n;return r&&(t=Vn(zt([t,n1.slice(r)]))),fe(this,Uu,y0).call(this,t)}writeValue(e){return fe(this,Uu,y0).call(this,UP(e))}writeUpdatableValue(){const e=T(this,Qi).length;return T(this,Qi).push(n1),L(this,Dl,T(this,Dl)+$n),t=>{T(this,Qi)[e]=UP(t)}}}Qi=new WeakMap,Dl=new WeakMap,Uu=new WeakSet,y0=function(e){return T(this,Qi).push(e),L(this,Dl,T(this,Dl)+e.length),e.length};const AE=class AE{constructor(e,t,r){J(this,Bl);G(this,"allowLoose");J(this,cr);J(this,Rr);J(this,Il);J(this,Ll);J(this,ea);Ne(this,{allowLoose:!!t}),L(this,cr,Vn(e)),L(this,Il,0),L(this,Ll,null),L(this,ea,r??1024),L(this,Rr,0)}get data(){return we(T(this,cr))}get dataLength(){return T(this,cr).length}get consumed(){return T(this,Rr)}get bytes(){return new Uint8Array(T(this,cr))}subReader(e){const t=new AE(T(this,cr).slice(T(this,Rr)+e),this.allowLoose,T(this,ea));return L(t,Ll,this),t}readBytes(e,t){let r=fe(this,Bl,oF).call(this,0,e,!!t);return fe(this,Bl,NE).call(this,e),L(this,Rr,T(this,Rr)+r.length),r.slice(0,e)}readValue(){return e1(this.readBytes($n))}readIndex(){return HJ(this.readBytes($n))}};cr=new WeakMap,Rr=new WeakMap,Il=new WeakMap,Ll=new WeakMap,ea=new WeakMap,Bl=new WeakSet,NE=function(e){var t;if(T(this,Ll))return fe(t=T(this,Ll),Bl,NE).call(t,e);L(this,Il,T(this,Il)+e),ee(T(this,ea)<1||T(this,Il)<=T(this,ea)*this.dataLength,`compressed ABI data exceeds inflation ratio of ${T(this,ea)} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),offset:T(this,Rr),length:e,info:{bytesRead:T(this,Il),dataLength:this.dataLength}})},oF=function(e,t,r){let s=Math.ceil(t/$n)*$n;return T(this,Rr)+s>T(this,cr).length&&(this.allowLoose&&r&&T(this,Rr)+t<=T(this,cr).length?s=t:ee(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:Vn(T(this,cr)),length:T(this,cr).length,offset:T(this,Rr)+s})),T(this,cr).slice(T(this,Rr),T(this,Rr)+s)};let i1=AE;function ry(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function o1(n,...e){if(!(n instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function oq(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ry(n.outputLen),ry(n.blockLen)}function au(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function VP(n,e){o1(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}const a1=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const HP=n=>n instanceof Uint8Array,aq=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4)),l1=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),Xs=(n,e)=>n<<32-e|n>>>e;if(!(new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68))throw new Error("Non little-endian hardware is not supported");function lq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function sy(n){if(typeof n=="string"&&(n=lq(n)),!HP(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}function cq(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!HP(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}class c1{clone(){return this._cloneInto()}}function u1(n){const e=r=>n().update(sy(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function uq(n=32){if(a1&&typeof a1.getRandomValues=="function")return a1.getRandomValues(new Uint8Array(n));throw new Error("crypto.getRandomValues must be defined")}class zP extends c1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,oq(e);const r=sy(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return au(this),this.iHash.update(e),this}digestInto(e){au(this),o1(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const $P=(n,e,t)=>new zP(n,e).update(t).digest();$P.create=(n,e)=>new zP(n,e);function fq(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(t>>s&i),a=Number(t&i),l=r?4:0,c=r?0:4;n.setUint32(e+l,o,r),n.setUint32(e+c,a,r)}class GP extends c1{constructor(e,t,r,s){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=l1(this.buffer)}update(e){au(this);const{view:t,buffer:r,blockLen:s}=this;e=sy(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const l=l1(e);for(;s<=i-o;o+=s)this.process(l,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){au(this),VP(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let f=o;f<s;f++)t[f]=0;fq(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=l1(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<c;f++)a.setUint32(4*f,u[f],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%t&&e.buffer.set(r),e}}const dq=(n,e,t)=>n&e^~n&t,hq=(n,e,t)=>n&e^n&t^e&t,pq=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),jo=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Uo=new Uint32Array(64);class mq extends GP{constructor(){super(64,32,8,!1),this.A=jo[0]|0,this.B=jo[1]|0,this.C=jo[2]|0,this.D=jo[3]|0,this.E=jo[4]|0,this.F=jo[5]|0,this.G=jo[6]|0,this.H=jo[7]|0}get(){const{A:e,B:t,C:r,D:s,E:i,F:o,G:a,H:l}=this;return[e,t,r,s,i,o,a,l]}set(e,t,r,s,i,o,a,l){this.A=e|0,this.B=t|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let f=0;f<16;f++,t+=4)Uo[f]=e.getUint32(t,!1);for(let f=16;f<64;f++){const d=Uo[f-15],h=Uo[f-2],p=Xs(d,7)^Xs(d,18)^d>>>3,m=Xs(h,17)^Xs(h,19)^h>>>10;Uo[f]=m+Uo[f-7]+p+Uo[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:l,G:c,H:u}=this;for(let f=0;f<64;f++){const d=Xs(a,6)^Xs(a,11)^Xs(a,25),h=u+d+dq(a,l,c)+pq[f]+Uo[f]|0,m=(Xs(r,2)^Xs(r,13)^Xs(r,22))+hq(r,s,i)|0;u=c,c=l,l=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,s,i,o,a,l,c,u)}roundClean(){Uo.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const WP=u1(()=>new mq),iy=BigInt(2**32-1),f1=BigInt(32);function KP(n,e=!1){return e?{h:Number(n&iy),l:Number(n>>f1&iy)}:{h:Number(n>>f1&iy)|0,l:Number(n&iy)|0}}function QP(n,e=!1){let t=new Uint32Array(n.length),r=new Uint32Array(n.length);for(let s=0;s<n.length;s++){const{h:i,l:o}=KP(n[s],e);[t[s],r[s]]=[i,o]}return[t,r]}const gq=(n,e)=>BigInt(n>>>0)<<f1|BigInt(e>>>0),yq=(n,e,t)=>n>>>t,bq=(n,e,t)=>n<<32-t|e>>>t,wq=(n,e,t)=>n>>>t|e<<32-t,Aq=(n,e,t)=>n<<32-t|e>>>t,vq=(n,e,t)=>n<<64-t|e>>>t-32,xq=(n,e,t)=>n>>>t-32|e<<64-t,Eq=(n,e)=>e,Cq=(n,e)=>n,JP=(n,e,t)=>n<<t|e>>>32-t,qP=(n,e,t)=>e<<t|n>>>32-t,YP=(n,e,t)=>e<<t-32|n>>>64-t,XP=(n,e,t)=>n<<t-32|e>>>64-t;function kq(n,e,t,r){const s=(e>>>0)+(r>>>0);return{h:n+t+(s/2**32|0)|0,l:s|0}}const Ze={fromBig:KP,split:QP,toBig:gq,shrSH:yq,shrSL:bq,rotrSH:wq,rotrSL:Aq,rotrBH:vq,rotrBL:xq,rotr32H:Eq,rotr32L:Cq,rotlSH:JP,rotlSL:qP,rotlBH:YP,rotlBL:XP,add:kq,add3L:(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),add3H:(n,e,t,r)=>e+t+r+(n/2**32|0)|0,add4L:(n,e,t,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0),add4H:(n,e,t,r,s)=>e+t+r+s+(n/2**32|0)|0,add5H:(n,e,t,r,s,i)=>e+t+r+s+i+(n/2**32|0)|0,add5L:(n,e,t,r,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(r>>>0)+(s>>>0)},[Sq,Tq]=Ze.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Vo=new Uint32Array(80),Ho=new Uint32Array(80);class Oq extends GP{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:f,Fl:d,Gh:h,Gl:p,Hh:m,Hl:y}=this;return[e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y]}set(e,t,r,s,i,o,a,l,c,u,f,d,h,p,m,y){this.Ah=e|0,this.Al=t|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=f|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=m|0,this.Hl=y|0}process(e,t){for(let A=0;A<16;A++,t+=4)Vo[A]=e.getUint32(t),Ho[A]=e.getUint32(t+=4);for(let A=16;A<80;A++){const w=Vo[A-15]|0,x=Ho[A-15]|0,C=Ze.rotrSH(w,x,1)^Ze.rotrSH(w,x,8)^Ze.shrSH(w,x,7),S=Ze.rotrSL(w,x,1)^Ze.rotrSL(w,x,8)^Ze.shrSL(w,x,7),M=Vo[A-2]|0,O=Ho[A-2]|0,R=Ze.rotrSH(M,O,19)^Ze.rotrBH(M,O,61)^Ze.shrSH(M,O,6),D=Ze.rotrSL(M,O,19)^Ze.rotrBL(M,O,61)^Ze.shrSL(M,O,6),_=Ze.add4L(S,D,Ho[A-7],Ho[A-16]),U=Ze.add4H(_,C,R,Vo[A-7],Vo[A-16]);Vo[A]=U|0,Ho[A]=_|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:f,El:d,Fh:h,Fl:p,Gh:m,Gl:y,Hh:b,Hl:v}=this;for(let A=0;A<80;A++){const w=Ze.rotrSH(f,d,14)^Ze.rotrSH(f,d,18)^Ze.rotrBH(f,d,41),x=Ze.rotrSL(f,d,14)^Ze.rotrSL(f,d,18)^Ze.rotrBL(f,d,41),C=f&h^~f&m,S=d&p^~d&y,M=Ze.add5L(v,x,S,Tq[A],Ho[A]),O=Ze.add5H(M,b,w,C,Sq[A],Vo[A]),R=M|0,D=Ze.rotrSH(r,s,28)^Ze.rotrBH(r,s,34)^Ze.rotrBH(r,s,39),_=Ze.rotrSL(r,s,28)^Ze.rotrBL(r,s,34)^Ze.rotrBL(r,s,39),U=r&i^r&a^i&a,K=s&o^s&l^o&l;b=m|0,v=y|0,m=h|0,y=p|0,h=f|0,p=d|0,{h:f,l:d}=Ze.add(c|0,u|0,O|0,R|0),c=a|0,u=l|0,a=i|0,l=o|0,i=r|0,o=s|0;const B=Ze.add3L(R,_,K);r=Ze.add3H(B,O,D,U),s=B|0}({h:r,l:s}=Ze.add(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ze.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=Ze.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=Ze.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:f,l:d}=Ze.add(this.Eh|0,this.El|0,f|0,d|0),{h,l:p}=Ze.add(this.Fh|0,this.Fl|0,h|0,p|0),{h:m,l:y}=Ze.add(this.Gh|0,this.Gl|0,m|0,y|0),{h:b,l:v}=Ze.add(this.Hh|0,this.Hl|0,b|0,v|0),this.set(r,s,i,o,a,l,c,u,f,d,h,p,m,y,b,v)}roundClean(){Vo.fill(0),Ho.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Nq=u1(()=>new Oq);function Mq(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const ZP=Mq();ZP.crypto||ZP.msCrypto;function Rq(n){switch(n){case"sha256":return WP.create();case"sha512":return Nq.create()}z(!1,"invalid hashing algorithm name","algorithm",n)}const[eD,tD,nD]=[[],[],[]],Pq=BigInt(0),th=BigInt(1),Dq=BigInt(2),Iq=BigInt(7),Lq=BigInt(256),Bq=BigInt(113);for(let n=0,e=th,t=1,r=0;n<24;n++){[t,r]=[r,(2*t+3*r)%5],eD.push(2*(5*r+t)),tD.push((n+1)*(n+2)/2%64);let s=Pq;for(let i=0;i<7;i++)e=(e<<th^(e>>Iq)*Bq)%Lq,e&Dq&&(s^=th<<(th<<BigInt(i))-th);nD.push(s)}const[_q,Fq]=QP(nD,!0),rD=(n,e,t)=>t>32?YP(n,e,t):JP(n,e,t),sD=(n,e,t)=>t>32?XP(n,e,t):qP(n,e,t);function jq(n,e=24){const t=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,c=t[l],u=t[l+1],f=rD(c,u,1)^t[a],d=sD(c,u,1)^t[a+1];for(let h=0;h<50;h+=10)n[o+h]^=f,n[o+h+1]^=d}let s=n[2],i=n[3];for(let o=0;o<24;o++){const a=tD[o],l=rD(s,i,a),c=sD(s,i,a),u=eD[o];s=n[u],i=n[u+1],n[u]=l,n[u+1]=c}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=_q[r],n[1]^=Fq[r]}t.fill(0)}class d1 extends c1{constructor(e,t,r,s=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ry(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=aq(this.state)}keccak(){jq(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){au(this);const{blockLen:t,state:r}=this;e=sy(e);const s=e.length;for(let i=0;i<s;){const o=Math.min(t-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:s}=this;e[r]^=t,t&128&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){au(this,!1),o1(e),this.finish();const t=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(t.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ry(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(VP(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new d1(t,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Uq=((n,e,t)=>u1(()=>new d1(e,n,t)))(1,136,256/8);let iD=!1;const oD=function(n){return Uq(n)};let aD=oD;function Xt(n){const e=ct(n,"data");return we(aD(e))}Xt._=oD,Xt.lock=function(){iD=!0},Xt.register=function(n){if(iD)throw new TypeError("keccak256 is locked");aD=n},Object.freeze(Xt);const lD=function(n){return Rq("sha256").update(n).digest()};let cD=lD,uD=!1;function lu(n){const e=ct(n,"data");return we(cD(e))}lu._=lD,lu.lock=function(){uD=!0},lu.register=function(n){if(uD)throw new Error("sha256 is locked");cD=n},Object.freeze(lu),Object.freeze(lu);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const fD=BigInt(0),oy=BigInt(1),Vq=BigInt(2),ay=n=>n instanceof Uint8Array,Hq=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function cu(n){if(!ay(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Hq[n[t]];return e}function dD(n){const e=n.toString(16);return e.length&1?`0${e}`:e}function h1(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return BigInt(n===""?"0":`0x${n}`)}function uu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const t=new Uint8Array(e/2);for(let r=0;r<t.length;r++){const s=r*2,i=n.slice(s,s+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");t[r]=o}return t}function cl(n){return h1(cu(n))}function p1(n){if(!ay(n))throw new Error("Uint8Array expected");return h1(cu(Uint8Array.from(n).reverse()))}function fu(n,e){return uu(n.toString(16).padStart(e*2,"0"))}function m1(n,e){return fu(n,e).reverse()}function zq(n){return uu(dD(n))}function bs(n,e,t){let r;if(typeof e=="string")try{r=uu(e)}catch(i){throw new Error(`${n} must be valid hex string, got "${e}". Cause: ${i}`)}else if(ay(e))r=Uint8Array.from(e);else throw new Error(`${n} must be hex string or Uint8Array`);const s=r.length;if(typeof t=="number"&&s!==t)throw new Error(`${n} expected ${t} bytes, got ${s}`);return r}function nh(...n){const e=new Uint8Array(n.reduce((r,s)=>r+s.length,0));let t=0;return n.forEach(r=>{if(!ay(r))throw new Error("Uint8Array expected");e.set(r,t),t+=r.length}),e}function $q(n,e){if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}function Gq(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Wq(n){let e;for(e=0;n>fD;n>>=oy,e+=1);return e}function Kq(n,e){return n>>BigInt(e)&oy}const Qq=(n,e,t)=>n|(t?oy:fD)<<BigInt(e),g1=n=>(Vq<<BigInt(n-1))-oy,y1=n=>new Uint8Array(n),hD=n=>Uint8Array.from(n);function pD(n,e,t){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof t!="function")throw new Error("hmacFn must be a function");let r=y1(n),s=y1(n),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...f)=>t(s,r,...f),l=(f=y1())=>{s=a(hD([0]),f),r=a(),f.length!==0&&(s=a(hD([1]),f),r=a())},c=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const d=[];for(;f<e;){r=a();const h=r.slice();d.push(h),f+=r.length}return nh(...d)};return(f,d)=>{o(),l(f);let h;for(;!(h=d(c()));)l();return o(),h}}const Jq={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||n instanceof Uint8Array,isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,e)=>e.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function rh(n,e,t={}){const r=(s,i,o)=>{const a=Jq[i];if(typeof a!="function")throw new Error(`Invalid validator "${i}", expected function`);const l=n[s];if(!(o&&l===void 0)&&!a(l,n))throw new Error(`Invalid param ${String(s)}=${l} (${typeof l}), expected ${i}`)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(t))r(s,i,!0);return n}const qq=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Kq,bitLen:Wq,bitMask:g1,bitSet:Qq,bytesToHex:cu,bytesToNumberBE:cl,bytesToNumberLE:p1,concatBytes:nh,createHmacDrbg:pD,ensureBytes:bs,equalBytes:$q,hexToBytes:uu,hexToNumber:h1,numberToBytesBE:fu,numberToBytesLE:m1,numberToHexUnpadded:dD,numberToVarBytesBE:zq,utf8ToBytes:Gq,validateObject:rh},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hn=BigInt(0),$t=BigInt(1),ul=BigInt(2),Yq=BigInt(3),b1=BigInt(4),mD=BigInt(5),gD=BigInt(8);BigInt(9),BigInt(16);function or(n,e){const t=n%e;return t>=hn?t:e+t}function Xq(n,e,t){if(t<=hn||e<hn)throw new Error("Expected power/modulo > 0");if(t===$t)return hn;let r=$t;for(;e>hn;)e&$t&&(r=r*n%t),n=n*n%t,e>>=$t;return r}function Wr(n,e,t){let r=n;for(;e-- >hn;)r*=r,r%=t;return r}function w1(n,e){if(n===hn||e<=hn)throw new Error(`invert: expected positive integers, got n=${n} mod=${e}`);let t=or(n,e),r=e,s=hn,i=$t;for(;t!==hn;){const a=r/t,l=r%t,c=s-i*a;r=t,t=l,s=i,i=c}if(r!==$t)throw new Error("invert: does not exist");return or(s,e)}function Zq(n){const e=(n-$t)/ul;let t,r,s;for(t=n-$t,r=0;t%ul===hn;t/=ul,r++);for(s=ul;s<n&&Xq(s,e,n)!==n-$t;s++);if(r===1){const o=(n+$t)/b1;return function(l,c){const u=l.pow(c,o);if(!l.eql(l.sqr(u),c))throw new Error("Cannot find square root");return u}}const i=(t+$t)/ul;return function(a,l){if(a.pow(l,e)===a.neg(a.ONE))throw new Error("Cannot find square root");let c=r,u=a.pow(a.mul(a.ONE,s),t),f=a.pow(l,i),d=a.pow(l,t);for(;!a.eql(d,a.ONE);){if(a.eql(d,a.ZERO))return a.ZERO;let h=1;for(let m=a.sqr(d);h<c&&!a.eql(m,a.ONE);h++)m=a.sqr(m);const p=a.pow(u,$t<<BigInt(c-h-1));u=a.sqr(p),f=a.mul(f,p),d=a.mul(d,u),c=h}return f}}function eY(n){if(n%b1===Yq){const e=(n+$t)/b1;return function(r,s){const i=r.pow(s,e);if(!r.eql(r.sqr(i),s))throw new Error("Cannot find square root");return i}}if(n%gD===mD){const e=(n-mD)/gD;return function(r,s){const i=r.mul(s,ul),o=r.pow(i,e),a=r.mul(s,o),l=r.mul(r.mul(a,ul),o),c=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(c),s))throw new Error("Cannot find square root");return c}}return Zq(n)}const tY=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function nY(n){const e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=tY.reduce((r,s)=>(r[s]="function",r),e);return rh(n,t)}function rY(n,e,t){if(t<hn)throw new Error("Expected power > 0");if(t===hn)return n.ONE;if(t===$t)return e;let r=n.ONE,s=e;for(;t>hn;)t&$t&&(r=n.mul(r,s)),s=n.sqr(s),t>>=$t;return r}function sY(n,e){const t=new Array(e.length),r=e.reduce((i,o,a)=>n.is0(o)?i:(t[a]=i,n.mul(i,o)),n.ONE),s=n.inv(r);return e.reduceRight((i,o,a)=>n.is0(o)?i:(t[a]=n.mul(i,t[a]),n.mul(i,o)),s),t}function yD(n,e){const t=e!==void 0?e:n.toString(2).length,r=Math.ceil(t/8);return{nBitLength:t,nByteLength:r}}function iY(n,e,t=!1,r={}){if(n<=hn)throw new Error(`Expected Field ORDER > 0, got ${n}`);const{nBitLength:s,nByteLength:i}=yD(n,e);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=eY(n),a=Object.freeze({ORDER:n,BITS:s,BYTES:i,MASK:g1(s),ZERO:hn,ONE:$t,create:l=>or(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof l}`);return hn<=l&&l<n},is0:l=>l===hn,isOdd:l=>(l&$t)===$t,neg:l=>or(-l,n),eql:(l,c)=>l===c,sqr:l=>or(l*l,n),add:(l,c)=>or(l+c,n),sub:(l,c)=>or(l-c,n),mul:(l,c)=>or(l*c,n),pow:(l,c)=>rY(a,l,c),div:(l,c)=>or(l*w1(c,n),n),sqrN:l=>l*l,addN:(l,c)=>l+c,subN:(l,c)=>l-c,mulN:(l,c)=>l*c,inv:l=>w1(l,n),sqrt:r.sqrt||(l=>o(a,l)),invertBatch:l=>sY(a,l),cmov:(l,c,u)=>u?c:l,toBytes:l=>t?m1(l,i):fu(l,i),fromBytes:l=>{if(l.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${l.length}`);return t?p1(l):cl(l)}});return Object.freeze(a)}function bD(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const e=n.toString(2).length;return Math.ceil(e/8)}function wD(n){const e=bD(n);return e+Math.ceil(e/2)}function oY(n,e,t=!1){const r=n.length,s=bD(e),i=wD(e);if(r<16||r<i||r>1024)throw new Error(`expected ${i}-1024 bytes of input, got ${r}`);const o=t?cl(n):p1(n),a=or(o,e-$t)+$t;return t?m1(a,s):fu(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const aY=BigInt(0),A1=BigInt(1);function lY(n,e){const t=(s,i)=>{const o=i.negate();return s?o:i},r=s=>{const i=Math.ceil(e/s)+1,o=2**(s-1);return{windows:i,windowSize:o}};return{constTimeNegate:t,unsafeLadder(s,i){let o=n.ZERO,a=s;for(;i>aY;)i&A1&&(o=o.add(a)),a=a.double(),i>>=A1;return o},precomputeWindow(s,i){const{windows:o,windowSize:a}=r(i),l=[];let c=s,u=c;for(let f=0;f<o;f++){u=c,l.push(u);for(let d=1;d<a;d++)u=u.add(c),l.push(u);c=u.double()}return l},wNAF(s,i,o){const{windows:a,windowSize:l}=r(s);let c=n.ZERO,u=n.BASE;const f=BigInt(2**s-1),d=2**s,h=BigInt(s);for(let p=0;p<a;p++){const m=p*l;let y=Number(o&f);o>>=h,y>l&&(y-=d,o+=A1);const b=m,v=m+Math.abs(y)-1,A=p%2!==0,w=y<0;y===0?u=u.add(t(A,i[b])):c=c.add(t(w,i[v]))}return{p:c,f:u}},wNAFCached(s,i,o,a){const l=s._WINDOW_SIZE||1;let c=i.get(s);return c||(c=this.precomputeWindow(s,l),l!==1&&i.set(s,a(c))),this.wNAF(l,c,o)}}}function AD(n){return nY(n.Fp),rh(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...yD(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function cY(n){const e=AD(n);rh(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:t,Fp:r,a:s}=e;if(t){if(!r.eql(s,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof t!="object"||typeof t.beta!="bigint"||typeof t.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...e})}const{bytesToNumberBE:uY,hexToBytes:fY}=qq,fl={Err:class extends Error{constructor(e=""){super(e)}},_parseInt(n){const{Err:e}=fl;if(n.length<2||n[0]!==2)throw new e("Invalid signature integer tag");const t=n[1],r=n.subarray(2,t+2);if(!t||r.length!==t)throw new e("Invalid signature integer: wrong length");if(r[0]&128)throw new e("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new e("Invalid signature integer: unnecessary leading zero");return{d:uY(r),l:n.subarray(t+2)}},toSig(n){const{Err:e}=fl,t=typeof n=="string"?fY(n):n;if(!(t instanceof Uint8Array))throw new Error("ui8a expected");let r=t.length;if(r<2||t[0]!=48)throw new e("Invalid signature tag");if(t[1]!==r-2)throw new e("Invalid signature: incorrect length");const{d:s,l:i}=fl._parseInt(t.subarray(2)),{d:o,l:a}=fl._parseInt(i);if(a.length)throw new e("Invalid signature: left bytes after parsing");return{r:s,s:o}},hexFromSig(n){const e=c=>Number.parseInt(c[0],16)&8?"00"+c:c,t=c=>{const u=c.toString(16);return u.length&1?`0${u}`:u},r=e(t(n.s)),s=e(t(n.r)),i=r.length/2,o=s.length/2,a=t(i),l=t(o);return`30${t(o+i+4)}02${l}${s}02${a}${r}`}},Pi=BigInt(0),Kr=BigInt(1);BigInt(2);const vD=BigInt(3);BigInt(4);function dY(n){const e=cY(n),{Fp:t}=e,r=e.toBytes||((p,m,y)=>{const b=m.toAffine();return nh(Uint8Array.from([4]),t.toBytes(b.x),t.toBytes(b.y))}),s=e.fromBytes||(p=>{const m=p.subarray(1),y=t.fromBytes(m.subarray(0,t.BYTES)),b=t.fromBytes(m.subarray(t.BYTES,2*t.BYTES));return{x:y,y:b}});function i(p){const{a:m,b:y}=e,b=t.sqr(p),v=t.mul(b,p);return t.add(t.add(v,t.mul(p,m)),y)}if(!t.eql(t.sqr(e.Gy),i(e.Gx)))throw new Error("bad generator point: equation left != right");function o(p){return typeof p=="bigint"&&Pi<p&&p<e.n}function a(p){if(!o(p))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function l(p){const{allowedPrivateKeyLengths:m,nByteLength:y,wrapPrivateKey:b,n:v}=e;if(m&&typeof p!="bigint"){if(p instanceof Uint8Array&&(p=cu(p)),typeof p!="string"||!m.includes(p.length))throw new Error("Invalid key");p=p.padStart(y*2,"0")}let A;try{A=typeof p=="bigint"?p:cl(bs("private key",p,y))}catch{throw new Error(`private key must be ${y} bytes, hex or bigint, not ${typeof p}`)}return b&&(A=or(A,v)),a(A),A}const c=new Map;function u(p){if(!(p instanceof f))throw new Error("ProjectivePoint expected")}class f{constructor(m,y,b){if(this.px=m,this.py=y,this.pz=b,m==null||!t.isValid(m))throw new Error("x required");if(y==null||!t.isValid(y))throw new Error("y required");if(b==null||!t.isValid(b))throw new Error("z required")}static fromAffine(m){const{x:y,y:b}=m||{};if(!m||!t.isValid(y)||!t.isValid(b))throw new Error("invalid affine point");if(m instanceof f)throw new Error("projective point not allowed");const v=A=>t.eql(A,t.ZERO);return v(y)&&v(b)?f.ZERO:new f(y,b,t.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){const y=t.invertBatch(m.map(b=>b.pz));return m.map((b,v)=>b.toAffine(y[v])).map(f.fromAffine)}static fromHex(m){const y=f.fromAffine(s(bs("pointHex",m)));return y.assertValidity(),y}static fromPrivateKey(m){return f.BASE.multiply(l(m))}_setWindowSize(m){this._WINDOW_SIZE=m,c.delete(this)}assertValidity(){if(this.is0()){if(e.allowInfinityPoint&&!t.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:m,y}=this.toAffine();if(!t.isValid(m)||!t.isValid(y))throw new Error("bad point: x or y not FE");const b=t.sqr(y),v=i(m);if(!t.eql(b,v))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:m}=this.toAffine();if(t.isOdd)return!t.isOdd(m);throw new Error("Field doesn't support isOdd")}equals(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m,C=t.eql(t.mul(y,x),t.mul(A,v)),S=t.eql(t.mul(b,x),t.mul(w,v));return C&&S}negate(){return new f(this.px,t.neg(this.py),this.pz)}double(){const{a:m,b:y}=e,b=t.mul(y,vD),{px:v,py:A,pz:w}=this;let x=t.ZERO,C=t.ZERO,S=t.ZERO,M=t.mul(v,v),O=t.mul(A,A),R=t.mul(w,w),D=t.mul(v,A);return D=t.add(D,D),S=t.mul(v,w),S=t.add(S,S),x=t.mul(m,S),C=t.mul(b,R),C=t.add(x,C),x=t.sub(O,C),C=t.add(O,C),C=t.mul(x,C),x=t.mul(D,x),S=t.mul(b,S),R=t.mul(m,R),D=t.sub(M,R),D=t.mul(m,D),D=t.add(D,S),S=t.add(M,M),M=t.add(S,M),M=t.add(M,R),M=t.mul(M,D),C=t.add(C,M),R=t.mul(A,w),R=t.add(R,R),M=t.mul(R,D),x=t.sub(x,M),S=t.mul(R,O),S=t.add(S,S),S=t.add(S,S),new f(x,C,S)}add(m){u(m);const{px:y,py:b,pz:v}=this,{px:A,py:w,pz:x}=m;let C=t.ZERO,S=t.ZERO,M=t.ZERO;const O=e.a,R=t.mul(e.b,vD);let D=t.mul(y,A),_=t.mul(b,w),U=t.mul(v,x),K=t.add(y,b),B=t.add(A,w);K=t.mul(K,B),B=t.add(D,_),K=t.sub(K,B),B=t.add(y,v);let $=t.add(A,x);return B=t.mul(B,$),$=t.add(D,U),B=t.sub(B,$),$=t.add(b,v),C=t.add(w,x),$=t.mul($,C),C=t.add(_,U),$=t.sub($,C),M=t.mul(O,B),C=t.mul(R,U),M=t.add(C,M),C=t.sub(_,M),M=t.add(_,M),S=t.mul(C,M),_=t.add(D,D),_=t.add(_,D),U=t.mul(O,U),B=t.mul(R,B),_=t.add(_,U),U=t.sub(D,U),U=t.mul(O,U),B=t.add(B,U),D=t.mul(_,B),S=t.add(S,D),D=t.mul($,B),C=t.mul(K,C),C=t.sub(C,D),D=t.mul(K,_),M=t.mul($,M),M=t.add(M,D),new f(C,S,M)}subtract(m){return this.add(m.negate())}is0(){return this.equals(f.ZERO)}wNAF(m){return h.wNAFCached(this,c,m,y=>{const b=t.invertBatch(y.map(v=>v.pz));return y.map((v,A)=>v.toAffine(b[A])).map(f.fromAffine)})}multiplyUnsafe(m){const y=f.ZERO;if(m===Pi)return y;if(a(m),m===Kr)return this;const{endo:b}=e;if(!b)return h.unsafeLadder(this,m);let{k1neg:v,k1:A,k2neg:w,k2:x}=b.splitScalar(m),C=y,S=y,M=this;for(;A>Pi||x>Pi;)A&Kr&&(C=C.add(M)),x&Kr&&(S=S.add(M)),M=M.double(),A>>=Kr,x>>=Kr;return v&&(C=C.negate()),w&&(S=S.negate()),S=new f(t.mul(S.px,b.beta),S.py,S.pz),C.add(S)}multiply(m){a(m);let y=m,b,v;const{endo:A}=e;if(A){const{k1neg:w,k1:x,k2neg:C,k2:S}=A.splitScalar(y);let{p:M,f:O}=this.wNAF(x),{p:R,f:D}=this.wNAF(S);M=h.constTimeNegate(w,M),R=h.constTimeNegate(C,R),R=new f(t.mul(R.px,A.beta),R.py,R.pz),b=M.add(R),v=O.add(D)}else{const{p:w,f:x}=this.wNAF(y);b=w,v=x}return f.normalizeZ([b,v])[0]}multiplyAndAddUnsafe(m,y,b){const v=f.BASE,A=(x,C)=>C===Pi||C===Kr||!x.equals(v)?x.multiplyUnsafe(C):x.multiply(C),w=A(this,y).add(A(m,b));return w.is0()?void 0:w}toAffine(m){const{px:y,py:b,pz:v}=this,A=this.is0();m==null&&(m=A?t.ONE:t.inv(v));const w=t.mul(y,m),x=t.mul(b,m),C=t.mul(v,m);if(A)return{x:t.ZERO,y:t.ZERO};if(!t.eql(C,t.ONE))throw new Error("invZ was invalid");return{x:w,y:x}}isTorsionFree(){const{h:m,isTorsionFree:y}=e;if(m===Kr)return!0;if(y)return y(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:m,clearCofactor:y}=e;return m===Kr?this:y?y(f,this):this.multiplyUnsafe(e.h)}toRawBytes(m=!0){return this.assertValidity(),r(f,this,m)}toHex(m=!0){return cu(this.toRawBytes(m))}}f.BASE=new f(e.Gx,e.Gy,t.ONE),f.ZERO=new f(t.ZERO,t.ONE,t.ZERO);const d=e.nBitLength,h=lY(f,e.endo?Math.ceil(d/2):d);return{CURVE:e,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:i,isWithinCurveOrder:o}}function hY(n){const e=AD(n);return rh(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}function pY(n){const e=hY(n),{Fp:t,n:r}=e,s=t.BYTES+1,i=2*t.BYTES+1;function o(B){return Pi<B&&B<t.ORDER}function a(B){return or(B,r)}function l(B){return w1(B,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:f,isWithinCurveOrder:d}=dY({...e,toBytes(B,$,q){const ne=$.toAffine(),Z=t.toBytes(ne.x),me=nh;return q?me(Uint8Array.from([$.hasEvenY()?2:3]),Z):me(Uint8Array.from([4]),Z,t.toBytes(ne.y))},fromBytes(B){const $=B.length,q=B[0],ne=B.subarray(1);if($===s&&(q===2||q===3)){const Z=cl(ne);if(!o(Z))throw new Error("Point is not on curve");const me=f(Z);let Ce=t.sqrt(me);const De=(Ce&Kr)===Kr;return(q&1)===1!==De&&(Ce=t.neg(Ce)),{x:Z,y:Ce}}else if($===i&&q===4){const Z=t.fromBytes(ne.subarray(0,t.BYTES)),me=t.fromBytes(ne.subarray(t.BYTES,2*t.BYTES));return{x:Z,y:me}}else throw new Error(`Point of length ${$} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}}),h=B=>cu(fu(B,e.nByteLength));function p(B){const $=r>>Kr;return B>$}function m(B){return p(B)?a(-B):B}const y=(B,$,q)=>cl(B.slice($,q));class b{constructor($,q,ne){this.r=$,this.s=q,this.recovery=ne,this.assertValidity()}static fromCompact($){const q=e.nByteLength;return $=bs("compactSignature",$,q*2),new b(y($,0,q),y($,q,2*q))}static fromDER($){const{r:q,s:ne}=fl.toSig(bs("DER",$));return new b(q,ne)}assertValidity(){if(!d(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!d(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit($){return new b(this.r,this.s,$)}recoverPublicKey($){const{r:q,s:ne,recovery:Z}=this,me=S(bs("msgHash",$));if(Z==null||![0,1,2,3].includes(Z))throw new Error("recovery id invalid");const Ce=Z===2||Z===3?q+e.n:q;if(Ce>=t.ORDER)throw new Error("recovery id 2 or 3 invalid");const De=Z&1?"03":"02",ke=c.fromHex(De+h(Ce)),Ee=l(Ce),Ve=a(-me*Ee),je=a(ne*Ee),He=c.BASE.multiplyAndAddUnsafe(ke,Ve,je);if(!He)throw new Error("point at infinify");return He.assertValidity(),He}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new b(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return uu(this.toDERHex())}toDERHex(){return fl.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return uu(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const v={isValidPrivateKey(B){try{return u(B),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const B=wD(e.n);return oY(e.randomBytes(B),e.n)},precompute(B=8,$=c.BASE){return $._setWindowSize(B),$.multiply(BigInt(3)),$}};function A(B,$=!0){return c.fromPrivateKey(B).toRawBytes($)}function w(B){const $=B instanceof Uint8Array,q=typeof B=="string",ne=($||q)&&B.length;return $?ne===s||ne===i:q?ne===2*s||ne===2*i:B instanceof c}function x(B,$,q=!0){if(w(B))throw new Error("first arg must be private key");if(!w($))throw new Error("second arg must be public key");return c.fromHex($).multiply(u(B)).toRawBytes(q)}const C=e.bits2int||function(B){const $=cl(B),q=B.length*8-e.nBitLength;return q>0?$>>BigInt(q):$},S=e.bits2int_modN||function(B){return a(C(B))},M=g1(e.nBitLength);function O(B){if(typeof B!="bigint")throw new Error("bigint expected");if(!(Pi<=B&&B<M))throw new Error(`bigint expected < 2^${e.nBitLength}`);return fu(B,e.nByteLength)}function R(B,$,q=D){if(["recovered","canonical"].some(et=>et in q))throw new Error("sign() legacy options not supported");const{hash:ne,randomBytes:Z}=e;let{lowS:me,prehash:Ce,extraEntropy:De}=q;me==null&&(me=!0),B=bs("msgHash",B),Ce&&(B=bs("prehashed msgHash",ne(B)));const ke=S(B),Ee=u($),Ve=[O(Ee),O(ke)];if(De!=null){const et=De===!0?Z(t.BYTES):De;Ve.push(bs("extraEntropy",et))}const je=nh(...Ve),He=ke;function Be(et){const le=C(et);if(!d(le))return;const ze=l(le),ae=c.BASE.multiply(le).toAffine(),be=a(ae.x);if(be===Pi)return;const _e=a(ze*a(He+be*Ee));if(_e===Pi)return;let H=(ae.x===be?0:2)|Number(ae.y&Kr),Q=_e;return me&&p(_e)&&(Q=m(_e),H^=1),new b(be,Q,H)}return{seed:je,k2sig:Be}}const D={lowS:e.lowS,prehash:!1},_={lowS:e.lowS,prehash:!1};function U(B,$,q=D){const{seed:ne,k2sig:Z}=R(B,$,q),me=e;return pD(me.hash.outputLen,me.nByteLength,me.hmac)(ne,Z)}c.BASE._setWindowSize(8);function K(B,$,q,ne=_){var ae;const Z=B;if($=bs("msgHash",$),q=bs("publicKey",q),"strict"in ne)throw new Error("options.strict was renamed to lowS");const{lowS:me,prehash:Ce}=ne;let De,ke;try{if(typeof Z=="string"||Z instanceof Uint8Array)try{De=b.fromDER(Z)}catch(be){if(!(be instanceof fl.Err))throw be;De=b.fromCompact(Z)}else if(typeof Z=="object"&&typeof Z.r=="bigint"&&typeof Z.s=="bigint"){const{r:be,s:_e}=Z;De=new b(be,_e)}else throw new Error("PARSE");ke=c.fromHex(q)}catch(be){if(be.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(me&&De.hasHighS())return!1;Ce&&($=e.hash($));const{r:Ee,s:Ve}=De,je=S($),He=l(Ve),Be=a(je*He),et=a(Ee*He),le=(ae=c.BASE.multiplyAndAddUnsafe(ke,Be,et))==null?void 0:ae.toAffine();return le?a(le.x)===Ee:!1}return{CURVE:e,getPublicKey:A,getSharedSecret:x,sign:U,verify:K,ProjectivePoint:c,Signature:b,utils:v}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function mY(n){return{hash:n,hmac:(e,...t)=>$P(n,e,cq(...t)),randomBytes:uq}}function gY(n,e){const t=r=>pY({...n,...mY(r)});return Object.freeze({...t(e),create:t})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const xD=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ED=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),yY=BigInt(1),v1=BigInt(2),CD=(n,e)=>(n+e/v1)/e;function bY(n){const e=xD,t=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),c=n*n*n%e,u=c*c*n%e,f=Wr(u,t,e)*u%e,d=Wr(f,t,e)*u%e,h=Wr(d,v1,e)*c%e,p=Wr(h,s,e)*h%e,m=Wr(p,i,e)*p%e,y=Wr(m,a,e)*m%e,b=Wr(y,l,e)*y%e,v=Wr(b,a,e)*m%e,A=Wr(v,t,e)*u%e,w=Wr(A,o,e)*p%e,x=Wr(w,r,e)*c%e,C=Wr(x,v1,e);if(!x1.eql(x1.sqr(C),n))throw new Error("Cannot find square root");return C}const x1=iY(xD,void 0,void 0,{sqrt:bY}),zo=gY({a:BigInt(0),b:BigInt(7),Fp:x1,n:ED,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const e=ED,t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-yY*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=t,o=BigInt("0x100000000000000000000000000000000"),a=CD(i*n,e),l=CD(-r*n,e);let c=or(n-a*t-l*s,e),u=or(-a*r-l*i,e);const f=c>o,d=u>o;if(f&&(c=e-c),d&&(u=e-u),c>o||u>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:f,k1:c,k2neg:d,k2:u}}}},WP);BigInt(0),zo.ProjectivePoint;const sh="0x0000000000000000000000000000000000000000",kD="0x0000000000000000000000000000000000000000000000000000000000000000",SD=BigInt(0),TD=BigInt(1),OD=BigInt(2),ND=BigInt(27),MD=BigInt(28),ly=BigInt(35),du={};function RD(n){return il(Hn(n),32)}const Cs=class Cs{constructor(e,t,r,s){J(this,Vu);J(this,Hu);J(this,zu);J(this,_l);qg(e,du,"Signature"),L(this,Vu,t),L(this,Hu,r),L(this,zu,s),L(this,_l,null)}get r(){return T(this,Vu)}set r(e){z(ru(e)===32,"invalid r","value",e),L(this,Vu,we(e))}get s(){return T(this,Hu)}set s(e){z(ru(e)===32,"invalid s","value",e);const t=we(e);z(parseInt(t.substring(0,3))<8,"non-canonical s","value",t),L(this,Hu,t)}get v(){return T(this,zu)}set v(e){const t=Je(e,"value");z(t===27||t===28,"invalid v","v",e),L(this,zu,t)}get networkV(){return T(this,_l)}get legacyChainId(){const e=this.networkV;return e==null?null:Cs.getChainId(e)}get yParity(){return this.v===27?0:1}get yParityAndS(){const e=ct(this.s);return this.yParity&&(e[0]|=128),we(e)}get compactSerialized(){return zt([this.r,this.yParityAndS])}get serialized(){return zt([this.r,this.s,this.yParity?"0x1c":"0x1b"])}[Symbol.for("nodejs.util.inspect.custom")](){return`Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`}clone(){const e=new Cs(du,this.r,this.s,this.v);return this.networkV&&L(e,_l,this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:e!=null?e.toString():null,r:this.r,s:this.s,v:this.v}}static getChainId(e){const t=xe(e,"v");return t==ND||t==MD?SD:(z(t>=ly,"invalid EIP-155 v","v",e),(t-ly)/OD)}static getChainIdV(e,t){return xe(e)*OD+BigInt(35+t-27)}static getNormalizedV(e){const t=xe(e);return t===SD||t===ND?27:t===TD||t===MD?28:(z(t>=ly,"invalid v","v",e),t&TD?27:28)}static from(e){function t(c,u){z(c,u,"signature",e)}if(e==null)return new Cs(du,kD,kD,27);if(typeof e=="string"){const c=ct(e,"signature");if(c.length===64){const u=we(c.slice(0,32)),f=c.slice(32,64),d=f[0]&128?28:27;return f[0]&=127,new Cs(du,u,we(f),d)}if(c.length===65){const u=we(c.slice(0,32)),f=c.slice(32,64);t((f[0]&128)===0,"non-canonical s");const d=Cs.getNormalizedV(c[64]);return new Cs(du,u,we(f),d)}t(!1,"invalid raw signature length")}if(e instanceof Cs)return e.clone();const r=e.r;t(r!=null,"missing r");const s=RD(r),i=function(c,u){if(c!=null)return RD(c);if(u!=null){t(Ct(u,32),"invalid yParityAndS");const f=ct(u);return f[0]&=127,we(f)}t(!1,"missing s")}(e.s,e.yParityAndS);t((ct(i)[0]&128)==0,"non-canonical s");const{networkV:o,v:a}=function(c,u,f){if(c!=null){const d=xe(c);return{networkV:d>=ly?d:void 0,v:Cs.getNormalizedV(d)}}if(u!=null)return t(Ct(u,32),"invalid yParityAndS"),{v:ct(u)[0]&128?28:27};if(f!=null){switch(Je(f,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),l=new Cs(du,s,i,a);return o&&L(l,_l,o),t(e.yParity==null||Je(e.yParity,"sig.yParity")===l.yParity,"yParity mismatch"),t(e.yParityAndS==null||e.yParityAndS===l.yParityAndS,"yParityAndS mismatch"),l}};Vu=new WeakMap,Hu=new WeakMap,zu=new WeakMap,_l=new WeakMap;let ws=Cs;const Fl=class Fl{constructor(e){J(this,Ji);z(ru(e)===32,"invalid private key","privateKey","[REDACTED]"),L(this,Ji,we(e))}get privateKey(){return T(this,Ji)}get publicKey(){return Fl.computePublicKey(T(this,Ji))}get compressedPublicKey(){return Fl.computePublicKey(T(this,Ji),!0)}sign(e){z(ru(e)===32,"invalid digest length","digest",e);const t=zo.sign(Vn(e),Vn(T(this,Ji)),{lowS:!0});return ws.from({r:_o(t.r,32),s:_o(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Fl.computePublicKey(e);return we(zo.getSharedSecret(Vn(T(this,Ji)),ct(t),!1))}static computePublicKey(e,t){let r=ct(e,"key");if(r.length===32){const i=zo.getPublicKey(r,!!t);return we(i)}if(r.length===64){const i=new Uint8Array(65);i[0]=4,i.set(r,1),r=i}const s=zo.ProjectivePoint.fromHex(r);return we(s.toRawBytes(t))}static recoverPublicKey(e,t){z(ru(e)===32,"invalid digest length","digest",e);const r=ws.from(t);let s=zo.Signature.fromCompact(Vn(zt([r.r,r.s])));s=s.addRecoveryBit(r.yParity);const i=s.recoverPublicKey(Vn(e));return z(i!=null,"invalid signautre for digest","signature",t),"0x"+i.toHex(!1)}static addPoints(e,t,r){const s=zo.ProjectivePoint.fromHex(Fl.computePublicKey(e).substring(2)),i=zo.ProjectivePoint.fromHex(Fl.computePublicKey(t).substring(2));return"0x"+s.add(i).toHex(!!r)}};Ji=new WeakMap;let ih=Fl;const wY=BigInt(0),AY=BigInt(36);function PD(n){n=n.toLowerCase();const e=n.substring(2).split(""),t=new Uint8Array(40);for(let s=0;s<40;s++)t[s]=e[s].charCodeAt(0);const r=ct(Xt(t));for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&(e[s]=e[s].toUpperCase()),(r[s>>1]&15)>=8&&(e[s+1]=e[s+1].toUpperCase());return"0x"+e.join("")}const E1={};for(let n=0;n<10;n++)E1[String(n)]=String(n);for(let n=0;n<26;n++)E1[String.fromCharCode(65+n)]=String(10+n);const DD=15;function vY(n){n=n.toUpperCase(),n=n.substring(4)+n.substring(0,2)+"00";let e=n.split("").map(r=>E1[r]).join("");for(;e.length>=DD;){let r=e.substring(0,DD);e=parseInt(r,10)%97+e.substring(r.length)}let t=String(98-parseInt(e,10)%97);for(;t.length<2;)t="0"+t;return t}const xY=function(){const n={};for(let e=0;e<36;e++){const t="0123456789abcdefghijklmnopqrstuvwxyz"[e];n[t]=BigInt(e)}return n}();function EY(n){n=n.toLowerCase();let e=wY;for(let t=0;t<n.length;t++)e=e*AY+xY[n[t]];return e}function pt(n){if(z(typeof n=="string","invalid address","address",n),n.match(/^(0x)?[0-9a-fA-F]{40}$/)){n.startsWith("0x")||(n="0x"+n);const e=PD(n);return z(!n.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||e===n,"bad address checksum","address",n),e}if(n.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){z(n.substring(2,4)===vY(n),"bad icap checksum","address",n);let e=EY(n.substring(4)).toString(16);for(;e.length<40;)e="0"+e;return PD("0x"+e)}z(!1,"invalid address","address",n)}function CY(n){const e=pt(n.from);let r=xe(n.nonce,"tx.nonce").toString(16);return r==="0"?r="0x":r.length%2?r="0x0"+r:r="0x"+r,pt(Vt(Xt(al([e,r])),12))}function ID(n){return n&&typeof n.getAddress=="function"}function kY(n){try{return pt(n),!0}catch{}return!1}async function C1(n,e){const t=await e;return(t==null||t==="0x0000000000000000000000000000000000000000")&&(ee(typeof n!="string","unconfigured name","UNCONFIGURED_NAME",{value:n}),z(!1,"invalid AddressLike value; did not resolve to a value address","target",n)),pt(t)}function Gn(n,e){if(typeof n=="string")return n.match(/^0x[0-9a-f]{40}$/i)?pt(n):(ee(e!=null,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),C1(n,e.resolveName(n)));if(ID(n))return C1(n,n.getAddress());if(n&&typeof n.then=="function")return C1(n,n);z(!1,"unsupported addressable value","target",n)}const Di={};function Ae(n,e){let t=!1;return e<0&&(t=!0,e*=-1),new Nn(Di,`${t?"":"u"}int${e}`,n,{signed:t,width:e})}function ft(n,e){return new Nn(Di,`bytes${e||""}`,n,{size:e})}const LD=Symbol.for("_ethers_typed"),qi=class qi{constructor(e,t,r,s){G(this,"type");G(this,"value");J(this,jl);G(this,"_typedSymbol");s==null&&(s=null),qg(Di,e,"Typed"),Ne(this,{_typedSymbol:LD,type:t,value:r}),L(this,jl,s),this.format()}format(){if(this.type==="array")throw new Error("");if(this.type==="dynamicArray")throw new Error("");return this.type==="tuple"?`tuple(${this.value.map(e=>e.format()).join(",")})`:this.type}defaultValue(){return 0}minValue(){return 0}maxValue(){return 0}isBigInt(){return!!this.type.match(/^u?int[0-9]+$/)}isData(){return this.type.startsWith("bytes")}isString(){return this.type==="string"}get tupleName(){if(this.type!=="tuple")throw TypeError("not a tuple");return T(this,jl)}get arrayLength(){if(this.type!=="array")throw TypeError("not an array");return T(this,jl)===!0?-1:T(this,jl)===!1?this.value.length:null}static from(e,t){return new qi(Di,e,t)}static uint8(e){return Ae(e,8)}static uint16(e){return Ae(e,16)}static uint24(e){return Ae(e,24)}static uint32(e){return Ae(e,32)}static uint40(e){return Ae(e,40)}static uint48(e){return Ae(e,48)}static uint56(e){return Ae(e,56)}static uint64(e){return Ae(e,64)}static uint72(e){return Ae(e,72)}static uint80(e){return Ae(e,80)}static uint88(e){return Ae(e,88)}static uint96(e){return Ae(e,96)}static uint104(e){return Ae(e,104)}static uint112(e){return Ae(e,112)}static uint120(e){return Ae(e,120)}static uint128(e){return Ae(e,128)}static uint136(e){return Ae(e,136)}static uint144(e){return Ae(e,144)}static uint152(e){return Ae(e,152)}static uint160(e){return Ae(e,160)}static uint168(e){return Ae(e,168)}static uint176(e){return Ae(e,176)}static uint184(e){return Ae(e,184)}static uint192(e){return Ae(e,192)}static uint200(e){return Ae(e,200)}static uint208(e){return Ae(e,208)}static uint216(e){return Ae(e,216)}static uint224(e){return Ae(e,224)}static uint232(e){return Ae(e,232)}static uint240(e){return Ae(e,240)}static uint248(e){return Ae(e,248)}static uint256(e){return Ae(e,256)}static uint(e){return Ae(e,256)}static int8(e){return Ae(e,-8)}static int16(e){return Ae(e,-16)}static int24(e){return Ae(e,-24)}static int32(e){return Ae(e,-32)}static int40(e){return Ae(e,-40)}static int48(e){return Ae(e,-48)}static int56(e){return Ae(e,-56)}static int64(e){return Ae(e,-64)}static int72(e){return Ae(e,-72)}static int80(e){return Ae(e,-80)}static int88(e){return Ae(e,-88)}static int96(e){return Ae(e,-96)}static int104(e){return Ae(e,-104)}static int112(e){return Ae(e,-112)}static int120(e){return Ae(e,-120)}static int128(e){return Ae(e,-128)}static int136(e){return Ae(e,-136)}static int144(e){return Ae(e,-144)}static int152(e){return Ae(e,-152)}static int160(e){return Ae(e,-160)}static int168(e){return Ae(e,-168)}static int176(e){return Ae(e,-176)}static int184(e){return Ae(e,-184)}static int192(e){return Ae(e,-192)}static int200(e){return Ae(e,-200)}static int208(e){return Ae(e,-208)}static int216(e){return Ae(e,-216)}static int224(e){return Ae(e,-224)}static int232(e){return Ae(e,-232)}static int240(e){return Ae(e,-240)}static int248(e){return Ae(e,-248)}static int256(e){return Ae(e,-256)}static int(e){return Ae(e,-256)}static bytes1(e){return ft(e,1)}static bytes2(e){return ft(e,2)}static bytes3(e){return ft(e,3)}static bytes4(e){return ft(e,4)}static bytes5(e){return ft(e,5)}static bytes6(e){return ft(e,6)}static bytes7(e){return ft(e,7)}static bytes8(e){return ft(e,8)}static bytes9(e){return ft(e,9)}static bytes10(e){return ft(e,10)}static bytes11(e){return ft(e,11)}static bytes12(e){return ft(e,12)}static bytes13(e){return ft(e,13)}static bytes14(e){return ft(e,14)}static bytes15(e){return ft(e,15)}static bytes16(e){return ft(e,16)}static bytes17(e){return ft(e,17)}static bytes18(e){return ft(e,18)}static bytes19(e){return ft(e,19)}static bytes20(e){return ft(e,20)}static bytes21(e){return ft(e,21)}static bytes22(e){return ft(e,22)}static bytes23(e){return ft(e,23)}static bytes24(e){return ft(e,24)}static bytes25(e){return ft(e,25)}static bytes26(e){return ft(e,26)}static bytes27(e){return ft(e,27)}static bytes28(e){return ft(e,28)}static bytes29(e){return ft(e,29)}static bytes30(e){return ft(e,30)}static bytes31(e){return ft(e,31)}static bytes32(e){return ft(e,32)}static address(e){return new qi(Di,"address",e)}static bool(e){return new qi(Di,"bool",!!e)}static bytes(e){return new qi(Di,"bytes",e)}static string(e){return new qi(Di,"string",e)}static array(e,t){throw new Error("not implemented yet")}static tuple(e,t){throw new Error("not implemented yet")}static overrides(e){return new qi(Di,"overrides",Object.assign({},e))}static isTyped(e){return e&&typeof e=="object"&&"_typedSymbol"in e&&e._typedSymbol===LD}static dereference(e,t){if(qi.isTyped(e)){if(e.type!==t)throw new Error(`invalid type: expecetd ${t}, got ${e.type}`);return e.value}return e}};jl=new WeakMap;let Nn=qi;class SY extends Ri{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){let r=Nn.dereference(t,"string");try{r=pt(r)}catch(s){return this._throwError(s.message,t)}return e.writeValue(r)}decode(e){return pt(_o(e.readValue(),20))}}class TY extends Ri{constructor(t){super(t.name,t.type,"_",t.dynamic);G(this,"coder");this.coder=t}defaultValue(){return this.coder.defaultValue()}encode(t,r){return this.coder.encode(t,r)}decode(t){return this.coder.decode(t)}}function BD(n,e,t){let r=[];if(Array.isArray(t))r=t;else if(t&&typeof t=="object"){let l={};r=e.map(c=>{const u=c.localName;return ee(u,"cannot encode object for signature with missing names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),ee(!l[u],"cannot encode object for signature with duplicate names","INVALID_ARGUMENT",{argument:"values",info:{coder:c},value:t}),l[u]=!0,t[u]})}else z(!1,"invalid tuple value","tuple",t);z(e.length===r.length,"types/value length mismatch","tuple",t);let s=new s1,i=new s1,o=[];e.forEach((l,c)=>{let u=r[c];if(l.dynamic){let f=i.length;l.encode(i,u);let d=s.writeUpdatableValue();o.push(h=>{d(h+f)})}else l.encode(s,u)}),o.forEach(l=>{l(s.length)});let a=n.appendWriter(s);return a+=n.appendWriter(i),a}function _D(n,e){let t=[],r=[],s=n.subReader(0);return e.forEach(i=>{let o=null;if(i.dynamic){let a=n.readIndex(),l=s.subReader(a);try{o=i.decode(l)}catch(c){if(dn(c,"BUFFER_OVERRUN"))throw c;o=c,o.baseType=i.name,o.name=i.localName,o.type=i.type}}else try{o=i.decode(n)}catch(a){if(dn(a,"BUFFER_OVERRUN"))throw a;o=a,o.baseType=i.name,o.name=i.localName,o.type=i.type}if(o==null)throw new Error("investigate");t.push(o),r.push(i.localName||null)}),ou.fromItems(t,r)}class OY extends Ri{constructor(t,r,s){const i=t.type+"["+(r>=0?r:"")+"]",o=r===-1||t.dynamic;super("array",i,s,o);G(this,"coder");G(this,"length");Ne(this,{coder:t,length:r})}defaultValue(){const t=this.coder.defaultValue(),r=[];for(let s=0;s<this.length;s++)r.push(t);return r}encode(t,r){const s=Nn.dereference(r,"array");Array.isArray(s)||this._throwError("expected array value",s);let i=this.length;i===-1&&(i=s.length,t.writeValue(s.length)),gP(s.length,i,"coder array"+(this.localName?" "+this.localName:""));let o=[];for(let a=0;a<s.length;a++)o.push(this.coder);return BD(t,o,s)}decode(t){let r=this.length;r===-1&&(r=t.readIndex(),ee(r*$n<=t.dataLength,"insufficient data length","BUFFER_OVERRUN",{buffer:t.bytes,offset:r*$n,length:t.dataLength}));let s=[];for(let i=0;i<r;i++)s.push(new TY(this.coder));return _D(t,s)}}class NY extends Ri{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){const r=Nn.dereference(t,"bool");return e.writeValue(r?1:0)}decode(e){return!!e.readValue()}}class FD extends Ri{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=Vn(t);let r=e.writeValue(t.length);return r+=e.writeBytes(t),r}decode(e){return e.readBytes(e.readIndex(),!0)}}class MY extends FD{constructor(e){super("bytes",e)}decode(e){return we(super.decode(e))}}class RY extends Ri{constructor(t,r){let s="bytes"+String(t);super(s,s,r,!1);G(this,"size");Ne(this,{size:t},{size:"number"})}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+this.size*2)}encode(t,r){let s=Vn(Nn.dereference(r,this.type));return s.length!==this.size&&this._throwError("incorrect data length",r),t.writeBytes(s)}decode(t){return we(t.readBytes(this.size))}}const PY=new Uint8Array([]);class DY extends Ri{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return t!=null&&this._throwError("not null",t),e.writeBytes(PY)}decode(e){return e.readBytes(0),null}}const IY=BigInt(0),LY=BigInt(1),BY=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class _Y extends Ri{constructor(t,r,s){const i=(r?"int":"uint")+t*8;super(i,i,s,!1);G(this,"size");G(this,"signed");Ne(this,{size:t,signed:r},{size:"number",signed:"boolean"})}defaultValue(){return 0}encode(t,r){let s=xe(Nn.dereference(r,this.type)),i=Zd(BY,$n*8);if(this.signed){let o=Zd(i,this.size*8-1);(s>o||s<-(o+LY))&&this._throwError("value out-of-bounds",r),s=AP(s,8*$n)}else(s<IY||s>Zd(i,this.size*8))&&this._throwError("value out-of-bounds",r);return t.writeValue(s)}decode(t){let r=Zd(t.readValue(),this.size*8);return this.signed&&(r=VJ(r,this.size*8)),r}}class FY extends FD{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Mi(Nn.dereference(t,"string")))}decode(e){return iu(super.decode(e))}}class cy extends Ri{constructor(t,r){let s=!1;const i=[];t.forEach(a=>{a.dynamic&&(s=!0),i.push(a.type)});const o="tuple("+i.join(",")+")";super("tuple",o,r,s);G(this,"coders");Ne(this,{coders:Object.freeze(t.slice())})}defaultValue(){const t=[];this.coders.forEach(s=>{t.push(s.defaultValue())});const r=this.coders.reduce((s,i)=>{const o=i.localName;return o&&(s[o]||(s[o]=0),s[o]++),s},{});return this.coders.forEach((s,i)=>{let o=s.localName;!o||r[o]!==1||(o==="length"&&(o="_length"),t[o]==null&&(t[o]=t[i]))}),Object.freeze(t)}encode(t,r){const s=Nn.dereference(r,"tuple");return BD(t,this.coders,s)}decode(t){return _D(t,this.coders)}}function dl(n){return Xt(Mi(n))}var jY="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";const jD=new Map([[8217,"apostrophe"],[8260,"fraction slash"],[12539,"middle dot"]]),UD=4;function UY(n){let e=0;function t(){return n[e++]<<8|n[e++]}let r=t(),s=1,i=[0,1];for(let x=1;x<r;x++)i.push(s+=t());let o=t(),a=e;e+=o;let l=0,c=0;function u(){return l==0&&(c=c<<8|n[e++],l=8),c>>--l&1}const f=31,d=2**f,h=d>>>1,p=h>>1,m=d-1;let y=0;for(let x=0;x<f;x++)y=y<<1|u();let b=[],v=0,A=d;for(;;){let x=Math.floor(((y-v+1)*s-1)/A),C=0,S=r;for(;S-C>1;){let R=C+S>>>1;x<i[R]?S=R:C=R}if(C==0)break;b.push(C);let M=v+Math.floor(A*i[C]/s),O=v+Math.floor(A*i[C+1]/s)-1;for(;!((M^O)&h);)y=y<<1&m|u(),M=M<<1&m,O=O<<1&m|1;for(;M&~O&p;)y=y&h|y<<1&m>>>1|u(),M=M<<1^h,O=(O^h)<<1|h|1;v=M,A=1+O-M}let w=r-4;return b.map(x=>{switch(x-w){case 3:return w+65792+(n[a++]<<16|n[a++]<<8|n[a++]);case 2:return w+256+(n[a++]<<8|n[a++]);case 1:return w+n[a++];default:return x-1}})}function VY(n){let e=0;return()=>n[e++]}function VD(n){return VY(UY(HY(n)))}function HY(n){let e=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((s,i)=>e[s.charCodeAt(0)]=i);let t=n.length,r=new Uint8Array(6*t>>3);for(let s=0,i=0,o=0,a=0;s<t;s++)a=a<<6|e[n.charCodeAt(s)],o+=6,o>=8&&(r[i++]=a>>(o-=8));return r}function zY(n){return n&1?~n>>1:n>>1}function $Y(n,e){let t=Array(n);for(let r=0,s=0;r<n;r++)t[r]=s+=zY(e());return t}function oh(n,e=0){let t=[];for(;;){let r=n(),s=n();if(!s)break;e+=r;for(let i=0;i<s;i++)t.push(e+i);e+=s+1}return t}function HD(n){return ah(()=>{let e=oh(n);if(e.length)return e})}function zD(n){let e=[];for(;;){let t=n();if(t==0)break;e.push(GY(t,n))}for(;;){let t=n()-1;if(t<0)break;e.push(WY(t,n))}return e.flat()}function ah(n){let e=[];for(;;){let t=n(e.length);if(!t)break;e.push(t)}return e}function $D(n,e,t){let r=Array(n).fill().map(()=>[]);for(let s=0;s<e;s++)$Y(n,t).forEach((i,o)=>r[o].push(i));return r}function GY(n,e){let t=1+e(),r=e(),s=ah(e);return $D(s.length,1+n,e).flatMap((o,a)=>{let[l,...c]=o;return Array(s[a]).fill().map((u,f)=>{let d=f*r;return[l+f*t,c.map(h=>h+d)]})})}function WY(n,e){let t=1+e();return $D(t,1+n,e).map(s=>[s[0],s.slice(1)])}function KY(n){let e=[],t=oh(n);return s(r([]),[]),e;function r(i){let o=n(),a=ah(()=>{let l=oh(n).map(c=>t[c]);if(l.length)return r(l)});return{S:o,B:a,Q:i}}function s({S:i,B:o},a,l){if(!(i&4&&l===a[a.length-1])){i&2&&(l=a[a.length-1]),i&1&&e.push(a);for(let c of o)for(let u of c.Q)s(c,[...a,u],l)}}}function QY(n){return n.toString(16).toUpperCase().padStart(2,"0")}function GD(n){return`{${QY(n)}}`}function JY(n){let e=[];for(let t=0,r=n.length;t<r;){let s=n.codePointAt(t);t+=s<65536?1:2,e.push(s)}return e}function hu(n){let t=n.length;if(t<4096)return String.fromCodePoint(...n);let r=[];for(let s=0;s<t;)r.push(String.fromCodePoint(...n.slice(s,s+=4096)));return r.join("")}function qY(n,e){let t=n.length,r=t-e.length;for(let s=0;r==0&&s<t;s++)r=n[s]-e[s];return r}var YY="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";const lh=44032,uy=4352,fy=4449,dy=4519,WD=19,KD=21,pu=28,hy=KD*pu,XY=WD*hy,ZY=lh+XY,eX=uy+WD,tX=fy+KD,nX=dy+pu;function ch(n){return n>>24&255}function QD(n){return n&16777215}let k1,JD,S1,py;function rX(){let n=VD(YY);k1=new Map(HD(n).flatMap((e,t)=>e.map(r=>[r,t+1<<24]))),JD=new Set(oh(n)),S1=new Map,py=new Map;for(let[e,t]of zD(n)){if(!JD.has(e)&&t.length==2){let[r,s]=t,i=py.get(r);i||(i=new Map,py.set(r,i)),i.set(s,e)}S1.set(e,t.reverse())}}function qD(n){return n>=lh&&n<ZY}function sX(n,e){if(n>=uy&&n<eX&&e>=fy&&e<tX)return lh+(n-uy)*hy+(e-fy)*pu;if(qD(n)&&e>dy&&e<nX&&(n-lh)%pu==0)return n+(e-dy);{let t=py.get(n);return t&&(t=t.get(e),t)?t:-1}}function YD(n){k1||rX();let e=[],t=[],r=!1;function s(i){let o=k1.get(i);o&&(r=!0,i|=o),e.push(i)}for(let i of n)for(;;){if(i<128)e.push(i);else if(qD(i)){let o=i-lh,a=o/hy|0,l=o%hy/pu|0,c=o%pu;s(uy+a),s(fy+l),c>0&&s(dy+c)}else{let o=S1.get(i);o?t.push(...o):s(i)}if(!t.length)break;i=t.pop()}if(r&&e.length>1){let i=ch(e[0]);for(let o=1;o<e.length;o++){let a=ch(e[o]);if(a==0||i<=a){i=a;continue}let l=o-1;for(;;){let c=e[l+1];if(e[l+1]=e[l],e[l]=c,!l||(i=ch(e[--l]),i<=a))break}i=ch(e[o])}}return e}function iX(n){let e=[],t=[],r=-1,s=0;for(let i of n){let o=ch(i),a=QD(i);if(r==-1)o==0?r=a:e.push(a);else if(s>0&&s>=o)o==0?(e.push(r,...t),t.length=0,r=a):t.push(a),s=o;else{let l=sX(r,a);l>=0?r=l:s==0&&o==0?(e.push(r),r=a):(t.push(a),s=o)}}return r>=0&&e.push(r,...t),e}function XD(n){return YD(n).map(QD)}function oX(n){return iX(YD(n))}const ZD=45,eI=".",tI=65039,nI=1,my=n=>Array.from(n);function uh(n,e){return n.P.has(e)||n.Q.has(e)}class aX extends Array{get is_emoji(){return!0}}let T1,rI,hl,O1,sI,mu,N1,gu,pl,iI,M1;function R1(){if(T1)return;let n=VD(jY);const e=()=>oh(n),t=()=>new Set(e()),r=(u,f)=>f.forEach(d=>u.add(d));T1=new Map(zD(n)),rI=t(),hl=e(),O1=new Set(e().map(u=>hl[u])),hl=new Set(hl),sI=t(),t();let s=HD(n),i=n();const o=()=>{let u=new Set;return e().forEach(f=>r(u,s[f])),r(u,e()),u};mu=ah(u=>{let f=ah(n).map(d=>d+96);if(f.length){let d=u>=i;f[0]-=32,f=hu(f),d&&(f=`Restricted[${f}]`);let h=o(),p=o(),m=!n();return{N:f,P:h,Q:p,M:m,R:d}}}),N1=t(),gu=new Map;let a=e().concat(my(N1)).sort((u,f)=>u-f);a.forEach((u,f)=>{let d=n(),h=a[f]=d?a[f-d]:{V:[],M:new Map};h.V.push(u),N1.has(u)||gu.set(u,h)});for(let{V:u,M:f}of new Set(gu.values())){let d=[];for(let p of u){let m=mu.filter(b=>uh(b,p)),y=d.find(({G:b})=>m.some(v=>b.has(v)));y||(y={G:new Set,V:[]},d.push(y)),y.V.push(p),r(y.G,m)}let h=d.flatMap(p=>my(p.G));for(let{G:p,V:m}of d){let y=new Set(h.filter(b=>!p.has(b)));for(let b of m)f.set(b,y)}}pl=new Set;let l=new Set;const c=u=>pl.has(u)?l.add(u):pl.add(u);for(let u of mu){for(let f of u.P)c(f);for(let f of u.Q)c(f)}for(let u of pl)!gu.has(u)&&!l.has(u)&&gu.set(u,nI);r(pl,XD(pl)),iI=KY(n).map(u=>aX.from(u)).sort(qY),M1=new Map;for(let u of iI){let f=[M1];for(let d of u){let h=f.map(p=>{let m=p.get(d);return m||(m=new Map,p.set(d,m)),m});d===tI?f.push(...h):f=h}for(let d of f)d.V=u}}function P1(n){return(oI(n)?"":`${D1(gy([n]))} `)+GD(n)}function D1(n){return`"${n}"`}function lX(n){if(n.length>=4&&n[2]==ZD&&n[3]==ZD)throw new Error(`invalid label extension: "${hu(n.slice(0,4))}"`)}function cX(n){for(let t=n.lastIndexOf(95);t>0;)if(n[--t]!==95)throw new Error("underscore allowed only at start")}function uX(n){let e=n[0],t=jD.get(e);if(t)throw fh(`leading ${t}`);let r=n.length,s=-1;for(let i=1;i<r;i++){e=n[i];let o=jD.get(e);if(o){if(s==i)throw fh(`${t} + ${o}`);s=i+1,t=o}}if(s==r)throw fh(`trailing ${t}`)}function gy(n,e=1/0,t=GD){let r=[];fX(n[0])&&r.push("◌"),n.length>e&&(e>>=1,n=[...n.slice(0,e),8230,...n.slice(-e)]);let s=0,i=n.length;for(let o=0;o<i;o++){let a=n[o];oI(a)&&(r.push(hu(n.slice(s,o))),r.push(t(a)),s=o+1)}return r.push(hu(n.slice(s,i))),r.join("")}function fX(n){return R1(),hl.has(n)}function oI(n){return R1(),sI.has(n)}function dX(n){return gX(hX(n,oX,wX))}function hX(n,e,t){if(!n)return[];R1();let r=0;return n.split(eI).map(s=>{let i=JY(s),o={input:i,offset:r};r+=i.length+1;try{let a=o.tokens=bX(i,e,t),l=a.length,c;if(!l)throw new Error("empty label");let u=o.output=a.flat();if(cX(u),!(o.emoji=l>1||a[0].is_emoji)&&u.every(d=>d<128))lX(u),c="ASCII";else{let d=a.flatMap(h=>h.is_emoji?[]:h);if(!d.length)c="Emoji";else{if(hl.has(u[0]))throw fh("leading combining mark");for(let m=1;m<l;m++){let y=a[m];if(!y.is_emoji&&hl.has(y[0]))throw fh(`emoji + combining mark: "${hu(a[m-1])} + ${gy([y[0]])}"`)}uX(u);let h=my(new Set(d)),[p]=mX(h);yX(p,d),pX(p,h),c=p.N}}o.type=c}catch(a){o.error=a}return o})}function pX(n,e){let t,r=[];for(let s of e){let i=gu.get(s);if(i===nI)return;if(i){let o=i.M.get(s);if(t=t?t.filter(a=>o.has(a)):my(o),!t.length)return}else r.push(s)}if(t){for(let s of t)if(r.every(i=>uh(s,i)))throw new Error(`whole-script confusable: ${n.N}/${s.N}`)}}function mX(n){let e=mu;for(let t of n){let r=e.filter(s=>uh(s,t));if(!r.length)throw mu.some(s=>uh(s,t))?lI(e[0],t):aI(t);if(e=r,r.length==1)break}return e}function gX(n){return n.map(({input:e,error:t,output:r})=>{if(t){let s=t.message;throw new Error(n.length==1?s:`Invalid label ${D1(gy(e,63))}: ${s}`)}return hu(r)}).join(eI)}function aI(n){return new Error(`disallowed character: ${P1(n)}`)}function lI(n,e){let t=P1(e),r=mu.find(s=>s.P.has(e));return r&&(t=`${r.N} ${t}`),new Error(`illegal mixture: ${n.N} + ${t}`)}function fh(n){return new Error(`illegal placement: ${n}`)}function yX(n,e){for(let t of e)if(!uh(n,t))throw lI(n,t);if(n.M){let t=XD(e);for(let r=1,s=t.length;r<s;r++)if(O1.has(t[r])){let i=r+1;for(let o;i<s&&O1.has(o=t[i]);i++)for(let a=r;a<i;a++)if(t[a]==o)throw new Error(`duplicate non-spacing marks: ${P1(o)}`);if(i-r>UD)throw new Error(`excessive non-spacing marks: ${D1(gy(t.slice(r-1,i)))} (${i-r}/${UD})`);r=i}}}function bX(n,e,t){let r=[],s=[];for(n=n.slice().reverse();n.length;){let i=AX(n);if(i)s.length&&(r.push(e(s)),s=[]),r.push(t(i));else{let o=n.pop();if(pl.has(o))s.push(o);else{let a=T1.get(o);if(a)s.push(...a);else if(!rI.has(o))throw aI(o)}}}return s.length&&r.push(e(s)),r}function wX(n){return n.filter(e=>e!=tI)}function AX(n,e){let t=M1,r,s=n.length;for(;s&&(t=t.get(n[--s]),!!t);){let{V:i}=t;i&&(r=i,n.length=s)}return r}const cI=new Uint8Array(32);cI.fill(0);function uI(n){return z(n.length!==0,"invalid ENS name; empty component","comp",n),n}function fI(n){const e=Mi(vX(n)),t=[];if(n.length===0)return t;let r=0;for(let s=0;s<e.length;s++)e[s]===46&&(t.push(uI(e.slice(r,s))),r=s+1);return z(r<e.length,"invalid ENS name; empty component","name",n),t.push(uI(e.slice(r))),t}function vX(n){try{if(n.length===0)throw new Error("empty label");return dX(n)}catch(e){z(!1,`invalid ENS name (${e.message})`,"name",n)}}function I1(n){z(typeof n=="string","invalid ENS name; not a string","name",n),z(n.length,"invalid ENS name (empty label)","name",n);let e=cI;const t=fI(n);for(;t.length;)e=Xt(zt([e,Xt(t.pop())]));return we(e)}function xX(n,e){const t=e;return z(t<=255,"DNS encoded label cannot exceed 255","length",t),we(zt(fI(n).map(r=>{z(r.length<=t,`label ${JSON.stringify(n)} exceeds ${t} bytes`,"name",n);const s=new Uint8Array(r.length+1);return s.set(r,1),s[0]=s.length-1,s})))+"00"}function L1(n,e){return{address:pt(n),storageKeys:e.map((t,r)=>(z(Ct(t,32),"invalid slot",`storageKeys[${r}]`,t),t.toLowerCase()))}}function $o(n){if(Array.isArray(n))return n.map((t,r)=>Array.isArray(t)?(z(t.length===2,"invalid slot set",`value[${r}]`,t),L1(t[0],t[1])):(z(t!=null&&typeof t=="object","invalid address-slot set","value",n),L1(t.address,t.storageKeys)));z(n!=null&&typeof n=="object","invalid access list","value",n);const e=Object.keys(n).map(t=>{const r=n[t].reduce((s,i)=>(s[i]=!0,s),{});return L1(t,Object.keys(r).sort())});return e.sort((t,r)=>t.address.localeCompare(r.address)),e}function EX(n){let e;return typeof n=="string"?e=ih.computePublicKey(n,!1):e=n.publicKey,pt(Xt("0x"+e.substring(4)).substring(26))}function CX(n,e){return EX(ih.recoverPublicKey(n,e))}const pn=BigInt(0),kX=BigInt(2),SX=BigInt(27),TX=BigInt(28),OX=BigInt(35),NX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B1=4096*32;function dI(n,e){let t=n.toString(16);for(;t.length<2;)t="0"+t;return t+=lu(e).substring(4),"0x"+t}function yy(n){return n==="0x"?null:pt(n)}function _1(n,e){try{return $o(n)}catch(t){z(!1,t.message,e,n)}}function dh(n,e){return n==="0x"?0:Je(n,e)}function Gt(n,e){if(n==="0x")return pn;const t=xe(n,e);return z(t<=NX,"value exceeds uint size",e,t),t}function Tt(n,e){const t=xe(n,"value"),r=Hn(t);return z(r.length<=32,"value too large",`tx.${e}`,t),r}function F1(n){return $o(n).map(e=>[e.address,e.storageKeys])}function MX(n,e){z(Array.isArray(n),`invalid ${e}`,"value",n);for(let t=0;t<n.length;t++)z(Ct(n[t],32),"invalid ${ param } hash",`value[${t}]`,n[t]);return n}function RX(n){const e=ty(n);z(Array.isArray(e)&&(e.length===9||e.length===6),"invalid field count for legacy transaction","data",n);const t={type:0,nonce:dh(e[0],"nonce"),gasPrice:Gt(e[1],"gasPrice"),gasLimit:Gt(e[2],"gasLimit"),to:yy(e[3]),value:Gt(e[4],"value"),data:we(e[5]),chainId:pn};if(e.length===6)return t;const r=Gt(e[6],"v"),s=Gt(e[7],"r"),i=Gt(e[8],"s");if(s===pn&&i===pn)t.chainId=r;else{let o=(r-OX)/kX;o<pn&&(o=pn),t.chainId=o,z(o!==pn||r===SX||r===TX,"non-canonical legacy v","v",e[6]),t.signature=ws.from({r:il(e[7],32),s:il(e[8],32),v:r})}return t}function PX(n,e){const t=[Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data];let r=pn;if(n.chainId!=pn)r=xe(n.chainId,"tx.chainId"),z(!e||e.networkV==null||e.legacyChainId===r,"tx.chainId/sig.v mismatch","sig",e);else if(n.signature){const i=n.signature.legacyChainId;i!=null&&(r=i)}if(!e)return r!==pn&&(t.push(Hn(r)),t.push("0x"),t.push("0x")),al(t);let s=BigInt(27+e.yParity);return r!==pn?s=ws.getChainIdV(r,e.v):BigInt(e.v)!==s&&z(!1,"tx.chainId/sig.v mismatch","sig",e),t.push(Hn(s)),t.push(Hn(e.r)),t.push(Hn(e.s)),al(t)}function j1(n,e){let t;try{if(t=dh(e[0],"yParity"),t!==0&&t!==1)throw new Error("bad yParity")}catch{z(!1,"invalid yParity","yParity",e[0])}const r=il(e[1],32),s=il(e[2],32),i=ws.from({r,s,yParity:t});n.signature=i}function DX(n){const e=ty(ct(n).slice(1));z(Array.isArray(e)&&(e.length===9||e.length===12),"invalid field count for transaction type: 2","data",we(n));const t={type:2,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:we(e[7]),accessList:_1(e[8],"accessList")};return e.length===9||j1(t,e.slice(9)),t}function IX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"yParity")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x02",al(t)])}function LX(n){const e=ty(ct(n).slice(1));z(Array.isArray(e)&&(e.length===8||e.length===11),"invalid field count for transaction type: 1","data",we(n));const t={type:1,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),gasPrice:Gt(e[2],"gasPrice"),gasLimit:Gt(e[3],"gasLimit"),to:yy(e[4]),value:Gt(e[5],"value"),data:we(e[6]),accessList:_1(e[7],"accessList")};return e.length===8||j1(t,e.slice(8)),t}function BX(n,e){const t=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.gasPrice||0,"gasPrice"),Tt(n.gasLimit,"gasLimit"),n.to||"0x",Tt(n.value,"value"),n.data,F1(n.accessList||[])];return e&&(t.push(Tt(e.yParity,"recoveryParam")),t.push(Hn(e.r)),t.push(Hn(e.s))),zt(["0x01",al(t)])}function _X(n){let e=ty(ct(n).slice(1)),t="3",r=null;if(e.length===4&&Array.isArray(e[0])){t="3 (network format)";const i=e[1],o=e[2],a=e[3];z(Array.isArray(i),"invalid network format: blobs not an array","fields[1]",i),z(Array.isArray(o),"invalid network format: commitments not an array","fields[2]",o),z(Array.isArray(a),"invalid network format: proofs not an array","fields[3]",a),z(i.length===o.length,"invalid network format: blobs/commitments length mismatch","fields",e),z(i.length===a.length,"invalid network format: blobs/proofs length mismatch","fields",e),r=[];for(let l=0;l<e[1].length;l++)r.push({data:i[l],commitment:o[l],proof:a[l]});e=e[0]}z(Array.isArray(e)&&(e.length===11||e.length===14),`invalid field count for transaction type: ${t}`,"data",we(n));const s={type:3,chainId:Gt(e[0],"chainId"),nonce:dh(e[1],"nonce"),maxPriorityFeePerGas:Gt(e[2],"maxPriorityFeePerGas"),maxFeePerGas:Gt(e[3],"maxFeePerGas"),gasPrice:null,gasLimit:Gt(e[4],"gasLimit"),to:yy(e[5]),value:Gt(e[6],"value"),data:we(e[7]),accessList:_1(e[8],"accessList"),maxFeePerBlobGas:Gt(e[9],"maxFeePerBlobGas"),blobVersionedHashes:e[10]};r&&(s.blobs=r),z(s.to!=null,`invalid address for transaction type: ${t}`,"data",n),z(Array.isArray(s.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",n);for(let i=0;i<s.blobVersionedHashes.length;i++)z(Ct(s.blobVersionedHashes[i],32),`invalid blobVersionedHash at index ${i}: must be length 32`,"data",n);return e.length===11||j1(s,e.slice(11)),s}function FX(n,e,t){const r=[Tt(n.chainId,"chainId"),Tt(n.nonce,"nonce"),Tt(n.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),Tt(n.maxFeePerGas||0,"maxFeePerGas"),Tt(n.gasLimit,"gasLimit"),n.to||sh,Tt(n.value,"value"),n.data,F1(n.accessList||[]),Tt(n.maxFeePerBlobGas||0,"maxFeePerBlobGas"),MX(n.blobVersionedHashes||[],"blobVersionedHashes")];return e&&(r.push(Tt(e.yParity,"yParity")),r.push(Hn(e.r)),r.push(Hn(e.s)),t)?zt(["0x03",al([r,t.map(s=>s.data),t.map(s=>s.commitment),t.map(s=>s.proof)])]):zt(["0x03",al(r)])}const Xi=class Xi{constructor(){J(this,tf);J(this,ri);J(this,$u);J(this,Gu);J(this,Wu);J(this,Ku);J(this,Qu);J(this,Ju);J(this,qu);J(this,Yu);J(this,Xu);J(this,Zu);J(this,ef);J(this,Ul);J(this,ta);J(this,Yi);J(this,na);L(this,ri,null),L(this,$u,null),L(this,Wu,0),L(this,Ku,pn),L(this,Qu,null),L(this,Ju,null),L(this,qu,null),L(this,Gu,"0x"),L(this,Yu,pn),L(this,Xu,pn),L(this,Zu,null),L(this,ef,null),L(this,Ul,null),L(this,ta,null),L(this,na,null),L(this,Yi,null)}get type(){return T(this,ri)}set type(e){switch(e){case null:L(this,ri,null);break;case 0:case"legacy":L(this,ri,0);break;case 1:case"berlin":case"eip-2930":L(this,ri,1);break;case 2:case"london":case"eip-1559":L(this,ri,2);break;case 3:case"cancun":case"eip-4844":L(this,ri,3);break;default:z(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844"}return null}get to(){const e=T(this,$u);return e==null&&this.type===3?sh:e}set to(e){L(this,$u,e==null?null:pt(e))}get nonce(){return T(this,Wu)}set nonce(e){L(this,Wu,Je(e,"value"))}get gasLimit(){return T(this,Ku)}set gasLimit(e){L(this,Ku,xe(e))}get gasPrice(){const e=T(this,Qu);return e==null&&(this.type===0||this.type===1)?pn:e}set gasPrice(e){L(this,Qu,e==null?null:xe(e,"gasPrice"))}get maxPriorityFeePerGas(){const e=T(this,Ju);return e??(this.type===2||this.type===3?pn:null)}set maxPriorityFeePerGas(e){L(this,Ju,e==null?null:xe(e,"maxPriorityFeePerGas"))}get maxFeePerGas(){const e=T(this,qu);return e??(this.type===2||this.type===3?pn:null)}set maxFeePerGas(e){L(this,qu,e==null?null:xe(e,"maxFeePerGas"))}get data(){return T(this,Gu)}set data(e){L(this,Gu,we(e))}get value(){return T(this,Yu)}set value(e){L(this,Yu,xe(e,"value"))}get chainId(){return T(this,Xu)}set chainId(e){L(this,Xu,xe(e))}get signature(){return T(this,Zu)||null}set signature(e){L(this,Zu,e==null?null:ws.from(e))}get accessList(){const e=T(this,ef)||null;return e??(this.type===1||this.type===2||this.type===3?[]:null)}set accessList(e){L(this,ef,e==null?null:$o(e))}get maxFeePerBlobGas(){const e=T(this,Ul);return e==null&&this.type===3?pn:e}set maxFeePerBlobGas(e){L(this,Ul,e==null?null:xe(e,"maxFeePerBlobGas"))}get blobVersionedHashes(){let e=T(this,ta);return e==null&&this.type===3?[]:e}set blobVersionedHashes(e){if(e!=null){z(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)z(Ct(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}L(this,ta,e)}get blobs(){return T(this,na)==null?null:T(this,na).map(e=>Object.assign({},e))}set blobs(e){if(e==null){L(this,na,null);return}const t=[],r=[];for(let s=0;s<e.length;s++){const i=e[s];if(Zv(i)){ee(T(this,Yi),"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let o=ct(i);if(z(o.length<=B1,"blob is too large",`blobs[${s}]`,i),o.length!==B1){const c=new Uint8Array(B1);c.set(o),o=c}const a=T(this,Yi).blobToKzgCommitment(o),l=we(T(this,Yi).computeBlobKzgProof(o,a));t.push({data:we(o),commitment:we(a),proof:l}),r.push(dI(1,a))}else{const o=we(i.commitment);t.push({data:we(i.data),commitment:o,proof:we(i.proof)}),r.push(dI(1,o))}}L(this,na,t),L(this,ta,r)}get kzg(){return T(this,Yi)}set kzg(e){L(this,Yi,e)}get hash(){return this.signature==null?null:Xt(fe(this,tf,b0).call(this,!0,!1))}get unsignedHash(){return Xt(this.unsignedSerialized)}get from(){return this.signature==null?null:CX(this.unsignedHash,this.signature)}get fromPublicKey(){return this.signature==null?null:ih.recoverPublicKey(this.unsignedHash,this.signature)}isSigned(){return this.signature!=null}get serialized(){return fe(this,tf,b0).call(this,!0,!0)}get unsignedSerialized(){return fe(this,tf,b0).call(this,!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=this.gasPrice!=null,t=this.maxFeePerGas!=null||this.maxPriorityFeePerGas!=null,r=this.accessList!=null,s=T(this,Ul)!=null||T(this,ta);this.maxFeePerGas!=null&&this.maxPriorityFeePerGas!=null&&ee(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),ee(!t||this.type!==0&&this.type!==1,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),ee(this.type!==0||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const i=[];return this.type!=null?i.push(this.type):t?i.push(2):e?(i.push(1),r||i.push(0)):r?(i.push(1),i.push(2)):(s&&this.to||(i.push(0),i.push(1),i.push(2)),i.push(3)),i.sort(),i}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}clone(){return Xi.from(this)}toJSON(){const e=t=>t==null?null:t.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}static from(e){if(e==null)return new Xi;if(typeof e=="string"){const r=ct(e);if(r[0]>=127)return Xi.from(RX(r));switch(r[0]){case 1:return Xi.from(LX(r));case 2:return Xi.from(DX(r));case 3:return Xi.from(_X(r))}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new Xi;return e.type!=null&&(t.type=e.type),e.to!=null&&(t.to=e.to),e.nonce!=null&&(t.nonce=e.nonce),e.gasLimit!=null&&(t.gasLimit=e.gasLimit),e.gasPrice!=null&&(t.gasPrice=e.gasPrice),e.maxPriorityFeePerGas!=null&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),e.maxFeePerGas!=null&&(t.maxFeePerGas=e.maxFeePerGas),e.maxFeePerBlobGas!=null&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),e.data!=null&&(t.data=e.data),e.value!=null&&(t.value=e.value),e.chainId!=null&&(t.chainId=e.chainId),e.signature!=null&&(t.signature=ws.from(e.signature)),e.accessList!=null&&(t.accessList=e.accessList),e.blobVersionedHashes!=null&&(t.blobVersionedHashes=e.blobVersionedHashes),e.kzg!=null&&(t.kzg=e.kzg),e.blobs!=null&&(t.blobs=e.blobs),e.hash!=null&&(z(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),z(t.hash===e.hash,"hash mismatch","tx",e)),e.from!=null&&(z(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),z(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}};ri=new WeakMap,$u=new WeakMap,Gu=new WeakMap,Wu=new WeakMap,Ku=new WeakMap,Qu=new WeakMap,Ju=new WeakMap,qu=new WeakMap,Yu=new WeakMap,Xu=new WeakMap,Zu=new WeakMap,ef=new WeakMap,Ul=new WeakMap,ta=new WeakMap,Yi=new WeakMap,na=new WeakMap,tf=new WeakSet,b0=function(e,t){ee(!e||this.signature!=null,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return PX(this,r);case 1:return BX(this,r);case 2:return IX(this,r);case 3:return FX(this,r,t?this.blobs:null)}ee(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})};let hh=Xi;const hI=new Uint8Array(32);hI.fill(0);const jX=BigInt(-1),pI=BigInt(0),mI=BigInt(1),UX=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");function VX(n){const e=ct(n),t=e.length%32;return t?zt([e,hI.slice(t)]):we(e)}const HX=_o(mI,32),zX=_o(pI,32),gI={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},U1=["name","version","chainId","verifyingContract","salt"];function yI(n){return function(e){return z(typeof e=="string",`invalid domain value for ${JSON.stringify(n)}`,`domain.${n}`,e),e}}const $X={name:yI("name"),version:yI("version"),chainId:function(n){const e=xe(n,"domain.chainId");return z(e>=0,"invalid chain ID","domain.chainId",n),Number.isSafeInteger(e)?Number(e):ol(e)},verifyingContract:function(n){try{return pt(n).toLowerCase()}catch{}z(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",n)},salt:function(n){const e=ct(n,"domain.salt");return z(e.length===32,'invalid domain value "salt"',"domain.salt",n),we(e)}};function V1(n){{const e=n.match(/^(u?)int(\d+)$/);if(e){const t=e[1]==="",r=parseInt(e[2]);z(r%8===0&&r!==0&&r<=256&&e[2]===String(r),"invalid numeric width","type",n);const s=Zd(UX,t?r-1:r),i=t?(s+mI)*jX:pI;return function(o){const a=xe(o,"value");return z(a>=i&&a<=s,`value out-of-bounds for ${n}`,"value",a),_o(t?AP(a,256):a,32)}}}{const e=n.match(/^bytes(\d+)$/);if(e){const t=parseInt(e[1]);return z(t!==0&&t<=32&&e[1]===String(t),"invalid bytes width","type",n),function(r){const s=ct(r);return z(s.length===t,`invalid length for ${n}`,"value",r),VX(r)}}}switch(n){case"address":return function(e){return il(pt(e),32)};case"bool":return function(e){return e?HX:zX};case"bytes":return function(e){return Xt(e)};case"string":return function(e){return dl(e)}}return null}function bI(n,e){return`${n}(${e.map(({name:t,type:r})=>r+" "+t).join(",")})`}function by(n){const e=n.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return e?{base:e[1],index:e[2]+e[4],array:{base:e[1],prefix:e[1]+e[2],count:e[5]?parseInt(e[5]):-1}}:{base:n}}const qr=class qr{constructor(e){J(this,f0);G(this,"primaryType");J(this,Uh);J(this,Zi);J(this,nf);L(this,Zi,new Map),L(this,nf,new Map);const t=new Map,r=new Map,s=new Map,i={};Object.keys(e).forEach(l=>{i[l]=e[l].map(({name:c,type:u})=>{let{base:f,index:d}=by(u);return f==="int"&&!e.int&&(f="int256"),f==="uint"&&!e.uint&&(f="uint256"),{name:c,type:f+(d||"")}}),t.set(l,new Set),r.set(l,[]),s.set(l,new Set)}),L(this,Uh,JSON.stringify(i));for(const l in i){const c=new Set;for(const u of i[l]){z(!c.has(u.name),`duplicate variable name ${JSON.stringify(u.name)} in ${JSON.stringify(l)}`,"types",e),c.add(u.name);const f=by(u.type).base;z(f!==l,`circular type reference to ${JSON.stringify(f)}`,"types",e),!V1(f)&&(z(r.has(f),`unknown type ${JSON.stringify(f)}`,"types",e),r.get(f).push(l),t.get(l).add(f))}}const o=Array.from(r.keys()).filter(l=>r.get(l).length===0);z(o.length!==0,"missing primary type","types",e),z(o.length===1,`ambiguous primary types or unused types: ${o.map(l=>JSON.stringify(l)).join(", ")}`,"types",e),Ne(this,{primaryType:o[0]});function a(l,c){z(!c.has(l),`circular type reference to ${JSON.stringify(l)}`,"types",e),c.add(l);for(const u of t.get(l))if(r.has(u)){a(u,c);for(const f of c)s.get(f).add(u)}c.delete(l)}a(this.primaryType,new Set);for(const[l,c]of s){const u=Array.from(c);u.sort(),T(this,Zi).set(l,bI(l,i[l])+u.map(f=>bI(f,i[f])).join(""))}}get types(){return JSON.parse(T(this,Uh))}getEncoder(e){let t=T(this,nf).get(e);return t||(t=fe(this,f0,aF).call(this,e),T(this,nf).set(e,t)),t}encodeType(e){const t=T(this,Zi).get(e);return z(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Xt(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(V1(e))return r(e,t);const s=by(e).array;if(s)return z(s.count===-1||s.count===t.length,`array length mismatch; expected length ${s.count}`,"value",t),t.map(o=>this._visit(s.prefix,o,r));const i=this.types[e];if(i)return i.reduce((o,{name:a,type:l})=>(o[a]=this._visit(l,t[a],r),o),{});z(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new qr(e)}static getPrimaryType(e){return qr.from(e).primaryType}static hashStruct(e,t,r){return qr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(e[r]==null)continue;const s=gI[r];z(s,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:s})}return t.sort((r,s)=>U1.indexOf(r.name)-U1.indexOf(s.name)),qr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return zt(["0x1901",qr.hashDomain(e),qr.from(t).hash(r)])}static hash(e,t,r){return Xt(qr.encode(e,t,r))}static async resolveNames(e,t,r,s){e=Object.assign({},e);for(const a in e)e[a]==null&&delete e[a];const i={};e.verifyingContract&&!Ct(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=qr.from(t);o.visit(r,(a,l)=>(a==="address"&&!Ct(l,20)&&(i[l]="0x"),l));for(const a in i)i[a]=await s(a);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),r=o.visit(r,(a,l)=>a==="address"&&i[l]?i[l]:l),{domain:e,value:r}}static getPayload(e,t,r){qr.hashDomain(e);const s={},i=[];U1.forEach(l=>{const c=e[l];c!=null&&(s[l]=$X[l](c),i.push({name:l,type:gI[l]}))});const o=qr.from(t);t=o.types;const a=Object.assign({},t);return z(a.EIP712Domain==null,"types must not contain EIP712Domain type","types.EIP712Domain",t),a.EIP712Domain=i,o.encode(r),{types:a,domain:s,primaryType:o.primaryType,message:o.visit(r,(l,c)=>{if(l.match(/^bytes(\d*)/))return we(ct(c));if(l.match(/^u?int/))return xe(c).toString();switch(l){case"address":return c.toLowerCase();case"bool":return!!c;case"string":return z(typeof c=="string","invalid string","value",c),c}z(!1,"unsupported type","type",l)})}}};Uh=new WeakMap,Zi=new WeakMap,nf=new WeakMap,f0=new WeakSet,aF=function(e){{const s=V1(e);if(s)return s}const t=by(e).array;if(t){const s=t.prefix,i=this.getEncoder(s);return o=>{z(t.count===-1||t.count===o.length,`array length mismatch; expected length ${t.count}`,"value",o);let a=o.map(i);return T(this,Zi).has(s)&&(a=a.map(Xt)),Xt(zt(a))}}const r=this.types[e];if(r){const s=dl(T(this,Zi).get(e));return i=>{const o=r.map(({name:a,type:l})=>{const c=this.getEncoder(l)(i[a]);return T(this,Zi).has(l)?Xt(c):c});return o.unshift(s),zt(o)}}z(!1,`unknown type: ${e}`,"type",e)};let wy=qr;function Wn(n){const e=new Set;return n.forEach(t=>e.add(t)),Object.freeze(e)}const GX=Wn("external public payable override".split(" ")),wI="constant external internal payable private public pure view override",WX=Wn(wI.split(" ")),AI="constructor error event fallback function receive struct",vI=Wn(AI.split(" ")),xI="calldata memory storage payable indexed",KX=Wn(xI.split(" ")),QX=[AI,xI,"tuple returns",wI].join(" "),JX=Wn(QX.split(" ")),qX={"(":"OPEN_PAREN",")":"CLOSE_PAREN","[":"OPEN_BRACKET","]":"CLOSE_BRACKET",",":"COMMA","@":"AT"},YX=new RegExp("^(\\s*)"),XX=new RegExp("^([0-9]+)"),ZX=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"),EI=new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"),CI=new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"),d0=class d0{constructor(e){J(this,Vh);J(this,Cn);J(this,ks);L(this,Cn,0),L(this,ks,e.slice())}get offset(){return T(this,Cn)}get length(){return T(this,ks).length-T(this,Cn)}clone(){return new d0(T(this,ks))}reset(){L(this,Cn,0)}popKeyword(e){const t=this.peek();if(t.type!=="KEYWORD"||!e.has(t.text))throw new Error(`expected keyword ${t.text}`);return this.pop().text}popType(e){if(this.peek().type!==e){const t=this.peek();throw new Error(`expected ${e}; got ${t.type} ${JSON.stringify(t.text)}`)}return this.pop().text}popParen(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=fe(this,Vh,ME).call(this,T(this,Cn)+1,e.match+1);return L(this,Cn,e.match+1),t}popParams(){const e=this.peek();if(e.type!=="OPEN_PAREN")throw new Error("bad start");const t=[];for(;T(this,Cn)<e.match-1;){const r=this.peek().linkNext;t.push(fe(this,Vh,ME).call(this,T(this,Cn)+1,r)),L(this,Cn,r)}return L(this,Cn,e.match+1),t}peek(){if(T(this,Cn)>=T(this,ks).length)throw new Error("out-of-bounds");return T(this,ks)[T(this,Cn)]}peekKeyword(e){const t=this.peekType("KEYWORD");return t!=null&&e.has(t)?t:null}peekType(e){if(this.length===0)return null;const t=this.peek();return t.type===e?t.text:null}pop(){const e=this.peek();return Xh(this,Cn)._++,e}toString(){const e=[];for(let t=T(this,Cn);t<T(this,ks).length;t++){const r=T(this,ks)[t];e.push(`${r.type}:${r.text}`)}return`<TokenString ${e.join(" ")}>`}};Cn=new WeakMap,ks=new WeakMap,Vh=new WeakSet,ME=function(e=0,t=0){return new d0(T(this,ks).slice(e,t).map(r=>Object.freeze(Object.assign({},r,{match:r.match-e,linkBack:r.linkBack-e,linkNext:r.linkNext-e}))))};let As=d0;function Go(n){const e=[],t=o=>{const a=i<n.length?JSON.stringify(n[i]):"$EOI";throw new Error(`invalid token ${a} at ${i}: ${o}`)};let r=[],s=[],i=0;for(;i<n.length;){let o=n.substring(i),a=o.match(YX);a&&(i+=a[1].length,o=n.substring(i));const l={depth:r.length,linkBack:-1,linkNext:-1,match:-1,type:"",text:"",offset:i,value:-1};e.push(l);let c=qX[o[0]]||"";if(c){if(l.type=c,l.text=o[0],i++,c==="OPEN_PAREN")r.push(e.length-1),s.push(e.length-1);else if(c=="CLOSE_PAREN")r.length===0&&t("no matching open bracket"),l.match=r.pop(),e[l.match].match=e.length-1,l.depth--,l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1;else if(c==="COMMA")l.linkBack=s.pop(),e[l.linkBack].linkNext=e.length-1,s.push(e.length-1);else if(c==="OPEN_BRACKET")l.type="BRACKET";else if(c==="CLOSE_BRACKET"){let u=e.pop().text;if(e.length>0&&e[e.length-1].type==="NUMBER"){const f=e.pop().text;u=f+u,e[e.length-1].value=Je(f)}if(e.length===0||e[e.length-1].type!=="BRACKET")throw new Error("missing opening bracket");e[e.length-1].text+=u}continue}if(a=o.match(ZX),a){if(l.text=a[1],i+=l.text.length,JX.has(l.text)){l.type="KEYWORD";continue}if(l.text.match(CI)){l.type="TYPE";continue}l.type="ID";continue}if(a=o.match(XX),a){l.text=a[1],l.type="NUMBER",i+=l.text.length;continue}throw new Error(`unexpected token ${JSON.stringify(o[0])} at position ${i}`)}return new As(e.map(o=>Object.freeze(o)))}function kI(n,e){let t=[];for(const r in e.keys())n.has(r)&&t.push(r);if(t.length>1)throw new Error(`conflicting types: ${t.join(", ")}`)}function Ay(n,e){if(e.peekKeyword(vI)){const t=e.pop().text;if(t!==n)throw new Error(`expected ${n}, got ${t}`)}return e.popType("ID")}function Ii(n,e){const t=new Set;for(;;){const r=n.peekType("KEYWORD");if(r==null||e&&!e.has(r))break;if(n.pop(),t.has(r))throw new Error(`duplicate keywords: ${JSON.stringify(r)}`);t.add(r)}return Object.freeze(t)}function SI(n){let e=Ii(n,WX);return kI(e,Wn("constant payable nonpayable".split(" "))),kI(e,Wn("pure view payable nonpayable".split(" "))),e.has("view")?"view":e.has("pure")?"pure":e.has("payable")?"payable":e.has("nonpayable")?"nonpayable":e.has("constant")?"view":"nonpayable"}function Li(n,e){return n.popParams().map(t=>An.from(t,e))}function TI(n){if(n.peekType("AT")){if(n.pop(),n.peekType("NUMBER"))return xe(n.pop().text);throw new Error("invalid gas")}return null}function ml(n){if(n.length)throw new Error(`unexpected tokens at offset ${n.offset}: ${n.toString()}`)}const eZ=new RegExp(/^(.*)\[([0-9]*)\]$/);function OI(n){const e=n.match(CI);if(z(e,"invalid type","type",n),n==="uint")return"uint256";if(n==="int")return"int256";if(e[2]){const t=parseInt(e[2]);z(t!==0&&t<=32,"invalid bytes length","type",n)}else if(e[3]){const t=parseInt(e[3]);z(t!==0&&t<=256&&t%8===0,"invalid numeric width","type",n)}return n}const Lt={},ar=Symbol.for("_ethers_internal"),NI="_ParamTypeInternal",MI="_ErrorInternal",RI="_EventInternal",PI="_ConstructorInternal",DI="_FallbackInternal",II="_FunctionInternal",LI="_StructInternal",Yr=class Yr{constructor(e,t,r,s,i,o,a,l){J(this,rf);G(this,"name");G(this,"type");G(this,"baseType");G(this,"indexed");G(this,"components");G(this,"arrayLength");G(this,"arrayChildren");if(qg(e,Lt,"ParamType"),Object.defineProperty(this,ar,{value:NI}),o&&(o=Object.freeze(o.slice())),s==="array"){if(a==null||l==null)throw new Error("")}else if(a!=null||l!=null)throw new Error("");if(s==="tuple"){if(o==null)throw new Error("")}else if(o!=null)throw new Error("");Ne(this,{name:t,type:r,baseType:s,indexed:i,components:o,arrayLength:a,arrayChildren:l})}format(e){if(e==null&&(e="sighash"),e==="json"){const r=this.name||"";if(this.isArray()){const i=JSON.parse(this.arrayChildren.format("json"));return i.name=r,i.type+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`,JSON.stringify(i)}const s={type:this.baseType==="tuple"?"tuple":this.type,name:r};return typeof this.indexed=="boolean"&&(s.indexed=this.indexed),this.isTuple()&&(s.components=this.components.map(i=>JSON.parse(i.format(e)))),JSON.stringify(s)}let t="";return this.isArray()?(t+=this.arrayChildren.format(e),t+=`[${this.arrayLength<0?"":String(this.arrayLength)}]`):this.isTuple()?t+="("+this.components.map(r=>r.format(e)).join(e==="full"?", ":",")+")":t+=this.type,e!=="sighash"&&(this.indexed===!0&&(t+=" indexed"),e==="full"&&this.name&&(t+=" "+this.name)),t}isArray(){return this.baseType==="array"}isTuple(){return this.baseType==="tuple"}isIndexable(){return this.indexed!=null}walk(e,t){if(this.isArray()){if(!Array.isArray(e))throw new Error("invalid array value");if(this.arrayLength!==-1&&e.length!==this.arrayLength)throw new Error("array is wrong length");const r=this;return e.map(s=>r.arrayChildren.walk(s,t))}if(this.isTuple()){if(!Array.isArray(e))throw new Error("invalid tuple value");if(e.length!==this.components.length)throw new Error("array is wrong length");const r=this;return e.map((s,i)=>r.components[i].walk(s,t))}return t(this.type,e)}async walkAsync(e,t){const r=[],s=[e];return fe(this,rf,w0).call(this,r,e,t,i=>{s[0]=i}),r.length&&await Promise.all(r),s[0]}static from(e,t){if(Yr.isParamType(e))return e;if(typeof e=="string")try{return Yr.from(Go(e),t)}catch{z(!1,"invalid param type","obj",e)}else if(e instanceof As){let a="",l="",c=null;Ii(e,Wn(["tuple"])).has("tuple")||e.peekType("OPEN_PAREN")?(l="tuple",c=e.popParams().map(m=>Yr.from(m)),a=`tuple(${c.map(m=>m.format()).join(",")})`):(a=OI(e.popType("TYPE")),l=a);let u=null,f=null;for(;e.length&&e.peekType("BRACKET");){const m=e.pop();u=new Yr(Lt,"",a,l,null,c,f,u),f=m.value,a+=m.text,l="array",c=null}let d=null;if(Ii(e,KX).has("indexed")){if(!t)throw new Error("");d=!0}const p=e.peekType("ID")?e.pop().text:"";if(e.length)throw new Error("leftover tokens");return new Yr(Lt,p,a,l,d,c,f,u)}const r=e.name;z(!r||typeof r=="string"&&r.match(EI),"invalid name","obj.name",r);let s=e.indexed;s!=null&&(z(t,"parameter cannot be indexed","obj.indexed",e.indexed),s=!!s);let i=e.type,o=i.match(eZ);if(o){const a=parseInt(o[2]||"-1"),l=Yr.from({type:o[1],components:e.components});return new Yr(Lt,r||"",i,"array",s,null,a,l)}if(i==="tuple"||i.startsWith("tuple(")||i.startsWith("(")){const a=e.components!=null?e.components.map(c=>Yr.from(c)):null;return new Yr(Lt,r||"",i,"tuple",s,a,null,null)}return i=OI(e.type),new Yr(Lt,r||"",i,i,s,null,null,null)}static isParamType(e){return e&&e[ar]===NI}};rf=new WeakSet,w0=function(e,t,r,s){if(this.isArray()){if(!Array.isArray(t))throw new Error("invalid array value");if(this.arrayLength!==-1&&t.length!==this.arrayLength)throw new Error("array is wrong length");const o=this.arrayChildren,a=t.slice();a.forEach((l,c)=>{var u;fe(u=o,rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}if(this.isTuple()){const o=this.components;let a;if(Array.isArray(t))a=t.slice();else{if(t==null||typeof t!="object")throw new Error("invalid tuple value");a=o.map(l=>{if(!l.name)throw new Error("cannot use object value with unnamed components");if(!(l.name in t))throw new Error(`missing value for component ${l.name}`);return t[l.name]})}if(a.length!==this.components.length)throw new Error("array is wrong length");a.forEach((l,c)=>{var u;fe(u=o[c],rf,w0).call(u,e,l,r,f=>{a[c]=f})}),s(a);return}const i=r(this.type,t);i.then?e.push(async function(){s(await i)}()):s(i)};let An=Yr;class gl{constructor(e,t,r){G(this,"type");G(this,"inputs");qg(e,Lt,"Fragment"),r=Object.freeze(r.slice()),Ne(this,{type:t,inputs:r})}static from(e){if(typeof e=="string"){try{gl.from(JSON.parse(e))}catch{}return gl.from(Go(e))}if(e instanceof As)switch(e.peekKeyword(vI)){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return yl.from(e)}else if(typeof e=="object"){switch(e.type){case"constructor":return Bi.from(e);case"error":return lr.from(e);case"event":return Zs.from(e);case"fallback":case"receive":return _i.from(e);case"function":return ei.from(e);case"struct":return yl.from(e)}ee(!1,`unsupported type: ${e.type}`,"UNSUPPORTED_OPERATION",{operation:"Fragment.from"})}z(!1,"unsupported frgament object","obj",e)}static isConstructor(e){return Bi.isFragment(e)}static isError(e){return lr.isFragment(e)}static isEvent(e){return Zs.isFragment(e)}static isFunction(e){return ei.isFragment(e)}static isStruct(e){return yl.isFragment(e)}}class vy extends gl{constructor(t,r,s,i){super(t,r,i);G(this,"name");z(typeof s=="string"&&s.match(EI),"invalid identifier","name",s),i=Object.freeze(i.slice()),Ne(this,{name:s})}}function ph(n,e){return"("+e.map(t=>t.format(n)).join(n==="full"?", ":",")+")"}class lr extends vy{constructor(e,t,r){super(e,"error",t,r),Object.defineProperty(this,ar,{value:MI})}get selector(){return dl(this.format("sighash")).substring(0,10)}format(e){if(e==null&&(e="sighash"),e==="json")return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map(r=>JSON.parse(r.format(e)))});const t=[];return e!=="sighash"&&t.push("error"),t.push(this.name+ph(e,this.inputs)),t.join(" ")}static from(e){if(lr.isFragment(e))return e;if(typeof e=="string")return lr.from(Go(e));if(e instanceof As){const t=Ay("error",e),r=Li(e);return ml(e),new lr(Lt,t,r)}return new lr(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===MI}}class Zs extends vy{constructor(t,r,s,i){super(t,"event",r,s);G(this,"anonymous");Object.defineProperty(this,ar,{value:RI}),Ne(this,{anonymous:i})}get topicHash(){return dl(this.format("sighash"))}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("event"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&this.anonymous&&r.push("anonymous"),r.join(" ")}static getTopicHash(t,r){return r=(r||[]).map(i=>An.from(i)),new Zs(Lt,t,r,!1).topicHash}static from(t){if(Zs.isFragment(t))return t;if(typeof t=="string")try{return Zs.from(Go(t))}catch{z(!1,"invalid event fragment","obj",t)}else if(t instanceof As){const r=Ay("event",t),s=Li(t,!0),i=!!Ii(t,Wn(["anonymous"])).has("anonymous");return ml(t),new Zs(Lt,r,s,i)}return new Zs(Lt,t.name,t.inputs?t.inputs.map(r=>An.from(r,!0)):[],!!t.anonymous)}static isFragment(t){return t&&t[ar]===RI}}class Bi extends gl{constructor(t,r,s,i,o){super(t,r,s);G(this,"payable");G(this,"gas");Object.defineProperty(this,ar,{value:PI}),Ne(this,{payable:i,gas:o})}format(t){if(ee(t!=null&&t!=="sighash","cannot format a constructor for sighash","UNSUPPORTED_OPERATION",{operation:"format(sighash)"}),t==="json")return JSON.stringify({type:"constructor",stateMutability:this.payable?"payable":"undefined",payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t)))});const r=[`constructor${ph(t,this.inputs)}`];return this.payable&&r.push("payable"),this.gas!=null&&r.push(`@${this.gas.toString()}`),r.join(" ")}static from(t){if(Bi.isFragment(t))return t;if(typeof t=="string")try{return Bi.from(Go(t))}catch{z(!1,"invalid constuctor fragment","obj",t)}else if(t instanceof As){Ii(t,Wn(["constructor"]));const r=Li(t),s=!!Ii(t,GX).has("payable"),i=TI(t);return ml(t),new Bi(Lt,"constructor",r,s,i)}return new Bi(Lt,"constructor",t.inputs?t.inputs.map(An.from):[],!!t.payable,t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===PI}}class _i extends gl{constructor(t,r,s){super(t,"fallback",r);G(this,"payable");Object.defineProperty(this,ar,{value:DI}),Ne(this,{payable:s})}format(t){const r=this.inputs.length===0?"receive":"fallback";if(t==="json"){const s=this.payable?"payable":"nonpayable";return JSON.stringify({type:r,stateMutability:s})}return`${r}()${this.payable?" payable":""}`}static from(t){if(_i.isFragment(t))return t;if(typeof t=="string")try{return _i.from(Go(t))}catch{z(!1,"invalid fallback fragment","obj",t)}else if(t instanceof As){const r=t.toString(),s=t.peekKeyword(Wn(["fallback","receive"]));if(z(s,"type must be fallback or receive","obj",r),t.popKeyword(Wn(["fallback","receive"]))==="receive"){const l=Li(t);return z(l.length===0,"receive cannot have arguments","obj.inputs",l),Ii(t,Wn(["payable"])),ml(t),new _i(Lt,[],!0)}let o=Li(t);o.length?z(o.length===1&&o[0].type==="bytes","invalid fallback inputs","obj.inputs",o.map(l=>l.format("minimal")).join(", ")):o=[An.from("bytes")];const a=SI(t);if(z(a==="nonpayable"||a==="payable","fallback cannot be constants","obj.stateMutability",a),Ii(t,Wn(["returns"])).has("returns")){const l=Li(t);z(l.length===1&&l[0].type==="bytes","invalid fallback outputs","obj.outputs",l.map(c=>c.format("minimal")).join(", "))}return ml(t),new _i(Lt,o,a==="payable")}if(t.type==="receive")return new _i(Lt,[],!0);if(t.type==="fallback"){const r=[An.from("bytes")],s=t.stateMutability==="payable";return new _i(Lt,r,s)}z(!1,"invalid fallback description","obj",t)}static isFragment(t){return t&&t[ar]===DI}}class ei extends vy{constructor(t,r,s,i,o,a){super(t,"function",r,i);G(this,"constant");G(this,"outputs");G(this,"stateMutability");G(this,"payable");G(this,"gas");Object.defineProperty(this,ar,{value:II}),o=Object.freeze(o.slice()),Ne(this,{constant:s==="view"||s==="pure",gas:a,outputs:o,payable:s==="payable",stateMutability:s})}get selector(){return dl(this.format("sighash")).substring(0,10)}format(t){if(t==null&&(t="sighash"),t==="json")return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:this.stateMutability!=="nonpayable"?this.stateMutability:void 0,payable:this.payable,gas:this.gas!=null?this.gas:void 0,inputs:this.inputs.map(s=>JSON.parse(s.format(t))),outputs:this.outputs.map(s=>JSON.parse(s.format(t)))});const r=[];return t!=="sighash"&&r.push("function"),r.push(this.name+ph(t,this.inputs)),t!=="sighash"&&(this.stateMutability!=="nonpayable"&&r.push(this.stateMutability),this.outputs&&this.outputs.length&&(r.push("returns"),r.push(ph(t,this.outputs))),this.gas!=null&&r.push(`@${this.gas.toString()}`)),r.join(" ")}static getSelector(t,r){return r=(r||[]).map(i=>An.from(i)),new ei(Lt,t,"view",r,[],null).selector}static from(t){if(ei.isFragment(t))return t;if(typeof t=="string")try{return ei.from(Go(t))}catch{z(!1,"invalid function fragment","obj",t)}else if(t instanceof As){const s=Ay("function",t),i=Li(t),o=SI(t);let a=[];Ii(t,Wn(["returns"])).has("returns")&&(a=Li(t));const l=TI(t);return ml(t),new ei(Lt,s,o,i,a,l)}let r=t.stateMutability;return r==null&&(r="payable",typeof t.constant=="boolean"?(r="view",t.constant||(r="payable",typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable"))):typeof t.payable=="boolean"&&!t.payable&&(r="nonpayable")),new ei(Lt,t.name,r,t.inputs?t.inputs.map(An.from):[],t.outputs?t.outputs.map(An.from):[],t.gas!=null?t.gas:null)}static isFragment(t){return t&&t[ar]===II}}class yl extends vy{constructor(e,t,r){super(e,"struct",t,r),Object.defineProperty(this,ar,{value:LI})}format(){throw new Error("@TODO")}static from(e){if(typeof e=="string")try{return yl.from(Go(e))}catch{z(!1,"invalid struct fragment","obj",e)}else if(e instanceof As){const t=Ay("struct",e),r=Li(e);return ml(e),new yl(Lt,t,r)}return new yl(Lt,e.name,e.inputs?e.inputs.map(An.from):[])}static isFragment(e){return e&&e[ar]===LI}}const vs=new Map;vs.set(0,"GENERIC_PANIC"),vs.set(1,"ASSERT_FALSE"),vs.set(17,"OVERFLOW"),vs.set(18,"DIVIDE_BY_ZERO"),vs.set(33,"ENUM_RANGE_ERROR"),vs.set(34,"BAD_STORAGE_DATA"),vs.set(49,"STACK_UNDERFLOW"),vs.set(50,"ARRAY_RANGE_ERROR"),vs.set(65,"OUT_OF_MEMORY"),vs.set(81,"UNINITIALIZED_FUNCTION_CALL");const tZ=new RegExp(/^bytes([0-9]*)$/),nZ=new RegExp(/^(u?int)([0-9]*)$/);let H1=null,BI=1024;function rZ(n,e,t,r){let s="missing revert data",i=null;const o=null;let a=null;if(t){s="execution reverted";const c=ct(t);if(t=we(t),c.length===0)s+=" (no data present; likely require(false) occurred",i="require(false)";else if(c.length%32!==4)s+=" (could not decode reason; invalid data length)";else if(we(c.slice(0,4))==="0x08c379a0")try{i=r.decode(["string"],c.slice(4))[0],a={signature:"Error(string)",name:"Error",args:[i]},s+=`: ${JSON.stringify(i)}`}catch{s+=" (could not decode reason; invalid string data)"}else if(we(c.slice(0,4))==="0x4e487b71")try{const u=Number(r.decode(["uint256"],c.slice(4))[0]);a={signature:"Panic(uint256)",name:"Panic",args:[u]},i=`Panic due to ${vs.get(u)||"UNKNOWN"}(${u})`,s+=`: ${i}`}catch{s+=" (could not decode panic code)"}else s+=" (unknown custom error)"}const l={to:e.to?pt(e.to):null,data:e.data||"0x"};return e.from&&(l.from=pt(e.from)),Mt(s,"CALL_EXCEPTION",{action:n,data:t,reason:i,transaction:l,invocation:o,revert:a})}const h0=class h0{constructor(){J(this,ra)}getDefaultValue(e){const t=e.map(s=>fe(this,ra,Tf).call(this,An.from(s)));return new cy(t,"_").defaultValue()}encode(e,t){gP(t.length,e.length,"types/values length mismatch");const r=e.map(o=>fe(this,ra,Tf).call(this,An.from(o))),s=new cy(r,"_"),i=new s1;return s.encode(i,t),i.data}decode(e,t,r){const s=e.map(o=>fe(this,ra,Tf).call(this,An.from(o)));return new cy(s,"_").decode(new i1(t,r,BI))}static _setDefaultMaxInflation(e){z(typeof e=="number"&&Number.isInteger(e),"invalid defaultMaxInflation factor","value",e),BI=e}static defaultAbiCoder(){return H1==null&&(H1=new h0),H1}static getBuiltinCallException(e,t,r){return rZ(e,t,r,h0.defaultAbiCoder())}};ra=new WeakSet,Tf=function(e){if(e.isArray())return new OY(fe(this,ra,Tf).call(this,e.arrayChildren),e.arrayLength,e.name);if(e.isTuple())return new cy(e.components.map(r=>fe(this,ra,Tf).call(this,r)),e.name);switch(e.baseType){case"address":return new SY(e.name);case"bool":return new NY(e.name);case"string":return new FY(e.name);case"bytes":return new MY(e.name);case"":return new DY(e.name)}let t=e.type.match(nZ);if(t){let r=parseInt(t[2]||"256");return z(r!==0&&r<=256&&r%8===0,"invalid "+t[1]+" bit length","param",e),new _Y(r/8,t[1]==="int",e.name)}if(t=e.type.match(tZ),t){let r=parseInt(t[1]);return z(r!==0&&r<=32,"invalid bytes length","param",e),new RY(r,e.name)}z(!1,"invalid type","type",e.type)};let yu=h0;class sZ{constructor(e,t,r){G(this,"fragment");G(this,"name");G(this,"signature");G(this,"topic");G(this,"args");const s=e.name,i=e.format();Ne(this,{fragment:e,name:s,signature:i,topic:t,args:r})}}class iZ{constructor(e,t,r,s){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");G(this,"value");const i=e.name,o=e.format();Ne(this,{fragment:e,name:i,args:r,signature:o,selector:t,value:s})}}class oZ{constructor(e,t,r){G(this,"fragment");G(this,"name");G(this,"args");G(this,"signature");G(this,"selector");const s=e.name,i=e.format();Ne(this,{fragment:e,name:s,args:r,signature:i,selector:t})}}class _I{constructor(e){G(this,"hash");G(this,"_isIndexed");Ne(this,{hash:e,_isIndexed:!0})}static isIndexed(e){return!!(e&&e._isIndexed)}}const FI={0:"generic panic",1:"assert(false)",17:"arithmetic overflow",18:"division or modulo by zero",33:"enum overflow",34:"invalid encoded storage byte array accessed",49:"out-of-bounds array access; popping on an empty array",50:"out-of-bounds access of an array or bytesN",65:"out of memory",81:"uninitialized function"},jI={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:n=>`reverted with reason string ${JSON.stringify(n)}`},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"],reason:n=>{let e="unknown panic code";return n>=0&&n<=255&&FI[n.toString()]&&(e=FI[n.toString()]),`reverted with panic code 0x${n.toString(16)} (${e})`}}},Vl=class Vl{constructor(e){J(this,ai);G(this,"fragments");G(this,"deploy");G(this,"fallback");G(this,"receive");J(this,si);J(this,ii);J(this,oi);J(this,Pn);let t=[];typeof e=="string"?t=JSON.parse(e):t=e,L(this,oi,new Map),L(this,si,new Map),L(this,ii,new Map);const r=[];for(const o of t)try{r.push(gl.from(o))}catch(a){console.log(`[Warning] Invalid Fragment ${JSON.stringify(o)}:`,a.message)}Ne(this,{fragments:Object.freeze(r)});let s=null,i=!1;L(this,Pn,this.getAbiCoder()),this.fragments.forEach((o,a)=>{let l;switch(o.type){case"constructor":if(this.deploy){console.log("duplicate definition - constructor");return}Ne(this,{deploy:o});return;case"fallback":o.inputs.length===0?i=!0:(z(!s||o.payable!==s.payable,"conflicting fallback fragments",`fragments[${a}]`,o),s=o,i=s.payable);return;case"function":l=T(this,oi);break;case"event":l=T(this,ii);break;case"error":l=T(this,si);break;default:return}const c=o.format();l.has(c)||l.set(c,o)}),this.deploy||Ne(this,{deploy:Bi.from("constructor()")}),Ne(this,{fallback:s,receive:i})}format(e){const t=e?"minimal":"full";return this.fragments.map(s=>s.format(t))}formatJson(){const e=this.fragments.map(t=>t.format("json"));return JSON.stringify(e.map(t=>JSON.parse(t)))}getAbiCoder(){return yu.defaultAbiCoder()}getFunctionName(e){const t=fe(this,ai,A0).call(this,e,null,!1);return z(t,"no matching function","key",e),t.name}hasFunction(e){return!!fe(this,ai,A0).call(this,e,null,!1)}getFunction(e,t){return fe(this,ai,A0).call(this,e,t||null,!0)}forEachFunction(e){const t=Array.from(T(this,oi).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,oi).get(s),r)}}getEventName(e){const t=fe(this,ai,v0).call(this,e,null,!1);return z(t,"no matching event","key",e),t.name}hasEvent(e){return!!fe(this,ai,v0).call(this,e,null,!1)}getEvent(e,t){return fe(this,ai,v0).call(this,e,t||null,!0)}forEachEvent(e){const t=Array.from(T(this,ii).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,ii).get(s),r)}}getError(e,t){if(Ct(e)){const s=e.toLowerCase();if(jI[s])return lr.from(jI[s].signature);for(const i of T(this,si).values())if(s===i.selector)return i;return null}if(e.indexOf("(")===-1){const s=[];for(const[i,o]of T(this,si))i.split("(")[0]===e&&s.push(o);if(s.length===0)return e==="Error"?lr.from("error Error(string)"):e==="Panic"?lr.from("error Panic(uint256)"):null;if(s.length>1){const i=s.map(o=>JSON.stringify(o.format())).join(", ");z(!1,`ambiguous error description (i.e. ${i})`,"name",e)}return s[0]}if(e=lr.from(e).format(),e==="Error(string)")return lr.from("error Error(string)");if(e==="Panic(uint256)")return lr.from("error Panic(uint256)");const r=T(this,si).get(e);return r||null}forEachError(e){const t=Array.from(T(this,si).keys());t.sort((r,s)=>r.localeCompare(s));for(let r=0;r<t.length;r++){const s=t[r];e(T(this,si).get(s),r)}}_decodeParams(e,t){return T(this,Pn).decode(e,t)}_encodeParams(e,t){return T(this,Pn).encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);z(r,"unknown error","fragment",e),e=r}return z(Vt(t,0,4)===e.selector,`data signature does not match error ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeErrorResult(e,t){if(typeof e=="string"){const r=this.getError(e);z(r,"unknown error","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return z(Vt(t,0,4)===e.selector,`data signature does not match function ${e.name}.`,"data",t),this._decodeParams(e.inputs,Vt(t,4))}encodeFunctionData(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return zt([e.selector,this._encodeParams(e.inputs,t||[])])}decodeFunctionResult(e,t){if(typeof e=="string"){const i=this.getFunction(e);z(i,"unknown function","fragment",e),e=i}let r="invalid length for result data";const s=Vn(t);if(s.length%32===0)try{return T(this,Pn).decode(e.outputs,s)}catch{r="could not decode result data"}ee(!1,r,"BAD_DATA",{value:we(s),info:{method:e.name,signature:e.format()}})}makeError(e,t){const r=ct(e,"data"),s=yu.getBuiltinCallException("call",t,r);if(s.message.startsWith("execution reverted (unknown custom error)")){const a=we(r.slice(0,4)),l=this.getError(a);if(l)try{const c=T(this,Pn).decode(l.inputs,r.slice(4));s.revert={name:l.name,signature:l.format(),args:c},s.reason=s.revert.signature,s.message=`execution reverted: ${s.reason}`}catch{s.message="execution reverted (coult not decode custom error)"}}const o=this.parseTransaction(t);return o&&(s.invocation={method:o.name,signature:o.signature,args:o.args}),s}encodeFunctionResult(e,t){if(typeof e=="string"){const r=this.getFunction(e);z(r,"unknown function","fragment",e),e=r}return we(T(this,Pn).encode(e.outputs,t||[]))}encodeFilterTopics(e,t){if(typeof e=="string"){const i=this.getEvent(e);z(i,"unknown event","eventFragment",e),e=i}ee(t.length<=e.inputs.length,`too many arguments for ${e.format()}`,"UNEXPECTED_ARGUMENT",{count:t.length,expectedCount:e.inputs.length});const r=[];e.anonymous||r.push(e.topicHash);const s=(i,o)=>i.type==="string"?dl(o):i.type==="bytes"?Xt(we(o)):(i.type==="bool"&&typeof o=="boolean"?o=o?"0x01":"0x00":i.type.match(/^u?int/)?o=_o(o):i.type.match(/^bytes/)?o=UJ(o,32):i.type==="address"&&T(this,Pn).encode(["address"],[o]),il(we(o),32));for(t.forEach((i,o)=>{const a=e.inputs[o];if(!a.indexed){z(i==null,"cannot filter non-indexed parameters; must be null","contract."+a.name,i);return}i==null?r.push(null):a.baseType==="array"||a.baseType==="tuple"?z(!1,"filtering with tuples or arrays not supported","contract."+a.name,i):Array.isArray(i)?r.push(i.map(l=>s(a,l))):r.push(s(a,i))});r.length&&r[r.length-1]===null;)r.pop();return r}encodeEventLog(e,t){if(typeof e=="string"){const o=this.getEvent(e);z(o,"unknown event","eventFragment",e),e=o}const r=[],s=[],i=[];return e.anonymous||r.push(e.topicHash),z(t.length===e.inputs.length,"event arguments/values mismatch","values",t),e.inputs.forEach((o,a)=>{const l=t[a];if(o.indexed)if(o.type==="string")r.push(dl(l));else if(o.type==="bytes")r.push(Xt(l));else{if(o.baseType==="tuple"||o.baseType==="array")throw new Error("not implemented");r.push(T(this,Pn).encode([o.type],[l]))}else s.push(o),i.push(l)}),{data:T(this,Pn).encode(s,i),topics:r}}decodeEventLog(e,t,r){if(typeof e=="string"){const h=this.getEvent(e);z(h,"unknown event","eventFragment",e),e=h}if(r!=null&&!e.anonymous){const h=e.topicHash;z(Ct(r[0],32)&&r[0].toLowerCase()===h,"fragment/topic mismatch","topics[0]",r[0]),r=r.slice(1)}const s=[],i=[],o=[];e.inputs.forEach((h,p)=>{h.indexed?h.type==="string"||h.type==="bytes"||h.baseType==="tuple"||h.baseType==="array"?(s.push(An.from({type:"bytes32",name:h.name})),o.push(!0)):(s.push(h),o.push(!1)):(i.push(h),o.push(!1))});const a=r!=null?T(this,Pn).decode(s,zt(r)):null,l=T(this,Pn).decode(i,t,!0),c=[],u=[];let f=0,d=0;return e.inputs.forEach((h,p)=>{let m=null;if(h.indexed)if(a==null)m=new _I(null);else if(o[p])m=new _I(a[d++]);else try{m=a[d++]}catch(y){m=y}else try{m=l[f++]}catch(y){m=y}c.push(m),u.push(h.name||null)}),ou.fromItems(c,u)}parseTransaction(e){const t=ct(e.data,"tx.data"),r=xe(e.value!=null?e.value:0,"tx.value"),s=this.getFunction(we(t.slice(0,4)));if(!s)return null;const i=T(this,Pn).decode(s.inputs,t.slice(4));return new iZ(s,s.selector,i,r)}parseCallResult(e){throw new Error("@TODO")}parseLog(e){const t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new sZ(t,t.topicHash,this.decodeEventLog(t,e.data,e.topics))}parseError(e){const t=we(e),r=this.getError(Vt(t,0,4));if(!r)return null;const s=T(this,Pn).decode(r.inputs,Vt(t,4));return new oZ(r,r.selector,s)}static from(e){return e instanceof Vl?e:typeof e=="string"?new Vl(JSON.parse(e)):typeof e.formatJson=="function"?new Vl(e.formatJson()):typeof e.format=="function"?new Vl(e.format("json")):new Vl(e)}};si=new WeakMap,ii=new WeakMap,oi=new WeakMap,Pn=new WeakMap,ai=new WeakSet,A0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,oi).values())if(i===o.selector)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,oi))o.split("(")[0]===e&&i.push(a);if(t){const o=t.length>0?t[t.length-1]:null;let a=t.length,l=!0;Nn.isTyped(o)&&o.type==="overrides"&&(l=!1,a--);for(let c=i.length-1;c>=0;c--){const u=i[c].inputs.length;u!==a&&(!l||u!==a-1)&&i.splice(c,1)}for(let c=i.length-1;c>=0;c--){const u=i[c].inputs;for(let f=0;f<t.length;f++)if(Nn.isTyped(t[f])){if(f>=u.length){if(t[f].type==="overrides")continue;i.splice(c,1);break}if(t[f].type!==u[f].baseType){i.splice(c,1);break}}}}if(i.length===1&&t&&t.length!==i[0].inputs.length){const o=t[t.length-1];(o==null||Array.isArray(o)||typeof o!="object")&&i.splice(0,1)}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");z(!1,`ambiguous function description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,oi).get(ei.from(e).format());return s||null},v0=function(e,t,r){if(Ct(e)){const i=e.toLowerCase();for(const o of T(this,ii).values())if(i===o.topicHash)return o;return null}if(e.indexOf("(")===-1){const i=[];for(const[o,a]of T(this,ii))o.split("(")[0]===e&&i.push(a);if(t){for(let o=i.length-1;o>=0;o--)i[o].inputs.length<t.length&&i.splice(o,1);for(let o=i.length-1;o>=0;o--){const a=i[o].inputs;for(let l=0;l<t.length;l++)if(Nn.isTyped(t[l])&&t[l].type!==a[l].baseType){i.splice(o,1);break}}}if(i.length===0)return null;if(i.length>1&&r){const o=i.map(a=>JSON.stringify(a.format())).join(", ");z(!1,`ambiguous event description (i.e. matches ${o})`,"key",e)}return i[0]}const s=T(this,ii).get(Zs.from(e).format());return s||null};let z1=Vl;const UI=BigInt(0);function bu(n){return n??null}function Wt(n){return n==null?null:n.toString()}class VI{constructor(e,t,r){G(this,"gasPrice");G(this,"maxFeePerGas");G(this,"maxPriorityFeePerGas");Ne(this,{gasPrice:bu(e),maxFeePerGas:bu(t),maxPriorityFeePerGas:bu(r)})}toJSON(){const{gasPrice:e,maxFeePerGas:t,maxPriorityFeePerGas:r}=this;return{_type:"FeeData",gasPrice:Wt(e),maxFeePerGas:Wt(t),maxPriorityFeePerGas:Wt(r)}}}function xy(n){const e={};n.to&&(e.to=n.to),n.from&&(e.from=n.from),n.data&&(e.data=we(n.data));const t="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const s of t)!(s in n)||n[s]==null||(e[s]=xe(n[s],`request.${s}`));const r="type,nonce".split(/,/);for(const s of r)!(s in n)||n[s]==null||(e[s]=Je(n[s],`request.${s}`));return n.accessList&&(e.accessList=$o(n.accessList)),"blockTag"in n&&(e.blockTag=n.blockTag),"enableCcipRead"in n&&(e.enableCcipRead=!!n.enableCcipRead),"customData"in n&&(e.customData=n.customData),"blobVersionedHashes"in n&&n.blobVersionedHashes&&(e.blobVersionedHashes=n.blobVersionedHashes.slice()),"kzg"in n&&(e.kzg=n.kzg),"blobs"in n&&n.blobs&&(e.blobs=n.blobs.map(s=>Zv(s)?we(s):Object.assign({},s))),e}class aZ{constructor(e,t){G(this,"provider");G(this,"number");G(this,"hash");G(this,"timestamp");G(this,"parentHash");G(this,"parentBeaconBlockRoot");G(this,"nonce");G(this,"difficulty");G(this,"gasLimit");G(this,"gasUsed");G(this,"stateRoot");G(this,"receiptsRoot");G(this,"blobGasUsed");G(this,"excessBlobGas");G(this,"miner");G(this,"prevRandao");G(this,"extraData");G(this,"baseFeePerGas");J(this,eo);L(this,eo,e.transactions.map(r=>typeof r!="string"?new gh(r,t):r)),Ne(this,{provider:t,hash:bu(e.hash),number:e.number,timestamp:e.timestamp,parentHash:e.parentHash,parentBeaconBlockRoot:e.parentBeaconBlockRoot,nonce:e.nonce,difficulty:e.difficulty,gasLimit:e.gasLimit,gasUsed:e.gasUsed,blobGasUsed:e.blobGasUsed,excessBlobGas:e.excessBlobGas,miner:e.miner,prevRandao:bu(e.prevRandao),extraData:e.extraData,baseFeePerGas:bu(e.baseFeePerGas),stateRoot:e.stateRoot,receiptsRoot:e.receiptsRoot})}get transactions(){return T(this,eo).map(e=>typeof e=="string"?e:e.hash)}get prefetchedTransactions(){const e=T(this,eo).slice();return e.length===0?[]:(ee(typeof e[0]=="object","transactions were not prefetched with block request","UNSUPPORTED_OPERATION",{operation:"transactionResponses()"}),e)}toJSON(){const{baseFeePerGas:e,difficulty:t,extraData:r,gasLimit:s,gasUsed:i,hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,timestamp:m,transactions:y}=this;return{_type:"Block",baseFeePerGas:Wt(e),difficulty:Wt(t),extraData:r,gasLimit:Wt(s),gasUsed:Wt(i),blobGasUsed:Wt(this.blobGasUsed),excessBlobGas:Wt(this.excessBlobGas),hash:o,miner:a,prevRandao:l,nonce:c,number:u,parentHash:f,timestamp:m,parentBeaconBlockRoot:d,stateRoot:h,receiptsRoot:p,transactions:y}}[Symbol.iterator](){let e=0;const t=this.transactions;return{next:()=>e<this.length?{value:t[e++],done:!1}:{value:void 0,done:!0}}}get length(){return T(this,eo).length}get date(){return this.timestamp==null?null:new Date(this.timestamp*1e3)}async getTransaction(e){let t;if(typeof e=="number")t=T(this,eo)[e];else{const r=e.toLowerCase();for(const s of T(this,eo))if(typeof s=="string"){if(s!==r)continue;t=s;break}else{if(s.hash===r)continue;t=s;break}}if(t==null)throw new Error("no such tx");return typeof t=="string"?await this.provider.getTransaction(t):t}getPrefetchedTransaction(e){const t=this.prefetchedTransactions;if(typeof e=="number")return t[e];e=e.toLowerCase();for(const r of t)if(r.hash===e)return r;z(!1,"no matching transaction","indexOrHash",e)}isMined(){return!!this.hash}isLondon(){return!!this.baseFeePerGas}orphanedEvent(){if(!this.isMined())throw new Error("");return lZ(this)}}eo=new WeakMap;class mh{constructor(e,t){G(this,"provider");G(this,"transactionHash");G(this,"blockHash");G(this,"blockNumber");G(this,"removed");G(this,"address");G(this,"data");G(this,"topics");G(this,"index");G(this,"transactionIndex");this.provider=t;const r=Object.freeze(e.topics.slice());Ne(this,{transactionHash:e.transactionHash,blockHash:e.blockHash,blockNumber:e.blockNumber,removed:e.removed,address:e.address,data:e.data,topics:r,index:e.index,transactionIndex:e.transactionIndex})}toJSON(){const{address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}=this;return{_type:"log",address:e,blockHash:t,blockNumber:r,data:s,index:i,removed:o,topics:a,transactionHash:l,transactionIndex:c}}async getBlock(){const e=await this.provider.getBlock(this.blockHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransaction(){const e=await this.provider.getTransaction(this.transactionHash);return ee(!!e,"failed to find transaction","UNKNOWN_ERROR",{}),e}async getTransactionReceipt(){const e=await this.provider.getTransactionReceipt(this.transactionHash);return ee(!!e,"failed to find transaction receipt","UNKNOWN_ERROR",{}),e}removedEvent(){return cZ(this)}}class HI{constructor(e,t){G(this,"provider");G(this,"to");G(this,"from");G(this,"contractAddress");G(this,"hash");G(this,"index");G(this,"blockHash");G(this,"blockNumber");G(this,"logsBloom");G(this,"gasUsed");G(this,"blobGasUsed");G(this,"cumulativeGasUsed");G(this,"gasPrice");G(this,"blobGasPrice");G(this,"type");G(this,"status");G(this,"root");J(this,Hh);L(this,Hh,Object.freeze(e.logs.map(s=>new mh(s,t))));let r=UI;e.effectiveGasPrice!=null?r=e.effectiveGasPrice:e.gasPrice!=null&&(r=e.gasPrice),Ne(this,{provider:t,to:e.to,from:e.from,contractAddress:e.contractAddress,hash:e.hash,index:e.index,blockHash:e.blockHash,blockNumber:e.blockNumber,logsBloom:e.logsBloom,gasUsed:e.gasUsed,cumulativeGasUsed:e.cumulativeGasUsed,blobGasUsed:e.blobGasUsed,gasPrice:r,blobGasPrice:e.blobGasPrice,type:e.type,status:e.status,root:e.root})}get logs(){return T(this,Hh)}toJSON(){const{to:e,from:t,contractAddress:r,hash:s,index:i,blockHash:o,blockNumber:a,logsBloom:l,logs:c,status:u,root:f}=this;return{_type:"TransactionReceipt",blockHash:o,blockNumber:a,contractAddress:r,cumulativeGasUsed:Wt(this.cumulativeGasUsed),from:t,gasPrice:Wt(this.gasPrice),blobGasUsed:Wt(this.blobGasUsed),blobGasPrice:Wt(this.blobGasPrice),gasUsed:Wt(this.gasUsed),hash:s,index:i,logs:c,logsBloom:l,root:f,status:u,to:e}}get length(){return this.logs.length}[Symbol.iterator](){let e=0;return{next:()=>e<this.length?{value:this.logs[e++],done:!1}:{value:void 0,done:!0}}}get fee(){return this.gasUsed*this.gasPrice}async getBlock(){const e=await this.provider.getBlock(this.blockHash);if(e==null)throw new Error("TODO");return e}async getTransaction(){const e=await this.provider.getTransaction(this.hash);if(e==null)throw new Error("TODO");return e}async getResult(){return await this.provider.getTransactionResult(this.hash)}async confirmations(){return await this.provider.getBlockNumber()-this.blockNumber+1}removedEvent(){return $I(this)}reorderedEvent(e){return ee(!e||e.isMined(),"unmined 'other' transction cannot be orphaned","UNSUPPORTED_OPERATION",{operation:"reorderedEvent(other)"}),zI(this,e)}}Hh=new WeakMap;const vE=class vE{constructor(e,t){G(this,"provider");G(this,"blockNumber");G(this,"blockHash");G(this,"index");G(this,"hash");G(this,"type");G(this,"to");G(this,"from");G(this,"nonce");G(this,"gasLimit");G(this,"gasPrice");G(this,"maxPriorityFeePerGas");G(this,"maxFeePerGas");G(this,"maxFeePerBlobGas");G(this,"data");G(this,"value");G(this,"chainId");G(this,"signature");G(this,"accessList");G(this,"blobVersionedHashes");J(this,sa);this.provider=t,this.blockNumber=e.blockNumber!=null?e.blockNumber:null,this.blockHash=e.blockHash!=null?e.blockHash:null,this.hash=e.hash,this.index=e.index,this.type=e.type,this.from=e.from,this.to=e.to||null,this.gasLimit=e.gasLimit,this.nonce=e.nonce,this.data=e.data,this.value=e.value,this.gasPrice=e.gasPrice,this.maxPriorityFeePerGas=e.maxPriorityFeePerGas!=null?e.maxPriorityFeePerGas:null,this.maxFeePerGas=e.maxFeePerGas!=null?e.maxFeePerGas:null,this.maxFeePerBlobGas=e.maxFeePerBlobGas!=null?e.maxFeePerBlobGas:null,this.chainId=e.chainId,this.signature=e.signature,this.accessList=e.accessList!=null?e.accessList:null,this.blobVersionedHashes=e.blobVersionedHashes!=null?e.blobVersionedHashes:null,L(this,sa,-1)}toJSON(){const{blockNumber:e,blockHash:t,index:r,hash:s,type:i,to:o,from:a,nonce:l,data:c,signature:u,accessList:f,blobVersionedHashes:d}=this;return{_type:"TransactionResponse",accessList:f,blockNumber:e,blockHash:t,blobVersionedHashes:d,chainId:Wt(this.chainId),data:c,from:a,gasLimit:Wt(this.gasLimit),gasPrice:Wt(this.gasPrice),hash:s,maxFeePerGas:Wt(this.maxFeePerGas),maxPriorityFeePerGas:Wt(this.maxPriorityFeePerGas),maxFeePerBlobGas:Wt(this.maxFeePerBlobGas),nonce:l,signature:u,to:o,index:r,type:i,value:Wt(this.value)}}async getBlock(){let e=this.blockNumber;if(e==null){const r=await this.getTransaction();r&&(e=r.blockNumber)}if(e==null)return null;const t=this.provider.getBlock(e);if(t==null)throw new Error("TODO");return t}async getTransaction(){return this.provider.getTransaction(this.hash)}async confirmations(){if(this.blockNumber==null){const{tx:t,blockNumber:r}=await On({tx:this.getTransaction(),blockNumber:this.provider.getBlockNumber()});return t==null||t.blockNumber==null?0:r-t.blockNumber+1}return await this.provider.getBlockNumber()-this.blockNumber+1}async wait(e,t){const r=e??1,s=t??0;let i=T(this,sa),o=-1,a=i===-1;const l=async()=>{if(a)return null;const{blockNumber:d,nonce:h}=await On({blockNumber:this.provider.getBlockNumber(),nonce:this.provider.getTransactionCount(this.from)});if(h<this.nonce){i=d;return}if(a)return null;const p=await this.getTransaction();if(!(p&&p.blockNumber!=null))for(o===-1&&(o=i-3,o<T(this,sa)&&(o=T(this,sa)));o<=d;){if(a)return null;const m=await this.provider.getBlock(o,!0);if(m==null)return;for(const y of m)if(y===this.hash)return;for(let y=0;y<m.length;y++){const b=await m.getTransaction(y);if(b.from===this.from&&b.nonce===this.nonce){if(a)return null;const v=await this.provider.getTransactionReceipt(b.hash);if(v==null||d-v.blockNumber+1<r)return;let A="replaced";b.data===this.data&&b.to===this.to&&b.value===this.value?A="repriced":b.data==="0x"&&b.from===b.to&&b.value===UI&&(A="cancelled"),ee(!1,"transaction was replaced","TRANSACTION_REPLACED",{cancelled:A==="replaced"||A==="cancelled",reason:A,replacement:b.replaceableTransaction(i),hash:b.hash,receipt:v})}}o++}},c=d=>{if(d==null||d.status!==0)return d;ee(!1,"transaction execution reverted","CALL_EXCEPTION",{action:"sendTransaction",data:null,reason:null,invocation:null,revert:null,transaction:{to:d.to,from:d.from,data:""},receipt:d})},u=await this.provider.getTransactionReceipt(this.hash);if(r===0)return c(u);if(u){if(await u.confirmations()>=r)return c(u)}else if(await l(),r===0)return null;return await new Promise((d,h)=>{const p=[],m=()=>{p.forEach(b=>b())};if(p.push(()=>{a=!0}),s>0){const b=setTimeout(()=>{m(),h(Mt("wait for transaction timeout","TIMEOUT"))},s);p.push(()=>{clearTimeout(b)})}const y=async b=>{if(await b.confirmations()>=r){m();try{d(c(b))}catch(v){h(v)}}};if(p.push(()=>{this.provider.off(this.hash,y)}),this.provider.on(this.hash,y),i>=0){const b=async()=>{try{await l()}catch(v){if(dn(v,"TRANSACTION_REPLACED")){m(),h(v);return}}a||this.provider.once("block",b)};p.push(()=>{this.provider.off("block",b)}),this.provider.once("block",b)}})}isMined(){return this.blockHash!=null}isLegacy(){return this.type===0}isBerlin(){return this.type===1}isLondon(){return this.type===2}isCancun(){return this.type===3}removedEvent(){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),$I(this)}reorderedEvent(e){return ee(this.isMined(),"unmined transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),ee(!e||e.isMined(),"unmined 'other' transaction canot be orphaned","UNSUPPORTED_OPERATION",{operation:"removeEvent()"}),zI(this,e)}replaceableTransaction(e){z(Number.isInteger(e)&&e>=0,"invalid startBlock","startBlock",e);const t=new vE(this,this.provider);return L(t,sa,e),t}};sa=new WeakMap;let gh=vE;function lZ(n){return{orphan:"drop-block",hash:n.hash,number:n.number}}function zI(n,e){return{orphan:"reorder-transaction",tx:n,other:e}}function $I(n){return{orphan:"drop-transaction",tx:n}}function cZ(n){return{orphan:"drop-log",log:{transactionHash:n.transactionHash,blockHash:n.blockHash,blockNumber:n.blockNumber,address:n.address,data:n.data,topics:Object.freeze(n.topics.slice()),index:n.index}}}class $1 extends mh{constructor(t,r,s){super(t,t.provider);G(this,"interface");G(this,"fragment");G(this,"args");const i=r.decodeEventLog(s,t.data,t.topics);Ne(this,{args:i,fragment:s,interface:r})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}class GI extends mh{constructor(t,r){super(t,t.provider);G(this,"error");Ne(this,{error:r})}}class uZ extends HI{constructor(t,r,s){super(s,r);J(this,sf);L(this,sf,t)}get logs(){return super.logs.map(t=>{const r=t.topics.length?T(this,sf).getEvent(t.topics[0]):null;if(r)try{return new $1(t,T(this,sf),r)}catch(s){return new GI(t,s)}return t})}}sf=new WeakMap;class G1 extends gh{constructor(t,r,s){super(s,r);J(this,zh);L(this,zh,t)}async wait(t,r){const s=await super.wait(t,r);return s==null?null:new uZ(T(this,zh),this.provider,s)}}zh=new WeakMap;class WI extends CP{constructor(t,r,s,i){super(t,r,s);G(this,"log");Ne(this,{log:i})}async getBlock(){return await this.log.getBlock()}async getTransaction(){return await this.log.getTransaction()}async getTransactionReceipt(){return await this.log.getTransactionReceipt()}}class fZ extends WI{constructor(e,t,r,s,i){super(e,t,r,new $1(i,e.interface,s));const o=e.interface.decodeEventLog(s,this.log.data,this.log.topics);Ne(this,{args:o,fragment:s})}get eventName(){return this.fragment.name}get eventSignature(){return this.fragment.format()}}const KI=BigInt(0);function QI(n){return n&&typeof n.call=="function"}function JI(n){return n&&typeof n.estimateGas=="function"}function Ey(n){return n&&typeof n.resolveName=="function"}function qI(n){return n&&typeof n.sendTransaction=="function"}function YI(n){if(n!=null){if(Ey(n))return n;if(n.provider)return n.provider}}class dZ{constructor(e,t,r){J(this,$h);G(this,"fragment");if(Ne(this,{fragment:t}),t.inputs.length<r.length)throw new Error("too many arguments");const s=bl(e.runner,"resolveName"),i=Ey(s)?s:null;L(this,$h,async function(){const o=await Promise.all(t.inputs.map((a,l)=>r[l]==null?null:a.walkAsync(r[l],(u,f)=>u==="address"?Array.isArray(f)?Promise.all(f.map(d=>Gn(d,i))):Gn(f,i):f)));return e.interface.encodeFilterTopics(t,o)}())}getTopicFilter(){return T(this,$h)}}$h=new WeakMap;function bl(n,e){return n==null?null:typeof n[e]=="function"?n:n.provider&&typeof n.provider[e]=="function"?n.provider:null}function wl(n){return n==null?null:n.provider||null}async function XI(n,e){const t=Nn.dereference(n,"overrides");z(typeof t=="object","invalid overrides parameter","overrides",n);const r=xy(t);return z(r.to==null||(e||[]).indexOf("to")>=0,"cannot override to","overrides.to",r.to),z(r.data==null||(e||[]).indexOf("data")>=0,"cannot override data","overrides.data",r.data),r.from&&(r.from=r.from),r}async function hZ(n,e,t){const r=bl(n,"resolveName"),s=Ey(r)?r:null;return await Promise.all(e.map((i,o)=>i.walkAsync(t[o],(a,l)=>(l=Nn.dereference(l,a),a==="address"?Gn(l,s):l))))}function pZ(n){const e=async function(o){const a=await XI(o,["data"]);a.to=await n.getAddress(),a.from&&(a.from=await Gn(a.from,YI(n.runner)));const l=n.interface,c=xe(a.value||KI,"overrides.value")===KI,u=(a.data||"0x")==="0x";l.fallback&&!l.fallback.payable&&l.receive&&!u&&!c&&z(!1,"cannot send data to receive or send value to non-payable fallback","overrides",o),z(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data);const f=l.receive||l.fallback&&l.fallback.payable;return z(f||c,"cannot send value to non-payable fallback","overrides.value",a.value),z(l.fallback||u,"cannot send data to receive-only contract","overrides.data",a.data),a},t=async function(o){const a=bl(n.runner,"call");ee(QI(a),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const l=await e(o);try{return await a.call(l)}catch(c){throw Xv(c)&&c.data?n.interface.makeError(c.data,l):c}},r=async function(o){const a=n.runner;ee(qI(a),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const l=await a.sendTransaction(await e(o)),c=wl(n.runner);return new G1(n.interface,c,l)},s=async function(o){const a=bl(n.runner,"estimateGas");return ee(JI(a),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await a.estimateGas(await e(o))},i=async o=>await r(o);return Ne(i,{_contract:n,estimateGas:s,populateTransaction:e,send:r,staticCall:t}),i}function mZ(n,e){const t=function(...c){const u=n.interface.getFunction(e,c);return ee(u,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:c}}),u},r=async function(...c){const u=t(...c);let f={};if(u.inputs.length+1===c.length&&(f=await XI(c.pop()),f.from&&(f.from=await Gn(f.from,YI(n.runner)))),u.inputs.length!==c.length)throw new Error("internal error: fragment inputs doesn't match arguments; should not happen");const d=await hZ(n.runner,u.inputs,c);return Object.assign({},f,await On({to:n.getAddress(),data:n.interface.encodeFunctionData(u,d)}))},s=async function(...c){const u=await a(...c);return u.length===1?u[0]:u},i=async function(...c){const u=n.runner;ee(qI(u),"contract runner does not support sending transactions","UNSUPPORTED_OPERATION",{operation:"sendTransaction"});const f=await u.sendTransaction(await r(...c)),d=wl(n.runner);return new G1(n.interface,d,f)},o=async function(...c){const u=bl(n.runner,"estimateGas");return ee(JI(u),"contract runner does not support gas estimation","UNSUPPORTED_OPERATION",{operation:"estimateGas"}),await u.estimateGas(await r(...c))},a=async function(...c){const u=bl(n.runner,"call");ee(QI(u),"contract runner does not support calling","UNSUPPORTED_OPERATION",{operation:"call"});const f=await r(...c);let d="0x";try{d=await u.call(f)}catch(p){throw Xv(p)&&p.data?n.interface.makeError(p.data,f):p}const h=t(...c);return n.interface.decodeFunctionResult(h,d)},l=async(...c)=>t(...c).constant?await s(...c):await i(...c);return Ne(l,{name:n.interface.getFunctionName(e),_contract:n,_key:e,getFragment:t,estimateGas:o,populateTransaction:r,send:i,staticCall:s,staticCallResult:a}),Object.defineProperty(l,"fragment",{configurable:!1,enumerable:!0,get:()=>{const c=n.interface.getFunction(e);return ee(c,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),c}}),l}function gZ(n,e){const t=function(...s){const i=n.interface.getEvent(e,s);return ee(i,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e,args:s}}),i},r=function(...s){return new dZ(n,t(...s),s)};return Ne(r,{name:n.interface.getEventName(e),_contract:n,_key:e,getFragment:t}),Object.defineProperty(r,"fragment",{configurable:!1,enumerable:!0,get:()=>{const s=n.interface.getEvent(e);return ee(s,"no matching fragment","UNSUPPORTED_OPERATION",{operation:"fragment",info:{key:e}}),s}}),r}const Cy=Symbol.for("_ethersInternal_contract"),ZI=new WeakMap;function yZ(n,e){ZI.set(n[Cy],e)}function Tr(n){return ZI.get(n[Cy])}function bZ(n){return n&&typeof n=="object"&&"getTopicFilter"in n&&typeof n.getTopicFilter=="function"&&n.fragment}async function W1(n,e){let t,r=null;if(Array.isArray(e)){const i=function(o){if(Ct(o,32))return o;const a=n.interface.getEvent(o);return z(a,"unknown fragment","name",o),a.topicHash};t=e.map(o=>o==null?null:Array.isArray(o)?o.map(i):i(o))}else e==="*"?t=[null]:typeof e=="string"?Ct(e,32)?t=[e]:(r=n.interface.getEvent(e),z(r,"unknown fragment","event",e),t=[r.topicHash]):bZ(e)?t=await e.getTopicFilter():"fragment"in e?(r=e.fragment,t=[r.topicHash]):z(!1,"unknown event name","event",e);t=t.map(i=>{if(i==null)return null;if(Array.isArray(i)){const o=Array.from(new Set(i.map(a=>a.toLowerCase())).values());return o.length===1?o[0]:(o.sort(),o)}return i.toLowerCase()});const s=t.map(i=>i==null?"null":Array.isArray(i)?i.join("|"):i).join("&");return{fragment:r,tag:s,topics:t}}async function yh(n,e){const{subs:t}=Tr(n);return t.get((await W1(n,e)).tag)||null}async function eL(n,e,t){const r=wl(n.runner);ee(r,"contract runner does not support subscribing","UNSUPPORTED_OPERATION",{operation:e});const{fragment:s,tag:i,topics:o}=await W1(n,t),{addr:a,subs:l}=Tr(n);let c=l.get(i);if(!c){const f={address:a||n,topics:o},d=y=>{let b=s;if(b==null)try{b=n.interface.getEvent(y.topics[0])}catch{}if(b){const v=b,A=s?n.interface.decodeEventLog(s,y.data,y.topics):[];Q1(n,t,A,w=>new fZ(n,w,t,v,y))}else Q1(n,t,[],v=>new WI(n,v,t,y))};let h=[];c={tag:i,listeners:[],start:()=>{h.length||h.push(r.on(f,d))},stop:async()=>{if(h.length==0)return;let y=h;h=[],await Promise.all(y),r.off(f,d)}},l.set(i,c)}return c}let K1=Promise.resolve();async function wZ(n,e,t,r){await K1;const s=await yh(n,e);if(!s)return!1;const i=s.listeners.length;return s.listeners=s.listeners.filter(({listener:o,once:a})=>{const l=Array.from(t);r&&l.push(r(a?null:o));try{o.call(n,...l)}catch{}return!a}),s.listeners.length===0&&(s.stop(),Tr(n).subs.delete(s.tag)),i>0}async function Q1(n,e,t,r){try{await K1}catch{}const s=wZ(n,e,t,r);return K1=s,await s}const ky=["then"];tF=Cy;const Gh=class Gh{constructor(e,t,r,s){G(this,"target");G(this,"interface");G(this,"runner");G(this,"filters");G(this,tF);G(this,"fallback");z(typeof e=="string"||ID(e),"invalid value for Contract target","target",e),r==null&&(r=null);const i=z1.from(t);Ne(this,{target:e,runner:r,interface:i}),Object.defineProperty(this,Cy,{value:{}});let o,a=null,l=null;if(s){const f=wl(r);l=new G1(this.interface,f,s)}let c=new Map;if(typeof e=="string")if(Ct(e))a=e,o=Promise.resolve(e);else{const f=bl(r,"resolveName");if(!Ey(f))throw Mt("contract runner does not support name resolution","UNSUPPORTED_OPERATION",{operation:"resolveName"});o=f.resolveName(e).then(d=>{if(d==null)throw Mt("an ENS name used for a contract target must be correctly configured","UNCONFIGURED_NAME",{value:e});return Tr(this).addr=d,d})}else o=e.getAddress().then(f=>{if(f==null)throw new Error("TODO");return Tr(this).addr=f,f});yZ(this,{addrPromise:o,addr:a,deployTx:l,subs:c});const u=new Proxy({},{get:(f,d,h)=>{if(typeof d=="symbol"||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return this.getEvent(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>ky.indexOf(d)>=0?Reflect.has(f,d):Reflect.has(f,d)||this.interface.hasEvent(String(d))});return Ne(this,{filters:u}),Ne(this,{fallback:i.receive||i.fallback?pZ(this):null}),new Proxy(this,{get:(f,d,h)=>{if(typeof d=="symbol"||d in f||ky.indexOf(d)>=0)return Reflect.get(f,d,h);try{return f.getFunction(d)}catch(p){if(!dn(p,"INVALID_ARGUMENT")||p.argument!=="key")throw p}},has:(f,d)=>typeof d=="symbol"||d in f||ky.indexOf(d)>=0?Reflect.has(f,d):f.interface.hasFunction(d)})}connect(e){return new Gh(this.target,this.interface,e)}attach(e){return new Gh(e,this.interface,this.runner)}async getAddress(){return await Tr(this).addrPromise}async getDeployedCode(){const e=wl(this.runner);ee(e,"runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"getDeployedCode"});const t=await e.getCode(await this.getAddress());return t==="0x"?null:t}async waitForDeployment(){const e=this.deploymentTransaction();if(e)return await e.wait(),this;if(await this.getDeployedCode()!=null)return this;const r=wl(this.runner);return ee(r!=null,"contract runner does not support .provider","UNSUPPORTED_OPERATION",{operation:"waitForDeployment"}),new Promise((s,i)=>{const o=async()=>{try{if(await this.getDeployedCode()!=null)return s(this);r.once("block",o)}catch(a){i(a)}};o()})}deploymentTransaction(){return Tr(this).deployTx}getFunction(e){return typeof e!="string"&&(e=e.format()),mZ(this,e)}getEvent(e){return typeof e!="string"&&(e=e.format()),gZ(this,e)}async queryTransaction(e){throw new Error("@TODO")}async queryFilter(e,t,r){t==null&&(t=0),r==null&&(r="latest");const{addr:s,addrPromise:i}=Tr(this),o=s||await i,{fragment:a,topics:l}=await W1(this,e),c={address:o,topics:l,fromBlock:t,toBlock:r},u=wl(this.runner);return ee(u,"contract runner does not have a provider","UNSUPPORTED_OPERATION",{operation:"queryFilter"}),(await u.getLogs(c)).map(f=>{let d=a;if(d==null)try{d=this.interface.getEvent(f.topics[0])}catch{}if(d)try{return new $1(f,this.interface,d)}catch(h){return new GI(f,h)}return new mh(f,u)})}async on(e,t){const r=await eL(this,"on",e);return r.listeners.push({listener:t,once:!1}),r.start(),this}async once(e,t){const r=await eL(this,"once",e);return r.listeners.push({listener:t,once:!0}),r.start(),this}async emit(e,...t){return await Q1(this,e,t,null)}async listenerCount(e){if(e){const s=await yh(this,e);return s?s.listeners.length:0}const{subs:t}=Tr(this);let r=0;for(const{listeners:s}of t.values())r+=s.length;return r}async listeners(e){if(e){const s=await yh(this,e);return s?s.listeners.map(({listener:i})=>i):[]}const{subs:t}=Tr(this);let r=[];for(const{listeners:s}of t.values())r=r.concat(s.map(({listener:i})=>i));return r}async off(e,t){const r=await yh(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(t==null||r.listeners.length===0)&&(r.stop(),Tr(this).subs.delete(r.tag)),this}async removeAllListeners(e){if(e){const t=await yh(this,e);if(!t)return this;t.stop(),Tr(this).subs.delete(t.tag)}else{const{subs:t}=Tr(this);for(const{tag:r,stop:s}of t.values())s(),t.delete(r)}return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return await this.off(e,t)}static buildClass(e){class t extends Gh{constructor(s,i=null){super(s,e,i)}}return t}static from(e,t,r){return r==null&&(r=null),new this(e,t,r)}};let J1=Gh;function AZ(){return J1}class wu extends AZ(){}function q1(n){return n.match(/^ipfs:\/\/ipfs\//i)?n=n.substring(12):n.match(/^ipfs:\/\//i)?n=n.substring(7):z(!1,"unsupported IPFS format","link",n),`https://gateway.ipfs.io/ipfs/${n}`}class vZ{constructor(e){G(this,"name");Ne(this,{name:e})}connect(e){return this}supportsCoinType(e){return!1}async encodeAddress(e,t){throw new Error("unsupported coin")}async decodeAddress(e,t){throw new Error("unsupported coin")}}const tL=new RegExp("^(ipfs)://(.*)$","i"),nL=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),tL,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")],of=class of{constructor(e,t,r){J(this,oa);G(this,"provider");G(this,"address");G(this,"name");J(this,ia);J(this,Hl);Ne(this,{provider:e,address:t,name:r}),L(this,ia,null),L(this,Hl,new wu(t,["function supportsInterface(bytes4) view returns (bool)","function resolve(bytes, bytes) view returns (bytes)","function addr(bytes32) view returns (address)","function addr(bytes32, uint) view returns (bytes)","function text(bytes32, string) view returns (string)","function contenthash(bytes32) view returns (bytes)"],e))}async supportsWildcard(){return T(this,ia)==null&&L(this,ia,(async()=>{try{return await T(this,Hl).supportsInterface("0x9061b923")}catch(e){if(dn(e,"CALL_EXCEPTION"))return!1;throw L(this,ia,null),e}})()),await T(this,ia)}async getAddress(e){if(e==null&&(e=60),e===60)try{const i=await fe(this,oa,Of).call(this,"addr(bytes32)");return i==null||i===sh?null:i}catch(i){if(dn(i,"CALL_EXCEPTION"))return null;throw i}if(e>=0&&e<2147483648){let i=e+2147483648;const o=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[i]);if(Ct(o,20))return pt(o)}let t=null;for(const i of this.provider.plugins)if(i instanceof vZ&&i.supportsCoinType(e)){t=i;break}if(t==null)return null;const r=await fe(this,oa,Of).call(this,"addr(bytes32,uint)",[e]);if(r==null||r==="0x")return null;const s=await t.decodeAddress(e,r);if(s!=null)return s;ee(!1,"invalid coin data","UNSUPPORTED_OPERATION",{operation:`getAddress(${e})`,info:{coinType:e,data:r}})}async getText(e){const t=await fe(this,oa,Of).call(this,"text(bytes32,string)",[e]);return t==null||t==="0x"?null:t}async getContentHash(){const e=await fe(this,oa,Of).call(this,"contenthash(bytes32)");if(e==null||e==="0x")return null;const t=e.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const s=t[1]==="e3010170"?"ipfs":"ipns",i=parseInt(t[4],16);if(t[5].length===i*2)return`${s}://${zJ("0x"+t[2])}`}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&r[1].length===64)return`bzz://${r[1]}`;ee(!1,"invalid or unsupported content hash data","UNSUPPORTED_OPERATION",{operation:"getContentHash()",info:{data:e}})}async getAvatar(){return(await this._getAvatar()).url}async _getAvatar(){const e=[{type:"name",value:this.name}];try{const t=await this.getText("avatar");if(t==null)return e.push({type:"!avatar",value:""}),{url:null,linkage:e};e.push({type:"avatar",value:t});for(let r=0;r<nL.length;r++){const s=t.match(nL[r]);if(s==null)continue;const i=s[1].toLowerCase();switch(i){case"https":case"data":return e.push({type:"url",value:t}),{linkage:e,url:t};case"ipfs":{const o=q1(t);return e.push({type:"ipfs",value:t}),e.push({type:"url",value:o}),{linkage:e,url:o}}case"erc721":case"erc1155":{const o=i==="erc721"?"tokenURI(uint256)":"uri(uint256)";e.push({type:i,value:t});const a=await this.getAddress();if(a==null)return e.push({type:"!owner",value:""}),{url:null,linkage:e};const l=(s[2]||"").split("/");if(l.length!==2)return e.push({type:`!${i}caip`,value:s[2]||""}),{url:null,linkage:e};const c=l[1],u=new wu(l[0],["function tokenURI(uint) view returns (string)","function ownerOf(uint) view returns (address)","function uri(uint) view returns (string)","function balanceOf(address, uint256) view returns (uint)"],this.provider);if(i==="erc721"){const m=await u.ownerOf(c);if(a!==m)return e.push({type:"!owner",value:m}),{url:null,linkage:e};e.push({type:"owner",value:m})}else if(i==="erc1155"){const m=await u.balanceOf(a,c);if(!m)return e.push({type:"!balance",value:"0"}),{url:null,linkage:e};e.push({type:"balance",value:m.toString()})}let f=await u[o](c);if(f==null||f==="0x")return e.push({type:"!metadata-url",value:""}),{url:null,linkage:e};e.push({type:"metadata-url-base",value:f}),i==="erc1155"&&(f=f.replace("{id}",_o(c,32).substring(2)),e.push({type:"metadata-url-expanded",value:f})),f.match(/^ipfs:/i)&&(f=q1(f)),e.push({type:"metadata-url",value:f});let d={};const h=await new zn(f).send();h.assertOk();try{d=h.bodyJson}catch{try{e.push({type:"!metadata",value:h.bodyText})}catch{const b=h.body;return b&&e.push({type:"!metadata",value:we(b)}),{url:null,linkage:e}}return{url:null,linkage:e}}if(!d)return e.push({type:"!metadata",value:""}),{url:null,linkage:e};e.push({type:"metadata",value:JSON.stringify(d)});let p=d.image;if(typeof p!="string")return e.push({type:"!imageUrl",value:""}),{url:null,linkage:e};if(!p.match(/^(https:\/\/|data:)/i)){if(p.match(tL)==null)return e.push({type:"!imageUrl-ipfs",value:p}),{url:null,linkage:e};e.push({type:"imageUrl-ipfs",value:p}),p=q1(p)}return e.push({type:"url",value:p}),{linkage:e,url:p}}}}}catch{}return{linkage:e,url:null}}static async getEnsAddress(e){const t=await e.getNetwork(),r=t.getPlugin("org.ethers.plugins.network.Ens");return ee(r,"network does not support ENS","UNSUPPORTED_OPERATION",{operation:"getEnsAddress",info:{network:t}}),r.address}static async fromName(e,t){var s;let r=t;for(;;){if(r===""||r==="."||t!=="eth"&&r==="eth")return null;const i=await fe(s=of,p0,lF).call(s,e,r);if(i!=null){const o=new of(e,i,t);return r!==t&&!await o.supportsWildcard()?null:o}r=r.split(".").slice(1).join(".")}}};ia=new WeakMap,Hl=new WeakMap,oa=new WeakSet,Of=async function(e,t){t=(t||[]).slice();const r=T(this,Hl).interface;t.unshift(I1(this.name));let s=null;await this.supportsWildcard()&&(s=r.getFunction(e),ee(s,"missing fragment","UNKNOWN_ERROR",{info:{funcName:e}}),t=[xX(this.name,255),r.encodeFunctionData(s,t)],e="resolve(bytes,bytes)"),t.push({enableCcipRead:!0});try{const i=await T(this,Hl)[e](...t);return s?r.decodeFunctionResult(s,i)[0]:i}catch(i){if(!dn(i,"CALL_EXCEPTION"))throw i}return null},p0=new WeakSet,lF=async function(e,t){const r=await of.getEnsAddress(e);try{const i=await new wu(r,["function resolver(bytes32) view returns (address)"],e).resolver(I1(t),{enableCcipRead:!0});return i===sh?null:i}catch(s){throw s}return null},J(of,p0);let Sy=of;const rL=BigInt(0);function at(n,e){return function(t){return t==null?e:n(t)}}function Ty(n,e){return t=>{if(e&&t==null)return null;if(!Array.isArray(t))throw new Error("not an array");return t.map(r=>n(r))}}function bh(n,e){return t=>{const r={};for(const s in n){let i=s;if(e&&s in e&&!(i in t)){for(const o of e[s])if(o in t){i=o;break}}try{const o=n[s](t[i]);o!==void 0&&(r[s]=o)}catch(o){const a=o instanceof Error?o.message:"not-an-error";ee(!1,`invalid value for value.${s} (${a})`,"BAD_DATA",{value:t})}}return r}}function xZ(n){switch(n){case!0:case"true":return!0;case!1:case"false":return!1}z(!1,`invalid boolean; ${JSON.stringify(n)}`,"value",n)}function Au(n){return z(Ct(n,!0),"invalid data","value",n),n}function vn(n){return z(Ct(n,32),"invalid hash","value",n),n}const EZ=bh({address:pt,blockHash:vn,blockNumber:Je,data:Au,index:Je,removed:at(xZ,!1),topics:Ty(vn),transactionHash:vn,transactionIndex:Je},{index:["logIndex"]});function CZ(n){return EZ(n)}const kZ=bh({hash:at(vn),parentHash:vn,parentBeaconBlockRoot:at(vn,null),number:Je,timestamp:Je,nonce:at(Au),difficulty:xe,gasLimit:xe,gasUsed:xe,stateRoot:at(vn,null),receiptsRoot:at(vn,null),blobGasUsed:at(xe,null),excessBlobGas:at(xe,null),miner:at(pt),prevRandao:at(vn,null),extraData:Au,baseFeePerGas:at(xe)},{prevRandao:["mixHash"]});function SZ(n){const e=kZ(n);return e.transactions=n.transactions.map(t=>typeof t=="string"?t:sL(t)),e}const TZ=bh({transactionIndex:Je,blockNumber:Je,transactionHash:vn,address:pt,topics:Ty(vn),data:Au,index:Je,blockHash:vn},{index:["logIndex"]});function OZ(n){return TZ(n)}const NZ=bh({to:at(pt,null),from:at(pt,null),contractAddress:at(pt,null),index:Je,root:at(we),gasUsed:xe,blobGasUsed:at(xe,null),logsBloom:at(Au),blockHash:vn,hash:vn,logs:Ty(OZ),blockNumber:Je,cumulativeGasUsed:xe,effectiveGasPrice:at(xe),blobGasPrice:at(xe,null),status:at(Je),type:at(Je,0)},{effectiveGasPrice:["gasPrice"],hash:["transactionHash"],index:["transactionIndex"]});function MZ(n){return NZ(n)}function sL(n){n.to&&xe(n.to)===rL&&(n.to="0x0000000000000000000000000000000000000000");const e=bh({hash:vn,index:at(Je,void 0),type:t=>t==="0x"||t==null?0:Je(t),accessList:at($o,null),blobVersionedHashes:at(Ty(vn,!0),null),blockHash:at(vn,null),blockNumber:at(Je,null),transactionIndex:at(Je,null),from:pt,gasPrice:at(xe),maxPriorityFeePerGas:at(xe),maxFeePerGas:at(xe),maxFeePerBlobGas:at(xe,null),gasLimit:xe,to:at(pt,null),value:xe,nonce:Je,data:Au,creates:at(pt,null),chainId:at(xe,null)},{data:["input"],gasLimit:["gas"],index:["transactionIndex"]})(n);if(e.to==null&&e.creates==null&&(e.creates=CY(e)),(n.type===1||n.type===2)&&n.accessList==null&&(e.accessList=[]),n.signature?e.signature=ws.from(n.signature):e.signature=ws.from(n),e.chainId==null){const t=e.signature.legacyChainId;t!=null&&(e.chainId=t)}return e.blockHash&&xe(e.blockHash)===rL&&(e.blockHash=null),e}const RZ="0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";class wh{constructor(e){G(this,"name");Ne(this,{name:e})}clone(){return new wh(this.name)}}class Oy extends wh{constructor(t,r){t==null&&(t=0);super(`org.ethers.network.plugins.GasCost#${t||0}`);G(this,"effectiveBlock");G(this,"txBase");G(this,"txCreate");G(this,"txDataZero");G(this,"txDataNonzero");G(this,"txAccessListStorageKey");G(this,"txAccessListAddress");const s={effectiveBlock:t};function i(o,a){let l=(r||{})[o];l==null&&(l=a),z(typeof l=="number",`invalud value for ${o}`,"costs",r),s[o]=l}i("txBase",21e3),i("txCreate",32e3),i("txDataZero",4),i("txDataNonzero",16),i("txAccessListStorageKey",1900),i("txAccessListAddress",2400),Ne(this,s)}clone(){return new Oy(this.effectiveBlock,this)}}class Ny extends wh{constructor(t,r){super("org.ethers.plugins.network.Ens");G(this,"address");G(this,"targetNetwork");Ne(this,{address:t||RZ,targetNetwork:r??1})}clone(){return new Ny(this.address,this.targetNetwork)}}class PZ extends wh{constructor(t,r){super("org.ethers.plugins.network.FetchUrlFeeDataPlugin");J(this,Wh);J(this,Kh);L(this,Wh,t),L(this,Kh,r)}get url(){return T(this,Wh)}get processFunc(){return T(this,Kh)}clone(){return this}}Wh=new WeakMap,Kh=new WeakMap;const Y1=new Map,cf=class cf{constructor(e,t){J(this,af);J(this,lf);J(this,aa);L(this,af,e),L(this,lf,xe(t)),L(this,aa,new Map)}toJSON(){return{name:this.name,chainId:String(this.chainId)}}get name(){return T(this,af)}set name(e){L(this,af,e)}get chainId(){return T(this,lf)}set chainId(e){L(this,lf,xe(e,"chainId"))}matches(e){if(e==null)return!1;if(typeof e=="string"){try{return this.chainId===xe(e)}catch{}return this.name===e}if(typeof e=="number"||typeof e=="bigint"){try{return this.chainId===xe(e)}catch{}return!1}if(typeof e=="object"){if(e.chainId!=null){try{return this.chainId===xe(e.chainId)}catch{}return!1}return e.name!=null?this.name===e.name:!1}return!1}get plugins(){return Array.from(T(this,aa).values())}attachPlugin(e){if(T(this,aa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,aa).set(e.name,e.clone()),this}getPlugin(e){return T(this,aa).get(e)||null}getPlugins(e){return this.plugins.filter(t=>t.name.split("#")[0]===e)}clone(){const e=new cf(this.name,this.chainId);return this.plugins.forEach(t=>{e.attachPlugin(t.clone())}),e}computeIntrinsicGas(e){const t=this.getPlugin("org.ethers.plugins.network.GasCost")||new Oy;let r=t.txBase;if(e.to==null&&(r+=t.txCreate),e.data)for(let s=2;s<e.data.length;s+=2)e.data.substring(s,s+2)==="00"?r+=t.txDataZero:r+=t.txDataNonzero;if(e.accessList){const s=$o(e.accessList);for(const i in s)r+=t.txAccessListAddress+t.txAccessListStorageKey*s[i].storageKeys.length}return r}static from(e){if(DZ(),e==null)return cf.from("mainnet");if(typeof e=="number"&&(e=BigInt(e)),typeof e=="string"||typeof e=="bigint"){const t=Y1.get(e);if(t)return t();if(typeof e=="bigint")return new cf("unknown",e);z(!1,"unknown network","network",e)}if(typeof e.clone=="function")return e.clone();if(typeof e=="object"){z(typeof e.name=="string"&&typeof e.chainId=="number","invalid network object name or chainId","network",e);const t=new cf(e.name,e.chainId);return(e.ensAddress||e.ensNetwork!=null)&&t.attachPlugin(new Ny(e.ensAddress,e.ensNetwork)),t}z(!1,"invalid network","network",e)}static register(e,t){typeof e=="number"&&(e=BigInt(e));const r=Y1.get(e);r&&z(!1,`conflicting network for ${JSON.stringify(r.name)}`,"nameOrChainId",e),Y1.set(e,t)}};af=new WeakMap,lf=new WeakMap,aa=new WeakMap;let tn=cf;function iL(n,e){const t=String(n);if(!t.match(/^[0-9.]+$/))throw new Error(`invalid gwei value: ${n}`);const r=t.split(".");if(r.length===1&&r.push(""),r.length!==2)throw new Error(`invalid gwei value: ${n}`);for(;r[1].length<e;)r[1]+="0";if(r[1].length>9){let s=BigInt(r[1].substring(0,9));r[1].substring(9).match(/^0+$/)||s++,r[1]=s.toString()}return BigInt(r[0]+r[1])}function oL(n){return new PZ(n,async(e,t,r)=>{r.setHeader("User-Agent","ethers");let s;try{const[i,o]=await Promise.all([r.send(),e()]);s=i;const a=s.bodyJson.standard;return{gasPrice:o.gasPrice,maxFeePerGas:iL(a.maxFee,9),maxPriorityFeePerGas:iL(a.maxPriorityFee,9)}}catch(i){ee(!1,`error encountered with polygon gas station (${JSON.stringify(r.url)})`,"SERVER_ERROR",{request:r,response:s,error:i})}})}let aL=!1;function DZ(){if(aL)return;aL=!0;function n(e,t,r){const s=function(){const i=new tn(e,t);return r.ensNetwork!=null&&i.attachPlugin(new Ny(null,r.ensNetwork)),i.attachPlugin(new Oy),(r.plugins||[]).forEach(o=>{i.attachPlugin(o)}),i};tn.register(e,s),tn.register(t,s),r.altNames&&r.altNames.forEach(i=>{tn.register(i,s)})}n("mainnet",1,{ensNetwork:1,altNames:["homestead"]}),n("ropsten",3,{ensNetwork:3}),n("rinkeby",4,{ensNetwork:4}),n("goerli",5,{ensNetwork:5}),n("kovan",42,{ensNetwork:42}),n("sepolia",11155111,{ensNetwork:11155111}),n("holesky",17e3,{ensNetwork:17e3}),n("classic",61,{}),n("classicKotti",6,{}),n("arbitrum",42161,{ensNetwork:1}),n("arbitrum-goerli",421613,{}),n("arbitrum-sepolia",421614,{}),n("base",8453,{ensNetwork:1}),n("base-goerli",84531,{}),n("base-sepolia",84532,{}),n("bnb",56,{ensNetwork:1}),n("bnbt",97,{}),n("linea",59144,{ensNetwork:1}),n("linea-goerli",59140,{}),n("linea-sepolia",59141,{}),n("matic",137,{ensNetwork:1,plugins:[oL("https://gasstation.polygon.technology/v2")]}),n("matic-amoy",80002,{}),n("matic-mumbai",80001,{altNames:["maticMumbai","maticmum"],plugins:[oL("https://gasstation-testnet.polygon.technology/v2")]}),n("optimism",10,{ensNetwork:1,plugins:[]}),n("optimism-goerli",420,{}),n("optimism-sepolia",11155420,{}),n("xdai",100,{ensNetwork:1})}function X1(n){return JSON.parse(JSON.stringify(n))}class IZ{constructor(e){J(this,uf);J(this,to);J(this,Xr);J(this,la);J(this,li);L(this,to,e),L(this,Xr,null),L(this,la,4e3),L(this,li,-2)}get pollingInterval(){return T(this,la)}set pollingInterval(e){L(this,la,e)}start(){T(this,Xr)||(L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la))),fe(this,uf,x0).call(this))}stop(){T(this,Xr)&&(T(this,to)._clearTimeout(T(this,Xr)),L(this,Xr,null))}pause(e){this.stop(),e&&L(this,li,-2)}resume(){this.start()}}to=new WeakMap,Xr=new WeakMap,la=new WeakMap,li=new WeakMap,uf=new WeakSet,x0=async function(){try{const e=await T(this,to).getBlockNumber();if(T(this,li)===-2){L(this,li,e);return}if(e!==T(this,li)){for(let t=T(this,li)+1;t<=e;t++){if(T(this,Xr)==null)return;await T(this,to).emit("block",t)}L(this,li,e)}}catch{}T(this,Xr)!=null&&L(this,Xr,T(this,to)._setTimeout(fe(this,uf,x0).bind(this),T(this,la)))};class Z1{constructor(e){J(this,zl);J(this,$l);J(this,ca);L(this,zl,e),L(this,ca,!1),L(this,$l,t=>{this._poll(t,T(this,zl))})}async _poll(e,t){throw new Error("sub-classes must override this")}start(){T(this,ca)||(L(this,ca,!0),T(this,$l).call(this,-2),T(this,zl).on("block",T(this,$l)))}stop(){T(this,ca)&&(L(this,ca,!1),T(this,zl).off("block",T(this,$l)))}pause(e){this.stop()}resume(){this.start()}}zl=new WeakMap,$l=new WeakMap,ca=new WeakMap;class LZ extends Z1{constructor(t,r){super(t);J(this,ff);J(this,no);L(this,ff,r),L(this,no,-2)}pause(t){t&&L(this,no,-2),super.pause(t)}async _poll(t,r){const s=await r.getBlock(T(this,ff));s!=null&&(T(this,no)===-2?L(this,no,s.number):s.number>T(this,no)&&(r.emit(T(this,ff),s.number),L(this,no,s.number)))}}ff=new WeakMap,no=new WeakMap;class BZ extends Z1{constructor(t,r){super(t);J(this,m0);L(this,m0,X1(r))}async _poll(t,r){throw new Error("@TODO")}}m0=new WeakMap;class _Z extends Z1{constructor(t,r){super(t);J(this,df);L(this,df,r)}async _poll(t,r){const s=await r.getTransactionReceipt(T(this,df));s&&r.emit(T(this,df),s)}}df=new WeakMap;class ex{constructor(e,t){J(this,g0);J(this,ro);J(this,hf);J(this,pf);J(this,ua);J(this,Zr);L(this,ro,e),L(this,hf,X1(t)),L(this,pf,fe(this,g0,cF).bind(this)),L(this,ua,!1),L(this,Zr,-2)}start(){T(this,ua)||(L(this,ua,!0),T(this,Zr)===-2&&T(this,ro).getBlockNumber().then(e=>{L(this,Zr,e)}),T(this,ro).on("block",T(this,pf)))}stop(){T(this,ua)&&(L(this,ua,!1),T(this,ro).off("block",T(this,pf)))}pause(e){this.stop(),e&&L(this,Zr,-2)}resume(){this.start()}}ro=new WeakMap,hf=new WeakMap,pf=new WeakMap,ua=new WeakMap,Zr=new WeakMap,g0=new WeakSet,cF=async function(e){if(T(this,Zr)===-2)return;const t=X1(T(this,hf));t.fromBlock=T(this,Zr)+1,t.toBlock=e;const r=await T(this,ro).getLogs(t);if(r.length===0){T(this,Zr)<e-60&&L(this,Zr,e-60);return}for(const s of r)T(this,ro).emit(T(this,hf),s),L(this,Zr,s.blockNumber)};const FZ=BigInt(2),jZ=10;function My(n){return n&&typeof n.then=="function"}function Ry(n,e){return n+":"+JSON.stringify(e,(t,r)=>{if(r==null)return"null";if(typeof r=="bigint")return`bigint:${r.toString()}`;if(typeof r=="string")return r.toLowerCase();if(typeof r=="object"&&!Array.isArray(r)){const s=Object.keys(r);return s.sort(),s.reduce((i,o)=>(i[o]=r[o],i),{})}return r})}class Py{constructor(e){G(this,"name");Ne(this,{name:e})}start(){}stop(){}pause(e){}resume(){}}function UZ(n){return JSON.parse(JSON.stringify(n))}function tx(n){return n=Array.from(new Set(n).values()),n.sort(),n}async function nx(n,e){if(n==null)throw new Error("invalid event");if(Array.isArray(n)&&(n={topics:n}),typeof n=="string")switch(n){case"block":case"debug":case"error":case"finalized":case"network":case"pending":case"safe":return{type:n,tag:n}}if(Ct(n,32)){const t=n.toLowerCase();return{type:"transaction",tag:Ry("tx",{hash:t}),hash:t}}if(n.orphan){const t=n;return{type:"orphan",tag:Ry("orphan",t),filter:UZ(t)}}if(n.address||n.topics){const t=n,r={topics:(t.topics||[]).map(s=>s==null?null:Array.isArray(s)?tx(s.map(i=>i.toLowerCase())):s.toLowerCase())};if(t.address){const s=[],i=[],o=a=>{Ct(a)?s.push(a):i.push((async()=>{s.push(await Gn(a,e))})())};Array.isArray(t.address)?t.address.forEach(o):o(t.address),i.length&&await Promise.all(i),r.address=tx(s.map(a=>a.toLowerCase()))}return{filter:r,tag:Ry("event",r),type:"event"}}z(!1,"unknown ProviderEvent","event",n)}function rx(){return new Date().getTime()}const VZ={cacheTimeout:250,pollingInterval:4e3};class Dy{constructor(e,t){J(this,rt);J(this,Dn);J(this,fa);J(this,In);J(this,mf);J(this,Pr);J(this,Gl);J(this,da);J(this,so);J(this,Qh);J(this,es);J(this,gf);J(this,yf);if(L(this,yf,Object.assign({},VZ,t||{})),e==="any")L(this,Gl,!0),L(this,Pr,null);else if(e){const r=tn.from(e);L(this,Gl,!1),L(this,Pr,Promise.resolve(r)),setTimeout(()=>{this.emit("network",r,null)},0)}else L(this,Gl,!1),L(this,Pr,null);L(this,so,-1),L(this,da,new Map),L(this,Dn,new Map),L(this,fa,new Map),L(this,In,null),L(this,mf,!1),L(this,Qh,1),L(this,es,new Map),L(this,gf,!1)}get pollingInterval(){return T(this,yf).pollingInterval}get provider(){return this}get plugins(){return Array.from(T(this,fa).values())}attachPlugin(e){if(T(this,fa).get(e.name))throw new Error(`cannot replace existing plugin: ${e.name} `);return T(this,fa).set(e.name,e.connect(this)),this}getPlugin(e){return T(this,fa).get(e)||null}get disableCcipRead(){return T(this,gf)}set disableCcipRead(e){L(this,gf,!!e)}async ccipReadFetch(e,t,r){if(this.disableCcipRead||r.length===0||e.to==null)return null;const s=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let a=0;a<r.length;a++){const l=r[a],c=l.replace("{sender}",s).replace("{data}",i),u=new zn(c);l.indexOf("{data}")===-1&&(u.body={data:i,sender:s}),this.emit("debug",{action:"sendCcipReadFetchRequest",request:u,index:a,urls:r});let f="unknown error";const d=await u.send();try{const h=d.bodyJson;if(h.data)return this.emit("debug",{action:"receiveCcipReadFetchResult",request:u,result:h}),h.data;h.message&&(f=h.message),this.emit("debug",{action:"receiveCcipReadFetchError",request:u,result:h})}catch{}ee(d.statusCode<400||d.statusCode>=500,`response not found during CCIP fetch: ${f}`,"OFFCHAIN_FAULT",{reason:"404_MISSING_RESOURCE",transaction:e,info:{url:l,errorMessage:f}}),o.push(f)}ee(!1,`error encountered during CCIP fetch: ${o.map(a=>JSON.stringify(a)).join(", ")}`,"OFFCHAIN_FAULT",{reason:"500_SERVER_ERROR",transaction:e,info:{urls:r,errorMessages:o}})}_wrapBlock(e,t){return new aZ(SZ(e),this)}_wrapLog(e,t){return new mh(CZ(e),this)}_wrapTransactionReceipt(e,t){return new HI(MZ(e),this)}_wrapTransactionResponse(e,t){return new gh(sL(e),this)}_detectNetwork(){ee(!1,"sub-classes must implement this","UNSUPPORTED_OPERATION",{operation:"_detectNetwork"})}async _perform(e){ee(!1,`unsupported method: ${e.method}`,"UNSUPPORTED_OPERATION",{operation:e.method,info:e})}async getBlockNumber(){const e=Je(await fe(this,rt,Dr).call(this,{method:"getBlockNumber"}),"%response");return T(this,so)>=0&&L(this,so,e),e}_getAddress(e){return Gn(e,this)}_getBlockTag(e){if(e==null)return"latest";switch(e){case"earliest":return"0x0";case"finalized":case"latest":case"pending":case"safe":return e}if(Ct(e))return Ct(e,32)?e:ol(e);if(typeof e=="bigint"&&(e=Je(e,"blockTag")),typeof e=="number")return e>=0?ol(e):T(this,so)>=0?ol(T(this,so)+e):this.getBlockNumber().then(t=>ol(t+e));z(!1,"invalid blockTag","blockTag",e)}_getFilter(e){const t=(e.topics||[]).map(l=>l==null?null:Array.isArray(l)?tx(l.map(c=>c.toLowerCase())):l.toLowerCase()),r="blockHash"in e?e.blockHash:void 0,s=(l,c,u)=>{let f;switch(l.length){case 0:break;case 1:f=l[0];break;default:l.sort(),f=l}if(r&&(c!=null||u!=null))throw new Error("invalid filter");const d={};return f&&(d.address=f),t.length&&(d.topics=t),c&&(d.fromBlock=c),u&&(d.toBlock=u),r&&(d.blockHash=r),d};let i=[];if(e.address)if(Array.isArray(e.address))for(const l of e.address)i.push(this._getAddress(l));else i.push(this._getAddress(e.address));let o;"fromBlock"in e&&(o=this._getBlockTag(e.fromBlock));let a;return"toBlock"in e&&(a=this._getBlockTag(e.toBlock)),i.filter(l=>typeof l!="string").length||o!=null&&typeof o!="string"||a!=null&&typeof a!="string"?Promise.all([Promise.all(i),o,a]).then(l=>s(l[0],l[1],l[2])):s(i,o,a)}_getTransactionRequest(e){const t=xy(e),r=[];if(["to","from"].forEach(s=>{if(t[s]==null)return;const i=Gn(t[s],this);My(i)?r.push(async function(){t[s]=await i}()):t[s]=i}),t.blockTag!=null){const s=this._getBlockTag(t.blockTag);My(s)?r.push(async function(){t.blockTag=await s}()):t.blockTag=s}return r.length?async function(){return await Promise.all(r),t}():t}async getNetwork(){if(T(this,Pr)==null){const s=(async()=>{try{const i=await this._detectNetwork();return this.emit("network",i,null),i}catch(i){throw T(this,Pr)===s&&L(this,Pr,null),i}})();return L(this,Pr,s),(await s).clone()}const e=T(this,Pr),[t,r]=await Promise.all([e,this._detectNetwork()]);return t.chainId!==r.chainId&&(T(this,Gl)?(this.emit("network",r,t),T(this,Pr)===e&&L(this,Pr,Promise.resolve(r))):ee(!1,`network changed: ${t.chainId} => ${r.chainId} `,"NETWORK_ERROR",{event:"changed"})),t.clone()}async getFeeData(){const e=await this.getNetwork(),t=async()=>{const{_block:s,gasPrice:i,priorityFee:o}=await On({_block:fe(this,rt,DE).call(this,"latest",!1),gasPrice:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getGasPrice"});return xe(u,"%response")}catch{}return null})(),priorityFee:(async()=>{try{const u=await fe(this,rt,Dr).call(this,{method:"getPriorityFee"});return xe(u,"%response")}catch{}return null})()});let a=null,l=null;const c=this._wrapBlock(s,e);return c&&c.baseFeePerGas&&(l=o??BigInt("1000000000"),a=c.baseFeePerGas*FZ+l),new VI(i,a,l)},r=e.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin");if(r){const s=new zn(r.url),i=await r.processFunc(t,this,s);return new VI(i.gasPrice,i.maxFeePerGas,i.maxPriorityFeePerGas)}return await t()}async estimateGas(e){let t=this._getTransactionRequest(e);return My(t)&&(t=await t),xe(await fe(this,rt,Dr).call(this,{method:"estimateGas",transaction:t}),"%response")}async call(e){const{tx:t,blockTag:r}=await On({tx:this._getTransactionRequest(e),blockTag:this._getBlockTag(e.blockTag)});return await fe(this,rt,PE).call(this,fe(this,rt,RE).call(this,t,r,e.enableCcipRead?0:-1))}async getBalance(e,t){return xe(await fe(this,rt,ep).call(this,{method:"getBalance"},e,t),"%response")}async getTransactionCount(e,t){return Je(await fe(this,rt,ep).call(this,{method:"getTransactionCount"},e,t),"%response")}async getCode(e,t){return we(await fe(this,rt,ep).call(this,{method:"getCode"},e,t))}async getStorage(e,t,r){const s=xe(t,"position");return we(await fe(this,rt,ep).call(this,{method:"getStorage",position:s},e,r))}async broadcastTransaction(e){const{blockNumber:t,hash:r,network:s}=await On({blockNumber:this.getBlockNumber(),hash:this._perform({method:"broadcastTransaction",signedTransaction:e}),network:this.getNetwork()}),i=hh.from(e);if(i.hash!==r)throw new Error("@TODO: the returned hash did not match");return this._wrapTransactionResponse(i,s).replaceableTransaction(t)}async getBlock(e,t){const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,DE).call(this,e,!!t)});return s==null?null:this._wrapBlock(s,r)}async getTransaction(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e})});return r==null?null:this._wrapTransactionResponse(r,t)}async getTransactionReceipt(e){const{network:t,params:r}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getTransactionReceipt",hash:e})});if(r==null)return null;if(r.gasPrice==null&&r.effectiveGasPrice==null){const s=await fe(this,rt,Dr).call(this,{method:"getTransaction",hash:e});if(s==null)throw new Error("report this; could not find tx or effectiveGasPrice");r.effectiveGasPrice=s.gasPrice}return this._wrapTransactionReceipt(r,t)}async getTransactionResult(e){const{result:t}=await On({network:this.getNetwork(),result:fe(this,rt,Dr).call(this,{method:"getTransactionResult",hash:e})});return t==null?null:we(t)}async getLogs(e){let t=this._getFilter(e);My(t)&&(t=await t);const{network:r,params:s}=await On({network:this.getNetwork(),params:fe(this,rt,Dr).call(this,{method:"getLogs",filter:t})});return s.map(i=>this._wrapLog(i,r))}_getProvider(e){ee(!1,"provider cannot connect to target network","UNSUPPORTED_OPERATION",{operation:"_getProvider()"})}async getResolver(e){return await Sy.fromName(this,e)}async getAvatar(e){const t=await this.getResolver(e);return t?await t.getAvatar():null}async resolveName(e){const t=await this.getResolver(e);return t?await t.getAddress():null}async lookupAddress(e){e=pt(e);const t=I1(e.substring(2).toLowerCase()+".addr.reverse");try{const r=await Sy.getEnsAddress(this),i=await new wu(r,["function resolver(bytes32) view returns (address)"],this).resolver(t);if(i==null||i===sh)return null;const a=await new wu(i,["function name(bytes32) view returns (string)"],this).name(t);return await this.resolveName(a)!==e?null:a}catch(r){if(dn(r,"BAD_DATA")&&r.value==="0x"||dn(r,"CALL_EXCEPTION"))return null;throw r}return null}async waitForTransaction(e,t,r){const s=t??1;return s===0?this.getTransactionReceipt(e):new Promise(async(i,o)=>{let a=null;const l=async c=>{try{const u=await this.getTransactionReceipt(e);if(u!=null&&c-u.blockNumber+1>=s){i(u),a&&(clearTimeout(a),a=null);return}}catch(u){console.log("EEE",u)}this.once("block",l)};r!=null&&(a=setTimeout(()=>{a!=null&&(a=null,this.off("block",l),o(Mt("timeout","TIMEOUT",{reason:"timeout"})))},r)),l(await this.getBlockNumber())})}async waitForBlock(e){ee(!1,"not implemented yet","NOT_IMPLEMENTED",{operation:"waitForBlock"})}_clearTimeout(e){const t=T(this,es).get(e);t&&(t.timer&&clearTimeout(t.timer),T(this,es).delete(e))}_setTimeout(e,t){t==null&&(t=0);const r=Xh(this,Qh)._++,s=()=>{T(this,es).delete(r),e()};if(this.paused)T(this,es).set(r,{timer:null,func:s,time:t});else{const i=setTimeout(s,t);T(this,es).set(r,{timer:i,func:s,time:rx()})}return r}_forEachSubscriber(e){for(const t of T(this,Dn).values())e(t.subscriber)}_getSubscriber(e){switch(e.type){case"debug":case"error":case"network":return new Py(e.type);case"block":{const t=new IZ(this);return t.pollingInterval=this.pollingInterval,t}case"safe":case"finalized":return new LZ(this,e.type);case"event":return new ex(this,e.filter);case"transaction":return new _Z(this,e.hash);case"orphan":return new BZ(this,e.filter)}throw new Error(`unsupported event: ${e.type}`)}_recoverSubscriber(e,t){for(const r of T(this,Dn).values())if(r.subscriber===e){r.started&&r.subscriber.stop(),r.subscriber=t,r.started&&t.start(),T(this,In)!=null&&t.pause(T(this,In));break}}async on(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!1}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async once(e,t){const r=await fe(this,rt,E0).call(this,e);return r.listeners.push({listener:t,once:!0}),r.started||(r.subscriber.start(),r.started=!0,T(this,In)!=null&&r.subscriber.pause(T(this,In))),this}async emit(e,...t){const r=await fe(this,rt,tp).call(this,e,t);if(!r||r.listeners.length===0)return!1;const s=r.listeners.length;return r.listeners=r.listeners.filter(({listener:i,once:o})=>{const a=new CP(this,o?null:i,e);try{i.call(this,...t,a)}catch{}return!o}),r.listeners.length===0&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),s>0}async listenerCount(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.length:0}let t=0;for(const{listeners:r}of T(this,Dn).values())t+=r.length;return t}async listeners(e){if(e){const r=await fe(this,rt,tp).call(this,e);return r?r.listeners.map(({listener:s})=>s):[]}let t=[];for(const{listeners:r}of T(this,Dn).values())t=t.concat(r.map(({listener:s})=>s));return t}async off(e,t){const r=await fe(this,rt,tp).call(this,e);if(!r)return this;if(t){const s=r.listeners.map(({listener:i})=>i).indexOf(t);s>=0&&r.listeners.splice(s,1)}return(!t||r.listeners.length===0)&&(r.started&&r.subscriber.stop(),T(this,Dn).delete(r.tag)),this}async removeAllListeners(e){if(e){const{tag:t,started:r,subscriber:s}=await fe(this,rt,E0).call(this,e);r&&s.stop(),T(this,Dn).delete(t)}else for(const[t,{started:r,subscriber:s}]of T(this,Dn))r&&s.stop(),T(this,Dn).delete(t);return this}async addListener(e,t){return await this.on(e,t)}async removeListener(e,t){return this.off(e,t)}get destroyed(){return T(this,mf)}destroy(){this.removeAllListeners();for(const e of T(this,es).keys())this._clearTimeout(e);L(this,mf,!0)}get paused(){return T(this,In)!=null}set paused(e){!!e!==this.paused&&(this.paused?this.resume():this.pause(!1))}pause(e){if(L(this,so,-1),T(this,In)!=null){if(T(this,In)==!!e)return;ee(!1,"cannot change pause type; resume first","UNSUPPORTED_OPERATION",{operation:"pause"})}this._forEachSubscriber(t=>t.pause(e)),L(this,In,!!e);for(const t of T(this,es).values())t.timer&&clearTimeout(t.timer),t.time=rx()-t.time}resume(){if(T(this,In)!=null){this._forEachSubscriber(e=>e.resume()),L(this,In,null);for(const e of T(this,es).values()){let t=e.time;t<0&&(t=0),e.time=rx(),setTimeout(e.func,t)}}}}Dn=new WeakMap,fa=new WeakMap,In=new WeakMap,mf=new WeakMap,Pr=new WeakMap,Gl=new WeakMap,da=new WeakMap,so=new WeakMap,Qh=new WeakMap,es=new WeakMap,gf=new WeakMap,yf=new WeakMap,rt=new WeakSet,Dr=async function(e){const t=T(this,yf).cacheTimeout;if(t<0)return await this._perform(e);const r=Ry(e.method,e);let s=T(this,da).get(r);return s||(s=this._perform(e),T(this,da).set(r,s),setTimeout(()=>{T(this,da).get(r)===s&&T(this,da).delete(r)},t)),await s},RE=async function(e,t,r){ee(r<jZ,"CCIP read exceeded maximum redirections","OFFCHAIN_FAULT",{reason:"TOO_MANY_REDIRECTS",transaction:Object.assign({},e,{blockTag:t,enableCcipRead:!0})});const s=xy(e);try{return we(await this._perform({method:"call",transaction:s,blockTag:t}))}catch(i){if(!this.disableCcipRead&&Xv(i)&&i.data&&r>=0&&t==="latest"&&s.to!=null&&Vt(i.data,0,4)==="0x556f1830"){const o=i.data,a=await Gn(s.to,this);let l;try{l=WZ(Vt(i.data,4))}catch(f){ee(!1,f.message,"OFFCHAIN_FAULT",{reason:"BAD_DATA",transaction:s,info:{data:o}})}ee(l.sender.toLowerCase()===a.toLowerCase(),"CCIP Read sender mismatch","CALL_EXCEPTION",{action:"call",data:o,reason:"OffchainLookup",transaction:s,invocation:null,revert:{signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",name:"OffchainLookup",args:l.errorArgs}});const c=await this.ccipReadFetch(s,l.calldata,l.urls);ee(c!=null,"CCIP Read failed to fetch data","OFFCHAIN_FAULT",{reason:"FETCH_FAILED",transaction:s,info:{data:i.data,errorArgs:l.errorArgs}});const u={to:a,data:zt([l.selector,GZ([c,l.extraData])])};this.emit("debug",{action:"sendCcipReadCall",transaction:u});try{const f=await fe(this,rt,RE).call(this,u,t,r+1);return this.emit("debug",{action:"receiveCcipReadCallResult",transaction:Object.assign({},u),result:f}),f}catch(f){throw this.emit("debug",{action:"receiveCcipReadCallError",transaction:Object.assign({},u),error:f}),f}}throw i}},PE=async function(e){const{value:t}=await On({network:this.getNetwork(),value:e});return t},ep=async function(e,t,r){let s=this._getAddress(t),i=this._getBlockTag(r);return(typeof s!="string"||typeof i!="string")&&([s,i]=await Promise.all([s,i])),await fe(this,rt,PE).call(this,fe(this,rt,Dr).call(this,Object.assign(e,{address:s,blockTag:i})))},DE=async function(e,t){if(Ct(e,32))return await fe(this,rt,Dr).call(this,{method:"getBlock",blockHash:e,includeTransactions:t});let r=this._getBlockTag(e);return typeof r!="string"&&(r=await r),await fe(this,rt,Dr).call(this,{method:"getBlock",blockTag:r,includeTransactions:t})},tp=async function(e,t){let r=await nx(e,this);return r.type==="event"&&t&&t.length>0&&t[0].removed===!0&&(r=await nx({orphan:"drop-log",log:t[0]},this)),T(this,Dn).get(r.tag)||null},E0=async function(e){const t=await nx(e,this),r=t.tag;let s=T(this,Dn).get(r);return s||(s={subscriber:this._getSubscriber(t),tag:r,addressableMap:new WeakMap,nameMap:new Map,started:!1,listeners:[]},T(this,Dn).set(r,s)),s};function HZ(n,e){try{const t=sx(n,e);if(t)return iu(t)}catch{}return null}function sx(n,e){if(n==="0x")return null;try{const t=Je(Vt(n,e,e+32)),r=Je(Vt(n,t,t+32));return Vt(n,t+32,t+32+r)}catch{}return null}function lL(n){const e=Hn(n);if(e.length>32)throw new Error("internal; should not happen");const t=new Uint8Array(32);return t.set(e,32-e.length),t}function zZ(n){if(n.length%32===0)return n;const e=new Uint8Array(Math.ceil(n.length/32)*32);return e.set(n),e}const $Z=new Uint8Array([]);function GZ(n){const e=[];let t=0;for(let r=0;r<n.length;r++)e.push($Z),t+=32;for(let r=0;r<n.length;r++){const s=ct(n[r]);e[r]=lL(t),e.push(lL(s.length)),e.push(zZ(s)),t+=32+Math.ceil(s.length/32)*32}return zt(e)}const cL="0x0000000000000000000000000000000000000000000000000000000000000000";function WZ(n){const e={sender:"",urls:[],calldata:"",selector:"",extraData:"",errorArgs:[]};ee(ru(n)>=5*32,"insufficient OffchainLookup data","OFFCHAIN_FAULT",{reason:"insufficient OffchainLookup data"});const t=Vt(n,0,32);ee(Vt(t,0,12)===Vt(cL,0,12),"corrupt OffchainLookup sender","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup sender"}),e.sender=Vt(t,12);try{const r=[],s=Je(Vt(n,32,64)),i=Je(Vt(n,s,s+32)),o=Vt(n,s+32);for(let a=0;a<i;a++){const l=HZ(o,a*32);if(l==null)throw new Error("abort");r.push(l)}e.urls=r}catch{ee(!1,"corrupt OffchainLookup urls","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup urls"})}try{const r=sx(n,64);if(r==null)throw new Error("abort");e.calldata=r}catch{ee(!1,"corrupt OffchainLookup calldata","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup calldata"})}ee(Vt(n,100,128)===Vt(cL,0,28),"corrupt OffchainLookup callbaackSelector","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup callbaackSelector"}),e.selector=Vt(n,96,100);try{const r=sx(n,128);if(r==null)throw new Error("abort");e.extraData=r}catch{ee(!1,"corrupt OffchainLookup extraData","OFFCHAIN_FAULT",{reason:"corrupt OffchainLookup extraData"})}return e.errorArgs="sender,urls,calldata,selector,extraData".split(/,/).map(r=>e[r]),e}function vu(n,e){if(n.provider)return n.provider;ee(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:e})}async function uL(n,e){let t=xy(e);if(t.to!=null&&(t.to=Gn(t.to,n)),t.from!=null){const r=t.from;t.from=Promise.all([n.getAddress(),Gn(r,n)]).then(([s,i])=>(z(s.toLowerCase()===i.toLowerCase(),"transaction from mismatch","tx.from",i),s))}else t.from=n.getAddress();return await On(t)}class KZ{constructor(e){G(this,"provider");Ne(this,{provider:e||null})}async getNonce(e){return vu(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await uL(this,e)}async populateTransaction(e){const t=vu(this,"populateTransaction"),r=await uL(this,e);r.nonce==null&&(r.nonce=await this.getNonce("pending")),r.gasLimit==null&&(r.gasLimit=await this.estimateGas(r));const s=await this.provider.getNetwork();if(r.chainId!=null){const o=xe(r.chainId);z(o===s.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=s.chainId;const i=r.maxFeePerGas!=null||r.maxPriorityFeePerGas!=null;if(r.gasPrice!=null&&(r.type===2||i)?z(!1,"eip-1559 transaction do not support gasPrice","tx",e):(r.type===0||r.type===1)&&i&&z(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e),(r.type===2||r.type==null)&&r.maxFeePerGas!=null&&r.maxPriorityFeePerGas!=null)r.type=2;else if(r.type===0||r.type===1){const o=await t.getFeeData();ee(o.gasPrice!=null,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice)}else{const o=await t.getFeeData();if(r.type==null)if(o.maxFeePerGas!=null&&o.maxPriorityFeePerGas!=null)if(r.type=2,r.gasPrice!=null){const a=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=a,r.maxPriorityFeePerGas=a}else r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas);else o.gasPrice!=null?(ee(!i,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),r.gasPrice==null&&(r.gasPrice=o.gasPrice),r.type=0):ee(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else(r.type===2||r.type===3)&&(r.maxFeePerGas==null&&(r.maxFeePerGas=o.maxFeePerGas),r.maxPriorityFeePerGas==null&&(r.maxPriorityFeePerGas=o.maxPriorityFeePerGas))}return await On(r)}async estimateGas(e){return vu(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return vu(this,"call").call(await this.populateCall(e))}async resolveName(e){return await vu(this,"resolveName").resolveName(e)}async sendTransaction(e){const t=vu(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const s=hh.from(r);return await t.broadcastTransaction(await this.signTransaction(s))}}const fL=new Set;function xu(n){fL.has(n)||(fL.add(n),console.log("========= NOTICE ========="),console.log(`Request-Rate Exceeded for ${n} (this message will not be repeated)`),console.log(""),console.log("The default API keys for each service are provided as a highly-throttled,"),console.log("community resource for low-traffic projects and early prototyping."),console.log(""),console.log("While your application will continue to function, we highly recommended"),console.log("signing up for your own API keys to improve performance, increase your"),console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."),console.log(""),console.log("For more details: https://docs.ethers.org/api-keys/"),console.log("=========================="))}function QZ(n){return JSON.parse(JSON.stringify(n))}class dL{constructor(e){J(this,pa);J(this,Kn);J(this,ci);J(this,Wl);J(this,ha);J(this,Kl);J(this,bf);L(this,Kn,e),L(this,ci,null),L(this,Wl,fe(this,pa,IE).bind(this)),L(this,ha,!1),L(this,Kl,null),L(this,bf,!1)}_subscribe(e){throw new Error("subclasses must override this")}_emitResults(e,t){throw new Error("subclasses must override this")}_recover(e){throw new Error("subclasses must override this")}start(){T(this,ha)||(L(this,ha,!0),fe(this,pa,IE).call(this,-2))}stop(){T(this,ha)&&(L(this,ha,!1),L(this,bf,!0),fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Wl)))}pause(e){e&&fe(this,pa,LE).call(this),T(this,Kn).off("block",T(this,Wl))}resume(){this.start()}}Kn=new WeakMap,ci=new WeakMap,Wl=new WeakMap,ha=new WeakMap,Kl=new WeakMap,bf=new WeakMap,pa=new WeakSet,IE=async function(e){try{T(this,ci)==null&&L(this,ci,this._subscribe(T(this,Kn)));let t=null;try{t=await T(this,ci)}catch(i){if(!dn(i,"UNSUPPORTED_OPERATION")||i.operation!=="eth_newFilter")throw i}if(t==null){L(this,ci,null),T(this,Kn)._recoverSubscriber(this,this._recover(T(this,Kn)));return}const r=await T(this,Kn).getNetwork();if(T(this,Kl)||L(this,Kl,r),T(this,Kl).chainId!==r.chainId)throw new Error("chaid changed");if(T(this,bf))return;const s=await T(this,Kn).send("eth_getFilterChanges",[t]);await this._emitResults(T(this,Kn),s)}catch(t){console.log("@TODO",t)}T(this,Kn).once("block",T(this,Wl))},LE=function(){const e=T(this,ci);e&&(L(this,ci,null),e.then(t=>{T(this,Kn).destroyed||T(this,Kn).send("eth_uninstallFilter",[t])}))};class JZ extends dL{constructor(t,r){super(t);J(this,Ql);L(this,Ql,QZ(r))}_recover(t){return new ex(t,T(this,Ql))}async _subscribe(t){return await t.send("eth_newFilter",[T(this,Ql)])}async _emitResults(t,r){for(const s of r)t.emit(T(this,Ql),t._wrapLog(s,t._network))}}Ql=new WeakMap;class qZ extends dL{async _subscribe(e){return await e.send("eth_newPendingTransactionFilter",[])}async _emitResults(e,t){for(const r of t)e.emit("pending",r)}}const YZ="bigint,boolean,function,number,string,symbol".split(/,/g);function Iy(n){if(n==null||YZ.indexOf(typeof n)>=0||typeof n.getAddress=="function")return n;if(Array.isArray(n))return n.map(Iy);if(typeof n=="object")return Object.keys(n).reduce((e,t)=>(e[t]=n[t],e),{});throw new Error(`should not happen: ${n} (${typeof n})`)}function XZ(n){return new Promise(e=>{setTimeout(e,n)})}function Eu(n){return n&&n.toLowerCase()}function hL(n){return n&&typeof n.pollingInterval=="number"}const pL={polling:!1,staticNetwork:null,batchStallTime:10,batchMaxSize:1<<20,batchMaxCount:100,cacheTimeout:250,pollingInterval:4e3};class ix extends KZ{constructor(t,r){super(t);G(this,"address");r=pt(r),Ne(this,{address:r})}connect(t){ee(!1,"cannot reconnect JsonRpcSigner","UNSUPPORTED_OPERATION",{operation:"signer.connect"})}async getAddress(){return this.address}async populateTransaction(t){return await this.populateCall(t)}async sendUncheckedTransaction(t){const r=Iy(t),s=[];if(r.from){const o=r.from;s.push((async()=>{const a=await Gn(o,this.provider);z(a!=null&&a.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=a})())}else r.from=this.address;if(r.gasLimit==null&&s.push((async()=>{r.gasLimit=await this.provider.estimateGas({...r,from:this.address})})()),r.to!=null){const o=r.to;s.push((async()=>{r.to=await Gn(o,this.provider)})())}s.length&&await Promise.all(s);const i=this.provider.getRpcTransaction(r);return this.provider.send("eth_sendTransaction",[i])}async sendTransaction(t){const r=await this.provider.getBlockNumber(),s=await this.sendUncheckedTransaction(t);return await new Promise((i,o)=>{const a=[1e3,100];let l=0;const c=async()=>{try{const u=await this.provider.getTransaction(s);if(u!=null){i(u.replaceableTransaction(r));return}}catch(u){if(dn(u,"CANCELLED")||dn(u,"BAD_DATA")||dn(u,"NETWORK_ERROR")){u.info==null&&(u.info={}),u.info.sendTransactionHash=s,o(u);return}if(dn(u,"INVALID_ARGUMENT")&&(l++,u.info==null&&(u.info={}),u.info.sendTransactionHash=s,l>10)){o(u);return}this.provider.emit("error",Mt("failed to fetch transation after sending (will try again)","UNKNOWN_ERROR",{error:u}))}this.provider._setTimeout(()=>{c()},a.pop()||4e3)};c()})}async signTransaction(t){const r=Iy(t);if(r.from){const i=await Gn(r.from,this.provider);z(i!=null&&i.toLowerCase()===this.address.toLowerCase(),"from address mismatch","transaction",t),r.from=i}else r.from=this.address;const s=this.provider.getRpcTransaction(r);return await this.provider.send("eth_signTransaction",[s])}async signMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("personal_sign",[we(r),this.address.toLowerCase()])}async signTypedData(t,r,s){const i=Iy(s),o=await wy.resolveNames(t,r,i,async a=>{const l=await Gn(a);return z(l!=null,"TypedData does not support null address","value",a),l});return await this.provider.send("eth_signTypedData_v4",[this.address.toLowerCase(),JSON.stringify(wy.getPayload(o.domain,r,o.value))])}async unlock(t){return this.provider.send("personal_unlockAccount",[this.address.toLowerCase(),t,null])}async _legacySignMessage(t){const r=typeof t=="string"?Mi(t):t;return await this.provider.send("eth_sign",[this.address.toLowerCase(),we(r)])}}class mL extends Dy{constructor(t,r){super(t,r);J(this,Jh);J(this,Jl);J(this,wf);J(this,io);J(this,ui);J(this,Ss);J(this,ts);J(this,ur);L(this,wf,1),L(this,Jl,Object.assign({},pL,r||{})),L(this,io,[]),L(this,ui,null),L(this,ts,null),L(this,ur,null);{let i=null;const o=new Promise(a=>{i=a});L(this,Ss,{promise:o,resolve:i})}const s=this._getOption("staticNetwork");typeof s=="boolean"?(z(!s||t!=="any","staticNetwork cannot be used on special network 'any'","options",r),s&&t!=null&&L(this,ts,tn.from(t))):s&&(z(t==null||s.matches(t),"staticNetwork MUST match network object","options",r),L(this,ts,s))}_getOption(t){return T(this,Jl)[t]}get _network(){return ee(T(this,ts),"network is not available yet","NETWORK_ERROR"),T(this,ts)}async _perform(t){if(t.method==="call"||t.method==="estimateGas"){let s=t.transaction;if(s&&s.type!=null&&xe(s.type)&&s.maxFeePerGas==null&&s.maxPriorityFeePerGas==null){const i=await this.getFeeData();i.maxFeePerGas==null&&i.maxPriorityFeePerGas==null&&(t=Object.assign({},t,{transaction:Object.assign({},s,{type:void 0})}))}}const r=this.getRpcRequest(t);return r!=null?await this.send(r.method,r.args):super._perform(t)}async _detectNetwork(){const t=this._getOption("staticNetwork");if(t)if(t===!0){if(T(this,ts))return T(this,ts)}else return t;return T(this,ur)?await T(this,ur):this.ready?(L(this,ur,(async()=>{try{const r=tn.from(xe(await this.send("eth_chainId",[])));return L(this,ur,null),r}catch(r){throw L(this,ur,null),r}})()),await T(this,ur)):(L(this,ur,(async()=>{const r={id:Xh(this,wf)._++,method:"eth_chainId",params:[],jsonrpc:"2.0"};this.emit("debug",{action:"sendRpcPayload",payload:r});let s;try{s=(await this._send(r))[0],L(this,ur,null)}catch(i){throw L(this,ur,null),this.emit("debug",{action:"receiveRpcError",error:i}),i}if(this.emit("debug",{action:"receiveRpcResult",result:s}),"result"in s)return tn.from(xe(s.result));throw this.getRpcError(r,s)})()),await T(this,ur))}_start(){T(this,Ss)==null||T(this,Ss).resolve==null||(T(this,Ss).resolve(),L(this,Ss,null),(async()=>{for(;T(this,ts)==null&&!this.destroyed;)try{L(this,ts,await this._detectNetwork())}catch(t){if(this.destroyed)break;console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"),this.emit("error",Mt("failed to bootstrap network detection","NETWORK_ERROR",{event:"initial-network-discovery",info:{error:t}})),await XZ(1e3)}fe(this,Jh,BE).call(this)})())}async _waitUntilReady(){if(T(this,Ss)!=null)return await T(this,Ss).promise}_getSubscriber(t){return t.type==="pending"?new qZ(this):t.type==="event"?this._getOption("polling")?new ex(this,t.filter):new JZ(this,t.filter):t.type==="orphan"&&t.filter.orphan==="drop-log"?new Py("orphan"):super._getSubscriber(t)}get ready(){return T(this,Ss)==null}getRpcTransaction(t){const r={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach(s=>{if(t[s]==null)return;let i=s;s==="gasLimit"&&(i="gas"),r[i]=ol(xe(t[s],`tx.${s}`))}),["from","to","data"].forEach(s=>{t[s]!=null&&(r[s]=we(t[s]))}),t.accessList&&(r.accessList=$o(t.accessList)),t.blobVersionedHashes&&(r.blobVersionedHashes=t.blobVersionedHashes.map(s=>s.toLowerCase())),r}getRpcRequest(t){switch(t.method){case"chainId":return{method:"eth_chainId",args:[]};case"getBlockNumber":return{method:"eth_blockNumber",args:[]};case"getGasPrice":return{method:"eth_gasPrice",args:[]};case"getPriorityFee":return{method:"eth_maxPriorityFeePerGas",args:[]};case"getBalance":return{method:"eth_getBalance",args:[Eu(t.address),t.blockTag]};case"getTransactionCount":return{method:"eth_getTransactionCount",args:[Eu(t.address),t.blockTag]};case"getCode":return{method:"eth_getCode",args:[Eu(t.address),t.blockTag]};case"getStorage":return{method:"eth_getStorageAt",args:[Eu(t.address),"0x"+t.position.toString(16),t.blockTag]};case"broadcastTransaction":return{method:"eth_sendRawTransaction",args:[t.signedTransaction]};case"getBlock":if("blockTag"in t)return{method:"eth_getBlockByNumber",args:[t.blockTag,!!t.includeTransactions]};if("blockHash"in t)return{method:"eth_getBlockByHash",args:[t.blockHash,!!t.includeTransactions]};break;case"getTransaction":return{method:"eth_getTransactionByHash",args:[t.hash]};case"getTransactionReceipt":return{method:"eth_getTransactionReceipt",args:[t.hash]};case"call":return{method:"eth_call",args:[this.getRpcTransaction(t.transaction),t.blockTag]};case"estimateGas":return{method:"eth_estimateGas",args:[this.getRpcTransaction(t.transaction)]};case"getLogs":return t.filter&&t.filter.address!=null&&(Array.isArray(t.filter.address)?t.filter.address=t.filter.address.map(Eu):t.filter.address=Eu(t.filter.address)),{method:"eth_getLogs",args:[t.filter]}}return null}getRpcError(t,r){const{method:s}=t,{error:i}=r;if(s==="eth_estimateGas"&&i.message){const l=i.message;if(!l.match(/revert/i)&&l.match(/insufficient funds/i))return Mt("insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.params[0],info:{payload:t,error:i}})}if(s==="eth_call"||s==="eth_estimateGas"){const l=ox(i),c=yu.getBuiltinCallException(s==="eth_call"?"call":"estimateGas",t.params[0],l?l.data:null);return c.info={error:i,payload:t},c}const o=JSON.stringify(eee(i));if(typeof i.message=="string"&&i.message.match(/user denied|ethers-user-denied/i))return Mt("user rejected action","ACTION_REJECTED",{action:{eth_sign:"signMessage",personal_sign:"signMessage",eth_signTypedData_v4:"signTypedData",eth_signTransaction:"signTransaction",eth_sendTransaction:"sendTransaction",eth_requestAccounts:"requestAccess",wallet_requestAccounts:"requestAccess"}[s]||"unknown",reason:"rejected",info:{payload:t,error:i}});if(s==="eth_sendRawTransaction"||s==="eth_sendTransaction"){const l=t.params[0];if(o.match(/insufficient funds|base fee exceeds gas limit/i))return Mt("insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:l,info:{error:i}});if(o.match(/nonce/i)&&o.match(/too low/i))return Mt("nonce has already been used","NONCE_EXPIRED",{transaction:l,info:{error:i}});if(o.match(/replacement transaction/i)&&o.match(/underpriced/i))return Mt("replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:l,info:{error:i}});if(o.match(/only replay-protected/i))return Mt("legacy pre-eip-155 transactions not supported","UNSUPPORTED_OPERATION",{operation:s,info:{transaction:l,info:{error:i}}})}let a=!!o.match(/the method .* does not exist/i);return a||i&&i.details&&i.details.startsWith("Unauthorized method:")&&(a=!0),a?Mt("unsupported operation","UNSUPPORTED_OPERATION",{operation:t.method,info:{error:i,payload:t}}):Mt("could not coalesce error","UNKNOWN_ERROR",{error:i,payload:t})}send(t,r){if(this.destroyed)return Promise.reject(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t}));const s=Xh(this,wf)._++,i=new Promise((o,a)=>{T(this,io).push({resolve:o,reject:a,payload:{method:t,params:r,id:s,jsonrpc:"2.0"}})});return fe(this,Jh,BE).call(this),i}async getSigner(t){t==null&&(t=0);const r=this.send("eth_accounts",[]);if(typeof t=="number"){const i=await r;if(t>=i.length)throw new Error("no such account");return new ix(this,i[t])}const{accounts:s}=await On({network:this.getNetwork(),accounts:r});t=pt(t);for(const i of s)if(pt(i)===t)return new ix(this,t);throw new Error("invalid account")}async listAccounts(){return(await this.send("eth_accounts",[])).map(r=>new ix(this,r))}destroy(){T(this,ui)&&(clearTimeout(T(this,ui)),L(this,ui,null));for(const{payload:t,reject:r}of T(this,io))r(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:t.method}));L(this,io,[]),super.destroy()}}Jl=new WeakMap,wf=new WeakMap,io=new WeakMap,ui=new WeakMap,Ss=new WeakMap,ts=new WeakMap,ur=new WeakMap,Jh=new WeakSet,BE=function(){if(T(this,ui))return;const t=this._getOption("batchMaxCount")===1?0:this._getOption("batchStallTime");L(this,ui,setTimeout(()=>{L(this,ui,null);const r=T(this,io);for(L(this,io,[]);r.length;){const s=[r.shift()];for(;r.length&&s.length!==T(this,Jl).batchMaxCount;)if(s.push(r.shift()),JSON.stringify(s.map(o=>o.payload)).length>T(this,Jl).batchMaxSize){r.unshift(s.pop());break}(async()=>{const i=s.length===1?s[0].payload:s.map(o=>o.payload);this.emit("debug",{action:"sendRpcPayload",payload:i});try{const o=await this._send(i);this.emit("debug",{action:"receiveRpcResult",result:o});for(const{resolve:a,reject:l,payload:c}of s){if(this.destroyed){l(Mt("provider destroyed; cancelled request","UNSUPPORTED_OPERATION",{operation:c.method}));continue}const u=o.filter(f=>f.id===c.id)[0];if(u==null){const f=Mt("missing response for request","BAD_DATA",{value:o,info:{payload:c}});this.emit("error",f),l(f);continue}if("error"in u){l(this.getRpcError(c,u));continue}a(u.result)}}catch(o){this.emit("debug",{action:"receiveRpcError",error:o});for(const{reject:a}of s)a(o)}})()}},t))};class ZZ extends mL{constructor(t,r){super(t,r);J(this,ma);let s=this._getOption("pollingInterval");s==null&&(s=pL.pollingInterval),L(this,ma,s)}_getSubscriber(t){const r=super._getSubscriber(t);return hL(r)&&(r.pollingInterval=T(this,ma)),r}get pollingInterval(){return T(this,ma)}set pollingInterval(t){if(!Number.isInteger(t)||t<0)throw new Error("invalid interval");L(this,ma,t),this._forEachSubscriber(r=>{hL(r)&&(r.pollingInterval=T(this,ma))})}}ma=new WeakMap;class Fi extends ZZ{constructor(t,r,s){t==null&&(t="http://localhost:8545");super(r,s);J(this,Af);typeof t=="string"?L(this,Af,new zn(t)):L(this,Af,t.clone())}_getConnection(){return T(this,Af).clone()}async send(t,r){return await this._start(),await super.send(t,r)}async _send(t){const r=this._getConnection();r.body=JSON.stringify(t),r.setHeader("content-type","application/json");const s=await r.send();s.assertOk();let i=s.bodyJson;return Array.isArray(i)||(i=[i]),i}}Af=new WeakMap;function ox(n){if(n==null)return null;if(typeof n.message=="string"&&n.message.match(/revert/i)&&Ct(n.data))return{message:n.message,data:n.data};if(typeof n=="object"){for(const e in n){const t=ox(n[e]);if(t)return t}return null}if(typeof n=="string")try{return ox(JSON.parse(n))}catch{}return null}function ax(n,e){if(n!=null){if(typeof n.message=="string"&&e.push(n.message),typeof n=="object")for(const t in n)ax(n[t],e);if(typeof n=="string")try{return ax(JSON.parse(n),e)}catch{}}}function eee(n){const e=[];return ax(n,e),e}const Ly="9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972";function tee(n){switch(n){case"mainnet":return"rpc.ankr.com/eth";case"goerli":return"rpc.ankr.com/eth_goerli";case"sepolia":return"rpc.ankr.com/eth_sepolia";case"arbitrum":return"rpc.ankr.com/arbitrum";case"base":return"rpc.ankr.com/base";case"base-goerli":return"rpc.ankr.com/base_goerli";case"base-sepolia":return"rpc.ankr.com/base_sepolia";case"bnb":return"rpc.ankr.com/bsc";case"bnbt":return"rpc.ankr.com/bsc_testnet_chapel";case"matic":return"rpc.ankr.com/polygon";case"matic-mumbai":return"rpc.ankr.com/polygon_mumbai";case"optimism":return"rpc.ankr.com/optimism";case"optimism-goerli":return"rpc.ankr.com/optimism_testnet";case"optimism-sepolia":return"rpc.ankr.com/optimism_sepolia"}z(!1,"unsupported network","network",n)}class By extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Ly);const i={polling:!0,staticNetwork:s},o=By.getRequest(s,r);super(o,s,i);G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new By(t,this.apiKey)}catch{}return super._getProvider(t)}static getRequest(t,r){r==null&&(r=Ly);const s=new zn(`https://${tee(t.name)}/${r}`);return s.allowGzip=!0,r===Ly&&(s.retryFunc=async(i,o,a)=>(xu("AnkrProvider"),!0)),s}getRpcError(t,r){return t.method==="eth_sendRawTransaction"&&r&&r.error&&r.error.message==="INTERNAL_ERROR: could not replace existing tx"&&(r.error.message="replacement transaction underpriced"),super.getRpcError(t,r)}isCommunityResource(){return this.apiKey===Ly}}const _y="_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";function nee(n){switch(n){case"mainnet":return"eth-mainnet.alchemyapi.io";case"goerli":return"eth-goerli.g.alchemy.com";case"sepolia":return"eth-sepolia.g.alchemy.com";case"arbitrum":return"arb-mainnet.g.alchemy.com";case"arbitrum-goerli":return"arb-goerli.g.alchemy.com";case"arbitrum-sepolia":return"arb-sepolia.g.alchemy.com";case"base":return"base-mainnet.g.alchemy.com";case"base-goerli":return"base-goerli.g.alchemy.com";case"base-sepolia":return"base-sepolia.g.alchemy.com";case"matic":return"polygon-mainnet.g.alchemy.com";case"matic-amoy":return"polygon-amoy.g.alchemy.com";case"matic-mumbai":return"polygon-mumbai.g.alchemy.com";case"optimism":return"opt-mainnet.g.alchemy.com";case"optimism-goerli":return"opt-goerli.g.alchemy.com";case"optimism-sepolia":return"opt-sepolia.g.alchemy.com"}z(!1,"unsupported network","network",n)}class Fy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=_y);const i=Fy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new Fy(t,this.apiKey)}catch{}return super._getProvider(t)}async _perform(t){if(t.method==="getTransactionResult"){const{trace:r,tx:s}=await On({trace:this.send("trace_transaction",[t.hash]),tx:this.getTransaction(t.hash)});if(r==null||s==null)return null;let i,o=!1;try{i=r[0].result.output,o=r[0].error==="Reverted"}catch{}if(i)return ee(!o,"an error occurred during transaction executions","CALL_EXCEPTION",{action:"getTransactionResult",data:i,reason:null,transaction:s,invocation:null,revert:null}),i;ee(!1,"could not parse trace result","BAD_DATA",{value:r})}return await super._perform(t)}isCommunityResource(){return this.apiKey===_y}static getRequest(t,r){r==null&&(r=_y);const s=new zn(`https://${nee(t.name)}/v2/${r}`);return s.allowGzip=!0,r===_y&&(s.retryFunc=async(i,o,a)=>(xu("alchemy"),!0)),s}}function jy(n){switch(n){case"mainnet":return"39f1d67cedf8b7831010a665328c9197";case"arbitrum":return"0550c209db33c3abf4cc927e1e18cea1";case"bnb":return"98b5a77e531614387366f6fc5da097f8";case"matic":return"cd9d4d70377471aa7c142ec4a4205249"}z(!1,"unsupported network","network",n)}function ree(n){switch(n){case"mainnet":return"ethereum-mainnet.core.chainstack.com";case"arbitrum":return"arbitrum-mainnet.core.chainstack.com";case"bnb":return"bsc-mainnet.core.chainstack.com";case"matic":return"polygon-mainnet.core.chainstack.com"}z(!1,"unsupported network","network",n)}class Uy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=jy(s.name));const i=Uy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"apiKey");Ne(this,{apiKey:r})}_getProvider(t){try{return new Uy(t,this.apiKey)}catch{}return super._getProvider(t)}isCommunityResource(){return this.apiKey===jy(this._network.name)}static getRequest(t,r){r==null&&(r=jy(t.name));const s=new zn(`https://${ree(t.name)}/${r}`);return s.allowGzip=!0,r===jy(t.name)&&(s.retryFunc=async(i,o,a)=>(xu("ChainstackProvider"),!0)),s}}class see extends Fi{constructor(e){e==null&&(e="mainnet");const t=tn.from(e);z(t.name==="mainnet","unsupported network","network",e),super("https://cloudflare-eth.com/",t,{staticNetwork:t})}}const gL=2e3;function iee(n){return n&&typeof n.then=="function"}const oee="org.ethers.plugins.provider.Etherscan",aee=["enableCcipRead"];let lee=1;class cee extends Dy{constructor(t,r){const s=r??null;super();G(this,"network");G(this,"apiKey");J(this,vf);const i=tn.from(t);L(this,vf,i.getPlugin(oee)),Ne(this,{apiKey:s,network:i}),this.getBaseUrl()}getBaseUrl(){if(T(this,vf))return T(this,vf).baseUrl;switch(this.network.name){case"mainnet":return"https://api.etherscan.io";case"goerli":return"https://api-goerli.etherscan.io";case"sepolia":return"https://api-sepolia.etherscan.io";case"holesky":return"https://api-holesky.etherscan.io";case"arbitrum":return"https://api.arbiscan.io";case"arbitrum-goerli":return"https://api-goerli.arbiscan.io";case"base":return"https://api.basescan.org";case"base-sepolia":return"https://api-sepolia.basescan.org";case"bnb":return"https://api.bscscan.com";case"bnbt":return"https://api-testnet.bscscan.com";case"matic":return"https://api.polygonscan.com";case"matic-amoy":return"https://api-amoy.polygonscan.com";case"matic-mumbai":return"https://api-testnet.polygonscan.com";case"optimism":return"https://api-optimistic.etherscan.io";case"optimism-goerli":return"https://api-goerli-optimistic.etherscan.io"}z(!1,"unsupported network","network",this.network)}getUrl(t,r){const s=Object.keys(r).reduce((o,a)=>{const l=r[a];return l!=null&&(o+=`&${a}=${l}`),o},""),i=this.apiKey?`&apikey=${this.apiKey}`:"";return`${this.getBaseUrl()}/api?module=${t}${s}${i}`}getPostUrl(){return`${this.getBaseUrl()}/api`}getPostData(t,r){return r.module=t,r.apikey=this.apiKey,r}async detectNetwork(){return this.network}async fetch(t,r,s){const i=lee++,o=s?this.getPostUrl():this.getUrl(t,r),a=s?this.getPostData(t,r):null;this.emit("debug",{action:"sendRequest",id:i,url:o,payload:a});const l=new zn(o);l.setThrottleParams({slotInterval:1e3}),l.retryFunc=(f,d,h)=>(this.isCommunityResource()&&xu("Etherscan"),Promise.resolve(!0)),l.processFunc=async(f,d)=>{const h=d.hasBody()?JSON.parse(iu(d.body)):{},p=(typeof h.result=="string"?h.result:"").toLowerCase().indexOf("rate limit")>=0;return t==="proxy"?h&&h.status==0&&h.message=="NOTOK"&&p&&(this.emit("debug",{action:"receiveError",id:i,reason:"proxy-NOTOK",error:h}),d.throwThrottleError(h.result,gL)):p&&(this.emit("debug",{action:"receiveError",id:i,reason:"null result",error:h.result}),d.throwThrottleError(h.result,gL)),d},a&&(l.setHeader("content-type","application/x-www-form-urlencoded; charset=UTF-8"),l.body=Object.keys(a).map(f=>`${f}=${a[f]}`).join("&"));const c=await l.send();try{c.assertOk()}catch(f){this.emit("debug",{action:"receiveError",id:i,error:f,reason:"assertOk"}),ee(!1,"response error","SERVER_ERROR",{request:l,response:c})}c.hasBody()||(this.emit("debug",{action:"receiveError",id:i,error:"missing body",reason:"null body"}),ee(!1,"missing response","SERVER_ERROR",{request:l,response:c}));const u=JSON.parse(iu(c.body));return t==="proxy"?(u.jsonrpc!="2.0"&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"invalid JSON-RPC"}),ee(!1,"invalid JSON-RPC response (missing jsonrpc='2.0')","SERVER_ERROR",{request:l,response:c,info:{result:u}})),u.error&&(this.emit("debug",{action:"receiveError",id:i,result:u,reason:"JSON-RPC error"}),ee(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):u.status==0&&(u.message==="No records found"||u.message==="No transactions found")?(this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result):((u.status!=1||typeof u.message=="string"&&!u.message.match(/^OK/))&&(this.emit("debug",{action:"receiveError",id:i,result:u}),ee(!1,"error response","SERVER_ERROR",{request:l,response:c,info:{result:u}})),this.emit("debug",{action:"receiveRequest",id:i,result:u}),u.result)}_getTransactionPostData(t){const r={};for(let s in t){if(aee.indexOf(s)>=0||t[s]==null)continue;let i=t[s];if(!(s==="type"&&i===0)&&!(s==="blockTag"&&i==="latest")){if({type:!0,gasLimit:!0,gasPrice:!0,maxFeePerGs:!0,maxPriorityFeePerGas:!0,nonce:!0,value:!0}[s])i=ol(i);else if(s==="accessList")i="["+$o(i).map(o=>`{address:"${o.address}",storageKeys:["${o.storageKeys.join('","')}"]}`).join(",")+"]";else if(s==="blobVersionedHashes"){if(i.length===0)continue;ee(!1,"Etherscan API does not support blobVersionedHashes","UNSUPPORTED_OPERATION",{operation:"_getTransactionPostData",info:{transaction:t}})}else i=we(i);r[s]=i}}return r}_checkError(t,r,s){let i="";if(dn(r,"SERVER_ERROR")){try{i=r.info.result.error.message}catch{}if(!i)try{i=r.info.message}catch{}}if(t.method==="estimateGas"&&!i.match(/revert/i)&&i.match(/insufficient funds/i)&&ee(!1,"insufficient funds","INSUFFICIENT_FUNDS",{transaction:t.transaction}),(t.method==="call"||t.method==="estimateGas")&&i.match(/execution reverted/i)){let o="";try{o=r.info.result.error.data}catch{}const a=yu.getBuiltinCallException(t.method,t.transaction,o);throw a.info={request:t,error:r},a}if(i&&t.method==="broadcastTransaction"){const o=hh.from(t.signedTransaction);i.match(/replacement/i)&&i.match(/underpriced/i)&&ee(!1,"replacement fee too low","REPLACEMENT_UNDERPRICED",{transaction:o}),i.match(/insufficient funds/)&&ee(!1,"insufficient funds for intrinsic transaction cost","INSUFFICIENT_FUNDS",{transaction:o}),i.match(/same hash was already imported|transaction nonce is too low|nonce too low/)&&ee(!1,"nonce has already been used","NONCE_EXPIRED",{transaction:o})}throw r}async _detectNetwork(){return this.network}async _perform(t){switch(t.method){case"chainId":return this.network.chainId;case"getBlockNumber":return this.fetch("proxy",{action:"eth_blockNumber"});case"getGasPrice":return this.fetch("proxy",{action:"eth_gasPrice"});case"getPriorityFee":if(this.network.name==="mainnet")return"1000000000";if(this.network.name==="optimism")return"1000000";throw new Error("fallback onto the AbstractProvider default");case"getBalance":return this.fetch("account",{action:"balance",address:t.address,tag:t.blockTag});case"getTransactionCount":return this.fetch("proxy",{action:"eth_getTransactionCount",address:t.address,tag:t.blockTag});case"getCode":return this.fetch("proxy",{action:"eth_getCode",address:t.address,tag:t.blockTag});case"getStorage":return this.fetch("proxy",{action:"eth_getStorageAt",address:t.address,position:t.position,tag:t.blockTag});case"broadcastTransaction":return this.fetch("proxy",{action:"eth_sendRawTransaction",hex:t.signedTransaction},!0).catch(r=>this._checkError(t,r,t.signedTransaction));case"getBlock":if("blockTag"in t)return this.fetch("proxy",{action:"eth_getBlockByNumber",tag:t.blockTag,boolean:t.includeTransactions?"true":"false"});ee(!1,"getBlock by blockHash not supported by Etherscan","UNSUPPORTED_OPERATION",{operation:"getBlock(blockHash)"});case"getTransaction":return this.fetch("proxy",{action:"eth_getTransactionByHash",txhash:t.hash});case"getTransactionReceipt":return this.fetch("proxy",{action:"eth_getTransactionReceipt",txhash:t.hash});case"call":{if(t.blockTag!=="latest")throw new Error("EtherscanProvider does not support blockTag for call");const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_call";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}case"estimateGas":{const r=this._getTransactionPostData(t.transaction);r.module="proxy",r.action="eth_estimateGas";try{return await this.fetch("proxy",r,!0)}catch(s){return this._checkError(t,s,t.transaction)}}}return super._perform(t)}async getNetwork(){return this.network}async getEtherPrice(){return this.network.name!=="mainnet"?0:parseFloat((await this.fetch("stats",{action:"ethprice"})).ethusd)}async getContract(t){let r=this._getAddress(t);iee(r)&&(r=await r);try{const s=await this.fetch("contract",{action:"getabi",address:r}),i=JSON.parse(s);return new wu(r,i,this)}catch{return null}}isCommunityResource(){return this.apiKey==null}}vf=new WeakMap;function uee(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("unable to locate global object")}const fee=uee().WebSocket;class lx{constructor(e,t){J(this,fi);J(this,qh);J(this,ga);J(this,ql);J(this,ya);L(this,fi,e),L(this,qh,JSON.stringify(t)),L(this,ga,null),L(this,ql,null),L(this,ya,null)}get filter(){return JSON.parse(T(this,qh))}start(){L(this,ga,T(this,fi).send("eth_subscribe",this.filter).then(e=>(T(this,fi)._register(e,this),e)))}stop(){T(this,ga).then(e=>{T(this,fi).destroyed||T(this,fi).send("eth_unsubscribe",[e])}),L(this,ga,null)}pause(e){ee(e,"preserve logs while paused not supported by SocketSubscriber yet","UNSUPPORTED_OPERATION",{operation:"pause(false)"}),L(this,ql,!!e)}resume(){L(this,ql,null)}_handleMessage(e){if(T(this,ga)!=null&&T(this,ql)===null){let t=T(this,ya);t==null?t=this._emit(T(this,fi),e):t=t.then(async()=>{await this._emit(T(this,fi),e)}),L(this,ya,t.then(()=>{T(this,ya)===t&&L(this,ya,null)}))}}async _emit(e,t){throw new Error("sub-classes must implemente this; _emit")}}fi=new WeakMap,qh=new WeakMap,ga=new WeakMap,ql=new WeakMap,ya=new WeakMap;class dee extends lx{constructor(e){super(e,["newHeads"])}async _emit(e,t){e.emit("block",parseInt(t.number))}}class hee extends lx{constructor(e){super(e,["newPendingTransactions"])}async _emit(e,t){e.emit("pending",t)}}class pee extends lx{constructor(t,r){super(t,["logs",r]);J(this,Yh);L(this,Yh,JSON.stringify(r))}get logFilter(){return JSON.parse(T(this,Yh))}async _emit(t,r){t.emit(this.logFilter,t._wrapLog(r,t._network))}}Yh=new WeakMap;class mee extends mL{constructor(t,r){const s=Object.assign({},r??{});z(s.batchMaxCount==null||s.batchMaxCount===1,"sockets-based providers do not support batches","options.batchMaxCount",r),s.batchMaxCount=1,s.staticNetwork==null&&(s.staticNetwork=!0);super(t,s);J(this,Yl);J(this,xf);J(this,ba);L(this,Yl,new Map),L(this,xf,new Map),L(this,ba,new Map)}_getSubscriber(t){switch(t.type){case"close":return new Py("close");case"block":return new dee(this);case"pending":return new hee(this);case"event":return new pee(this,t.filter);case"orphan":if(t.filter.orphan==="drop-log")return new Py("drop-log")}return super._getSubscriber(t)}_register(t,r){T(this,xf).set(t,r);const s=T(this,ba).get(t);if(s){for(const i of s)r._handleMessage(i);T(this,ba).delete(t)}}async _send(t){z(!Array.isArray(t),"WebSocket does not support batch send","payload",t);const r=new Promise((s,i)=>{T(this,Yl).set(t.id,{payload:t,resolve:s,reject:i})});return await this._waitUntilReady(),await this._write(JSON.stringify(t)),[await r]}async _processMessage(t){const r=JSON.parse(t);if(r&&typeof r=="object"&&"id"in r){const s=T(this,Yl).get(r.id);if(s==null){this.emit("error",Mt("received result for unknown id","UNKNOWN_ERROR",{reasonCode:"UNKNOWN_ID",result:r}));return}T(this,Yl).delete(r.id),s.resolve(r)}else if(r&&r.method==="eth_subscription"){const s=r.params.subscription,i=T(this,xf).get(s);if(i)i._handleMessage(r.params.result);else{let o=T(this,ba).get(s);o==null&&(o=[],T(this,ba).set(s,o)),o.push(r.params.result)}}else{this.emit("error",Mt("received unexpected message","UNKNOWN_ERROR",{reasonCode:"UNEXPECTED_MESSAGE",result:r}));return}}async _write(t){throw new Error("sub-classes must override this")}}Yl=new WeakMap,xf=new WeakMap,ba=new WeakMap;class yL extends mee{constructor(t,r,s){super(r,s);J(this,Xl);J(this,Ts);typeof t=="string"?(L(this,Xl,()=>new fee(t)),L(this,Ts,T(this,Xl).call(this))):typeof t=="function"?(L(this,Xl,t),L(this,Ts,t())):(L(this,Xl,null),L(this,Ts,t)),this.websocket.onopen=async()=>{try{await this._start(),this.resume()}catch(i){console.log("failed to start WebsocketProvider",i)}},this.websocket.onmessage=i=>{this._processMessage(i.data)}}get websocket(){if(T(this,Ts)==null)throw new Error("websocket closed");return T(this,Ts)}async _write(t){this.websocket.send(t)}async destroy(){T(this,Ts)!=null&&(T(this,Ts).close(),L(this,Ts,null)),super.destroy()}}Xl=new WeakMap,Ts=new WeakMap;const Ah="84842078b09946638c03157f83405213";function gee(n){switch(n){case"mainnet":return"mainnet.infura.io";case"goerli":return"goerli.infura.io";case"sepolia":return"sepolia.infura.io";case"arbitrum":return"arbitrum-mainnet.infura.io";case"arbitrum-goerli":return"arbitrum-goerli.infura.io";case"arbitrum-sepolia":return"arbitrum-sepolia.infura.io";case"base":return"base-mainnet.infura.io";case"base-goerlia":return"base-goerli.infura.io";case"base-sepolia":return"base-sepolia.infura.io";case"bnb":return"bnbsmartchain-mainnet.infura.io";case"bnbt":return"bnbsmartchain-testnet.infura.io";case"linea":return"linea-mainnet.infura.io";case"linea-goerli":return"linea-goerli.infura.io";case"linea-sepolia":return"linea-sepolia.infura.io";case"matic":return"polygon-mainnet.infura.io";case"matic-amoy":return"polygon-amoy.infura.io";case"matic-mumbai":return"polygon-mumbai.infura.io";case"optimism":return"optimism-mainnet.infura.io";case"optimism-goerli":return"optimism-goerli.infura.io";case"optimism-sepolia":return"optimism-sepolia.infura.io"}z(!1,"unsupported network","network",n)}class yee extends yL{constructor(t,r){const s=new vh(t,r),i=s._getConnection();ee(!i.credentials,"INFURA WebSocket project secrets unsupported","UNSUPPORTED_OPERATION",{operation:"InfuraProvider.getWebSocketProvider()"});const o=i.url.replace(/^http/i,"ws").replace("/v3/","/ws/v3/");super(o,s._network);G(this,"projectId");G(this,"projectSecret");Ne(this,{projectId:s.projectId,projectSecret:s.projectSecret})}isCommunityResource(){return this.projectId===Ah}}class vh extends Fi{constructor(t,r,s){t==null&&(t="mainnet");const i=tn.from(t);r==null&&(r=Ah),s==null&&(s=null);const o=vh.getRequest(i,r,s);super(o,i,{staticNetwork:i});G(this,"projectId");G(this,"projectSecret");Ne(this,{projectId:r,projectSecret:s})}_getProvider(t){try{return new vh(t,this.projectId,this.projectSecret)}catch{}return super._getProvider(t)}isCommunityResource(){return this.projectId===Ah}static getWebSocketProvider(t,r){return new yee(t,r)}static getRequest(t,r,s){r==null&&(r=Ah),s==null&&(s=null);const i=new zn(`https://${gee(t.name)}/v3/${r}`);return i.allowGzip=!0,s&&i.setCredentials("",s),r===Ah&&(i.retryFunc=async(o,a,l)=>(xu("InfuraProvider"),!0)),i}}const Vy="919b412a057b5e9c9b6dce193c5a60242d6efadb";function bee(n){switch(n){case"mainnet":return"ethers.quiknode.pro";case"goerli":return"ethers.ethereum-goerli.quiknode.pro";case"sepolia":return"ethers.ethereum-sepolia.quiknode.pro";case"holesky":return"ethers.ethereum-holesky.quiknode.pro";case"arbitrum":return"ethers.arbitrum-mainnet.quiknode.pro";case"arbitrum-goerli":return"ethers.arbitrum-goerli.quiknode.pro";case"arbitrum-sepolia":return"ethers.arbitrum-sepolia.quiknode.pro";case"base":return"ethers.base-mainnet.quiknode.pro";case"base-goerli":return"ethers.base-goerli.quiknode.pro";case"base-spolia":return"ethers.base-sepolia.quiknode.pro";case"bnb":return"ethers.bsc.quiknode.pro";case"bnbt":return"ethers.bsc-testnet.quiknode.pro";case"matic":return"ethers.matic.quiknode.pro";case"matic-mumbai":return"ethers.matic-testnet.quiknode.pro";case"optimism":return"ethers.optimism.quiknode.pro";case"optimism-goerli":return"ethers.optimism-goerli.quiknode.pro";case"optimism-sepolia":return"ethers.optimism-sepolia.quiknode.pro";case"xdai":return"ethers.xdai.quiknode.pro"}z(!1,"unsupported network","network",n)}class Hy extends Fi{constructor(t,r){t==null&&(t="mainnet");const s=tn.from(t);r==null&&(r=Vy);const i=Hy.getRequest(s,r);super(i,s,{staticNetwork:s});G(this,"token");Ne(this,{token:r})}_getProvider(t){try{return new Hy(t,this.token)}catch{}return super._getProvider(t)}isCommunityResource(){return this.token===Vy}static getRequest(t,r){r==null&&(r=Vy);const s=new zn(`https://${bee(t.name)}/${r}`);return s.allowGzip=!0,r===Vy&&(s.retryFunc=async(i,o,a)=>(xu("QuickNodeProvider"),!0)),s}}const wee=BigInt("1"),Aee=BigInt("2");function vee(n){for(let e=n.length-1;e>0;e--){const t=Math.floor(Math.random()*(e+1)),r=n[e];n[e]=n[t],n[t]=r}}function xee(n){return new Promise(e=>{setTimeout(e,n)})}function cx(){return new Date().getTime()}function ux(n){return JSON.stringify(n,(e,t)=>typeof t=="bigint"?{type:"bigint",value:t.toString()}:t)}const bL={stallTimeout:400,priority:1,weight:1},wL={blockNumber:-2,requests:0,lateResponses:0,errorResponses:0,outOfSync:-1,unsupportedEvents:0,rollingDuration:0,score:0,_network:null,_updateNumber:null,_totalTime:0,_lastFatalError:null,_lastFatalErrorTimestamp:0};async function Eee(n,e){for(;(n.blockNumber<0||n.blockNumber<e)&&(n._updateNumber||(n._updateNumber=(async()=>{try{const t=await n.provider.getBlockNumber();t>n.blockNumber&&(n.blockNumber=t)}catch(t){n.blockNumber=-2,n._lastFatalError=t,n._lastFatalErrorTimestamp=cx()}n._updateNumber=null})()),await n._updateNumber,n.outOfSync++,!n._lastFatalError););}function xh(n){if(n==null)return"null";if(Array.isArray(n))return"["+n.map(xh).join(",")+"]";if(typeof n=="object"&&typeof n.toJSON=="function")return xh(n.toJSON());switch(typeof n){case"boolean":case"symbol":return n.toString();case"bigint":case"number":return BigInt(n).toString();case"string":return JSON.stringify(n);case"object":{const e=Object.keys(n);return e.sort(),"{"+e.map(t=>`${JSON.stringify(t)}:${xh(n[t])}`).join(",")+"}"}}throw console.log("Could not serialize",n),new Error("Hmm...")}function fx(n){if("error"in n){const t=n.error;return{tag:xh(t),value:t}}const e=n.result;return{tag:xh(e),value:e}}function zy(n,e){const t=new Map;for(const{value:s,tag:i,weight:o}of e){const a=t.get(i)||{value:s,weight:0};a.weight+=o,t.set(i,a)}let r=null;for(const s of t.values())s.weight>=n&&(!r||s.weight>r.weight)&&(r=s);if(r)return r.value}function dx(n,e){let t=0;const r=new Map;let s=null;const i=[];for(const{value:a,tag:l,weight:c}of e)if(a instanceof Error){const u=r.get(l)||{value:a,weight:0};u.weight+=c,r.set(l,u),(s==null||u.weight>s.weight)&&(s=u)}else i.push(BigInt(a)),t+=c;if(t<n)return s&&s.weight>=n?s.value:void 0;i.sort((a,l)=>a<l?-1:l>a?1:0);const o=Math.floor(i.length/2);return i.length%2?i[o]:(i[o-1]+i[o]+wee)/Aee}function hx(n,e){const t=zy(n,e);if(t!==void 0)return t;for(const r of e)if(r.value)return r.value}function Cee(n,e){if(n===1)return Je(dx(n,e),"%internal");const t=new Map,r=(o,a)=>{const l=t.get(o)||{result:o,weight:0};l.weight+=a,t.set(o,l)};for(const{weight:o,value:a}of e){const l=Je(a);r(l-1,o),r(l,o),r(l+1,o)}let s=0,i;for(const{weight:o,result:a}of t.values())o>=n&&(o>s||i!=null&&o===s&&a>i)&&(s=o,i=a);return i}class kee extends Dy{constructor(t,r,s){super(r,s);J(this,dr);G(this,"quorum");G(this,"eventQuorum");G(this,"eventWorkers");J(this,fr);J(this,oo);J(this,Ef);L(this,fr,t.map(i=>i instanceof Dy?Object.assign({provider:i},bL,wL):Object.assign({},bL,i,wL))),L(this,oo,-2),L(this,Ef,null),s&&s.quorum!=null?this.quorum=s.quorum:this.quorum=Math.ceil(T(this,fr).reduce((i,o)=>(i+=o.weight,i),0)/2),this.eventQuorum=1,this.eventWorkers=1,z(this.quorum<=T(this,fr).reduce((i,o)=>i+o.weight,0),"quorum exceed provider weight","quorum",this.quorum)}get providerConfigs(){return T(this,fr).map(t=>{const r=Object.assign({},t);for(const s in r)s[0]==="_"&&delete r[s];return r})}async _detectNetwork(){return tn.from(xe(await this._perform({method:"chainId"})))}async _translatePerform(t,r){switch(r.method){case"broadcastTransaction":return await t.broadcastTransaction(r.signedTransaction);case"call":return await t.call(Object.assign({},r.transaction,{blockTag:r.blockTag}));case"chainId":return(await t.getNetwork()).chainId;case"estimateGas":return await t.estimateGas(r.transaction);case"getBalance":return await t.getBalance(r.address,r.blockTag);case"getBlock":{const s="blockHash"in r?r.blockHash:r.blockTag;return await t.getBlock(s,r.includeTransactions)}case"getBlockNumber":return await t.getBlockNumber();case"getCode":return await t.getCode(r.address,r.blockTag);case"getGasPrice":return(await t.getFeeData()).gasPrice;case"getPriorityFee":return(await t.getFeeData()).maxPriorityFeePerGas;case"getLogs":return await t.getLogs(r.filter);case"getStorage":return await t.getStorage(r.address,r.position,r.blockTag);case"getTransaction":return await t.getTransaction(r.hash);case"getTransactionCount":return await t.getTransactionCount(r.address,r.blockTag);case"getTransactionReceipt":return await t.getTransactionReceipt(r.hash);case"getTransactionResult":return await t.getTransactionResult(r.hash)}}async _perform(t){if(t.method==="broadcastTransaction"){const o=T(this,fr).map(c=>null),a=T(this,fr).map(async({provider:c,weight:u},f)=>{try{const d=await c._perform(t);o[f]=Object.assign(fx({result:d}),{weight:u})}catch(d){o[f]=Object.assign(fx({error:d}),{weight:u})}});for(;;){const c=o.filter(d=>d!=null);for(const{value:d}of c)if(!(d instanceof Error))return d;const u=zy(this.quorum,o.filter(d=>d!=null));if(dn(u,"INSUFFICIENT_FUNDS"))throw u;const f=a.filter((d,h)=>o[h]==null);if(f.length===0)break;await Promise.race(f)}const l=hx(this.quorum,o);if(ee(l!==void 0,"problem multi-broadcasting","SERVER_ERROR",{request:"%sub-requests",info:{request:t,results:o.map(ux)}}),l instanceof Error)throw l;return l}await fe(this,dr,fF).call(this);const r=new Set;let s=0;for(;;){const o=fe(this,dr,_E).call(this,r,t);if(o==null||(s+=o.config.weight,s>=this.quorum))break}const i=await fe(this,dr,FE).call(this,r,t);for(const o of r)o.perform&&o.result==null&&o.config.lateResponses++;return i}async destroy(){for(const{provider:t}of T(this,fr))t.destroy();super.destroy()}}fr=new WeakMap,oo=new WeakMap,Ef=new WeakMap,dr=new WeakSet,uF=function(t){const r=Array.from(t).map(i=>i.config),s=T(this,fr).slice();vee(s),s.sort((i,o)=>i.priority-o.priority);for(const i of s)if(!i._lastFatalError&&r.indexOf(i)===-1)return i;return null},_E=function(t,r){const s=fe(this,dr,uF).call(this,t);if(s==null)return null;const i={config:s,result:null,didBump:!1,perform:null,staller:null},o=cx();return i.perform=(async()=>{try{s.requests++;const l=await this._translatePerform(s.provider,r);i.result={result:l}}catch(l){s.errorResponses++,i.result={error:l}}const a=cx()-o;s._totalTime+=a,s.rollingDuration=.95*s.rollingDuration+.05*a,i.perform=null})(),i.staller=(async()=>{await xee(s.stallTimeout),i.staller=null})(),t.add(i),i},fF=async function(){let t=T(this,Ef);if(!t){const r=[];T(this,fr).forEach(s=>{r.push((async()=>{await Eee(s,0),s._lastFatalError||(s._network=await s.provider.getNetwork())})())}),L(this,Ef,t=(async()=>{await Promise.all(r);let s=null;for(const i of T(this,fr)){if(i._lastFatalError)continue;const o=i._network;s==null?s=o.chainId:o.chainId!==s&&ee(!1,"cannot mix providers on different networks","UNSUPPORTED_OPERATION",{operation:"new FallbackProvider"})}})())}await t},dF=async function(t,r){const s=[];for(const i of t)if(i.result!=null){const{tag:o,value:a}=fx(i.result);s.push({tag:o,value:a,weight:i.config.weight})}if(!(s.reduce((i,o)=>i+o.weight,0)<this.quorum)){switch(r.method){case"getBlockNumber":{T(this,oo)===-2&&L(this,oo,Math.ceil(Je(dx(this.quorum,T(this,fr).filter(o=>!o._lastFatalError).map(o=>({value:o.blockNumber,tag:Je(o.blockNumber).toString(),weight:o.weight}))))));const i=Cee(this.quorum,s);return i===void 0?void 0:(i>T(this,oo)&&L(this,oo,i),T(this,oo))}case"getGasPrice":case"getPriorityFee":case"estimateGas":return dx(this.quorum,s);case"getBlock":return"blockTag"in r&&r.blockTag==="pending"?hx(this.quorum,s):zy(this.quorum,s);case"call":case"chainId":case"getBalance":case"getTransactionCount":case"getCode":case"getStorage":case"getTransaction":case"getTransactionReceipt":case"getLogs":return zy(this.quorum,s);case"broadcastTransaction":return hx(this.quorum,s)}ee(!1,"unsupported method","UNSUPPORTED_OPERATION",{operation:`_perform(${ux(r.method)})`})}},FE=async function(t,r){if(t.size===0)throw new Error("no runners?!");const s=[];let i=0;for(const a of t){if(a.perform&&s.push(a.perform),a.staller){s.push(a.staller);continue}a.didBump||(a.didBump=!0,i++)}const o=await fe(this,dr,dF).call(this,t,r);if(o!==void 0){if(o instanceof Error)throw o;return o}for(let a=0;a<i;a++)fe(this,dr,_E).call(this,t,r);return ee(s.length>0,"quorum not met","SERVER_ERROR",{request:"%sub-requests",info:{request:r,results:Array.from(t).map(a=>ux(a.result))}}),await Promise.race(s),await fe(this,dr,FE).call(this,t,r)};function See(n){return typeof n.send=="function"&&typeof n.close=="function"}const Tee="goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" ");function Oee(n,e){e==null&&(e={});const t=o=>e[o]==="-"?!1:typeof e.exclusive=="string"?o===e.exclusive:Array.isArray(e.exclusive)?e.exclusive.indexOf(o)!==-1:!0;if(n.match(/^https?:/))return new Fi(n);if(n.match(/^wss?:/)||See(n))return new yL(n);let r=null;try{r=tn.from(n)}catch{}const s=[];if(t("publicPolygon")&&r&&(r.name==="matic"?s.push(new Fi("https://polygon-rpc.com/",r,{staticNetwork:r})):r.name==="matic-amoy"&&s.push(new Fi("https://rpc-amoy.polygon.technology/",r,{staticNetwork:r}))),t("alchemy"))try{s.push(new Fy(n,e.alchemy))}catch{}if(t("ankr")&&e.ankr!=null)try{s.push(new By(n,e.ankr))}catch{}if(t("chainstack"))try{s.push(new Uy(n,e.chainstack))}catch{}if(t("cloudflare"))try{s.push(new see(n))}catch{}if(t("etherscan"))try{s.push(new cee(n,e.etherscan))}catch{}if(t("infura"))try{let o=e.infura,a;typeof o=="object"&&(a=o.projectSecret,o=o.projectId),s.push(new vh(n,o,a))}catch{}if(t("quicknode"))try{let o=e.quicknode;s.push(new Hy(n,o))}catch{}if(ee(s.length,"unsupported default network","UNSUPPORTED_OPERATION",{operation:"getDefaultProvider"}),s.length===1)return s[0];let i=Math.floor(s.length/2);return i>2&&(i=2),r&&Tee.indexOf(r.name)!==-1&&(i=1),e&&e.quorum&&(i=e.quorum),new kee(s,void 0,{quorum:i})}const Nee=async(n,e)=>{const t={name:n,isEns:!1};if(!kY(n))return t;try{const r=await Mee(n,e);r&&(t.name=r,t.isEns=!0)}catch(r){console.log(r)}return t},Mee=async(n,e)=>await Ree(e).lookupAddress(n),Ree=n=>Oee(n),Pee="https://eth-mainnet.g.alchemy.com/v2/uzKE0HT-Vc3LmUAA_dNVEt2rO8LtJGA3",AL=["#30bced","#6eeb83","#fa69d1","#ecd444","#ee6352","#db3041","#0ad7f2","#1bff39"],Dee=({isPreviewMode:n,initialContent:e,enableCollaboration:t,collaborationId:r,walletAddress:s,username:i,onAutoSave:o,onChange:a,onCollaboratorChange:l})=>{var S,M;const[c]=P.useState(new Wa),[u,f]=P.useState(!1),[d,h]=P.useState([...PJ]),p=P.useRef(!1),m=nT({extensions:d,editorProps:fM,autofocus:"start",onUpdate:O=>{w!=null&&w.isEmpty||a==null||a(O.editor.getJSON())}},[d]),y=nT({extensions:d,editorProps:fM,autofocus:"start",onUpdate:O=>{w!=null&&w.isEmpty||a==null||a(O.editor.getJSON())}}),b=P.useRef(()=>{}),v=(O,R=!1)=>{if(!t||!r)throw new Error("docId or username is not provided");f(!0);const D=new h9(r,c,{signaling:["wss://fileverse-signaling-server-0529292ff51c.herokuapp.com/"]});h([...d,j9.configure({document:c}),U9.configure({provider:D,user:{name:O,color:AL[Math.floor(Math.random()*AL.length)],isEns:R},render:_J})]);const _=setTimeout(()=>{f(!1)},100);return b.current=()=>{clearTimeout(_),D.destroy(),c.destroy(),f(!1)},b.current},A=P.useRef(null),w=P.useMemo(()=>t&&r&&m&&!u?m:y,[m,y,u]);P.useEffect(()=>{w==null||w.setEditable(!n)},[n,w]),P.useEffect(()=>{e&&w&&!p.current&&(w.commands.setContent(e),p.current=!0),setTimeout(()=>{p.current=!1})},[e,w]);const x=async()=>{let O=i,R=!1;if(s){const{name:D,isEns:_}=await Nee(s,Pee);O=D,R=_}v(O,R)};P.useEffect(()=>{t?x():b.current()},[t]);const C=P.useMemo(()=>Tv((O,R)=>{R({editorJSONData:O.getJSON()})},1e3),[o]);return P.useEffect(()=>{if(w&&o){const O=()=>{C(w,o)};return w.on("update",O),()=>{w.off("update",O)}}},[w,o,C]),P.useEffect(()=>{var O,R;l==null||l((R=(O=w==null?void 0:w.storage)==null?void 0:O.collaborationCursor)==null?void 0:R.users)},[(M=(S=w==null?void 0:w.storage)==null?void 0:S.collaborationCursor)==null?void 0:M.users]),{editor:w,ref:A,loading:u,connect:v,ydoc:c}},Iee=({title:n,content:e,contentClassName:t,open:r,onOpenChange:s,primaryAction:i,secondaryAction:o})=>k.jsx(m6,{open:r,onOpenChange:s,children:k.jsxs(_O,{className:"max-w-md sm:w-full w-[90%] z-20",children:[k.jsx(FO,{className:"px-4 pt-0 border-b-[1px]",children:k.jsx(UO,{className:"text-left text-base",children:n})}),k.jsx("div",{className:he("flex flex-col gap-4 w-full h-full pb-4 text-base text-black",t),children:e&&e}),k.jsxs(jO,{className:"px-5 pb-5 justify-end sm:",children:[o&&k.jsx(b6,{asChild:!0,children:k.jsx(Oc,{disabled:o==null?void 0:o.isLoading,isLoading:o==null?void 0:o.isLoading,className:o==null?void 0:o.className,variant:(o==null?void 0:o.variant)||"ghost",onClick:o==null?void 0:o.onClick,children:o==null?void 0:o.label})}),i&&k.jsx(Oc,{disabled:i==null?void 0:i.isLoading,isLoading:i==null?void 0:i.isLoading,className:i==null?void 0:i.className,variant:(i==null?void 0:i.variant)||"primary",onClick:i==null?void 0:i.onClick,children:i==null?void 0:i.label})]})]})}),Lee=({editor:n,uploadToIpfs:e})=>{const{toolVisibilty:t,setToolVisibility:r,bottomToolbar:s}=Qw({editor:n,uploadToIpfs:e}),i=YM("(max-width: 1023px)"),[o,a]=P.useState(""),[l,c]=P.useState(""),[u,f]=P.useState(!0),d=()=>{if(o===null){f(!1);return}if(o===""){n.chain().focus().extendMarkRange("link").unsetLink().run(),f(!1);return}let m=o;!o.startsWith("http://")&&!o.startsWith("https://")&&(m="https://"+o);try{m.match(/^((http|https):\/\/)?([w|W]{3}\.)+[a-zA-Z0-9\-\.]{3,}\.[a-zA-Z]{2,}(\.[a-zA-Z]{2,})?$/)&&n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0)}catch{console.error("Invalid URL"),f(!1);return}n.chain().focus().extendMarkRange("link").setLink({href:m}).command(({tr:y})=>(y.insertText(l),!0)).run(),f(!0),r(Me.NONE)},h=m=>{const{from:y,to:b}=m.state.selection;return m.state.doc.textBetween(y,b)},p=P.useRef(null);return P.useEffect(()=>{let m=0;const y=()=>{m=Date.now()},b=()=>{var w;if(Date.now()-m>500){const{selection:x}=n.state;x.from!==x.to&&((w=p.current)==null||w.click())}},v=()=>{var x;if(!i)return;const{selection:A}=n.state;A.from!==A.to&&((x=p.current)==null||x.click())};return i?(document.addEventListener("touchstart",y),document.addEventListener("touchend",b)):document.addEventListener("mouseup",v),()=>{i?(document.removeEventListener("touchstart",y),document.removeEventListener("touchend",b)):document.removeEventListener("mouseup",v)}},[n,i]),k.jsxs(NO,{children:[k.jsx("div",{className:"flex w-full justify-between sm:justify-evenly",children:s.map(m=>{if(m)return k.jsx("div",{className:"flex items-center",children:m.title==="Text formating"?k.jsx(MO,{asChild:!0,children:k.jsx("button",{ref:p,onClick:()=>m.onClick(),children:m.icon})}):m.title==="Text color"?k.jsx(MO,{asChild:!0,children:k.jsx("button",{onClick:()=>m.onClick(),children:m.icon})}):k.jsx("button",{className:he("flex items-center rounded px-2 py-1 text-black transition"),onClick:()=>m.onClick(),children:m.icon})},m.title)})}),t===Me.TEXT_FORMATING&&k.jsx(iz,{editor:n,setToolVisibility:r}),t===Me.TEXT_COLOR_PICKER&&k.jsx(oz,{editor:n,setToolVisibility:r}),t===Me.LINK_POPUP&&k.jsx(Iee,{open:t===Me.LINK_POPUP,onOpenChange:()=>r(Me.NONE),title:"Link",content:k.jsxs("div",{className:"flex flex-col gap-4 w-full h-full px-4",children:[k.jsx(dm,{label:"Text",placeholder:"Link text",className:"w-full",defaultValue:h(n),onChange:m=>c(m.target.value)}),k.jsx(dm,{label:"Link",placeholder:"Paste URL",className:"w-full",defaultValue:n.getAttributes("link").href,onChange:m=>{a(m.target.value)},isValid:u,message:u?"":"Invalid URL"})]}),primaryAction:{label:"Save",onClick:()=>d(),isLoading:!1,className:"w-auto min-w-[80px]"},secondaryAction:{label:"Cancel",variant:"secondary",onClick:()=>r(Me.NONE),className:"w-auto min-w-[80px]"}})]})},px=P.createContext({transformPagePoint:n=>n,isStatic:!1,reducedMotion:"never"}),$y=P.createContext({}),Gy=P.createContext(null),mx=typeof document<"u",gx=mx?P.useLayoutEffect:P.useEffect,vL=P.createContext({strict:!1}),yx=n=>n.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),xL="data-"+yx("framerAppearId"),Bee={skipAnimations:!1,useManualTiming:!1};class EL{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){const t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}}function _ee(n){let e=new EL,t=new EL,r=0,s=!1,i=!1;const o=new WeakSet,a={schedule:(l,c=!1,u=!1)=>{const f=u&&s,d=f?e:t;return c&&o.add(l),d.add(l)&&f&&s&&(r=e.order.length),l},cancel:l=>{t.remove(l),o.delete(l)},process:l=>{if(s){i=!0;return}if(s=!0,[e,t]=[t,e],t.clear(),r=e.order.length,r)for(let c=0;c<r;c++){const u=e.order[c];o.has(u)&&(a.schedule(u),n()),u(l)}s=!1,i&&(i=!1,a.process(l))}};return a}const Wy=["read","resolveKeyframes","update","preRender","render","postRender"],Fee=40;function CL(n,e){let t=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=Wy.reduce((f,d)=>(f[d]=_ee(()=>t=!0),f),{}),o=f=>{i[f].process(s)},a=()=>{const f=performance.now();t=!1,s.delta=r?1e3/60:Math.max(Math.min(f-s.timestamp,Fee),1),s.timestamp=f,s.isProcessing=!0,Wy.forEach(o),s.isProcessing=!1,t&&e&&(r=!1,n(a))},l=()=>{t=!0,r=!0,s.isProcessing||n(a)};return{schedule:Wy.reduce((f,d)=>{const h=i[d];return f[d]=(p,m=!1,y=!1)=>(t||l(),h.schedule(p,m,y)),f},{}),cancel:f=>Wy.forEach(d=>i[d].cancel(f)),state:s,steps:i}}const{schedule:bx,cancel:Qie}=CL(queueMicrotask,!1);function Cu(n){return n&&typeof n=="object"&&Object.prototype.hasOwnProperty.call(n,"current")}const kL=P.createContext({});let SL=!1;function jee(n,e,t,r,s){const{visualElement:i}=P.useContext($y),o=P.useContext(vL),a=P.useContext(Gy),l=P.useContext(px).reducedMotion,c=P.useRef();r=r||o.renderer,!c.current&&r&&(c.current=r(n,{visualState:e,parent:i,props:t,presenceContext:a,blockInitialAnimation:a?a.initial===!1:!1,reducedMotionConfig:l}));const u=c.current,f=P.useContext(kL);u&&!u.projection&&s&&(u.type==="html"||u.type==="svg")&&Vee(c.current,t,s,f),P.useInsertionEffect(()=>{u&&u.update(t,a)});const d=P.useRef(!!(t[xL]&&!window.HandoffComplete));return gx(()=>{u&&(u.updateFeatures(),bx.render(u.render),d.current&&u.animationState&&u.animationState.animateChanges())}),P.useEffect(()=>{u&&(!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,SL||(SL=!0,queueMicrotask(Uee))))}),u}function Uee(){window.HandoffComplete=!0}function Vee(n,e,t,r){const{layoutId:s,layout:i,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:c}=e;n.projection=new t(n.latestValues,e["data-framer-portal-id"]?void 0:TL(n.parent)),n.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||a&&Cu(a),visualElement:n,scheduleRender:()=>n.scheduleRender(),animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:c})}function TL(n){if(n)return n.options.allowProjection!==!1?n.projection:TL(n.parent)}function Hee(n,e,t){return P.useCallback(r=>{r&&n.mount&&n.mount(r),e&&(r?e.mount(r):e.unmount()),t&&(typeof t=="function"?t(r):Cu(t)&&(t.current=r))},[e])}function Eh(n){return typeof n=="string"||Array.isArray(n)}function Ky(n){return n!==null&&typeof n=="object"&&typeof n.start=="function"}const wx=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Ax=["initial",...wx];function Qy(n){return Ky(n.animate)||Ax.some(e=>Eh(n[e]))}function OL(n){return!!(Qy(n)||n.variants)}function zee(n,e){if(Qy(n)){const{initial:t,animate:r}=n;return{initial:t===!1||Eh(t)?t:void 0,animate:Eh(r)?r:void 0}}return n.inherit!==!1?e:{}}function $ee(n){const{initial:e,animate:t}=zee(n,P.useContext($y));return P.useMemo(()=>({initial:e,animate:t}),[NL(e),NL(t)])}function NL(n){return Array.isArray(n)?n.join(" "):n}const ML={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},ku={};for(const n in ML)ku[n]={isEnabled:e=>ML[n].some(t=>!!e[t])};function Gee(n){for(const e in n)ku[e]={...ku[e],...n[e]}}const vx=P.createContext({}),Wee=Symbol.for("motionComponentSymbol"),xn=n=>n;let Su=xn,ji=xn;process.env.NODE_ENV!=="production"&&(Su=(n,e)=>{!n&&typeof console<"u"&&console.warn(e)},ji=(n,e)=>{if(!n)throw new Error(e)});function Kee({preloadedFeatures:n,createVisualElement:e,useRender:t,useVisualState:r,Component:s}){n&&Gee(n);function i(a,l){let c;const u={...P.useContext(px),...a,layoutId:Qee(a)},{isStatic:f}=u,d=$ee(a),h=r(a,f);if(!f&&mx){Jee(u,n);const p=qee(u);c=p.MeasureLayout,d.visualElement=jee(s,h,u,e,p.ProjectionNode)}return k.jsxs($y.Provider,{value:d,children:[c&&d.visualElement?k.jsx(c,{visualElement:d.visualElement,...u}):null,t(s,a,Hee(h,d.visualElement,l),h,f,d.visualElement)]})}const o=P.forwardRef(i);return o[Wee]=s,o}function Qee({layoutId:n}){const e=P.useContext(vx).id;return e&&n!==void 0?e+"-"+n:n}function Jee(n,e){const t=P.useContext(vL).strict;if(process.env.NODE_ENV!=="production"&&e&&t){const r="You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";n.ignoreStrict?Su(!1,r):ji(!1,r)}}function qee(n){const{drag:e,layout:t}=ku;if(!e&&!t)return{};const r={...e,...t};return{MeasureLayout:e!=null&&e.isEnabled(n)||t!=null&&t.isEnabled(n)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function Yee(n){function e(r,s={}){return Kee(n(r,s))}if(typeof Proxy>"u")return e;const t=new Map;return new Proxy(e,{get:(r,s)=>(t.has(s)||t.set(s,e(s)),t.get(s))})}const Xee=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function xx(n){return typeof n!="string"||n.includes("-")?!1:!!(Xee.indexOf(n)>-1||/[A-Z]/u.test(n))}const Jy={};function Zee(n){Object.assign(Jy,n)}const Ch=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Al=new Set(Ch);function RL(n,{layout:e,layoutId:t}){return Al.has(n)||n.startsWith("origin")||(e||t!==void 0)&&(!!Jy[n]||n==="opacity")}const Mn=n=>!!(n&&n.getVelocity),ete={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},tte=Ch.length;function nte(n,{enableHardwareAcceleration:e=!0,allowTransformNone:t=!0},r,s){let i="";for(let o=0;o<tte;o++){const a=Ch[o];if(n[a]!==void 0){const l=ete[a]||a;i+=`${l}(${n[a]}) `}}return e&&!n.z&&(i+="translateZ(0)"),i=i.trim(),s?i=s(n,r?"":i):t&&r&&(i="none"),i}const PL=n=>e=>typeof e=="string"&&e.startsWith(n),DL=PL("--"),rte=PL("var(--"),Ex=n=>rte(n)?ste.test(n.split("/*")[0].trim()):!1,ste=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,ite=(n,e)=>e&&typeof n=="number"?e.transform(n):n,Wo=(n,e,t)=>t>e?e:t<n?n:t,Tu={test:n=>typeof n=="number",parse:parseFloat,transform:n=>n},kh={...Tu,transform:n=>Wo(0,1,n)},qy={...Tu,default:1},Sh=n=>Math.round(n*1e5)/1e5,Cx=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,ote=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,ate=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;function Th(n){return typeof n=="string"}const Oh=n=>({test:e=>Th(e)&&e.endsWith(n)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${n}`}),Ko=Oh("deg"),ti=Oh("%"),Le=Oh("px"),lte=Oh("vh"),cte=Oh("vw"),IL={...ti,parse:n=>ti.parse(n)/100,transform:n=>ti.transform(n*100)},LL={...Tu,transform:Math.round},BL={borderWidth:Le,borderTopWidth:Le,borderRightWidth:Le,borderBottomWidth:Le,borderLeftWidth:Le,borderRadius:Le,radius:Le,borderTopLeftRadius:Le,borderTopRightRadius:Le,borderBottomRightRadius:Le,borderBottomLeftRadius:Le,width:Le,maxWidth:Le,height:Le,maxHeight:Le,size:Le,top:Le,right:Le,bottom:Le,left:Le,padding:Le,paddingTop:Le,paddingRight:Le,paddingBottom:Le,paddingLeft:Le,margin:Le,marginTop:Le,marginRight:Le,marginBottom:Le,marginLeft:Le,rotate:Ko,rotateX:Ko,rotateY:Ko,rotateZ:Ko,scale:qy,scaleX:qy,scaleY:qy,scaleZ:qy,skew:Ko,skewX:Ko,skewY:Ko,distance:Le,translateX:Le,translateY:Le,translateZ:Le,x:Le,y:Le,z:Le,perspective:Le,transformPerspective:Le,opacity:kh,originX:IL,originY:IL,originZ:Le,zIndex:LL,backgroundPositionX:Le,backgroundPositionY:Le,fillOpacity:kh,strokeOpacity:kh,numOctaves:LL};function kx(n,e,t,r){const{style:s,vars:i,transform:o,transformOrigin:a}=n;let l=!1,c=!1,u=!0;for(const f in e){const d=e[f];if(DL(f)){i[f]=d;continue}const h=BL[f],p=ite(d,h);if(Al.has(f)){if(l=!0,o[f]=p,!u)continue;d!==(h.default||0)&&(u=!1)}else f.startsWith("origin")?(c=!0,a[f]=p):s[f]=p}if(e.transform||(l||r?s.transform=nte(n.transform,t,u,r):s.transform&&(s.transform="none")),c){const{originX:f="50%",originY:d="50%",originZ:h=0}=a;s.transformOrigin=`${f} ${d} ${h}`}}const Sx=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function _L(n,e,t){for(const r in e)!Mn(e[r])&&!RL(r,t)&&(n[r]=e[r])}function ute({transformTemplate:n},e,t){return P.useMemo(()=>{const r=Sx();return kx(r,e,{enableHardwareAcceleration:!t},n),Object.assign({},r.vars,r.style)},[e])}function fte(n,e,t){const r=n.style||{},s={};return _L(s,r,n),Object.assign(s,ute(n,e,t)),s}function dte(n,e,t){const r={},s=fte(n,e,t);return n.drag&&n.dragListener!==!1&&(r.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.touchAction=n.drag===!0?"none":`pan-${n.drag==="x"?"y":"x"}`),n.tabIndex===void 0&&(n.onTap||n.onTapStart||n.whileTap)&&(r.tabIndex=0),r.style=s,r}const hte=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function Yy(n){return n.startsWith("while")||n.startsWith("drag")&&n!=="draggable"||n.startsWith("layout")||n.startsWith("onTap")||n.startsWith("onPan")||n.startsWith("onLayout")||hte.has(n)}let FL=n=>!Yy(n);function pte(n){n&&(FL=e=>e.startsWith("on")?!Yy(e):n(e))}try{pte(require("@emotion/is-prop-valid").default)}catch{}function mte(n,e,t){const r={};for(const s in n)s==="values"&&typeof n.values=="object"||(FL(s)||t===!0&&Yy(s)||!e&&!Yy(s)||n.draggable&&s.startsWith("onDrag"))&&(r[s]=n[s]);return r}function jL(n,e,t){return typeof n=="string"?n:Le.transform(e+t*n)}function gte(n,e,t){const r=jL(e,n.x,n.width),s=jL(t,n.y,n.height);return`${r} ${s}`}const yte={offset:"stroke-dashoffset",array:"stroke-dasharray"},bte={offset:"strokeDashoffset",array:"strokeDasharray"};function wte(n,e,t=1,r=0,s=!0){n.pathLength=1;const i=s?yte:bte;n[i.offset]=Le.transform(-r);const o=Le.transform(e),a=Le.transform(t);n[i.array]=`${o} ${a}`}function Tx(n,{attrX:e,attrY:t,attrScale:r,originX:s,originY:i,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...c},u,f,d){if(kx(n,c,u,d),f){n.style.viewBox&&(n.attrs.viewBox=n.style.viewBox);return}n.attrs=n.style,n.style={};const{attrs:h,style:p,dimensions:m}=n;h.transform&&(m&&(p.transform=h.transform),delete h.transform),m&&(s!==void 0||i!==void 0||p.transform)&&(p.transformOrigin=gte(m,s!==void 0?s:.5,i!==void 0?i:.5)),e!==void 0&&(h.x=e),t!==void 0&&(h.y=t),r!==void 0&&(h.scale=r),o!==void 0&&wte(h,o,a,l,!1)}const UL=()=>({...Sx(),attrs:{}}),Ox=n=>typeof n=="string"&&n.toLowerCase()==="svg";function Ate(n,e,t,r){const s=P.useMemo(()=>{const i=UL();return Tx(i,e,{enableHardwareAcceleration:!1},Ox(r),n.transformTemplate),{...i.attrs,style:{...i.style}}},[e]);if(n.style){const i={};_L(i,n.style,n),s.style={...i,...s.style}}return s}function vte(n=!1){return(t,r,s,{latestValues:i},o)=>{const l=(xx(t)?Ate:dte)(r,i,o,t),c=mte(r,typeof t=="string",n),u=t!==P.Fragment?{...c,...l,ref:s}:{},{children:f}=r,d=P.useMemo(()=>Mn(f)?f.get():f,[f]);return P.createElement(t,{...u,children:d})}}function VL(n,{style:e,vars:t},r,s){Object.assign(n.style,e,s&&s.getProjectionStyles(r));for(const i in t)n.style.setProperty(i,t[i])}const HL=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function zL(n,e,t,r){VL(n,e,void 0,r);for(const s in e.attrs)n.setAttribute(HL.has(s)?s:yx(s),e.attrs[s])}function Nx(n,e,t){var r;const{style:s}=n,i={};for(const o in s)(Mn(s[o])||e.style&&Mn(e.style[o])||RL(o,n)||((r=t==null?void 0:t.getValue(o))===null||r===void 0?void 0:r.liveStyle)!==void 0)&&(i[o]=s[o]);return i}function $L(n,e,t){const r=Nx(n,e,t);for(const s in n)if(Mn(n[s])||Mn(e[s])){const i=Ch.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=n[s]}return r}function GL(n){const e=[{},{}];return n==null||n.values.forEach((t,r)=>{e[0][r]=t.get(),e[1][r]=t.getVelocity()}),e}function Mx(n,e,t,r){if(typeof e=="function"){const[s,i]=GL(r);e=e(t!==void 0?t:n.custom,s,i)}if(typeof e=="string"&&(e=n.variants&&n.variants[e]),typeof e=="function"){const[s,i]=GL(r);e=e(t!==void 0?t:n.custom,s,i)}return e}function WL(n){const e=P.useRef(null);return e.current===null&&(e.current=n()),e.current}const Rx=n=>Array.isArray(n),xte=n=>!!(n&&typeof n=="object"&&n.mix&&n.toValue),Ete=n=>Rx(n)?n[n.length-1]||0:n;function Xy(n){const e=Mn(n)?n.get():n;return xte(e)?e.toValue():e}function Cte({scrapeMotionValuesFromProps:n,createRenderState:e,onMount:t},r,s,i){const o={latestValues:kte(r,s,i,n),renderState:e()};return t&&(o.mount=a=>t(r,a,o)),o}const KL=n=>(e,t)=>{const r=P.useContext($y),s=P.useContext(Gy),i=()=>Cte(n,e,r,s);return t?i():WL(i)};function kte(n,e,t,r){const s={},i=r(n,{});for(const d in i)s[d]=Xy(i[d]);let{initial:o,animate:a}=n;const l=Qy(n),c=OL(n);e&&c&&!l&&n.inherit!==!1&&(o===void 0&&(o=e.initial),a===void 0&&(a=e.animate));let u=t?t.initial===!1:!1;u=u||o===!1;const f=u?a:o;return f&&typeof f!="boolean"&&!Ky(f)&&(Array.isArray(f)?f:[f]).forEach(h=>{const p=Mx(n,h);if(!p)return;const{transitionEnd:m,transition:y,...b}=p;for(const v in b){let A=b[v];if(Array.isArray(A)){const w=u?A.length-1:0;A=A[w]}A!==null&&(s[v]=A)}for(const v in m)s[v]=m[v]}),s}const{schedule:dt,cancel:Ui,state:En,steps:Px}=CL(typeof requestAnimationFrame<"u"?requestAnimationFrame:xn,!0),Ste={useVisualState:KL({scrapeMotionValuesFromProps:$L,createRenderState:UL,onMount:(n,e,{renderState:t,latestValues:r})=>{dt.read(()=>{try{t.dimensions=typeof e.getBBox=="function"?e.getBBox():e.getBoundingClientRect()}catch{t.dimensions={x:0,y:0,width:0,height:0}}}),dt.render(()=>{Tx(t,r,{enableHardwareAcceleration:!1},Ox(e.tagName),n.transformTemplate),zL(e,t)})}})},Tte={useVisualState:KL({scrapeMotionValuesFromProps:Nx,createRenderState:Sx})};function Ote(n,{forwardMotionProps:e=!1},t,r){return{...xx(n)?Ste:Tte,preloadedFeatures:t,useRender:vte(e),createVisualElement:r,Component:n}}function Vi(n,e,t,r={passive:!0}){return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t)}const QL=n=>n.pointerType==="mouse"?typeof n.button!="number"||n.button<=0:n.isPrimary!==!1;function Zy(n,e="page"){return{point:{x:n[`${e}X`],y:n[`${e}Y`]}}}const Nte=n=>e=>QL(e)&&n(e,Zy(e));function Hi(n,e,t,r){return Vi(n,e,Nte(t),r)}const Mte=(n,e)=>t=>e(n(t)),zi=(...n)=>n.reduce(Mte);function JL(n){let e=null;return()=>{const t=()=>{e=null};return e===null?(e=n,t):!1}}const qL=JL("dragHorizontal"),YL=JL("dragVertical");function XL(n){let e=!1;if(n==="y")e=YL();else if(n==="x")e=qL();else{const t=qL(),r=YL();t&&r?e=()=>{t(),r()}:(t&&t(),r&&r())}return e}function ZL(){const n=XL(!0);return n?(n(),!1):!0}class Qo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function eB(n,e){const t=e?"pointerenter":"pointerleave",r=e?"onHoverStart":"onHoverEnd",s=(i,o)=>{if(i.pointerType==="touch"||ZL())return;const a=n.getProps();n.animationState&&a.whileHover&&n.animationState.setActive("whileHover",e);const l=a[r];l&&dt.postRender(()=>l(i,o))};return Hi(n.current,t,s,{passive:!n.getProps()[r]})}class Rte extends Qo{mount(){this.unmount=zi(eB(this.node,!0),eB(this.node,!1))}unmount(){}}class Pte extends Qo{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=zi(Vi(this.node.current,"focus",()=>this.onFocus()),Vi(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}const tB=(n,e)=>e?n===e?!0:tB(n,e.parentElement):!1;function Dx(n,e){if(!e)return;const t=new PointerEvent("pointer"+n);e(t,Zy(t))}class Dte extends Qo{constructor(){super(...arguments),this.removeStartListeners=xn,this.removeEndListeners=xn,this.removeAccessibleListeners=xn,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();const r=this.node.getProps(),i=Hi(window,"pointerup",(a,l)=>{if(!this.checkPressEnd())return;const{onTap:c,onTapCancel:u,globalTapTarget:f}=this.node.getProps(),d=!f&&!tB(this.node.current,a.target)?u:c;d&&dt.update(()=>d(a,l))},{passive:!(r.onTap||r.onPointerUp)}),o=Hi(window,"pointercancel",(a,l)=>this.cancelPress(a,l),{passive:!(r.onTapCancel||r.onPointerCancel)});this.removeEndListeners=zi(i,o),this.startPress(e,t)},this.startAccessiblePress=()=>{const e=i=>{if(i.key!=="Enter"||this.isPressing)return;const o=a=>{a.key!=="Enter"||!this.checkPressEnd()||Dx("up",(l,c)=>{const{onTap:u}=this.node.getProps();u&&dt.postRender(()=>u(l,c))})};this.removeEndListeners(),this.removeEndListeners=Vi(this.node.current,"keyup",o),Dx("down",(a,l)=>{this.startPress(a,l)})},t=Vi(this.node.current,"keydown",e),r=()=>{this.isPressing&&Dx("cancel",(i,o)=>this.cancelPress(i,o))},s=Vi(this.node.current,"blur",r);this.removeAccessibleListeners=zi(t,s)}}startPress(e,t){this.isPressing=!0;const{onTapStart:r,whileTap:s}=this.node.getProps();s&&this.node.animationState&&this.node.animationState.setActive("whileTap",!0),r&&dt.postRender(()=>r(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive("whileTap",!1),!ZL()}cancelPress(e,t){if(!this.checkPressEnd())return;const{onTapCancel:r}=this.node.getProps();r&&dt.postRender(()=>r(e,t))}mount(){const e=this.node.getProps(),t=Hi(e.globalTapTarget?window:this.node.current,"pointerdown",this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),r=Vi(this.node.current,"focus",this.startAccessiblePress);this.removeStartListeners=zi(t,r)}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}}const Ix=new WeakMap,Lx=new WeakMap,Ite=n=>{const e=Ix.get(n.target);e&&e(n)},Lte=n=>{n.forEach(Ite)};function Bte({root:n,...e}){const t=n||document;Lx.has(t)||Lx.set(t,{});const r=Lx.get(t),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Lte,{root:n,...e})),r[s]}function _te(n,e,t){const r=Bte(e);return Ix.set(n,t),r.observe(n),()=>{Ix.delete(n),r.unobserve(n)}}const Fte={some:0,all:1};class jte extends Qo{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:t,margin:r,amount:s="some",once:i}=e,o={root:t?t.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:Fte[s]},a=l=>{const{isIntersecting:c}=l;if(this.isInView===c||(this.isInView=c,i&&!c&&this.hasEnteredView))return;c&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",c);const{onViewportEnter:u,onViewportLeave:f}=this.node.getProps(),d=c?u:f;d&&d(l)};return _te(this.node.current,o,a)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:t}=this.node;["amount","margin","root"].some(Ute(e,t))&&this.startObserver()}unmount(){}}function Ute({viewport:n={}},{viewport:e={}}={}){return t=>n[t]!==e[t]}const Vte={inView:{Feature:jte},tap:{Feature:Dte},focus:{Feature:Pte},hover:{Feature:Rte}};function nB(n,e){if(!Array.isArray(e))return!1;const t=e.length;if(t!==n.length)return!1;for(let r=0;r<t;r++)if(e[r]!==n[r])return!1;return!0}function e0(n,e,t){const r=n.getProps();return Mx(r,e,t!==void 0?t:r.custom,n)}const $i=n=>n*1e3,Gi=n=>n/1e3,Hte={type:"spring",stiffness:500,damping:25,restSpeed:10},zte=n=>({type:"spring",stiffness:550,damping:n===0?2*Math.sqrt(550):30,restSpeed:10}),$te={type:"keyframes",duration:.8},Gte={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Wte=(n,{keyframes:e})=>e.length>2?$te:Al.has(n)?n.startsWith("scale")?zte(e[1]):Hte:Gte;function Kte({when:n,delay:e,delayChildren:t,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:a,from:l,elapsed:c,...u}){return!!Object.keys(u).length}function Bx(n,e){return n[e]||n.default||n}const Qte=n=>n!==null;function t0(n,{repeat:e,repeatType:t="loop"},r){const s=n.filter(Qte),i=e&&t!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}let n0;function Jte(){n0=void 0}const Jo={now:()=>(n0===void 0&&Jo.set(En.isProcessing||Bee.useManualTiming?En.timestamp:performance.now()),n0),set:n=>{n0=n,queueMicrotask(Jte)}},rB=n=>/^0[^.\s]+$/u.test(n);function qte(n){return typeof n=="number"?n===0:n!==null?n==="none"||n==="0"||rB(n):!0}const sB=n=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(n),Yte=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Xte(n){const e=Yte.exec(n);if(!e)return[,];const[,t,r,s]=e;return[`--${t??r}`,s]}const Zte=4;function iB(n,e,t=1){ji(t<=Zte,`Max CSS variable fallback depth detected in property "${n}". This may indicate a circular fallback dependency.`);const[r,s]=Xte(n);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return sB(o)?parseFloat(o):o}return Ex(s)?iB(s,e,t+1):s}const ene=new Set(["width","height","top","left","right","bottom","x","y","translateX","translateY"]),oB=n=>n===Tu||n===Le,aB=(n,e)=>parseFloat(n.split(", ")[e]),lB=(n,e)=>(t,{transform:r})=>{if(r==="none"||!r)return 0;const s=r.match(/^matrix3d\((.+)\)$/u);if(s)return aB(s[1],e);{const i=r.match(/^matrix\((.+)\)$/u);return i?aB(i[1],n):0}},tne=new Set(["x","y","z"]),nne=Ch.filter(n=>!tne.has(n));function rne(n){const e=[];return nne.forEach(t=>{const r=n.getValue(t);r!==void 0&&(e.push([t,r.get()]),r.set(t.startsWith("scale")?1:0))}),e}const Ou={width:({x:n},{paddingLeft:e="0",paddingRight:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),height:({y:n},{paddingTop:e="0",paddingBottom:t="0"})=>n.max-n.min-parseFloat(e)-parseFloat(t),top:(n,{top:e})=>parseFloat(e),left:(n,{left:e})=>parseFloat(e),bottom:({y:n},{top:e})=>parseFloat(e)+(n.max-n.min),right:({x:n},{left:e})=>parseFloat(e)+(n.max-n.min),x:lB(4,13),y:lB(5,14)};Ou.translateX=Ou.x,Ou.translateY=Ou.y;const cB=n=>e=>e.test(n),uB=[Tu,Le,ti,Ko,cte,lte,{test:n=>n==="auto",parse:n=>n}],fB=n=>uB.find(cB(n)),vl=new Set;let _x=!1,Fx=!1;function dB(){if(Fx){const n=Array.from(vl).filter(r=>r.needsMeasurement),e=new Set(n.map(r=>r.element)),t=new Map;e.forEach(r=>{const s=rne(r);s.length&&(t.set(r,s),r.render())}),n.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=t.get(r);s&&s.forEach(([i,o])=>{var a;(a=r.getValue(i))===null||a===void 0||a.set(o)})}),n.forEach(r=>r.measureEndState()),n.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fx=!1,_x=!1,vl.forEach(n=>n.complete()),vl.clear()}function hB(){vl.forEach(n=>{n.readKeyframes(),n.needsMeasurement&&(Fx=!0)})}function sne(){hB(),dB()}class jx{constructor(e,t,r,s,i,o=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.isScheduled=!0,this.isAsync?(vl.add(this),_x||(_x=!0,dt.read(hB),dt.resolveKeyframes(dB))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:t,element:r,motionValue:s}=this;for(let i=0;i<e.length;i++)if(e[i]===null)if(i===0){const o=s==null?void 0:s.get(),a=e[e.length-1];if(o!==void 0)e[0]=o;else if(r&&t){const l=r.readValue(t,a);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=a),s&&o===void 0&&s.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),vl.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,vl.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}const Ux=(n,e)=>t=>!!(Th(t)&&ate.test(t)&&t.startsWith(n)||e&&Object.prototype.hasOwnProperty.call(t,e)),pB=(n,e,t)=>r=>{if(!Th(r))return r;const[s,i,o,a]=r.match(Cx);return{[n]:parseFloat(s),[e]:parseFloat(i),[t]:parseFloat(o),alpha:a!==void 0?parseFloat(a):1}},ine=n=>Wo(0,255,n),Vx={...Tu,transform:n=>Math.round(ine(n))},xl={test:Ux("rgb","red"),parse:pB("red","green","blue"),transform:({red:n,green:e,blue:t,alpha:r=1})=>"rgba("+Vx.transform(n)+", "+Vx.transform(e)+", "+Vx.transform(t)+", "+Sh(kh.transform(r))+")"};function one(n){let e="",t="",r="",s="";return n.length>5?(e=n.substring(1,3),t=n.substring(3,5),r=n.substring(5,7),s=n.substring(7,9)):(e=n.substring(1,2),t=n.substring(2,3),r=n.substring(3,4),s=n.substring(4,5),e+=e,t+=t,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(t,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Hx={test:Ux("#"),parse:one,transform:xl.transform},Nu={test:Ux("hsl","hue"),parse:pB("hue","saturation","lightness"),transform:({hue:n,saturation:e,lightness:t,alpha:r=1})=>"hsla("+Math.round(n)+", "+ti.transform(Sh(e))+", "+ti.transform(Sh(t))+", "+Sh(kh.transform(r))+")"},Rn={test:n=>xl.test(n)||Hx.test(n)||Nu.test(n),parse:n=>xl.test(n)?xl.parse(n):Nu.test(n)?Nu.parse(n):Hx.parse(n),transform:n=>Th(n)?n:n.hasOwnProperty("red")?xl.transform(n):Nu.transform(n)};function ane(n){var e,t;return isNaN(n)&&Th(n)&&(((e=n.match(Cx))===null||e===void 0?void 0:e.length)||0)+(((t=n.match(ote))===null||t===void 0?void 0:t.length)||0)>0}const mB="number",gB="color",lne="var",cne="var(",yB="${}",une=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Nh(n){const e=n.toString(),t=[],r={color:[],number:[],var:[]},s=[];let i=0;const a=e.replace(une,l=>(Rn.test(l)?(r.color.push(i),s.push(gB),t.push(Rn.parse(l))):l.startsWith(cne)?(r.var.push(i),s.push(lne),t.push(l)):(r.number.push(i),s.push(mB),t.push(parseFloat(l))),++i,yB)).split(yB);return{values:t,split:a,indexes:r,types:s}}function bB(n){return Nh(n).values}function wB(n){const{split:e,types:t}=Nh(n),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const a=t[o];a===mB?i+=Sh(s[o]):a===gB?i+=Rn.transform(s[o]):i+=s[o]}return i}}const fne=n=>typeof n=="number"?0:n;function dne(n){const e=bB(n);return wB(n)(e.map(fne))}const qo={test:ane,parse:bB,createTransformer:wB,getAnimatableNone:dne},hne=new Set(["brightness","contrast","saturate","opacity"]);function pne(n){const[e,t]=n.slice(0,-1).split("(");if(e==="drop-shadow")return n;const[r]=t.match(Cx)||[];if(!r)return n;const s=t.replace(r,"");let i=hne.has(e)?1:0;return r!==t&&(i*=100),e+"("+i+s+")"}const mne=/\b([a-z-]*)\(.*?\)/gu,zx={...qo,getAnimatableNone:n=>{const e=n.match(mne);return e?e.map(pne).join(" "):n}},gne={...BL,color:Rn,backgroundColor:Rn,outlineColor:Rn,fill:Rn,stroke:Rn,borderColor:Rn,borderTopColor:Rn,borderRightColor:Rn,borderBottomColor:Rn,borderLeftColor:Rn,filter:zx,WebkitFilter:zx},$x=n=>gne[n];function AB(n,e){let t=$x(n);return t!==zx&&(t=qo),t.getAnimatableNone?t.getAnimatableNone(e):void 0}const yne=new Set(["auto","none","0"]);function bne(n,e,t){let r=0,s;for(;r<n.length&&!s;){const i=n[r];typeof i=="string"&&!yne.has(i)&&Nh(i).values.length&&(s=n[r]),r++}if(s&&t)for(const i of e)n[i]=AB(t,s)}class vB extends jx{constructor(e,t,r,s){super(e,t,r,s,s==null?void 0:s.owner,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:t,name:r}=this;if(!t.current)return;super.readKeyframes();for(let l=0;l<e.length;l++){let c=e[l];if(typeof c=="string"&&(c=c.trim(),Ex(c))){const u=iB(c,t.current);u!==void 0&&(e[l]=u),l===e.length-1&&(this.finalKeyframe=c)}}if(this.resolveNoneKeyframes(),!ene.has(r)||e.length!==2)return;const[s,i]=e,o=fB(s),a=fB(i);if(o!==a)if(oB(o)&&oB(a))for(let l=0;l<e.length;l++){const c=e[l];typeof c=="string"&&(e[l]=parseFloat(c))}else this.needsMeasurement=!0}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:t}=this,r=[];for(let s=0;s<e.length;s++)qte(e[s])&&r.push(s);r.length&&bne(e,r,t)}measureInitialState(){const{element:e,unresolvedKeyframes:t,name:r}=this;if(!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ou[r](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;const s=t[t.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var e;const{element:t,name:r,unresolvedKeyframes:s}=this;if(!t.current)return;const i=t.getValue(r);i&&i.jump(this.measuredOrigin,!1);const o=s.length-1,a=s[o];s[o]=Ou[r](t.measureViewportBox(),window.getComputedStyle(t.current)),a!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=a),!((e=this.removedTransforms)===null||e===void 0)&&e.length&&this.removedTransforms.forEach(([l,c])=>{t.getValue(l).set(c)}),this.resolveNoneKeyframes()}}function xB(n){let e;return()=>(e===void 0&&(e=n()),e)}const EB=(n,e)=>e==="zIndex"?!1:!!(typeof n=="number"||Array.isArray(n)||typeof n=="string"&&(qo.test(n)||n==="0")&&!n.startsWith("url("));function wne(n){const e=n[0];if(n.length===1)return!0;for(let t=0;t<n.length;t++)if(n[t]!==e)return!0}function Ane(n,e,t,r){const s=n[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=n[n.length-1],o=EB(s,e),a=EB(i,e);return Su(o===a,`You are trying to animate ${e} from "${s}" to "${i}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${i} via the \`style\` property.`),!o||!a?!1:wne(n)||t==="spring"&&r}class CB{constructor({autoplay:e=!0,delay:t=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",...a}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.options={autoplay:e,delay:t,type:r,repeat:s,repeatDelay:i,repeatType:o,...a},this.updateFinishedPromise()}get resolved(){return!this._resolved&&!this.hasAttemptedResolve&&sne(),this._resolved}onKeyframesResolved(e,t){this.hasAttemptedResolve=!0;const{name:r,type:s,velocity:i,delay:o,onComplete:a,onUpdate:l,isGenerator:c}=this.options;if(!c&&!Ane(e,r,s,i))if(o)this.options.duration=0;else{l==null||l(t0(e,this.options,t)),a==null||a(),this.resolveFinishedPromise();return}const u=this.initPlayback(e,t);u!==!1&&(this._resolved={keyframes:e,finalKeyframe:t,...u},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}function kB(n,e){return e?n*(1e3/e):0}const vne=5;function SB(n,e,t){const r=Math.max(e-vne,0);return kB(t-n(r),e-r)}const Gx=.001,xne=.01,TB=10,Ene=.05,Cne=1;function kne({duration:n=800,bounce:e=.25,velocity:t=0,mass:r=1}){let s,i;Su(n<=$i(TB),"Spring duration must be 10 seconds or less");let o=1-e;o=Wo(Ene,Cne,o),n=Wo(xne,TB,Gi(n)),o<1?(s=c=>{const u=c*o,f=u*n,d=u-t,h=Wx(c,o),p=Math.exp(-f);return Gx-d/h*p},i=c=>{const f=c*o*n,d=f*t+t,h=Math.pow(o,2)*Math.pow(c,2)*n,p=Math.exp(-f),m=Wx(Math.pow(c,2),o);return(-s(c)+Gx>0?-1:1)*((d-h)*p)/m}):(s=c=>{const u=Math.exp(-c*n),f=(c-t)*n+1;return-Gx+u*f},i=c=>{const u=Math.exp(-c*n),f=(t-c)*(n*n);return u*f});const a=5/n,l=Tne(s,i,a);if(n=$i(n),isNaN(l))return{stiffness:100,damping:10,duration:n};{const c=Math.pow(l,2)*r;return{stiffness:c,damping:o*2*Math.sqrt(r*c),duration:n}}}const Sne=12;function Tne(n,e,t){let r=t;for(let s=1;s<Sne;s++)r=r-n(r)/e(r);return r}function Wx(n,e){return n*Math.sqrt(1-e*e)}const One=["duration","bounce"],Nne=["stiffness","damping","mass"];function OB(n,e){return e.some(t=>n[t]!==void 0)}function Mne(n){let e={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...n};if(!OB(n,Nne)&&OB(n,One)){const t=kne(n);e={...e,...t,mass:1},e.isResolvedFromDuration=!0}return e}function NB({keyframes:n,restDelta:e,restSpeed:t,...r}){const s=n[0],i=n[n.length-1],o={done:!1,value:s},{stiffness:a,damping:l,mass:c,duration:u,velocity:f,isResolvedFromDuration:d}=Mne({...r,velocity:-Gi(r.velocity||0)}),h=f||0,p=l/(2*Math.sqrt(a*c)),m=i-s,y=Gi(Math.sqrt(a/c)),b=Math.abs(m)<5;t||(t=b?.01:2),e||(e=b?.005:.5);let v;if(p<1){const A=Wx(y,p);v=w=>{const x=Math.exp(-p*y*w);return i-x*((h+p*y*m)/A*Math.sin(A*w)+m*Math.cos(A*w))}}else if(p===1)v=A=>i-Math.exp(-y*A)*(m+(h+y*m)*A);else{const A=y*Math.sqrt(p*p-1);v=w=>{const x=Math.exp(-p*y*w),C=Math.min(A*w,300);return i-x*((h+p*y*m)*Math.sinh(C)+A*m*Math.cosh(C))/A}}return{calculatedDuration:d&&u||null,next:A=>{const w=v(A);if(d)o.done=A>=u;else{let x=h;A!==0&&(p<1?x=SB(v,A,w):x=0);const C=Math.abs(x)<=t,S=Math.abs(i-w)<=e;o.done=C&&S}return o.value=o.done?i:w,o}}}function MB({keyframes:n,velocity:e=0,power:t=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:a,max:l,restDelta:c=.5,restSpeed:u}){const f=n[0],d={done:!1,value:f},h=M=>a!==void 0&&M<a||l!==void 0&&M>l,p=M=>a===void 0?l:l===void 0||Math.abs(a-M)<Math.abs(l-M)?a:l;let m=t*e;const y=f+m,b=o===void 0?y:o(y);b!==y&&(m=b-f);const v=M=>-m*Math.exp(-M/r),A=M=>b+v(M),w=M=>{const O=v(M),R=A(M);d.done=Math.abs(O)<=c,d.value=d.done?b:R};let x,C;const S=M=>{h(d.value)&&(x=M,C=NB({keyframes:[d.value,p(d.value)],velocity:SB(A,M,d.value),damping:s,stiffness:i,restDelta:c,restSpeed:u}))};return S(0),{calculatedDuration:null,next:M=>{let O=!1;return!C&&x===void 0&&(O=!0,w(M),S(M)),x!==void 0&&M>=x?C.next(M-x):(!O&&w(M),d)}}}const RB=(n,e,t)=>(((1-3*t+3*e)*n+(3*t-6*e))*n+3*e)*n,Rne=1e-7,Pne=12;function Dne(n,e,t,r,s){let i,o,a=0;do o=e+(t-e)/2,i=RB(o,r,s)-n,i>0?t=o:e=o;while(Math.abs(i)>Rne&&++a<Pne);return o}function Mh(n,e,t,r){if(n===e&&t===r)return xn;const s=i=>Dne(i,0,1,n,t);return i=>i===0||i===1?i:RB(s(i),e,r)}const Ine=Mh(.42,0,1,1),Lne=Mh(0,0,.58,1),PB=Mh(.42,0,.58,1),Bne=n=>Array.isArray(n)&&typeof n[0]!="number",DB=n=>e=>e<=.5?n(2*e)/2:(2-n(2*(1-e)))/2,IB=n=>e=>1-n(1-e),Kx=n=>1-Math.sin(Math.acos(n)),LB=IB(Kx),_ne=DB(Kx),BB=Mh(.33,1.53,.69,.99),Qx=IB(BB),Fne=DB(Qx),_B={linear:xn,easeIn:Ine,easeInOut:PB,easeOut:Lne,circIn:Kx,circInOut:_ne,circOut:LB,backIn:Qx,backInOut:Fne,backOut:BB,anticipate:n=>(n*=2)<1?.5*Qx(n):.5*(2-Math.pow(2,-10*(n-1)))},FB=n=>{if(Array.isArray(n)){ji(n.length===4,"Cubic bezier arrays must contain four numerical values.");const[e,t,r,s]=n;return Mh(e,t,r,s)}else if(typeof n=="string")return ji(_B[n]!==void 0,`Invalid easing type '${n}'`),_B[n];return n},Rh=(n,e,t)=>{const r=e-n;return r===0?1:(t-n)/r},Bt=(n,e,t)=>n+(e-n)*t;function Jx(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function jne({hue:n,saturation:e,lightness:t,alpha:r}){n/=360,e/=100,t/=100;let s=0,i=0,o=0;if(!e)s=i=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;s=Jx(l,a,n+1/3),i=Jx(l,a,n),o=Jx(l,a,n-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function r0(n,e){return t=>t>0?e:n}const qx=(n,e,t)=>{const r=n*n,s=t*(e*e-r)+r;return s<0?0:Math.sqrt(s)},Une=[Hx,xl,Nu],Vne=n=>Une.find(e=>e.test(n));function jB(n){const e=Vne(n);if(Su(!!e,`'${n}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let t=e.parse(n);return e===Nu&&(t=jne(t)),t}const UB=(n,e)=>{const t=jB(n),r=jB(e);if(!t||!r)return r0(n,e);const s={...t};return i=>(s.red=qx(t.red,r.red,i),s.green=qx(t.green,r.green,i),s.blue=qx(t.blue,r.blue,i),s.alpha=Bt(t.alpha,r.alpha,i),xl.transform(s))},Yx=new Set(["none","hidden"]);function Hne(n,e){return Yx.has(n)?t=>t<=0?n:e:t=>t>=1?e:n}function zne(n,e){return t=>Bt(n,e,t)}function Xx(n){return typeof n=="number"?zne:typeof n=="string"?Ex(n)?r0:Rn.test(n)?UB:Wne:Array.isArray(n)?VB:typeof n=="object"?Rn.test(n)?UB:$ne:r0}function VB(n,e){const t=[...n],r=t.length,s=n.map((i,o)=>Xx(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)t[o]=s[o](i);return t}}function $ne(n,e){const t={...n,...e},r={};for(const s in t)n[s]!==void 0&&e[s]!==void 0&&(r[s]=Xx(n[s])(n[s],e[s]));return s=>{for(const i in r)t[i]=r[i](s);return t}}function Gne(n,e){var t;const r=[],s={color:0,var:0,number:0};for(let i=0;i<e.values.length;i++){const o=e.types[i],a=n.indexes[o][s[o]],l=(t=n.values[a])!==null&&t!==void 0?t:0;r[i]=l,s[o]++}return r}const Wne=(n,e)=>{const t=qo.createTransformer(e),r=Nh(n),s=Nh(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Yx.has(n)&&!s.values.length||Yx.has(e)&&!r.values.length?Hne(n,e):zi(VB(Gne(r,s),s.values),t):(Su(!0,`Complex values '${n}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),r0(n,e))};function HB(n,e,t){return typeof n=="number"&&typeof e=="number"&&typeof t=="number"?Bt(n,e,t):Xx(n)(n,e)}function Kne(n,e,t){const r=[],s=t||HB,i=n.length-1;for(let o=0;o<i;o++){let a=s(n[o],n[o+1]);if(e){const l=Array.isArray(e)?e[o]||xn:e;a=zi(l,a)}r.push(a)}return r}function Qne(n,e,{clamp:t=!0,ease:r,mixer:s}={}){const i=n.length;if(ji(i===e.length,"Both input and output ranges must be the same length"),i===1)return()=>e[0];if(i===2&&n[0]===n[1])return()=>e[1];n[0]>n[i-1]&&(n=[...n].reverse(),e=[...e].reverse());const o=Kne(e,r,s),a=o.length,l=c=>{let u=0;if(a>1)for(;u<n.length-2&&!(c<n[u+1]);u++);const f=Rh(n[u],n[u+1],c);return o[u](f)};return t?c=>l(Wo(n[0],n[i-1],c)):l}function Jne(n,e){const t=n[n.length-1];for(let r=1;r<=e;r++){const s=Rh(0,e,r);n.push(Bt(t,1,s))}}function qne(n){const e=[0];return Jne(e,n.length-1),e}function Yne(n,e){return n.map(t=>t*e)}function Xne(n,e){return n.map(()=>e||PB).splice(0,n.length-1)}function s0({duration:n=300,keyframes:e,times:t,ease:r="easeInOut"}){const s=Bne(r)?r.map(FB):FB(r),i={done:!1,value:e[0]},o=Yne(t&&t.length===e.length?t:qne(e),n),a=Qne(o,e,{ease:Array.isArray(s)?s:Xne(e,s)});return{calculatedDuration:n,next:l=>(i.value=a(l),i.done=l>=n,i)}}const zB=2e4;function Zne(n){let e=0;const t=50;let r=n.next(e);for(;!r.done&&e<zB;)e+=t,r=n.next(e);return e>=zB?1/0:e}const ere=n=>{const e=({timestamp:t})=>n(t);return{start:()=>dt.update(e,!0),stop:()=>Ui(e),now:()=>En.isProcessing?En.timestamp:Jo.now()}},tre={decay:MB,inertia:MB,tween:s0,keyframes:s0,spring:NB},nre=n=>n/100;class Zx extends CB{constructor({KeyframeResolver:e=jx,...t}){super(t),this.holdTime=null,this.startTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;this.teardown();const{onStop:a}=this.options;a&&a()};const{name:r,motionValue:s,keyframes:i}=this.options,o=(a,l)=>this.onKeyframesResolved(a,l);r&&s&&s.owner?this.resolver=s.owner.resolveKeyframes(i,o,r,s):this.resolver=new e(i,o,r,s),this.resolver.scheduleResolve()}initPlayback(e){const{type:t="keyframes",repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=this.options,a=tre[t]||s0;let l,c;a!==s0&&typeof e[0]!="number"&&(process.env.NODE_ENV!=="production"&&ji(e.length===2,`Only two keyframes currently supported with spring and inertia animations. Trying to animate ${e}`),l=zi(nre,HB(e[0],e[1])),e=[0,100]);const u=a({...this.options,keyframes:e});i==="mirror"&&(c=a({...this.options,keyframes:[...e].reverse(),velocity:-o})),u.calculatedDuration===null&&(u.calculatedDuration=Zne(u));const{calculatedDuration:f}=u,d=f+s,h=d*(r+1)-s;return{generator:u,mirroredGenerator:c,mapPercentToKeyframes:l,calculatedDuration:f,resolvedDuration:d,totalDuration:h}}onPostResolved(){const{autoplay:e=!0}=this.options;this.play(),this.pendingPlayState==="paused"||!e?this.pause():this.state=this.pendingPlayState}tick(e,t=!1){const{resolved:r}=this;if(!r){const{keyframes:M}=this.options;return{done:!0,value:M[M.length-1]}}const{finalKeyframe:s,generator:i,mirroredGenerator:o,mapPercentToKeyframes:a,keyframes:l,calculatedDuration:c,totalDuration:u,resolvedDuration:f}=r;if(this.startTime===null)return i.next(0);const{delay:d,repeat:h,repeatType:p,repeatDelay:m,onUpdate:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;const b=this.currentTime-d*(this.speed>=0?1:-1),v=this.speed>=0?b<0:b>u;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=u);let A=this.currentTime,w=i;if(h){const M=Math.min(this.currentTime,u)/f;let O=Math.floor(M),R=M%1;!R&&M>=1&&(R=1),R===1&&O--,O=Math.min(O,h+1),!!(O%2)&&(p==="reverse"?(R=1-R,m&&(R-=m/f)):p==="mirror"&&(w=o)),A=Wo(0,1,R)*f}const x=v?{done:!1,value:l[0]}:w.next(A);a&&(x.value=a(x.value));let{done:C}=x;!v&&c!==null&&(C=this.speed>=0?this.currentTime>=u:this.currentTime<=0);const S=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return S&&s!==void 0&&(x.value=t0(l,this.options,s)),y&&y(x.value),S&&this.finish(),x}get duration(){const{resolved:e}=this;return e?Gi(e.calculatedDuration):0}get time(){return Gi(this.currentTime)}set time(e){e=$i(e),this.currentTime=e,this.holdTime!==null||this.speed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){const t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=Gi(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;const{driver:e=ere,onPlay:t}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),t&&t();const r=this.driver.now();this.holdTime!==null?this.startTime=r-this.holdTime:(!this.startTime||this.state==="finished")&&(this.startTime=r),this.state==="finished"&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=(e=this.currentTime)!==null&&e!==void 0?e:0}complete(){this.state!=="running"&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";const{onComplete:e}=this.options;e&&e()}cancel(){this.cancelTime!==null&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}const $B=n=>Array.isArray(n)&&typeof n[0]=="number";function GB(n){return!!(!n||typeof n=="string"&&n in eE||$B(n)||Array.isArray(n)&&n.every(GB))}const Ph=([n,e,t,r])=>`cubic-bezier(${n}, ${e}, ${t}, ${r})`,eE={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ph([0,.65,.55,1]),circOut:Ph([.55,0,1,.45]),backIn:Ph([.31,.01,.66,-.59]),backOut:Ph([.33,1.53,.69,.99])};function rre(n){return WB(n)||eE.easeOut}function WB(n){if(n)return $B(n)?Ph(n):Array.isArray(n)?n.map(rre):eE[n]}function sre(n,e,t,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:a,times:l}={}){const c={[e]:t};l&&(c.offset=l);const u=WB(a);return Array.isArray(u)&&(c.easing=u),n.animate(c,{delay:r,duration:s,easing:Array.isArray(u)?"linear":u,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"})}const ire=xB(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),ore=new Set(["opacity","clipPath","filter","transform"]),i0=10,are=2e4;function lre(n){return n.type==="spring"||n.name==="backgroundColor"||!GB(n.ease)}function cre(n,e){const t=new Zx({...e,keyframes:n,repeat:0,delay:0,isGenerator:!0});let r={done:!1,value:n[0]};const s=[];let i=0;for(;!r.done&&i<are;)r=t.sample(i),s.push(r.value),i+=i0;return{times:void 0,keyframes:s,duration:i-i0,ease:"linear"}}class KB extends CB{constructor(e){super(e);const{name:t,motionValue:r,keyframes:s}=this.options;this.resolver=new vB(s,(i,o)=>this.onKeyframesResolved(i,o),t,r),this.resolver.scheduleResolve()}initPlayback(e,t){var r;let{duration:s=300,times:i,ease:o,type:a,motionValue:l,name:c}=this.options;if(!(!((r=l.owner)===null||r===void 0)&&r.current))return!1;if(lre(this.options)){const{onComplete:f,onUpdate:d,motionValue:h,...p}=this.options,m=cre(e,p);e=m.keyframes,e.length===1&&(e[1]=e[0]),s=m.duration,i=m.times,o=m.ease,a="keyframes"}const u=sre(l.owner.current,c,e,{...this.options,duration:s,times:i,ease:o});return u.startTime=Jo.now(),this.pendingTimeline?(u.timeline=this.pendingTimeline,this.pendingTimeline=void 0):u.onfinish=()=>{const{onComplete:f}=this.options;l.set(t0(e,this.options,t)),f&&f(),this.cancel(),this.resolveFinishedPromise()},{animation:u,duration:s,times:i,type:a,ease:o,keyframes:e}}get duration(){const{resolved:e}=this;if(!e)return 0;const{duration:t}=e;return Gi(t)}get time(){const{resolved:e}=this;if(!e)return 0;const{animation:t}=e;return Gi(t.currentTime||0)}set time(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.currentTime=$i(e)}get speed(){const{resolved:e}=this;if(!e)return 1;const{animation:t}=e;return t.playbackRate}set speed(e){const{resolved:t}=this;if(!t)return;const{animation:r}=t;r.playbackRate=e}get state(){const{resolved:e}=this;if(!e)return"idle";const{animation:t}=e;return t.playState}attachTimeline(e){if(!this._resolved)this.pendingTimeline=e;else{const{resolved:t}=this;if(!t)return xn;const{animation:r}=t;r.timeline=e,r.onfinish=null}return xn}play(){if(this.isStopped)return;const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.playState==="finished"&&this.updateFinishedPromise(),t.play()}pause(){const{resolved:e}=this;if(!e)return;const{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,this.state==="idle")return;const{resolved:e}=this;if(!e)return;const{animation:t,keyframes:r,duration:s,type:i,ease:o,times:a}=e;if(!(t.playState==="idle"||t.playState==="finished")){if(this.time){const{motionValue:l,onUpdate:c,onComplete:u,...f}=this.options,d=new Zx({...f,keyframes:r,duration:s,type:i,ease:o,times:a,isGenerator:!0}),h=$i(this.time);l.setWithVelocity(d.sample(h-i0).value,d.sample(h).value,i0)}this.cancel()}}complete(){const{resolved:e}=this;e&&e.animation.finish()}cancel(){const{resolved:e}=this;e&&e.animation.cancel()}static supports(e){const{motionValue:t,name:r,repeatDelay:s,repeatType:i,damping:o,type:a}=e;return ire()&&r&&ore.has(r)&&t&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate&&!s&&i!=="mirror"&&o!==0&&a!=="inertia"}}function ure(n,e){let t;const r=()=>{const{currentTime:s}=e,o=(s===null?0:s.value)/100;t!==o&&n(o),t=o};return dt.update(r,!0),()=>Ui(r)}const fre=xB(()=>window.ScrollTimeline!==void 0);class dre{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}then(e,t){return Promise.all(this.animations).then(e).catch(t)}getAll(e){return this.animations[0][e]}setAll(e,t){for(let r=0;r<this.animations.length;r++)this.animations[r][e]=t}attachTimeline(e){const t=this.animations.map(r=>{if(fre()&&r.attachTimeline)r.attachTimeline(e);else return r.pause(),ure(s=>{r.time=r.duration*s},e)});return()=>{t.forEach((r,s)=>{r&&r(),this.animations[s].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}const tE=(n,e,t,r={},s,i)=>o=>{const a=Bx(r,n)||{},l=a.delay||r.delay||0;let{elapsed:c=0}=r;c=c-$i(l);let u={keyframes:Array.isArray(t)?t:[null,t],ease:"easeOut",velocity:e.getVelocity(),...a,delay:-c,onUpdate:d=>{e.set(d),a.onUpdate&&a.onUpdate(d)},onComplete:()=>{o(),a.onComplete&&a.onComplete()},name:n,motionValue:e,element:i?void 0:s};Kte(a)||(u={...u,...Wte(n,u)}),u.duration&&(u.duration=$i(u.duration)),u.repeatDelay&&(u.repeatDelay=$i(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let f=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(u.duration=0,u.delay===0&&(f=!0)),f&&!i&&e.get()!==void 0){const d=t0(u.keyframes,a);if(d!==void 0)return dt.update(()=>{u.onUpdate(d),u.onComplete()}),new dre([])}return!i&&KB.supports(u)?new KB(u):new Zx(u)};function o0(n){return!!(Mn(n)&&n.add)}function nE(n,e){n.indexOf(e)===-1&&n.push(e)}function rE(n,e){const t=n.indexOf(e);t>-1&&n.splice(t,1)}class sE{constructor(){this.subscriptions=[]}add(e){return nE(this.subscriptions,e),()=>rE(this.subscriptions,e)}notify(e,t,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,t,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,t,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const QB=new Set;function iE(n,e,t){n||QB.has(e)||(console.warn(e),QB.add(e))}const JB=30,hre=n=>!isNaN(parseFloat(n));class pre{constructor(e,t={}){this.version="11.2.12",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(r,s=!0)=>{const i=Jo.now();this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),s&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=Jo.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=hre(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return process.env.NODE_ENV!=="production"&&iE(!1,'value.onChange(callback) is deprecated. Switch to value.on("change", callback).'),this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new sE);const r=this.events[e].add(t);return e==="change"?()=>{r(),dt.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,r){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Jo.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>JB)return 0;const t=Math.min(this.updatedAt-this.prevUpdatedAt,JB);return kB(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Dh(n,e){return new pre(n,e)}function mre(n,e,t){n.hasValue(e)?n.getValue(e).set(t):n.addValue(e,Dh(t))}function gre(n,e){const t=e0(n,e);let{transitionEnd:r={},transition:s={},...i}=t||{};i={...i,...r};for(const o in i){const a=Ete(i[o]);mre(n,o,a)}}function qB(n){return n.getProps()[xL]}function yre({protectedKeys:n,needsAnimating:e},t){const r=n.hasOwnProperty(t)&&e[t]!==!0;return e[t]=!1,r}function YB(n,e,{delay:t=0,transitionOverride:r,type:s}={}){var i;let{transition:o=n.getDefaultTransition(),transitionEnd:a,...l}=e;const c=n.getValue("willChange");r&&(o=r);const u=[],f=s&&n.animationState&&n.animationState.getState()[s];for(const d in l){const h=n.getValue(d,(i=n.latestValues[d])!==null&&i!==void 0?i:null),p=l[d];if(p===void 0||f&&yre(f,d))continue;const m={delay:t,elapsed:0,...Bx(o||{},d)};let y=!1;if(window.HandoffAppearAnimations){const v=qB(n);if(v){const A=window.HandoffAppearAnimations(v,d,h,dt);A!==null&&(m.elapsed=A,y=!0)}}h.start(tE(d,h,p,n.shouldReduceMotion&&Al.has(d)?{type:!1}:m,n,y));const b=h.animation;b&&(o0(c)&&(c.add(d),b.then(()=>c.remove(d))),u.push(b))}return a&&Promise.all(u).then(()=>{dt.update(()=>{a&&gre(n,a)})}),u}function oE(n,e,t={}){var r;const s=e0(n,e,t.type==="exit"?(r=n.presenceContext)===null||r===void 0?void 0:r.custom:void 0);let{transition:i=n.getDefaultTransition()||{}}=s||{};t.transitionOverride&&(i=t.transitionOverride);const o=s?()=>Promise.all(YB(n,s,t)):()=>Promise.resolve(),a=n.variantChildren&&n.variantChildren.size?(c=0)=>{const{delayChildren:u=0,staggerChildren:f,staggerDirection:d}=i;return bre(n,e,u+c,f,d,t)}:()=>Promise.resolve(),{when:l}=i;if(l){const[c,u]=l==="beforeChildren"?[o,a]:[a,o];return c().then(()=>u())}else return Promise.all([o(),a(t.delay)])}function bre(n,e,t=0,r=0,s=1,i){const o=[],a=(n.variantChildren.size-1)*r,l=s===1?(c=0)=>c*r:(c=0)=>a-c*r;return Array.from(n.variantChildren).sort(wre).forEach((c,u)=>{c.notify("AnimationStart",e),o.push(oE(c,e,{...i,delay:t+l(u)}).then(()=>c.notify("AnimationComplete",e)))}),Promise.all(o)}function wre(n,e){return n.sortNodePosition(e)}function Are(n,e,t={}){n.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>oE(n,i,t));r=Promise.all(s)}else if(typeof e=="string")r=oE(n,e,t);else{const s=typeof e=="function"?e0(n,e,t.custom):e;r=Promise.all(YB(n,s,t))}return r.then(()=>{dt.postRender(()=>{n.notify("AnimationComplete",e)})})}const vre=[...wx].reverse(),xre=wx.length;function Ere(n){return e=>Promise.all(e.map(({animation:t,options:r})=>Are(n,t,r)))}function Cre(n){let e=Ere(n),t=XB(),r=!0;const s=l=>(c,u)=>{var f;const d=e0(n,u,l==="exit"?(f=n.presenceContext)===null||f===void 0?void 0:f.custom:void 0);if(d){const{transition:h,transitionEnd:p,...m}=d;c={...c,...m,...p}}return c};function i(l){e=l(n)}function o(l){const c=n.getProps(),u=n.getVariantContext(!0)||{},f=[],d=new Set;let h={},p=1/0;for(let y=0;y<xre;y++){const b=vre[y],v=t[b],A=c[b]!==void 0?c[b]:u[b],w=Eh(A),x=b===l?v.isActive:null;x===!1&&(p=y);let C=A===u[b]&&A!==c[b]&&w;if(C&&r&&n.manuallyAnimateOnMount&&(C=!1),v.protectedKeys={...h},!v.isActive&&x===null||!A&&!v.prevProp||Ky(A)||typeof A=="boolean")continue;let M=kre(v.prevProp,A)||b===l&&v.isActive&&!C&&w||y>p&&w,O=!1;const R=Array.isArray(A)?A:[A];let D=R.reduce(s(b),{});x===!1&&(D={});const{prevResolvedValues:_={}}=v,U={..._,...D},K=B=>{M=!0,d.has(B)&&(O=!0,d.delete(B)),v.needsAnimating[B]=!0;const $=n.getValue(B);$&&($.liveStyle=!1)};for(const B in U){const $=D[B],q=_[B];if(h.hasOwnProperty(B))continue;let ne=!1;Rx($)&&Rx(q)?ne=!nB($,q):ne=$!==q,ne?$!=null?K(B):d.add(B):$!==void 0&&d.has(B)?K(B):v.protectedKeys[B]=!0}v.prevProp=A,v.prevResolvedValues=D,v.isActive&&(h={...h,...D}),r&&n.blockInitialAnimation&&(M=!1),M&&(!C||O)&&f.push(...R.map(B=>({animation:B,options:{type:b}})))}if(d.size){const y={};d.forEach(b=>{const v=n.getBaseTarget(b),A=n.getValue(b);A&&(A.liveStyle=!0),y[b]=v??null}),f.push({animation:y})}let m=!!f.length;return r&&(c.initial===!1||c.initial===c.animate)&&!n.manuallyAnimateOnMount&&(m=!1),r=!1,m?e(f):Promise.resolve()}function a(l,c){var u;if(t[l].isActive===c)return Promise.resolve();(u=n.variantChildren)===null||u===void 0||u.forEach(d=>{var h;return(h=d.animationState)===null||h===void 0?void 0:h.setActive(l,c)}),t[l].isActive=c;const f=o(l);for(const d in t)t[d].protectedKeys={};return f}return{animateChanges:o,setActive:a,setAnimateFunction:i,getState:()=>t,reset:()=>{t=XB(),r=!0}}}function kre(n,e){return typeof e=="string"?e!==n:Array.isArray(e)?!nB(e,n):!1}function El(n=!1){return{isActive:n,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function XB(){return{animate:El(!0),whileInView:El(),whileHover:El(),whileTap:El(),whileDrag:El(),whileFocus:El(),exit:El()}}class Sre extends Qo{constructor(e){super(e),e.animationState||(e.animationState=Cre(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Ky(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)===null||e===void 0||e.call(this)}}let Tre=0;class Ore extends Qo{constructor(){super(...arguments),this.id=Tre++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);t&&!e&&s.then(()=>t(this.id))}mount(){const{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}const Nre={animation:{Feature:Sre},exit:{Feature:Ore}},ZB=(n,e)=>Math.abs(n-e);function Mre(n,e){const t=ZB(n.x,e.x),r=ZB(n.y,e.y);return Math.sqrt(t**2+r**2)}class e_{constructor(e,t,{transformPagePoint:r,contextWindow:s,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=lE(this.lastMoveEventInfo,this.history),d=this.startEvent!==null,h=Mre(f.offset,{x:0,y:0})>=3;if(!d&&!h)return;const{point:p}=f,{timestamp:m}=En;this.history.push({...p,timestamp:m});const{onStart:y,onMove:b}=this.handlers;d||(y&&y(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),b&&b(this.lastMoveEvent,f)},this.handlePointerMove=(f,d)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=aE(d,this.transformPagePoint),dt.update(this.updatePoint,!0)},this.handlePointerUp=(f,d)=>{this.end();const{onEnd:h,onSessionEnd:p,resumeAnimation:m}=this.handlers;if(this.dragSnapToOrigin&&m&&m(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const y=lE(f.type==="pointercancel"?this.lastMoveEventInfo:aE(d,this.transformPagePoint),this.history);this.startEvent&&h&&h(f,y),p&&p(f,y)},!QL(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=r,this.contextWindow=s||window;const o=Zy(e),a=aE(o,this.transformPagePoint),{point:l}=a,{timestamp:c}=En;this.history=[{...l,timestamp:c}];const{onSessionStart:u}=t;u&&u(e,lE(a,this.history)),this.removeListeners=zi(Hi(this.contextWindow,"pointermove",this.handlePointerMove),Hi(this.contextWindow,"pointerup",this.handlePointerUp),Hi(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Ui(this.updatePoint)}}function aE(n,e){return e?{point:e(n.point)}:n}function t_(n,e){return{x:n.x-e.x,y:n.y-e.y}}function lE({point:n},e){return{point:n,delta:t_(n,n_(e)),offset:t_(n,Rre(e)),velocity:Pre(e,.1)}}function Rre(n){return n[0]}function n_(n){return n[n.length-1]}function Pre(n,e){if(n.length<2)return{x:0,y:0};let t=n.length-1,r=null;const s=n_(n);for(;t>=0&&(r=n[t],!(s.timestamp-r.timestamp>$i(e)));)t--;if(!r)return{x:0,y:0};const i=Gi(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Or(n){return n.max-n.min}function cE(n,e=0,t=.01){return Math.abs(n-e)<=t}function r_(n,e,t,r=.5){n.origin=r,n.originPoint=Bt(e.min,e.max,n.origin),n.scale=Or(t)/Or(e),(cE(n.scale,1,1e-4)||isNaN(n.scale))&&(n.scale=1),n.translate=Bt(t.min,t.max,n.origin)-n.originPoint,(cE(n.translate)||isNaN(n.translate))&&(n.translate=0)}function Ih(n,e,t,r){r_(n.x,e.x,t.x,r?r.originX:void 0),r_(n.y,e.y,t.y,r?r.originY:void 0)}function s_(n,e,t){n.min=t.min+e.min,n.max=n.min+Or(e)}function Dre(n,e,t){s_(n.x,e.x,t.x),s_(n.y,e.y,t.y)}function i_(n,e,t){n.min=e.min-t.min,n.max=n.min+Or(e)}function Lh(n,e,t){i_(n.x,e.x,t.x),i_(n.y,e.y,t.y)}function Ire(n,{min:e,max:t},r){return e!==void 0&&n<e?n=r?Bt(e,n,r.min):Math.max(n,e):t!==void 0&&n>t&&(n=r?Bt(t,n,r.max):Math.min(n,t)),n}function o_(n,e,t){return{min:e!==void 0?n.min+e:void 0,max:t!==void 0?n.max+t-(n.max-n.min):void 0}}function Lre(n,{top:e,left:t,bottom:r,right:s}){return{x:o_(n.x,t,s),y:o_(n.y,e,r)}}function a_(n,e){let t=e.min-n.min,r=e.max-n.max;return e.max-e.min<n.max-n.min&&([t,r]=[r,t]),{min:t,max:r}}function Bre(n,e){return{x:a_(n.x,e.x),y:a_(n.y,e.y)}}function _re(n,e){let t=.5;const r=Or(n),s=Or(e);return s>r?t=Rh(e.min,e.max-r,n.min):r>s&&(t=Rh(n.min,n.max-s,e.min)),Wo(0,1,t)}function Fre(n,e){const t={};return e.min!==void 0&&(t.min=e.min-n.min),e.max!==void 0&&(t.max=e.max-n.min),t}const uE=.35;function jre(n=uE){return n===!1?n=0:n===!0&&(n=uE),{x:l_(n,"left","right"),y:l_(n,"top","bottom")}}function l_(n,e,t){return{min:c_(n,e),max:c_(n,t)}}function c_(n,e){return typeof n=="number"?n:n[e]||0}const u_=()=>({translate:0,scale:1,origin:0,originPoint:0}),Mu=()=>({x:u_(),y:u_()}),f_=()=>({min:0,max:0}),Kt=()=>({x:f_(),y:f_()});function Qr(n){return[n("x"),n("y")]}function d_({top:n,left:e,right:t,bottom:r}){return{x:{min:e,max:t},y:{min:n,max:r}}}function Ure({x:n,y:e}){return{top:e.min,right:n.max,bottom:e.max,left:n.min}}function Vre(n,e){if(!e)return n;const t=e({x:n.left,y:n.top}),r=e({x:n.right,y:n.bottom});return{top:t.y,left:t.x,bottom:r.y,right:r.x}}function fE(n){return n===void 0||n===1}function dE({scale:n,scaleX:e,scaleY:t}){return!fE(n)||!fE(e)||!fE(t)}function Cl(n){return dE(n)||h_(n)||n.z||n.rotate||n.rotateX||n.rotateY||n.skewX||n.skewY}function h_(n){return p_(n.x)||p_(n.y)}function p_(n){return n&&n!=="0%"}function a0(n,e,t){const r=n-t,s=e*r;return t+s}function m_(n,e,t,r,s){return s!==void 0&&(n=a0(n,s,r)),a0(n,t,r)+e}function hE(n,e=0,t=1,r,s){n.min=m_(n.min,e,t,r,s),n.max=m_(n.max,e,t,r,s)}function g_(n,{x:e,y:t}){hE(n.x,e.translate,e.scale,e.originPoint),hE(n.y,t.translate,t.scale,t.originPoint)}function Hre(n,e,t,r=!1){const s=t.length;if(!s)return;e.x=e.y=1;let i,o;for(let a=0;a<s;a++){i=t[a],o=i.projectionDelta;const l=i.instance;l&&l.style&&l.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&Ru(n,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,g_(n,o)),r&&Cl(i.latestValues)&&Ru(n,i.latestValues))}e.x=y_(e.x),e.y=y_(e.y)}function y_(n){return Number.isInteger(n)||n>1.0000000000001||n<.999999999999?n:1}function Yo(n,e){n.min=n.min+e,n.max=n.max+e}function b_(n,e,[t,r,s]){const i=e[s]!==void 0?e[s]:.5,o=Bt(n.min,n.max,i);hE(n,e[t],e[r],o,e.scale)}const zre=["x","scaleX","originX"],$re=["y","scaleY","originY"];function Ru(n,e){b_(n.x,e,zre),b_(n.y,e,$re)}function w_(n,e){return d_(Vre(n.getBoundingClientRect(),e))}function Gre(n,e,t){const r=w_(n,t),{scroll:s}=e;return s&&(Yo(r.x,s.offset.x),Yo(r.y,s.offset.y)),r}const A_=({current:n})=>n?n.ownerDocument.defaultView:null,Wre=new WeakMap;class Kre{constructor(e){this.openGlobalLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Kt(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){const{presenceContext:r}=this.visualElement;if(r&&r.isPresent===!1)return;const s=u=>{const{dragSnapToOrigin:f}=this.getProps();f?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(Zy(u,"page").point)},i=(u,f)=>{const{drag:d,dragPropagation:h,onDragStart:p}=this.getProps();if(d&&!h&&(this.openGlobalLock&&this.openGlobalLock(),this.openGlobalLock=XL(d),!this.openGlobalLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Qr(y=>{let b=this.getAxisMotionValue(y).get()||0;if(ti.test(b)){const{projection:v}=this.visualElement;if(v&&v.layout){const A=v.layout.layoutBox[y];A&&(b=Or(A)*(parseFloat(b)/100))}}this.originPoint[y]=b}),p&&dt.postRender(()=>p(u,f));const{animationState:m}=this.visualElement;m&&m.setActive("whileDrag",!0)},o=(u,f)=>{const{dragPropagation:d,dragDirectionLock:h,onDirectionLock:p,onDrag:m}=this.getProps();if(!d&&!this.openGlobalLock)return;const{offset:y}=f;if(h&&this.currentDirection===null){this.currentDirection=Qre(y),this.currentDirection!==null&&p&&p(this.currentDirection);return}this.updateAxis("x",f.point,y),this.updateAxis("y",f.point,y),this.visualElement.render(),m&&m(u,f)},a=(u,f)=>this.stop(u,f),l=()=>Qr(u=>{var f;return this.getAnimationState(u)==="paused"&&((f=this.getAxisMotionValue(u).animation)===null||f===void 0?void 0:f.play())}),{dragSnapToOrigin:c}=this.getProps();this.panSession=new e_(e,{onSessionStart:s,onStart:i,onMove:o,onSessionEnd:a,resumeAnimation:l},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:c,contextWindow:A_(this.visualElement)})}stop(e,t){const r=this.isDragging;if(this.cancel(),!r)return;const{velocity:s}=t;this.startAnimation(s);const{onDragEnd:i}=this.getProps();i&&dt.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;const{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openGlobalLock&&(this.openGlobalLock(),this.openGlobalLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,r){const{drag:s}=this.getProps();if(!r||!l0(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Ire(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var e;const{dragConstraints:t,dragElastic:r}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(e=this.visualElement.projection)===null||e===void 0?void 0:e.layout,i=this.constraints;t&&Cu(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&s?this.constraints=Lre(s.layoutBox,t):this.constraints=!1,this.elastic=jre(r),i!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&Qr(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=Fre(s.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:t}=this.getProps();if(!e||!Cu(e))return!1;const r=e.current;ji(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Gre(r,s.root,this.visualElement.getTransformPagePoint());let o=Bre(s.layout.layoutBox,i);if(t){const a=t(Ure(o));this.hasMutatedConstraints=!!a,a&&(o=d_(a))}return o}startAnimation(e){const{drag:t,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:a}=this.getProps(),l=this.constraints||{},c=Qr(u=>{if(!l0(u,t,this.currentDirection))return;let f=l&&l[u]||{};o&&(f={min:0,max:0});const d=s?200:1e6,h=s?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:d,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...i,...f};return this.startAxisValueAnimation(u,p)});return Promise.all(c).then(a)}startAxisValueAnimation(e,t){const r=this.getAxisMotionValue(e);return r.start(tE(e,r,0,t,this.visualElement))}stopAnimation(){Qr(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Qr(e=>{var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.pause()})}getAnimationState(e){var t;return(t=this.getAxisMotionValue(e).animation)===null||t===void 0?void 0:t.state}getAxisMotionValue(e){const t=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[t];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Qr(t=>{const{drag:r}=this.getProps();if(!l0(t,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(t);if(s&&s.layout){const{min:o,max:a}=s.layout.layoutBox[t];i.set(e[t]-Bt(o,a,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:t}=this.getProps(),{projection:r}=this.visualElement;if(!Cu(t)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};Qr(o=>{const a=this.getAxisMotionValue(o);if(a&&this.constraints!==!1){const l=a.get();s[o]=_re({min:l,max:l},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Qr(o=>{if(!l0(o,e,null))return;const a=this.getAxisMotionValue(o),{min:l,max:c}=this.constraints[o];a.set(Bt(l,c,s[o]))})}addListeners(){if(!this.visualElement.current)return;Wre.set(this.visualElement,this);const e=this.visualElement.current,t=Hi(e,"pointerdown",l=>{const{drag:c,dragListener:u=!0}=this.getProps();c&&u&&this.start(l)}),r=()=>{const{dragConstraints:l}=this.getProps();Cu(l)&&l.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,i=s.addEventListener("measure",r);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),dt.read(r);const o=Vi(window,"resize",()=>this.scalePositionWithinConstraints()),a=s.addEventListener("didUpdate",({delta:l,hasLayoutChanged:c})=>{this.isDragging&&c&&(Qr(u=>{const f=this.getAxisMotionValue(u);f&&(this.originPoint[u]+=l[u].translate,f.set(f.get()+l[u].translate))}),this.visualElement.render())});return()=>{o(),t(),i(),a&&a()}}getProps(){const e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=uE,dragMomentum:a=!0}=e;return{...e,drag:t,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:a}}}function l0(n,e,t){return(e===!0||e===n)&&(t===null||t===n)}function Qre(n,e=10){let t=null;return Math.abs(n.y)>e?t="y":Math.abs(n.x)>e&&(t="x"),t}class Jre extends Qo{constructor(e){super(e),this.removeGroupControls=xn,this.removeListeners=xn,this.controls=new Kre(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||xn}unmount(){this.removeGroupControls(),this.removeListeners()}}const v_=n=>(e,t)=>{n&&dt.postRender(()=>n(e,t))};class qre extends Qo{constructor(){super(...arguments),this.removePointerDownListener=xn}onPointerDown(e){this.session=new e_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:A_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:t,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:v_(e),onStart:v_(t),onMove:r,onEnd:(i,o)=>{delete this.session,s&&dt.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=Hi(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}function Yre(){const n=P.useContext(Gy);if(n===null)return[!0,null];const{isPresent:e,onExitComplete:t,register:r}=n,s=P.useId();return P.useEffect(()=>r(s),[]),!e&&t?[!1,()=>t&&t(s)]:[!0]}const c0={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function x_(n,e){return e.max===e.min?0:n/(e.max-e.min)*100}const Bh={correct:(n,e)=>{if(!e.target)return n;if(typeof n=="string")if(Le.test(n))n=parseFloat(n);else return n;const t=x_(n,e.target.x),r=x_(n,e.target.y);return`${t}% ${r}%`}},Xre={correct:(n,{treeScale:e,projectionDelta:t})=>{const r=n,s=qo.parse(n);if(s.length>5)return r;const i=qo.createTransformer(n),o=typeof s[0]!="number"?1:0,a=t.x.scale*e.x,l=t.y.scale*e.y;s[0+o]/=a,s[1+o]/=l;const c=Bt(a,l,.5);return typeof s[2+o]=="number"&&(s[2+o]/=c),typeof s[3+o]=="number"&&(s[3+o]/=c),i(s)}};class Zre extends P.Component{componentDidMount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;Zee(ese),i&&(t.group&&t.group.add(i),r&&r.register&&s&&r.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),c0.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:t,visualElement:r,drag:s,isPresent:i}=this.props,o=r.projection;return o&&(o.isPresent=i,s||e.layoutDependency!==t||t===void 0?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||dt.postRender(()=>{const a=o.getStack();(!a||!a.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),bx.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:t,switchLayoutGroup:r}=this.props,{projection:s}=e;s&&(s.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function E_(n){const[e,t]=Yre(),r=P.useContext(vx);return k.jsx(Zre,{...n,layoutGroup:r,switchLayoutGroup:P.useContext(kL),isPresent:e,safeToRemove:t})}const ese={borderRadius:{...Bh,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Bh,borderTopRightRadius:Bh,borderBottomLeftRadius:Bh,borderBottomRightRadius:Bh,boxShadow:Xre},C_=["TopLeft","TopRight","BottomLeft","BottomRight"],tse=C_.length,k_=n=>typeof n=="string"?parseFloat(n):n,S_=n=>typeof n=="number"||Le.test(n);function nse(n,e,t,r,s,i){s?(n.opacity=Bt(0,t.opacity!==void 0?t.opacity:1,rse(r)),n.opacityExit=Bt(e.opacity!==void 0?e.opacity:1,0,sse(r))):i&&(n.opacity=Bt(e.opacity!==void 0?e.opacity:1,t.opacity!==void 0?t.opacity:1,r));for(let o=0;o<tse;o++){const a=`border${C_[o]}Radius`;let l=T_(e,a),c=T_(t,a);if(l===void 0&&c===void 0)continue;l||(l=0),c||(c=0),l===0||c===0||S_(l)===S_(c)?(n[a]=Math.max(Bt(k_(l),k_(c),r),0),(ti.test(c)||ti.test(l))&&(n[a]+="%")):n[a]=c}(e.rotate||t.rotate)&&(n.rotate=Bt(e.rotate||0,t.rotate||0,r))}function T_(n,e){return n[e]!==void 0?n[e]:n.borderRadius}const rse=O_(0,.5,LB),sse=O_(.5,.95,xn);function O_(n,e,t){return r=>r<n?0:r>e?1:t(Rh(n,e,r))}function N_(n,e){n.min=e.min,n.max=e.max}function Jr(n,e){N_(n.x,e.x),N_(n.y,e.y)}function M_(n,e,t,r,s){return n-=e,n=a0(n,1/t,r),s!==void 0&&(n=a0(n,1/s,r)),n}function ise(n,e=0,t=1,r=.5,s,i=n,o=n){if(ti.test(e)&&(e=parseFloat(e),e=Bt(o.min,o.max,e/100)-o.min),typeof e!="number")return;let a=Bt(i.min,i.max,r);n===i&&(a-=e),n.min=M_(n.min,e,t,a,s),n.max=M_(n.max,e,t,a,s)}function R_(n,e,[t,r,s],i,o){ise(n,e[t],e[r],e[s],e.scale,i,o)}const ose=["x","scaleX","originX"],ase=["y","scaleY","originY"];function P_(n,e,t,r){R_(n.x,e,ose,t?t.x:void 0,r?r.x:void 0),R_(n.y,e,ase,t?t.y:void 0,r?r.y:void 0)}function D_(n){return n.translate===0&&n.scale===1}function I_(n){return D_(n.x)&&D_(n.y)}function lse(n,e){return n.x.min===e.x.min&&n.x.max===e.x.max&&n.y.min===e.y.min&&n.y.max===e.y.max}function L_(n,e){return Math.round(n.x.min)===Math.round(e.x.min)&&Math.round(n.x.max)===Math.round(e.x.max)&&Math.round(n.y.min)===Math.round(e.y.min)&&Math.round(n.y.max)===Math.round(e.y.max)}function B_(n){return Or(n.x)/Or(n.y)}class cse{constructor(){this.members=[]}add(e){nE(this.members,e),e.scheduleRender()}remove(e){if(rE(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const t=this.members[this.members.length-1];t&&this.promote(t)}}relegate(e){const t=this.members.findIndex(s=>e===s);if(t===0)return!1;let r;for(let s=t;s>=0;s--){const i=this.members[s];if(i.isPresent!==!1){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,t){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender(),e.resumeFrom=r,t&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:s}=e.options;s===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:t,resumingFrom:r}=e;t.onExitComplete&&t.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function __(n,e,t){let r="";const s=n.x.translate/e.x,i=n.y.translate/e.y,o=(t==null?void 0:t.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),t){const{transformPerspective:c,rotate:u,rotateX:f,rotateY:d,skewX:h,skewY:p}=t;c&&(r=`perspective(${c}px) ${r}`),u&&(r+=`rotate(${u}deg) `),f&&(r+=`rotateX(${f}deg) `),d&&(r+=`rotateY(${d}deg) `),h&&(r+=`skewX(${h}deg) `),p&&(r+=`skewY(${p}deg) `)}const a=n.x.scale*e.x,l=n.y.scale*e.y;return(a!==1||l!==1)&&(r+=`scale(${a}, ${l})`),r||"none"}const use=(n,e)=>n.depth-e.depth;class fse{constructor(){this.children=[],this.isDirty=!1}add(e){nE(this.children,e),this.isDirty=!0}remove(e){rE(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(use),this.isDirty=!1,this.children.forEach(e)}}function dse(n,e){const t=Jo.now(),r=({timestamp:s})=>{const i=s-t;i>=e&&(Ui(r),n(i-e))};return dt.read(r,!0),()=>Ui(r)}function hse(n){window.MotionDebug&&window.MotionDebug.record(n)}function pse(n){return n instanceof SVGElement&&n.tagName!=="svg"}function mse(n,e,t){const r=Mn(n)?n:Dh(n);return r.start(tE("",r,e,t)),r.animation}const pE=["","X","Y","Z"],gse={visibility:"hidden"},F_=1e3;let yse=0;const kl={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0};function mE(n,e,t,r){const{latestValues:s}=e;s[n]&&(t[n]=s[n],e.setStaticValue(n,0),r&&(r[n]=0))}function j_(n){if(n.hasCheckedOptimisedAppear=!0,n.root===n)return!1;const{visualElement:e}=n.options;return e?qB(e)?!0:n.parent&&!n.parent.hasCheckedOptimisedAppear?j_(n.parent):!1:!1}function U_({attachResizeListener:n,defaultParent:e,measureScroll:t,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},a=e==null?void 0:e()){this.id=yse++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,kl.totalNodes=kl.resolvedTargetDeltas=kl.recalculatedProjection=0,this.nodes.forEach(Ase),this.nodes.forEach(kse),this.nodes.forEach(Sse),this.nodes.forEach(vse),hse(kl)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=a?a.root||a:this,this.path=a?[...a.path,a]:[],this.parent=a,this.depth=a?a.depth+1:0;for(let l=0;l<this.path.length;l++)this.path[l].shouldResetTransform=!0;this.root===this&&(this.nodes=new fse)}addEventListener(o,a){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new sE),this.eventHandlers.get(o).add(a)}notifyListeners(o,...a){const l=this.eventHandlers.get(o);l&&l.notify(...a)}hasListeners(o){return this.eventHandlers.has(o)}mount(o,a=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=pse(o),this.instance=o;const{layoutId:l,layout:c,visualElement:u}=this.options;if(u&&!u.current&&u.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),a&&(c||l)&&(this.isLayoutDirty=!0),n){let f;const d=()=>this.root.updateBlockedByResize=!1;n(o,()=>{this.root.updateBlockedByResize=!0,f&&f(),f=dse(d,250),c0.hasAnimatedSinceResize&&(c0.hasAnimatedSinceResize=!1,this.nodes.forEach(H_))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&u&&(l||c)&&this.addEventListener("didUpdate",({delta:f,hasLayoutChanged:d,hasRelativeTargetChanged:h,layout:p})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const m=this.options.transition||u.getDefaultTransition()||Rse,{onLayoutAnimationStart:y,onLayoutAnimationComplete:b}=u.getProps(),v=!this.targetLayout||!L_(this.targetLayout,p)||h,A=!d&&h;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||A||d&&(v||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(f,A);const w={...Bx(m,"layout"),onPlay:y,onComplete:b};(u.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w)}else d||H_(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=p})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,Ui(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Tse),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.HandoffCancelAllAnimations&&j_(this)&&window.HandoffCancelAllAnimations(),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const f=this.path[u];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:a,layout:l}=this.options;if(a===void 0&&!l)return;const c=this.getTransformTemplate();this.prevTransformTemplateValue=c?c(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(V_);return}this.isUpdating||this.nodes.forEach(Ese),this.isUpdating=!1,this.nodes.forEach(Cse),this.nodes.forEach(bse),this.nodes.forEach(wse),this.clearAllSnapshots();const a=Jo.now();En.delta=Wo(0,1e3/60,a-En.timestamp),En.timestamp=a,En.isProcessing=!0,Px.update.process(En),Px.preRender.process(En),Px.render.process(En),En.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,bx.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(xse),this.sharedNodes.forEach(Ose)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,dt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){dt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let l=0;l<this.path.length;l++)this.path[l].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutCorrected=Kt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:a}=this.options;a&&a.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let a=!!(this.options.layoutScroll&&this.instance);this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(a=!1),a&&(this.scroll={animationId:this.root.animationId,phase:o,isRoot:r(this.instance),offset:t(this.instance)})}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,a=this.projectionDelta&&!I_(this.projectionDelta),l=this.getTransformTemplate(),c=l?l(this.latestValues,""):void 0,u=c!==this.prevTransformTemplateValue;o&&(a||Cl(this.latestValues)||u)&&(s(this.instance,c),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const a=this.measurePageBox();let l=this.removeElementScroll(a);return o&&(l=this.removeTransform(l)),Pse(l),{animationId:this.root.animationId,measuredBox:a,layoutBox:l,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:o}=this.options;if(!o)return Kt();const a=o.measureViewportBox(),{scroll:l}=this.root;return l&&(Yo(a.x,l.offset.x),Yo(a.y,l.offset.y)),a}removeElementScroll(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l],{scroll:u,options:f}=c;if(c!==this.root&&u&&f.layoutScroll){if(u.isRoot){Jr(a,o);const{scroll:d}=this.root;d&&(Yo(a.x,-d.offset.x),Yo(a.y,-d.offset.y))}Yo(a.x,u.offset.x),Yo(a.y,u.offset.y)}}return a}applyTransform(o,a=!1){const l=Kt();Jr(l,o);for(let c=0;c<this.path.length;c++){const u=this.path[c];!a&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Ru(l,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),Cl(u.latestValues)&&Ru(l,u.latestValues)}return Cl(this.latestValues)&&Ru(l,this.latestValues),l}removeTransform(o){const a=Kt();Jr(a,o);for(let l=0;l<this.path.length;l++){const c=this.path[l];if(!c.instance||!Cl(c.latestValues))continue;dE(c.latestValues)&&c.updateSnapshot();const u=Kt(),f=c.measurePageBox();Jr(u,f),P_(a,c.latestValues,c.snapshot?c.snapshot.layoutBox:void 0,u)}return Cl(this.latestValues)&&P_(a,this.latestValues),a}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==En.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var a;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||!((a=this.parent)===null||a===void 0)&&a.isProjectionDirty||this.attemptToResolveRelativeTarget))return;const{layout:f,layoutId:d}=this.options;if(!(!this.layout||!(f||d))){if(this.resolvedRelativeTargetAt=En.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),Lh(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)){if(this.target||(this.target=Kt(),this.targetWithTransforms=Kt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),Dre(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Jr(this.target,this.layout.layoutBox),g_(this.target,this.targetDelta)):Jr(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Kt(),this.relativeTargetOrigin=Kt(),Lh(this.relativeTargetOrigin,this.target,h.target),Jr(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}kl.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||dE(this.parent.latestValues)||h_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var o;const a=this.getLead(),l=!!this.resumingFrom||this!==a;let c=!0;if((this.isProjectionDirty||!((o=this.parent)===null||o===void 0)&&o.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===En.timestamp&&(c=!1),c)return;const{layout:u,layoutId:f}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(u||f))return;Jr(this.layoutCorrected,this.layout.layoutBox);const d=this.treeScale.x,h=this.treeScale.y;Hre(this.layoutCorrected,this.treeScale,this.path,l),a.layout&&!a.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(a.target=a.layout.layoutBox,a.targetWithTransforms=Kt());const{target:p}=a;if(!p){this.projectionTransform&&(this.projectionDelta=Mu(),this.projectionTransform="none",this.scheduleRender());return}this.projectionDelta||(this.projectionDelta=Mu(),this.projectionDeltaWithTransform=Mu());const m=this.projectionTransform;Ih(this.projectionDelta,this.layoutCorrected,p,this.latestValues),this.projectionTransform=__(this.projectionDelta,this.treeScale),(this.projectionTransform!==m||this.treeScale.x!==d||this.treeScale.y!==h)&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",p)),kl.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){if(this.options.scheduleRender&&this.options.scheduleRender(),o){const a=this.getStack();a&&a.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}setAnimationOrigin(o,a=!1){const l=this.snapshot,c=l?l.latestValues:{},u={...this.latestValues},f=Mu();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!a;const d=Kt(),h=l?l.source:void 0,p=this.layout?this.layout.source:void 0,m=h!==p,y=this.getStack(),b=!y||y.members.length<=1,v=!!(m&&!b&&this.options.crossfade===!0&&!this.path.some(Mse));this.animationProgress=0;let A;this.mixTargetDelta=w=>{const x=w/1e3;z_(f.x,o.x,x),z_(f.y,o.y,x),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Lh(d,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Nse(this.relativeTarget,this.relativeTargetOrigin,d,x),A&&lse(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=Kt()),Jr(A,this.relativeTarget)),m&&(this.animationValues=u,nse(u,c,this.latestValues,x,v,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=x},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&(Ui(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=dt.update(()=>{c0.hasAnimatedSinceResize=!0,this.currentAnimation=mse(0,F_,{...o,onUpdate:a=>{this.mixTargetDelta(a),o.onUpdate&&o.onUpdate(a)},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(F_),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:a,target:l,layout:c,latestValues:u}=o;if(!(!a||!l||!c)){if(this!==o&&this.layout&&c&&Q_(this.options.animationType,this.layout.layoutBox,c.layoutBox)){l=this.target||Kt();const f=Or(this.layout.layoutBox.x);l.x.min=o.target.x.min,l.x.max=l.x.min+f;const d=Or(this.layout.layoutBox.y);l.y.min=o.target.y.min,l.y.max=l.y.min+d}Jr(a,l),Ru(a,u),Ih(this.projectionDeltaWithTransform,this.layoutCorrected,a,u)}}registerSharedNode(o,a){this.sharedNodes.has(o)||this.sharedNodes.set(o,new cse),this.sharedNodes.get(o).add(a);const c=a.options.initialPromotionConfig;a.promote({transition:c?c.transition:void 0,preserveFollowOpacity:c&&c.shouldPreserveFollowOpacity?c.shouldPreserveFollowOpacity(a):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var o;const{layoutId:a}=this.options;return a?((o=this.getStack())===null||o===void 0?void 0:o.lead)||this:this}getPrevLead(){var o;const{layoutId:a}=this.options;return a?(o=this.getStack())===null||o===void 0?void 0:o.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:a,preserveFollowOpacity:l}={}){const c=this.getStack();c&&c.promote(this,l),o&&(this.projectionDelta=void 0,this.needsReset=!0),a&&this.setOptions({transition:a})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let a=!1;const{latestValues:l}=o;if((l.z||l.rotate||l.rotateX||l.rotateY||l.rotateZ||l.skewX||l.skewY)&&(a=!0),!a)return;const c={};l.z&&mE("z",o,c,this.animationValues);for(let u=0;u<pE.length;u++)mE(`rotate${pE[u]}`,o,c,this.animationValues),mE(`skew${pE[u]}`,o,c,this.animationValues);o.render();for(const u in c)o.setStaticValue(u,c[u]),this.animationValues&&(this.animationValues[u]=c[u]);o.scheduleRender()}getProjectionStyles(o){var a,l;if(!this.instance||this.isSVG)return;if(!this.isVisible)return gse;const c={visibility:""},u=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,c.opacity="",c.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||"",c.transform=u?u(this.latestValues,""):"none",c;const f=this.getLead();if(!this.projectionDelta||!this.layout||!f.target){const m={};return this.options.layoutId&&(m.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,m.pointerEvents=Xy(o==null?void 0:o.pointerEvents)||""),this.hasProjected&&!Cl(this.latestValues)&&(m.transform=u?u({},""):"none",this.hasProjected=!1),m}const d=f.animationValues||f.latestValues;this.applyTransformsToTarget(),c.transform=__(this.projectionDeltaWithTransform,this.treeScale,d),u&&(c.transform=u(d,c.transform));const{x:h,y:p}=this.projectionDelta;c.transformOrigin=`${h.origin*100}% ${p.origin*100}% 0`,f.animationValues?c.opacity=f===this?(l=(a=d.opacity)!==null&&a!==void 0?a:this.latestValues.opacity)!==null&&l!==void 0?l:1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:c.opacity=f===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const m in Jy){if(d[m]===void 0)continue;const{correct:y,applyTo:b}=Jy[m],v=c.transform==="none"?d[m]:y(d[m],f);if(b){const A=b.length;for(let w=0;w<A;w++)c[b[w]]=v}else c[m]=v}return this.options.layoutId&&(c.pointerEvents=f===this?Xy(o==null?void 0:o.pointerEvents)||"":"none"),c}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var a;return(a=o.currentAnimation)===null||a===void 0?void 0:a.stop()}),this.root.nodes.forEach(V_),this.root.sharedNodes.clear()}}}function bse(n){n.updateLayout()}function wse(n){var e;const t=((e=n.resumeFrom)===null||e===void 0?void 0:e.snapshot)||n.snapshot;if(n.isLead()&&n.layout&&t&&n.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=n.layout,{animationType:i}=n.options,o=t.source!==n.layout.source;i==="size"?Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(d);d.min=r[f].min,d.max=d.min+h}):Q_(i,t.layoutBox,r)&&Qr(f=>{const d=o?t.measuredBox[f]:t.layoutBox[f],h=Or(r[f]);d.max=d.min+h,n.relativeTarget&&!n.currentAnimation&&(n.isProjectionDirty=!0,n.relativeTarget[f].max=n.relativeTarget[f].min+h)});const a=Mu();Ih(a,r,t.layoutBox);const l=Mu();o?Ih(l,n.applyTransform(s,!0),t.measuredBox):Ih(l,r,t.layoutBox);const c=!I_(a);let u=!1;if(!n.resumeFrom){const f=n.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:d,layout:h}=f;if(d&&h){const p=Kt();Lh(p,t.layoutBox,d.layoutBox);const m=Kt();Lh(m,r,h.layoutBox),L_(p,m)||(u=!0),f.options.layoutRoot&&(n.relativeTarget=m,n.relativeTargetOrigin=p,n.relativeParent=f)}}}n.notifyListeners("didUpdate",{layout:r,snapshot:t,delta:l,layoutDelta:a,hasLayoutChanged:c,hasRelativeTargetChanged:u})}else if(n.isLead()){const{onExitComplete:r}=n.options;r&&r()}n.options.transition=void 0}function Ase(n){kl.totalNodes++,n.parent&&(n.isProjecting()||(n.isProjectionDirty=n.parent.isProjectionDirty),n.isSharedProjectionDirty||(n.isSharedProjectionDirty=!!(n.isProjectionDirty||n.parent.isProjectionDirty||n.parent.isSharedProjectionDirty)),n.isTransformDirty||(n.isTransformDirty=n.parent.isTransformDirty))}function vse(n){n.isProjectionDirty=n.isSharedProjectionDirty=n.isTransformDirty=!1}function xse(n){n.clearSnapshot()}function V_(n){n.clearMeasurements()}function Ese(n){n.isLayoutDirty=!1}function Cse(n){const{visualElement:e}=n.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),n.resetTransform()}function H_(n){n.finishAnimation(),n.targetDelta=n.relativeTarget=n.target=void 0,n.isProjectionDirty=!0}function kse(n){n.resolveTargetDelta()}function Sse(n){n.calcProjection()}function Tse(n){n.resetSkewAndRotation()}function Ose(n){n.removeLeadSnapshot()}function z_(n,e,t){n.translate=Bt(e.translate,0,t),n.scale=Bt(e.scale,1,t),n.origin=e.origin,n.originPoint=e.originPoint}function $_(n,e,t,r){n.min=Bt(e.min,t.min,r),n.max=Bt(e.max,t.max,r)}function Nse(n,e,t,r){$_(n.x,e.x,t.x,r),$_(n.y,e.y,t.y,r)}function Mse(n){return n.animationValues&&n.animationValues.opacityExit!==void 0}const Rse={duration:.45,ease:[.4,0,.1,1]},G_=n=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(n),W_=G_("applewebkit/")&&!G_("chrome/")?Math.round:xn;function K_(n){n.min=W_(n.min),n.max=W_(n.max)}function Pse(n){K_(n.x),K_(n.y)}function Q_(n,e,t){return n==="position"||n==="preserve-aspect"&&!cE(B_(e),B_(t),.2)}const Dse=U_({attachResizeListener:(n,e)=>Vi(n,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),gE={current:void 0},J_=U_({measureScroll:n=>({x:n.scrollLeft,y:n.scrollTop}),defaultParent:()=>{if(!gE.current){const n=new Dse({});n.mount(window),n.setOptions({layoutScroll:!0}),gE.current=n}return gE.current},resetTransform:(n,e)=>{n.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:n=>window.getComputedStyle(n).position==="fixed"}),Ise={pan:{Feature:qre},drag:{Feature:Jre,ProjectionNode:J_,MeasureLayout:E_}},yE={current:null},q_={current:!1};function Lse(){if(q_.current=!0,!!mx)if(window.matchMedia){const n=window.matchMedia("(prefers-reduced-motion)"),e=()=>yE.current=n.matches;n.addListener(e),e()}else yE.current=!1}function Bse(n,e,t){const{willChange:r}=e;for(const s in e){const i=e[s],o=t[s];if(Mn(i))n.addValue(s,i),o0(r)&&r.add(s),process.env.NODE_ENV==="development"&&iE(i.version==="11.2.12",`Attempting to mix Framer Motion versions ${i.version} with 11.2.12 may not work as expected.`);else if(Mn(o))n.addValue(s,Dh(i,{owner:n})),o0(r)&&r.remove(s);else if(o!==i)if(n.hasValue(s)){const a=n.getValue(s);a.liveStyle===!0?a.jump(i):a.hasAnimated||a.set(i)}else{const a=n.getStaticValue(s);n.addValue(s,Dh(a!==void 0?a:i,{owner:n}))}}for(const s in t)e[s]===void 0&&n.removeValue(s);return e}const Y_=new WeakMap,_se=[...uB,Rn,qo],Fse=n=>_se.find(cB(n)),X_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"],jse=Ax.length;class Use{scrapeMotionValuesFromProps(e,t,r){return{}}constructor({parent:e,props:t,presenceContext:r,reducedMotionConfig:s,blockInitialAnimation:i,visualState:o},a={}){this.resolveKeyframes=(d,h,p,m)=>new this.KeyframeResolver(d,h,p,m,this),this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=jx,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>dt.render(this.render,!1,!0);const{latestValues:l,renderState:c}=o;this.latestValues=l,this.baseTarget={...l},this.initialValues=t.initial?{...l}:{},this.renderState=c,this.parent=e,this.props=t,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.options=a,this.blockInitialAnimation=!!i,this.isControllingVariants=Qy(t),this.isVariantNode=OL(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:u,...f}=this.scrapeMotionValuesFromProps(t,{},this);for(const d in f){const h=f[d];l[d]!==void 0&&Mn(h)&&(h.set(l[d],!1),o0(u)&&u.add(d))}}mount(e){this.current=e,Y_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((t,r)=>this.bindToMotionValue(r,t)),q_.current||Lse(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:yE.current,process.env.NODE_ENV!=="production"&&iE(this.shouldReduceMotion!==!0,"You have Reduced Motion enabled on your device. Animations may not appear as expected."),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){Y_.delete(this.current),this.projection&&this.projection.unmount(),Ui(this.notifyUpdate),Ui(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){const r=Al.has(e),s=t.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&dt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on("renderRequest",this.scheduleRender);this.valueSubscriptions.set(e,()=>{s(),i(),t.owner&&t.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in ku){const t=ku[e];if(!t)continue;const{isEnabled:r,Feature:s}=t;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Kt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let r=0;r<X_.length;r++){const s=X_[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=Bse(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){const r=this.parent?this.parent.getVariantContext()||{}:{};return this.props.initial!==void 0&&(r.initial=this.props.initial),r}const t={};for(let r=0;r<jse;r++){const s=Ax[r],i=this.props[s];(Eh(i)||i===!1)&&(t[s]=i)}return t}addVariantChild(e){const t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){const r=this.values.get(e);t!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);const t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&t!==void 0&&(r=Dh(t===null?void 0:t,{owner:this}),this.addValue(e,r)),r}readValue(e,t){var r;let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:(r=this.getBaseTargetFromProps(this.props,e))!==null&&r!==void 0?r:this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(sB(s)||rB(s))?s=parseFloat(s):!Fse(s)&&qo.test(t)&&(s=AB(e,t)),this.setBaseTarget(e,Mn(s)?s.get():s)),Mn(s)?s.get():s}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;const{initial:r}=this.props;let s;if(typeof r=="string"||typeof r=="object"){const o=Mx(this.props,r,(t=this.presenceContext)===null||t===void 0?void 0:t.custom);o&&(s=o[e])}if(r&&s!==void 0)return s;const i=this.getBaseTargetFromProps(this.props,e);return i!==void 0&&!Mn(i)?i:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new sE),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}class Z_ extends Use{constructor(){super(...arguments),this.KeyframeResolver=vB}sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:r}){delete t[e],delete r[e]}}function Vse(n){return window.getComputedStyle(n)}class Hse extends Z_{constructor(){super(...arguments),this.type="html"}readValueFromInstance(e,t){if(Al.has(t)){const r=$x(t);return r&&r.default||0}else{const r=Vse(e),s=(DL(t)?r.getPropertyValue(t):r[t])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:t}){return w_(e,t)}build(e,t,r,s){kx(e,t,r,s.transformTemplate)}scrapeMotionValuesFromProps(e,t,r){return Nx(e,t,r)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Mn(e)&&(this.childSubscription=e.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}renderInstance(e,t,r,s){VL(e,t,r,s)}}class zse extends Z_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(Al.has(t)){const r=$x(t);return r&&r.default||0}return t=HL.has(t)?t:yx(t),e.getAttribute(t)}measureInstanceViewportBox(){return Kt()}scrapeMotionValuesFromProps(e,t,r){return $L(e,t,r)}build(e,t,r,s){Tx(e,t,r,this.isSVGTag,s.transformTemplate)}renderInstance(e,t,r,s){zL(e,t,r,s)}mount(e){this.isSVGTag=Ox(e.tagName),super.mount(e)}}const $se=(n,e)=>xx(n)?new zse(e,{enableHardwareAcceleration:!1}):new Hse(e,{allowProjection:n!==P.Fragment,enableHardwareAcceleration:!0}),Gse={...Nre,...Vte,...Ise,...{layout:{ProjectionNode:J_,MeasureLayout:E_}}},Wse=Yee((n,e)=>Ote(n,e,Gse,$se));function eF(){const n=P.useRef(!1);return gx(()=>(n.current=!0,()=>{n.current=!1}),[]),n}function Kse(){const n=eF(),[e,t]=P.useState(0),r=P.useCallback(()=>{n.current&&t(e+1)},[e]);return[P.useCallback(()=>dt.postRender(r),[r]),e]}class Qse extends V.Component{getSnapshotBeforeUpdate(e){const t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){const r=this.props.sizeRef.current;r.height=t.offsetHeight||0,r.width=t.offsetWidth||0,r.top=t.offsetTop,r.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function Jse({children:n,isPresent:e}){const t=P.useId(),r=P.useRef(null),s=P.useRef({width:0,height:0,top:0,left:0}),{nonce:i}=P.useContext(px);return P.useInsertionEffect(()=>{const{width:o,height:a,top:l,left:c}=s.current;if(e||!r.current||!o||!a)return;r.current.dataset.motionPopId=t;const u=document.createElement("style");return i&&(u.nonce=i),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(`
|
438
438
|
[data-motion-pop-id="${t}"] {
|
439
439
|
position: absolute !important;
|
440
440
|
width: ${o}px !important;
|
@@ -442,4 +442,4 @@ Use Chrome, Firefox or Internet Explorer 11`)}}).call(this)}).call(this,i("_proc
|
|
442
442
|
top: ${l}px !important;
|
443
443
|
left: ${c}px !important;
|
444
444
|
}
|
445
|
-
`),()=>{document.head.removeChild(u)}},[e]),k.jsx(
|
445
|
+
`),()=>{document.head.removeChild(u)}},[e]),k.jsx(Qse,{isPresent:e,childRef:r,sizeRef:s,children:V.cloneElement(n,{ref:r})})}const bE=({children:n,initial:e,isPresent:t,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o})=>{const a=WL(qse),l=P.useId(),c=P.useMemo(()=>({id:l,initial:e,isPresent:t,custom:s,onExitComplete:u=>{a.set(u,!0);for(const f of a.values())if(!f)return;r&&r()},register:u=>(a.set(u,!1),()=>a.delete(u))}),i?[Math.random()]:[t]);return P.useMemo(()=>{a.forEach((u,f)=>a.set(f,!1))},[t]),V.useEffect(()=>{!t&&!a.size&&r&&r()},[t]),o==="popLayout"&&(n=k.jsx(Jse,{isPresent:t,children:n})),k.jsx(Gy.Provider,{value:c,children:n})};function qse(){return new Map}function Yse(n){return P.useEffect(()=>()=>n(),[])}const Sl=n=>n.key||"";function Xse(n,e){n.forEach(t=>{const r=Sl(t);e.set(r,t)})}function Zse(n){const e=[];return P.Children.forEach(n,t=>{P.isValidElement(t)&&e.push(t)}),e}const eie=({children:n,custom:e,initial:t=!0,onExitComplete:r,exitBeforeEnter:s,presenceAffectsLayout:i=!0,mode:o="sync"})=>{ji(!s,"Replace exitBeforeEnter with mode='wait'");const a=P.useContext(vx).forceRender||Kse()[0],l=eF(),c=Zse(n);let u=c;const f=P.useRef(new Map).current,d=P.useRef(u),h=P.useRef(new Map).current,p=P.useRef(!0);if(gx(()=>{p.current=!1,Xse(c,h),d.current=u}),Yse(()=>{p.current=!0,h.clear(),f.clear()}),p.current)return k.jsx(k.Fragment,{children:u.map(v=>k.jsx(bE,{isPresent:!0,initial:t?void 0:!1,presenceAffectsLayout:i,mode:o,children:v},Sl(v)))});u=[...u];const m=d.current.map(Sl),y=c.map(Sl),b=m.length;for(let v=0;v<b;v++){const A=m[v];y.indexOf(A)===-1&&!f.has(A)&&f.set(A,void 0)}return o==="wait"&&f.size&&(u=[]),f.forEach((v,A)=>{if(y.indexOf(A)!==-1)return;const w=h.get(A);if(!w)return;const x=m.indexOf(A);let C=v;if(!C){const S=()=>{f.delete(A);const M=Array.from(h.keys()).filter(O=>!y.includes(O));if(M.forEach(O=>h.delete(O)),d.current=c.filter(O=>{const R=Sl(O);return R===A||M.includes(R)}),!f.size){if(l.current===!1)return;a(),r&&r()}};C=k.jsx(bE,{isPresent:!1,onExitComplete:S,custom:e,presenceAffectsLayout:i,mode:o,children:w},Sl(w)),f.set(A,C)}u.splice(x,0,C)}),u=u.map(v=>{const A=v.key;return f.has(A)?v:k.jsx(bE,{isPresent:!0,presenceAffectsLayout:i,mode:o,children:v},Sl(v))}),process.env.NODE_ENV!=="production"&&o==="wait"&&u.length>1&&console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`),k.jsx(k.Fragment,{children:f.size?u:u.map(v=>P.cloneElement(v))})},tie=P.forwardRef(({isPreviewMode:n=!1,initialContent:e,enableCollaboration:t,collaborationId:r,username:s,onAutoSave:i,renderToolRightSection:o,renderToolLeftSection:a,walletAddress:l,onChange:c,handleImageUploadToIpfs:u,onCollaboratorChange:f},d)=>{const[h,p]=P.useState(!1),m=P.useRef(null),{editor:y,ref:b,loading:v,ydoc:A}=Dee({isPreviewMode:n,initialContent:e,enableCollaboration:t,collaborationId:r,walletAddress:l,username:s,onAutoSave:i,onChange:c,onCollaboratorChange:f});return P.useImperativeHandle(d,()=>({getEditor:()=>y,getYdoc:()=>A}),[y,A]),P.useEffect(()=>{if(!y)return;const w=S=>{const{key:M}=S;return M.length===1},x=S=>{w(S)&&(m.current&&clearTimeout(m.current),p(!0),m.current=setTimeout(()=>{p(!1)},500))},C=y.view.dom;return C.addEventListener("keydown",x),()=>{C.removeEventListener("keydown",x),m.current&&clearTimeout(m.current)}},[y]),!y||v?k.jsxs("div",{className:"w-screen h-screen flex flex-col gap-4 justify-center items-center",children:[k.jsx(hN,{}),k.jsx("p",{children:"Loading Editor..."})]}):k.jsx("div",{"data-cy":"single-webpage",className:"bg-[#f8f9fa] h-full w-full overflow-hidden no-scrollbar",children:k.jsxs("div",{className:"flex flex-col justify-between items-center",children:[k.jsx("div",{className:"flex items-center w-full h-16 fixed z-10 px-4 bg-[#f8f9fa]",children:k.jsxs("div",{className:"flex items-center justify-between gap-2 w-full",children:[k.jsx("div",{className:"grow",children:a==null?void 0:a({editor:y.getJSON()})}),!n&&k.jsx("div",{className:"grow relative hidden xl:block",children:k.jsx(gz,{uploadToIpfs:u,editor:y})}),o==null?void 0:o({editor:y.getJSON()})]})}),k.jsx("main",{className:"rounded-[8px] flex flex-col justify-start items-center gap-2 ",children:k.jsx("div",{className:"mt-8 lg:mt-[5rem] w-screen flex justify-center relative",children:k.jsx("div",{className:"px-4 pt-12 sm:p-[88px] h-screen bg-white w-full sm:w-[70%] max-w-[856px]",children:k.jsxs("div",{ref:b,className:"w-full h-full overflow-y-scroll overflow-x-hidden no-scrollbar",children:[!n&&k.jsxs("div",{children:[k.jsx(az,{editor:y}),k.jsx(pz,{editor:y,appendTo:b})]}),k.jsx(mz,{isPreviewMode:n,children:k.jsx(GH,{editor:y})})]})})})}),!n&&k.jsx(eie,{children:!h&&k.jsx(Wse.div,{initial:{y:50,opacity:0},animate:{y:0,opacity:1},exit:{y:50,opacity:0},transition:{duration:.2},className:he("flex xl:hidden items-center w-full h-16 fixed z-10 px-4 bg-[#f8f9fa] bottom-0"),children:k.jsx(Lee,{uploadToIpfs:u,editor:y})})})]})})});it.DdocEditor=tie,Object.defineProperty(it,Symbol.toStringTag,{value:"Module"})});
|