tempest.games 0.2.66 → 0.2.68

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.
@@ -0,0 +1,109 @@
1
+ function yk(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 gk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yh={exports:{}},Fa={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var ES;function vk(){if(ES)return Fa;ES=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 OS;function bk(){return OS||(OS=1,Yh.exports=vk()),Yh.exports}var F=bk();function ft(t){return cf(Ft.STORE,t,void 0)}function z1(t){return fy(Ft.STORE,t,void 0)}function Sk(t){return ny(Ft.STORE,t)}function nt(...t){return An(Ft.STORE,...t)}function wk(t){return hM(Ft.STORE,t)}function xk(t){return mM(t,Ft.STORE)}const Ur={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]"},Jh=t=>(e,n,r,a,...u)=>{console[t](`${e} ${Ur[n]} \`${r}\` ${a}`,...u)},Tk={error:Jh("error"),info:Jh("info"),warn:Jh("warn")};var Ak=class{logLevel;filter;logger;constructor(t,e,n=Tk){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 bc(t,e){return[t,e].sort().join("")}function Ek(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 rT(Ft.STORE,t)}function Ok(t){return Wk(Ft.STORE,t)}function De(...t){Lt(Ft.STORE,...t)}function _k(t,e,n=of()){return uM(Ft.STORE,t,e,n)}function Rk(t){return X1(Ft.STORE,t)}function Ck(t,e=of()){return Zm(Ft.STORE,t,e)}function kk(t){return Object.entries(t)}function Kr(t){return JSON.parse(t)}const zt=t=>JSON.stringify(t);function Mk(t){const e={};let n=0;for(const r of t)e[r]=n,e[n]=r,++n;return e}const L1="",V1="",U1="",K1="",_S=t=>{switch(typeof t){case"string":return U1+t;case"number":return K1+t;case"boolean":return L1+ +t;case"object":return V1}},RS=t=>{switch(t[0]){case U1:return t.slice(1);case K1:return+t.slice(1);case L1:return t.slice(1)==="1";case V1:return null}},CS=Mk(["add","delete","clear"]);var Jm=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=CS[e.type]+"";return e.type==="clear"?n+e.values.map(_S).join(""):n+_S(e.value)}static unpackUpdate(e){const[n,r]=e.split(""),a=CS[n];return a==="clear"?{type:"clear",values:r.split("").map(RS)}:{type:a,value:RS(r)}}};function of(t=Math.random){return t().toString(36).slice(2)}function Re(t){for(;t.child!==null;)t=t.child;return t}function Xm(t){for(;t.parent!==null;)t=t.parent;return t}const Dk=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function jo(t){const e=Object.prototype.toString.call(t);return Dk.test(e)}function Kp(t,e){return jo(t)?t(e):t}var qp=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)}},Nk=class extends We{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}},$k=class q1{_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 q1([...this._buffer]);return e._index=this._index,e}};function Br(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}},P1=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}},jk=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 P1(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)}},Pi=class I1{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 jk(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 I1({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 P1){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 Bk(t){return t.startsWith("🔍 ")}const zk=t=>{t.logger.info("🪂","transaction",t.transactionMeta.update.token.key,"Aborting transaction"),t.parent.child=null};function Zm(t,e,n){return(...r)=>ct(t,e).run(r,n)}function Lk(t,e,n){const{token:r,update:{newValue:a,oldValue:u}}=e;Lt(t,r,n==="newValue"?a:u)}function Vk(t){const{stack:e}=t;return e?`
10
+ `+e.split(`
11
+ `)?.slice(1)?.join(`
12
+ `):""}function H1(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?`
13
+ ${y} was most recently disposed
14
+ ${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function Qm(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?`
15
+ This state was most recently deallocated
16
+ ${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=Ek(e);if(b){const[,S,x]=b,T=t.keyRefsInJoins.getRelatedKey(bc(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?Qm(t,Kr(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]),af(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=Vk(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?`
17
+ ${a} was most recently disposed
18
+ ${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?`
19
+ ${f} was most recently disposed
20
+ ${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])=>Kr(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 Uk(t,e,n){switch(n){case"newValue":F1(t,e);break;case"oldValue":af(t,e.token);break}}function Kk(t,e,n){switch(n){case"newValue":af(t,e.token);break;case"oldValue":F1(t,e),e.subType==="atom"&&t.valueMap.set(e.token.key,e.value);break}}function F1(t,e){const{token:n}=e;e.subType==="writable"&&e.value?Lt(t,n,e.value):An(t,n)}function qk(t,e,n){switch(n){case"newValue":H1(t,e.provenance,e.key);break;case"oldValue":Qm(t,e.key);break}}function Pk(t,e,n){switch(n){case"newValue":Qm(t,e.key);break;case"oldValue":H1(t,e.provenance.map(Kr),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 Ik(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 So(t,e,n){const r=n==="newValue"?e.subEvents:[...e.subEvents].reverse();for(const a of r)switch(a.type){case"atom_update":Lk(t,a,n);break;case"state_creation":Uk(t,a,n);break;case"state_disposal":Kk(t,a,n);break;case"molecule_creation":qk(t,a,n);break;case"molecule_disposal":Pk(t,a,n);break;case"molecule_transfer":Ik(t,a,n);break;case"transaction_outcome":So(t,a,n);break}}function ul(t){return"epoch"in t.transactionMeta}function Tn(t){return"phase"in t.transactionMeta}function G1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function Y1(t,e){return t.transactionMeta.epoch.get(e)}function Hk(t,e){const n=G1(t,e);if(n!==void 0)return Y1(t,n)}function Wm(t,e,n){t.transactionMeta.epoch.set(e,n)}function Fk(t,e,n){const r=G1(t,e);r!==void 0&&t.transactionMeta.epoch.set(r,n)}function Gk(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),So(r,n.transactionMeta.update,"newValue"),ul(r)?(Fk(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 J1(t,e,n){const{epoch:r,actionContinuities:a}=t.transactionMeta;a.set(e,n),r.has(e)||r.set(e,-1)}function Yk(t){return{store:t}}const Jk=(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=Hk(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)=>{ry(h,...m)}),run:(m,y=of())=>Zm(h,m,y),find:((...m)=>qr(t,...m)),json:m=>_s(h,m),dispose:((...m)=>{af(h,...m)}),env:()=>Yk(h)}},h=Object.assign(u,{transactionMeta:f});return a.child=h,t.logger.info("🛫","transaction",e.key,"building with params:",n),h};function X1(t,e){const{key:n}=e,r=t.transactions.has(n),a={key:n,type:"transaction",run:(c,f)=>{const h=Jk(t,Br(a),c,f);try{const{toolkit:m}=h.transactionMeta,y=e.do(m,...c);return Gk(h,y),y}catch(m){throw zk(h),t.logger.warn("💥","transaction",n,"caught:",m),m}},install:c=>X1(c,e),subject:new We};Re(t).transactions.set(n,a);const u=Br(a);return r||t.on.transactionCreation.next(u),u}var Xk=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 Pi({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Pi({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 Pi({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Pi({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new $k(100);molecules=new Map;moleculeGraph=new Pi({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Pi({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});keyRefsInJoins=new Pi({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 Nk(null),operationClose:new We,moleculeCreation:new We,moleculeDisposal:new We};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0};loggers=[new Ak("warn",(t,e,n)=>!Bk(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 Pi(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=_s(e,r),u=lT(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 Xk({name:"IMPLICIT_STORE",lifespan:"ephemeral",isProduction:!0}),globalThis.ATOM_IO_IMPLICIT_STORE}};var Zk=class extends Error{constructor(t,e){super(`${Ur[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 Zk(e,t)}function Z1(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:
21
+ ${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 $c(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(jo(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 Os(t,e,n){if(t.valueMap.has(e.key))return dM(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 $c(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 ey(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"),Qk=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 ty(t,...e){let n,r,a,u,c;if(e.length===1){if(c=e[0],"family"in c){const h=ey(t,c);if(a=ct(t,h),u=Kr(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}=ty(t,...e);return"counterfeit"in n&&r&&a?Z1(t,n,r,a):Os(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&&Br(c)}function qr(t,e,n){const r=ct(t,e),a=dl(t,e,n);return a||fl(Qk,t,r,n)}function jc(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 ${Ur[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),ay(x,T,b)},internalRoles:n,subject:f,install:y=>jc(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>qr(t,...g)),json:g=>_s(t,g)})};return t.families.set(r,m),u}function ny(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 ${Ur[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:jo(S)?()=>S(h):S};return e.effects&&(x.effects=e.effects(h)),e.catch&&(x.catch=e.catch),cf(b,x,y)},default:e.default,subject:u,install:h=>ny(h,e),internalRoles:n};return t.families.set(e.key,f),jo(e.default)===!1&&t.defaults.set(e.key,e.default),r}function Q1(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 ${Ur[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 oy(Re(t),{key:S,const:e.const(y),get:e.get(y)},b)},internalRoles:n,subject:f,install:y=>Q1(y,e),default:e.const};return t.families.set(r,m),u}function W1(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 ${Ur[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 ly(Re(t),{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},b)},internalRoles:n,subject:f,install:y=>W1(y,e),default:e.const};return t.families.set(r,m),u}function iy(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 ${Ur[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),uy(x,T,b)},internalRoles:n,subject:f,install:y=>iy(y,e),default:y=>e.get(y)({get:((...g)=>An(t,...g)),find:((...g)=>qr(t,...g)),json:g=>_s(t,g)})};return t.families.set(r,m),u}function Wk(t,e){const n="set"in e,r="const"in e;return r&&n?W1(t,e,void 0):r?Q1(t,e,void 0):n?iy(t,e):jc(t,e)}function af(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],a=e[1];n=qr(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":py(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":aM(t,n);break}}function eT(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 tT(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 nT=(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),lf=(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 Pp(t,e,{oldValue:n,newValue:r},a,u){const c=Br(e);if(a&&u){e.subject.next({newValue:r});const g={checkpoint:!0,type:"state_creation",subType:"writable",token:c,timestamp:Date.now(),value:r};t.operation.subEvents.push(g),u.subject.next(g);const b=Re(t);if(c.family)if(ul(b))switch(c.type){case"atom":case"mutable_atom":t.on.atomCreation.next(c);break;case"writable_pure_selector":case"writable_held_selector":t.on.selectorCreation.next(c);break}else Tn(b)&&b.on.transactionApplying.state===null&&b.transactionMeta.update.subEvents.push(g);return}const{key:f,subject:h,type:m}=e,y={oldValue:Zh(n)?n.READONLY_VIEW:n,newValue:Zh(r)?r.READONLY_VIEW:r};if(ul(t)){switch(m){case"mutable_atom":t.logger.info("📢",m,f,"is now (",r,") subscribers:",h.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":t.logger.info("📢",m,f,"went (",n,"->",r,") subscribers:",h.subscribers.keys())}h.next(y)}if(Tn(t)&&(m==="mutable_atom"||m==="atom")){if(t.on.transactionApplying.state===null){if(Zh(r))return;const{timestamp:g}=t.operation,b={type:"atom_update",token:c,timestamp:g,update:y};t.transactionMeta.update.subEvents.push(b),t.logger.info("📁","atom",f,"stowed (",n,"->",r,")");return}if(hy(e,"tracker:signal")){const g=f.slice(1),b=t.atoms.get(g);Os(t,b,"mut").do(y.newValue)===null&&dy(t,b)}}}const Ip=(t,e,n)=>{const r=Os(t,e,"mut");let a=Kp(n,r);return t.logger.info("⭐","atom",e.key,"setting value",a),a=Kn(t,e,a),lf(t,e.key),dy(t,e),{oldValue:r,newValue:a}};function Xh(t,e){switch(e.type){case"mutable_atom":return Ip(t,e,new e.class);case"atom":{let n;return jo(e.default)?n=$c(t,e):n=e.default,Ip(t,e,n)}}}function eM(t,e){let n;switch(e.type){case"atom":case"mutable_atom":n=Xh(t,e);break;case"writable_held_selector":{const r=hl(t,e.key);for(const u of r.values())Pp(t,e,Xh(t,u),!1);const a=e.getFrom(t);n={oldValue:a,newValue:a}}break;case"writable_pure_selector":{const r=$c(t,e),a=hl(t,e.key);for(const u of a.values())Pp(t,e,Xh(t,u),!1);n={oldValue:r,newValue:$c(t,e)}}break}return n}function Lt(t,...e){El(Fp,t,...e)}const Hp=Symbol("RESET");function ry(t,...e){Lt(t,...e,Hp)}function tM(t,e,n){let r,a,u;const{type:c,key:f}=e;switch(e.type){case"writable_pure_selector":r=Os(t,e,"mut"),a=Kp(n,r),a=Kn(t,e,a);break;case"writable_held_selector":u=e.const,Kp(n,u),r=u,a=u}return t.logger.info("⭐",c,f,"setting to",a),lf(t,f),e.setSelf(a),{oldValue:r,newValue:a}}const nM=(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=tM(t,e,n);break}return r},Fp=Symbol("OWN_OP"),sy=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=ey(e,u),f=Kr(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===Hp?"reset":"set";let y;if(t===Fp){const S=eT(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===Hp?b=eM(y,g):b=nM(y,g,h),Pp(y,g,b,!!a,c),t===Fp&&tT(y)}const iT=(t,e)=>Re(t).atoms.has(e),iM=(t,e)=>Re(t).writableSelectors.has(e),rM=(t,e)=>Re(t).readonlySelectors.has(e),sM=(t,e)=>iT(t,e)||iM(t,e)||rM(t,e);function DS(t,e){return Re(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([n,{source:r}])=>r!==e).map(([n,{source:r}])=>r).filter(n=>sM(t,n))}function hl(t,e,n=new Set){const r=DS(t,e),a=new Map;for(;r.length>0;){const u=r.pop();if(!n.has(u))if(n.add(u),iT(t,u)){const c=t.atoms.get(u);a.set(c.key,c)}else r.push(...DS(t,u))}return a}function oM(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 uf(t,e,n,r){return{get:(...a)=>{const u=Re(t),{token:c,family:f,subKey:h}=ty(t,...a);let m;return"counterfeit"in c&&f&&h?m=Z1(t,c,f,h):m=Os(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}),oM(t,e,n,c,r),m},set:((...a)=>{El(sy,Re(t),...a)}),find:((...a)=>qr(t,...a)),json:a=>_s(t,a)}}function oy(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}=uf(r,h,c,u),S={...e,type:h,subject:a,getFrom:T=>{const M=T.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[k,{source:_}]of M)_!==c&&T.selectorGraph.delete(k,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=>oy(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 ay(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}=uf(r,f,c,u),b={...e,type:f,subject:a,getFrom:()=>{const x=Re(t),T=x.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[k,{source:_}]of T)_!==c&&x.selectorGraph.delete(k,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=>ay(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 ly(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=uf(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:I}]of R)I!==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:_=>ly(_,e,n)};n&&(M.family=n),r.writableSelectors.set(c,M);const k={key:c,type:h};return n&&(k.family=n),k}function uy(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=uf(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:k=>{const _=k.selectorGraph.getRelationEntries({downstreamSelectorKey:c});for(const[G,{source:I}]of _)I!==c&&k.selectorGraph.delete(G,c);k.selectorAtoms.delete(c);const R=Kn(k,T,e.get(b));return t.logger.info("✨",f,c,"=",R),u.clear(),R},setSelf:k=>{e.set(h,k)},install:k=>uy(k,e,n)};n&&(T.family=n),r.writableSelectors.set(c,T);const M={key:c,type:f};return n&&(M.family=n),M}function rT(t,e){const n="set"in e,r="const"in e;if(r&&n){const u=ly(t,e,void 0);return t.on.selectorCreation.next(u),u}if(r){const u=oy(t,e,void 0);return t.on.selectorCreation.next(u),u}if(n){const u=uy(t,e,void 0);return t.on.selectorCreation.next(u),u}const a=ay(t,e,void 0);return t.on.selectorCreation.next(a),a}function aM(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 lM=(t,e)=>{const n=Re(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)},NS=(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=lM(t,e),u=Os(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"&&hy(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)}ty(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){Os(t,u);for(const[g,b]of hl(t,u.key))f.set(g,NS(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,NS(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 sT=(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()}},oT=(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 uM(t,e,n,r=of()){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 oT(t,e,r,n);case"timeline":return sT(t,e,r,n)}}var cy=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=cf(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(sy,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=sT(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 fy(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."),Br(u);const f=new We,h={...e,type:c,install:y=>(y.logger.info("🛠️","atom",a,`installing in store "${y.config.name}"`),fy(y,e,n)),subject:f};n&&(h.family=n),r.atoms.set(h.key,h);const m=Br(h);if(new cy(m,t),n||rT(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:()=>{ry(t,m)},setSelf:x=>{Lt(t,m,x)},onSet:x=>Bo(t,m,`effect[${y}]`,x),token:m,store:Xm(t)});S&&g.push(S),++y}h.cleanup=()=>{for(const b of g)b()}}return t.on.atomCreation.next(m),m}var cM=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(t,e){this.latestSignalAtoms=ct(e,ny(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=Kr(u.family.subKey);switch(a){case"state_creation":this.trackers.set(c,new cy(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 aT(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 ${Ur[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)),fy(b,S,y)},class:e.class,subject:u,install:h=>aT(h,e),internalRoles:n};return t.families.set(e.key,f),iy(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 cM(f,t),r}const fM=(t,e)=>{const n=Re(e),r=`${t.key}:JSON`;return n.families.get(r)},_s=(t,e)=>e.family?qr(t,ct(Re(t),{key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"}),Kr(e.family.subKey)):{type:"writable_pure_selector",key:`${e.key}:JSON`},lT=t=>{const e={type:"atom",key:`*${t.key}`};return t.family&&(e.family={key:`*${t.family.key}`,subKey:t.family.subKey}),e};function Zh(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 qp&&!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 qp(n);return t.valueMap.set(r,f),f.then(function(m){if(t.valueMap.get(r)===f){switch(eT(t,e),Kn(t,e,m),u){case"atom":dy(t,e);break;case"readonly_pure_selector":case"writable_pure_selector":cT(t,r);break}tT(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 dM(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 cy(a,u),r=h}return r}function uT(t,e){const n=t.valueMap.get(e);if(n instanceof qp){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 dy(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)nT(n,c)||(uT(n,c),lf(n,c))}}function cT(t,e){const n=Re(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e}).filter(([a,{source:u}])=>u===e);for(const[a]of r)nT(n,a)||(uT(n,a),lf(n,a),cT(t,a))}function cf(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."),Br(f);const h=new We,m={...e,type:a,install:g=>(g.logger.info("🛠️",a,u,`installing in store "${g.config.name}"`),cf(g,e,n)),subject:h};n&&(m.family=n),r&&(m.internalRoles=r),c.atoms.set(u,m);const y=Br(m);if(e.effects){let g=0;const b=[];for(const S of e.effects){const x=S({resetSelf:()=>{ry(t,y)},setSelf:T=>{Lt(t,y,T)},onSet:T=>Bo(t,y,`effect[${g}]`,T),token:y,store:Xm(t)});x&&b.push(x),++g}m.cleanup=()=>{for(const S of b)S()}}return t.on.atomCreation.next(y),y}function hy(t,e){return"internalRoles"in t?t.internalRoles.includes(e):!1}function py(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,ey(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"&&(py(t,lT(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=hy(u,"tracker:signal");!g&&!b&&n.transactionMeta.update.subEvents.push(h)}else t.on.atomDisposal.next(e)}}function ds(t){return t[0].toUpperCase()+t.slice(1)}var fT=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)=>qr(e,...y)),json:y=>_s(e,y)};const n=t.between[0],r=t.between[1],a=aT(e,{key:`${t.key}/relatedKeys`,class:Jm},["join","relations"]);this.relatedKeysAtoms=a;const u=(y,g,b)=>{const{find:S,get:x,set:T}=y,M=S(a,g),k=x(M);for(const _ of k)b.includes(_)||T(a,_,R=>(R.delete(g),R));T(M,_=>{_.clear();for(const R of b){const G=S(a,R),I=x(G),ee=I.has(g);if(this.relations.cardinality==="1:n"){const J=[];for(const X of I){if(X===g)continue;let he;El(sy,this.store,a,X,pe=>(pe.delete(R),he=pe.size,pe)),he===0&&J.push(X)}!ee&&I.size>0&&T(G,X=>(X.clear(),X));for(const X of J)e.keyRefsInJoins.delete(bc(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 Pi(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(bc(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=bc(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=()=>jc(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=()=>jc(e,{key:`${t.key}/multipleRelatedKeys`,get:y=>({get:g})=>g(fM(a,e),y)},["join","keys"]);switch(t.cardinality){case"1:1":{const y=h(),g=`${n}KeyOf${ds(r)}`,b=`${r}KeyOf${ds(n)}`;this.relations=f,this.states={[g]:y,[b]:y};break}case"1:n":{const y=h(),g=m(),b=`${n}KeyOf${ds(r)}`,S=`${r}KeysOf${ds(n)}`,x={[b]:y,[S]:g};this.relations=f,this.states=x;break}case"n:n":{const y=m(),g=`${n}KeysOf${ds(r)}`,b=`${r}KeysOf${ds(n)}`;this.relations=f,this.states={[g]:y,[b]:y}}}}};function hM(t,e){return t.joins.set(e.key,new fT(e)),{key:e.key,type:"join",a:e.between[0],b:e.between[1],cardinality:e.cardinality}}function pM(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=Xm(e);n=new fT(r.options,a),e.joins.set(t.key,n)}return n}function mM(t,e){return pM(t,e).relatedKeysAtoms}var Qh={exports:{}},ye={};/**
22
+ * @license React
23
+ * react.production.js
24
+ *
25
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
26
+ *
27
+ * This source code is licensed under the MIT license found in the
28
+ * LICENSE file in the root directory of this source tree.
29
+ */var $S;function yM(){if($S)return ye;$S=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 k(E,q,H){this.props=E,this.context=q,this.refs=M,this.updater=H||x}k.prototype.isReactComponent={},k.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")},k.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function _(){}_.prototype=k.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,k.prototype),G.isPureReactComponent=!0;var I=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 $(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,$(Te(E._payload),q,H,Q,re)}}if(Te)return re=re(E),Te=Q===""?"."+Z(E,0):Q,I(re)?(H="",Te!=null&&(H=Te.replace(be,"$&/")+"/"),$(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(I(E))for(var Je=0;Je<E.length;Je++)Q=E[Je],ce=Ct+Z(Q,Je),Te+=$(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+=$(Q,q,H,ce,re);else if(ce==="object"){if(typeof E.then=="function")return $(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 $(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=k,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 jS;function my(){return jS||(jS=1,Qh.exports=yM()),Qh.exports}var j=my();const gM=gk(j),dT=yk({__proto__:null,default:gM},[j]),yy=j.createContext(Ft.STORE);function hT(t,...e){let n;if(e.length===2){const r=e[0],a=e[1];n=qr(t,r,a)}else n=e[0];return n}function Wn(...t){const e=j.useContext(yy),n=hT(e,...t),r=j.useRef(null);return r.current??=a=>{Lt(e,n,a)},r.current}function Et(...t){const e=j.useContext(yy),n=hT(e,...t),r=j.useId();return j.useSyncExternalStore(a=>Bo(e,n,`use-o:${r}`,a),()=>An(e,n),()=>An(e,n))}const pT=(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))})};Sk({key:"mutex",default:!1});var vM=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)}},bM=class Gp{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new vM;static create(e,n){const{type:r,globals:a,actions:u,perspectives:c}=n(new Gp(e)),f={type:r,key:e,globals:a,actions:u,perspectives:c};return Gp.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 SM(t){const{key:e,config:n}=t,r=bM.create(e,n),{actions:a}=r;for(const u of a)J1(Ft.STORE,e,u.key);return Wm(Ft.STORE,e,-1),r}z1({key:"usersInRoomIndex",class:Jm});z1({key:"roomIndex",class:Jm});const wM=wk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"});Ok({key:"usersInMyRoomView",get:t=>({find:e})=>[e(xk(wM),t)]});const xM=(t,e,n,r,a)=>u=>{function c(h,m){if(t.logger.info("🧑‍⚖️","continuity",e,"reconciling updates"),Lt(t,Sc,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)So(t,g,"oldValue");t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),So(t,h,"oldValue"),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),So(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;Zm(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,Yp,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=Y1(t,e),h===u.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${u.epoch} (${u.token.key} ${u.id})`),So(t,u,"newValue"),n.emit(`ack:${e}`,u.epoch),Wm(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,Yp,m=>(m.push(u),m.sort((y,g)=>y.epoch-g.epoch),m))))}};function TM(t){return e=>{for(const n of e)py(t,n)}}function AM(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 mT=ft({key:"mySocketId__INTERNAL",default:void 0});vi({key:"mySocketId",get:({get:t})=>t(mT)});ft({key:"myName",default:null,effects:[pT(globalThis.localStorage,JSON,"myUsername")]});const Sc=ft({key:"updateQueue",default:()=>[]}),Yp=ft({key:"serverConfirmedUpdateQueue",default:()=>[]});function EM(t,e,n){const r=n.key,a=An(t,Sc),u=An(t,Yp),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=_s(t,x)),Lt(t,x,T)),S++;Wm(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,c);const f=xM(t,r,e,a,u);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,f);const h=n.actions.map(g=>(J1(t,r,g.key),oT(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,Sc,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,Sc,x=>(x[S]=b,x))),e.emit(`tx-run:${r}`,{id:b.id,token:g,params:b.params})}))),m=AM(t),y=TM(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 yT=j.createContext({socket:null,services:null}),OM=({children:t,socket:e})=>{const n=j.useRef(new Map).current,r=Wn(mT);return j.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),F.jsx(yT.Provider,{value:{socket:e,services:n},children:t})};function _M(t,e){if(globalThis.env?.NODE_ENV==="development"){const n=j.useRef(!1);j.useEffect(()=>{let r=n.current;if(r===!1)r=t()??!0,n.current=r;else return()=>{jo(r)&&r(),n.current=!1}},e)}else j.useEffect(t,e)}function RM(t,e){const{socket:n,services:r}=j.useContext(yT);_M(()=>{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 CM(t){const e=j.useContext(yy);RM(`tx-sync:${t.key}`,n=>EM(e,n,t))}var Wh={exports:{}},Ga={},ep={exports:{}},tp={};/**
30
+ * @license React
31
+ * scheduler.production.js
32
+ *
33
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
34
+ *
35
+ * This source code is licensed under the MIT license found in the
36
+ * LICENSE file in the root directory of this source tree.
37
+ */var BS;function kM(){return BS||(BS=1,(function(t){function e($,U){var L=$.length;$.push(U);e:for(;0<L;){var te=L-1>>>1,oe=$[te];if(0<a(oe,U))$[te]=U,$[L]=oe,L=te;else break e}}function n($){return $.length===0?null:$[0]}function r($){if($.length===0)return null;var U=$[0],L=$.pop();if(L!==U){$[0]=L;e:for(var te=0,oe=$.length,E=oe>>>1;te<E;){var q=2*(te+1)-1,H=$[q],Q=q+1,re=$[Q];if(0>a(H,L))Q<oe&&0>a(re,H)?($[te]=re,$[Q]=L,te=Q):($[te]=H,$[q]=L,te=q);else if(Q<oe&&0>a(re,L))$[te]=re,$[Q]=L,te=Q;else break e}}return U}function a($,U){var L=$.sortIndex-U.sortIndex;return L!==0?L:$.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,k=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,R=typeof setImmediate<"u"?setImmediate:null;function G($){for(var U=n(m);U!==null;){if(U.callback===null)r(m);else if(U.startTime<=$)r(m),U.sortIndex=U.expirationTime,e(h,U);else break;U=n(m)}}function I($){if(T=!1,G($),!x)if(n(h)!==null)x=!0,ee||(ee=!0,je());else{var U=n(m);U!==null&&ne(I,U.startTime-$)}}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 $=t.unstable_now();he=$;var U=!0;try{e:{x=!1,T&&(T=!1,_(J),J=-1),S=!0;var L=b;try{t:{for(G($),g=n(h);g!==null&&!(g.expirationTime>$&&pe());){var te=g.callback;if(typeof te=="function"){g.callback=null,b=g.priorityLevel;var oe=te(g.expirationTime<=$);if($=t.unstable_now(),typeof oe=="function"){g.callback=oe,G($),U=!0;break t}g===n(h)&&r(h),G($)}else r(h);g=n(h)}if(g!==null)U=!0;else{var E=n(m);E!==null&&ne(I,E.startTime-$),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(){k(we,0)};function ne($,U){J=k(function(){$(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($){$.callback=null},t.unstable_forceFrameRate=function($){0>$||125<$?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<$?Math.floor(1e3/$):5},t.unstable_getCurrentPriorityLevel=function(){return b},t.unstable_next=function($){switch(b){case 1:case 2:case 3:var U=3;break;default:U=b}var L=b;b=U;try{return $()}finally{b=L}},t.unstable_requestPaint=function(){M=!0},t.unstable_runWithPriority=function($,U){switch($){case 1:case 2:case 3:case 4:case 5:break;default:$=3}var L=b;b=$;try{return U()}finally{b=L}},t.unstable_scheduleCallback=function($,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,$){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,$={id:y++,callback:U,priorityLevel:$,startTime:L,expirationTime:oe,sortIndex:-1},L>te?($.sortIndex=L,e(m,$),n(h)===null&&$===n(m)&&(T?(_(J),J=-1):T=!0,ne(I,L-te))):($.sortIndex=oe,e(h,$),x||S||(x=!0,ee||(ee=!0,je()))),$},t.unstable_shouldYield=pe,t.unstable_wrapCallback=function($){var U=b;return function(){var L=b;b=U;try{return $.apply(this,arguments)}finally{b=L}}}})(tp)),tp}var zS;function MM(){return zS||(zS=1,ep.exports=kM()),ep.exports}var np={exports:{}},Yt={};/**
38
+ * @license React
39
+ * react-dom.production.js
40
+ *
41
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
42
+ *
43
+ * This source code is licensed under the MIT license found in the
44
+ * LICENSE file in the root directory of this source tree.
45
+ */var LS;function DM(){if(LS)return Yt;LS=1;var t=my();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 VS;function gT(){if(VS)return np.exports;VS=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=DM(),np.exports}/**
46
+ * @license React
47
+ * react-dom-client.production.js
48
+ *
49
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
50
+ *
51
+ * This source code is licensed under the MIT license found in the
52
+ * LICENSE file in the root directory of this source tree.
53
+ */var US;function NM(){if(US)return Ga;US=1;var t=MM(),e=my(),n=gT();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"),k=Symbol.for("react.profiler"),_=Symbol.for("react.consumer"),R=Symbol.for("react.context"),G=Symbol.for("react.forward_ref"),I=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 k:return"Profiler";case M:return"StrictMode";case I: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,$=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)?Y0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=Y0(s),i=J0(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=J0(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(`
54
+ at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
55
+ `+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 P=function(){throw Error()};if(Object.defineProperty(P.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(P,[])}catch(z){var B=z}Reflect.construct(i,[],P)}else{try{P.call()}catch(z){B=z}i.call(P.prototype)}}else{try{throw Error()}catch(z){B=z}(P=i())&&typeof P.catch=="function"&&P.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(`
56
+ `),N=w.split(`
57
+ `);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=`
58
+ `+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`
59
+ Error generating stack: `+l.message+`
60
+ `+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,Og=t.unstable_ImmediatePriority,_g=t.unstable_UserBlockingPriority,ql=t.unstable_NormalPriority,Z_=t.unstable_LowPriority,Rg=t.unstable_IdlePriority,Q_=t.log,W_=t.unstable_setDisableYieldValue,ea=null,dn=null;function tr(i){if(typeof Q_=="function"&&W_(i),dn&&typeof dn.setStrictMode=="function")try{dn.setStrictMode(ea,i)}catch{}}var hn=Math.clz32?Math.clz32:nR,eR=Math.log,tR=Math.LN2;function nR(i){return i>>>=0,i===0?32:31-(eR(i)/tR|0)|0}var Pl=256,Il=262144,Hl=4194304;function Gr(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=Gr(l):(v&=w,v!==0?d=Gr(v):o||(o=w&~i,o!==0&&(d=Gr(o))))):(w=l&~p,w!==0?d=Gr(w):v!==0?d=Gr(v):o||(o=l&~i,o!==0&&(d=Gr(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 iR(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 Cg(){var i=Hl;return Hl<<=1,(Hl&62914560)===0&&(Hl=4194304),i}function Bf(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 rR(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),P=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&=~P}l!==0&&kg(i,l,0),p!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=p&~(v&~s))}function kg(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 Mg(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 Dg(i,s){var o=s&-s;return o=(o&42)!==0?1:zf(o),(o&(i.suspendedLanes|s))!==0?0:o}function zf(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 Lf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ng(){var i=U.p;return i!==0?i:(i=window.event,i===void 0?32:vS(i.type))}function $g(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,ks="__reactContainer$"+nr,Vf="__reactEvents$"+nr,sR="__reactListeners$"+nr,oR="__reactHandles$"+nr,jg="__reactResources$"+nr,ia="__reactMarker$"+nr;function Uf(i){delete i[Ut],delete i[tn],delete i[Vf],delete i[sR],delete i[oR]}function Ms(i){var s=i[Ut];if(s)return s;for(var o=i.parentNode;o;){if(s=o[ks]||o[Ut]){if(o=s.alternate,s.child!==null||o!==null&&o.child!==null)for(i=nS(i);i!==null;){if(o=i[Ut])return o;i=nS(i)}return s}i=o,o=i.parentNode}return null}function Ds(i){if(i=i[Ut]||i[ks]){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 Ns(i){var s=i[jg];return s||(s=i[jg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Nt(i){i[ia]=!0}var Bg=new Set,zg={};function Yr(i,s){$s(i,s),$s(i+"Capture",s)}function $s(i,s){for(zg[i]=s,i=0;i<s.length;i++)Bg.add(s[i])}var aR=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]*$"),Lg={},Vg={};function lR(i){return Gt.call(Vg,i)?!0:Gt.call(Lg,i)?!1:aR.test(i)?Vg[i]=!0:(Lg[i]=!0,!1)}function Gl(i,s,o){if(lR(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 Ug(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function uR(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 Kf(i){if(!i._valueTracker){var s=Ug(i)?"checked":"value";i._valueTracker=uR(i,s,""+i[s])}}function Kg(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var o=s.getValue(),l="";return i&&(l=Ug(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 cR=/[\n"\\]/g;function _n(i){return i.replace(cR,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function qf(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 qg(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)){Kf(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),Kf(i)}function Pf(i,s,o){s==="number"&&Jl(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function js(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 Pg(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),Kf(i)}function Bs(i,s){if(s){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=s;return}}i.textContent=s}var fR=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 Hg(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||fR.has(s)?s==="float"?i.cssFloat=o:i[s]=(""+o).trim():i[s]=o+"px"}function Fg(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&&Hg(i,d,l)}else for(var p in s)s.hasOwnProperty(p)&&Hg(i,p,s[p])}function If(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 dR=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"]]),hR=/^[\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 hR.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ei(){}var Hf=null;function Ff(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var zs=null,Ls=null;function Gg(i){var s=Ds(i);if(s&&(i=s.stateNode)){var o=i[tn]||null;e:switch(i=s.stateNode,s.type){case"input":if(qf(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));qf(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&&Kg(l)}break e;case"textarea":Pg(i,o.value,o.defaultValue);break e;case"select":s=o.value,s!=null&&js(i,!!o.multiple,s,!1)}}}var Gf=!1;function Yg(i,s,o){if(Gf)return i(s,o);Gf=!0;try{var l=i(s);return l}finally{if(Gf=!1,(zs!==null||Ls!==null)&&(zu(),zs&&(s=zs,i=Ls,Ls=zs=null,Gg(s),i)))for(s=0;s<i.length;s++)Gg(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"),Yf=!1;if(Oi)try{var oa={};Object.defineProperty(oa,"passive",{get:function(){Yf=!0}}),window.addEventListener("test",oa,oa),window.removeEventListener("test",oa,oa)}catch{Yf=!1}var ir=null,Jf=null,Zl=null;function Jg(){if(Zl)return Zl;var i,s=Jf,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 Xg(){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:Xg,this.isPropagationStopped=Xg,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 Jr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},eu=nn(Jr),aa=g({},Jr,{view:0,detail:0}),pR=nn(aa),Xf,Zf,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:Wf,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"?(Xf=i.screenX-la.screenX,Zf=i.screenY-la.screenY):Zf=Xf=0,la=i),Xf)},movementY:function(i){return"movementY"in i?i.movementY:Zf}}),Zg=nn(tu),mR=g({},tu,{dataTransfer:0}),yR=nn(mR),gR=g({},aa,{relatedTarget:0}),Qf=nn(gR),vR=g({},Jr,{animationName:0,elapsedTime:0,pseudoElement:0}),bR=nn(vR),SR=g({},Jr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),wR=nn(SR),xR=g({},Jr,{data:0}),Qg=nn(xR),TR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},AR={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"},ER={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function OR(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=ER[i])?!!s[i]:!1}function Wf(){return OR}var _R=g({},aa,{key:function(i){if(i.key){var s=TR[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"?AR[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Wf,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}}),RR=nn(_R),CR=g({},tu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Wg=nn(CR),kR=g({},aa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Wf}),MR=nn(kR),DR=g({},Jr,{propertyName:0,elapsedTime:0,pseudoElement:0}),NR=nn(DR),$R=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}),jR=nn($R),BR=g({},Jr,{newState:0,oldState:0}),zR=nn(BR),LR=[9,13,27,32],ed=Oi&&"CompositionEvent"in window,ua=null;Oi&&"documentMode"in document&&(ua=document.documentMode);var VR=Oi&&"TextEvent"in window&&!ua,ev=Oi&&(!ed||ua&&8<ua&&11>=ua),tv=" ",nv=!1;function iv(i,s){switch(i){case"keyup":return LR.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function rv(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Vs=!1;function UR(i,s){switch(i){case"compositionend":return rv(s);case"keypress":return s.which!==32?null:(nv=!0,tv);case"textInput":return i=s.data,i===tv&&nv?null:i;default:return null}}function KR(i,s){if(Vs)return i==="compositionend"||!ed&&iv(i,s)?(i=Jg(),Zl=Jf=ir=null,Vs=!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 ev&&s.locale!=="ko"?null:s.data;default:return null}}var qR={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 sv(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!qR[i.type]:s==="textarea"}function ov(i,s,o,l){zs?Ls?Ls.push(l):Ls=[l]:zs=l,s=Iu(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 PR(i){q0(i,0)}function nu(i){var s=ra(i);if(Kg(s))return i}function av(i,s){if(i==="change")return s}var lv=!1;if(Oi){var td;if(Oi){var nd="oninput"in document;if(!nd){var uv=document.createElement("div");uv.setAttribute("oninput","return;"),nd=typeof uv.oninput=="function"}td=nd}else td=!1;lv=td&&(!document.documentMode||9<document.documentMode)}function cv(){ca&&(ca.detachEvent("onpropertychange",fv),fa=ca=null)}function fv(i){if(i.propertyName==="value"&&nu(fa)){var s=[];ov(s,fa,i,Ff(i)),Yg(PR,s)}}function IR(i,s,o){i==="focusin"?(cv(),ca=s,fa=o,ca.attachEvent("onpropertychange",fv)):i==="focusout"&&cv()}function HR(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return nu(fa)}function FR(i,s){if(i==="click")return nu(s)}function GR(i,s){if(i==="input"||i==="change")return nu(s)}function YR(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var pn=typeof Object.is=="function"?Object.is:YR;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 dv(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function hv(i,s){var o=dv(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=dv(o)}}function pv(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?pv(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function mv(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 id(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 JR=Oi&&"documentMode"in document&&11>=document.documentMode,Us=null,rd=null,ha=null,sd=!1;function yv(i,s,o){var l=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;sd||Us==null||Us!==Jl(l)||(l=Us,"selectionStart"in l&&id(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=Iu(rd,"onSelect"),0<l.length&&(s=new eu("onSelect","select",null,s,o),i.push({event:s,listeners:l}),s.target=Us)))}function Xr(i,s){var o={};return o[i.toLowerCase()]=s.toLowerCase(),o["Webkit"+i]="webkit"+s,o["Moz"+i]="moz"+s,o}var Ks={animationend:Xr("Animation","AnimationEnd"),animationiteration:Xr("Animation","AnimationIteration"),animationstart:Xr("Animation","AnimationStart"),transitionrun:Xr("Transition","TransitionRun"),transitionstart:Xr("Transition","TransitionStart"),transitioncancel:Xr("Transition","TransitionCancel"),transitionend:Xr("Transition","TransitionEnd")},od={},gv={};Oi&&(gv=document.createElement("div").style,"AnimationEvent"in window||(delete Ks.animationend.animation,delete Ks.animationiteration.animation,delete Ks.animationstart.animation),"TransitionEvent"in window||delete Ks.transitionend.transition);function Zr(i){if(od[i])return od[i];if(!Ks[i])return i;var s=Ks[i],o;for(o in s)if(s.hasOwnProperty(o)&&o in gv)return od[i]=s[o];return i}var vv=Zr("animationend"),bv=Zr("animationiteration"),Sv=Zr("animationstart"),XR=Zr("transitionrun"),ZR=Zr("transitionstart"),QR=Zr("transitioncancel"),wv=Zr("transitionend"),xv=new Map,ad="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(" ");ad.push("scrollEnd");function Gn(i,s){xv.set(i,s),Yr(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=[],qs=0,ld=0;function ru(){for(var i=qs,s=ld=qs=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&&Tv(o,d,p)}}function su(i,s,o,l){Rn[qs++]=i,Rn[qs++]=s,Rn[qs++]=o,Rn[qs++]=l,ld|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function ud(i,s,o,l){return su(i,s,o,l),ou(i)}function Qr(i,s){return su(i,null,null,s),ou(i)}function Tv(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,vh=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 WR(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 WR(i,s,o,l)}function cd(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 Av(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")cd(i)&&(v=1);else if(typeof i=="string")v=rk(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 Wr(o.children,d,p,s);case M:v=8,d|=24;break;case k:return i=mn(12,o,s,d|2),i.elementType=k,i.lanes=p,i;case I:return i=mn(13,o,s,d),i.elementType=I,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 Wr(i,s,o,l){return i=mn(7,i,l,s),i.lanes=o,i}function fd(i,s,o){return i=mn(6,i,null,s),i.lanes=o,i}function Ev(i){var s=mn(18,null,null,0);return s.stateNode=i,s}function dd(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 Ov=new WeakMap;function Cn(i,s){if(typeof i=="object"&&i!==null){var o=Ov.get(i);return o!==void 0?o:(s={value:i,source:s,stack:En(s)},Ov.set(i,s),s)}return{value:i,source:s,stack:En(s)}}var Is=[],Hs=0,lu=null,pa=0,kn=[],Mn=0,rr=null,si=1,oi="";function Ri(i,s){Is[Hs++]=pa,Is[Hs++]=lu,lu=i,pa=s}function _v(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 hd(i){i.return!==null&&(Ri(i,1),_v(i,1,0))}function pd(i){for(;i===lu;)lu=Is[--Hs],Is[Hs]=null,pa=Is[--Hs],Is[Hs]=null;for(;i===rr;)rr=kn[--Mn],kn[Mn]=null,oi=kn[--Mn],kn[Mn]=null,si=kn[--Mn],kn[Mn]=null}function Rv(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,md=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)),md}function Cv(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),qg(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||F0(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 kv(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 Fs(i){if(i!==Kt)return!1;if(!Ce)return kv(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")||Nh(i.type,i.memoizedProps)),o=!o),o&&Ze&&or(i),kv(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=tS(i)}else if(s===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Ze=tS(i)}else s===27?(s=Ze,Sr(i.type)?(i=Lh,Lh=null,Ze=i):Ze=s):Ze=Kt?$n(i.stateNode.nextSibling):null;return!0}function es(){Ze=Kt=null,Ce=!1}function yd(){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 gd=E(null),ts=null,Ci=null;function ar(i,s,o){H(gd,s._currentValue),s._currentValue=o}function ki(i){i._currentValue=gd.current,q(gd)}function vd(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 bd(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),vd(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),vd(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 Gs(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&&bd(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 ns(i){ts=i,Ci=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function qt(i){return Mv(ts,i)}function cu(i,s){return ts===null&&ns(i),Mv(i,s)}function Mv(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 eC=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()})}},tC=t.unstable_scheduleCallback,nC=t.unstable_NormalPriority,bt={$$typeof:R,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Sd(){return{controller:new eC,data:new Map,refCount:0}}function ya(i){i.refCount--,i.refCount===0&&tC(nC,function(){i.controller.abort()})}var ga=null,wd=0,Ys=0,Js=null;function iC(i,s){if(ga===null){var o=ga=[];wd=0,Ys=Ah(),Js={status:"pending",value:void 0,then:function(l){o.push(l)}}}return wd++,s.then(Dv,Dv),s}function Dv(){if(--wd===0&&ga!==null){Js!==null&&(Js.status="fulfilled");var i=ga;ga=null,Ys=0,Js=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function rC(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 Nv=$.S;$.S=function(i,s){y0=st(),typeof s=="object"&&s!==null&&typeof s.then=="function"&&iC(i,s),Nv!==null&&Nv(i,s)};var is=E(null);function xd(){var i=is.current;return i!==null?i:He.pooledCache}function fu(i,s){s===null?H(is,is.current):H(is,s.pool)}function $v(){var i=xd();return i===null?null:{parent:bt._currentValue,pool:i}}var Xs=Error(r(460)),Td=Error(r(474)),du=Error(r(542)),hu={then:function(){}};function jv(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Bv(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,Lv(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,Lv(i),i}throw ss=s,Xs}}function rs(i){try{var s=i._init;return s(i._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(ss=o,Xs):o}}var ss=null;function zv(){if(ss===null)throw Error(r(459));var i=ss;return ss=null,i}function Lv(i){if(i===Xs||i===du)throw Error(r(483))}var Zs=null,va=0;function pu(i){var s=va;return va+=1,Zs===null&&(Zs=[]),Bv(Zs,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 Vv(i){function s(C,O){if(i){var D=C.deletions;D===null?(C.deletions=[O],C.flags|=16):D.push(O)}}function o(C,O){if(!i)return null;for(;O!==null;)s(C,O),O=O.sibling;return null}function l(C){for(var O=new Map;C!==null;)C.key!==null?O.set(C.key,C):O.set(C.index,C),C=C.sibling;return O}function d(C,O){return C=_i(C,O),C.index=0,C.sibling=null,C}function p(C,O,D){return C.index=D,i?(D=C.alternate,D!==null?(D=D.index,D<O?(C.flags|=67108866,O):D):(C.flags|=67108866,O)):(C.flags|=1048576,O)}function v(C){return i&&C.alternate===null&&(C.flags|=67108866),C}function w(C,O,D,K){return O===null||O.tag!==6?(O=fd(D,C.mode,K),O.return=C,O):(O=d(O,D),O.return=C,O)}function A(C,O,D,K){var le=D.type;return le===T?V(C,O,D.props.children,K,D.key):O!==null&&(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&rs(le)===O.type)?(O=d(O,D.props),ba(O,D),O.return=C,O):(O=au(D.type,D.key,D.props,null,C.mode,K),ba(O,D),O.return=C,O)}function N(C,O,D,K){return O===null||O.tag!==4||O.stateNode.containerInfo!==D.containerInfo||O.stateNode.implementation!==D.implementation?(O=dd(D,C.mode,K),O.return=C,O):(O=d(O,D.children||[]),O.return=C,O)}function V(C,O,D,K,le){return O===null||O.tag!==7?(O=Wr(D,C.mode,K,le),O.return=C,O):(O=d(O,D),O.return=C,O)}function P(C,O,D){if(typeof O=="string"&&O!==""||typeof O=="number"||typeof O=="bigint")return O=fd(""+O,C.mode,D),O.return=C,O;if(typeof O=="object"&&O!==null){switch(O.$$typeof){case S:return D=au(O.type,O.key,O.props,null,C.mode,D),ba(D,O),D.return=C,D;case x:return O=dd(O,C.mode,D),O.return=C,O;case X:return O=rs(O),P(C,O,D)}if(ne(O)||je(O))return O=Wr(O,C.mode,D,null),O.return=C,O;if(typeof O.then=="function")return P(C,pu(O),D);if(O.$$typeof===R)return P(C,cu(C,O),D);mu(C,O)}return null}function B(C,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(C,O,""+D,K);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case S:return D.key===le?A(C,O,D,K):null;case x:return D.key===le?N(C,O,D,K):null;case X:return D=rs(D),B(C,O,D,K)}if(ne(D)||je(D))return le!==null?null:V(C,O,D,K,null);if(typeof D.then=="function")return B(C,O,pu(D),K);if(D.$$typeof===R)return B(C,O,cu(C,D),K);mu(C,D)}return null}function z(C,O,D,K,le){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return C=C.get(D)||null,w(O,C,""+K,le);if(typeof K=="object"&&K!==null){switch(K.$$typeof){case S:return C=C.get(K.key===null?D:K.key)||null,A(O,C,K,le);case x:return C=C.get(K.key===null?D:K.key)||null,N(O,C,K,le);case X:return K=rs(K),z(C,O,D,K,le)}if(ne(K)||je(K))return C=C.get(D)||null,V(O,C,K,le,null);if(typeof K.then=="function")return z(C,O,D,pu(K),le);if(K.$$typeof===R)return z(C,O,D,cu(O,K),le);mu(O,K)}return null}function ie(C,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(C,se,D[Se],K);if($e===null){se===null&&(se=_e);break}i&&se&&$e.alternate===null&&s(C,se),O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e,se=_e}if(Se===D.length)return o(C,se),Ce&&Ri(C,Se),le;if(se===null){for(;Se<D.length;Se++)se=P(C,D[Se],K),se!==null&&(O=p(se,O,Se),Ne===null?le=se:Ne.sibling=se,Ne=se);return Ce&&Ri(C,Se),le}for(se=l(se);Se<D.length;Se++)_e=z(se,C,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(C,Er)}),Ce&&Ri(C,Se),le}function ue(C,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(C,se,$e.value,K);if(Er===null){se===null&&(se=_e);break}i&&se&&Er.alternate===null&&s(C,se),O=p(Er,O,Se),Ne===null?le=Er:Ne.sibling=Er,Ne=Er,se=_e}if($e.done)return o(C,se),Ce&&Ri(C,Se),le;if(se===null){for(;!$e.done;Se++,$e=D.next())$e=P(C,$e.value,K),$e!==null&&(O=p($e,O,Se),Ne===null?le=$e:Ne.sibling=$e,Ne=$e);return Ce&&Ri(C,Se),le}for(se=l(se);!$e.done;Se++,$e=D.next())$e=z(se,C,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(mk){return s(C,mk)}),Ce&&Ri(C,Se),le}function Pe(C,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(C,O.sibling),K=d(O,D.props.children),K.return=C,C=K;break e}}else if(O.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===X&&rs(le)===O.type){o(C,O.sibling),K=d(O,D.props),ba(K,D),K.return=C,C=K;break e}o(C,O);break}else s(C,O);O=O.sibling}D.type===T?(K=Wr(D.props.children,C.mode,K,D.key),K.return=C,C=K):(K=au(D.type,D.key,D.props,null,C.mode,K),ba(K,D),K.return=C,C=K)}return v(C);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(C,O.sibling),K=d(O,D.children||[]),K.return=C,C=K;break e}else{o(C,O);break}else s(C,O);O=O.sibling}K=dd(D,C.mode,K),K.return=C,C=K}return v(C);case X:return D=rs(D),Pe(C,O,D,K)}if(ne(D))return ie(C,O,D,K);if(je(D)){if(le=je(D),typeof le!="function")throw Error(r(150));return D=le.call(D),ue(C,O,D,K)}if(typeof D.then=="function")return Pe(C,O,pu(D),K);if(D.$$typeof===R)return Pe(C,O,cu(C,D),K);mu(C,D)}return typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint"?(D=""+D,O!==null&&O.tag===6?(o(C,O.sibling),K=d(O,D),K.return=C,C=K):(o(C,O),K=fd(D,C.mode,K),K.return=C,C=K),v(C)):o(C,O)}return function(C,O,D,K){try{va=0;var le=Pe(C,O,D,K);return Zs=null,le}catch(se){if(se===Xs||se===du)throw se;var Ne=mn(29,se,null,C.mode);return Ne.lanes=K,Ne.return=C,Ne}finally{}}}var os=Vv(!0),Uv=Vv(!1),lr=!1;function Ad(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Ed(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),Tv(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,Mg(i,o)}}function Od(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 _d=!1;function wa(){if(_d){var i=Js;if(i!==null)throw i}}function xa(i,s,o,l){_d=!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 P=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===Ys&&(_d=!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 Pe=o;switch(ue.tag){case 1:if(ie=ue.payload,typeof ie=="function"){P=ie.call(Pe,P,B);break e}P=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=ue.payload,B=typeof ie=="function"?ie.call(Pe,P,B):ie,B==null)break e;P=g({},P,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=P):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=P),d.baseState=A,d.firstBaseUpdate=N,d.lastBaseUpdate=V,p===null&&(d.shared.lanes=0),mr|=v,i.lanes=v,i.memoizedState=P}}function Kv(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function qv(i,s){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;i<o.length;i++)Kv(o[i],s)}var Qs=E(null),yu=E(0);function Pv(i,s){i=Vi,H(yu,i),H(Qs,s),Vi=i|s.baseLanes}function Rd(){H(yu,Vi),H(Qs,Qs.current)}function Cd(){Vi=yu.current,q(Qs),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||Qs.current!==null||s.memoizedState!==null)&&(Nn=i)}function kd(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||Bh(o)||zh(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,Ws=!1,as=!1,bu=0,Ta=0,eo=null,sC=0;function ot(){throw Error(r(321))}function Md(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 Dd(i,s,o,l,d,p){return Mi=p,ve=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,$.H=i===null||i.memoizedState===null?_b:Gd,as=!1,p=o(l,d),as=!1,Ws&&(p=Fv(s,o,l,d)),Hv(i),p}function Hv(i){$.H=Oa;var s=Ke!==null&&Ke.next!==null;if(Mi=0,St=Ke=ve=null,vu=!1,Ta=0,eo=null,s)throw Error(r(300));i===null||wt||(i=i.dependencies,i!==null&&uu(i)&&(wt=!0))}function Fv(i,s,o,l){ve=i;var d=0;do{if(Ws&&(eo=null),Ta=0,Ws=!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)}$.H=Rb,p=s(o,l)}while(Ws);return p}function oC(){var i=$.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 Nd(){var i=bu!==0;return bu=0,i}function $d(i,s,o){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~o}function jd(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,Ws=!1,Ta=bu=0,eo=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,eo===null&&(eo=[]),i=Bv(eo,i,s),s=ve,(St===null?s.memoizedState:St.next)===null&&(s=s.alternate,$.H=s===null||s.memoizedState===null?_b:Gd),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 Bd(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 zd(s,Ke,i)}function zd(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 P=N.lane&-536870913;if(P!==N.lane?(Oe&P)===P:(Mi&P)===P){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}),P===Ys&&(V=!0);else if((Mi&B)===B){N=N.next,B===Ys&&(V=!0);continue}else P={lane:0,revertLane:N.revertLane,gesture:null,action:N.action,hasEagerState:N.hasEagerState,eagerState:N.eagerState,next:null},A===null?(w=A=P,v=p):A=A.next=P,ve.lanes|=B,mr|=B;P=N.action,as&&o(p,P),p=N.hasEagerState?N.eagerState:o(p,P)}else B={lane:P,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|=P,mr|=P;N=N.next}while(N!==null&&N!==s);if(A===null?v=p:A.next=w,!pn(p,i.memoizedState)&&(wt=!0,V&&(o=Js,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 Ld(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 Gv(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,Kd(Xv.bind(null,l,d,i),[i]),d.getSnapshot!==s||v||St!==null&&St.memoizedState.tag&1){if(l.flags|=2048,to(9,{destroy:void 0},Jv.bind(null,l,d,o,s),null),He===null)throw Error(r(349));p||(Mi&127)!==0||Yv(l,s,o)}return o}function Yv(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 Jv(i,s,o,l){s.value=o,s.getSnapshot=l,Zv(s)&&Qv(i)}function Xv(i,s,o){return o(function(){Zv(s)&&Qv(i)})}function Zv(i){var s=i.getSnapshot;i=i.value;try{var o=s();return!pn(i,o)}catch{return!0}}function Qv(i){var s=Qr(i,2);s!==null&&ln(s,i,2)}function Vd(i){var s=Zt();if(typeof i=="function"){var o=i;if(i=o(),as){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 Wv(i,s,o,l){return i.baseState=o,zd(i,Ke,typeof l=="function"?l:Di)}function aC(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)}};$.T!==null?o(!0):p.isTransition=!1,l(p),o=s.pending,o===null?(p.next=s.pending=p,eb(s,p)):(p.next=o.next,s.pending=o.next=p)}}function eb(i,s){var o=s.action,l=s.payload,d=i.state;if(s.isTransition){var p=$.T,v={};$.T=v;try{var w=o(d,l),A=$.S;A!==null&&A(v,w),tb(i,s,w)}catch(N){Ud(i,s,N)}finally{p!==null&&v.types!==null&&(p.types=v.types),$.T=p}}else try{p=o(d,l),tb(i,s,p)}catch(N){Ud(i,s,N)}}function tb(i,s,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(l){nb(i,s,l)},function(l){return Ud(i,s,l)}):nb(i,s,o)}function nb(i,s,o){s.status="fulfilled",s.value=o,ib(s),i.state=o,s=i.pending,s!==null&&(o=s.next,o===s?i.pending=null:(o=o.next,s.next=o,eb(i,o)))}function Ud(i,s,o){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=o,ib(s),s=s.next;while(s!==l)}i.action=null}function ib(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function rb(i,s){return s}function sb(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:rb,lastRenderedState:s},o.queue=l,o=Ab.bind(null,ve,l),l.dispatch=o,l=Vd(!1),p=Fd.bind(null,ve,!1,l.queue),l=Zt(),d={state:s,dispatch:null,action:i,pending:null},l.queue=d,o=aC.bind(null,ve,d,p,o),d.dispatch=o,l.memoizedState=i,[s,o,!1]}function ob(i){var s=mt();return ab(s,Ke,i)}function ab(i,s,o){if(s=zd(i,s,rb)[0],i=xu(Di)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=Aa(s)}catch(v){throw v===Xs?du:v}else l=s;s=mt();var d=s.queue,p=d.dispatch;return o!==s.memoizedState&&(ve.flags|=2048,to(9,{destroy:void 0},lC.bind(null,d,o),null)),[l,p,i]}function lC(i,s){i.action=s}function lb(i){var s=mt(),o=Ke;if(o!==null)return ab(s,o,i);mt(),s=s.memoizedState,o=mt();var l=o.queue.dispatch;return o.memoizedState=i,[s,l,!1]}function to(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 ub(){return mt().memoizedState}function Tu(i,s,o,l){var d=Zt();ve.flags|=i,d.memoizedState=to(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&&Md(l,Ke.memoizedState.deps)?d.memoizedState=to(s,p,o,l):(ve.flags|=i,d.memoizedState=to(1|s,p,o,l))}function cb(i,s){Tu(8390656,8,i,s)}function Kd(i,s){Au(2048,8,i,s)}function uC(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 fb(i){var s=mt().memoizedState;return uC({ref:s,nextImpl:i}),function(){if((Be&2)!==0)throw Error(r(440));return s.impl.apply(void 0,arguments)}}function db(i,s){return Au(4,2,i,s)}function hb(i,s){return Au(4,4,i,s)}function pb(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 mb(i,s,o){o=o!=null?o.concat([i]):null,Au(4,4,pb.bind(null,s,i),o)}function qd(){}function yb(i,s){var o=mt();s=s===void 0?null:s;var l=o.memoizedState;return s!==null&&Md(s,l[1])?l[0]:(o.memoizedState=[i,s],i)}function gb(i,s){var o=mt();s=s===void 0?null:s;var l=o.memoizedState;if(s!==null&&Md(s,l[1]))return l[0];if(l=i(),as){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=v0(),ve.lanes|=i,mr|=i,o)}function vb(i,s,o,l){return pn(o,s)?o:Qs.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=v0(),ve.lanes|=i,mr|=i,s)}function bb(i,s,o,l,d){var p=U.p;U.p=p!==0&&8>p?p:8;var v=$.T,w={};$.T=w,Fd(i,!1,s,o);try{var A=d(),N=$.S;if(N!==null&&N(w,A),A!==null&&typeof A=="object"&&typeof A.then=="function"){var V=rC(A,l);Ea(i,s,V,Sn(i))}else Ea(i,s,l,Sn(i))}catch(P){Ea(i,s,{then:function(){},status:"rejected",reason:P},Sn())}finally{U.p=p,v!==null&&w.types!==null&&(v.types=w.types),$.T=v}}function cC(){}function Id(i,s,o,l){if(i.tag!==5)throw Error(r(476));var d=Sb(i).queue;bb(i,d,s,L,o===null?cC:function(){return wb(i),o(l)})}function Sb(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 wb(i){var s=Sb(i);s.next===null&&(s=i.alternate.memoizedState),Ea(i,s.next.queue,{},Sn())}function Hd(){return qt(qa)}function xb(){return mt().memoizedState}function Tb(){return mt().memoizedState}function fC(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:Sd()},i.payload=s;return}s=s.return}}function dC(i,s,o){var l=Sn();o={lane:l,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},Eu(i)?Eb(s,o):(o=ud(i,s,o,l),o!==null&&(ln(o,i,l),Ob(o,s,l)))}function Ab(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))Eb(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=ud(i,s,d,l),o!==null)return ln(o,i,l),Ob(o,s,l),!0}return!1}function Fd(i,s,o,l){if(l={lane:2,revertLane:Ah(),gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},Eu(i)){if(s)throw Error(r(479))}else s=ud(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 Eb(i,s){Ws=vu=!0;var o=i.pending;o===null?s.next=s:(s.next=o.next,o.next=s),i.pending=s}function Ob(i,s,o){if((o&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,o|=l,s.lanes=o,Mg(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 _b={readContext:qt,use:wu,useCallback:function(i,s){return Zt().memoizedState=[i,s===void 0?null:s],i},useContext:qt,useEffect:cb,useImperativeHandle:function(i,s,o){o=o!=null?o.concat([i]):null,Tu(4194308,4,pb.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(as){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(as){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=dC.bind(null,ve,i),[l.memoizedState,i]},useRef:function(i){var s=Zt();return i={current:i},s.memoizedState=i},useState:function(i){i=Vd(i);var s=i.queue,o=Ab.bind(null,ve,s);return s.dispatch=o,[i.memoizedState,o]},useDebugValue:qd,useDeferredValue:function(i,s){var o=Zt();return Pd(o,i,s)},useTransition:function(){var i=Vd(!1);return i=bb.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||Yv(l,s,o)}d.memoizedState=o;var p={value:o,getSnapshot:s};return d.queue=p,cb(Xv.bind(null,l,p,i),[i]),l.flags|=2048,to(9,{destroy:void 0},Jv.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=sC++,s="_"+s+"r_"+o.toString(32)+"_";return i.memoizedState=s},useHostTransitionStatus:Hd,useFormState:sb,useActionState:sb,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=Fd.bind(null,ve,!0,o),o.dispatch=s,[i,s]},useMemoCache:Bd,useCacheRefresh:function(){return Zt().memoizedState=fC.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)}}},Gd={readContext:qt,use:wu,useCallback:yb,useContext:qt,useEffect:Kd,useImperativeHandle:mb,useInsertionEffect:db,useLayoutEffect:hb,useMemo:gb,useReducer:xu,useRef:ub,useState:function(){return xu(Di)},useDebugValue:qd,useDeferredValue:function(i,s){var o=mt();return vb(o,Ke.memoizedState,i,s)},useTransition:function(){var i=xu(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Gv,useId:xb,useHostTransitionStatus:Hd,useFormState:ob,useActionState:ob,useOptimistic:function(i,s){var o=mt();return Wv(o,Ke,i,s)},useMemoCache:Bd,useCacheRefresh:Tb};Gd.useEffectEvent=fb;var Rb={readContext:qt,use:wu,useCallback:yb,useContext:qt,useEffect:Kd,useImperativeHandle:mb,useInsertionEffect:db,useLayoutEffect:hb,useMemo:gb,useReducer:Ld,useRef:ub,useState:function(){return Ld(Di)},useDebugValue:qd,useDeferredValue:function(i,s){var o=mt();return Ke===null?Pd(o,i,s):vb(o,Ke.memoizedState,i,s)},useTransition:function(){var i=Ld(Di)[0],s=mt().memoizedState;return[typeof i=="boolean"?i:Aa(i),s]},useSyncExternalStore:Gv,useId:xb,useHostTransitionStatus:Hd,useFormState:lb,useActionState:lb,useOptimistic:function(i,s){var o=mt();return Ke!==null?Wv(o,Ke,i,s):(o.baseState=i,[i,o.queue.dispatch])},useMemoCache:Bd,useCacheRefresh:Tb};Rb.useEffectEvent=fb;function Yd(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 Jd={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 Cb(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 kb(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&&Jd.enqueueReplaceState(s,s.state,null)}function ls(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 Mb(i){iu(i)}function Db(i){console.error(i)}function Nb(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 $b(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 Xd(i,s,o){return o=ur(o),o.tag=3,o.payload={element:null},o.callback=function(){Ou(i,s)},o}function jb(i){return i=ur(i),i.tag=3,i}function Bb(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(){$b(s,o,l)}}var v=o.stateNode;v!==null&&typeof v.componentDidCatch=="function"&&(i.callback=function(){$b(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 hC(i,s,o,l,d){if(o.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=o.alternate,s!==null&&Gs(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),wh(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)),wh(i,l,d)),!1}throw Error(r(435,o.tag))}return wh(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!==md&&(i=Error(r(422),{cause:l}),ma(Cn(i,o)))):(l!==md&&(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=Xd(i.stateNode,l,d),Od(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=Xd(o.stateNode,l,i),Od(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=jb(d),Bb(d,i,o,l),Od(o,d),!1}o=o.return}while(o!==null);return!1}var Zd=Error(r(461)),wt=!1;function Pt(i,s,o,l){s.child=i===null?Uv(s,null,o,l):os(s,i.child,o,l)}function zb(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 ns(s),l=Dd(i,s,o,v,p,d),w=Nd(),i!==null&&!wt?($d(i,s,d),Ni(i,s,d)):(Ce&&w&&hd(s),s.flags|=1,Pt(i,s,l,d),s.child)}function Lb(i,s,o,l,d){if(i===null){var p=o.type;return typeof p=="function"&&!cd(p)&&p.defaultProps===void 0&&o.compare===null?(s.tag=15,s.type=p,Vb(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,!sh(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 Vb(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,sh(i,d))(i.flags&131072)!==0&&(wt=!0);else return s.lanes=i.lanes,Ni(i,s,d)}return Qd(i,s,o,l,d)}function Ub(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 Kb(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?Pv(s,p):Rd(),Iv(s);else return l=s.lanes=536870912,Kb(i,s,p!==null?p.baseLanes|o:o,o,l)}else p!==null?(fu(s,p.cachePool),Pv(s,p),dr(),s.memoizedState=null):(i!==null&&fu(s,null),Rd(),dr());return Pt(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 Kb(i,s,o,l,d){var p=xd();return p=p===null?null:{parent:bt._currentValue,pool:p},s.memoizedState={baseLanes:o,cachePool:p},i!==null&&fu(s,null),Rd(),Iv(s),i!==null&&Gs(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 qb(i,s,o){return os(s,i.child,null,o),i=_u(s,s.pendingProps),i.flags|=2,gn(s),s.memoizedState=null,i}function pC(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(kd(s),(i=Ze)?(i=eS(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=Ev(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(kd(s),d)if(s.flags&256)s.flags&=-257,s=qb(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||Gs(i,s,o,!1),d=(o&i.childLanes)!==0,wt||d){if(l=He,l!==null&&(v=Dg(l,o),v!==0&&v!==p.retryLane))throw p.retryLane=v,Qr(i,v),ln(l,i,v),Zd;Lu(),s=qb(i,s,o)}else i=p.treeContext,Ze=$n(v.nextSibling),Kt=s,Ce=!0,sr=null,Dn=!1,i!==null&&Rv(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 Qd(i,s,o,l,d){return ns(s),o=Dd(i,s,o,l,void 0,d),l=Nd(),i!==null&&!wt?($d(i,s,d),Ni(i,s,d)):(Ce&&l&&hd(s),s.flags|=1,Pt(i,s,o,d),s.child)}function Pb(i,s,o,l,d,p){return ns(s),s.updateQueue=null,o=Fv(s,l,o,d),Hv(i),l=Nd(),i!==null&&!wt?($d(i,s,p),Ni(i,s,p)):(Ce&&l&&hd(s),s.flags|=1,Pt(i,s,o,p),s.child)}function Ib(i,s,o,l,d){if(ns(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=Jd,s.stateNode=p,p._reactInternals=s,p=s.stateNode,p.props=l,p.state=s.memoizedState,p.refs={},Ad(s),v=o.contextType,p.context=typeof v=="object"&&v!==null?qt(v):Ps,p.state=s.memoizedState,v=o.getDerivedStateFromProps,typeof v=="function"&&(Yd(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&&Jd.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=ls(o,w);p.props=A;var N=p.context,V=o.contextType;v=Ps,typeof V=="object"&&V!==null&&(v=qt(V));var P=o.getDerivedStateFromProps;V=typeof P=="function"||typeof p.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,V||typeof p.UNSAFE_componentWillReceiveProps!="function"&&typeof p.componentWillReceiveProps!="function"||(w||N!==v)&&kb(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 P=="function"&&(Yd(s,o,P,l),N=s.memoizedState),(A=lr||Cb(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,Ed(i,s),v=s.memoizedProps,V=ls(o,v),p.props=V,P=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!==P||B!==A)&&kb(s,p,l,A),lr=!1,B=s.memoizedState,p.state=B,xa(s,l,p,d),wa();var z=s.memoizedState;v!==P||B!==z||lr||i!==null&&i.dependencies!==null&&uu(i.dependencies)?(typeof w=="function"&&(Yd(s,o,w,l),z=s.memoizedState),(V=lr||Cb(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=os(s,i.child,null,d),s.child=os(s,null,o,d)):Pt(i,s,o,d),s.memoizedState=p.state,i=s.child):i=Ni(i,s,d),i}function Hb(i,s,o,l){return es(),s.flags|=256,Pt(i,s,o,l),s.child}var Wd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function eh(i){return{baseLanes:i,cachePool:$v()}}function th(i,s,o){return i=i!==null?i.childLanes&~o:0,s&&(i|=bn),i}function Fb(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=eS(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=Ev(i),o.return=s,s.child=o,Kt=s,Ze=null)):i=null,i===null)throw or(s);return zh(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=Wr(l,d,o,null),w.return=s,l.return=s,w.sibling=l,s.child=w,l=s.child,l.memoizedState=eh(o),l.childLanes=th(i,v,o),s.memoizedState=Wd,_a(null,l)):(fr(s),nh(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=ih(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=Wr(w,d,o,null),w.flags|=2,l.return=s,w.return=s,l.sibling=w,s.child=l,os(s,i.child,null,o),l=s.child,l.memoizedState=eh(o),l.childLanes=th(i,v,o),s.memoizedState=Wd,s=_a(null,l));else if(fr(s),zh(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=ih(i,s,o)}else if(wt||Gs(i,s,o,!1),v=(o&i.childLanes)!==0,wt||v){if(v=He,v!==null&&(l=Dg(v,o),l!==0&&l!==A.retryLane))throw A.retryLane=l,Qr(i,l),ln(v,i,l),Zd;Bh(w)||Lu(),s=ih(i,s,o)}else Bh(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&&Rv(s,i),s=nh(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=Wr(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=eh(o):(d=w.cachePool,d!==null?(A=bt._currentValue,d=d.parent!==A?{parent:A,pool:A}:d):d=$v(),w={baseLanes:w.baseLanes|o,cachePool:d}),l.memoizedState=w,l.childLanes=th(i,v,o),s.memoizedState=Wd,_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 nh(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 ih(i,s,o){return os(s,i.child,null,o),i=nh(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Gb(i,s,o){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),vd(i.return,s,o)}function rh(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 Yb(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),Pt(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&&Gb(i,o,s);else if(i.tag===19)Gb(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),rh(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}rh(s,!0,o,null,p,l);break;case"together":rh(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(Gs(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 sh(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&uu(i)))}function mC(i,s,o){switch(s.tag){case 3:Ct(s,s.stateNode.containerInfo),ar(s,bt,i.memoizedState.cache),es();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,kd(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?Fb(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||(Gs(i,s,o,!1),l=(o&s.childLanes)!==0),d){if(l)return Yb(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,Ub(i,s,o,s.pendingProps);case 24:ar(s,bt,i.memoizedState.cache)}return Ni(i,s,o)}function Jb(i,s,o){if(i!==null)if(i.memoizedProps!==s.pendingProps)wt=!0;else{if(!sh(i,o)&&(s.flags&128)===0)return wt=!1,mC(i,s,o);wt=(i.flags&131072)!==0}else wt=!1,Ce&&(s.flags&1048576)!==0&&_v(s,pa,s.index);switch(s.lanes=0,s.tag){case 16:e:{var l=s.pendingProps;if(i=rs(s.elementType),s.type=i,typeof i=="function")cd(i)?(l=ls(i,l),s.tag=1,s=Ib(null,s,i,l,o)):(s.tag=0,s=Qd(null,s,i,l,o));else{if(i!=null){var d=i.$$typeof;if(d===G){s.tag=11,s=zb(null,s,i,l,o);break e}else if(d===J){s.tag=14,s=Lb(null,s,i,l,o);break e}}throw s=Z(i)||i,Error(r(306,s,""))}}return s;case 0:return Qd(i,s,s.type,s.pendingProps,o);case 1:return l=s.type,d=ls(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,Ed(i,s),xa(s,l,null,o);var v=s.memoizedState;if(l=v.cache,ar(s,bt,l),l!==p.cache&&bd(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=Hb(i,s,l,o);break e}else if(l!==d){d=Cn(Error(r(424)),s),ma(d),s=Hb(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=Uv(s,null,l,o),s.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling}else{if(es(),l===d){s=Ni(i,s,o);break e}Pt(i,s,l,o)}s=s.child}return s;case 26:return Ru(i,s),i===null?(o=oS(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,It(l,o,i),Nt(l),s.stateNode=l):s.memoizedState=oS(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return ii(s),i===null&&Ce&&(l=s.stateNode=iS(s.type,s.pendingProps,ce.current),Kt=s,Dn=!0,d=Ze,Sr(s.type)?(Lh=d,Ze=$n(l.firstChild)):Ze=d),Pt(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=HC(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,Nh(d,p)?l=null:v!==null&&Nh(d,v)&&(s.flags|=32),s.memoizedState!==null&&(d=Dd(i,s,oC,null,null,o),qa._currentValue=d),Ru(i,s),Pt(i,s,l,o),s.child;case 6:return i===null&&Ce&&((i=o=Ze)&&(o=FC(o,s.pendingProps,Dn),o!==null?(s.stateNode=o,Kt=s,Ze=null,i=!0):i=!1),i||or(s)),null;case 13:return Fb(i,s,o);case 4:return Ct(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=os(s,null,l,o):Pt(i,s,l,o),s.child;case 11:return zb(i,s,s.type,s.pendingProps,o);case 7:return Pt(i,s,s.pendingProps,o),s.child;case 8:return Pt(i,s,s.pendingProps.children,o),s.child;case 12:return Pt(i,s,s.pendingProps.children,o),s.child;case 10:return l=s.pendingProps,ar(s,s.type,l.value),Pt(i,s,l.children,o),s.child;case 9:return d=s.type._context,l=s.pendingProps.children,ns(s),d=qt(d),l=l(d),s.flags|=1,Pt(i,s,l,o),s.child;case 14:return Lb(i,s,s.type,s.pendingProps,o);case 15:return Vb(i,s,s.type,s.pendingProps,o);case 19:return Yb(i,s,o);case 31:return pC(i,s,o);case 22:return Ub(i,s,o,s.pendingProps);case 24:return ns(s),l=qt(bt),i===null?(d=xd(),d===null&&(d=He,p=Sd(),d.pooledCache=p,p.refCount++,p!==null&&(d.pooledCacheLanes|=o),d=p),s.memoizedState={parent:l,cache:d},Ad(s),ar(s,bt,d)):((i.lanes&o)!==0&&(Ed(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&&bd(s,[bt],o,!0))),Pt(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 oh(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(x0())i.flags|=8192;else throw ss=hu,Td}else i.flags&=-16777217}function Xb(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!fS(s))if(x0())i.flags|=8192;else throw ss=hu,Td}function ku(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?Cg():536870912,i.lanes|=s,so|=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 yC(i,s,o){var l=s.pendingProps;switch(pd(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)&&(Fs(s)?$i(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,yd())),Qe(s),null;case 26:var d=s.type,p=s.memoizedState;return i===null?($i(s),p!==null?(Qe(s),Xb(s,p)):(Qe(s),oh(s,d,null,l,o))):p?p!==i.memoizedState?($i(s),Qe(s),Xb(s,p)):(Qe(s),s.flags&=-16777217):(i=i.memoizedProps,i!==l&&$i(s),Qe(s),oh(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,Fs(s)?Cv(s):(i=iS(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,Fs(s))Cv(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(It(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),oh(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,Fs(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||F0(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=Fs(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 es(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),i=!1}else o=yd(),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=Fs(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 es(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;Qe(s),d=!1}else d=yd(),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&&Rh(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;)Av(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),Cd(),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(is),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 gC(i,s){switch(pd(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));es()}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));es()}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),Cd(),i!==null&&q(is),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 Zb(i,s){switch(pd(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),Cd(),i!==null&&q(is);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 Qb(i){var s=i.updateQueue;if(s!==null){var o=i.stateNode;try{qv(s,o)}catch(l){Ue(i,i.return,l)}}}function Wb(i,s,o){o.props=ls(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 e0(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 ah(i,s,o){try{var l=i.stateNode;VC(l,i.type,o,s),l[tn]=s}catch(d){Ue(i,i.return,d)}}function t0(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Sr(i.type)||i.tag===4}function lh(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||t0(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 uh(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(uh(i,s,o),i=i.sibling;i!==null;)uh(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 n0(i){var s=i.stateNode,o=i.memoizedProps;try{for(var l=i.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);It(s,l,o),s[Ut]=i,s[tn]=o}catch(p){Ue(i,i.return,p)}}var ji=!1,xt=!1,ch=!1,i0=typeof WeakSet=="function"?WeakSet:Set,$t=null;function vC(i,s){if(i=i.containerInfo,Mh=Qu,i=mv(i),id(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,P=i,B=null;t:for(;;){for(var z;P!==o||d!==0&&P.nodeType!==3||(w=v+d),P!==p||l!==0&&P.nodeType!==3||(A=v+l),P.nodeType===3&&(v+=P.nodeValue.length),(z=P.firstChild)!==null;)B=P,P=z;for(;;){if(P===i)break t;if(B===o&&++N===d&&(w=v),B===p&&++V===l&&(A=v),(z=P.nextSibling)!==null)break;P=B,B=P.parentNode}P=z}o=w===-1||A===-1?null:{start:w,end:A}}else o=null}o=o||{start:0,end:0}}else o=null;for(Dh={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=ls(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)jh(i);else if(o===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":jh(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 r0(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=ls(o.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(d,s,i.__reactInternalSnapshotBeforeUpdate)}catch(v){Ue(o,o.return,v)}}l&64&&Qb(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{qv(i,s)}catch(v){Ue(o,o.return,v)}}break;case 27:s===null&&l&4&&n0(o);case 26:case 5:zi(i,o),s===null&&l&4&&e0(o),l&512&&ka(o,o.return);break;case 12:zi(i,o);break;case 31:zi(i,o),l&4&&a0(i,o);break;case 13:zi(i,o),l&4&&l0(i,o),l&64&&(i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(o=_C.bind(null,o),GC(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 s0(i){var s=i.alternate;s!==null&&(i.alternate=null,s0(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Uf(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;)o0(i,s,o),o=o.sibling}function o0(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,Q0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.stateNode),po(i)):Q0(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"&&Wb(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 a0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{po(i)}catch(o){Ue(s,s.return,o)}}}function l0(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{po(i)}catch(o){Ue(s,s.return,o)}}function bC(i){switch(i.tag){case 31:case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new i0),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new i0),s;default:throw Error(r(435,i.tag))}}function Du(i,s){var o=bC(i);s.forEach(function(l){if(!o.has(l)){o.add(l);var d=RC.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));o0(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;)u0(s,i),s=s.sibling}var Yn=null;function u0(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"))),It(p,l,o),p[Ut]=i,Nt(p),l=p;break e;case"link":var v=uS("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),It(p,l,o),d.head.appendChild(p);break;case"meta":if(v=uS("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),It(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 cS(d,i.type,i.stateNode);else i.stateNode=lS(d,l,i.memoizedProps);else p!==l?(p===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):p.count--,l===null?cS(d,i.type,i.stateNode):lS(d,l,i.memoizedProps)):l===null&&i.stateNode!==null&&ah(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&&ah(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{Bs(d,"")}catch(ie){Ue(i,i.return,ie)}}l&4&&i.stateNode!=null&&(d=i.memoizedProps,ah(i,d,o!==null?o.memoizedProps:d)),l&1024&&(ch=!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{po(s.containerInfo)}catch(ie){Ue(i,i.return,ie)}ch&&(ch=!1,c0(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||us(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 P=A.memoizedProps.style,B=P!=null&&P.hasOwnProperty("display")?P.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?W0(z,!0):W0(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(t0(l)){o=l;break}l=l.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var d=o.stateNode,p=lh(i);Mu(i,p,d);break;case 5:var v=o.stateNode;o.flags&32&&(Bs(v,""),o.flags&=-33);var w=lh(i);Mu(i,w,v);break;case 3:case 4:var A=o.stateNode.containerInfo,N=lh(i);uh(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 c0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;c0(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;)r0(i,s.alternate,s),s=s.sibling}function us(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),us(s);break;case 1:ai(s,s.return);var o=s.stateNode;typeof o.componentWillUnmount=="function"&&Wb(s,s.return,o),us(s);break;case 27:Va(s.stateNode);case 26:case 5:ai(s,s.return),us(s);break;case 22:s.memoizedState===null&&us(s);break;case 30:us(s);break;default:us(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++)Kv(A[d],w)}catch(N){Ue(l,l.return,N)}}o&&v&64&&Qb(p),ka(p,p.return);break;case 27:n0(p);case 26:case 5:Li(d,p,o),o&&l===null&&v&4&&e0(p),ka(p,p.return);break;case 12:Li(d,p,o);break;case 31:Li(d,p,o),o&&v&4&&a0(d,p);break;case 13:Li(d,p,o),o&&v&4&&l0(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 fh(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 dh(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;)f0(i,s,o,l),s=s.sibling}function f0(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,no(i,s,o,l,(s.subtreeFlags&10256)!==0||!1)),d&2048&&fh(v,s);break;case 24:Jn(i,s,o,l),d&2048&&dh(s.alternate,s);break;default:Jn(i,s,o,l)}}function no(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:no(p,v,w,A,d),Ca(8,v);break;case 23:break;case 22:var V=v.stateNode;v.memoizedState!==null?V._visibility&2?no(p,v,w,A,d):Ma(p,v):(V._visibility|=2,no(p,v,w,A,d)),d&&N&2048&&fh(v.alternate,v);break;case 24:no(p,v,w,A,d),d&&N&2048&&dh(v.alternate,v);break;default:no(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&&fh(l.alternate,l);break;case 24:Ma(o,l),d&2048&&dh(l.alternate,l);break;default:Ma(o,l)}s=s.sibling}}var Da=8192;function io(i,s,o){if(i.subtreeFlags&Da)for(i=i.child;i!==null;)d0(i,s,o),i=i.sibling}function d0(i,s,o){switch(i.tag){case 26:io(i,s,o),i.flags&Da&&i.memoizedState!==null&&sk(o,Yn,i.memoizedState,i.memoizedProps);break;case 5:io(i,s,o);break;case 3:case 4:var l=Yn;Yn=Fu(i.stateNode.containerInfo),io(i,s,o),Yn=l;break;case 22:i.memoizedState===null&&(l=i.alternate,l!==null&&l.memoizedState!==null?(l=Da,Da=16777216,io(i,s,o),Da=l):io(i,s,o));break;default:io(i,s,o)}}function h0(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,m0(l,i)}h0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)p0(i),i=i.sibling}function p0(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,m0(l,i)}h0(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 m0(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(s0(l),l===o){$t=null;break e}if(d!==null){d.return=p,$t=d;break e}$t=p}}}var SC={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}},wC=typeof WeakMap=="function"?WeakMap:Map,Be=0,He=null,Ae=null,Oe=0,Ve=0,vn=null,pr=!1,ro=!1,hh=!1,Vi=0,at=0,mr=0,cs=0,ph=0,bn=0,so=0,$a=null,an=null,mh=!1,$u=0,y0=0,ju=1/0,Bu=null,yr=null,kt=0,gr=null,oo=null,Ui=0,yh=0,gh=null,g0=null,ja=0,vh=null;function Sn(){return(Be&2)!==0&&Oe!==0?Oe&-Oe:$.T!==null?Ah():Ng()}function v0(){if(bn===0)if((Oe&536870912)===0||Ce){var i=Il;Il<<=1,(Il&3932160)===0&&(Il=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)&&(ao(i,0),vr(i,Oe,bn,!1)),na(i,o),((Be&2)===0||i!==He)&&(i===He&&((Be&2)===0&&(cs|=o),at===4&&vr(i,Oe,bn,!1)),li(i))}function b0(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?AC(i,s):Sh(i,s,!0),p=l;do{if(d===0){ro&&!l&&vr(i,s,0,!1);break}else{if(o=i.current.alternate,p&&!xC(o)){d=Sh(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&&(ao(w,v).flags|=256),v=Sh(w,v,!1),v!==2){if(hh&&!A){w.errorRecoveryDisabledLanes|=p,cs|=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){ao(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=X0(S0.bind(null,l,o,an,Bu,mh,s,bn,cs,so,pr,p,"Throttled",-0,0),d);break e}S0(l,o,an,Bu,mh,s,bn,cs,so,pr,p,null,-0,0)}}break}while(!0);li(i)}function S0(i,s,o,l,d,p,v,w,A,N,V,P,B,z){if(i.timeoutHandle=-1,P=s.subtreeFlags,P&8192||(P&16785408)===16785408){P={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},d0(s,p,P);var ie=(p&62914560)===p?$u-st():(p&4194048)===p?y0-st():0;if(ie=ok(P,ie),ie!==null){Ui=p,i.cancelPendingCommit=ie(R0.bind(null,i,s,p,o,l,d,v,w,A,V,P,null,B,z)),vr(i,p,v,!N);return}}R0(i,s,p,o,l,d,v,w,A)}function xC(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&=~ph,s&=~cs,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&&kg(i,o,s)}function zu(){return(Be&6)===0?(Ba(0),!1):!0}function bh(){if(Ae!==null){if(Ve===0)var i=Ae.return;else i=Ae,Ci=ts=null,jd(i),Zs=null,va=0,i=Ae;for(;i!==null;)Zb(i.alternate,i),i=i.return;Ae=null}}function ao(i,s){var o=i.timeoutHandle;o!==-1&&(i.timeoutHandle=-1,qC(o)),o=i.cancelPendingCommit,o!==null&&(i.cancelPendingCommit=null,o()),Ui=0,bh(),He=i,Ae=o=_i(i.current,null),Oe=s,Ve=0,vn=null,pr=!1,ro=ta(i,s),hh=!1,so=bn=ph=cs=mr=at=0,an=$a=null,mh=!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 w0(i,s){ve=null,$.H=Oa,s===Xs||s===du?(s=zv(),Ve=3):s===Td?(s=zv(),Ve=4):Ve=s===Zd?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 x0(){var i=yn.current;return i===null?!0:(Oe&4194048)===Oe?Nn===null:(Oe&62914560)===Oe||(Oe&536870912)!==0?i===Nn:!1}function T0(){var i=$.H;return $.H=Oa,i===null?Oa:i}function A0(){var i=$.A;return $.A=SC,i}function Lu(){at=4,pr||(Oe&4194048)!==Oe&&yn.current!==null||(ro=!0),(mr&134217727)===0&&(cs&134217727)===0||He===null||vr(He,Oe,bn,!1)}function Sh(i,s,o){var l=Be;Be|=2;var d=T0(),p=A0();(He!==i||Oe!==s)&&(Bu=null,ao(i,s)),s=!1;var v=at;e:do try{if(Ve!==0&&Ae!==null){var w=Ae,A=vn;switch(Ve){case 8:bh(),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,lo(i,w,A,N),o&&ro){v=0;break e}break;default:N=Ve,Ve=0,vn=null,lo(i,w,A,N)}}TC(),v=at;break}catch(V){w0(i,V)}while(!0);return s&&i.shellSuspendCounter++,Ci=ts=null,Be=l,$.H=d,$.A=p,Ae===null&&(He=null,Oe=0,ru()),v}function TC(){for(;Ae!==null;)E0(Ae)}function AC(i,s){var o=Be;Be|=2;var l=T0(),d=A0();He!==i||Oe!==s?(Bu=null,ju=st()+500,ao(i,s)):ro=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,lo(i,s,p,1);break;case 2:case 9:if(jv(p)){Ve=0,vn=null,O0(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:jv(p)?(Ve=0,vn=null,O0(s)):(Ve=0,vn=null,lo(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?fS(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,lo(i,s,p,5);break;case 6:Ve=0,vn=null,lo(i,s,p,6);break;case 8:bh(),at=6;break e;default:throw Error(r(462))}}EC();break}catch(V){w0(i,V)}while(!0);return Ci=ts=null,$.H=l,$.A=d,Be=o,Ae!==null?0:(He=null,Oe=0,ru(),at)}function EC(){for(;Ae!==null&&!ri();)E0(Ae)}function E0(i){var s=Jb(i.alternate,i,Vi);i.memoizedProps=i.pendingProps,s===null?Vu(i):Ae=s}function O0(i){var s=i,o=s.alternate;switch(s.tag){case 15:case 0:s=Pb(o,s,s.pendingProps,s.type,void 0,Oe);break;case 11:s=Pb(o,s,s.pendingProps,s.type.render,s.ref,Oe);break;case 5:jd(s);default:Zb(o,s),s=Ae=Av(s,Vi),s=Jb(o,s,Vi)}i.memoizedProps=i.pendingProps,s===null?Vu(i):Ae=s}function lo(i,s,o,l){Ci=ts=null,jd(s),Zs=null,va=0;var d=s.return;try{if(hC(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:ro||(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))),_0(s,i)):Vu(s)}function Vu(i){var s=i;do{if((s.flags&32768)!==0){_0(s,pr);return}i=s.return;var o=yC(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 _0(i,s){do{var o=gC(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 R0(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|=ld,rR(i,o,p,v,w,A),i===He&&(Ae=He=null,Oe=0),oo=s,gr=i,Ui=o,yh=p,gh=d,g0=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,CC(ql,function(){return N0(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=$.T,$.T=null,d=U.p,U.p=2,v=Be,Be|=4;try{vC(i,s,o)}finally{Be=v,U.p=d,$.T=l}}kt=1,C0(),k0(),M0()}}function C0(){if(kt===1){kt=0;var i=gr,s=oo,o=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||o){o=$.T,$.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{u0(s,i);var p=Dh,v=mv(i.containerInfo),w=p.focusedElem,A=p.selectionRange;if(v!==w&&w&&w.ownerDocument&&pv(w.ownerDocument.documentElement,w)){if(A!==null&&id(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 P=w.ownerDocument||document,B=P&&P.defaultView||window;if(B.getSelection){var z=B.getSelection(),ie=w.textContent.length,ue=Math.min(A.start,ie),Pe=A.end===void 0?ue:Math.min(A.end,ie);!z.extend&&ue>Pe&&(v=Pe,Pe=ue,ue=v);var C=hv(w,ue),O=hv(w,Pe);if(C&&O&&(z.rangeCount!==1||z.anchorNode!==C.node||z.anchorOffset!==C.offset||z.focusNode!==O.node||z.focusOffset!==O.offset)){var D=P.createRange();D.setStart(C.node,C.offset),z.removeAllRanges(),ue>Pe?(z.addRange(D),z.extend(O.node,O.offset)):(D.setEnd(O.node,O.offset),z.addRange(D))}}}}for(P=[],z=w;z=z.parentNode;)z.nodeType===1&&P.push({element:z,left:z.scrollLeft,top:z.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<P.length;w++){var K=P[w];K.element.scrollLeft=K.left,K.element.scrollTop=K.top}}Qu=!!Mh,Dh=Mh=null}finally{Be=d,U.p=l,$.T=o}}i.current=s,kt=2}}function k0(){if(kt===2){kt=0;var i=gr,s=oo,o=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||o){o=$.T,$.T=null;var l=U.p;U.p=2;var d=Be;Be|=4;try{r0(i,s.alternate,s)}finally{Be=d,U.p=l,$.T=o}}kt=3}}function M0(){if(kt===4||kt===3){kt=0,Fn();var i=gr,s=oo,o=Ui,l=g0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?kt=5:(kt=0,oo=gr=null,D0(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(yr=null),Lf(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=$.T,d=U.p,U.p=2,$.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{$.T=s,U.p=d}}(Ui&3)!==0&&Uu(),li(i),d=i.pendingLanes,(o&261930)!==0&&(d&42)!==0?i===vh?ja++:(ja=0,vh=i):ja=0,Ba(0)}}function D0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ya(s)))}function Uu(){return C0(),k0(),M0(),N0()}function N0(){if(kt!==5)return!1;var i=gr,s=yh;yh=0;var o=Lf(Ui),l=$.T,d=U.p;try{U.p=32>o?32:o,$.T=null,o=gh,gh=null;var p=gr,v=Ui;if(kt=0,oo=gr=null,Ui=0,(Be&6)!==0)throw Error(r(331));var w=Be;if(Be|=4,p0(p.current),f0(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,$.T=l,D0(i,s)}}function $0(i,s,o){s=Cn(o,s),s=Xd(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)$0(i,i,o);else for(;s!==null;){if(s.tag===3){$0(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=jb(2),l=cr(s,o,2),l!==null&&(Bb(o,l,s,i),na(l,2),li(l));break}}s=s.return}}function wh(i,s,o){var l=i.pingCache;if(l===null){l=i.pingCache=new wC;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)||(hh=!0,d.add(o),i=OC.bind(null,i,s,o),s.then(i,i))}function OC(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&&ao(i,0):ph|=o,so===Oe&&(so=0)),li(i)}function j0(i,s){s===0&&(s=Cg()),i=Qr(i,s),i!==null&&(na(i,s),li(i))}function _C(i){var s=i.memoizedState,o=0;s!==null&&(o=s.retryLane),j0(i,o)}function RC(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),j0(i,o)}function CC(i,s){return Vt(i,s)}var Ku=null,uo=null,xh=!1,qu=!1,Th=!1,br=0;function li(i){i!==uo&&i.next===null&&(uo===null?Ku=uo=i:uo=uo.next=i),qu=!0,xh||(xh=!0,MC())}function Ba(i,s){if(!Th&&qu){Th=!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,V0(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,V0(l,p));l=l.next}while(o);Th=!1}}function kC(){B0()}function B0(){qu=xh=!1;var i=0;br!==0&&KC()&&(i=br);for(var s=st(),o=null,l=Ku;l!==null;){var d=l.next,p=z0(l,s);p===0?(l.next=null,o===null?Ku=d:o.next=d,d===null&&(uo=o)):(o=l,(i!==0||(p&3)!==0)&&(qu=!0)),l=d}kt!==0&&kt!==5||Ba(i),br!==0&&(br=0)}function z0(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]=iR(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),Lf(o)){case 2:case 8:o=_g;break;case 32:o=ql;break;case 268435456:o=Rg;break;default:o=ql}return l=L0.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 L0(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:(b0(i,l,s),z0(i,st()),i.callbackNode!=null&&i.callbackNode===o?L0.bind(null,i):null)}function V0(i,s){if(Uu())return null;b0(i,s,!0)}function MC(){PC(function(){(Be&6)!==0?Vt(Og,kC):B0()})}function Ah(){if(br===0){var i=Ys;i===0&&(i=Pl,Pl<<=1,(Pl&261888)===0&&(Pl=256)),br=i}return br}function U0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Xl(""+i)}function K0(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 DC(i,s,o,l,d){if(s==="submit"&&o&&o.stateNode===d){var p=U0((d[tn]||null).action),v=l.submitter;v&&(s=(s=v[tn]||null)?U0(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?K0(d,v):new FormData(d);Id(o,{pending:!0,data:A,method:d.method,action:p},null,A)}}else typeof p=="function"&&(w.preventDefault(),A=v?K0(d,v):new FormData(d),Id(o,{pending:!0,data:A,method:d.method,action:p},p,A))},currentTarget:d}]})}}for(var Eh=0;Eh<ad.length;Eh++){var Oh=ad[Eh],NC=Oh.toLowerCase(),$C=Oh[0].toUpperCase()+Oh.slice(1);Gn(NC,"on"+$C)}Gn(vv,"onAnimationEnd"),Gn(bv,"onAnimationIteration"),Gn(Sv,"onAnimationStart"),Gn("dblclick","onDoubleClick"),Gn("focusin","onFocus"),Gn("focusout","onBlur"),Gn(XR,"onTransitionRun"),Gn(ZR,"onTransitionStart"),Gn(QR,"onTransitionCancel"),Gn(wv,"onTransitionEnd"),$s("onMouseEnter",["mouseout","mouseover"]),$s("onMouseLeave",["mouseout","mouseover"]),$s("onPointerEnter",["pointerout","pointerover"]),$s("onPointerLeave",["pointerout","pointerover"]),Yr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Yr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Yr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Yr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Yr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Yr("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(" "),jC=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(za));function q0(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[Vf];o===void 0&&(o=s[Vf]=new Set);var l=i+"__bubble";o.has(l)||(P0(s,i,2,!1),o.add(l))}function _h(i,s,o){var l=0;s&&(l|=4),P0(o,i,l,s)}var Pu="_reactListening"+Math.random().toString(36).slice(2);function Rh(i){if(!i[Pu]){i[Pu]=!0,Bg.forEach(function(o){o!=="selectionchange"&&(jC.has(o)||_h(o,!1,i),_h(o,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Pu]||(s[Pu]=!0,_h("selectionchange",!1,s))}}function P0(i,s,o,l){switch(vS(s)){case 2:var d=uk;break;case 8:d=ck;break;default:d=Ph}o=d.bind(null,s,o,i),d=void 0,!Yf||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 Ch(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=Ms(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}Yg(function(){var N=p,V=Ff(o),P=[];e:{var B=xv.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=RR;break;case"focusin":ie="focus",z=Qf;break;case"focusout":ie="blur",z=Qf;break;case"beforeblur":case"afterblur":z=Qf;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=Zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":z=yR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":z=MR;break;case vv:case bv:case Sv:z=bR;break;case wv:z=NR;break;case"scroll":case"scrollend":z=pR;break;case"wheel":z=jR;break;case"copy":case"cut":case"paste":z=wR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":z=Wg;break;case"toggle":case"beforetoggle":z=zR}var ue=(s&4)!==0,Pe=!ue&&(i==="scroll"||i==="scrollend"),C=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||C===null||(K=sa(O,C),K!=null&&ue.push(La(O,K,D))),Pe)break;O=O.return}0<ue.length&&(B=new z(B,ie,null,o,V),P.push({event:B,listeners:ue}))}}if((s&7)===0){e:{if(B=i==="mouseover"||i==="pointerover",z=i==="mouseout"||i==="pointerout",B&&o!==Hf&&(ie=o.relatedTarget||o.fromElement)&&(Ms(ie)||ie[ks]))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?Ms(ie):null,ie!==null&&(Pe=u(ie),ue=ie.tag,ie!==Pe||ue!==5&&ue!==27&&ue!==6)&&(ie=null)):(z=null,ie=N),z!==ie)){if(ue=Zg,K="onMouseLeave",C="onMouseEnter",O="mouse",(i==="pointerout"||i==="pointerover")&&(ue=Wg,K="onPointerLeave",C="onPointerEnter",O="pointer"),Pe=z==null?B:ra(z),D=ie==null?B:ra(ie),B=new ue(K,O+"leave",z,o,V),B.target=Pe,B.relatedTarget=D,K=null,Ms(V)===N&&(ue=new ue(C,O+"enter",ie,o,V),ue.target=D,ue.relatedTarget=Pe,K=ue),Pe=K,z&&ie)t:{for(ue=BC,C=z,O=ie,D=0,K=C;K;K=ue(K))D++;K=0;for(var le=O;le;le=ue(le))K++;for(;0<D-K;)C=ue(C),D--;for(;0<K-D;)O=ue(O),K--;for(;D--;){if(C===O||O!==null&&C===O.alternate){ue=C;break t}C=ue(C),O=ue(O)}ue=null}else ue=null;z!==null&&I0(P,B,z,ue,!1),ie!==null&&Pe!==null&&I0(P,Pe,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=av;else if(sv(B))if(lv)Ne=GR;else{Ne=HR;var se=IR}else z=B.nodeName,!z||z.toLowerCase()!=="input"||B.type!=="checkbox"&&B.type!=="radio"?N&&If(N.elementType)&&(Ne=av):Ne=FR;if(Ne&&(Ne=Ne(i,N))){ov(P,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":(sv(se)||se.contentEditable==="true")&&(Us=se,rd=N,ha=null);break;case"focusout":ha=rd=Us=null;break;case"mousedown":sd=!0;break;case"contextmenu":case"mouseup":case"dragend":sd=!1,yv(P,o,V);break;case"selectionchange":if(JR)break;case"keydown":case"keyup":yv(P,o,V)}var Se;if(ed)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 Vs?iv(i,o)&&(_e="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(_e="onCompositionStart");_e&&(ev&&o.locale!=="ko"&&(Vs||_e!=="onCompositionStart"?_e==="onCompositionEnd"&&Vs&&(Se=Jg()):(ir=V,Jf="value"in ir?ir.value:ir.textContent,Vs=!0)),se=Iu(N,_e),0<se.length&&(_e=new Qg(_e,i,null,o,V),P.push({event:_e,listeners:se}),Se?_e.data=Se:(Se=rv(o),Se!==null&&(_e.data=Se)))),(Se=VR?UR(i,o):KR(i,o))&&(_e=Iu(N,"onBeforeInput"),0<_e.length&&(se=new Qg("onBeforeInput","beforeinput",null,o,V),P.push({event:se,listeners:_e}),se.data=Se)),DC(P,i,N,o,V)}q0(P,s)})}function La(i,s,o){return{instance:i,listener:s,currentTarget:o}}function Iu(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 BC(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 zC=/\r\n?/g,LC=/\u0000|\uFFFD/g;function H0(i){return(typeof i=="string"?i:""+i).replace(zC,`
61
+ `).replace(LC,"")}function F0(i,s){return s=H0(s),H0(i)===s}function qe(i,s,o,l,d,p){switch(o){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||Bs(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&Bs(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":Fg(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=dR.get(o)||o,Gl(i,o,l))}}function kh(i,s,o,l,d,p){switch(o){case"style":Fg(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"?Bs(i,l):(typeof l=="number"||typeof l=="bigint")&&Bs(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(!zg.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 It(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)}}qg(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?js(i,!!l,s,!1):o!=null&&js(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(If(s)){for(V in o)o.hasOwnProperty(V)&&(l=o[V],l!==void 0&&kh(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 VC(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 P=o[z];if(o.hasOwnProperty(z)&&P!=null)switch(z){case"checked":break;case"value":break;case"defaultValue":A=P;default:l.hasOwnProperty(z)||qe(i,s,z,null,l,P)}}for(var B in l){var z=l[B];if(P=o[B],l.hasOwnProperty(B)&&(z!=null||P!=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!==P&&qe(i,s,B,z,l,P)}}qf(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?js(i,!!o,B,!1):!!l!=!!o&&(s!=null?js(i,!!o,s,!0):js(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)}Pg(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(If(s)){for(var Pe in o)B=o[Pe],o.hasOwnProperty(Pe)&&B!==void 0&&!l.hasOwnProperty(Pe)&&kh(i,s,Pe,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||kh(i,s,V,B,l,z);return}}for(var C in o)B=o[C],o.hasOwnProperty(C)&&B!=null&&!l.hasOwnProperty(C)&&qe(i,s,C,null,l,B);for(P in l)B=l[P],z=o[P],!l.hasOwnProperty(P)||B===z||B==null&&z==null||qe(i,s,P,B,l,z)}function G0(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function UC(){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&&G0(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,P=A.initiatorType;V&&G0(P)&&(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 Mh=null,Dh=null;function Hu(i){return i.nodeType===9?i:i.ownerDocument}function Y0(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 J0(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 Nh(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 $h=null;function KC(){var i=window.event;return i&&i.type==="popstate"?i===$h?!1:($h=i,!0):($h=null,!1)}var X0=typeof setTimeout=="function"?setTimeout:void 0,qC=typeof clearTimeout=="function"?clearTimeout:void 0,Z0=typeof Promise=="function"?Promise:void 0,PC=typeof queueMicrotask=="function"?queueMicrotask:typeof Z0<"u"?function(i){return Z0.resolve(null).then(i).catch(IC)}:X0;function IC(i){setTimeout(function(){throw i})}function Sr(i){return i==="head"}function Q0(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),po(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);po(s)}function W0(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 jh(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":jh(o),Uf(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}i.removeChild(o)}}function HC(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 FC(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 eS(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 Bh(i){return i.data==="$?"||i.data==="$~"}function zh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function GC(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 Lh=null;function tS(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 nS(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 iS(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]);Uf(i)}var jn=new Map,rS=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:YC,r:JC,D:XC,C:ZC,L:QC,m:WC,X:tk,S:ek,M:nk};function YC(){var i=Ki.f(),s=zu();return i||s}function JC(i){var s=Ds(i);s!==null&&s.tag===5&&s.type==="form"?wb(s):Ki.r(i)}var co=typeof document>"u"?null:document;function sS(i,s,o){var l=co;if(l&&typeof s=="string"&&s){var d=_n(s);d='link[rel="'+i+'"][href="'+d+'"]',typeof o=="string"&&(d+='[crossorigin="'+o+'"]'),rS.has(d)||(rS.add(d),i={rel:i,crossOrigin:o,href:s},l.querySelector(d)===null&&(s=l.createElement("link"),It(s,"link",i),Nt(s),l.head.appendChild(s)))}}function XC(i){Ki.D(i),sS("dns-prefetch",i,null)}function ZC(i,s){Ki.C(i,s),sS("preconnect",i,s)}function QC(i,s,o){Ki.L(i,s,o);var l=co;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=fo(i);break;case"script":p=ho(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"),It(s,"link",i),Nt(s),l.head.appendChild(s)))}}function WC(i,s){Ki.m(i,s);var o=co;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=ho(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"),It(l,"link",i),Nt(l),o.head.appendChild(l)}}}function ek(i,s,o){Ki.S(i,s,o);var l=co;if(l&&i){var d=Ns(l).hoistableStyles,p=fo(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))&&Vh(i,o);var A=v=l.createElement("link");Nt(A),It(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 tk(i,s){Ki.X(i,s);var o=co;if(o&&i){var l=Ns(o).hoistableScripts,d=ho(i),p=l.get(d);p||(p=o.querySelector(Ka(d)),p||(i=g({src:i,async:!0},s),(s=jn.get(d))&&Uh(i,s),p=o.createElement("script"),Nt(p),It(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function nk(i,s){Ki.M(i,s);var o=co;if(o&&i){var l=Ns(o).hoistableScripts,d=ho(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))&&Uh(i,s),p=o.createElement("script"),Nt(p),It(p,"link",i),o.head.appendChild(p)),p={type:"script",instance:p,count:1,state:null},l.set(d,p))}}function oS(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=fo(o.href),o=Ns(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=fo(o.href);var p=Ns(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||ik(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=ho(o),o=Ns(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 fo(i){return'href="'+_n(i)+'"'}function Ua(i){return'link[rel="stylesheet"]['+i+"]"}function aS(i){return g({},i,{"data-precedence":i.precedence,precedence:null})}function ik(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}),It(s,"link",o),Nt(s),i.head.appendChild(s))}function ho(i){return'[src="'+_n(i)+'"]'}function Ka(i){return"script[async]"+i}function lS(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),It(l,"style",d),Gu(l,o.precedence,i),s.instance=l;case"stylesheet":d=fo(o.href);var p=i.querySelector(Ua(d));if(p)return s.state.loading|=4,s.instance=p,Nt(p),p;l=aS(o),(d=jn.get(d))&&Vh(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}),It(p,"link",l),s.state.loading|=4,Gu(p,o.precedence,i),s.instance=p;case"script":return p=ho(o.src),(d=i.querySelector(Ka(p)))?(s.instance=d,Nt(d),d):(l=o,(d=jn.get(p))&&(l=g({},o),Uh(l,d)),i=i.ownerDocument||i,d=i.createElement("script"),Nt(d),It(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 Vh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Uh(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 uS(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 cS(i,s,o){i=i.ownerDocument||i,i.head.insertBefore(o,s==="title"?i.querySelector("head > title"):null)}function rk(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 fS(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function sk(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=fo(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=aS(l),(d=jn.get(d))&&Vh(l,d),p=p.createElement("link"),Nt(p);var v=p;v._p=new Promise(function(w,A){v.onload=w,v.onerror=A}),It(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 Kh=0;function ok(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&&Kh===0&&(Kh=62500*UC());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>Kh?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(ak,i),Xu=null,Ju.call(i))}function ak(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 lk(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=Bf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Bf(0),this.hiddenUpdates=Bf(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 dS(i,s,o,l,d,p,v,w,A,N,V,P){return i=new lk(i,s,o,v,A,N,V,P,w),s=1,p===!0&&(s|=24),p=mn(3,null,null,s),i.current=p,p.stateNode=i,s=Sd(),s.refCount++,i.pooledCache=s,s.refCount++,p.memoizedState={element:l,isDehydrated:o,cache:s},Ad(p),i}function hS(i){return i?(i=Ps,i):Ps}function pS(i,s,o,l,d,p){d=hS(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 mS(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<s?o:s}}function qh(i,s){mS(i,s),(i=i.alternate)&&mS(i,s)}function yS(i){if(i.tag===13||i.tag===31){var s=Qr(i,67108864);s!==null&&ln(s,i,67108864),qh(i,67108864)}}function gS(i){if(i.tag===13||i.tag===31){var s=Sn();s=zf(s);var o=Qr(i,s);o!==null&&ln(o,i,s),qh(i,s)}}var Qu=!0;function uk(i,s,o,l){var d=$.T;$.T=null;var p=U.p;try{U.p=2,Ph(i,s,o,l)}finally{U.p=p,$.T=d}}function ck(i,s,o,l){var d=$.T;$.T=null;var p=U.p;try{U.p=8,Ph(i,s,o,l)}finally{U.p=p,$.T=d}}function Ph(i,s,o,l){if(Qu){var d=Ih(l);if(d===null)Ch(i,s,l,Wu,o),bS(i,l);else if(dk(d,i,s,o,l))l.stopPropagation();else if(bS(i,l),s&4&&-1<fk.indexOf(i)){for(;d!==null;){var p=Ds(d);if(p!==null)switch(p.tag){case 3:if(p=p.stateNode,p.current.memoizedState.isDehydrated){var v=Gr(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=Qr(p,2),w!==null&&ln(w,p,2),zu(),qh(p,2)}if(p=Ih(l),p===null&&Ch(i,s,l,Wu,o),p===d)break;d=p}d!==null&&l.stopPropagation()}else Ch(i,s,l,null,o)}}function Ih(i){return i=Ff(i),Hh(i)}var Wu=null;function Hh(i){if(Wu=null,i=Ms(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 vS(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 Og:return 2;case _g:return 8;case ql:case Z_:return 32;case Rg:return 268435456;default:return 32}default:return 32}}var Fh=!1,wr=null,xr=null,Tr=null,Pa=new Map,Ia=new Map,Ar=[],fk="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 bS(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":Pa.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ia.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=Ds(s),s!==null&&yS(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function dk(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 Pa.set(p,Ha(Pa.get(p)||null,i,s,o,l,d)),!0;case"gotpointercapture":return p=d.pointerId,Ia.set(p,Ha(Ia.get(p)||null,i,s,o,l,d)),!0}return!1}function SS(i){var s=Ms(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,$g(i.priority,function(){gS(o)});return}}else if(s===31){if(s=f(o),s!==null){i.blockedOn=s,$g(i.priority,function(){gS(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=Ih(i.nativeEvent);if(o===null){o=i.nativeEvent;var l=new o.constructor(o.type,o);Hf=l,o.target.dispatchEvent(l),Hf=null}else return s=Ds(o),s!==null&&yS(s),i.blockedOn=o,!1;s.shift()}return!0}function wS(i,s,o){ec(i)&&o.delete(s)}function hk(){Fh=!1,wr!==null&&ec(wr)&&(wr=null),xr!==null&&ec(xr)&&(xr=null),Tr!==null&&ec(Tr)&&(Tr=null),Pa.forEach(wS),Ia.forEach(wS)}function tc(i,s){i.blockedOn===s&&(i.blockedOn=null,Fh||(Fh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,hk)))}var nc=null;function xS(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(Hh(l||o)===null)continue;break}var p=Ds(o);p!==null&&(i.splice(s,3),s-=3,Id(p,{pending:!0,data:d,method:o.method,action:l},l,d))}}))}function po(i){function s(A){return tc(A,i)}wr!==null&&tc(wr,i),xr!==null&&tc(xr,i),Tr!==null&&tc(Tr,i),Pa.forEach(s),Ia.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);)SS(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||xS(o);else if(v){var w=null;if(p&&p.hasAttribute("formAction")){if(d=p,v=p[tn]||null)w=v.formAction;else if(Hh(d)!==null)continue}else w=v.action;typeof w=="function"?o[l+1]=w:(o.splice(l,3),l-=3),xS(o)}}}function TS(){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 Gh(i){this._internalRoot=i}ic.prototype.render=Gh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var o=s.current,l=Sn();pS(o,l,i,s,null,null)},ic.prototype.unmount=Gh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;pS(i.current,2,null,i,null,null),zu(),s[ks]=null}};function ic(i){this._internalRoot=i}ic.prototype.unstable_scheduleHydration=function(i){if(i){var s=Ng();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&&SS(i)}};var AS=e.version;if(AS!=="19.2.0")throw Error(r(527,AS,"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 pk={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:$,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(pk),dn=rc}catch{}}return Ga.createRoot=function(i,s){if(!a(i))throw Error(r(299));var o=!1,l="",d=Mb,p=Db,v=Nb;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=dS(i,1,!1,null,null,o,l,null,d,p,v,TS),i[ks]=s.current,Rh(i),new Gh(s)},Ga.hydrateRoot=function(i,s,o){if(!a(i))throw Error(r(299));var l=!1,d="",p=Mb,v=Db,w=Nb,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=dS(i,1,!0,s,o??null,l,d,A,p,v,w,TS),s.context=hS(null),o=s.current,l=Sn(),l=zf(l),d=ur(l),d.callback=null,cr(o,d,l),o=l,s.current.lanes=o,na(s,o),li(s),i[ks]=s.current,Rh(i),new ic(s)},Ga.version="19.2.0",Ga}var KS;function $M(){if(KS)return Wh.exports;KS=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=NM(),Wh.exports}var jM=$M();function ff(){return typeof window<"u"}function Pr(t){return vT(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=(vT(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function vT(t){return ff()?t instanceof Node||t instanceof xn(t).Node:!1}function gt(t){return ff()?t instanceof Element||t instanceof xn(t).Element:!1}function Dt(t){return ff()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Jp(t){return!ff()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}const BM=new Set(["inline","contents"]);function Ol(t){const{overflow:e,overflowX:n,overflowY:r,display:a}=In(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!BM.has(a)}const zM=new Set(["table","td","th"]);function LM(t){return zM.has(Pr(t))}const VM=[":popover-open",":modal"];function df(t){return VM.some(e=>{try{return t.matches(e)}catch{return!1}})}const UM=["transform","translate","scale","rotate","perspective"],KM=["transform","translate","scale","rotate","perspective","filter"],qM=["paint","layout","strict","content"];function gy(t){const e=hf(),n=gt(t)?In(t):t;return UM.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)||KM.some(r=>(n.willChange||"").includes(r))||qM.some(r=>(n.contain||"").includes(r))}function PM(t){let e=Gi(t);for(;Dt(e)&&!Hi(e);){if(gy(e))return e;if(df(e))return null;e=Gi(e)}return null}function hf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const IM=new Set(["html","body","#document"]);function Hi(t){return IM.has(Pr(t))}function In(t){return xn(t).getComputedStyle(t)}function pf(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||Jp(t)&&t.host||bi(t);return Jp(e)?e.host:e}function bT(t){const e=Gi(t);return Hi(e)?t.ownerDocument?t.ownerDocument.body:t.body:Dt(e)&&Ol(e)?e:bT(e)}function $r(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=bT(t),u=a===((r=t.ownerDocument)==null?void 0:r.body),c=xn(a);if(u){const f=Xp(c);return e.concat(c,c.visualViewport||[],Ol(a)?a:[],f&&n?$r(f):[])}return e.concat(a,$r(a,[],n))}function Xp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Bc=Math.min,vs=Math.max,zc=Math.round,sc=Math.floor,hi=t=>({x:t,y:t}),HM={left:"right",right:"left",bottom:"top",top:"bottom"},FM={start:"end",end:"start"};function qS(t,e,n){return vs(t,Bc(e,n))}function mf(t,e){return typeof t=="function"?t(e):t}function xs(t){return t.split("-")[0]}function yf(t){return t.split("-")[1]}function ST(t){return t==="x"?"y":"x"}function wT(t){return t==="y"?"height":"width"}const GM=new Set(["top","bottom"]);function Mr(t){return GM.has(xs(t))?"y":"x"}function xT(t){return ST(Mr(t))}function YM(t,e,n){n===void 0&&(n=!1);const r=yf(t),a=xT(t),u=wT(a);let c=a==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[u]>e.floating[u]&&(c=Lc(c)),[c,Lc(c)]}function JM(t){const e=Lc(t);return[Zp(t),e,Zp(e)]}function Zp(t){return t.replace(/start|end/g,e=>FM[e])}const PS=["left","right"],IS=["right","left"],XM=["top","bottom"],ZM=["bottom","top"];function QM(t,e,n){switch(t){case"top":case"bottom":return n?e?IS:PS:e?PS:IS;case"left":case"right":return e?XM:ZM;default:return[]}}function WM(t,e,n,r){const a=yf(t);let u=QM(xs(t),n==="start",r);return a&&(u=u.map(c=>c+"-"+a),e&&(u=u.concat(u.map(Zp)))),u}function Lc(t){return t.replace(/left|right|bottom|top/g,e=>HM[e])}function eD(t){return{top:0,right:0,bottom:0,left:0,...t}}function tD(t){return typeof t!="number"?eD(t):{top:t,right:t,bottom:t,left:t}}function Vc(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}}/*!
62
+ * tabbable 6.3.0
63
+ * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
64
+ */var nD=["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])"],Uc=nD.join(","),TT=typeof Element>"u",zo=TT?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Kc=!TT&&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},iD=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},AT=function(e,n,r){if(pl(e))return[];var a=Array.prototype.slice.apply(e.querySelectorAll(Uc));return n&&zo.call(e,Uc)&&a.unshift(e),a=a.filter(r),a},qc=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=qc(h,!0,r);r.flatten?a.push.apply(a,m):a.push({scopeParent:c,candidates:m})}else{var y=zo.call(c,Uc);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=qc(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},ET=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},OT=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||iD(e))&&!ET(e)?0:e.tabIndex},rD=function(e,n){var r=OT(e);return r<0&&n&&!ET(e)?0:r},sD=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},_T=function(e){return e.tagName==="INPUT"},oD=function(e){return _T(e)&&e.type==="hidden"},aD=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},lD=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},uD=function(e){if(!e.name)return!0;var n=e.form||Kc(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=lD(a,e.form);return!u||u===e},cD=function(e){return _T(e)&&e.type==="radio"},fD=function(e){return cD(e)&&!uD(e)},dD=function(e){var n,r=e&&Kc(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=Kc(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},HS=function(e){var n=e.getBoundingClientRect(),r=n.width,a=n.height;return r===0&&a===0},hD=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=Kc(e);if(m&&!m.shadowRoot&&a(m)===!0)return HS(e);e.assignedSlot?e=e.assignedSlot:!m&&y!==e.ownerDocument?e=y.host:e=m}e=h}if(dD(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return HS(e);return!1},pD=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},Qp=function(e,n){return!(n.disabled||pl(n)||oD(n)||hD(n,e)||aD(n)||pD(n))},Wp=function(e,n){return!(fD(n)||OT(n)<0||!Qp(e,n))},mD=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},RT=function(e){var n=[],r=[];return e.forEach(function(a,u){var c=!!a.scopeParent,f=c?a.scopeParent:a,h=rD(f,c),m=c?RT(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(sD).reduce(function(a,u){return u.isScope?a.push.apply(a,u.content):a.push(u.content),a},[]).concat(n)},vy=function(e,n){n=n||{};var r;return n.getShadowRoot?r=qc([e],n.includeContainer,{filter:Wp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:mD}):r=AT(e,n.includeContainer,Wp.bind(null,n)),RT(r)},yD=function(e,n){n=n||{};var r;return n.getShadowRoot?r=qc([e],n.includeContainer,{filter:Qp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=AT(e,n.includeContainer,Qp.bind(null,n)),r},CT=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return zo.call(e,Uc)===!1?!1:Wp(n,e)};function gD(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function kT(){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 vD(){return/apple/i.test(navigator.vendor)}function em(){const t=/android/i;return t.test(gD())||t.test(kT())}function bD(){return kT().includes("jsdom/")}const FS="data-floating-ui-focusable",SD="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function bo(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&&Jp(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 wD(t){return t.matches("html,body")}function ei(t){return t?.ownerDocument||document}function MT(t){return Dt(t)&&t.matches(SD)}function GS(t){return t?t.getAttribute("role")==="combobox"&&MT(t):!1}function tm(t){return t?t.hasAttribute(FS)?t:t.querySelector("["+FS+"]")||t:null}function _o(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,..._o(t,a.id,n)])}function YS(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 xD(t){return"nativeEvent"in t}function TD(t){return t.mozInputSource===0&&t.isTrusted?!0:em()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function AD(t){return bD()?!1:!em()&&t.width===0&&t.height===0||em()&&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 JS(t,e){return["mouse","pen"].includes(t)}var ED=typeof document<"u",OD=function(){},Ii=ED?j.useLayoutEffect:OD;const _D={...dT};function sp(t){const e=j.useRef(t);return Ii(()=>{e.current=t}),e}const RD=_D.useInsertionEffect,CD=RD||(t=>t());function fi(t){const e=j.useRef(()=>{});return CD(()=>{e.current=t}),j.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 gf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function DT(t,e){const n=vy(t,gf()),r=n.length;if(r===0)return;const a=bo(ei(t)),u=n.indexOf(a),c=u===-1?e===1?0:r-1:u+e;return n[c]}function kD(t){return DT(ei(t).body,1)||t}function MD(t){return DT(ei(t).body,-1)||t}function XS(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!wn(n,r)}var DD=gT();function ZS(t,e,n){let{reference:r,floating:a}=t;const u=Mr(e),c=xT(e),f=wT(c),h=xs(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(yf(e)){case"start":S[c]-=b*(n&&m?-1:1);break;case"end":S[c]+=b*(n&&m?-1:1);break}return S}const ND=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}=ZS(m,r,h),b=r,S={},x=0;for(let T=0;T<f.length;T++){const{name:M,fn:k}=f[T],{x:_,y:R,data:G,reset:I}=await k({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}},I&&x<=50&&(x++,typeof I=="object"&&(I.placement&&(b=I.placement),I.rects&&(m=I.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:a}):I.rects),{x:y,y:g}=ZS(m,b,h)),T=-1)}return{x:y,y:g,placement:b,strategy:a,middlewareData:S}};async function NT(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}=mf(e,t),x=tD(S),M=f[b?g==="floating"?"reference":"floating":g],k=Vc(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},I=Vc(u.convertOffsetParentRelativeRectToViewportRelativeRect?await u.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:_,offsetParent:R,strategy:h}):_);return{top:(k.top-I.top+x.top)/G.y,bottom:(I.bottom-k.bottom+x.bottom)/G.y,left:(k.left-I.left+x.left)/G.x,right:(I.right-k.right+x.right)/G.x}}const $D=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}=mf(t,e);if((n=u.arrow)!=null&&n.alignmentOffset)return{};const k=xs(a),_=Mr(f),R=xs(f)===f,G=await(h.isRTL==null?void 0:h.isRTL(m.floating)),I=b||(R||!T?[Lc(f)]:JM(f)),ee=x!=="none";!b&&ee&&I.push(...WM(f,T,x,G));const J=[f,...I],X=await NT(e,M),he=[];let pe=((r=u.flip)==null?void 0:r.overflows)||[];if(y&&he.push(X[k]),g){const Z=YM(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 $=(je=pe.filter(U=>U.overflows[0]<=0).sort((U,L)=>U.overflows[1]-L.overflows[1])[0])==null?void 0:je.placement;if(!$)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&&($=U);break}case"initialPlacement":$=f;break}if(a!==$)return{reset:{placement:$}}}return{}}}},jD=new Set(["left","top"]);async function BD(t,e){const{placement:n,platform:r,elements:a}=t,u=await(r.isRTL==null?void 0:r.isRTL(a.floating)),c=xs(n),f=yf(n),h=Mr(n)==="y",m=jD.has(c)?-1:1,y=u&&h?-1:1,g=mf(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 zD=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 BD(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}}}}},LD=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:k,y:_}=M;return{x:k,y:_}}},...h}=mf(t,e),m={x:n,y:r},y=await NT(e,h),g=Mr(xs(a)),b=ST(g);let S=m[b],x=m[g];if(u){const M=b==="y"?"top":"left",k=b==="y"?"bottom":"right",_=S+y[M],R=S-y[k];S=qS(_,S,R)}if(c){const M=g==="y"?"top":"left",k=g==="y"?"bottom":"right",_=x+y[M],R=x-y[k];x=qS(_,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 $T(t){const e=In(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=zc(n)!==u||zc(r)!==c;return f&&(n=u,r=c),{width:n,height:r,$:f}}function by(t){return gt(t)?t:t.contextElement}function Ro(t){const e=by(t);if(!Dt(e))return hi(1);const n=e.getBoundingClientRect(),{width:r,height:a,$:u}=$T(e);let c=(u?zc(n.width):n.width)/r,f=(u?zc(n.height):n.height)/a;return(!c||!Number.isFinite(c))&&(c=1),(!f||!Number.isFinite(f))&&(f=1),{x:c,y:f}}const VD=hi(0);function jT(t){const e=xn(t);return!hf()||!e.visualViewport?VD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function UD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function Ts(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),u=by(t);let c=hi(1);e&&(r?gt(r)&&(c=Ro(r)):c=Ro(t));const f=UD(u,n,r)?jT(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&&gt(r)?xn(r):r;let x=b,T=Xp(x);for(;T&&r&&S!==x;){const M=Ro(T),k=T.getBoundingClientRect(),_=In(T),R=k.left+(T.clientLeft+parseFloat(_.paddingLeft))*M.x,G=k.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=Xp(x)}}return Vc({width:y,height:g,x:h,y:m})}function vf(t,e){const n=pf(t).scrollLeft;return e?e.left+n:Ts(bi(t)).left+n}function BT(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-vf(t,n),a=n.top+e.scrollTop;return{x:r,y:a}}function KD(t){let{elements:e,rect:n,offsetParent:r,strategy:a}=t;const u=a==="fixed",c=bi(r),f=e?df(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=pf(r)),Dt(r))){const S=Ts(r);m=Ro(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const b=c&&!g&&!u?BT(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 qD(t){return Array.from(t.getClientRects())}function PD(t){const e=bi(t),n=pf(t),r=t.ownerDocument.body,a=vs(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),u=vs(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let c=-n.scrollLeft+vf(t);const f=-n.scrollTop;return In(r).direction==="rtl"&&(c+=vs(e.clientWidth,r.clientWidth)-a),{width:a,height:u,x:c,y:f}}const QS=25;function ID(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=hf();(!y||y&&e==="fixed")&&(f=a.offsetLeft,h=a.offsetTop)}const m=vf(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<=QS&&(u-=x)}else m<=QS&&(u+=m);return{width:u,height:c,x:f,y:h}}const HD=new Set(["absolute","fixed"]);function FD(t,e){const n=Ts(t,!0,e==="fixed"),r=n.top+t.clientTop,a=n.left+t.clientLeft,u=Dt(t)?Ro(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 WS(t,e,n){let r;if(e==="viewport")r=ID(t,n);else if(e==="document")r=PD(bi(t));else if(gt(e))r=FD(e,n);else{const a=jT(t);r={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return Vc(r)}function zT(t,e){const n=Gi(t);return n===e||!gt(n)||Hi(n)?!1:In(n).position==="fixed"||zT(n,e)}function GD(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=In(t).position==="fixed";let c=u?Gi(t):t;for(;gt(c)&&!Hi(c);){const f=In(c),h=gy(c);!h&&f.position==="fixed"&&(a=null),(u?!h&&!a:!h&&f.position==="static"&&!!a&&HD.has(a.position)||Ol(c)&&!h&&zT(t,c))?r=r.filter(y=>y!==c):a=f,c=Gi(c)}return e.set(t,r),r}function YD(t){let{element:e,boundary:n,rootBoundary:r,strategy:a}=t;const c=[...n==="clippingAncestors"?df(e)?[]:GD(e,this._c):[].concat(n),r],f=c[0],h=c.reduce((m,y)=>{const g=WS(e,y,a);return m.top=vs(g.top,m.top),m.right=Bc(g.right,m.right),m.bottom=Bc(g.bottom,m.bottom),m.left=vs(g.left,m.left),m},WS(e,f,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function JD(t){const{width:e,height:n}=$T(t);return{width:e,height:n}}function XD(t,e,n){const r=Dt(e),a=bi(e),u=n==="fixed",c=Ts(t,!0,u,e);let f={scrollLeft:0,scrollTop:0};const h=hi(0);function m(){h.x=vf(a)}if(r||!r&&!u)if((Pr(e)!=="body"||Ol(a))&&(f=pf(e)),r){const S=Ts(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?BT(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 In(t).position==="static"}function ew(t,e){if(!Dt(t)||In(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bi(t)===n&&(n=n.ownerDocument.body),n}function LT(t,e){const n=xn(t);if(df(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=ew(t,e);for(;r&&LM(r)&&op(r);)r=ew(r,e);return r&&Hi(r)&&op(r)&&!gy(r)?n:r||PM(t)||n}const ZD=async function(t){const e=this.getOffsetParent||LT,n=this.getDimensions,r=await n(t.floating);return{reference:XD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function QD(t){return In(t).direction==="rtl"}const WD={convertOffsetParentRelativeRectToViewportRelativeRect:KD,getDocumentElement:bi,getClippingRect:YD,getOffsetParent:LT,getElementRects:ZD,getClientRects:qD,getDimensions:JD,getScale:Ro,isElement:gt,isRTL:QD};function VT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function e2(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=sc(g),T=sc(a.clientWidth-(y+b)),M=sc(a.clientHeight-(g+S)),k=sc(y),R={rootMargin:-x+"px "+-T+"px "+-M+"px "+-k+"px",threshold:vs(0,Bc(1,h))||1};let G=!0;function I(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&&!VT(m,t.getBoundingClientRect())&&c(),G=!1}try{n=new IntersectionObserver(I,{...R,root:a.ownerDocument})}catch{n=new IntersectionObserver(I,R)}n.observe(t)}return c(!0),u}function t2(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=by(t),y=a||u?[...m?$r(m):[],...$r(e)]:[];y.forEach(k=>{a&&k.addEventListener("scroll",n,{passive:!0}),u&&k.addEventListener("resize",n)});const g=m&&f?e2(m,n):null;let b=-1,S=null;c&&(S=new ResizeObserver(k=>{let[_]=k;_&&_.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?Ts(t):null;h&&M();function M(){const k=Ts(t);T&&!VT(T,k)&&n(),T=k,x=requestAnimationFrame(M)}return n(),()=>{var k;y.forEach(_=>{a&&_.removeEventListener("scroll",n),u&&_.removeEventListener("resize",n)}),g?.(),(k=S)==null||k.disconnect(),S=null,h&&cancelAnimationFrame(x)}}const n2=zD,i2=LD,r2=$D,s2=(t,e,n)=>{const r=new Map,a={platform:WD,...n},u={...a.platform,_c:r};return ND(t,e,{...a,platform:u})};var o2=typeof document<"u",a2=function(){},wc=o2?j.useLayoutEffect:a2;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 UT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tw(t,e){const n=UT(t);return Math.round(e*n)/n}function ap(t){const e=j.useRef(t);return wc(()=>{e.current=t}),e}function l2(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]=j.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[b,S]=j.useState(r);Pc(b,r)||S(r);const[x,T]=j.useState(null),[M,k]=j.useState(null),_=j.useCallback(L=>{L!==ee.current&&(ee.current=L,T(L))},[]),R=j.useCallback(L=>{L!==J.current&&(J.current=L,k(L))},[]),G=u||x,I=c||M,ee=j.useRef(null),J=j.useRef(null),X=j.useRef(y),he=h!=null,pe=ap(h),we=ap(a),je=ap(m),be=j.useCallback(()=>{if(!ee.current||!J.current)return;const L={placement:e,strategy:n,middleware:b};we.current&&(L.platform=we.current),s2(ee.current,J.current,L).then(te=>{const oe={...te,isPositioned:je.current!==!1};Z.current&&!Pc(X.current,oe)&&(X.current=oe,DD.flushSync(()=>{g(oe)}))})},[b,e,n,we,je]);wc(()=>{m===!1&&X.current.isPositioned&&(X.current.isPositioned=!1,g(L=>({...L,isPositioned:!1})))},[m]);const Z=j.useRef(!1);wc(()=>(Z.current=!0,()=>{Z.current=!1}),[]),wc(()=>{if(G&&(ee.current=G),I&&(J.current=I),G&&I){if(pe.current)return pe.current(G,I,be);be()}},[G,I,be,pe,he]);const ne=j.useMemo(()=>({reference:ee,floating:J,setReference:_,setFloating:R}),[_,R]),$=j.useMemo(()=>({reference:G,floating:I}),[G,I]),U=j.useMemo(()=>{const L={position:n,left:0,top:0};if(!$.floating)return L;const te=tw($.floating,y.x),oe=tw($.floating,y.y);return f?{...L,transform:"translate("+te+"px, "+oe+"px)",...UT($.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:te,top:oe}},[n,f,$.floating,y.x,y.y]);return j.useMemo(()=>({...y,update:be,refs:ne,elements:$,floatingStyles:U}),[y,be,ne,$,U])}const u2=(t,e)=>({...n2(t),options:[t,e]}),c2=(t,e)=>({...i2(t),options:[t,e]}),f2=(t,e)=>({...r2(t),options:[t,e]}),d2="data-floating-ui-focusable",nw="active",iw="selected",h2={...dT};let rw=!1,p2=0;const sw=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+p2++;function m2(){const[t,e]=j.useState(()=>rw?sw():void 0);return Ii(()=>{t==null&&e(sw())},[]),j.useEffect(()=>{rw=!0},[]),t}const y2=h2.useId,KT=y2||m2;function g2(){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 v2=j.createContext(null),b2=j.createContext(null),qT=()=>{var t;return((t=j.useContext(v2))==null?void 0:t.id)||null},Sy=()=>j.useContext(b2);function Ic(t){return"data-floating-ui-"+t}function S2(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let ow=0;function mo(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:a=!1}=e;r&&cancelAnimationFrame(ow);const u=()=>t?.focus({preventScroll:n});a?u():ow=requestAnimationFrame(u)}function w2(t){return t?.ownerDocument||document}const Co={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function aw(t){return t==="inert"?Co.inert:t==="aria-hidden"?Co["aria-hidden"]:Co.none}let oc=new WeakSet,ac={},lp=0;const x2=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,PT=t=>t&&(t.host||PT(t.parentNode)),T2=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=PT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function A2(t,e,n,r){const a="data-floating-ui-inert",u=r?"inert":n?"aria-hidden":null,c=T2(e,t),f=new Set,h=new Set(c),m=[];ac[a]||(ac[a]=new WeakMap);const y=ac[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",k=aw(u),_=(k.get(x)||0)+1,R=(y.get(x)||0)+1;k.set(x,_),y.set(x,R),m.push(x),_===1&&M&&oc.add(x),R===1&&x.setAttribute(a,""),!M&&u&&x.setAttribute(u,u==="inert"?"":"true")}})}return lp++,()=>{m.forEach(S=>{const x=aw(u),M=(x.get(S)||0)-1,k=(y.get(S)||0)-1;x.set(S,M),y.set(S,k),M||(!oc.has(S)&&u&&S.removeAttribute(u),oc.delete(S)),k||S.removeAttribute(a)}),lp--,lp||(Co.inert=new WeakMap,Co["aria-hidden"]=new WeakMap,Co.none=new WeakMap,oc=new WeakSet,ac={})}}function lw(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=w2(t[0]).body;return A2(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const wy={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},uw=j.forwardRef(function(e,n){const[r,a]=j.useState();Ii(()=>{vD()&&a("button")},[]);const u={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ic("focus-guard")]:"",style:wy};return F.jsx("span",{...e,...u})}),E2=j.createContext(null),O2=()=>j.useContext(E2);function cw(t){return j.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const _2=20;let Dr=[];function xy(){Dr=Dr.filter(t=>t.isConnected)}function R2(t){xy(),t&&Pr(t)!=="body"&&(Dr.push(t),Dr.length>_2&&(Dr=Dr.slice(-20)))}function fw(){return xy(),Dr[Dr.length-1]}function C2(t){const e=gf();return CT(t,e)?t:vy(t,e)[0]||t}function dw(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=gf(),u=yD(t,r).filter(f=>{const h=f.getAttribute("data-tabindex")||"";return CT(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 k2=j.forwardRef(function(e,n){return F.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:wy})});function M2(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:k,elements:{domReference:_,floating:R}}=e,G=fi(()=>{var xe;return(xe=k.current.floatingContext)==null?void 0:xe.nodeId}),I=fi(S),ee=typeof c=="number"&&c<0,J=GS(_)&&ee,X=x2(),he=X?u:!0,pe=!he||X&&b,we=sp(a),je=sp(c),be=sp(f),Z=Sy(),ne=O2(),$=j.useRef(null),U=j.useRef(null),L=j.useRef(!1),te=j.useRef(!1),oe=j.useRef(-1),E=j.useRef(-1),q=ne!=null,H=tm(R),Q=fi(function(xe){return xe===void 0&&(xe=H),xe?vy(xe,gf()):[]}),re=fi(xe=>{const Me=Q(xe);return we.current.map(ge=>_&&ge==="reference"?_:H&&ge==="floating"?H:Me).filter(Boolean).flat()});j.useEffect(()=>{if(r||!m)return;function xe(ge){if(ge.key==="Tab"){wn(H,bo(ei(H)))&&Q().length===0&&!J&&rp(ge);const Xe=re(),ht=Cr(ge);we.current[0]==="reference"&&ht===_&&(rp(ge),ge.shiftKey?mo(Xe[Xe.length-1]):mo(Xe[1])),we.current[1]==="floating"&&ht===H&&ge.shiftKey&&(rp(ge),mo(Xe[0]))}}const Me=ei(H);return Me.addEventListener("keydown",xe),()=>{Me.removeEventListener("keydown",xe)}},[r,_,H,m,we,J,Q,re]),j.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]),j.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(Ic("focus-guard"))||Z&&(_o(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)})||YS(Z.nodesRef.current,Vt).find(ri=>{var Fn,st,Kl;return[(Fn=ri.context)==null?void 0:Fn.elements.floating,tm((st=ri.context)==null?void 0:st.elements.floating)].includes(Le)||((Kl=ri.context)==null?void 0:Kl.elements.domReference)===Le})));if(En===_&&H&&dw(H,we),h&&En!==_&&!(Gt!=null&&Gt.isConnected)&&bo(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(k.current.insideReactTree){k.current.insideReactTree=!1;return}(J||!m)&&Le&&Hn&&!te.current&&Le!==fw()&&(L.current=!0,T(!1,ht,"focus-out"))})}const ge=!!(!Z&&ne);function Xe(){S2(E),k.current.insideReactTree=!0,E.current=window.setTimeout(()=>{k.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,k]);const ce=j.useRef(null),Te=j.useRef(null),Ct=cw([ce,ne?.beforeInsideRef]),Je=cw([Te,ne?.afterInsideRef]);j.useEffect(()=>{var xe,Me;if(r||!R)return;const ge=Array.from((ne==null||(xe=ne.portalNode)==null?void 0:xe.querySelectorAll("["+Ic("portal")+"]"))||[]),ht=(Me=(Z?YS(Z.nodesRef.current,G()):[]).find(Gt=>{var Vt;return GS(((Vt=Gt.context)==null?void 0:Vt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,Le=[R,ht,...ge,...I(),$.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?lw(Le,!pe,pe):lw(Le);return()=>{En()}},[r,_,R,m,we,ne,J,he,pe,Z,G,I]),Ii(()=>{if(r||!Dt(H))return;const xe=ei(H),Me=bo(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&&mo(ht,{preventScroll:ht===H})})},[r,x,H,ee,re,je]),Ii(()=>{if(r||!H)return;const xe=ei(H),Me=bo(xe);R2(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(TD(Gt)||AD(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,wy),q&&_&&_.insertAdjacentElement("afterend",Xe);function ht(){if(typeof be.current=="boolean"){const Le=_||fw();return Le&&Le.isConnected?Le:Xe}return be.current.current||Xe}return()=>{M.off("openchange",ge);const Le=bo(xe),En=wn(R,Le)||Z&&_o(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=C2(Gt);be.current&&!L.current&&Dt(Vt)&&(!(Vt!==Le&&Le!==xe.body)||En)&&Vt.focus({preventScroll:!0}),Xe.remove()})}},[r,R,H,be,k,M,Z,q,_,G]),j.useEffect(()=>(queueMicrotask(()=>{L.current=!1}),()=>{queueMicrotask(xy)}),[r]),Ii(()=>{if(!r&&ne)return ne.setFocusManagerState({modal:m,closeOnFocusOut:g,open:x,onOpenChange:T,domReference:_}),()=>{ne.setFocusManagerState(null)}},[r,ne,m,x,T,g,_]),Ii(()=>{r||H&&dw(H,we)},[r,H,we]);function ii(xe){return r||!y||!m?null:F.jsx(k2,{ref:xe==="start"?$: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(uw,{"data-type":"inside",ref:Ct,onFocus:xe=>{if(m){const ge=re();mo(a[0]==="reference"?ge[0]:ge[ge.length-1])}else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(L.current=!1,XS(xe,ne.portalNode)){const ge=kD(_);ge?.focus()}else{var Me;(Me=ne.beforeOutsideRef.current)==null||Me.focus()}}}),!J&&ii("start"),n,ii("end"),Ti&&F.jsx(uw,{"data-type":"inside",ref:Je,onFocus:xe=>{if(m)mo(re()[0]);else if(ne!=null&&ne.preserveTabOrder&&ne.portalNode)if(g&&(L.current=!0),XS(xe,ne.portalNode)){const ge=MD(_);ge?.focus()}else{var Me;(Me=ne.afterOutsideRef.current)==null||Me.focus()}}})]})}function hw(t){return Dt(t.target)&&t.target.tagName==="BUTTON"}function D2(t){return Dt(t.target)&&t.target.tagName==="A"}function pw(t){return MT(t)}function N2(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=j.useRef(),S=j.useRef(!1),x=j.useMemo(()=>({onPointerDown(T){b.current=T.pointerType},onMouseDown(T){const M=b.current;T.button===0&&f!=="click"&&(JS(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}JS(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||hw(T))&&(T.key===" "&&!pw(u)&&(T.preventDefault(),S.current=!0),!D2(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||hw(T)||pw(u)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[a,u,f,m,y,r,n,g,h]);return j.useMemo(()=>c?{reference:x}:{},[c,x])}const $2={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},j2={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},mw=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 B2(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=Sy(),M=fi(typeof h=="function"?h:()=>!1),k=typeof h=="function"?M:h,_=j.useRef(!1),{escapeKey:R,outsidePress:G}=mw(S),{escapeKey:I,outsidePress:ee}=mw(x),J=j.useRef(!1),X=fi(Z=>{var ne;if(!n||!c||!f||Z.key!=="Escape"||J.current)return;const $=(ne=u.current.floatingContext)==null?void 0:ne.nodeId,U=T?_o(T.nodesRef.current,$):[];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,xD(Z)?Z.nativeEvent:Z,"escape-key")}),he=fi(Z=>{var ne;const $=()=>{var U;X(Z),(U=Cr(Z))==null||U.removeEventListener("keydown",$)};(ne=Cr(Z))==null||ne.addEventListener("keydown",$)}),pe=fi(Z=>{var ne;const $=u.current.insideReactTree;u.current.insideReactTree=!1;const U=_.current;if(_.current=!1,m==="click"&&U||$||typeof k=="function"&&!k(Z))return;const L=Cr(Z),te="["+Ic("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&&gt(L)&&!wD(L)&&!wn(L,a.floating)&&Array.from(oe).every(re=>!wn(E,re)))return;if(Dt(L)&&be){const re=Hi(L),ce=In(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&&_o(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?_o(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 $=()=>{var U;pe(Z),(U=Cr(Z))==null||U.removeEventListener(m,$)};(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 $(){window.clearTimeout(Z),J.current=!0}function U(){Z=window.setTimeout(()=>{J.current=!1},hf()?5:0)}const L=ei(a.floating);f&&(L.addEventListener("keydown",I?he:X,I),L.addEventListener("compositionstart",$),L.addEventListener("compositionend",U)),k&&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",I?he:X,I),L.removeEventListener("compositionstart",$),L.removeEventListener("compositionend",U)),k&&L.removeEventListener(m,ee?we:pe,ee),te.forEach(oe=>{oe.removeEventListener("scroll",ne)}),window.clearTimeout(Z)}},[u,a,f,k,m,n,r,b,c,R,G,X,I,he,pe,ee,we]),j.useEffect(()=>{u.current.insideReactTree=!1},[u,k,m]);const je=j.useMemo(()=>({onKeyDown:X,...y&&{[$2[g]]:Z=>{r(!1,Z.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Z){r(!1,Z.nativeEvent,"reference-press")}}}}),[X,r,y,g]),be=j.useMemo(()=>({onKeyDown:X,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[j2[m]]:()=>{u.current.insideReactTree=!0}}),[X,m,u]);return j.useMemo(()=>c?{reference:je,floating:be}:{},[c,je,be])}function z2(t){const{open:e=!1,onOpenChange:n,elements:r}=t,a=KT(),u=j.useRef({}),[c]=j.useState(()=>g2()),f=qT()!=null,[h,m]=j.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=j.useMemo(()=>({setPositionReference:m}),[]),b=j.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return j.useMemo(()=>({dataRef:u,open:e,onOpenChange:y,elements:b,events:c,floatingId:a,refs:g}),[e,y,b,c,a,g])}function L2(t){t===void 0&&(t={});const{nodeId:e}=t,n=z2({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,a=r.elements,[u,c]=j.useState(null),[f,h]=j.useState(null),y=a?.domReference||u,g=j.useRef(null),b=Sy();Ii(()=>{y&&(g.current=y)},[y]);const S=l2({...t,elements:{...a,...f&&{reference:f}}}),x=j.useCallback(R=>{const G=gt(R)?{getBoundingClientRect:()=>R.getBoundingClientRect(),getClientRects:()=>R.getClientRects(),contextElement:R}:R;h(G),S.refs.setReference(G)},[S.refs]),T=j.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=j.useMemo(()=>({...S.refs,setReference:T,setPositionReference:x,domReference:g}),[S.refs,T,x]),k=j.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),_=j.useMemo(()=>({...S,...r,refs:M,elements:k,nodeId:e}),[S,M,k,e,r]);return Ii(()=>{r.dataRef.current.floatingContext=_;const R=b?.nodesRef.current.find(G=>G.id===e);R&&(R.context=_)}),j.useMemo(()=>({...S,context:_,refs:M,elements:k}),[S,M,k,_])}function up(t,e,n){const r=new Map,a=n==="item";let u=t;if(a&&t){const{[nw]:c,[iw]:f,...h}=t;u=h}return{...n==="floating"&&{tabIndex:-1,[d2]:""},...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&&[nw,iw].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 V2(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=j.useCallback(f=>up(f,t,"reference"),e),u=j.useCallback(f=>up(f,t,"floating"),n),c=j.useCallback(f=>up(f,t,"item"),r);return j.useMemo(()=>({getReferenceProps:a,getFloatingProps:u,getItemProps:c}),[a,u,c])}const U2=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function K2(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=KT(),y=((n=u.domReference)==null?void 0:n.id)||m,g=j.useMemo(()=>{var _;return((_=tm(u.floating))==null?void 0:_.id)||c},[u.floating,c]),b=(r=U2.get(h))!=null?r:h,x=qT()!=null,T=j.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=j.useMemo(()=>{const _={id:g,...b&&{role:b}};return b==="tooltip"||h==="label"?_:{..._,...b==="menu"&&{"aria-labelledby":y}}},[b,g,y,h]),k=j.useCallback(_=>{let{active:R,selected:G}=_;const I={role:"option",...R&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{...I,"aria-selected":G}}return{}},[g,h]);return j.useMemo(()=>f?{reference:T,floating:M,item:k}:{},[f,T,M,k])}const _l=t=>Array.isArray(t)?t:[t],q2=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},IT=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),ms=(t,e)=>e==null?t??[]:t==null?_l(e):t.concat(e),I2=(...t)=>t.reduce(ms,[]),bs=(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},H2=(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]),Rs=(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"},F2={...Yi,function:"a function"};class G2 extends Error{}const Rt=t=>Vo(t,G2),Vo=(t,e=Error)=>{throw new e(t)};class Y2 extends Error{name="ParseError"}const Y=t=>Vo(t,Y2),HT=t=>` ${t}`,J2="​",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},FT=Object.entries,Si=(t,e)=>t in e,Ty=(t,e)=>e in t;class X2{constructor(e){Object.assign(this,e)}}const Z2=class{};class GT extends Z2{}const Q2=(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]},YT=(t,e)=>Q2(t,e)[1],Rl=t=>Object.keys(t).length===0,Hc=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],W2=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),eN=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=HT(`unset${J2}`),tN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),JT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},XT=globalThis.File??Blob,ZT={ArrayBuffer,Blob,File:XT,FormData,Headers,Request,Response,URL},nN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},Uo={...JT,...ZT,...nN,String,Number,Boolean},Ay=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},nm=t=>typeof t=="object"&&t!==null?Ay(t)??"object":ti(t),Xt=Array.isArray,iN={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"},rN={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"},sN={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"},oN={...iN,...rN,...sN},Ey=t=>{const e=Object(t).name??null;return e&&Si(e,Uo)&&Uo[e]===t?e:null},yw=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},aN=t=>QT(t,new Map),QT=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=Ey(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=QT(c.value,e))}}return Object.defineProperties(r,a),r},lN=t=>{let e=ci;return()=>e===ci?e=t():e},bf=t=>typeof t=="function"&&t.length===0,uN=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:
65
+ Message: ${r}
66
+ Source: (${t.slice(0,-1)}) => {
67
+ ${t.at(-1)}
68
+ }`)}}};class Ir{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const cN=lN(()=>{try{return new Function("return false")()}catch{return!0}});class wi{constructor(){}}var fN={};const dN=()=>{try{return((new Error().stack?.split(`
69
+ `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},hN=fN??{},pN={fileName:dN,env:hN},mN=t=>t[0].toUpperCase()+t.slice(1),WT=t=>new RegExp(yN(t),typeof t=="string"?"":t.flags),yN=t=>`^(?:${typeof t=="string"?t:t.source})$`,kr={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},tl="\\",Sf={" ":1,"\n":1," ":1},gN=/^-0\.?0*$/.source,eA=/[1-9]\d*/.source,vN=/\.\d+/.source,bN=/\.\d*[1-9]/.source,tA=t=>WT(kr.negativeLookahead(gN)+kr.nonCapturingGroup("-?"+kr.nonCapturingGroup(kr.nonCapturingGroup("0|"+eA)+kr.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),gw=tA({decimalPattern:bN,allowDecimalOnly:!1}),SN=gw.test.bind(gw),im=tA({decimalPattern:vN,allowDecimalOnly:!0});im.test.bind(im);const wN=/^-?\d*\.?\d*$/,xN=t=>t.length!==0&&wN.test(t),Fc=WT(kr.negativeLookahead("^-0$")+"-?"+kr.nonCapturingGroup(kr.nonCapturingGroup("0|"+eA))),TN=Fc.test.bind(Fc),rm=/^-?\d+$/,AN=rm.test.bind(rm),nA={number:"a number",bigint:"a bigint",integer:"an integer"},iA=(t,e)=>`'${t}' was parsed as ${nA[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,EN=(t,e)=>e==="number"?SN(t):TN(t),ON=(t,e)=>e==="number"?Number(t):Number.parseInt(t),_N=(t,e)=>e==="number"?xN(t):AN(t),RN=(t,e)=>Oy(t,"number",e),CN=(t,e)=>Oy(t,"number",{...e,strict:!0}),kN=(t,e)=>Oy(t,"integer",e),Oy=(t,e,n)=>{const r=ON(t,e);return!Number.isNaN(r)&&_N(t,e)?n?.strict?EN(t,e)?r:Y(iA(t,e)):r:n?.errorOnFail?Y(n?.errorOnFail===!0?`Failed to parse ${nA[e]} from '${t}'`:n?.errorOnFail):void 0},MN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Fc.test(e))return n;if(rm.test(e))return Y(iA(t,"bigint"))},DN="0.53.0",NN={version:DN,filename:pN.fileName(),FileConstructor:XT},Cl=NN,vw=new Map,cp=Object.create(null),sm=t=>{const e=vw.get(t);if(e)return e;let n=$N(t);return cp[n]?n=`${n}${cp[n]++}`:cp[n]=1,Cl[n]=t,vw.set(t,n),n},ml=t=>/^[$A-Z_a-z][\w$]*$/.test(t),$N=t=>{switch(typeof t){case"object":{if(t===null)break;const e=Ay(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)}`)},_y=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,jN=(t,e={})=>nl(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Ie=(t,e)=>{switch(ti(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?Gc(n,e?.indent??0,""):JSON.stringify(nl(n,Ko,[]),null,e?.indent):Gc(n,e?.indent??0,"");case"symbol":return Ko.onSymbol(t);default:return _y(t)}},Gc=(t,e,n)=>{if(typeof t=="function")return Ko.onFunction(t);if(typeof t!="object"||t===null)return _y(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const u=t.map(c=>Gc(c,e,r)).join(`,
70
+ `+r);return e?`[
71
+ ${r}${u}
72
+ ${n}]`:`[${u}]`}const a=t.constructor.name;if(a==="Object"){const u=Hc(t).map(([c,f])=>{const h=typeof c=="symbol"?Ko.onSymbol(c):ml(c)?c:JSON.stringify(c),m=Gc(f,e,r);return`${r}${h}: ${m}`});return u.length===0?"{}":e?`{
73
+ ${u.join(`,
74
+ `)}
75
+ ${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(${sm(t)})`,onFunction:t=>`Function(${sm(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=`${BN[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+=`.${LN(f,3)}`:zN.test(m)&&(m=m.slice(0,-3)),`${m+y}, ${h}`},BN=["January","February","March","April","May","June","July","August","September","October","November","December"],zN=/:\d\d:00$/,LN=(t,e)=>String(t).padStart(e,"0"),rA=(t,e,...[n])=>{const r=n?.stringifySymbol??Ie;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(`${Ie(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return a},Ml=(t,...e)=>t.reduce((n,r)=>rA(n,r,...e),"");class sA extends IT{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"?Ie(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=rA(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class oA{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 Sf))}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 VN=(t,e)=>`Unmatched ${t}${e===""?"":` before ${e}`}`,aA=t=>`Missing ${t}`;let om="$ark",UN=2;for(;om in globalThis;)om=`$ark${UN++}`;const lA=om;globalThis[lA]=Cl;const W=Cl,KN=t=>`${lA}.${t}`,en=t=>KN(sm(t));class uA extends GT{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 cA(e,n)}index(e,n=!1){return fA(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
76
+ `,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(`
77
+ `).map(r=>" ".repeat(n)+`${r}`).join(`
78
+ `):this.body} }`}compile(){return new uN(...this.argNames,this.body)}}const Fo=t=>Rs(t,"object")||typeof t=="symbol"?en(t):_y(t),cA=(t,e=!1)=>typeof t=="string"&&ml(t)?`${e?"?":""}.${t}`:fA(qN(t),e),qN=t=>typeof t=="symbol"?en(t):JSON.stringify(t),fA=(t,e=!1)=>`${e?"?.":""}[${t}]`;class fp extends uA{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 dA=t=>Ge(t,(e,n)=>[e,Xt(n)?[...n]:n]),Ji=HT("arkKind"),fe=(t,e)=>t?.[Ji]===e,Qt=t=>fe(t,"root")||fe(t,"constraint"),PN=["unit","proto","domain"],wf=["required","optional","index","sequence"],hA=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],pA=[...hA,"structure","predicate"],Ry=[...pA,...wf],xf=["alias","union","morph","unit","intersection","proto","domain"],IN=[...xf,...Ry],mA=Ge(Ry,(t,e)=>[e,1]),HN=Ge([...wf,"undeclared"],(t,e)=>[e,1]),yA=Ge(IN,(t,e)=>[e,t]),xc=t=>typeof t=="string"&&t in yA,Yc=t=>yA[t],Cy=t=>xf.slice(Yc(t)+1);[...Cy("union")];[...Cy("morph")];const As=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),Tf=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=>Ie(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 FN extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Ie(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const GN={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:FN,throw:(...t)=>{throw new Mt.Error(...t)},throwInternalOperandError:(t,e)=>Rt(`Unexpected JSON Schema input for ${t}: ${Ie(e)}`),defaultConfig:GN};W.config??={};const am=(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]=gA(t.toJsonSchema,e.toJsonSchema):xc(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},gA=((t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=YN(t.fallback,e.fallback):n[r]=e[r];return n}),YN=(t,e)=>{t=bw(t),e=bw(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},bw=t=>typeof t=="function"?{default:t}:t??{};class qo extends GT{[Ji]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},a){super(),this.input=r,this.ctx=a,W2(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:I2(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 sA(...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 zr extends IT{[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 JN(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 zr(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(`
79
+ `)}addAncestorPaths(e){for(const n of e.path.stringifyAncestors())this.byAncestorPath[n]=Fe(this.byAncestorPath[n],e)}}class JN extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
80
+ `+e.map(n=>` • ${XN(n)}`).join(`
81
+ `)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const XN=t=>t.toString().split(`
82
+ `).join(`
83
+ `);class wo{path=[];errors=new zr(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 sA(...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 zr){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 vA extends Ir{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)=>e$(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=>bA(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 wo(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 wo(n,this.$.resolvedConfig);return this.traverseApply(n,a),a.finalize(r)};case"contextual":return(n,r)=>{const a=new wo(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 wo(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=WN(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=Yc(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(Ry,this.kind)}isStructural(){return Rr(wf,this.kind)}isRefinement(){return Rr(pA,this.kind)}isRoot(){return Rr(xf,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(Sw(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&Vo(Sw(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}},Sw=(t,e)=>`${t} had no references matching ${Ie(e)}.`,ZN=t=>Ml(t,{stringifyNonKey:e=>e.expression}),QN=/"(\$ark\.[^"]+)"/g,WN=t=>JSON.stringify(t).replaceAll(QN,"$1"),Nr=(t,e)=>({path:t,node:e,propString:ZN(t)}),bA=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),ww=(t,e)=>bs(t,e,{isEqual:bA}),e$=(t,e)=>bs(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 SA(`Intersection${a&&` at ${a}`} of ${xw(n,r)}`)}return`The following intersections result in unsatisfiable types:
84
+ • ${this.map(({path:e,l:n,r})=>`${e}: ${xw(n,r)}`).join(`
85
+ • `)}`}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 xw=(t,e)=>`${lm(t)} and ${lm(e)}`,lm=t=>Qt(t)?t.expression:Xt(t)?t.map(lm).join(" | ")||"never":String(t),SA=t=>`${t} results in an unsatisfiable type`,yo={},Zi=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),um=(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(yo[a]!==void 0)return yo[a];if(!n.pipe){const f=`${e.hash}${r}${t.hash}`;if(yo[f]!==void 0){const h=yo[f],m=h instanceof ae?h.invert():h;return yo[a]=m,m}}const u=!n.pipe||!t.includesTransform&&!e.includesTransform;if(u&&t.equals(e))return t;let c=u?cm(t,e,n):t.hasKindIn(...xf)?t$(t,e,n):cm(t,e,n);return Qt(c)&&(t.equals(c)?c=t:e.equals(c)&&(c=e)),yo[a]=c,c}),cm=(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}},t$=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?Tw(e,t,n):Tw(t,e,n):cm(t,e,n),Tw=(t,e,n)=>t.distribute(r=>n$(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)}),n$=(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 vA{constructor(e,n){super(e,n),Object.defineProperty(this,Ji,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Zi(this,e,this.$)}}class Af 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 Tf(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},Jc=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,i$(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),Jc(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)bs(t.r,r);return Jc(t)},Xc=t=>Object.entries(t).flatMap(([n,r])=>n in mA?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),i$=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},r$=(...t)=>Y(s$(...t)),s$=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${mN(t)} operand must be ${e.description} (was ${r})`},o$=(t,e,n)=>new Zc(t,e,n,n,null);class wA extends Ir{}class Zc extends Ir{[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(a$(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 wA}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:jN(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 a$=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,l$=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 u$ 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=Tf(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 xA={implementation:l$,Node:u$},c$=dt({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Y(d$(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/h$(t.rule,e.rule))})},obviatesBasisDescription:!0});class f$ extends Af{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 TA={implementation:c$,Node:f$},d$=t=>`divisor must be an integer (was ${t})`,h$=(t,e)=>{let n,r=t,a=e;for(;a!==0;)n=a,a=r%a,r=n;return r};class Yo extends Af{boundOperandKind=g$[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=v$(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${p$[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?b$(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 p$={"<":">=","<=":">",">":"<=",">=":"<"},m$={min:"max",minLength:"maxLength",after:"before"},AA={parse:t=>t||void 0},EA=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},OA=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},_A=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,y$=(t,e)=>`${t} bound must be a positive integer (was ${e})`,ky=t=>e=>((!Number.isInteger(e)||e<0)&&Y(y$(t,e)),e),g$={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},v$=(t,e)=>`${Si(t,m$)?">":"<"}${e?"":"="}`,b$=t=>typeof t=="string"?t:new Date(t).toLocaleString(),S$=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,w$=dt({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:_A,serialize:t=>t.toISOString()}},normalize:OA("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:kl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class x$ 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 RA={implementation:w$,Node:x$},T$=dt({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:_A,serialize:t=>t.toISOString()}},normalize:OA("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 A$ 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 CA={implementation:T$,Node:A$},E$=dt({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:ky("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 O$ extends Af{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 kA={implementation:E$,Node:O$},_$=dt({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:AA},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 R$ 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 MA={implementation:_$,Node:R$},C$=dt({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:ky("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:EA("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 k$ 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 DA={implementation:C$,Node:k$},M$=dt({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:AA},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 D$ 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 NA={implementation:M$,Node:D$},N$=dt({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:ky("minLength")}},reduce:t=>t.rule===0?W.intrinsic.unknown:void 0,normalize:EA("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 $$ 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 $A={implementation:N$,Node:$$},j$={min:NA.implementation,max:MA.implementation,minLength:$A.implementation,maxLength:DA.implementation,exactLength:kA.implementation,after:RA.implementation,before:CA.implementation},B$={min:NA.Node,max:MA.Node,minLength:$A.Node,maxLength:DA.Node,exactLength:kA.Node,after:RA.Node,before:CA.Node},z$=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 L$ extends Af{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 jA={implementation:z$,Node:L$},Tc=(t,e)=>{const n=V$(t);return e&&!e.includes(n)?Y(`Root of kind ${n} should be one of ${e}`):n},V$=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(Aw(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 mA)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Y(Aw(t))},Aw=t=>`${Ie(t)} is not a valid type schema`,Ew={},U$=t=>Xt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Vn={};W.nodesByRegisteredId=Vn;const BA=t=>(Ew[t]??=0,`${t}${++Ew[t]}`),zA=t=>{const e=Ef[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=FT(u).sort(([m],[y])=>xc(m)?xc(y)?Yc(m)-Yc(y):1:xc(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():q$(m,c)}return My({id:t.id,kind:t.kind,inner:r,meta:c,$:t.$})},My=({id:t,kind:e,inner:n,meta:r,$:a,ignoreCache:u})=>{const c=Ef[e],f=FT(n),h=[];let m={};for(const[k,_]of f){const R=c.keys[k],G=R.serialize??(R.child?U$:As);if(m[k]=G(_),R.child===!0){const I=_;Xt(I)?h.push(...I):h.push(I)}else typeof R.child=="function"&&h.push(...R.child(_))}c.finalizeInnerJson&&(m=c.finalizeInnerJson(m));let y={...m},g={};Rl(r)||(g=Ge(r,(k,_)=>[k,k==="examples"?_:As(_)]),y.meta=lc(g,"description",!0)),m=lc(m,c.collapsibleKey,!1);const b=JSON.stringify({kind:e,...m});y=lc(y,c.collapsibleKey,!1);const S=lc(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 k in n)k!=="in"&&k!=="out"&&(T[k]=n[k]);const M=new Yj[e](T,a);return a.nodesByHash[x]=M},K$=(t,e)=>t.id===e?t:(Qt(Vn[e])&&Rt(`Unexpected attempt to overwrite node id ${e}`),My({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),q$=(t,e,n)=>My({id:BA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),lc=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const a=t[e];if(n||Rs(a,"object")&&(Object.keys(a).length===1||Array.isArray(a)))return a}return t},fm=(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(VA(t.default,e.default)):t.default:e.hasDefault()?e.default:ci;return n.$.node("optional",{key:r,value:a,default:c})};class LA 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 VA=(t,e)=>`Invalid intersection of default values ${Ie(t)} & ${Ie(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:fm}});class I$ extends LA{constructor(...e){super(...e),"default"in this.inner&&Ny(this.value,this.inner.default,this.key)}get rawIn(){const e=super.rawIn;return this.hasDefault()?this.$.node("optional",YT(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} = ${Ie(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=F$(this);defaultValueMorphRef=this.defaultValueMorph&&en(this.defaultValueMorph)}const Dy={implementation:P$,Node:I$},H$={},F$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${As(t.default)}}`;return H$[e]??=UA(t.key,t.value,t.default)},UA=(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 Rs(r,"object")?(a,u)=>(Xi(t,()=>e(a[t]=n,u),u),a):a=>(a[t]=r,a)},Ny=(t,e,n)=>{const r=bf(e);Rs(e,"object")&&!r&&Y(G$(n));const a=t.in(r?e():e);if(a instanceof zr){n===null&&Y(`Default ${a.summary}`);const u=a.transform(c=>c.transform(f=>({...f,prefixPath:[n]})));Y(`Default for ${u.summary}`)}return e},G$=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 vA{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 zr?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(Y$):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=gA(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(SA(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Y(J$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[Ow(r)??Y(_w("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(W.intrinsic.object)&&e!=="merge")return r;const a=Ow(r);if(a||Y(_w(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 Ny(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:
86
+ ${f}
87
+ `})}})),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=um(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 r$(n,a.impliedBasis,this);const c=this.$.node("intersection",{[a.kind]:a}),f=e==="out"?um(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"?YT(u,{undeclared:1}):{...u,undeclared:n}:u,r?void 0:{shouldTransform:a=>!Rr(wf,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",go(e))}lessThan(e){return this.constrain("max",go(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",go(e))}lessThanLength(e){return this.constrain("maxLength",go(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",go(e))}earlierThan(e){return this.constrain("before",go(e))}}const Y$="Expected a non-empty brand name after #",go=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},uc=(t,e)=>fe(e,"root")?fe(t,"root")?t.extends(e):e.allows(t):fe(t,"root")?t.hasUnit(e):e===t,Ow=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,J$=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
88
+ ${t}`,_w=(t,e)=>`${t} operand must be an object (was ${e})`,Nl=(t,e)=>Ge(Cy(t),(n,r)=>[r,e]),X$=t=>typeof t=="string"?{reference:t}:t,Rw=t=>t instanceof ae?W.intrinsic.never.internal:t,Z$=dt({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:X$,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>Rw(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(()=>Rw(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class Q$ 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(W$(n.id,r));r.push(n.id),n=Vn[n.id]}return fe(n,"root")?n:Rt(`Unexpected resolution for reference ${this.reference}
89
+ Seen: [${r.join("->")}]
90
+ Resolution: ${Ie(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}: ${Ie(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 W$=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,$y={implementation:Z$,Node:Q$};class jy 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 Tf(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`ctx.errorFromNodeContext(${this.compiledErrorContext})`))}}const ej=dt({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:Ty(t,"numberAllowsNaN")&&t.domain!=="number"?Y(By.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 tj extends jy{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 By={implementation:ej,Node:tj,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},nj=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,HN)?(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})=>Rs(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)=>Cw({},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(`
91
+ ◦ `)}`,problem:t=>`(${t.actual}) must be...
92
+ ${t.expected}`},intersections:{intersection:(t,e,n)=>Cw(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 ij extends Dl{basis=this.inner.domain??this.inner.proto??null;prestructurals=[];refinements=this.children.filter(e=>e.isRefinement()?(Rr(hA,e.kind)&&this.prestructurals.push(e),!0):!1);structure=this.inner.structure;expression=rj(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 KA={implementation:nj,Node:ij},rj=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"},Cw=(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),Jc({kind:"intersection",baseInner:r,l:Xc(t),r:Xc(e),roots:[],ctx:n}))},sj=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(aj(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 oj 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 qA={implementation:sj,Node:oj},aj=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
93
+ Left: ${t}
94
+ Right: ${e}`,lj=dt({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>Ey(t)??As(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(Qc.writeInvalidSchemaMessage(e.proto)),Ty(e,"dateAllowsInvalid")&&e.proto!==Date&&Y(Qc.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?oN[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":nm(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:yw(t.proto,e.proto)?t:yw(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 uj extends jy{builtinName=Ey(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 Qc={implementation:lj,Node:uj,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${ti(t)})`},cj=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=wj(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,ko),expected:t=>{const e=H2(t.errors,"propString"),n=Object.entries(e).map(([r,a])=>{const u=[];for(const h of a)bs(u,h.expected);const c=ko(u),f=a.every(h=>h.actual===a[0].actual)?a[0].actual:Ie(a[0].data);return`${r&&`${r} `}must be ${c}${f&&` (was ${f})`}`});return ko(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(Tj(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 fj 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?vj(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,Sj);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==ci)return r;const a=new wo(e,this.$.resolvedConfig);return this.traverseApply(e,a),a.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>bs(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,ko)}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&&Ty(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=ko(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"?`${yj}[${n}]`:`${gj}(${n})`;e.line(`ctx.errorFromNodeContext({
95
+ code: "predicate",
96
+ expected: ${h},
97
+ actual: ${m},
98
+ relativePath: [${f}],
99
+ meta: ${this.compiledMeta}
100
+ })`)}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=bs(S.cases[g].branchIndices,u):S.cases[g]??={branchIndices:[u],condition:y.l},S.cases[b]?S.cases[b].branchIndices=bs(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?pj(e,this.branches):e;if(!n.length)return null;const r=dj(n,this),a={};for(const u in r.best.cases){const c=hj(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 dj=(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:PA(r.path)},u=e.branches.map((c,f)=>({originalIndex:f,branch:c}));return{best:r,location:a,defaultEntries:u,node:e}},hj=(t,e)=>{const n=t.best.cases[e],r=mj(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=kw(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=kw(f.branch,t.location);a?.push({originalIndex:f.originalIndex,branch:h})}u.push(f)}}return t.defaultEntries=u,a},pj=(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}),mj=(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},PA=t=>t.reduce((e,n)=>e+cA(n,!0),"data"),yj=en(F2),gj=en(Ie),IA={implementation:cj,Node:fj},vj=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])}),bj={delimiter:" | ",finalDelimiter:" | "},Sj=t=>ko(t,bj),ko=(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},wj=({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||xj(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])},xj=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Lo(t.shallowMorphs,e.shallowMorphs)||Y(Mw(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(Mw(t.expression,e.expression)))},kw=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const a=PA(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}}),Mw=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
101
+ Left: ${t}
102
+ Right: ${e}`,Tj=(t,e)=>`The intersection of two ordered unions is indeterminate:
103
+ Left: ${t}
104
+ Right: ${e}`,Aj=dt({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():As(t)}},normalize:t=>t,defaults:{description:t=>Ie(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 Ej extends jy{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=Dw(this.unit,this.serializedValue);compiledNegation=Dw(this.unit,this.serializedValue,"negated");expression=Ie(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 HA={implementation:Aj,Node:Ej},Dw=(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}`},Oj=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(Cj(n.expression));const r=n.branches.filter(a=>a.hasKind("unit"));return r.length?Y(Rj(r.map(a=>Ie(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 _j 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)=>Hc(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 Hc(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 FA={implementation:Oj,Node:_j},Rj=t=>`Index keys ${t.join(", ")} should be specified as named props.`,Cj=t=>`Indexed key definition '${t}' must be a string or symbol`,kj=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:fm,optional:fm}});class Mj extends LA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=Tf(this.errorContext)}const GA={implementation:kj,Node:Mj},Dj=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 Ny(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,As(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(zj);if(t.optionals?.length||t.defaultables?.length)return Y(JA)}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} = ${Ie(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",Nw(a[0].result)):n.$.node("union",a.map(u=>({proto:Array,sequence:Nw(u.result)})))}}});class Nj extends Go{impliedBasis=W.intrinsic.Array.internal;tuple=Bj(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=ms(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return ww(this.flatRefs,this.prevariadic.flatMap((e,n)=>Fe(e.node.flatRefs.map(r=>Nr([`${n}`,...r.path],r.node)),Nr([`${n}`],e.node)))),ww(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=jj(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 $j={},jj=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(UA(a,u,c)),n+=`${a}: ${u.id} = ${As(c)}, `}return n+="]",$j[n]??=e},YA={implementation:Dj,Node:Nj},Bj=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},Nw=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),{}),JA="A postfix required element cannot follow an optional or defaultable element",zj="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}`,$w(e)&&$w(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(VA(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)},$w=t=>t.kind==="prefix"||t.kind==="postfix",XA=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??"{}"},Lj=XA("description"),Vj=XA("expression"),jw=(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},Uj=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:Lj},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=dm(y,m.value,n.$);return g.required&&(a.required=ms(a.required,g.required)),g.optional&&(a.optional=ms(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=dm(y,m.value,n.$);return g.required&&(r.required=ms(r.required,g.required)),g.optional&&(r.optional=ms(r.optional,g.optional)),g.index??[]}))}const c={};(t.undeclared||e.undeclared)&&(c.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const f=Jc({kind:"structure",baseInner:c,l:Xc(r),r:Xc(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(zw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=jw(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(zw(c.key)),n[c.key]=!0,t.index)for(const f of t.index){const h=jw(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 Kj extends Go{impliedBasis=W.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=ms(this.required,this.optional);propsByKey=Ge(this.props,(e,n)=>[n.key,n]);propsByKeyReference=en(this.propsByKey);expression=Vj(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 Dy.implementation.keys?[f,h]:[]);return n[u]=Fe(n[u],this.$.node(u,c)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!uc(r,this.keyof()));if(n.length)return Y(Bw(this.expression,n))}get(e,...n){let r,a=!1;const u=Hj(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)uc(u,f.signature)&&(r=r?.and(f.value)??f.value);if(this.sequence&&uc(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(Fj(u.expression,this.sequence.expression)):Y(Bw(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=dA(this.inner),a=u=>{const c=n.some(f=>uc(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(["),Ij(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={},qj=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=qj(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},Ij=(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")})},ZA={implementation:Uj,Node:Kj},Hj=t=>(fe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),Fj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,dm=(t,e,n)=>{const[r,a]=q2(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},Gj=t=>fe(t,"root")?t.expression:Ie(t),Bw=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(Gj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,zw=t=>`Duplicate key ${Fo(t)}`,Ef={...j$,alias:$y.implementation,domain:By.implementation,unit:HA.implementation,proto:Qc.implementation,union:IA.implementation,morph:qA.implementation,intersection:KA.implementation,divisor:TA.implementation,pattern:jA.implementation,predicate:xA.implementation,required:GA.implementation,optional:Dy.implementation,index:FA.implementation,sequence:YA.implementation,structure:ZA.implementation};W.defaultConfig=eN(Object.assign(Ge(Ef,(t,e)=>[t,e.defaults]),{jitless:cN(),clone:aN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Mt.defaultConfig}));W.resolvedConfig=am(W.defaultConfig,W.config);const Yj={...B$,alias:$y.Node,domain:By.Node,unit:HA.Node,proto:Qc.Node,union:IA.Node,morph:qA.Node,intersection:KA.Node,divisor:TA.Node,pattern:jA.Node,predicate:xA.Node,required:GA.Node,optional:Dy.Node,index:FA.Node,sequence:YA.Node,structure:ZA.Node};class hm extends X2{get[Ji](){return"module"}}const QA=(t,e)=>new hm(Ge(t,(n,r)=>[n,fe(r,"module")?QA(r,e):e.bindReference(r)])),Jj=t=>Xt(t)?t:"branches"in t&&Xt(t.branches)?t.branches:void 0,Xj=(t,e)=>Y(`Node of kind ${e} is not valid as a ${t} definition`),Lw=t=>`#${t} duplicates public alias ${t}`,pp={};W.ambient??={};let Vw;const WA="function $",Zj=t=>eE(t,tE(t)),eE=(t,e)=>{const n=e.write(WA,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)},tE=t=>new uA().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},
105
+ ${c},
106
+ `;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},
107
+ `},`{
108
+ `)+"}");class nE{config;resolvedConfig;name;get[Ji](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=am(W.config,n),this.resolvedConfig=am(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(Lw(c)),this.aliases[c]=u):(c in this.aliases&&Y(Lw(a)),this.aliases[c]=u,this.exportedNames.push(c)),!fe(u,"module")&&!fe(u,"generic")&&!bf(u)){const f=this.preparseOwnDefinitionFormat(u,{alias:c});this.resolutions[c]=fe(f,"root")?this.bindReference(f):this.createParseContext(f).id}}Vw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[Vw.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 Zc(e,a?new wA(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(Tc(e),e,n);preparseNode(e,n,r){let a=typeof e=="string"?e:Tc(n,e);if(Qt(n)&&n.kind===a)return n;if(a==="alias"&&!r?.prereduced){const{reference:f}=$y.implementation.normalize(n,this);if(f.startsWith("$")){const h=this.resolveRoot(f.slice(1));n=h,a=h.kind}}else if(a==="union"&&Rs(n,"object")){const f=Jj(n);f?.length===1&&(n=f[0],a=Tc(n))}if(Qt(n)&&n.kind===a)return n;const c=Ef[a].normalize?.(n,this)??n;return Qt(c)?c.kind===a?c:Xj(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 Zc(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Y(oE(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!fe(n,"generic"))return n}maybeResolveSubalias(e){return pm(this.aliases,e)??pm(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: ${Ie(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}: ${Ie(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(aE(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??BA(e.prefix);return Vn[n]=Object.assign(e,{[Ji]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new wo(e,this.resolvedConfig)}import(...e){return new hm(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")?QA(a,this):Uw(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=sE(this,this._exports),this._json=rE(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=tE(this.references);this.precompilation=r.write(WA,4),eE(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new hm(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=zA(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=K$(u,a.id)),Vn[a.id]=u,u}finalize(e){return Uw(e),!e.precompilation&&!this.resolvedConfig.jitless&&Zj(e.references),e}}class iE extends nE{parseOwnDefinitionFormat(e,n){return zA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(Tc(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const Uw=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},rE=t=>Ge(t,(e,n)=>[e,fe(n,"root")||fe(n,"generic")?n.json:fe(n,"module")?rE(n):Rt(`Unexpected resolution ${Ie(n)}`)]),pm=(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(Qj(r));const u=e.slice(n+1),c=a[u];if(c===void 0)return pm(a,u);if(fe(c,"root")||fe(c,"generic"))return c;if(fe(c,"module"))return c.root??Y(aE(e));Rt(`Unexpected resolution for alias '${e}': ${Ie(c)}`)},zy=(t,e)=>new iE(t,e),$l=new iE({}),sE=(t,e)=>{const n={};for(const r in e){const a=e[r];if(fe(a,"module")){const u=sE(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 ${Ie(a)}`)}return n},oE=t=>`'${t}' is unresolvable`,Qj=t=>`'${t}' must reference a module to be accessed using dot syntax`,aE=t=>`Reference to submodule '${t}' must specify an alias`;$l.export();const Ye=$l.schema,Ly=$l.node;$l.defineSchema;const er=$l.generic,lE="^(?:0|[1-9]\\d*)$",Wj=new RegExp(lE);en(Wj);const uE=zy({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={...uE};const cE=zy({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:lE}},{prereducedAliases:!0}).export();Object.assign(W.intrinsic,cE);const e3=zy({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),me={...uE,...cE,...e3,emptyStructure:Ly("structure",{},{prereduced:!0})};W.intrinsic={...me};const Kw=((t,e)=>new RegExp(t,e));Object.assign(Kw,{as:Kw});const t3=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],qw=t=>t.toString()!=="Invalid Date",n3=t=>t.slice(2,-1),fE=t=>`'${t}' could not be parsed by the Date constructor`,i3=(t,e)=>r3(t,e),r3=(t,e)=>{const n=new Date(t);if(qw(n))return n;const r=RN(t);if(r!==void 0){const a=new Date(r);if(qw(a))return a}return e?Y(e===!0?fE(t):e):void 0},Pw=(t,e)=>{const n=t.scanner.shiftUntilEscapable(a3[hE[e]]);if(t.scanner.lookahead==="")return t.error(u3(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,dE))t.root=t.ctx.$.node("unit",{unit:n});else{const r=i3(n,fE(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},dE={"'":1,'"':1},s3={"/":1,"'":1,'"':1},o3={"d'":"'",'d"':'"',"'":"'",'"':'"'},hE={...o3,"/":"/"},a3={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},l3={'"':"double-quote","'":"single-quote","/":"forward slash"},u3=(t,e)=>`${e}${t} requires a closing ${l3[hE[e]]}`,c3=t=>`Private type references should not include '#'. Use '${t}' instead.`,pE="Optional definitions like 'string?' are only valid as properties in an object or tuple",mE="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,...Sf},f3=(t,e)=>t===">"?e[0]==="="?e[1]==="=":e.trimStart()===""||Si(e.trimStart()[0],Jo):t==="="?e[0]!=="=":t===","||t==="?",d3=(t,e,n)=>yE(t,e,n,[]),yE=(t,e,n,r)=>{const a=n.parseUntilFinalizer();return r.push(a.root),a.finalizer===">"?r.length!==e.params.length?n.error(gE(t,e.names,r.map(u=>u.expression))):r:a.finalizer===","?yE(t,e,n,r):a.error(aA(">"))},gE=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,Iw=t=>{const e=t.scanner.shiftUntilLookahead(Jo);e==="keyof"?t.addPrefix("keyof"):t.root=p3(t,e)},h3=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(gE(t,e.names,[]));const a=d3(t,e,n);return e(...a)},p3=(t,e)=>m3(t,e)??y3(t,e)??t.error(e===""?t.scanner.lookahead==="#"?c3(t.shiftedByOne().scanner.shiftUntilLookahead(Jo)):vE(t):oE(e)),m3=(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")?h3(e,n,t):Y(`Unexpected resolution ${Ie(n)}`)},y3=(t,e)=>{const n=CN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=MN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},vE=t=>{const e=t.previousOperator();return e?bE(e,t.scanner.unscanned):g3(t.scanner.unscanned)},bE=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,g3=t=>`Expected an expression${t?` before '${t}'`:""}`,SE=t=>t.scanner.lookahead===""?t.error(vE(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(s3)?Pw(t,t.scanner.shift()):t.scanner.lookaheadIsIn(Sf)?SE(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in dE?Pw(t,`${t.scanner.shift()}${t.scanner.shift()}`):Iw(t),v3={">":!0,">=":!0},b3={"<":!0,"<=":!0},Wc={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},S3=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,wE=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,w3=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Wc[e]}, ${n}${Wc[r]})`,x3=(t,e)=>{const n=A3(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 O3(t,n)},T3={"<":1,">":1,"=":1},A3=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,Hw=(t,e,n,r)=>n.extends(W.intrinsic.number)?typeof e!="number"?Y(mm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(W.intrinsic.lengthBoundable)?typeof e!="number"?Y(mm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(W.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Y(S$(n.expression)),E3=t=>({rule:t3(t.limit)?n3(t.limit):t.limit,exclusive:t.comparator.length===1}),O3=(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(mm(e,u,"right"));const c=a.unit,f=e.length===1,h=Hw(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,b3))return t.error(wE(e));const m=Hw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(m[0],E3(t.branches.leftBound)),t.branches.leftBound=null},mm=(t,e,n)=>`Comparator ${n==="left"?Wc[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,_3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo);t.root=t.root.brand(e)},R3=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilLookahead(Jo),n=kN(e,{errorOnFail:Fw(e)});n===0&&t.error(Fw(0)),t.root=t.root.constrain("divisor",n)},Fw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,xE=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(C3):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():f3(e,t.scanner.unscanned)?t.finalize(e):Si(e,T3)?x3(t,e):e==="%"?R3(t):e==="#"?_3(t):e in Sf?xE(t):t.error(Vy(e))},Vy=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,C3="Missing expected ']'",k3=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(M3(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},M3=t=>`Default value '${t}' must be a literal value`,Gw=(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 Of(new oA(t),e),a=D3(r);return r.finalizer===">"&&Y(Vy(">")),a},D3=t=>{t.parseOperand();let e=Uy(t).root;return e?(t.finalizer==="="?e=k3(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Y(Vy(t.scanner.lookahead)),e):Rt(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Uy=t=>{for(;t.finalizer===void 0;)N3(t);return t},N3=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class Of{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(aA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Wc[n];if(!Si(r,v3))return this.error(wE(n));if(this.branches.leftBound)return this.error(w3(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(VN(")",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 Uy(new Of(this.scanner,this.ctx))}parseOperator(){return xE(this)}parseOperand(){return SE(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(S3(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 $3="An empty string is not a valid generic parameter name",ym=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilLookahead(Jo);return r===""?t.lookahead===""&&e.length?e:Y($3):(t.shiftUntilNonWhitespace(),j3(t,r,e,n))},Yw="extends ",j3=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(Yw))t.jumpForward(Yw.length);else return t.lookahead===","&&t.shift(),n.push(e),ym(t,n,r);const a=Uy(new Of(t,r));return n.push([e,a.root]),ym(t,n,r)};class B3 extends Ir{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(L3);h=e.parse(r[a+1])}return m=>new z3(m,f,h)},{attach:n})}}class z3 extends Ir{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 L3=`":" must be followed by exactly one return type e.g:
109
+ fn("string", ":", "number")(s => s.length)`;class V3 extends Ir{$;constructor(e){super((...n)=>new cc(e)(...n),{bind:e}),this.$=e}in(e){return new cc(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new cc(this.$).at(e,n)}case(e,n){return new cc(this.$).case(e,n)}}class cc extends Ir{$;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(K3),this.branches.length&&Y(U3),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:Jw});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:Jw},"self")),this.$.finalize(a)}}const Jw=t=>t.throw(),U3="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",K3="At most one key matcher may be specified per expression",TE=(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 kE(t,e)},q3="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' }",I3=(t,e)=>{let n;const r={},a=Hc(t);for(const[c,f]of a){const h=G3(c);if(h.kind==="spread"){if(!Rl(r))return Y(F3);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(me.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(me.object))return Y(Y3(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Y(H3(f)),r.undeclared=f;continue}const m=TE(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(q3),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=dm(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))},H3=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Ie(t)})`,F3="Spread operator may only be used as the first key in an object",G3=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},Y3=t=>`Spread operand must resolve to an object literal type (was ${t})`,J3=(t,e)=>sB(t)?_E[t[0]](t,e):iB(t)?OE[t[1]](t,e):null,X3=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),yp=(t,e)=>{if(t[2]===void 0)return Y(bE(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.$):um(n,r,e.$);return a instanceof ae?a.throw():a},Z3=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),Q3=(t,e)=>typeof t[2]!="function"?Y(AE("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),AE=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,W3=(t,e)=>typeof t[2]!="function"?Y(AE(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),eB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configure(t[2],t[3]),EE=t=>t,tB=EE({"[]":Z3,"?":()=>Y(pE)}),nB=EE({"|":yp,"&":yp,":":W3,"=>":Q3,"|>":yp,"@":eB,"=":()=>Y(mE)}),OE={...tB,...nB},iB=t=>OE[t[1]]!==void 0,rB=t=>t,_E=rB({keyof:X3,instanceof:(t,e)=>{if(typeof t[1]!="function")return Y(Xw(nm(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Y(Xw(nm(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),sB=t=>_E[t[0]]!==void 0,Xw=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,oB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let a=!1;t[r]==="..."&&r<t.length-1&&(a=!0,r++);const u=TE(t[r],e),[c,f,h]=Xt(u)?u:[u];if(r++,a){if(!c.extends(W.intrinsic.Array))return Y(uB(c.expression));n=n.flatMap(m=>c.distribute(y=>lB(dA(m),y)))}else n=n.map(m=>f==="?"?RE(m,c):f==="="?aB(m,c,h):gm(m,c))}return e.$.parseSchema(n.map(a=>Rl(a)?{proto:Array,exactLength:0}:{proto:Array,sequence:a}))},gm=(t,e)=>t.defaultables||t.optionals?Y(t.variadic?JA:cB):(t.variadic?t.postfix=Fe(t.postfix,e):t.prefix=Fe(t.prefix,e),t),RE=(t,e)=>t.variadic?Y(CE):(t.optionals=Fe(t.optionals,e),t),aB=(t,e,n)=>t.variadic?Y(CE):t.optionals?Y(fB):(t.defaultables=Fe(t.defaultables,[[e,n]]),t),Zw=(t,e)=>(t.postfix&&Y(Qw),t.variadic?t.variadic.equals(e)||Y(Qw):t.variadic=e.internal,t),lB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return Zw(t,W.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)gm(t,r);if(n.optionals)for(const r of n.optionals)RE(t,r);if(n.variadic&&Zw(t,n.variadic),n.postfix)for(const r of n.postfix)gm(t,r);return t},uB=t=>`Spread element must be an array (was ${t})`,Qw="A tuple may have at most one variadic element",cB="A required element may not follow an optional element",CE="An optional element may not follow a variadic element",fB="A defaultable element may not follow an optional element without a default",dB={},kE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Gw(t,e);const n=dB[e.$.name]??={};return n[t]??=Gw(t,e)}return Rs(t,"object")?hB(t,e):Y(vm(ti(t)))},hB=(t,e)=>{const n=Ay(t);switch(n){case void 0:return fe(t,"root")?t:I3(t,e);case"Array":return pB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=bf(t)?t():t;return fe(r,"root")?r:Y(vm("Function"))}default:return Y(vm(n??Ie(t)))}},pB=(t,e)=>J3(t,e)??oB(t,e),vm=t=>`Type definitions must be strings or objects (was ${t})`;class mB extends Ir{constructor(e){const n=Object.assign({errors:zr,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 Zc(u,r[1],e,e,null)}return e.parse(r)},{attach:n})}}const yl=W;class _f extends nE{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 o$(c,n,this)}]}parseGenericParams(e,n){return ym(new oA(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return bf(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=kE(e,n);if(Xt(a)){if(a[1]==="=")return Y(mE);if(a[1]==="?")return Y(pE)}return a}unit=e=>this.units([e]);valueOf=e=>this.units(tN(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 B3(this);match=new V3(this);declare=()=>({type:this.type});define(e){return e}type=new mB(this);static scope=((e,n={})=>new _f(e,n));static module=((e,n={})=>this.scope(e,n).export())}const yB=Object.assign(_f.scope,{define:t=>t}),ze=_f;class gB extends wi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const vB=er(["base",me.object],["props",me.object])(t=>t.base.merge(t.props),gB),bB=ze.module({Key:me.key,Merge:vB});class SB extends wi{}const wB=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)},SB),xB=ze.module({root:me.Array,readonly:"root",index:me.nonNegativeIntegerString,liftFrom:wB},{name:"Array"}),bm=Ye(["string",Cl.FileConstructor]),TB=bm.rawOr(bm.array()),Ww=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:TB}}),AB=ze.module({root:["instanceof",FormData],value:bm,parsed:Ww,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:Ww})},{name:"FormData"}),EB=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"}),OB={Boolean:1,Number:1,String:1},_B=ze.module({...Ge({...JT,...ZT},(t,e)=>t in OB?[]:[t,["instanceof",e]]),Array:xB,TypedArray:EB,FormData:AB}),RB=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"}),CB=Ye({domain:"number",divisor:1}),ME=ze.module({root:me.number,integer:CB,epoch:RB,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}),Ly("intersection",r)},ex=et(Fc,"a well-formed integer string"),DE=ze.module({root:ex,parse:Ye({in:ex,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"}),kB=et(/^[\dA-Fa-f]+$/,"hex characters only"),MB=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"}),tx=et(/^[A-Z].*$/,"capitalized"),DB=ze.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:tx}),preformatted:tx},{name:"string.capitalize"}),NB=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)},$B=/^(?: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}))$/,jB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:$B.source},predicate:{meta:"a credit card number",predicate:NB}}),BB=/^([+-]?\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)?)?)?)?$/,zB=t=>!Number.isNaN(new Date(t).valueOf()),nx=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:zB}}).assertHasKind("intersection"),ix=DE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=ME.epoch(n);return r instanceof zr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),LB=ze.module({root:ix,parse:Ye({in:ix,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.epoch"}),rx=et(BB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),VB=ze.module({root:rx,parse:Ye({in:rx,morphs:t=>new Date(t),declaredOut:me.Date})},{name:"string.date.iso"}),UB=ze.module({root:nx,parse:Ye({declaredIn:nx,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:VB,epoch:LB},{name:"string.date"}),KB=et(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),sx="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Or=`(${sx}[.]){3}${sx}`,qB=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,})?$`),IB=ze.module({root:["v4 | v6","@","an IP address"],v4:et(qB,"an IPv4 address","ipv4"),v6:et(PB,"an IPv6 address","ipv6")},{name:"string.ip"}),Mo="a JSON string",NE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Mo} (${t})`},HB=Ye({meta:Mo,domain:"string",predicate:{meta:Mo,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Mo,problem:NE(n)})}}}}),FB=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Mo,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Mo,problem:NE(n)})}},GB=ze.module({root:HB,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:FB,declaredOut:me.jsonObject})},{name:"string.json"}),ox=et(/^[a-z]*$/,"only lowercase letters"),YB=ze.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:ox}),preformatted:ox},{name:"string.lower"}),$E=["NFC","NFD","NFKC","NFKD"],jl=Ge($E,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Rf=Ge($E,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:jl[e]})]),JB=ze.module({root:Rf.NFC,preformatted:jl.NFC},{name:"string.normalize.NFC"}),XB=ze.module({root:Rf.NFD,preformatted:jl.NFD},{name:"string.normalize.NFD"}),ZB=ze.module({root:Rf.NFKC,preformatted:jl.NFKC},{name:"string.normalize.NFKC"}),QB=ze.module({root:Rf.NFKD,preformatted:jl.NFKD},{name:"string.normalize.NFKD"}),WB=ze.module({root:"NFC",NFC:JB,NFD:XB,NFKC:ZB,NFKD:QB},{name:"string.normalize"}),ax=et(im,"a well-formed numeric string"),ez=ze.module({root:ax,parse:Ye({in:ax,morphs:t=>Number.parseFloat(t),declaredOut:me.number})},{name:"string.numeric"}),lx="a regex pattern",tz=Ye({domain:"string",predicate:{meta:lx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:lx,problem:String(n)})}}},meta:{format:"regex"}}),nz=/^(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-]+)*))?$/,iz=et(nz,"a semantic version (see https://semver.org/)"),ux=et(/^\S.*\S$|^\S?$/,"trimmed"),rz=ze.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:ux}),preformatted:ux},{name:"string.trim"}),cx=et(/^[A-Z]*$/,"only uppercase letters"),sz=ze.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:cx}),preformatted:cx},{name:"string.upper"}),oz=t=>URL.canParse(t),fx=Ye({domain:"string",predicate:{meta:"a URL string",predicate:oz},meta:{format:"uri"}}),az=ze.module({root:fx,parse:Ye({declaredIn:fx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),lz=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"}),uz=ze.module({root:me.string,alpha:et(/^[A-Za-z]*$/,"only letters"),alphanumeric:et(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:kB,base64:MB,capitalize:DB,creditCard:jB,date:UB,digits:et(/^\d*$/,"only digits 0-9"),email:KB,integer:DE,ip:IB,json:GB,lower:YB,normalize:WB,numeric:ez,regex:tz,semver:iz,trim:rz,upper:sz,url:az,uuid:lz},{name:"string"}),cz=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}),fz=ze.module({root:me.unknown,any:me.unknown},{name:"unknown"}),dz=ze.module({root:me.jsonObject,stringify:Ly("morph",{in:me.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:me.string})},{name:"object.json"}),hz=ze.module({root:me.object,json:dz},{name:"object"});class pz extends wi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const mz=er(["K",me.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),pz);class yz extends wi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const gz=er(["T",me.object],["K",me.key])(t=>t.T.pick(t.K),yz);class vz extends wi{description='omit a set of properties from an object like `Omit(User, "age")`'}const bz=er(["T",me.object],["K",me.key])(t=>t.T.omit(t.K),vz);class Sz extends wi{description="make all named properties of an object optional like `Partial(User)`"}const wz=er(["T",me.object])(t=>t.T.partial(),Sz);class xz extends wi{description="make all named properties of an object required like `Required(User)`"}const Tz=er(["T",me.object])(t=>t.T.required(),xz);class Az extends wi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const Ez=er("T","U")(t=>t.T.exclude(t.U),Az);class Oz extends wi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const _z=er("T","U")(t=>t.T.extract(t.U),Oz),Rz=ze.module({Exclude:Ez,Extract:_z,Omit:bz,Partial:wz,Pick:gz,Record:mz,Required:Tz}),Hr=yB({...cz,...Rz,..._B,...bB,string:uz,number:ME,object:hz,unknown:fz},{prereducedAliases:!0,name:"ark"}),jt=Hr.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(Hr.type,yl.typeAttachments);Hr.match;Hr.fn;Hr.generic;Hr.schema;Hr.define;Hr.declare;const jE={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 Cz(t){return Number.parseInt(t,10)}const kz=Ot(jE),Mz=kz.keyof().pipe(t=>Cz(t));Ot([Mz,"string"]);function Dz(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 BE(t){return F.jsx("a",{...t})}const Nz={class:"_class_1riwg_1"},gp=["⠋","⠙","⠸","⠴","⠦","⠇"];function $z({input:t}){const e=j.useRef(null),[n,r]=j.useState(typeof t=="string"?t:null);return j.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 jz=Object.create,zE=Object.defineProperty,Bz=Object.getOwnPropertyDescriptor,LE=Object.getOwnPropertyNames,zz=Object.getPrototypeOf,Lz=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[LE(t)[0]])((e={exports:{}}).exports,e),e.exports},Vz=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=LE(e),u=0,c=a.length,f;u<c;u++)f=a[u],!Lz.call(t,f)&&f!==n&&zE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=Bz(e,f))||r.enumerable});return t},vt=(t,e,n)=>(n=t!=null?jz(zz(t)):{},Vz(zE(n,"default",{value:t,enumerable:!0}),t)),VE=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}}),Uz=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=VE().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}}),Kz=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=VE().default,r=Uz();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}}),Cs=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=Kz();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=Cs();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 Cf(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(qz,e)}};return e}function qz(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 Iz(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 Cf(f=>(n++,a.push(f),u(),{unsubscribe(){n--,c();const h=a.findIndex(m=>m===f);h>-1&&a.splice(h,1)}}))}}function Hz(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=Cf(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 Fz(t){return Cf(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 Gz=Object.create,UE=Object.defineProperty,Yz=Object.getOwnPropertyDescriptor,KE=Object.getOwnPropertyNames,Jz=Object.getPrototypeOf,Xz=Object.prototype.hasOwnProperty,Bl=(t,e)=>function(){return e||(0,t[KE(t)[0]])((e={exports:{}}).exports,e),e.exports},Zz=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var a=KE(e),u=0,c=a.length,f;u<c;u++)f=a[u],!Xz.call(t,f)&&f!==n&&UE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=Yz(e,f))||r.enumerable});return t},kf=(t,e,n)=>(n=t!=null?Gz(Jz(t)):{},Zz(UE(n,"default",{value:t,enumerable:!0}),t));const qE=()=>{},dx=t=>{Object.freeze&&Object.freeze(t)};function PE(t,e,n){var r;const a=e.join(".");return(r=n[a])!==null&&r!==void 0||(n[a]=new Proxy(qE,{get(u,c){if(!(typeof c!="string"||c==="then"))return PE(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)}),dx(m.args),dx(m.path),t(m)}})),n[a]}const Qz=t=>PE(t,[],Object.create(null)),Wz=t=>new Proxy(qE,{get(e,n){if(n!=="then")return t(n)}});var IE=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}}),eL=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=IE().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}}),tL=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=IE().default,r=eL();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}}),HE=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=tL();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}}),Ky=Bl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=HE();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}});kf(Ky());kf(HE());var fc=kf(Ky());function nL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,fc.default)((0,fc.default)({},t),{},{error:r})}}return{ok:!0,result:(0,fc.default)((0,fc.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 iL(t,e){let n;try{n=nL(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}kf(Ky());var dc=vt(Cs()),vo=vt(ni());function rL(t){return t instanceof vl}function sL(t){return gl(t)&&gl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function oL(t,e){return typeof t=="string"?t:gl(t)&&typeof t.message=="string"?t.message:e}var vl=class Ac extends Error{constructor(e,n){var r,a;const u=n?.cause;super(e,{cause:u}),(0,dc.default)(this,"cause",void 0),(0,dc.default)(this,"shape",void 0),(0,dc.default)(this,"data",void 0),(0,dc.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,Ac.prototype)}static from(e,n={}){const r=e;return rL(r)?(n.meta&&(r.meta=(0,vo.default)((0,vo.default)({},r.meta),n.meta)),r):sL(r)?new Ac(r.error.message,(0,vo.default)((0,vo.default)({},n),{},{result:r})):new Ac(oL(r,"Unknown error"),(0,vo.default)((0,vo.default)({},n),{},{cause:r}))}};function aL(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 hx=t=>typeof t=="function";function lL(t){if(t)return t;if(typeof window<"u"&&hx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&hx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var il=vt(ni());function uL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:aL(t.transformer),methodOverride:t.methodOverride}}function cL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const fL={query:"GET",mutation:"POST",subscription:"PATCH"};function FE(t){return"input"in t?t.transformer.input.serialize(t.input):cL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const GE=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=FE(t);u!==void 0&&t.methodOverride!=="POST"&&a.push(`input=${encodeURIComponent(JSON.stringify(u))}`)}return a.length&&(r+="?"+a.join("&")),r},dL=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=FE(t);return e!==void 0?JSON.stringify(e):void 0},hL=t=>gL((0,il.default)((0,il.default)({},t),{},{contentTypeHeader:"application/json",getUrl:GE,getBody:dL}));var pL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const mL=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 pL};async function yL(t){var e;mL(t.signal);const n=t.getUrl(t),r=t.getBody(t),a=(e=t.methodOverride)!==null&&e!==void 0?e:fL[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 lL(t.fetch)(n,{method:a,signal:t.signal,body:r,headers:c})}async function gL(t){const e={},n=await yL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}vt(ni());const px=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function mx(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 k;(k=T.reject)===null||k===void 0||k.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:px,reject:px},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 vL(...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 hc=vt(ni());function bL(t){var e,n;const r=uL(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 GE((0,hc.default)((0,hc.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=vL(...g.map(_=>_.signal)),T=await hL((0,hc.default)((0,hc.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=mx(c("query")),h=mx(c("mutation")),m={query:f,mutation:h};return({op:y})=>Cf(g=>{/* istanbul ignore if -- @preserve */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=iL(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 YE=(t,...e)=>typeof t=="function"?t(...e):t;vt(Cs());function SL(){let t,e;return{promise:new Promise((r,a)=>{t=r,e=a}),resolve:t,reject:e}}async function wL(t){const e=await YE(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function xL(t){const e={method:"connectionParams",data:await YE(t)};return JSON.stringify(e)}vt(Cs());var hs=vt(Cs());function TL(t){const{promise:e,resolve:n,reject:r}=SL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function AL(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 EL=class Sm{constructor(e){var n;if((0,hs.default)(this,"id",++Sm.connectCount),(0,hs.default)(this,"WebSocketPonyfill",void 0),(0,hs.default)(this,"urlOptions",void 0),(0,hs.default)(this,"keepAliveOpts",void 0),(0,hs.default)(this,"wsObservable",Hz(null)),(0,hs.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=++Sm.connectCount;const n=wL(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&&AL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await TL(r),e.urlOptions.connectionParams&&r.send(await xL(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,hs.default)(EL,"connectCount",0);vt(Cs());vt(ni());var bp=vt(Cs()),yx=vt(ni()),OL=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 Fz({links:this.links,op:(0,yx.default)((0,yx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(Iz())}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 _L=Symbol.for("trpc_untypedClient"),RL={query:"query",mutate:"mutation",subscribe:"subscription"},CL=t=>RL[t];function kL(t){const e=Qz(({path:n,args:r})=>{const a=[...n],u=CL(a.pop()),c=a.join(".");return t[u](c,...r)});return Wz(n=>n===_L?t:e[n])}function ML(t){const e=new OL(t);return kL(e)}vt(ni());vt(ni());var DL=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(DL());vt(ni());var NL=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}}),JE=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}}),$L=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=JE();function r(a){return new n(a,0)}e.exports=r,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/wrapAsyncGenerator.js"(t,e){var n=JE();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(NL());vt($L());vt(jL());vt(ni());var BL={};function XE(t,e){if(t instanceof Promise)throw new Error(e)}function zL(t,e){const n={},r=[];for(const a in t){const u=t[a]["~standard"].validate(e[a]);if(XE(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 LL(t){const e=t.runtimeEnvStrict??t.runtimeEnv??BL;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)??zL(h,e);XE(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 VL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},UL="__vite_start_time"in globalThis,KL=typeof window<"u",qi=Ot("string"),gx=Ot('"true" | "false" | undefined'),ZE=LL({isServer:!UL&&!KL,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:gx.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:gx.pipe(t=>t==="true")},runtimeEnv:VL,emptyStringAsUndefined:!0}),cn=ML({links:[bL({url:ZE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),qL=ft({key:"appVersionQuery",default:cn.version.query});ft({key:"lastKnownVersion",default:null,effects:[pT(localStorage,JSON,"lastKnownVersion")]});const PL=vi({key:"appVersion",get:async({get:t})=>{const e=t(qL),{version:n}=await e;return n}});function Sp(t){return["optional",t]}function IL(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 Ec=Object.create(null);Object.keys(yi).forEach(t=>{Ec[yi[t]]=t});const wm={type:"error",data:"parser error"},QE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",WE=typeof ArrayBuffer=="function",eO=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,qy=({type:t,data:e},n,r)=>QE&&e instanceof Blob?n?r(e):vx(e,r):WE&&(e instanceof ArrayBuffer||eO(e))?n?r(e):vx(new Blob([e]),r):r(yi[t]+(e||"")),vx=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function bx(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let wp;function HL(t,e){if(QE&&t.data instanceof Blob)return t.data.arrayBuffer().then(bx).then(e);if(WE&&(t.data instanceof ArrayBuffer||eO(t.data)))return e(bx(t.data));qy(t,!1,n=>{wp||(wp=new TextEncoder),e(wp.encode(n))})}const Sx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Wa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Sx.length;t++)Wa[Sx.charCodeAt(t)]=t;const FL=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},GL=typeof ArrayBuffer=="function",Py=(t,e)=>{if(typeof t!="string")return{type:"message",data:tO(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:YL(t.substring(1),e)}:Ec[n]?t.length>1?{type:Ec[n],data:t.substring(1)}:{type:Ec[n]}:wm},YL=(t,e)=>{if(GL){const n=FL(t);return tO(n,e)}else return{base64:!0,data:t}},tO=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},nO="",JL=(t,e)=>{const n=t.length,r=new Array(n);let a=0;t.forEach((u,c)=>{qy(u,!1,f=>{r[c]=f,++a===n&&e(r.join(nO))})})},XL=(t,e)=>{const n=t.split(nO),r=[];for(let a=0;a<n.length;a++){const u=Py(n[a],e);if(r.push(u),u.type==="error")break}return r};function ZL(){return new TransformStream({transform(t,e){HL(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 pc(t){return t.reduce((e,n)=>e+n.length,0)}function mc(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 QL(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(pc(n)<1)break;const h=mc(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(pc(n)<2)break;const h=mc(n,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(pc(n)<8)break;const h=mc(n,8),m=new DataView(h.buffer,h.byteOffset,h.length),y=m.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(wm);break}a=y*Math.pow(2,32)+m.getUint32(4),r=3}else{if(pc(n)<a)break;const h=mc(n,a);f.enqueue(Py(u?h:xp.decode(h),e)),r=0}if(a===0||a>t){f.enqueue(wm);break}}}})}const iO=4;function _t(t){if(t)return WL(t)}function WL(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 Mf=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")(),e4="arraybuffer";function rO(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const t4=Un.setTimeout,n4=Un.clearTimeout;function Df(t,e){e.useNativeTimers?(t.setTimeoutFn=t4.bind(Un),t.clearTimeoutFn=n4.bind(Un)):(t.setTimeoutFn=Un.setTimeout.bind(Un),t.clearTimeoutFn=Un.clearTimeout.bind(Un))}const i4=1.33;function r4(t){return typeof t=="string"?s4(t):Math.ceil((t.byteLength||t.size)*i4)}function s4(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 sO(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function o4(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function a4(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 l4 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,Df(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 l4(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=Py(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=o4(e);return n.length?"?"+n:""}}class u4 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)};XL(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,JL(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]=sO()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let oO=!1;try{oO=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const c4=oO;function f4(){}class d4 extends u4{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 Do=class Oc extends _t{constructor(e,n,r){super(),this.createRequest=e,Df(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=rO(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=Oc.requestsCount++,Oc.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=f4,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete Oc.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()}};Do.requestsCount=0;Do.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",wx);else if(typeof addEventListener=="function"){const t="onpagehide"in Un?"pagehide":"unload";addEventListener(t,wx,!1)}}function wx(){for(let t in Do.requests)Do.requests.hasOwnProperty(t)&&Do.requests[t].abort()}const h4=(function(){const t=aO({xdomain:!1});return t&&t.responseType!==null})();class p4 extends d4{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=h4&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Do(aO,this.uri(),e)}}function aO(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||c4))return new XMLHttpRequest}catch{}if(!e)try{return new Un[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const lO=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class m4 extends Iy{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=lO?{}:rO(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;qy(r,this.supportsBinary,u=>{try{this.doWrite(r,u)}catch{}a&&Mf(()=>{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]=sO()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Tp=Un.WebSocket||Un.MozWebSocket;class y4 extends m4{createSocket(e,n,r){return lO?new Tp(e,n,r):n?new Tp(e,n):new Tp(e)}doWrite(e,n){this.ws.send(n)}}class g4 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=QL(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),a=ZL();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&&Mf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const v4={websocket:y4,webtransport:g4,polling:p4},b4=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,S4=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function xm(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=b4.exec(t||""),u={},c=14;for(;c--;)u[S4[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=w4(u,u.path),u.queryKey=x4(u,u.query),u}function w4(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 x4(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,a,u){a&&(n[a]=u)}),n}const Tm=typeof addEventListener=="function"&&typeof removeEventListener=="function",_c=[];Tm&&addEventListener("offline",()=>{_c.forEach(t=>t())},!1);class jr extends _t{constructor(e,n){if(super(),this.binaryType=e4,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=xm(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=xm(n.host).host);Df(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=a4(this.opts.query)),Tm&&(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"})},_c.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=iO,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+=r4(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,Mf(()=>{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(),Tm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=_c.indexOf(this._offlineEventListener);r!==-1&&_c.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}jr.protocol=iO;class T4 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 A4=class extends T4{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=>v4[a]).filter(a=>!!a)),super(e,r)}};function E4(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=xm(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 O4=typeof ArrayBuffer=="function",_4=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,uO=Object.prototype.toString,R4=typeof Blob=="function"||typeof Blob<"u"&&uO.call(Blob)==="[object BlobConstructor]",C4=typeof File=="function"||typeof File<"u"&&uO.call(File)==="[object FileConstructor]";function Hy(t){return O4&&(t instanceof ArrayBuffer||_4(t))||R4&&t instanceof Blob||C4&&t instanceof File}function Rc(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(Rc(t[n]))return!0;return!1}if(Hy(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return Rc(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&Rc(t[n]))return!0;return!1}function k4(t){const e=[],n=t.data,r=t;return r.data=Am(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Am(t,e){if(!t)return t;if(Hy(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]=Am(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]=Am(t[r],e));return n}return t}function M4(t,e){return t.data=Em(t.data,e),delete t.attachments,t}function Em(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]=Em(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=Em(t[n],e));return t}const D4=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],N4=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 $4{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&Rc(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=k4(e),r=this.encodeAsString(n.packet),a=n.buffers;return a.unshift(r),a}}function xx(t){return Object.prototype.toString.call(t)==="[object Object]"}class Fy 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 j4(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Hy(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(Fy.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 xx(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||xx(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&D4.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 j4{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=M4(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const B4=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Fy,Encoder:$4,get PacketType(){return ke},protocol:N4},Symbol.toStringTag,{value:"Module"}));function Qn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const z4=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class cO 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(z4.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 Om 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,Df(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||B4;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 A4(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){Mf(()=>{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 cO(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 Cc(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=E4(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 Om(r,e):(Ya[a]||(Ya[a]=new Om(r,e)),h=Ya[a]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Cc,{Manager:Om,Socket:cO,io:Cc,connect:Cc});const L4=["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"],V4=3,U4=15,K4=/^[a-zA-Z0-9_-]+$/,q4=Ot(K4).pipe(Ot(`string > ${V4} & string < ${U4}`)).brand("username"),Tx=20,Ax={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function P4(t){let e="";for(const n of t)n in Ax?e+=Ax[n]:e+=n;return e}function I4(t){const e=t.toLocaleLowerCase(),n=P4(e);for(const r of L4)if(n.includes(r)||e.includes(r))return!0;return!1}function H4(t){const e=new Set(t).size;return t.length*Math.log2(e)}function F4(t){let e=0;return I4(t)&&(e-=100),e+=H4(t)*.5,Math.max(e,0)}const G4=Ot("string").narrow((t,e)=>{const n=F4(t);return n>=Tx?!0:e.mustBe(`Of complexity ${Tx} or more. Was ${n.toFixed(2)}.`)}).brand("password");Ot({"+":"delete",email:"string",password:"string"});const Y4=Ot("string").brand("email");Ot({"+":"delete",username:"string",password:"string",email:"string"});const J4=Ot({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),gi=Cc(ZE.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=Kr(e),r=J4(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(No,n.username),localStorage.setItem("auth",zt(n)),n.verification==="verified"?(console.log("connecting..."),gi.connect()):Es("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),No=ft({key:"username",default:nt(ut)?.username??""}),Ap=ft({key:"usernameDebounce",default:!0}),X4=ft({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{_k(No,()=>{nt(Ap)&&(t(nt(No)),De(Ap,!1),setTimeout(()=>{De(Ap,!0),t(nt(No))},2e3))})}]}),Z4=vi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(X4);if(!e)return!1;const n=nt(ut);return e===n?.username?!1:cn.isUsernameTaken.query({username:e})}}),fO=vi({key:"usernameIssues",get:({get:t})=>{const e=t(No),n=q4(e);return n instanceof Ot.errors?n:null}}),di=ft({key:"password0",default:""}),dO=vi({key:"password0Issues",get:({get:t})=>{const e=t(di),n=G4(e);return n instanceof Ot.errors?n:null}}),Po=ft({key:"email",default:""}),hO=vi({key:"emailIssues",get:({get:t})=>{const e=t(Po),n=Y4(e);return n instanceof Ot.errors?n:null}});vi({key:"signupReady",get:({get:t})=>{const e=t(fO),n=t(dO),r=t(hO);return!(e??n??r)}});const Fi=ft({key:"oneTimeCode",default:""}),_m=ft({key:"oneTimeCodeNewEmail",default:""}),ui=ft({key:"authTarget",default:null}),pO=Sp({verify:Sp({$token:null}),game:Sp({clicker:null}),account:null,admin:null});function Q4(t){return IL(pO,t)}const W4=[[]];function eV(t){return W4.some(e=>e.join("/")===t.join("/"))}function Es(t){history.pushState(null,"",t),De(mO,t)}const mO=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)})}]}),tV=vi({key:"route",get:({get:t})=>{const n=t(mO).split("/").slice(1).filter(Boolean);return Q4(n)?eV(n)||t(ut)?n:401:404}}),Ex=ft({key:"buttonBlockActive",default:!1}),zn=ft({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{nt(yO)?.focus();break}case"new-password":{nt(gO)?.focus();break}case"username":{nt(vO)?.focus();break}}})}]}),yO=ft({key:"emailInputElement",default:null}),gO=ft({key:"password0InputElement",default:null}),vO=ft({key:"usernameInputElement",default:null});function nV(t){const e=j.useRef(null);return j.useEffect(()=>{De(t,e.current)},[t]),e}const iV=vi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(ut);return e?`Code sent to ${e.email}`:""}}),rV=vi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Po);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(_m),x=Wn(_m),T=Et(di),M=Wn(di),k=Et(Ex),_=Wn(Ex),R=Et(zn),G=Wn(zn),I=Et(n),ee=Et(iV),J=Et(rV),X=nV(r),he=R[0]===t,pe=R.at(-1),[we,...je]=R;return F.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),k){_(!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:[I||h?F.jsxs("aside",{children:[h,I?.map(be=>F.jsx("span",{children:be.message},be.path.join(".")))]}):null,F.jsx("span",{children:t==="new-password"?"Password":ds(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 sV(){const t=Et(ut),e=Et(Z4);return j.useEffect(()=>{t&&De(Po,t.email),t?.password&&De(di,"••••••••••••")},[]),t?F.jsxs("article",{"data-css":"editor",children:[F.jsx(Ep,{label:"username",inputToken:No,issuesToken:fO,inputElementToken:vO,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:Po,issuesToken:hO,inputElementToken:yO,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(_m),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:dO,inputElementToken:gO,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 oV(){return F.jsx("article",{children:F.jsx("h1",{children:"admin"})})}const Gy=ft({key:"count",default:0}),bO=Rk({key:"incrementTX",do:({set:t})=>{t(Gy,e=>e+1)}}),aV=SM({key:"countContinuity",config:t=>t.add(Gy).add(bO)});function lV({route:[,t]}){return F.jsx("article",{children:t?F.jsx(cV,{gameId:t}):F.jsx(uV,{})})}function uV(){return F.jsx("nav",{children:F.jsx(BE,{href:"/game/clicker",children:"Clicker"})})}kk(pO[1].game[1]);function cV({gameId:t}){console.log(t);const e=Et(Gy),n=Ck(bO);return CM(aV),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 SO=j.createContext({});function fV(t){const e=j.useRef(null);return e.current===null&&(e.current=t()),e.current}const Yy=typeof window<"u",dV=Yy?j.useLayoutEffect:j.useEffect,Jy=j.createContext(null);function Xy(t,e){t.indexOf(e)===-1&&t.push(e)}function Zy(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 Qy=()=>{};const Wi={},wO=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function xO(t){return typeof t=="object"&&t!==null}const TO=t=>/^0[^.\s]+$/u.test(t);function Wy(t){let e;return()=>(e===void 0&&(e=t()),e)}const Pn=t=>t,hV=(t,e)=>n=>e(t(n)),zl=(...t)=>t.reduce(hV),bl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class eg{constructor(){this.subscriptions=[]}add(e){return Xy(this.subscriptions,e),()=>Zy(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 AO(t,e){return e?t*(1e3/e):0}const EO=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,pV=1e-7,mV=12;function yV(t,e,n,r,a){let u,c,f=0;do c=e+(n-e)/2,u=EO(c,r,a)-t,u>0?n=c:e=c;while(Math.abs(u)>pV&&++f<mV);return c}function Ll(t,e,n,r){if(t===e&&n===r)return Pn;const a=u=>yV(u,0,1,t,n);return u=>u===0||u===1?u:EO(a(u),e,r)}const OO=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,_O=t=>e=>1-t(1-e),RO=Ll(.33,1.53,.69,.99),tg=_O(RO),CO=OO(tg),kO=t=>(t*=2)<1?.5*tg(t):.5*(2-Math.pow(2,-10*(t-1))),ng=t=>1-Math.sin(Math.acos(t)),MO=_O(ng),DO=OO(ng),gV=Ll(.42,0,1,1),vV=Ll(0,0,.58,1),NO=Ll(.42,0,.58,1),bV=t=>Array.isArray(t)&&typeof t[0]!="number",$O=t=>Array.isArray(t)&&typeof t[0]=="number",SV={linear:Pn,easeIn:gV,easeInOut:NO,easeOut:vV,circIn:ng,circInOut:DO,circOut:MO,backIn:tg,backInOut:CO,backOut:RO,anticipate:kO},wV=t=>typeof t=="string",Ox=t=>{if($O(t)){Qy(t.length===4);const[e,n,r,a]=t;return Ll(e,n,r,a)}else if(wV(t))return SV[t];return t},yc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function xV(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 TV=40;function jO(t,e){let n=!1,r=!0;const a={delta:0,timestamp:0,isProcessing:!1},u=()=>n=!0,c=yc.reduce((R,G)=>(R[G]=xV(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,TV),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:yc.reduce((R,G)=>{const I=c[G];return R[G]=(ee,J=!1,X=!1)=>(n||M(),I.schedule(ee,J,X)),R},{}),cancel:R=>{for(let G=0;G<yc.length;G++)c[yc[G]].cancel(R)},state:a,steps:c}}const{schedule:it,cancel:Lr,state:Ht,steps:Op}=jO(typeof requestAnimationFrame<"u"?requestAnimationFrame:Pn,!0);let kc;function AV(){kc=void 0}const fn={now:()=>(kc===void 0&&fn.set(Ht.isProcessing||Wi.useManualTiming?Ht.timestamp:performance.now()),kc),set:t=>{kc=t,queueMicrotask(AV)}},BO=t=>e=>typeof e=="string"&&e.startsWith(t),ig=BO("--"),EV=BO("var(--"),rg=t=>EV(t)?OV.test(t.split("/*")[0].trim()):!1,OV=/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)},gc={...Zo,default:1},rl=t=>Math.round(t*1e5)/1e5,sg=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function _V(t){return t==null}const RV=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,og=(t,e)=>n=>!!(typeof n=="string"&&RV.test(n)&&n.startsWith(t)||e&&!_V(n)&&Object.prototype.hasOwnProperty.call(n,e)),zO=(t,e,n)=>r=>{if(typeof r!="string")return r;const[a,u,c,f]=r.match(sg);return{[t]:parseFloat(a),[e]:parseFloat(u),[n]:parseFloat(c),alpha:f!==void 0?parseFloat(f):1}},CV=t=>Qi(0,255,t),_p={...Zo,transform:t=>Math.round(CV(t))},ys={test:og("rgb","red"),parse:zO("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 kV(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 Rm={test:og("#"),parse:kV,transform:ys.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"),MV=Vl("vh"),DV=Vl("vw"),_x={...mi,parse:t=>mi.parse(t)/100,transform:t=>mi.transform(t*100)},xo={test:og("hsl","hue"),parse:zO("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=>ys.test(t)||Rm.test(t)||xo.test(t),parse:t=>ys.test(t)?ys.parse(t):xo.test(t)?xo.parse(t):Rm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ys.transform(t):xo.transform(t),getAnimatableNone:t=>{const e=At.parse(t);return e.alpha=0,At.transform(e)}},NV=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function $V(t){return isNaN(t)&&typeof t=="string"&&(t.match(sg)?.length||0)+(t.match(NV)?.length||0)>0}const LO="number",VO="color",jV="var",BV="var(",Rx="${}",zV=/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(zV,h=>(At.test(h)?(r.color.push(u),a.push(VO),n.push(At.parse(h))):h.startsWith(BV)?(r.var.push(u),a.push(jV),n.push(h)):(r.number.push(u),a.push(LO),n.push(parseFloat(h))),++u,Rx)).split(Rx);return{values:n,split:f,indexes:r,types:a}}function UO(t){return wl(t).values}function KO(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===LO?u+=rl(a[c]):f===VO?u+=At.transform(a[c]):u+=a[c]}return u}}const LV=t=>typeof t=="number"?0:At.test(t)?At.getAnimatableNone(t):t;function VV(t){const e=UO(t);return KO(t)(e.map(LV))}const Vr={test:$V,parse:UO,createTransformer:KO,getAnimatableNone:VV};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 UV({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 ef(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)},KV=[Rm,ys,xo],qV=t=>KV.find(e=>e.test(t));function Cx(t){const e=qV(t);if(!e)return!1;let n=e.parse(t);return e===xo&&(n=UV(n)),n}const kx=(t,e)=>{const n=Cx(t),r=Cx(e);if(!n||!r)return ef(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),ys.transform(a))},Cm=new Set(["none","hidden"]);function PV(t,e){return Cm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function IV(t,e){return n=>rt(t,e,n)}function ag(t){return typeof t=="number"?IV:typeof t=="string"?rg(t)?ef:At.test(t)?kx:GV:Array.isArray(t)?qO:typeof t=="object"?At.test(t)?kx:HV:ef}function qO(t,e){const n=[...t],r=n.length,a=t.map((u,c)=>ag(u)(u,e[c]));return u=>{for(let c=0;c<r;c++)n[c]=a[c](u);return n}}function HV(t,e){const n={...t,...e},r={};for(const a in n)t[a]!==void 0&&e[a]!==void 0&&(r[a]=ag(t[a])(t[a],e[a]));return a=>{for(const u in r)n[u]=r[u](a);return n}}function FV(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 GV=(t,e)=>{const n=Vr.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?Cm.has(t)&&!a.values.length||Cm.has(e)&&!r.values.length?PV(t,e):zl(qO(FV(r,a),a.values),n):ef(t,e)};function PO(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?rt(t,e,n):ag(t)(t,e)}const YV=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>it.update(e,n),stop:()=>Lr(e),now:()=>Ht.isProcessing?Ht.timestamp:fn.now()}},IO=(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)})`},tf=2e4;function lg(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<tf;)e+=n,r=t.next(e);return e>=tf?1/0:e}function JV(t,e=100,n){const r=n({...t,keyframes:[0,e]}),a=Math.min(lg(r),tf);return{type:"keyframes",ease:u=>r.next(a*u).value/e,duration:qn(a)}}const XV=5;function HO(t,e,n){const r=Math.max(e-XV,0);return AO(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 ZV({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=km(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=km(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=WV(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 QV=12;function WV(t,e,n){let r=n;for(let a=1;a<QV;a++)r=r-t(r)/e(r);return r}function km(t,e){return t*Math.sqrt(1-e*e)}const eU=["duration","bounce"],tU=["stiffness","damping","mass"];function Mx(t,e){return e.some(n=>t[n]!==void 0)}function nU(t){let e={velocity:lt.velocity,stiffness:lt.stiffness,damping:lt.damping,mass:lt.mass,isResolvedFromDuration:!1,...t};if(!Mx(t,tU)&&Mx(t,eU))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=ZV(t);e={...e,...n,mass:lt.mass},e.isResolvedFromDuration=!0}return e}function nf(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}=nU({...n,velocity:-qn(n.velocity||0)}),x=b||0,T=m/(2*Math.sqrt(h*y)),M=c-u,k=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 I=km(k,T);R=ee=>{const J=Math.exp(-T*k*ee);return c-J*((x+T*k*M)/I*Math.sin(I*ee)+M*Math.cos(I*ee))}}else if(T===1)R=I=>c-Math.exp(-k*I)*(M+(x+k*M)*I);else{const I=k*Math.sqrt(T*T-1);R=ee=>{const J=Math.exp(-T*k*ee),X=Math.min(I*ee,300);return c-J*((x+T*k*M)*Math.sinh(X)+I*M*Math.cosh(X))/I}}const G={calculatedDuration:S&&g||null,next:I=>{const ee=R(I);if(S)f.done=I>=g;else{let J=I===0?x:0;T<1&&(J=I===0?pi(x):HO(R,I,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 I=Math.min(lg(G),tf),ee=IO(J=>G.next(I*J).value,I,30);return I+"ms "+ee},toTransition:()=>{}};return G}nf.applyToOptions=t=>{const e=JV(t,100,nf);return t.ease=e.ease,t.duration=pi(e.duration),t.type="keyframes",t};function Mm({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,k=c===void 0?M:c(M);k!==M&&(T=k-g);const _=X=>-T*Math.exp(-X/r),R=X=>k+_(X),G=X=>{const he=_(X),pe=R(X);b.done=Math.abs(he)<=m,b.value=b.done?k:pe};let I,ee;const J=X=>{S(b.value)&&(I=X,ee=nf({keyframes:[b.value,x(b.value)],velocity:HO(R,X,b.value),damping:a,stiffness:u,restDelta:m,restSpeed:y}))};return J(0),{calculatedDuration:null,next:X=>{let he=!1;return!ee&&I===void 0&&(he=!0,G(X),J(X)),I!==void 0&&X>=I?ee.next(X-I):(!he&&G(X),b)}}}function iU(t,e,n){const r=[],a=n||Wi.mix||PO,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]||Pn:e;f=zl(h,f)}r.push(f)}return r}function rU(t,e,{clamp:n=!0,ease:r,mixer:a}={}){const u=t.length;if(Qy(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=iU(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 sU(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 oU(t){const e=[0];return sU(e,t.length-1),e}function aU(t,e){return t.map(n=>n*e)}function lU(t,e){return t.map(()=>e||NO).splice(0,t.length-1)}function sl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const a=bV(r)?r.map(Ox):Ox(r),u={done:!1,value:e[0]},c=aU(n&&n.length===e.length?n:oU(e),t),f=rU(c,e,{ease:Array.isArray(a)?a:lU(e,a)});return{calculatedDuration:t,next:h=>(u.value=f(h),u.done=h>=t,u)}}const uU=t=>t!==null;function ug(t,{repeat:e,repeatType:n="loop"},r,a=1){const u=t.filter(uU),f=a<0||e&&n!=="loop"&&e%2===1?0:u.length-1;return!f||r===void 0?u[f]:r}const cU={decay:Mm,inertia:Mm,tween:sl,keyframes:sl,spring:nf};function FO(t){typeof t.type=="string"&&(t.type=cU[t.type])}class cg{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 fU=t=>t/100;class fg extends cg{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;FO(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(fU,PO(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=lg(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 k=this.currentTime-m*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?k<0:k>a;this.currentTime=Math.max(k,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 I=_?{done:!1,value:y[0]}:G.next(R);u&&(I.value=u(I.value));let{done:ee}=I;!_&&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!==Mm&&(I.value=ug(y,this.options,M,this.speed)),T&&T(I.value),J&&this.finish(),I}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=YV,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 dU(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const gs=t=>t*180/Math.PI,Dm=t=>{const e=gs(Math.atan2(t[1],t[0]));return Nm(e)},hU={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Dm,rotateZ:Dm,skewX:t=>gs(Math.atan(t[1])),skewY:t=>gs(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Nm=t=>(t=t%360,t<0&&(t+=360),t),Dx=Dm,Nx=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),$x=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),pU={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:Nx,scaleY:$x,scale:t=>(Nx(t)+$x(t))/2,rotateX:t=>Nm(gs(Math.atan2(t[6],t[5]))),rotateY:t=>Nm(gs(Math.atan2(-t[2],t[0]))),rotateZ:Dx,rotate:Dx,skewX:t=>gs(Math.atan(t[4])),skewY:t=>gs(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function $m(t){return t.includes("scale")?1:0}function jm(t,e){if(!t||t==="none")return $m(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,a;if(n)r=pU,a=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=hU,a=f}if(!a)return $m(e);const u=r[e],c=a[1].split(",").map(yU);return typeof u=="function"?u(c):c[u]}const mU=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return jm(n,e)};function yU(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),jx=t=>t===Zo||t===de,gU=new Set(["x","y","z"]),vU=Qo.filter(t=>!gU.has(t));function bU(t){const e=[];return vU.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const Ss={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})=>jm(e,"x"),y:(t,{transform:e})=>jm(e,"y")};Ss.translateX=Ss.x;Ss.translateY=Ss.y;const ws=new Set;let Bm=!1,zm=!1,Lm=!1;function GO(){if(zm){const t=Array.from(ws).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const a=bU(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)})}zm=!1,Bm=!1,ws.forEach(t=>t.complete(Lm)),ws.clear()}function YO(){ws.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(zm=!0)})}function SU(){Lm=!0,YO(),GO(),Lm=!1}class dg{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?(ws.add(this),Bm||(Bm=!0,it.read(YO),it.resolveKeyframes(GO))):(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])}dU(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ws.delete(this)}cancel(){this.state==="scheduled"&&(ws.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const wU=t=>t.startsWith("--");function xU(t,e,n){wU(e)?t.style.setProperty(e,n):t.style[e]=n}const TU=Wy(()=>window.ScrollTimeline!==void 0),AU={};function EU(t,e){const n=Wy(t);return()=>AU[e]??n()}const JO=EU(()=>{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})`,Bx={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 XO(t,e){if(t)return typeof t=="function"?JO()?IO(t,e):"ease-out":$O(t)?el(t):Array.isArray(t)?t.map(n=>XO(n,e)||Bx.easeOut):Bx[t]}function OU(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=XO(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 ZO(t){return typeof t=="function"&&"applyToOptions"in t}function _U({type:t,...e}){return ZO(t)&&JO()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class RU extends cg{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,Qy(typeof e.type!="string");const m=_U(e);this.animation=OU(n,r,a,m,u),m.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!u){const y=ug(a,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):xU(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&&TU()?(this.animation.timeline=e,Pn):n(this)}}const QO={anticipate:kO,backInOut:CO,circInOut:DO};function CU(t){return t in QO}function kU(t){typeof t.ease=="string"&&CU(t.ease)&&(t.ease=QO[t.ease])}const zx=10;class MU extends RU{constructor(e){kU(e),FO(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 fg({...c,autoplay:!1}),h=pi(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-zx).value,f.sample(h).value,zx),f.stop()}}const Lx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Vr.test(t)||t==="0")&&!t.startsWith("url("));function DU(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 NU(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=Lx(a,e),f=Lx(u,e);return!c||!f?!1:DU(t)||(n==="spring"||ZO(n))&&r}function Vm(t){t.duration=0,t.type="keyframes"}const $U=new Set(["opacity","clipPath","filter","transform"]),jU=Wy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function BU(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 jU()&&n&&$U.has(n)&&(n!=="transform"||!m)&&!h&&!r&&a!=="mirror"&&u!==0&&c!=="inertia"}const zU=40;class LU extends cg{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||dg;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(),NU(e,u,c,f)||((Wi.instantAnimations||!h)&&y?.(ug(e,r,n)),e[0]=e[e.length-1],Vm(r),r.repeat=0);const b={startTime:a?this.resolvedAt?this.resolvedAt-this.createdAt>zU?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!m&&BU(b)?new MU({...b,element:b.motionValue.owner.current}):new fg(b);S.finished.then(()=>this.notifyFinished()).catch(Pn),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(),SU()),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 VU=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function UU(t){const e=VU.exec(t);if(!e)return[,];const[,n,r,a]=e;return[`--${n??r}`,a]}function WO(t,e,n=1){const[r,a]=UU(t);if(!r)return;const u=window.getComputedStyle(e).getPropertyValue(r);if(u){const c=u.trim();return wO(c)?parseFloat(c):c}return rg(a)?WO(a,e,n+1):a}function hg(t,e){return t?.[e]??t?.default??t}const e_=new Set(["width","height","top","left","right","bottom",...Qo]),KU={test:t=>t==="auto",parse:t=>t},t_=t=>e=>e.test(t),n_=[Zo,de,mi,_r,DV,MV,KU],Vx=t=>n_.find(t_(t));function qU(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||TO(t):!0}const PU=new Set(["brightness","contrast","saturate","opacity"]);function IU(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(sg)||[];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 HU=/\b([a-z-]*)\(.*?\)/gu,Um={...Vr,getAnimatableNone:t=>{const e=t.match(HU);return e?e.map(IU).join(" "):t}},Ux={...Zo,transform:Math.round},FU={rotate:_r,rotateX:_r,rotateY:_r,rotateZ:_r,scale:gc,scaleX:gc,scaleY:gc,scaleZ:gc,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:_x,originY:_x,originZ:de},pg={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,...FU,zIndex:Ux,fillOpacity:Sl,strokeOpacity:Sl,numOctaves:Ux},GU={...pg,color:At,backgroundColor:At,outlineColor:At,fill:At,stroke:At,borderColor:At,borderTopColor:At,borderRightColor:At,borderBottomColor:At,borderLeftColor:At,filter:Um,WebkitFilter:Um},i_=t=>GU[t];function r_(t,e){let n=i_(t);return n!==Um&&(n=Vr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const YU=new Set(["auto","none","0"]);function JU(t,e,n){let r=0,a;for(;r<t.length&&!a;){const u=t[r];typeof u=="string"&&!YU.has(u)&&wl(u).values.length&&(a=t[r]),r++}if(a&&n)for(const u of e)t[u]=r_(n,a)}class XU extends dg{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(),rg(m))){const y=WO(m,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!e_.has(r)||e.length!==2)return;const[a,u]=e,c=Vx(a),f=Vx(u);if(c!==f)if(jx(c)&&jx(f))for(let h=0;h<e.length;h++){const m=e[h];typeof m=="string"&&(e[h]=parseFloat(m))}else Ss[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let a=0;a<e.length;a++)(e[a]===null||qU(e[a]))&&r.push(a);r.length&&JU(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=Ss[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]=Ss[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 ZU(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 s_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function QU(t){return xO(t)&&"offsetHeight"in t}const Kx=30,WU=t=>!isNaN(parseFloat(t));class eK{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=WU(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 eg);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>Kx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Kx);return AO(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 Io(t,e){return new eK(t,e)}const{schedule:mg}=jO(queueMicrotask,!1),Zn={x:!1,y:!1};function o_(){return Zn.x||Zn.y}function tK(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 a_(t,e){const n=ZU(t),r=new AbortController,a={passive:!0,...e,signal:r.signal};return[n,a,()=>r.abort()]}function qx(t){return!(t.pointerType==="touch"||o_())}function nK(t,e,n={}){const[r,a,u]=a_(t,n),c=f=>{if(!qx(f))return;const{target:h}=f,m=e(h,f);if(typeof m!="function"||!h)return;const y=g=>{qx(g)&&(m(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,a)};return r.forEach(f=>{f.addEventListener("pointerenter",c,a)}),u}const l_=(t,e)=>e?t===e?!0:l_(t,e.parentElement):!1,yg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,iK=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function rK(t){return iK.has(t.tagName)||t.tabIndex!==-1}const Mc=new WeakSet;function Px(t){return e=>{e.key==="Enter"&&t(e)}}function Mp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const sK=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Px(()=>{if(Mc.has(n))return;Mp(n,"down");const a=Px(()=>{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 Ix(t){return yg(t)&&!o_()}function oK(t,e,n={}){const[r,a,u]=a_(t,n),c=f=>{const h=f.currentTarget;if(!Ix(f))return;Mc.add(h);const m=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",b),Mc.has(h)&&Mc.delete(h),Ix(S)&&typeof m=="function"&&m(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||l_(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),QU(f)&&(f.addEventListener("focus",m=>sK(m,a)),!rK(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),u}function u_(t){return xO(t)&&"ownerSVGElement"in t}function aK(t){return u_(t)&&t.tagName==="svg"}const Jt=t=>!!(t&&t.getVelocity),lK=[...n_,At,Vr],uK=t=>lK.find(t_(t)),c_=j.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function cK(t=!0){const e=j.useContext(Jy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:a}=e,u=j.useId();j.useEffect(()=>{if(t)return a(u)},[t]);const c=j.useCallback(()=>t&&r&&r(u),[u,r,t]);return!n&&r?[!1,c]:[!0]}const f_=j.createContext({strict:!1}),Hx={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 Hx)Ho[t]={isEnabled:e=>Hx[t].some(n=>!!e[n])};function fK(t){for(const e in t)Ho[e]={...Ho[e],...t[e]}}const dK=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 rf(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||dK.has(t)}let d_=t=>!rf(t);function hK(t){typeof t=="function"&&(d_=e=>e.startsWith("on")?!rf(e):t(e))}try{hK(require("@emotion/is-prop-valid").default)}catch{}function pK(t,e,n){const r={};for(const a in t)a==="values"&&typeof t.values=="object"||(d_(a)||n===!0&&rf(a)||!e&&!rf(a)||t.draggable&&a.startsWith("onDrag"))&&(r[a]=t[a]);return r}const Nf=j.createContext({});function $f(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function xl(t){return typeof t=="string"||Array.isArray(t)}const gg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],vg=["initial",...gg];function jf(t){return $f(t.animate)||vg.some(e=>xl(t[e]))}function h_(t){return!!(jf(t)||t.variants)}function mK(t,e){if(jf(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 yK(t){const{initial:e,animate:n}=mK(t,j.useContext(Nf));return j.useMemo(()=>({initial:e,animate:n}),[Fx(e),Fx(n)])}function Fx(t){return Array.isArray(t)?t.join(" "):t}const Tl={};function gK(t){for(const e in t)Tl[e]=t[e],ig(e)&&(Tl[e].isCSSVariable=!0)}function p_(t,{layout:e,layoutId:n}){return Wo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Tl[t]||t==="opacity")}const vK={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bK=Qo.length;function SK(t,e,n){let r="",a=!0;for(let u=0;u<bK;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=s_(f,pg[c]);if(!h){a=!1;const y=vK[c]||c;r+=`${y}(${m}) `}n&&(e[c]=m)}}return r=r.trim(),n?r=n(e,a?"":r):a&&(r="none"),r}function bg(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(ig(h)){a[h]=m;continue}else{const y=s_(m,pg[h]);h.startsWith("origin")?(f=!0,u[h]=y):r[h]=y}}if(e.transform||(c||n?r.transform=SK(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 Sg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function m_(t,e,n){for(const r in e)!Jt(e[r])&&!p_(r,n)&&(t[r]=e[r])}function wK({transformTemplate:t},e){return j.useMemo(()=>{const n=Sg();return bg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function xK(t,e){const n=t.style||{},r={};return m_(r,n,t),Object.assign(r,wK(t,e)),r}function TK(t,e){const n={},r=xK(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 AK={offset:"stroke-dashoffset",array:"stroke-dasharray"},EK={offset:"strokeDashoffset",array:"strokeDasharray"};function OK(t,e,n=1,r=0,a=!0){t.pathLength=1;const u=a?AK:EK;t[u.offset]=de.transform(-r);const c=de.transform(e),f=de.transform(n);t[u.array]=`${c} ${f}`}function y_(t,{attrX:e,attrY:n,attrScale:r,pathLength:a,pathSpacing:u=1,pathOffset:c=0,...f},h,m,y){if(bg(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&&OK(g,a,u,c,!1)}const g_=()=>({...Sg(),attrs:{}}),v_=t=>typeof t=="string"&&t.toLowerCase()==="svg";function _K(t,e,n,r){const a=j.useMemo(()=>{const u=g_();return y_(u,e,v_(r),t.transformTemplate,t.style),{...u.attrs,style:{...u.style}}},[e]);if(t.style){const u={};m_(u,t.style,t),a.style={...u,...a.style}}return a}const RK=["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 wg(t){return typeof t!="string"||t.includes("-")?!1:!!(RK.indexOf(t)>-1||/[A-Z]/u.test(t))}function CK(t,e,n,{latestValues:r},a,u=!1){const f=(wg(t)?_K:TK)(e,r,a,t),h=pK(e,typeof t=="string",u),m=t!==j.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=j.useMemo(()=>Jt(y)?y.get():y,[y]);return j.createElement(t,{...m,children:g})}function Gx(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function xg(t,e,n,r){if(typeof e=="function"){const[a,u]=Gx(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]=Gx(r);e=e(n!==void 0?n:t.custom,a,u)}return e}function Dc(t){return Jt(t)?t.get():t}function kK({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,a){return{latestValues:MK(n,r,a,t),renderState:e()}}function MK(t,e,n,r){const a={},u=r(t,{});for(const b in u)a[b]=Dc(u[b]);let{initial:c,animate:f}=t;const h=jf(t),m=h_(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"&&!$f(g)){const b=Array.isArray(g)?g:[g];for(let S=0;S<b.length;S++){const x=xg(t,b[S]);if(x){const{transitionEnd:T,transition:M,...k}=x;for(const _ in k){let R=k[_];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 b_=t=>(e,n)=>{const r=j.useContext(Nf),a=j.useContext(Jy),u=()=>kK(t,e,r,a);return n?u():fV(u)};function Tg(t,e,n){const{style:r}=t,a={};for(const u in r)(Jt(r[u])||e.style&&Jt(e.style[u])||p_(u,t)||n?.getValue(u)?.liveStyle!==void 0)&&(a[u]=r[u]);return a}const DK=b_({scrapeMotionValuesFromProps:Tg,createRenderState:Sg});function S_(t,e,n){const r=Tg(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 NK=b_({scrapeMotionValuesFromProps:S_,createRenderState:g_}),$K=Symbol.for("motionComponentSymbol");function To(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function jK(t,e,n){return j.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):To(n)&&(n.current=r))},[e])}const Ag=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),BK="framerAppearId",w_="data-"+Ag(BK),x_=j.createContext({});function zK(t,e,n,r,a){const{visualElement:u}=j.useContext(Nf),c=j.useContext(f_),f=j.useContext(Jy),h=j.useContext(c_).reducedMotion,m=j.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=j.useContext(x_);y&&!y.projection&&a&&(y.type==="html"||y.type==="svg")&&LK(m.current,n,a,g);const b=j.useRef(!1);j.useInsertionEffect(()=>{y&&b.current&&y.update(n,f)});const S=n[w_],x=j.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return dV(()=>{y&&(b.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),j.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function LK(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:T_(t.parent)),t.projection.setOptions({layoutId:a,layout:u,alwaysMeasureLayout:!!c||f&&To(f),visualElement:t,animationType:typeof u=="string"?u:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:m})}function T_(t){if(t)return t.options.allowProjection!==!1?t.projection:T_(t.parent)}function Dp(t,{forwardMotionProps:e=!1}={},n,r){n&&fK(n);const a=wg(t)?NK:DK;function u(f,h){let m;const y={...j.useContext(c_),...f,layoutId:VK(f)},{isStatic:g}=y,b=yK(f),S=a(f,g);if(!g&&Yy){UK();const x=KK(y);m=x.MeasureLayout,b.visualElement=zK(t,S,y,r,x.ProjectionNode)}return F.jsxs(Nf.Provider,{value:b,children:[m&&b.visualElement?F.jsx(m,{visualElement:b.visualElement,...y}):null,CK(t,f,jK(S,b.visualElement,h),S,g,e)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=j.forwardRef(u);return c[$K]=t,c}function VK({layoutId:t}){const e=j.useContext(SO).id;return e&&t!==void 0?e+"-"+t:t}function UK(t,e){j.useContext(f_).strict}function KK(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 qK(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 A_({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 IK(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 Km({scale:t,scaleX:e,scaleY:n}){return!Np(t)||!Np(e)||!Np(n)}function ps(t){return Km(t)||E_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function E_(t){return Yx(t.x)||Yx(t.y)}function Yx(t){return t&&t!=="0%"}function sf(t,e,n){const r=t-n,a=e*r;return n+a}function Jx(t,e,n,r,a){return a!==void 0&&(t=sf(t,a,r)),sf(t,n,r)+e}function qm(t,e=0,n=1,r,a){t.min=Jx(t.min,e,n,r,a),t.max=Jx(t.max,e,n,r,a)}function O_(t,{x:e,y:n}){qm(t.x,e.translate,e.scale,e.originPoint),qm(t.y,n.translate,n.scale,n.originPoint)}const Xx=.999999999999,Zx=1.0000000000001;function HK(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&&Eo(t,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,O_(t,c)),r&&ps(u.latestValues)&&Eo(t,u.latestValues))}e.x<Zx&&e.x>Xx&&(e.x=1),e.y<Zx&&e.y>Xx&&(e.y=1)}function Ao(t,e){t.min=t.min+e,t.max=t.max+e}function Qx(t,e,n,r,a=.5){const u=rt(t.min,t.max,a);qm(t,e,n,u,r)}function Eo(t,e){Qx(t.x,e.x,e.scaleX,e.scale,e.originX),Qx(t.y,e.y,e.scaleY,e.scale,e.originY)}function __(t,e){return A_(IK(t.getBoundingClientRect(),e))}function FK(t,e,n){const r=__(t,n),{scroll:a}=e;return a&&(Ao(r.x,a.offset.x),Ao(r.y,a.offset.y)),r}const Wx=()=>({translate:0,scale:1,origin:0,originPoint:0}),Oo=()=>({x:Wx(),y:Wx()}),e1=()=>({min:0,max:0}),yt=()=>({x:e1(),y:e1()}),Pm={current:null},R_={current:!1};function GK(){if(R_.current=!0,!!Yy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Pm.current=t.matches;t.addEventListener("change",e),e()}else Pm.current=!1}const YK=new WeakMap;function JK(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,Io(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,Io(c!==void 0?c:a,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const t1=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class XK{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=dg,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=jf(n),this.isVariantNode=h_(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,YK.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)),R_.current||GK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Pm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Lr(this.notifyUpdate),Lr(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<t1.length;r++){const a=t1[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=JK(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=Io(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"&&(wO(r)||TO(r))?r=parseFloat(r):!uK(r)&&Vr.test(n)&&(r=r_(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=xg(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 eg),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){mg.render(this.render)}}class C_ extends XK{constructor(){super(...arguments),this.KeyframeResolver=XU}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 k_(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 ZK(t){return window.getComputedStyle(t)}class QK extends C_{constructor(){super(...arguments),this.type="html",this.renderInstance=k_}readValueFromInstance(e,n){if(Wo.has(n))return this.projection?.isProjecting?$m(n):mU(e,n);{const r=ZK(e),a=(ig(n)?r.getPropertyValue(n):r[n])||0;return typeof a=="string"?a.trim():a}}measureInstanceViewportBox(e,{transformPagePoint:n}){return __(e,n)}build(e,n,r){bg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return Tg(e,n,r)}}const M_=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 WK(t,e,n,r){k_(t,e,void 0,r);for(const a in e.attrs)t.setAttribute(M_.has(a)?a:Ag(a),e.attrs[a])}class eq extends C_{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=i_(n);return r&&r.default||0}return n=M_.has(n)?n:Ag(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return S_(e,n,r)}build(e,n,r){y_(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,a){WK(e,n,r,a)}mount(e){this.isSVGTag=v_(e.tagName),super.mount(e)}}const tq=(t,e)=>wg(t)?new eq(e):new QK(e,{allowProjection:t!==j.Fragment});function $o(t,e,n){const r=t.getProps();return xg(r,e,n!==void 0?n:r.custom,t)}const Im=t=>Array.isArray(t);function nq(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Io(n))}function iq(t){return Im(t)?t[t.length-1]||0:t}function rq(t,e){const n=$o(t,e);let{transitionEnd:r={},transition:a={},...u}=n||{};u={...u,...r};for(const c in u){const f=iq(u[c]);nq(t,c,f)}}function sq(t){return!!(Jt(t)&&t.add)}function Hm(t,e){const n=t.getValue("willChange");if(sq(n))return n.add(e);if(!n&&Wi.WillChange){const r=new Wi.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function D_(t){return t.props[w_]}const oq=t=>t!==null;function aq(t,{repeat:e,repeatType:n="loop"},r){const a=t.filter(oq),u=e&&n!=="loop"&&e%2===1?0:a.length-1;return a[u]}const lq={type:"spring",stiffness:500,damping:25,restSpeed:10},uq=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),cq={type:"keyframes",duration:.8},fq={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dq=(t,{keyframes:e})=>e.length>2?cq:Wo.has(t)?t.startsWith("scale")?uq(e[1]):lq:fq;function hq({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 Eg=(t,e,n,r={},a,u)=>c=>{const f=hg(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};hq(f)||Object.assign(y,dq(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)&&(Vm(y),y.delay===0&&(g=!0)),(Wi.instantAnimations||Wi.skipAnimations)&&(g=!0,Vm(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!u&&e.get()!==void 0){const b=aq(y.keyframes,f);if(b!==void 0){it.update(()=>{y.onUpdate(b),y.onComplete()});return}}return f.isSync?new fg(y):new LU(y)};function pq({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function N_(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&&pq(m,y))continue;const S={delay:n,...hg(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 k=D_(t);if(k){const _=window.MotionHandoffAnimation(k,y,it);_!==null&&(S.startTime=_,T=!0)}}Hm(t,y),g.start(Eg(y,g,b,t.shouldReduceMotion&&e_.has(y)?{type:!1}:S,t,T));const M=g.animation;M&&h.push(M)}return c&&Promise.all(h).then(()=>{it.update(()=>{c&&rq(t,c)})}),h}function $_(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 Fm(t,e,n={}){const r=$o(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(N_(t,r,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:m=0,staggerChildren:y,staggerDirection:g}=a;return mq(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 mq(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(Fm(h,e,{...c,delay:n+(typeof r=="function"?0:r)+$_(t.variantChildren,h,r,a,u)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function yq(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const a=e.map(u=>Fm(t,u,n));r=Promise.all(a)}else if(typeof e=="string")r=Fm(t,e,n);else{const a=typeof e=="function"?$o(t,e,n.custom):e;r=Promise.all(N_(t,a,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function j_(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 gq=vg.length;function B_(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?B_(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<gq;n++){const r=vg[n],a=t.props[r];(xl(a)||a===!1)&&(e[r]=a)}return e}const vq=[...gg].reverse(),bq=gg.length;function Sq(t){return e=>Promise.all(e.map(({animation:n,options:r})=>yq(t,n,r)))}function wq(t){let e=Sq(t),n=n1(),r=!0;const a=h=>(m,y)=>{const g=$o(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=B_(t.parent)||{},g=[],b=new Set;let S={},x=1/0;for(let M=0;M<bq;M++){const k=vq[M],_=n[k],R=m[k]!==void 0?m[k]:y[k],G=xl(R),I=k===h?_.isActive:null;I===!1&&(x=M);let ee=R===y[k]&&R!==m[k]&&G;if(ee&&r&&t.manuallyAnimateOnMount&&(ee=!1),_.protectedKeys={...S},!_.isActive&&I===null||!R&&!_.prevProp||$f(R)||typeof R=="boolean")continue;const J=xq(_.prevProp,R);let X=J||k===h&&_.isActive&&!ee&&G||M>x&&G,he=!1;const pe=Array.isArray(R)?R:[R];let we=pe.reduce(a(k),{});I===!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=!j_(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:k};if(typeof U=="string"&&r&&!ne&&t.manuallyAnimateOnMount&&t.parent){const{parent:te}=t,oe=$o(te,U);if(te.enteringChildren&&oe){const{delayChildren:E}=oe.transition||{};L.delay=$_(te.enteringChildren,t,E)}}return{animation:U,options:L}}))}if(b.size){const M={};if(typeof m.initial!="boolean"){const k=$o(t,Array.isArray(m.initial)?m.initial[0]:m.initial);k&&k.transition&&(M.transition=k.transition)}b.forEach(k=>{const _=t.getBaseTarget(k),R=t.getValue(k);R&&(R.liveStyle=!0),M[k]=_??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=n1()}}}function xq(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!j_(e,t):!1}function fs(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function n1(){return{animate:fs(!0),whileInView:fs(),whileHover:fs(),whileTap:fs(),whileDrag:fs(),whileFocus:fs(),exit:fs()}}class Fr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class Tq extends Fr{constructor(e){super(e),e.animationState||(e.animationState=wq(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();$f(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 Aq=0;class Eq extends Fr{constructor(){super(...arguments),this.id=Aq++}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 Oq={animation:{Feature:Tq},exit:{Feature:Eq}};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 _q=t=>e=>yg(e)&&t(e,Ul(e));function ol(t,e,n,r){return Al(t,e,_q(n),r)}const z_=1e-4,Rq=1-z_,Cq=1+z_,L_=.01,kq=0-L_,Mq=0+L_;function Wt(t){return t.max-t.min}function Dq(t,e,n){return Math.abs(t-e)<=n}function i1(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>=Rq&&t.scale<=Cq||isNaN(t.scale))&&(t.scale=1),(t.translate>=kq&&t.translate<=Mq||isNaN(t.translate))&&(t.translate=0)}function al(t,e,n,r){i1(t.x,e.x,n.x,r?r.originX:void 0),i1(t.y,e.y,n.y,r?r.originY:void 0)}function r1(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function Nq(t,e,n){r1(t.x,e.x,n.x),r1(t.y,e.y,n.y)}function s1(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function ll(t,e,n){s1(t.x,e.x,n.x),s1(t.y,e.y,n.y)}function Ln(t){return[t("x"),t("y")]}const V_=({current:t})=>t?t.ownerDocument.defaultView:null,o1=(t,e)=>Math.abs(t-e);function $q(t,e){const n=o1(t.x,e.x),r=o1(t.y,e.y);return Math.sqrt(n**2+r**2)}class U_{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=$q(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:k,onMove:_}=this.handlers;S||(k&&k(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 k=jp(b.type==="pointercancel"?this.lastMoveEventInfo:$p(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(b,k),T&&T(b,k)},!yg(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(),Lr(this.updatePoint)}}function $p(t,e){return e?{point:e(t.point)}:t}function a1(t,e){return{x:t.x-e.x,y:t.y-e.y}}function jp({point:t},e){return{point:t,delta:a1(t,K_(e)),offset:a1(t,jq(e)),velocity:Bq(e,.1)}}function jq(t){return t[0]}function K_(t){return t[t.length-1]}function Bq(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const a=K_(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 zq(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 l1(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 Lq(t,{top:e,left:n,bottom:r,right:a}){return{x:l1(t.x,n,a),y:l1(t.y,e,r)}}function u1(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 Vq(t,e){return{x:u1(t.x,e.x),y:u1(t.y,e.y)}}function Uq(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 Kq(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 Gm=.35;function qq(t=Gm){return t===!1?t=0:t===!0&&(t=Gm),{x:c1(t,"left","right"),y:c1(t,"top","bottom")}}function c1(t,e,n){return{min:f1(t,e),max:f1(t,n)}}function f1(t,e){return typeof t=="number"?t:t[e]||0}const Pq=new WeakMap;class Iq{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=tK(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(k=>{let _=this.getAxisMotionValue(k).get()||0;if(mi.test(_)){const{projection:R}=this.visualElement;if(R&&R.layout){const G=R.layout.layoutBox[k];G&&(_=Wt(G)*(parseFloat(_)/100))}}this.originPoint[k]=_}),T&&it.postRender(()=>T(g,b)),Hm(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:k}=b;if(x&&this.currentDirection===null){this.currentDirection=Hq(k),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",b.point,k),this.updateAxis("y",b.point,k),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 U_(e,{onSessionStart:u,onStart:c,onMove:f,onSessionEnd:h,resumeAnimation:m},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:V_(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||!vc(e,a,this.currentDirection))return;const u=this.getAxisMotionValue(e);let c=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(c=zq(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&&To(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Lq(r.layoutBox,e):this.constraints=!1,this.elastic=qq(n),a!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Ln(u=>{this.constraints!==!1&&this.getAxisMotionValue(u)&&(this.constraints[u]=Kq(r.layoutBox[u],this.constraints[u]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!To(e))return!1;const r=e.current,{projection:a}=this.visualElement;if(!a||!a.layout)return!1;const u=FK(r,a.root,this.visualElement.getTransformPagePoint());let c=Vq(a.layout.layoutBox,u);if(n){const f=n(PK(c));this.hasMutatedConstraints=!!f,f&&(c=A_(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(!vc(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 Hm(this.visualElement,e),r.start(Eg(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(!vc(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(!To(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]=Uq({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(!vc(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();To(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=Gm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:a,dragConstraints:u,dragElastic:c,dragMomentum:f}}}function vc(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function Hq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Fq extends Fr{constructor(e){super(e),this.removeGroupControls=Pn,this.removeListeners=Pn,this.controls=new Iq(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Pn}unmount(){this.removeGroupControls(),this.removeListeners()}}const d1=t=>(e,n)=>{t&&it.postRender(()=>t(e,n))};class Gq extends Fr{constructor(){super(...arguments),this.removePointerDownListener=Pn}onPointerDown(e){this.session=new U_(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:V_(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:a}=this.node.getProps();return{onSessionStart:d1(e),onStart:d1(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 Nc={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function h1(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=h1(t,e.target.x),r=h1(t,e.target.y);return`${n}% ${r}%`}},Yq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,a=Vr.parse(t);if(a.length>5)return r;const u=Vr.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 Jq extends j.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:a}=this.props,{projection:u}=e;gK(Xq),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()})),Nc.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(),mg.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 q_(t){const[e,n]=cK(),r=j.useContext(SO);return F.jsx(Jq,{...t,layoutGroup:r,switchLayoutGroup:j.useContext(x_),isPresent:e,safeToRemove:n})}const Xq={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:Yq};function Zq(t,e,n){const r=Jt(t)?t:Io(t);return r.start(Eg("",r,e,n)),r.animation}const Qq=(t,e)=>t.depth-e.depth;class Wq{constructor(){this.children=[],this.isDirty=!1}add(e){Xy(this.children,e),this.isDirty=!0}remove(e){Zy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(Qq),this.isDirty=!1,this.children.forEach(e)}}function e6(t,e){const n=fn.now(),r=({timestamp:a})=>{const u=a-n;u>=e&&(Lr(r),t(u-e))};return it.setup(r,!0),()=>Lr(r)}const P_=["TopLeft","TopRight","BottomLeft","BottomRight"],t6=P_.length,p1=t=>typeof t=="string"?parseFloat(t):t,m1=t=>typeof t=="number"||de.test(t);function n6(t,e,n,r,a,u){a?(t.opacity=rt(0,n.opacity??1,i6(r)),t.opacityExit=rt(e.opacity??1,0,r6(r))):u&&(t.opacity=rt(e.opacity??1,n.opacity??1,r));for(let c=0;c<t6;c++){const f=`border${P_[c]}Radius`;let h=y1(e,f),m=y1(n,f);if(h===void 0&&m===void 0)continue;h||(h=0),m||(m=0),h===0||m===0||m1(h)===m1(m)?(t[f]=Math.max(rt(p1(h),p1(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 y1(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const i6=I_(0,.5,MO),r6=I_(.5,.95,Pn);function I_(t,e,n){return r=>r<t?0:r>e?1:n(bl(t,e,r))}function g1(t,e){t.min=e.min,t.max=e.max}function Bn(t,e){g1(t.x,e.x),g1(t.y,e.y)}function v1(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function b1(t,e,n,r,a){return t-=e,t=sf(t,1/n,r),a!==void 0&&(t=sf(t,1/a,r)),t}function s6(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=b1(t.min,e,n,f,a),t.max=b1(t.max,e,n,f,a)}function S1(t,e,[n,r,a],u,c){s6(t,e[n],e[r],e[a],e.scale,u,c)}const o6=["x","scaleX","originX"],a6=["y","scaleY","originY"];function w1(t,e,n,r){S1(t.x,e,o6,n?n.x:void 0,r?r.x:void 0),S1(t.y,e,a6,n?n.y:void 0,r?r.y:void 0)}function x1(t){return t.translate===0&&t.scale===1}function H_(t){return x1(t.x)&&x1(t.y)}function T1(t,e){return t.min===e.min&&t.max===e.max}function l6(t,e){return T1(t.x,e.x)&&T1(t.y,e.y)}function A1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function F_(t,e){return A1(t.x,e.x)&&A1(t.y,e.y)}function E1(t){return Wt(t.x)/Wt(t.y)}function O1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class u6{constructor(){this.members=[]}add(e){Xy(this.members,e),e.scheduleRender()}remove(e){if(Zy(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 c6(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"],f6=1e3;let d6=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 G_(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=D_(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&&G_(r)}function Y_({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:a}){return class{constructor(c={},f=e?.()){this.id=d6++,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(m6),this.nodes.forEach(b6),this.nodes.forEach(S6),this.nodes.forEach(y6)},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 Wq)}addEventListener(c,f){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new eg),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=u_(c)&&!aK(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=e6(b,250),Nc.hasAnimatedSinceResize&&(Nc.hasAnimatedSinceResize=!1,this.nodes.forEach(C1)))})}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()||E6,{onLayoutAnimationStart:T,onLayoutAnimationComplete:M}=m.getProps(),k=!this.targetLayout||!F_(this.targetLayout,S),_=!g&&b;if(this.options.layoutRoot||this.resumeFrom||_||g&&(k||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const R={...hg(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||C1(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(),Lr(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(w6),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&&G_(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(_1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(R1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(v6),this.nodes.forEach(h6),this.nodes.forEach(p6)):this.nodes.forEach(R1),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,mg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(g6),this.sharedNodes.forEach(x6)}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&&!H_(this.projectionDelta),h=this.getTransformTemplate(),m=h?h(this.latestValues,""):void 0,y=m!==this.prevTransformTemplateValue;c&&this.instance&&(f||ps(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)),O6(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(_6))){const{scroll:m}=this.root;m&&(Ao(f.x,m.offset.x),Ao(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),Ao(f.x,y.offset.x),Ao(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&&Eo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ps(y.latestValues)&&Eo(h,y.latestValues)}return ps(this.latestValues)&&Eo(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||!ps(m.latestValues))continue;Km(m.latestValues)&&m.updateSnapshot();const y=yt(),g=m.measurePageBox();Bn(y,g),w1(f,m.latestValues,m.snapshot?m.snapshot.layoutBox:void 0,y)}return ps(this.latestValues)&&w1(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(),Nq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Bn(this.target,this.layout.layoutBox),O_(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||Km(this.parent.latestValues)||E_(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;HK(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():(v1(this.prevProjectionDelta.x,this.projectionDelta.x),v1(this.prevProjectionDelta.y,this.projectionDelta.y)),al(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==b||!O1(this.projectionDelta.x,this.prevProjectionDelta.x)||!O1(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=Oo(),this.projectionDelta=Oo(),this.projectionDeltaWithTransform=Oo()}setAnimationOrigin(c,f=!1){const h=this.snapshot,m=h?h.latestValues:{},y={...this.latestValues},g=Oo();(!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(),k=!M||M.members.length<=1,_=!!(T&&!k&&this.options.crossfade===!0&&!this.path.some(A6));this.animationProgress=0;let R;this.mixTargetDelta=G=>{const I=G/1e3;k1(g.x,c.x,I),k1(g.y,c.y,I),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ll(b,this.layout.layoutBox,this.relativeParent.layout.layoutBox),T6(this.relativeTarget,this.relativeTargetOrigin,b,I),R&&l6(this.relativeTarget,R)&&(this.isProjectionDirty=!1),R||(R=yt()),Bn(R,this.relativeTarget)),T&&(this.animationValues=y,n6(y,m,this.latestValues,I,_,k)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=I},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Lr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=it.update(()=>{Nc.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Io(0)),this.currentAnimation=Zq(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(f6),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&&J_(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),Eo(f,y),al(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(c,f){this.sharedNodes.has(c)||this.sharedNodes.set(c,new u6),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=Dc(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=Dc(f?.pointerEvents)||""),this.hasProjected&&!ps(this.latestValues)&&(c.transform=h?h({},""):"none",this.hasProjected=!1);return}c.visibility="";const y=m.animationValues||m.latestValues;this.applyTransformsToTarget();let g=c6(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:k}=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 k?this.options.visualElement.renderState.vars[x]=_:c[x]=_}this.options.layoutId&&(c.pointerEvents=m===this?Dc(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(_1),this.root.sharedNodes.clear()}}}function h6(t){t.updateLayout()}function p6(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}):J_(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=Oo();al(c,n,e.layoutBox);const f=Oo();u?al(f,t.applyTransform(r,!0),e.measuredBox):al(f,n,e.layoutBox);const h=!H_(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),F_(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 m6(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 y6(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function g6(t){t.clearSnapshot()}function _1(t){t.clearMeasurements()}function R1(t){t.isLayoutDirty=!1}function v6(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function C1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function b6(t){t.resolveTargetDelta()}function S6(t){t.calcProjection()}function w6(t){t.resetSkewAndRotation()}function x6(t){t.removeLeadSnapshot()}function k1(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 M1(t,e,n,r){t.min=rt(e.min,n.min,r),t.max=rt(e.max,n.max,r)}function T6(t,e,n,r){M1(t.x,e.x,n.x,r),M1(t.y,e.y,n.y,r)}function A6(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const E6={duration:.45,ease:[.4,0,.1,1]},D1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),N1=D1("applewebkit/")&&!D1("chrome/")?Math.round:Pn;function $1(t){t.min=N1(t.min),t.max=N1(t.max)}function O6(t){$1(t.x),$1(t.y)}function J_(t,e,n){return t==="position"||t==="preserve-aspect"&&!Dq(E1(e),E1(n),.2)}function _6(t){return t!==t.root&&t.scroll?.wasRoot}const R6=Y_({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},X_=Y_({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Vp.current){const t=new R6({});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"}),C6={pan:{Feature:Gq},drag:{Feature:Fq,ProjectionNode:X_,MeasureLayout:q_}};function j1(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 k6 extends Fr{mount(){const{current:e}=this.node;e&&(this.unmount=nK(e,(n,r)=>(j1(this.node,r,"Start"),a=>j1(this.node,a,"End"))))}unmount(){}}class M6 extends Fr{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 B1(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 D6 extends Fr{mount(){const{current:e}=this.node;e&&(this.unmount=oK(e,(n,r)=>(B1(this.node,r,"Start"),(a,{success:u})=>B1(this.node,a,u?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Ym=new WeakMap,Up=new WeakMap,N6=t=>{const e=Ym.get(t.target);e&&e(t)},$6=t=>{t.forEach(N6)};function j6({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($6,{root:t,...e})),r[a]}function B6(t,e,n){const r=j6(e);return Ym.set(t,n),r.observe(t),()=>{Ym.delete(t),r.unobserve(t)}}const z6={some:0,all:1};class L6 extends Fr{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:z6[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 B6(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(V6(e,n))&&this.startObserver()}unmount(){}}function V6({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const U6={inView:{Feature:L6},tap:{Feature:D6},focus:{Feature:M6},hover:{Feature:k6}},K6={layout:{ProjectionNode:X_,MeasureLayout:q_}},q6={...Oq,...U6,...C6,...K6},P6=qK(q6,tq);function I6(){const t=Wn(Po),e=Wn(di),n=Wn(Fi),r=Et(Po),a=Et(di),u=Et(Fi),c=`email-${j.useId()}`,f=`password-${j.useId()}`,h=`one-time-code-${j.useId()}`,[m,y]=j.useState(null),[g,b]=j.useState("email");return F.jsx("form",{onSubmit:async S=>{S.preventDefault();const x=nt(ui);try{switch(g){case"email":{const{nextStep:T,userKey:M}=await cn.declareAuthTarget.query({email:r});switch(De(ui,M),T){case"otc_login":case"otc_verify":{b("otc");break}case"password_login":{b("password");break}}break}case"otc":{if(!x){console.error("somehow userKey is null");return}const T=await cn.verifyAccountAction.mutate({oneTimeCode:u,userKey:x});De(ut,T),gi.once("connect",()=>{Es("/game"),t(""),n("")});break}case"password":{const T=await cn.openSession.mutate({email:r,password:a});De(ut,T),gi.once("connect",()=>{Es("/game"),t(""),e("")});break}}}catch(T){T instanceof vl&&y(T.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:S=>{t(S.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:S=>{e(S.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:"otc",value:u,onChange:S=>{n(S.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 S=nt(ui);if(!S)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:S}),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 H6({route:[,t]}){const e=Et(ut),n=Et(Fi),r=Wn(Fi),a=`code-${j.useId()}`;return j.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"?Es("/account"):Es("/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 F6(){const t=Et(tV),e=Et(ut),[n,r]=j.useState(!1),{refs:a,floatingStyles:u,context:c}=L2({open:n,onOpenChange:r,placement:"bottom-end",middleware:[u2(5),f2(),c2()],whileElementsMounted:t2}),f=N2(c),h=B2(c),m=K2(c),{getReferenceProps:y,getFloatingProps:g}=V2([f,h,m]),b=Et(PL);return F.jsxs("main",{className:Nz.class,children:[F.jsxs("header",{children:[F.jsxs("main",{children:[F.jsx(Dz,{}),F.jsx("span",{children:F.jsx($z,{input:b})})]}),F.jsx("button",{"data-css":"profile",ref:a.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&F.jsx(M2,{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:()=>{Es("/account")},children:"Account"}),F.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),gi.once("disconnect",()=>{De(ut,null),Es("/")}),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(jE[t])}),F.jsx(BE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return F.jsx(I6,{});case"admin":return F.jsx(oV,{});case"game":return F.jsx(lV,{route:t});case"verify":return F.jsx(H6,{route:t});case"account":return F.jsx(sV,{})}})()})]})}jM.createRoot(document.getElementById("root")).render(F.jsx(j.StrictMode,{children:F.jsx(OM,{socket:gi,children:F.jsx(F6,{})})}));