tempest.games 0.2.69 → 0.2.71
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/CHANGELOG.md +14 -0
- package/app/assets/index-BQfBw87O.js +66 -0
- package/app/index.html +1 -1
- package/bin/backend.bun.js +29 -7
- package/bin/backend.worker.game.bun.js +29 -7
- package/bin/backend.worker.tribunal.bun.js +133 -111
- package/bin/frontend.bun.js +29 -7
- package/package.json +6 -6
- package/app/assets/index-CCuiNaIa.js +0 -109
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function vk(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const a in r)if(a!=="default"&&!(a in t)){const u=Object.getOwnPropertyDescriptor(r,a);u&&Object.defineProperty(t,a,u.get?u:{enumerable:!0,get:()=>r[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))r(a);new MutationObserver(a=>{for(const u of a)if(u.type==="childList")for(const c of u.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&r(c)}).observe(document,{childList:!0,subtree:!0});function n(a){const u={};return a.integrity&&(u.integrity=a.integrity),a.referrerPolicy&&(u.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?u.credentials="include":a.crossOrigin==="anonymous"?u.credentials="omit":u.credentials="same-origin",u}function r(a){if(a.ep)return;a.ep=!0;const u=n(a);fetch(a.href,u)}})();function bk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Jh={exports:{}},Fa={};var AS;function Sk(){if(AS)return Fa;AS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,a,u){var c=null;if(u!==void 0&&(c=""+u),a.key!==void 0&&(c=""+a.key),"key"in a){u={};for(var f in a)f!=="key"&&(u[f]=a[f])}else u=a;return a=u.ref,{$$typeof:t,type:r,key:c,ref:a!==void 0?a:null,props:u}}return Fa.Fragment=e,Fa.jsx=n,Fa.jsxs=n,Fa}var ES;function wk(){return ES||(ES=1,Jh.exports=Sk()),Jh.exports}var F=wk();function ft(t){return ff(Ft.STORE,t,void 0)}function Lx(t){return cy(Ft.STORE,t,void 0)}function xk(t){return ty(Ft.STORE,t)}function nt(...t){return An(Ft.STORE,...t)}function Tk(t){return pM(Ft.STORE,t)}function Ak(t){return yM(t,Ft.STORE)}const Kr={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"},Xh=t=>(e,n,r,a,...u)=>{console[t](`${e} ${Kr[n]} \`${r}\` ${a}`,...u)},Ek={error:Xh("error"),info:Xh("info"),warn:Xh("warn")};var Ok=class{logLevel;filter;logger;constructor(t,e,n=Ek){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{if(this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.error(...t):e&&this.logger.error(...e)}};info=(...t)=>{if(this.logLevel==="info"){const e=this.filter?.(...t)??!0;e===!0?this.logger.info(...t):e&&this.logger.info(...e)}};warn=(...t)=>{if(this.logLevel!=="error"&&this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.warn(...t):e&&this.logger.warn(...e)}}};function Sc(t,e){return[t,e].sort().join("")}function _k(t){if(typeof t!="string")return null;const[e,n]=t.split("==");if(!n)return null;const r=e.slice(4),[a,u]=n.split("++");return r&&a&&u?[r,a,u]:null}function vi(t){return sT(Ft.STORE,t)}function Rk(t){return tM(Ft.STORE,t)}function De(...t){Lt(Ft.STORE,...t)}function Ck(t,e,n=af()){return fM(Ft.STORE,t,e,n)}function kk(t){return Zx(Ft.STORE,t)}function Mk(t,e=af()){return Xm(Ft.STORE,t,e)}function Dk(t){return Object.entries(t)}function qr(t){return JSON.parse(t)}const zt=t=>JSON.stringify(t);function Nk(t){const e={};let n=0;for(const r of t)e[r]=n,e[n]=r,++n;return e}const Vx="",Ux="",Kx="",qx="",OS=t=>{switch(typeof t){case"string":return Kx+t;case"number":return qx+t;case"boolean":return Vx+ +t;case"object":return Ux}},_S=t=>{switch(t[0]){case Kx:return t.slice(1);case qx:return+t.slice(1);case Vx:return t.slice(1)==="1";case Ux:return null}},RS=Nk(["add","delete","clear"]);var Ym=class Xa extends Set{mode="record";subject=new We;constructor(e){super(e)}READONLY_VIEW=this;toJSON(){return[...this]}static fromJSON(e){return new Xa(e)}add(e){const n=super.add(e);return this.mode==="record"&&this.emit({type:"add",value:e}),n}clear(){const e=this.mode==="record"?[...this]:null;super.clear(),e&&this.emit({type:"clear",values:e})}delete(e){const n=super.delete(e);return this.mode==="record"&&this.emit({type:"delete",value:e}),n}subscribe(e,n){return this.subject.subscribe(e,n)}emit(e){this.subject.next(Xa.packUpdate(e))}do(e){this.mode="playback";const n=Xa.unpackUpdate(e);switch(n.type){case"add":this.add(n.value);break;case"delete":this.delete(n.value);break;case"clear":this.clear()}return this.mode="record",null}undo(e){const n=Xa.unpackUpdate(e);switch(this.mode="playback",n.type){case"add":this.delete(n.value);break;case"delete":this.add(n.value);break;case"clear":{const r=n.values;for(const a of r)this.add(a)}}return this.mode="record",null}static packUpdate(e){const n=RS[e.type]+"";return e.type==="clear"?n+e.values.map(OS).join(""):n+OS(e.value)}static unpackUpdate(e){const[n,r]=e.split(""),a=RS[n];return a==="clear"?{type:"clear",values:r.split("").map(_S)}:{type:a,value:_S(r)}}};function af(t=Math.random){return t().toString(36).slice(2)}function Re(t){for(;t.child!==null;)t=t.child;return t}function Jm(t){for(;t.parent!==null;)t=t.parent;return t}const $k=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function Br(t){const e=Object.prototype.toString.call(t);return $k.test(e)}function CS(t,e){return Br(t)?t(e):t}var Kp=class extends Promise{fate;resolve;reject;done=!1;constructor(t){let e,n;super((r,a)=>{e=r,n=a}),this.resolve=e,this.reject=n,this.use(t instanceof Promise?t:new Promise(t))}pass(t,e){t===this.fate&&(this.resolve(e),this.done=!0)}fail(t,e){t===this.fate&&(this.reject(e),this.done=!0)}use(t){if(this!==t)if(t instanceof Promise){const e=t;this.fate=e,e.then(n=>{this.pass(e,n)},n=>{this.fail(e,n)})}else this.resolve(t),this.fate=void 0}},We=class{Subscriber;subscribers=new Map;subscribe(t,e){return this.subscribers.set(t,e),()=>{this.unsubscribe(t)}}unsubscribe(t){this.subscribers.delete(t)}next(t){const e=this.subscribers.values();for(const n of e)n(t)}},jk=class extends We{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}},Bk=class Ix{_buffer;_index=0;constructor(e){let n;typeof e=="number"?n=e:n=e.length,this._buffer=Array.from({length:n})}get buffer(){return this._buffer}get index(){return this._index}add(e){this._buffer[this._index]=e,this._index=(this._index+1)%this._buffer.length}copy(){const e=new Ix([...this._buffer]);return e._index=this._index,e}};function zr(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}var Xn=class extends Map{deleted=new Set;changed=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t))return this.source.get(t)}set(t,e){return this.deleted.delete(t),this.source.has(t)&&this.changed.add(t),super.set(t,e)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)&&(this.deleted.add(t),this.changed.delete(t)),super.delete(t)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const[t,e]of this.source)!this.deleted.has(t)&&!this.changed.has(t)&&(yield[t,e])}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(const t of this.source.keys())!this.deleted.has(t)&&!this.changed.has(t)&&(yield t)}*values(){for(const[,t]of this[Symbol.iterator]())yield t}forEach(t){for(const[e,n]of this[Symbol.iterator]())t(n,e,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},Px=class extends Set{deleted=new Set;source;constructor(t){super(),this.source=t}add(t){return this.source.has(t)?(this.deleted.delete(t),this):super.add(t)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)?(this.deleted.add(t),!0):super.delete(t)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const t of this.source)this.deleted.has(t)||(yield t)}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},zk=class extends Map{deleted=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t)){const e=new Px(this.source.get(t));return super.set(t,e),e}}set(t,e){return this.deleted.delete(t),super.set(t,e)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.deleted.add(t),super.delete(t)}},Ii=class Hx{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,n)=>`${e}:${n}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,n){let r=this.relations.get(e),a=this.relations.get(n);r?r.add(n):(r=new Set([n]),this.relations.set(e,r)),a?a.add(e):(a=new Set([e]),this.relations.set(n,a))}deleteRelation(e,n){const r=this.relations.get(e);if(r){r.delete(n),r.size===0&&this.relations.delete(e);const a=this.relations.get(n);a&&(a.delete(e),a.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(e,n){this.relations.set(e,new Set(n));for(const r of n){const a=new Set().add(e);this.relations.set(r,a)}}replaceRelationsSafely(e,n){const r=this.relations.get(e);let a=this.isAType?.(e)?e:void 0,u=a===void 0?e:void 0;if(r)for(const c of r){a??=c,u??=c;const f=this.relations.get(c);f&&(f.size===1?this.relations.delete(c):f.delete(e),this.contents.delete(this.makeContentKey(a,u)))}this.relations.set(e,new Set(n));for(const c of n){let f=this.relations.get(c);f?f.add(e):(f=new Set().add(e),this.relations.set(c,f))}}getContentInternal(e){return this.contents.get(e)}setContent(e,n){this.contents.set(e,n)}deleteContent(e){this.contents.delete(e)}constructor(e,n){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,this.isAType=n?.isAType??null,this.isBType=n?.isBType??null,this.isContent=n?.isContent??null,n?.makeContentKey&&(this.makeContentKey=n.makeContentKey),!n?.externalStore){const r=n?.source;r===void 0&&(this.relations=new Map(e.relations?.map(([a,u])=>[a,new Set(u)])),this.contents=new Map(e.contents)),r&&(this.relations=new zk(r.relations),this.contents=new Xn(r.contents))}if(n?.externalStore){const r=n.externalStore;this.has=(a,u)=>r.has(a,u),this.addRelation=(a,u)=>{r.addRelation(a,u)},this.deleteRelation=(a,u)=>{r.deleteRelation(a,u)},this.replaceRelationsSafely=(a,u)=>{r.replaceRelationsSafely(a,u)},this.replaceRelationsUnsafely=(a,u)=>{r.replaceRelationsUnsafely(a,u)},this.getRelatedKeys=(a=>r.getRelatedKeys(a)),r.getContent&&(this.getContentInternal=a=>r.getContent(a),this.setContent=(a,u)=>{r.setContent(a,u)},this.deleteContent=a=>{r.deleteContent(a)});for(const[a,u]of e.relations??[]){let c=this.isAType?.(a)?a:void 0,f=c===void 0?a:void 0;for(const h of u)c??=h,f??=h,this.addRelation(c,f)}for(const[a,u]of e.contents??[])this.setContent(a,u)}n?.warn&&(this.warn=n.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,n])=>[e,[...n]]),contents:[...this.contents.entries()]}}set(...e){let n,r,a;switch(e.length){case 1:{const u=e[0];n=u[this.a],r=u[this.b],a=void 0;break}case 2:{const u=e[0];typeof u=="string"?[n,r]=e:(n=u[this.a],r=u[this.b],a=e[1]);break}default:n=e[0],r=e[1],a=e[2];break}switch(this.cardinality){case"1:1":{const u=this.getRelatedKey(n);u&&u!==r&&this.delete(n,u)}case"1:n":{const u=this.getRelatedKey(r);u&&u!==n&&this.delete(u,r)}break}if(a){const u=this.makeContentKey(n,r);this.setContent(u,a)}return this.addRelation(n,r),this}delete(e,n){n=typeof n=="string"?n:e[this.b];const r=typeof e=="string"?e:e[this.a];if(r===void 0&&typeof n=="string"){const a=this.getRelatedKeys(n);if(a)for(const u of a)this.delete(u,n)}else if(typeof r=="string"&&n===void 0){const a=this.getRelatedKeys(r);if(a)for(const u of a)this.delete(r,u)}else if(typeof r=="string"&&typeof n=="string"){this.deleteRelation(r,n);const a=this.makeContentKey(r,n);this.deleteContent(a)}return this}getRelatedKey(e){const n=this.getRelatedKeys(e);if(n){n.size>1&&this.warn?.(`${n.size} related keys were found for key "${e}": (${[...n].map(a=>`"${a}"`).join(", ")}). Only one related key was expected.`);let r;for(const a of n){r=a;break}return r}}replaceRelations(e,n,r){const a=!Array.isArray(n),u=a?Object.keys(n):n;if(r?.reckless?this.replaceRelationsUnsafely(e,u):this.replaceRelationsSafely(e,u),a)for(const c of u){const f=this.makeContentKey(e,c),h=n[c];this.setContent(f,h)}return this}getContent(e,n){const r=this.makeContentKey(e,n);return this.getContentInternal(r)}getRelationEntries(e){const n=e[this.a],r=e[this.b];if(n!==void 0&&r===void 0){const a=this.getRelatedKeys(n);if(a)return[...a].map(u=>[u,this.getContent(n,u)])}if(n===void 0&&r!==void 0){const a=this.getRelatedKeys(r);if(a)return[...a].map(u=>[u,this.getContent(u,r)])}return[]}has(e,n){return n?this.getRelatedKeys(e)?.has(n)??!1:this.relations.has(e)}overlay(){const e={source:this,makeContentKey:this.makeContentKey};return this.isAType&&(e.isAType=this.isAType),this.isBType&&(e.isBType=this.isBType),this.isContent&&(e.isContent=this.isContent),this.warn&&(e.warn=this.warn),new Hx({between:[this.a,this.b],cardinality:this.cardinality},e)}incorporate(e){const{relations:n,contents:r}=e;for(const[a,u]of n)if(u instanceof Px){const{source:c}=u;for(const f of u.iterateOwn())c.add(f)}else this.relations.set(a,u);for(const a of n.deleted)this.relations.delete(a);for(const[a,u]of r)this.contents.set(a,u);for(const a of r.deleted)this.contents.delete(a)}};function Lk(t){return t.startsWith("🔍 ")}const Vk=t=>{t.logger.info("🪂","transaction",t.transactionMeta.update.token.key,"Aborting transaction"),t.parent.child=null};function Xm(t,e,n){return(...r)=>ct(t,e).run(r,n)}function Uk(t,e,n){const{token:r,update:{newValue:a,oldValue:u}}=e;Lt(t,r,n==="newValue"?a:u)}function Kk(t){const{stack:e}=t;return e?`
|
|
2
|
+
`+e.split(`
|
|
3
|
+
`)?.slice(1)?.join(`
|
|
4
|
+
`):""}function Fx(t,e,n,r="any"){const a=e,u=zt(n),c=[],f=Re(t);if(Array.isArray(a))for(const y of a){const g=zt(y);f.molecules.get(g)?t.moleculeGraph.set(g,u,{source:g}):c.push(g)}else{const y=zt(a);f.molecules.get(y)?t.moleculeGraph.set(y,u,{source:y}):c.push(y)}const h=new We;c.length===0&&f.molecules.set(u,{key:n,stringKey:u,dependsOn:r,subject:h});const m={type:"molecule_creation",key:n,provenance:a,timestamp:Date.now()};Tn(f)&&f.transactionMeta.phase==="building"?f.transactionMeta.update.subEvents.push(m):f.on.moleculeCreation.next(m);for(const y of c){const g=t.disposalTraces.buffer.find(b=>b?.key===y);t.logger.error("❌","key",n,"allocation failed:",`Could not allocate to ${y} in store "${t.config.name}".`,g?`
|
|
5
|
+
${y} was most recently disposed
|
|
6
|
+
${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function Zm(t,e){const n=zt(e),r=t.molecules.get(n);if(!r){const b=t.disposalTraces.buffer.find(S=>S?.key===n);t.logger.error("❌","key",e,"deallocation failed:",`Could not find allocation for ${n} in store "${t.config.name}".`,b?`
|
|
7
|
+
This state was most recently deallocated
|
|
8
|
+
${b.trace}`:`No previous disposal trace for ${n} was found.`);return}r.subject.next();const a=t.keyRefsInJoins.getRelatedKeys(n);if(a)for(const b of a){const S=t.joins.get(b);S&&S.relations.delete(e)}else{const b=_k(e);if(b){const[,S,x]=b,T=t.keyRefsInJoins.getRelatedKey(Sc(S,x));if(T){const M=t.joins.get(T);M&&M.relations.delete(S,x)}}}t.keyRefsInJoins.delete(n);const u=[],c=[],f=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:n});if(f)for(const[b,{source:S}]of f)S===n?Zm(t,qr(b)):u.push(S);const h=t.moleculeData.getRelatedKeys(r.stringKey);if(h)for(const b of h){const S=t.families.get(b),x=An(t,S,e);c.push([S.key,x]),lf(t,S,e)}const m={type:"molecule_disposal",key:r.key,values:c,provenance:u,timestamp:Date.now()};t.molecules.delete(n);const y=Tn(t)&&t.transactionMeta.phase==="building";y&&t.transactionMeta.update.subEvents.push(m),t.moleculeGraph.delete(r.stringKey),t.keyRefsInJoins.delete(r.stringKey),t.moleculeData.delete(r.stringKey),y||t.on.moleculeDisposal.next(m),t.molecules.delete(r.stringKey);const g=Kk(new Error);t.disposalTraces.add({key:n,trace:g})}function kS(t,e,n,r){const a=zt(n),u=Re(t),c=u.molecules.get(a);if(!c){const g=t.disposalTraces.buffer.find(b=>b?.key===a);return t.logger.error("❌","key",a,"claim failed:",`Could not allocate to ${a} in store "${t.config.name}".`,g?`
|
|
9
|
+
${a} was most recently disposed
|
|
10
|
+
${g.trace}`:`No previous disposal trace for ${a} was found.`),n}const f=zt(e),h=u.molecules.get(f);if(!h){const g=t.disposalTraces.buffer.find(b=>b?.key===f);return t.logger.error("❌","key",n,"claim failed:",`Could not allocate to ${f} in store "${t.config.name}".`,g?`
|
|
11
|
+
${f} was most recently disposed
|
|
12
|
+
${g.trace}`:`No previous disposal trace for ${f} was found.`),n}const m=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:c.stringKey}).filter(([,{source:g}])=>g!==a).map(([g])=>qr(g));r&&u.moleculeGraph.delete(a),u.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:c.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:c.key,exclusive:!!r,from:m,to:[h.key],timestamp:Date.now()};return Tn(u)&&u.transactionMeta.phase==="building"&&u.transactionMeta.update.subEvents.push(y),n}function qk(t,e,n){switch(n){case"newValue":Gx(t,e);break;case"oldValue":lf(t,e.token);break}}function Ik(t,e,n){switch(n){case"newValue":lf(t,e.token);break;case"oldValue":Gx(t,e),e.subType==="atom"&&t.valueMap.set(e.token.key,e.value);break}}function Gx(t,e){const{token:n}=e;e.subType==="writable"&&e.value?Lt(t,n,e.value):An(t,n)}function Pk(t,e,n){switch(n){case"newValue":Fx(t,e.provenance,e.key);break;case"oldValue":Zm(t,e.key);break}}function Hk(t,e,n){switch(n){case"newValue":Zm(t,e.key);break;case"oldValue":Fx(t,e.provenance.map(qr),e.key);for(const[r,a]of e.values){const u=t.families.get(r);if(u){An(t,u,e.key);const c=`${r}(${zt(e.key)})`;t.valueMap.set(c,a)}}break}}function Fk(t,e,n){switch(n){case"newValue":for(const r of e.to)kS(t,r,e.key,e.exclusive?"exclusive":void 0);break;case"oldValue":{let r="exclusive";for(const a of e.from)kS(t,a,e.key,r),r=void 0}break}}function wo(t,e,n){const r=n==="newValue"?e.subEvents:[...e.subEvents].reverse();for(const a of r)switch(a.type){case"atom_update":Uk(t,a,n);break;case"state_creation":qk(t,a,n);break;case"state_disposal":Ik(t,a,n);break;case"molecule_creation":Pk(t,a,n);break;case"molecule_disposal":Hk(t,a,n);break;case"molecule_transfer":Fk(t,a,n);break;case"transaction_outcome":wo(t,a,n);break}}function ul(t){return"epoch"in t.transactionMeta}function Tn(t){return"phase"in t.transactionMeta}function Yx(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function Jx(t,e){return t.transactionMeta.epoch.get(e)}function Gk(t,e){const n=Yx(t,e);if(n!==void 0)return Jx(t,n)}function Qm(t,e,n){t.transactionMeta.epoch.set(e,n)}function Yk(t,e,n){const r=Yx(t,e);r!==void 0&&t.transactionMeta.epoch.set(r,n)}function Jk(t,e){const n=Re(t),{parent:r}=n;n.transactionMeta.phase="applying",n.transactionMeta.update.output=e,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{subEvents:a}=n.transactionMeta.update;t.logger.info("🛄","transaction",n.transactionMeta.update.token.key,`applying ${a.length} subEvents:`,a),wo(r,n.transactionMeta.update,"newValue"),ul(r)?(Yk(r,n.transactionMeta.update.token.key,n.transactionMeta.update.epoch),ct(t,{key:n.transactionMeta.update.token.key,type:"transaction"})?.subject.next(n.transactionMeta.update),t.logger.info("🛬","transaction",n.transactionMeta.update.token.key,"applied")):Tn(r)&&r.transactionMeta.update.subEvents.push(n.transactionMeta.update),r.on.transactionApplying.next(null)}function Xx(t,e,n){const{epoch:r,actionContinuities:a}=t.transactionMeta;a.set(e,n),r.has(e)||r.set(e,-1)}function Xk(t){return{store:t}}const Zk=(t,e,n,r)=>{const a=Re(t),u={parent:a,child:null,on:a.on,loggers:a.loggers,logger:a.logger,config:a.config,atoms:new Xn(a.atoms),atomsThatAreDefault:new Set(a.atomsThatAreDefault),families:new Xn(a.families),joins:new Xn(a.joins),operation:{open:!1},readonlySelectors:new Xn(a.readonlySelectors),timelines:new Xn(a.timelines),timelineTopics:a.timelineTopics.overlay(),trackers:new Map,transactions:new Xn(a.transactions),selectorAtoms:a.selectorAtoms.overlay(),selectorGraph:a.selectorGraph.overlay(),writableSelectors:new Xn(a.writableSelectors),valueMap:new Xn(a.valueMap),defaults:a.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new Xn(a.molecules),moleculeGraph:a.moleculeGraph.overlay(),moleculeData:a.moleculeData.overlay(),keyRefsInJoins:a.keyRefsInJoins.overlay(),miscResources:new Xn(a.miscResources)},c=Gk(t,e.key),f={phase:"building",update:{type:"transaction_outcome",token:e,id:r,epoch:c===void 0?NaN:c+1,timestamp:Date.now(),subEvents:[],params:n,output:void 0},toolkit:{get:((...m)=>An(h,...m)),set:((...m)=>{Lt(h,...m)}),reset:((...m)=>{iy(h,...m)}),run:(m,y=af())=>Xm(h,m,y),find:((...m)=>Ir(t,...m)),json:m=>Rs(h,m),dispose:((...m)=>{lf(h,...m)}),env:()=>Xk(h)}},h=Object.assign(u,{transactionMeta:f});return a.child=h,t.logger.info("🛫","transaction",e.key,"building with params:",n),h};function Zx(t,e){const{key:n}=e,r=t.transactions.has(n),a={key:n,type:"transaction",run:(c,f)=>{const h=Zk(t,zr(a),c,f);try{const{toolkit:m}=h.transactionMeta,y=e.do(m,...c);return Jk(h,y),y}catch(m){throw Vk(h),t.logger.warn("💥","transaction",n,"caught:",m),m}},install:c=>Zx(c,e),subject:new We};Re(t).transactions.set(n,a);const u=zr(a);return r||t.on.transactionCreation.next(u),u}var Qk=class{parent=null;child=null;valueMap=new Map;defaults=new Map;atoms=new Map;writableSelectors=new Map;readonlySelectors=new Map;atomsThatAreDefault=new Set;selectorAtoms=new Ii({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Ii({between:["upstreamSelectorKey","downstreamSelectorKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});trackers=new Map;families=new Map;joins=new Map;transactions=new Map;transactionMeta={epoch:new Map,actionContinuities:new Ii({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Ii({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Bk(100);molecules=new Map;moleculeGraph=new Ii({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Ii({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});keyRefsInJoins=new Ii({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});miscResources=new Map;on={atomCreation:new We,atomDisposal:new We,selectorCreation:new We,selectorDisposal:new We,timelineCreation:new We,transactionCreation:new We,transactionApplying:new jk(null),operationClose:new We,moleculeCreation:new We,moleculeDisposal:new We};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0};loggers=[new Ok("warn",(t,e,n)=>!Lk(n))];logger={error:(...t)=>{for(const e of this.loggers)e.error(...t)},info:(...t)=>{for(const e of this.loggers)e.info(...t)},warn:(...t)=>{for(const e of this.loggers)e.warn(...t)}};constructor(t,e=null){if(this.config={...e?.config,...t},e!==null){this.operation={...e?.operation},ul(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new Ii(e?.transactionMeta.actionContinuities.toJSON())});for(const[,r]of e.families)r.internalRoles?.includes("mutable")||r.internalRoles?.includes("join")||r.install(this);const n=new Set;for(const[,r]of e.atoms)if(!n.has(r.key)&&(r.install(this),r.type==="mutable_atom")){const a=Rs(e,r),u=uT(r);n.add(a.key),n.add(u.key)}for(const[,r]of e.readonlySelectors)r.install(this);for(const[,r]of e.writableSelectors)n.has(r.key)||r.install(this);for(const[,r]of e.transactions)r.install(this);for(const[,r]of e.timelines)r.install(this)}}};const Ft={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new Qk({name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0}),globalThis.ATOM_IO_IMPLICIT_STORE}};var Wk=class extends Error{constructor(t,e){super(`${Kr[t.type]} ${zt(t.key)} not found in store "${e.config.name}".`)}};function ct(t,e){let n,r=t;for(;r!==null;){switch(e.type){case"atom":case"mutable_atom":n=r.atoms.get(e.key);break;case"writable_pure_selector":case"writable_held_selector":n=r.writableSelectors.get(e.key);break;case"readonly_pure_selector":case"readonly_held_selector":n=r.readonlySelectors.get(e.key);break;case"atom_family":case"mutable_atom_family":case"writable_pure_selector_family":case"readonly_pure_selector_family":case"writable_held_selector_family":case"readonly_held_selector_family":n=r.families.get(e.key);break;case"timeline":n=r.timelines.get(e.key);break;case"transaction":n=r.transactions.get(e.key);break}if(n)return n;r=r.child}throw new Wk(e,t)}function Qx(t,e,n,r){const a=t.disposalTraces.buffer.find(u=>u?.key===zt(r));switch(t.logger.error("❌",e.type,e.key,"gets a fallback value because key",r,"is not allocated",a?`This key was previously disposed:
|
|
13
|
+
${a.trace}`:"(no previous disposal trace found)"),n.type){case"mutable_atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=new n.class;return t.defaults.set(n.key,u),u.READONLY_VIEW}case"atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=n.default,c=u(r);return t.defaults.set(n.key,c),c}case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const u=n.default(r);return t.defaults.set(n.key,u),u}}}function jc(t,e){const{type:n,key:r,catch:a}=e;switch(n){case"readonly_pure_selector":case"writable_pure_selector":{let u;t.logger.info("🧮",n,r,"computing value");try{if(u=e.getFrom(t),u instanceof Promise)return u.catch(c=>{if(t.logger.error("💥",n,r,"rejected:",c),a){for(const f of a)if(c instanceof f)return c}throw c})}catch(c){if(t.logger.error("💥",n,r,"rejected:",c),a){for(const f of a)if(c instanceof f)return Kn(t,e,c)}throw c}return Kn(t,e,u)}case"atom":{let u;if(Br(e.default))try{u=e.default(),u instanceof Promise&&(u=u.catch(c=>{if(t.logger.error("💥",n,r,"rejected:",c),a){for(const f of a)if(c instanceof f)return c}throw c}))}catch(c){if(t.logger.error("💥",n,r,"rejected:",c),a){for(const f of a)if(c instanceof f)return u=Kn(t,e,c),t.logger.info("✨",e.type,r,"computed default",u),u}throw c}else u=e.default,t.logger.info("✨",e.type,r,"using static default",u);return Kn(t,e,u)}}}function _s(t,e,n){if(t.valueMap.has(e.key))return cT(t,e,n);t.logger.info("❔",e.type,e.key,"value not found in cache");const{key:r}=e;switch(e.type){case"readonly_held_selector":case"writable_held_selector":return t.logger.info("🧮",e.type,r,"computing value"),e.getFrom(t);case"writable_pure_selector":case"readonly_pure_selector":case"atom":return jc(t,e);case"mutable_atom":{const a=new e.class;return t.logger.info("✨",e.type,r,"created new instance",a),Kn(t,e,a)}}}function Wm(t,e){return ct(t,{key:e.family.key,type:`${e.type}_family`})}const MS={atom_family:"atom",molecule_family:"molecule",mutable_atom_family:"mutable_atom",readonly_held_selector_family:"readonly_held_selector",readonly_pure_selector_family:"readonly_pure_selector",writable_held_selector_family:"writable_held_selector",writable_pure_selector_family:"writable_pure_selector"},cl=Symbol("MUST_CREATE"),eM=Symbol("DO_NOT_CREATE");function fl(t,e,n,r){const a=zt(r),u=e.molecules.get(a);if(!u&&e.config.lifespan==="immortal"){const{type:f,key:h}=n;return e.logger.warn("💣","key",a,"was used to mint a counterfeit token for",f,`"${h}"`),{counterfeit:!0,key:`${h}(${a})`,type:MS[f],family:{key:h,subKey:a}}}let c;if(t===cl)e.logger.info("👪",n.type,n.key,"adds member",typeof r=="string"?`\`${r}\``:r),c=n.create(r),u&&e.moleculeData.set(a,n.key);else{const{type:f,key:h}=n;return{key:`${h}(${a})`,type:MS[f],family:{key:h,subKey:a}}}return c}function ey(t,...e){let n,r,a,u,c;if(e.length===1){if(c=e[0],"family"in c){const h=Wm(t,c);if(a=ct(t,h),u=qr(c.family.subKey),n=dl(t,h,u),"counterfeit"in c)return{token:c,family:a,subKey:u,isNew:!1};n?c=n:(r=fl(cl,t,h,u),c=r)}}else a=ct(t,e[0]),u=e[1],n=dl(t,a,u),n?c=n:(r=fl(cl,t,a,u),c=r);const f="counterfeit"in c;if(r&&f===!1&&a){let h;switch(c.type){case"readonly_pure_selector":case"readonly_held_selector":h="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":h="writable";break}const m={type:"state_creation",subType:h,token:c,timestamp:Date.now()};a.subject.next(m);const y=Re(t);if(c.family)if(ul(y))switch(c.type){case"atom":case"mutable_atom":t.on.atomCreation.next(c);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(c);break}else Tn(y)&&y.on.transactionApplying.state===null&&y.transactionMeta.update.subEvents.push(m)}return{token:c,family:a,subKey:u,isNew:!!r}}function An(t,...e){const{token:n,family:r,subKey:a}=ey(t,...e);return"counterfeit"in n&&r&&a?Qx(t,n,r,a):_s(t,ct(t,n))}function dl(t,e,n){const r=zt(n),a=`${e.key}(${r})`,u=Re(t);let c;switch(e.type){case"atom_family":case"mutable_atom_family":c=u.atoms.get(a);break;case"writable_held_selector_family":case"writable_pure_selector_family":c=u.writableSelectors.get(a);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":c=u.readonlySelectors.get(a);break}return c&&zr(c)}function Ir(t,e,n){const r=ct(t,e),a=dl(t,e,n);return a||fl(eM,t,r,n)}function Bc(t,e,n){const r=e.key,a="readonly_pure_selector_family",u={key:r,type:a},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",a,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`,x=Re(t),T={key:S,get:e.get(y)};return e.catch&&(T.catch=e.catch),oy(x,T,b)},internalRoles:n,subject:f,install:y=>Bc(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>Ir(t,...g)),json:g=>Rs(t,g)})};return t.families.set(r,m),u}function ty(t,e,n){const r={key:e.key,type:"atom_family"},a=t.families.get(e.key);a&&t.config.isProduction===!0&&t.logger.error("❗","atom_family",e.key,`Overwriting an existing ${Kr[a.type]} "${a.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const u=new We,f={...r,create:h=>{const m=zt(h),y={key:e.key,subKey:m},g=`${e.key}(${m})`,b=Re(t),S=e.default,x={key:g,default:Br(S)?()=>S(h):S};return e.effects&&(x.effects=e.effects(h)),e.catch&&(x.catch=e.catch),ff(b,x,y)},default:e.default,subject:u,install:h=>ty(h,e),internalRoles:n};return t.families.set(e.key,f),Br(e.default)===!1&&t.defaults.set(e.key,e.default),r}function Wx(t,e,n){const r=e.key,a="readonly_held_selector_family",u={key:r,type:a},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",a,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`;return sy(Re(t),{key:S,const:e.const(y),get:e.get(y)},b)},internalRoles:n,subject:f,install:y=>Wx(y,e),default:e.const};return t.families.set(r,m),u}function eT(t,e,n){const r=e.key,a="writable_held_selector_family",u={key:r,type:a},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",a,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`;return ay(Re(t),{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},b)},internalRoles:n,subject:f,install:y=>eT(y,e),default:e.const};return t.families.set(r,m),u}function ny(t,e,n){const r=e.key,a="writable_pure_selector_family",u={key:r,type:a},c=t.families.get(r);c&&t.config.isProduction===!0&&t.logger.error("❗",a,r,`Overwriting an existing ${Kr[c.type]} "${c.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new We,m={...u,create:y=>{const g=zt(y),b={key:r,subKey:g},S=`${r}(${g})`,x=Re(t),T={key:S,get:e.get(y),set:e.set(y)};return e.catch&&(T.catch=e.catch),ly(x,T,b)},internalRoles:n,subject:f,install:y=>ny(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>Ir(t,...g)),json:g=>Rs(t,g)})};return t.families.set(r,m),u}function tM(t,e){const n="set"in e,r="const"in e;return r&&n?eT(t,e,void 0):r?Wx(t,e,void 0):n?ny(t,e):Bc(t,e)}function lf(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],a=e[1];n=Ir(t,r,a)}try{ct(t,n)}catch{t.logger.error("❌",n.type,n.key,`could not be disposed because it was not found in the store "${t.config.name}".`);return}switch(n.type){case"atom":case"mutable_atom":hy(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":uM(t,n);break}}function tT(t,e){if(t.operation.open){const n=performance.now();return t.logger.info("🚫",e.type,e.key,`deferring setState at T-${n} until setState for "${t.operation.token.key}" is done`),n}return t.operation={open:!0,done:new Set,prev:new Map,timestamp:Date.now(),token:e,subEvents:[]},t.logger.info("⭕",e.type,e.key,`operation start in store "${t.config.name}"${Tn(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.token.key}"`:""}`),t}function nT(t){t.operation.open&&t.logger.info("🔴",t.operation.token.type,t.operation.token.key,`operation done in store "${t.config.name}"`),t.operation={open:!1},t.on.operationClose.next(t.operation)}const iT=(t,e)=>t.operation.open?t.operation.done.has(e):(t.logger.error("🐞","unknown",e,"isDone called outside of an operation. This is probably a bug in AtomIO."),!0),uf=(t,e)=>{if(!t.operation.open){t.logger.error("🐞","unknown",e,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}t.operation.done.add(e)};function qp(t,e,n,r,a){const{oldValue:u,newValue:c}=n,f="oldValue"in n,h=zr(e);if(r&&a){e.subject.next({newValue:c});const S={checkpoint:!0,type:"state_creation",subType:"writable",token:h,timestamp:Date.now(),value:c};t.operation.subEvents.push(S),a.subject.next(S);const x=Re(t);if(h.family)if(ul(x))switch(h.type){case"atom":case"mutable_atom":t.on.atomCreation.next(h);break;case"writable_pure_selector":case"writable_held_selector":t.on.selectorCreation.next(h);break}else Tn(x)&&x.on.transactionApplying.state===null&&x.transactionMeta.update.subEvents.push(S);return}const{key:m,subject:y,type:g}=e;let b;if(f?b={oldValue:sc(u)?u.READONLY_VIEW:u,newValue:sc(c)?c.READONLY_VIEW:c}:b={newValue:sc(c)?c.READONLY_VIEW:c},ul(t)){switch(g){case"mutable_atom":t.logger.info("📢",g,m,"is now (",c,") subscribers:",y.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":t.logger.info("📢",g,m,"went (",u,"->",c,") subscribers:",y.subscribers.keys())}y.next(b)}if(Tn(t)&&(g==="mutable_atom"||g==="atom")){if(t.on.transactionApplying.state===null){if(sc(c))return;const{timestamp:S}=t.operation,x={type:"atom_update",token:h,timestamp:S,update:b};t.transactionMeta.update.subEvents.push(x),t.logger.info("📁","atom",m,"stowed (",u,"->",c,")");return}if(dy(e,"tracker:signal")){const S=m.slice(1),x=t.atoms.get(S);_s(t,x,"mut").do(b.newValue)===null&&fy(t,x)}}}const DS=Symbol("UNSET"),Ip=(t,e,n)=>{let r,a;if(Br(n)){const u=_s(t,e,"mut");r=u,a=n(u)}else t.valueMap.has(e.key)?r=cT(t,e,"mut"):e.type==="atom"&&!Br(e.default)?r=e.default:r=DS,a=n;return t.logger.info("⭐","atom",e.key,"setting value",a),a=Kn(t,e,a),uf(t,e.key),fy(t,e),r===DS?{newValue:a}:{oldValue:r,newValue:a}};function Zh(t,e){switch(e.type){case"mutable_atom":return Ip(t,e,new e.class);case"atom":{let n;return Br(e.default)?n=jc(t,e):n=e.default,Ip(t,e,n)}}}function nM(t,e){let n;switch(e.type){case"atom":case"mutable_atom":n=Zh(t,e);break;case"writable_held_selector":{const r=hl(t,e.key);for(const u of r.values())qp(t,e,Zh(t,u),!1);const a=e.getFrom(t);n={oldValue:a,newValue:a}}break;case"writable_pure_selector":{const r=jc(t,e),a=hl(t,e.key);for(const u of a.values())qp(t,e,Zh(t,u),!1);n={oldValue:r,newValue:jc(t,e)}}break}return n}function Lt(t,...e){El(Hp,t,...e)}const Pp=Symbol("RESET");function iy(t,...e){Lt(t,...e,Pp)}function iM(t,e,n){let r,a,u;const{type:c,key:f}=e;switch(e.type){case"writable_pure_selector":r=_s(t,e,"mut"),a=CS(n,r),a=Kn(t,e,a);break;case"writable_held_selector":u=e.const,CS(n,u),r=u,a=u}return t.logger.info("⭐",c,f,"setting to",a),uf(t,f),e.setSelf(a),{oldValue:r,newValue:a}}const rM=(t,e,n)=>{let r;switch(e.type){case"atom":case"mutable_atom":r=Ip(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":r=iM(t,e,n);break}return r},Hp=Symbol("OWN_OP"),ry=Symbol("JOIN_OP");function El(t,e,...n){let r,a,u,c,f,h;n.length===2?(u=n[0],h=n[1],"family"in u&&(c=Wm(e,u),f=qr(u.family.subKey),r=dl(e,c,f),r?u=r:u=a=fl(cl,e,c,f))):(c=ct(e,n[0]),f=n[1],h=n[2],r=dl(e,c,f),r?u=r:u=a=fl(cl,e,c,f));const m=h===Pp?"reset":"set";let y;if(t===Hp){const S=tT(e,u);if(typeof S=="number"){const x=S,T=e.on.operationClose.subscribe(`waiting to ${m} "${u.key}" at T-${x}`,function(){T(),e.logger.info("🟢",u.type,u.key,"resuming deferred",m,`from T-${x}`),El(t,e,u,h)});return}y=S}else y=e;if("counterfeit"in u&&"family"in u){const S=u.family.subKey,x=e.disposalTraces.buffer.find(T=>T?.key===S);e.logger.error("❌",u.type,u.key,"could not be",m,"because key",S,"is not allocated.",x?`this key was previously disposed:${x.trace}`:"(no previous disposal trace found)");return}const g=ct(y,u);let b;h===Pp?b=nM(y,g):b=rM(y,g,h),qp(y,g,b,!!a,c),t===Hp&&nT(y)}const rT=(t,e)=>Re(t).atoms.has(e),sM=(t,e)=>Re(t).writableSelectors.has(e),oM=(t,e)=>Re(t).readonlySelectors.has(e),aM=(t,e)=>rT(t,e)||sM(t,e)||oM(t,e);function NS(t,e){return Re(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([n,{source:r}])=>r!==e).map(([n,{source:r}])=>r).filter(n=>aM(t,n))}function hl(t,e,n=new Set){const r=NS(t,e),a=new Map;for(;r.length>0;){const u=r.pop();if(!n.has(u))if(n.add(u),rT(t,u)){const c=t.atoms.get(u);a.set(c.key,c)}else r.push(...NS(t,u))}return a}function lM(t,e,n,r,a){const u=Re(t),{type:c,key:f}=r;if(c==="atom"||c==="mutable_atom")u.selectorAtoms.set({selectorKey:n,atomKey:f}),t.logger.info("🔍",e,n,`discovers root atom "${f}"`);else{const h=hl(t,f,a);t.logger.info("🔍",e,n,`discovers root atoms: [ ${[...h.values()].map(m=>`"${m.key}"`).join(", ")} ]`);for(const{key:m}of h.values())u.selectorAtoms=u.selectorAtoms.set({selectorKey:n,atomKey:m})}a.add(f)}function cf(t,e,n,r){return{get:(...a)=>{const u=Re(t),{token:c,family:f,subKey:h}=ey(t,...a);let m;return"counterfeit"in c&&f&&h?m=Qx(t,c,f,h):m=_s(t,ct(t,c)),t.logger.info("🔌",e,n,`registers dependency ( "${c.key}" =`,m,")"),u.selectorGraph.set({upstreamSelectorKey:c.key,downstreamSelectorKey:n},{source:c.key}),lM(t,e,n,c,r),m},set:((...a)=>{El(ry,Re(t),...a)}),find:((...a)=>Ir(t,...a)),json:a=>Rs(t,a)}}function sy(t,e,n){const r=Re(t),a=new We,u=new Set,{key:c,const:f}=e,h="readonly_held_selector";t.logger.info("🔨",h,c,"is being created");const{get:m,find:y,json:g}=cf(r,h,c,u),S={...e,type:h,subject:a,getFrom:T=>{const M=T.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[C,{source:_}]of M)_!==c&&T.selectorGraph.delete(C,c);return T.selectorAtoms.delete(c),e.get({get:m,find:y,json:g},f),Kn(T,S,f),t.logger.info("✨",h,c,"=",f),u.clear(),f},install:T=>sy(T,e,n)};n&&(S.family=n),r.readonlySelectors.set(c,S);const x={key:c,type:h};return n&&(x.family=n),x}function oy(t,e,n){const r=Re(t),a=new We,u=new Set,c=e.key,f="readonly_pure_selector";t.logger.info("🔨",f,c,"is being created");const{get:h,find:m,json:y}=cf(r,f,c,u),b={...e,type:f,subject:a,getFrom:()=>{const x=Re(t),T=x.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[C,{source:_}]of T)_!==c&&x.selectorGraph.delete(C,c);x.selectorAtoms.delete(c);const M=Kn(x,b,e.get({get:h,find:m,json:y}));return t.logger.info("✨",f,c,"=",M),u.clear(),M},install:x=>oy(x,e,n)};n&&(b.family=n),r.readonlySelectors.set(c,b);const S={key:c,type:f};return n&&(S.family=n),S}function ay(t,e,n){const r=Re(t),a=new We,u=new Set,{key:c,const:f}=e,h="writable_held_selector";t.logger.info("🔨",h,c,"is being created");const m=cf(r,h,c,u),{find:y,get:g,json:b}=m,S={find:y,get:g,json:b},M={...e,type:h,subject:a,getFrom:_=>{const R=_.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[G,{source:P}]of R)P!==c&&_.selectorGraph.delete(G,c);return _.selectorAtoms.delete(c),e.get(S,f),Kn(_,M,f),t.logger.info("✨",h,c,"=",f),u.clear(),f},setSelf:()=>{e.set(m,f)},install:_=>ay(_,e,n)};n&&(M.family=n),r.writableSelectors.set(c,M);const C={key:c,type:h};return n&&(C.family=n),C}function ly(t,e,n){const r=Re(t),a=new We,u=new Set,c=e.key,f="writable_pure_selector";t.logger.info("🔨",f,c,"is being created");const h=cf(r,f,c,u),{find:m,get:y,json:g}=h,b={find:m,get:y,json:g},T={...e,type:f,subject:a,getFrom:C=>{const _=C.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[G,{source:P}]of _)P!==c&&C.selectorGraph.delete(G,c);C.selectorAtoms.delete(c);const R=Kn(C,T,e.get(b));return t.logger.info("✨",f,c,"=",R),u.clear(),R},setSelf:C=>{e.set(h,C)},install:C=>ly(C,e,n)};n&&(T.family=n),r.writableSelectors.set(c,T);const M={key:c,type:f};return n&&(M.family=n),M}function sT(t,e){const n="set"in e,r="const"in e;if(r&&n){const u=ay(t,e,void 0);return t.on.selectorCreation.next(u),u}if(r){const u=sy(t,e,void 0);return t.on.selectorCreation.next(u),u}if(n){const u=ly(t,e,void 0);return t.on.selectorCreation.next(u),u}const a=oy(t,e,void 0);return t.on.selectorCreation.next(a),a}function uM(t,e){const n=Re(t),{key:r,type:a,family:u}=e;if(!u)t.logger.error("❌",a,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(u.subKey)&&n.moleculeData.delete(u.subKey,u.key);let c;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),c={key:u.key,type:"writable_held_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"writable_pure_selector":n.writableSelectors.delete(r),c={key:u.key,type:"writable_pure_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_held_selector":n.readonlySelectors.delete(r),c={key:u.key,type:"readonly_held_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),c={key:u.key,type:"readonly_pure_selector_family"},ct(t,c).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),n.moleculeData.delete(u.key,u.subKey),t.logger.info("🔥",e.type,r,"deleted"),Tn(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()}):t.on.selectorDisposal.next(e)}}const cM=(t,e)=>{const n=Re(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)},$S=(t,e,n)=>n.subject.subscribe(`${e.type}:${e.key}`,r=>{t.logger.info("📢",e.type,e.key,"root",n.key,"went",r.oldValue,"->",r.newValue);const a=cM(t,e),u=_s(t,e);t.logger.info("✨",e.type,e.key,"went",a,"->",u),e.subject.next({newValue:u,oldValue:a})});function Bo(t,e,n,r){function a(g){if(t.operation.open){if(u?.type==="atom"&&dy(u,"tracker:signal")&&"*"+t.operation.token.key===e.key&&"inboundTracker"in r)return;const b=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{b(),r(g)})}else r(g)}ey(t,e);const u=ct(t,e);t.logger.info("👀",u.type,u.key,`Adding subscription "${n}"`);const c=u.type==="writable_pure_selector"||u.type==="readonly_pure_selector",f=new Map;let h=a;if(c){_s(t,u);for(const[g,b]of hl(t,u.key))f.set(g,$S(t,u,b));h=function(b){const S=hl(t,u.key);for(const[x,T]of f)S.get(x)?S.delete(x):(T(),f.delete(x));for(const[x,T]of S)f.set(x,$S(t,u,T));a(b)}}const m=u.subject.subscribe(n,h);return()=>{t.logger.info("🙈",u.type,u.key,`Removing subscription "${n}"`),m();for(const g of f.values())g()}}const oT=(t,e,n,r)=>{const a=ct(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const u=a.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),u()}},aT=(t,e,n,r)=>{const a=ct(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const u=a.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),u()}};function fM(t,e,n,r=af()){switch(e.type){case"atom":case"mutable_atom":case"readonly_pure_selector":case"readonly_held_selector":case"writable_pure_selector":case"writable_held_selector":return Bo(t,e,r,n);case"transaction":return aT(t,e,r,n);case"timeline":return oT(t,e,r,n)}}var uy=class{initializeSignalAtom(t,e){const n=`*${t.key}`;e.atoms.delete(n),e.valueMap.delete(n);const r=t.family?{key:`*${t.family.key}`,subKey:t.family.subKey}:void 0,a=ff(e,{key:n,default:null},r,["tracker:signal"]);if(e.parent?.valueMap.has(n)){const u=e.parent.valueMap.get(n);e.valueMap.set(n,u)}return a}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore(t,e,n){const r=t.key,a=`tracker-from-core:${n.config.name}:${Tn(n)?n.transactionMeta.update.token.key:"main"}:${r}`,u=c=>{El(ry,n,e,c)};this.unsubscribeFromInnerValue=An(n,t).subscribe(a,u),this.unsubscribeFromState=Bo(n,t,a,(function(f){f.newValue!==f.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=f.newValue.subscribe(a,u))}).bind(this))}supplySignalsToCore(t,e,n){const r=t.key,a=`tracker-to-core:${n.config.name}:${Tn(n)?n.transactionMeta.update.token.key:"main"}:${r}`;Bo(n,e,a,Object.assign(function({newValue:c,oldValue:f}){const h=n.timelineTopics.getRelatedKey(e.key);if(h&&n.timelines.get(h)?.timeTraveling){const m=oT(n,{key:h,type:"timeline"},a,function(g){m(),Lt(n,t,b=>(g==="redo"&&c?b.do(c):g==="undo"&&f&&b.undo(f),b))});return}Lt(n,t,m=>(m.do(c),m))},{inboundTracker:!0}))}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor(t,e){const n=Re(e),r=this.initializeSignalAtom(t,n);this.mutableAtomToken=t,this.latestSignalToken=r,this.captureSignalsFromCore(t,r,n),this.supplySignalsToCore(t,r,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function cy(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const r=Re(t),{key:a}=e,u=r.atoms.get(a),c="mutable_atom";if(u?.type===c&&t.config.isProduction===!0)return t.logger.error("❌",c,a,"Tried to create atom, but it already exists in the store."),zr(u);const f=new We,h={...e,type:c,install:y=>(y.logger.info("🛠️","atom",a,`installing in store "${y.config.name}"`),cy(y,e,n)),subject:f};n&&(h.family=n),r.atoms.set(h.key,h);const m=zr(h);if(new uy(m,t),n||sT(t,{key:`${a}:JSON`,get:({get:y})=>y(m).toJSON(),set:({set:y},g)=>{y(m,e.class.fromJSON(g))}}),e.effects){let y=0;const g=[];for(const b of e.effects){const S=b({resetSelf:()=>{iy(t,m)},setSelf:x=>{Lt(t,m,x)},onSet:x=>Bo(t,m,`effect[${y}]`,x),token:m,store:Jm(t)});S&&g.push(S),++y}h.cleanup=()=>{for(const b of g)b()}}return t.on.atomCreation.next(m),m}var dM=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(t,e){this.latestSignalAtoms=ct(e,ty(e,{key:`*${t.key}`,default:null},["mutable","updates"])),this.mutableAtoms=t;const n=r=>{const{type:a,token:u}=r;if(u.family){const c=qr(u.family.subKey);switch(a){case"state_creation":this.trackers.set(c,new uy(u,e));break;case"state_disposal":{const f=this.trackers.get(c);f&&(f[Symbol.dispose](),this.trackers.delete(c))}}}};this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,n)}};function lT(t,e,n){const r={key:e.key,type:"mutable_atom_family"},a=t.families.get(e.key);a&&t.config.isProduction===!0&&t.logger.error("❗","mutable_atom_family",e.key,`Overwriting an existing ${Kr[a.type]} "${a.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const u=new We,f={...r,create:h=>{const m=zt(h),y={key:e.key,subKey:m},g=`${e.key}(${m})`,b=Re(t),S={key:g,class:e.class};return e.effects&&(S.effects=e.effects(h)),cy(b,S,y)},class:e.class,subject:u,install:h=>lT(h,e),internalRoles:n};return t.families.set(e.key,f),ny(t,{key:`${e.key}:JSON`,get:h=>({get:m})=>m(r,h).toJSON(),set:h=>({set:m},y)=>{m(r,h,e.class.fromJSON(y))}},["mutable","json"]),new dM(f,t),r}const hM=(t,e)=>{const n=Re(e),r=`${t.key}:JSON`;return n.families.get(r)},Rs=(t,e)=>e.family?Ir(t,ct(Re(t),{key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"}),qr(e.family.subKey)):{type:"writable_pure_selector",key:`${e.key}:JSON`},uT=t=>{const e={type:"atom",key:`*${t.key}`};return t.family&&(e.family={key:`*${t.family.key}`,subKey:t.family.subKey}),e};function sc(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t&&"READONLY_VIEW"in t&&"toJSON"in t}function Kn(t,e,n){const{key:r,subject:a,type:u}=e,c=t.valueMap.get(r);if(c instanceof Kp&&!c.done){const f=c;return n instanceof Promise?(f.use(n),f):(t.valueMap.set(r,n),n)}if(n instanceof Promise){const f=new Kp(n);return t.valueMap.set(r,f),f.then(function(m){if(t.valueMap.get(r)===f){switch(tT(t,e),Kn(t,e,m),u){case"atom":fy(t,e);break;case"readonly_pure_selector":case"writable_pure_selector":dT(t,r);break}nT(t),a.next({newValue:m,oldValue:f})}}).catch(h=>{t.logger.error("💥",e.type,r,"rejected:",h)}),f}return t.logger.info("📝",e.type,e.key,"writing to cache",n),t.valueMap.set(r,n),n}function cT(t,e,n){t.logger.info("📖",e.type,e.key,"reading cached value");let r=t.valueMap.get(e.key);if(n==="mut"&&e.type==="mutable_atom"&&Tn(t)){const a=e,{parent:u}=t;if(t.valueMap.hasOwn(a.key))return r;const c=u.valueMap.get(a.key);t.logger.info("📃","atom",a.key,"copying");const f=c.toJSON(),h=a.class.fromJSON(f);t.valueMap.set(a.key,h),new uy(a,u),r=h}return r}function fT(t,e){const n=t.valueMap.get(e);if(n instanceof Kp){const r=t.writableSelectors.get(e)??t.readonlySelectors.get(e);r&&r.getFrom(t);return}t.operation.open&&t.operation.prev.set(e,n),t.valueMap.delete(e),t.logger.info("🗑","state",e,"evicted")}function fy(t,e){const n=Re(t),{key:r,type:a}=e,u=n.selectorAtoms.getRelatedKeys(r);if(n.logger.info("🧹",a,r,u?`evicting ${u.size} states downstream:`:"no downstream states",u??"to evict"),u){n.operation.open&&n.logger.info("🧹",a,r,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const c of u)iT(n,c)||(fT(n,c),uf(n,c))}}function dT(t,e){const n=Re(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e}).filter(([a,{source:u}])=>u===e);for(const[a]of r)iT(n,a)||(fT(n,a),uf(n,a),dT(t,a))}function ff(t,e,n,r){const a="atom",{key:u}=e;t.logger.info("🔨",a,u,"is being created");const c=Re(t),f=c.atoms.get(u);if(f?.type===a&&t.config.isProduction===!0)return t.logger.error("❌","atom",u,"Tried to create atom, but it already exists in the store."),zr(f);const h=new We,m={...e,type:a,install:g=>(g.logger.info("🛠️",a,u,`installing in store "${g.config.name}"`),ff(g,e,n)),subject:h};n&&(m.family=n),r&&(m.internalRoles=r),c.atoms.set(u,m);const y=zr(m);if(e.effects){let g=0;const b=[];for(const S of e.effects){const x=S({resetSelf:()=>{iy(t,y)},setSelf:T=>{Lt(t,y,T)},onSet:T=>Bo(t,y,`effect[${g}]`,T),token:y,store:Jm(t)});x&&b.push(x),++g}m.cleanup=()=>{for(const S of b)S()}}return t.on.atomCreation.next(y),y}function dy(t,e){return"internalRoles"in t?t.internalRoles.includes(e):!1}function hy(t,e){const n=Re(t),{key:r,family:a}=e,u=ct(n,e);if(!a)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{u.cleanup?.();const c=t.valueMap.get(u.key),f=ct(t,Wm(t,e)).subject,h={type:"state_disposal",subType:"atom",token:e,value:c,timestamp:Date.now()};f.next(h);const m=Tn(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),n.moleculeData.delete(a.key,a.subKey),t.timelineTopics.delete(r),e.type==="mutable_atom"&&(hy(t,uT(e)),t.trackers.delete(r)),t.logger.info("🔥","atom",r,"deleted"),m&&n.transactionMeta.phase==="building"){const y=n.transactionMeta.update.subEvents.at(-1),g=y?.type==="molecule_disposal"&&y.values.some(([S])=>S===u.family?.key),b=dy(u,"tracker:signal");!g&&!b&&n.transactionMeta.update.subEvents.push(h)}else t.on.atomDisposal.next(e)}}function hs(t){return t[0].toUpperCase()+t.slice(1)}var hT=class{toolkit;options;relations;states;relatedKeysAtoms;transact(t,e){const n=this.toolkit;this.toolkit=t,e(this),this.toolkit=n}store;[Symbol.dispose](){}constructor(t,e=Ft.STORE){this.store=e,this.options=t,this.store.miscResources.set(`join:${t.key}`,this),this.toolkit={get:((...y)=>An(e,...y)),set:((...y)=>{Lt(e,...y)}),find:((...y)=>Ir(e,...y)),json:y=>Rs(e,y)};const n=t.between[0],r=t.between[1],a=lT(e,{key:`${t.key}/relatedKeys`,class:Ym},["join","relations"]);this.relatedKeysAtoms=a;const u=(y,g,b)=>{const{find:S,get:x,set:T}=y,M=S(a,g),C=x(M);for(const _ of C)b.includes(_)||T(a,_,R=>(R.delete(g),R));T(M,_=>{_.clear();for(const R of b){const G=S(a,R),P=x(G),ee=P.has(g);if(this.relations.cardinality==="1:n"){const J=[];for(const X of P){if(X===g)continue;let he;El(ry,this.store,a,X,pe=>(pe.delete(R),he=pe.size,pe)),he===0&&J.push(X)}!ee&&P.size>0&&T(G,X=>(X.clear(),X));for(const X of J)e.keyRefsInJoins.delete(Sc(R,X))}ee||T(G,J=>(J.add(g),J)),_.add(R)}return _})},c=(y,g,b)=>{const{set:S}=y;S(a,g,x=>{for(const T of b)x.add(T);return x});for(const x of b)S(a,x,T=>(T.add(g),T));return!0},f=new Ii(t,{externalStore:{getRelatedKeys:y=>this.toolkit.get(a,y),addRelation:(y,g)=>{this.store.keyRefsInJoins.set(`"${y}"`,t.key),this.store.keyRefsInJoins.set(`"${g}"`,t.key),this.store.keyRefsInJoins.set(Sc(y,g),t.key),this.toolkit.set(a,y,b=>b.add(g)),this.toolkit.set(a,g,b=>b.add(y))},deleteRelation:(y,g)=>{this.toolkit.set(a,y,S=>(S.delete(g),S)),this.toolkit.set(a,g,S=>(S.delete(y),S));const b=Sc(y,g);this.store.keyRefsInJoins.delete(b)},replaceRelationsSafely:(y,g)=>{u(this.toolkit,y,g)},replaceRelationsUnsafely:(y,g)=>{c(this.toolkit,y,g)},has:(y,g)=>{const b=this.toolkit.get(a,y);return g?b.has(g):b.size>0}},isAType:t.isAType,isBType:t.isBType}),h=()=>Bc(e,{key:`${t.key}/singleRelatedKey`,get:y=>({get:g})=>{const b=g(a,y);for(const S of b)return S;return null}},["join","keys"]),m=()=>Bc(e,{key:`${t.key}/multipleRelatedKeys`,get:y=>({get:g})=>g(hM(a,e),y)},["join","keys"]);switch(t.cardinality){case"1:1":{const y=h(),g=`${n}KeyOf${hs(r)}`,b=`${r}KeyOf${hs(n)}`;this.relations=f,this.states={[g]:y,[b]:y};break}case"1:n":{const y=h(),g=m(),b=`${n}KeyOf${hs(r)}`,S=`${r}KeysOf${hs(n)}`,x={[b]:y,[S]:g};this.relations=f,this.states=x;break}case"n:n":{const y=m(),g=`${n}KeysOf${hs(r)}`,b=`${r}KeysOf${hs(n)}`;this.relations=f,this.states={[g]:y,[b]:y}}}}};function pM(t,e){return t.joins.set(e.key,new hT(e)),{key:e.key,type:"join",a:e.between[0],b:e.between[1],cardinality:e.cardinality}}function mM(t,e){let n=e.joins.get(t.key);if(n===void 0){const r=Ft.STORE.joins.get(t.key);if(r===void 0)throw new Error(`Join "${t.key}" not found in store "${e.config.name}"`);const a=Jm(e);n=new hT(r.options,a),e.joins.set(t.key,n)}return n}function yM(t,e){return mM(t,e).relatedKeysAtoms}var Qh={exports:{}},ye={};var jS;function gM(){if(jS)return ye;jS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),u=Symbol.for("react.consumer"),c=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function S(E){return E===null||typeof E!="object"?null:(E=b&&E[b]||E["@@iterator"],typeof E=="function"?E:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,M={};function C(E,q,H){this.props=E,this.context=q,this.refs=M,this.updater=H||x}C.prototype.isReactComponent={},C.prototype.setState=function(E,q){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,q,"setState")},C.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function _(){}_.prototype=C.prototype;function R(E,q,H){this.props=E,this.context=q,this.refs=M,this.updater=H||x}var G=R.prototype=new _;G.constructor=R,T(G,C.prototype),G.isPureReactComponent=!0;var P=Array.isArray;function ee(){}var J={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function he(E,q,H){var Q=H.ref;return{$$typeof:t,type:E,key:q,ref:Q!==void 0?Q:null,props:H}}function pe(E,q){return he(E.type,q,E.props)}function we(E){return typeof E=="object"&&E!==null&&E.$$typeof===t}function je(E){var q={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(H){return q[H]})}var be=/\/+/g;function Z(E,q){return typeof E=="object"&&E!==null&&E.key!=null?je(""+E.key):q.toString(36)}function ne(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(ee,ee):(E.status="pending",E.then(function(q){E.status==="pending"&&(E.status="fulfilled",E.value=q)},function(q){E.status==="pending"&&(E.status="rejected",E.reason=q)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function j(E,q,H,Q,re){var ce=typeof E;(ce==="undefined"||ce==="boolean")&&(E=null);var Te=!1;if(E===null)Te=!0;else switch(ce){case"bigint":case"string":case"number":Te=!0;break;case"object":switch(E.$$typeof){case t:case e:Te=!0;break;case y:return Te=E._init,j(Te(E._payload),q,H,Q,re)}}if(Te)return re=re(E),Te=Q===""?"."+Z(E,0):Q,P(re)?(H="",Te!=null&&(H=Te.replace(be,"$&/")+"/"),j(re,q,H,"",function(ii){return ii})):re!=null&&(we(re)&&(re=pe(re,H+(re.key==null||E&&E.key===re.key?"":(""+re.key).replace(be,"$&/")+"/")+Te)),q.push(re)),1;Te=0;var Ct=Q===""?".":Q+":";if(P(E))for(var Je=0;Je<E.length;Je++)Q=E[Je],ce=Ct+Z(Q,Je),Te+=j(Q,q,H,ce,re);else if(Je=S(E),typeof Je=="function")for(E=Je.call(E),Je=0;!(Q=E.next()).done;)Q=Q.value,ce=Ct+Z(Q,Je++),Te+=j(Q,q,H,ce,re);else if(ce==="object"){if(typeof E.then=="function")return j(ne(E),q,H,Q,re);throw q=String(E),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return Te}function U(E,q,H){if(E==null)return E;var Q=[],re=0;return j(E,Q,"","",function(ce){return q.call(H,ce,re++)}),Q}function L(E){if(E._status===-1){var q=E._result;q=q(),q.then(function(H){(E._status===0||E._status===-1)&&(E._status=1,E._result=H)},function(H){(E._status===0||E._status===-1)&&(E._status=2,E._result=H)}),E._status===-1&&(E._status=0,E._result=q)}if(E._status===1)return E._result.default;throw E._result}var te=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)},oe={map:U,forEach:function(E,q,H){U(E,function(){q.apply(this,arguments)},H)},count:function(E){var q=0;return U(E,function(){q++}),q},toArray:function(E){return U(E,function(q){return q})||[]},only:function(E){if(!we(E))throw Error("React.Children.only expected to receive a single React element child.");return E}};return ye.Activity=g,ye.Children=oe,ye.Component=C,ye.Fragment=n,ye.Profiler=a,ye.PureComponent=R,ye.StrictMode=r,ye.Suspense=h,ye.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=J,ye.__COMPILER_RUNTIME={__proto__:null,c:function(E){return J.H.useMemoCache(E)}},ye.cache=function(E){return function(){return E.apply(null,arguments)}},ye.cacheSignal=function(){return null},ye.cloneElement=function(E,q,H){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Q=T({},E.props),re=E.key;if(q!=null)for(ce in q.key!==void 0&&(re=""+q.key),q)!X.call(q,ce)||ce==="key"||ce==="__self"||ce==="__source"||ce==="ref"&&q.ref===void 0||(Q[ce]=q[ce]);var ce=arguments.length-2;if(ce===1)Q.children=H;else if(1<ce){for(var Te=Array(ce),Ct=0;Ct<ce;Ct++)Te[Ct]=arguments[Ct+2];Q.children=Te}return he(E.type,re,Q)},ye.createContext=function(E){return E={$$typeof:c,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:u,_context:E},E},ye.createElement=function(E,q,H){var Q,re={},ce=null;if(q!=null)for(Q in q.key!==void 0&&(ce=""+q.key),q)X.call(q,Q)&&Q!=="key"&&Q!=="__self"&&Q!=="__source"&&(re[Q]=q[Q]);var Te=arguments.length-2;if(Te===1)re.children=H;else if(1<Te){for(var Ct=Array(Te),Je=0;Je<Te;Je++)Ct[Je]=arguments[Je+2];re.children=Ct}if(E&&E.defaultProps)for(Q in Te=E.defaultProps,Te)re[Q]===void 0&&(re[Q]=Te[Q]);return he(E,ce,re)},ye.createRef=function(){return{current:null}},ye.forwardRef=function(E){return{$$typeof:f,render:E}},ye.isValidElement=we,ye.lazy=function(E){return{$$typeof:y,_payload:{_status:-1,_result:E},_init:L}},ye.memo=function(E,q){return{$$typeof:m,type:E,compare:q===void 0?null:q}},ye.startTransition=function(E){var q=J.T,H={};J.T=H;try{var Q=E(),re=J.S;re!==null&&re(H,Q),typeof Q=="object"&&Q!==null&&typeof Q.then=="function"&&Q.then(ee,te)}catch(ce){te(ce)}finally{q!==null&&H.types!==null&&(q.types=H.types),J.T=q}},ye.unstable_useCacheRefresh=function(){return J.H.useCacheRefresh()},ye.use=function(E){return J.H.use(E)},ye.useActionState=function(E,q,H){return J.H.useActionState(E,q,H)},ye.useCallback=function(E,q){return J.H.useCallback(E,q)},ye.useContext=function(E){return J.H.useContext(E)},ye.useDebugValue=function(){},ye.useDeferredValue=function(E,q){return J.H.useDeferredValue(E,q)},ye.useEffect=function(E,q){return J.H.useEffect(E,q)},ye.useEffectEvent=function(E){return J.H.useEffectEvent(E)},ye.useId=function(){return J.H.useId()},ye.useImperativeHandle=function(E,q,H){return J.H.useImperativeHandle(E,q,H)},ye.useInsertionEffect=function(E,q){return J.H.useInsertionEffect(E,q)},ye.useLayoutEffect=function(E,q){return J.H.useLayoutEffect(E,q)},ye.useMemo=function(E,q){return J.H.useMemo(E,q)},ye.useOptimistic=function(E,q){return J.H.useOptimistic(E,q)},ye.useReducer=function(E,q,H){return J.H.useReducer(E,q,H)},ye.useRef=function(E){return J.H.useRef(E)},ye.useState=function(E){return J.H.useState(E)},ye.useSyncExternalStore=function(E,q,H){return J.H.useSyncExternalStore(E,q,H)},ye.useTransition=function(){return J.H.useTransition()},ye.version="19.2.0",ye}var BS;function py(){return BS||(BS=1,Qh.exports=gM()),Qh.exports}var $=py();const vM=bk($),pT=vk({__proto__:null,default:vM},[$]),my=$.createContext(Ft.STORE);function mT(t,...e){let n;if(e.length===2){const r=e[0],a=e[1];n=Ir(t,r,a)}else n=e[0];return n}function Wn(...t){const e=$.useContext(my),n=mT(e,...t),r=$.useRef(null);return r.current??=a=>{Lt(e,n,a)},r.current}function Et(...t){const e=$.useContext(my),n=mT(e,...t),r=$.useId();return $.useSyncExternalStore(a=>Bo(e,n,`use-o:${r}`,a),()=>An(e,n),()=>An(e,n))}const yT=(t,{stringify:e,parse:n},r)=>({setSelf:a,onSet:u})=>{if(!t)return;const c=t.getItem(r);c!=null&&a(n(c)),u(({newValue:f})=>{if(f==null){t.removeItem(r);return}t.setItem(r,e(f))})};xk({key:"mutex",default:!1});var bM=class extends Map{set(t,e){return this.has(t)?(console.warn("Tried to set a key that already exists in an InvariantMap",{key:t,value:e}),this):super.set(t,e)}},SM=class Fp{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new bM;static create(e,n){const{type:r,globals:a,actions:u,perspectives:c}=n(new Fp(e)),f={type:r,key:e,globals:a,actions:u,perspectives:c};return Fp.existing.set(e,f),f}add(...e){switch(e[0].type){case"atom":case"mutable_atom":this.globals.push(...e);break;case"transaction":this.actions.push(...e);break;case"atom_family":case"mutable_atom_family":{const[n,r]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:n,viewAtoms:r})}break}return this}};function wM(t){const{key:e,config:n}=t,r=SM.create(e,n),{actions:a}=r;for(const u of a)Xx(Ft.STORE,e,u.key);return Qm(Ft.STORE,e,-1),r}Lx({key:"usersInRoomIndex",class:Ym});Lx({key:"roomIndex",class:Ym});const xM=Tk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"});Rk({key:"usersInMyRoomView",get:t=>({find:e})=>[e(Ak(xM),t)]});const TM=(t,e,n,r,a)=>u=>{function c(h,m){if(t.logger.info("🧑⚖️","continuity",e,"reconciling updates"),Lt(t,wc,g=>(g.shift(),g)),h.id===m.id){if(JSON.stringify(h.subEvents)===JSON.stringify(m.subEvents)){t.logger.info("✅","continuity",e,`results for ${h.id} match between client and server`),n.emit(`ack:${e}`,m.epoch);return}}else t.logger.info("❌","continuity",e,`thought update #${m.epoch} was ${h.token.key}:${h.id}, but it was actually ${m.token.key}:${m.id}`);t.logger.info("🧑⚖️","continuity",e,"updates do not match",h,m);const y=r.toReversed();for(const g of y)wo(t,g,"oldValue");t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),wo(t,h,"oldValue"),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),wo(t,m,"newValue"),t.logger.info("⏩","continuity",e,"applied confirmed update",m),n.emit(`ack:${e}`,m.epoch);for(const g of r){const b={type:"transaction",key:g.token.key},{id:S,params:x}=g;Xm(t,b,S)(...x)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:u,confirmedUpdates:a,optimisticUpdates:r});const f=r[0];if(f)if(t.logger.info("🧑⚖️","continuity",e,"has optimistic updates to reconcile"),u.epoch===f.epoch){t.logger.info("🧑⚖️","continuity",e,`epoch of confirmed update #${u.epoch} matches zeroth optimistic update`),c(f,u);for(const h of a){const m=r[0];if(h.epoch===m?.epoch)c(m,h);else break}}else t.logger.info("🧑⚖️","continuity",e,`epoch of confirmed update #${u.epoch} does not match zeroth optimistic update #${f.epoch}`),a.some(h=>h.epoch===u.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",u),Lt(t,Gp,h=>(h.push(u),h.sort((m,y)=>m.epoch-y.epoch),h)));else{t.logger.info("🧑⚖️","continuity",e,"has no optimistic updates to deal with");let h;h=Jx(t,e),h===u.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${u.epoch} (${u.token.key} ${u.id})`),wo(t,u,"newValue"),n.emit(`ack:${e}`,u.epoch),Qm(t,e,u.epoch)):h!==void 0&&(t.logger.info("🧑⚖️","continuity",e,`received update #${u.epoch} but still waiting for update #${h+1}`,{clientEpoch:h,serverEpoch:u.epoch}),a.some(m=>m.epoch===u.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${u.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${u.epoch} to queue`),Lt(t,Gp,m=>(m.push(u),m.sort((y,g)=>y.epoch-g.epoch),m))))}};function AM(t){return e=>{for(const n of e)hy(t,n)}}function EM(t){return e=>{let n=0,r,a;for(const u of e)n%2===0?r=u:(a=u,Lt(t,r,a)),n++}}const gT=ft({key:"mySocketId__INTERNAL",default:void 0});vi({key:"mySocketId",get:({get:t})=>t(gT)});ft({key:"myName",default:null,effects:[yT(globalThis.localStorage,JSON,"myUsername")]});const wc=ft({key:"updateQueue",default:()=>[]}),Gp=ft({key:"serverConfirmedUpdateQueue",default:()=>[]});function OM(t,e,n){const r=n.key,a=An(t,wc),u=An(t,Gp),c=(g,b)=>{e.off(`continuity-init:${r}`,c);let S=0,x,T;for(const M of b)S%2===0?x=M:(T=M,"type"in x&&x.type==="mutable_atom"&&(x=Rs(t,x)),Lt(t,x,T)),S++;Qm(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,c);const f=TM(t,r,e,a,u);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,f);const h=n.actions.map(g=>(Xx(t,r,g.key),aT(t,g,`tx-run:${r}`,b=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const S=a.findIndex(x=>x.id===b.id);S===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),Lt(t,wc,x=>(x.push(b),x.sort((T,M)=>T.epoch-M.epoch),x))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${S}`),Lt(t,wc,x=>(x[S]=b,x))),e.emit(`tx-run:${r}`,{id:b.id,token:g,params:b.params})}))),m=EM(t),y=AM(t);return e.on(`reveal:${r}`,m),e.on(`conceal:${r}`,y),e.emit(`get:${r}`),()=>{e.off(`continuity-init:${r}`),e.off(`tx-new:${r}`);for(const g of h)g()}}const vT=$.createContext({socket:null,services:null}),_M=({children:t,socket:e})=>{const n=$.useRef(new Map).current,r=Wn(gT);return $.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),F.jsx(vT.Provider,{value:{socket:e,services:n},children:t})};function RM(t,e){if(globalThis.env?.NODE_ENV==="development"){const n=$.useRef(!1);$.useEffect(()=>{let r=n.current;if(r===!1)r=t()??!0,n.current=r;else return()=>{Br(r)&&r(),n.current=!1}},e)}else $.useEffect(t,e)}function CM(t,e){const{socket:n,services:r}=$.useContext(vT);RM(()=>{let a=r?.get(t);return a?++a.consumerCount:n&&(a={consumerCount:1,dispose:e(n)},r?.set(t,a)),()=>{a&&(--a.consumerCount,a.consumerCount===0&&(a.dispose?.(),r?.delete(t)))}},[n,t])}function kM(t){const e=$.useContext(my);CM(`tx-sync:${t.key}`,n=>OM(e,n,t))}var Wh={exports:{}},Ga={},ep={exports:{}},tp={};var zS;function MM(){return zS||(zS=1,(function(t){function e(j,U){var L=j.length;j.push(U);e:for(;0<L;){var te=L-1>>>1,oe=j[te];if(0<a(oe,U))j[te]=U,j[L]=oe,L=te;else break e}}function n(j){return j.length===0?null:j[0]}function r(j){if(j.length===0)return null;var U=j[0],L=j.pop();if(L!==U){j[0]=L;e:for(var te=0,oe=j.length,E=oe>>>1;te<E;){var q=2*(te+1)-1,H=j[q],Q=q+1,re=j[Q];if(0>a(H,L))Q<oe&&0>a(re,H)?(j[te]=re,j[Q]=L,te=Q):(j[te]=H,j[q]=L,te=q);else if(Q<oe&&0>a(re,L))j[te]=re,j[Q]=L,te=Q;else break e}}return U}function a(j,U){var L=j.sortIndex-U.sortIndex;return L!==0?L:j.id-U.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var u=performance;t.unstable_now=function(){return u.now()}}else{var c=Date,f=c.now();t.unstable_now=function(){return c.now()-f}}var h=[],m=[],y=1,g=null,b=3,S=!1,x=!1,T=!1,M=!1,C=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function G(j){for(var U=n(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=j)r(m),U.sortIndex=U.expirationTime,e(h,U);else break;U=n(m)}}function P(j){if(T=!1,G(j),!x)if(n(h)!==null)x=!0,ee||(ee=!0,je());else{var U=n(m);U!==null&&ne(P,U.startTime-j)}}var ee=!1,J=-1,X=5,he=-1;function pe(){return M?!0:!(t.unstable_now()-he<X)}function we(){if(M=!1,ee){var j=t.unstable_now();he=j;var U=!0;try{e:{x=!1,T&&(T=!1,_(J),J=-1),S=!0;var L=b;try{t:{for(G(j),g=n(h);g!==null&&!(g.expirationTime>j&&pe());){var te=g.callback;if(typeof te=="function"){g.callback=null,b=g.priorityLevel;var oe=te(g.expirationTime<=j);if(j=t.unstable_now(),typeof oe=="function"){g.callback=oe,G(j),U=!0;break t}g===n(h)&&r(h),G(j)}else r(h);g=n(h)}if(g!==null)U=!0;else{var E=n(m);E!==null&&ne(P,E.startTime-j),U=!1}}break e}finally{g=null,b=L,S=!1}U=void 0}}finally{U?je():ee=!1}}}var je;if(typeof R=="function")je=function(){R(we)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,Z=be.port2;be.port1.onmessage=we,je=function(){Z.postMessage(null)}}else je=function(){C(we,0)};function ne(j,U){J=C(function(){j(t.unstable_now())},U)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function(j){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var L=b;b=U;try{return j()}finally{b=L}},t.unstable_requestPaint=function(){M=!0},t.unstable_runWithPriority=function(j,U){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var L=b;b=j;try{return U()}finally{b=L}},t.unstable_scheduleCallback=function(j,U,L){var te=t.unstable_now();switch(typeof L=="object"&&L!==null?(L=L.delay,L=typeof L=="number"&&0<L?te+L:te):L=te,j){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=L+oe,j={id:y++,callback:U,priorityLevel:j,startTime:L,expirationTime:oe,sortIndex:-1},L>te?(j.sortIndex=L,e(m,j),n(h)===null&&j===n(m)&&(T?(_(J),J=-1):T=!0,ne(P,L-te))):(j.sortIndex=oe,e(h,j),x||S||(x=!0,ee||(ee=!0,je()))),j},t.unstable_shouldYield=pe,t.unstable_wrapCallback=function(j){var U=b;return function(){var L=b;b=U;try{return j.apply(this,arguments)}finally{b=L}}}})(tp)),tp}var LS;function DM(){return LS||(LS=1,ep.exports=MM()),ep.exports}var np={exports:{}},Yt={};var VS;function NM(){if(VS)return Yt;VS=1;var t=py();function e(h){var m="https://react.dev/errors/"+h;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)m+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function u(h,m,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:h,containerInfo:m,implementation:y}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,m){if(h==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Yt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Yt.createPortal=function(h,m){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(e(299));return u(h,m,null,y)},Yt.flushSync=function(h){var m=c.T,y=r.p;try{if(c.T=null,r.p=2,h)return h()}finally{c.T=m,r.p=y,r.d.f()}},Yt.preconnect=function(h,m){typeof h=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,r.d.C(h,m))},Yt.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Yt.preinit=function(h,m){if(typeof h=="string"&&m&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin),b=typeof m.integrity=="string"?m.integrity:void 0,S=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;y==="style"?r.d.S(h,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:S}):y==="script"&&r.d.X(h,{crossOrigin:g,integrity:b,fetchPriority:S,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Yt.preinitModule=function(h,m){if(typeof h=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var y=f(m.as,m.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&r.d.M(h)},Yt.preload=function(h,m){if(typeof h=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var y=m.as,g=f(y,m.crossOrigin);r.d.L(h,y,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Yt.preloadModule=function(h,m){if(typeof h=="string")if(m){var y=f(m.as,m.crossOrigin);r.d.m(h,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:y,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else r.d.m(h)},Yt.requestFormReset=function(h){r.d.r(h)},Yt.unstable_batchedUpdates=function(h,m){return h(m)},Yt.useFormState=function(h,m,y){return c.H.useFormState(h,m,y)},Yt.useFormStatus=function(){return c.H.useHostTransitionStatus()},Yt.version="19.2.0",Yt}var US;function bT(){if(US)return np.exports;US=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),np.exports=NM(),np.exports}var KS;function $M(){if(KS)return Ga;KS=1;var t=DM(),e=py(),n=bT();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)s+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+i+"; visit "+s+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function u(i){var s=i,o=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(o=s.return),i=s.return;while(i)}return s.tag===3?o:null}function c(i){if(i.tag===13){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function f(i){if(i.tag===31){var s=i.memoizedState;if(s===null&&(i=i.alternate,i!==null&&(s=i.memoizedState)),s!==null)return s.dehydrated}return null}function h(i){if(u(i)!==i)throw Error(r(188))}function m(i){var s=i.alternate;if(!s){if(s=u(i),s===null)throw Error(r(188));return s!==i?null:i}for(var o=i,l=s;;){var d=o.return;if(d===null)break;var p=d.alternate;if(p===null){if(l=d.return,l!==null){o=l;continue}break}if(d.child===p.child){for(p=d.child;p;){if(p===o)return h(d),i;if(p===l)return h(d),s;p=p.sibling}throw Error(r(188))}if(o.return!==l.return)o=d,l=p;else{for(var v=!1,w=d.child;w;){if(w===o){v=!0,o=d,l=p;break}if(w===l){v=!0,l=d,o=p;break}w=w.sibling}if(!v){for(w=p.child;w;){if(w===o){v=!0,o=p,l=d;break}if(w===l){v=!0,l=p,o=d;break}w=w.sibling}if(!v)throw Error(r(189))}}if(o.alternate!==l)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?i:s}function y(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=y(i),s!==null)return s;i=i.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),S=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),T=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),C=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),R=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),ee=Symbol.for("react.suspense_list"),J=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),he=Symbol.for("react.activity"),pe=Symbol.for("react.memo_cache_sentinel"),we=Symbol.iterator;function je(i){return i===null||typeof i!="object"?null:(i=we&&i[we]||i["@@iterator"],typeof i=="function"?i:null)}var be=Symbol.for("react.client.reference");function Z(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===be?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case T:return"Fragment";case C:return"Profiler";case M:return"StrictMode";case P:return"Suspense";case ee:return"SuspenseList";case he:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case R:return i.displayName||"Context";case _:return(i._context.displayName||"Context")+".Consumer";case G:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case J:return s=i.displayName||null,s!==null?s:Z(i.type)||"Memo";case X:s=i._payload,i=i._init;try{return Z(i(s))}catch{}}return null}var ne=Array.isArray,j=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,U=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L={pending:!1,data:null,method:null,action:null},te=[],oe=-1;function E(i){return{current:i}}function q(i){0>oe||(i.current=te[oe],te[oe]=null,oe--)}function H(i,s){oe++,te[oe]=i.current,i.current=s}var Q=E(null),re=E(null),ce=E(null),Te=E(null);function Ct(i,s){switch(H(ce,s),H(re,i),H(Q,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?G0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=G0(s),i=Y0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}q(Q),H(Q,i)}function Je(){q(Q),q(re),q(ce)}function ii(i){i.memoizedState!==null&&H(Te,i);var s=Q.current,o=Y0(s,i.type);s!==o&&(H(re,i),H(Q,o))}function Ti(i){re.current===i&&(q(Q),q(re)),Te.current===i&&(q(Te),qa._currentValue=L)}var xe,Me;function ge(i){if(xe===void 0)try{throw Error()}catch(o){var s=o.stack.trim().match(/\n( *(at )?)/);xe=s&&s[1]||"",Me=-1<o.stack.indexOf(`
|
|
14
|
+
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
15
|
+
`+xe+i+Me}var Xe=!1;function ht(i,s){if(!i||Xe)return"";Xe=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(z){var B=z}Reflect.construct(i,[],I)}else{try{I.call()}catch(z){B=z}i.call(I.prototype)}}else{try{throw Error()}catch(z){B=z}(I=i())&&typeof I.catch=="function"&&I.catch(function(){})}}catch(z){if(z&&B&&typeof z.stack=="string")return[z.stack,B.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var p=l.DetermineComponentFrameRoot(),v=p[0],w=p[1];if(v&&w){var A=v.split(`
|
|
16
|
+
`),N=w.split(`
|
|
17
|
+
`);for(d=l=0;l<A.length&&!A[l].includes("DetermineComponentFrameRoot");)l++;for(;d<N.length&&!N[d].includes("DetermineComponentFrameRoot");)d++;if(l===A.length||d===N.length)for(l=A.length-1,d=N.length-1;1<=l&&0<=d&&A[l]!==N[d];)d--;for(;1<=l&&0<=d;l--,d--)if(A[l]!==N[d]){if(l!==1||d!==1)do if(l--,d--,0>d||A[l]!==N[d]){var V=`
|
|
18
|
+
`+A[l].replace(" at new "," at ");return i.displayName&&V.includes("<anonymous>")&&(V=V.replace("<anonymous>",i.displayName)),V}while(1<=l&&0<=d);break}}}finally{Xe=!1,Error.prepareStackTrace=o}return(o=i?i.displayName||i.name:"")?ge(o):""}function Le(i,s){switch(i.tag){case 26:case 27:case 5:return ge(i.type);case 16:return ge("Lazy");case 13:return i.child!==s&&s!==null?ge("Suspense Fallback"):ge("Suspense");case 19:return ge("SuspenseList");case 0:case 15:return ht(i.type,!1);case 11:return ht(i.type.render,!1);case 1:return ht(i.type,!0);case 31:return ge("Activity");default:return""}}function En(i){try{var s="",o=null;do s+=Le(i,o),o=i,i=i.return;while(i);return s}catch(l){return`
|
|
19
|
+
Error generating stack: `+l.message+`
|
|
20
|
+
`+l.stack}}var Gt=Object.prototype.hasOwnProperty,Vt=t.unstable_scheduleCallback,Hn=t.unstable_cancelCallback,ri=t.unstable_shouldYield,Fn=t.unstable_requestPaint,st=t.unstable_now,Kl=t.unstable_getCurrentPriorityLevel,Eg=t.unstable_ImmediatePriority,Og=t.unstable_UserBlockingPriority,ql=t.unstable_NormalPriority,W_=t.unstable_LowPriority,_g=t.unstable_IdlePriority,eR=t.log,tR=t.unstable_setDisableYieldValue,ea=null,dn=null;function tr(i){if(typeof eR=="function"&&tR(i),dn&&typeof dn.setStrictMode=="function")try{dn.setStrictMode(ea,i)}catch{}}var hn=Math.clz32?Math.clz32:rR,nR=Math.log,iR=Math.LN2;function rR(i){return i>>>=0,i===0?32:31-(nR(i)/iR|0)|0}var Il=256,Pl=262144,Hl=4194304;function Yr(i){var s=i&42;if(s!==0)return s;switch(i&-i){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function Fl(i,s,o){var l=i.pendingLanes;if(l===0)return 0;var d=0,p=i.suspendedLanes,v=i.pingedLanes;i=i.warmLanes;var w=l&134217727;return w!==0?(l=w&~p,l!==0?d=Yr(l):(v&=w,v!==0?d=Yr(v):o||(o=w&~i,o!==0&&(d=Yr(o))))):(w=l&~p,w!==0?d=Yr(w):v!==0?d=Yr(v):o||(o=l&~i,o!==0&&(d=Yr(o)))),d===0?0:s!==0&&s!==d&&(s&p)===0&&(p=d&-d,o=s&-s,p>=o||p===32&&(o&4194048)!==0)?s:d}function ta(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function sR(i,s){switch(i){case 1:case 2:case 4:case 8:case 64:return s+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rg(){var i=Hl;return Hl<<=1,(Hl&62914560)===0&&(Hl=4194304),i}function zf(i){for(var s=[],o=0;31>o;o++)s.push(i);return s}function na(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function oR(i,s,o,l,d,p){var v=i.pendingLanes;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=o,i.entangledLanes&=o,i.errorRecoveryDisabledLanes&=o,i.shellSuspendCounter=0;var w=i.entanglements,A=i.expirationTimes,N=i.hiddenUpdates;for(o=v&~o;0<o;){var V=31-hn(o),I=1<<V;w[V]=0,A[V]=-1;var B=N[V];if(B!==null)for(N[V]=null,V=0;V<B.length;V++){var z=B[V];z!==null&&(z.lane&=-536870913)}o&=~I}l!==0&&Cg(i,l,0),p!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=p&~(v&~s))}function Cg(i,s,o){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-hn(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|o&261930}function kg(i,s){var o=i.entangledLanes|=s;for(i=i.entanglements;o;){var l=31-hn(o),d=1<<l;d&s|i[l]&s&&(i[l]|=s),o&=~d}}function Mg(i,s){var o=s&-s;return o=(o&42)!==0?1:Lf(o),(o&(i.suspendedLanes|s))!==0?0:o}function Lf(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Vf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Dg(){var i=U.p;return i!==0?i:(i=window.event,i===void 0?32:gS(i.type))}function Ng(i,s){var o=U.p;try{return U.p=i,s()}finally{U.p=o}}var nr=Math.random().toString(36).slice(2),Ut="__reactFiber$"+nr,tn="__reactProps$"+nr,Ms="__reactContainer$"+nr,Uf="__reactEvents$"+nr,aR="__reactListeners$"+nr,lR="__reactHandles$"+nr,$g="__reactResources$"+nr,ia="__reactMarker$"+nr;function Kf(i){delete i[Ut],delete i[tn],delete i[Uf],delete i[aR],delete i[lR]}function Ds(i){var s=i[Ut];if(s)return s;for(var o=i.parentNode;o;){if(s=o[Ms]||o[Ut]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(i=tS(i);i!==null;){if(o=i[Ut])return o;i=tS(i)}return s}i=o,o=i.parentNode}return null}function Ns(i){if(i=i[Ut]||i[Ms]){var s=i.tag;if(s===5||s===6||s===13||s===31||s===26||s===27||s===3)return i}return null}function ra(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function $s(i){var s=i[$g];return s||(s=i[$g]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Nt(i){i[ia]=!0}var jg=new Set,Bg={};function Jr(i,s){js(i,s),js(i+"Capture",s)}function js(i,s){for(Bg[i]=s,i=0;i<s.length;i++)jg.add(s[i])}var uR=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),zg={},Lg={};function cR(i){return Gt.call(Lg,i)?!0:Gt.call(zg,i)?!1:uR.test(i)?Lg[i]=!0:(zg[i]=!0,!1)}function Gl(i,s,o){if(cR(s))if(o===null)i.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var l=s.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+o)}}function Yl(i,s,o){if(o===null)i.removeAttribute(s);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+o)}}function Ai(i,s,o,l){if(l===null)i.removeAttribute(o);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttributeNS(s,o,""+l)}}function On(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Vg(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function fR(i,s,o){var l=Object.getOwnPropertyDescriptor(i.constructor.prototype,s);if(!i.hasOwnProperty(s)&&typeof l<"u"&&typeof l.get=="function"&&typeof l.set=="function"){var d=l.get,p=l.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return d.call(this)},set:function(v){o=""+v,p.call(this,v)}}),Object.defineProperty(i,s,{enumerable:l.enumerable}),{getValue:function(){return o},setValue:function(v){o=""+v},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function qf(i){if(!i._valueTracker){var s=Vg(i)?"checked":"value";i._valueTracker=fR(i,s,""+i[s])}}function Ug(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),l="";return i&&(l=Vg(i)?i.checked?"true":"false":i.value),i=l,i!==o?(s.setValue(i),!0):!1}function Jl(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var dR=/[\n"\\]/g;function _n(i){return i.replace(dR,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function If(i,s,o,l,d,p,v,w){i.name="",v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"?i.type=v:i.removeAttribute("type"),s!=null?v==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+On(s)):i.value!==""+On(s)&&(i.value=""+On(s)):v!=="submit"&&v!=="reset"||i.removeAttribute("value"),s!=null?Pf(i,v,On(s)):o!=null?Pf(i,v,On(o)):l!=null&&i.removeAttribute("value"),d==null&&p!=null&&(i.defaultChecked=!!p),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+On(w):i.removeAttribute("name")}function Kg(i,s,o,l,d,p,v,w){if(p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(i.type=p),s!=null||o!=null){if(!(p!=="submit"&&p!=="reset"||s!=null)){qf(i);return}o=o!=null?""+On(o):"",s=s!=null?""+On(s):o,w||s===i.value||(i.value=s),i.defaultValue=s}l=l??d,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=w?i.checked:!!l,i.defaultChecked=!!l,v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.name=v),qf(i)}function Pf(i,s,o){s==="number"&&Jl(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function Bs(i,s,o,l){if(i=i.options,s){s={};for(var d=0;d<o.length;d++)s["$"+o[d]]=!0;for(o=0;o<i.length;o++)d=s.hasOwnProperty("$"+i[o].value),i[o].selected!==d&&(i[o].selected=d),d&&l&&(i[o].defaultSelected=!0)}else{for(o=""+On(o),s=null,d=0;d<i.length;d++){if(i[d].value===o){i[d].selected=!0,l&&(i[d].defaultSelected=!0);return}s!==null||i[d].disabled||(s=i[d])}s!==null&&(s.selected=!0)}}function qg(i,s,o){if(s!=null&&(s=""+On(s),s!==i.value&&(i.value=s),o==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=o!=null?""+On(o):""}function Ig(i,s,o,l){if(s==null){if(l!=null){if(o!=null)throw Error(r(92));if(ne(l)){if(1<l.length)throw Error(r(93));l=l[0]}o=l}o==null&&(o=""),s=o}o=On(s),i.defaultValue=o,l=i.textContent,l===o&&l!==""&&l!==null&&(i.value=l),qf(i)}function zs(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var hR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Pg(i,s,o){var l=s.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,o):typeof o!="number"||o===0||hR.has(s)?s==="float"?i.cssFloat=o:i[s]=(""+o).trim():i[s]=o+"px"}function Hg(i,s,o){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,o!=null){for(var l in o)!o.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var d in s)l=s[d],s.hasOwnProperty(d)&&o[d]!==l&&Pg(i,d,l)}else for(var p in s)s.hasOwnProperty(p)&&Pg(i,p,s[p])}function Hf(i){if(i.indexOf("-")===-1)return!1;switch(i){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var pR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),mR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Xl(i){return mR.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ei(){}var Ff=null;function Gf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ls=null,Vs=null;function Fg(i){var s=Ns(i);if(s&&(i=s.stateNode)){var o=i[tn]||null;e:switch(i=s.stateNode,s.type){case"input":if(If(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),s=o.name,o.type==="radio"&&s!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+_n(""+s)+'"][type="radio"]'),s=0;s<o.length;s++){var l=o[s];if(l!==i&&l.form===i.form){var d=l[tn]||null;if(!d)throw Error(r(90));If(l,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<o.length;s++)l=o[s],l.form===i.form&&Ug(l)}break e;case"textarea":qg(i,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&Bs(i,!!o.multiple,s,!1)}}}var Yf=!1;function Gg(i,s,o){if(Yf)return i(s,o);Yf=!0;try{var l=i(s);return l}finally{if(Yf=!1,(Ls!==null||Vs!==null)&&(zu(),Ls&&(s=Ls,i=Vs,Vs=Ls=null,Fg(s),i)))for(s=0;s<i.length;s++)Fg(i[s])}}function sa(i,s){var o=i.stateNode;if(o===null)return null;var l=o[tn]||null;if(l===null)return null;o=l[s];e:switch(s){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(i=i.type,l=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!l;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(r(231,s,typeof o));return o}var Oi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Jf=!1;if(Oi)try{var oa={};Object.defineProperty(oa,"passive",{get:function(){Jf=!0}}),window.addEventListener("test",oa,oa),window.removeEventListener("test",oa,oa)}catch{Jf=!1}var ir=null,Xf=null,Zl=null;function Yg(){if(Zl)return Zl;var i,s=Xf,o=s.length,l,d="value"in ir?ir.value:ir.textContent,p=d.length;for(i=0;i<o&&s[i]===d[i];i++);var v=o-i;for(l=1;l<=v&&s[o-l]===d[p-l];l++);return Zl=d.slice(i,1<l?1-l:void 0)}function Ql(i){var s=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&s===13&&(i=13)):i=s,i===10&&(i=13),32<=i||i===13?i:0}function Wl(){return!0}function Jg(){return!1}function nn(i){function s(o,l,d,p,v){this._reactName=o,this._targetInst=d,this.type=l,this.nativeEvent=p,this.target=v,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(o=i[w],this[w]=o?o(p):p[w]);return this.isDefaultPrevented=(p.defaultPrevented!=null?p.defaultPrevented:p.returnValue===!1)?Wl:Jg,this.isPropagationStopped=Jg,this}return g(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=Wl)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=Wl)},persist:function(){},isPersistent:Wl}),s}var Xr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eu=nn(Xr),aa=g({},Xr,{view:0,detail:0}),yR=nn(aa),Zf,Qf,la,tu=g({},aa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:ed,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==la&&(la&&i.type==="mousemove"?(Zf=i.screenX-la.screenX,Qf=i.screenY-la.screenY):Qf=Zf=0,la=i),Zf)},movementY:function(i){return"movementY"in i?i.movementY:Qf}}),Xg=nn(tu),gR=g({},tu,{dataTransfer:0}),vR=nn(gR),bR=g({},aa,{relatedTarget:0}),Wf=nn(bR),SR=g({},Xr,{animationName:0,elapsedTime:0,pseudoElement:0}),wR=nn(SR),xR=g({},Xr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),TR=nn(xR),AR=g({},Xr,{data:0}),Zg=nn(AR),ER={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},OR={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},_R={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function RR(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=_R[i])?!!s[i]:!1}function ed(){return RR}var CR=g({},aa,{key:function(i){if(i.key){var s=ER[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Ql(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?OR[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:ed,charCode:function(i){return i.type==="keypress"?Ql(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Ql(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),kR=nn(CR),MR=g({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Qg=nn(MR),DR=g({},aa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:ed}),NR=nn(DR),$R=g({},Xr,{propertyName:0,elapsedTime:0,pseudoElement:0}),jR=nn($R),BR=g({},tu,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),zR=nn(BR),LR=g({},Xr,{newState:0,oldState:0}),VR=nn(LR),UR=[9,13,27,32],td=Oi&&"CompositionEvent"in window,ua=null;Oi&&"documentMode"in document&&(ua=document.documentMode);var KR=Oi&&"TextEvent"in window&&!ua,Wg=Oi&&(!td||ua&&8<ua&&11>=ua),ev=" ",tv=!1;function nv(i,s){switch(i){case"keyup":return UR.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Us=!1;function qR(i,s){switch(i){case"compositionend":return iv(s);case"keypress":return s.which!==32?null:(tv=!0,ev);case"textInput":return i=s.data,i===ev&&tv?null:i;default:return null}}function IR(i,s){if(Us)return i==="compositionend"||!td&&nv(i,s)?(i=Yg(),Zl=Xf=ir=null,Us=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1<s.char.length)return s.char;if(s.which)return String.fromCharCode(s.which)}return null;case"compositionend":return Wg&&s.locale!=="ko"?null:s.data;default:return null}}var PR={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function rv(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!PR[i.type]:s==="textarea"}function sv(i,s,o,l){Ls?Vs?Vs.push(l):Vs=[l]:Ls=l,s=Pu(s,"onChange"),0<s.length&&(o=new eu("onChange","change",null,o,l),i.push({event:o,listeners:s}))}var ca=null,fa=null;function HR(i){K0(i,0)}function nu(i){var s=ra(i);if(Ug(s))return i}function ov(i,s){if(i==="change")return s}var av=!1;if(Oi){var nd;if(Oi){var id="oninput"in document;if(!id){var lv=document.createElement("div");lv.setAttribute("oninput","return;"),id=typeof lv.oninput=="function"}nd=id}else nd=!1;av=nd&&(!document.documentMode||9<document.documentMode)}function uv(){ca&&(ca.detachEvent("onpropertychange",cv),fa=ca=null)}function cv(i){if(i.propertyName==="value"&&nu(fa)){var s=[];sv(s,fa,i,Gf(i)),Gg(HR,s)}}function FR(i,s,o){i==="focusin"?(uv(),ca=s,fa=o,ca.attachEvent("onpropertychange",cv)):i==="focusout"&&uv()}function GR(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return nu(fa)}function YR(i,s){if(i==="click")return nu(s)}function JR(i,s){if(i==="input"||i==="change")return nu(s)}function XR(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var pn=typeof Object.is=="function"?Object.is:XR;function da(i,s){if(pn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var o=Object.keys(i),l=Object.keys(s);if(o.length!==l.length)return!1;for(l=0;l<o.length;l++){var d=o[l];if(!Gt.call(s,d)||!pn(i[d],s[d]))return!1}return!0}function fv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function dv(i,s){var o=fv(i);i=0;for(var l;o;){if(o.nodeType===3){if(l=i+o.textContent.length,i<=s&&l>=s)return{node:o,offset:s-i};i=l}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=fv(o)}}function hv(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?hv(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function pv(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Jl(i.document);s instanceof i.HTMLIFrameElement;){try{var o=typeof s.contentWindow.location.href=="string"}catch{o=!1}if(o)i=s.contentWindow;else break;s=Jl(i.document)}return s}function rd(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s&&(s==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||s==="textarea"||i.contentEditable==="true")}var ZR=Oi&&"documentMode"in document&&11>=document.documentMode,Ks=null,sd=null,ha=null,od=!1;function mv(i,s,o){var l=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;od||Ks==null||Ks!==Jl(l)||(l=Ks,"selectionStart"in l&&rd(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),ha&&da(ha,l)||(ha=l,l=Pu(sd,"onSelect"),0<l.length&&(s=new eu("onSelect","select",null,s,o),i.push({event:s,listeners:l}),s.target=Ks)))}function Zr(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var qs={animationend:Zr("Animation","AnimationEnd"),animationiteration:Zr("Animation","AnimationIteration"),animationstart:Zr("Animation","AnimationStart"),transitionrun:Zr("Transition","TransitionRun"),transitionstart:Zr("Transition","TransitionStart"),transitioncancel:Zr("Transition","TransitionCancel"),transitionend:Zr("Transition","TransitionEnd")},ad={},yv={};Oi&&(yv=document.createElement("div").style,"AnimationEvent"in window||(delete qs.animationend.animation,delete qs.animationiteration.animation,delete qs.animationstart.animation),"TransitionEvent"in window||delete qs.transitionend.transition);function Qr(i){if(ad[i])return ad[i];if(!qs[i])return i;var s=qs[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in yv)return ad[i]=s[o];return i}var gv=Qr("animationend"),vv=Qr("animationiteration"),bv=Qr("animationstart"),QR=Qr("transitionrun"),WR=Qr("transitionstart"),eC=Qr("transitioncancel"),Sv=Qr("transitionend"),wv=new Map,ld="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ld.push("scrollEnd");function Gn(i,s){wv.set(i,s),Jr(s,[i])}var iu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Rn=[],Is=0,ud=0;function ru(){for(var i=Is,s=ud=Is=0;s<i;){var o=Rn[s];Rn[s++]=null;var l=Rn[s];Rn[s++]=null;var d=Rn[s];Rn[s++]=null;var p=Rn[s];if(Rn[s++]=null,l!==null&&d!==null){var v=l.pending;v===null?d.next=d:(d.next=v.next,v.next=d),l.pending=d}p!==0&&xv(o,d,p)}}function su(i,s,o,l){Rn[Is++]=i,Rn[Is++]=s,Rn[Is++]=o,Rn[Is++]=l,ud|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function cd(i,s,o,l){return su(i,s,o,l),ou(i)}function Wr(i,s){return su(i,null,null,s),ou(i)}function xv(i,s,o){i.lanes|=o;var l=i.alternate;l!==null&&(l.lanes|=o);for(var d=!1,p=i.return;p!==null;)p.childLanes|=o,l=p.alternate,l!==null&&(l.childLanes|=o),p.tag===22&&(i=p.stateNode,i===null||i._visibility&1||(d=!0)),i=p,p=p.return;return i.tag===3?(p=i.stateNode,d&&s!==null&&(d=31-hn(o),i=p.hiddenUpdates,l=i[d],l===null?i[d]=[s]:l.push(s),s.lane=o|536870912),p):null}function ou(i){if(50<ja)throw ja=0,bh=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Ps={};function tC(i,s,o,l){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=s,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function mn(i,s,o,l){return new tC(i,s,o,l)}function fd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function _i(i,s){var o=i.alternate;return o===null?(o=mn(i.tag,s,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=s,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&65011712,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,s=i.dependencies,o.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o.refCleanup=i.refCleanup,o}function Tv(i,s){i.flags&=65011714;var o=i.alternate;return o===null?(i.childLanes=0,i.lanes=s,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,s=o.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function au(i,s,o,l,d,p){var v=0;if(l=i,typeof i=="function")fd(i)&&(v=1);else if(typeof i=="string")v=ok(i,o,Q.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case he:return i=mn(31,o,s,d),i.elementType=he,i.lanes=p,i;case T:return es(o.children,d,p,s);case M:v=8,d|=24;break;case C:return i=mn(12,o,s,d|2),i.elementType=C,i.lanes=p,i;case P:return i=mn(13,o,s,d),i.elementType=P,i.lanes=p,i;case ee:return i=mn(19,o,s,d),i.elementType=ee,i.lanes=p,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case R:v=10;break e;case _:v=9;break e;case G:v=11;break e;case J:v=14;break e;case X:v=16,l=null;break e}v=29,o=Error(r(130,i===null?"null":typeof i,"")),l=null}return s=mn(v,o,s,d),s.elementType=i,s.type=l,s.lanes=p,s}function es(i,s,o,l){return i=mn(7,i,l,s),i.lanes=o,i}function dd(i,s,o){return i=mn(6,i,null,s),i.lanes=o,i}function Av(i){var s=mn(18,null,null,0);return s.stateNode=i,s}function hd(i,s,o){return s=mn(4,i.children!==null?i.children:[],i.key,s),s.lanes=o,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Ev=new WeakMap;function Cn(i,s){if(typeof i=="object"&&i!==null){var o=Ev.get(i);return o!==void 0?o:(s={value:i,source:s,stack:En(s)},Ev.set(i,s),s)}return{value:i,source:s,stack:En(s)}}var Hs=[],Fs=0,lu=null,pa=0,kn=[],Mn=0,rr=null,si=1,oi="";function Ri(i,s){Hs[Fs++]=pa,Hs[Fs++]=lu,lu=i,pa=s}function Ov(i,s,o){kn[Mn++]=si,kn[Mn++]=oi,kn[Mn++]=rr,rr=i;var l=si;i=oi;var d=32-hn(l)-1;l&=~(1<<d),o+=1;var p=32-hn(s)+d;if(30<p){var v=d-d%5;p=(l&(1<<v)-1).toString(32),l>>=v,d-=v,si=1<<32-hn(s)+d|o<<d|l,oi=p+i}else si=1<<p|o<<d|l,oi=i}function pd(i){i.return!==null&&(Ri(i,1),Ov(i,1,0))}function md(i){for(;i===lu;)lu=Hs[--Fs],Hs[Fs]=null,pa=Hs[--Fs],Hs[Fs]=null;for(;i===rr;)rr=kn[--Mn],kn[Mn]=null,oi=kn[--Mn],kn[Mn]=null,si=kn[--Mn],kn[Mn]=null}function _v(i,s){kn[Mn++]=si,kn[Mn++]=oi,kn[Mn++]=rr,si=s.id,oi=s.overflow,rr=i}var Kt=null,Ze=null,Ce=!1,sr=null,Dn=!1,yd=Error(r(519));function or(i){var s=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ma(Cn(s,i)),yd}function Rv(i){var s=i.stateNode,o=i.type,l=i.memoizedProps;switch(s[Ut]=i,s[tn]=l,o){case"dialog":Ee("cancel",s),Ee("close",s);break;case"iframe":case"object":case"embed":Ee("load",s);break;case"video":case"audio":for(o=0;o<za.length;o++)Ee(za[o],s);break;case"source":Ee("error",s);break;case"img":case"image":case"link":Ee("error",s),Ee("load",s);break;case"details":Ee("toggle",s);break;case"input":Ee("invalid",s),Kg(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0);break;case"select":Ee("invalid",s);break;case"textarea":Ee("invalid",s),Ig(s,l.value,l.defaultValue,l.children)}o=l.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||s.textContent===""+o||l.suppressHydrationWarning===!0||H0(s.textContent,o)?(l.popover!=null&&(Ee("beforetoggle",s),Ee("toggle",s)),l.onScroll!=null&&Ee("scroll",s),l.onScrollEnd!=null&&Ee("scrollend",s),l.onClick!=null&&(s.onclick=Ei),s=!0):s=!1,s||or(i,!0)}function Cv(i){for(Kt=i.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:Dn=!1;return;case 27:case 3:Dn=!0;return;default:Kt=Kt.return}}function Gs(i){if(i!==Kt)return!1;if(!Ce)return Cv(i),Ce=!0,!1;var s=i.tag,o;if((o=s!==3&&s!==27)&&((o=s===5)&&(o=i.type,o=!(o!=="form"&&o!=="button")||$h(i.type,i.memoizedProps)),o=!o),o&&Ze&&or(i),Cv(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=eS(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=eS(i)}else s===27?(s=Ze,Sr(i.type)?(i=Vh,Vh=null,Ze=i):Ze=s):Ze=Kt?$n(i.stateNode.nextSibling):null;return!0}function ts(){Ze=Kt=null,Ce=!1}function gd(){var i=sr;return i!==null&&(an===null?an=i:an.push.apply(an,i),sr=null),i}function ma(i){sr===null?sr=[i]:sr.push(i)}var vd=E(null),ns=null,Ci=null;function ar(i,s,o){H(vd,s._currentValue),s._currentValue=o}function ki(i){i._currentValue=vd.current,q(vd)}function bd(i,s,o){for(;i!==null;){var l=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,l!==null&&(l.childLanes|=s)):l!==null&&(l.childLanes&s)!==s&&(l.childLanes|=s),i===o)break;i=i.return}}function Sd(i,s,o,l){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var p=d.dependencies;if(p!==null){var v=d.child;p=p.firstContext;e:for(;p!==null;){var w=p;p=d;for(var A=0;A<s.length;A++)if(w.context===s[A]){p.lanes|=o,w=p.alternate,w!==null&&(w.lanes|=o),bd(p.return,o,i),l||(v=null);break e}p=w.next}}else if(d.tag===18){if(v=d.return,v===null)throw Error(r(341));v.lanes|=o,p=v.alternate,p!==null&&(p.lanes|=o),bd(v,o,i),v=null}else v=d.child;if(v!==null)v.return=d;else for(v=d;v!==null;){if(v===i){v=null;break}if(d=v.sibling,d!==null){d.return=v.return,v=d;break}v=v.return}d=v}}function Ys(i,s,o,l){i=null;for(var d=s,p=!1;d!==null;){if(!p){if((d.flags&524288)!==0)p=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var v=d.alternate;if(v===null)throw Error(r(387));if(v=v.memoizedProps,v!==null){var w=d.type;pn(d.pendingProps.value,v.value)||(i!==null?i.push(w):i=[w])}}else if(d===Te.current){if(v=d.alternate,v===null)throw Error(r(387));v.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(qa):i=[qa])}d=d.return}i!==null&&Sd(s,i,o,l),s.flags|=262144}function uu(i){for(i=i.firstContext;i!==null;){if(!pn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function is(i){ns=i,Ci=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function qt(i){return kv(ns,i)}function cu(i,s){return ns===null&&is(i),kv(i,s)}function kv(i,s){var o=s._currentValue;if(s={context:s,memoizedValue:o,next:null},Ci===null){if(i===null)throw Error(r(308));Ci=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Ci=Ci.next=s;return o}var nC=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(o,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(o){return o()})}},iC=t.unstable_scheduleCallback,rC=t.unstable_NormalPriority,bt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function wd(){return{controller:new nC,data:new Map,refCount:0}}function ya(i){i.refCount--,i.refCount===0&&iC(rC,function(){i.controller.abort()})}var ga=null,xd=0,Js=0,Xs=null;function sC(i,s){if(ga===null){var o=ga=[];xd=0,Js=Eh(),Xs={status:"pending",value:void 0,then:function(l){o.push(l)}}}return xd++,s.then(Mv,Mv),s}function Mv(){if(--xd===0&&ga!==null){Xs!==null&&(Xs.status="fulfilled");var i=ga;ga=null,Js=0,Xs=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function oC(i,s){var o=[],l={status:"pending",value:null,reason:null,then:function(d){o.push(d)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var d=0;d<o.length;d++)(0,o[d])(s)},function(d){for(l.status="rejected",l.reason=d,d=0;d<o.length;d++)(0,o[d])(void 0)}),l}var Dv=j.S;j.S=function(i,s){m0=st(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&sC(i,s),Dv!==null&&Dv(i,s)};var rs=E(null);function Td(){var i=rs.current;return i!==null?i:He.pooledCache}function fu(i,s){s===null?H(rs,rs.current):H(rs,s.pool)}function Nv(){var i=Td();return i===null?null:{parent:bt._currentValue,pool:i}}var Zs=Error(r(460)),Ad=Error(r(474)),du=Error(r(542)),hu={then:function(){}};function $v(i){return i=i.status,i==="fulfilled"||i==="rejected"}function jv(i,s,o){switch(o=i[o],o===void 0?i.push(s):o!==s&&(s.then(Ei,Ei),s=o),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,zv(i),i;default:if(typeof s.status=="string")s.then(Ei,Ei);else{if(i=He,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=l}},function(l){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,zv(i),i}throw os=s,Zs}}function ss(i){try{var s=i._init;return s(i._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(os=o,Zs):o}}var os=null;function Bv(){if(os===null)throw Error(r(459));var i=os;return os=null,i}function zv(i){if(i===Zs||i===du)throw Error(r(483))}var Qs=null,va=0;function pu(i){var s=va;return va+=1,Qs===null&&(Qs=[]),jv(Qs,i,s)}function ba(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function mu(i,s){throw s.$$typeof===b?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function Lv(i){function s(k,O){if(i){var D=k.deletions;D===null?(k.deletions=[O],k.flags|=16):D.push(O)}}function o(k,O){if(!i)return null;for(;O!==null;)s(k,O),O=O.sibling;return null}function l(k){for(var O=new Map;k!==null;)k.key!==null?O.set(k.key,k):O.set(k.index,k),k=k.sibling;return O}function d(k,O){return k=_i(k,O),k.index=0,k.sibling=null,k}function p(k,O,D){return k.index=D,i?(D=k.alternate,D!==null?(D=D.index,D<O?(k.flags|=67108866,O):D):(k.flags|=67108866,O)):(k.flags|=1048576,O)}function v(k){return i&&k.alternate===null&&(k.flags|=67108866),k}function w(k,O,D,K){return O===null||O.tag!==6?(O=dd(D,k.mode,K),O.return=k,O):(O=d(O,D),O.return=k,O)}function A(k,O,D,K){var le=D.type;return le===T?V(k,O,D.props.children,K,D.key):O!==null&&(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&ss(le)===O.type)?(O=d(O,D.props),ba(O,D),O.return=k,O):(O=au(D.type,D.key,D.props,null,k.mode,K),ba(O,D),O.return=k,O)}function N(k,O,D,K){return O===null||O.tag!==4||O.stateNode.containerInfo!==D.containerInfo||O.stateNode.implementation!==D.implementation?(O=hd(D,k.mode,K),O.return=k,O):(O=d(O,D.children||[]),O.return=k,O)}function V(k,O,D,K,le){return O===null||O.tag!==7?(O=es(D,k.mode,K,le),O.return=k,O):(O=d(O,D),O.return=k,O)}function I(k,O,D){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=dd(""+O,k.mode,D),O.return=k,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case S:return D=au(O.type,O.key,O.props,null,k.mode,D),ba(D,O),D.return=k,D;case x:return O=hd(O,k.mode,D),O.return=k,O;case X:return O=ss(O),I(k,O,D)}if(ne(O)||je(O))return O=es(O,k.mode,D,null),O.return=k,O;if(typeof O.then=="function")return I(k,pu(O),D);if(O.$$typeof===R)return I(k,cu(k,O),D);mu(k,O)}return null}function B(k,O,D,K){var le=O!==null?O.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return le!==null?null:w(k,O,""+D,K);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===le?A(k,O,D,K):null;case x:return D.key===le?N(k,O,D,K):null;case X:return D=ss(D),B(k,O,D,K)}if(ne(D)||je(D))return le!==null?null:V(k,O,D,K,null);if(typeof D.then=="function")return B(k,O,pu(D),K);if(D.$$typeof===R)return B(k,O,cu(k,D),K);mu(k,D)}return null}function z(k,O,D,K,le){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return k=k.get(D)||null,w(O,k,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return k=k.get(K.key===null?D:K.key)||null,A(O,k,K,le);case x:return k=k.get(K.key===null?D:K.key)||null,N(O,k,K,le);case X:return K=ss(K),z(k,O,D,K,le)}if(ne(K)||je(K))return k=k.get(D)||null,V(O,k,K,le,null);if(typeof K.then=="function")return z(k,O,D,pu(K),le);if(K.$$typeof===R)return z(k,O,D,cu(O,K),le);mu(O,K)}return null}function ie(k,O,D,K){for(var le=null,Ne=null,se=O,Se=O=0,_e=null;se!==null&&Se<D.length;Se++){se.index>Se?(_e=se,se=null):_e=se.sibling;var $e=B(k,se,D[Se],K);if($e===null){se===null&&(se=_e);break}i&&se&&$e.alternate===null&&s(k,se),O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e,se=_e}if(Se===D.length)return o(k,se),Ce&&Ri(k,Se),le;if(se===null){for(;Se<D.length;Se++)se=I(k,D[Se],K),se!==null&&(O=p(se,O,Se),Ne===null?le=se:Ne.sibling=se,Ne=se);return Ce&&Ri(k,Se),le}for(se=l(se);Se<D.length;Se++)_e=z(se,k,Se,D[Se],K),_e!==null&&(i&&_e.alternate!==null&&se.delete(_e.key===null?Se:_e.key),O=p(_e,O,Se),Ne===null?le=_e:Ne.sibling=_e,Ne=_e);return i&&se.forEach(function(Er){return s(k,Er)}),Ce&&Ri(k,Se),le}function ue(k,O,D,K){if(D==null)throw Error(r(151));for(var le=null,Ne=null,se=O,Se=O=0,_e=null,$e=D.next();se!==null&&!$e.done;Se++,$e=D.next()){se.index>Se?(_e=se,se=null):_e=se.sibling;var Er=B(k,se,$e.value,K);if(Er===null){se===null&&(se=_e);break}i&&se&&Er.alternate===null&&s(k,se),O=p(Er,O,Se),Ne===null?le=Er:Ne.sibling=Er,Ne=Er,se=_e}if($e.done)return o(k,se),Ce&&Ri(k,Se),le;if(se===null){for(;!$e.done;Se++,$e=D.next())$e=I(k,$e.value,K),$e!==null&&(O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e);return Ce&&Ri(k,Se),le}for(se=l(se);!$e.done;Se++,$e=D.next())$e=z(se,k,Se,$e.value,K),$e!==null&&(i&&$e.alternate!==null&&se.delete($e.key===null?Se:$e.key),O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e);return i&&se.forEach(function(gk){return s(k,gk)}),Ce&&Ri(k,Se),le}function Ie(k,O,D,K){if(typeof D=="object"&&D!==null&&D.type===T&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case S:e:{for(var le=D.key;O!==null;){if(O.key===le){if(le=D.type,le===T){if(O.tag===7){o(k,O.sibling),K=d(O,D.props.children),K.return=k,k=K;break e}}else if(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&ss(le)===O.type){o(k,O.sibling),K=d(O,D.props),ba(K,D),K.return=k,k=K;break e}o(k,O);break}else s(k,O);O=O.sibling}D.type===T?(K=es(D.props.children,k.mode,K,D.key),K.return=k,k=K):(K=au(D.type,D.key,D.props,null,k.mode,K),ba(K,D),K.return=k,k=K)}return v(k);case x:e:{for(le=D.key;O!==null;){if(O.key===le)if(O.tag===4&&O.stateNode.containerInfo===D.containerInfo&&O.stateNode.implementation===D.implementation){o(k,O.sibling),K=d(O,D.children||[]),K.return=k,k=K;break e}else{o(k,O);break}else s(k,O);O=O.sibling}K=hd(D,k.mode,K),K.return=k,k=K}return v(k);case X:return D=ss(D),Ie(k,O,D,K)}if(ne(D))return ie(k,O,D,K);if(je(D)){if(le=je(D),typeof le!="function")throw Error(r(150));return D=le.call(D),ue(k,O,D,K)}if(typeof D.then=="function")return Ie(k,O,pu(D),K);if(D.$$typeof===R)return Ie(k,O,cu(k,D),K);mu(k,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,O!==null&&O.tag===6?(o(k,O.sibling),K=d(O,D),K.return=k,k=K):(o(k,O),K=dd(D,k.mode,K),K.return=k,k=K),v(k)):o(k,O)}return function(k,O,D,K){try{va=0;var le=Ie(k,O,D,K);return Qs=null,le}catch(se){if(se===Zs||se===du)throw se;var Ne=mn(29,se,null,k.mode);return Ne.lanes=K,Ne.return=k,Ne}finally{}}}var as=Lv(!0),Vv=Lv(!1),lr=!1;function Ed(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Od(i,s){i=i.updateQueue,s.updateQueue===i&&(s.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ur(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function cr(i,s,o){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Be&2)!==0){var d=l.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),l.pending=s,s=ou(i),xv(i,null,o),s}return su(i,l,s,o),ou(i)}function Sa(i,s,o){if(s=s.updateQueue,s!==null&&(s=s.shared,(o&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,o|=l,s.lanes=o,kg(i,o)}}function _d(i,s){var o=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,o===l)){var d=null,p=null;if(o=o.firstBaseUpdate,o!==null){do{var v={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};p===null?d=p=v:p=p.next=v,o=o.next}while(o!==null);p===null?d=p=s:p=p.next=s}else d=p=s;o={baseState:l.baseState,firstBaseUpdate:d,lastBaseUpdate:p,shared:l.shared,callbacks:l.callbacks},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=s:i.next=s,o.lastBaseUpdate=s}var Rd=!1;function wa(){if(Rd){var i=Xs;if(i!==null)throw i}}function xa(i,s,o,l){Rd=!1;var d=i.updateQueue;lr=!1;var p=d.firstBaseUpdate,v=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var A=w,N=A.next;A.next=null,v===null?p=N:v.next=N,v=A;var V=i.alternate;V!==null&&(V=V.updateQueue,w=V.lastBaseUpdate,w!==v&&(w===null?V.firstBaseUpdate=N:w.next=N,V.lastBaseUpdate=A))}if(p!==null){var I=d.baseState;v=0,V=N=A=null,w=p;do{var B=w.lane&-536870913,z=B!==w.lane;if(z?(Oe&B)===B:(l&B)===B){B!==0&&B===Js&&(Rd=!0),V!==null&&(V=V.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var ie=i,ue=w;B=s;var Ie=o;switch(ue.tag){case 1:if(ie=ue.payload,typeof ie=="function"){I=ie.call(Ie,I,B);break e}I=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ue.payload,B=typeof ie=="function"?ie.call(Ie,I,B):ie,B==null)break e;I=g({},I,B);break e;case 2:lr=!0}}B=w.callback,B!==null&&(i.flags|=64,z&&(i.flags|=8192),z=d.callbacks,z===null?d.callbacks=[B]:z.push(B))}else z={lane:B,tag:w.tag,payload:w.payload,callback:w.callback,next:null},V===null?(N=V=z,A=I):V=V.next=z,v|=B;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;z=w,w=z.next,z.next=null,d.lastBaseUpdate=z,d.shared.pending=null}}while(!0);V===null&&(A=I),d.baseState=A,d.firstBaseUpdate=N,d.lastBaseUpdate=V,p===null&&(d.shared.lanes=0),mr|=v,i.lanes=v,i.memoizedState=I}}function Uv(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Kv(i,s){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;i<o.length;i++)Uv(o[i],s)}var Ws=E(null),yu=E(0);function qv(i,s){i=Vi,H(yu,i),H(Ws,s),Vi=i|s.baseLanes}function Cd(){H(yu,Vi),H(Ws,Ws.current)}function kd(){Vi=yu.current,q(Ws),q(yu)}var yn=E(null),Nn=null;function fr(i){var s=i.alternate;H(pt,pt.current&1),H(yn,i),Nn===null&&(s===null||Ws.current!==null||s.memoizedState!==null)&&(Nn=i)}function Md(i){H(pt,pt.current),H(yn,i),Nn===null&&(Nn=i)}function Iv(i){i.tag===22?(H(pt,pt.current),H(yn,i),Nn===null&&(Nn=i)):dr()}function dr(){H(pt,pt.current),H(yn,yn.current)}function gn(i){q(yn),Nn===i&&(Nn=null),q(pt)}var pt=E(0);function gu(i){for(var s=i;s!==null;){if(s.tag===13){var o=s.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||zh(o)||Lh(o)))return s}else if(s.tag===19&&(s.memoizedProps.revealOrder==="forwards"||s.memoizedProps.revealOrder==="backwards"||s.memoizedProps.revealOrder==="unstable_legacy-backwards"||s.memoizedProps.revealOrder==="together")){if((s.flags&128)!==0)return s}else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return null;s=s.return}s.sibling.return=s.return,s=s.sibling}return null}var Mi=0,ve=null,Ke=null,St=null,vu=!1,eo=!1,ls=!1,bu=0,Ta=0,to=null,aC=0;function ot(){throw Error(r(321))}function Dd(i,s){if(s===null)return!1;for(var o=0;o<s.length&&o<i.length;o++)if(!pn(i[o],s[o]))return!1;return!0}function Nd(i,s,o,l,d,p){return Mi=p,ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,j.H=i===null||i.memoizedState===null?Ob:Yd,ls=!1,p=o(l,d),ls=!1,eo&&(p=Hv(s,o,l,d)),Pv(i),p}function Pv(i){j.H=Oa;var s=Ke!==null&&Ke.next!==null;if(Mi=0,St=Ke=ve=null,vu=!1,Ta=0,to=null,s)throw Error(r(300));i===null||wt||(i=i.dependencies,i!==null&&uu(i)&&(wt=!0))}function Hv(i,s,o,l){ve=i;var d=0;do{if(eo&&(to=null),Ta=0,eo=!1,25<=d)throw Error(r(301));if(d+=1,St=Ke=null,i.updateQueue!=null){var p=i.updateQueue;p.lastEffect=null,p.events=null,p.stores=null,p.memoCache!=null&&(p.memoCache.index=0)}j.H=_b,p=s(o,l)}while(eo);return p}function lC(){var i=j.H,s=i.useState()[0];return s=typeof s.then=="function"?Aa(s):s,i=i.useState()[0],(Ke!==null?Ke.memoizedState:null)!==i&&(ve.flags|=1024),s}function $d(){var i=bu!==0;return bu=0,i}function jd(i,s,o){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~o}function Bd(i){if(vu){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}vu=!1}Mi=0,St=Ke=ve=null,eo=!1,Ta=bu=0,to=null}function Zt(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?ve.memoizedState=St=i:St=St.next=i,St}function mt(){if(Ke===null){var i=ve.alternate;i=i!==null?i.memoizedState:null}else i=Ke.next;var s=St===null?ve.memoizedState:St.next;if(s!==null)St=s,Ke=i;else{if(i===null)throw ve.alternate===null?Error(r(467)):Error(r(310));Ke=i,i={memoizedState:Ke.memoizedState,baseState:Ke.baseState,baseQueue:Ke.baseQueue,queue:Ke.queue,next:null},St===null?ve.memoizedState=St=i:St=St.next=i}return St}function Su(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Aa(i){var s=Ta;return Ta+=1,to===null&&(to=[]),i=jv(to,i,s),s=ve,(St===null?s.memoizedState:St.next)===null&&(s=s.alternate,j.H=s===null||s.memoizedState===null?Ob:Yd),i}function wu(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Aa(i);if(i.$$typeof===R)return qt(i)}throw Error(r(438,String(i)))}function zd(i){var s=null,o=ve.updateQueue;if(o!==null&&(s=o.memoCache),s==null){var l=ve.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),o===null&&(o=Su(),ve.updateQueue=o),o.memoCache=s,o=s.data[s.index],o===void 0)for(o=s.data[s.index]=Array(i),l=0;l<i;l++)o[l]=pe;return s.index++,o}function Di(i,s){return typeof s=="function"?s(i):s}function xu(i){var s=mt();return Ld(s,Ke,i)}function Ld(i,s,o){var l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=o;var d=i.baseQueue,p=l.pending;if(p!==null){if(d!==null){var v=d.next;d.next=p.next,p.next=v}s.baseQueue=d=p,l.pending=null}if(p=i.baseState,d===null)i.memoizedState=p;else{s=d.next;var w=v=null,A=null,N=s,V=!1;do{var I=N.lane&-536870913;if(I!==N.lane?(Oe&I)===I:(Mi&I)===I){var B=N.revertLane;if(B===0)A!==null&&(A=A.next={lane:0,revertLane:0,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null}),I===Js&&(V=!0);else if((Mi&B)===B){N=N.next,B===Js&&(V=!0);continue}else I={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},A===null?(w=A=I,v=p):A=A.next=I,ve.lanes|=B,mr|=B;I=N.action,ls&&o(p,I),p=N.hasEagerState?N.eagerState:o(p,I)}else B={lane:I,revertLane:N.revertLane,gesture:N.gesture,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},A===null?(w=A=B,v=p):A=A.next=B,ve.lanes|=I,mr|=I;N=N.next}while(N!==null&&N!==s);if(A===null?v=p:A.next=w,!pn(p,i.memoizedState)&&(wt=!0,V&&(o=Xs,o!==null)))throw o;i.memoizedState=p,i.baseState=v,i.baseQueue=A,l.lastRenderedState=p}return d===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Vd(i){var s=mt(),o=s.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var l=o.dispatch,d=o.pending,p=s.memoizedState;if(d!==null){o.pending=null;var v=d=d.next;do p=i(p,v.action),v=v.next;while(v!==d);pn(p,s.memoizedState)||(wt=!0),s.memoizedState=p,s.baseQueue===null&&(s.baseState=p),o.lastRenderedState=p}return[p,l]}function Fv(i,s,o){var l=ve,d=mt(),p=Ce;if(p){if(o===void 0)throw Error(r(407));o=o()}else o=s();var v=!pn((Ke||d).memoizedState,o);if(v&&(d.memoizedState=o,wt=!0),d=d.queue,qd(Jv.bind(null,l,d,i),[i]),d.getSnapshot!==s||v||St!==null&&St.memoizedState.tag&1){if(l.flags|=2048,no(9,{destroy:void 0},Yv.bind(null,l,d,o,s),null),He===null)throw Error(r(349));p||(Mi&127)!==0||Gv(l,s,o)}return o}function Gv(i,s,o){i.flags|=16384,i={getSnapshot:s,value:o},s=ve.updateQueue,s===null?(s=Su(),ve.updateQueue=s,s.stores=[i]):(o=s.stores,o===null?s.stores=[i]:o.push(i))}function Yv(i,s,o,l){s.value=o,s.getSnapshot=l,Xv(s)&&Zv(i)}function Jv(i,s,o){return o(function(){Xv(s)&&Zv(i)})}function Xv(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!pn(i,o)}catch{return!0}}function Zv(i){var s=Wr(i,2);s!==null&&ln(s,i,2)}function Ud(i){var s=Zt();if(typeof i=="function"){var o=i;if(i=o(),ls){tr(!0);try{o()}finally{tr(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:i},s}function Qv(i,s,o,l){return i.baseState=o,Ld(i,Ke,typeof l=="function"?l:Di)}function uC(i,s,o,l,d){if(Eu(i))throw Error(r(485));if(i=s.action,i!==null){var p={payload:d,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(v){p.listeners.push(v)}};j.T!==null?o(!0):p.isTransition=!1,l(p),o=s.pending,o===null?(p.next=s.pending=p,Wv(s,p)):(p.next=o.next,s.pending=o.next=p)}}function Wv(i,s){var o=s.action,l=s.payload,d=i.state;if(s.isTransition){var p=j.T,v={};j.T=v;try{var w=o(d,l),A=j.S;A!==null&&A(v,w),eb(i,s,w)}catch(N){Kd(i,s,N)}finally{p!==null&&v.types!==null&&(p.types=v.types),j.T=p}}else try{p=o(d,l),eb(i,s,p)}catch(N){Kd(i,s,N)}}function eb(i,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(l){tb(i,s,l)},function(l){return Kd(i,s,l)}):tb(i,s,o)}function tb(i,s,o){s.status="fulfilled",s.value=o,nb(s),i.state=o,s=i.pending,s!==null&&(o=s.next,o===s?i.pending=null:(o=o.next,s.next=o,Wv(i,o)))}function Kd(i,s,o){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=o,nb(s),s=s.next;while(s!==l)}i.action=null}function nb(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function ib(i,s){return s}function rb(i,s){if(Ce){var o=He.formState;if(o!==null){e:{var l=ve;if(Ce){if(Ze){t:{for(var d=Ze,p=Dn;d.nodeType!==8;){if(!p){d=null;break t}if(d=$n(d.nextSibling),d===null){d=null;break t}}p=d.data,d=p==="F!"||p==="F"?d:null}if(d){Ze=$n(d.nextSibling),l=d.data==="F!";break e}}or(l)}l=!1}l&&(s=o[0])}}return o=Zt(),o.memoizedState=o.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ib,lastRenderedState:s},o.queue=l,o=Tb.bind(null,ve,l),l.dispatch=o,l=Ud(!1),p=Gd.bind(null,ve,!1,l.queue),l=Zt(),d={state:s,dispatch:null,action:i,pending:null},l.queue=d,o=uC.bind(null,ve,d,p,o),d.dispatch=o,l.memoizedState=i,[s,o,!1]}function sb(i){var s=mt();return ob(s,Ke,i)}function ob(i,s,o){if(s=Ld(i,s,ib)[0],i=xu(Di)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Aa(s)}catch(v){throw v===Zs?du:v}else l=s;s=mt();var d=s.queue,p=d.dispatch;return o!==s.memoizedState&&(ve.flags|=2048,no(9,{destroy:void 0},cC.bind(null,d,o),null)),[l,p,i]}function cC(i,s){i.action=s}function ab(i){var s=mt(),o=Ke;if(o!==null)return ob(s,o,i);mt(),s=s.memoizedState,o=mt();var l=o.queue.dispatch;return o.memoizedState=i,[s,l,!1]}function no(i,s,o,l){return i={tag:i,create:o,deps:l,inst:s,next:null},s=ve.updateQueue,s===null&&(s=Su(),ve.updateQueue=s),o=s.lastEffect,o===null?s.lastEffect=i.next=i:(l=o.next,o.next=i,i.next=l,s.lastEffect=i),i}function lb(){return mt().memoizedState}function Tu(i,s,o,l){var d=Zt();ve.flags|=i,d.memoizedState=no(1|s,{destroy:void 0},o,l===void 0?null:l)}function Au(i,s,o,l){var d=mt();l=l===void 0?null:l;var p=d.memoizedState.inst;Ke!==null&&l!==null&&Dd(l,Ke.memoizedState.deps)?d.memoizedState=no(s,p,o,l):(ve.flags|=i,d.memoizedState=no(1|s,p,o,l))}function ub(i,s){Tu(8390656,8,i,s)}function qd(i,s){Au(2048,8,i,s)}function fC(i){ve.flags|=4;var s=ve.updateQueue;if(s===null)s=Su(),ve.updateQueue=s,s.events=[i];else{var o=s.events;o===null?s.events=[i]:o.push(i)}}function cb(i){var s=mt().memoizedState;return fC({ref:s,nextImpl:i}),function(){if((Be&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function fb(i,s){return Au(4,2,i,s)}function db(i,s){return Au(4,4,i,s)}function hb(i,s){if(typeof s=="function"){i=i();var o=s(i);return function(){typeof o=="function"?o():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function pb(i,s,o){o=o!=null?o.concat([i]):null,Au(4,4,hb.bind(null,s,i),o)}function Id(){}function mb(i,s){var o=mt();s=s===void 0?null:s;var l=o.memoizedState;return s!==null&&Dd(s,l[1])?l[0]:(o.memoizedState=[i,s],i)}function yb(i,s){var o=mt();s=s===void 0?null:s;var l=o.memoizedState;if(s!==null&&Dd(s,l[1]))return l[0];if(l=i(),ls){tr(!0);try{i()}finally{tr(!1)}}return o.memoizedState=[l,s],l}function Pd(i,s,o){return o===void 0||(Mi&1073741824)!==0&&(Oe&261930)===0?i.memoizedState=s:(i.memoizedState=o,i=g0(),ve.lanes|=i,mr|=i,o)}function gb(i,s,o,l){return pn(o,s)?o:Ws.current!==null?(i=Pd(i,o,l),pn(i,s)||(wt=!0),i):(Mi&42)===0||(Mi&1073741824)!==0&&(Oe&261930)===0?(wt=!0,i.memoizedState=o):(i=g0(),ve.lanes|=i,mr|=i,s)}function vb(i,s,o,l,d){var p=U.p;U.p=p!==0&&8>p?p:8;var v=j.T,w={};j.T=w,Gd(i,!1,s,o);try{var A=d(),N=j.S;if(N!==null&&N(w,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var V=oC(A,l);Ea(i,s,V,Sn(i))}else Ea(i,s,l,Sn(i))}catch(I){Ea(i,s,{then:function(){},status:"rejected",reason:I},Sn())}finally{U.p=p,v!==null&&w.types!==null&&(v.types=w.types),j.T=v}}function dC(){}function Hd(i,s,o,l){if(i.tag!==5)throw Error(r(476));var d=bb(i).queue;vb(i,d,s,L,o===null?dC:function(){return Sb(i),o(l)})}function bb(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:L,baseState:L,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:L},next:null};var o={};return s.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Di,lastRenderedState:o},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function Sb(i){var s=bb(i);s.next===null&&(s=i.alternate.memoizedState),Ea(i,s.next.queue,{},Sn())}function Fd(){return qt(qa)}function wb(){return mt().memoizedState}function xb(){return mt().memoizedState}function hC(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var o=Sn();i=ur(o);var l=cr(s,i,o);l!==null&&(ln(l,s,o),Sa(l,s,o)),s={cache:wd()},i.payload=s;return}s=s.return}}function pC(i,s,o){var l=Sn();o={lane:l,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Eu(i)?Ab(s,o):(o=cd(i,s,o,l),o!==null&&(ln(o,i,l),Eb(o,s,l)))}function Tb(i,s,o){var l=Sn();Ea(i,s,o,l)}function Ea(i,s,o,l){var d={lane:l,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(Eu(i))Ab(s,d);else{var p=i.alternate;if(i.lanes===0&&(p===null||p.lanes===0)&&(p=s.lastRenderedReducer,p!==null))try{var v=s.lastRenderedState,w=p(v,o);if(d.hasEagerState=!0,d.eagerState=w,pn(w,v))return su(i,s,d,0),He===null&&ru(),!1}catch{}finally{}if(o=cd(i,s,d,l),o!==null)return ln(o,i,l),Eb(o,s,l),!0}return!1}function Gd(i,s,o,l){if(l={lane:2,revertLane:Eh(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Eu(i)){if(s)throw Error(r(479))}else s=cd(i,o,l,2),s!==null&&ln(s,i,2)}function Eu(i){var s=i.alternate;return i===ve||s!==null&&s===ve}function Ab(i,s){eo=vu=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function Eb(i,s,o){if((o&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,o|=l,s.lanes=o,kg(i,o)}}var Oa={readContext:qt,use:wu,useCallback:ot,useContext:ot,useEffect:ot,useImperativeHandle:ot,useLayoutEffect:ot,useInsertionEffect:ot,useMemo:ot,useReducer:ot,useRef:ot,useState:ot,useDebugValue:ot,useDeferredValue:ot,useTransition:ot,useSyncExternalStore:ot,useId:ot,useHostTransitionStatus:ot,useFormState:ot,useActionState:ot,useOptimistic:ot,useMemoCache:ot,useCacheRefresh:ot};Oa.useEffectEvent=ot;var Ob={readContext:qt,use:wu,useCallback:function(i,s){return Zt().memoizedState=[i,s===void 0?null:s],i},useContext:qt,useEffect:ub,useImperativeHandle:function(i,s,o){o=o!=null?o.concat([i]):null,Tu(4194308,4,hb.bind(null,s,i),o)},useLayoutEffect:function(i,s){return Tu(4194308,4,i,s)},useInsertionEffect:function(i,s){Tu(4,2,i,s)},useMemo:function(i,s){var o=Zt();s=s===void 0?null:s;var l=i();if(ls){tr(!0);try{i()}finally{tr(!1)}}return o.memoizedState=[l,s],l},useReducer:function(i,s,o){var l=Zt();if(o!==void 0){var d=o(s);if(ls){tr(!0);try{o(s)}finally{tr(!1)}}}else d=s;return l.memoizedState=l.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},l.queue=i,i=i.dispatch=pC.bind(null,ve,i),[l.memoizedState,i]},useRef:function(i){var s=Zt();return i={current:i},s.memoizedState=i},useState:function(i){i=Ud(i);var s=i.queue,o=Tb.bind(null,ve,s);return s.dispatch=o,[i.memoizedState,o]},useDebugValue:Id,useDeferredValue:function(i,s){var o=Zt();return Pd(o,i,s)},useTransition:function(){var i=Ud(!1);return i=vb.bind(null,ve,i.queue,!0,!1),Zt().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,o){var l=ve,d=Zt();if(Ce){if(o===void 0)throw Error(r(407));o=o()}else{if(o=s(),He===null)throw Error(r(349));(Oe&127)!==0||Gv(l,s,o)}d.memoizedState=o;var p={value:o,getSnapshot:s};return d.queue=p,ub(Jv.bind(null,l,p,i),[i]),l.flags|=2048,no(9,{destroy:void 0},Yv.bind(null,l,p,o,s),null),o},useId:function(){var i=Zt(),s=He.identifierPrefix;if(Ce){var o=oi,l=si;o=(l&~(1<<32-hn(l)-1)).toString(32)+o,s="_"+s+"R_"+o,o=bu++,0<o&&(s+="H"+o.toString(32)),s+="_"}else o=aC++,s="_"+s+"r_"+o.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Fd,useFormState:rb,useActionState:rb,useOptimistic:function(i){var s=Zt();s.memoizedState=s.baseState=i;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=o,s=Gd.bind(null,ve,!0,o),o.dispatch=s,[i,s]},useMemoCache:zd,useCacheRefresh:function(){return Zt().memoizedState=hC.bind(null,ve)},useEffectEvent:function(i){var s=Zt(),o={impl:i};return s.memoizedState=o,function(){if((Be&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},Yd={readContext:qt,use:wu,useCallback:mb,useContext:qt,useEffect:qd,useImperativeHandle:pb,useInsertionEffect:fb,useLayoutEffect:db,useMemo:yb,useReducer:xu,useRef:lb,useState:function(){return xu(Di)},useDebugValue:Id,useDeferredValue:function(i,s){var o=mt();return gb(o,Ke.memoizedState,i,s)},useTransition:function(){var i=xu(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Fv,useId:wb,useHostTransitionStatus:Fd,useFormState:sb,useActionState:sb,useOptimistic:function(i,s){var o=mt();return Qv(o,Ke,i,s)},useMemoCache:zd,useCacheRefresh:xb};Yd.useEffectEvent=cb;var _b={readContext:qt,use:wu,useCallback:mb,useContext:qt,useEffect:qd,useImperativeHandle:pb,useInsertionEffect:fb,useLayoutEffect:db,useMemo:yb,useReducer:Vd,useRef:lb,useState:function(){return Vd(Di)},useDebugValue:Id,useDeferredValue:function(i,s){var o=mt();return Ke===null?Pd(o,i,s):gb(o,Ke.memoizedState,i,s)},useTransition:function(){var i=Vd(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Fv,useId:wb,useHostTransitionStatus:Fd,useFormState:ab,useActionState:ab,useOptimistic:function(i,s){var o=mt();return Ke!==null?Qv(o,Ke,i,s):(o.baseState=i,[i,o.queue.dispatch])},useMemoCache:zd,useCacheRefresh:xb};_b.useEffectEvent=cb;function Jd(i,s,o,l){s=i.memoizedState,o=o(l,s),o=o==null?s:g({},s,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var Xd={enqueueSetState:function(i,s,o){i=i._reactInternals;var l=Sn(),d=ur(l);d.payload=s,o!=null&&(d.callback=o),s=cr(i,d,l),s!==null&&(ln(s,i,l),Sa(s,i,l))},enqueueReplaceState:function(i,s,o){i=i._reactInternals;var l=Sn(),d=ur(l);d.tag=1,d.payload=s,o!=null&&(d.callback=o),s=cr(i,d,l),s!==null&&(ln(s,i,l),Sa(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var o=Sn(),l=ur(o);l.tag=2,s!=null&&(l.callback=s),s=cr(i,l,o),s!==null&&(ln(s,i,o),Sa(s,i,o))}};function Rb(i,s,o,l,d,p,v){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,p,v):s.prototype&&s.prototype.isPureReactComponent?!da(o,l)||!da(d,p):!0}function Cb(i,s,o,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(o,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(o,l),s.state!==i&&Xd.enqueueReplaceState(s,s.state,null)}function us(i,s){var o=s;if("ref"in s){o={};for(var l in s)l!=="ref"&&(o[l]=s[l])}if(i=i.defaultProps){o===s&&(o=g({},o));for(var d in i)o[d]===void 0&&(o[d]=i[d])}return o}function kb(i){iu(i)}function Mb(i){console.error(i)}function Db(i){iu(i)}function Ou(i,s){try{var o=i.onUncaughtError;o(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Nb(i,s,o){try{var l=i.onCaughtError;l(o.value,{componentStack:o.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Zd(i,s,o){return o=ur(o),o.tag=3,o.payload={element:null},o.callback=function(){Ou(i,s)},o}function $b(i){return i=ur(i),i.tag=3,i}function jb(i,s,o,l){var d=o.type.getDerivedStateFromError;if(typeof d=="function"){var p=l.value;i.payload=function(){return d(p)},i.callback=function(){Nb(s,o,l)}}var v=o.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){Nb(s,o,l),typeof d!="function"&&(yr===null?yr=new Set([this]):yr.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function mC(i,s,o,l,d){if(o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=o.alternate,s!==null&&Ys(s,o,d,!0),o=yn.current,o!==null){switch(o.tag){case 31:case 13:return Nn===null?Lu():o.alternate===null&&at===0&&(at=3),o.flags&=-257,o.flags|=65536,o.lanes=d,l===hu?o.flags|=16384:(s=o.updateQueue,s===null?o.updateQueue=new Set([l]):s.add(l),xh(i,l,d)),!1;case 22:return o.flags|=65536,l===hu?o.flags|=16384:(s=o.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},o.updateQueue=s):(o=s.retryQueue,o===null?s.retryQueue=new Set([l]):o.add(l)),xh(i,l,d)),!1}throw Error(r(435,o.tag))}return xh(i,l,d),Lu(),!1}if(Ce)return s=yn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,l!==yd&&(i=Error(r(422),{cause:l}),ma(Cn(i,o)))):(l!==yd&&(s=Error(r(423),{cause:l}),ma(Cn(s,o))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,l=Cn(l,o),d=Zd(i.stateNode,l,d),_d(i,d),at!==4&&(at=2)),!1;var p=Error(r(520),{cause:l});if(p=Cn(p,o),$a===null?$a=[p]:$a.push(p),at!==4&&(at=2),s===null)return!0;l=Cn(l,o),o=s;do{switch(o.tag){case 3:return o.flags|=65536,i=d&-d,o.lanes|=i,i=Zd(o.stateNode,l,i),_d(o,i),!1;case 1:if(s=o.type,p=o.stateNode,(o.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||p!==null&&typeof p.componentDidCatch=="function"&&(yr===null||!yr.has(p))))return o.flags|=65536,d&=-d,o.lanes|=d,d=$b(d),jb(d,i,o,l),_d(o,d),!1}o=o.return}while(o!==null);return!1}var Qd=Error(r(461)),wt=!1;function It(i,s,o,l){s.child=i===null?Vv(s,null,o,l):as(s,i.child,o,l)}function Bb(i,s,o,l,d){o=o.render;var p=s.ref;if("ref"in l){var v={};for(var w in l)w!=="ref"&&(v[w]=l[w])}else v=l;return is(s),l=Nd(i,s,o,v,p,d),w=$d(),i!==null&&!wt?(jd(i,s,d),Ni(i,s,d)):(Ce&&w&&pd(s),s.flags|=1,It(i,s,l,d),s.child)}function zb(i,s,o,l,d){if(i===null){var p=o.type;return typeof p=="function"&&!fd(p)&&p.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=p,Lb(i,s,p,l,d)):(i=au(o.type,null,l,s,s.mode,d),i.ref=s.ref,i.return=s,s.child=i)}if(p=i.child,!oh(i,d)){var v=p.memoizedProps;if(o=o.compare,o=o!==null?o:da,o(v,l)&&i.ref===s.ref)return Ni(i,s,d)}return s.flags|=1,i=_i(p,l),i.ref=s.ref,i.return=s,s.child=i}function Lb(i,s,o,l,d){if(i!==null){var p=i.memoizedProps;if(da(p,l)&&i.ref===s.ref)if(wt=!1,s.pendingProps=l=p,oh(i,d))(i.flags&131072)!==0&&(wt=!0);else return s.lanes=i.lanes,Ni(i,s,d)}return Wd(i,s,o,l,d)}function Vb(i,s,o,l){var d=l.children,p=i!==null?i.memoizedState:null;if(i===null&&s.stateNode===null&&(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.mode==="hidden"){if((s.flags&128)!==0){if(p=p!==null?p.baseLanes|o:o,i!==null){for(l=s.child=i.child,d=0;l!==null;)d=d|l.lanes|l.childLanes,l=l.sibling;l=d&~p}else l=0,s.child=null;return Ub(i,s,p,o,l)}if((o&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&fu(s,p!==null?p.cachePool:null),p!==null?qv(s,p):Cd(),Iv(s);else return l=s.lanes=536870912,Ub(i,s,p!==null?p.baseLanes|o:o,o,l)}else p!==null?(fu(s,p.cachePool),qv(s,p),dr(),s.memoizedState=null):(i!==null&&fu(s,null),Cd(),dr());return It(i,s,d,o),s.child}function _a(i,s){return i!==null&&i.tag===22||s.stateNode!==null||(s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),s.sibling}function Ub(i,s,o,l,d){var p=Td();return p=p===null?null:{parent:bt._currentValue,pool:p},s.memoizedState={baseLanes:o,cachePool:p},i!==null&&fu(s,null),Cd(),Iv(s),i!==null&&Ys(i,s,l,!0),s.childLanes=d,null}function _u(i,s){return s=Cu({mode:s.mode,children:s.children},i.mode),s.ref=i.ref,i.child=s,s.return=i,s}function Kb(i,s,o){return as(s,i.child,null,o),i=_u(s,s.pendingProps),i.flags|=2,gn(s),s.memoizedState=null,i}function yC(i,s,o){var l=s.pendingProps,d=(s.flags&128)!==0;if(s.flags&=-129,i===null){if(Ce){if(l.mode==="hidden")return i=_u(s,l),s.lanes=536870912,_a(null,i);if(Md(s),(i=Ze)?(i=W0(i,Dn),i=i!==null&&i.data==="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:rr!==null?{id:si,overflow:oi}:null,retryLane:536870912,hydrationErrors:null},o=Av(i),o.return=s,s.child=o,Kt=s,Ze=null)):i=null,i===null)throw or(s);return s.lanes=536870912,null}return _u(s,l)}var p=i.memoizedState;if(p!==null){var v=p.dehydrated;if(Md(s),d)if(s.flags&256)s.flags&=-257,s=Kb(i,s,o);else if(s.memoizedState!==null)s.child=i.child,s.flags|=128,s=null;else throw Error(r(558));else if(wt||Ys(i,s,o,!1),d=(o&i.childLanes)!==0,wt||d){if(l=He,l!==null&&(v=Mg(l,o),v!==0&&v!==p.retryLane))throw p.retryLane=v,Wr(i,v),ln(l,i,v),Qd;Lu(),s=Kb(i,s,o)}else i=p.treeContext,Ze=$n(v.nextSibling),Kt=s,Ce=!0,sr=null,Dn=!1,i!==null&&_v(s,i),s=_u(s,l),s.flags|=4096;return s}return i=_i(i.child,{mode:l.mode,children:l.children}),i.ref=s.ref,s.child=i,i.return=s,i}function Ru(i,s){var o=s.ref;if(o===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(i===null||i.ref!==o)&&(s.flags|=4194816)}}function Wd(i,s,o,l,d){return is(s),o=Nd(i,s,o,l,void 0,d),l=$d(),i!==null&&!wt?(jd(i,s,d),Ni(i,s,d)):(Ce&&l&&pd(s),s.flags|=1,It(i,s,o,d),s.child)}function qb(i,s,o,l,d,p){return is(s),s.updateQueue=null,o=Hv(s,l,o,d),Pv(i),l=$d(),i!==null&&!wt?(jd(i,s,p),Ni(i,s,p)):(Ce&&l&&pd(s),s.flags|=1,It(i,s,o,p),s.child)}function Ib(i,s,o,l,d){if(is(s),s.stateNode===null){var p=Ps,v=o.contextType;typeof v=="object"&&v!==null&&(p=qt(v)),p=new o(l,p),s.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,p.updater=Xd,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=l,p.state=s.memoizedState,p.refs={},Ed(s),v=o.contextType,p.context=typeof v=="object"&&v!==null?qt(v):Ps,p.state=s.memoizedState,v=o.getDerivedStateFromProps,typeof v=="function"&&(Jd(s,o,v,l),p.state=s.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(v=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),v!==p.state&&Xd.enqueueReplaceState(p,p.state,null),xa(s,l,p,d),wa(),p.state=s.memoizedState),typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){p=s.stateNode;var w=s.memoizedProps,A=us(o,w);p.props=A;var N=p.context,V=o.contextType;v=Ps,typeof V=="object"&&V!==null&&(v=qt(V));var I=o.getDerivedStateFromProps;V=typeof I=="function"||typeof p.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,V||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w||N!==v)&&Cb(s,p,l,v),lr=!1;var B=s.memoizedState;p.state=B,xa(s,l,p,d),wa(),N=s.memoizedState,w||B!==N||lr?(typeof I=="function"&&(Jd(s,o,I,l),N=s.memoizedState),(A=lr||Rb(s,o,A,l,B,N,v))?(V||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount()),typeof p.componentDidMount=="function"&&(s.flags|=4194308)):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=N),p.props=l,p.state=N,p.context=v,l=A):(typeof p.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{p=s.stateNode,Od(i,s),v=s.memoizedProps,V=us(o,v),p.props=V,I=s.pendingProps,B=p.context,N=o.contextType,A=Ps,typeof N=="object"&&N!==null&&(A=qt(N)),w=o.getDerivedStateFromProps,(N=typeof w=="function"||typeof p.getSnapshotBeforeUpdate=="function")||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(v!==I||B!==A)&&Cb(s,p,l,A),lr=!1,B=s.memoizedState,p.state=B,xa(s,l,p,d),wa();var z=s.memoizedState;v!==I||B!==z||lr||i!==null&&i.dependencies!==null&&uu(i.dependencies)?(typeof w=="function"&&(Jd(s,o,w,l),z=s.memoizedState),(V=lr||Rb(s,o,V,l,B,z,A)||i!==null&&i.dependencies!==null&&uu(i.dependencies))?(N||typeof p.UNSAFE_componentWillUpdate!="function"&&typeof p.componentWillUpdate!="function"||(typeof p.componentWillUpdate=="function"&&p.componentWillUpdate(l,z,A),typeof p.UNSAFE_componentWillUpdate=="function"&&p.UNSAFE_componentWillUpdate(l,z,A)),typeof p.componentDidUpdate=="function"&&(s.flags|=4),typeof p.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=z),p.props=l,p.state=z,p.context=A,l=V):(typeof p.componentDidUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=4),typeof p.getSnapshotBeforeUpdate!="function"||v===i.memoizedProps&&B===i.memoizedState||(s.flags|=1024),l=!1)}return p=l,Ru(i,s),l=(s.flags&128)!==0,p||l?(p=s.stateNode,o=l&&typeof o.getDerivedStateFromError!="function"?null:p.render(),s.flags|=1,i!==null&&l?(s.child=as(s,i.child,null,d),s.child=as(s,null,o,d)):It(i,s,o,d),s.memoizedState=p.state,i=s.child):i=Ni(i,s,d),i}function Pb(i,s,o,l){return ts(),s.flags|=256,It(i,s,o,l),s.child}var eh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function th(i){return{baseLanes:i,cachePool:Nv()}}function nh(i,s,o){return i=i!==null?i.childLanes&~o:0,s&&(i|=bn),i}function Hb(i,s,o){var l=s.pendingProps,d=!1,p=(s.flags&128)!==0,v;if((v=p)||(v=i!==null&&i.memoizedState===null?!1:(pt.current&2)!==0),v&&(d=!0,s.flags&=-129),v=(s.flags&32)!==0,s.flags&=-33,i===null){if(Ce){if(d?fr(s):dr(),(i=Ze)?(i=W0(i,Dn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(s.memoizedState={dehydrated:i,treeContext:rr!==null?{id:si,overflow:oi}:null,retryLane:536870912,hydrationErrors:null},o=Av(i),o.return=s,s.child=o,Kt=s,Ze=null)):i=null,i===null)throw or(s);return Lh(i)?s.lanes=32:s.lanes=536870912,null}var w=l.children;return l=l.fallback,d?(dr(),d=s.mode,w=Cu({mode:"hidden",children:w},d),l=es(l,d,o,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=th(o),l.childLanes=nh(i,v,o),s.memoizedState=eh,_a(null,l)):(fr(s),ih(s,w))}var A=i.memoizedState;if(A!==null&&(w=A.dehydrated,w!==null)){if(p)s.flags&256?(fr(s),s.flags&=-257,s=rh(i,s,o)):s.memoizedState!==null?(dr(),s.child=i.child,s.flags|=128,s=null):(dr(),w=l.fallback,d=s.mode,l=Cu({mode:"visible",children:l.children},d),w=es(w,d,o,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,as(s,i.child,null,o),l=s.child,l.memoizedState=th(o),l.childLanes=nh(i,v,o),s.memoizedState=eh,s=_a(null,l));else if(fr(s),Lh(w)){if(v=w.nextSibling&&w.nextSibling.dataset,v)var N=v.dgst;v=N,l=Error(r(419)),l.stack="",l.digest=v,ma({value:l,source:null,stack:null}),s=rh(i,s,o)}else if(wt||Ys(i,s,o,!1),v=(o&i.childLanes)!==0,wt||v){if(v=He,v!==null&&(l=Mg(v,o),l!==0&&l!==A.retryLane))throw A.retryLane=l,Wr(i,l),ln(v,i,l),Qd;zh(w)||Lu(),s=rh(i,s,o)}else zh(w)?(s.flags|=192,s.child=i.child,s=null):(i=A.treeContext,Ze=$n(w.nextSibling),Kt=s,Ce=!0,sr=null,Dn=!1,i!==null&&_v(s,i),s=ih(s,l.children),s.flags|=4096);return s}return d?(dr(),w=l.fallback,d=s.mode,A=i.child,N=A.sibling,l=_i(A,{mode:"hidden",children:l.children}),l.subtreeFlags=A.subtreeFlags&65011712,N!==null?w=_i(N,w):(w=es(w,d,o,null),w.flags|=2),w.return=s,l.return=s,l.sibling=w,s.child=l,_a(null,l),l=s.child,w=i.child.memoizedState,w===null?w=th(o):(d=w.cachePool,d!==null?(A=bt._currentValue,d=d.parent!==A?{parent:A,pool:A}:d):d=Nv(),w={baseLanes:w.baseLanes|o,cachePool:d}),l.memoizedState=w,l.childLanes=nh(i,v,o),s.memoizedState=eh,_a(i.child,l)):(fr(s),o=i.child,i=o.sibling,o=_i(o,{mode:"visible",children:l.children}),o.return=s,o.sibling=null,i!==null&&(v=s.deletions,v===null?(s.deletions=[i],s.flags|=16):v.push(i)),s.child=o,s.memoizedState=null,o)}function ih(i,s){return s=Cu({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function Cu(i,s){return i=mn(22,i,null,s),i.lanes=0,i}function rh(i,s,o){return as(s,i.child,null,o),i=ih(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Fb(i,s,o){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),bd(i.return,s,o)}function sh(i,s,o,l,d,p){var v=i.memoizedState;v===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:o,tailMode:d,treeForkCount:p}:(v.isBackwards=s,v.rendering=null,v.renderingStartTime=0,v.last=l,v.tail=o,v.tailMode=d,v.treeForkCount=p)}function Gb(i,s,o){var l=s.pendingProps,d=l.revealOrder,p=l.tail;l=l.children;var v=pt.current,w=(v&2)!==0;if(w?(v=v&1|2,s.flags|=128):v&=1,H(pt,v),It(i,s,l,o),l=Ce?pa:0,!w&&i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Fb(i,o,s);else if(i.tag===19)Fb(i,o,s);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===s)break e;for(;i.sibling===null;){if(i.return===null||i.return===s)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(d){case"forwards":for(o=s.child,d=null;o!==null;)i=o.alternate,i!==null&&gu(i)===null&&(d=o),o=o.sibling;o=d,o===null?(d=s.child,s.child=null):(d=o.sibling,o.sibling=null),sh(s,!1,d,o,p,l);break;case"backwards":case"unstable_legacy-backwards":for(o=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&gu(i)===null){s.child=d;break}i=d.sibling,d.sibling=o,o=d,d=i}sh(s,!0,o,null,p,l);break;case"together":sh(s,!1,null,null,void 0,l);break;default:s.memoizedState=null}return s.child}function Ni(i,s,o){if(i!==null&&(s.dependencies=i.dependencies),mr|=s.lanes,(o&s.childLanes)===0)if(i!==null){if(Ys(i,s,o,!1),(o&s.childLanes)===0)return null}else return null;if(i!==null&&s.child!==i.child)throw Error(r(153));if(s.child!==null){for(i=s.child,o=_i(i,i.pendingProps),s.child=o,o.return=s;i.sibling!==null;)i=i.sibling,o=o.sibling=_i(i,i.pendingProps),o.return=s;o.sibling=null}return s.child}function oh(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&uu(i)))}function gC(i,s,o){switch(s.tag){case 3:Ct(s,s.stateNode.containerInfo),ar(s,bt,i.memoizedState.cache),ts();break;case 27:case 5:ii(s);break;case 4:Ct(s,s.stateNode.containerInfo);break;case 10:ar(s,s.type,s.memoizedProps.value);break;case 31:if(s.memoizedState!==null)return s.flags|=128,Md(s),null;break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(fr(s),s.flags|=128,null):(o&s.child.childLanes)!==0?Hb(i,s,o):(fr(s),i=Ni(i,s,o),i!==null?i.sibling:null);fr(s);break;case 19:var d=(i.flags&128)!==0;if(l=(o&s.childLanes)!==0,l||(Ys(i,s,o,!1),l=(o&s.childLanes)!==0),d){if(l)return Gb(i,s,o);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),H(pt,pt.current),l)break;return null;case 22:return s.lanes=0,Vb(i,s,o,s.pendingProps);case 24:ar(s,bt,i.memoizedState.cache)}return Ni(i,s,o)}function Yb(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps)wt=!0;else{if(!oh(i,o)&&(s.flags&128)===0)return wt=!1,gC(i,s,o);wt=(i.flags&131072)!==0}else wt=!1,Ce&&(s.flags&1048576)!==0&&Ov(s,pa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=ss(s.elementType),s.type=i,typeof i=="function")fd(i)?(l=us(i,l),s.tag=1,s=Ib(null,s,i,l,o)):(s.tag=0,s=Wd(null,s,i,l,o));else{if(i!=null){var d=i.$$typeof;if(d===G){s.tag=11,s=Bb(null,s,i,l,o);break e}else if(d===J){s.tag=14,s=zb(null,s,i,l,o);break e}}throw s=Z(i)||i,Error(r(306,s,""))}}return s;case 0:return Wd(i,s,s.type,s.pendingProps,o);case 1:return l=s.type,d=us(l,s.pendingProps),Ib(i,s,l,d,o);case 3:e:{if(Ct(s,s.stateNode.containerInfo),i===null)throw Error(r(387));l=s.pendingProps;var p=s.memoizedState;d=p.element,Od(i,s),xa(s,l,null,o);var v=s.memoizedState;if(l=v.cache,ar(s,bt,l),l!==p.cache&&Sd(s,[bt],o,!0),wa(),l=v.element,p.isDehydrated)if(p={element:l,isDehydrated:!1,cache:v.cache},s.updateQueue.baseState=p,s.memoizedState=p,s.flags&256){s=Pb(i,s,l,o);break e}else if(l!==d){d=Cn(Error(r(424)),s),ma(d),s=Pb(i,s,l,o);break e}else{switch(i=s.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(Ze=$n(i.firstChild),Kt=s,Ce=!0,sr=null,Dn=!0,o=Vv(s,null,l,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(ts(),l===d){s=Ni(i,s,o);break e}It(i,s,l,o)}s=s.child}return s;case 26:return Ru(i,s),i===null?(o=sS(s.type,null,s.pendingProps,null))?s.memoizedState=o:Ce||(o=s.type,i=s.pendingProps,l=Hu(ce.current).createElement(o),l[Ut]=s,l[tn]=i,Pt(l,o,i),Nt(l),s.stateNode=l):s.memoizedState=sS(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return ii(s),i===null&&Ce&&(l=s.stateNode=nS(s.type,s.pendingProps,ce.current),Kt=s,Dn=!0,d=Ze,Sr(s.type)?(Vh=d,Ze=$n(l.firstChild)):Ze=d),It(i,s,s.pendingProps.children,o),Ru(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&Ce&&((d=l=Ze)&&(l=GC(l,s.type,s.pendingProps,Dn),l!==null?(s.stateNode=l,Kt=s,Ze=$n(l.firstChild),Dn=!1,d=!0):d=!1),d||or(s)),ii(s),d=s.type,p=s.pendingProps,v=i!==null?i.memoizedProps:null,l=p.children,$h(d,p)?l=null:v!==null&&$h(d,v)&&(s.flags|=32),s.memoizedState!==null&&(d=Nd(i,s,lC,null,null,o),qa._currentValue=d),Ru(i,s),It(i,s,l,o),s.child;case 6:return i===null&&Ce&&((i=o=Ze)&&(o=YC(o,s.pendingProps,Dn),o!==null?(s.stateNode=o,Kt=s,Ze=null,i=!0):i=!1),i||or(s)),null;case 13:return Hb(i,s,o);case 4:return Ct(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=as(s,null,l,o):It(i,s,l,o),s.child;case 11:return Bb(i,s,s.type,s.pendingProps,o);case 7:return It(i,s,s.pendingProps,o),s.child;case 8:return It(i,s,s.pendingProps.children,o),s.child;case 12:return It(i,s,s.pendingProps.children,o),s.child;case 10:return l=s.pendingProps,ar(s,s.type,l.value),It(i,s,l.children,o),s.child;case 9:return d=s.type._context,l=s.pendingProps.children,is(s),d=qt(d),l=l(d),s.flags|=1,It(i,s,l,o),s.child;case 14:return zb(i,s,s.type,s.pendingProps,o);case 15:return Lb(i,s,s.type,s.pendingProps,o);case 19:return Gb(i,s,o);case 31:return yC(i,s,o);case 22:return Vb(i,s,o,s.pendingProps);case 24:return is(s),l=qt(bt),i===null?(d=Td(),d===null&&(d=He,p=wd(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=o),d=p),s.memoizedState={parent:l,cache:d},Ed(s),ar(s,bt,d)):((i.lanes&o)!==0&&(Od(i,s),xa(s,null,null,o),wa()),d=i.memoizedState,p=s.memoizedState,d.parent!==l?(d={parent:l,cache:l},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),ar(s,bt,l)):(l=p.cache,ar(s,bt,l),l!==d.cache&&Sd(s,[bt],o,!0))),It(i,s,s.pendingProps.children,o),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function $i(i){i.flags|=4}function ah(i,s,o,l,d){if((s=(i.mode&32)!==0)&&(s=!1),s){if(i.flags|=16777216,(d&335544128)===d)if(i.stateNode.complete)i.flags|=8192;else if(w0())i.flags|=8192;else throw os=hu,Ad}else i.flags&=-16777217}function Jb(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!cS(s))if(w0())i.flags|=8192;else throw os=hu,Ad}function ku(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Rg():536870912,i.lanes|=s,oo|=s)}function Ra(i,s){if(!Ce)switch(i.tailMode){case"hidden":s=i.tail;for(var o=null;s!==null;)s.alternate!==null&&(o=s),s=s.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var l=null;o!==null;)o.alternate!==null&&(l=o),o=o.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function Qe(i){var s=i.alternate!==null&&i.alternate.child===i.child,o=0,l=0;if(s)for(var d=i.child;d!==null;)o|=d.lanes|d.childLanes,l|=d.subtreeFlags&65011712,l|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)o|=d.lanes|d.childLanes,l|=d.subtreeFlags,l|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=l,i.childLanes=o,s}function vC(i,s,o){var l=s.pendingProps;switch(md(s),s.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Qe(s),null;case 1:return Qe(s),null;case 3:return o=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),ki(bt),Je(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(i===null||i.child===null)&&(Gs(s)?$i(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,gd())),Qe(s),null;case 26:var d=s.type,p=s.memoizedState;return i===null?($i(s),p!==null?(Qe(s),Jb(s,p)):(Qe(s),ah(s,d,null,l,o))):p?p!==i.memoizedState?($i(s),Qe(s),Jb(s,p)):(Qe(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&$i(s),Qe(s),ah(s,d,i,l,o)),null;case 27:if(Ti(s),o=ce.current,d=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return Qe(s),null}i=Q.current,Gs(s)?Rv(s):(i=nS(d,l,o),s.stateNode=i,$i(s))}return Qe(s),null;case 5:if(Ti(s),d=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return Qe(s),null}if(p=Q.current,Gs(s))Rv(s);else{var v=Hu(ce.current);switch(p){case 1:p=v.createElementNS("http://www.w3.org/2000/svg",d);break;case 2:p=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;default:switch(d){case"svg":p=v.createElementNS("http://www.w3.org/2000/svg",d);break;case"math":p=v.createElementNS("http://www.w3.org/1998/Math/MathML",d);break;case"script":p=v.createElement("div"),p.innerHTML="<script><\/script>",p=p.removeChild(p.firstChild);break;case"select":p=typeof l.is=="string"?v.createElement("select",{is:l.is}):v.createElement("select"),l.multiple?p.multiple=!0:l.size&&(p.size=l.size);break;default:p=typeof l.is=="string"?v.createElement(d,{is:l.is}):v.createElement(d)}}p[Ut]=s,p[tn]=l;e:for(v=s.child;v!==null;){if(v.tag===5||v.tag===6)p.appendChild(v.stateNode);else if(v.tag!==4&&v.tag!==27&&v.child!==null){v.child.return=v,v=v.child;continue}if(v===s)break e;for(;v.sibling===null;){if(v.return===null||v.return===s)break e;v=v.return}v.sibling.return=v.return,v=v.sibling}s.stateNode=p;e:switch(Pt(p,d,l),d){case"button":case"input":case"select":case"textarea":l=!!l.autoFocus;break e;case"img":l=!0;break e;default:l=!1}l&&$i(s)}}return Qe(s),ah(s,s.type,i===null?null:i.memoizedProps,s.pendingProps,o),null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&$i(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(r(166));if(i=ce.current,Gs(s)){if(i=s.stateNode,o=s.memoizedProps,l=null,d=Kt,d!==null)switch(d.tag){case 27:case 5:l=d.memoizedProps}i[Ut]=s,i=!!(i.nodeValue===o||l!==null&&l.suppressHydrationWarning===!0||H0(i.nodeValue,o)),i||or(s,!0)}else i=Hu(i).createTextNode(l),i[Ut]=s,s.stateNode=i}return Qe(s),null;case 31:if(o=s.memoizedState,i===null||i.memoizedState!==null){if(l=Gs(s),o!==null){if(i===null){if(!l)throw Error(r(318));if(i=s.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ut]=s}else ts(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),i=!1}else o=gd(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=o),i=!0;if(!i)return s.flags&256?(gn(s),s):(gn(s),null);if((s.flags&128)!==0)throw Error(r(558))}return Qe(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=Gs(s),l!==null&&l.dehydrated!==null){if(i===null){if(!d)throw Error(r(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[Ut]=s}else ts(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),d=!1}else d=gd(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(gn(s),s):(gn(s),null)}return gn(s),(s.flags&128)!==0?(s.lanes=o,s):(o=l!==null,i=i!==null&&i.memoizedState!==null,o&&(l=s.child,d=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(d=l.alternate.memoizedState.cachePool.pool),p=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(p=l.memoizedState.cachePool.pool),p!==d&&(l.flags|=2048)),o!==i&&o&&(s.child.flags|=8192),ku(s,s.updateQueue),Qe(s),null);case 4:return Je(),i===null&&Ch(s.stateNode.containerInfo),Qe(s),null;case 10:return ki(s.type),Qe(s),null;case 19:if(q(pt),l=s.memoizedState,l===null)return Qe(s),null;if(d=(s.flags&128)!==0,p=l.rendering,p===null)if(d)Ra(l,!1);else{if(at!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(p=gu(i),p!==null){for(s.flags|=128,Ra(l,!1),i=p.updateQueue,s.updateQueue=i,ku(s,i),s.subtreeFlags=0,i=o,o=s.child;o!==null;)Tv(o,i),o=o.sibling;return H(pt,pt.current&1|2),Ce&&Ri(s,l.treeForkCount),s.child}i=i.sibling}l.tail!==null&&st()>ju&&(s.flags|=128,d=!0,Ra(l,!1),s.lanes=4194304)}else{if(!d)if(i=gu(p),i!==null){if(s.flags|=128,d=!0,i=i.updateQueue,s.updateQueue=i,ku(s,i),Ra(l,!0),l.tail===null&&l.tailMode==="hidden"&&!p.alternate&&!Ce)return Qe(s),null}else 2*st()-l.renderingStartTime>ju&&o!==536870912&&(s.flags|=128,d=!0,Ra(l,!1),s.lanes=4194304);l.isBackwards?(p.sibling=s.child,s.child=p):(i=l.last,i!==null?i.sibling=p:s.child=p,l.last=p)}return l.tail!==null?(i=l.tail,l.rendering=i,l.tail=i.sibling,l.renderingStartTime=st(),i.sibling=null,o=pt.current,H(pt,d?o&1|2:o&1),Ce&&Ri(s,l.treeForkCount),i):(Qe(s),null);case 22:case 23:return gn(s),kd(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(o&536870912)!==0&&(s.flags&128)===0&&(Qe(s),s.subtreeFlags&6&&(s.flags|=8192)):Qe(s),o=s.updateQueue,o!==null&&ku(s,o.retryQueue),o=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==o&&(s.flags|=2048),i!==null&&q(rs),null;case 24:return o=null,i!==null&&(o=i.memoizedState.cache),s.memoizedState.cache!==o&&(s.flags|=2048),ki(bt),Qe(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function bC(i,s){switch(md(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ki(bt),Je(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return Ti(s),null;case 31:if(s.memoizedState!==null){if(gn(s),s.alternate===null)throw Error(r(340));ts()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 13:if(gn(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ts()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return q(pt),null;case 4:return Je(),null;case 10:return ki(s.type),null;case 22:case 23:return gn(s),kd(),i!==null&&q(rs),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return ki(bt),null;case 25:return null;default:return null}}function Xb(i,s){switch(md(s),s.tag){case 3:ki(bt),Je();break;case 26:case 27:case 5:Ti(s);break;case 4:Je();break;case 31:s.memoizedState!==null&&gn(s);break;case 13:gn(s);break;case 19:q(pt);break;case 10:ki(s.type);break;case 22:case 23:gn(s),kd(),i!==null&&q(rs);break;case 24:ki(bt)}}function Ca(i,s){try{var o=s.updateQueue,l=o!==null?o.lastEffect:null;if(l!==null){var d=l.next;o=d;do{if((o.tag&i)===i){l=void 0;var p=o.create,v=o.inst;l=p(),v.destroy=l}o=o.next}while(o!==d)}}catch(w){Ue(s,s.return,w)}}function hr(i,s,o){try{var l=s.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var p=d.next;l=p;do{if((l.tag&i)===i){var v=l.inst,w=v.destroy;if(w!==void 0){v.destroy=void 0,d=s;var A=o,N=w;try{N()}catch(V){Ue(d,A,V)}}}l=l.next}while(l!==p)}}catch(V){Ue(s,s.return,V)}}function Zb(i){var s=i.updateQueue;if(s!==null){var o=i.stateNode;try{Kv(s,o)}catch(l){Ue(i,i.return,l)}}}function Qb(i,s,o){o.props=us(i.type,i.memoizedProps),o.state=i.memoizedState;try{o.componentWillUnmount()}catch(l){Ue(i,s,l)}}function ka(i,s){try{var o=i.ref;if(o!==null){switch(i.tag){case 26:case 27:case 5:var l=i.stateNode;break;case 30:l=i.stateNode;break;default:l=i.stateNode}typeof o=="function"?i.refCleanup=o(l):o.current=l}}catch(d){Ue(i,s,d)}}function ai(i,s){var o=i.ref,l=i.refCleanup;if(o!==null)if(typeof l=="function")try{l()}catch(d){Ue(i,s,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(d){Ue(i,s,d)}else o.current=null}function Wb(i){var s=i.type,o=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":o.autoFocus&&l.focus();break e;case"img":o.src?l.src=o.src:o.srcSet&&(l.srcset=o.srcSet)}}catch(d){Ue(i,i.return,d)}}function lh(i,s,o){try{var l=i.stateNode;KC(l,i.type,o,s),l[tn]=s}catch(d){Ue(i,i.return,d)}}function e0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Sr(i.type)||i.tag===4}function uh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||e0(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Sr(i.type)||i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function ch(i,s,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(i,s):(s=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,s.appendChild(i),o=o._reactRootContainer,o!=null||s.onclick!==null||(s.onclick=Ei));else if(l!==4&&(l===27&&Sr(i.type)&&(o=i.stateNode,s=null),i=i.child,i!==null))for(ch(i,s,o),i=i.sibling;i!==null;)ch(i,s,o),i=i.sibling}function Mu(i,s,o){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?o.insertBefore(i,s):o.appendChild(i);else if(l!==4&&(l===27&&Sr(i.type)&&(o=i.stateNode),i=i.child,i!==null))for(Mu(i,s,o),i=i.sibling;i!==null;)Mu(i,s,o),i=i.sibling}function t0(i){var s=i.stateNode,o=i.memoizedProps;try{for(var l=i.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Pt(s,l,o),s[Ut]=i,s[tn]=o}catch(p){Ue(i,i.return,p)}}var ji=!1,xt=!1,fh=!1,n0=typeof WeakSet=="function"?WeakSet:Set,$t=null;function SC(i,s){if(i=i.containerInfo,Dh=Qu,i=pv(i),rd(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var l=o.getSelection&&o.getSelection();if(l&&l.rangeCount!==0){o=l.anchorNode;var d=l.anchorOffset,p=l.focusNode;l=l.focusOffset;try{o.nodeType,p.nodeType}catch{o=null;break e}var v=0,w=-1,A=-1,N=0,V=0,I=i,B=null;t:for(;;){for(var z;I!==o||d!==0&&I.nodeType!==3||(w=v+d),I!==p||l!==0&&I.nodeType!==3||(A=v+l),I.nodeType===3&&(v+=I.nodeValue.length),(z=I.firstChild)!==null;)B=I,I=z;for(;;){if(I===i)break t;if(B===o&&++N===d&&(w=v),B===p&&++V===l&&(A=v),(z=I.nextSibling)!==null)break;I=B,B=I.parentNode}I=z}o=w===-1||A===-1?null:{start:w,end:A}}else o=null}o=o||{start:0,end:0}}else o=null;for(Nh={focusedElem:i,selectionRange:o},Qu=!1,$t=s;$t!==null;)if(s=$t,i=s.child,(s.subtreeFlags&1028)!==0&&i!==null)i.return=s,$t=i;else for(;$t!==null;){switch(s=$t,p=s.alternate,i=s.flags,s.tag){case 0:if((i&4)!==0&&(i=s.updateQueue,i=i!==null?i.events:null,i!==null))for(o=0;o<i.length;o++)d=i[o],d.ref.impl=d.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&p!==null){i=void 0,o=s,d=p.memoizedProps,p=p.memoizedState,l=o.stateNode;try{var ie=us(o.type,d);i=l.getSnapshotBeforeUpdate(ie,p),l.__reactInternalSnapshotBeforeUpdate=i}catch(ue){Ue(o,o.return,ue)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,o=i.nodeType,o===9)Bh(i);else if(o===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Bh(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=s.sibling,i!==null){i.return=s.return,$t=i;break}$t=s.return}}function i0(i,s,o){var l=o.flags;switch(o.tag){case 0:case 11:case 15:zi(i,o),l&4&&Ca(5,o);break;case 1:if(zi(i,o),l&4)if(i=o.stateNode,s===null)try{i.componentDidMount()}catch(v){Ue(o,o.return,v)}else{var d=us(o.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(d,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ue(o,o.return,v)}}l&64&&Zb(o),l&512&&ka(o,o.return);break;case 3:if(zi(i,o),l&64&&(i=o.updateQueue,i!==null)){if(s=null,o.child!==null)switch(o.child.tag){case 27:case 5:s=o.child.stateNode;break;case 1:s=o.child.stateNode}try{Kv(i,s)}catch(v){Ue(o,o.return,v)}}break;case 27:s===null&&l&4&&t0(o);case 26:case 5:zi(i,o),s===null&&l&4&&Wb(o),l&512&&ka(o,o.return);break;case 12:zi(i,o);break;case 31:zi(i,o),l&4&&o0(i,o);break;case 13:zi(i,o),l&4&&a0(i,o),l&64&&(i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(o=CC.bind(null,o),JC(i,o))));break;case 22:if(l=o.memoizedState!==null||ji,!l){s=s!==null&&s.memoizedState!==null||xt,d=ji;var p=xt;ji=l,(xt=s)&&!p?Li(i,o,(o.subtreeFlags&8772)!==0):zi(i,o),ji=d,xt=p}break;case 30:break;default:zi(i,o)}}function r0(i){var s=i.alternate;s!==null&&(i.alternate=null,r0(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Kf(s)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var tt=null,rn=!1;function Bi(i,s,o){for(o=o.child;o!==null;)s0(i,s,o),o=o.sibling}function s0(i,s,o){if(dn&&typeof dn.onCommitFiberUnmount=="function")try{dn.onCommitFiberUnmount(ea,o)}catch{}switch(o.tag){case 26:xt||ai(o,s),Bi(i,s,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:xt||ai(o,s);var l=tt,d=rn;Sr(o.type)&&(tt=o.stateNode,rn=!1),Bi(i,s,o),Va(o.stateNode),tt=l,rn=d;break;case 5:xt||ai(o,s);case 6:if(l=tt,d=rn,tt=null,Bi(i,s,o),tt=l,rn=d,tt!==null)if(rn)try{(tt.nodeType===9?tt.body:tt.nodeName==="HTML"?tt.ownerDocument.body:tt).removeChild(o.stateNode)}catch(p){Ue(o,s,p)}else try{tt.removeChild(o.stateNode)}catch(p){Ue(o,s,p)}break;case 18:tt!==null&&(rn?(i=tt,Z0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.stateNode),mo(i)):Z0(tt,o.stateNode));break;case 4:l=tt,d=rn,tt=o.stateNode.containerInfo,rn=!0,Bi(i,s,o),tt=l,rn=d;break;case 0:case 11:case 14:case 15:hr(2,o,s),xt||hr(4,o,s),Bi(i,s,o);break;case 1:xt||(ai(o,s),l=o.stateNode,typeof l.componentWillUnmount=="function"&&Qb(o,s,l)),Bi(i,s,o);break;case 21:Bi(i,s,o);break;case 22:xt=(l=xt)||o.memoizedState!==null,Bi(i,s,o),xt=l;break;default:Bi(i,s,o)}}function o0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{mo(i)}catch(o){Ue(s,s.return,o)}}}function a0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{mo(i)}catch(o){Ue(s,s.return,o)}}function wC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new n0),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new n0),s;default:throw Error(r(435,i.tag))}}function Du(i,s){var o=wC(i);s.forEach(function(l){if(!o.has(l)){o.add(l);var d=kC.bind(null,i,l);l.then(d,d)}})}function sn(i,s){var o=s.deletions;if(o!==null)for(var l=0;l<o.length;l++){var d=o[l],p=i,v=s,w=v;e:for(;w!==null;){switch(w.tag){case 27:if(Sr(w.type)){tt=w.stateNode,rn=!1;break e}break;case 5:tt=w.stateNode,rn=!1;break e;case 3:case 4:tt=w.stateNode.containerInfo,rn=!0;break e}w=w.return}if(tt===null)throw Error(r(160));s0(p,v,d),tt=null,rn=!1,p=d.alternate,p!==null&&(p.return=null),d.return=null}if(s.subtreeFlags&13886)for(s=s.child;s!==null;)l0(s,i),s=s.sibling}var Yn=null;function l0(i,s){var o=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:sn(s,i),on(i),l&4&&(hr(3,i,i.return),Ca(3,i),hr(5,i,i.return));break;case 1:sn(s,i),on(i),l&512&&(xt||o===null||ai(o,o.return)),l&64&&ji&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(o=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=o===null?l:o.concat(l))));break;case 26:var d=Yn;if(sn(s,i),on(i),l&512&&(xt||o===null||ai(o,o.return)),l&4){var p=o!==null?o.memoizedState:null;if(l=i.memoizedState,o===null)if(l===null)if(i.stateNode===null){e:{l=i.type,o=i.memoizedProps,d=d.ownerDocument||d;t:switch(l){case"title":p=d.getElementsByTagName("title")[0],(!p||p[ia]||p[Ut]||p.namespaceURI==="http://www.w3.org/2000/svg"||p.hasAttribute("itemprop"))&&(p=d.createElement(l),d.head.insertBefore(p,d.querySelector("head > title"))),Pt(p,l,o),p[Ut]=i,Nt(p),l=p;break e;case"link":var v=lS("link","href",d).get(l+(o.href||""));if(v){for(var w=0;w<v.length;w++)if(p=v[w],p.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&p.getAttribute("rel")===(o.rel==null?null:o.rel)&&p.getAttribute("title")===(o.title==null?null:o.title)&&p.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){v.splice(w,1);break t}}p=d.createElement(l),Pt(p,l,o),d.head.appendChild(p);break;case"meta":if(v=lS("meta","content",d).get(l+(o.content||""))){for(w=0;w<v.length;w++)if(p=v[w],p.getAttribute("content")===(o.content==null?null:""+o.content)&&p.getAttribute("name")===(o.name==null?null:o.name)&&p.getAttribute("property")===(o.property==null?null:o.property)&&p.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&p.getAttribute("charset")===(o.charSet==null?null:o.charSet)){v.splice(w,1);break t}}p=d.createElement(l),Pt(p,l,o),d.head.appendChild(p);break;default:throw Error(r(468,l))}p[Ut]=i,Nt(p),l=p}i.stateNode=l}else uS(d,i.type,i.stateNode);else i.stateNode=aS(d,l,i.memoizedProps);else p!==l?(p===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):p.count--,l===null?uS(d,i.type,i.stateNode):aS(d,l,i.memoizedProps)):l===null&&i.stateNode!==null&&lh(i,i.memoizedProps,o.memoizedProps)}break;case 27:sn(s,i),on(i),l&512&&(xt||o===null||ai(o,o.return)),o!==null&&l&4&&lh(i,i.memoizedProps,o.memoizedProps);break;case 5:if(sn(s,i),on(i),l&512&&(xt||o===null||ai(o,o.return)),i.flags&32){d=i.stateNode;try{zs(d,"")}catch(ie){Ue(i,i.return,ie)}}l&4&&i.stateNode!=null&&(d=i.memoizedProps,lh(i,d,o!==null?o.memoizedProps:d)),l&1024&&(fh=!0);break;case 6:if(sn(s,i),on(i),l&4){if(i.stateNode===null)throw Error(r(162));l=i.memoizedProps,o=i.stateNode;try{o.nodeValue=l}catch(ie){Ue(i,i.return,ie)}}break;case 3:if(Yu=null,d=Yn,Yn=Fu(s.containerInfo),sn(s,i),Yn=d,on(i),l&4&&o!==null&&o.memoizedState.isDehydrated)try{mo(s.containerInfo)}catch(ie){Ue(i,i.return,ie)}fh&&(fh=!1,u0(i));break;case 4:l=Yn,Yn=Fu(i.stateNode.containerInfo),sn(s,i),on(i),Yn=l;break;case 12:sn(s,i),on(i);break;case 31:sn(s,i),on(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Du(i,l)));break;case 13:sn(s,i),on(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&($u=st()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Du(i,l)));break;case 22:d=i.memoizedState!==null;var A=o!==null&&o.memoizedState!==null,N=ji,V=xt;if(ji=N||d,xt=V||A,sn(s,i),xt=V,ji=N,on(i),l&8192)e:for(s=i.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(o===null||A||ji||xt||cs(i)),o=null,s=i;;){if(s.tag===5||s.tag===26){if(o===null){A=o=s;try{if(p=A.stateNode,d)v=p.style,typeof v.setProperty=="function"?v.setProperty("display","none","important"):v.display="none";else{w=A.stateNode;var I=A.memoizedProps.style,B=I!=null&&I.hasOwnProperty("display")?I.display:null;w.style.display=B==null||typeof B=="boolean"?"":(""+B).trim()}}catch(ie){Ue(A,A.return,ie)}}}else if(s.tag===6){if(o===null){A=s;try{A.stateNode.nodeValue=d?"":A.memoizedProps}catch(ie){Ue(A,A.return,ie)}}}else if(s.tag===18){if(o===null){A=s;try{var z=A.stateNode;d?Q0(z,!0):Q0(A.stateNode,!1)}catch(ie){Ue(A,A.return,ie)}}}else if((s.tag!==22&&s.tag!==23||s.memoizedState===null||s===i)&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===i)break e;for(;s.sibling===null;){if(s.return===null||s.return===i)break e;o===s&&(o=null),s=s.return}o===s&&(o=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(o=l.retryQueue,o!==null&&(l.retryQueue=null,Du(i,o))));break;case 19:sn(s,i),on(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,Du(i,l)));break;case 30:break;case 21:break;default:sn(s,i),on(i)}}function on(i){var s=i.flags;if(s&2){try{for(var o,l=i.return;l!==null;){if(e0(l)){o=l;break}l=l.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var d=o.stateNode,p=uh(i);Mu(i,p,d);break;case 5:var v=o.stateNode;o.flags&32&&(zs(v,""),o.flags&=-33);var w=uh(i);Mu(i,w,v);break;case 3:case 4:var A=o.stateNode.containerInfo,N=uh(i);ch(i,N,A);break;default:throw Error(r(161))}}catch(V){Ue(i,i.return,V)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function u0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;u0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function zi(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)i0(i,s.alternate,s),s=s.sibling}function cs(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:hr(4,s,s.return),cs(s);break;case 1:ai(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Qb(s,s.return,o),cs(s);break;case 27:Va(s.stateNode);case 26:case 5:ai(s,s.return),cs(s);break;case 22:s.memoizedState===null&&cs(s);break;case 30:cs(s);break;default:cs(s)}i=i.sibling}}function Li(i,s,o){for(o=o&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,d=i,p=s,v=p.flags;switch(p.tag){case 0:case 11:case 15:Li(d,p,o),Ca(4,p);break;case 1:if(Li(d,p,o),l=p,d=l.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch(N){Ue(l,l.return,N)}if(l=p,d=l.updateQueue,d!==null){var w=l.stateNode;try{var A=d.shared.hiddenCallbacks;if(A!==null)for(d.shared.hiddenCallbacks=null,d=0;d<A.length;d++)Uv(A[d],w)}catch(N){Ue(l,l.return,N)}}o&&v&64&&Zb(p),ka(p,p.return);break;case 27:t0(p);case 26:case 5:Li(d,p,o),o&&l===null&&v&4&&Wb(p),ka(p,p.return);break;case 12:Li(d,p,o);break;case 31:Li(d,p,o),o&&v&4&&o0(d,p);break;case 13:Li(d,p,o),o&&v&4&&a0(d,p);break;case 22:p.memoizedState===null&&Li(d,p,o),ka(p,p.return);break;case 30:break;default:Li(d,p,o)}s=s.sibling}}function dh(i,s){var o=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==o&&(i!=null&&i.refCount++,o!=null&&ya(o))}function hh(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ya(i))}function Jn(i,s,o,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)c0(i,s,o,l),s=s.sibling}function c0(i,s,o,l){var d=s.flags;switch(s.tag){case 0:case 11:case 15:Jn(i,s,o,l),d&2048&&Ca(9,s);break;case 1:Jn(i,s,o,l);break;case 3:Jn(i,s,o,l),d&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ya(i)));break;case 12:if(d&2048){Jn(i,s,o,l),i=s.stateNode;try{var p=s.memoizedProps,v=p.id,w=p.onPostCommit;typeof w=="function"&&w(v,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(A){Ue(s,s.return,A)}}else Jn(i,s,o,l);break;case 31:Jn(i,s,o,l);break;case 13:Jn(i,s,o,l);break;case 23:break;case 22:p=s.stateNode,v=s.alternate,s.memoizedState!==null?p._visibility&2?Jn(i,s,o,l):Ma(i,s):p._visibility&2?Jn(i,s,o,l):(p._visibility|=2,io(i,s,o,l,(s.subtreeFlags&10256)!==0||!1)),d&2048&&dh(v,s);break;case 24:Jn(i,s,o,l),d&2048&&hh(s.alternate,s);break;default:Jn(i,s,o,l)}}function io(i,s,o,l,d){for(d=d&&((s.subtreeFlags&10256)!==0||!1),s=s.child;s!==null;){var p=i,v=s,w=o,A=l,N=v.flags;switch(v.tag){case 0:case 11:case 15:io(p,v,w,A,d),Ca(8,v);break;case 23:break;case 22:var V=v.stateNode;v.memoizedState!==null?V._visibility&2?io(p,v,w,A,d):Ma(p,v):(V._visibility|=2,io(p,v,w,A,d)),d&&N&2048&&dh(v.alternate,v);break;case 24:io(p,v,w,A,d),d&&N&2048&&hh(v.alternate,v);break;default:io(p,v,w,A,d)}s=s.sibling}}function Ma(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var o=i,l=s,d=l.flags;switch(l.tag){case 22:Ma(o,l),d&2048&&dh(l.alternate,l);break;case 24:Ma(o,l),d&2048&&hh(l.alternate,l);break;default:Ma(o,l)}s=s.sibling}}var Da=8192;function ro(i,s,o){if(i.subtreeFlags&Da)for(i=i.child;i!==null;)f0(i,s,o),i=i.sibling}function f0(i,s,o){switch(i.tag){case 26:ro(i,s,o),i.flags&Da&&i.memoizedState!==null&&ak(o,Yn,i.memoizedState,i.memoizedProps);break;case 5:ro(i,s,o);break;case 3:case 4:var l=Yn;Yn=Fu(i.stateNode.containerInfo),ro(i,s,o),Yn=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Da,Da=16777216,ro(i,s,o),Da=l):ro(i,s,o));break;default:ro(i,s,o)}}function d0(i){var s=i.alternate;if(s!==null&&(i=s.child,i!==null)){s.child=null;do s=i.sibling,i.sibling=null,i=s;while(i!==null)}}function Na(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var l=s[o];$t=l,p0(l,i)}d0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)h0(i),i=i.sibling}function h0(i){switch(i.tag){case 0:case 11:case 15:Na(i),i.flags&2048&&hr(9,i,i.return);break;case 3:Na(i);break;case 12:Na(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Nu(i)):Na(i);break;default:Na(i)}}function Nu(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var o=0;o<s.length;o++){var l=s[o];$t=l,p0(l,i)}d0(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:hr(8,s,s.return),Nu(s);break;case 22:o=s.stateNode,o._visibility&2&&(o._visibility&=-3,Nu(s));break;default:Nu(s)}i=i.sibling}}function p0(i,s){for(;$t!==null;){var o=$t;switch(o.tag){case 0:case 11:case 15:hr(8,o,s);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var l=o.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ya(o.memoizedState.cache)}if(l=o.child,l!==null)l.return=o,$t=l;else e:for(o=i;$t!==null;){l=$t;var d=l.sibling,p=l.return;if(r0(l),l===o){$t=null;break e}if(d!==null){d.return=p,$t=d;break e}$t=p}}}var xC={getCacheForType:function(i){var s=qt(bt),o=s.data.get(i);return o===void 0&&(o=i(),s.data.set(i,o)),o},cacheSignal:function(){return qt(bt).controller.signal}},TC=typeof WeakMap=="function"?WeakMap:Map,Be=0,He=null,Ae=null,Oe=0,Ve=0,vn=null,pr=!1,so=!1,ph=!1,Vi=0,at=0,mr=0,fs=0,mh=0,bn=0,oo=0,$a=null,an=null,yh=!1,$u=0,m0=0,ju=1/0,Bu=null,yr=null,kt=0,gr=null,ao=null,Ui=0,gh=0,vh=null,y0=null,ja=0,bh=null;function Sn(){return(Be&2)!==0&&Oe!==0?Oe&-Oe:j.T!==null?Eh():Dg()}function g0(){if(bn===0)if((Oe&536870912)===0||Ce){var i=Pl;Pl<<=1,(Pl&3932160)===0&&(Pl=262144),bn=i}else bn=536870912;return i=yn.current,i!==null&&(i.flags|=32),bn}function ln(i,s,o){(i===He&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)&&(lo(i,0),vr(i,Oe,bn,!1)),na(i,o),((Be&2)===0||i!==He)&&(i===He&&((Be&2)===0&&(fs|=o),at===4&&vr(i,Oe,bn,!1)),li(i))}function v0(i,s,o){if((Be&6)!==0)throw Error(r(327));var l=!o&&(s&127)===0&&(s&i.expiredLanes)===0||ta(i,s),d=l?OC(i,s):wh(i,s,!0),p=l;do{if(d===0){so&&!l&&vr(i,s,0,!1);break}else{if(o=i.current.alternate,p&&!AC(o)){d=wh(i,s,!1),p=!1;continue}if(d===2){if(p=s,i.errorRecoveryDisabledLanes&p)var v=0;else v=i.pendingLanes&-536870913,v=v!==0?v:v&536870912?536870912:0;if(v!==0){s=v;e:{var w=i;d=$a;var A=w.current.memoizedState.isDehydrated;if(A&&(lo(w,v).flags|=256),v=wh(w,v,!1),v!==2){if(ph&&!A){w.errorRecoveryDisabledLanes|=p,fs|=p,d=4;break e}p=an,an=d,p!==null&&(an===null?an=p:an.push.apply(an,p))}d=v}if(p=!1,d!==2)continue}}if(d===1){lo(i,0),vr(i,s,0,!0);break}e:{switch(l=i,p=d,p){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:vr(l,s,bn,!pr);break e;case 2:an=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=$u+300-st(),10<d)){if(vr(l,s,bn,!pr),Fl(l,0,!0)!==0)break e;Ui=s,l.timeoutHandle=J0(b0.bind(null,l,o,an,Bu,yh,s,bn,fs,oo,pr,p,"Throttled",-0,0),d);break e}b0(l,o,an,Bu,yh,s,bn,fs,oo,pr,p,null,-0,0)}}break}while(!0);li(i)}function b0(i,s,o,l,d,p,v,w,A,N,V,I,B,z){if(i.timeoutHandle=-1,I=s.subtreeFlags,I&8192||(I&16785408)===16785408){I={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},f0(s,p,I);var ie=(p&62914560)===p?$u-st():(p&4194048)===p?m0-st():0;if(ie=lk(I,ie),ie!==null){Ui=p,i.cancelPendingCommit=ie(_0.bind(null,i,s,p,o,l,d,v,w,A,V,I,null,B,z)),vr(i,p,v,!N);return}}_0(i,s,p,o,l,d,v,w,A)}function AC(i){for(var s=i;;){var o=s.tag;if((o===0||o===11||o===15)&&s.flags&16384&&(o=s.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var l=0;l<o.length;l++){var d=o[l],p=d.getSnapshot;d=d.value;try{if(!pn(p(),d))return!1}catch{return!1}}if(o=s.child,s.subtreeFlags&16384&&o!==null)o.return=s,s=o;else{if(s===i)break;for(;s.sibling===null;){if(s.return===null||s.return===i)return!0;s=s.return}s.sibling.return=s.return,s=s.sibling}}return!0}function vr(i,s,o,l){s&=~mh,s&=~fs,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var d=s;0<d;){var p=31-hn(d),v=1<<p;l[p]=-1,d&=~v}o!==0&&Cg(i,o,s)}function zu(){return(Be&6)===0?(Ba(0),!1):!0}function Sh(){if(Ae!==null){if(Ve===0)var i=Ae.return;else i=Ae,Ci=ns=null,Bd(i),Qs=null,va=0,i=Ae;for(;i!==null;)Xb(i.alternate,i),i=i.return;Ae=null}}function lo(i,s){var o=i.timeoutHandle;o!==-1&&(i.timeoutHandle=-1,PC(o)),o=i.cancelPendingCommit,o!==null&&(i.cancelPendingCommit=null,o()),Ui=0,Sh(),He=i,Ae=o=_i(i.current,null),Oe=s,Ve=0,vn=null,pr=!1,so=ta(i,s),ph=!1,oo=bn=mh=fs=mr=at=0,an=$a=null,yh=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var d=31-hn(l),p=1<<d;s|=i[d],l&=~p}return Vi=s,ru(),o}function S0(i,s){ve=null,j.H=Oa,s===Zs||s===du?(s=Bv(),Ve=3):s===Ad?(s=Bv(),Ve=4):Ve=s===Qd?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,vn=s,Ae===null&&(at=1,Ou(i,Cn(s,i.current)))}function w0(){var i=yn.current;return i===null?!0:(Oe&4194048)===Oe?Nn===null:(Oe&62914560)===Oe||(Oe&536870912)!==0?i===Nn:!1}function x0(){var i=j.H;return j.H=Oa,i===null?Oa:i}function T0(){var i=j.A;return j.A=xC,i}function Lu(){at=4,pr||(Oe&4194048)!==Oe&&yn.current!==null||(so=!0),(mr&134217727)===0&&(fs&134217727)===0||He===null||vr(He,Oe,bn,!1)}function wh(i,s,o){var l=Be;Be|=2;var d=x0(),p=T0();(He!==i||Oe!==s)&&(Bu=null,lo(i,s)),s=!1;var v=at;e:do try{if(Ve!==0&&Ae!==null){var w=Ae,A=vn;switch(Ve){case 8:Sh(),v=6;break e;case 3:case 2:case 9:case 6:yn.current===null&&(s=!0);var N=Ve;if(Ve=0,vn=null,uo(i,w,A,N),o&&so){v=0;break e}break;default:N=Ve,Ve=0,vn=null,uo(i,w,A,N)}}EC(),v=at;break}catch(V){S0(i,V)}while(!0);return s&&i.shellSuspendCounter++,Ci=ns=null,Be=l,j.H=d,j.A=p,Ae===null&&(He=null,Oe=0,ru()),v}function EC(){for(;Ae!==null;)A0(Ae)}function OC(i,s){var o=Be;Be|=2;var l=x0(),d=T0();He!==i||Oe!==s?(Bu=null,ju=st()+500,lo(i,s)):so=ta(i,s);e:do try{if(Ve!==0&&Ae!==null){s=Ae;var p=vn;t:switch(Ve){case 1:Ve=0,vn=null,uo(i,s,p,1);break;case 2:case 9:if($v(p)){Ve=0,vn=null,E0(s);break}s=function(){Ve!==2&&Ve!==9||He!==i||(Ve=7),li(i)},p.then(s,s);break e;case 3:Ve=7;break e;case 4:Ve=5;break e;case 7:$v(p)?(Ve=0,vn=null,E0(s)):(Ve=0,vn=null,uo(i,s,p,7));break;case 5:var v=null;switch(Ae.tag){case 26:v=Ae.memoizedState;case 5:case 27:var w=Ae;if(v?cS(v):w.stateNode.complete){Ve=0,vn=null;var A=w.sibling;if(A!==null)Ae=A;else{var N=w.return;N!==null?(Ae=N,Vu(N)):Ae=null}break t}}Ve=0,vn=null,uo(i,s,p,5);break;case 6:Ve=0,vn=null,uo(i,s,p,6);break;case 8:Sh(),at=6;break e;default:throw Error(r(462))}}_C();break}catch(V){S0(i,V)}while(!0);return Ci=ns=null,j.H=l,j.A=d,Be=o,Ae!==null?0:(He=null,Oe=0,ru(),at)}function _C(){for(;Ae!==null&&!ri();)A0(Ae)}function A0(i){var s=Yb(i.alternate,i,Vi);i.memoizedProps=i.pendingProps,s===null?Vu(i):Ae=s}function E0(i){var s=i,o=s.alternate;switch(s.tag){case 15:case 0:s=qb(o,s,s.pendingProps,s.type,void 0,Oe);break;case 11:s=qb(o,s,s.pendingProps,s.type.render,s.ref,Oe);break;case 5:Bd(s);default:Xb(o,s),s=Ae=Tv(s,Vi),s=Yb(o,s,Vi)}i.memoizedProps=i.pendingProps,s===null?Vu(i):Ae=s}function uo(i,s,o,l){Ci=ns=null,Bd(s),Qs=null,va=0;var d=s.return;try{if(mC(i,d,s,o,Oe)){at=1,Ou(i,Cn(o,i.current)),Ae=null;return}}catch(p){if(d!==null)throw Ae=d,p;at=1,Ou(i,Cn(o,i.current)),Ae=null;return}s.flags&32768?(Ce||l===1?i=!0:so||(Oe&536870912)!==0?i=!1:(pr=i=!0,(l===2||l===9||l===3||l===6)&&(l=yn.current,l!==null&&l.tag===13&&(l.flags|=16384))),O0(s,i)):Vu(s)}function Vu(i){var s=i;do{if((s.flags&32768)!==0){O0(s,pr);return}i=s.return;var o=vC(s.alternate,s,Vi);if(o!==null){Ae=o;return}if(s=s.sibling,s!==null){Ae=s;return}Ae=s=i}while(s!==null);at===0&&(at=5)}function O0(i,s){do{var o=bC(i.alternate,i);if(o!==null){o.flags&=32767,Ae=o;return}if(o=i.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!s&&(i=i.sibling,i!==null)){Ae=i;return}Ae=i=o}while(i!==null);at=6,Ae=null}function _0(i,s,o,l,d,p,v,w,A){i.cancelPendingCommit=null;do Uu();while(kt!==0);if((Be&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(p=s.lanes|s.childLanes,p|=ud,oR(i,o,p,v,w,A),i===He&&(Ae=He=null,Oe=0),ao=s,gr=i,Ui=o,gh=p,vh=d,y0=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,MC(ql,function(){return D0(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=j.T,j.T=null,d=U.p,U.p=2,v=Be,Be|=4;try{SC(i,s,o)}finally{Be=v,U.p=d,j.T=l}}kt=1,R0(),C0(),k0()}}function R0(){if(kt===1){kt=0;var i=gr,s=ao,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=j.T,j.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{l0(s,i);var p=Nh,v=pv(i.containerInfo),w=p.focusedElem,A=p.selectionRange;if(v!==w&&w&&w.ownerDocument&&hv(w.ownerDocument.documentElement,w)){if(A!==null&&rd(w)){var N=A.start,V=A.end;if(V===void 0&&(V=N),"selectionStart"in w)w.selectionStart=N,w.selectionEnd=Math.min(V,w.value.length);else{var I=w.ownerDocument||document,B=I&&I.defaultView||window;if(B.getSelection){var z=B.getSelection(),ie=w.textContent.length,ue=Math.min(A.start,ie),Ie=A.end===void 0?ue:Math.min(A.end,ie);!z.extend&&ue>Ie&&(v=Ie,Ie=ue,ue=v);var k=dv(w,ue),O=dv(w,Ie);if(k&&O&&(z.rangeCount!==1||z.anchorNode!==k.node||z.anchorOffset!==k.offset||z.focusNode!==O.node||z.focusOffset!==O.offset)){var D=I.createRange();D.setStart(k.node,k.offset),z.removeAllRanges(),ue>Ie?(z.addRange(D),z.extend(O.node,O.offset)):(D.setEnd(O.node,O.offset),z.addRange(D))}}}}for(I=[],z=w;z=z.parentNode;)z.nodeType===1&&I.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<I.length;w++){var K=I[w];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}Qu=!!Dh,Nh=Dh=null}finally{Be=d,U.p=l,j.T=o}}i.current=s,kt=2}}function C0(){if(kt===2){kt=0;var i=gr,s=ao,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=j.T,j.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{i0(i,s.alternate,s)}finally{Be=d,U.p=l,j.T=o}}kt=3}}function k0(){if(kt===4||kt===3){kt=0,Fn();var i=gr,s=ao,o=Ui,l=y0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?kt=5:(kt=0,ao=gr=null,M0(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(yr=null),Vf(o),s=s.stateNode,dn&&typeof dn.onCommitFiberRoot=="function")try{dn.onCommitFiberRoot(ea,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=j.T,d=U.p,U.p=2,j.T=null;try{for(var p=i.onRecoverableError,v=0;v<l.length;v++){var w=l[v];p(w.value,{componentStack:w.stack})}}finally{j.T=s,U.p=d}}(Ui&3)!==0&&Uu(),li(i),d=i.pendingLanes,(o&261930)!==0&&(d&42)!==0?i===bh?ja++:(ja=0,bh=i):ja=0,Ba(0)}}function M0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ya(s)))}function Uu(){return R0(),C0(),k0(),D0()}function D0(){if(kt!==5)return!1;var i=gr,s=gh;gh=0;var o=Vf(Ui),l=j.T,d=U.p;try{U.p=32>o?32:o,j.T=null,o=vh,vh=null;var p=gr,v=Ui;if(kt=0,ao=gr=null,Ui=0,(Be&6)!==0)throw Error(r(331));var w=Be;if(Be|=4,h0(p.current),c0(p,p.current,v,o),Be=w,Ba(0,!1),dn&&typeof dn.onPostCommitFiberRoot=="function")try{dn.onPostCommitFiberRoot(ea,p)}catch{}return!0}finally{U.p=d,j.T=l,M0(i,s)}}function N0(i,s,o){s=Cn(o,s),s=Zd(i.stateNode,s,2),i=cr(i,s,2),i!==null&&(na(i,2),li(i))}function Ue(i,s,o){if(i.tag===3)N0(i,i,o);else for(;s!==null;){if(s.tag===3){N0(s,i,o);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(yr===null||!yr.has(l))){i=Cn(o,i),o=$b(2),l=cr(s,o,2),l!==null&&(jb(o,l,s,i),na(l,2),li(l));break}}s=s.return}}function xh(i,s,o){var l=i.pingCache;if(l===null){l=i.pingCache=new TC;var d=new Set;l.set(s,d)}else d=l.get(s),d===void 0&&(d=new Set,l.set(s,d));d.has(o)||(ph=!0,d.add(o),i=RC.bind(null,i,s,o),s.then(i,i))}function RC(i,s,o){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&o,i.warmLanes&=~o,He===i&&(Oe&o)===o&&(at===4||at===3&&(Oe&62914560)===Oe&&300>st()-$u?(Be&2)===0&&lo(i,0):mh|=o,oo===Oe&&(oo=0)),li(i)}function $0(i,s){s===0&&(s=Rg()),i=Wr(i,s),i!==null&&(na(i,s),li(i))}function CC(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),$0(i,o)}function kC(i,s){var o=0;switch(i.tag){case 31:case 13:var l=i.stateNode,d=i.memoizedState;d!==null&&(o=d.retryLane);break;case 19:l=i.stateNode;break;case 22:l=i.stateNode._retryCache;break;default:throw Error(r(314))}l!==null&&l.delete(s),$0(i,o)}function MC(i,s){return Vt(i,s)}var Ku=null,co=null,Th=!1,qu=!1,Ah=!1,br=0;function li(i){i!==co&&i.next===null&&(co===null?Ku=co=i:co=co.next=i),qu=!0,Th||(Th=!0,NC())}function Ba(i,s){if(!Ah&&qu){Ah=!0;do for(var o=!1,l=Ku;l!==null;){if(i!==0){var d=l.pendingLanes;if(d===0)var p=0;else{var v=l.suspendedLanes,w=l.pingedLanes;p=(1<<31-hn(42|i)+1)-1,p&=d&~(v&~w),p=p&201326741?p&201326741|1:p?p|2:0}p!==0&&(o=!0,L0(l,p))}else p=Oe,p=Fl(l,l===He?p:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(p&3)===0||ta(l,p)||(o=!0,L0(l,p));l=l.next}while(o);Ah=!1}}function DC(){j0()}function j0(){qu=Th=!1;var i=0;br!==0&&IC()&&(i=br);for(var s=st(),o=null,l=Ku;l!==null;){var d=l.next,p=B0(l,s);p===0?(l.next=null,o===null?Ku=d:o.next=d,d===null&&(co=o)):(o=l,(i!==0||(p&3)!==0)&&(qu=!0)),l=d}kt!==0&&kt!==5||Ba(i),br!==0&&(br=0)}function B0(i,s){for(var o=i.suspendedLanes,l=i.pingedLanes,d=i.expirationTimes,p=i.pendingLanes&-62914561;0<p;){var v=31-hn(p),w=1<<v,A=d[v];A===-1?((w&o)===0||(w&l)!==0)&&(d[v]=sR(w,s)):A<=s&&(i.expiredLanes|=w),p&=~w}if(s=He,o=Oe,o=Fl(i,i===s?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,o===0||i===s&&(Ve===2||Ve===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Hn(l),i.callbackNode=null,i.callbackPriority=0;if((o&3)===0||ta(i,o)){if(s=o&-o,s===i.callbackPriority)return s;switch(l!==null&&Hn(l),Vf(o)){case 2:case 8:o=Og;break;case 32:o=ql;break;case 268435456:o=_g;break;default:o=ql}return l=z0.bind(null,i),o=Vt(o,l),i.callbackPriority=s,i.callbackNode=o,s}return l!==null&&l!==null&&Hn(l),i.callbackPriority=2,i.callbackNode=null,2}function z0(i,s){if(kt!==0&&kt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var o=i.callbackNode;if(Uu()&&i.callbackNode!==o)return null;var l=Oe;return l=Fl(i,i===He?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(v0(i,l,s),B0(i,st()),i.callbackNode!=null&&i.callbackNode===o?z0.bind(null,i):null)}function L0(i,s){if(Uu())return null;v0(i,s,!0)}function NC(){HC(function(){(Be&6)!==0?Vt(Eg,DC):j0()})}function Eh(){if(br===0){var i=Js;i===0&&(i=Il,Il<<=1,(Il&261888)===0&&(Il=256)),br=i}return br}function V0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Xl(""+i)}function U0(i,s){var o=s.ownerDocument.createElement("input");return o.name=s.name,o.value=s.value,i.id&&o.setAttribute("form",i.id),s.parentNode.insertBefore(o,s),i=new FormData(i),o.parentNode.removeChild(o),i}function $C(i,s,o,l,d){if(s==="submit"&&o&&o.stateNode===d){var p=V0((d[tn]||null).action),v=l.submitter;v&&(s=(s=v[tn]||null)?V0(s.formAction):v.getAttribute("formAction"),s!==null&&(p=s,v=null));var w=new eu("action","action",null,l,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(br!==0){var A=v?U0(d,v):new FormData(d);Hd(o,{pending:!0,data:A,method:d.method,action:p},null,A)}}else typeof p=="function"&&(w.preventDefault(),A=v?U0(d,v):new FormData(d),Hd(o,{pending:!0,data:A,method:d.method,action:p},p,A))},currentTarget:d}]})}}for(var Oh=0;Oh<ld.length;Oh++){var _h=ld[Oh],jC=_h.toLowerCase(),BC=_h[0].toUpperCase()+_h.slice(1);Gn(jC,"on"+BC)}Gn(gv,"onAnimationEnd"),Gn(vv,"onAnimationIteration"),Gn(bv,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(QR,"onTransitionRun"),Gn(WR,"onTransitionStart"),Gn(eC,"onTransitionCancel"),Gn(Sv,"onTransitionEnd"),js("onMouseEnter",["mouseout","mouseover"]),js("onMouseLeave",["mouseout","mouseover"]),js("onPointerEnter",["pointerout","pointerover"]),js("onPointerLeave",["pointerout","pointerover"]),Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var za="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),zC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(za));function K0(i,s){s=(s&4)!==0;for(var o=0;o<i.length;o++){var l=i[o],d=l.event;l=l.listeners;e:{var p=void 0;if(s)for(var v=l.length-1;0<=v;v--){var w=l[v],A=w.instance,N=w.currentTarget;if(w=w.listener,A!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=N;try{p(d)}catch(V){iu(V)}d.currentTarget=null,p=A}else for(v=0;v<l.length;v++){if(w=l[v],A=w.instance,N=w.currentTarget,w=w.listener,A!==p&&d.isPropagationStopped())break e;p=w,d.currentTarget=N;try{p(d)}catch(V){iu(V)}d.currentTarget=null,p=A}}}}function Ee(i,s){var o=s[Uf];o===void 0&&(o=s[Uf]=new Set);var l=i+"__bubble";o.has(l)||(q0(s,i,2,!1),o.add(l))}function Rh(i,s,o){var l=0;s&&(l|=4),q0(o,i,l,s)}var Iu="_reactListening"+Math.random().toString(36).slice(2);function Ch(i){if(!i[Iu]){i[Iu]=!0,jg.forEach(function(o){o!=="selectionchange"&&(zC.has(o)||Rh(o,!1,i),Rh(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Iu]||(s[Iu]=!0,Rh("selectionchange",!1,s))}}function q0(i,s,o,l){switch(gS(s)){case 2:var d=fk;break;case 8:d=dk;break;default:d=Ph}o=d.bind(null,s,o,i),d=void 0,!Jf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),l?d!==void 0?i.addEventListener(s,o,{capture:!0,passive:d}):i.addEventListener(s,o,!0):d!==void 0?i.addEventListener(s,o,{passive:d}):i.addEventListener(s,o,!1)}function kh(i,s,o,l,d){var p=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var v=l.tag;if(v===3||v===4){var w=l.stateNode.containerInfo;if(w===d)break;if(v===4)for(v=l.return;v!==null;){var A=v.tag;if((A===3||A===4)&&v.stateNode.containerInfo===d)return;v=v.return}for(;w!==null;){if(v=Ds(w),v===null)return;if(A=v.tag,A===5||A===6||A===26||A===27){l=p=v;continue e}w=w.parentNode}}l=l.return}Gg(function(){var N=p,V=Gf(o),I=[];e:{var B=wv.get(i);if(B!==void 0){var z=eu,ie=i;switch(i){case"keypress":if(Ql(o)===0)break e;case"keydown":case"keyup":z=kR;break;case"focusin":ie="focus",z=Wf;break;case"focusout":ie="blur",z=Wf;break;case"beforeblur":case"afterblur":z=Wf;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":z=Xg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":z=vR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":z=NR;break;case gv:case vv:case bv:z=wR;break;case Sv:z=jR;break;case"scroll":case"scrollend":z=yR;break;case"wheel":z=zR;break;case"copy":case"cut":case"paste":z=TR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":z=Qg;break;case"toggle":case"beforetoggle":z=VR}var ue=(s&4)!==0,Ie=!ue&&(i==="scroll"||i==="scrollend"),k=ue?B!==null?B+"Capture":null:B;ue=[];for(var O=N,D;O!==null;){var K=O;if(D=K.stateNode,K=K.tag,K!==5&&K!==26&&K!==27||D===null||k===null||(K=sa(O,k),K!=null&&ue.push(La(O,K,D))),Ie)break;O=O.return}0<ue.length&&(B=new z(B,ie,null,o,V),I.push({event:B,listeners:ue}))}}if((s&7)===0){e:{if(B=i==="mouseover"||i==="pointerover",z=i==="mouseout"||i==="pointerout",B&&o!==Ff&&(ie=o.relatedTarget||o.fromElement)&&(Ds(ie)||ie[Ms]))break e;if((z||B)&&(B=V.window===V?V:(B=V.ownerDocument)?B.defaultView||B.parentWindow:window,z?(ie=o.relatedTarget||o.toElement,z=N,ie=ie?Ds(ie):null,ie!==null&&(Ie=u(ie),ue=ie.tag,ie!==Ie||ue!==5&&ue!==27&&ue!==6)&&(ie=null)):(z=null,ie=N),z!==ie)){if(ue=Xg,K="onMouseLeave",k="onMouseEnter",O="mouse",(i==="pointerout"||i==="pointerover")&&(ue=Qg,K="onPointerLeave",k="onPointerEnter",O="pointer"),Ie=z==null?B:ra(z),D=ie==null?B:ra(ie),B=new ue(K,O+"leave",z,o,V),B.target=Ie,B.relatedTarget=D,K=null,Ds(V)===N&&(ue=new ue(k,O+"enter",ie,o,V),ue.target=D,ue.relatedTarget=Ie,K=ue),Ie=K,z&&ie)t:{for(ue=LC,k=z,O=ie,D=0,K=k;K;K=ue(K))D++;K=0;for(var le=O;le;le=ue(le))K++;for(;0<D-K;)k=ue(k),D--;for(;0<K-D;)O=ue(O),K--;for(;D--;){if(k===O||O!==null&&k===O.alternate){ue=k;break t}k=ue(k),O=ue(O)}ue=null}else ue=null;z!==null&&I0(I,B,z,ue,!1),ie!==null&&Ie!==null&&I0(I,Ie,ie,ue,!0)}}e:{if(B=N?ra(N):window,z=B.nodeName&&B.nodeName.toLowerCase(),z==="select"||z==="input"&&B.type==="file")var Ne=ov;else if(rv(B))if(av)Ne=JR;else{Ne=GR;var se=FR}else z=B.nodeName,!z||z.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?N&&Hf(N.elementType)&&(Ne=ov):Ne=YR;if(Ne&&(Ne=Ne(i,N))){sv(I,Ne,o,V);break e}se&&se(i,B,N),i==="focusout"&&N&&B.type==="number"&&N.memoizedProps.value!=null&&Pf(B,"number",B.value)}switch(se=N?ra(N):window,i){case"focusin":(rv(se)||se.contentEditable==="true")&&(Ks=se,sd=N,ha=null);break;case"focusout":ha=sd=Ks=null;break;case"mousedown":od=!0;break;case"contextmenu":case"mouseup":case"dragend":od=!1,mv(I,o,V);break;case"selectionchange":if(ZR)break;case"keydown":case"keyup":mv(I,o,V)}var Se;if(td)e:{switch(i){case"compositionstart":var _e="onCompositionStart";break e;case"compositionend":_e="onCompositionEnd";break e;case"compositionupdate":_e="onCompositionUpdate";break e}_e=void 0}else Us?nv(i,o)&&(_e="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(_e="onCompositionStart");_e&&(Wg&&o.locale!=="ko"&&(Us||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Us&&(Se=Yg()):(ir=V,Xf="value"in ir?ir.value:ir.textContent,Us=!0)),se=Pu(N,_e),0<se.length&&(_e=new Zg(_e,i,null,o,V),I.push({event:_e,listeners:se}),Se?_e.data=Se:(Se=iv(o),Se!==null&&(_e.data=Se)))),(Se=KR?qR(i,o):IR(i,o))&&(_e=Pu(N,"onBeforeInput"),0<_e.length&&(se=new Zg("onBeforeInput","beforeinput",null,o,V),I.push({event:se,listeners:_e}),se.data=Se)),$C(I,i,N,o,V)}K0(I,s)})}function La(i,s,o){return{instance:i,listener:s,currentTarget:o}}function Pu(i,s){for(var o=s+"Capture",l=[];i!==null;){var d=i,p=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||p===null||(d=sa(i,o),d!=null&&l.unshift(La(i,d,p)),d=sa(i,s),d!=null&&l.push(La(i,d,p))),i.tag===3)return l;i=i.return}return[]}function LC(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function I0(i,s,o,l,d){for(var p=s._reactName,v=[];o!==null&&o!==l;){var w=o,A=w.alternate,N=w.stateNode;if(w=w.tag,A!==null&&A===l)break;w!==5&&w!==26&&w!==27||N===null||(A=N,d?(N=sa(o,p),N!=null&&v.unshift(La(o,N,A))):d||(N=sa(o,p),N!=null&&v.push(La(o,N,A)))),o=o.return}v.length!==0&&i.push({event:s,listeners:v})}var VC=/\r\n?/g,UC=/\u0000|\uFFFD/g;function P0(i){return(typeof i=="string"?i:""+i).replace(VC,`
|
|
21
|
+
`).replace(UC,"")}function H0(i,s){return s=P0(s),P0(i)===s}function qe(i,s,o,l,d,p){switch(o){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||zs(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&zs(i,""+l);break;case"className":Yl(i,"class",l);break;case"tabIndex":Yl(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":Yl(i,o,l);break;case"style":Hg(i,l,p);break;case"data":if(s!=="object"){Yl(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||o!=="href")){i.removeAttribute(o);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(o);break}l=Xl(""+l),i.setAttribute(o,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof p=="function"&&(o==="formAction"?(s!=="input"&&qe(i,s,"name",d.name,d,null),qe(i,s,"formEncType",d.formEncType,d,null),qe(i,s,"formMethod",d.formMethod,d,null),qe(i,s,"formTarget",d.formTarget,d,null)):(qe(i,s,"encType",d.encType,d,null),qe(i,s,"method",d.method,d,null),qe(i,s,"target",d.target,d,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(o);break}l=Xl(""+l),i.setAttribute(o,l);break;case"onClick":l!=null&&(i.onclick=Ei);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(o=l.__html,o!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"multiple":i.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":i.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){i.removeAttribute("xlink:href");break}o=Xl(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,""+l):i.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,""):i.removeAttribute(o);break;case"capture":case"download":l===!0?i.setAttribute(o,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(o,l):i.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(o,l):i.removeAttribute(o);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(o):i.setAttribute(o,l);break;case"popover":Ee("beforetoggle",i),Ee("toggle",i),Gl(i,"popover",l);break;case"xlinkActuate":Ai(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ai(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ai(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ai(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ai(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ai(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ai(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Gl(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=pR.get(o)||o,Gl(i,o,l))}}function Mh(i,s,o,l,d,p){switch(o){case"style":Hg(i,l,p);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(o=l.__html,o!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"children":typeof l=="string"?zs(i,l):(typeof l=="number"||typeof l=="bigint")&&zs(i,""+l);break;case"onScroll":l!=null&&Ee("scroll",i);break;case"onScrollEnd":l!=null&&Ee("scrollend",i);break;case"onClick":l!=null&&(i.onclick=Ei);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Bg.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(d=o.endsWith("Capture"),s=o.slice(2,d?o.length-7:void 0),p=i[tn]||null,p=p!=null?p[o]:null,typeof p=="function"&&i.removeEventListener(s,p,d),typeof l=="function")){typeof p!="function"&&p!==null&&(o in i?i[o]=null:i.hasAttribute(o)&&i.removeAttribute(o)),i.addEventListener(s,l,d);break e}o in i?i[o]=l:l===!0?i.setAttribute(o,""):Gl(i,o,l)}}}function Pt(i,s,o){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ee("error",i),Ee("load",i);var l=!1,d=!1,p;for(p in o)if(o.hasOwnProperty(p)){var v=o[p];if(v!=null)switch(p){case"src":l=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:qe(i,s,p,v,o,null)}}d&&qe(i,s,"srcSet",o.srcSet,o,null),l&&qe(i,s,"src",o.src,o,null);return;case"input":Ee("invalid",i);var w=p=v=d=null,A=null,N=null;for(l in o)if(o.hasOwnProperty(l)){var V=o[l];if(V!=null)switch(l){case"name":d=V;break;case"type":v=V;break;case"checked":A=V;break;case"defaultChecked":N=V;break;case"value":p=V;break;case"defaultValue":w=V;break;case"children":case"dangerouslySetInnerHTML":if(V!=null)throw Error(r(137,s));break;default:qe(i,s,l,V,o,null)}}Kg(i,p,w,A,N,v,d,!1);return;case"select":Ee("invalid",i),l=v=p=null;for(d in o)if(o.hasOwnProperty(d)&&(w=o[d],w!=null))switch(d){case"value":p=w;break;case"defaultValue":v=w;break;case"multiple":l=w;default:qe(i,s,d,w,o,null)}s=p,o=v,i.multiple=!!l,s!=null?Bs(i,!!l,s,!1):o!=null&&Bs(i,!!l,o,!0);return;case"textarea":Ee("invalid",i),p=d=l=null;for(v in o)if(o.hasOwnProperty(v)&&(w=o[v],w!=null))switch(v){case"value":l=w;break;case"defaultValue":d=w;break;case"children":p=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:qe(i,s,v,w,o,null)}Ig(i,l,d,p);return;case"option":for(A in o)if(o.hasOwnProperty(A)&&(l=o[A],l!=null))switch(A){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:qe(i,s,A,l,o,null)}return;case"dialog":Ee("beforetoggle",i),Ee("toggle",i),Ee("cancel",i),Ee("close",i);break;case"iframe":case"object":Ee("load",i);break;case"video":case"audio":for(l=0;l<za.length;l++)Ee(za[l],i);break;case"image":Ee("error",i),Ee("load",i);break;case"details":Ee("toggle",i);break;case"embed":case"source":case"link":Ee("error",i),Ee("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(N in o)if(o.hasOwnProperty(N)&&(l=o[N],l!=null))switch(N){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:qe(i,s,N,l,o,null)}return;default:if(Hf(s)){for(V in o)o.hasOwnProperty(V)&&(l=o[V],l!==void 0&&Mh(i,s,V,l,o,void 0));return}}for(w in o)o.hasOwnProperty(w)&&(l=o[w],l!=null&&qe(i,s,w,l,o,null))}function KC(i,s,o,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,p=null,v=null,w=null,A=null,N=null,V=null;for(z in o){var I=o[z];if(o.hasOwnProperty(z)&&I!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":A=I;default:l.hasOwnProperty(z)||qe(i,s,z,null,l,I)}}for(var B in l){var z=l[B];if(I=o[B],l.hasOwnProperty(B)&&(z!=null||I!=null))switch(B){case"type":p=z;break;case"name":d=z;break;case"checked":N=z;break;case"defaultChecked":V=z;break;case"value":v=z;break;case"defaultValue":w=z;break;case"children":case"dangerouslySetInnerHTML":if(z!=null)throw Error(r(137,s));break;default:z!==I&&qe(i,s,B,z,l,I)}}If(i,v,w,A,N,V,p,d);return;case"select":z=v=w=B=null;for(p in o)if(A=o[p],o.hasOwnProperty(p)&&A!=null)switch(p){case"value":break;case"multiple":z=A;default:l.hasOwnProperty(p)||qe(i,s,p,null,l,A)}for(d in l)if(p=l[d],A=o[d],l.hasOwnProperty(d)&&(p!=null||A!=null))switch(d){case"value":B=p;break;case"defaultValue":w=p;break;case"multiple":v=p;default:p!==A&&qe(i,s,d,p,l,A)}s=w,o=v,l=z,B!=null?Bs(i,!!o,B,!1):!!l!=!!o&&(s!=null?Bs(i,!!o,s,!0):Bs(i,!!o,o?[]:"",!1));return;case"textarea":z=B=null;for(w in o)if(d=o[w],o.hasOwnProperty(w)&&d!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:qe(i,s,w,null,l,d)}for(v in l)if(d=l[v],p=o[v],l.hasOwnProperty(v)&&(d!=null||p!=null))switch(v){case"value":B=d;break;case"defaultValue":z=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==p&&qe(i,s,v,d,l,p)}qg(i,B,z);return;case"option":for(var ie in o)if(B=o[ie],o.hasOwnProperty(ie)&&B!=null&&!l.hasOwnProperty(ie))switch(ie){case"selected":i.selected=!1;break;default:qe(i,s,ie,null,l,B)}for(A in l)if(B=l[A],z=o[A],l.hasOwnProperty(A)&&B!==z&&(B!=null||z!=null))switch(A){case"selected":i.selected=B&&typeof B!="function"&&typeof B!="symbol";break;default:qe(i,s,A,B,l,z)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ue in o)B=o[ue],o.hasOwnProperty(ue)&&B!=null&&!l.hasOwnProperty(ue)&&qe(i,s,ue,null,l,B);for(N in l)if(B=l[N],z=o[N],l.hasOwnProperty(N)&&B!==z&&(B!=null||z!=null))switch(N){case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(r(137,s));break;default:qe(i,s,N,B,l,z)}return;default:if(Hf(s)){for(var Ie in o)B=o[Ie],o.hasOwnProperty(Ie)&&B!==void 0&&!l.hasOwnProperty(Ie)&&Mh(i,s,Ie,void 0,l,B);for(V in l)B=l[V],z=o[V],!l.hasOwnProperty(V)||B===z||B===void 0&&z===void 0||Mh(i,s,V,B,l,z);return}}for(var k in o)B=o[k],o.hasOwnProperty(k)&&B!=null&&!l.hasOwnProperty(k)&&qe(i,s,k,null,l,B);for(I in l)B=l[I],z=o[I],!l.hasOwnProperty(I)||B===z||B==null&&z==null||qe(i,s,I,B,l,z)}function F0(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function qC(){if(typeof performance.getEntriesByType=="function"){for(var i=0,s=0,o=performance.getEntriesByType("resource"),l=0;l<o.length;l++){var d=o[l],p=d.transferSize,v=d.initiatorType,w=d.duration;if(p&&w&&F0(v)){for(v=0,w=d.responseEnd,l+=1;l<o.length;l++){var A=o[l],N=A.startTime;if(N>w)break;var V=A.transferSize,I=A.initiatorType;V&&F0(I)&&(A=A.responseEnd,v+=V*(A<w?1:(w-N)/(A-N)))}if(--l,s+=8*(p+v)/(d.duration/1e3),i++,10<i)break}}if(0<i)return s/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var Dh=null,Nh=null;function Hu(i){return i.nodeType===9?i:i.ownerDocument}function G0(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Y0(i,s){if(i===0)switch(s){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&s==="foreignObject"?0:i}function $h(i,s){return i==="textarea"||i==="noscript"||typeof s.children=="string"||typeof s.children=="number"||typeof s.children=="bigint"||typeof s.dangerouslySetInnerHTML=="object"&&s.dangerouslySetInnerHTML!==null&&s.dangerouslySetInnerHTML.__html!=null}var jh=null;function IC(){var i=window.event;return i&&i.type==="popstate"?i===jh?!1:(jh=i,!0):(jh=null,!1)}var J0=typeof setTimeout=="function"?setTimeout:void 0,PC=typeof clearTimeout=="function"?clearTimeout:void 0,X0=typeof Promise=="function"?Promise:void 0,HC=typeof queueMicrotask=="function"?queueMicrotask:typeof X0<"u"?function(i){return X0.resolve(null).then(i).catch(FC)}:J0;function FC(i){setTimeout(function(){throw i})}function Sr(i){return i==="head"}function Z0(i,s){var o=s,l=0;do{var d=o.nextSibling;if(i.removeChild(o),d&&d.nodeType===8)if(o=d.data,o==="/$"||o==="/&"){if(l===0){i.removeChild(d),mo(s);return}l--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")l++;else if(o==="html")Va(i.ownerDocument.documentElement);else if(o==="head"){o=i.ownerDocument.head,Va(o);for(var p=o.firstChild;p;){var v=p.nextSibling,w=p.nodeName;p[ia]||w==="SCRIPT"||w==="STYLE"||w==="LINK"&&p.rel.toLowerCase()==="stylesheet"||o.removeChild(p),p=v}}else o==="body"&&Va(i.ownerDocument.body);o=d}while(o);mo(s)}function Q0(i,s){var o=i;i=0;do{var l=o.nextSibling;if(o.nodeType===1?s?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(s?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),l&&l.nodeType===8)if(o=l.data,o==="/$"){if(i===0)break;i--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||i++;o=l}while(o)}function Bh(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var o=s;switch(s=s.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":Bh(o),Kf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}i.removeChild(o)}}function GC(i,s,o,l){for(;i.nodeType===1;){var d=o;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[ia])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(p=i.getAttribute("rel"),p==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(p!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(p=i.getAttribute("src"),(p!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&p&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var p=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===p)return i}else return i;if(i=$n(i.nextSibling),i===null)break}return null}function YC(i,s,o){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=$n(i.nextSibling),i===null))return null;return i}function W0(i,s){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!s||(i=$n(i.nextSibling),i===null))return null;return i}function zh(i){return i.data==="$?"||i.data==="$~"}function Lh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function JC(i,s){var o=i.ownerDocument;if(i.data==="$~")i._reactRetry=s;else if(i.data!=="$?"||o.readyState!=="loading")s();else{var l=function(){s(),o.removeEventListener("DOMContentLoaded",l)};o.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function $n(i){for(;i!=null;i=i.nextSibling){var s=i.nodeType;if(s===1||s===3)break;if(s===8){if(s=i.data,s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"||s==="F!"||s==="F")break;if(s==="/$"||s==="/&")return null}}return i}var Vh=null;function eS(i){i=i.nextSibling;for(var s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="/$"||o==="/&"){if(s===0)return $n(i.nextSibling);s--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||s++}i=i.nextSibling}return null}function tS(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(s===0)return i;s--}else o!=="/$"&&o!=="/&"||s++}i=i.previousSibling}return null}function nS(i,s,o){switch(s=Hu(o),i){case"html":if(i=s.documentElement,!i)throw Error(r(452));return i;case"head":if(i=s.head,!i)throw Error(r(453));return i;case"body":if(i=s.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Va(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);Kf(i)}var jn=new Map,iS=new Set;function Fu(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ki=U.d;U.d={f:XC,r:ZC,D:QC,C:WC,L:ek,m:tk,X:ik,S:nk,M:rk};function XC(){var i=Ki.f(),s=zu();return i||s}function ZC(i){var s=Ns(i);s!==null&&s.tag===5&&s.type==="form"?Sb(s):Ki.r(i)}var fo=typeof document>"u"?null:document;function rS(i,s,o){var l=fo;if(l&&typeof s=="string"&&s){var d=_n(s);d='link[rel="'+i+'"][href="'+d+'"]',typeof o=="string"&&(d+='[crossorigin="'+o+'"]'),iS.has(d)||(iS.add(d),i={rel:i,crossOrigin:o,href:s},l.querySelector(d)===null&&(s=l.createElement("link"),Pt(s,"link",i),Nt(s),l.head.appendChild(s)))}}function QC(i){Ki.D(i),rS("dns-prefetch",i,null)}function WC(i,s){Ki.C(i,s),rS("preconnect",i,s)}function ek(i,s,o){Ki.L(i,s,o);var l=fo;if(l&&i&&s){var d='link[rel="preload"][as="'+_n(s)+'"]';s==="image"&&o&&o.imageSrcSet?(d+='[imagesrcset="'+_n(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(d+='[imagesizes="'+_n(o.imageSizes)+'"]')):d+='[href="'+_n(i)+'"]';var p=d;switch(s){case"style":p=ho(i);break;case"script":p=po(i)}jn.has(p)||(i=g({rel:"preload",href:s==="image"&&o&&o.imageSrcSet?void 0:i,as:s},o),jn.set(p,i),l.querySelector(d)!==null||s==="style"&&l.querySelector(Ua(p))||s==="script"&&l.querySelector(Ka(p))||(s=l.createElement("link"),Pt(s,"link",i),Nt(s),l.head.appendChild(s)))}}function tk(i,s){Ki.m(i,s);var o=fo;if(o&&i){var l=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+_n(l)+'"][href="'+_n(i)+'"]',p=d;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":p=po(i)}if(!jn.has(p)&&(i=g({rel:"modulepreload",href:i},s),jn.set(p,i),o.querySelector(d)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(Ka(p)))return}l=o.createElement("link"),Pt(l,"link",i),Nt(l),o.head.appendChild(l)}}}function nk(i,s,o){Ki.S(i,s,o);var l=fo;if(l&&i){var d=$s(l).hoistableStyles,p=ho(i);s=s||"default";var v=d.get(p);if(!v){var w={loading:0,preload:null};if(v=l.querySelector(Ua(p)))w.loading=5;else{i=g({rel:"stylesheet",href:i,"data-precedence":s},o),(o=jn.get(p))&&Uh(i,o);var A=v=l.createElement("link");Nt(A),Pt(A,"link",i),A._p=new Promise(function(N,V){A.onload=N,A.onerror=V}),A.addEventListener("load",function(){w.loading|=1}),A.addEventListener("error",function(){w.loading|=2}),w.loading|=4,Gu(v,s,l)}v={type:"stylesheet",instance:v,count:1,state:w},d.set(p,v)}}}function ik(i,s){Ki.X(i,s);var o=fo;if(o&&i){var l=$s(o).hoistableScripts,d=po(i),p=l.get(d);p||(p=o.querySelector(Ka(d)),p||(i=g({src:i,async:!0},s),(s=jn.get(d))&&Kh(i,s),p=o.createElement("script"),Nt(p),Pt(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function rk(i,s){Ki.M(i,s);var o=fo;if(o&&i){var l=$s(o).hoistableScripts,d=po(i),p=l.get(d);p||(p=o.querySelector(Ka(d)),p||(i=g({src:i,async:!0,type:"module"},s),(s=jn.get(d))&&Kh(i,s),p=o.createElement("script"),Nt(p),Pt(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function sS(i,s,o,l){var d=(d=ce.current)?Fu(d):null;if(!d)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(s=ho(o.href),o=$s(d).hoistableStyles,l=o.get(s),l||(l={type:"style",instance:null,count:0,state:null},o.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){i=ho(o.href);var p=$s(d).hoistableStyles,v=p.get(i);if(v||(d=d.ownerDocument||d,v={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},p.set(i,v),(p=d.querySelector(Ua(i)))&&!p._p&&(v.instance=p,v.state.loading=5),jn.has(i)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},jn.set(i,o),p||sk(d,i,o,v.state))),s&&l===null)throw Error(r(528,""));return v}if(s&&l!==null)throw Error(r(529,""));return null;case"script":return s=o.async,o=o.src,typeof o=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=po(o),o=$s(d).hoistableScripts,l=o.get(s),l||(l={type:"script",instance:null,count:0,state:null},o.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ho(i){return'href="'+_n(i)+'"'}function Ua(i){return'link[rel="stylesheet"]['+i+"]"}function oS(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function sk(i,s,o,l){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?l.loading=1:(s=i.createElement("link"),l.preload=s,s.addEventListener("load",function(){return l.loading|=1}),s.addEventListener("error",function(){return l.loading|=2}),Pt(s,"link",o),Nt(s),i.head.appendChild(s))}function po(i){return'[src="'+_n(i)+'"]'}function Ka(i){return"script[async]"+i}function aS(i,s,o){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+_n(o.href)+'"]');if(l)return s.instance=l,Nt(l),l;var d=g({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Nt(l),Pt(l,"style",d),Gu(l,o.precedence,i),s.instance=l;case"stylesheet":d=ho(o.href);var p=i.querySelector(Ua(d));if(p)return s.state.loading|=4,s.instance=p,Nt(p),p;l=oS(o),(d=jn.get(d))&&Uh(l,d),p=(i.ownerDocument||i).createElement("link"),Nt(p);var v=p;return v._p=new Promise(function(w,A){v.onload=w,v.onerror=A}),Pt(p,"link",l),s.state.loading|=4,Gu(p,o.precedence,i),s.instance=p;case"script":return p=po(o.src),(d=i.querySelector(Ka(p)))?(s.instance=d,Nt(d),d):(l=o,(d=jn.get(p))&&(l=g({},o),Kh(l,d)),i=i.ownerDocument||i,d=i.createElement("script"),Nt(d),Pt(d,"link",l),i.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(l=s.instance,s.state.loading|=4,Gu(l,o.precedence,i));return s.instance}function Gu(i,s,o){for(var l=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=l.length?l[l.length-1]:null,p=d,v=0;v<l.length;v++){var w=l[v];if(w.dataset.precedence===s)p=w;else if(p!==d)break}p?p.parentNode.insertBefore(i,p.nextSibling):(s=o.nodeType===9?o.head:o,s.insertBefore(i,s.firstChild))}function Uh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Kh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Yu=null;function lS(i,s,o){if(Yu===null){var l=new Map,d=Yu=new Map;d.set(o,l)}else d=Yu,l=d.get(o),l||(l=new Map,d.set(o,l));if(l.has(i))return l;for(l.set(i,null),o=o.getElementsByTagName(i),d=0;d<o.length;d++){var p=o[d];if(!(p[ia]||p[Ut]||i==="link"&&p.getAttribute("rel")==="stylesheet")&&p.namespaceURI!=="http://www.w3.org/2000/svg"){var v=p.getAttribute(s)||"";v=i+v;var w=l.get(v);w?w.push(p):l.set(v,[p])}}return l}function uS(i,s,o){i=i.ownerDocument||i,i.head.insertBefore(o,s==="title"?i.querySelector("head > title"):null)}function ok(i,s,o){if(o===1||s.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return i=s.disabled,typeof s.precedence=="string"&&i==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function cS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function ak(i,s,o,l){if(o.type==="stylesheet"&&(typeof l.media!="string"||matchMedia(l.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var d=ho(l.href),p=s.querySelector(Ua(d));if(p){s=p._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(i.count++,i=Ju.bind(i),s.then(i,i)),o.state.loading|=4,o.instance=p,Nt(p);return}p=s.ownerDocument||s,l=oS(l),(d=jn.get(d))&&Uh(l,d),p=p.createElement("link"),Nt(p);var v=p;v._p=new Promise(function(w,A){v.onload=w,v.onerror=A}),Pt(p,"link",l),o.instance=p}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(o,s),(s=o.state.preload)&&(o.state.loading&3)===0&&(i.count++,o=Ju.bind(i),s.addEventListener("load",o),s.addEventListener("error",o))}}var qh=0;function lk(i,s){return i.stylesheets&&i.count===0&&Zu(i,i.stylesheets),0<i.count||0<i.imgCount?function(o){var l=setTimeout(function(){if(i.stylesheets&&Zu(i,i.stylesheets),i.unsuspend){var p=i.unsuspend;i.unsuspend=null,p()}},6e4+s);0<i.imgBytes&&qh===0&&(qh=62500*qC());var d=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Zu(i,i.stylesheets),i.unsuspend)){var p=i.unsuspend;i.unsuspend=null,p()}},(i.imgBytes>qh?50:800)+s);return i.unsuspend=o,function(){i.unsuspend=null,clearTimeout(l),clearTimeout(d)}}:null}function Ju(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Zu(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Xu=null;function Zu(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Xu=new Map,s.forEach(uk,i),Xu=null,Ju.call(i))}function uk(i,s){if(!(s.state.loading&4)){var o=Xu.get(i);if(o)var l=o.get(null);else{o=new Map,Xu.set(i,o);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),p=0;p<d.length;p++){var v=d[p];(v.nodeName==="LINK"||v.getAttribute("media")!=="not all")&&(o.set(v.dataset.precedence,v),l=v)}l&&o.set(null,l)}d=s.instance,v=d.getAttribute("data-precedence"),p=o.get(v)||l,p===l&&o.set(null,d),o.set(v,d),this.count++,l=Ju.bind(this),d.addEventListener("load",l),d.addEventListener("error",l),p?p.parentNode.insertBefore(d,p.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),s.state.loading|=4}}var qa={$$typeof:R,Provider:null,Consumer:null,_currentValue:L,_currentValue2:L,_threadCount:0};function ck(i,s,o,l,d,p,v,w,A){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=zf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zf(0),this.hiddenUpdates=zf(null),this.identifierPrefix=l,this.onUncaughtError=d,this.onCaughtError=p,this.onRecoverableError=v,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=A,this.incompleteTransitions=new Map}function fS(i,s,o,l,d,p,v,w,A,N,V,I){return i=new ck(i,s,o,v,A,N,V,I,w),s=1,p===!0&&(s|=24),p=mn(3,null,null,s),i.current=p,p.stateNode=i,s=wd(),s.refCount++,i.pooledCache=s,s.refCount++,p.memoizedState={element:l,isDehydrated:o,cache:s},Ed(p),i}function dS(i){return i?(i=Ps,i):Ps}function hS(i,s,o,l,d,p){d=dS(d),l.context===null?l.context=d:l.pendingContext=d,l=ur(s),l.payload={element:o},p=p===void 0?null:p,p!==null&&(l.callback=p),o=cr(i,l,s),o!==null&&(ln(o,i,s),Sa(o,i,s))}function pS(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function Ih(i,s){pS(i,s),(i=i.alternate)&&pS(i,s)}function mS(i){if(i.tag===13||i.tag===31){var s=Wr(i,67108864);s!==null&&ln(s,i,67108864),Ih(i,67108864)}}function yS(i){if(i.tag===13||i.tag===31){var s=Sn();s=Lf(s);var o=Wr(i,s);o!==null&&ln(o,i,s),Ih(i,s)}}var Qu=!0;function fk(i,s,o,l){var d=j.T;j.T=null;var p=U.p;try{U.p=2,Ph(i,s,o,l)}finally{U.p=p,j.T=d}}function dk(i,s,o,l){var d=j.T;j.T=null;var p=U.p;try{U.p=8,Ph(i,s,o,l)}finally{U.p=p,j.T=d}}function Ph(i,s,o,l){if(Qu){var d=Hh(l);if(d===null)kh(i,s,l,Wu,o),vS(i,l);else if(pk(d,i,s,o,l))l.stopPropagation();else if(vS(i,l),s&4&&-1<hk.indexOf(i)){for(;d!==null;){var p=Ns(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=Yr(p.pendingLanes);if(v!==0){var w=p;for(w.pendingLanes|=2,w.entangledLanes|=2;v;){var A=1<<31-hn(v);w.entanglements[1]|=A,v&=~A}li(p),(Be&6)===0&&(ju=st()+500,Ba(0))}}break;case 31:case 13:w=Wr(p,2),w!==null&&ln(w,p,2),zu(),Ih(p,2)}if(p=Hh(l),p===null&&kh(i,s,l,Wu,o),p===d)break;d=p}d!==null&&l.stopPropagation()}else kh(i,s,l,null,o)}}function Hh(i){return i=Gf(i),Fh(i)}var Wu=null;function Fh(i){if(Wu=null,i=Ds(i),i!==null){var s=u(i);if(s===null)i=null;else{var o=s.tag;if(o===13){if(i=c(s),i!==null)return i;i=null}else if(o===31){if(i=f(s),i!==null)return i;i=null}else if(o===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return Wu=i,null}function gS(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Kl()){case Eg:return 2;case Og:return 8;case ql:case W_:return 32;case _g:return 268435456;default:return 32}default:return 32}}var Gh=!1,wr=null,xr=null,Tr=null,Ia=new Map,Pa=new Map,Ar=[],hk="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function vS(i,s){switch(i){case"focusin":case"focusout":wr=null;break;case"dragenter":case"dragleave":xr=null;break;case"mouseover":case"mouseout":Tr=null;break;case"pointerover":case"pointerout":Ia.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Pa.delete(s.pointerId)}}function Ha(i,s,o,l,d,p){return i===null||i.nativeEvent!==p?(i={blockedOn:s,domEventName:o,eventSystemFlags:l,nativeEvent:p,targetContainers:[d]},s!==null&&(s=Ns(s),s!==null&&mS(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function pk(i,s,o,l,d){switch(s){case"focusin":return wr=Ha(wr,i,s,o,l,d),!0;case"dragenter":return xr=Ha(xr,i,s,o,l,d),!0;case"mouseover":return Tr=Ha(Tr,i,s,o,l,d),!0;case"pointerover":var p=d.pointerId;return Ia.set(p,Ha(Ia.get(p)||null,i,s,o,l,d)),!0;case"gotpointercapture":return p=d.pointerId,Pa.set(p,Ha(Pa.get(p)||null,i,s,o,l,d)),!0}return!1}function bS(i){var s=Ds(i.target);if(s!==null){var o=u(s);if(o!==null){if(s=o.tag,s===13){if(s=c(o),s!==null){i.blockedOn=s,Ng(i.priority,function(){yS(o)});return}}else if(s===31){if(s=f(o),s!==null){i.blockedOn=s,Ng(i.priority,function(){yS(o)});return}}else if(s===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function ec(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var o=Hh(i.nativeEvent);if(o===null){o=i.nativeEvent;var l=new o.constructor(o.type,o);Ff=l,o.target.dispatchEvent(l),Ff=null}else return s=Ns(o),s!==null&&mS(s),i.blockedOn=o,!1;s.shift()}return!0}function SS(i,s,o){ec(i)&&o.delete(s)}function mk(){Gh=!1,wr!==null&&ec(wr)&&(wr=null),xr!==null&&ec(xr)&&(xr=null),Tr!==null&&ec(Tr)&&(Tr=null),Ia.forEach(SS),Pa.forEach(SS)}function tc(i,s){i.blockedOn===s&&(i.blockedOn=null,Gh||(Gh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,mk)))}var nc=null;function wS(i){nc!==i&&(nc=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){nc===i&&(nc=null);for(var s=0;s<i.length;s+=3){var o=i[s],l=i[s+1],d=i[s+2];if(typeof l!="function"){if(Fh(l||o)===null)continue;break}var p=Ns(o);p!==null&&(i.splice(s,3),s-=3,Hd(p,{pending:!0,data:d,method:o.method,action:l},l,d))}}))}function mo(i){function s(A){return tc(A,i)}wr!==null&&tc(wr,i),xr!==null&&tc(xr,i),Tr!==null&&tc(Tr,i),Ia.forEach(s),Pa.forEach(s);for(var o=0;o<Ar.length;o++){var l=Ar[o];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Ar.length&&(o=Ar[0],o.blockedOn===null);)bS(o),o.blockedOn===null&&Ar.shift();if(o=(i.ownerDocument||i).$$reactFormReplay,o!=null)for(l=0;l<o.length;l+=3){var d=o[l],p=o[l+1],v=d[tn]||null;if(typeof p=="function")v||wS(o);else if(v){var w=null;if(p&&p.hasAttribute("formAction")){if(d=p,v=p[tn]||null)w=v.formAction;else if(Fh(d)!==null)continue}else w=v.action;typeof w=="function"?o[l+1]=w:(o.splice(l,3),l-=3),wS(o)}}}function xS(){function i(p){p.canIntercept&&p.info==="react-transition"&&p.intercept({handler:function(){return new Promise(function(v){return d=v})},focusReset:"manual",scroll:"manual"})}function s(){d!==null&&(d(),d=null),l||setTimeout(o,20)}function o(){if(!l&&!navigation.transition){var p=navigation.currentEntry;p&&p.url!=null&&navigation.navigate(p.url,{state:p.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var l=!1,d=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",s),navigation.addEventListener("navigateerror",s),setTimeout(o,100),function(){l=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",s),navigation.removeEventListener("navigateerror",s),d!==null&&(d(),d=null)}}}function Yh(i){this._internalRoot=i}ic.prototype.render=Yh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var o=s.current,l=Sn();hS(o,l,i,s,null,null)},ic.prototype.unmount=Yh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;hS(i.current,2,null,i,null,null),zu(),s[Ms]=null}};function ic(i){this._internalRoot=i}ic.prototype.unstable_scheduleHydration=function(i){if(i){var s=Dg();i={blockedOn:null,target:i,priority:s};for(var o=0;o<Ar.length&&s!==0&&s<Ar[o].priority;o++);Ar.splice(o,0,i),o===0&&bS(i)}};var TS=e.version;if(TS!=="19.2.0")throw Error(r(527,TS,"19.2.0"));U.findDOMNode=function(i){var s=i._reactInternals;if(s===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=m(s),i=i!==null?y(i):null,i=i===null?null:i.stateNode,i};var yk={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var rc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!rc.isDisabled&&rc.supportsFiber)try{ea=rc.inject(yk),dn=rc}catch{}}return Ga.createRoot=function(i,s){if(!a(i))throw Error(r(299));var o=!1,l="",d=kb,p=Mb,v=Db;return s!=null&&(s.unstable_strictMode===!0&&(o=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(p=s.onCaughtError),s.onRecoverableError!==void 0&&(v=s.onRecoverableError)),s=fS(i,1,!1,null,null,o,l,null,d,p,v,xS),i[Ms]=s.current,Ch(i),new Yh(s)},Ga.hydrateRoot=function(i,s,o){if(!a(i))throw Error(r(299));var l=!1,d="",p=kb,v=Mb,w=Db,A=null;return o!=null&&(o.unstable_strictMode===!0&&(l=!0),o.identifierPrefix!==void 0&&(d=o.identifierPrefix),o.onUncaughtError!==void 0&&(p=o.onUncaughtError),o.onCaughtError!==void 0&&(v=o.onCaughtError),o.onRecoverableError!==void 0&&(w=o.onRecoverableError),o.formState!==void 0&&(A=o.formState)),s=fS(i,1,!0,s,o??null,l,d,A,p,v,w,xS),s.context=dS(null),o=s.current,l=Sn(),l=Lf(l),d=ur(l),d.callback=null,cr(o,d,l),o=l,s.current.lanes=o,na(s,o),li(s),i[Ms]=s.current,Ch(i),new ic(s)},Ga.version="19.2.0",Ga}var qS;function jM(){if(qS)return Wh.exports;qS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Wh.exports=$M(),Wh.exports}var BM=jM();function df(){return typeof window<"u"}function Pr(t){return ST(t)?(t.nodeName||"").toLowerCase():"#document"}function xn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function bi(t){var e;return(e=(ST(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function ST(t){return df()?t instanceof Node||t instanceof xn(t).Node:!1}function gt(t){return df()?t instanceof Element||t instanceof xn(t).Element:!1}function Dt(t){return df()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Yp(t){return!df()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}const zM=new Set(["inline","contents"]);function Ol(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=Pn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!zM.has(a)}const LM=new Set(["table","td","th"]);function VM(t){return LM.has(Pr(t))}const UM=[":popover-open",":modal"];function hf(t){return UM.some(e=>{try{return t.matches(e)}catch{return!1}})}const KM=["transform","translate","scale","rotate","perspective"],qM=["transform","translate","scale","rotate","perspective","filter"],IM=["paint","layout","strict","content"];function yy(t){const e=pf(),n=gt(t)?Pn(t):t;return KM.some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||qM.some(r=>(n.willChange||"").includes(r))||IM.some(r=>(n.contain||"").includes(r))}function PM(t){let e=Gi(t);for(;Dt(e)&&!Hi(e);){if(yy(e))return e;if(hf(e))return null;e=Gi(e)}return null}function pf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const HM=new Set(["html","body","#document"]);function Hi(t){return HM.has(Pr(t))}function Pn(t){return xn(t).getComputedStyle(t)}function mf(t){return gt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Gi(t){if(Pr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Yp(t)&&t.host||bi(t);return Yp(e)?e.host:e}function wT(t){const e=Gi(t);return Hi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Dt(e)&&Ol(e)?e:wT(e)}function $r(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=wT(t),u=a===((r=t.ownerDocument)==null?void 0:r.body),c=xn(a);if(u){const f=Jp(c);return e.concat(c,c.visualViewport||[],Ol(a)?a:[],f&&n?$r(f):[])}return e.concat(a,$r(a,[],n))}function Jp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const zc=Math.min,bs=Math.max,Lc=Math.round,oc=Math.floor,hi=t=>({x:t,y:t}),FM={left:"right",right:"left",bottom:"top",top:"bottom"},GM={start:"end",end:"start"};function IS(t,e,n){return bs(t,zc(e,n))}function yf(t,e){return typeof t=="function"?t(e):t}function Ts(t){return t.split("-")[0]}function gf(t){return t.split("-")[1]}function xT(t){return t==="x"?"y":"x"}function TT(t){return t==="y"?"height":"width"}const YM=new Set(["top","bottom"]);function Mr(t){return YM.has(Ts(t))?"y":"x"}function AT(t){return xT(Mr(t))}function JM(t,e,n){n===void 0&&(n=!1);const r=gf(t),a=AT(t),u=TT(a);let c=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[u]>e.floating[u]&&(c=Vc(c)),[c,Vc(c)]}function XM(t){const e=Vc(t);return[Xp(t),e,Xp(e)]}function Xp(t){return t.replace(/start|end/g,e=>GM[e])}const PS=["left","right"],HS=["right","left"],ZM=["top","bottom"],QM=["bottom","top"];function WM(t,e,n){switch(t){case"top":case"bottom":return n?e?HS:PS:e?PS:HS;case"left":case"right":return e?ZM:QM;default:return[]}}function eD(t,e,n,r){const a=gf(t);let u=WM(Ts(t),n==="start",r);return a&&(u=u.map(c=>c+"-"+a),e&&(u=u.concat(u.map(Xp)))),u}function Vc(t){return t.replace(/left|right|bottom|top/g,e=>FM[e])}function tD(t){return{top:0,right:0,bottom:0,left:0,...t}}function nD(t){return typeof t!="number"?tD(t):{top:t,right:t,bottom:t,left:t}}function Uc(t){const{x:e,y:n,width:r,height:a}=t;return{width:r,height:a,top:n,left:e,right:e+r,bottom:n+a,x:e,y:n}}var iD=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Kc=iD.join(","),ET=typeof Element>"u",zo=ET?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,qc=!ET&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},pl=function(e,n){var r;n===void 0&&(n=!0);var a=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),u=a===""||a==="true",c=u||n&&e&&pl(e.parentNode);return c},rD=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},OT=function(e,n,r){if(pl(e))return[];var a=Array.prototype.slice.apply(e.querySelectorAll(Kc));return n&&zo.call(e,Kc)&&a.unshift(e),a=a.filter(r),a},Ic=function(e,n,r){for(var a=[],u=Array.from(e);u.length;){var c=u.shift();if(!pl(c,!1))if(c.tagName==="SLOT"){var f=c.assignedElements(),h=f.length?f:c.children,m=Ic(h,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:c,candidates:m})}else{var y=zo.call(c,Kc);y&&r.filter(c)&&(n||!e.includes(c))&&a.push(c);var g=c.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(c),b=!pl(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(c));if(g&&b){var S=Ic(g===!0?c.children:g.children,!0,r);r.flatten?a.push.apply(a,S):a.push({scopeParent:c,candidates:S})}else u.unshift.apply(u,c.children)}}return a},_T=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},RT=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||rD(e))&&!_T(e)?0:e.tabIndex},sD=function(e,n){var r=RT(e);return r<0&&n&&!_T(e)?0:r},oD=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},CT=function(e){return e.tagName==="INPUT"},aD=function(e){return CT(e)&&e.type==="hidden"},lD=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},uD=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},cD=function(e){if(!e.name)return!0;var n=e.form||qc(e),r=function(f){return n.querySelectorAll('input[type="radio"][name="'+f+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=r(window.CSS.escape(e.name));else try{a=r(e.name)}catch(c){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",c.message),!1}var u=uD(a,e.form);return!u||u===e},fD=function(e){return CT(e)&&e.type==="radio"},dD=function(e){return fD(e)&&!cD(e)},hD=function(e){var n,r=e&&qc(e),a=(n=r)===null||n===void 0?void 0:n.host,u=!1;if(r&&r!==e){var c,f,h;for(u=!!((c=a)!==null&&c!==void 0&&(f=c.ownerDocument)!==null&&f!==void 0&&f.contains(a)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!u&&a;){var m,y,g;r=qc(a),a=(m=r)===null||m===void 0?void 0:m.host,u=!!((y=a)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(a))}}return u},FS=function(e){var n=e.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},pD=function(e,n){var r=n.displayCheck,a=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var u=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!u}if(getComputedStyle(e).visibility==="hidden")return!0;var c=zo.call(e,"details>summary:first-of-type"),f=c?e.parentElement:e;if(zo.call(f,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof a=="function"){for(var h=e;e;){var m=e.parentElement,y=qc(e);if(m&&!m.shadowRoot&&a(m)===!0)return FS(e);e.assignedSlot?e=e.assignedSlot:!m&&y!==e.ownerDocument?e=y.host:e=m}e=h}if(hD(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return FS(e);return!1},mD=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var a=n.children.item(r);if(a.tagName==="LEGEND")return zo.call(n,"fieldset[disabled] *")?!0:!a.contains(e)}return!0}n=n.parentElement}return!1},Zp=function(e,n){return!(n.disabled||pl(n)||aD(n)||pD(n,e)||lD(n)||mD(n))},Qp=function(e,n){return!(dD(n)||RT(n)<0||!Zp(e,n))},yD=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},kT=function(e){var n=[],r=[];return e.forEach(function(a,u){var c=!!a.scopeParent,f=c?a.scopeParent:a,h=sD(f,c),m=c?kT(a.candidates):f;h===0?c?n.push.apply(n,m):n.push(f):r.push({documentOrder:u,tabIndex:h,item:a,isScope:c,content:m})}),r.sort(oD).reduce(function(a,u){return u.isScope?a.push.apply(a,u.content):a.push(u.content),a},[]).concat(n)},gy=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ic([e],n.includeContainer,{filter:Qp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:yD}):r=OT(e,n.includeContainer,Qp.bind(null,n)),kT(r)},gD=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Ic([e],n.includeContainer,{filter:Zp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=OT(e,n.includeContainer,Zp.bind(null,n)),r},MT=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return zo.call(e,Kc)===!1?!1:Qp(n,e)};function vD(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function DT(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function bD(){return/apple/i.test(navigator.vendor)}function Wp(){const t=/android/i;return t.test(vD())||t.test(DT())}function SD(){return DT().includes("jsdom/")}const GS="data-floating-ui-focusable",wD="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function So(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function wn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Yp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Cr(t){return"composedPath"in t?t.composedPath()[0]:t.target}function ip(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function xD(t){return t.matches("html,body")}function ei(t){return t?.ownerDocument||document}function NT(t){return Dt(t)&&t.matches(wD)}function YS(t){return t?t.getAttribute("role")==="combobox"&&NT(t):!1}function em(t){return t?t.hasAttribute(GS)?t:t.querySelector("["+GS+"]")||t:null}function Ro(t,e,n){return n===void 0&&(n=!0),t.filter(a=>{var u;return a.parentId===e&&(!n||((u=a.context)==null?void 0:u.open))}).flatMap(a=>[a,...Ro(t,a.id,n)])}function JS(t,e){var n;let r=[],a=(n=t.find(u=>u.id===e))==null?void 0:n.parentId;for(;a;){const u=t.find(c=>c.id===a);a=u?.parentId,u&&(r=r.concat(u))}return r}function rp(t){t.preventDefault(),t.stopPropagation()}function TD(t){return"nativeEvent"in t}function AD(t){return t.mozInputSource===0&&t.isTrusted?!0:Wp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function ED(t){return SD()?!1:!Wp()&&t.width===0&&t.height===0||Wp()&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function XS(t,e){return["mouse","pen"].includes(t)}var OD=typeof document<"u",_D=function(){},Pi=OD?$.useLayoutEffect:_D;const RD={...pT};function sp(t){const e=$.useRef(t);return Pi(()=>{e.current=t}),e}const CD=RD.useInsertionEffect,kD=CD||(t=>t());function fi(t){const e=$.useRef(()=>{});return kD(()=>{e.current=t}),$.useCallback(function(){for(var n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return e.current==null?void 0:e.current(...r)},[])}const vf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $T(t,e){const n=gy(t,vf()),r=n.length;if(r===0)return;const a=So(ei(t)),u=n.indexOf(a),c=u===-1?e===1?0:r-1:u+e;return n[c]}function MD(t){return $T(ei(t).body,1)||t}function DD(t){return $T(ei(t).body,-1)||t}function ZS(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!wn(n,r)}var ND=bT();function QS(t,e,n){let{reference:r,floating:a}=t;const u=Mr(e),c=AT(e),f=TT(c),h=Ts(e),m=u==="y",y=r.x+r.width/2-a.width/2,g=r.y+r.height/2-a.height/2,b=r[f]/2-a[f]/2;let S;switch(h){case"top":S={x:y,y:r.y-a.height};break;case"bottom":S={x:y,y:r.y+r.height};break;case"right":S={x:r.x+r.width,y:g};break;case"left":S={x:r.x-a.width,y:g};break;default:S={x:r.x,y:r.y}}switch(gf(e)){case"start":S[c]-=b*(n&&m?-1:1);break;case"end":S[c]+=b*(n&&m?-1:1);break}return S}const $D=async(t,e,n)=>{const{placement:r="bottom",strategy:a="absolute",middleware:u=[],platform:c}=n,f=u.filter(Boolean),h=await(c.isRTL==null?void 0:c.isRTL(e));let m=await c.getElementRects({reference:t,floating:e,strategy:a}),{x:y,y:g}=QS(m,r,h),b=r,S={},x=0;for(let T=0;T<f.length;T++){const{name:M,fn:C}=f[T],{x:_,y:R,data:G,reset:P}=await C({x:y,y:g,initialPlacement:r,placement:b,strategy:a,middlewareData:S,rects:m,platform:c,elements:{reference:t,floating:e}});y=_??y,g=R??g,S={...S,[M]:{...S[M],...G}},P&&x<=50&&(x++,typeof P=="object"&&(P.placement&&(b=P.placement),P.rects&&(m=P.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:a}):P.rects),{x:y,y:g}=QS(m,b,h)),T=-1)}return{x:y,y:g,placement:b,strategy:a,middlewareData:S}};async function jT(t,e){var n;e===void 0&&(e={});const{x:r,y:a,platform:u,rects:c,elements:f,strategy:h}=t,{boundary:m="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:b=!1,padding:S=0}=yf(e,t),x=nD(S),M=f[b?g==="floating"?"reference":"floating":g],C=Uc(await u.getClippingRect({element:(n=await(u.isElement==null?void 0:u.isElement(M)))==null||n?M:M.contextElement||await(u.getDocumentElement==null?void 0:u.getDocumentElement(f.floating)),boundary:m,rootBoundary:y,strategy:h})),_=g==="floating"?{x:r,y:a,width:c.floating.width,height:c.floating.height}:c.reference,R=await(u.getOffsetParent==null?void 0:u.getOffsetParent(f.floating)),G=await(u.isElement==null?void 0:u.isElement(R))?await(u.getScale==null?void 0:u.getScale(R))||{x:1,y:1}:{x:1,y:1},P=Uc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:_,offsetParent:R,strategy:h}):_);return{top:(C.top-P.top+x.top)/G.y,bottom:(P.bottom-C.bottom+x.bottom)/G.y,left:(C.left-P.left+x.left)/G.x,right:(P.right-C.right+x.right)/G.x}}const jD=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:a,middlewareData:u,rects:c,initialPlacement:f,platform:h,elements:m}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:T=!0,...M}=yf(t,e);if((n=u.arrow)!=null&&n.alignmentOffset)return{};const C=Ts(a),_=Mr(f),R=Ts(f)===f,G=await(h.isRTL==null?void 0:h.isRTL(m.floating)),P=b||(R||!T?[Vc(f)]:XM(f)),ee=x!=="none";!b&&ee&&P.push(...eD(f,T,x,G));const J=[f,...P],X=await jT(e,M),he=[];let pe=((r=u.flip)==null?void 0:r.overflows)||[];if(y&&he.push(X[C]),g){const Z=JM(a,c,G);he.push(X[Z[0]],X[Z[1]])}if(pe=[...pe,{placement:a,overflows:he}],!he.every(Z=>Z<=0)){var we,je;const Z=(((we=u.flip)==null?void 0:we.index)||0)+1,ne=J[Z];if(ne&&(!(g==="alignment"?_!==Mr(ne):!1)||pe.every(L=>Mr(L.placement)===_?L.overflows[0]>0:!0)))return{data:{index:Z,overflows:pe},reset:{placement:ne}};let j=(je=pe.filter(U=>U.overflows[0]<=0).sort((U,L)=>U.overflows[1]-L.overflows[1])[0])==null?void 0:je.placement;if(!j)switch(S){case"bestFit":{var be;const U=(be=pe.filter(L=>{if(ee){const te=Mr(L.placement);return te===_||te==="y"}return!0}).map(L=>[L.placement,L.overflows.filter(te=>te>0).reduce((te,oe)=>te+oe,0)]).sort((L,te)=>L[1]-te[1])[0])==null?void 0:be[0];U&&(j=U);break}case"initialPlacement":j=f;break}if(a!==j)return{reset:{placement:j}}}return{}}}},BD=new Set(["left","top"]);async function zD(t,e){const{placement:n,platform:r,elements:a}=t,u=await(r.isRTL==null?void 0:r.isRTL(a.floating)),c=Ts(n),f=gf(n),h=Mr(n)==="y",m=BD.has(c)?-1:1,y=u&&h?-1:1,g=yf(e,t);let{mainAxis:b,crossAxis:S,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof x=="number"&&(S=f==="end"?x*-1:x),h?{x:S*y,y:b*m}:{x:b*m,y:S*y}}const LD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:a,y:u,placement:c,middlewareData:f}=e,h=await zD(e,t);return c===((n=f.offset)==null?void 0:n.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:a+h.x,y:u+h.y,data:{...h,placement:c}}}}},VD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:a}=e,{mainAxis:u=!0,crossAxis:c=!1,limiter:f={fn:M=>{let{x:C,y:_}=M;return{x:C,y:_}}},...h}=yf(t,e),m={x:n,y:r},y=await jT(e,h),g=Mr(Ts(a)),b=xT(g);let S=m[b],x=m[g];if(u){const M=b==="y"?"top":"left",C=b==="y"?"bottom":"right",_=S+y[M],R=S-y[C];S=IS(_,S,R)}if(c){const M=g==="y"?"top":"left",C=g==="y"?"bottom":"right",_=x+y[M],R=x-y[C];x=IS(_,x,R)}const T=f.fn({...e,[b]:S,[g]:x});return{...T,data:{x:T.x-n,y:T.y-r,enabled:{[b]:u,[g]:c}}}}}};function BT(t){const e=Pn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const a=Dt(t),u=a?t.offsetWidth:n,c=a?t.offsetHeight:r,f=Lc(n)!==u||Lc(r)!==c;return f&&(n=u,r=c),{width:n,height:r,$:f}}function vy(t){return gt(t)?t:t.contextElement}function Co(t){const e=vy(t);if(!Dt(e))return hi(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:u}=BT(e);let c=(u?Lc(n.width):n.width)/r,f=(u?Lc(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const UD=hi(0);function zT(t){const e=xn(t);return!pf()||!e.visualViewport?UD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function KD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function As(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),u=vy(t);let c=hi(1);e&&(r?gt(r)&&(c=Co(r)):c=Co(t));const f=KD(u,n,r)?zT(u):hi(0);let h=(a.left+f.x)/c.x,m=(a.top+f.y)/c.y,y=a.width/c.x,g=a.height/c.y;if(u){const b=xn(u),S=r&>(r)?xn(r):r;let x=b,T=Jp(x);for(;T&&r&&S!==x;){const M=Co(T),C=T.getBoundingClientRect(),_=Pn(T),R=C.left+(T.clientLeft+parseFloat(_.paddingLeft))*M.x,G=C.top+(T.clientTop+parseFloat(_.paddingTop))*M.y;h*=M.x,m*=M.y,y*=M.x,g*=M.y,h+=R,m+=G,x=xn(T),T=Jp(x)}}return Uc({width:y,height:g,x:h,y:m})}function bf(t,e){const n=mf(t).scrollLeft;return e?e.left+n:As(bi(t)).left+n}function LT(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-bf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function qD(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const u=a==="fixed",c=bi(r),f=e?hf(e.floating):!1;if(r===c||f&&u)return n;let h={scrollLeft:0,scrollTop:0},m=hi(1);const y=hi(0),g=Dt(r);if((g||!g&&!u)&&((Pr(r)!=="body"||Ol(c))&&(h=mf(r)),Dt(r))){const S=As(r);m=Co(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const b=c&&!g&&!u?LT(c,h):hi(0);return{width:n.width*m.x,height:n.height*m.y,x:n.x*m.x-h.scrollLeft*m.x+y.x+b.x,y:n.y*m.y-h.scrollTop*m.y+y.y+b.y}}function ID(t){return Array.from(t.getClientRects())}function PD(t){const e=bi(t),n=mf(t),r=t.ownerDocument.body,a=bs(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),u=bs(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+bf(t);const f=-n.scrollTop;return Pn(r).direction==="rtl"&&(c+=bs(e.clientWidth,r.clientWidth)-a),{width:a,height:u,x:c,y:f}}const WS=25;function HD(t,e){const n=xn(t),r=bi(t),a=n.visualViewport;let u=r.clientWidth,c=r.clientHeight,f=0,h=0;if(a){u=a.width,c=a.height;const y=pf();(!y||y&&e==="fixed")&&(f=a.offsetLeft,h=a.offsetTop)}const m=bf(r);if(m<=0){const y=r.ownerDocument,g=y.body,b=getComputedStyle(g),S=y.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,x=Math.abs(r.clientWidth-g.clientWidth-S);x<=WS&&(u-=x)}else m<=WS&&(u+=m);return{width:u,height:c,x:f,y:h}}const FD=new Set(["absolute","fixed"]);function GD(t,e){const n=As(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,u=Dt(t)?Co(t):hi(1),c=t.clientWidth*u.x,f=t.clientHeight*u.y,h=a*u.x,m=r*u.y;return{width:c,height:f,x:h,y:m}}function ew(t,e,n){let r;if(e==="viewport")r=HD(t,n);else if(e==="document")r=PD(bi(t));else if(gt(e))r=GD(e,n);else{const a=zT(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Uc(r)}function VT(t,e){const n=Gi(t);return n===e||!gt(n)||Hi(n)?!1:Pn(n).position==="fixed"||VT(n,e)}function YD(t,e){const n=e.get(t);if(n)return n;let r=$r(t,[],!1).filter(f=>gt(f)&&Pr(f)!=="body"),a=null;const u=Pn(t).position==="fixed";let c=u?Gi(t):t;for(;gt(c)&&!Hi(c);){const f=Pn(c),h=yy(c);!h&&f.position==="fixed"&&(a=null),(u?!h&&!a:!h&&f.position==="static"&&!!a&&FD.has(a.position)||Ol(c)&&!h&&VT(t,c))?r=r.filter(y=>y!==c):a=f,c=Gi(c)}return e.set(t,r),r}function JD(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const c=[...n==="clippingAncestors"?hf(e)?[]:YD(e,this._c):[].concat(n),r],f=c[0],h=c.reduce((m,y)=>{const g=ew(e,y,a);return m.top=bs(g.top,m.top),m.right=zc(g.right,m.right),m.bottom=zc(g.bottom,m.bottom),m.left=bs(g.left,m.left),m},ew(e,f,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function XD(t){const{width:e,height:n}=BT(t);return{width:e,height:n}}function ZD(t,e,n){const r=Dt(e),a=bi(e),u=n==="fixed",c=As(t,!0,u,e);let f={scrollLeft:0,scrollTop:0};const h=hi(0);function m(){h.x=bf(a)}if(r||!r&&!u)if((Pr(e)!=="body"||Ol(a))&&(f=mf(e)),r){const S=As(e,!0,u,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else a&&m();u&&!r&&a&&m();const y=a&&!r&&!u?LT(a,f):hi(0),g=c.left+f.scrollLeft-h.x-y.x,b=c.top+f.scrollTop-h.y-y.y;return{x:g,y:b,width:c.width,height:c.height}}function op(t){return Pn(t).position==="static"}function tw(t,e){if(!Dt(t)||Pn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bi(t)===n&&(n=n.ownerDocument.body),n}function UT(t,e){const n=xn(t);if(hf(t))return n;if(!Dt(t)){let a=Gi(t);for(;a&&!Hi(a);){if(gt(a)&&!op(a))return a;a=Gi(a)}return n}let r=tw(t,e);for(;r&&VM(r)&&op(r);)r=tw(r,e);return r&&Hi(r)&&op(r)&&!yy(r)?n:r||PM(t)||n}const QD=async function(t){const e=this.getOffsetParent||UT,n=this.getDimensions,r=await n(t.floating);return{reference:ZD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function WD(t){return Pn(t).direction==="rtl"}const e2={convertOffsetParentRelativeRectToViewportRelativeRect:qD,getDocumentElement:bi,getClippingRect:JD,getOffsetParent:UT,getElementRects:QD,getClientRects:ID,getDimensions:XD,getScale:Co,isElement:gt,isRTL:WD};function KT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function t2(t,e){let n=null,r;const a=bi(t);function u(){var f;clearTimeout(r),(f=n)==null||f.disconnect(),n=null}function c(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),u();const m=t.getBoundingClientRect(),{left:y,top:g,width:b,height:S}=m;if(f||e(),!b||!S)return;const x=oc(g),T=oc(a.clientWidth-(y+b)),M=oc(a.clientHeight-(g+S)),C=oc(y),R={rootMargin:-x+"px "+-T+"px "+-M+"px "+-C+"px",threshold:bs(0,zc(1,h))||1};let G=!0;function P(ee){const J=ee[0].intersectionRatio;if(J!==h){if(!G)return c();J?c(!1,J):r=setTimeout(()=>{c(!1,1e-7)},1e3)}J===1&&!KT(m,t.getBoundingClientRect())&&c(),G=!1}try{n=new IntersectionObserver(P,{...R,root:a.ownerDocument})}catch{n=new IntersectionObserver(P,R)}n.observe(t)}return c(!0),u}function n2(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:u=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,m=vy(t),y=a||u?[...m?$r(m):[],...$r(e)]:[];y.forEach(C=>{a&&C.addEventListener("scroll",n,{passive:!0}),u&&C.addEventListener("resize",n)});const g=m&&f?t2(m,n):null;let b=-1,S=null;c&&(S=new ResizeObserver(C=>{let[_]=C;_&&_.target===m&&S&&(S.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var R;(R=S)==null||R.observe(e)})),n()}),m&&!h&&S.observe(m),S.observe(e));let x,T=h?As(t):null;h&&M();function M(){const C=As(t);T&&!KT(T,C)&&n(),T=C,x=requestAnimationFrame(M)}return n(),()=>{var C;y.forEach(_=>{a&&_.removeEventListener("scroll",n),u&&_.removeEventListener("resize",n)}),g?.(),(C=S)==null||C.disconnect(),S=null,h&&cancelAnimationFrame(x)}}const i2=LD,r2=VD,s2=jD,o2=(t,e,n)=>{const r=new Map,a={platform:e2,...n},u={...a.platform,_c:r};return $D(t,e,{...a,platform:u})};var a2=typeof document<"u",l2=function(){},xc=a2?$.useLayoutEffect:l2;function Pc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,a;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!Pc(t[r],e[r]))return!1;return!0}if(a=Object.keys(t),n=a.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,a[r]))return!1;for(r=n;r--!==0;){const u=a[r];if(!(u==="_owner"&&t.$$typeof)&&!Pc(t[u],e[u]))return!1}return!0}return t!==t&&e!==e}function qT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function nw(t,e){const n=qT(t);return Math.round(e*n)/n}function ap(t){const e=$.useRef(t);return xc(()=>{e.current=t}),e}function u2(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:a,elements:{reference:u,floating:c}={},transform:f=!0,whileElementsMounted:h,open:m}=t,[y,g]=$.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[b,S]=$.useState(r);Pc(b,r)||S(r);const[x,T]=$.useState(null),[M,C]=$.useState(null),_=$.useCallback(L=>{L!==ee.current&&(ee.current=L,T(L))},[]),R=$.useCallback(L=>{L!==J.current&&(J.current=L,C(L))},[]),G=u||x,P=c||M,ee=$.useRef(null),J=$.useRef(null),X=$.useRef(y),he=h!=null,pe=ap(h),we=ap(a),je=ap(m),be=$.useCallback(()=>{if(!ee.current||!J.current)return;const L={placement:e,strategy:n,middleware:b};we.current&&(L.platform=we.current),o2(ee.current,J.current,L).then(te=>{const oe={...te,isPositioned:je.current!==!1};Z.current&&!Pc(X.current,oe)&&(X.current=oe,ND.flushSync(()=>{g(oe)}))})},[b,e,n,we,je]);xc(()=>{m===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,g(L=>({...L,isPositioned:!1})))},[m]);const Z=$.useRef(!1);xc(()=>(Z.current=!0,()=>{Z.current=!1}),[]),xc(()=>{if(G&&(ee.current=G),P&&(J.current=P),G&&P){if(pe.current)return pe.current(G,P,be);be()}},[G,P,be,pe,he]);const ne=$.useMemo(()=>({reference:ee,floating:J,setReference:_,setFloating:R}),[_,R]),j=$.useMemo(()=>({reference:G,floating:P}),[G,P]),U=$.useMemo(()=>{const L={position:n,left:0,top:0};if(!j.floating)return L;const te=nw(j.floating,y.x),oe=nw(j.floating,y.y);return f?{...L,transform:"translate("+te+"px, "+oe+"px)",...qT(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:oe}},[n,f,j.floating,y.x,y.y]);return $.useMemo(()=>({...y,update:be,refs:ne,elements:j,floatingStyles:U}),[y,be,ne,j,U])}const c2=(t,e)=>({...i2(t),options:[t,e]}),f2=(t,e)=>({...r2(t),options:[t,e]}),d2=(t,e)=>({...s2(t),options:[t,e]}),h2="data-floating-ui-focusable",iw="active",rw="selected",p2={...pT};let sw=!1,m2=0;const ow=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+m2++;function y2(){const[t,e]=$.useState(()=>sw?ow():void 0);return Pi(()=>{t==null&&e(ow())},[]),$.useEffect(()=>{sw=!0},[]),t}const g2=p2.useId,IT=g2||y2;function v2(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(a=>a(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const b2=$.createContext(null),S2=$.createContext(null),PT=()=>{var t;return((t=$.useContext(b2))==null?void 0:t.id)||null},by=()=>$.useContext(S2);function Hc(t){return"data-floating-ui-"+t}function w2(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let aw=0;function yo(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:a=!1}=e;r&&cancelAnimationFrame(aw);const u=()=>t?.focus({preventScroll:n});a?u():aw=requestAnimationFrame(u)}function x2(t){return t?.ownerDocument||document}const ko={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function lw(t){return t==="inert"?ko.inert:t==="aria-hidden"?ko["aria-hidden"]:ko.none}let ac=new WeakSet,lc={},lp=0;const T2=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,HT=t=>t&&(t.host||HT(t.parentNode)),A2=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=HT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function E2(t,e,n,r){const a="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,c=A2(e,t),f=new Set,h=new Set(c),m=[];lc[a]||(lc[a]=new WeakMap);const y=lc[a];c.forEach(g),b(e),f.clear();function g(S){!S||f.has(S)||(f.add(S),S.parentNode&&g(S.parentNode))}function b(S){!S||h.has(S)||[].forEach.call(S.children,x=>{if(Pr(x)!=="script")if(f.has(x))b(x);else{const T=u?x.getAttribute(u):null,M=T!==null&&T!=="false",C=lw(u),_=(C.get(x)||0)+1,R=(y.get(x)||0)+1;C.set(x,_),y.set(x,R),m.push(x),_===1&&M&&ac.add(x),R===1&&x.setAttribute(a,""),!M&&u&&x.setAttribute(u,u==="inert"?"":"true")}})}return lp++,()=>{m.forEach(S=>{const x=lw(u),M=(x.get(S)||0)-1,C=(y.get(S)||0)-1;x.set(S,M),y.set(S,C),M||(!ac.has(S)&&u&&S.removeAttribute(u),ac.delete(S)),C||S.removeAttribute(a)}),lp--,lp||(ko.inert=new WeakMap,ko["aria-hidden"]=new WeakMap,ko.none=new WeakMap,ac=new WeakSet,lc={})}}function uw(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=x2(t[0]).body;return E2(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const Sy={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},cw=$.forwardRef(function(e,n){const[r,a]=$.useState();Pi(()=>{bD()&&a("button")},[]);const u={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Hc("focus-guard")]:"",style:Sy};return F.jsx("span",{...e,...u})}),O2=$.createContext(null),_2=()=>$.useContext(O2);function fw(t){return $.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const R2=20;let Dr=[];function wy(){Dr=Dr.filter(t=>t.isConnected)}function C2(t){wy(),t&&Pr(t)!=="body"&&(Dr.push(t),Dr.length>R2&&(Dr=Dr.slice(-20)))}function dw(){return wy(),Dr[Dr.length-1]}function k2(t){const e=vf();return MT(t,e)?t:gy(t,e)[0]||t}function hw(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=vf(),u=gD(t,r).filter(f=>{const h=f.getAttribute("data-tabindex")||"";return MT(f,r)||f.hasAttribute("data-tabindex")&&!h.startsWith("-")}),c=t.getAttribute("tabindex");e.current.includes("floating")||u.length===0?c!=="0"&&t.setAttribute("tabindex","0"):(c!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const M2=$.forwardRef(function(e,n){return F.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:Sy})});function D2(t){const{context:e,children:n,disabled:r=!1,order:a=["content"],guards:u=!0,initialFocus:c=0,returnFocus:f=!0,restoreFocus:h=!1,modal:m=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:b=!1,getInsideElements:S=()=>[]}=t,{open:x,onOpenChange:T,events:M,dataRef:C,elements:{domReference:_,floating:R}}=e,G=fi(()=>{var xe;return(xe=C.current.floatingContext)==null?void 0:xe.nodeId}),P=fi(S),ee=typeof c=="number"&&c<0,J=YS(_)&&ee,X=T2(),he=X?u:!0,pe=!he||X&&b,we=sp(a),je=sp(c),be=sp(f),Z=by(),ne=_2(),j=$.useRef(null),U=$.useRef(null),L=$.useRef(!1),te=$.useRef(!1),oe=$.useRef(-1),E=$.useRef(-1),q=ne!=null,H=em(R),Q=fi(function(xe){return xe===void 0&&(xe=H),xe?gy(xe,vf()):[]}),re=fi(xe=>{const Me=Q(xe);return we.current.map(ge=>_&&ge==="reference"?_:H&&ge==="floating"?H:Me).filter(Boolean).flat()});$.useEffect(()=>{if(r||!m)return;function xe(ge){if(ge.key==="Tab"){wn(H,So(ei(H)))&&Q().length===0&&!J&&rp(ge);const Xe=re(),ht=Cr(ge);we.current[0]==="reference"&&ht===_&&(rp(ge),ge.shiftKey?yo(Xe[Xe.length-1]):yo(Xe[1])),we.current[1]==="floating"&&ht===H&&ge.shiftKey&&(rp(ge),yo(Xe[0]))}}const Me=ei(H);return Me.addEventListener("keydown",xe),()=>{Me.removeEventListener("keydown",xe)}},[r,_,H,m,we,J,Q,re]),$.useEffect(()=>{if(r||!R)return;function xe(Me){const ge=Cr(Me),ht=Q().indexOf(ge);ht!==-1&&(oe.current=ht)}return R.addEventListener("focusin",xe),()=>{R.removeEventListener("focusin",xe)}},[r,R,Q]),$.useEffect(()=>{if(r||!g)return;function xe(){te.current=!0,setTimeout(()=>{te.current=!1})}function Me(ht){const Le=ht.relatedTarget,En=ht.currentTarget,Gt=Cr(ht);queueMicrotask(()=>{const Vt=G(),Hn=!(wn(_,Le)||wn(R,Le)||wn(Le,R)||wn(ne?.portalNode,Le)||Le!=null&&Le.hasAttribute(Hc("focus-guard"))||Z&&(Ro(Z.nodesRef.current,Vt).find(ri=>{var Fn,st;return wn((Fn=ri.context)==null?void 0:Fn.elements.floating,Le)||wn((st=ri.context)==null?void 0:st.elements.domReference,Le)})||JS(Z.nodesRef.current,Vt).find(ri=>{var Fn,st,Kl;return[(Fn=ri.context)==null?void 0:Fn.elements.floating,em((st=ri.context)==null?void 0:st.elements.floating)].includes(Le)||((Kl=ri.context)==null?void 0:Kl.elements.domReference)===Le})));if(En===_&&H&&hw(H,we),h&&En!==_&&!(Gt!=null&&Gt.isConnected)&&So(ei(H))===ei(H).body){Dt(H)&&H.focus();const ri=oe.current,Fn=Q(),st=Fn[ri]||Fn[Fn.length-1]||H;Dt(st)&&st.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(J||!m)&&Le&&Hn&&!te.current&&Le!==dw()&&(L.current=!0,T(!1,ht,"focus-out"))})}const ge=!!(!Z&&ne);function Xe(){w2(E),C.current.insideReactTree=!0,E.current=window.setTimeout(()=>{C.current.insideReactTree=!1})}if(R&&Dt(_))return _.addEventListener("focusout",Me),_.addEventListener("pointerdown",xe),R.addEventListener("focusout",Me),ge&&R.addEventListener("focusout",Xe,!0),()=>{_.removeEventListener("focusout",Me),_.removeEventListener("pointerdown",xe),R.removeEventListener("focusout",Me),ge&&R.removeEventListener("focusout",Xe,!0)}},[r,_,R,H,m,Z,ne,T,g,h,Q,J,G,we,C]);const ce=$.useRef(null),Te=$.useRef(null),Ct=fw([ce,ne?.beforeInsideRef]),Je=fw([Te,ne?.afterInsideRef]);$.useEffect(()=>{var xe,Me;if(r||!R)return;const ge=Array.from((ne==null||(xe=ne.portalNode)==null?void 0:xe.querySelectorAll("["+Hc("portal")+"]"))||[]),ht=(Me=(Z?JS(Z.nodesRef.current,G()):[]).find(Gt=>{var Vt;return YS(((Vt=Gt.context)==null?void 0:Vt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,Le=[R,ht,...ge,...P(),j.current,U.current,ce.current,Te.current,ne?.beforeOutsideRef.current,ne?.afterOutsideRef.current,we.current.includes("reference")||J?_:null].filter(Gt=>Gt!=null),En=m||J?uw(Le,!pe,pe):uw(Le);return()=>{En()}},[r,_,R,m,we,ne,J,he,pe,Z,G,P]),Pi(()=>{if(r||!Dt(H))return;const xe=ei(H),Me=So(xe);queueMicrotask(()=>{const ge=re(H),Xe=je.current,ht=(typeof Xe=="number"?ge[Xe]:Xe.current)||H,Le=wn(H,Me);!ee&&!Le&&x&&yo(ht,{preventScroll:ht===H})})},[r,x,H,ee,re,je]),Pi(()=>{if(r||!H)return;const xe=ei(H),Me=So(xe);C2(Me);function ge(Le){let{reason:En,event:Gt,nested:Vt}=Le;if(["hover","safe-polygon"].includes(En)&&Gt.type==="mouseleave"&&(L.current=!0),En==="outside-press")if(Vt)L.current=!1;else if(AD(Gt)||ED(Gt))L.current=!1;else{let Hn=!1;document.createElement("div").focus({get preventScroll(){return Hn=!0,!1}}),Hn?L.current=!1:L.current=!0}}M.on("openchange",ge);const Xe=xe.createElement("span");Xe.setAttribute("tabindex","-1"),Xe.setAttribute("aria-hidden","true"),Object.assign(Xe.style,Sy),q&&_&&_.insertAdjacentElement("afterend",Xe);function ht(){if(typeof be.current=="boolean"){const Le=_||dw();return Le&&Le.isConnected?Le:Xe}return be.current.current||Xe}return()=>{M.off("openchange",ge);const Le=So(xe),En=wn(R,Le)||Z&&Ro(Z.nodesRef.current,G(),!1).some(Vt=>{var Hn;return wn((Hn=Vt.context)==null?void 0:Hn.elements.floating,Le)}),Gt=ht();queueMicrotask(()=>{const Vt=k2(Gt);be.current&&!L.current&&Dt(Vt)&&(!(Vt!==Le&&Le!==xe.body)||En)&&Vt.focus({preventScroll:!0}),Xe.remove()})}},[r,R,H,be,C,M,Z,q,_,G]),$.useEffect(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(wy)}),[r]),Pi(()=>{if(!r&&ne)return ne.setFocusManagerState({modal:m,closeOnFocusOut:g,open:x,onOpenChange:T,domReference:_}),()=>{ne.setFocusManagerState(null)}},[r,ne,m,x,T,g,_]),Pi(()=>{r||H&&hw(H,we)},[r,H,we]);function ii(xe){return r||!y||!m?null:F.jsx(M2,{ref:xe==="start"?j:U,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const Ti=!r&&he&&(m?!J:!0)&&(q||m);return F.jsxs(F.Fragment,{children:[Ti&&F.jsx(cw,{"data-type":"inside",ref:Ct,onFocus:xe=>{if(m){const ge=re();yo(a[0]==="reference"?ge[0]:ge[ge.length-1])}else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(L.current=!1,ZS(xe,ne.portalNode)){const ge=MD(_);ge?.focus()}else{var Me;(Me=ne.beforeOutsideRef.current)==null||Me.focus()}}}),!J&&ii("start"),n,ii("end"),Ti&&F.jsx(cw,{"data-type":"inside",ref:Je,onFocus:xe=>{if(m)yo(re()[0]);else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(g&&(L.current=!0),ZS(xe,ne.portalNode)){const ge=DD(_);ge?.focus()}else{var Me;(Me=ne.afterOutsideRef.current)==null||Me.focus()}}})]})}function pw(t){return Dt(t.target)&&t.target.tagName==="BUTTON"}function N2(t){return Dt(t.target)&&t.target.tagName==="A"}function mw(t){return NT(t)}function $2(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:a,elements:{domReference:u}}=t,{enabled:c=!0,event:f="click",toggle:h=!0,ignoreMouse:m=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,b=$.useRef(),S=$.useRef(!1),x=$.useMemo(()=>({onPointerDown(T){b.current=T.pointerType},onMouseDown(T){const M=b.current;T.button===0&&f!=="click"&&(XS(M)&&m||(n&&h&&(!(a.current.openEvent&&g)||a.current.openEvent.type==="mousedown")?r(!1,T.nativeEvent,"click"):(T.preventDefault(),r(!0,T.nativeEvent,"click"))))},onClick(T){const M=b.current;if(f==="mousedown"&&b.current){b.current=void 0;return}XS(M)&&m||(n&&h&&(!(a.current.openEvent&&g)||a.current.openEvent.type==="click")?r(!1,T.nativeEvent,"click"):r(!0,T.nativeEvent,"click"))},onKeyDown(T){b.current=void 0,!(T.defaultPrevented||!y||pw(T))&&(T.key===" "&&!mw(u)&&(T.preventDefault(),S.current=!0),!N2(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||pw(T)||mw(u)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[a,u,f,m,y,r,n,g,h]);return $.useMemo(()=>c?{reference:x}:{},[c,x])}const j2={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},B2={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},yw=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function z2(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:a,dataRef:u}=t,{enabled:c=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:m="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:b=!1,bubbles:S,capture:x}=e,T=by(),M=fi(typeof h=="function"?h:()=>!1),C=typeof h=="function"?M:h,_=$.useRef(!1),{escapeKey:R,outsidePress:G}=yw(S),{escapeKey:P,outsidePress:ee}=yw(x),J=$.useRef(!1),X=fi(Z=>{var ne;if(!n||!c||!f||Z.key!=="Escape"||J.current)return;const j=(ne=u.current.floatingContext)==null?void 0:ne.nodeId,U=T?Ro(T.nodesRef.current,j):[];if(!R&&(Z.stopPropagation(),U.length>0)){let L=!0;if(U.forEach(te=>{var oe;if((oe=te.context)!=null&&oe.open&&!te.context.dataRef.current.__escapeKeyBubbles){L=!1;return}}),!L)return}r(!1,TD(Z)?Z.nativeEvent:Z,"escape-key")}),he=fi(Z=>{var ne;const j=()=>{var U;X(Z),(U=Cr(Z))==null||U.removeEventListener("keydown",j)};(ne=Cr(Z))==null||ne.addEventListener("keydown",j)}),pe=fi(Z=>{var ne;const j=u.current.insideReactTree;u.current.insideReactTree=!1;const U=_.current;if(_.current=!1,m==="click"&&U||j||typeof C=="function"&&!C(Z))return;const L=Cr(Z),te="["+Hc("inert")+"]",oe=ei(a.floating).querySelectorAll(te);let E=gt(L)?L:null;for(;E&&!Hi(E);){const re=Gi(E);if(Hi(re)||!gt(re))break;E=re}if(oe.length&>(L)&&!xD(L)&&!wn(L,a.floating)&&Array.from(oe).every(re=>!wn(E,re)))return;if(Dt(L)&&be){const re=Hi(L),ce=Pn(L),Te=/auto|scroll/,Ct=re||Te.test(ce.overflowX),Je=re||Te.test(ce.overflowY),ii=Ct&&L.clientWidth>0&&L.scrollWidth>L.clientWidth,Ti=Je&&L.clientHeight>0&&L.scrollHeight>L.clientHeight,xe=ce.direction==="rtl",Me=Ti&&(xe?Z.offsetX<=L.offsetWidth-L.clientWidth:Z.offsetX>L.clientWidth),ge=ii&&Z.offsetY>L.clientHeight;if(Me||ge)return}const q=(ne=u.current.floatingContext)==null?void 0:ne.nodeId,H=T&&Ro(T.nodesRef.current,q).some(re=>{var ce;return ip(Z,(ce=re.context)==null?void 0:ce.elements.floating)});if(ip(Z,a.floating)||ip(Z,a.domReference)||H)return;const Q=T?Ro(T.nodesRef.current,q):[];if(Q.length>0){let re=!0;if(Q.forEach(ce=>{var Te;if((Te=ce.context)!=null&&Te.open&&!ce.context.dataRef.current.__outsidePressBubbles){re=!1;return}}),!re)return}r(!1,Z,"outside-press")}),we=fi(Z=>{var ne;const j=()=>{var U;pe(Z),(U=Cr(Z))==null||U.removeEventListener(m,j)};(ne=Cr(Z))==null||ne.addEventListener(m,j)});$.useEffect(()=>{if(!n||!c)return;u.current.__escapeKeyBubbles=R,u.current.__outsidePressBubbles=G;let Z=-1;function ne(oe){r(!1,oe,"ancestor-scroll")}function j(){window.clearTimeout(Z),J.current=!0}function U(){Z=window.setTimeout(()=>{J.current=!1},pf()?5:0)}const L=ei(a.floating);f&&(L.addEventListener("keydown",P?he:X,P),L.addEventListener("compositionstart",j),L.addEventListener("compositionend",U)),C&&L.addEventListener(m,ee?we:pe,ee);let te=[];return b&&(gt(a.domReference)&&(te=$r(a.domReference)),gt(a.floating)&&(te=te.concat($r(a.floating))),!gt(a.reference)&&a.reference&&a.reference.contextElement&&(te=te.concat($r(a.reference.contextElement)))),te=te.filter(oe=>{var E;return oe!==((E=L.defaultView)==null?void 0:E.visualViewport)}),te.forEach(oe=>{oe.addEventListener("scroll",ne,{passive:!0})}),()=>{f&&(L.removeEventListener("keydown",P?he:X,P),L.removeEventListener("compositionstart",j),L.removeEventListener("compositionend",U)),C&&L.removeEventListener(m,ee?we:pe,ee),te.forEach(oe=>{oe.removeEventListener("scroll",ne)}),window.clearTimeout(Z)}},[u,a,f,C,m,n,r,b,c,R,G,X,P,he,pe,ee,we]),$.useEffect(()=>{u.current.insideReactTree=!1},[u,C,m]);const je=$.useMemo(()=>({onKeyDown:X,...y&&{[j2[g]]:Z=>{r(!1,Z.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Z){r(!1,Z.nativeEvent,"reference-press")}}}}),[X,r,y,g]),be=$.useMemo(()=>({onKeyDown:X,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[B2[m]]:()=>{u.current.insideReactTree=!0}}),[X,m,u]);return $.useMemo(()=>c?{reference:je,floating:be}:{},[c,je,be])}function L2(t){const{open:e=!1,onOpenChange:n,elements:r}=t,a=IT(),u=$.useRef({}),[c]=$.useState(()=>v2()),f=PT()!=null,[h,m]=$.useState(r.reference),y=fi((S,x,T)=>{u.current.openEvent=S?x:void 0,c.emit("openchange",{open:S,event:x,reason:T,nested:f}),n?.(S,x,T)}),g=$.useMemo(()=>({setPositionReference:m}),[]),b=$.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return $.useMemo(()=>({dataRef:u,open:e,onOpenChange:y,elements:b,events:c,floatingId:a,refs:g}),[e,y,b,c,a,g])}function V2(t){t===void 0&&(t={});const{nodeId:e}=t,n=L2({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,a=r.elements,[u,c]=$.useState(null),[f,h]=$.useState(null),y=a?.domReference||u,g=$.useRef(null),b=by();Pi(()=>{y&&(g.current=y)},[y]);const S=u2({...t,elements:{...a,...f&&{reference:f}}}),x=$.useCallback(R=>{const G=gt(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;h(G),S.refs.setReference(G)},[S.refs]),T=$.useCallback(R=>{(gt(R)||R===null)&&(g.current=R,c(R)),(gt(S.refs.reference.current)||S.refs.reference.current===null||R!==null&&!gt(R))&&S.refs.setReference(R)},[S.refs]),M=$.useMemo(()=>({...S.refs,setReference:T,setPositionReference:x,domReference:g}),[S.refs,T,x]),C=$.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),_=$.useMemo(()=>({...S,...r,refs:M,elements:C,nodeId:e}),[S,M,C,e,r]);return Pi(()=>{r.dataRef.current.floatingContext=_;const R=b?.nodesRef.current.find(G=>G.id===e);R&&(R.context=_)}),$.useMemo(()=>({...S,context:_,refs:M,elements:C}),[S,M,C,_])}function up(t,e,n){const r=new Map,a=n==="item";let u=t;if(a&&t){const{[iw]:c,[rw]:f,...h}=t;u=h}return{...n==="floating"&&{tabIndex:-1,[h2]:""},...u,...e.map(c=>{const f=c?c[n]:null;return typeof f=="function"?t?f(t):null:f}).concat(t).reduce((c,f)=>(f&&Object.entries(f).forEach(h=>{let[m,y]=h;if(!(a&&[iw,rw].includes(m)))if(m.indexOf("on")===0){if(r.has(m)||r.set(m,[]),typeof y=="function"){var g;(g=r.get(m))==null||g.push(y),c[m]=function(){for(var b,S=arguments.length,x=new Array(S),T=0;T<S;T++)x[T]=arguments[T];return(b=r.get(m))==null?void 0:b.map(M=>M(...x)).find(M=>M!==void 0)}}}else c[m]=y}),c),{})}}function U2(t){t===void 0&&(t=[]);const e=t.map(f=>f?.reference),n=t.map(f=>f?.floating),r=t.map(f=>f?.item),a=$.useCallback(f=>up(f,t,"reference"),e),u=$.useCallback(f=>up(f,t,"floating"),n),c=$.useCallback(f=>up(f,t,"item"),r);return $.useMemo(()=>({getReferenceProps:a,getFloatingProps:u,getItemProps:c}),[a,u,c])}const K2=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function q2(t,e){var n,r;e===void 0&&(e={});const{open:a,elements:u,floatingId:c}=t,{enabled:f=!0,role:h="dialog"}=e,m=IT(),y=((n=u.domReference)==null?void 0:n.id)||m,g=$.useMemo(()=>{var _;return((_=em(u.floating))==null?void 0:_.id)||c},[u.floating,c]),b=(r=K2.get(h))!=null?r:h,x=PT()!=null,T=$.useMemo(()=>b==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:a?g:void 0}:{"aria-expanded":a?"true":"false","aria-haspopup":b==="alertdialog"?"dialog":b,"aria-controls":a?g:void 0,...b==="listbox"&&{role:"combobox"},...b==="menu"&&{id:y},...b==="menu"&&x&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[b,g,x,a,y,h]),M=$.useMemo(()=>{const _={id:g,...b&&{role:b}};return b==="tooltip"||h==="label"?_:{..._,...b==="menu"&&{"aria-labelledby":y}}},[b,g,y,h]),C=$.useCallback(_=>{let{active:R,selected:G}=_;const P={role:"option",...R&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{...P,"aria-selected":G}}return{}},[g,h]);return $.useMemo(()=>f?{reference:T,floating:M,item:C}:{},[f,T,M,C])}const _l=t=>Array.isArray(t)?t:[t],I2=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},FT=Array,Rr=(t,e)=>t.includes(e),P2=(t,e=0)=>[...new Array(t)].map((n,r)=>r+e),Fe=(t,e,n)=>t===void 0?e===void 0?[]:Array.isArray(e)?e:[e]:(Array.isArray(e)?t.push(...e):t.push(e),t),ys=(t,e)=>e==null?t??[]:t==null?_l(e):t.concat(e),H2=(...t)=>t.reduce(ys,[]),Ss=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((a,u)=>a===u);for(const a of _l(e))t.some(u=>r(u,a))||t.push(a);return t},F2=(t,e)=>t.reduce((n,r)=>{const a=r[e];return n[a]=Fe(n[a],r),n},{}),Lo=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,a)=>n.isEqual(r,e[a]):(r,a)=>r===e[a]),Cs=(t,e)=>ti(t)===e,ti=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Yi={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},G2={...Yi,function:"a function"};class Y2 extends Error{}const Rt=t=>Vo(t,Y2),Vo=(t,e=Error)=>{throw new e(t)};class J2 extends Error{name="ParseError"}const Y=t=>Vo(t,J2),GT=t=>` ${t}`,X2="",Ge=(t,e)=>{const n={},r=Array.isArray(t);let a=!1;for(const[u,c]of Object.entries(t).entries()){const f=r?e(u,c[1]):e(...c,u);a||=typeof f[0]=="number";const h=Array.isArray(f[0])||f.length===0?f:[f];for(const[m,y]of h)typeof m=="object"?n[m.group]=Fe(n[m.group],y):n[m]=y}return a?Object.values(n):n},YT=Object.entries,Si=(t,e)=>t in e,xy=(t,e)=>e in t;class Z2{constructor(e){Object.assign(this,e)}}const Q2=class{};class JT extends Q2{}const W2=(t,e)=>{const n={},r={};let a;for(a in t)a in e?n[a]=t[a]:r[a]=t[a];return[n,r]},XT=(t,e)=>W2(t,e)[1],Rl=t=>Object.keys(t).length===0,Fc=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],eN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),tN=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},ci=GT(`unset${X2}`),nN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),ZT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},QT=globalThis.File??Blob,WT={ArrayBuffer,Blob,File:QT,FormData,Headers,Request,Response,URL},iN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Uo={...ZT,...WT,...iN,String,Number,Boolean},Ty=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!Si(e.constructor.name,Uo)||!(t instanceof Uo[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},tm=t=>typeof t=="object"&&t!==null?Ty(t)??"object":ti(t),Xt=Array.isArray,rN={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},sN={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},oN={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},aN={...rN,...sN,...oN},Ay=t=>{const e=Object(t).name??null;return e&&Si(e,Uo)&&Uo[e]===t?e:null},gw=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},lN=t=>eA(t,new Map),eA=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=Ay(t.constructor);if(n==="Date")return new Date(t.getTime());if(n&&n!=="Array")return t;const r=Array.isArray(t)?t.slice():Object.create(Object.getPrototypeOf(t)),a=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,r);for(const u in a){const c=a[u];"get"in c||"set"in c||(c.value=eA(c.value,e))}}return Object.defineProperties(r,a),r},uN=t=>{let e=ci;return()=>e===ci?e=t():e},Sf=t=>typeof t=="function"&&t.length===0,cN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(r){return Rt(`Encountered an unexpected error while compiling your definition:
|
|
22
|
+
Message: ${r}
|
|
23
|
+
Source: (${t.slice(0,-1)}) => {
|
|
24
|
+
${t.at(-1)}
|
|
25
|
+
}`)}}};class Hr{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const fN=uN(()=>{try{return new Function("return false")()}catch{return!0}});class wi{constructor(){}}var dN={};const hN=()=>{try{return((new Error().stack?.split(`
|
|
26
|
+
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},pN=dN??{},mN={fileName:hN,env:pN},yN=t=>t[0].toUpperCase()+t.slice(1),tA=t=>new RegExp(gN(t),typeof t=="string"?"":t.flags),gN=t=>`^(?:${typeof t=="string"?t:t.source})$`,kr={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},tl="\\",wf={" ":1,"\n":1," ":1},vN=/^-0\.?0*$/.source,nA=/[1-9]\d*/.source,bN=/\.\d+/.source,SN=/\.\d*[1-9]/.source,iA=t=>tA(kr.negativeLookahead(vN)+kr.nonCapturingGroup("-?"+kr.nonCapturingGroup(kr.nonCapturingGroup("0|"+nA)+kr.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),vw=iA({decimalPattern:SN,allowDecimalOnly:!1}),wN=vw.test.bind(vw),nm=iA({decimalPattern:bN,allowDecimalOnly:!0});nm.test.bind(nm);const xN=/^-?\d*\.?\d*$/,TN=t=>t.length!==0&&xN.test(t),Gc=tA(kr.negativeLookahead("^-0$")+"-?"+kr.nonCapturingGroup(kr.nonCapturingGroup("0|"+nA))),AN=Gc.test.bind(Gc),im=/^-?\d+$/,EN=im.test.bind(im),rA={number:"a number",bigint:"a bigint",integer:"an integer"},sA=(t,e)=>`'${t}' was parsed as ${rA[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,ON=(t,e)=>e==="number"?wN(t):AN(t),_N=(t,e)=>e==="number"?Number(t):Number.parseInt(t),RN=(t,e)=>e==="number"?TN(t):EN(t),CN=(t,e)=>Ey(t,"number",e),kN=(t,e)=>Ey(t,"number",{...e,strict:!0}),MN=(t,e)=>Ey(t,"integer",e),Ey=(t,e,n)=>{const r=_N(t,e);return!Number.isNaN(r)&&RN(t,e)?n?.strict?ON(t,e)?r:Y(sA(t,e)):r:n?.errorOnFail?Y(n?.errorOnFail===!0?`Failed to parse ${rA[e]} from '${t}'`:n?.errorOnFail):void 0},DN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Gc.test(e))return n;if(im.test(e))return Y(sA(t,"bigint"))},NN="0.53.0",$N={version:NN,filename:mN.fileName(),FileConstructor:QT},Cl=$N,bw=new Map,cp=Object.create(null),rm=t=>{const e=bw.get(t);if(e)return e;let n=jN(t);return cp[n]?n=`${n}${cp[n]++}`:cp[n]=1,Cl[n]=t,bw.set(t,n),n},ml=t=>/^[$A-Z_a-z][\w$]*$/.test(t),jN=t=>{switch(typeof t){case"object":{if(t===null)break;const e=Ty(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return ml(t.name)?t.name:"fn";case"symbol":return t.description&&ml(t.description)?t.description:"symbol"}return Rt(`Unexpected attempt to register serializable value of type ${ti(t)}`)},Oy=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,BN=(t,e={})=>nl(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Pe=(t,e)=>{switch(ti(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?Yc(n,e?.indent??0,""):JSON.stringify(nl(n,Ko,[]),null,e?.indent):Yc(n,e?.indent??0,"");case"symbol":return Ko.onSymbol(t);default:return Oy(t)}},Yc=(t,e,n)=>{if(typeof t=="function")return Ko.onFunction(t);if(typeof t!="object"||t===null)return Oy(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const u=t.map(c=>Yc(c,e,r)).join(`,
|
|
27
|
+
`+r);return e?`[
|
|
28
|
+
${r}${u}
|
|
29
|
+
${n}]`:`[${u}]`}const a=t.constructor.name;if(a==="Object"){const u=Fc(t).map(([c,f])=>{const h=typeof c=="symbol"?Ko.onSymbol(c):ml(c)?c:JSON.stringify(c),m=Yc(f,e,r);return`${r}${h}: ${m}`});return u.length===0?"{}":e?`{
|
|
30
|
+
${u.join(`,
|
|
31
|
+
`)}
|
|
32
|
+
${n}}`:`{${u.join(", ")}}`}return t instanceof Date?kl(t):"expression"in t&&typeof t.expression=="string"?t.expression:a},Ko={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${rm(t)})`,onFunction:t=>`Function(${rm(t)})`},nl=(t,e,n)=>{switch(ti(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return Ko.onFunction(r);if(n.includes(r))return"(cycle)";const a=[...n,r];if(Array.isArray(r))return r.map(c=>nl(c,e,a));if(r instanceof Date)return r.toDateString();const u={};for(const c in r)u[c]=nl(r[c],e,a);for(const c of Object.getOwnPropertySymbols(r))u[e.onSymbol?.(c)??c.toString()]=nl(r[c],e,a);return u}case"symbol":return Ko.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},kl=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),a=t.getHours(),u=t.getMinutes(),c=t.getSeconds(),f=t.getMilliseconds();if(n===0&&r===1&&a===0&&u===0&&c===0&&f===0)return`${e}`;const h=`${zN[n]} ${r}, ${e}`;if(a===0&&u===0&&c===0&&f===0)return h;let m=t.toLocaleTimeString();const y=m.endsWith(" AM")||m.endsWith(" PM")?m.slice(-3):"";return y&&(m=m.slice(0,-y.length)),f?m+=`.${VN(f,3)}`:LN.test(m)&&(m=m.slice(0,-3)),`${m+y}, ${h}`},zN=["January","February","March","April","May","June","July","August","September","October","November","December"],LN=/:\d\d:00$/,VN=(t,e)=>String(t).padStart(e,"0"),oA=(t,e,...[n])=>{const r=n?.stringifySymbol??Pe;let a=t;switch(typeof e){case"string":a=ml(e)?t===""?e:`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;break;case"number":a=`${t}[${e}]`;break;case"symbol":a=`${t}[${r(e)}]`;break;default:n?.stringifyNonKey?a=`${t}[${n.stringifyNonKey(e)}]`:Y(`${Pe(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return a},Ml=(t,...e)=>t.reduce((n,r)=>oA(n,r,...e),"");class aA extends FT{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]=="symbol"?Pe(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Ml(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=oA(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class lA{chars;i;def;constructor(e){this.def=e,this.chars=[...e],this.i=0}shift(){return this.chars[this.i++]??""}get lookahead(){return this.chars[this.i]??""}get nextLookahead(){return this.chars[this.i+1]??""}get length(){return this.chars.length}shiftUntil(e){let n="";for(;this.lookahead&&!e(this,n);)n+=this.shift();return n}shiftUntilEscapable(e){let n="";for(;this.lookahead;)if(this.lookahead===tl)this.shift(),e(this,n)?n+=this.shift():this.lookahead===tl?n+=this.shift():n+=`${tl}${this.shift()}`;else{if(e(this,n))break;n+=this.shift()}return n}shiftUntilLookahead(e){return typeof e=="string"?this.shiftUntil(n=>n.lookahead===e):this.shiftUntil(n=>n.lookahead in e)}shiftUntilNonWhitespace(){return this.shiftUntil(()=>!(this.lookahead in wf))}jumpToIndex(e){this.i=e<0?this.length+e:e}jumpForward(e){this.i+=e}get location(){return this.i}get unscanned(){return this.chars.slice(this.i,this.length).join("")}get scanned(){return this.chars.slice(0,this.i).join("")}sliceChars(e,n){return this.chars.slice(e,n).join("")}lookaheadIs(e){return this.lookahead===e}lookaheadIsIn(e){return this.lookahead in e}}const UN=(t,e)=>`Unmatched ${t}${e===""?"":` before ${e}`}`,uA=t=>`Missing ${t}`;let sm="$ark",KN=2;for(;sm in globalThis;)sm=`$ark${KN++}`;const cA=sm;globalThis[cA]=Cl;const W=Cl,qN=t=>`${cA}.${t}`,en=t=>qN(rm(t));class fA extends JT{argNames;body="";constructor(...e){super(),this.argNames=e;for(const n of e){if(n in this)throw new Error(`Arg name '${n}' would overwrite an existing property on FunctionBody`);this[n]=n}}indentation=0;indent(){return this.indentation+=4,this}dedent(){return this.indentation-=4,this}prop(e,n=!1){return dA(e,n)}index(e,n=!1){return hA(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
|
|
33
|
+
`,this}const(e,n){return this.line(`const ${e} = ${n}`),this}let(e,n){return this.line(`let ${e} = ${n}`)}set(e,n){return this.line(`${e} = ${n}`)}if(e,n){return this.block(`if (${e})`,n)}elseIf(e,n){return this.block(`else if (${e})`,n)}else(e){return this.block("else",e)}for(e,n,r=0){return this.block(`for (let i = ${r}; ${e}; i++)`,n)}forIn(e,n){return this.block(`for (const k in ${e})`,n)}block(e,n,r=""){return this.line(`${e} {`),this.indent(),n(this),this.dedent(),this.line(`}${r}`)}return(e=""){return this.line(`return ${e}`)}write(e="anonymous",n=0){return`${e}(${this.argNames.join(", ")}) { ${n?this.body.split(`
|
|
34
|
+
`).map(r=>" ".repeat(n)+`${r}`).join(`
|
|
35
|
+
`):this.body} }`}compile(){return new cN(...this.argNames,this.body)}}const Fo=t=>Cs(t,"object")||typeof t=="symbol"?en(t):Oy(t),dA=(t,e=!1)=>typeof t=="string"&&ml(t)?`${e?"?":""}.${t}`:hA(IN(t),e),IN=t=>typeof t=="symbol"?en(t):JSON.stringify(t),hA=(t,e=!1)=>`${e?"?.":""}[${t}]`;class fp extends fA{traversalKind;optimistic;constructor(e){super("data","ctx"),this.traversalKind=e.kind,this.optimistic=e.optimistic===!0}invoke(e,n){const r=n?.arg??this.data,a=typeof e=="string"?!0:this.requiresContextFor(e),u=typeof e=="string"?e:e.id;return a?`${this.referenceToId(u,n)}(${r}, ${this.ctx})`:`${this.referenceToId(u,n)}(${r})`}referenceToId(e,n){const r=n?.kind??this.traversalKind,a=`this.${e}${r}`;return n?.bind?`${a}.bind(${n?.bind})`:a}requiresContextFor(e){return this.traversalKind==="Apply"||e.allowsRequiresContext}initializeErrorCount(){return this.const("errorCount","ctx.currentErrorCount")}returnIfFail(){return this.if("ctx.currentErrorCount > errorCount",()=>this.return())}returnIfFailFast(){return this.if("ctx.failFast && ctx.currentErrorCount > errorCount",()=>this.return())}traverseKey(e,n,r){const a=this.requiresContextFor(r);return a&&this.line(`${this.ctx}.path.push(${e})`),this.check(r,{arg:n}),a&&this.line(`${this.ctx}.path.pop()`),this}check(e,n){return this.traversalKind==="Allows"?this.if(`!${this.invoke(e,n)}`,()=>this.return(!1)):this.line(this.invoke(e,n))}}const pA=t=>Ge(t,(e,n)=>[e,Xt(n)?[...n]:n]),Ji=GT("arkKind"),fe=(t,e)=>t?.[Ji]===e,Qt=t=>fe(t,"root")||fe(t,"constraint"),PN=["unit","proto","domain"],xf=["required","optional","index","sequence"],mA=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],yA=[...mA,"structure","predicate"],_y=[...yA,...xf],Tf=["alias","union","morph","unit","intersection","proto","domain"],HN=[...Tf,..._y],gA=Ge(_y,(t,e)=>[e,1]),FN=Ge([...xf,"undeclared"],(t,e)=>[e,1]),vA=Ge(HN,(t,e)=>[e,t]),Tc=t=>typeof t=="string"&&t in vA,Jc=t=>vA[t],Ry=t=>Tf.slice(Jc(t)+1);[...Ry("union")];[...Ry("morph")];const Es=t=>typeof t=="string"||typeof t=="boolean"||t===null?t:typeof t=="number"?Number.isNaN(t)?"NaN":t===Number.POSITIVE_INFINITY?"Infinity":t===Number.NEGATIVE_INFINITY?"-Infinity":t:Fo(t),Af=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${Fo(r)}, `;return e+" }"},dt=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>Pe(n),e.defaults.problem??=n=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,e.defaults.message??=n=>{if(n.path.length===0)return n.problem;const r=`${n.propString} ${n.problem}`;return r[0]==="["?`value at ${r}`:r}),e};class GN extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Pe(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const YN={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>Mt.throw("arrayObject",t),arrayPostfix:t=>Mt.throw("arrayPostfix",t),defaultValue:t=>Mt.throw("defaultValue",t),domain:t=>Mt.throw("domain",t),morph:t=>Mt.throw("morph",t),patternIntersection:t=>Mt.throw("patternIntersection",t),predicate:t=>Mt.throw("predicate",t),proto:t=>Mt.throw("proto",t),symbolKey:t=>Mt.throw("symbolKey",t),unit:t=>Mt.throw("unit",t),date:t=>Mt.throw("date",t)}},Mt={Error:GN,throw:(...t)=>{throw new Mt.Error(...t)},throwInternalOperandError:(t,e)=>Rt(`Unexpected JSON Schema input for ${t}: ${Pe(e)}`),defaultConfig:YN};W.config??={};const om=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const a={...t.keywords};if(r==="keywords"){for(const u in e[r]){const c=e.keywords[u];c!==void 0&&(a[u]=typeof c=="string"?{description:c}:c)}n.keywords=a}else r==="toJsonSchema"?n[r]=bA(t.toJsonSchema,e.toJsonSchema):Tc(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},bA=((t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=JN(t.fallback,e.fallback):n[r]=e[r];return n}),JN=(t,e)=>{t=Sw(t),e=Sw(e);const n={};let r;for(r in Mt.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??Mt.defaultConfig.fallback[r];return n},Sw=t=>typeof t=="function"?{default:t}:t??{};class qo extends JT{[Ji]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},a){super(),this.input=r,this.ctx=a,eN(this,r);const u=a.data;r.code==="union"&&(r.errors=r.errors.flatMap(f=>{const h=f.hasCode("union")?f.errors:[f];return!e&&!n?h:h.map(m=>m.transform(y=>({...y,path:H2(e,y.path,n)})))})),this.nodeConfig=a.config[this.code];const c=[...r.path??a.path];n&&c.push(...n),e&&c.unshift(...e),this.path=new aA(...c),this.data="data"in r?r.data:u}transform(e){return new qo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return Ml(this.path)}get expected(){if(this.input.expected)return this.input.expected;const e=this.meta?.expected??this.nodeConfig.expected;return typeof e=="function"?e(this.input):e}get actual(){if(this.input.actual)return this.input.actual;const e=this.meta?.actual??this.nodeConfig.actual;return typeof e=="function"?e(this.data):e}get problem(){if(this.input.problem)return this.input.problem;const e=this.meta?.problem??this.nodeConfig.problem;return typeof e=="function"?e(this):e}get message(){if(this.input.message)return this.input.message;const e=this.meta?.message??this.nodeConfig.message;return typeof e=="function"?e(this):e}get flat(){return this.hasCode("intersection")?[...this.errors]:[this]}toJSON(){return{data:this.data,path:this.path,...this.input,expected:this.expected,actual:this.actual,problem:this.problem,message:this.message}}toString(){return this.message}throw(){throw this}}class Lr extends FT{[Ji]="errors";ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return Ge(this.byPath,(e,n)=>[e,n.flat])}get flatProblemsByPath(){return Ge(this.byPath,(e,n)=>[e,n.flat.map(r=>r.problem)])}byAncestorPath=Object.create(null);count=0;mutable=this;throw(){throw this.toTraversalError()}toTraversalError(){return new XN(this)}add(e){const n=this.byPath[e.propString];if(n){if(e===n||n.hasCode("union")&&n.errors.length===0)return;const r=e.hasCode("union")&&e.errors.length===0?e:new qo({code:"intersection",errors:n.hasCode("intersection")?[...n.errors,e]:[n,e]},this.ctx),a=this.indexOf(n);this.mutable[a===-1?this.length:a]=r,this.byPath[e.propString]=r,this.addAncestorPaths(e)}else this.byPath[e.propString]=e,this.addAncestorPaths(e),this.mutable.push(e);this.count++}transform(e){const n=new Lr(this.ctx);for(const r of this)n.add(e(r));return n}merge(e){for(const n of e)this.add(new qo({...n,path:[...this.ctx.path,...n.path]},this.ctx))}affectsPath(e){return this.length===0?!1:e.stringifyAncestors().some(n=>n in this.byPath)||e.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(e=>e.toJSON())]}toString(){return this.join(`
|
|
36
|
+
`)}addAncestorPaths(e){for(const n of e.path.stringifyAncestors())this.byAncestorPath[n]=Fe(this.byAncestorPath[n],e)}}class XN extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
|
|
37
|
+
`+e.map(n=>` • ${ZN(n)}`).join(`
|
|
38
|
+
`)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const ZN=t=>t.toString().split(`
|
|
39
|
+
`).join(`
|
|
40
|
+
`);class xo{path=[];errors=new Lr(this);root;config;queuedMorphs=[];branches=[];seen={};constructor(e,n){this.root=e,this.config=n}get data(){let e=this.root;for(const n of this.path)e=e?.[n];return e}get propString(){return Ml(this.path)}reject(e){return this.error(e),!1}mustBe(e){return this.error(e),!1}error(e){const n=typeof e=="object"?e.code?e:{...e,code:"predicate"}:{code:"predicate",expected:e};return this.errorFromContext(n)}hasError(){return this.currentErrorCount!==0}get currentBranch(){return this.branches.at(-1)}queueMorphs(e){const n={path:new aA(...this.path),morphs:e};this.currentBranch?this.currentBranch.queuedMorphs.push(n):this.queuedMorphs.push(n)}finalize(e){return this.queuedMorphs.length&&(typeof this.root=="object"&&this.root!==null&&this.config.clone&&(this.root=this.config.clone(this.root)),this.applyQueuedMorphs()),this.hasError()?e?e(this.errors):this.errors:this.root}get currentErrorCount(){return this.currentBranch?this.currentBranch.error?1:0:this.errors.count}get failFast(){return this.branches.length!==0}pushBranch(){this.branches.push({error:void 0,queuedMorphs:[]})}popBranch(){return this.branches.pop()}get external(){return this}errorFromNodeContext(e){return this.errorFromContext(e)}errorFromContext(e){const n=new qo(e,this);return this.currentBranch?this.currentBranch.error=n:this.errors.add(n),n}applyQueuedMorphs(){for(;this.queuedMorphs.length;){const e=this.queuedMorphs;this.queuedMorphs=[];for(const{path:n,morphs:r}of e)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,r)}}applyMorphsAtPath(e,n){const r=e.at(-1);let a;if(r!==void 0){a=this.root;for(let u=0;u<e.length-1;u++)a=a[e[u]]}for(const u of n){this.path=[...e];const c=Qt(u),f=u(a===void 0?this.root:a[r],this);if(f instanceof qo){this.errors.add(f);break}if(f instanceof Lr){c||this.errors.merge(f),this.queuedMorphs=[];break}a===void 0?this.root=f:a[r]=f,this.applyQueuedMorphs()}}}const Xi=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class SA extends Hr{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((a,u,c=this.onFail)=>u?(this.traverseApply(a,u),u.hasError()?u.errors:u.data):this.rootApply(a,c),{attach:e}),this.attachments=e,this.$=n,this.onFail=this.meta.onFail??this.$.resolvedConfig.onFail,this.includesTransform=this.hasKind("morph")||this.hasKind("structure")&&this.structuralMorph!==void 0||this.hasKind("sequence")&&this.inner.defaultables!==void 0,this.includesContextualPredicate=this.hasKind("predicate")&&this.inner.predicate.length!==1,this.isCyclic=this.kind==="alias",this.referencesById={[this.id]:this},this.shallowReferences=this.hasKind("structure")?[this,...this.children]:this.children.reduce((a,u)=>t$(a,u.shallowReferences),[this]);const r=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let a=0;a<this.children.length;a++){if(this.includesTransform||=this.children[a].includesTransform,this.includesContextualPredicate||=this.children[a].includesContextualPredicate,this.isCyclic||=this.children[a].isCyclic,!r){const u=this.children[a].flatRefs;for(let c=0;c<u.length;c++){const f=u[c];if(!this.flatRefs.some(h=>wA(h,f))){this.flatRefs.push(f);for(const h of f.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:f.path,propString:f.propString,node:h})}}}Object.assign(this.referencesById,this.children[a].referencesById)}this.flatRefs.sort((a,u)=>a.path.length>u.path.length?1:a.path.length<u.path.length?-1:a.propString>u.propString?1:a.propString<u.propString||a.node.expression<u.node.expression?-1:1),this.allowsRequiresContext=this.includesContextualPredicate||this.isCyclic,this.rootApplyStrategy=!this.allowsRequiresContext&&this.flatMorphs.length===0?this.shallowMorphs.length===0?"allows":this.shallowMorphs.every(a=>a.length===1||a.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(a=>a.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?a=>this.traverseAllows(a,new xo(a,this.$.resolvedConfig)):a=>this.traverseAllows(a)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,r)=>{if(this.allows(n))return n;const a=new xo(n,this.$.resolvedConfig);return this.traverseApply(n,a),a.finalize(r)};case"contextual":return(n,r)=>{const a=new xo(n,this.$.resolvedConfig);return this.traverseApply(n,a),a.finalize(r)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const e=this.$.resolvedConfig.clone;return(n,r)=>{if(this.allows(n))return this.contextFreeMorph(e&&(typeof n=="object"&&n!==null||typeof n=="function")?e(n):n);const a=new xo(n,this.$.resolvedConfig);return this.traverseApply(n,a),a.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Rt(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=e$(this.metaJson);cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get description(){return this.cacheGetter("description",this.meta?.description??this.$.resolvedConfig[this.kind].description(this))}get references(){return Object.values(this.referencesById)}precedence=Jc(this.kind);precompilation;assert=(e,n)=>this(e,n,r=>r.throw());traverse(e,n){return this(e,n,null)}get in(){return this.cacheGetter("in",this.rawIn.isRoot()?this.$.finalize(this.rawIn):this.rawIn)}get rawIn(){return this.cacheGetter("rawIn",this.getIo("in"))}get out(){return this.cacheGetter("out",this.rawOut.isRoot()?this.$.finalize(this.rawOut):this.rawOut)}get rawOut(){return this.cacheGetter("rawOut",this.getIo("out"))}getIo(e){if(!this.includesTransform)return this;const n={};for(const[r,a]of this.innerEntries){const u=this.impl.keys[r];if(u.reduceIo)u.reduceIo(e,n,a);else if(u.child){const c=a;n[r]=Xt(c)?c.map(f=>e==="in"?f.rawIn:f.rawOut):e==="in"?c.rawIn:c.rawOut}else n[r]=a}return this.$.node(this.kind,n)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(e){const n=Qt(e)?e:this.$.parseDefinition(e);return this.innerHash===n.innerHash}ifEquals(e){return this.equals(e)?this:void 0}hasKind(e){return this.kind===e}assertHasKind(e){return this.kind!==e&&Vo(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return Rr(e,this.kind)||Vo(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return Rr(PN,this.kind)}isConstraint(){return Rr(_y,this.kind)}isStructural(){return Rr(xf,this.kind)}isRefinement(){return Rr(yA,this.kind)}isRoot(){return Rr(Tf,this.kind)}isUnknown(){return this.hasKind("intersection")&&this.children.length===0}isNever(){return this.hasKind("union")&&this.children.length===0}hasUnit(e){return this.hasKind("unit")&&this.allows(e)}hasOpenIntersection(){return this.impl.intersectionIsOpen}get nestableExpression(){return this.expression}select(e){const n=Za.normalize(e);return this._select(n)}_select(e){let n=Za.applyBoundary[e.boundary??"references"](this);return e.kind&&(n=n.filter(r=>r.kind===e.kind)),e.where&&(n=n.filter(e.where)),Za.applyMethod[e.method??"filter"](n,this,e)}transform(e,n){return this._transform(e,this._createTransformContext(n))}_createTransformContext(e){return{root:this,selected:void 0,seen:{},path:[],parseOptions:{prereduced:e?.prereduced??!1},undeclaredKeyHandling:void 0,...e}}_transform(e,n){const r=n.bindScope??this.$;if(n.seen[this.id])return this.$.lazilyResolve(n.seen[this.id]);if(n.shouldTransform?.(this,n)===!1)return this;let a;n.seen[this.id]=()=>a,this.hasKind("structure")&&this.undeclared!==n.undeclaredKeyHandling&&(n={...n,undeclaredKeyHandling:this.undeclared});const u=Ge(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const b=g;if(!Xt(b)){const x=b._transform(e,n);return x?[y,x]:[]}if(b.length===0)return[y,g];const S=b.flatMap(x=>x._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const c=Object.assign(u,{meta:this.meta}),f=n.selected&&!n.selected.includes(this)?c:e(this.kind,c,n);if(f===null)return null;if(Qt(f))return a=f;const h=Object.keys(f);return(h.length===0||h.length===1&&h[0]==="meta")&&!Rl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in f)?n.undeclaredKeyHandling?{...f,value:W.intrinsic.unknown}:null:(this.kind==="morph"&&(f.in??=W.intrinsic.unknown),a=r.node(this.kind,f,n.parseOptions))}configureReferences(e,n="references"){const r=Za.normalize(n),a=typeof e=="string"?(h,m)=>({...m,meta:{...m.meta,description:e}}):typeof e=="function"?(h,m)=>({...m,meta:e(m.meta)}):(h,m)=>({...m,meta:{...m.meta,...e}});if(r.boundary==="self")return this.$.node(this.kind,a(this.kind,{...this.inner,meta:this.meta}));const u=this._select(r),c=u&&_l(u),f=r.boundary==="child"?(h,m)=>m.root.children.includes(h):r.boundary==="shallow"?h=>h.kind!=="structure":()=>!0;return this.$.finalize(this.transform(a,{shouldTransform:f,selected:c}))}}const Za={applyBoundary:{self:t=>[t],child:t=>[...t.children],shallow:t=>[...t.shallowReferences],references:t=>[...t.references]},applyMethod:{filter:t=>t,assertFilter:(t,e,n)=>(t.length===0&&Vo(ww(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&Vo(ww(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?Si(t,Za.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},ww=(t,e)=>`${t} had no references matching ${Pe(e)}.`,QN=t=>Ml(t,{stringifyNonKey:e=>e.expression}),WN=/"(\$ark\.[^"]+)"/g,e$=t=>JSON.stringify(t).replaceAll(WN,"$1"),Nr=(t,e)=>({path:t,node:e,propString:QN(t)}),wA=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),xw=(t,e)=>Ss(t,e,{isEqual:wA}),t$=(t,e)=>Ss(t,e,{isEqual:(n,r)=>n.equals(r)});class ae extends Array{static init(e,n,r,a){return new ae({kind:e,l:n,r,path:a?.path??[],optional:a?.optional??!1})}add(e,n,r,a){return this.push({kind:e,l:n,r,path:a?.path??[],optional:a?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r}=this[0],a=Ml(e);return xA(`Intersection${a&&` at ${a}`} of ${Tw(n,r)}`)}return`The following intersections result in unsatisfiable types:
|
|
41
|
+
• ${this.map(({path:e,l:n,r})=>`${e}: ${Tw(n,r)}`).join(`
|
|
42
|
+
• `)}`}throw(){return Y(this.describeReasons())}invert(){const e=this.map(n=>({...n,l:n.r,r:n.l}));return e instanceof ae?e:new ae(...e)}withPrefixKey(e,n){return this.map(r=>({...r,path:[e,...r.path],optional:r.optional||n==="optional"}))}toNeverIfDisjoint(){return W.intrinsic.never}}const Tw=(t,e)=>`${am(t)} and ${am(e)}`,am=t=>Qt(t)?t.expression:Xt(t)?t.map(am).join(" | ")||"never":String(t),xA=t=>`${t} results in an unsatisfiable type`,go={},Zi=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),lm=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!0}),Bt=((t,e,n)=>{const r=n.pipe?"|>":"&",a=`${t.hash}${r}${e.hash}`;if(go[a]!==void 0)return go[a];if(!n.pipe){const f=`${e.hash}${r}${t.hash}`;if(go[f]!==void 0){const h=go[f],m=h instanceof ae?h.invert():h;return go[a]=m,m}}const u=!n.pipe||!t.includesTransform&&!e.includesTransform;if(u&&t.equals(e))return t;let c=u?um(t,e,n):t.hasKindIn(...Tf)?n$(t,e,n):um(t,e,n);return Qt(c)&&(t.equals(c)?c=t:e.equals(c)&&(c=e)),go[a]=c,c}),um=(t,e,n)=>{const r=t.precedence<e.precedence?t.kind:e.kind,a=t.impl.intersections[e.kind]??e.impl.intersections[t.kind];if(a===void 0)return null;if(r===t.kind)return a(t,e,n);{let u=a(e,t,{...n,invert:!n.invert});return u instanceof ae&&(u=u.invert()),u}},n$=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?Aw(e,t,n):Aw(t,e,n):um(t,e,n),Aw=(t,e,n)=>t.distribute(r=>i$(r,e,n),r=>{const a=r.filter(Qt);if(a.length===0)return ae.init("union",t.branches,e.branches);if(a.length<t.branches.length||!t.branches.every((c,f)=>c.rawIn.equals(a[f].rawIn)))return n.$.parseSchema(a);if(a.length===1)return a[0];const u={branches:a};return n.$.parseSchema(u)}),i$=(t,e,n)=>{if(t.hasKind("morph")){const a=[...t.morphs];if(t.lastMorphIfNode){const u=Bt(t.lastMorphIfNode,e,n);if(u instanceof ae)return u;a[a.length-1]=u}else a.push(e);return n.$.node("morph",{morphs:a,in:t.inner.in})}if(e.hasKind("morph")){const a=Bt(t,e.rawIn,n);return a instanceof ae?a:n.$.node("morph",{morphs:[e],in:a})}return n.$.node("morph",{morphs:[e],in:t})};class Go extends SA{constructor(e,n){super(e,n),Object.defineProperty(this,Ji,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Zi(this,e,this.$)}}class Ef extends Go{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Af(this.errorContext)}}const un=t=>(e,n)=>{if(Xt(e)){if(e.length===0)return;const a=e.map(u=>n.$.node(t,u));return t==="predicate"?a:a.sort((u,c)=>u.hash<c.hash?-1:1)}const r=n.$.node(t,e);return r.hasOpenIntersection()?[r]:r},Xc=t=>{const e=t.r.shift();if(!e){let r=t.l.length===0&&t.kind==="structure"?W.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,r$(t.l)),{prereduced:!0});for(const a of t.roots){if(r instanceof ae)return r;r=Bt(a,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const a=Bt(t.l[r],e,t.ctx);if(a!==null){if(a instanceof ae)return a;if(a.isRoot())return t.roots.push(a),t.l.splice(r),Xc(t);if(!n)t.l[r]=a,n=!0;else if(!t.l.includes(a))return Rt(`Unexpectedly encountered multiple distinct intersection results for refinement ${e}`)}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const r of e.impliedSiblings)Ss(t.r,r);return Xc(t)},Zc=t=>Object.entries(t).flatMap(([n,r])=>n in gA?r:[]).sort((n,r)=>n.precedence<r.precedence?-1:n.precedence>r.precedence?1:n.kind==="predicate"&&r.kind==="predicate"?0:n.hash<r.hash?-1:1),r$=t=>{const e={};for(const n of t)if(n.hasOpenIntersection())e[n.kind]=Fe(e[n.kind],n);else{if(e[n.kind])return Rt(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},s$=(...t)=>Y(o$(...t)),o$=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${yN(t)} operand must be ${e.description} (was ${r})`},a$=(t,e,n)=>new Qc(t,e,n,n,null);class TA extends Hr{}class Qc extends Hr{[Ji]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,a,u){super((...c)=>{const f=Ge(this.names,(h,m)=>{const y=this.arg$.parse(c[h]);return y.extends(this.constraints[h])||Y(l$(m,this.constraints[h].expression,y.expression)),[m,y]});if(this.defIsLazy()){const h=this.bodyDef(f);return this.$.parse(h)}return this.$.parse(n,{args:f})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=a,this.hkt=u,this.description=u?new u().description??`a generic type for ${u.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof TA}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get json(){return this.cacheGetter("json",{params:this.params.map(e=>e[1].isUnknown()?e[0]:[e[0],e[1].json]),body:BN(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,W.intrinsic.unknown]:[e[0],this.$.parse(e[1])]))}get names(){return this.cacheGetter("names",this.params.map(e=>e[0]))}get constraints(){return this.cacheGetter("constraints",this.params.map(e=>e[1]))}get internal(){return this}get referencesById(){return this.baseInstantiation.internal.referencesById}get references(){return this.baseInstantiation.internal.references}}const l$=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,u$=dt({kind:"predicate",hasAssociatedError:!0,collapsibleKey:"predicate",keys:{predicate:{}},normalize:t=>typeof t=="function"?{predicate:t}:t,defaults:{description:t=>`valid according to ${t.predicate.name||"an anonymous predicate"}`},intersectionIsOpen:!0,intersections:{predicate:()=>null}});class c$ extends Go{serializedPredicate=en(this.predicate);compiledCondition=`${this.serializedPredicate}(data, ctx)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=null;expression=this.serializedPredicate;traverseAllows=this.predicate;errorContext={code:"predicate",description:this.description,meta:this.meta};compiledErrorContext=Af(this.errorContext);traverseApply=(e,n)=>{!this.predicate(e,n.external)&&!n.hasError()&&n.errorFromNodeContext(this.errorContext)};compile(e){if(e.traversalKind==="Allows"){e.return(this.compiledCondition);return}e.if(`${this.compiledNegation} && !ctx.hasError()`,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}reduceJsonSchema(e,n){return n.fallback.predicate({code:"predicate",base:e,predicate:this.predicate})}}const AA={implementation:u$,Node:c$},f$=dt({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Y(h$(t))}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>t.rule===1?"an integer":t.rule===2?"even":`a multiple of ${t.rule}`},intersections:{divisor:(t,e,n)=>n.$.node("divisor",{rule:Math.abs(t.rule*e.rule/p$(t.rule,e.rule))})},obviatesBasisDescription:!0});class d$ extends Ef{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=W.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const EA={implementation:f$,Node:d$},h$=t=>`divisor must be an integer (was ${t})`,p$=(t,e)=>{let n,r=t,a=e;for(;a!==0;)n=a,a=r%a,r=n;return r};class Yo extends Ef{boundOperandKind=v$[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=b$(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${m$[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?S$(this.numericLimit):`${this.numericLimit}`;limitKind=this.comparator[0]==="<"?"upper":"lower";isStricterThan(e){return(this.limitKind==="upper"?this.numericLimit<e.numericLimit:this.numericLimit>e.numericLimit)||this.numericLimit===e.numericLimit&&this.exclusive===!0&&!e.exclusive}overlapsRange(e){return!(this.isStricterThan(e)||this.numericLimit===e.numericLimit&&(this.exclusive||e.exclusive))}overlapIsUnit(e){return this.numericLimit===e.numericLimit&&!this.exclusive&&!e.exclusive}}const m$={"<":">=","<=":">",">":"<=",">=":"<"},y$={min:"max",minLength:"maxLength",after:"before"},OA={parse:t=>t||void 0},_A=t=>e=>{if(typeof e=="number")return{rule:e};const{exclusive:n,...r}=e;return n?{...r,rule:t==="minLength"?r.rule+1:r.rule-1}:r},RA=t=>e=>{if(typeof e=="number"||typeof e=="string"||e instanceof Date)return{rule:e};const{exclusive:n,...r}=e;if(!n)return r;const a=typeof r.rule=="number"?r.rule:typeof r.rule=="string"?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:t==="after"?a+1:a-1}:r},CA=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,g$=(t,e)=>`${t} bound must be a positive integer (was ${e})`,Cy=t=>e=>((!Number.isInteger(e)||e<0)&&Y(g$(t,e)),e),v$={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},b$=(t,e)=>`${Si(t,y$)?">":"<"}${e?"":"="}`,S$=t=>typeof t=="string"?t:new Date(t).toLocaleString(),w$=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,x$=dt({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:CA,serialize:t=>t.toISOString()}},normalize:RA("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:kl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class T$ extends Yo{impliedBasis=W.intrinsic.Date.internal;collapsibleLimitString=kl(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const kA={implementation:x$,Node:T$},A$=dt({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:CA,serialize:t=>t.toISOString()}},normalize:RA("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:kl},intersections:{before:(t,e)=>t.isStricterThan(e)?t:e,after:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:ae.init("range",t,e)}});class E$ extends Yo{collapsibleLimitString=kl(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=W.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const MA={implementation:A$,Node:E$},O$=dt({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:Cy("exactLength")}},normalize:t=>typeof t=="number"?{rule:t}:t,hasAssociatedError:!0,defaults:{description:t=>`exactly length ${t.rule}`,actual:t=>`${t.length}`},intersections:{exactLength:(t,e,n)=>ae.init("unit",n.$.node("unit",{unit:t.rule}),n.$.node("unit",{unit:e.rule}),{path:["length"]}),minLength:(t,e)=>t.rule>=e.rule?t:ae.init("range",t,e),maxLength:(t,e)=>t.rule<=e.rule?t:ae.init("range",t,e)}});class _$ extends Ef{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=W.intrinsic.lengthBoundable.internal;expression=`== ${this.rule}`;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e.maxLength=this.rule,e;case"array":return e.minItems=this.rule,e.maxItems=this.rule,e;default:return Mt.throwInternalOperandError("exactLength",e)}}}const DA={implementation:O$,Node:_$},R$=dt({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:OA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"negative":"non-positive":`${t.exclusive?"less than":"at most"} ${t.rule}`},intersections:{max:(t,e)=>t.isStricterThan(e)?t:e,min:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("unit",{unit:t.rule}):null:ae.init("range",t,e)},obviatesBasisDescription:!0});class C$ extends Yo{impliedBasis=W.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e<this.rule:e=>e<=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMaximum=this.rule:e.maximum=this.rule,e}}const NA={implementation:R$,Node:C$},k$=dt({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Cy("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:_A("maxLength"),defaults:{description:t=>`at most length ${t.rule}`,actual:t=>`${t.length}`},intersections:{maxLength:(t,e)=>t.isStricterThan(e)?t:e,minLength:(t,e,n)=>t.overlapsRange(e)?t.overlapIsUnit(e)?n.$.node("exactLength",{rule:t.rule}):null:ae.init("range",t,e)}});class M$ extends Yo{impliedBasis=W.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length<=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.maxLength=this.rule,e;case"array":return e.maxItems=this.rule,e;default:return Mt.throwInternalOperandError("maxLength",e)}}}const $A={implementation:k$,Node:M$},D$=dt({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:OA},normalize:t=>typeof t=="number"?{rule:t}:t,defaults:{description:t=>t.rule===0?t.exclusive?"positive":"non-negative":`${t.exclusive?"more than":"at least"} ${t.rule}`},intersections:{min:(t,e)=>t.isStricterThan(e)?t:e},obviatesBasisDescription:!0});class N$ extends Yo{impliedBasis=W.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}const jA={implementation:D$,Node:N$},$$=dt({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:Cy("minLength")}},reduce:t=>t.rule===0?W.intrinsic.unknown:void 0,normalize:_A("minLength"),defaults:{description:t=>t.rule===1?"non-empty":`at least length ${t.rule}`,actual:t=>t.length===0?"":`${t.length}`},intersections:{minLength:(t,e)=>t.isStricterThan(e)?t:e}});class j$ extends Yo{impliedBasis=W.intrinsic.lengthBoundable.internal;traverseAllows=e=>e.length>=this.rule;reduceJsonSchema(e){switch(e.type){case"string":return e.minLength=this.rule,e;case"array":return e.minItems=this.rule,e;default:return Mt.throwInternalOperandError("minLength",e)}}}const BA={implementation:$$,Node:j$},B$={min:jA.implementation,max:NA.implementation,minLength:BA.implementation,maxLength:$A.implementation,exactLength:DA.implementation,after:kA.implementation,before:MA.implementation},z$={min:jA.Node,max:NA.Node,minLength:BA.Node,maxLength:$A.Node,exactLength:DA.Node,after:kA.Node,before:MA.Node},L$=dt({kind:"pattern",collapsibleKey:"rule",keys:{rule:{},flags:{}},normalize:t=>typeof t=="string"?{rule:t}:t instanceof RegExp?t.flags?{rule:t.source,flags:t.flags}:{rule:t.source}:t,obviatesBasisDescription:!0,obviatesBasisExpression:!0,hasAssociatedError:!0,intersectionIsOpen:!0,defaults:{description:t=>`matched by ${t.rule}`},intersections:{pattern:()=>null}});class V$ extends Ef{instance=new RegExp(this.rule,this.flags);expression=`${this.instance}`;traverseAllows=this.instance.test.bind(this.instance);compiledCondition=`${this.expression}.test(data)`;compiledNegation=`!${this.compiledCondition}`;impliedBasis=W.intrinsic.string.internal;reduceJsonSchema(e,n){return e.pattern?n.fallback.patternIntersection({code:"patternIntersection",base:e,pattern:this.rule}):(e.pattern=this.rule,e)}}const zA={implementation:L$,Node:V$},Ac=(t,e)=>{const n=U$(t);return e&&!e.includes(n)?Y(`Root of kind ${n} should be one of ${e}`):n},U$=t=>{if(fe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Yi?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Y(Ew(t));if("morphs"in t)return"morph";if("branches"in t||Xt(t))return"union";if("unit"in t)return"unit";if("reference"in t)return"alias";const e=Object.keys(t);return e.length===0||e.some(n=>n in gA)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Y(Ew(t))},Ew=t=>`${Pe(t)} is not a valid type schema`,Ow={},K$=t=>Xt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Vn={};W.nodesByRegisteredId=Vn;const LA=t=>(Ow[t]??=0,`${t}${++Ow[t]}`),VA=t=>{const e=Of[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:a,...u}=n,c=a===void 0?{}:typeof a=="string"?{description:a}:a,f=YT(u).sort(([m],[y])=>Tc(m)?Tc(y)?Jc(m)-Jc(y):1:Tc(y)||m<y?-1:1).filter(([m,y])=>{if(m.startsWith("meta.")){const g=m.slice(5);return c[g]=y,!1}return!0});for(const m of f){const y=m[0],g=e.keys[y];if(!g)return Y(`Key ${y} is not valid on ${t.kind} schema`);const b=g.parse?g.parse(m[1],t):m[1];b!==ci&&(b!==void 0||g.preserveUndefined)&&(r[y]=b)}if(e.reduce&&!t.prereduced){const m=e.reduce(r,t.$);if(m)return m instanceof ae?m.throw():I$(m,c)}return ky({id:t.id,kind:t.kind,inner:r,meta:c,$:t.$})},ky=({id:t,kind:e,inner:n,meta:r,$:a,ignoreCache:u})=>{const c=Of[e],f=YT(n),h=[];let m={};for(const[C,_]of f){const R=c.keys[C],G=R.serialize??(R.child?K$:Es);if(m[C]=G(_),R.child===!0){const P=_;Xt(P)?h.push(...P):h.push(P)}else typeof R.child=="function"&&h.push(...R.child(_))}c.finalizeInnerJson&&(m=c.finalizeInnerJson(m));let y={...m},g={};Rl(r)||(g=Ge(r,(C,_)=>[C,C==="examples"?_:Es(_)]),y.meta=uc(g,"description",!0)),m=uc(m,c.collapsibleKey,!1);const b=JSON.stringify({kind:e,...m});y=uc(y,c.collapsibleKey,!1);const S=uc(y,c.collapsibleKey,!0),x=JSON.stringify({kind:e,...y});if(a.nodesByHash[x]&&!u)return a.nodesByHash[x];const T={id:t,kind:e,impl:c,inner:n,innerEntries:f,innerJson:m,innerHash:b,meta:r,metaJson:g,json:y,hash:x,collapsibleJson:S,children:h};if(e!=="intersection")for(const C in n)C!=="in"&&C!=="out"&&(T[C]=n[C]);const M=new Jj[e](T,a);return a.nodesByHash[x]=M},q$=(t,e)=>t.id===e?t:(Qt(Vn[e])&&Rt(`Unexpected attempt to overwrite node id ${e}`),ky({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),I$=(t,e,n)=>ky({id:LA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),uc=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const a=t[e];if(n||Cs(a,"object")&&(Object.keys(a).length===1||Array.isArray(a)))return a}return t},cm=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let a=Bt(t.value,e.value,n);const u=t.required||e.required?"required":"optional";if(a instanceof ae)if(u==="optional")a=W.intrinsic.never.internal;else return a.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(u==="required")return n.$.node("required",{key:r,value:a});const c=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Y(KA(t.default,e.default)):t.default:e.hasDefault()?e.default:ci;return n.$.node("optional",{key:r,value:a,default:c})};class UA extends Go{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=W.intrinsic.object.internal;serializedKey=Fo(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Fe(this.value.flatRefs.map(e=>Nr([this.key,...e.path],e.node)),Nr([this.key],this.value));_transform(e,n){n.path.push(this.key);const r=super._transform(e,n);return n.path.pop(),r}hasDefault(){return"default"in this.inner}traverseAllows=(e,n)=>this.key in e?Xi(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Xi(this.key,()=>this.value.traverseApply(e[this.key],n),n):this.hasKind("required")&&n.errorFromNodeContext(this.errorContext)};compile(e){e.if(`${this.serializedKey} in data`,()=>e.traverseKey(this.serializedKey,`data${e.prop(this.key)}`,this.value)),this.hasKind("required")&&e.else(()=>e.traversalKind==="Apply"?e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`):e.return(!1)),e.traversalKind==="Allows"&&e.return(!0)}}const KA=(t,e)=>`Invalid intersection of default values ${Pe(t)} & ${Pe(e)}`,P$=dt({kind:"optional",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},default:{preserveUndefined:!0}},normalize:t=>t,reduce:(t,e)=>{if(e.resolvedConfig.exactOptionalPropertyTypes===!1&&!t.value.allows(void 0))return e.node("optional",{...t,value:t.value.or(me.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:cm}});class H$ extends UA{constructor(...e){super(...e),"default"in this.inner&&Dy(this.value,this.inner.default,this.key)}get rawIn(){const e=super.rawIn;return this.hasDefault()?this.$.node("optional",XT(e.inner,{default:!0}),{prereduced:!0}):e}get outProp(){if(!this.hasDefault())return this;const{default:e,...n}=this.inner;return this.cacheGetter("outProp",this.$.node("required",n,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Pe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=G$(this);defaultValueMorphRef=this.defaultValueMorph&&en(this.defaultValueMorph)}const My={implementation:P$,Node:H$},F$={},G$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${Es(t.default)}}`;return F$[e]??=qA(t.key,t.value,t.default)},qA=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(a,u)=>(Xi(t,()=>e(a[t]=n(),u),u),a):a=>(a[t]=n(),a);const r=e.includesTransform?e.assert(n):n;return Cs(r,"object")?(a,u)=>(Xi(t,()=>e(a[t]=n,u),u),a):a=>(a[t]=r,a)},Dy=(t,e,n)=>{const r=Sf(e);Cs(e,"object")&&!r&&Y(Y$(n));const a=t.in(r?e():e);if(a instanceof Lr){n===null&&Y(`Default ${a.summary}`);const u=a.transform(c=>c.transform(f=>({...f,prefixPath:[n]})));Y(`Default for ${u.summary}`)}return e},Y$=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${Fo(t)} `}must be specified as a function like () => ({my: 'object'})`;class Dl extends SA{constructor(e,n){super(e,n),Object.defineProperty(this,Ji,{value:"root",enumerable:!1})}get rawIn(){return super.rawIn}get rawOut(){return super.rawOut}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Lr?n:{value:n}},toJSONSchema:e=>e.target&&e.target!=="draft-2020-12"?Y(`JSONSchema target '${e.target}' is not supported (must be "draft-2020-12")`):e.io==="input"?this.rawIn.toJsonSchema():this.rawOut.toJsonSchema()}}as(){return this}brand(e){return e===""?Y(J$):this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(e,n){const r=this.branches.map(e);return n?.(r)??r}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){const n=bA(this.$.resolvedConfig.toJsonSchema,e);n.useRefs||=this.isCyclic;const r=typeof n.dialect=="string"?{$schema:n.dialect}:{};return Object.assign(r,this.toJsonSchemaRecurse(n)),n.useRefs&&(r.$defs=Ge(this.references,(a,u)=>u.isRoot()&&!u.alwaysExpandJsonSchema?[u.id,u.toResolvedJsonSchema(n)]:[])),r}toJsonSchemaRecurse(e){return e.useRefs&&!this.alwaysExpandJsonSchema?{$ref:`#/$defs/${this.id}`}:this.toResolvedJsonSchema(e)}get alwaysExpandJsonSchema(){return this.isBasis()||this.kind==="alias"||this.hasKind("union")&&this.isBoolean}toResolvedJsonSchema(e){const n=this.innerToJsonSchema(e);return Object.assign(n,this.metaJson)}intersect(e){const n=this.$.parseDefinition(e),r=this.rawIntersect(n);return r instanceof ae?r:this.$.finalize(r)}rawIntersect(e){return Zi(this,e,this.$)}toNeverIfDisjoint(){return this}and(e){const n=this.intersect(e);return n instanceof ae?n.throw():n}rawAnd(e){const n=this.rawIntersect(e);return n instanceof ae?n.throw():n}or(e){const n=this.$.parseDefinition(e);return this.$.finalize(this.rawOr(n))}rawOr(e){const n=[...this.branches,...e.branches];return this.$.node("union",n)}map(e){return this.$.schema(this.applyStructuralOperation("map",[e]))}pick(...e){return this.$.schema(this.applyStructuralOperation("pick",e))}omit(...e){return this.$.schema(this.applyStructuralOperation("omit",e))}required(){return this.$.schema(this.applyStructuralOperation("required",[]))}partial(){return this.$.schema(this.applyStructuralOperation("partial",[]))}_keyof;keyof(){if(this._keyof)return this._keyof;const e=this.applyStructuralOperation("keyof",[]).reduce((n,r)=>n.intersect(r).toNeverIfDisjoint(),W.intrinsic.unknown.internal);return e.branches.length===0&&Y(xA(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Y(X$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[_w(r)??Y(Rw("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(W.intrinsic.object)&&e!=="merge")return r;const a=_w(r);if(a||Y(Rw(e,r.expression)),e==="keyof")return a.keyof();if(e==="get")return a.get(...n);if(e==="props")return a.props;const u=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{domain:"object",structure:a[u](...n)})})}get(...e){return e[0]===void 0?this:this.$.schema(this.applyStructuralOperation("get",e))}extract(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>r.extends(n)))}exclude(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(r=>!r.extends(n)))}array(){return this.$.schema(this.isUnknown()?{proto:Array}:{proto:Array,sequence:this},{prereduced:!0})}overlaps(e){return!(this.intersect(e)instanceof ae)}extends(e){if(this.isNever())return!0;const n=this.intersect(e);return!(n instanceof ae)&&this.equals(n)}ifExtends(e){return this.extends(e)?this:void 0}subsumes(e){return this.$.parseDefinition(e).extends(this)}configure(e,n="shallow"){return this.configureReferences(e,n)}describe(e,n="shallow"){return this.configure({description:e},n)}optional(){return[this,"?"]}default(e){return Dy(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((r,a)=>r.rawPipeOnce(a),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((r,a)=>r.rawPipeOnce(fe(a,"root")?a:((u,c)=>{try{return a(u,c)}catch(f){return c.error({code:"predicate",predicate:a,actual:`aborted due to error:
|
|
43
|
+
${f}
|
|
44
|
+
`})}})),this);return this.$.finalize(n)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){const n=lm(this,e,this.$);return n instanceof ae?n.throw():n}rawPipeOnce(e){return fe(e,"root")?this.toNode(e):this.distribute(n=>n.hasKind("morph")?this.$.node("morph",{in:n.inner.in,morphs:[...n.morphs,e]}):this.$.node("morph",{in:n,morphs:[e]}),this.$.parseSchema)}narrow(e){return this.constrainOut("predicate",e)}constrain(e,n){return this._constrain("root",e,n)}constrainIn(e,n){return this._constrain("in",e,n)}constrainOut(e,n){return this._constrain("out",e,n)}_constrain(e,n,r){const a=this.$.node(n,r);if(a.isRoot())return a.isUnknown()?this:Rt(`Unexpected constraint node ${a}`);const u=e==="root"?this:e==="in"?this.rawIn:this.rawOut;if(u.hasKind("morph")||a.impliedBasis&&!u.extends(a.impliedBasis))return s$(n,a.impliedBasis,this);const c=this.$.node("intersection",{[a.kind]:a}),f=e==="out"?lm(this,c,this.$):Zi(this,c,this.$);return f instanceof ae&&f.throw(),this.$.finalize(f)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((a,u)=>a==="structure"?n==="ignore"?XT(u,{undeclared:1}):{...u,undeclared:n}:u,r?void 0:{shouldTransform:a=>!Rr(xf,a.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!Lo(this.shallowMorphs,e.shallowMorphs)||!Lo(this.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)}))}onDeepUndeclaredKey(e){return this.onUndeclaredKey({rule:e,deep:!0})}filter(e){return this.constrainIn("predicate",e)}divisibleBy(e){return this.constrain("divisor",e)}matching(e){return this.constrain("pattern",e)}atLeast(e){return this.constrain("min",e)}atMost(e){return this.constrain("max",e)}moreThan(e){return this.constrain("min",vo(e))}lessThan(e){return this.constrain("max",vo(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",vo(e))}lessThanLength(e){return this.constrain("maxLength",vo(e))}exactlyLength(e){return this.constrain("exactLength",e)}atOrAfter(e){return this.constrain("after",e)}atOrBefore(e){return this.constrain("before",e)}laterThan(e){return this.constrain("after",vo(e))}earlierThan(e){return this.constrain("before",vo(e))}}const J$="Expected a non-empty brand name after #",vo=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},cc=(t,e)=>fe(e,"root")?fe(t,"root")?t.extends(e):e.allows(t):fe(t,"root")?t.hasUnit(e):e===t,_w=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(W.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(W.intrinsic.emptyStructure):null,X$=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
45
|
+
${t}`,Rw=(t,e)=>`${t} operand must be an object (was ${e})`,Nl=(t,e)=>Ge(Ry(t),(n,r)=>[r,e]),Z$=t=>typeof t=="string"?{reference:t}:t,Cw=t=>t instanceof ae?W.intrinsic.never.internal:t,Q$=dt({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:Z$,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>Cw(Bt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...Nl("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(W.intrinsic.object)?ae.init("assignability",W.intrinsic.object,e):n.$.lazilyResolve(()=>Cw(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class W$ extends Dl{expression=this.reference;structure=void 0;get resolution(){const e=this._resolve();return Vn[this.id]=e}_resolve(){if(this.resolve)return this.resolve();if(this.reference[0]==="$")return this.$.resolveRoot(this.reference.slice(1));const e=this.reference;let n=Vn[e];const r=[];for(;fe(n,"context");){if(r.includes(n.id))return Y(ej(n.id,r));r.push(n.id),n=Vn[n.id]}return fe(n,"root")?n:Rt(`Unexpected resolution for reference ${this.reference}
|
|
46
|
+
Seen: [${r.join("->")}]
|
|
47
|
+
Resolution: ${Pe(n)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const e=this.reference.slice(1),n=this.$.resolutions[e];return typeof n=="string"?n:fe(n,"root")?n.id:Rt(`Unexpected resolution for reference ${this.reference}: ${Pe(n)}`)}get defaultShortDescription(){return Yi.object}innerToJsonSchema(e){return this.resolution.toJsonSchemaRecurse(e)}traverseAllows=(e,n)=>{const r=n.seen[this.reference];return r?.includes(e)?!0:(n.seen[this.reference]=Fe(r,e),this.resolution.traverseAllows(e,n))};traverseApply=(e,n)=>{const r=n.seen[this.reference];r?.includes(e)||(n.seen[this.reference]=Fe(r,e),this.resolution.traverseApply(e,n))};compile(e){const n=this.resolutionId;e.if(`ctx.seen.${n} && ctx.seen.${n}.includes(data)`,()=>e.return(!0)),e.if(`!ctx.seen.${n}`,()=>e.line(`ctx.seen.${n} = []`)),e.line(`ctx.seen.${n}.push(data)`),e.return(e.invoke(n))}}const ej=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,Ny={implementation:Q$,Node:W$};class $y extends Dl{traverseApply=(e,n)=>{this.traverseAllows(e,n)||n.errorFromNodeContext(this.errorContext)};get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return Af(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}}const tj=dt({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:xy(t,"numberAllowsNaN")&&t.domain!=="number"?Y(jy.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Yi[t.domain],actual:t=>Number.isNaN(t)?"NaN":Yi[ti(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:ae.init("domain",t,e)}});class nj extends $y{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>ti(e)===this.domain;compiledCondition=this.domain==="object"?'((typeof data === "object" && data !== null) || typeof data === "function")':`typeof data === "${this.domain}"${this.requiresNaNCheck?" && !Number.isNaN(data)":""}`;compiledNegation=this.domain==="object"?'((typeof data !== "object" || data === null) && typeof data !== "function")':`typeof data !== "${this.domain}"${this.requiresNaNCheck?" || Number.isNaN(data)":""}`;expression=this.numberAllowsNaN?"number | NaN":this.domain;get nestableExpression(){return this.numberAllowsNaN?`(${this.expression})`:this.expression}get defaultShortDescription(){return Yi[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const jy={implementation:tj,Node:nj,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},ij=dt({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Qt(t))return t;const{structure:e,...n}=t,r=!!e,a=e??{},u=Ge(n,(c,f)=>Si(c,FN)?(r&&Y(`Flattened structure key ${c} cannot be specified alongside a root 'structure' key.`),a[c]=f,[]):[c,f]);return(fe(a,"constraint")||!Rl(a))&&(u.structure=a),u},finalizeInnerJson:({structure:t,...e})=>Cs(t,"object")?{...t,...e}:e,keys:{domain:{child:!0,parse:(t,e)=>e.$.node("domain",t)},proto:{child:!0,parse:(t,e)=>e.$.node("proto",t)},structure:{child:!0,parse:(t,e)=>e.$.node("structure",t),serialize:t=>{if(!t.sequence?.minLength)return t.collapsibleJson;const{sequence:e,...n}=t.collapsibleJson,{minVariadicLength:r,...a}=e,u=a.variadic&&Object.keys(a).length===1?a.variadic:a;return{...n,sequence:u}}},divisor:{child:!0,parse:un("divisor")},max:{child:!0,parse:un("max")},min:{child:!0,parse:un("min")},maxLength:{child:!0,parse:un("maxLength")},minLength:{child:!0,parse:un("minLength")},exactLength:{child:!0,parse:un("exactLength")},before:{child:!0,parse:un("before")},after:{child:!0,parse:un("after")},pattern:{child:!0,parse:un("pattern")},predicate:{child:!0,parse:un("predicate")}},reduce:(t,e)=>kw({},t,{$:e,invert:!1,pipe:!1}),defaults:{description:t=>{if(t.children.length===0)return"unknown";if(t.structure)return t.structure.description;const e=[];if(t.basis&&!t.prestructurals.some(n=>n.impl.obviatesBasisDescription)&&e.push(t.basis.description),t.prestructurals.length){const n=t.prestructurals.toSorted((r,a)=>r.kind==="min"&&a.kind==="max"?-1:0).map(r=>r.description);e.push(...n)}return t.inner.predicate&&e.push(...t.inner.predicate.map(n=>n.description)),e.join(" and ")},expected:t=>` ◦ ${t.errors.map(e=>e.expected).join(`
|
|
48
|
+
◦ `)}`,problem:t=>`(${t.actual}) must be...
|
|
49
|
+
${t.expected}`},intersections:{intersection:(t,e,n)=>kw(t.inner,e.inner,n),...Nl("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:a,...u}=t.inner,c=a??r,f=c?Bt(c,e,n):e;return f instanceof ae?f:t?.basis?.equals(f)?t:t.$.node("intersection",{...u,[f.kind]:f},{prereduced:!0})})}});class rj extends Dl{basis=this.inner.domain??this.inner.proto??null;prestructurals=[];refinements=this.children.filter(e=>e.isRefinement()?(Rr(mA,e.kind)&&this.prestructurals.push(e),!0):!1);structure=this.inner.structure;expression=sj(this);get shallowMorphs(){return this.inner.structure?.structuralMorph?[this.inner.structure.structuralMorph]:[]}get defaultShortDescription(){return this.basis?.defaultShortDescription??"present"}innerToJsonSchema(e){return this.children.reduce((n,r)=>r.isBasis()?r.toJsonSchemaRecurse(e):r.reduceJsonSchema(n,e),{})}traverseAllows=(e,n)=>this.children.every(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=n.currentErrorCount;if(!(this.basis&&(this.basis.traverseApply(e,n),n.currentErrorCount>r))){if(this.prestructurals.length){for(let a=0;a<this.prestructurals.length-1;a++)if(this.prestructurals[a].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;if(this.prestructurals.at(-1).traverseApply(e,n),n.currentErrorCount>r)return}if(!(this.structure&&(this.structure.traverseApply(e,n),n.currentErrorCount>r))&&this.inner.predicate){for(let a=0;a<this.inner.predicate.length-1;a++)if(this.inner.predicate[a].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;this.inner.predicate.at(-1).traverseApply(e,n)}}};compile(e){if(e.traversalKind==="Allows"){for(const n of this.children)e.check(n);e.return(!0);return}if(e.initializeErrorCount(),this.basis&&(e.check(this.basis),this.children.length>1&&e.returnIfFail()),this.prestructurals.length){for(let n=0;n<this.prestructurals.length-1;n++)e.check(this.prestructurals[n]),e.returnIfFailFast();e.check(this.prestructurals.at(-1)),(this.structure||this.inner.predicate)&&e.returnIfFail()}if(this.structure&&(e.check(this.structure),this.inner.predicate&&e.returnIfFail()),this.inner.predicate){for(let n=0;n<this.inner.predicate.length-1;n++)e.check(this.inner.predicate[n]),e.returnIfFail();e.check(this.inner.predicate.at(-1))}}}const IA={implementation:ij,Node:rj},sj=t=>{if(t.structure?.expression)return t.structure.expression;const e=t.basis&&!t.prestructurals.some(a=>a.impl.obviatesBasisExpression)?t.basis.nestableExpression:"",n=t.prestructurals.map(a=>a.expression).join(" & "),r=`${e}${e?" ":""}${n}`;return r==="Array == 0"?"[]":r||"unknown"},kw=(t,e,n)=>{const r={},a=t.proto??t.domain,u=e.proto??e.domain,c=a?u?Bt(a,u,n):a:u;return c instanceof ae?c:(c&&(r[c.kind]=c),Xc({kind:"intersection",baseInner:r,l:Zc(t),r:Zc(e),roots:[],ctx:n}))},oj=dt({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:_l,serialize:t=>t.map(e=>fe(e,"root")?e.json:en(e))},declaredIn:{child:!1,serialize:t=>t.json},declaredOut:{child:!1,serialize:t=>t.json}},normalize:t=>t,defaults:{description:t=>`a morph from ${t.rawIn.description} to ${t.rawOut?.description??"unknown"}`},intersections:{morph:(t,e,n)=>{if(!t.hasEqualMorphs(e))return Y(lj(t.expression,e.expression));const r=Bt(t.rawIn,e.rawIn,n);if(r instanceof ae)return r;const a={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const u=Bt(t.rawIn,e.rawIn,n);if(u instanceof ae)return u.throw();a.declaredIn=u}if(t.declaredOut||e.declaredOut){const u=Bt(t.rawOut,e.rawOut,n);if(u instanceof ae)return u.throw();a.declaredOut=u}return r.distribute(u=>n.$.node("morph",{...a,in:u}),n.$.parseSchema)},...Nl("morph",(t,e,n)=>{const r=t.inner.in?Bt(t.inner.in,e,n):e;return r instanceof ae?r:r.equals(t.inner.in)?t:n.$.node("morph",{...t.inner,in:r})})}});class aj extends Dl{serializedMorphs=this.morphs.map(en);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=fe(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.rawOut:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get rawIn(){return this.declaredIn??this.inner.in?.rawIn??W.intrinsic.unknown.internal}get rawOut(){return this.declaredOut??this.introspectableOut??W.intrinsic.unknown.internal}declareIn(e){return this.$.node("morph",{...this.inner,declaredIn:e})}declareOut(e){return this.$.node("morph",{...this.inner,declaredOut:e})}expression=`(In: ${this.rawIn.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.rawOut.expression}>`;get defaultShortDescription(){return this.rawIn.meta.description??this.rawIn.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:"morph",base:this.rawIn.toJsonSchemaRecurse(e),out:this.introspectableOut?.toJsonSchemaRecurse(e)??null})}compile(e){if(e.traversalKind==="Allows"){if(!this.introspectableIn)return;e.return(e.invoke(this.introspectableIn));return}this.introspectableIn&&e.line(e.invoke(this.introspectableIn)),e.line(`ctx.queueMorphs(${this.compiledMorphs})`)}traverseAllows=(e,n)=>!this.introspectableIn||this.introspectableIn.traverseAllows(e,n);traverseApply=(e,n)=>{this.introspectableIn&&this.introspectableIn.traverseApply(e,n),n.queueMorphs(this.morphs)};hasEqualMorphs(e){return Lo(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||fe(n,"root")&&fe(r,"root")&&n.equals(r)})}}const PA={implementation:oj,Node:aj},lj=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
50
|
+
Left: ${t}
|
|
51
|
+
Right: ${e}`,uj=dt({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>Ay(t)??Es(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:Uo[t]}:typeof t=="function"?Qt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:Uo[t.proto]}:t;return typeof e.proto!="function"&&Y(Wc.writeInvalidSchemaMessage(e.proto)),xy(e,"dateAllowsInvalid")&&e.proto!==Date&&Y(Wc.writeBadInvalidDateMessage(e.proto)),e},applyConfig:(t,e)=>t.dateAllowsInvalid===void 0&&t.proto===Date&&e.dateAllowsInvalid?{...t,dateAllowsInvalid:!0}:t,defaults:{description:t=>t.builtinName?aN[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":tm(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:gw(t.proto,e.proto)?t:gw(e.proto,t.proto)?e:ae.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:ae.init("domain",W.intrinsic.object.internal,e)}});class cj extends $y{builtinName=Ay(this.proto);serializedConstructor=this.json.proto;requiresInvalidDateCheck=this.proto===Date&&!this.dateAllowsInvalid;traverseAllows=this.requiresInvalidDateCheck?e=>e instanceof Date&&e.toString()!=="Invalid Date":e=>e instanceof this.proto;compiledCondition=`data instanceof ${this.serializedConstructor}${this.requiresInvalidDateCheck?' && data.toString() !== "Invalid Date"':""}`;compiledNegation=`!(${this.compiledCondition})`;innerToJsonSchema(e){switch(this.builtinName){case"Array":return{type:"array"};case"Date":return e.fallback.date?.({code:"date",base:{}})??e.fallback.proto({code:"proto",base:{},proto:this.proto});default:return e.fallback.proto({code:"proto",base:{},proto:this.proto})}}expression=this.dateAllowsInvalid?"Date | InvalidDate":this.proto.name;get nestableExpression(){return this.dateAllowsInvalid?`(${this.expression})`:this.expression}domain="object";get defaultShortDescription(){return this.description}}const Wc={implementation:uj,Node:cj,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${ti(t)})`},fj=dt({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,e)=>{const n=[];for(const r of t){const a=fe(r,"root")?r.branches:e.$.parseSchema(r).branches;for(const u of a)if(u.hasKind("morph")){const c=n.findIndex(f=>f.hasKind("morph")&&f.hasEqualMorphs(u));if(c===-1)n.push(u);else{const f=n[c];n[c]=e.$.node("morph",{...f.inner,in:f.rawIn.rawOr(u.rawIn)})}}else n.push(u)}return e.def.ordered||n.sort((r,a)=>r.hash<a.hash?-1:1),n}}},normalize:t=>Xt(t)?{branches:t}:t,reduce:(t,e)=>{const n=xj(t);if(n.length===1)return n[0];if(n.length!==t.branches.length)return e.node("union",{...t,branches:n},{prereduced:!0})},defaults:{description:t=>t.distribute(e=>e.description,Mo),expected:t=>{const e=F2(t.errors,"propString"),n=Object.entries(e).map(([r,a])=>{const u=[];for(const h of a)Ss(u,h.expected);const c=Mo(u),f=a.every(h=>h.actual===a[0].actual)?a[0].actual:Pe(a[0].data);return`${r&&`${r} `}must be ${c}${f&&` (was ${f})`}`});return Mo(n)},problem:t=>t.expected,message:t=>t.problem[0]==="["?`value at ${t.problem}`:t.problem},intersections:{union:(t,e,n)=>{if(t.isNever!==e.isNever)return ae.init("presence",t,e);let r;return t.ordered?(e.ordered&&Y(Aj(t.expression,e.expression)),r=dp(e.branches,t.branches,n),r instanceof ae&&r.invert()):r=dp(t.branches,e.branches,n),r instanceof ae?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...Nl("union",(t,e,n)=>{const r=dp(t.branches,[e],n);return r instanceof ae?r:r.length===1?r[0]:n.$.parseSchema(t.ordered?{branches:r,ordered:!0}:{branches:r})})}});class dj extends Dl{isBoolean=this.branches.length===2&&this.branches[0].hasUnit(!1)&&this.branches[1].hasUnit(!0);get branchGroups(){const e=[];let n=-1;for(const r of this.branches){if(r.hasKind("unit")&&r.domain==="boolean"){n===-1?(n=e.length,e.push(r)):e[n]=W.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.rawIn.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?bj(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,wj);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==ci)return r;const a=new xo(e,this.$.resolvedConfig);return this.traverseApply(e,a),a.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>Ss(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,Mo)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(W.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&xy(r,"const"))?{enum:n.map(r=>r.const)}:{anyOf:n}}traverseAllows=(e,n)=>this.branches.some(r=>r.traverseAllows(e,n));traverseApply=(e,n)=>{const r=[];for(let a=0;a<this.branches.length;a++){if(n.pushBranch(),this.branches[a].traverseApply(e,n),!n.hasError())return this.branches[a].includesTransform?n.queuedMorphs.push(...n.popBranch().queuedMorphs):n.popBranch();r.push(n.popBranch().error)}n.errorFromNodeContext({code:"union",errors:r,meta:this.meta})};traverseOptimistic=e=>{for(let n=0;n<this.branches.length;n++){const r=this.branches[n];if(r.traverseAllows(e))return r.contextFreeMorph?r.contextFreeMorph(e):e}return ci};compile(e){if(!this.discriminant||this.unitBranches.length===this.branches.length&&this.branches.length===2)return this.compileIndiscriminable(e);let n=this.discriminant.optionallyChainedPropString;this.discriminant.kind==="domain"&&(n=`typeof ${n} === "object" ? ${n} === null ? "null" : "object" : typeof ${n} === "function" ? "object" : typeof ${n}`);const r=this.discriminant.cases,a=Object.keys(r),{optimistic:u}=e;if(e.optimistic=!1,e.block(`switch(${n})`,()=>{for(const y in r){const g=r[y],b=y==="default"?y:`case ${y}`;let S;g===!0?S=u?"data":"true":u?g.rootApplyStrategy==="branchedOptimistic"?S=e.invoke(g,{kind:"Optimistic"}):g.contextFreeMorph?S=`${e.invoke(g)} ? ${en(g.contextFreeMorph)}(data) : "${ci}"`:S=`${e.invoke(g)} ? data : "${ci}"`:S=e.invoke(g),e.line(`${b}: return ${S}`)}return e}),e.traversalKind==="Allows"){e.return(u?`"${ci}"`:!1);return}const c=Mo(this.discriminant.kind==="domain"?a.map(y=>{const g=y.slice(1,-1);return g==="function"?Yi.object:Yi[g]}):a),f=this.discriminant.path.map(y=>typeof y=="symbol"?en(y):JSON.stringify(y)),h=JSON.stringify(c),m=this.discriminant.kind==="domain"?`${gj}[${n}]`:`${vj}(${n})`;e.line(`ctx.errorFromNodeContext({
|
|
52
|
+
code: "predicate",
|
|
53
|
+
expected: ${h},
|
|
54
|
+
actual: ${m},
|
|
55
|
+
relativePath: [${f}],
|
|
56
|
+
meta: ${this.compiledMeta}
|
|
57
|
+
})`)}compileIndiscriminable(e){if(e.traversalKind==="Apply"){e.const("errors","[]");for(const n of this.branches)e.line("ctx.pushBranch()").line(e.invoke(n)).if("!ctx.hasError()",()=>e.return(n.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:n}=e;e.optimistic=!1;for(const r of this.branches)e.if(`${e.invoke(r)}`,()=>e.return(n?r.contextFreeMorph?`${en(r.contextFreeMorph)}(data)`:"data":!0));e.return(n?`"${ci}"`:!1)}}get nestableExpression(){return this.isBoolean?"boolean":`(${this.expression})`}discriminate(){if(this.branches.length<2||this.isCyclic)return null;if(this.unitBranches.length===this.branches.length){const u=Ge(this.unitBranches,(c,f)=>[`${f.rawIn.serializedValue}`,f.hasKind("morph")?f:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:u}}const e=[];for(let u=0;u<this.branches.length-1;u++){const c=this.branches[u];for(let f=u+1;f<this.branches.length;f++){const h=this.branches[f],m=Zi(c.rawIn,h.rawIn,c.$);if(m instanceof ae)for(const y of m){if(!y.kind||y.optional)continue;let g,b;if(y.kind==="domain"){const x=y.l,T=y.r;g=`"${typeof x=="string"?x:x.domain}"`,b=`"${typeof T=="string"?T:T.domain}"`}else if(y.kind==="unit")g=y.l.serializedValue,b=y.r.serializedValue;else continue;const S=e.find(x=>Lo(x.path,y.path)&&x.kind===y.kind);S?(S.cases[g]?S.cases[g].branchIndices=Ss(S.cases[g].branchIndices,u):S.cases[g]??={branchIndices:[u],condition:y.l},S.cases[b]?S.cases[b].branchIndices=Ss(S.cases[b].branchIndices,f):S.cases[b]??={branchIndices:[f],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[u],condition:y.l},[b]:{branchIndices:[f],condition:y.r}},path:y.path})}}}const n=this.ordered?mj(e,this.branches):e;if(!n.length)return null;const r=hj(n,this),a={};for(const u in r.best.cases){const c=pj(r,u);if(c===null){a[u]=!0;continue}if(c.length===this.branches.length)return null;this.ordered&&c.sort((m,y)=>m.originalIndex-y.originalIndex);const f=c.map(m=>m.branch),h=f.length===1?f[0]:this.$.node("union",this.ordered?{branches:f,ordered:!0}:f);Object.assign(this.referencesById,h.referencesById),a[u]=h}if(r.defaultEntries.length){const u=r.defaultEntries.map(c=>c.branch);a.default=this.$.node("union",this.ordered?{branches:u,ordered:!0}:u,{prereduced:!0}),Object.assign(this.referencesById,a.default.referencesById)}return Object.assign(r.location,{cases:a})}}const hj=(t,e)=>{const r=t.sort((c,f)=>c.path.length===f.path.length?Object.keys(f.cases).length-Object.keys(c.cases).length:c.path.length-f.path.length)[0],a={kind:r.kind,path:r.path,optionallyChainedPropString:HA(r.path)},u=e.branches.map((c,f)=>({originalIndex:f,branch:c}));return{best:r,location:a,defaultEntries:u,node:e}},pj=(t,e)=>{const n=t.best.cases[e],r=yj(n.condition,t.location.path,t.node.$);let a=[];const u=[];for(let c=0;c<t.defaultEntries.length;c++){const f=t.defaultEntries[c];if(n.branchIndices.includes(f.originalIndex)){const h=Mw(t.node.branches[f.originalIndex],t.location);h===null?a=null:a?.push({originalIndex:f.originalIndex,branch:h})}else if(f.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")a?.push(f);else{if(f.branch.rawIn.overlaps(r)){const h=Mw(f.branch,t.location);a?.push({originalIndex:f.originalIndex,branch:h})}u.push(f)}}return t.defaultEntries=u,a},mj=(t,e)=>t.filter(r=>{const a=Object.values(r.cases).map(u=>u.branchIndices);for(let u=0;u<a.length-1;u++){const c=a[u];for(let f=u+1;f<a.length;f++){const h=a[f];for(const m of c)for(const y of h)if(m>y&&e[m].overlaps(e[y]))return!1}}return!0}),yj=(t,e,n)=>{let r=t==="undefined"?n.node("unit",{unit:void 0}):t==="null"?n.node("unit",{unit:null}):t==="boolean"?n.units([!0,!1]):t;for(let a=e.length-1;a>=0;a--){const u=e[a];r=n.node("intersection",typeof u=="number"?{proto:"Array",sequence:[...P2(u).map(c=>({})),r]}:{domain:"object",required:[{key:u,value:r}]})}return r},HA=t=>t.reduce((e,n)=>e+dA(n,!0),"data"),gj=en(G2),vj=en(Pe),FA={implementation:fj,Node:dj},bj=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:Fo(e)),cases:Ge(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),Sj={delimiter:" | ",finalDelimiter:" | "},wj=t=>Mo(t,Sj),Mo=(t,e)=>{const n=e?.delimiter??", ",r=e?.finalDelimiter??" or ";if(t.length===0)return"never";if(t.length===1)return t[0];if(t.length===2&&t[0]==="false"&&t[1]==="true"||t[0]==="true"&&t[1]==="false")return"boolean";const a={},u=t.filter(f=>a[f]?!1:a[f]=!0),c=u.pop();return`${u.join(n)}${u.length?r:""}${c}`},dp=(t,e,n)=>{const r=e.map(()=>[]);for(let u=0;u<t.length;u++){let c={};for(let f=0;f<e.length;f++){if(r[f]===null)continue;if(t[u].equals(e[f])){r[f]=null,c={};break}const h=Bt(t[u],e[f],n);if(!(h instanceof ae)){if(h.equals(t[u])){r[f].push(t[u]),c={};break}h.equals(e[f])?r[f]=null:c[f]=h}}for(const f in c)r[f][u]=c[f]}const a=r.flatMap((u,c)=>u?.flatMap(f=>f.branches)??e[c]);return a.length===0?ae.init("union",t,e):a},xj=({branches:t,ordered:e})=>{if(t.length<2)return t;const n=t.map(()=>!0);for(let r=0;r<t.length;r++)for(let a=r+1;a<t.length&&n[r]&&n[a];a++){if(t[r].equals(t[a])){n[a]=!1;continue}const u=Zi(t[r].rawIn,t[a].rawIn,t[0].$);u instanceof ae||(e||Tj(t[r],t[a]),u.equals(t[r].rawIn)?n[r]=!!e:u.equals(t[a].rawIn)&&(n[a]=!1))}return t.filter((r,a)=>n[a])},Tj=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Lo(t.shallowMorphs,e.shallowMorphs)||Y(Dw(t.expression,e.expression)),Lo(t.flatMorphs,e.flatMorphs,{isEqual:(n,r)=>n.propString===r.propString&&(n.node.hasKind("morph")&&r.node.hasKind("morph")?n.node.hasEqualMorphs(r.node):n.node.hasKind("intersection")&&r.node.hasKind("intersection")?n.node.structure?.structuralMorphRef===r.node.structure?.structuralMorphRef:!1)})||Y(Dw(t.expression,e.expression)))},Mw=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const a=HA(r.path);return e.optionallyChainedPropString.startsWith(a)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||e.kind==="unit")&&a===e.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),Dw=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
58
|
+
Left: ${t}
|
|
59
|
+
Right: ${e}`,Aj=(t,e)=>`The intersection of two ordered unions is indeterminate:
|
|
60
|
+
Left: ${t}
|
|
61
|
+
Right: ${e}`,Ej=dt({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():Es(t)}},normalize:t=>t,defaults:{description:t=>Pe(t.unit),problem:({expected:t,actual:e})=>`${t===e?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${e})`}`},intersections:{unit:(t,e)=>ae.init("unit",t,e),...Nl("unit",(t,e)=>{if(e.allows(t.unit))return t;const n=e.hasKind("intersection")?e.basis:e;if(n){const r=n.hasKind("domain")?n:W.intrinsic.object;if(t.domain!==r.domain){const a=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:W.intrinsic[t.domain];return ae.init("domain",a,r)}}return ae.init("assignability",t,e.hasKind("intersection")?e.children.find(r=>!r.allows(t.unit)):e)})}});class Oj extends $y{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Nw(this.unit,this.serializedValue);compiledNegation=Nw(this.unit,this.serializedValue,"negated");expression=Pe(this.unit);domain=ti(this.unit);get defaultShortDescription(){return this.domain==="object"?Yi.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:W.intrinsic.jsonPrimitive.allows(this.unit)?{const:this.unit}:e.fallback.unit({code:"unit",base:{},unit:this.unit})}traverseAllows=this.unit instanceof Date?e=>e instanceof Date&&e.toISOString()===this.compiledValue:Number.isNaN(this.unit)?e=>Number.isNaN(e):e=>e===this.unit}const GA={implementation:Ej,Node:Oj},Nw=(t,e,n)=>{if(t instanceof Date){const r=`data instanceof Date && data.toISOString() === ${e}`;return n?`!(${r})`:r}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${e}`},_j=dt({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(W.intrinsic.key))return Y(kj(n.expression));const r=n.branches.filter(a=>a.hasKind("unit"));return r.length?Y(Cj(r.map(a=>Pe(a.unit)))):n}},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`[${t.signature.expression}]: ${t.value.description}`},intersections:{index:(t,e,n)=>{if(t.signature.equals(e.signature)){const r=Bt(t.value,e.value,n),a=r instanceof ae?W.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:a})}return t.signature.extends(e.signature)&&t.value.subsumes(e.value)?e:e.signature.extends(t.signature)&&e.value.subsumes(t.value)?t:null}}});class Rj extends Go{impliedBasis=W.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Fe(this.value.flatRefs.map(e=>Nr([this.signature,...e.path],e.node)),Nr([this.signature],this.value));traverseAllows=(e,n)=>Fc(e).every(r=>this.signature.traverseAllows(r[0],n)?Xi(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Fc(e))this.signature.traverseAllows(r[0],n)&&Xi(r[0],()=>this.value.traverseApply(r[1],n),n)};_transform(e,n){n.path.push(this.signature);const r=super._transform(e,n);return n.path.pop(),r}compile(){}}const YA={implementation:_j,Node:Rj},Cj=t=>`Index keys ${t.join(", ")} should be specified as named props.`,kj=t=>`Indexed key definition '${t}' must be a string or symbol`,Mj=dt({kind:"required",hasAssociatedError:!0,intersectionIsOpen:!0,keys:{key:{},value:{child:!0,parse:(t,e)=>e.$.parseSchema(t)}},normalize:t=>t,defaults:{description:t=>`${t.compiledKey}: ${t.value.description}`,expected:t=>t.missingValueDescription,actual:()=>"missing"},intersections:{required:cm,optional:cm}});class Dj extends UA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=Af(this.errorContext)}const JA={implementation:Mj,Node:Dj},Nj=dt({kind:"sequence",hasAssociatedError:!1,collapsibleKey:"variadic",keys:{prefix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},optionals:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}},defaultables:{child:t=>t.map(e=>e[0]),parse:(t,e)=>{if(t.length!==0)return t.map(n=>{const r=e.$.parseSchema(n[0]);return Dy(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,Es(e[1])]),reduceIo:(t,e,n)=>{if(t==="in"){e.optionals=n.map(r=>r[0].rawIn);return}e.prefix=n.map(r=>r[0].rawOut)}},variadic:{child:!0,parse:(t,e)=>e.$.parseSchema(t,e)},minVariadicLength:{parse:t=>t===0?void 0:t},postfix:{child:!0,parse:(t,e)=>{if(t.length!==0)return t.map(n=>e.$.parseSchema(n))}}},normalize:t=>{if(typeof t=="string")return{variadic:t};if("variadic"in t||"prefix"in t||"defaultables"in t||"optionals"in t||"postfix"in t||"minVariadicLength"in t){if(t.postfix?.length){if(!t.variadic)return Y(Lj);if(t.optionals?.length||t.defaultables?.length)return Y(ZA)}return t.minVariadicLength&&!t.variadic?Y("minVariadicLength may not be specified without a variadic element"):t}return{variadic:t}},reduce:(t,e)=>{let n=t.minVariadicLength??0;const r=t.prefix?.slice()??[],a=t.defaultables?.slice()??[],u=t.optionals?.slice()??[],c=t.postfix?.slice()??[];if(t.variadic){for(;u.at(-1)?.equals(t.variadic);)u.pop();if(u.length===0&&a.length===0)for(;r.at(-1)?.equals(t.variadic);)r.pop(),n++;for(;c[0]?.equals(t.variadic);)c.shift(),n++}else u.length===0&&a.length===0&&r.push(...c.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return e.node("sequence",{...t,prefix:r,defaultables:a,optionals:u,postfix:c,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Pe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const r=Qa({l:t.tuple,r:e.tuple,disjoint:new ae,result:[],fixedVariants:[],ctx:n}),a=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return a.length===0?r.disjoint:a.length===1?n.$.node("sequence",$w(a[0].result)):n.$.node("union",a.map(u=>({proto:Array,sequence:$w(u.result)})))}}});class $j extends Go{impliedBasis=W.intrinsic.Array.internal;tuple=zj(this.inner);prefixLength=this.prefix?.length??0;defaultablesLength=this.defaultables?.length??0;optionalsLength=this.optionals?.length??0;postfixLength=this.postfix?.length??0;defaultablesAndOptionals=[];prevariadic=this.tuple.filter(e=>e.kind==="defaultables"||e.kind==="optionals"?(this.defaultablesAndOptionals.push(e.node),!0):e.kind==="prefix");variadicOrPostfix=ys(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return xw(this.flatRefs,this.prevariadic.flatMap((e,n)=>Fe(e.node.flatRefs.map(r=>Nr([`${n}`,...r.path],r.node)),Nr([`${n}`],e.node)))),xw(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Fe(e.flatRefs.map(n=>Nr([W.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),Nr([W.intrinsic.nonNegativeIntegerString.internal],e)))),this.flatRefs}isVariadicOnly=this.prevariadic.length+this.postfixLength===0;minVariadicLength=this.inner.minVariadicLength??0;minLength=this.prefixLength+this.minVariadicLength+this.postfixLength;minLengthNode=this.minLength===0?null:this.$.node("minLength",this.minLength);maxLength=this.variadic?null:this.tuple.length;maxLengthNode=this.maxLength===null?null:this.$.node("maxLength",this.maxLength);impliedSiblings=this.minLengthNode?this.maxLengthNode?[this.minLengthNode,this.maxLengthNode]:[this.minLengthNode]:this.maxLengthNode?[this.maxLengthNode]:[];defaultValueMorphs=Bj(this);defaultValueMorphsReference=this.defaultValueMorphs.length?en(this.defaultValueMorphs):void 0;elementAtIndex(e,n){if(n<this.prevariadic.length)return this.tuple[n];const r=e.length-this.postfixLength;return n>=r?{kind:"postfix",node:this.postfix[n-r]}:{kind:"variadic",node:this.variadic??Rt(`Unexpected attempt to access index ${n} on ${this}`)}}traverseAllows=(e,n)=>{for(let r=0;r<e.length;r++)if(!this.elementAtIndex(e,r).node.traverseAllows(e[r],n))return!1;return!0};traverseApply=(e,n)=>{let r=0;for(;r<e.length;r++)Xi(r,()=>this.elementAtIndex(e,r).node.traverseApply(e[r],n),n)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(e){if(this.prefix)for(const[n,r]of this.prefix.entries())e.traverseKey(`${n}`,`data[${n}]`,r);for(const[n,r]of this.defaultablesAndOptionals.entries()){const a=`${n+this.prefixLength}`;e.if(`${a} >= data.length`,()=>e.traversalKind==="Allows"?e.return(!0):e.return()),e.traverseKey(a,`data[${a}]`,r)}if(this.variadic&&(this.postfix&&e.const("firstPostfixIndex",`data.length${this.postfix?`- ${this.postfix.length}`:""}`),e.for(`i < ${this.postfix?"firstPostfixIndex":"data.length"}`,()=>e.traverseKey("i","data[i]",this.variadic),this.prevariadic.length),this.postfix))for(const[n,r]of this.postfix.entries()){const a=`firstPostfixIndex + ${n}`;e.traverseKey(a,`data[${a}]`,r)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(W.intrinsic.nonNegativeIntegerString.internal);const r=super._transform(e,n);return n.path.pop(),r}expression=this.description;reduceJsonSchema(e,n){if(this.prevariadic.length&&(e.prefixItems=this.prevariadic.map(r=>{const a=r.node.toJsonSchemaRecurse(n);if(r.kind==="defaultables"){const u=typeof r.default=="function"?r.default():r.default;a.default=W.intrinsic.jsonData.allows(u)?u:n.fallback.defaultValue({code:"defaultValue",base:a,value:u})}return a})),this.minLength&&(e.minItems=this.minLength),this.variadic){const r=Object.assign(e,{items:this.variadic.toJsonSchemaRecurse(n)});if(this.maxLength&&(r.maxItems=this.maxLength),this.postfix){const a=this.postfix.map(u=>u.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:r,elements:a})}}else e.items=!1,delete e.maxItems;return e}}const jj={},Bj=t=>{if(!t.defaultables)return[];const e=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let a=t.prefixLength;a<=r;a++){const[u,c]=t.defaultables[a-t.prefixLength];e.push(qA(a,u,c)),n+=`${a}: ${u.id} = ${Es(c)}, `}return n+="]",jj[n]??=e},XA={implementation:Nj,Node:$j},zj=t=>{const e=[];if(t.prefix)for(const n of t.prefix)e.push({kind:"prefix",node:n});if(t.defaultables)for(const[n,r]of t.defaultables)e.push({kind:"defaultables",node:n,default:r});if(t.optionals)for(const n of t.optionals)e.push({kind:"optionals",node:n});if(t.variadic&&e.push({kind:"variadic",node:t.variadic}),t.postfix)for(const n of t.postfix)e.push({kind:"postfix",node:n});return e},$w=t=>t.reduce((e,n)=>(n.kind==="variadic"?e.variadic=n.node:n.kind==="defaultables"?e.defaultables=Fe(e.defaultables,[[n.node,n.default]]):e[n.kind]=Fe(e[n.kind],n.node),e),{}),ZA="A postfix required element cannot follow an optional or defaultable element",Lj="A postfix element requires a variadic element",Qa=t=>{const[e,...n]=t.l,[r,...a]=t.r;if(!e||!r)return t;const u=n.at(-1)?.kind==="postfix",c=a.at(-1)?.kind==="postfix",f=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":u||c?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&c){const g=Qa({...t,fixedVariants:[],r:a.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(r.kind==="prefix"&&e.kind==="variadic"&&u){const g=Qa({...t,fixedVariants:[],l:n.map(b=>({...b,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=Bt(e.node,r.node,t.ctx);if(h instanceof ae)if(f==="prefix"||f==="postfix")t.disjoint.push(...h.withPrefixKey(f==="prefix"?t.result.length:`-${n.length+1}`,jw(e)&&jw(r)?"required":"optional")),t.result=[...t.result,{kind:f,node:W.intrinsic.never.internal}];else return f==="optionals"||f==="defaultables"?t:Qa({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else f==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Y(KA(e.default,r.default)),t.result=[...t.result,{kind:f,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:Rt(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:f,node:h}];const m=t.l.length,y=t.r.length;return(e.kind!=="variadic"||m>=y&&(r.kind==="variadic"||y===1))&&(t.l=n),(r.kind!=="variadic"||y>=m&&(e.kind==="variadic"||m===1))&&(t.r=a),Qa(t)},jw=t=>t.kind==="prefix"||t.kind==="postfix",QA=t=>e=>{if(e.props.length||e.index){const n=e.index?.map(a=>a[t])??[];for(const a of e.props)n.push(a[t]);e.undeclared&&n.push(`+ (undeclared): ${e.undeclared}`);const r=`{ ${n.join(", ")} }`;return e.sequence?`${r} & ${e.sequence.description}`:r}return e.sequence?.description??"{}"},Vj=QA("description"),Uj=QA("expression"),Bw=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const a=Zi(t.value,e.value,n);return a instanceof ae?r==="optional"?n.node("optional",{key:t.key,value:W.intrinsic.never.internal}):a.withPrefixKey(t.key,t.kind):null},Kj=dt({kind:"structure",hasAssociatedError:!1,normalize:t=>t,applyConfig:(t,e)=>!t.undeclared&&e.onUndeclaredKey!=="ignore"?{...t,undeclared:e.onUndeclaredKey}:t,keys:{required:{child:!0,parse:un("required"),reduceIo:(t,e,n)=>{e.required=Fe(e.required,n.map(r=>t==="in"?r.rawIn:r.rawOut))}},optional:{child:!0,parse:un("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(r=>r.rawIn);return}for(const r of n)e[r.outProp.kind]=Fe(e[r.outProp.kind],r.outProp.rawOut)}},index:{child:!0,parse:un("index")},sequence:{child:!0,parse:un("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,e,n)=>{if(n==="reject"){e.undeclared="reject";return}t==="in"?delete e.undeclared:e.undeclared="reject"}}},defaults:{description:Vj},intersections:{structure:(t,e,n)=>{const r={...t.inner},a={...e.inner},u=new ae;if(t.undeclared){const h=t.keyof();for(const m of e.requiredKeys)h.allows(m)||u.add("presence",W.intrinsic.never.internal,e.propsByKey[m].value,{path:[m]});a.optional&&(a.optional=a.optional.filter(m=>h.allows(m.key))),a.index&&(a.index=a.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Zi(h,m.signature,n.$);if(y instanceof ae)return[];const g=fm(y,m.value,n.$);return g.required&&(a.required=ys(a.required,g.required)),g.optional&&(a.optional=ys(a.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const m of t.requiredKeys)h.allows(m)||u.add("presence",t.propsByKey[m].value,W.intrinsic.never.internal,{path:[m]});r.optional&&(r.optional=r.optional.filter(m=>h.allows(m.key))),r.index&&(r.index=r.index.flatMap(m=>{if(m.signature.extends(h))return m;const y=Zi(h,m.signature,n.$);if(y instanceof ae)return[];const g=fm(y,m.value,n.$);return g.required&&(r.required=ys(r.required,g.required)),g.optional&&(r.optional=ys(r.optional,g.optional)),g.index??[]}))}const c={};(t.undeclared||e.undeclared)&&(c.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const f=Xc({kind:"structure",baseInner:c,l:Zc(r),r:Zc(a),roots:[],ctx:n});return f instanceof ae&&u.push(...f),u.length?u:f}},reduce:(t,e)=>{if(!t.required&&!t.optional)return;const n={};let r=!1;const a=t.optional?[...t.optional]:[];if(t.required)for(let u=0;u<t.required.length;u++){const c=t.required[u];if(c.key in n&&Y(Lw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=Bw(c,f,e);if(h instanceof ae)return h}}if(t.optional)for(let u=0;u<t.optional.length;u++){const c=t.optional[u];if(c.key in n&&Y(Lw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=Bw(c,f,e);if(h instanceof ae)return h;h!==null&&(a[u]=h,r=!0)}}if(r)return e.node("structure",{...t,optional:a},{prereduced:!0})}});class qj extends Go{impliedBasis=W.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=ys(this.required,this.optional);propsByKey=Ge(this.props,(e,n)=>[n.key,n]);propsByKeyReference=en(this.propsByKey);expression=Uj(this);requiredKeys=this.required?.map(e=>e.key)??[];optionalKeys=this.optional?.map(e=>e.key)??[];literalKeys=[...this.requiredKeys,...this.optionalKeys];_keyof;keyof(){if(this._keyof)return this._keyof;let e=this.$.units(this.literalKeys).branches;if(this.index)for(const{signature:n}of this.index)e=e.concat(n.branches);return this._keyof=this.$.node("union",e)}map(e){return this.$.node("structure",this.props.flatMap(e).reduce((n,r)=>{const a=this.propsByKey[r.key];if(Qt(r))return r.kind!=="required"&&r.kind!=="optional"?Y(`Map result must have kind "required" or "optional" (was ${r.kind})`):(n[r.kind]=Fe(n[r.kind],r),n);const u=r.kind??a?.kind??"required",c=Ge(r,(f,h)=>f in My.implementation.keys?[f,h]:[]);return n[u]=Fe(n[u],this.$.node(u,c)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!cc(r,this.keyof()));if(n.length)return Y(zw(this.expression,n))}get(e,...n){let r,a=!1;const u=Fj(e);if((typeof u=="string"||typeof u=="symbol")&&this.propsByKey[u]&&(r=this.propsByKey[u].value,a=this.propsByKey[u].required),this.index)for(const f of this.index)cc(u,f.signature)&&(r=r?.and(f.value)??f.value);if(this.sequence&&cc(u,W.intrinsic.nonNegativeIntegerString))if(fe(u,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const f=Number.parseInt(u);if(f<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[f].node;r=r?.and(h)??h,a||=f<this.sequence.prefixLength}else if(this.sequence.variadic){const h=this.$.node("union",this.sequence.variadicOrPostfix);r=r?.and(h)??h}}if(!r)return this.sequence?.variadic&&fe(u,"root")&&u.extends(W.intrinsic.number)?Y(Gj(u.expression,this.sequence.expression)):Y(zw(this.expression,[u]));const c=r.get(...n);return a?c:c.or(W.intrinsic.undefined)}pick(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("pick",e))}omit(...e){return this.assertHasKeys(e),this.$.node("structure",this.filterKeys("omit",e))}optionalize(){const{required:e,...n}=this.inner;return this.$.node("structure",{...n,optional:this.props.map(r=>r.hasKind("required")?this.$.node("optional",r.inner):r)})}require(){const{optional:e,...n}=this.inner;return this.$.node("structure",{...n,required:this.props.map(r=>r.hasKind("optional")?{key:r.key,value:r.value}:r)})}merge(e){const n=this.filterKeys("omit",[e.keyof()]);return e.required&&(n.required=Fe(n.required,e.required)),e.optional&&(n.optional=Fe(n.optional,e.optional)),e.index&&(n.index=Fe(n.index,e.index)),e.sequence&&(n.sequence=e.sequence),e.undeclared?n.undeclared=e.undeclared:delete n.undeclared,this.$.node("structure",n)}filterKeys(e,n){const r=pA(this.inner),a=u=>{const c=n.some(f=>cc(u,f));return e==="pick"?c:!c};return r.required&&(r.required=r.required.filter(u=>a(u.key))),r.optional&&(r.optional=r.optional.filter(u=>a(u.key))),r.index&&(r.index=r.index.filter(u=>a(u.signature))),r}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,r)=>{const a=r?.currentErrorCount??0;for(let u=0;u<this.props.length;u++)if(e==="Allows"){if(!this.props[u].traverseAllows(n,r))return!1}else if(this.props[u].traverseApply(n,r),r.failFast&&r.currentErrorCount>a)return!1;if(this.sequence){if(e==="Allows"){if(!this.sequence.traverseAllows(n,r))return!1}else if(this.sequence.traverseApply(n,r),r.failFast&&r.currentErrorCount>a)return!1}if(this.index||this.undeclared==="reject"){const u=Object.keys(n);u.push(...Object.getOwnPropertySymbols(n));for(let c=0;c<u.length;c++){const f=u[c];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(f,r)){if(e==="Allows"){if(!Xi(f,()=>h.value.traverseAllows(n[f],r),r))return!1}else if(Xi(f,()=>h.value.traverseApply(n[f],r),r),r.failFast&&r.currentErrorCount>a)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(f)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[f],meta:this.meta}),r.failFast)))return!1}}return this.structuralMorph&&r&&!r.hasError()&&r.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(n=>n.signature.allows(e))||this.sequence!==void 0&&W.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){const n=[];if(this.props.length&&n.push(`k in ${this.propsByKeyReference}`),this.index)for(const r of this.index)n.push(e.invoke(r.signature,{kind:"Allows",arg:"k"}));return this.sequence&&n.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),n.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",Pj(this))}structuralMorphRef=this.structuralMorph&&en(this.structuralMorph);compile(e){e.traversalKind==="Apply"&&e.initializeErrorCount();for(const n of this.props)e.check(n),e.traversalKind==="Apply"&&e.returnIfFailFast();if(this.sequence&&(e.check(this.sequence),e.traversalKind==="Apply"&&e.returnIfFailFast()),(this.index||this.undeclared==="reject")&&(e.const("keys","Object.keys(data)"),e.line("keys.push(...Object.getOwnPropertySymbols(data))"),e.for("i < keys.length",()=>this.compileExhaustiveEntry(e))),e.traversalKind==="Allows")return e.return(!0);this.structuralMorphRef&&e.if("ctx && !ctx.hasError()",()=>(e.line("ctx.queueMorphs(["),Hj(e,this),e.line("])")))}compileExhaustiveEntry(e){if(e.const("k","keys[i]"),this.index)for(const n of this.index)e.if(`${e.invoke(n.signature,{arg:"k",kind:"Allows"})}`,()=>e.traverseKey("k","data[k]",n.value));return this.undeclared==="reject"&&e.if(`!(${this._compileDeclaresKey(e)})`,()=>e.traversalKind==="Allows"?e.return(!1):e.line(`ctx.errorFromNodeContext({ code: "predicate", expected: "removed", actual: "", relativePath: [k], meta: ${this.compiledMeta} })`).if("ctx.failFast",()=>e.return())),e}reduceJsonSchema(e,n){switch(e.type){case"object":return this.reduceObjectJsonSchema(e,n);case"array":const r=this.sequence?.reduceJsonSchema(e,n)??e;return this.props.length||this.index?n.fallback.arrayObject({code:"arrayObject",base:r,object:this.reduceObjectJsonSchema({type:"object"},n)}):r;default:return Mt.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const r of this.props){const a=r.value.toJsonSchemaRecurse(n);if(typeof r.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:r.key,value:a,optional:r.optional});continue}if(r.hasDefault()){const u=typeof r.default=="function"?r.default():r.default;a.default=W.intrinsic.jsonData.allows(u)?u:n.fallback.defaultValue({code:"defaultValue",base:a,value:u})}e.properties[r.key]=a}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(r=>typeof r=="string"&&r in e.properties))}if(this.index)for(const r of this.index){const a=r.value.toJsonSchemaRecurse(n);if(r.signature.equals(W.intrinsic.string)){e.additionalProperties=a;continue}for(const u of r.signature.branches){if(!u.extends(W.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:a,optional:!1});continue}let c={type:"string"};if(u.hasKind("morph")&&(c=n.fallback.morph({code:"morph",base:u.rawIn.toJsonSchemaRecurse(n),out:u.rawOut.toJsonSchemaRecurse(n)})),!u.hasKind("intersection"))return Rt(`Unexpected index branch kind ${u.kind}.`);const{pattern:f}=u.inner;if(f){const h=Object.assign(c,{pattern:f[0].rule});for(let m=1;m<f.length;m++)c=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:f[m].rule});e.patternProperties??={},e.patternProperties[h.pattern]=a}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const hp={},Ij=t=>{let e="";for(let n=0;n<t.defaultable.length;n++)e+=t.defaultable[n].defaultValueMorphRef;if(t.sequence?.defaultValueMorphsReference&&(e+=t.sequence?.defaultValueMorphsReference),t.undeclared==="delete"){if(e+="delete !(",t.required)for(const n of t.required)e+=n.compiledKey+" | ";if(t.optional)for(const n of t.optional)e+=n.compiledKey+" | ";if(t.index)for(const n of t.index)e+=n.signature.id+" | ";if(t.sequence)if(t.sequence.maxLength===null)e+=me.nonNegativeIntegerString.id;else for(let n=0;n<t.sequence.tuple.length;n++)e+=n+" | ";e+=")"}return e},Pj=t=>{const e=Ij(t);if(!e)return;if(hp[e])return hp[e];const n=(r,a)=>{for(let u=0;u<t.defaultable.length;u++)t.defaultable[u].key in r||t.defaultable[u].defaultValueMorph(r,a);if(t.sequence?.defaultables)for(let u=r.length-t.sequence.prefixLength;u<t.sequence.defaultables.length;u++)t.sequence.defaultValueMorphs[u](r,a);if(t.undeclared==="delete")for(const u in r)t.declaresKey(u)||delete r[u];return r};return hp[e]=n},Hj=(t,e)=>{const r=`(data${e.defaultable.some(a=>a.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(a=>a.length===2)?", ctx":""})`;return t.block(`${r} => `,a=>{for(let u=0;u<e.defaultable.length;u++){const{serializedKey:c,defaultValueMorphRef:f}=e.defaultable[u];a.if(`!(${c} in data)`,h=>h.line(`${f}${r}`))}return e.sequence?.defaultables&&a.for(`i < ${e.sequence.defaultables.length}`,u=>u.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&a.forIn("data",u=>u.if(`!(${e._compileDeclaresKey(u)})`,c=>c.line("delete data[k]"))),a.return("data")})},WA={implementation:Kj,Node:qj},Fj=t=>(fe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),Gj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,fm=(t,e,n)=>{const[r,a]=I2(t.branches,c=>c.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const u={};for(const c of r){const f=n.node("required",{key:c.unit,value:e});u[f.kind]=Fe(u[f.kind],f)}return a.length&&(u.index=n.node("index",{signature:a,value:e})),u},Yj=t=>fe(t,"root")?t.expression:Pe(t),zw=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(Yj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,Lw=t=>`Duplicate key ${Fo(t)}`,Of={...B$,alias:Ny.implementation,domain:jy.implementation,unit:GA.implementation,proto:Wc.implementation,union:FA.implementation,morph:PA.implementation,intersection:IA.implementation,divisor:EA.implementation,pattern:zA.implementation,predicate:AA.implementation,required:JA.implementation,optional:My.implementation,index:YA.implementation,sequence:XA.implementation,structure:WA.implementation};W.defaultConfig=tN(Object.assign(Ge(Of,(t,e)=>[t,e.defaults]),{jitless:fN(),clone:lN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Mt.defaultConfig}));W.resolvedConfig=om(W.defaultConfig,W.config);const Jj={...z$,alias:Ny.Node,domain:jy.Node,unit:GA.Node,proto:Wc.Node,union:FA.Node,morph:PA.Node,intersection:IA.Node,divisor:EA.Node,pattern:zA.Node,predicate:AA.Node,required:JA.Node,optional:My.Node,index:YA.Node,sequence:XA.Node,structure:WA.Node};class dm extends Z2{get[Ji](){return"module"}}const eE=(t,e)=>new dm(Ge(t,(n,r)=>[n,fe(r,"module")?eE(r,e):e.bindReference(r)])),Xj=t=>Xt(t)?t:"branches"in t&&Xt(t.branches)?t.branches:void 0,Zj=(t,e)=>Y(`Node of kind ${e} is not valid as a ${t} definition`),Vw=t=>`#${t} duplicates public alias ${t}`,pp={};W.ambient??={};let Uw;const tE="function $",Qj=t=>nE(t,iE(t)),nE=(t,e)=>{const n=e.write(tE,4),r=e.compile()();for(const a of t)a.precompilation||(a.traverseAllows=r[`${a.id}Allows`].bind(r),a.isRoot()&&!a.allowsRequiresContext&&(a.allows=a.traverseAllows),a.traverseApply=r[`${a.id}Apply`].bind(r),r[`${a.id}Optimistic`]&&(a.traverseOptimistic=r[`${a.id}Optimistic`].bind(r)),a.precompilation=n)},iE=t=>new fA().return(t.reduce((e,n)=>{const r=new fp({kind:"Allows"}).indent();n.compile(r);const a=r.write(`${n.id}Allows`),u=new fp({kind:"Apply"}).indent();n.compile(u);const c=u.write(`${n.id}Apply`),f=`${e}${a},
|
|
62
|
+
${c},
|
|
63
|
+
`;if(!n.hasKind("union"))return f;const h=new fp({kind:"Allows",optimistic:!0}).indent();n.compile(h);const m=h.write(`${n.id}Optimistic`);return`${f}${m},
|
|
64
|
+
`},`{
|
|
65
|
+
`)+"}");class rE{config;resolvedConfig;name;get[Ji](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=om(W.config,n),this.resolvedConfig=om(W.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(pp).length}`,this.name in pp&&Y(`A Scope already named ${this.name} already exists`),pp[this.name]=this;const r=Object.entries(e).map(a=>this.preparseOwnAliasEntry(...a));for(const[a,u]of r){let c=a;if(a[0]==="#"?(c=a.slice(1),c in this.aliases&&Y(Vw(c)),this.aliases[c]=u):(c in this.aliases&&Y(Vw(a)),this.aliases[c]=u,this.exportedNames.push(c)),!fe(u,"module")&&!fe(u,"generic")&&!Sf(u)){const f=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=fe(f,"root")?this.bindReference(f):this.createParseContext(f).id}}Uw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Uw.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=W.intrinsic?Ge(W.intrinsic,(a,u)=>a.startsWith("json")?[]:[a,this.bindReference(u)]):{}}cacheGetter(e,n){return Object.defineProperty(this,e,{value:n}),n}get internal(){return this}_json;get json(){return this._json||this.export(),this._json}defineSchema(e){return e}generic=(...e)=>{const n=this;return(r,a)=>new Qc(e,a?new TA(r):r,n,n,a??null)};units=(e,n)=>{const r=[];for(const u of e)r.includes(u)||r.push(u);const a=r.map(u=>this.node("unit",{unit:u},n));return this.node("union",a,{...n,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,n){const r=this.node("alias",{reference:n??"synthetic",resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(r),r}schema=(e,n)=>this.finalize(this.parseSchema(e,n));parseSchema=(e,n)=>this.node(Ac(e),e,n);preparseNode(e,n,r){let a=typeof e=="string"?e:Ac(n,e);if(Qt(n)&&n.kind===a)return n;if(a==="alias"&&!r?.prereduced){const{reference:f}=Ny.implementation.normalize(n,this);if(f.startsWith("$")){const h=this.resolveRoot(f.slice(1));n=h,a=h.kind}}else if(a==="union"&&Cs(n,"object")){const f=Xj(n);f?.length===1&&(n=f[0],a=Ac(n))}if(Qt(n)&&n.kind===a)return n;const c=Of[a].normalize?.(n,this)??n;return Qt(c)?c.kind===a?c:Zj(a,c.kind):{...r,$:this,kind:a,def:c,prefix:r.alias??a}}bindReference(e){let n;return Qt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Qc(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Y(lE(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!fe(n,"generic"))return n}maybeResolveSubalias(e){return hm(this.aliases,e)??hm(this.ambient,e)}get ambient(){return W.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const a=Vn[n];if(fe(a,"root"))return this.resolutions[e]=a;if(fe(a,"context")){if(a.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(a.phase==="resolved")return Rt(`Unexpected resolved context for was uncached by its scope: ${Pe(a)}`);a.phase="resolving";const u=this.bindReference(this.parseOwnDefinitionFormat(a.def,a));return a.phase="resolved",Vn[u.id]=u,Vn[a.id]=u,this.resolutions[e]=u}return Rt(`Unexpected nodesById entry for ${n}: ${Pe(a)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),fe(r,"generic")?this.resolutions[e]=this.bindReference(r):fe(r,"module")?(r.root||Y(uE(e)),this.resolutions[e]=this.bindReference(r.root)):this.resolutions[e]=this.parse(r,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){const n=e.id??LA(e.prefix);return Vn[n]=Object.assign(e,{[Ji]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new xo(e,this.resolvedConfig)}import(...e){return new dm(Ge(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const a=this.aliases[r];this._exports[r]=fe(a,"module")?eE(a,this):Kw(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=aE(this,this._exports),this._json=oE(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=iE(this.references);this.precompilation=r.write(tE,4),nE(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new dm(Ge(n,(r,a)=>[a,this._exports[a]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const a=this.preparseNode(e,n,r);if(Qt(a))return this.bindReference(a);const u=this.createParseContext(a),c=VA(u),f=this.bindReference(c);return Vn[u.id]=f};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(fe(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(fe(r,"root"))return this.bindReference(r);const a=this.createParseContext(r);Vn[a.id]=a;let u=this.bindReference(this.parseOwnDefinitionFormat(e,a));return u.isCyclic&&(u=q$(u,a.id)),Vn[a.id]=u,u}finalize(e){return Kw(e),!e.precompilation&&!this.resolvedConfig.jitless&&Qj(e.references),e}}class sE extends rE{parseOwnDefinitionFormat(e,n){return VA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(Ac(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const Kw=t=>{const e=t.references.filter(n=>n.hasKind("alias"));for(const n of e){Object.assign(n.referencesById,n.resolution.referencesById);for(const r of t.references)n.id in r.referencesById&&Object.assign(r.referencesById,n.referencesById)}return t},oE=t=>Ge(t,(e,n)=>[e,fe(n,"root")||fe(n,"generic")?n.json:fe(n,"module")?oE(n):Rt(`Unexpected resolution ${Pe(n)}`)]),hm=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),a=t[r];if(a===void 0)return;if(!fe(a,"module"))return Y(Wj(r));const u=e.slice(n+1),c=a[u];if(c===void 0)return hm(a,u);if(fe(c,"root")||fe(c,"generic"))return c;if(fe(c,"module"))return c.root??Y(uE(e));Rt(`Unexpected resolution for alias '${e}': ${Pe(c)}`)},By=(t,e)=>new sE(t,e),$l=new sE({}),aE=(t,e)=>{const n={};for(const r in e){const a=e[r];if(fe(a,"module")){const u=aE(t,a),c=Ge(u,(f,h)=>[`${r}.${f}`,h]);Object.assign(n,c)}else fe(a,"root")||fe(a,"generic")?n[r]=a:Rt(`Unexpected scope resolution ${Pe(a)}`)}return n},lE=t=>`'${t}' is unresolvable`,Wj=t=>`'${t}' must reference a module to be accessed using dot syntax`,uE=t=>`Reference to submodule '${t}' must specify an alias`;$l.export();const Ye=$l.schema,zy=$l.node;$l.defineSchema;const er=$l.generic,cE="^(?:0|[1-9]\\d*)$",e3=new RegExp(cE);en(e3);const fE=By({bigint:"bigint",boolean:[{unit:!1},{unit:!0}],false:{unit:!1},never:[],null:{unit:null},number:"number",object:"object",string:"string",symbol:"symbol",true:{unit:!0},unknown:{},undefined:{unit:void 0},Array,Date},{prereducedAliases:!0}).export();W.intrinsic={...fE};const dE=By({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:cE}},{prereducedAliases:!0}).export();Object.assign(W.intrinsic,dE);const t3=By({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),me={...fE,...dE,...t3,emptyStructure:zy("structure",{},{prereduced:!0})};W.intrinsic={...me};const qw=((t,e)=>new RegExp(t,e));Object.assign(qw,{as:qw});const n3=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],Iw=t=>t.toString()!=="Invalid Date",i3=t=>t.slice(2,-1),hE=t=>`'${t}' could not be parsed by the Date constructor`,r3=(t,e)=>s3(t,e),s3=(t,e)=>{const n=new Date(t);if(Iw(n))return n;const r=CN(t);if(r!==void 0){const a=new Date(r);if(Iw(a))return a}return e?Y(e===!0?hE(t):e):void 0},Pw=(t,e)=>{const n=t.scanner.shiftUntilEscapable(l3[mE[e]]);if(t.scanner.lookahead==="")return t.error(c3(n,e));if(t.scanner.shift(),e==="/"){try{new RegExp(n)}catch(r){Y(String(r))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(Si(e,pE))t.root=t.ctx.$.node("unit",{unit:n});else{const r=r3(n,hE(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},pE={"'":1,'"':1},o3={"/":1,"'":1,'"':1},a3={"d'":"'",'d"':'"',"'":"'",'"':'"'},mE={...a3,"/":"/"},l3={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},u3={'"':"double-quote","'":"single-quote","/":"forward slash"},c3=(t,e)=>`${e}${t} requires a closing ${u3[mE[e]]}`,f3=t=>`Private type references should not include '#'. Use '${t}' instead.`,yE="Optional definitions like 'string?' are only valid as properties in an object or tuple",gE="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Jo={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...wf},d3=(t,e)=>t===">"?e[0]==="="?e[1]==="=":e.trimStart()===""||Si(e.trimStart()[0],Jo):t==="="?e[0]!=="=":t===","||t==="?",h3=(t,e,n)=>vE(t,e,n,[]),vE=(t,e,n,r)=>{const a=n.parseUntilFinalizer();return r.push(a.root),a.finalizer===">"?r.length!==e.params.length?n.error(bE(t,e.names,r.map(u=>u.expression))):r:a.finalizer===","?vE(t,e,n,r):a.error(uA(">"))},bE=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,Hw=t=>{const e=t.scanner.shiftUntilLookahead(Jo);e==="keyof"?t.addPrefix("keyof"):t.root=m3(t,e)},p3=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(bE(t,e.names,[]));const a=h3(t,e,n);return e(...a)},m3=(t,e)=>y3(t,e)??g3(t,e)??t.error(e===""?t.scanner.lookahead==="#"?f3(t.shiftedByOne().scanner.shiftUntilLookahead(Jo)):SE(t):lE(e)),y3=(t,e)=>{if(t.ctx.args?.[e]){const r=t.ctx.args[e];return typeof r!="string"?r:t.ctx.$.node("alias",{reference:r},{prereduced:!0})}const n=t.ctx.$.maybeResolve(e);if(fe(n,"root"))return n;if(n!==void 0)return fe(n,"generic")?p3(e,n,t):Y(`Unexpected resolution ${Pe(n)}`)},g3=(t,e)=>{const n=kN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=DN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},SE=t=>{const e=t.previousOperator();return e?wE(e,t.scanner.unscanned):v3(t.scanner.unscanned)},wE=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,v3=t=>`Expected an expression${t?` before '${t}'`:""}`,xE=t=>t.scanner.lookahead===""?t.error(SE(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(o3)?Pw(t,t.scanner.shift()):t.scanner.lookaheadIsIn(wf)?xE(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in pE?Pw(t,`${t.scanner.shift()}${t.scanner.shift()}`):Hw(t),b3={">":!0,">=":!0},S3={"<":!0,"<=":!0},ef={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},w3=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,TE=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,x3=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${ef[e]}, ${n}${ef[r]})`,T3=(t,e)=>{const n=E3(t,e);if(t.root.hasKind("unit")){if(typeof t.root.unit=="number"){t.reduceLeftBound(t.root.unit,n),t.unsetRoot();return}if(t.root.unit instanceof Date){const r=`d'${t.root.description??t.root.unit.toISOString()}'`;t.unsetRoot(),t.reduceLeftBound(r,n);return}}return _3(t,n)},A3={"<":1,">":1,"=":1},E3=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,Fw=(t,e,n,r)=>n.extends(W.intrinsic.number)?typeof e!="number"?Y(pm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(W.intrinsic.lengthBoundable)?typeof e!="number"?Y(pm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(W.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Y(w$(n.expression)),O3=t=>({rule:n3(t.limit)?i3(t.limit):t.limit,exclusive:t.comparator.length===1}),_3=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const a=t.unsetRoot(),u=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!a.hasKind("unit")||typeof a.unit!="number"&&!(a.unit instanceof Date))return t.error(pm(e,u,"right"));const c=a.unit,f=e.length===1,h=Fw(e,typeof c=="number"?c:u,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:c}:{rule:c,exclusive:f});if(!t.branches.leftBound)return;if(!Si(e,S3))return t.error(TE(e));const m=Fw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(m[0],O3(t.branches.leftBound)),t.branches.leftBound=null},pm=(t,e,n)=>`Comparator ${n==="left"?ef[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,R3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo);t.root=t.root.brand(e)},C3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo),n=MN(e,{errorOnFail:Gw(e)});n===0&&t.error(Gw(0)),t.root=t.root.constrain("divisor",n)},Gw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,AE=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(k3):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():d3(e,t.scanner.unscanned)?t.finalize(e):Si(e,A3)?T3(t,e):e==="%"?C3(t):e==="#"?R3(t):e in wf?AE(t):t.error(Ly(e))},Ly=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,k3="Missing expected ']'",M3=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(D3(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},D3=t=>`Default value '${t}' must be a literal value`,Yw=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const u=e.$.maybeResolveRoot(t.slice(0,-2));if(u)return u.array()}const r=new _f(new lA(t),e),a=N3(r);return r.finalizer===">"&&Y(Ly(">")),a},N3=t=>{t.parseOperand();let e=Vy(t).root;return e?(t.finalizer==="="?e=M3(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Y(Ly(t.scanner.lookahead)),e):Rt(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Vy=t=>{for(;t.finalizer===void 0;)$3(t);return t},$3=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class _f{root;branches={prefixes:[],leftBound:null,intersection:null,union:null,pipe:null};finalizer;groups=[];scanner;ctx;constructor(e,n){this.scanner=e,this.ctx=n}error(e){return Y(e)}hasRoot(){return this.root!==void 0}setRoot(e){this.root=e}unsetRoot(){const e=this.root;return this.root=void 0,e}constrainRoot(...e){this.root=this.root.constrain(e[0],e[1])}finalize(e){if(this.groups.length)return this.error(uA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=ef[n];if(!Si(r,b3))return this.error(TE(n));if(this.branches.leftBound)return this.error(x3(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,r));this.branches.leftBound={comparator:r,limit:e}}finalizeBranches(){if(this.assertRangeUnset(),this.branches.pipe){this.pushRootToBranch("|>"),this.root=this.branches.pipe;return}if(this.branches.union){this.pushRootToBranch("|"),this.root=this.branches.union;return}if(this.branches.intersection){this.pushRootToBranch("&"),this.root=this.branches.intersection;return}this.applyPrefixes()}finalizeGroup(){this.finalizeBranches();const e=this.groups.pop();if(!e)return this.error(UN(")",this.scanner.unscanned));this.branches=e}addPrefix(e){this.branches.prefixes.push(e)}applyPrefixes(){for(;this.branches.prefixes.length;){const e=this.branches.prefixes.pop();this.root=e==="keyof"?this.root.keyof():Rt(`Unexpected prefix '${e}'`)}}pushRootToBranch(e){this.assertRangeUnset(),this.applyPrefixes();const n=this.root;this.root=void 0,this.branches.intersection=this.branches.intersection?.rawAnd(n)??n,e!=="&"&&(this.branches.union=this.branches.union?.rawOr(this.branches.intersection)??this.branches.intersection,this.branches.intersection=null,e!=="|"&&(this.branches.pipe=this.branches.pipe?.rawPipeOnce(this.branches.union)??this.branches.union,this.branches.union=null))}parseUntilFinalizer(){return Vy(new _f(this.scanner,this.ctx))}parseOperator(){return AE(this)}parseOperand(){return xE(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(w3(this.branches.leftBound.limit,this.branches.leftBound.comparator))}reduceGroupOpen(){this.groups.push(this.branches),this.branches={prefixes:[],leftBound:null,union:null,intersection:null,pipe:null}}previousOperator(){return this.branches.leftBound?.comparator??this.branches.prefixes.at(-1)??(this.branches.intersection?"&":this.branches.union?"|":this.branches.pipe?"|>":void 0)}shiftedByOne(){return this.scanner.shift(),this}}const j3="An empty string is not a valid generic parameter name",mm=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilLookahead(Jo);return r===""?t.lookahead===""&&e.length?e:Y(j3):(t.shiftUntilNonWhitespace(),B3(t,r,e,n))},Jw="extends ",B3=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(Jw))t.jumpForward(Jw.length);else return t.lookahead===","&&t.shift(),n.push(e),mm(t,n,r);const a=Vy(new _f(t,r));return n.push([e,a.root]),mm(t,n,r)};class z3 extends Hr{constructor(e){const n={$:e,raw:e.fn};super((...r)=>{const a=r.indexOf(":"),u=a===-1?r.length-1:a-1,c=r.slice(0,u+1),f=e.parse(c).assertHasKind("intersection");let h=e.intrinsic.unknown;if(a!==-1){if(a!==r.length-2)return Y(V3);h=e.parse(r[a+1])}return m=>new L3(m,f,h)},{attach:n})}}class L3 extends Hr{raw;params;returns;expression;constructor(e,n,r){const a=`typed ${e.name}`,u={[a]:(...f)=>{const h=n.assert(f),m=e(...h);return r.assert(m)}}[a];super(u),this.raw=e,this.params=n,this.returns=r;let c=n.expression;c[0]==="["&&c.at(-1)==="]"?c=c.slice(1,-1):c.endsWith("[]")&&(c=`...${c}`),this.expression=`(${c}) => ${r?.expression??"unknown"}`}}const V3=`":" must be followed by exactly one return type e.g:
|
|
66
|
+
fn("string", ":", "number")(s => s.length)`;class U3 extends Hr{$;constructor(e){super((...n)=>new fc(e)(...n),{bind:e}),this.$=e}in(e){return new fc(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new fc(this.$).at(e,n)}case(e,n){return new fc(this.$).case(e,n)}}class fc extends Hr{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([a,u])=>a==="default"?[a,u]:[this.$.parse(a),u]))),this.$=e,this.in=n}at(e,n){return this.key&&Y(q3),this.branches.length&&Y(K3),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const a=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(a),this}match(e){return this(e)}strings(e){return this.caseEntries(Object.entries(e).map(([n,r])=>n==="default"?[n,r]:[this.$.node("unit",{unit:n}),r]))}caseEntries(e){for(let n=0;n<e.length;n++){const[r,a]=e[n];if(r==="default")return n!==e.length-1&&Y("default may only be specified as the last key of a switch definition"),this.default(a);if(typeof a!="function")return Y(`Value for case "${r}" must be a function (was ${ti(a)})`);this.caseEntry(r,a)}return this}default(e){typeof e=="function"&&this.case(me.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:Xw});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let a=this.in.pipe(r);return(e==="never"||e==="assert")&&(a=a.configureReferences({onFail:Xw},"self")),this.$.finalize(a)}}const Xw=t=>t.throw(),K3="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",q3="At most one key matcher may be specified per expression",EE=(t,e)=>{if(Xt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return DE(t,e)},I3="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",P3="Only required keys may specify default values, e.g. { value: 'number = 0' }",H3=(t,e)=>{let n;const r={},a=Fc(t);for(const[c,f]of a){const h=Y3(c);if(h.kind==="spread"){if(!Rl(r))return Y(G3);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(me.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(me.object))return Y(J3(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Y(F3(f)),r.undeclared=f;continue}const m=EE(f,e),y=h;if(h.kind==="required"){Xt(m)?mp(r,"optional",m[1]==="="?{key:h.normalized,value:m[0],default:m[2]}:{key:h.normalized,value:m[0]},e):mp(r,"required",{key:h.normalized,value:m},e);continue}if(Xt(m)&&(m[1]==="?"&&Y(I3),m[1]==="="&&Y(P3)),h.kind==="optional"){mp(r,"optional",{key:h.normalized,value:m},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),b=fm(g,m,e.$);b.index&&(r.index=Fe(r.index,b.index)),b.required&&(r.required=Fe(r.required,b.required))}const u=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(u)??u})},mp=(t,e,n,r)=>{t[e]=Fe(t[e],r.$.node(e,n))},F3=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Pe(t)})`,G3="Spread operator may only be used as the first key in an object",Y3=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===tl?{kind:"required",normalized:`${t.slice(0,-2)}?`}:{kind:"optional",normalized:t.slice(0,-1)}:t[0]==="["&&t.at(-1)==="]"?{kind:"index",normalized:t.slice(1,-1)}:t[0]===tl&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},J3=t=>`Spread operand must resolve to an object literal type (was ${t})`,X3=(t,e)=>oB(t)?CE[t[0]](t,e):rB(t)?RE[t[1]](t,e):null,Z3=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),yp=(t,e)=>{if(t[2]===void 0)return Y(wE(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),r=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,r]});const a=t[1]==="&"?Zi(n,r,e.$):lm(n,r,e.$);return a instanceof ae?a.throw():a},Q3=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),W3=(t,e)=>typeof t[2]!="function"?Y(OE("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),OE=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,eB=(t,e)=>typeof t[2]!="function"?Y(OE(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),tB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configure(t[2],t[3]),_E=t=>t,nB=_E({"[]":Q3,"?":()=>Y(yE)}),iB=_E({"|":yp,"&":yp,":":eB,"=>":W3,"|>":yp,"@":tB,"=":()=>Y(gE)}),RE={...nB,...iB},rB=t=>RE[t[1]]!==void 0,sB=t=>t,CE=sB({keyof:Z3,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(Zw(tm(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(Zw(tm(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),oB=t=>CE[t[0]]!==void 0,Zw=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,aB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let a=!1;t[r]==="..."&&r<t.length-1&&(a=!0,r++);const u=EE(t[r],e),[c,f,h]=Xt(u)?u:[u];if(r++,a){if(!c.extends(W.intrinsic.Array))return Y(cB(c.expression));n=n.flatMap(m=>c.distribute(y=>uB(pA(m),y)))}else n=n.map(m=>f==="?"?kE(m,c):f==="="?lB(m,c,h):ym(m,c))}return e.$.parseSchema(n.map(a=>Rl(a)?{proto:Array,exactLength:0}:{proto:Array,sequence:a}))},ym=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?ZA:fB):(t.variadic?t.postfix=Fe(t.postfix,e):t.prefix=Fe(t.prefix,e),t),kE=(t,e)=>t.variadic?Y(ME):(t.optionals=Fe(t.optionals,e),t),lB=(t,e,n)=>t.variadic?Y(ME):t.optionals?Y(dB):(t.defaultables=Fe(t.defaultables,[[e,n]]),t),Qw=(t,e)=>(t.postfix&&Y(Ww),t.variadic?t.variadic.equals(e)||Y(Ww):t.variadic=e.internal,t),uB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return Qw(t,W.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)ym(t,r);if(n.optionals)for(const r of n.optionals)kE(t,r);if(n.variadic&&Qw(t,n.variadic),n.postfix)for(const r of n.postfix)ym(t,r);return t},cB=t=>`Spread element must be an array (was ${t})`,Ww="A tuple may have at most one variadic element",fB="A required element may not follow an optional element",ME="An optional element may not follow a variadic element",dB="A defaultable element may not follow an optional element without a default",hB={},DE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Yw(t,e);const n=hB[e.$.name]??={};return n[t]??=Yw(t,e)}return Cs(t,"object")?pB(t,e):Y(gm(ti(t)))},pB=(t,e)=>{const n=Ty(t);switch(n){case void 0:return fe(t,"root")?t:H3(t,e);case"Array":return mB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=Sf(t)?t():t;return fe(r,"root")?r:Y(gm("Function"))}default:return Y(gm(n??Pe(t)))}},mB=(t,e)=>X3(t,e)??aB(t,e),gm=t=>`Type definitions must be strings or objects (was ${t})`;class yB extends Hr{constructor(e){const n=Object.assign({errors:Lr,hkt:wi,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,declare:e.declare,define:e.define,match:e.match,generic:e.generic,schema:e.schema,keywords:e.ambient,unit:e.unit,enumerated:e.enumerated,instanceOf:e.instanceOf,valueOf:e.valueOf,or:e.or,and:e.and,merge:e.merge,pipe:e.pipe,fn:e.fn},e.ambientAttachments);super((...r)=>{if(r.length===1)return e.parse(r[0]);if(r.length===2&&typeof r[0]=="string"&&r[0][0]==="<"&&r[0].at(-1)===">"){const a=r[0].slice(1,-1),u=e.parseGenericParams(a,{});return new Qc(u,r[1],e,e,null)}return e.parse(r)},{attach:n})}}const yl=W;class Rf extends rE{get ambientAttachments(){if(yl.typeAttachments)return this.cacheGetter("ambientAttachments",Ge(yl.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(fe(n,"module")||fe(n,"generic"))return[e,n];const c=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,f=this.resolvedConfig.keywords?.[c];return f&&(n=[n,"@",f]),[e,n]}e.at(-1)!==">"&&Y("'>' must be the last character of a generic declaration in a scope");const a=e.slice(0,r),u=e.slice(r+1,-1);return[a,()=>{const c=this.parseGenericParams(u,{alias:a});return a$(c,n,this)}]}parseGenericParams(e,n){return mm(new lA(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return Sf(e)&&!fe(e,"generic")?e():e}preparseOwnDefinitionFormat(e,n){return{...n,def:e,prefix:n.alias??"type"}}parseOwnDefinitionFormat(e,n){!(n.alias&&n.alias in this.aliases)&&!n.args&&(n.args={this:n.id});const a=DE(e,n);if(Xt(a)){if(a[1]==="=")return Y(gE);if(a[1]==="?")return Y(yE)}return a}unit=e=>this.units([e]);valueOf=e=>this.units(nN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);fn=new z3(this);match=new U3(this);declare=()=>({type:this.type});define(e){return e}type=new yB(this);static scope=((e,n={})=>new Rf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const gB=Object.assign(Rf.scope,{define:t=>t}),ze=Rf;class vB extends wi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const bB=er(["base",me.object],["props",me.object])(t=>t.base.merge(t.props),vB),SB=ze.module({Key:me.key,Merge:bB});class wB extends wi{}const xB=er("element")(t=>{const e=t.element.exclude(me.Array),n=e.array();return e.rawOr(n).pipe(_l).distribute(r=>r.assertHasKind("morph").declareOut(n),Ye)},wB),TB=ze.module({root:me.Array,readonly:"root",index:me.nonNegativeIntegerString,liftFrom:xB},{name:"Array"}),vm=Ye(["string",Cl.FileConstructor]),AB=vm.rawOr(vm.array()),e1=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:AB}}),EB=ze.module({root:["instanceof",FormData],value:vm,parsed:e1,parse:Ye({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const a=e[n];typeof a=="string"||a instanceof Cl.FileConstructor?e[n]=[a,r]:a.push(r)}else e[n]=r;return e},declaredOut:e1})},{name:"FormData"}),OB=ze.module({Int8:["instanceof",Int8Array],Uint8:["instanceof",Uint8Array],Uint8Clamped:["instanceof",Uint8ClampedArray],Int16:["instanceof",Int16Array],Uint16:["instanceof",Uint16Array],Int32:["instanceof",Int32Array],Uint32:["instanceof",Uint32Array],Float32:["instanceof",Float32Array],Float64:["instanceof",Float64Array],BigInt64:["instanceof",BigInt64Array],BigUint64:["instanceof",BigUint64Array]},{name:"TypedArray"}),_B={Boolean:1,Number:1,String:1},RB=ze.module({...Ge({...ZT,...WT},(t,e)=>t in _B?[]:[t,["instanceof",e]]),Array:TB,TypedArray:OB,FormData:EB}),CB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),kB=Ye({domain:"number",divisor:1}),NE=ze.module({root:me.number,integer:kB,epoch:CB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),et=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),zy("intersection",r)},t1=et(Gc,"a well-formed integer string"),$E=ze.module({root:t1,parse:Ye({in:t1,morphs:(t,e)=>{const n=Number.parseInt(t);return Number.isSafeInteger(n)?n:e.error("an integer in the range Number.MIN_SAFE_INTEGER to Number.MAX_SAFE_INTEGER")},declaredOut:me.integer})},{name:"string.integer"}),MB=et(/^[\dA-Fa-f]+$/,"hex characters only"),DB=ze.module({root:et(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:et(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),n1=et(/^[A-Z].*$/,"capitalized"),NB=ze.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:n1}),preformatted:n1},{name:"string.capitalize"}),$B=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,r,a,u=!1;for(let c=e.length-1;c>=0;c--)r=e.substring(c,c+1),a=Number.parseInt(r,10),u?(a*=2,n+=a>=10?a%10+1:a):n+=a,u=!u;return!!(n%10===0&&e)},jB=/^(?:4\d{12}(?:\d{3,6})?|5[1-5]\d{14}|(222[1-9]|22[3-9]\d|2[3-6]\d{2}|27[01]\d|2720)\d{12}|6(?:011|5\d\d)\d{12,15}|3[47]\d{13}|3(?:0[0-5]|[68]\d)\d{11}|(?:2131|1800|35\d{3})\d{11}|6[27]\d{14}|^(81\d{14,17}))$/,BB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:jB.source},predicate:{meta:"a credit card number",predicate:$B}}),zB=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))(T((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([,.]\d+(?!:))?)?(\17[0-5]\d([,.]\d+)?)?([Zz]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/,LB=t=>!Number.isNaN(new Date(t).valueOf()),i1=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:LB}}).assertHasKind("intersection"),r1=$E.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=NE.epoch(n);return r instanceof Lr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),VB=ze.module({root:r1,parse:Ye({in:r1,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.epoch"}),s1=et(zB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),UB=ze.module({root:s1,parse:Ye({in:s1,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.iso"}),KB=ze.module({root:i1,parse:Ye({declaredIn:i1,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:me.Date}),iso:UB,epoch:VB},{name:"string.date"}),qB=et(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),o1="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Or=`(${o1}[.]){3}${o1}`,IB=new RegExp(`^${Or}$`),Tt="(?:[0-9a-fA-F]{1,4})",PB=new RegExp(`^((?:${Tt}:){7}(?:${Tt}|:)|(?:${Tt}:){6}(?:${Or}|:${Tt}|:)|(?:${Tt}:){5}(?::${Or}|(:${Tt}){1,2}|:)|(?:${Tt}:){4}(?:(:${Tt}){0,1}:${Or}|(:${Tt}){1,3}|:)|(?:${Tt}:){3}(?:(:${Tt}){0,2}:${Or}|(:${Tt}){1,4}|:)|(?:${Tt}:){2}(?:(:${Tt}){0,3}:${Or}|(:${Tt}){1,5}|:)|(?:${Tt}:){1}(?:(:${Tt}){0,4}:${Or}|(:${Tt}){1,6}|:)|(?::((?::${Tt}){0,5}:${Or}|(?::${Tt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),HB=ze.module({root:["v4 | v6","@","an IP address"],v4:et(IB,"an IPv4 address","ipv4"),v6:et(PB,"an IPv6 address","ipv6")},{name:"string.ip"}),Do="a JSON string",jE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Do} (${t})`},FB=Ye({meta:Do,domain:"string",predicate:{meta:Do,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Do,problem:jE(n)})}}}}),GB=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Do,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Do,problem:jE(n)})}},YB=ze.module({root:FB,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:GB,declaredOut:me.jsonObject})},{name:"string.json"}),a1=et(/^[a-z]*$/,"only lowercase letters"),JB=ze.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:a1}),preformatted:a1},{name:"string.lower"}),BE=["NFC","NFD","NFKC","NFKD"],jl=Ge(BE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Cf=Ge(BE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:jl[e]})]),XB=ze.module({root:Cf.NFC,preformatted:jl.NFC},{name:"string.normalize.NFC"}),ZB=ze.module({root:Cf.NFD,preformatted:jl.NFD},{name:"string.normalize.NFD"}),QB=ze.module({root:Cf.NFKC,preformatted:jl.NFKC},{name:"string.normalize.NFKC"}),WB=ze.module({root:Cf.NFKD,preformatted:jl.NFKD},{name:"string.normalize.NFKD"}),ez=ze.module({root:"NFC",NFC:XB,NFD:ZB,NFKC:QB,NFKD:WB},{name:"string.normalize"}),l1=et(nm,"a well-formed numeric string"),tz=ze.module({root:l1,parse:Ye({in:l1,morphs:t=>Number.parseFloat(t),declaredOut:me.number})},{name:"string.numeric"}),u1="a regex pattern",nz=Ye({domain:"string",predicate:{meta:u1,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:u1,problem:String(n)})}}},meta:{format:"regex"}}),iz=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][\dA-Za-z-]*))*))?(?:\+([\dA-Za-z-]+(?:\.[\dA-Za-z-]+)*))?$/,rz=et(iz,"a semantic version (see https://semver.org/)"),c1=et(/^\S.*\S$|^\S?$/,"trimmed"),sz=ze.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:c1}),preformatted:c1},{name:"string.trim"}),f1=et(/^[A-Z]*$/,"only uppercase letters"),oz=ze.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:f1}),preformatted:f1},{name:"string.upper"}),az=t=>URL.canParse(t),d1=Ye({domain:"string",predicate:{meta:"a URL string",predicate:az},meta:{format:"uri"}}),lz=ze.module({root:d1,parse:Ye({declaredIn:d1,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),uz=ze.module({root:["versioned | nil | max","@",{description:"a UUID",format:"uuid"}],"#nil":"'00000000-0000-0000-0000-000000000000'","#max":"'ffffffff-ffff-ffff-ffff-ffffffffffff'","#versioned":/[\da-f]{8}-[\da-f]{4}-[1-8][\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}/i,v1:et(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:et(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:et(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:et(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:et(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:et(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:et(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:et(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),cz=ze.module({root:me.string,alpha:et(/^[A-Za-z]*$/,"only letters"),alphanumeric:et(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:MB,base64:DB,capitalize:NB,creditCard:BB,date:KB,digits:et(/^\d*$/,"only digits 0-9"),email:qB,integer:$E,ip:HB,json:YB,lower:JB,normalize:ez,numeric:tz,regex:nz,semver:rz,trim:sz,upper:oz,url:lz,uuid:uz},{name:"string"}),fz=ze.module({bigint:me.bigint,boolean:me.boolean,false:me.false,never:me.never,null:me.null,number:me.number,object:me.object,string:me.string,symbol:me.symbol,true:me.true,unknown:me.unknown,undefined:me.undefined}),dz=ze.module({root:me.unknown,any:me.unknown},{name:"unknown"}),hz=ze.module({root:me.jsonObject,stringify:zy("morph",{in:me.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:me.string})},{name:"object.json"}),pz=ze.module({root:me.object,json:hz},{name:"object"});class mz extends wi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const yz=er(["K",me.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),mz);class gz extends wi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const vz=er(["T",me.object],["K",me.key])(t=>t.T.pick(t.K),gz);class bz extends wi{description='omit a set of properties from an object like `Omit(User, "age")`'}const Sz=er(["T",me.object],["K",me.key])(t=>t.T.omit(t.K),bz);class wz extends wi{description="make all named properties of an object optional like `Partial(User)`"}const xz=er(["T",me.object])(t=>t.T.partial(),wz);class Tz extends wi{description="make all named properties of an object required like `Required(User)`"}const Az=er(["T",me.object])(t=>t.T.required(),Tz);class Ez extends wi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const Oz=er("T","U")(t=>t.T.exclude(t.U),Ez);class _z extends wi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const Rz=er("T","U")(t=>t.T.extract(t.U),_z),Cz=ze.module({Exclude:Oz,Extract:Rz,Omit:Sz,Partial:xz,Pick:vz,Record:yz,Required:Az}),Fr=gB({...fz,...Cz,...RB,...SB,string:cz,number:NE,object:pz,unknown:dz},{prereducedAliases:!0,name:"ark"}),jt=Fr.export();Object.assign(yl.ambient,jt);yl.typeAttachments={string:jt.string.root,number:jt.number.root,bigint:jt.bigint,boolean:jt.boolean,symbol:jt.symbol,undefined:jt.undefined,null:jt.null,object:jt.object.root,unknown:jt.unknown.root,false:jt.false,true:jt.true,never:jt.never,arrayIndex:jt.Array.index,Key:jt.Key,Record:jt.Record,Array:jt.Array.root,Date:jt.Date};const Ot=Object.assign(Fr.type,yl.typeAttachments);Fr.match;Fr.fn;Fr.generic;Fr.schema;Fr.define;Fr.declare;const zE={100:'"Continue"',101:'"Switching Protocols"',102:'"Processing"',103:'"Early Hints"',200:'"OK"',201:'"Created"',202:'"Accepted"',203:'"Non-Authoritative Information"',204:'"No Content"',205:'"Reset Content"',206:'"Partial Content"',207:'"Multi-Status"',208:'"Already Reported"',226:'"IM Used"',300:'"Multiple Choices"',301:'"Moved Permanently"',302:'"Found"',303:'"See Other"',304:'"Not Modified"',305:'"Use Proxy"',306:'"Switch Proxy"',307:'"Temporary Redirect"',308:'"Permanent Redirect"',400:'"Bad Request"',401:'"Unauthorized"',402:'"Payment Required"',403:'"Forbidden"',404:'"Not Found"',405:'"Method Not Allowed"',406:'"Not Acceptable"',407:'"Proxy Authentication Required"',408:'"Request Timeout"',409:'"Conflict"',410:'"Gone"',411:'"Length Required"',412:'"Precondition Failed"',413:'"Payload Too Large"',414:'"URI Too Long"',415:'"Unsupported Media Type"',416:'"Range Not Satisfiable"',417:'"Expectation Failed"',418:`"I'm a teapot"`,421:'"Misdirected Request"',422:'"Unprocessable Entity"',423:'"Locked"',424:'"Failed Dependency"',425:'"Too Early"',426:'"Upgrade Required"',428:'"Precondition Required"',429:'"Too Many Requests"',431:'"Request Header Fields Too Large"',451:'"Unavailable For Legal Reasons"',500:'"Internal Server Error"',501:'"Not Implemented"',502:'"Bad Gateway"',503:'"Service Unavailable"',504:'"Gateway Timeout"',505:'"HTTP Version Not Supported"',506:'"Variant Also Negotiates"',507:'"Insufficient Storage"',508:'"Loop Detected"',510:'"Not Extended"',511:'"Network Authentication Required"'};function kz(t){return Number.parseInt(t,10)}const Mz=Ot(zE),Dz=Mz.keyof().pipe(t=>kz(t));Ot([Dz,"string"]);function Nz(t){return F.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[F.jsx("title",{children:"Tempest Games Logo"}),F.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M202.91,7.86h-13.18v17.03h13.18v6.84h-13.18v22.24h13.18v6.84h-30.29V.93h30.29v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M289.49.93v59.89h-17.11V7.78h-.43c-8.21,0-11.21,5.82-11.21,17.03v36.02h-16.25V24.8c0-11.21-2.99-17.03-11.21-17.03h-.43v53.04h-17.11V.93h18.74c9.92,0,15.31,4.96,18.14,11.21,2.82-6.25,8.21-11.21,18.14-11.21h18.73Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M352.82,29.68c0,11.72-6.42,19.16-24.55,19.16h-4.53v11.98h-17.11V1.1l46.2-.17v28.75ZM323.73,7.78v34.22h2.48c7.36,0,9.5-4.11,9.5-12.15V7.78h-11.98Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M396.8,7.86h-13.17v17.03h13.17v6.84h-13.17v22.24h13.17v6.84h-30.28V.93h30.28v6.93Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M425.9,12.57v14.03h27.89v16.94c0,12.75-1.71,18.13-16.43,18.13h-14.54c-9.58,0-14.03-2.74-14.03-11.97v-5.99h15.4v5.13c0,4.53.77,5.99,4.62,5.99h1.71c5.05,0,6.16-1.46,6.16-6.84v-14.54h-27.89v-16.68c0-13.52,3.85-16.68,18.82-16.68h12.83c8.81,0,13.17,1.54,13.17,10.78v7.19h-15.4v-6.5c0-3.42-1.03-4.62-4.45-4.62h-1.45c-4.28,0-6.42,1.46-6.42,5.65Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M155.96,93.78v-3.57h-5.58v-7.14h13.39v17.85h-24.76v-28.56h24.76v7.14h-16.96v14.28h9.15Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M224.26,100.92h-8.25v-10.71h-8.25v3.57h4.68v7.14h-12.94v-17.85h16.51v-3.57h-16.51v-7.14h24.76v28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M259.99,72.36h30.57v28.56h-7.81v-21.42h-3.57v21.42h-7.81v-21.42h-3.57v21.42h-7.81v-28.56Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M343.24,83.08v-3.57h-9.14v14.28h16.96v7.14h-24.76v-28.56h24.76v17.85h-13.38v-7.14h5.57Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M394.59,79.5v3.57h16.96v17.85h-24.76v-7.14h16.96v-3.57h-16.96v-17.85h24.76v7.14h-16.96Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),F.jsx("path",{d:"M0,63.42v-20.84h20.83L0,63.42ZM100,.92v32.29h-35.42v8.33h-8.33V14.46h-22.92l1.04,7.29h9.38v19.79h-8.33v-8.33H0V.92h100ZM0,100.92v-26.04l6.25-1.04,25-26.04,1.04,1.05-10.42,18.75-4.16,7.29h13.54l3.13-3.12,8.33-22.92h1.04v41.66h3.12l9.38-8.33v-33.33h1.04l8.33,22.92,3.12,3.12h13.54l-4.17-7.29-10.42-19.8,1.04-1.04,25,27.09,6.25,1.04v26.04H0ZM100,42.59v20.84l-20.83-20.84h20.83Z",style:{fill:"var(--logo-color)",strokeWidth:0}})]})}function LE(t){return F.jsx("a",{...t})}const $z={class:"_class_1riwg_1"},gp=["⠋","⠙","⠸","⠴","⠦","⠇"];function jz({input:t}){const e=$.useRef(null),[n,r]=$.useState(typeof t=="string"?t:null);return $.useEffect(()=>{let a=!0,u;if(typeof t=="string")r(t);else{let c=0;u=setInterval(()=>{e.current&&(e.current.textContent=gp[c],c=(c+1)%gp.length)},100),t.then(f=>{a&&(clearInterval(u),r(f))})}return()=>{a=!1,u&&clearInterval(u)}},[t]),F.jsx("span",{ref:e,children:n??gp[0]})}var Bz=Object.create,VE=Object.defineProperty,zz=Object.getOwnPropertyDescriptor,UE=Object.getOwnPropertyNames,Lz=Object.getPrototypeOf,Vz=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[UE(t)[0]])((e={exports:{}}).exports,e),e.exports},Uz=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=UE(e),u=0,c=a.length,f;u<c;u++)f=a[u],!Vz.call(t,f)&&f!==n&&VE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=zz(e,f))||r.enumerable});return t},vt=(t,e,n)=>(n=t!=null?Bz(Lz(t)):{},Uz(VE(n,"default",{value:t,enumerable:!0}),t)),KE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),Kz=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=KE().default;function r(a,u){if(n(a)!="object"||!a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var f=c.call(a,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),qz=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=KE().default,r=Kz();function a(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),ks=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=qz();function r(a,u,c){return(u=n(u))in a?Object.defineProperty(a,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[u]=c,a}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),ni=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=ks();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function a(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}});function kf(t){const e={subscribe(n){let r=null,a=!1,u=!1,c=!1;function f(){if(r===null){c=!0;return}u||(u=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var m;a||(m=n.next)===null||m===void 0||m.call(n,h)},error(h){var m;a||(a=!0,(m=n.error)===null||m===void 0||m.call(n,h),f())},complete(){var h;a||(a=!0,(h=n.complete)===null||h===void 0||h.call(n),f())}}),c&&f(),{unsubscribe:f}},pipe(...n){return n.reduce(Iz,e)}};return e}function Iz(t,e){return e(t)}function Pz(t){const e=new AbortController;return new Promise((r,a)=>{let u=!1;function c(){u||(u=!0,f.unsubscribe())}e.signal.addEventListener("abort",()=>{a(e.signal.reason)});const f=t.subscribe({next(h){u=!0,r(h),c()},error(h){a(h)},complete(){e.abort(),c()}})})}function Hz(t){return e=>{let n=0,r=null;const a=[];function u(){r||(r=e.subscribe({next(f){for(const m of a){var h;(h=m.next)===null||h===void 0||h.call(m,f)}},error(f){for(const m of a){var h;(h=m.error)===null||h===void 0||h.call(m,f)}},complete(){for(const h of a){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function c(){if(n===0&&r){const f=r;r=null,f.unsubscribe()}}return kf(f=>(n++,a.push(f),u(),{unsubscribe(){n--,c();const h=a.findIndex(m=>m===f);h>-1&&a.splice(h,1)}}))}}function Fz(t){let e=t;const n=[],r=c=>{e!==void 0&&c.next(e),n.push(c)},a=c=>{n.splice(n.indexOf(c),1)},u=kf(c=>(r(c),()=>{a(c)}));return u.next=c=>{if(e!==c){e=c;for(const f of n)f.next(c)}},u.get=()=>e,u}function Gz(t){return kf(e=>{function n(a=0,u=t.op){const c=t.links[a];if(!c)throw new Error("No more links to execute - did you forget to add an ending link?");return c({op:u,next(h){return n(a+1,h)}})}return n().subscribe(e)})}function gl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var Yz=Object.create,qE=Object.defineProperty,Jz=Object.getOwnPropertyDescriptor,IE=Object.getOwnPropertyNames,Xz=Object.getPrototypeOf,Zz=Object.prototype.hasOwnProperty,Bl=(t,e)=>function(){return e||(0,t[IE(t)[0]])((e={exports:{}}).exports,e),e.exports},Qz=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=IE(e),u=0,c=a.length,f;u<c;u++)f=a[u],!Zz.call(t,f)&&f!==n&&qE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=Jz(e,f))||r.enumerable});return t},Mf=(t,e,n)=>(n=t!=null?Yz(Xz(t)):{},Qz(qE(n,"default",{value:t,enumerable:!0}),t));const PE=()=>{},h1=t=>{Object.freeze&&Object.freeze(t)};function HE(t,e,n){var r;const a=e.join(".");return(r=n[a])!==null&&r!==void 0||(n[a]=new Proxy(PE,{get(u,c){if(!(typeof c!="string"||c==="then"))return HE(t,[...e,c],n)},apply(u,c,f){const h=e[e.length-1];let m={args:f,path:e};return h==="call"?m={args:f.length>=2?[f[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(m={args:f.length>=2?f[1]:[],path:e.slice(0,-1)}),h1(m.args),h1(m.path),t(m)}})),n[a]}const Wz=t=>HE(t,[],Object.create(null)),eL=t=>new Proxy(PE,{get(e,n){if(n!=="then")return t(n)}});var FE=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(r){"@babel/helpers - typeof";return e.exports=n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),tL=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=FE().default;function r(a,u){if(n(a)!="object"||!a)return a;var c=a[Symbol.toPrimitive];if(c!==void 0){var f=c.call(a,u||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(a)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),nL=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=FE().default,r=tL();function a(u){var c=r(u,"string");return n(c)=="symbol"?c:c+""}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}}),GE=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=nL();function r(a,u,c){return(u=n(u))in a?Object.defineProperty(a,u,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[u]=c,a}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Uy=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=GE();function r(u,c){var f=Object.keys(u);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(u);c&&(h=h.filter(function(m){return Object.getOwnPropertyDescriptor(u,m).enumerable})),f.push.apply(f,h)}return f}function a(u){for(var c=1;c<arguments.length;c++){var f=arguments[c]!=null?arguments[c]:{};c%2?r(Object(f),!0).forEach(function(h){n(u,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(u,h,Object.getOwnPropertyDescriptor(f,h))})}return u}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}});Mf(Uy());Mf(GE());var dc=Mf(Uy());function iL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,dc.default)((0,dc.default)({},t),{},{error:r})}}return{ok:!0,result:(0,dc.default)((0,dc.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var vp=class extends Error{constructor(){super("Unable to transform response from server")}};function rL(t,e){let n;try{n=iL(t,e)}catch{throw new vp}if(!n.ok&&(!gl(n.error.error)||typeof n.error.error.code!="number"))throw new vp;if(n.ok&&!gl(n.result))throw new vp;return n}Mf(Uy());var hc=vt(ks()),bo=vt(ni());function sL(t){return t instanceof vl}function oL(t){return gl(t)&&gl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function aL(t,e){return typeof t=="string"?t:gl(t)&&typeof t.message=="string"?t.message:e}var vl=class Ec extends Error{constructor(e,n){var r,a;const u=n?.cause;super(e,{cause:u}),(0,hc.default)(this,"cause",void 0),(0,hc.default)(this,"shape",void 0),(0,hc.default)(this,"data",void 0),(0,hc.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=u,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(a=n.result)===null||a===void 0?void 0:a.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,Ec.prototype)}static from(e,n={}){const r=e;return sL(r)?(n.meta&&(r.meta=(0,bo.default)((0,bo.default)({},r.meta),n.meta)),r):oL(r)?new Ec(r.error.message,(0,bo.default)((0,bo.default)({},n),{},{result:r})):new Ec(aL(r,"Unknown error"),(0,bo.default)((0,bo.default)({},n),{},{cause:r}))}};function lL(t){const e=t;return e?"input"in e?e:{input:e,output:e}:{input:{serialize:n=>n,deserialize:n=>n},output:{serialize:n=>n,deserialize:n=>n}}}const p1=t=>typeof t=="function";function uL(t){if(t)return t;if(typeof window<"u"&&p1(window.fetch))return window.fetch;if(typeof globalThis<"u"&&p1(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var il=vt(ni());function cL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:lL(t.transformer),methodOverride:t.methodOverride}}function fL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const dL={query:"GET",mutation:"POST",subscription:"PATCH"};function YE(t){return"input"in t?t.transformer.input.serialize(t.input):fL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const JE=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const a=[];if(e[1]&&a.push(e[1]),"inputs"in t&&a.push("batch=1"),t.type==="query"||t.type==="subscription"){const u=YE(t);u!==void 0&&t.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return a.length&&(r+="?"+a.join("&")),r},hL=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=YE(t);return e!==void 0?JSON.stringify(e):void 0},pL=t=>vL((0,il.default)((0,il.default)({},t),{},{contentTypeHeader:"application/json",getUrl:JE,getBody:hL}));var mL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const yL=t=>{var e;if(t?.aborted)throw(e=t.throwIfAborted)===null||e===void 0||e.call(t),typeof DOMException<"u"?new DOMException("AbortError","AbortError"):new mL};async function gL(t){var e;yL(t.signal);const n=t.getUrl(t),r=t.getBody(t),a=(e=t.methodOverride)!==null&&e!==void 0?e:dL[t.type],u=await(async()=>{const f=await t.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),c=(0,il.default)((0,il.default)((0,il.default)({},t.contentTypeHeader&&a!=="GET"?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),u);return uL(t.fetch)(n,{method:a,signal:t.signal,body:r,headers:c})}async function vL(t){const e={},n=await gL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}vt(ni());const m1=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function y1(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function a(f){const h=[[]];let m=0;for(;;){const b=f[m];if(!b)break;const S=h[h.length-1];if(b.aborted){var y;(y=b.reject)===null||y===void 0||y.call(b,new Error("Aborted")),m++;continue}if(t.validate(S.concat(b).map(T=>T.key))){S.push(b),m++;continue}if(S.length===0){var g;(g=b.reject)===null||g===void 0||g.call(b,new Error("Input is too big for a single dispatch")),m++;continue}h.push([])}return h}function u(){const f=a(e);r();for(const h of f){if(!h.length)continue;const m={items:h};for(const g of h)g.batch=m;t.fetch(m.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,x)=>{const T=m.items[x];try{var M;const _=await Promise.resolve(S);(M=T.resolve)===null||M===void 0||M.call(T,_)}catch(_){var C;(C=T.reject)===null||C===void 0||C.call(T,_)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of m.items){var b;(b=S.reject)===null||b===void 0||b.call(S,g),S.batch=null}})}}function c(f){var h;const m={aborted:!1,key:f,batch:null,resolve:m1,reject:m1},y=new Promise((g,b)=>{var S;m.reject=b,m.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(m)});return(h=n)!==null&&h!==void 0||(n=setTimeout(u)),y}return{load:c}}function bL(...t){const e=new AbortController,n=t.length;let r=0;const a=()=>{++r===n&&e.abort()};for(const u of t)u?.aborted?a():u?.addEventListener("abort",a,{once:!0});return e.signal}var pc=vt(ni());function SL(t){var e,n;const r=cL(t),a=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,u=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const c=y=>({validate(g){if(a===1/0&&u===1/0)return!0;if(g.length>u)return!1;const b=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return JE((0,pc.default)((0,pc.default)({},r),{},{type:y,path:b,inputs:S,signal:null})).length<=a},async fetch(g){const b=g.map(_=>_.path).join(","),S=g.map(_=>_.input),x=bL(...g.map(_=>_.signal)),T=await pL((0,pc.default)((0,pc.default)({},r),{},{path:b,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(_=>({meta:T.meta,json:_}))}}),f=y1(c("query")),h=y1(c("mutation")),m={query:f,mutation:h};return({op:y})=>kf(g=>{if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=m[y.type].load(y);let x;return S.then(T=>{x=T;const M=rL(T.json,r.transformer.output);if(!M.ok){g.error(vl.from(M.error,{meta:T.meta}));return}g.next({context:T.meta,result:M.result}),g.complete()}).catch(T=>{g.error(vl.from(T,{meta:x?.meta}))}),()=>{}})}}vt(ni());const XE=(t,...e)=>typeof t=="function"?t(...e):t;vt(ks());function wL(){let t,e;return{promise:new Promise((r,a)=>{t=r,e=a}),resolve:t,reject:e}}async function xL(t){const e=await XE(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function TL(t){const e={method:"connectionParams",data:await XE(t)};return JSON.stringify(e)}vt(ks());var ps=vt(ks());function AL(t){const{promise:e,resolve:n,reject:r}=wL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function EL(t,{intervalMs:e,pongTimeoutMs:n}){let r,a;function u(){r=setTimeout(()=>{t.send("PING"),a=setTimeout(()=>{t.close()},n)},e)}function c(){clearTimeout(r),u()}function f(){clearTimeout(a),c()}t.addEventListener("open",u),t.addEventListener("message",({data:h})=>{clearTimeout(r),u(),h==="PONG"&&f()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(a)})}var OL=class bm{constructor(e){var n;if((0,ps.default)(this,"id",++bm.connectCount),(0,ps.default)(this,"WebSocketPonyfill",void 0),(0,ps.default)(this,"urlOptions",void 0),(0,ps.default)(this,"keepAliveOpts",void 0),(0,ps.default)(this,"wsObservable",Fz(null)),(0,ps.default)(this,"openPromise",null),this.WebSocketPonyfill=(n=e.WebSocketPonyfill)!==null&&n!==void 0?n:WebSocket,!this.WebSocketPonyfill)throw new Error("No WebSocket implementation found - you probably don't want to use this on the server, but if you do you need to pass a `WebSocket`-ponyfill");this.urlOptions=e.urlOptions,this.keepAliveOpts=e.keepAlive}get ws(){return this.wsObservable.get()}set ws(e){this.wsObservable.next(e)}isOpen(){return!!this.ws&&this.ws.readyState===this.WebSocketPonyfill.OPEN&&!this.openPromise}isClosed(){return!!this.ws&&(this.ws.readyState===this.WebSocketPonyfill.CLOSING||this.ws.readyState===this.WebSocketPonyfill.CLOSED)}async open(){var e=this;if(e.openPromise)return e.openPromise;e.id=++bm.connectCount;const n=xL(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:a}){a==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&EL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await AL(r),e.urlOptions.connectionParams&&r.send(await TL(e.urlOptions.connectionParams))});try{await e.openPromise}finally{e.openPromise=null}}async close(){var e=this;try{await e.openPromise}finally{var n;(n=e.ws)===null||n===void 0||n.close()}}};(0,ps.default)(OL,"connectCount",0);vt(ks());vt(ni());var bp=vt(ks()),g1=vt(ni()),_L=class{constructor(t){(0,bp.default)(this,"links",void 0),(0,bp.default)(this,"runtime",void 0),(0,bp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return Gz({links:this.links,op:(0,g1.default)((0,g1.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(Hz())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await Pz(n)).result.data}catch(n){throw vl.from(n)}}query(t,e,n){return this.requestAsPromise({type:"query",path:t,input:e,context:n?.context,signal:n?.signal})}mutation(t,e,n){return this.requestAsPromise({type:"mutation",path:t,input:e,context:n?.context,signal:n?.signal})}subscription(t,e,n){return this.$request({type:"subscription",path:t,input:e,context:n.context,signal:n.signal}).subscribe({next(a){switch(a.result.type){case"state":{var u;(u=n.onConnectionStateChange)===null||u===void 0||u.call(n,a.result);break}case"started":{var c;(c=n.onStarted)===null||c===void 0||c.call(n,{context:a.context});break}case"stopped":{var f;(f=n.onStopped)===null||f===void 0||f.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,a.result.data);break}}},error(a){var u;(u=n.onError)===null||u===void 0||u.call(n,a)},complete(){var a;(a=n.onComplete)===null||a===void 0||a.call(n)}})}};const RL=Symbol.for("trpc_untypedClient"),CL={query:"query",mutate:"mutation",subscribe:"subscription"},kL=t=>CL[t];function ML(t){const e=Wz(({path:n,args:r})=>{const a=[...n],u=kL(a.pop()),c=a.join(".");return t[u](c,...r)});return eL(n=>n===RL?t:e[n])}function DL(t){const e=new _L(t);return ML(e)}vt(ni());vt(ni());var NL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(a){var u,c,f,h=2;for(typeof Symbol<"u"&&(c=Symbol.asyncIterator,f=Symbol.iterator);h--;){if(c&&(u=a[c])!=null)return u.call(a);if(f&&(u=a[f])!=null)return new r(u.call(a));c="@@asyncIterator",f="@@iterator"}throw new TypeError("Object is not async iterable")}function r(a){function u(c){if(Object(c)!==c)return Promise.reject(new TypeError(c+" is not an object."));var f=c.done;return Promise.resolve(c.value).then(function(h){return{value:h,done:f}})}return r=function(f){this.s=f,this.n=f.next},r.prototype={s:null,n:null,next:function(){return u(this.n.apply(this.s,arguments))},return:function(f){var h=this.s.return;return h===void 0?Promise.resolve({value:f,done:!0}):u(h.apply(this.s,arguments))},throw:function(f){var h=this.s.return;return h===void 0?Promise.reject(f):u(h.apply(this.s,arguments))}},new r(a)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});vt(NL());vt(ni());var $L=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(f,h){var m=Error();return m.name="SuppressedError",m.error=f,m.suppressed=h,m},a={},u=[];function c(f,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(f)var m=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(m===void 0&&(m=h[Symbol.dispose||Symbol.for("Symbol.dispose")],f))var y=m;if(typeof m!="function")throw new TypeError("Object is not disposable.");y&&(m=function(){try{y.call(h)}catch(b){return Promise.reject(b)}}),u.push({v:h,d:m,a:f})}else f&&u.push({d:h,a:f});return h}return{e:a,u:c.bind(null,!1),a:c.bind(null,!0),d:function(){var h,m=this.e,y=0;function g(){for(;h=u.pop();)try{if(!h.a&&y===1)return y=0,u.push(h),Promise.resolve().then(g);if(h.d){var S=h.d.call(h.v);if(h.a)return y|=2,Promise.resolve(S).then(g,b)}else y|=1}catch(x){return b(x)}if(y===1)return m!==a?Promise.reject(m):Promise.resolve();if(m!==a)throw m}function b(S){return m=m!==a?new r(S,m):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),ZE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,a){this.v=r,this.k=a}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),jL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=ZE();function r(a){return new n(a,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),BL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=ZE();function r(u){return function(){return new a(u.apply(this,arguments))}}function a(u){var c,f;function h(y,g){try{var b=u[y](g),S=b.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var M=y==="return"?"return":"next";if(!S.k||T.done)return h(M,T);T=u[M](T).value}m(b.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){m("throw",T)}}function m(y,g){switch(y){case"return":c.resolve({value:g,done:!0});break;case"throw":c.reject(g);break;default:c.resolve({value:g,done:!1})}(c=c.next)?h(c.key,c.arg):f=null}this._invoke=function(y,g){return new Promise(function(b,S){var x={key:y,arg:g,resolve:b,reject:S,next:null};f?f=f.next=x:(c=f=x,h(y,g))})},typeof u.return!="function"&&(this.return=void 0)}a.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},a.prototype.next=function(u){return this._invoke("next",u)},a.prototype.throw=function(u){return this._invoke("throw",u)},a.prototype.return=function(u){return this._invoke("return",u)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});vt($L());vt(jL());vt(BL());vt(ni());var zL={};function QE(t,e){if(t instanceof Promise)throw new Error(e)}function LL(t,e){const n={},r=[];for(const a in t){const u=t[a]["~standard"].validate(e[a]);if(QE(u,`Validation must be synchronous, but ${a} returned a Promise.`),u.issues){r.push(...u.issues.map(c=>({...c,message:c.message,path:[a,...c.path??[]]})));continue}n[a]=u.value}return r.length?{issues:r}:{value:n}}function VL(t){const e=t.runtimeEnvStrict??t.runtimeEnv??zL;if(t.emptyStringAsUndefined??!1)for(const[_,R]of Object.entries(e))R===""&&delete e[_];if(!!t.skipValidation)return e;const a=typeof t.client=="object"?t.client:{},u=typeof t.server=="object"?t.server:{},c=typeof t.shared=="object"?t.shared:{},f=t.isServer??(typeof window>"u"||"Deno"in window),h=f?{...u,...c,...a}:{...a,...c},m=t.createFinalSchema?.(h,f)["~standard"].validate(e)??LL(h,e);QE(m,"Validation must be synchronous");const y=t.onValidationError??(_=>{throw console.error("❌ Invalid environment variables:",_),new Error("Invalid environment variables")}),g=t.onInvalidAccess??(()=>{throw new Error("❌ Attempted to access a server-side environment variable on the client")});if(m.issues)return y(m.issues);const b=_=>t.clientPrefix?!_.startsWith(t.clientPrefix)&&!(_ in c):!0,S=_=>f||!b(_),x=_=>_==="__esModule"||_==="$$typeof",T=(t.extends??[]).reduce((_,R)=>Object.assign(_,R),{}),M=Object.assign(T,m.value);return new Proxy(M,{get(_,R){if(typeof R=="string"&&!x(R))return S(R)?Reflect.get(_,R):g(R)}})}const UL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},KL="__vite_start_time"in globalThis,qL=typeof window<"u",qi=Ot("string"),v1=Ot('"true" | "false" | undefined'),WE=VL({isServer:!KL&&!qL,server:{CI:Ot("string | undefined").pipe(Boolean),POSTGRES_USER:qi,POSTGRES_PASSWORD:qi,POSTGRES_DATABASE:qi,POSTGRES_HOST:qi,POSTGRES_PORT:qi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:v1.pipe(t=>t==="true"),FRONTEND_PORT:qi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:qi.pipe.try(t=>JSON.parse(t),Ot("string[]")),API_KEY_OPENAI:Ot("string | undefined"),API_KEY_RESEND:Ot("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:qi,VITE_DEV_FRONTEND_HOST:Ot("string | undefined"),VITE_DEV_HTTPS:v1.pipe(t=>t==="true")},runtimeEnv:UL,emptyStringAsUndefined:!0}),cn=DL({links:[SL({url:WE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),IL=ft({key:"appVersionQuery",default:cn.version.query});ft({key:"lastKnownVersion",default:null,effects:[yT(localStorage,JSON,"lastKnownVersion")]});const PL=vi({key:"appVersion",get:async({get:t})=>{const e=t(IL),{version:n}=await e;return n}});function Sp(t){return["optional",t]}function HL(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(a=>{if(a===null)return[];const u=[],c=a[1],f=c[r];f!==void 0&&u.push(f);const h=Object.keys(c).find(m=>m.startsWith("$"));if(h){const m=c[h];m&&u.push(m)}return u})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const yi=Object.create(null);yi.open="0";yi.close="1";yi.ping="2";yi.pong="3";yi.message="4";yi.upgrade="5";yi.noop="6";const Oc=Object.create(null);Object.keys(yi).forEach(t=>{Oc[yi[t]]=t});const Sm={type:"error",data:"parser error"},eO=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",tO=typeof ArrayBuffer=="function",nO=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ky=({type:t,data:e},n,r)=>eO&&e instanceof Blob?n?r(e):b1(e,r):tO&&(e instanceof ArrayBuffer||nO(e))?n?r(e):b1(new Blob([e]),r):r(yi[t]+(e||"")),b1=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function S1(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let wp;function FL(t,e){if(eO&&t.data instanceof Blob)return t.data.arrayBuffer().then(S1).then(e);if(tO&&(t.data instanceof ArrayBuffer||nO(t.data)))return e(S1(t.data));Ky(t,!1,n=>{wp||(wp=new TextEncoder),e(wp.encode(n))})}const w1="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<w1.length;t++)Wa[w1.charCodeAt(t)]=t;const GL=t=>{let e=t.length*.75,n=t.length,r,a=0,u,c,f,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const m=new ArrayBuffer(e),y=new Uint8Array(m);for(r=0;r<n;r+=4)u=Wa[t.charCodeAt(r)],c=Wa[t.charCodeAt(r+1)],f=Wa[t.charCodeAt(r+2)],h=Wa[t.charCodeAt(r+3)],y[a++]=u<<2|c>>4,y[a++]=(c&15)<<4|f>>2,y[a++]=(f&3)<<6|h&63;return m},YL=typeof ArrayBuffer=="function",qy=(t,e)=>{if(typeof t!="string")return{type:"message",data:iO(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:JL(t.substring(1),e)}:Oc[n]?t.length>1?{type:Oc[n],data:t.substring(1)}:{type:Oc[n]}:Sm},JL=(t,e)=>{if(YL){const n=GL(t);return iO(n,e)}else return{base64:!0,data:t}},iO=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},rO="",XL=(t,e)=>{const n=t.length,r=new Array(n);let a=0;t.forEach((u,c)=>{Ky(u,!1,f=>{r[c]=f,++a===n&&e(r.join(rO))})})},ZL=(t,e)=>{const n=t.split(rO),r=[];for(let a=0;a<n.length;a++){const u=qy(n[a],e);if(r.push(u),u.type==="error")break}return r};function QL(){return new TransformStream({transform(t,e){FL(t,n=>{const r=n.length;let a;if(r<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,r);else if(r<65536){a=new Uint8Array(3);const u=new DataView(a.buffer);u.setUint8(0,126),u.setUint16(1,r)}else{a=new Uint8Array(9);const u=new DataView(a.buffer);u.setUint8(0,127),u.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(a[0]|=128),e.enqueue(a),e.enqueue(n)})}})}let xp;function mc(t){return t.reduce((e,n)=>e+n.length,0)}function yc(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let a=0;a<e;a++)n[a]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function WL(t,e){xp||(xp=new TextDecoder);const n=[];let r=0,a=-1,u=!1;return new TransformStream({transform(c,f){for(n.push(c);;){if(r===0){if(mc(n)<1)break;const h=yc(n,1);u=(h[0]&128)===128,a=h[0]&127,a<126?r=3:a===126?r=1:r=2}else if(r===1){if(mc(n)<2)break;const h=yc(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(mc(n)<8)break;const h=yc(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(Sm);break}a=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(mc(n)<a)break;const h=yc(n,a);f.enqueue(qy(u?h:xp.decode(h),e)),r=0}if(a===0||a>t){f.enqueue(Sm);break}}}})}const sO=4;function _t(t){if(t)return eV(t)}function eV(t){for(var e in _t.prototype)t[e]=_t.prototype[e];return t}_t.prototype.on=_t.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};_t.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};_t.prototype.off=_t.prototype.removeListener=_t.prototype.removeAllListeners=_t.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,a=0;a<n.length;a++)if(r=n[a],r===e||r.fn===e){n.splice(a,1);break}return n.length===0&&delete this._callbacks["$"+t],this};_t.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,a=n.length;r<a;++r)n[r].apply(this,e)}return this};_t.prototype.emitReserved=_t.prototype.emit;_t.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};_t.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Df=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Un=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),tV="arraybuffer";function oO(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const nV=Un.setTimeout,iV=Un.clearTimeout;function Nf(t,e){e.useNativeTimers?(t.setTimeoutFn=nV.bind(Un),t.clearTimeoutFn=iV.bind(Un)):(t.setTimeoutFn=Un.setTimeout.bind(Un),t.clearTimeoutFn=Un.clearTimeout.bind(Un))}const rV=1.33;function sV(t){return typeof t=="string"?oV(t):Math.ceil((t.byteLength||t.size)*rV)}function oV(t){let e=0,n=0;for(let r=0,a=t.length;r<a;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function aO(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function aV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function lV(t){let e={},n=t.split("&");for(let r=0,a=n.length;r<a;r++){let u=n[r].split("=");e[decodeURIComponent(u[0])]=decodeURIComponent(u[1])}return e}class uV extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class Iy extends _t{constructor(e){super(),this.writable=!1,Nf(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new uV(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=qy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=aV(e);return n.length?"?"+n:""}}class cV extends Iy{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};ZL(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,XL(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=aO()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let lO=!1;try{lO=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const fV=lO;function dV(){}class hV extends cV{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(a,u)=>{this.onError("xhr post error",a,u)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let No=class _c extends _t{constructor(e,n,r){super(),this.createRequest=e,Nf(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=oO(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&r.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var a;r.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=_c.requestsCount++,_c.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=dV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete _c.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};No.requestsCount=0;No.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",x1);else if(typeof addEventListener=="function"){const t="onpagehide"in Un?"pagehide":"unload";addEventListener(t,x1,!1)}}function x1(){for(let t in No.requests)No.requests.hasOwnProperty(t)&&No.requests[t].abort()}const pV=(function(){const t=uO({xdomain:!1});return t&&t.responseType!==null})();class mV extends hV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=pV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new No(uO,this.uri(),e)}}function uO(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||fV))return new XMLHttpRequest}catch{}if(!e)try{return new Un[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const cO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class yV extends Iy{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=cO?{}:oO(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],a=n===e.length-1;Ky(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}a&&Df(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=aO()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Tp=Un.WebSocket||Un.MozWebSocket;class gV extends yV{createSocket(e,n,r){return cO?new Tp(e,n,r):n?new Tp(e,n):new Tp(e)}doWrite(e,n){this.ws.send(n)}}class vV extends Iy{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=WL(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),a=QL();a.readable.pipeTo(e.writable),this._writer=a.writable.getWriter();const u=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),u())}).catch(f=>{})};u();const c={type:"open"};this.query.sid&&(c.data=`{"sid":"${this.query.sid}"}`),this._writer.write(c).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],a=n===e.length-1;this._writer.write(r).then(()=>{a&&Df(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const bV={websocket:gV,webtransport:vV,polling:mV},SV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,wV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function wm(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let a=SV.exec(t||""),u={},c=14;for(;c--;)u[wV[c]]=a[c]||"";return n!=-1&&r!=-1&&(u.source=e,u.host=u.host.substring(1,u.host.length-1).replace(/;/g,":"),u.authority=u.authority.replace("[","").replace("]","").replace(/;/g,":"),u.ipv6uri=!0),u.pathNames=xV(u,u.path),u.queryKey=TV(u,u.query),u}function xV(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function TV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,u){a&&(n[a]=u)}),n}const xm=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rc=[];xm&&addEventListener("offline",()=>{Rc.forEach(t=>t())},!1);class jr extends _t{constructor(e,n){if(super(),this.binaryType=tV,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=wm(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=wm(n.host).host);Nf(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const a=r.prototype.name;this.transports.push(a),this._transportsByName[a]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=lV(this.opts.query)),xm&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Rc.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=sO,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&jr.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",jr.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const a=this.writeBuffer[r].data;if(a&&(n+=sV(a)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Df(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,a){if(typeof n=="function"&&(a=n,n=void 0),typeof r=="function"&&(a=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const u={type:e,data:n,options:r};this.emitReserved("packetCreate",u),this.writeBuffer.push(u),a&&this.once("flush",a),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(jr.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),xm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rc.indexOf(this._offlineEventListener);r!==-1&&Rc.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=sO;class AV extends jr{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;jr.priorWebsocketSuccess=!1;const a=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!r)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;jr.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(y(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const b=new Error("probe error");b.transport=n.name,this.emitReserved("upgradeError",b)}}))};function u(){r||(r=!0,y(),n.close(),n=null)}const c=g=>{const b=new Error("probe error: "+g);b.transport=n.name,u(),this.emitReserved("upgradeError",b)};function f(){c("transport closed")}function h(){c("socket closed")}function m(g){n&&g.name!==n.name&&u()}const y=()=>{n.removeListener("open",a),n.removeListener("error",c),n.removeListener("close",f),this.off("close",h),this.off("upgrading",m)};n.once("open",a),n.once("error",c),n.once("close",f),this.once("close",h),this.once("upgrading",m),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let EV=class extends AV{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(a=>bV[a]).filter(a=>!!a)),super(e,r)}};function OV(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=wm(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const u=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+u+":"+r.port+e,r.href=r.protocol+"://"+u+(n&&n.port===r.port?"":":"+r.port),r}const _V=typeof ArrayBuffer=="function",RV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,fO=Object.prototype.toString,CV=typeof Blob=="function"||typeof Blob<"u"&&fO.call(Blob)==="[object BlobConstructor]",kV=typeof File=="function"||typeof File<"u"&&fO.call(File)==="[object FileConstructor]";function Py(t){return _V&&(t instanceof ArrayBuffer||RV(t))||CV&&t instanceof Blob||kV&&t instanceof File}function Cc(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Cc(t[n]))return!0;return!1}if(Py(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Cc(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Cc(t[n]))return!0;return!1}function MV(t){const e=[],n=t.data,r=t;return r.data=Tm(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Tm(t,e){if(!t)return t;if(Py(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Tm(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Tm(t[r],e));return n}return t}function DV(t,e){return t.data=Am(t.data,e),delete t.attachments,t}function Am(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=Am(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Am(t[n],e));return t}const NV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],$V=5;var ke;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(ke||(ke={}));class jV{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&Cc(e)?this.encodeAsBinary({type:e.type===ke.EVENT?ke.BINARY_EVENT:ke.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===ke.BINARY_EVENT||e.type===ke.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=MV(e),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}function T1(t){return Object.prototype.toString.call(t)==="[object Object]"}class Hy extends _t{constructor(e){super(),this.reviver=e}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===ke.BINARY_EVENT;r||n.type===ke.BINARY_ACK?(n.type=r?ke.EVENT:ke.ACK,this.reconstructor=new BV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Py(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(ke[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===ke.BINARY_EVENT||r.type===ke.BINARY_ACK){const u=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const c=e.substring(u,n);if(c!=Number(c)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(c)}if(e.charAt(n+1)==="/"){const u=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(u,n)}else r.nsp="/";const a=e.charAt(n+1);if(a!==""&&Number(a)==a){const u=n+1;for(;++n;){const c=e.charAt(n);if(c==null||Number(c)!=c){--n;break}if(n===e.length)break}r.id=Number(e.substring(u,n+1))}if(e.charAt(++n)){const u=this.tryParse(e.substr(n));if(Hy.isPayloadValid(r.type,u))r.data=u;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case ke.CONNECT:return T1(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||T1(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&NV.indexOf(n[0])===-1);case ke.ACK:case ke.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class BV{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=DV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const zV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Hy,Encoder:jV,get PacketType(){return ke},protocol:$V},Symbol.toStringTag,{value:"Module"}));function Qn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const LV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class dO extends _t{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Qn(e,"open",this.onopen.bind(this)),Qn(e,"packet",this.onpacket.bind(this)),Qn(e,"error",this.onerror.bind(this)),Qn(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,a,u;if(LV.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const c={type:ke.EVENT,data:n};if(c.options={},c.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),c.id=y}const f=(a=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((u=this.io.engine)===null||u===void 0)&&u._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(c),this.packet(c)):this.sendBuffer.push(c)),this.flags={},this}_registerAckCallback(e,n){var r;const a=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(a===void 0){this.acks[e]=n;return}const u=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},a),c=(...f)=>{this.io.clearTimeoutFn(u),n.apply(this,f)};c.withError=!0,this.acks[e]=c}emitWithAck(e,...n){return new Promise((r,a)=>{const u=(c,f)=>c?a(c):r(f);u.withError=!0,n.push(u),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((a,...u)=>r!==this._queue[0]?void 0:(a!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(a)):(this._queue.shift(),n&&n(null,...u)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:ke.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case ke.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case ke.EVENT:case ke.BINARY_EVENT:this.onevent(e);break;case ke.ACK:case ke.BINARY_ACK:this.onack(e);break;case ke.DISCONNECT:this.ondisconnect();break;case ke.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...a){r||(r=!0,n.packet({type:ke.ACK,id:e,data:a}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:ke.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function Xo(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}Xo.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=(Math.floor(e*10)&1)==0?t-n:t+n}return Math.min(t,this.max)|0};Xo.prototype.reset=function(){this.attempts=0};Xo.prototype.setMin=function(t){this.ms=t};Xo.prototype.setMax=function(t){this.max=t};Xo.prototype.setJitter=function(t){this.jitter=t};class Em extends _t{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Nf(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Xo({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const a=n.parser||zV;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new EV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const a=Qn(n,"open",function(){r.onopen(),e&&e()}),u=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},c=Qn(n,"error",u);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{a(),u(new Error("timeout")),n.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(c),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Qn(e,"ping",this.onping.bind(this)),Qn(e,"data",this.ondata.bind(this)),Qn(e,"error",this.onerror.bind(this)),Qn(e,"close",this.onclose.bind(this)),Qn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Df(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new dO(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(a=>{a?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",a)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ya={};function kc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=OV(t,e.path||"/socket.io"),r=n.source,a=n.id,u=n.path,c=Ya[a]&&u in Ya[a].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||c;let h;return f?h=new Em(r,e):(Ya[a]||(Ya[a]=new Em(r,e)),h=Ya[a]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(kc,{Manager:Em,Socket:dO,io:kc,connect:kc});const VV=["123","321","abc","admin","adobe","alexander","amanda","andrea","andrew","angel","apple","asdf","ashley","baby","banana","baseball","batman","bear","biteme","blazer","blonde","boston","buster","butterfly","cameron","charlie","cheese","chelsea","chicken","chocolate","chris","compaq","computer","cookie","corvette","cowboys","dakota","dallas","daniel","david","diamond","dolphin","donald","dragon","eagle","flower","football","frank","freedom","friend","gateway","george","ginger","god","golf","hannah","hardcore","harley","heather","hello","hottie","hunter","internet","jasmine","jennifer","jessica","jesus","johnny","jordan","joshua","justin","justme","killer","knight","lakers","letmein","liverpool","login","london","love","lucky","mackenzie","maggie","master","matrix","matthew","maverick","melissa","mercedes","michael","michelle","mickey","miller","money","monkey","morgan","mother","muffin","mustang","natasha","nathan","nicole","ninja","orange","pass","password","patrick","peanut","pepper","phoenix","photoshop","pokemon","princess","purple","qazwsx","qwerty","rainbow","ranger","root","samantha","samsung","scooter","secret","shadow","simpson","smile","soccer","sparkle","starwars","summer","sunflower","sunshine","superman","taylor","temp","test","thomas","tigers","tigger","tinkerbell","trust","turtle","victoria","welcome","whatever","william","winter","yellow","zaq12wsx","zxcvbn"],UV=3,KV=15,qV=/^[a-zA-Z0-9_-]+$/,IV=Ot(qV).pipe(Ot(`string > ${UV} & string < ${KV}`)).brand("username"),A1=20,E1={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function PV(t){let e="";for(const n of t)n in E1?e+=E1[n]:e+=n;return e}function HV(t){const e=t.toLocaleLowerCase(),n=PV(e);for(const r of VV)if(n.includes(r)||e.includes(r))return!0;return!1}function FV(t){const e=new Set(t).size;return t.length*Math.log2(e)}function GV(t){let e=0;return HV(t)&&(e-=100),e+=FV(t)*.5,Math.max(e,0)}const YV=Ot("string").narrow((t,e)=>{const n=GV(t);return n>=A1?!0:e.mustBe(`Of complexity ${A1} or more. Was ${n.toFixed(2)}.`)}).brand("password");Ot({"+":"delete",email:"string",password:"string"});const JV=Ot("string").brand("email");Ot({"+":"delete",username:"string",password:"string",email:"string"});const XV=Ot({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),gi=kc(WE.VITE_BACKEND_ORIGIN,{auth:t=>{const e=nt(ut);e&&t(e)},withCredentials:!0,autoConnect:!1});gi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(ut,null)}).on("usernameChanged",t=>{De(ut,e=>e===null?null:{...e,username:t})});const ut=ft({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=qr(e),r=XV(n);return r instanceof Ot.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),gi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De($o,n.username),localStorage.setItem("auth",zt(n)),n.verification==="verified"?(console.log("connecting..."),gi.connect()):Os("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),$o=ft({key:"username",default:nt(ut)?.username??""}),Ap=ft({key:"usernameDebounce",default:!0}),ZV=ft({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{Ck($o,()=>{nt(Ap)&&(t(nt($o)),De(Ap,!1),setTimeout(()=>{De(Ap,!0),t(nt($o))},2e3))})}]}),QV=vi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(ZV);if(!e)return!1;const n=nt(ut);return e===n?.username?!1:cn.isUsernameTaken.query({username:e})}}),hO=vi({key:"usernameIssues",get:({get:t})=>{const e=t($o),n=IV(e);return n instanceof Ot.errors?n:null}}),di=ft({key:"password0",default:""}),pO=vi({key:"password0Issues",get:({get:t})=>{const e=t(di),n=YV(e);return n instanceof Ot.errors?n:null}}),Io=ft({key:"email",default:""}),mO=vi({key:"emailIssues",get:({get:t})=>{const e=t(Io),n=JV(e);return n instanceof Ot.errors?n:null}});vi({key:"signupReady",get:({get:t})=>{const e=t(hO),n=t(pO),r=t(mO);return!(e??n??r)}});const Fi=ft({key:"oneTimeCode",default:""}),Om=ft({key:"oneTimeCodeNewEmail",default:""}),ui=ft({key:"authTarget",default:null}),yO=Sp({verify:Sp({$token:null}),game:Sp({clicker:null}),account:null,admin:null});function WV(t){return HL(yO,t)}const e4=[[]];function t4(t){return e4.some(e=>e.join("/")===t.join("/"))}function Os(t){history.pushState(null,"",t),De(gO,t)}const gO=ft({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=a=>{history.replaceState(null,"",a),e(a)},r=a=>{switch(a){case"/":{const u=nt(ut);switch(console.log("/","auth",u),u?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{nt(ut)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{nt(ut)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const u=nt(ut);if(!u){n("/");break}u.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:a})=>{r(a)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const r=n.getAttribute("href");r?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",r),t(r))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),n4=vi({key:"route",get:({get:t})=>{const n=t(gO).split("/").slice(1).filter(Boolean);return WV(n)?t4(n)||t(ut)?n:401:404}}),O1=ft({key:"buttonBlockActive",default:!1}),zn=ft({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{nt(vO)?.focus();break}case"new-password":{nt(bO)?.focus();break}case"username":{nt(SO)?.focus();break}}})}]}),vO=ft({key:"emailInputElement",default:null}),bO=ft({key:"password0InputElement",default:null}),SO=ft({key:"usernameInputElement",default:null});function i4(t){const e=$.useRef(null);return $.useEffect(()=>{De(t,e.current)},[t]),e}const r4=vi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ut);return e?`Code sent to ${e.email}`:""}}),s4=vi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Io);return e?`Code sent to ${e}`:""}});function Ep({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:a,onSubmit:u,onOpen:c,onCancel:f,extraIssues:h}){const m=Et(e),y=Wn(e),g=Et(Fi),b=Wn(Fi),S=Et(Om),x=Wn(Om),T=Et(di),M=Wn(di),C=Et(O1),_=Wn(O1),R=Et(zn),G=Wn(zn),P=Et(n),ee=Et(r4),J=Et(s4),X=i4(r),he=R[0]===t,pe=R.at(-1),[we,...je]=R;return F.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),C){_(!1);return}console.log(`submitted! changing ${t} to`,m);const Z=await u(m);Error.isError(Z)&&console.error(Z)},children:[he?F.jsx("button",{type:"button",onClick:async()=>{await f?.(),G([])},children:"x"}):null,F.jsxs("main",{children:[F.jsxs("label",{htmlFor:t,children:[P||h?F.jsxs("aside",{children:[h,P?.map(be=>F.jsx("span",{children:be.message},be.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":hs(t)}),F.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:X,value:m,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:pe!==t})]}),he?je.map(be=>F.jsxs("label",{htmlFor:`${t}-${be}`,children:[F.jsx("span",{children:(()=>{switch(be){case"otcLogin":return ee;case"otcVerify":return J;case"passwordLogin":return"Password"}})()}),F.jsx("input",{id:`${t}-otc`,type:"text",ref:X,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Z=>{switch(be){case"otcLogin":b(Z.target.value);break;case"otcVerify":if(t==="email"){x(Z.target.value);break}b(Z.target.value);break;case"passwordLogin":M(Z.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==pe})]},`${t}-${be}`)):null]}),R[0]===t?F.jsx("button",{type:"submit",children:"->"}):F.jsx("button",{type:"button",onMouseDown:async()=>{_(!0),await c?.(),G(a)},onMouseUp:()=>{_(!1)},children:"/"})]})}function o4(){const t=Et(ut),e=Et(QV);return $.useEffect(()=>{t&&De(Io,t.email),t?.password&&De(di,"••••••••••••")},[]),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(Ep,{label:"username",inputToken:$o,issuesToken:hO,inputElementToken:SO,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{gi.once("usernameChanged",r),gi.emit("changeUsername",n)}),De(zn,[]),n),extraIssues:e?F.jsx("span",{children:"This username is taken."}):null}),F.jsx(Ep,{label:"email",inputToken:Io,issuesToken:mO,inputElementToken:vO,initialState:["email"],onSubmit:async n=>{const r=nt(zn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:a,nextStep:u}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:a,nextStep:u}),u){case"otc_login":{De(ui,a),De(zn,["email","otcLogin"]);break}case"password_login":{De(ui,a),De(zn,["email","passwordLogin"]);break}case"otc_verify":{De(ui,a),De(Fi,"not needed"),De(zn,["email","otcLogin","otcVerify"]);break}}return a}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const a=nt(ui);if(!a)return new Error("No auth target");const u=nt(Fi),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:a});return De(ut,c),De(zn,["email","otcLogin","otcVerify"]),a}case"passwordLogin":return new Error("not implemented")}break;case 3:{const a=nt(ui);if(!a)return new Error("No auth target");const u=nt(Om),c=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:a});return De(ut,c),De(zn,[]),c.email}}}}),F.jsx(Ep,{label:"new-password",inputToken:di,issuesToken:pO,inputElementToken:bO,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=nt(zn);if(r[0]!=="new-password")return new Error("field not new-password");switch(r.length){case 1:return await cn.setPassword.mutate({password:n}),De(di,"••••••••••••"),De(ut,a=>a&&{...a,password:!0}),De(zn,[]),"done";case 2:{const a=nt(ui);return a?(await cn.verifyAccountAction.mutate({oneTimeCode:nt(Fi),userKey:a}),De(ut,u=>u&&{...u,password:!1}),De(di,""),De(zn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(di,"••••••••••••")},onOpen:async()=>{if(t.password){const n=nt(ui);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):F.jsx("p",{children:"You must be logged in to verify your account."})}function a4(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}const Fy=ft({key:"count",default:0}),wO=kk({key:"incrementTX",do:({set:t})=>{t(Fy,e=>e+1)}}),l4=wM({key:"countContinuity",config:t=>t.add(Fy).add(wO)});function u4({route:[,t]}){return F.jsx("article",{children:t?F.jsx(f4,{gameId:t}):F.jsx(c4,{})})}function c4(){return F.jsx("nav",{children:F.jsx(LE,{href:"/game/clicker",children:"Clicker"})})}Dk(yO[1].game[1]);function f4({gameId:t}){console.log(t);const e=Et(Fy),n=Mk(wO);return kM(l4),F.jsxs("article",{children:[F.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),F.jsx("p",{children:"Let's see how high we can count!"})]})}const xO=$.createContext({});function d4(t){const e=$.useRef(null);return e.current===null&&(e.current=t()),e.current}const Gy=typeof window<"u",h4=Gy?$.useLayoutEffect:$.useEffect,Yy=$.createContext(null);function Jy(t,e){t.indexOf(e)===-1&&t.push(e)}function Xy(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Qi=(t,e,n)=>n>e?e:n<t?t:n;let Zy=()=>{};const Wi={},TO=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function AO(t){return typeof t=="object"&&t!==null}const EO=t=>/^0[^.\s]+$/u.test(t);function Qy(t){let e;return()=>(e===void 0&&(e=t()),e)}const In=t=>t,p4=(t,e)=>n=>e(t(n)),zl=(...t)=>t.reduce(p4),bl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Wy{constructor(){this.subscriptions=[]}add(e){return Jy(this.subscriptions,e),()=>Xy(this.subscriptions,e)}notify(e,n,r){const a=this.subscriptions.length;if(a)if(a===1)this.subscriptions[0](e,n,r);else for(let u=0;u<a;u++){const c=this.subscriptions[u];c&&c(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const pi=t=>t*1e3,qn=t=>t/1e3;function OO(t,e){return e?t*(1e3/e):0}const _O=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,m4=1e-7,y4=12;function g4(t,e,n,r,a){let u,c,f=0;do c=e+(n-e)/2,u=_O(c,r,a)-t,u>0?n=c:e=c;while(Math.abs(u)>m4&&++f<y4);return c}function Ll(t,e,n,r){if(t===e&&n===r)return In;const a=u=>g4(u,0,1,t,n);return u=>u===0||u===1?u:_O(a(u),e,r)}const RO=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,CO=t=>e=>1-t(1-e),kO=Ll(.33,1.53,.69,.99),eg=CO(kO),MO=RO(eg),DO=t=>(t*=2)<1?.5*eg(t):.5*(2-Math.pow(2,-10*(t-1))),tg=t=>1-Math.sin(Math.acos(t)),NO=CO(tg),$O=RO(tg),v4=Ll(.42,0,1,1),b4=Ll(0,0,.58,1),jO=Ll(.42,0,.58,1),S4=t=>Array.isArray(t)&&typeof t[0]!="number",BO=t=>Array.isArray(t)&&typeof t[0]=="number",w4={linear:In,easeIn:v4,easeInOut:jO,easeOut:b4,circIn:tg,circInOut:$O,circOut:NO,backIn:eg,backInOut:MO,backOut:kO,anticipate:DO},x4=t=>typeof t=="string",_1=t=>{if(BO(t)){Zy(t.length===4);const[e,n,r,a]=t;return Ll(e,n,r,a)}else if(x4(t))return w4[t];return t},gc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function T4(t,e){let n=new Set,r=new Set,a=!1,u=!1;const c=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function h(y){c.has(y)&&(m.schedule(y),t()),y(f)}const m={schedule:(y,g=!1,b=!1)=>{const x=b&&a?n:r;return g&&c.add(y),x.has(y)||x.add(y),y},cancel:y=>{r.delete(y),c.delete(y)},process:y=>{if(f=y,a){u=!0;return}a=!0,[n,r]=[r,n],n.forEach(h),n.clear(),a=!1,u&&(u=!1,m.process(y))}};return m}const A4=40;function zO(t,e){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=gc.reduce((R,G)=>(R[G]=T4(u),R),{}),{setup:f,read:h,resolveKeyframes:m,preUpdate:y,update:g,preRender:b,render:S,postRender:x}=c,T=()=>{const R=Wi.useManualTiming?a.timestamp:performance.now();n=!1,Wi.useManualTiming||(a.delta=r?1e3/60:Math.max(Math.min(R-a.timestamp,A4),1)),a.timestamp=R,a.isProcessing=!0,f.process(a),h.process(a),m.process(a),y.process(a),g.process(a),b.process(a),S.process(a),x.process(a),a.isProcessing=!1,n&&e&&(r=!1,t(T))},M=()=>{n=!0,r=!0,a.isProcessing||t(T)};return{schedule:gc.reduce((R,G)=>{const P=c[G];return R[G]=(ee,J=!1,X=!1)=>(n||M(),P.schedule(ee,J,X)),R},{}),cancel:R=>{for(let G=0;G<gc.length;G++)c[gc[G]].cancel(R)},state:a,steps:c}}const{schedule:it,cancel:Vr,state:Ht,steps:Op}=zO(typeof requestAnimationFrame<"u"?requestAnimationFrame:In,!0);let Mc;function E4(){Mc=void 0}const fn={now:()=>(Mc===void 0&&fn.set(Ht.isProcessing||Wi.useManualTiming?Ht.timestamp:performance.now()),Mc),set:t=>{Mc=t,queueMicrotask(E4)}},LO=t=>e=>typeof e=="string"&&e.startsWith(t),ng=LO("--"),O4=LO("var(--"),ig=t=>O4(t)?_4.test(t.split("/*")[0].trim()):!1,_4=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Zo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Sl={...Zo,transform:t=>Qi(0,1,t)},vc={...Zo,default:1},rl=t=>Math.round(t*1e5)/1e5,rg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function R4(t){return t==null}const C4=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,sg=(t,e)=>n=>!!(typeof n=="string"&&C4.test(n)&&n.startsWith(t)||e&&!R4(n)&&Object.prototype.hasOwnProperty.call(n,e)),VO=(t,e,n)=>r=>{if(typeof r!="string")return r;const[a,u,c,f]=r.match(rg);return{[t]:parseFloat(a),[e]:parseFloat(u),[n]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},k4=t=>Qi(0,255,t),_p={...Zo,transform:t=>Math.round(k4(t))},gs={test:sg("rgb","red"),parse:VO("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+_p.transform(t)+", "+_p.transform(e)+", "+_p.transform(n)+", "+rl(Sl.transform(r))+")"};function M4(t){let e="",n="",r="",a="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),a=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),a=t.substring(4,5),e+=e,n+=n,r+=r,a+=a),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:a?parseInt(a,16)/255:1}}const _m={test:sg("#"),parse:M4,transform:gs.transform},Vl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),_r=Vl("deg"),mi=Vl("%"),de=Vl("px"),D4=Vl("vh"),N4=Vl("vw"),R1={...mi,parse:t=>mi.parse(t)/100,transform:t=>mi.transform(t*100)},To={test:sg("hsl","hue"),parse:VO("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+mi.transform(rl(e))+", "+mi.transform(rl(n))+", "+rl(Sl.transform(r))+")"},At={test:t=>gs.test(t)||_m.test(t)||To.test(t),parse:t=>gs.test(t)?gs.parse(t):To.test(t)?To.parse(t):_m.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?gs.transform(t):To.transform(t),getAnimatableNone:t=>{const e=At.parse(t);return e.alpha=0,At.transform(e)}},$4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function j4(t){return isNaN(t)&&typeof t=="string"&&(t.match(rg)?.length||0)+(t.match($4)?.length||0)>0}const UO="number",KO="color",B4="var",z4="var(",C1="${}",L4=/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 wl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},a=[];let u=0;const f=e.replace(L4,h=>(At.test(h)?(r.color.push(u),a.push(KO),n.push(At.parse(h))):h.startsWith(z4)?(r.var.push(u),a.push(B4),n.push(h)):(r.number.push(u),a.push(UO),n.push(parseFloat(h))),++u,C1)).split(C1);return{values:n,split:f,indexes:r,types:a}}function qO(t){return wl(t).values}function IO(t){const{split:e,types:n}=wl(t),r=e.length;return a=>{let u="";for(let c=0;c<r;c++)if(u+=e[c],a[c]!==void 0){const f=n[c];f===UO?u+=rl(a[c]):f===KO?u+=At.transform(a[c]):u+=a[c]}return u}}const V4=t=>typeof t=="number"?0:At.test(t)?At.getAnimatableNone(t):t;function U4(t){const e=qO(t);return IO(t)(e.map(V4))}const Ur={test:j4,parse:qO,createTransformer:IO,getAnimatableNone:U4};function Rp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function K4({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let a=0,u=0,c=0;if(!e)a=u=c=n;else{const f=n<.5?n*(1+e):n+e-n*e,h=2*n-f;a=Rp(h,f,t+1/3),u=Rp(h,f,t),c=Rp(h,f,t-1/3)}return{red:Math.round(a*255),green:Math.round(u*255),blue:Math.round(c*255),alpha:r}}function tf(t,e){return n=>n>0?e:t}const rt=(t,e,n)=>t+(e-t)*n,Cp=(t,e,n)=>{const r=t*t,a=n*(e*e-r)+r;return a<0?0:Math.sqrt(a)},q4=[_m,gs,To],I4=t=>q4.find(e=>e.test(t));function k1(t){const e=I4(t);if(!e)return!1;let n=e.parse(t);return e===To&&(n=K4(n)),n}const M1=(t,e)=>{const n=k1(t),r=k1(e);if(!n||!r)return tf(t,e);const a={...n};return u=>(a.red=Cp(n.red,r.red,u),a.green=Cp(n.green,r.green,u),a.blue=Cp(n.blue,r.blue,u),a.alpha=rt(n.alpha,r.alpha,u),gs.transform(a))},Rm=new Set(["none","hidden"]);function P4(t,e){return Rm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function H4(t,e){return n=>rt(t,e,n)}function og(t){return typeof t=="number"?H4:typeof t=="string"?ig(t)?tf:At.test(t)?M1:Y4:Array.isArray(t)?PO:typeof t=="object"?At.test(t)?M1:F4:tf}function PO(t,e){const n=[...t],r=n.length,a=t.map((u,c)=>og(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=a[c](u);return n}}function F4(t,e){const n={...t,...e},r={};for(const a in n)t[a]!==void 0&&e[a]!==void 0&&(r[a]=og(t[a])(t[a],e[a]));return a=>{for(const u in r)n[u]=r[u](a);return n}}function G4(t,e){const n=[],r={color:0,var:0,number:0};for(let a=0;a<e.values.length;a++){const u=e.types[a],c=t.indexes[u][r[u]],f=t.values[c]??0;n[a]=f,r[u]++}return n}const Y4=(t,e)=>{const n=Ur.createTransformer(e),r=wl(t),a=wl(e);return r.indexes.var.length===a.indexes.var.length&&r.indexes.color.length===a.indexes.color.length&&r.indexes.number.length>=a.indexes.number.length?Rm.has(t)&&!a.values.length||Rm.has(e)&&!r.values.length?P4(t,e):zl(PO(G4(r,a),a.values),n):tf(t,e)};function HO(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?rt(t,e,n):og(t)(t,e)}const J4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>it.update(e,n),stop:()=>Vr(e),now:()=>Ht.isProcessing?Ht.timestamp:fn.now()}},FO=(t,e,n=10)=>{let r="";const a=Math.max(Math.round(e/n),2);for(let u=0;u<a;u++)r+=Math.round(t(u/(a-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},nf=2e4;function ag(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<nf;)e+=n,r=t.next(e);return e>=nf?1/0:e}function X4(t,e=100,n){const r=n({...t,keyframes:[0,e]}),a=Math.min(ag(r),nf);return{type:"keyframes",ease:u=>r.next(a*u).value/e,duration:qn(a)}}const Z4=5;function GO(t,e,n){const r=Math.max(e-Z4,0);return OO(n-t(r),e-r)}const lt={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},kp=.001;function Q4({duration:t=lt.duration,bounce:e=lt.bounce,velocity:n=lt.velocity,mass:r=lt.mass}){let a,u,c=1-e;c=Qi(lt.minDamping,lt.maxDamping,c),t=Qi(lt.minDuration,lt.maxDuration,qn(t)),c<1?(a=m=>{const y=m*c,g=y*t,b=y-n,S=Cm(m,c),x=Math.exp(-g);return kp-b/S*x},u=m=>{const g=m*c*t,b=g*n+n,S=Math.pow(c,2)*Math.pow(m,2)*t,x=Math.exp(-g),T=Cm(Math.pow(m,2),c);return(-a(m)+kp>0?-1:1)*((b-S)*x)/T}):(a=m=>{const y=Math.exp(-m*t),g=(m-n)*t+1;return-kp+y*g},u=m=>{const y=Math.exp(-m*t),g=(n-m)*(t*t);return y*g});const f=5/t,h=eU(a,u,f);if(t=pi(t),isNaN(h))return{stiffness:lt.stiffness,damping:lt.damping,duration:t};{const m=Math.pow(h,2)*r;return{stiffness:m,damping:c*2*Math.sqrt(r*m),duration:t}}}const W4=12;function eU(t,e,n){let r=n;for(let a=1;a<W4;a++)r=r-t(r)/e(r);return r}function Cm(t,e){return t*Math.sqrt(1-e*e)}const tU=["duration","bounce"],nU=["stiffness","damping","mass"];function D1(t,e){return e.some(n=>t[n]!==void 0)}function iU(t){let e={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...t};if(!D1(t,nU)&&D1(t,tU))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),a=r*r,u=2*Qi(.05,1,1-(t.bounce||0))*Math.sqrt(a);e={...e,mass:lt.mass,stiffness:a,damping:u}}else{const n=Q4(t);e={...e,...n,mass:lt.mass},e.isResolvedFromDuration=!0}return e}function rf(t=lt.visualDuration,e=lt.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:a}=n;const u=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],f={done:!1,value:u},{stiffness:h,damping:m,mass:y,duration:g,velocity:b,isResolvedFromDuration:S}=iU({...n,velocity:-qn(n.velocity||0)}),x=b||0,T=m/(2*Math.sqrt(h*y)),M=c-u,C=qn(Math.sqrt(h/y)),_=Math.abs(M)<5;r||(r=_?lt.restSpeed.granular:lt.restSpeed.default),a||(a=_?lt.restDelta.granular:lt.restDelta.default);let R;if(T<1){const P=Cm(C,T);R=ee=>{const J=Math.exp(-T*C*ee);return c-J*((x+T*C*M)/P*Math.sin(P*ee)+M*Math.cos(P*ee))}}else if(T===1)R=P=>c-Math.exp(-C*P)*(M+(x+C*M)*P);else{const P=C*Math.sqrt(T*T-1);R=ee=>{const J=Math.exp(-T*C*ee),X=Math.min(P*ee,300);return c-J*((x+T*C*M)*Math.sinh(X)+P*M*Math.cosh(X))/P}}const G={calculatedDuration:S&&g||null,next:P=>{const ee=R(P);if(S)f.done=P>=g;else{let J=P===0?x:0;T<1&&(J=P===0?pi(x):GO(R,P,ee));const X=Math.abs(J)<=r,he=Math.abs(c-ee)<=a;f.done=X&&he}return f.value=f.done?c:ee,f},toString:()=>{const P=Math.min(ag(G),nf),ee=FO(J=>G.next(P*J).value,P,30);return P+"ms "+ee},toTransition:()=>{}};return G}rf.applyToOptions=t=>{const e=X4(t,100,rf);return t.ease=e.ease,t.duration=pi(e.duration),t.type="keyframes",t};function km({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:a=10,bounceStiffness:u=500,modifyTarget:c,min:f,max:h,restDelta:m=.5,restSpeed:y}){const g=t[0],b={done:!1,value:g},S=X=>f!==void 0&&X<f||h!==void 0&&X>h,x=X=>f===void 0?h:h===void 0||Math.abs(f-X)<Math.abs(h-X)?f:h;let T=n*e;const M=g+T,C=c===void 0?M:c(M);C!==M&&(T=C-g);const _=X=>-T*Math.exp(-X/r),R=X=>C+_(X),G=X=>{const he=_(X),pe=R(X);b.done=Math.abs(he)<=m,b.value=b.done?C:pe};let P,ee;const J=X=>{S(b.value)&&(P=X,ee=rf({keyframes:[b.value,x(b.value)],velocity:GO(R,X,b.value),damping:a,stiffness:u,restDelta:m,restSpeed:y}))};return J(0),{calculatedDuration:null,next:X=>{let he=!1;return!ee&&P===void 0&&(he=!0,G(X),J(X)),P!==void 0&&X>=P?ee.next(X-P):(!he&&G(X),b)}}}function rU(t,e,n){const r=[],a=n||Wi.mix||HO,u=t.length-1;for(let c=0;c<u;c++){let f=a(t[c],t[c+1]);if(e){const h=Array.isArray(e)?e[c]||In:e;f=zl(h,f)}r.push(f)}return r}function sU(t,e,{clamp:n=!0,ease:r,mixer:a}={}){const u=t.length;if(Zy(u===e.length),u===1)return()=>e[0];if(u===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[u-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=rU(e,r,a),h=f.length,m=y=>{if(c&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const b=bl(t[g],t[g+1],y);return f[g](b)};return n?y=>m(Qi(t[0],t[u-1],y)):m}function oU(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const a=bl(0,e,r);t.push(rt(n,1,a))}}function aU(t){const e=[0];return oU(e,t.length-1),e}function lU(t,e){return t.map(n=>n*e)}function uU(t,e){return t.map(()=>e||jO).splice(0,t.length-1)}function sl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const a=S4(r)?r.map(_1):_1(r),u={done:!1,value:e[0]},c=lU(n&&n.length===e.length?n:aU(e),t),f=sU(c,e,{ease:Array.isArray(a)?a:uU(e,a)});return{calculatedDuration:t,next:h=>(u.value=f(h),u.done=h>=t,u)}}const cU=t=>t!==null;function lg(t,{repeat:e,repeatType:n="loop"},r,a=1){const u=t.filter(cU),f=a<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const fU={decay:km,inertia:km,tween:sl,keyframes:sl,spring:rf};function YO(t){typeof t.type=="string"&&(t.type=fU[t.type])}class ug{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const dU=t=>t/100;class cg extends ug{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==fn.now()&&this.tick(fn.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;YO(e);const{type:n=sl,repeat:r=0,repeatDelay:a=0,repeatType:u,velocity:c=0}=e;let{keyframes:f}=e;const h=n||sl;h!==sl&&typeof f[0]!="number"&&(this.mixKeyframes=zl(dU,HO(f[0],f[1])),f=[0,100]);const m=h({...e,keyframes:f});u==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...f].reverse(),velocity:-c})),m.calculatedDuration===null&&(m.calculatedDuration=ag(m));const{calculatedDuration:y}=m;this.calculatedDuration=y,this.resolvedDuration=y+a,this.totalDuration=this.resolvedDuration*(r+1)-a,this.generator=m}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:a,mixKeyframes:u,mirroredGenerator:c,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:m=0,keyframes:y,repeat:g,repeatType:b,repeatDelay:S,type:x,onUpdate:T,finalKeyframe:M}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-a/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const C=this.currentTime-m*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?C<0:C>a;this.currentTime=Math.max(C,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=a);let R=this.currentTime,G=r;if(g){const X=Math.min(this.currentTime,a)/f;let he=Math.floor(X),pe=X%1;!pe&&X>=1&&(pe=1),pe===1&&he--,he=Math.min(he,g+1),!!(he%2)&&(b==="reverse"?(pe=1-pe,S&&(pe-=S/f)):b==="mirror"&&(G=c)),R=Qi(0,1,pe)*f}const P=_?{done:!1,value:y[0]}:G.next(R);u&&(P.value=u(P.value));let{done:ee}=P;!_&&h!==null&&(ee=this.playbackSpeed>=0?this.currentTime>=a:this.currentTime<=0);const J=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&ee);return J&&x!==km&&(P.value=lg(y,this.options,M,this.speed)),T&&T(P.value),J&&this.finish(),P}then(e,n){return this.finished.then(e,n)}get duration(){return qn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+qn(e)}get time(){return qn(this.currentTime)}set time(e){e=pi(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(fn.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=qn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=J4,startTime:n}=this.options;this.driver||(this.driver=e(a=>this.tick(a))),this.options.onPlay?.();const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(fn.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function hU(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const vs=t=>t*180/Math.PI,Mm=t=>{const e=vs(Math.atan2(t[1],t[0]));return Dm(e)},pU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Mm,rotateZ:Mm,skewX:t=>vs(Math.atan(t[1])),skewY:t=>vs(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Dm=t=>(t=t%360,t<0&&(t+=360),t),N1=Mm,$1=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),j1=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),mU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:$1,scaleY:j1,scale:t=>($1(t)+j1(t))/2,rotateX:t=>Dm(vs(Math.atan2(t[6],t[5]))),rotateY:t=>Dm(vs(Math.atan2(-t[2],t[0]))),rotateZ:N1,rotate:N1,skewX:t=>vs(Math.atan(t[4])),skewY:t=>vs(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Nm(t){return t.includes("scale")?1:0}function $m(t,e){if(!t||t==="none")return Nm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=mU,a=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=pU,a=f}if(!a)return Nm(e);const u=r[e],c=a[1].split(",").map(gU);return typeof u=="function"?u(c):c[u]}const yU=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return $m(n,e)};function gU(t){return parseFloat(t.trim())}const Qo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Wo=new Set(Qo),B1=t=>t===Zo||t===de,vU=new Set(["x","y","z"]),bU=Qo.filter(t=>!vU.has(t));function SU(t){const e=[];return bU.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const ws={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>$m(e,"x"),y:(t,{transform:e})=>$m(e,"y")};ws.translateX=ws.x;ws.translateY=ws.y;const xs=new Set;let jm=!1,Bm=!1,zm=!1;function JO(){if(Bm){const t=Array.from(xs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const a=SU(r);a.length&&(n.set(r,a),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const a=n.get(r);a&&a.forEach(([u,c])=>{r.getValue(u)?.set(c)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Bm=!1,jm=!1,xs.forEach(t=>t.complete(zm)),xs.clear()}function XO(){xs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Bm=!0)})}function wU(){zm=!0,XO(),JO(),zm=!1}class fg{constructor(e,n,r,a,u,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=a,this.element=u,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(xs.add(this),jm||(jm=!0,it.read(XO),it.resolveKeyframes(JO))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:a}=this;if(e[0]===null){const u=a?.get(),c=e[e.length-1];if(u!==void 0)e[0]=u;else if(r&&n){const f=r.readValue(n,c);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=c),a&&u===void 0&&a.set(e[0])}hU(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),xs.delete(this)}cancel(){this.state==="scheduled"&&(xs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const xU=t=>t.startsWith("--");function TU(t,e,n){xU(e)?t.style.setProperty(e,n):t.style[e]=n}const AU=Qy(()=>window.ScrollTimeline!==void 0),EU={};function OU(t,e){const n=Qy(t);return()=>EU[e]??n()}const ZO=OU(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,z1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function QO(t,e){if(t)return typeof t=="function"?ZO()?FO(t,e):"ease-out":BO(t)?el(t):Array.isArray(t)?t.map(n=>QO(n,e)||z1.easeOut):z1[t]}function _U(t,e,n,{delay:r=0,duration:a=300,repeat:u=0,repeatType:c="loop",ease:f="easeOut",times:h}={},m=void 0){const y={[e]:n};h&&(y.offset=h);const g=QO(f,a);Array.isArray(g)&&(y.easing=g);const b={delay:r,duration:a,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:u+1,direction:c==="reverse"?"alternate":"normal"};return m&&(b.pseudoElement=m),t.animate(y,b)}function WO(t){return typeof t=="function"&&"applyToOptions"in t}function RU({type:t,...e}){return WO(t)&&ZO()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class CU extends ug{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:a,pseudoElement:u,allowFlatten:c=!1,finalKeyframe:f,onComplete:h}=e;this.isPseudoElement=!!u,this.allowFlatten=c,this.options=e,Zy(typeof e.type!="string");const m=RU(e);this.animation=_U(n,r,a,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=lg(a,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):TU(n,r,y),this.animation.cancel()}h?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return qn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+qn(e)}get time(){return qn(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=pi(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(e){this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&AU()?(this.animation.timeline=e,In):n(this)}}const e_={anticipate:DO,backInOut:MO,circInOut:$O};function kU(t){return t in e_}function MU(t){typeof t.ease=="string"&&kU(t.ease)&&(t.ease=e_[t.ease])}const L1=10;class DU extends CU{constructor(e){MU(e),YO(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:a,element:u,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const f=new cg({...c,autoplay:!1}),h=pi(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-L1).value,f.sample(h).value,L1),f.stop()}}const V1=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ur.test(t)||t==="0")&&!t.startsWith("url("));function NU(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function $U(t,e,n,r){const a=t[0];if(a===null)return!1;if(e==="display"||e==="visibility")return!0;const u=t[t.length-1],c=V1(a,e),f=V1(u,e);return!c||!f?!1:NU(t)||(n==="spring"||WO(n))&&r}function Lm(t){t.duration=0,t.type="keyframes"}const jU=new Set(["opacity","clipPath","filter","transform"]),BU=Qy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function zU(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:a,damping:u,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:m}=e.owner.getProps();return BU()&&n&&jU.has(n)&&(n!=="transform"||!m)&&!h&&!r&&a!=="mirror"&&u!==0&&c!=="inertia"}const LU=40;class VU extends ug{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:a=0,repeatDelay:u=0,repeatType:c="loop",keyframes:f,name:h,motionValue:m,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=fn.now();const b={autoplay:e,delay:n,type:r,repeat:a,repeatDelay:u,repeatType:c,name:h,motionValue:m,element:y,...g},S=y?.KeyframeResolver||fg;this.keyframeResolver=new S(f,(x,T,M)=>this.onKeyframesResolved(x,T,b,!M),h,m,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,a){this.keyframeResolver=void 0;const{name:u,type:c,velocity:f,delay:h,isHandoff:m,onUpdate:y}=r;this.resolvedAt=fn.now(),$U(e,u,c,f)||((Wi.instantAnimations||!h)&&y?.(lg(e,r,n)),e[0]=e[e.length-1],Lm(r),r.repeat=0);const b={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>LU?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!m&&zU(b)?new DU({...b,element:b.motionValue.owner.current}):new cg(b);S.finished.then(()=>this.notifyFinished()).catch(In),this.pendingTimeline&&(this.stopTimeline=S.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=S}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),wU()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const UU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function KU(t){const e=UU.exec(t);if(!e)return[,];const[,n,r,a]=e;return[`--${n??r}`,a]}function t_(t,e,n=1){const[r,a]=KU(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return TO(c)?parseFloat(c):c}return ig(a)?t_(a,e,n+1):a}function dg(t,e){return t?.[e]??t?.default??t}const n_=new Set(["width","height","top","left","right","bottom",...Qo]),qU={test:t=>t==="auto",parse:t=>t},i_=t=>e=>e.test(t),r_=[Zo,de,mi,_r,N4,D4,qU],U1=t=>r_.find(i_(t));function IU(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||EO(t):!0}const PU=new Set(["brightness","contrast","saturate","opacity"]);function HU(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(rg)||[];if(!r)return t;const a=n.replace(r,"");let u=PU.has(e)?1:0;return r!==n&&(u*=100),e+"("+u+a+")"}const FU=/\b([a-z-]*)\(.*?\)/gu,Vm={...Ur,getAnimatableNone:t=>{const e=t.match(FU);return e?e.map(HU).join(" "):t}},K1={...Zo,transform:Math.round},GU={rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:vc,scaleX:vc,scaleY:vc,scaleZ:vc,skew:_r,skewX:_r,skewY:_r,distance:de,translateX:de,translateY:de,translateZ:de,x:de,y:de,z:de,perspective:de,transformPerspective:de,opacity:Sl,originX:R1,originY:R1,originZ:de},hg={borderWidth:de,borderTopWidth:de,borderRightWidth:de,borderBottomWidth:de,borderLeftWidth:de,borderRadius:de,radius:de,borderTopLeftRadius:de,borderTopRightRadius:de,borderBottomRightRadius:de,borderBottomLeftRadius:de,width:de,maxWidth:de,height:de,maxHeight:de,top:de,right:de,bottom:de,left:de,padding:de,paddingTop:de,paddingRight:de,paddingBottom:de,paddingLeft:de,margin:de,marginTop:de,marginRight:de,marginBottom:de,marginLeft:de,backgroundPositionX:de,backgroundPositionY:de,...GU,zIndex:K1,fillOpacity:Sl,strokeOpacity:Sl,numOctaves:K1},YU={...hg,color:At,backgroundColor:At,outlineColor:At,fill:At,stroke:At,borderColor:At,borderTopColor:At,borderRightColor:At,borderBottomColor:At,borderLeftColor:At,filter:Vm,WebkitFilter:Vm},s_=t=>YU[t];function o_(t,e){let n=s_(t);return n!==Vm&&(n=Ur),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const JU=new Set(["auto","none","0"]);function XU(t,e,n){let r=0,a;for(;r<t.length&&!a;){const u=t[r];typeof u=="string"&&!JU.has(u)&&wl(u).values.length&&(a=t[r]),r++}if(a&&n)for(const u of e)t[u]=o_(n,a)}class ZU extends fg{constructor(e,n,r,a,u){super(e,n,r,a,u,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let h=0;h<e.length;h++){let m=e[h];if(typeof m=="string"&&(m=m.trim(),ig(m))){const y=t_(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!n_.has(r)||e.length!==2)return;const[a,u]=e,c=U1(a),f=U1(u);if(c!==f)if(B1(c)&&B1(f))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else ws[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let a=0;a<e.length;a++)(e[a]===null||IU(e[a]))&&r.push(a);r.length&&XU(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=ws[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const a=n[n.length-1];a!==void 0&&e.getValue(r,a).jump(a,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const a=e.getValue(n);a&&a.jump(this.measuredOrigin,!1);const u=r.length-1,c=r[u];r[u]=ws[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,h])=>{e.getValue(f).set(h)}),this.resolveNoneKeyframes()}}function QU(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const a=n?.[t]??r.querySelectorAll(t);return a?Array.from(a):[]}return Array.from(t)}const a_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function WU(t){return AO(t)&&"offsetHeight"in t}const q1=30,eK=t=>!isNaN(parseFloat(t));class tK{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const a=fn.now();if(this.updatedAt!==a&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const u of this.dependents)u.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=fn.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=eK(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Wy);const r=this.events[e].add(n);return e==="change"?()=>{r(),it.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=fn.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>q1)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,q1);return OO(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),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.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Po(t,e){return new tK(t,e)}const{schedule:pg}=zO(queueMicrotask,!1),Zn={x:!1,y:!1};function l_(){return Zn.x||Zn.y}function nK(t){return t==="x"||t==="y"?Zn[t]?null:(Zn[t]=!0,()=>{Zn[t]=!1}):Zn.x||Zn.y?null:(Zn.x=Zn.y=!0,()=>{Zn.x=Zn.y=!1})}function u_(t,e){const n=QU(t),r=new AbortController,a={passive:!0,...e,signal:r.signal};return[n,a,()=>r.abort()]}function I1(t){return!(t.pointerType==="touch"||l_())}function iK(t,e,n={}){const[r,a,u]=u_(t,n),c=f=>{if(!I1(f))return;const{target:h}=f,m=e(h,f);if(typeof m!="function"||!h)return;const y=g=>{I1(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,a)};return r.forEach(f=>{f.addEventListener("pointerenter",c,a)}),u}const c_=(t,e)=>e?t===e?!0:c_(t,e.parentElement):!1,mg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,rK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function sK(t){return rK.has(t.tagName)||t.tabIndex!==-1}const Dc=new WeakSet;function P1(t){return e=>{e.key==="Enter"&&t(e)}}function Mp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const oK=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=P1(()=>{if(Dc.has(n))return;Mp(n,"down");const a=P1(()=>{Mp(n,"up")}),u=()=>Mp(n,"cancel");n.addEventListener("keyup",a,e),n.addEventListener("blur",u,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function H1(t){return mg(t)&&!l_()}function aK(t,e,n={}){const[r,a,u]=u_(t,n),c=f=>{const h=f.currentTarget;if(!H1(f))return;Dc.add(h);const m=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Dc.has(h)&&Dc.delete(h),H1(S)&&typeof m=="function"&&m(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||c_(h,S.target))},b=S=>{y(S,!1)};window.addEventListener("pointerup",g,a),window.addEventListener("pointercancel",b,a)};return r.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",c,a),WU(f)&&(f.addEventListener("focus",m=>oK(m,a)),!sK(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function f_(t){return AO(t)&&"ownerSVGElement"in t}function lK(t){return f_(t)&&t.tagName==="svg"}const Jt=t=>!!(t&&t.getVelocity),uK=[...r_,At,Ur],cK=t=>uK.find(i_(t)),d_=$.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function fK(t=!0){const e=$.useContext(Yy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:a}=e,u=$.useId();$.useEffect(()=>{if(t)return a(u)},[t]);const c=$.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const h_=$.createContext({strict:!1}),F1={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"]},Ho={};for(const t in F1)Ho[t]={isEnabled:e=>F1[t].some(n=>!!e[n])};function dK(t){for(const e in t)Ho[e]={...Ho[e],...t[e]}}const hK=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 sf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||hK.has(t)}let p_=t=>!sf(t);function pK(t){typeof t=="function"&&(p_=e=>e.startsWith("on")?!sf(e):t(e))}try{pK(require("@emotion/is-prop-valid").default)}catch{}function mK(t,e,n){const r={};for(const a in t)a==="values"&&typeof t.values=="object"||(p_(a)||n===!0&&sf(a)||!e&&!sf(a)||t.draggable&&a.startsWith("onDrag"))&&(r[a]=t[a]);return r}const $f=$.createContext({});function jf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function xl(t){return typeof t=="string"||Array.isArray(t)}const yg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],gg=["initial",...yg];function Bf(t){return jf(t.animate)||gg.some(e=>xl(t[e]))}function m_(t){return!!(Bf(t)||t.variants)}function yK(t,e){if(Bf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||xl(n)?n:void 0,animate:xl(r)?r:void 0}}return t.inherit!==!1?e:{}}function gK(t){const{initial:e,animate:n}=yK(t,$.useContext($f));return $.useMemo(()=>({initial:e,animate:n}),[G1(e),G1(n)])}function G1(t){return Array.isArray(t)?t.join(" "):t}const Tl={};function vK(t){for(const e in t)Tl[e]=t[e],ng(e)&&(Tl[e].isCSSVariable=!0)}function y_(t,{layout:e,layoutId:n}){return Wo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Tl[t]||t==="opacity")}const bK={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},SK=Qo.length;function wK(t,e,n){let r="",a=!0;for(let u=0;u<SK;u++){const c=Qo[u],f=t[c];if(f===void 0)continue;let h=!0;if(typeof f=="number"?h=f===(c.startsWith("scale")?1:0):h=parseFloat(f)===0,!h||n){const m=a_(f,hg[c]);if(!h){a=!1;const y=bK[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,a?"":r):a&&(r="none"),r}function vg(t,e,n){const{style:r,vars:a,transformOrigin:u}=t;let c=!1,f=!1;for(const h in e){const m=e[h];if(Wo.has(h)){c=!0;continue}else if(ng(h)){a[h]=m;continue}else{const y=a_(m,hg[h]);h.startsWith("origin")?(f=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=wK(e,t.transform,n):r.transform&&(r.transform="none")),f){const{originX:h="50%",originY:m="50%",originZ:y=0}=u;r.transformOrigin=`${h} ${m} ${y}`}}const bg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function g_(t,e,n){for(const r in e)!Jt(e[r])&&!y_(r,n)&&(t[r]=e[r])}function xK({transformTemplate:t},e){return $.useMemo(()=>{const n=bg();return vg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function TK(t,e){const n=t.style||{},r={};return g_(r,n,t),Object.assign(r,xK(t,e)),r}function AK(t,e){const n={},r=TK(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const EK={offset:"stroke-dashoffset",array:"stroke-dasharray"},OK={offset:"strokeDashoffset",array:"strokeDasharray"};function _K(t,e,n=1,r=0,a=!0){t.pathLength=1;const u=a?EK:OK;t[u.offset]=de.transform(-r);const c=de.transform(e),f=de.transform(n);t[u.array]=`${c} ${f}`}function v_(t,{attrX:e,attrY:n,attrScale:r,pathLength:a,pathSpacing:u=1,pathOffset:c=0,...f},h,m,y){if(vg(t,f,m),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:b}=t;g.transform&&(b.transform=g.transform,delete g.transform),(b.transform||g.transformOrigin)&&(b.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),b.transform&&(b.transformBox=y?.transformBox??"fill-box",delete g.transformBox),e!==void 0&&(g.x=e),n!==void 0&&(g.y=n),r!==void 0&&(g.scale=r),a!==void 0&&_K(g,a,u,c,!1)}const b_=()=>({...bg(),attrs:{}}),S_=t=>typeof t=="string"&&t.toLowerCase()==="svg";function RK(t,e,n,r){const a=$.useMemo(()=>{const u=b_();return v_(u,e,S_(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};g_(u,t.style,t),a.style={...u,...a.style}}return a}const CK=["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 Sg(t){return typeof t!="string"||t.includes("-")?!1:!!(CK.indexOf(t)>-1||/[A-Z]/u.test(t))}function kK(t,e,n,{latestValues:r},a,u=!1){const f=(Sg(t)?RK:AK)(e,r,a,t),h=mK(e,typeof t=="string",u),m=t!==$.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=$.useMemo(()=>Jt(y)?y.get():y,[y]);return $.createElement(t,{...m,children:g})}function Y1(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function wg(t,e,n,r){if(typeof e=="function"){const[a,u]=Y1(r);e=e(n!==void 0?n:t.custom,a,u)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[a,u]=Y1(r);e=e(n!==void 0?n:t.custom,a,u)}return e}function Nc(t){return Jt(t)?t.get():t}function MK({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,a){return{latestValues:DK(n,r,a,t),renderState:e()}}function DK(t,e,n,r){const a={},u=r(t,{});for(const b in u)a[b]=Nc(u[b]);let{initial:c,animate:f}=t;const h=Bf(t),m=m_(t);e&&m&&!h&&t.inherit!==!1&&(c===void 0&&(c=e.initial),f===void 0&&(f=e.animate));let y=n?n.initial===!1:!1;y=y||c===!1;const g=y?f:c;if(g&&typeof g!="boolean"&&!jf(g)){const b=Array.isArray(g)?g:[g];for(let S=0;S<b.length;S++){const x=wg(t,b[S]);if(x){const{transitionEnd:T,transition:M,...C}=x;for(const _ in C){let R=C[_];if(Array.isArray(R)){const G=y?R.length-1:0;R=R[G]}R!==null&&(a[_]=R)}for(const _ in T)a[_]=T[_]}}}return a}const w_=t=>(e,n)=>{const r=$.useContext($f),a=$.useContext(Yy),u=()=>MK(t,e,r,a);return n?u():d4(u)};function xg(t,e,n){const{style:r}=t,a={};for(const u in r)(Jt(r[u])||e.style&&Jt(e.style[u])||y_(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(a[u]=r[u]);return a}const NK=w_({scrapeMotionValuesFromProps:xg,createRenderState:bg});function x_(t,e,n){const r=xg(t,e,n);for(const a in t)if(Jt(t[a])||Jt(e[a])){const u=Qo.indexOf(a)!==-1?"attr"+a.charAt(0).toUpperCase()+a.substring(1):a;r[u]=t[a]}return r}const $K=w_({scrapeMotionValuesFromProps:x_,createRenderState:b_}),jK=Symbol.for("motionComponentSymbol");function Ao(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function BK(t,e,n){return $.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):Ao(n)&&(n.current=r))},[e])}const Tg=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),zK="framerAppearId",T_="data-"+Tg(zK),A_=$.createContext({});function LK(t,e,n,r,a){const{visualElement:u}=$.useContext($f),c=$.useContext(h_),f=$.useContext(Yy),h=$.useContext(d_).reducedMotion,m=$.useRef(null);r=r||c.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:u,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:h}));const y=m.current,g=$.useContext(A_);y&&!y.projection&&a&&(y.type==="html"||y.type==="svg")&&VK(m.current,n,a,g);const b=$.useRef(!1);$.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const S=n[T_],x=$.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return h4(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),$.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function VK(t,e,n,r){const{layoutId:a,layout:u,drag:c,dragConstraints:f,layoutScroll:h,layoutRoot:m,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:E_(t.parent)),t.projection.setOptions({layoutId:a,layout:u,alwaysMeasureLayout:!!c||f&&Ao(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function E_(t){if(t)return t.options.allowProjection!==!1?t.projection:E_(t.parent)}function Dp(t,{forwardMotionProps:e=!1}={},n,r){n&&dK(n);const a=Sg(t)?$K:NK;function u(f,h){let m;const y={...$.useContext(d_),...f,layoutId:UK(f)},{isStatic:g}=y,b=gK(f),S=a(f,g);if(!g&&Gy){KK();const x=qK(y);m=x.MeasureLayout,b.visualElement=LK(t,S,y,r,x.ProjectionNode)}return F.jsxs($f.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,kK(t,f,BK(S,b.visualElement,h),S,g,e)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=$.forwardRef(u);return c[jK]=t,c}function UK({layoutId:t}){const e=$.useContext(xO).id;return e&&t!==void 0?e+"-"+t:t}function KK(t,e){$.useContext(h_).strict}function qK(t){const{drag:e,layout:n}=Ho;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function IK(t,e){if(typeof Proxy>"u")return Dp;const n=new Map,r=(u,c)=>Dp(u,c,t,e),a=(u,c)=>r(u,c);return new Proxy(a,{get:(u,c)=>c==="create"?r:(n.has(c)||n.set(c,Dp(c,void 0,t,e)),n.get(c))})}function O_({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function PK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function HK(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Np(t){return t===void 0||t===1}function Um({scale:t,scaleX:e,scaleY:n}){return!Np(t)||!Np(e)||!Np(n)}function ms(t){return Um(t)||__(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function __(t){return J1(t.x)||J1(t.y)}function J1(t){return t&&t!=="0%"}function of(t,e,n){const r=t-n,a=e*r;return n+a}function X1(t,e,n,r,a){return a!==void 0&&(t=of(t,a,r)),of(t,n,r)+e}function Km(t,e=0,n=1,r,a){t.min=X1(t.min,e,n,r,a),t.max=X1(t.max,e,n,r,a)}function R_(t,{x:e,y:n}){Km(t.x,e.translate,e.scale,e.originPoint),Km(t.y,n.translate,n.scale,n.originPoint)}const Z1=.999999999999,Q1=1.0000000000001;function FK(t,e,n,r=!1){const a=n.length;if(!a)return;e.x=e.y=1;let u,c;for(let f=0;f<a;f++){u=n[f],c=u.projectionDelta;const{visualElement:h}=u.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&u.options.layoutScroll&&u.scroll&&u!==u.root&&Oo(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,R_(t,c)),r&&ms(u.latestValues)&&Oo(t,u.latestValues))}e.x<Q1&&e.x>Z1&&(e.x=1),e.y<Q1&&e.y>Z1&&(e.y=1)}function Eo(t,e){t.min=t.min+e,t.max=t.max+e}function W1(t,e,n,r,a=.5){const u=rt(t.min,t.max,a);Km(t,e,n,u,r)}function Oo(t,e){W1(t.x,e.x,e.scaleX,e.scale,e.originX),W1(t.y,e.y,e.scaleY,e.scale,e.originY)}function C_(t,e){return O_(HK(t.getBoundingClientRect(),e))}function GK(t,e,n){const r=C_(t,n),{scroll:a}=e;return a&&(Eo(r.x,a.offset.x),Eo(r.y,a.offset.y)),r}const ex=()=>({translate:0,scale:1,origin:0,originPoint:0}),_o=()=>({x:ex(),y:ex()}),tx=()=>({min:0,max:0}),yt=()=>({x:tx(),y:tx()}),qm={current:null},k_={current:!1};function YK(){if(k_.current=!0,!!Gy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>qm.current=t.matches;t.addEventListener("change",e),e()}else qm.current=!1}const JK=new WeakMap;function XK(t,e,n){for(const r in e){const a=e[r],u=n[r];if(Jt(a))t.addValue(r,a);else if(Jt(u))t.addValue(r,Po(a,{owner:t}));else if(u!==a)if(t.hasValue(r)){const c=t.getValue(r);c.liveStyle===!0?c.jump(a):c.hasAnimated||c.set(a)}else{const c=t.getStaticValue(r);t.addValue(r,Po(c!==void 0?c:a,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const nx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class ZK{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:a,blockInitialAnimation:u,visualState:c},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=fg,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.renderScheduledAt=0,this.scheduleRender=()=>{const b=fn.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,it.render(this.render,!1,!0))};const{latestValues:h,renderState:m}=c;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=m,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=a,this.options=f,this.blockInitialAnimation=!!u,this.isControllingVariants=Bf(n),this.isVariantNode=m_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in g){const S=g[b];h[b]!==void 0&&Jt(S)&&S.set(h[b])}}mount(e){this.current=e,JK.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((n,r)=>this.bindToMotionValue(r,n)),k_.current||YK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:qm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Vr(this.notifyUpdate),Vr(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();const r=Wo.has(e);r&&this.onBindTransform&&this.onBindTransform();const a=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&it.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let u;window.MotionCheckAppearSync&&(u=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{a(),u&&u(),n.owner&&n.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 Ho){const n=Ho[e];if(!n)continue;const{isEnabled:r,Feature:a}=n;if(!this.features[e]&&a&&r(this.props)&&(this.features[e]=new a(this)),this.features[e]){const u=this.features[e];u.isMounted?u.update():(u.mount(),u.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):yt()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<nx.length;r++){const a=nx[r];this.propEventSubscriptions[a]&&(this.propEventSubscriptions[a](),delete this.propEventSubscriptions[a]);const u="on"+a,c=e[u];c&&(this.propEventSubscriptions[a]=this.on(a,c))}this.prevMotionValues=XK(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}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=Po(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(TO(r)||EO(r))?r=parseFloat(r):!cK(r)&&Ur.test(n)&&(r=o_(e,n)),this.setBaseTarget(e,Jt(r)?r.get():r)),Jt(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const u=wg(this.props,n,this.presenceContext?.custom);u&&(r=u[e])}if(n&&r!==void 0)return r;const a=this.getBaseTargetFromProps(this.props,e);return a!==void 0&&!Jt(a)?a:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Wy),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){pg.render(this.render)}}class M_ extends ZK{constructor(){super(...arguments),this.KeyframeResolver=ZU}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){return e.style?e.style[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Jt(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function D_(t,{style:e,vars:n},r,a){const u=t.style;let c;for(c in e)u[c]=e[c];a?.applyProjectionStyles(u,r);for(c in n)u.setProperty(c,n[c])}function QK(t){return window.getComputedStyle(t)}class WK extends M_{constructor(){super(...arguments),this.type="html",this.renderInstance=D_}readValueFromInstance(e,n){if(Wo.has(n))return this.projection?.isProjecting?Nm(n):yU(e,n);{const r=QK(e),a=(ng(n)?r.getPropertyValue(n):r[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return C_(e,n)}build(e,n,r){vg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return xg(e,n,r)}}const N_=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 eq(t,e,n,r){D_(t,e,void 0,r);for(const a in e.attrs)t.setAttribute(N_.has(a)?a:Tg(a),e.attrs[a])}class tq extends M_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=yt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Wo.has(n)){const r=s_(n);return r&&r.default||0}return n=N_.has(n)?n:Tg(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return x_(e,n,r)}build(e,n,r){v_(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,a){eq(e,n,r,a)}mount(e){this.isSVGTag=S_(e.tagName),super.mount(e)}}const nq=(t,e)=>Sg(t)?new tq(e):new WK(e,{allowProjection:t!==$.Fragment});function jo(t,e,n){const r=t.getProps();return wg(r,e,n!==void 0?n:r.custom,t)}const Im=t=>Array.isArray(t);function iq(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Po(n))}function rq(t){return Im(t)?t[t.length-1]||0:t}function sq(t,e){const n=jo(t,e);let{transitionEnd:r={},transition:a={},...u}=n||{};u={...u,...r};for(const c in u){const f=rq(u[c]);iq(t,c,f)}}function oq(t){return!!(Jt(t)&&t.add)}function Pm(t,e){const n=t.getValue("willChange");if(oq(n))return n.add(e);if(!n&&Wi.WillChange){const r=new Wi.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function $_(t){return t.props[T_]}const aq=t=>t!==null;function lq(t,{repeat:e,repeatType:n="loop"},r){const a=t.filter(aq),u=e&&n!=="loop"&&e%2===1?0:a.length-1;return a[u]}const uq={type:"spring",stiffness:500,damping:25,restSpeed:10},cq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),fq={type:"keyframes",duration:.8},dq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},hq=(t,{keyframes:e})=>e.length>2?fq:Wo.has(t)?t.startsWith("scale")?cq(e[1]):uq:dq;function pq({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:a,repeat:u,repeatType:c,repeatDelay:f,from:h,elapsed:m,...y}){return!!Object.keys(y).length}const Ag=(t,e,n,r={},a,u)=>c=>{const f=dg(r,t)||{},h=f.delay||r.delay||0;let{elapsed:m=0}=r;m=m-pi(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-m,onUpdate:b=>{e.set(b),f.onUpdate&&f.onUpdate(b)},onComplete:()=>{c(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:u?void 0:a};pq(f)||Object.assign(y,hq(t,y)),y.duration&&(y.duration=pi(y.duration)),y.repeatDelay&&(y.repeatDelay=pi(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(Lm(y),y.delay===0&&(g=!0)),(Wi.instantAnimations||Wi.skipAnimations)&&(g=!0,Lm(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!u&&e.get()!==void 0){const b=lq(y.keyframes,f);if(b!==void 0){it.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new cg(y):new VU(y)};function mq({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function j_(t,e,{delay:n=0,transitionOverride:r,type:a}={}){let{transition:u=t.getDefaultTransition(),transitionEnd:c,...f}=e;r&&(u=r);const h=[],m=a&&t.animationState&&t.animationState.getState()[a];for(const y in f){const g=t.getValue(y,t.latestValues[y]??null),b=f[y];if(b===void 0||m&&mq(m,y))continue;const S={delay:n,...dg(u||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(b)&&b===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const C=$_(t);if(C){const _=window.MotionHandoffAnimation(C,y,it);_!==null&&(S.startTime=_,T=!0)}}Pm(t,y),g.start(Ag(y,g,b,t.shouldReduceMotion&&n_.has(y)?{type:!1}:S,t,T));const M=g.animation;M&&h.push(M)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&sq(t,c)})}),h}function B_(t,e,n,r=0,a=1){const u=Array.from(t).sort((m,y)=>m.sortNodePosition(y)).indexOf(e),c=t.size,f=(c-1)*r;return typeof n=="function"?n(u,c):a===1?u*r:f-u*r}function Hm(t,e,n={}){const r=jo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:a=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(a=n.transitionOverride);const u=r?()=>Promise.all(j_(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=a;return yq(t,e,h,m,y,g,n)}:()=>Promise.resolve(),{when:f}=a;if(f){const[h,m]=f==="beforeChildren"?[u,c]:[c,u];return h().then(()=>m())}else return Promise.all([u(),c(n.delay)])}function yq(t,e,n=0,r=0,a=0,u=1,c){const f=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),f.push(Hm(h,e,{...c,delay:n+(typeof r=="function"?0:r)+B_(t.variantChildren,h,r,a,u)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function gq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const a=e.map(u=>Hm(t,u,n));r=Promise.all(a)}else if(typeof e=="string")r=Hm(t,e,n);else{const a=typeof e=="function"?jo(t,e,n.custom):e;r=Promise.all(j_(t,a,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function z_(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const vq=gg.length;function L_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?L_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<vq;n++){const r=gg[n],a=t.props[r];(xl(a)||a===!1)&&(e[r]=a)}return e}const bq=[...yg].reverse(),Sq=yg.length;function wq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>gq(t,n,r)))}function xq(t){let e=wq(t),n=ix(),r=!0;const a=h=>(m,y)=>{const g=jo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:b,transitionEnd:S,...x}=g;m={...m,...x,...S}}return m};function u(h){e=h(t)}function c(h){const{props:m}=t,y=L_(t.parent)||{},g=[],b=new Set;let S={},x=1/0;for(let M=0;M<Sq;M++){const C=bq[M],_=n[C],R=m[C]!==void 0?m[C]:y[C],G=xl(R),P=C===h?_.isActive:null;P===!1&&(x=M);let ee=R===y[C]&&R!==m[C]&&G;if(ee&&r&&t.manuallyAnimateOnMount&&(ee=!1),_.protectedKeys={...S},!_.isActive&&P===null||!R&&!_.prevProp||jf(R)||typeof R=="boolean")continue;const J=Tq(_.prevProp,R);let X=J||C===h&&_.isActive&&!ee&&G||M>x&&G,he=!1;const pe=Array.isArray(R)?R:[R];let we=pe.reduce(a(C),{});P===!1&&(we={});const{prevResolvedValues:je={}}=_,be={...je,...we},Z=U=>{X=!0,b.has(U)&&(he=!0,b.delete(U)),_.needsAnimating[U]=!0;const L=t.getValue(U);L&&(L.liveStyle=!1)};for(const U in be){const L=we[U],te=je[U];if(S.hasOwnProperty(U))continue;let oe=!1;Im(L)&&Im(te)?oe=!z_(L,te):oe=L!==te,oe?L!=null?Z(U):b.add(U):L!==void 0&&b.has(U)?Z(U):_.protectedKeys[U]=!0}_.prevProp=R,_.prevResolvedValues=we,_.isActive&&(S={...S,...we}),r&&t.blockInitialAnimation&&(X=!1);const ne=ee&&J;X&&(!ne||he)&&g.push(...pe.map(U=>{const L={type:C};if(typeof U=="string"&&r&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,oe=jo(te,U);if(te.enteringChildren&&oe){const{delayChildren:E}=oe.transition||{};L.delay=B_(te.enteringChildren,t,E)}}return{animation:U,options:L}}))}if(b.size){const M={};if(typeof m.initial!="boolean"){const C=jo(t,Array.isArray(m.initial)?m.initial[0]:m.initial);C&&C.transition&&(M.transition=C.transition)}b.forEach(C=>{const _=t.getBaseTarget(C),R=t.getValue(C);R&&(R.liveStyle=!0),M[C]=_??null}),g.push({animation:M})}let T=!!g.length;return r&&(m.initial===!1||m.initial===m.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function f(h,m){if(n[h].isActive===m)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,m)),n[h].isActive=m;const y=c(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:c,setActive:f,setAnimateFunction:u,getState:()=>n,reset:()=>{n=ix()}}}function Tq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!z_(e,t):!1}function ds(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function ix(){return{animate:ds(!0),whileInView:ds(),whileHover:ds(),whileTap:ds(),whileDrag:ds(),whileFocus:ds(),exit:ds()}}class Gr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Aq extends Gr{constructor(e){super(e),e.animationState||(e.animationState=xq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();jf(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let Eq=0;class Oq extends Gr{constructor(){super(...arguments),this.id=Eq++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const a=this.node.animationState.setActive("exit",!e);n&&!e&&a.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const _q={animation:{Feature:Aq},exit:{Feature:Oq}};function Al(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Ul(t){return{point:{x:t.pageX,y:t.pageY}}}const Rq=t=>e=>mg(e)&&t(e,Ul(e));function ol(t,e,n,r){return Al(t,e,Rq(n),r)}const V_=1e-4,Cq=1-V_,kq=1+V_,U_=.01,Mq=0-U_,Dq=0+U_;function Wt(t){return t.max-t.min}function Nq(t,e,n){return Math.abs(t-e)<=n}function rx(t,e,n,r=.5){t.origin=r,t.originPoint=rt(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=rt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=Cq&&t.scale<=kq||isNaN(t.scale))&&(t.scale=1),(t.translate>=Mq&&t.translate<=Dq||isNaN(t.translate))&&(t.translate=0)}function al(t,e,n,r){rx(t.x,e.x,n.x,r?r.originX:void 0),rx(t.y,e.y,n.y,r?r.originY:void 0)}function sx(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function $q(t,e,n){sx(t.x,e.x,n.x),sx(t.y,e.y,n.y)}function ox(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function ll(t,e,n){ox(t.x,e.x,n.x),ox(t.y,e.y,n.y)}function Ln(t){return[t("x"),t("y")]}const K_=({current:t})=>t?t.ownerDocument.defaultView:null,ax=(t,e)=>Math.abs(t-e);function jq(t,e){const n=ax(t.x,e.x),r=ax(t.y,e.y);return Math.sqrt(n**2+r**2)}class q_{constructor(e,n,{transformPagePoint:r,contextWindow:a=window,dragSnapToOrigin:u=!1,distanceThreshold:c=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=jp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=jq(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=b,{timestamp:M}=Ht;this.history.push({...T,timestamp:M});const{onStart:C,onMove:_}=this.handlers;S||(C&&C(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,b)},this.handlePointerMove=(b,S)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=$p(S,this.transformPagePoint),it.update(this.updatePoint,!0)},this.handlePointerUp=(b,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:M}=this.handlers;if(this.dragSnapToOrigin&&M&&M(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const C=jp(b.type==="pointercancel"?this.lastMoveEventInfo:$p(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,C),T&&T(b,C)},!mg(e))return;this.dragSnapToOrigin=u,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=c,this.contextWindow=a||window;const f=Ul(e),h=$p(f,this.transformPagePoint),{point:m}=h,{timestamp:y}=Ht;this.history=[{...m,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,jp(h,this.history)),this.removeListeners=zl(ol(this.contextWindow,"pointermove",this.handlePointerMove),ol(this.contextWindow,"pointerup",this.handlePointerUp),ol(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Vr(this.updatePoint)}}function $p(t,e){return e?{point:e(t.point)}:t}function lx(t,e){return{x:t.x-e.x,y:t.y-e.y}}function jp({point:t},e){return{point:t,delta:lx(t,I_(e)),offset:lx(t,Bq(e)),velocity:zq(e,.1)}}function Bq(t){return t[0]}function I_(t){return t[t.length-1]}function zq(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const a=I_(t);for(;n>=0&&(r=t[n],!(a.timestamp-r.timestamp>pi(e)));)n--;if(!r)return{x:0,y:0};const u=qn(a.timestamp-r.timestamp);if(u===0)return{x:0,y:0};const c={x:(a.x-r.x)/u,y:(a.y-r.y)/u};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function Lq(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?rt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?rt(n,t,r.max):Math.min(t,n)),t}function ux(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Vq(t,{top:e,left:n,bottom:r,right:a}){return{x:ux(t.x,n,a),y:ux(t.y,e,r)}}function cx(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Uq(t,e){return{x:cx(t.x,e.x),y:cx(t.y,e.y)}}function Kq(t,e){let n=.5;const r=Wt(t),a=Wt(e);return a>r?n=bl(e.min,e.max-r,t.min):r>a&&(n=bl(t.min,t.max-a,e.min)),Qi(0,1,n)}function qq(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Fm=.35;function Iq(t=Fm){return t===!1?t=0:t===!0&&(t=Fm),{x:fx(t,"left","right"),y:fx(t,"top","bottom")}}function fx(t,e,n){return{min:dx(t,e),max:dx(t,n)}}function dx(t,e){return typeof t=="number"?t:t[e]||0}const Pq=new WeakMap;class Hq{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=yt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:a}=this.visualElement;if(a&&a.isPresent===!1)return;const u=g=>{const{dragSnapToOrigin:b}=this.getProps();b?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Ul(g).point)},c=(g,b)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=nK(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=b,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Ln(C=>{let _=this.getAxisMotionValue(C).get()||0;if(mi.test(_)){const{projection:R}=this.visualElement;if(R&&R.layout){const G=R.layout.layoutBox[C];G&&(_=Wt(G)*(parseFloat(_)/100))}}this.originPoint[C]=_}),T&&it.postRender(()=>T(g,b)),Pm(this.visualElement,"transform");const{animationState:M}=this.visualElement;M&&M.setActive("whileDrag",!0)},f=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b;const{dragPropagation:S,dragDirectionLock:x,onDirectionLock:T,onDrag:M}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:C}=b;if(x&&this.currentDirection===null){this.currentDirection=Fq(C),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,C),this.updateAxis("y",b.point,C),this.visualElement.render(),M&&M(g,b)},h=(g,b)=>{this.latestPointerEvent=g,this.latestPanInfo=b,this.stop(g,b),this.latestPointerEvent=null,this.latestPanInfo=null},m=()=>Ln(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new q_(e,{onSessionStart:u,onStart:c,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:K_(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,a=n||this.latestPanInfo,u=this.isDragging;if(this.cancel(),!u||!a||!r)return;const{velocity:c}=a;this.startAnimation(c);const{onDragEnd:f}=this.getProps();f&&it.postRender(()=>f(r,a))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,r){const{drag:a}=this.getProps();if(!r||!bc(e,a,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=Lq(c,this.constraints[e],this.elastic[e])),u.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,a=this.constraints;e&&Ao(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Vq(r.layoutBox,e):this.constraints=!1,this.elastic=Iq(n),a!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ln(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=qq(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Ao(e))return!1;const r=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const u=GK(r,a.root,this.visualElement.getTransformPagePoint());let c=Uq(a.layout.layoutBox,u);if(n){const f=n(PK(c));this.hasMutatedConstraints=!!f,f&&(c=O_(f))}return c}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:a,dragTransition:u,dragSnapToOrigin:c,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},m=Ln(y=>{if(!bc(y,n,this.currentDirection))return;let g=h&&h[y]||{};c&&(g={min:0,max:0});const b=a?200:1e6,S=a?40:1e7,x={type:"inertia",velocity:r?e[y]:0,bounceStiffness:b,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...u,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(m).then(f)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Pm(this.visualElement,e),r.start(Ag(e,r,0,n,this.visualElement,!1))}stopAnimation(){Ln(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Ln(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),a=r[n];return a||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Ln(n=>{const{drag:r}=this.getProps();if(!bc(n,r,this.currentDirection))return;const{projection:a}=this.visualElement,u=this.getAxisMotionValue(n);if(a&&a.layout){const{min:c,max:f}=a.layout.layoutBox[n];u.set(e[n]-rt(c,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!Ao(n)||!r||!this.constraints)return;this.stopAnimation();const a={x:0,y:0};Ln(c=>{const f=this.getAxisMotionValue(c);if(f&&this.constraints!==!1){const h=f.get();a[c]=Kq({min:h,max:h},this.constraints[c])}});const{transformTemplate:u}=this.visualElement.getProps();this.visualElement.current.style.transform=u?u({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Ln(c=>{if(!bc(c,e,null))return;const f=this.getAxisMotionValue(c),{min:h,max:m}=this.constraints[c];f.set(rt(h,m,a[c]))})}addListeners(){if(!this.visualElement.current)return;Pq.set(this.visualElement,this);const e=this.visualElement.current,n=ol(e,"pointerdown",h=>{const{drag:m,dragListener:y=!0}=this.getProps();m&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();Ao(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:a}=this.visualElement,u=a.addEventListener("measure",r);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),it.read(r);const c=Al(window,"resize",()=>this.scalePositionWithinConstraints()),f=a.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:m})=>{this.isDragging&&m&&(Ln(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())}));return()=>{c(),n(),u(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:a=!1,dragConstraints:u=!1,dragElastic:c=Fm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:a,dragConstraints:u,dragElastic:c,dragMomentum:f}}}function bc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Fq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Gq extends Gr{constructor(e){super(e),this.removeGroupControls=In,this.removeListeners=In,this.controls=new Hq(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||In}unmount(){this.removeGroupControls(),this.removeListeners()}}const hx=t=>(e,n)=>{t&&it.postRender(()=>t(e,n))};class Yq extends Gr{constructor(){super(...arguments),this.removePointerDownListener=In}onPointerDown(e){this.session=new q_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:K_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:a}=this.node.getProps();return{onSessionStart:hx(e),onStart:hx(n),onMove:r,onEnd:(u,c)=>{delete this.session,a&&it.postRender(()=>a(u,c))}}}mount(){this.removePointerDownListener=ol(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const $c={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function px(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ja={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(de.test(t))t=parseFloat(t);else return t;const n=px(t,e.target.x),r=px(t,e.target.y);return`${n}% ${r}%`}},Jq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,a=Ur.parse(t);if(a.length>5)return r;const u=Ur.createTransformer(t),c=typeof a[0]!="number"?1:0,f=n.x.scale*e.x,h=n.y.scale*e.y;a[0+c]/=f,a[1+c]/=h;const m=rt(f,h,.5);return typeof a[2+c]=="number"&&(a[2+c]/=m),typeof a[3+c]=="number"&&(a[3+c]/=m),u(a)}};let Bp=!1;class Xq extends $.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:a}=this.props,{projection:u}=e;vK(Zq),u&&(n.group&&n.group.add(u),r&&r.register&&a&&r.register(u),Bp&&u.root.didUpdate(),u.addEventListener("animationComplete",()=>{this.safeToRemove()}),u.setOptions({...u.options,onExitComplete:()=>this.safeToRemove()})),$c.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:a,isPresent:u}=this.props,{projection:c}=r;return c&&(c.isPresent=u,Bp=!0,a||e.layoutDependency!==n||n===void 0||e.isPresent!==u?c.willUpdate():this.safeToRemove(),e.isPresent!==u&&(u?c.promote():c.relegate()||it.postRender(()=>{const f=c.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),pg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:a}=e;Bp=!0,a&&(a.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(a),r&&r.deregister&&r.deregister(a))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function P_(t){const[e,n]=fK(),r=$.useContext(xO);return F.jsx(Xq,{...t,layoutGroup:r,switchLayoutGroup:$.useContext(A_),isPresent:e,safeToRemove:n})}const Zq={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:Jq};function Qq(t,e,n){const r=Jt(t)?t:Po(t);return r.start(Ag("",r,e,n)),r.animation}const Wq=(t,e)=>t.depth-e.depth;class e6{constructor(){this.children=[],this.isDirty=!1}add(e){Jy(this.children,e),this.isDirty=!0}remove(e){Xy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Wq),this.isDirty=!1,this.children.forEach(e)}}function t6(t,e){const n=fn.now(),r=({timestamp:a})=>{const u=a-n;u>=e&&(Vr(r),t(u-e))};return it.setup(r,!0),()=>Vr(r)}const H_=["TopLeft","TopRight","BottomLeft","BottomRight"],n6=H_.length,mx=t=>typeof t=="string"?parseFloat(t):t,yx=t=>typeof t=="number"||de.test(t);function i6(t,e,n,r,a,u){a?(t.opacity=rt(0,n.opacity??1,r6(r)),t.opacityExit=rt(e.opacity??1,0,s6(r))):u&&(t.opacity=rt(e.opacity??1,n.opacity??1,r));for(let c=0;c<n6;c++){const f=`border${H_[c]}Radius`;let h=gx(e,f),m=gx(n,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||yx(h)===yx(m)?(t[f]=Math.max(rt(mx(h),mx(m),r),0),(mi.test(m)||mi.test(h))&&(t[f]+="%")):t[f]=m}(e.rotate||n.rotate)&&(t.rotate=rt(e.rotate||0,n.rotate||0,r))}function gx(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const r6=F_(0,.5,NO),s6=F_(.5,.95,In);function F_(t,e,n){return r=>r<t?0:r>e?1:n(bl(t,e,r))}function vx(t,e){t.min=e.min,t.max=e.max}function Bn(t,e){vx(t.x,e.x),vx(t.y,e.y)}function bx(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Sx(t,e,n,r,a){return t-=e,t=of(t,1/n,r),a!==void 0&&(t=of(t,1/a,r)),t}function o6(t,e=0,n=1,r=.5,a,u=t,c=t){if(mi.test(e)&&(e=parseFloat(e),e=rt(c.min,c.max,e/100)-c.min),typeof e!="number")return;let f=rt(u.min,u.max,r);t===u&&(f-=e),t.min=Sx(t.min,e,n,f,a),t.max=Sx(t.max,e,n,f,a)}function wx(t,e,[n,r,a],u,c){o6(t,e[n],e[r],e[a],e.scale,u,c)}const a6=["x","scaleX","originX"],l6=["y","scaleY","originY"];function xx(t,e,n,r){wx(t.x,e,a6,n?n.x:void 0,r?r.x:void 0),wx(t.y,e,l6,n?n.y:void 0,r?r.y:void 0)}function Tx(t){return t.translate===0&&t.scale===1}function G_(t){return Tx(t.x)&&Tx(t.y)}function Ax(t,e){return t.min===e.min&&t.max===e.max}function u6(t,e){return Ax(t.x,e.x)&&Ax(t.y,e.y)}function Ex(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function Y_(t,e){return Ex(t.x,e.x)&&Ex(t.y,e.y)}function Ox(t){return Wt(t.x)/Wt(t.y)}function _x(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class c6{constructor(){this.members=[]}add(e){Jy(this.members,e),e.scheduleRender()}remove(e){if(Xy(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(a=>e===a);if(n===0)return!1;let r;for(let a=n;a>=0;a--){const u=this.members[a];if(u.isPresent!==!1){r=u;break}}return r?(this.promote(r),!0):!1}promote(e,n){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,n&&(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:a}=e.options;a===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.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 f6(t,e,n){let r="";const a=t.x.translate/e.x,u=t.y.translate/e.y,c=n?.z||0;if((a||u||c)&&(r=`translate3d(${a}px, ${u}px, ${c}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:m,rotate:y,rotateX:g,rotateY:b,skewX:S,skewY:x}=n;m&&(r=`perspective(${m}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),b&&(r+=`rotateY(${b}deg) `),S&&(r+=`skewX(${S}deg) `),x&&(r+=`skewY(${x}deg) `)}const f=t.x.scale*e.x,h=t.y.scale*e.y;return(f!==1||h!==1)&&(r+=`scale(${f}, ${h})`),r||"none"}const zp=["","X","Y","Z"],d6=1e3;let h6=0;function Lp(t,e,n,r){const{latestValues:a}=e;a[t]&&(n[t]=a[t],e.setStaticValue(t,0),r&&(r[t]=0))}function J_(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=$_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:a,layoutId:u}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",it,!(a||u))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&J_(r)}function X_({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(c={},f=e?.()){this.id=h6++,this.animationId=0,this.animationCommitId=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,this.nodes.forEach(y6),this.nodes.forEach(S6),this.nodes.forEach(w6),this.nodes.forEach(g6)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new e6)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Wy),this.eventHandlers.get(c).add(f)}notifyListeners(c,...f){const h=this.eventHandlers.get(c);h&&h.notify(...f)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=f_(c)&&!lK(c),this.instance=c;const{layoutId:f,layout:h,visualElement:m}=this.options;if(m&&!m.current&&m.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||f)&&(this.isLayoutDirty=!0),t){let y,g=0;const b=()=>this.root.updateBlockedByResize=!1;it.read(()=>{g=window.innerWidth}),t(c,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=t6(b,250),$c.hasAnimatedSinceResize&&($c.hasAnimatedSinceResize=!1,this.nodes.forEach(kx)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&m&&(f||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:b,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||m.getDefaultTransition()||O6,{onLayoutAnimationStart:T,onLayoutAnimationComplete:M}=m.getProps(),C=!this.targetLayout||!Y_(this.targetLayout,S),_=!g&&b;if(this.options.layoutRoot||this.resumeFrom||_||g&&(C||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const R={...dg(x,"layout"),onPlay:T,onComplete:M};(m.shouldReduceMotion||this.options.layoutRoot)&&(R.delay=0,R.type=!1),this.startAnimation(R),this.setAnimationOrigin(y,_)}else g||kx(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Vr(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(x6),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&J_(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const m=this.getTransformTemplate();this.prevTransformTemplateValue=m?m(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Rx);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Cx);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(b6),this.nodes.forEach(p6),this.nodes.forEach(m6)):this.nodes.forEach(Cx),this.clearAllSnapshots();const f=fn.now();Ht.delta=Qi(0,1e3/60,f-Ht.timestamp),Ht.timestamp=f,Ht.isProcessing=!0,Op.update.process(Ht),Op.preRender.process(Ht),Op.render.process(Ht),Ht.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,pg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(v6),this.sharedNodes.forEach(T6)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,it.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){it.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Wt(this.snapshot.measuredBox.x)&&!Wt(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let h=0;h<this.path.length;h++)this.path[h].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutCorrected=yt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(f=!1),f&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!a)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,f=this.projectionDelta&&!G_(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(f||ms(this.latestValues)||y)&&(a(this.instance,m),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return c&&(h=this.removeTransform(h)),_6(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return yt();const f=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(R6))){const{scroll:m}=this.root;m&&(Eo(f.x,m.offset.x),Eo(f.y,m.offset.y))}return f}removeElementScroll(c){const f=yt();if(Bn(f,c),this.scroll?.wasRoot)return f;for(let h=0;h<this.path.length;h++){const m=this.path[h],{scroll:y,options:g}=m;m!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&Bn(f,c),Eo(f.x,y.offset.x),Eo(f.y,y.offset.y))}return f}applyTransform(c,f=!1){const h=yt();Bn(h,c);for(let m=0;m<this.path.length;m++){const y=this.path[m];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&Oo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ms(y.latestValues)&&Oo(h,y.latestValues)}return ms(this.latestValues)&&Oo(h,this.latestValues),h}removeTransform(c){const f=yt();Bn(f,c);for(let h=0;h<this.path.length;h++){const m=this.path[h];if(!m.instance||!ms(m.latestValues))continue;Um(m.latestValues)&&m.updateSnapshot();const y=yt(),g=m.measurePageBox();Bn(y,g),xx(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return ms(this.latestValues)&&xx(f,this.latestValues),f}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.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!==Ht.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(c||h&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:y,layoutId:g}=this.options;if(!(!this.layout||!(y||g))){if(this.resolvedRelativeTargetAt=Ht.timestamp,!this.targetDelta&&!this.relativeTarget){const b=this.getClosestProjectingParent();b&&b.layout&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=yt(),this.relativeTargetOrigin=yt(),ll(this.relativeTargetOrigin,this.layout.layoutBox,b.layout.layoutBox),Bn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=yt(),this.targetWithTransforms=yt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),$q(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Bn(this.target,this.layout.layoutBox),R_(this.target,this.targetDelta)):Bn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const b=this.getClosestProjectingParent();b&&!!b.resumingFrom==!!this.resumingFrom&&!b.options.layoutScroll&&b.target&&this.animationProgress!==1?(this.relativeParent=b,this.forceRelativeParentToResolveTarget(),this.relativeTarget=yt(),this.relativeTargetOrigin=yt(),ll(this.relativeTargetOrigin,this.target,b.target),Bn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Um(this.parent.latestValues)||__(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){const c=this.getLead(),f=!!this.resumingFrom||this!==c;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Ht.timestamp&&(h=!1),h)return;const{layout:m,layoutId:y}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(m||y))return;Bn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,b=this.treeScale.y;FK(this.layoutCorrected,this.treeScale,this.path,f),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=yt());const{target:S}=c;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(bx(this.prevProjectionDelta.x,this.projectionDelta.x),bx(this.prevProjectionDelta.y,this.projectionDelta.y)),al(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!_x(this.projectionDelta.x,this.prevProjectionDelta.x)||!_x(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=_o(),this.projectionDelta=_o(),this.projectionDeltaWithTransform=_o()}setAnimationOrigin(c,f=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=_o();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const b=yt(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,M=this.getStack(),C=!M||M.members.length<=1,_=!!(T&&!C&&this.options.crossfade===!0&&!this.path.some(E6));this.animationProgress=0;let R;this.mixTargetDelta=G=>{const P=G/1e3;Mx(g.x,c.x,P),Mx(g.y,c.y,P),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ll(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),A6(this.relativeTarget,this.relativeTargetOrigin,b,P),R&&u6(this.relativeTarget,R)&&(this.isProjectionDirty=!1),R||(R=yt()),Bn(R,this.relativeTarget)),T&&(this.animationValues=y,i6(y,m,this.latestValues,P,_,C)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=P},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Vr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{$c.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Po(0)),this.currentAnimation=Qq(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),c.onUpdate&&c.onUpdate(f)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.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 c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(d6),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:f,target:h,layout:m,latestValues:y}=c;if(!(!f||!h||!m)){if(this!==c&&this.layout&&m&&Z_(this.options.animationType,this.layout.layoutBox,m.layoutBox)){h=this.target||yt();const g=Wt(this.layout.layoutBox.x);h.x.min=c.target.x.min,h.x.max=h.x.min+g;const b=Wt(this.layout.layoutBox.y);h.y.min=c.target.y.min,h.y.max=h.y.min+b}Bn(f,h),Oo(f,y),al(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new c6),this.sharedNodes.get(c).add(f);const m=f.options.initialPromotionConfig;f.promote({transition:m?m.transition:void 0,preserveFollowOpacity:m&&m.shouldPreserveFollowOpacity?m.shouldPreserveFollowOpacity(f):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:f,preserveFollowOpacity:h}={}){const m=this.getStack();m&&m.promote(this,h),c&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let f=!1;const{latestValues:h}=c;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const m={};h.z&&Lp("z",c,m,this.animationValues);for(let y=0;y<zp.length;y++)Lp(`rotate${zp[y]}`,c,m,this.animationValues),Lp(`skew${zp[y]}`,c,m,this.animationValues);c.render();for(const y in m)c.setStaticValue(y,m[y]),this.animationValues&&(this.animationValues[y]=m[y]);c.scheduleRender()}applyProjectionStyles(c,f){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=Nc(f?.pointerEvents)||"",c.transform=h?h(this.latestValues,""):"none";return}const m=this.getLead();if(!this.projectionDelta||!this.layout||!m.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=Nc(f?.pointerEvents)||""),this.hasProjected&&!ms(this.latestValues)&&(c.transform=h?h({},""):"none",this.hasProjected=!1);return}c.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=f6(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),c.transform=g;const{x:b,y:S}=this.projectionDelta;c.transformOrigin=`${b.origin*100}% ${S.origin*100}% 0`,m.animationValues?c.opacity=m===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:c.opacity=m===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const x in Tl){if(y[x]===void 0)continue;const{correct:T,applyTo:M,isCSSVariable:C}=Tl[x],_=g==="none"?y[x]:T(y[x],m);if(M){const R=M.length;for(let G=0;G<R;G++)c[M[G]]=_}else C?this.options.visualElement.renderState.vars[x]=_:c[x]=_}this.options.layoutId&&(c.pointerEvents=m===this?Nc(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(Rx),this.root.sharedNodes.clear()}}}function p6(t){t.updateLayout()}function m6(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:r}=t.layout,{animationType:a}=t.options,u=e.source!==t.layout.source;a==="size"?Ln(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(g);g.min=n[y].min,g.max=g.min+b}):Z_(a,e.layoutBox,n)&&Ln(y=>{const g=u?e.measuredBox[y]:e.layoutBox[y],b=Wt(n[y]);g.max=g.min+b,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+b)});const c=_o();al(c,n,e.layoutBox);const f=_o();u?al(f,t.applyTransform(r,!0),e.measuredBox):al(f,n,e.layoutBox);const h=!G_(c);let m=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:b}=y;if(g&&b){const S=yt();ll(S,e.layoutBox,g.layoutBox);const x=yt();ll(x,n,b.layoutBox),Y_(S,x)||(m=!0),y.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:f,layoutDelta:c,hasLayoutChanged:h,hasRelativeLayoutChanged:m})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function y6(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function g6(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function v6(t){t.clearSnapshot()}function Rx(t){t.clearMeasurements()}function Cx(t){t.isLayoutDirty=!1}function b6(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function kx(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function S6(t){t.resolveTargetDelta()}function w6(t){t.calcProjection()}function x6(t){t.resetSkewAndRotation()}function T6(t){t.removeLeadSnapshot()}function Mx(t,e,n){t.translate=rt(e.translate,0,n),t.scale=rt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function Dx(t,e,n,r){t.min=rt(e.min,n.min,r),t.max=rt(e.max,n.max,r)}function A6(t,e,n,r){Dx(t.x,e.x,n.x,r),Dx(t.y,e.y,n.y,r)}function E6(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const O6={duration:.45,ease:[.4,0,.1,1]},Nx=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),$x=Nx("applewebkit/")&&!Nx("chrome/")?Math.round:In;function jx(t){t.min=$x(t.min),t.max=$x(t.max)}function _6(t){jx(t.x),jx(t.y)}function Z_(t,e,n){return t==="position"||t==="preserve-aspect"&&!Nq(Ox(e),Ox(n),.2)}function R6(t){return t!==t.root&&t.scroll?.wasRoot}const C6=X_({attachResizeListener:(t,e)=>Al(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Vp={current:void 0},Q_=X_({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Vp.current){const t=new C6({});t.mount(window),t.setOptions({layoutScroll:!0}),Vp.current=t}return Vp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),k6={pan:{Feature:Yq},drag:{Feature:Gq,ProjectionNode:Q_,MeasureLayout:P_}};function Bx(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const a="onHover"+n,u=r[a];u&&it.postRender(()=>u(e,Ul(e)))}class M6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=iK(e,(n,r)=>(Bx(this.node,r,"Start"),a=>Bx(this.node,a,"End"))))}unmount(){}}class D6 extends Gr{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=zl(Al(this.node.current,"focus",()=>this.onFocus()),Al(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function zx(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const a="onTap"+(n==="End"?"":n),u=r[a];u&&it.postRender(()=>u(e,Ul(e)))}class N6 extends Gr{mount(){const{current:e}=this.node;e&&(this.unmount=aK(e,(n,r)=>(zx(this.node,r,"Start"),(a,{success:u})=>zx(this.node,a,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Gm=new WeakMap,Up=new WeakMap,$6=t=>{const e=Gm.get(t.target);e&&e(t)},j6=t=>{t.forEach($6)};function B6({root:t,...e}){const n=t||document;Up.has(n)||Up.set(n,{});const r=Up.get(n),a=JSON.stringify(e);return r[a]||(r[a]=new IntersectionObserver(j6,{root:t,...e})),r[a]}function z6(t,e,n){const r=B6(e);return Gm.set(t,n),r.observe(t),()=>{Gm.delete(t),r.unobserve(t)}}const L6={some:0,all:1};class V6 extends Gr{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:a="some",once:u}=e,c={root:n?n.current:void 0,rootMargin:r,threshold:typeof a=="number"?a:L6[a]},f=h=>{const{isIntersecting:m}=h;if(this.isInView===m||(this.isInView=m,u&&!m&&this.hasEnteredView))return;m&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",m);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),b=m?y:g;b&&b(h)};return z6(this.node.current,c,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(U6(e,n))&&this.startObserver()}unmount(){}}function U6({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const K6={inView:{Feature:V6},tap:{Feature:N6},focus:{Feature:D6},hover:{Feature:M6}},q6={layout:{ProjectionNode:Q_,MeasureLayout:P_}},I6={..._q,...K6,...k6,...q6},P6=IK(I6,nq);function H6(){const t=Wn(Io),e=Wn(di),n=Wn(Fi),r=Et(Io),a=Et(di),u=Et(Fi),c=`email-${$.useId()}`,f=`password-${$.useId()}`,h=`one-time-code-${$.useId()}`,[m,y]=$.useState(null),[g,b]=$.useState("email"),S=`form-${$.useId()}`;return $.useEffect(()=>{if(u.length===6){const x=document.getElementById(S);x instanceof HTMLFormElement&&x.requestSubmit()}},[u]),F.jsx("form",{id:S,onSubmit:async x=>{x.preventDefault();const T=nt(ui);try{switch(g){case"email":{const{nextStep:M,userKey:C}=await cn.declareAuthTarget.query({email:r});switch(De(ui,C),M){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!T){console.error("somehow userKey is null");return}const M=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:T});De(ut,M),gi.once("connect",()=>{Os("/game"),t(""),n("")});break}case"password":{const M=await cn.openSession.mutate({email:r,password:a});De(ut,M),gi.once("connect",()=>{Os("/game"),t(""),e("")});break}}}catch(M){M instanceof vl&&y(M.message)}},children:F.jsxs("main",{children:[m?F.jsx("aside",{children:m}):null,F.jsxs(P6.label,{htmlFor:c,children:[F.jsx("span",{children:"Email"}),F.jsx("input",{id:c,type:"text",value:r,onChange:x=>{t(x.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?F.jsxs("label",{htmlFor:f,children:[F.jsx("span",{children:"Password"}),F.jsx("input",{id:f,type:"password",value:a,onChange:x=>{e(x.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?F.jsxs("label",{htmlFor:h,children:[F.jsx("span",{children:"One-time Code"}),F.jsx("input",{id:h,type:"number",inputMode:"numeric",enterKeyHint:"go",value:u,onChange:x=>{n(x.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,F.jsxs("footer",{children:[g==="password"?F.jsx("button",{type:"button",onClick:async()=>{const x=nt(ui);if(!x)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:x}),b("otc")},children:"Forgot Password?"}):null,F.jsx("span",{}),F.jsx("button",{type:"submit",disabled:!r&&g==="email"||!a&&g==="password"||!u&&g==="otc",children:">>->"})]})]})})}function F6({route:[,t]}){const e=Et(ut),n=Et(Fi),r=Wn(Fi),a=`code-${$.useId()}`;return $.useEffect(()=>{t&&r(t)},[]),e?F.jsx("form",{onSubmit:async u=>{u.preventDefault();try{const c=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(ut,c),c.action==="resetPassword"?Os("/account"):Os("/game")}catch(c){console.error(c)}},children:F.jsxs("main",{children:[F.jsx("p",{children:"Check your email for a verification code."}),F.jsxs("label",{htmlFor:a,children:[F.jsx("span",{children:"Verification code"}),F.jsx("input",{id:a,type:"text",value:n,onChange:u=>{r(u.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})}):F.jsx("p",{children:"You must be logged in to verify your account."})}function G6(){const t=Et(n4),e=Et(ut),[n,r]=$.useState(!1),{refs:a,floatingStyles:u,context:c}=V2({open:n,onOpenChange:r,placement:"bottom-end",middleware:[c2(5),d2(),f2()],whileElementsMounted:n2}),f=$2(c),h=z2(c),m=q2(c),{getReferenceProps:y,getFloatingProps:g}=U2([f,h,m]),b=Et(PL);return F.jsxs("main",{className:$z.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Nz,{}),F.jsx("span",{children:F.jsx(jz,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:a.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(D2,{context:c,modal:!1,children:F.jsxs("div",{"data-css":"profile-actions",ref:a.setFloating,style:u,...g(),children:[F.jsx("span",{children:e.username}),F.jsx("button",{type:"button",onClick:()=>{Os("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),gi.once("disconnect",()=>{De(ut,null),Os("/")}),gi.disconnect())},children:"Sign out"})]})})]}),F.jsx("main",{children:typeof t=="number"?F.jsxs("article",{children:[F.jsx("h1",{children:t}),F.jsx("h2",{children:JSON.parse(zE[t])}),F.jsx(LE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(H6,{});case"admin":return F.jsx(a4,{});case"game":return F.jsx(u4,{route:t});case"verify":return F.jsx(F6,{route:t});case"account":return F.jsx(o4,{})}})()})]})}BM.createRoot(document.getElementById("root")).render(F.jsx($.StrictMode,{children:F.jsx(_M,{socket:gi,children:F.jsx(G6,{})})}));
|