tempest.games 0.2.28 → 0.2.30

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.
@@ -1,4 +1,4 @@
1
- function _k(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const c=Object.getOwnPropertyDescriptor(r,o);c&&Object.defineProperty(t,o,c.get?c:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function kk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Uh={exports:{}},Fa={};/**
1
+ function _k(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in t)){const c=Object.getOwnPropertyDescriptor(r,o);c&&Object.defineProperty(t,o,c.get?c:{enumerable:!0,get:()=>r[o]})}}}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 o of document.querySelectorAll('link[rel="modulepreload"]'))r(o);new MutationObserver(o=>{for(const c of o)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const c={};return o.integrity&&(c.integrity=o.integrity),o.referrerPolicy&&(c.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?c.credentials="include":o.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function r(o){if(o.ep)return;o.ep=!0;const c=n(o);fetch(o.href,c)}})();function kk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var zh={exports:{}},Fa={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.js
4
4
  *
@@ -6,8 +6,8 @@ function _k(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var tS;function Mk(){if(tS)return Fa;tS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var d in o)d!=="key"&&(c[d]=o[d])}else c=o;return o=c.ref,{$$typeof:t,type:r,key:u,ref:o!==void 0?o:null,props:c}}return Fa.Fragment=e,Fa.jsx=n,Fa.jsxs=n,Fa}var nS;function Ck(){return nS||(nS=1,Uh.exports=Mk()),Uh.exports}var Y=Ck();function Dk(t){return Object.entries(t)}const Nk=(t,e,n=mt.STORE)=>f1(n,{key:`${t.key}:JSON`,get:({get:r})=>e.toJson(r(t)),set:({set:r},o)=>{r(t,e.fromJson(o))}});function $k(t,e,n){return Gm(t,{key:`${e.key}:JSON`,get:o=>({get:c})=>{const u=c(e,o);return n.toJson(u)},set:o=>({set:c},u)=>{c(e,o,n.fromJson(u))}},["mutable","json"])}const $r=t=>JSON.parse(t),Je=t=>JSON.stringify(t);function et(t){return OM(mt.STORE,t)}function Ze(...t){return t.length===2?zn(mt.STORE,...t):zn(mt.STORE,...t)}function jk(t,e,n=mt.STORE){return n.joins.set(t.key,new O1(t,e,n)),{key:t.key,type:"join",a:t.between[0],b:t.between[1],cardinality:t.cardinality}}function Bk(t){return kM(t,mt.STORE)}const zh=t=>(e,n,r,o,...c)=>{console[t](`${e} ${n} "${r}" ${o}`,...c)},Lk={error:zh("error"),info:zh("info"),warn:zh("warn")};var Vk=class{logLevel;filter;logger;constructor(t,e,n=Lk){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel!==null&&(e===!0?this.logger.error(...t):e!==!1&&this.logger.error(...e))};info=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel==="info"&&(e===!0?this.logger.info(...t):e!==!1&&this.logger.info(...e))};warn=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel!=="error"&&this.logLevel!==null&&(e===!0?this.logger.warn(...t):e!==!1&&this.logger.warn(...e))}},Uk=class{store;constructor(t=mt.STORE){this.store=t,cM("root",t)}allocate(t,e,n){return gl(this.store,t,e,n)}fuse(t,e,n){return uM(this.store,t,e,n)}deallocate(t){bl(this.store,t)}claim(t,e,n){return Ou(this.store,t,e,n)}},zk=class{store;realm;constructor(t=mt.STORE){this.store=t,this.realm=new Uk(t)}allocate(t,e,n){gl(this.store,t,e,n)}deallocate(t){bl(this.store,t)}claim(t,e,n){Ou(this.store,t,e,n)}};function yi(t){return f1(mt.STORE,t)}function Kk(t){return rM(mt.STORE,t)}function De(...t){t.length===2?Tt(mt.STORE,...t):Tt(mt.STORE,...t)}function Pk(t,e,n=Qu()){return TM(mt.STORE,t,e,n)}function qk(t){return x1(mt.STORE,t)}function Ik(t,e=Qu()){return Um(mt.STORE,t,e)}var _o=class uu extends Set{mode="record";subject=new Qe;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(e,n=0){super(e),e instanceof uu&&(this.parent=e,this.cacheUpdateNumber=e.cacheUpdateNumber),n&&(this.cacheLimit=n,this.cache=new Array(n),this.subscribe("auto cache",r=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=r}))}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(e){const n=new uu(e.members,e.cacheLimit);return n.cache=e.cache,n.cacheIdx=e.cacheIdx,n.cacheUpdateNumber=e.cacheUpdateNumber,n}add(e){const n=super.add(e);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`add:${Je(e)}`)),n}clear(){const e=this.mode==="record"?[...this]:null;super.clear(),e&&(this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(e)}`))}delete(e){const n=super.delete(e);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`del:${Je(e)}`)),n}parent=null;child=null;transactionUpdates=null;transaction(e){this.mode="transaction",this.transactionUpdates=[],this.child=new uu(this);const n=this.child._subscribe("transaction",r=>{this.transactionUpdates?.push(r)});try{if(e(this.child)){for(const o of this.transactionUpdates)this.doStep(o);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(r){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",r),r}finally{n(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(e,n){return this.subject.subscribe(e,n)}subscribe(e,n){return this.subject.subscribe(e,r=>{n(`${this.cacheUpdateNumber}=${r}`)})}emit(e){this.subject.next(e)}doStep(e){const n=e.indexOf(":"),r=e.substring(0,n),o=e.substring(n+1);switch(r){case"add":this.add(JSON.parse(o));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(o));break;case"tx":for(const c of o.split(";"))this.doStep(c)}}getUpdateNumber(e){const n=e.indexOf("=");return Number(e.substring(0,n))}do(e){const n=e.indexOf("="),r=Number(e.substring(0,n)),o=r-this.cacheUpdateNumber;if(o>0){if(o===1){this.mode="playback";const u=e.substring(n+1);return this.doStep(u),this.mode="record",this.cacheUpdateNumber=r,null}return this.cacheUpdateNumber+1}if(Math.abs(o)<this.cacheLimit){const u=this.cacheIdx+o;if(this.cache[u]===e)return null;this.mode="playback";let h=!1;for(;!h;){this.cacheIdx%=this.cacheLimit;const y=this.cache[this.cacheIdx];if(this.cacheIdx--,!y)return"OUT_OF_RANGE";this.undo(y),h=this.cacheIdx===u-1}const p=e.substring(n+1);return this.doStep(p),this.mode="record",this.cacheUpdateNumber=r,null}return"OUT_OF_RANGE"}undoStep(e){const n=e.indexOf(":"),r=e.substring(0,n),o=e.substring(n+1);switch(r){case"add":this.delete(JSON.parse(o));break;case"del":this.add(JSON.parse(o));break;case"clear":{const c=JSON.parse(o);for(const u of c)this.add(u);break}case"tx":{const c=o.split(";");for(let u=c.length-1;u>=0;u--)this.undoStep(c[u])}}}undo(e){const n=e.indexOf("=");if(Number(e.substring(0,n))===this.cacheUpdateNumber){this.mode="playback";const o=e.substring(n+1);return this.undoStep(o),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}};function Qu(t=Math.random){return t().toString(36).slice(2)}var Mp=class extends Promise{fate;resolve;reject;done=!1;constructor(t){let e,n;super((r,o)=>{e=r,n=o}),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(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}};function Se(t){for(;t.child!==null;)t=t.child;return t}var Hk=class o1{_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 o1([...this._buffer]);return e._index=this._index,e}};const Fk={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"};function Gk(t,e){const n=Je(e),r=`${t.key}(${n})`,o=Fk[t.type],c={key:r,type:o};return Object.assign(c,{family:{key:t.key,subKey:n}}),Object.assign(c,{counterfeit:!0}),c}function ko(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}var Zt=class{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(t,e)=>`${t}:${e}`;warn;getRelatedKeys(t){return this.relations.get(t)}addRelation(t,e){let n=this.relations.get(t),r=this.relations.get(e);n?n.add(e):(n=new Set([e]),this.relations.set(t,n)),r?r.add(t):(r=new Set([t]),this.relations.set(e,r))}deleteRelation(t,e){const n=this.relations.get(t);if(n){n.delete(e),n.size===0&&this.relations.delete(t);const r=this.relations.get(e);r&&(r.delete(t),r.size===0&&this.relations.delete(e))}}replaceRelationsUnsafely(t,e){this.relations.set(t,new Set(e));for(const n of e){const r=new Set().add(t);this.relations.set(n,r)}}replaceRelationsSafely(t,e){const n=this.relations.get(t);let r=this.isAType?.(t)?t:void 0,o=r===void 0?t:void 0;if(n)for(const c of n){r??=c,o??=c;const u=this.relations.get(c);u&&(u.size===1?this.relations.delete(c):u.delete(t),this.contents.delete(this.makeContentKey(r,o)))}this.relations.set(t,new Set(e));for(const c of e){let u=this.relations.get(c);u?u.add(t):(u=new Set().add(t),this.relations.set(c,u))}}getContentInternal(t){return this.contents.get(t)}setContent(t,e){this.contents.set(t,e)}deleteContent(t){this.contents.delete(t)}constructor(t,e){if(this.a=t.between[0],this.b=t.between[1],this.cardinality=t.cardinality,e?.externalStore||(this.relations=new Map(t.relations?.map(([n,r])=>[n,new Set(r)])),this.contents=new Map(t.contents)),this.isAType=e?.isAType??null,this.isBType=e?.isBType??null,this.isContent=e?.isContent??null,e?.makeContentKey&&(this.makeContentKey=e.makeContentKey),e?.externalStore){const n=e.externalStore;this.has=(r,o)=>n.has(r,o),this.addRelation=(r,o)=>{n.addRelation(r,o)},this.deleteRelation=(r,o)=>{n.deleteRelation(r,o)},this.replaceRelationsSafely=(r,o)=>{n.replaceRelationsSafely(r,o)},this.replaceRelationsUnsafely=(r,o)=>{n.replaceRelationsUnsafely(r,o)},this.getRelatedKeys=r=>n.getRelatedKeys(r),n.getContent&&(this.getContentInternal=r=>n.getContent(r),this.setContent=(r,o)=>{n.setContent(r,o)},this.deleteContent=r=>{n.deleteContent(r)});for(const[r,o]of t.relations??[]){let c=this.isAType?.(r)?r:void 0,u=c===void 0?r:void 0;for(const d of o)c??=d,u??=d,this.addRelation(c,u)}for(const[r,o]of t.contents??[])this.setContent(r,o)}e?.warn&&(this.warn=e.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([t,e])=>[t,[...e]]),contents:[...this.contents.entries()]}}set(...t){let e,n,r;switch(t.length){case 1:{const o=t[0];e=o[this.a],n=o[this.b],r=void 0;break}case 2:{const o=t[0];typeof o=="string"?[e,n]=t:(e=o[this.a],n=o[this.b],r=t[1]);break}default:{e=t[0],n=t[1],r=t[2];break}}switch(this.cardinality){case"1:1":{const o=this.getRelatedKey(e);o&&o!==n&&this.delete(e,o)}case"1:n":{const o=this.getRelatedKey(n);o&&o!==e&&this.delete(o,n)}break}if(r){const o=this.makeContentKey(e,n);this.setContent(o,r)}return this.addRelation(e,n),this}delete(t,e){e=typeof e=="string"?e:t[this.b];const n=typeof t=="string"?t:t[this.a];if(n===void 0&&typeof e=="string"){const r=this.getRelatedKeys(e);if(r)for(const o of r)this.delete(o,e)}if(typeof n=="string"&&e===void 0){const r=this.getRelatedKeys(n);if(r)for(const o of r)this.delete(n,o)}if(typeof n=="string"&&typeof e=="string"){this.deleteRelation(n,e);const r=this.makeContentKey(n,e);this.deleteContent(r)}return this}getRelatedKey(t){const e=this.getRelatedKeys(t);if(e){e.size>1&&this.warn?.(`${e.size} related keys were found for key "${t}": (${[...e].map(r=>`"${r}"`).join(", ")}). Only one related key was expected.`);let n;for(const r of e){n=r;break}return n}}replaceRelations(t,e,n){const r=!Array.isArray(e),o=r?Object.keys(e):e;if(n?.reckless?this.replaceRelationsUnsafely(t,o):this.replaceRelationsSafely(t,o),r)for(const c of o){const u=this.makeContentKey(t,c),d=e[c];this.setContent(u,d)}return this}getContent(t,e){const n=this.makeContentKey(t,e);return this.getContentInternal(n)}getRelationEntries(t){const e=t[this.a],n=t[this.b];if(e!==void 0&&n===void 0){const r=this.getRelatedKeys(e);if(r)return[...r].map(o=>[o,this.getContent(e,o)])}if(e===void 0&&n!==void 0){const r=this.getRelatedKeys(n);if(r)return[...r].map(o=>[o,this.getContent(o,n)])}return[]}has(t,e){return e?this.getRelatedKeys(t)?.has(e)??!1:this.relations.has(t)}},Qe=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)}},Yk=class extends Qe{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}};function gi(t){return"epoch"in t.transactionMeta}function Gt(t){return"phase"in t.transactionMeta}const Jk=t=>{const e=Se(t);if(!Gt(e)){t.logger.warn("🐞","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}t.logger.info("🪂","transaction",e.transactionMeta.update.key,"Aborting transaction"),e.parent.child=null};function an(t){return t[0].toUpperCase()+t.slice(1)}function ys(t){return t.type.split("_").map(an).join(" ")}var Vm=class extends Error{constructor(t,e){super(`${ys(t)} ${Je(t.key)} not found in store "${e.config.name}".`)}};function Um(t,e,n){return(...r)=>{const o=pt(t,e);if(o)return o.run(r,n);throw new Vm(e,t)}}const zm=t=>e=>t instanceof Function?t(e):t,Wu=(t,e)=>{if(t.valueMap.has(e.key))return t.logger.info("📖",e.type,e.key,"reading cached value"),RM(e,t);switch(e.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return t.logger.info("🧮",e.type,e.key,"computing value"),e.get();case"atom":case"mutable_atom":{const n=e.default;let r;return n instanceof Function?r=n():r=n,t.logger.info("💁","atom",e.key,"could not find cached value; using default",r),r}}},Eu=(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}t.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:e},t.logger.info("⭕",e.type,e.key,`operation start in store "${t.config.name}"${Gt(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.key}"`:""}`)},Ru=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)},a1=(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),yl=(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)},Xk=(t,e,n)=>{switch(e.type){case"mutable_atom":t.logger.info("📢",e.type,e.key,"is now (",n.newValue,") subscribers:",e.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.logger.info("📢",e.type,e.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",e.subject.subscribers)}e.subject.next(n)};function Cp(t,e){const n=Se(t),r=n.selectorAtoms.getRelatedKeys(e.key);if(n.logger.info("🧹",e.type,e.key,r?`evicting ${r.size} states downstream:`:"no downstream states",r??"to evict"),r){n.operation.open&&n.logger.info("🧹",e.type,e.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const o of r)a1(n,o)||(R1(o,n),yl(n,o))}}function Zk(t,e){const n=Se(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e.key}).filter(([o,{source:c}])=>c===e.key);for(const[o]of r)a1(n,o)||(R1(o,n),yl(n,o))}const l1=(t,e,n)=>{const r=Wu(t,e);let o=r;if(e.type==="mutable_atom"&&Gt(t)){const{parent:u}=t;o=Np(t,e,u)}o=zm(n)(o),t.logger.info("📝","atom",e.key,"set to",o),o=hi(t,e.key,o,e.subject),yl(t,e.key),Cp(t,e);const c={oldValue:r,newValue:o};if(!Gt(t)){Xk(t,e,c);return}if(t.on.transactionApplying.state===null){const{key:u}=e;if(EM(c.newValue))return;const d={type:"atom_update",key:u,...c};e.family&&(d.family=e.family),t.transactionMeta.update.updates.push(d),t.logger.info("📁","atom",u,"stowed (",c.oldValue,"->",c.newValue,")")}else if(e.key.startsWith("*")){const u=e.key.slice(1),d=t.atoms.get(u);let h=t.valueMap.get(u);if(d.type==="mutable_atom"&&Gt(t)){const{parent:y}=t;h=Np(t,d,y)}h.do(c.newValue)===null&&Cp(t,d)}};function iS(t,e){let n=e.default;n instanceof Function&&(n=n()),l1(t,e,n)}function Qk(t,e){switch(e.type){case"atom":case"mutable_atom":iS(t,e);break;case"writable_pure_selector":case"writable_held_selector":{const n=u1(e,t);for(const r of n)iS(t,r)}break}}function Km(t,e,n){const r={key:e.key,type:"atom_family"},o=t.families.get(e.key);o&&t.logger.error("❗","atom_family",e.key,`Overwriting an existing ${ys(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Qe,d=Object.assign(h=>{const p=Je(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=Se(t),S=e.default,w={key:g,default:S instanceof Function?()=>S(h):S};e.effects&&(w.effects=e.effects(h));const T=nf(v,w,y);return c.next({type:"state_creation",token:T}),T},r,{subject:c,install:h=>Km(h,e),internalRoles:n});return t.families.set(e.key,d),t.defaults.set(e.key,e.default),r}const Pm=(t,e)=>Se(t).atoms.has(e),Wk=(t,e)=>Se(t).writableSelectors.has(e),eM=(t,e)=>Se(t).readonlySelectors.has(e),tM=(t,e)=>Pm(t,e)||Wk(t,e)||eM(t,e),Dp=(t,e)=>Se(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([r,{source:o}])=>o!==e).map(([r,{source:o}])=>o).filter(r=>tM(t,r)),c1=(t,e,n)=>{const r=[],o=Dp(t,e);for(;o.length>0;){const c=o.shift();n.has(c)||(n.add(c),Pm(t,c)?r.includes(c)||r.push(c):o.push(...Dp(t,c)))}return r},u1=(t,e)=>{const n=t.key,r=Dp(e,n),o=new Set;return r.flatMap(c=>Pm(e,c)?c:c1(e,c,o)).map(c=>e.atoms.get(c))},nM=(t,e,n,r,o)=>{const c=Se(t),{type:u,key:d}=r;if(u==="atom"||u==="mutable_atom")c.selectorAtoms.set({selectorKey:n,atomKey:d}),t.logger.info("🔍",e,n,`discovers root atom "${d}"`);else{const h=c1(t,d,o);t.logger.info("🔍",e,n,`discovers root atoms: [ ${h.map(p=>`"${p}"`).join(", ")} ]`);for(const p of h)c.selectorAtoms=c.selectorAtoms.set({selectorKey:n,atomKey:p})}o.add(d)},ef=(t,e,n,r)=>({get:(...o)=>{const c=Se(t);let u;if(o.length===2){const[y,g]=o;u=Lt(t,y,g)}else[u]=o;const d=pt(t,u),h=Wu(t,d),p=u.key;return t.logger.info("🔌",e,n,`registers dependency ( "${p}" =`,h,")"),c.selectorGraph.set({upstreamSelectorKey:p,downstreamSelectorKey:n},{source:u.key}),nM(t,e,n,u,r),h},set:(...o)=>{let c,u;if(o.length===2)c=o[0],u=o[1];else{const p=o[0],y=o[1];u=o[2],c=Lt(t,p,y)}const d=Se(t),h=pt(d,c);y1(d,h,u)},find:(...o)=>Lt(t,...o),json:o=>gs(t,o)}),qm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,{key:u,const:d}=e,h="readonly_held_selector",{get:p,find:y,json:g}=ef(r,h,u,c),S={...e,type:h,subject:o,install:T=>qm(T,e,n),get:()=>(e.get({get:p,find:y,json:g},d),hi(Se(t),u,d,o),c.clear(),d),...n&&{family:n}};r.readonlySelectors.set(u,S),t.logger.info("✨",h,u,"=",d);const w={key:u,type:h};return n&&(w.family=n),w},Im=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,u=e.key,d="readonly_pure_selector",{get:h,find:p,json:y}=ef(r,d,u,c),g=()=>{const T=e.get({get:h,find:p,json:y});return hi(Se(t),u,T,o),c.clear(),T},v={...e,type:d,subject:o,install:T=>Im(T,e,n),get:g,...n&&{family:n}};r.readonlySelectors.set(u,v);const S=g();t.logger.info("✨",d,u,"=",S);const w={key:u,type:d};return n&&(w.family=n),w},Hm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,{key:u,const:d}=e,h="writable_held_selector",p=ef(r,h,u,c),{find:y,get:g,json:v}=p,S={find:y,get:g,json:v},w=(k=e.get,C=Se(t))=>(k(S,d),hi(C,u,d,o),c.clear(),d),D={...e,type:h,subject:o,install:k=>Hm(k,e,n),get:w,set:k=>{const C=Se(t),O=w(e.get,C),J=zm(k)(O);t.logger.info("📝",h,u,"set (",O,"->",J,")"),hi(C,u,J,o),yl(C,u),gi(C)&&o.next({newValue:J,oldValue:O}),e.set(p,J)},...n&&{family:n}};r.writableSelectors.set(u,D);const $=w();t.logger.info("✨",h,u,"=",$);const _={key:u,type:h};return n&&(_.family=n),_},Fm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,u=e.key,d="writable_pure_selector",h=ef(r,d,u,c),{find:p,get:y,json:g}=h,v={find:p,get:y,json:g},S=(_=e.get,k=Se(t))=>{const C=_(v);return hi(k,u,C,o),c.clear(),C},T={...e,type:d,subject:o,install:_=>Fm(_,e,n),get:S,set:_=>{const k=Se(t),C=S(e.get,k),O=zm(_)(C);t.logger.info("📝",d,u,"set (",C,"->",O,")"),hi(k,e.key,O,o),yl(k,e.key),gi(k)&&o.next({newValue:O,oldValue:C}),e.set(h,O)},...n&&{family:n}};r.writableSelectors.set(u,T);const D=S();t.logger.info("✨",T.type,T.key,"=",D);const $={key:u,type:d};return n&&($.family=n),$};function f1(t,e){const n="set"in e,r="const"in e;if(r&&n){const c=Hm(t,e,void 0);return t.on.selectorCreation.next(c),c}if(r){const c=qm(t,e,void 0);return t.on.selectorCreation.next(c),c}if(n){const c=Fm(t,e,void 0);return t.on.selectorCreation.next(c),c}const o=Im(t,e,void 0);return t.on.selectorCreation.next(o),o}function iM(t,e){const n=Se(t),{key:r,type:o}=e,c=pt(n,e);if(!c.family)t.logger.error("❌",o,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(c.family.subKey)&&n.moleculeData.delete(c.family.subKey,c.family.key);let d;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),d={key:c.family.key,type:"writable_held_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"writable_pure_selector":n.writableSelectors.delete(r),d={key:c.family.key,type:"writable_pure_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_held_selector":n.readonlySelectors.delete(r),d={key:c.family.key,type:"readonly_held_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),d={key:c.family.key,type:"readonly_pure_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),t.logger.info("🔥",e.type,r,"deleted"),Gt(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:e}):t.on.selectorDisposal.next(e)}}function fo(t,e,n){const r=e.key,o="readonly_pure_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Im(w,{key:S,get:e.get(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>fo(y,e),default:y=>e.get(y)({get:(...v)=>zn(t,...v),find:(...v)=>Lt(t,...v),json:v=>gs(t,v)})});return t.families.set(r,p),c}function d1(t,e,n){const r=e.key,o="readonly_held_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=qm(w,{key:S,const:e.const(y),get:e.get(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>d1(y,e),default:e.const});return t.families.set(r,p),c}function h1(t,e,n){const r=e.key,o="writable_held_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Hm(w,{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>h1(y,e),default:e.const});return t.families.set(r,p),c}function Gm(t,e,n){const r=e.key,o="writable_pure_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Fm(w,{key:S,get:e.get(y),set:e.set(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>Gm(y,e),default:y=>e.get(y)({get:(...v)=>zn(t,...v),find:(...v)=>Lt(t,...v),json:v=>gs(t,v)})});return t.families.set(r,p),c}function rM(t,e){const n="set"in e,r="const"in e;return r&&n?h1(t,e,void 0):r?d1(t,e,void 0):n?Gm(t,e):fo(t,e)}function sM(t,e,n){const r=t.families.get(e.key);if(r===void 0)throw new Vm(e,t);const o=r(n),c=Se(t);if(o.family)if(gi(c))switch(o.type){case"atom":case"mutable_atom":t.on.atomCreation.next(o);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(o);break}else Gt(c)&&c.on.transactionApplying.state===null&&c.transactionMeta.update.updates.push({type:"state_creation",token:o});return o}function oM(t,e,n){const r=Je(n),o=`${e.key}(${r})`,c=Se(t);let u;switch(e.type){case"atom_family":case"mutable_atom_family":u=c.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":u=c.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":u=c.readonlySelectors.get(o);break}return u&&ko(u)}function Lt(t,e,n){let r=oM(t,e,n);if(r)return r;const o=Je(n),c=t.molecules.get(o);if(!c&&t.config.lifespan==="immortal"){const u=Gk(e,n);return t.logger.error("❌",u.type,u.key,`was not found in store "${t.config.name}"; returned a counterfeit token.`),u}return r=sM(t,e,n),c&&Se(t).moleculeData.set(o,e.key),r}function tf(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],o=e[1];n=Lt(t,r,o)}try{pt(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":Zm(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":iM(t,n);break}}function p1(t,e){if(e.family){const n=t.families.get(e.family.key);if(n)return n}}function m1(t,...e){let n,r,o;if(e.length===1?(n=e[0],r=p1(t,n)??null,r&&(o=n.family?$r(n.family.subKey):null,n=Lt(t,r,o))):(r=e[0],o=e[1],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){const d=n.family.subKey,h=t.disposalTraces.buffer.find(p=>p?.key===d);t.logger.error("❌",n.type,n.key,`could not be reset because it was not found in the store "${t.config.name}".`,h?`This state was previously disposed:
10
- ${h.trace}`:"No previous disposal trace was found.");return}const c=Eu(t,n);if(c){const d=t.on.operationClose.subscribe(`waiting to reset "${n.key}" at T-${c}`,()=>{d(),t.logger.info("🟢",n.type,n.key,`resuming deferred resetState from T-${c}`),m1(t,n)});return}const u=pt(t,n);Qk(t,u),Ru(t)}const y1=(t,e,n)=>{switch(e.type){case"atom":case"mutable_atom":l1(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":e.set(n);break}};function Tt(t,...e){let n,r,o,c;if(e.length===2?(n=e[0],c=e[1],r=p1(t,n)??null,r&&(o=n.family?$r(n.family.subKey):null,n=Lt(t,r,o))):(r=e[0],o=e[1],c=e[2],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){const h=n.family.subKey,p=t.disposalTraces.buffer.find(y=>y?.key===h);t.logger.error("❌",n.type,n.key,`could not be set because it was not found in the store "${t.config.name}".`,p?`This state was previously disposed:
9
+ */var nS;function Mk(){if(nS)return Fa;nS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,c){var u=null;if(c!==void 0&&(u=""+c),o.key!==void 0&&(u=""+o.key),"key"in o){c={};for(var d in o)d!=="key"&&(c[d]=o[d])}else c=o;return o=c.ref,{$$typeof:t,type:r,key:u,ref:o!==void 0?o:null,props:c}}return Fa.Fragment=e,Fa.jsx=n,Fa.jsxs=n,Fa}var iS;function Ck(){return iS||(iS=1,zh.exports=Mk()),zh.exports}var Y=Ck();function Dk(t){return Object.entries(t)}const Nk=(t,e,n=mt.STORE)=>d1(n,{key:`${t.key}:JSON`,get:({get:r})=>e.toJson(r(t)),set:({set:r},o)=>{r(t,e.fromJson(o))}});function $k(t,e,n){return Ym(t,{key:`${e.key}:JSON`,get:o=>({get:c})=>{const u=c(e,o);return n.toJson(u)},set:o=>({set:c},u)=>{c(e,o,n.fromJson(u))}},["mutable","json"])}const $r=t=>JSON.parse(t),Je=t=>JSON.stringify(t);function et(t){return OM(mt.STORE,t)}function Ze(...t){return t.length===2?zn(mt.STORE,...t):zn(mt.STORE,...t)}function jk(t,e,n=mt.STORE){return n.joins.set(t.key,new O1(t,e,n)),{key:t.key,type:"join",a:t.between[0],b:t.between[1],cardinality:t.cardinality}}function Bk(t){return kM(t,mt.STORE)}const Kh=t=>(e,n,r,o,...c)=>{console[t](`${e} ${n} "${r}" ${o}`,...c)},Lk={error:Kh("error"),info:Kh("info"),warn:Kh("warn")};var Vk=class{logLevel;filter;logger;constructor(t,e,n=Lk){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel!==null&&(e===!0?this.logger.error(...t):e!==!1&&this.logger.error(...e))};info=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel==="info"&&(e===!0?this.logger.info(...t):e!==!1&&this.logger.info(...e))};warn=(...t)=>{const e=this.filter?.(...t)??!0;this.logLevel!=="error"&&this.logLevel!==null&&(e===!0?this.logger.warn(...t):e!==!1&&this.logger.warn(...e))}},Uk=class{store;constructor(t=mt.STORE){this.store=t,cM("root",t)}allocate(t,e,n){return gl(this.store,t,e,n)}fuse(t,e,n){return uM(this.store,t,e,n)}deallocate(t){bl(this.store,t)}claim(t,e,n){return Ou(this.store,t,e,n)}},zk=class{store;realm;constructor(t=mt.STORE){this.store=t,this.realm=new Uk(t)}allocate(t,e,n){gl(this.store,t,e,n)}deallocate(t){bl(this.store,t)}claim(t,e,n){Ou(this.store,t,e,n)}};function yi(t){return d1(mt.STORE,t)}function Kk(t){return rM(mt.STORE,t)}function De(...t){t.length===2?Tt(mt.STORE,...t):Tt(mt.STORE,...t)}function Pk(t,e,n=Qu()){return TM(mt.STORE,t,e,n)}function qk(t){return x1(mt.STORE,t)}function Ik(t,e=Qu()){return zm(mt.STORE,t,e)}var _o=class uu extends Set{mode="record";subject=new Qe;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(e,n=0){super(e),e instanceof uu&&(this.parent=e,this.cacheUpdateNumber=e.cacheUpdateNumber),n&&(this.cacheLimit=n,this.cache=new Array(n),this.subscribe("auto cache",r=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=r}))}toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(e){const n=new uu(e.members,e.cacheLimit);return n.cache=e.cache,n.cacheIdx=e.cacheIdx,n.cacheUpdateNumber=e.cacheUpdateNumber,n}add(e){const n=super.add(e);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`add:${Je(e)}`)),n}clear(){const e=this.mode==="record"?[...this]:null;super.clear(),e&&(this.cacheUpdateNumber++,this.emit(`clear:${JSON.stringify(e)}`))}delete(e){const n=super.delete(e);return this.mode==="record"&&(this.cacheUpdateNumber++,this.emit(`del:${Je(e)}`)),n}parent=null;child=null;transactionUpdates=null;transaction(e){this.mode="transaction",this.transactionUpdates=[],this.child=new uu(this);const n=this.child._subscribe("transaction",r=>{this.transactionUpdates?.push(r)});try{if(e(this.child)){for(const o of this.transactionUpdates)this.doStep(o);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(r){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",r),r}finally{n(),this.child=null,this.transactionUpdates=null,this.mode="record"}}_subscribe(e,n){return this.subject.subscribe(e,n)}subscribe(e,n){return this.subject.subscribe(e,r=>{n(`${this.cacheUpdateNumber}=${r}`)})}emit(e){this.subject.next(e)}doStep(e){const n=e.indexOf(":"),r=e.substring(0,n),o=e.substring(n+1);switch(r){case"add":this.add(JSON.parse(o));break;case"clear":this.clear();break;case"del":this.delete(JSON.parse(o));break;case"tx":for(const c of o.split(";"))this.doStep(c)}}getUpdateNumber(e){const n=e.indexOf("=");return Number(e.substring(0,n))}do(e){const n=e.indexOf("="),r=Number(e.substring(0,n)),o=r-this.cacheUpdateNumber;if(o>0){if(o===1){this.mode="playback";const u=e.substring(n+1);return this.doStep(u),this.mode="record",this.cacheUpdateNumber=r,null}return this.cacheUpdateNumber+1}if(Math.abs(o)<this.cacheLimit){const u=this.cacheIdx+o;if(this.cache[u]===e)return null;this.mode="playback";let h=!1;for(;!h;){this.cacheIdx%=this.cacheLimit;const y=this.cache[this.cacheIdx];if(this.cacheIdx--,!y)return"OUT_OF_RANGE";this.undo(y),h=this.cacheIdx===u-1}const p=e.substring(n+1);return this.doStep(p),this.mode="record",this.cacheUpdateNumber=r,null}return"OUT_OF_RANGE"}undoStep(e){const n=e.indexOf(":"),r=e.substring(0,n),o=e.substring(n+1);switch(r){case"add":this.delete(JSON.parse(o));break;case"del":this.add(JSON.parse(o));break;case"clear":{const c=JSON.parse(o);for(const u of c)this.add(u);break}case"tx":{const c=o.split(";");for(let u=c.length-1;u>=0;u--)this.undoStep(c[u])}}}undo(e){const n=e.indexOf("=");if(Number(e.substring(0,n))===this.cacheUpdateNumber){this.mode="playback";const o=e.substring(n+1);return this.undoStep(o),this.mode="record",this.cacheUpdateNumber--,null}return this.cacheUpdateNumber}};function Qu(t=Math.random){return t().toString(36).slice(2)}var Cp=class extends Promise{fate;resolve;reject;done=!1;constructor(t){let e,n;super((r,o)=>{e=r,n=o}),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(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}};function Se(t){for(;t.child!==null;)t=t.child;return t}var Hk=class a1{_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 a1([...this._buffer]);return e._index=this._index,e}};const Fk={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"};function Gk(t,e){const n=Je(e),r=`${t.key}(${n})`,o=Fk[t.type],c={key:r,type:o};return Object.assign(c,{family:{key:t.key,subKey:n}}),Object.assign(c,{counterfeit:!0}),c}function ko(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}var Zt=class{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(t,e)=>`${t}:${e}`;warn;getRelatedKeys(t){return this.relations.get(t)}addRelation(t,e){let n=this.relations.get(t),r=this.relations.get(e);n?n.add(e):(n=new Set([e]),this.relations.set(t,n)),r?r.add(t):(r=new Set([t]),this.relations.set(e,r))}deleteRelation(t,e){const n=this.relations.get(t);if(n){n.delete(e),n.size===0&&this.relations.delete(t);const r=this.relations.get(e);r&&(r.delete(t),r.size===0&&this.relations.delete(e))}}replaceRelationsUnsafely(t,e){this.relations.set(t,new Set(e));for(const n of e){const r=new Set().add(t);this.relations.set(n,r)}}replaceRelationsSafely(t,e){const n=this.relations.get(t);let r=this.isAType?.(t)?t:void 0,o=r===void 0?t:void 0;if(n)for(const c of n){r??=c,o??=c;const u=this.relations.get(c);u&&(u.size===1?this.relations.delete(c):u.delete(t),this.contents.delete(this.makeContentKey(r,o)))}this.relations.set(t,new Set(e));for(const c of e){let u=this.relations.get(c);u?u.add(t):(u=new Set().add(t),this.relations.set(c,u))}}getContentInternal(t){return this.contents.get(t)}setContent(t,e){this.contents.set(t,e)}deleteContent(t){this.contents.delete(t)}constructor(t,e){if(this.a=t.between[0],this.b=t.between[1],this.cardinality=t.cardinality,e?.externalStore||(this.relations=new Map(t.relations?.map(([n,r])=>[n,new Set(r)])),this.contents=new Map(t.contents)),this.isAType=e?.isAType??null,this.isBType=e?.isBType??null,this.isContent=e?.isContent??null,e?.makeContentKey&&(this.makeContentKey=e.makeContentKey),e?.externalStore){const n=e.externalStore;this.has=(r,o)=>n.has(r,o),this.addRelation=(r,o)=>{n.addRelation(r,o)},this.deleteRelation=(r,o)=>{n.deleteRelation(r,o)},this.replaceRelationsSafely=(r,o)=>{n.replaceRelationsSafely(r,o)},this.replaceRelationsUnsafely=(r,o)=>{n.replaceRelationsUnsafely(r,o)},this.getRelatedKeys=r=>n.getRelatedKeys(r),n.getContent&&(this.getContentInternal=r=>n.getContent(r),this.setContent=(r,o)=>{n.setContent(r,o)},this.deleteContent=r=>{n.deleteContent(r)});for(const[r,o]of t.relations??[]){let c=this.isAType?.(r)?r:void 0,u=c===void 0?r:void 0;for(const d of o)c??=d,u??=d,this.addRelation(c,u)}for(const[r,o]of t.contents??[])this.setContent(r,o)}e?.warn&&(this.warn=e.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([t,e])=>[t,[...e]]),contents:[...this.contents.entries()]}}set(...t){let e,n,r;switch(t.length){case 1:{const o=t[0];e=o[this.a],n=o[this.b],r=void 0;break}case 2:{const o=t[0];typeof o=="string"?[e,n]=t:(e=o[this.a],n=o[this.b],r=t[1]);break}default:{e=t[0],n=t[1],r=t[2];break}}switch(this.cardinality){case"1:1":{const o=this.getRelatedKey(e);o&&o!==n&&this.delete(e,o)}case"1:n":{const o=this.getRelatedKey(n);o&&o!==e&&this.delete(o,n)}break}if(r){const o=this.makeContentKey(e,n);this.setContent(o,r)}return this.addRelation(e,n),this}delete(t,e){e=typeof e=="string"?e:t[this.b];const n=typeof t=="string"?t:t[this.a];if(n===void 0&&typeof e=="string"){const r=this.getRelatedKeys(e);if(r)for(const o of r)this.delete(o,e)}if(typeof n=="string"&&e===void 0){const r=this.getRelatedKeys(n);if(r)for(const o of r)this.delete(n,o)}if(typeof n=="string"&&typeof e=="string"){this.deleteRelation(n,e);const r=this.makeContentKey(n,e);this.deleteContent(r)}return this}getRelatedKey(t){const e=this.getRelatedKeys(t);if(e){e.size>1&&this.warn?.(`${e.size} related keys were found for key "${t}": (${[...e].map(r=>`"${r}"`).join(", ")}). Only one related key was expected.`);let n;for(const r of e){n=r;break}return n}}replaceRelations(t,e,n){const r=!Array.isArray(e),o=r?Object.keys(e):e;if(n?.reckless?this.replaceRelationsUnsafely(t,o):this.replaceRelationsSafely(t,o),r)for(const c of o){const u=this.makeContentKey(t,c),d=e[c];this.setContent(u,d)}return this}getContent(t,e){const n=this.makeContentKey(t,e);return this.getContentInternal(n)}getRelationEntries(t){const e=t[this.a],n=t[this.b];if(e!==void 0&&n===void 0){const r=this.getRelatedKeys(e);if(r)return[...r].map(o=>[o,this.getContent(e,o)])}if(e===void 0&&n!==void 0){const r=this.getRelatedKeys(n);if(r)return[...r].map(o=>[o,this.getContent(o,n)])}return[]}has(t,e){return e?this.getRelatedKeys(t)?.has(e)??!1:this.relations.has(t)}},Qe=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)}},Yk=class extends Qe{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}};function gi(t){return"epoch"in t.transactionMeta}function Gt(t){return"phase"in t.transactionMeta}const Jk=t=>{const e=Se(t);if(!Gt(e)){t.logger.warn("🐞","transaction","???","abortTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}t.logger.info("🪂","transaction",e.transactionMeta.update.key,"Aborting transaction"),e.parent.child=null};function an(t){return t[0].toUpperCase()+t.slice(1)}function ys(t){return t.type.split("_").map(an).join(" ")}var Um=class extends Error{constructor(t,e){super(`${ys(t)} ${Je(t.key)} not found in store "${e.config.name}".`)}};function zm(t,e,n){return(...r)=>{const o=pt(t,e);if(o)return o.run(r,n);throw new Um(e,t)}}const Km=t=>e=>t instanceof Function?t(e):t,Wu=(t,e)=>{if(t.valueMap.has(e.key))return t.logger.info("📖",e.type,e.key,"reading cached value"),RM(e,t);switch(e.type){case"readonly_held_selector":case"readonly_pure_selector":case"writable_held_selector":case"writable_pure_selector":return t.logger.info("🧮",e.type,e.key,"computing value"),e.get();case"atom":case"mutable_atom":{const n=e.default;let r;return n instanceof Function?r=n():r=n,t.logger.info("💁","atom",e.key,"could not find cached value; using default",r),r}}},Eu=(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}t.operation={open:!0,done:new Set,prev:new Map,time:Date.now(),token:e},t.logger.info("⭕",e.type,e.key,`operation start in store "${t.config.name}"${Gt(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.key}"`:""}`)},Ru=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)},l1=(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),yl=(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)},Xk=(t,e,n)=>{switch(e.type){case"mutable_atom":t.logger.info("📢",e.type,e.key,"is now (",n.newValue,") subscribers:",e.subject.subscribers);break;case"atom":case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.logger.info("📢",e.type,e.key,"went (",n.oldValue,"->",n.newValue,") subscribers:",e.subject.subscribers)}e.subject.next(n)};function Dp(t,e){const n=Se(t),r=n.selectorAtoms.getRelatedKeys(e.key);if(n.logger.info("🧹",e.type,e.key,r?`evicting ${r.size} states downstream:`:"no downstream states",r??"to evict"),r){n.operation.open&&n.logger.info("🧹",e.type,e.key,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const o of r)l1(n,o)||(R1(o,n),yl(n,o))}}function Zk(t,e){const n=Se(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e.key}).filter(([o,{source:c}])=>c===e.key);for(const[o]of r)l1(n,o)||(R1(o,n),yl(n,o))}const c1=(t,e,n)=>{const r=Wu(t,e);let o=r;if(e.type==="mutable_atom"&&Gt(t)){const{parent:u}=t;o=$p(t,e,u)}o=Km(n)(o),t.logger.info("📝","atom",e.key,"set to",o),o=hi(t,e.key,o,e.subject),yl(t,e.key),Dp(t,e);const c={oldValue:r,newValue:o};if(!Gt(t)){Xk(t,e,c);return}if(t.on.transactionApplying.state===null){const{key:u}=e;if(EM(c.newValue))return;const d={type:"atom_update",key:u,...c};e.family&&(d.family=e.family),t.transactionMeta.update.updates.push(d),t.logger.info("📁","atom",u,"stowed (",c.oldValue,"->",c.newValue,")")}else if(e.key.startsWith("*")){const u=e.key.slice(1),d=t.atoms.get(u);let h=t.valueMap.get(u);if(d.type==="mutable_atom"&&Gt(t)){const{parent:y}=t;h=$p(t,d,y)}h.do(c.newValue)===null&&Dp(t,d)}};function rS(t,e){let n=e.default;n instanceof Function&&(n=n()),c1(t,e,n)}function Qk(t,e){switch(e.type){case"atom":case"mutable_atom":rS(t,e);break;case"writable_pure_selector":case"writable_held_selector":{const n=f1(e,t);for(const r of n)rS(t,r)}break}}function Pm(t,e,n){const r={key:e.key,type:"atom_family"},o=t.families.get(e.key);o&&t.logger.error("❗","atom_family",e.key,`Overwriting an existing ${ys(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Qe,d=Object.assign(h=>{const p=Je(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=Se(t),S=e.default,w={key:g,default:S instanceof Function?()=>S(h):S};e.effects&&(w.effects=e.effects(h));const T=rf(v,w,y);return c.next({type:"state_creation",token:T}),T},r,{subject:c,install:h=>Pm(h,e),internalRoles:n});return t.families.set(e.key,d),t.defaults.set(e.key,e.default),r}const qm=(t,e)=>Se(t).atoms.has(e),Wk=(t,e)=>Se(t).writableSelectors.has(e),eM=(t,e)=>Se(t).readonlySelectors.has(e),tM=(t,e)=>qm(t,e)||Wk(t,e)||eM(t,e),Np=(t,e)=>Se(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([r,{source:o}])=>o!==e).map(([r,{source:o}])=>o).filter(r=>tM(t,r)),u1=(t,e,n)=>{const r=[],o=Np(t,e);for(;o.length>0;){const c=o.shift();n.has(c)||(n.add(c),qm(t,c)?r.includes(c)||r.push(c):o.push(...Np(t,c)))}return r},f1=(t,e)=>{const n=t.key,r=Np(e,n),o=new Set;return r.flatMap(c=>qm(e,c)?c:u1(e,c,o)).map(c=>e.atoms.get(c))},nM=(t,e,n,r,o)=>{const c=Se(t),{type:u,key:d}=r;if(u==="atom"||u==="mutable_atom")c.selectorAtoms.set({selectorKey:n,atomKey:d}),t.logger.info("🔍",e,n,`discovers root atom "${d}"`);else{const h=u1(t,d,o);t.logger.info("🔍",e,n,`discovers root atoms: [ ${h.map(p=>`"${p}"`).join(", ")} ]`);for(const p of h)c.selectorAtoms=c.selectorAtoms.set({selectorKey:n,atomKey:p})}o.add(d)},ef=(t,e,n,r)=>({get:(...o)=>{const c=Se(t);let u;if(o.length===2){const[y,g]=o;u=Lt(t,y,g)}else[u]=o;const d=pt(t,u),h=Wu(t,d),p=u.key;return t.logger.info("🔌",e,n,`registers dependency ( "${p}" =`,h,")"),c.selectorGraph.set({upstreamSelectorKey:p,downstreamSelectorKey:n},{source:u.key}),nM(t,e,n,u,r),h},set:(...o)=>{let c,u;if(o.length===2)c=o[0],u=o[1];else{const p=o[0],y=o[1];u=o[2],c=Lt(t,p,y)}const d=Se(t),h=pt(d,c);y1(d,h,u)},find:(...o)=>Lt(t,...o),json:o=>gs(t,o)}),Im=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,{key:u,const:d}=e,h="readonly_held_selector",{get:p,find:y,json:g}=ef(r,h,u,c),S={...e,type:h,subject:o,install:T=>Im(T,e,n),get:()=>(e.get({get:p,find:y,json:g},d),hi(Se(t),u,d,o),c.clear(),d),...n&&{family:n}};r.readonlySelectors.set(u,S),t.logger.info("✨",h,u,"=",d);const w={key:u,type:h};return n&&(w.family=n),w},Hm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,u=e.key,d="readonly_pure_selector",{get:h,find:p,json:y}=ef(r,d,u,c),g=()=>{const T=e.get({get:h,find:p,json:y});return hi(Se(t),u,T,o),c.clear(),T},v={...e,type:d,subject:o,install:T=>Hm(T,e,n),get:g,...n&&{family:n}};r.readonlySelectors.set(u,v);const S=g();t.logger.info("✨",d,u,"=",S);const w={key:u,type:d};return n&&(w.family=n),w},Fm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,{key:u,const:d}=e,h="writable_held_selector",p=ef(r,h,u,c),{find:y,get:g,json:v}=p,S={find:y,get:g,json:v},w=(k=e.get,C=Se(t))=>(k(S,d),hi(C,u,d,o),c.clear(),d),D={...e,type:h,subject:o,install:k=>Fm(k,e,n),get:w,set:k=>{const C=Se(t),O=w(e.get,C),J=Km(k)(O);t.logger.info("📝",h,u,"set (",O,"->",J,")"),hi(C,u,J,o),yl(C,u),gi(C)&&o.next({newValue:J,oldValue:O}),e.set(p,J)},...n&&{family:n}};r.writableSelectors.set(u,D);const $=w();t.logger.info("✨",h,u,"=",$);const _={key:u,type:h};return n&&(_.family=n),_},Gm=(t,e,n)=>{const r=Se(t),o=new Qe,c=new Set,u=e.key,d="writable_pure_selector",h=ef(r,d,u,c),{find:p,get:y,json:g}=h,v={find:p,get:y,json:g},S=(_=e.get,k=Se(t))=>{const C=_(v);return hi(k,u,C,o),c.clear(),C},T={...e,type:d,subject:o,install:_=>Gm(_,e,n),get:S,set:_=>{const k=Se(t),C=S(e.get,k),O=Km(_)(C);t.logger.info("📝",d,u,"set (",C,"->",O,")"),hi(k,e.key,O,o),yl(k,e.key),gi(k)&&o.next({newValue:O,oldValue:C}),e.set(h,O)},...n&&{family:n}};r.writableSelectors.set(u,T);const D=S();t.logger.info("✨",T.type,T.key,"=",D);const $={key:u,type:d};return n&&($.family=n),$};function d1(t,e){const n="set"in e,r="const"in e;if(r&&n){const c=Fm(t,e,void 0);return t.on.selectorCreation.next(c),c}if(r){const c=Im(t,e,void 0);return t.on.selectorCreation.next(c),c}if(n){const c=Gm(t,e,void 0);return t.on.selectorCreation.next(c),c}const o=Hm(t,e,void 0);return t.on.selectorCreation.next(o),o}function iM(t,e){const n=Se(t),{key:r,type:o}=e,c=pt(n,e);if(!c.family)t.logger.error("❌",o,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(c.family.subKey)&&n.moleculeData.delete(c.family.subKey,c.family.key);let d;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),d={key:c.family.key,type:"writable_held_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"writable_pure_selector":n.writableSelectors.delete(r),d={key:c.family.key,type:"writable_pure_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_held_selector":n.readonlySelectors.delete(r),d={key:c.family.key,type:"readonly_held_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),d={key:c.family.key,type:"readonly_pure_selector_family"},pt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),t.logger.info("🔥",e.type,r,"deleted"),Gt(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.updates.push({type:"state_disposal",subType:"selector",token:e}):t.on.selectorDisposal.next(e)}}function fo(t,e,n){const r=e.key,o="readonly_pure_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Hm(w,{key:S,get:e.get(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>fo(y,e),default:y=>e.get(y)({get:(...v)=>zn(t,...v),find:(...v)=>Lt(t,...v),json:v=>gs(t,v)})});return t.families.set(r,p),c}function h1(t,e,n){const r=e.key,o="readonly_held_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Im(w,{key:S,const:e.const(y),get:e.get(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>h1(y,e),default:e.const});return t.families.set(r,p),c}function p1(t,e,n){const r=e.key,o="writable_held_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Fm(w,{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>p1(y,e),default:e.const});return t.families.set(r,p),c}function Ym(t,e,n){const r=e.key,o="writable_pure_selector_family",c={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${ys(u)} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const d=new Qe,p=Object.assign(y=>{const g=Je(y),v={key:r,subKey:g},S=`${r}(${g})`,w=Se(t),T=Gm(w,{key:S,get:e.get(y),set:e.set(y)},v);return d.next({type:"state_creation",token:T}),T},c,{internalRoles:n,subject:d,install:y=>Ym(y,e),default:y=>e.get(y)({get:(...v)=>zn(t,...v),find:(...v)=>Lt(t,...v),json:v=>gs(t,v)})});return t.families.set(r,p),c}function rM(t,e){const n="set"in e,r="const"in e;return r&&n?p1(t,e,void 0):r?h1(t,e,void 0):n?Ym(t,e):fo(t,e)}function sM(t,e,n){const r=t.families.get(e.key);if(r===void 0)throw new Um(e,t);const o=r(n),c=Se(t);if(o.family)if(gi(c))switch(o.type){case"atom":case"mutable_atom":t.on.atomCreation.next(o);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(o);break}else Gt(c)&&c.on.transactionApplying.state===null&&c.transactionMeta.update.updates.push({type:"state_creation",token:o});return o}function oM(t,e,n){const r=Je(n),o=`${e.key}(${r})`,c=Se(t);let u;switch(e.type){case"atom_family":case"mutable_atom_family":u=c.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":u=c.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":u=c.readonlySelectors.get(o);break}return u&&ko(u)}function Lt(t,e,n){let r=oM(t,e,n);if(r)return r;const o=Je(n),c=t.molecules.get(o);if(!c&&t.config.lifespan==="immortal"){const u=Gk(e,n);return t.logger.error("❌",u.type,u.key,`was not found in store "${t.config.name}"; returned a counterfeit token.`),u}return r=sM(t,e,n),c&&Se(t).moleculeData.set(o,e.key),r}function tf(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],o=e[1];n=Lt(t,r,o)}try{pt(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":Qm(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":iM(t,n);break}}function m1(t,e){if(e.family){const n=t.families.get(e.family.key);if(n)return n}}function nf(t,...e){let n,r,o;if(e.length===1?(n=e[0],r=m1(t,n)??null,r&&(o=n.family?$r(n.family.subKey):null,n=Lt(t,r,o))):(r=e[0],o=e[1],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){const d=n.family.subKey,h=t.disposalTraces.buffer.find(p=>p?.key===d);t.logger.error("❌",n.type,n.key,`could not be reset because it was not found in the store "${t.config.name}".`,h?`This state was previously disposed:
10
+ ${h.trace}`:"No previous disposal trace was found.");return}const c=Eu(t,n);if(c){const d=t.on.operationClose.subscribe(`waiting to reset "${n.key}" at T-${c}`,()=>{d(),t.logger.info("🟢",n.type,n.key,`resuming deferred resetState from T-${c}`),nf(t,n)});return}const u=pt(t,n);Qk(t,u),Ru(t)}const y1=(t,e,n)=>{switch(e.type){case"atom":case"mutable_atom":c1(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":e.set(n);break}};function Tt(t,...e){let n,r,o,c;if(e.length===2?(n=e[0],c=e[1],r=m1(t,n)??null,r&&(o=n.family?$r(n.family.subKey):null,n=Lt(t,r,o))):(r=e[0],o=e[1],c=e[2],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){const h=n.family.subKey,p=t.disposalTraces.buffer.find(y=>y?.key===h);t.logger.error("❌",n.type,n.key,`could not be set because it was not found in the store "${t.config.name}".`,p?`This state was previously disposed:
11
11
  ${p.trace}`:"No previous disposal trace was found.");return}const u=Eu(t,n);if(u){const h=t.on.operationClose.subscribe(`waiting to set "${n.key}" at T-${u}`,()=>{h(),t.logger.info("🟢",n.type,n.key,`resuming deferred setState from T-${u}`),Tt(t,n,c)});return}const d=pt(t,n);y1(t,d,c),Ru(t)}function aM(t,e,n){const{key:r,newValue:o,oldValue:c}=e,u=t==="newValue"?o:c,d={key:r,type:"atom"};e.family&&Object.assign(d,{family:e.family}),Tt(n,d,u)}function lM(t){const{stack:e}=t;return e?`
12
12
  `+e.split(`
13
13
  `)?.slice(1)?.join(`
@@ -19,8 +19,8 @@ ${S.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.m
19
19
  ${o} was most recently disposed
20
20
  ${v.trace}`:`No previous disposal trace for ${o} was found.`),n}const d=Je(e),h=c.molecules.get(d);if(!h){const v=t.disposalTraces.buffer.find(S=>S?.key===d);return t.logger.error("❌","molecule",n,"claim failed:",`Could not allocate to ${d} in store "${t.config.name}".`,v?`
21
21
  ${d} was most recently disposed
22
- ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:u.stringKey}).filter(([,{source:v}])=>v!==o).map(([v])=>$r(v));r&&c.moleculeGraph.delete(o),c.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:u.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:u.key,from:p,to:[h.key]};return Gt(c)&&c.transactionMeta.phase==="building"&&c.transactionMeta.update.updates.push(y),n}function fM(t,e,n){switch(e){case"newValue":{g1(t,n);break}case"oldValue":{tf(n,t.token);break}}}function dM(t,e,n){switch(e){case"newValue":{tf(n,t.token);break}case"oldValue":{g1(t,n),t.subType==="atom"&&n.valueMap.set(t.token.key,t.value);break}}}function g1(t,e){const{family:n}=t.token;if(n){const r=e.families.get(n.key);r&&Lt(e,r,$r(n.subKey))}}function hM(t,e,n){switch(e){case"newValue":gl(n,t.provenance,t.key);break;case"oldValue":bl(n,t.key);break}}function pM(t,e,n){switch(e){case"newValue":bl(n,t.key);break;case"oldValue":{const r=t.provenance.map($r);gl(n,r,t.key);for(const[o,c]of t.values){const u=n.families.get(o);if(u){Lt(n,u,t.key);const d=`${o}(${Je(t.key)})`;n.valueMap.set(d,c)}}}break}}function mM(t,e,n){switch(e){case"newValue":{const r=t.to.length===1?t.to[0]:t.to;Ou(n,r,t.key,"exclusive")}break;case"oldValue":{const r=t.from.length===1?t.from[0]:t.from;Ou(n,r,t.key,"exclusive")}break}}function ho(t,e,n){const r=t==="newValue"?e.updates:[...e.updates].reverse();for(const o of r)switch(o.type){case"atom_update":case"selector_update":aM(t,o,n);break;case"state_creation":fM(o,t,n);break;case"state_disposal":dM(o,t,n);break;case"molecule_creation":hM(o,t,n);break;case"molecule_disposal":pM(o,t,n);break;case"molecule_transfer":mM(o,t,n);break;case"transaction_update":ho(t,o,n);break}}function b1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function v1(t,e){return t.transactionMeta.epoch.get(e)}function yM(t,e){if(!gi(t))return;const r=b1(t,e);if(r!==void 0)return v1(t,r)}function Ym(t,e,n){gi(t)&&e&&t.transactionMeta.epoch.set(e,n)}function gM(t,e,n){if(!gi(t))return;const o=b1(t,e);o!==void 0&&t.transactionMeta.epoch.set(o,n)}const bM=(t,e)=>{const n=Se(e),{parent:r}=n;if(r===null||!Gt(n)||n.transactionMeta?.phase!=="building"){e.logger.warn("🐞","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}n.transactionMeta.phase="applying",n.transactionMeta.update.output=t,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{updates:o}=n.transactionMeta.update;e.logger.info("🛄","transaction",n.transactionMeta.update.key,`Applying transaction with ${o.length} updates:`,o),ho("newValue",n.transactionMeta.update,r),gi(r)?(gM(r,n.transactionMeta.update.key,n.transactionMeta.update.epoch),pt(e,{key:n.transactionMeta.update.key,type:"transaction"})?.subject.next(n.transactionMeta.update),e.logger.info("🛬","transaction",n.transactionMeta.update.key,"Finished applying transaction.")):Gt(r)&&r.transactionMeta.update.updates.push(n.transactionMeta.update),r.on.transactionApplying.next(null)};function S1(t,e,n){if(!gi(t))return;const{epoch:o,actionContinuities:c}=t.transactionMeta;c.set(e,n),o.has(e)||o.set(e,-1)}function vM(t){return{store:t}}function zn(t,...e){let n,r,o;if(e.length===1?n=e[0]:(r=e[0],o=e[1],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){r=t.families.get(n.family.key);const c=n.family.subKey,u=t.disposalTraces.buffer.find(d=>d?.key===c);switch(t.logger.error("❌",n.type,n.key,`could not be retrieved because it was not found in the store "${t.config.name}".`,u?`This state was previously disposed:
23
- ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":case"mutable_atom_family":return t.defaults.get(r.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(r.key))return t.defaults.get(n.family.key);const d=pt(t,r).default(c);return t.defaults.set(r.key,d),d}}}return Wu(t,pt(t,n))}var si=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))return this.source.get(t)}set(t,e){return this.deleted.delete(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.deleted.add(t),super.delete(t)}};const SM=(t,e,n,r)=>{const o=Se(t),c={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new si(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new si(o.families),joins:new si(o.joins),operation:{open:!1},readonlySelectors:new si(o.readonlySelectors),timelines:new si(o.timelines),timelineTopics:new Zt(o.timelineTopics.toJSON()),trackers:new Map,transactions:new si(o.transactions),selectorAtoms:new Zt(o.selectorAtoms.toJSON()),selectorGraph:new Zt(o.selectorGraph.toJSON(),{makeContentKey:(...p)=>p.sort().join(":")}),writableSelectors:new si(o.writableSelectors),valueMap:new si(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new si(o.molecules),moleculeGraph:new Zt(o.moleculeGraph.toJSON(),{makeContentKey:o.moleculeGraph.makeContentKey}),moleculeData:new Zt(o.moleculeData.toJSON(),{makeContentKey:o.moleculeData.makeContentKey}),moleculeJoins:new Zt(o.moleculeJoins.toJSON(),{makeContentKey:o.moleculeJoins.makeContentKey}),miscResources:new si(o.miscResources)},u=yM(t,e),d={phase:"building",update:{type:"transaction_update",key:e,id:r,epoch:u===void 0?NaN:u+1,updates:[],params:n,output:void 0},toolkit:{get:(...p)=>zn(h,...p),set:(...p)=>{Tt(h,...p)},reset:(...p)=>{m1(h,...p)},run:(p,y=Qu())=>Um(h,p,y),find:(...p)=>Lt(t,...p),json:p=>gs(h,p),dispose:(...p)=>{tf(h,...p)},env:()=>vM(h)}},h=Object.assign(c,{transactionMeta:d});return o.child=h,t.logger.info("🛫","transaction",e,"Building transaction with params:",n),h};function x1(t,e){const{key:n}=e,r=t.transactions.has(n),o={key:n,type:"transaction",run:(d,h)=>{const p=SM(t,n,d,h);try{const y=Se(t),{toolkit:g}=p.transactionMeta,v=e.do(g,...d);return bM(v,y),v}catch(y){throw Jk(c),t.logger.warn("💥","transaction",n,"caught:",y),y}},install:d=>x1(d,e),subject:new Qe},c=Se(t);c.transactions.set(n,o);const u=ko(o);return r||t.on.transactionCreation.next(u),u}var xM=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 Zt({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Zt({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 Zt({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Zt({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Hk(100);molecules=new Map;moleculeJoins=new Zt({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeGraph=new Zt({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Zt({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});miscResources=new Map;on={atomCreation:new Qe,atomDisposal:new Qe,selectorCreation:new Qe,selectorDisposal:new Qe,timelineCreation:new Qe,transactionCreation:new Qe,transactionApplying:new Yk(null),operationClose:new Qe,moleculeCreation:new Qe,moleculeDisposal:new Qe};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new Vk("warn",(t,e,n)=>!MM(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.valueMap=new Map(e?.valueMap),this.operation={...e?.operation},gi(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new Zt(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 o=gs(e,r),c=E1(r);n.add(o.key),n.add(c.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 mt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new xM({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function pt(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 Vm(e,t)}const wM=(t,e)=>{const n=Se(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)};function TM(t,e,n,r=Qu()){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 Mo(t,e,r,n);case"transaction":return T1(t,e,r,n);case"timeline":return w1(t,e,r,n)}}const rS=(t,e)=>{const n=Se(t);return u1(e,t).map(o=>o.subject.subscribe(`${e.type}:${e.key}`,c=>{t.logger.info("📢",e.type,e.key,"root",o.key,"went",c.oldValue,"->",c.newValue);const u=wM(n,e),d=Wu(n,e);t.logger.info("✨",e.type,e.key,"went",u,"->",d),e.subject.next({newValue:d,oldValue:u})}))};function Mo(t,e,n,r){function o(g){if(t.operation.open){const v=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{v(),r(g)})}else r(g)}const c=pt(t,e);t.logger.info("👀",c.type,c.key,`Adding subscription "${n}"`);const u=c.type==="writable_pure_selector"||c.type==="readonly_pure_selector";let d=null,h=o;u&&(d=rS(t,c),h=g=>{d&&(d.length=0,d.push(...rS(t,c))),o(g)});const p=c.subject.subscribe(n,h);return()=>{if(t.logger.info("🙈",c.type,c.key,`Removing subscription "${n}"`),p(),d)for(const g of d)g()}}const w1=(t,e,n,r)=>{const o=pt(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),c()}},T1=(t,e,n,r)=>{const o=pt(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),c()}};var Jm=class{initializeState(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,o=nf(e,{key:n,default:null},r);if(e.parent?.valueMap.has(n)){const c=e.parent.valueMap.get(n);e.valueMap.set(n,c)}return o}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(t,e,n){const r=`tracker:${n.config.name}:${Gt(n)?n.transactionMeta.update.key:"main"}:${t.key}`,o=zn(n,t);this.unsubscribeFromInnerValue=o.subscribe(r,c=>{Tt(n,e,c)}),this.unsubscribeFromState=Mo(n,t,r,c=>{c.newValue!==c.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=c.newValue.subscribe(r,u=>{Tt(n,e,u)}))})}updateCore(t,e,n){const r=`tracker:${n.config.name}:${Gt(n)?n.transactionMeta.update.key:"main"}:${t.key}`;Mo(n,e,r,({newValue:o,oldValue:c})=>{const u=n.timelineTopics.getRelatedKey(e.key);if(u&&n.timelines.get(u)?.timeTraveling){const p=w1(n,{key:u,type:"timeline"},r,y=>{p(),Tt(n,t,g=>(y==="redo"&&o?g.do(o):y==="undo"&&c&&g.undo(c),g))});return}const d=n.on.operationClose.subscribe(r,()=>{d();const h=zn(n,t),p=o===null?-1:h.getUpdateNumber(o),y=p-h.cacheUpdateNumber;o&&y===1?Tt(n,t,g=>(g.do(o),g)):n.logger.info("❌","mutable_atom",t.key,`could not be updated. Expected update number ${h.cacheUpdateNumber+1}, but got ${p}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(t,e){this.mutableState=t;const n=Se(e);this.latestUpdateState=this.initializeState(t,n),this.observeCore(t,this.latestUpdateState,n),this.updateCore(t,this.latestUpdateState,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function Xm(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const r=Se(t),{key:o,default:c}=e,u=r.atoms.get(o),d="mutable_atom";if(u&&u.type===d)return t.logger.error("❌",d,o,"Tried to create atom, but it already exists in the store."),ko(u);const h=new Qe,p={...e,type:d,install:v=>(v.logger.info("🛠️","atom",o,`installing in store "${v.config.name}"`),Xm(v,e,n)),subject:h};n&&(p.family=n);const y=c();r.atoms.set(p.key,p),hi(r,o,y,h);const g=ko(p);if(e.effects){let v=0;const S=[];for(const w of e.effects){const T=w({setSelf:D=>{Tt(t,g,D)},onSet:D=>Mo(t,g,`effect[${v}]`,D)});T&&S.push(T),++v}p.cleanup=()=>{for(const w of S)w()}}return new Jm(g,t),n||Nk(g,e,t),g}var AM=class{trackers=new Map;latestUpdateAtoms;mutableAtoms;constructor(t,e){const n=Km(e,{key:`*${t.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=pt(e,n),this.mutableAtoms=t,this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,r=>{const{type:o,token:c}=r;if(c.family){const u=$r(c.family.subKey);switch(o){case"state_creation":this.trackers.set(u,new Jm(c,e));break;case"state_disposal":{const d=this.trackers.get(u);d&&(d[Symbol.dispose](),this.trackers.delete(u))}break}}})}};function A1(t,e,n){const r={key:e.key,type:"mutable_atom_family"},o=t.families.get(e.key);o&&t.logger.error("❗","mutable_atom_family",e.key,`Overwriting an existing ${ys(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Qe,d=Object.assign(h=>{const p=Je(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=Se(t),S={key:g,default:()=>e.default(h),toJson:e.toJson,fromJson:e.fromJson,mutable:!0};e.effects&&(S.effects=e.effects(h));const w=Xm(v,S,y);return c.next({type:"state_creation",token:w}),w},r,{subject:c,install:h=>A1(h,e),toJson:e.toJson,fromJson:e.fromJson,internalRoles:n});return t.families.set(e.key,d),$k(t,d,e),new AM(d,t),r}const sS=(t,e)=>{const n=Se(e),r=`${t.key}:JSON`;return n.families.get(r)},gs=(t,e)=>{if(e.family){const r=Se(t),c={key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"},u=pt(r,c),d=JSON.parse(e.family.subKey);return Lt(t,u,d)}return{type:"writable_pure_selector",key:`${e.key}:JSON`}},E1=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function EM(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t}function Np(t,e,n){const r=n.valueMap.get(e.key),o=t.valueMap.get(e.key);if(r!==o)return o;if(r===void 0)return e.default();n.logger.info("📃","atom",e.key,"copying");const c=e.toJson(r),u=e.fromJson(c);return t.valueMap.set(e.key,u),new Jm(e,n),u}function hi(t,e,n,r){const o=t.valueMap.get(e);if(o instanceof Mp){const c=o;return n instanceof Promise?c:(t.valueMap.set(e,n),n)}if(n instanceof Promise){const c=new Mp(n);return t.valueMap.set(e,c),c.then(u=>{if(t.valueMap.get(e)===c){hi(t,e,u,r);const h=t.atoms.get(e);if(h)Eu(t,h),Cp(t,h),Ru(t);else{const p=t.writableSelectors.get(e)??t.readonlySelectors.get(e);p&&(Eu(t,p),Zk(t,p),Ru(t))}r.next({newValue:u,oldValue:c})}}).catch(u=>{t.logger.error("💥","state",e,"rejected:",u)}),c}return t.valueMap.set(e,n),n}const RM=(t,e)=>{let n=e.valueMap.get(t.key);if(t.type==="mutable_atom"&&Gt(e)){const{parent:r}=e;n=Np(e,t,r)}return n},R1=(t,e)=>{const n=e.valueMap.get(t);if(n instanceof Mp){const r=n,o=e.writableSelectors.get(t)??e.readonlySelectors.get(t);o&&r.use(o.get());return}e.operation.open&&e.operation.prev.set(t,n),e.valueMap.delete(t),e.logger.info("🗑","state",t,"evicted")};function nf(t,e,n){const r="atom",{key:o,default:c}=e;t.logger.info("🔨","atom",o,`creating in store "${t.config.name}"`);const u=Se(t),d=u.atoms.get(o);if(d&&d.type===r)return t.logger.error("❌","atom",o,"Tried to create atom, but it already exists in the store."),ko(d);const h=new Qe,p={...e,type:r,install:v=>(v.logger.info("🛠️",r,o,`installing in store "${v.config.name}"`),nf(v,e,n)),subject:h};n&&(p.family=n);let y=c;c instanceof Function&&(y=c()),u.atoms.set(o,p),hi(u,o,y,h);const g=ko(p);if(e.effects){let v=0;const S=[];for(const w of e.effects){const T=w({setSelf:D=>{Tt(t,g,D)},onSet:D=>Mo(t,g,`effect[${v}]`,D)});T&&S.push(T),++v}p.cleanup=()=>{for(const w of S)w()}}return g}function OM(t,e){if("mutable"in e){const o=Xm(t,e,void 0);return t.on.atomCreation.next(o),o}const r=nf(t,e,void 0);return t.on.atomCreation.next(r),r}function Zm(t,e){const n=Se(t),{key:r,family:o}=e,c=pt(n,e);if(!o)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{c.cleanup?.();const u=t.valueMap.get(c.key),d=pt(t,{key:o.key,type:"atom_family"}),h={type:"state_disposal",subType:"atom",token:e,value:u};d.subject.next(h);const p=Gt(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),t.timelineTopics.delete(r),e.type==="mutable_atom"){const y=E1(e);Zm(t,y),t.trackers.delete(r)}if(t.logger.info("🔥","atom",r,"deleted"),p&&n.transactionMeta.phase==="building"){const y=n.transactionMeta.update.updates.at(-1);y?.type==="molecule_disposal"&&y.values.some(([S])=>S===c.family?.key)||n.transactionMeta.update.updates.push(h)}else t.on.atomDisposal.next(e)}}var O1=class{toolkit;options;defaultContent;molecules=new Map;relations;states;core;transact(t,e){const n=this.toolkit;this.toolkit=t,e(this),this.toolkit=n}store;realm;[Symbol.dispose](){}constructor(t,e,n=mt.STORE){this.store=n,this.realm=new zk(n),this.options=t,this.defaultContent=e,this.store.miscResources.set(`join:${t.key}`,this),this.realm.allocate("root",t.key),this.toolkit={get:(...C)=>zn(n,...C),set:(...C)=>{Tt(n,...C)},find:(...C)=>Lt(n,...C),json:C=>gs(n,C)};const r=t.between[0],o=t.between[1],c=A1(n,{key:`${t.key}/relatedKeys`,default:()=>new _o,mutable:!0,fromJson:C=>_o.fromJSON(C),toJson:C=>C.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:c};const u=({get:C},O)=>C(c,O),d=({set:C},O,J)=>{this.store.molecules.has(Je(O))||this.realm.allocate(t.key,O),C(c,O,G=>G.add(J)),C(c,J,G=>G.add(O))},h=({set:C},O,J)=>{C(c,O,G=>(G.delete(J),G)),C(c,J,G=>(G.delete(O),G))},p=(C,O,J)=>{const{find:G,get:H,set:ie}=C,oe=G(c,O),fe=H(oe);for(const ge of fe)J.includes(ge)||ie(c,ge,Q=>(Q.delete(O),Q));ie(oe,ge=>(ge.transaction(be=>{be.clear();for(const Q of J){const W=u(C,Q),B=W.has(O);if(this.relations.cardinality==="1:n"){const P=[];for(const z of W){if(z===O)continue;const ee=u(C,z);ee.delete(Q),ee.size===0&&P.push(z)}!B&&W.size>0&&W.clear();for(const z of P){const ee=[Q,z].sort(),A=`"${ee[0]}:${ee[1]}"`;this.molecules.delete(A)}}B||W.add(O),be.add(Q)}return!0}),ge))},y=(C,O,J)=>{const{set:G}=C;G(c,O,H=>(H.transaction(ie=>{for(const oe of J)ie.add(oe);return!0}),H));for(const H of J)G(c,H,ie=>(ie.add(O),ie));return!0},g=(C,O,J)=>{const G=u(C,O);return J?G.has(J):G.size>0},v={getRelatedKeys:C=>u(this.toolkit,C),addRelation:(C,O)=>{this.store.moleculeJoins.set(C,t.key),this.store.moleculeJoins.set(O,t.key),d(this.toolkit,C,O)},deleteRelation:(C,O)=>{h(this.toolkit,C,O)},replaceRelationsSafely:(C,O)=>{p(this.toolkit,C,O)},replaceRelationsUnsafely:(C,O)=>{y(this.toolkit,C,O)},has:(C,O)=>g(this.toolkit,C,O)};let S,w;if(e){w=Km(n,{key:`${t.key}/content`,default:e},["join","content"]);const C=({get:G},H)=>G(w,H),O=({set:G},H,ie)=>{G(w,H,ie)};S=Object.assign(v,{getContent:G=>C(this.toolkit,G),setContent:(G,H)=>{O(this.toolkit,G,H)},deleteContent:G=>{this.realm.deallocate(G)}})}else S=v;const T=new Zt(t,{externalStore:S,isAType:t.isAType,isBType:t.isBType,makeContentKey:(...C)=>{const[O,J]=C,G=C.sort(),H=`${G[0]}:${G[1]}`,ie=n.molecules.get(Je(O)),oe=n.molecules.get(Je(J));return ie||this.realm.allocate(t.key,O),oe||this.realm.allocate(t.key,J),this.realm.allocate(O,H,"all"),this.realm.claim(J,H),this.store.moleculeJoins.set(H,t.key),H}}),D=()=>fo(n,{key:`${t.key}/singleRelatedKey`,get:C=>({get:O})=>{const J=O(c,C);for(const G of J)return G;return null}},["join","keys"]),$=()=>fo(n,{key:`${t.key}/multipleRelatedKeys`,get:C=>({get:O})=>{const J=sS(c,n);return O(J,C).members}},["join","keys"]),_=()=>fo(n,{key:`${t.key}/singleRelatedEntry`,get:C=>({get:O})=>{const J=O(c,C);for(const G of J){let H=T.isAType?.(C)?C:void 0,ie=H===void 0?C:void 0;H??=G,ie??=G;const oe=T.makeContentKey(H,ie),fe=O(w,oe);return[G,fe]}return null}},["join","entries"]),k=()=>fo(n,{key:`${t.key}/multipleRelatedEntries`,get:C=>({get:O})=>{const J=sS(c,n);return O(J,C).members.map(H=>{let ie=T.isAType?.(C)?C:void 0,oe=ie===void 0?C:void 0;ie??=H,oe??=H;const fe=T.makeContentKey(ie,oe),ge=O(w,fe);return[H,ge]})}},["join","entries"]);switch(t.cardinality){case"1:1":{const C=D(),O=`${r}KeyOf${an(o)}`,J=`${o}KeyOf${an(r)}`,G={[O]:C,[J]:C};let H;if(e){const ie=_(),oe=`${r}EntryOf${an(o)}`,fe=`${o}EntryOf${an(r)}`,ge={[oe]:ie,[fe]:ie};H=Object.assign(G,ge)}else H=G;this.relations=T,this.states=H;break}case"1:n":{const C=D(),O=$(),J=`${r}KeyOf${an(o)}`,G=`${o}KeysOf${an(r)}`,H={[J]:C,[G]:O};let ie;if(e){const oe=_(),fe=k(),ge=`${r}EntryOf${an(o)}`,be=`${o}EntriesOf${an(r)}`,Q={[ge]:oe,[be]:fe};ie=Object.assign(H,Q)}else ie=H;this.relations=T,this.states=ie;break}case"n:n":{const C=$(),O=`${r}KeysOf${an(o)}`,J=`${o}KeysOf${an(r)}`,G={[O]:C,[J]:C};let H;if(e){const ie=k(),oe=`${r}EntriesOf${an(o)}`,fe=`${o}EntriesOf${an(r)}`,ge={[oe]:ie,[fe]:ie};H=Object.assign(G,ge)}else H=G;this.relations=T,this.states=H}}}};function _M(t,e){let n=e.joins.get(t.key);if(n===void 0){const o=mt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${e.config.name}"`);n=new O1(o.options,o.defaultContent,e),e.joins.set(t.key,n)}return n}function kM(t,e){return _M(t,e).core.relatedKeysAtoms}function MM(t){return t.startsWith("🔍 ")}var Kh={exports:{}},xe={};/**
22
+ ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:u.stringKey}).filter(([,{source:v}])=>v!==o).map(([v])=>$r(v));r&&c.moleculeGraph.delete(o),c.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:u.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:u.key,from:p,to:[h.key]};return Gt(c)&&c.transactionMeta.phase==="building"&&c.transactionMeta.update.updates.push(y),n}function fM(t,e,n){switch(e){case"newValue":{g1(t,n);break}case"oldValue":{tf(n,t.token);break}}}function dM(t,e,n){switch(e){case"newValue":{tf(n,t.token);break}case"oldValue":{g1(t,n),t.subType==="atom"&&n.valueMap.set(t.token.key,t.value);break}}}function g1(t,e){const{family:n}=t.token;if(n){const r=e.families.get(n.key);r&&Lt(e,r,$r(n.subKey))}}function hM(t,e,n){switch(e){case"newValue":gl(n,t.provenance,t.key);break;case"oldValue":bl(n,t.key);break}}function pM(t,e,n){switch(e){case"newValue":bl(n,t.key);break;case"oldValue":{const r=t.provenance.map($r);gl(n,r,t.key);for(const[o,c]of t.values){const u=n.families.get(o);if(u){Lt(n,u,t.key);const d=`${o}(${Je(t.key)})`;n.valueMap.set(d,c)}}}break}}function mM(t,e,n){switch(e){case"newValue":{const r=t.to.length===1?t.to[0]:t.to;Ou(n,r,t.key,"exclusive")}break;case"oldValue":{const r=t.from.length===1?t.from[0]:t.from;Ou(n,r,t.key,"exclusive")}break}}function ho(t,e,n){const r=t==="newValue"?e.updates:[...e.updates].reverse();for(const o of r)switch(o.type){case"atom_update":case"selector_update":aM(t,o,n);break;case"state_creation":fM(o,t,n);break;case"state_disposal":dM(o,t,n);break;case"molecule_creation":hM(o,t,n);break;case"molecule_disposal":pM(o,t,n);break;case"molecule_transfer":mM(o,t,n);break;case"transaction_update":ho(t,o,n);break}}function b1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function v1(t,e){return t.transactionMeta.epoch.get(e)}function yM(t,e){if(!gi(t))return;const r=b1(t,e);if(r!==void 0)return v1(t,r)}function Jm(t,e,n){gi(t)&&e&&t.transactionMeta.epoch.set(e,n)}function gM(t,e,n){if(!gi(t))return;const o=b1(t,e);o!==void 0&&t.transactionMeta.epoch.set(o,n)}const bM=(t,e)=>{const n=Se(e),{parent:r}=n;if(r===null||!Gt(n)||n.transactionMeta?.phase!=="building"){e.logger.warn("🐞","transaction","???","applyTransaction called outside of a transaction. This is probably a bug in AtomIO.");return}n.transactionMeta.phase="applying",n.transactionMeta.update.output=t,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{updates:o}=n.transactionMeta.update;e.logger.info("🛄","transaction",n.transactionMeta.update.key,`Applying transaction with ${o.length} updates:`,o),ho("newValue",n.transactionMeta.update,r),gi(r)?(gM(r,n.transactionMeta.update.key,n.transactionMeta.update.epoch),pt(e,{key:n.transactionMeta.update.key,type:"transaction"})?.subject.next(n.transactionMeta.update),e.logger.info("🛬","transaction",n.transactionMeta.update.key,"Finished applying transaction.")):Gt(r)&&r.transactionMeta.update.updates.push(n.transactionMeta.update),r.on.transactionApplying.next(null)};function S1(t,e,n){if(!gi(t))return;const{epoch:o,actionContinuities:c}=t.transactionMeta;c.set(e,n),o.has(e)||o.set(e,-1)}function vM(t){return{store:t}}function zn(t,...e){let n,r,o;if(e.length===1?n=e[0]:(r=e[0],o=e[1],n=Lt(t,r,o)),"counterfeit"in n&&"family"in n){r=t.families.get(n.family.key);const c=n.family.subKey,u=t.disposalTraces.buffer.find(d=>d?.key===c);switch(t.logger.error("❌",n.type,n.key,`could not be retrieved because it was not found in the store "${t.config.name}".`,u?`This state was previously disposed:
23
+ ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":case"mutable_atom_family":return t.defaults.get(r.key);case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(r.key))return t.defaults.get(n.family.key);const d=pt(t,r).default(c);return t.defaults.set(r.key,d),d}}}return Wu(t,pt(t,n))}var si=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))return this.source.get(t)}set(t,e){return this.deleted.delete(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.deleted.add(t),super.delete(t)}};const SM=(t,e,n,r)=>{const o=Se(t),c={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new si(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new si(o.families),joins:new si(o.joins),operation:{open:!1},readonlySelectors:new si(o.readonlySelectors),timelines:new si(o.timelines),timelineTopics:new Zt(o.timelineTopics.toJSON()),trackers:new Map,transactions:new si(o.transactions),selectorAtoms:new Zt(o.selectorAtoms.toJSON()),selectorGraph:new Zt(o.selectorGraph.toJSON(),{makeContentKey:(...p)=>p.sort().join(":")}),writableSelectors:new si(o.writableSelectors),valueMap:new si(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new si(o.molecules),moleculeGraph:new Zt(o.moleculeGraph.toJSON(),{makeContentKey:o.moleculeGraph.makeContentKey}),moleculeData:new Zt(o.moleculeData.toJSON(),{makeContentKey:o.moleculeData.makeContentKey}),moleculeJoins:new Zt(o.moleculeJoins.toJSON(),{makeContentKey:o.moleculeJoins.makeContentKey}),miscResources:new si(o.miscResources)},u=yM(t,e),d={phase:"building",update:{type:"transaction_update",key:e,id:r,epoch:u===void 0?NaN:u+1,updates:[],params:n,output:void 0},toolkit:{get:(...p)=>zn(h,...p),set:(...p)=>{Tt(h,...p)},reset:(...p)=>{nf(h,...p)},run:(p,y=Qu())=>zm(h,p,y),find:(...p)=>Lt(t,...p),json:p=>gs(h,p),dispose:(...p)=>{tf(h,...p)},env:()=>vM(h)}},h=Object.assign(c,{transactionMeta:d});return o.child=h,t.logger.info("🛫","transaction",e,"Building transaction with params:",n),h};function x1(t,e){const{key:n}=e,r=t.transactions.has(n),o={key:n,type:"transaction",run:(d,h)=>{const p=SM(t,n,d,h);try{const y=Se(t),{toolkit:g}=p.transactionMeta,v=e.do(g,...d);return bM(v,y),v}catch(y){throw Jk(c),t.logger.warn("💥","transaction",n,"caught:",y),y}},install:d=>x1(d,e),subject:new Qe},c=Se(t);c.transactions.set(n,o);const u=ko(o);return r||t.on.transactionCreation.next(u),u}var xM=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 Zt({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Zt({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 Zt({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Zt({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Hk(100);molecules=new Map;moleculeJoins=new Zt({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeGraph=new Zt({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Zt({between:["moleculeKey","stateFamilyKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});miscResources=new Map;on={atomCreation:new Qe,atomDisposal:new Qe,selectorCreation:new Qe,selectorDisposal:new Qe,timelineCreation:new Qe,transactionCreation:new Qe,transactionApplying:new Yk(null),operationClose:new Qe,moleculeCreation:new Qe,moleculeDisposal:new Qe};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new Vk("warn",(t,e,n)=>!MM(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.valueMap=new Map(e?.valueMap),this.operation={...e?.operation},gi(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new Zt(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 o=gs(e,r),c=E1(r);n.add(o.key),n.add(c.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 mt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new xM({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function pt(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 Um(e,t)}const wM=(t,e)=>{const n=Se(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)};function TM(t,e,n,r=Qu()){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 Mo(t,e,r,n);case"transaction":return T1(t,e,r,n);case"timeline":return w1(t,e,r,n)}}const sS=(t,e)=>{const n=Se(t);return f1(e,t).map(o=>o.subject.subscribe(`${e.type}:${e.key}`,c=>{t.logger.info("📢",e.type,e.key,"root",o.key,"went",c.oldValue,"->",c.newValue);const u=wM(n,e),d=Wu(n,e);t.logger.info("✨",e.type,e.key,"went",u,"->",d),e.subject.next({newValue:d,oldValue:u})}))};function Mo(t,e,n,r){function o(g){if(t.operation.open){const v=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{v(),r(g)})}else r(g)}const c=pt(t,e);t.logger.info("👀",c.type,c.key,`Adding subscription "${n}"`);const u=c.type==="writable_pure_selector"||c.type==="readonly_pure_selector";let d=null,h=o;u&&(d=sS(t,c),h=g=>{d&&(d.length=0,d.push(...sS(t,c))),o(g)});const p=c.subject.subscribe(n,h);return()=>{if(t.logger.info("🙈",c.type,c.key,`Removing subscription "${n}"`),p(),d)for(const g of d)g()}}const w1=(t,e,n,r)=>{const o=pt(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),c()}},T1=(t,e,n,r)=>{const o=pt(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const c=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),c()}};var Xm=class{initializeState(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,o=rf(e,{key:n,default:null},r);if(e.parent?.valueMap.has(n)){const c=e.parent.valueMap.get(n);e.valueMap.set(n,c)}return o}unsubscribeFromInnerValue;unsubscribeFromState;observeCore(t,e,n){const r=`tracker:${n.config.name}:${Gt(n)?n.transactionMeta.update.key:"main"}:${t.key}`,o=zn(n,t);this.unsubscribeFromInnerValue=o.subscribe(r,c=>{Tt(n,e,c)}),this.unsubscribeFromState=Mo(n,t,r,c=>{c.newValue!==c.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=c.newValue.subscribe(r,u=>{Tt(n,e,u)}))})}updateCore(t,e,n){const r=`tracker:${n.config.name}:${Gt(n)?n.transactionMeta.update.key:"main"}:${t.key}`;Mo(n,e,r,({newValue:o,oldValue:c})=>{const u=n.timelineTopics.getRelatedKey(e.key);if(u&&n.timelines.get(u)?.timeTraveling){const p=w1(n,{key:u,type:"timeline"},r,y=>{p(),Tt(n,t,g=>(y==="redo"&&o?g.do(o):y==="undo"&&c&&g.undo(c),g))});return}const d=n.on.operationClose.subscribe(r,()=>{d();const h=zn(n,t),p=o===null?-1:h.getUpdateNumber(o),y=p-h.cacheUpdateNumber;o&&y===1?Tt(n,t,g=>(g.do(o),g)):n.logger.info("❌","mutable_atom",t.key,`could not be updated. Expected update number ${h.cacheUpdateNumber+1}, but got ${p}`)})})}mutableState;latestUpdateState;[Symbol.dispose];constructor(t,e){this.mutableState=t;const n=Se(e);this.latestUpdateState=this.initializeState(t,n),this.observeCore(t,this.latestUpdateState,n),this.updateCore(t,this.latestUpdateState,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function Zm(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const r=Se(t),{key:o,default:c}=e,u=r.atoms.get(o),d="mutable_atom";if(u&&u.type===d)return t.logger.error("❌",d,o,"Tried to create atom, but it already exists in the store."),ko(u);const h=new Qe,p={...e,type:d,install:v=>(v.logger.info("🛠️","atom",o,`installing in store "${v.config.name}"`),Zm(v,e,n)),subject:h};n&&(p.family=n);const y=c();r.atoms.set(p.key,p),hi(r,o,y,h);const g=ko(p);if(e.effects){let v=0;const S=[];for(const w of e.effects){const T=w({resetSelf:()=>{nf(t,g)},setSelf:D=>{Tt(t,g,D)},onSet:D=>Mo(t,g,`effect[${v}]`,D)});T&&S.push(T),++v}p.cleanup=()=>{for(const w of S)w()}}return new Xm(g,t),n||Nk(g,e,t),g}var AM=class{trackers=new Map;latestUpdateAtoms;mutableAtoms;constructor(t,e){const n=Pm(e,{key:`*${t.key}`,default:null},["mutable","updates"]);this.latestUpdateAtoms=pt(e,n),this.mutableAtoms=t,this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,r=>{const{type:o,token:c}=r;if(c.family){const u=$r(c.family.subKey);switch(o){case"state_creation":this.trackers.set(u,new Xm(c,e));break;case"state_disposal":{const d=this.trackers.get(u);d&&(d[Symbol.dispose](),this.trackers.delete(u))}break}}})}};function A1(t,e,n){const r={key:e.key,type:"mutable_atom_family"},o=t.families.get(e.key);o&&t.logger.error("❗","mutable_atom_family",e.key,`Overwriting an existing ${ys(o)} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const c=new Qe,d=Object.assign(h=>{const p=Je(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=Se(t),S={key:g,default:()=>e.default(h),toJson:e.toJson,fromJson:e.fromJson,mutable:!0};e.effects&&(S.effects=e.effects(h));const w=Zm(v,S,y);return c.next({type:"state_creation",token:w}),w},r,{subject:c,install:h=>A1(h,e),toJson:e.toJson,fromJson:e.fromJson,internalRoles:n});return t.families.set(e.key,d),$k(t,d,e),new AM(d,t),r}const oS=(t,e)=>{const n=Se(e),r=`${t.key}:JSON`;return n.families.get(r)},gs=(t,e)=>{if(e.family){const r=Se(t),c={key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"},u=pt(r,c),d=JSON.parse(e.family.subKey);return Lt(t,u,d)}return{type:"writable_pure_selector",key:`${e.key}:JSON`}},E1=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function EM(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t}function $p(t,e,n){const r=n.valueMap.get(e.key),o=t.valueMap.get(e.key);if(r!==o)return o;if(r===void 0)return e.default();n.logger.info("📃","atom",e.key,"copying");const c=e.toJson(r),u=e.fromJson(c);return t.valueMap.set(e.key,u),new Xm(e,n),u}function hi(t,e,n,r){const o=t.valueMap.get(e);if(o instanceof Cp){const c=o;return n instanceof Promise?(c.use(n),c):(t.valueMap.set(e,n),n)}if(n instanceof Promise){const c=new Cp(n);return t.valueMap.set(e,c),c.then(u=>{if(t.valueMap.get(e)===c){hi(t,e,u,r);const h=t.atoms.get(e);if(h)Eu(t,h),Dp(t,h),Ru(t);else{const p=t.writableSelectors.get(e)??t.readonlySelectors.get(e);p&&(Eu(t,p),Zk(t,p),Ru(t))}r.next({newValue:u,oldValue:c})}}).catch(u=>{t.logger.error("💥","state",e,"rejected:",u)}),c}return t.valueMap.set(e,n),n}const RM=(t,e)=>{let n=e.valueMap.get(t.key);if(t.type==="mutable_atom"&&Gt(e)){const{parent:r}=e;n=$p(e,t,r)}return n},R1=(t,e)=>{const n=e.valueMap.get(t);if(n instanceof Cp){const r=n,o=e.writableSelectors.get(t)??e.readonlySelectors.get(t);o&&r.use(o.get());return}e.operation.open&&e.operation.prev.set(t,n),e.valueMap.delete(t),e.logger.info("🗑","state",t,"evicted")};function rf(t,e,n){const r="atom",{key:o,default:c}=e;t.logger.info("🔨","atom",o,`creating in store "${t.config.name}"`);const u=Se(t),d=u.atoms.get(o);if(d&&d.type===r)return t.logger.error("❌","atom",o,"Tried to create atom, but it already exists in the store."),ko(d);const h=new Qe,p={...e,type:r,install:v=>(v.logger.info("🛠️",r,o,`installing in store "${v.config.name}"`),rf(v,e,n)),subject:h};n&&(p.family=n);let y=c;c instanceof Function&&(y=c()),u.atoms.set(o,p),hi(u,o,y,h);const g=ko(p);if(e.effects){let v=0;const S=[];for(const w of e.effects){const T=w({resetSelf:()=>{nf(t,g)},setSelf:D=>{Tt(t,g,D)},onSet:D=>Mo(t,g,`effect[${v}]`,D)});T&&S.push(T),++v}p.cleanup=()=>{for(const w of S)w()}}return g}function OM(t,e){if("mutable"in e){const o=Zm(t,e,void 0);return t.on.atomCreation.next(o),o}const r=rf(t,e,void 0);return t.on.atomCreation.next(r),r}function Qm(t,e){const n=Se(t),{key:r,family:o}=e,c=pt(n,e);if(!o)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{c.cleanup?.();const u=t.valueMap.get(c.key),d=pt(t,{key:o.key,type:"atom_family"}),h={type:"state_disposal",subType:"atom",token:e,value:u};d.subject.next(h);const p=Gt(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),t.timelineTopics.delete(r),e.type==="mutable_atom"){const y=E1(e);Qm(t,y),t.trackers.delete(r)}if(t.logger.info("🔥","atom",r,"deleted"),p&&n.transactionMeta.phase==="building"){const y=n.transactionMeta.update.updates.at(-1);y?.type==="molecule_disposal"&&y.values.some(([S])=>S===c.family?.key)||n.transactionMeta.update.updates.push(h)}else t.on.atomDisposal.next(e)}}var O1=class{toolkit;options;defaultContent;molecules=new Map;relations;states;core;transact(t,e){const n=this.toolkit;this.toolkit=t,e(this),this.toolkit=n}store;realm;[Symbol.dispose](){}constructor(t,e,n=mt.STORE){this.store=n,this.realm=new zk(n),this.options=t,this.defaultContent=e,this.store.miscResources.set(`join:${t.key}`,this),this.realm.allocate("root",t.key),this.toolkit={get:(...C)=>zn(n,...C),set:(...C)=>{Tt(n,...C)},find:(...C)=>Lt(n,...C),json:C=>gs(n,C)};const r=t.between[0],o=t.between[1],c=A1(n,{key:`${t.key}/relatedKeys`,default:()=>new _o,mutable:!0,fromJson:C=>_o.fromJSON(C),toJson:C=>C.toJSON()},["join","relations"]);this.core={relatedKeysAtoms:c};const u=({get:C},O)=>C(c,O),d=({set:C},O,J)=>{this.store.molecules.has(Je(O))||this.realm.allocate(t.key,O),C(c,O,G=>G.add(J)),C(c,J,G=>G.add(O))},h=({set:C},O,J)=>{C(c,O,G=>(G.delete(J),G)),C(c,J,G=>(G.delete(O),G))},p=(C,O,J)=>{const{find:G,get:H,set:ie}=C,oe=G(c,O),fe=H(oe);for(const ge of fe)J.includes(ge)||ie(c,ge,Q=>(Q.delete(O),Q));ie(oe,ge=>(ge.transaction(be=>{be.clear();for(const Q of J){const W=u(C,Q),B=W.has(O);if(this.relations.cardinality==="1:n"){const P=[];for(const z of W){if(z===O)continue;const ee=u(C,z);ee.delete(Q),ee.size===0&&P.push(z)}!B&&W.size>0&&W.clear();for(const z of P){const ee=[Q,z].sort(),A=`"${ee[0]}:${ee[1]}"`;this.molecules.delete(A)}}B||W.add(O),be.add(Q)}return!0}),ge))},y=(C,O,J)=>{const{set:G}=C;G(c,O,H=>(H.transaction(ie=>{for(const oe of J)ie.add(oe);return!0}),H));for(const H of J)G(c,H,ie=>(ie.add(O),ie));return!0},g=(C,O,J)=>{const G=u(C,O);return J?G.has(J):G.size>0},v={getRelatedKeys:C=>u(this.toolkit,C),addRelation:(C,O)=>{this.store.moleculeJoins.set(C,t.key),this.store.moleculeJoins.set(O,t.key),d(this.toolkit,C,O)},deleteRelation:(C,O)=>{h(this.toolkit,C,O)},replaceRelationsSafely:(C,O)=>{p(this.toolkit,C,O)},replaceRelationsUnsafely:(C,O)=>{y(this.toolkit,C,O)},has:(C,O)=>g(this.toolkit,C,O)};let S,w;if(e){w=Pm(n,{key:`${t.key}/content`,default:e},["join","content"]);const C=({get:G},H)=>G(w,H),O=({set:G},H,ie)=>{G(w,H,ie)};S=Object.assign(v,{getContent:G=>C(this.toolkit,G),setContent:(G,H)=>{O(this.toolkit,G,H)},deleteContent:G=>{this.realm.deallocate(G)}})}else S=v;const T=new Zt(t,{externalStore:S,isAType:t.isAType,isBType:t.isBType,makeContentKey:(...C)=>{const[O,J]=C,G=C.sort(),H=`${G[0]}:${G[1]}`,ie=n.molecules.get(Je(O)),oe=n.molecules.get(Je(J));return ie||this.realm.allocate(t.key,O),oe||this.realm.allocate(t.key,J),this.realm.allocate(O,H,"all"),this.realm.claim(J,H),this.store.moleculeJoins.set(H,t.key),H}}),D=()=>fo(n,{key:`${t.key}/singleRelatedKey`,get:C=>({get:O})=>{const J=O(c,C);for(const G of J)return G;return null}},["join","keys"]),$=()=>fo(n,{key:`${t.key}/multipleRelatedKeys`,get:C=>({get:O})=>{const J=oS(c,n);return O(J,C).members}},["join","keys"]),_=()=>fo(n,{key:`${t.key}/singleRelatedEntry`,get:C=>({get:O})=>{const J=O(c,C);for(const G of J){let H=T.isAType?.(C)?C:void 0,ie=H===void 0?C:void 0;H??=G,ie??=G;const oe=T.makeContentKey(H,ie),fe=O(w,oe);return[G,fe]}return null}},["join","entries"]),k=()=>fo(n,{key:`${t.key}/multipleRelatedEntries`,get:C=>({get:O})=>{const J=oS(c,n);return O(J,C).members.map(H=>{let ie=T.isAType?.(C)?C:void 0,oe=ie===void 0?C:void 0;ie??=H,oe??=H;const fe=T.makeContentKey(ie,oe),ge=O(w,fe);return[H,ge]})}},["join","entries"]);switch(t.cardinality){case"1:1":{const C=D(),O=`${r}KeyOf${an(o)}`,J=`${o}KeyOf${an(r)}`,G={[O]:C,[J]:C};let H;if(e){const ie=_(),oe=`${r}EntryOf${an(o)}`,fe=`${o}EntryOf${an(r)}`,ge={[oe]:ie,[fe]:ie};H=Object.assign(G,ge)}else H=G;this.relations=T,this.states=H;break}case"1:n":{const C=D(),O=$(),J=`${r}KeyOf${an(o)}`,G=`${o}KeysOf${an(r)}`,H={[J]:C,[G]:O};let ie;if(e){const oe=_(),fe=k(),ge=`${r}EntryOf${an(o)}`,be=`${o}EntriesOf${an(r)}`,Q={[ge]:oe,[be]:fe};ie=Object.assign(H,Q)}else ie=H;this.relations=T,this.states=ie;break}case"n:n":{const C=$(),O=`${r}KeysOf${an(o)}`,J=`${o}KeysOf${an(r)}`,G={[O]:C,[J]:C};let H;if(e){const ie=k(),oe=`${r}EntriesOf${an(o)}`,fe=`${o}EntriesOf${an(r)}`,ge={[oe]:ie,[fe]:ie};H=Object.assign(G,ge)}else H=G;this.relations=T,this.states=H}}}};function _M(t,e){let n=e.joins.get(t.key);if(n===void 0){const o=mt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${e.config.name}"`);n=new O1(o.options,o.defaultContent,e),e.joins.set(t.key,n)}return n}function kM(t,e){return _M(t,e).core.relatedKeysAtoms}function MM(t){return t.startsWith("🔍 ")}var Ph={exports:{}},xe={};/**
24
24
  * @license React
25
25
  * react.production.js
26
26
  *
@@ -28,7 +28,7 @@ ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":c
28
28
  *
29
29
  * This source code is licensed under the MIT license found in the
30
30
  * LICENSE file in the root directory of this source tree.
31
- */var oS;function CM(){if(oS)return xe;oS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function v(A){return A===null||typeof A!="object"?null:(A=g&&A[g]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function D(A,I,te){this.props=A,this.context=I,this.refs=T,this.updater=te||S}D.prototype.isReactComponent={},D.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function $(){}$.prototype=D.prototype;function _(A,I,te){this.props=A,this.context=I,this.refs=T,this.updater=te||S}var k=_.prototype=new $;k.constructor=_,w(k,D.prototype),k.isPureReactComponent=!0;var C=Array.isArray,O={H:null,A:null,T:null,S:null,V:null},J=Object.prototype.hasOwnProperty;function G(A,I,te,X,se,ue){return te=ue.ref,{$$typeof:t,type:A,key:I,ref:te!==void 0?te:null,props:ue}}function H(A,I){return G(A.type,I,void 0,void 0,void 0,A.props)}function ie(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function oe(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(te){return I[te]})}var fe=/\/+/g;function ge(A,I){return typeof A=="object"&&A!==null&&A.key!=null?oe(""+A.key):I.toString(36)}function be(){}function Q(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(be,be):(A.status="pending",A.then(function(I){A.status==="pending"&&(A.status="fulfilled",A.value=I)},function(I){A.status==="pending"&&(A.status="rejected",A.reason=I)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function W(A,I,te,X,se){var ue=typeof A;(ue==="undefined"||ue==="boolean")&&(A=null);var le=!1;if(A===null)le=!0;else switch(ue){case"bigint":case"string":case"number":le=!0;break;case"object":switch(A.$$typeof){case t:case e:le=!0;break;case y:return le=A._init,W(le(A._payload),I,te,X,se)}}if(le)return se=se(A),le=X===""?"."+ge(A,0):X,C(se)?(te="",le!=null&&(te=le.replace(fe,"$&/")+"/"),W(se,I,te,"",function(wn){return wn})):se!=null&&(ie(se)&&(se=H(se,te+(se.key==null||A&&A.key===se.key?"":(""+se.key).replace(fe,"$&/")+"/")+le)),I.push(se)),1;le=0;var rt=X===""?".":X+":";if(C(A))for(var Ve=0;Ve<A.length;Ve++)X=A[Ve],ue=rt+ge(X,Ve),le+=W(X,I,te,ue,se);else if(Ve=v(A),typeof Ve=="function")for(A=Ve.call(A),Ve=0;!(X=A.next()).done;)X=X.value,ue=rt+ge(X,Ve++),le+=W(X,I,te,ue,se);else if(ue==="object"){if(typeof A.then=="function")return W(Q(A),I,te,X,se);throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return le}function B(A,I,te){if(A==null)return A;var X=[],se=0;return W(A,X,"","",function(ue){return I.call(te,ue,se++)}),X}function P(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(te){(A._status===0||A._status===-1)&&(A._status=1,A._result=te)},function(te){(A._status===0||A._status===-1)&&(A._status=2,A._result=te)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var z=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function ee(){}return xe.Children={map:B,forEach:function(A,I,te){B(A,function(){I.apply(this,arguments)},te)},count:function(A){var I=0;return B(A,function(){I++}),I},toArray:function(A){return B(A,function(I){return I})||[]},only:function(A){if(!ie(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},xe.Component=D,xe.Fragment=n,xe.Profiler=o,xe.PureComponent=_,xe.StrictMode=r,xe.Suspense=h,xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,xe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return O.H.useMemoCache(A)}},xe.cache=function(A){return function(){return A.apply(null,arguments)}},xe.cloneElement=function(A,I,te){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var X=w({},A.props),se=A.key,ue=void 0;if(I!=null)for(le in I.ref!==void 0&&(ue=void 0),I.key!==void 0&&(se=""+I.key),I)!J.call(I,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&I.ref===void 0||(X[le]=I[le]);var le=arguments.length-2;if(le===1)X.children=te;else if(1<le){for(var rt=Array(le),Ve=0;Ve<le;Ve++)rt[Ve]=arguments[Ve+2];X.children=rt}return G(A.type,se,void 0,void 0,ue,X)},xe.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},xe.createElement=function(A,I,te){var X,se={},ue=null;if(I!=null)for(X in I.key!==void 0&&(ue=""+I.key),I)J.call(I,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(se[X]=I[X]);var le=arguments.length-2;if(le===1)se.children=te;else if(1<le){for(var rt=Array(le),Ve=0;Ve<le;Ve++)rt[Ve]=arguments[Ve+2];se.children=rt}if(A&&A.defaultProps)for(X in le=A.defaultProps,le)se[X]===void 0&&(se[X]=le[X]);return G(A,ue,void 0,void 0,null,se)},xe.createRef=function(){return{current:null}},xe.forwardRef=function(A){return{$$typeof:d,render:A}},xe.isValidElement=ie,xe.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:P}},xe.memo=function(A,I){return{$$typeof:p,type:A,compare:I===void 0?null:I}},xe.startTransition=function(A){var I=O.T,te={};O.T=te;try{var X=A(),se=O.S;se!==null&&se(te,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(ee,z)}catch(ue){z(ue)}finally{O.T=I}},xe.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},xe.use=function(A){return O.H.use(A)},xe.useActionState=function(A,I,te){return O.H.useActionState(A,I,te)},xe.useCallback=function(A,I){return O.H.useCallback(A,I)},xe.useContext=function(A){return O.H.useContext(A)},xe.useDebugValue=function(){},xe.useDeferredValue=function(A,I){return O.H.useDeferredValue(A,I)},xe.useEffect=function(A,I,te){var X=O.H;if(typeof te=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return X.useEffect(A,I)},xe.useId=function(){return O.H.useId()},xe.useImperativeHandle=function(A,I,te){return O.H.useImperativeHandle(A,I,te)},xe.useInsertionEffect=function(A,I){return O.H.useInsertionEffect(A,I)},xe.useLayoutEffect=function(A,I){return O.H.useLayoutEffect(A,I)},xe.useMemo=function(A,I){return O.H.useMemo(A,I)},xe.useOptimistic=function(A,I){return O.H.useOptimistic(A,I)},xe.useReducer=function(A,I,te){return O.H.useReducer(A,I,te)},xe.useRef=function(A){return O.H.useRef(A)},xe.useState=function(A){return O.H.useState(A)},xe.useSyncExternalStore=function(A,I,te){return O.H.useSyncExternalStore(A,I,te)},xe.useTransition=function(){return O.H.useTransition()},xe.version="19.1.1",xe}var aS;function Qm(){return aS||(aS=1,Kh.exports=CM()),Kh.exports}var V=Qm();const $p=kk(V),_1=_k({__proto__:null,default:$p},[V]),Wm=V.createContext(mt.STORE);function k1(t,...e){let n;if(e.length===2){const r=e[0],o=e[1];n=Lt(t,r,o)}else n=e[0];return n}function Yn(...t){const e=V.useContext(Wm),n=k1(e,...t),r=V.useRef(null);return r.current??=o=>{Tt(e,n,o)},r.current}function xt(...t){const e=V.useContext(Wm),n=k1(e,...t),r=V.useId();return V.useSyncExternalStore(o=>Mo(e,n,`use-o:${r}`,o),()=>zn(e,n),()=>zn(e,n))}const M1=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:c})=>{const u=t.getItem(r);u!=null&&o(n(u)),c(({newValue:d})=>{if(d==null){t.removeItem(r);return}t.setItem(r,e(d))})},DM=(t,e,n,r,o)=>c=>{function u(h,p){if(t.logger.info("🧑‍⚖️","continuity",e,"reconciling updates"),Tt(t,fu,g=>(g.shift(),g)),h.id===p.id){const g=JSON.stringify(h.updates),v=JSON.stringify(p.updates);if(g===v){t.logger.info("✅","continuity",e,`results for ${h.id} match between client and server`),n.emit(`ack:${e}`,p.epoch);return}}else t.logger.info("❌","continuity",e,`thought update #${p.epoch} was ${h.key}:${h.id}, but it was actually ${p.key}:${p.id}`);t.logger.info("🧑‍⚖️","continuity",e,"updates do not match",h,p);const y=r.toReversed();for(const g of y)ho("oldValue",g,t);t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),ho("oldValue",h,t),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),ho("newValue",p,t),t.logger.info("⏩","continuity",e,"applied confirmed update",p),n.emit(`ack:${e}`,p.epoch);for(const g of r){const v={type:"transaction",key:g.key},{id:S,params:w}=g;Um(t,v,S)(...w)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑‍⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:c,confirmedUpdates:o,optimisticUpdates:r});const d=r[0];if(d)if(t.logger.info("🧑‍⚖️","continuity",e,"has optimistic updates to reconcile"),c.epoch===d.epoch){t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${c.epoch} matches zeroth optimistic update`),u(d,c);for(const h of o){const p=r[0];if(h.epoch===p?.epoch)u(p,h);else break}}else t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${c.epoch} does not match zeroth optimistic update #${d.epoch}`),o.some(p=>p.epoch===c.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",c),Tt(t,jp,p=>(p.push(c),p.sort((y,g)=>y.epoch-g.epoch),p)));else{t.logger.info("🧑‍⚖️","continuity",e,"has no optimistic updates to deal with");const h=gi(t);let p;h&&(p=v1(t,e)),p===c.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${c.epoch} (${c.key} ${c.id})`),ho("newValue",c,t),n.emit(`ack:${e}`,c.epoch),Ym(t,e,c.epoch)):h&&p!==void 0&&(t.logger.info("🧑‍⚖️","continuity",e,`received update #${c.epoch} but still waiting for update #${p+1}`,{clientEpoch:p,serverEpoch:c.epoch}),o.some(g=>g.epoch===c.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${c.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${c.epoch} to queue`),Tt(t,jp,g=>(g.push(c),g.sort((v,S)=>v.epoch-S.epoch),g))))}};function NM(t){return e=>{for(const n of e)Zm(t,n)}}function $M(t){return e=>{let n=0,r,o;for(const c of e)n%2===0?r=c:(o=c,Tt(t,r,o)),n++}}const C1=et({key:"mySocketId__INTERNAL",default:void 0});yi({key:"mySocketId",get:({get:t})=>t(C1)});et({key:"myName",default:null,effects:typeof window>"u"?[]:[M1(window.localStorage,JSON,"myUsername")]});const fu=et({key:"updateQueue",default:[]}),jp=et({key:"serverConfirmedUpdateQueue",default:[]});function jM(t,e,n){const r=n.key,o=zn(t,fu),c=zn(t,jp),u=(g,v)=>{e.off(`continuity-init:${r}`,u);let S=0,w,T;for(const D of v)S%2===0?w=D:(T=D,"type"in w&&w.type==="mutable_atom"&&(w=gs(t,w)),Tt(t,w,T)),S++;Ym(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,u);const d=DM(t,r,e,o,c);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,d);const h=n.actions.map(g=>(S1(t,r,g.key),T1(t,g,`tx-run:${r}`,S=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const w=o.findIndex(T=>T.id===S.id);w===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),Tt(t,fu,T=>(T.push(S),T.sort((D,$)=>D.epoch-$.epoch),T))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${w}`),Tt(t,fu,T=>(T[w]=S,T))),e.emit(`tx-run:${r}`,{id:S.id,key:g.key,params:S.params})}))),p=$M(t),y=NM(t);return e.on(`reveal:${r}`,p),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{NODE_ENV:BM}=globalThis.env??{},LM=BM==="development";function Jc(){}function VM(t,e){if(LM){const n=V.useRef(Jc);V.useEffect(()=>{let r=n.current;if(r===Jc)r=t()??Jc,n.current=r;else return()=>{r(),n.current=Jc}},e)}else V.useEffect(t,e)}function _u(t){VM(t,[])}const D1=V.createContext({socket:null,services:null}),UM=({children:t,socket:e})=>{const n=V.useRef(new Map).current,r=Yn(C1);return V.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),Y.jsx(D1.Provider,{value:{socket:e,services:n},children:t})};function zM(t,e){const{socket:n,services:r}=V.useContext(D1);_u(()=>{let o=r?.get(t);return o?o[0]++:(o=[1,n?e(n):void 0],r?.set(t,o)),()=>{o&&(o[0]--,o[0]===0&&(o[1]?.(),r?.delete(t)))}})}function KM(t){const e=V.useContext(Wm);zM(`tx-sync:${t.key}`,n=>jM(e,n,t))}var Ph={exports:{}},Ga={},qh={exports:{}},Ih={};/**
31
+ */var aS;function CM(){if(aS)return xe;aS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),g=Symbol.iterator;function v(A){return A===null||typeof A!="object"?null:(A=g&&A[g]||A["@@iterator"],typeof A=="function"?A:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function D(A,I,te){this.props=A,this.context=I,this.refs=T,this.updater=te||S}D.prototype.isReactComponent={},D.prototype.setState=function(A,I){if(typeof A!="object"&&typeof A!="function"&&A!=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,A,I,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function $(){}$.prototype=D.prototype;function _(A,I,te){this.props=A,this.context=I,this.refs=T,this.updater=te||S}var k=_.prototype=new $;k.constructor=_,w(k,D.prototype),k.isPureReactComponent=!0;var C=Array.isArray,O={H:null,A:null,T:null,S:null,V:null},J=Object.prototype.hasOwnProperty;function G(A,I,te,X,se,ue){return te=ue.ref,{$$typeof:t,type:A,key:I,ref:te!==void 0?te:null,props:ue}}function H(A,I){return G(A.type,I,void 0,void 0,void 0,A.props)}function ie(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function oe(A){var I={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(te){return I[te]})}var fe=/\/+/g;function ge(A,I){return typeof A=="object"&&A!==null&&A.key!=null?oe(""+A.key):I.toString(36)}function be(){}function Q(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(be,be):(A.status="pending",A.then(function(I){A.status==="pending"&&(A.status="fulfilled",A.value=I)},function(I){A.status==="pending"&&(A.status="rejected",A.reason=I)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function W(A,I,te,X,se){var ue=typeof A;(ue==="undefined"||ue==="boolean")&&(A=null);var le=!1;if(A===null)le=!0;else switch(ue){case"bigint":case"string":case"number":le=!0;break;case"object":switch(A.$$typeof){case t:case e:le=!0;break;case y:return le=A._init,W(le(A._payload),I,te,X,se)}}if(le)return se=se(A),le=X===""?"."+ge(A,0):X,C(se)?(te="",le!=null&&(te=le.replace(fe,"$&/")+"/"),W(se,I,te,"",function(wn){return wn})):se!=null&&(ie(se)&&(se=H(se,te+(se.key==null||A&&A.key===se.key?"":(""+se.key).replace(fe,"$&/")+"/")+le)),I.push(se)),1;le=0;var rt=X===""?".":X+":";if(C(A))for(var Ve=0;Ve<A.length;Ve++)X=A[Ve],ue=rt+ge(X,Ve),le+=W(X,I,te,ue,se);else if(Ve=v(A),typeof Ve=="function")for(A=Ve.call(A),Ve=0;!(X=A.next()).done;)X=X.value,ue=rt+ge(X,Ve++),le+=W(X,I,te,ue,se);else if(ue==="object"){if(typeof A.then=="function")return W(Q(A),I,te,X,se);throw I=String(A),Error("Objects are not valid as a React child (found: "+(I==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":I)+"). If you meant to render a collection of children, use an array instead.")}return le}function B(A,I,te){if(A==null)return A;var X=[],se=0;return W(A,X,"","",function(ue){return I.call(te,ue,se++)}),X}function P(A){if(A._status===-1){var I=A._result;I=I(),I.then(function(te){(A._status===0||A._status===-1)&&(A._status=1,A._result=te)},function(te){(A._status===0||A._status===-1)&&(A._status=2,A._result=te)}),A._status===-1&&(A._status=0,A._result=I)}if(A._status===1)return A._result.default;throw A._result}var z=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var I=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(I))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function ee(){}return xe.Children={map:B,forEach:function(A,I,te){B(A,function(){I.apply(this,arguments)},te)},count:function(A){var I=0;return B(A,function(){I++}),I},toArray:function(A){return B(A,function(I){return I})||[]},only:function(A){if(!ie(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},xe.Component=D,xe.Fragment=n,xe.Profiler=o,xe.PureComponent=_,xe.StrictMode=r,xe.Suspense=h,xe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,xe.__COMPILER_RUNTIME={__proto__:null,c:function(A){return O.H.useMemoCache(A)}},xe.cache=function(A){return function(){return A.apply(null,arguments)}},xe.cloneElement=function(A,I,te){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var X=w({},A.props),se=A.key,ue=void 0;if(I!=null)for(le in I.ref!==void 0&&(ue=void 0),I.key!==void 0&&(se=""+I.key),I)!J.call(I,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&I.ref===void 0||(X[le]=I[le]);var le=arguments.length-2;if(le===1)X.children=te;else if(1<le){for(var rt=Array(le),Ve=0;Ve<le;Ve++)rt[Ve]=arguments[Ve+2];X.children=rt}return G(A.type,se,void 0,void 0,ue,X)},xe.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:c,_context:A},A},xe.createElement=function(A,I,te){var X,se={},ue=null;if(I!=null)for(X in I.key!==void 0&&(ue=""+I.key),I)J.call(I,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(se[X]=I[X]);var le=arguments.length-2;if(le===1)se.children=te;else if(1<le){for(var rt=Array(le),Ve=0;Ve<le;Ve++)rt[Ve]=arguments[Ve+2];se.children=rt}if(A&&A.defaultProps)for(X in le=A.defaultProps,le)se[X]===void 0&&(se[X]=le[X]);return G(A,ue,void 0,void 0,null,se)},xe.createRef=function(){return{current:null}},xe.forwardRef=function(A){return{$$typeof:d,render:A}},xe.isValidElement=ie,xe.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:P}},xe.memo=function(A,I){return{$$typeof:p,type:A,compare:I===void 0?null:I}},xe.startTransition=function(A){var I=O.T,te={};O.T=te;try{var X=A(),se=O.S;se!==null&&se(te,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(ee,z)}catch(ue){z(ue)}finally{O.T=I}},xe.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},xe.use=function(A){return O.H.use(A)},xe.useActionState=function(A,I,te){return O.H.useActionState(A,I,te)},xe.useCallback=function(A,I){return O.H.useCallback(A,I)},xe.useContext=function(A){return O.H.useContext(A)},xe.useDebugValue=function(){},xe.useDeferredValue=function(A,I){return O.H.useDeferredValue(A,I)},xe.useEffect=function(A,I,te){var X=O.H;if(typeof te=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return X.useEffect(A,I)},xe.useId=function(){return O.H.useId()},xe.useImperativeHandle=function(A,I,te){return O.H.useImperativeHandle(A,I,te)},xe.useInsertionEffect=function(A,I){return O.H.useInsertionEffect(A,I)},xe.useLayoutEffect=function(A,I){return O.H.useLayoutEffect(A,I)},xe.useMemo=function(A,I){return O.H.useMemo(A,I)},xe.useOptimistic=function(A,I){return O.H.useOptimistic(A,I)},xe.useReducer=function(A,I,te){return O.H.useReducer(A,I,te)},xe.useRef=function(A){return O.H.useRef(A)},xe.useState=function(A){return O.H.useState(A)},xe.useSyncExternalStore=function(A,I,te){return O.H.useSyncExternalStore(A,I,te)},xe.useTransition=function(){return O.H.useTransition()},xe.version="19.1.1",xe}var lS;function Wm(){return lS||(lS=1,Ph.exports=CM()),Ph.exports}var V=Wm();const jp=kk(V),_1=_k({__proto__:null,default:jp},[V]),ey=V.createContext(mt.STORE);function k1(t,...e){let n;if(e.length===2){const r=e[0],o=e[1];n=Lt(t,r,o)}else n=e[0];return n}function Yn(...t){const e=V.useContext(ey),n=k1(e,...t),r=V.useRef(null);return r.current??=o=>{Tt(e,n,o)},r.current}function xt(...t){const e=V.useContext(ey),n=k1(e,...t),r=V.useId();return V.useSyncExternalStore(o=>Mo(e,n,`use-o:${r}`,o),()=>zn(e,n),()=>zn(e,n))}const M1=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:c})=>{const u=t.getItem(r);u!=null&&o(n(u)),c(({newValue:d})=>{if(d==null){t.removeItem(r);return}t.setItem(r,e(d))})},DM=(t,e,n,r,o)=>c=>{function u(h,p){if(t.logger.info("🧑‍⚖️","continuity",e,"reconciling updates"),Tt(t,fu,g=>(g.shift(),g)),h.id===p.id){const g=JSON.stringify(h.updates),v=JSON.stringify(p.updates);if(g===v){t.logger.info("✅","continuity",e,`results for ${h.id} match between client and server`),n.emit(`ack:${e}`,p.epoch);return}}else t.logger.info("❌","continuity",e,`thought update #${p.epoch} was ${h.key}:${h.id}, but it was actually ${p.key}:${p.id}`);t.logger.info("🧑‍⚖️","continuity",e,"updates do not match",h,p);const y=r.toReversed();for(const g of y)ho("oldValue",g,t);t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),ho("oldValue",h,t),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),ho("newValue",p,t),t.logger.info("⏩","continuity",e,"applied confirmed update",p),n.emit(`ack:${e}`,p.epoch);for(const g of r){const v={type:"transaction",key:g.key},{id:S,params:w}=g;zm(t,v,S)(...w)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑‍⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:c,confirmedUpdates:o,optimisticUpdates:r});const d=r[0];if(d)if(t.logger.info("🧑‍⚖️","continuity",e,"has optimistic updates to reconcile"),c.epoch===d.epoch){t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${c.epoch} matches zeroth optimistic update`),u(d,c);for(const h of o){const p=r[0];if(h.epoch===p?.epoch)u(p,h);else break}}else t.logger.info("🧑‍⚖️","continuity",e,`epoch of confirmed update #${c.epoch} does not match zeroth optimistic update #${d.epoch}`),o.some(p=>p.epoch===c.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",c),Tt(t,Bp,p=>(p.push(c),p.sort((y,g)=>y.epoch-g.epoch),p)));else{t.logger.info("🧑‍⚖️","continuity",e,"has no optimistic updates to deal with");const h=gi(t);let p;h&&(p=v1(t,e)),p===c.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${c.epoch} (${c.key} ${c.id})`),ho("newValue",c,t),n.emit(`ack:${e}`,c.epoch),Jm(t,e,c.epoch)):h&&p!==void 0&&(t.logger.info("🧑‍⚖️","continuity",e,`received update #${c.epoch} but still waiting for update #${p+1}`,{clientEpoch:p,serverEpoch:c.epoch}),o.some(g=>g.epoch===c.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${c.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${c.epoch} to queue`),Tt(t,Bp,g=>(g.push(c),g.sort((v,S)=>v.epoch-S.epoch),g))))}};function NM(t){return e=>{for(const n of e)Qm(t,n)}}function $M(t){return e=>{let n=0,r,o;for(const c of e)n%2===0?r=c:(o=c,Tt(t,r,o)),n++}}const C1=et({key:"mySocketId__INTERNAL",default:void 0});yi({key:"mySocketId",get:({get:t})=>t(C1)});et({key:"myName",default:null,effects:typeof window>"u"?[]:[M1(window.localStorage,JSON,"myUsername")]});const fu=et({key:"updateQueue",default:[]}),Bp=et({key:"serverConfirmedUpdateQueue",default:[]});function jM(t,e,n){const r=n.key,o=zn(t,fu),c=zn(t,Bp),u=(g,v)=>{e.off(`continuity-init:${r}`,u);let S=0,w,T;for(const D of v)S%2===0?w=D:(T=D,"type"in w&&w.type==="mutable_atom"&&(w=gs(t,w)),Tt(t,w,T)),S++;Jm(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,u);const d=DM(t,r,e,o,c);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,d);const h=n.actions.map(g=>(S1(t,r,g.key),T1(t,g,`tx-run:${r}`,S=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const w=o.findIndex(T=>T.id===S.id);w===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),Tt(t,fu,T=>(T.push(S),T.sort((D,$)=>D.epoch-$.epoch),T))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${w}`),Tt(t,fu,T=>(T[w]=S,T))),e.emit(`tx-run:${r}`,{id:S.id,key:g.key,params:S.params})}))),p=$M(t),y=NM(t);return e.on(`reveal:${r}`,p),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{NODE_ENV:BM}=globalThis.env??{},LM=BM==="development";function Jc(){}function VM(t,e){if(LM){const n=V.useRef(Jc);V.useEffect(()=>{let r=n.current;if(r===Jc)r=t()??Jc,n.current=r;else return()=>{r(),n.current=Jc}},e)}else V.useEffect(t,e)}function _u(t){VM(t,[])}const D1=V.createContext({socket:null,services:null}),UM=({children:t,socket:e})=>{const n=V.useRef(new Map).current,r=Yn(C1);return V.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),Y.jsx(D1.Provider,{value:{socket:e,services:n},children:t})};function zM(t,e){const{socket:n,services:r}=V.useContext(D1);_u(()=>{let o=r?.get(t);return o?o[0]++:(o=[1,n?e(n):void 0],r?.set(t,o)),()=>{o&&(o[0]--,o[0]===0&&(o[1]?.(),r?.delete(t)))}})}function KM(t){const e=V.useContext(ey);zM(`tx-sync:${t.key}`,n=>jM(e,n,t))}var qh={exports:{}},Ga={},Ih={exports:{}},Hh={};/**
32
32
  * @license React
33
33
  * scheduler.production.js
34
34
  *
@@ -36,7 +36,7 @@ ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":c
36
36
  *
37
37
  * This source code is licensed under the MIT license found in the
38
38
  * LICENSE file in the root directory of this source tree.
39
- */var lS;function PM(){return lS||(lS=1,function(t){function e(B,P){var z=B.length;B.push(P);e:for(;0<z;){var ee=z-1>>>1,A=B[ee];if(0<o(A,P))B[ee]=P,B[z]=A,z=ee;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var P=B[0],z=B.pop();if(z!==P){B[0]=z;e:for(var ee=0,A=B.length,I=A>>>1;ee<I;){var te=2*(ee+1)-1,X=B[te],se=te+1,ue=B[se];if(0>o(X,z))se<A&&0>o(ue,X)?(B[ee]=ue,B[se]=z,ee=se):(B[ee]=X,B[te]=z,ee=te);else if(se<A&&0>o(ue,z))B[ee]=ue,B[se]=z,ee=se;else break e}}return P}function o(B,P){var z=B.sortIndex-P.sortIndex;return z!==0?z:B.id-P.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],p=[],y=1,g=null,v=3,S=!1,w=!1,T=!1,D=!1,$=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function C(B){for(var P=n(p);P!==null;){if(P.callback===null)r(p);else if(P.startTime<=B)r(p),P.sortIndex=P.expirationTime,e(h,P);else break;P=n(p)}}function O(B){if(T=!1,C(B),!w)if(n(h)!==null)w=!0,J||(J=!0,ge());else{var P=n(p);P!==null&&W(O,P.startTime-B)}}var J=!1,G=-1,H=5,ie=-1;function oe(){return D?!0:!(t.unstable_now()-ie<H)}function fe(){if(D=!1,J){var B=t.unstable_now();ie=B;var P=!0;try{e:{w=!1,T&&(T=!1,_(G),G=-1),S=!0;var z=v;try{t:{for(C(B),g=n(h);g!==null&&!(g.expirationTime>B&&oe());){var ee=g.callback;if(typeof ee=="function"){g.callback=null,v=g.priorityLevel;var A=ee(g.expirationTime<=B);if(B=t.unstable_now(),typeof A=="function"){g.callback=A,C(B),P=!0;break t}g===n(h)&&r(h),C(B)}else r(h);g=n(h)}if(g!==null)P=!0;else{var I=n(p);I!==null&&W(O,I.startTime-B),P=!1}}break e}finally{g=null,v=z,S=!1}P=void 0}}finally{P?ge():J=!1}}}var ge;if(typeof k=="function")ge=function(){k(fe)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,Q=be.port2;be.port1.onmessage=fe,ge=function(){Q.postMessage(null)}}else ge=function(){$(fe,0)};function W(B,P){G=$(function(){B(t.unstable_now())},P)}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(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(B){switch(v){case 1:case 2:case 3:var P=3;break;default:P=v}var z=v;v=P;try{return B()}finally{v=z}},t.unstable_requestPaint=function(){D=!0},t.unstable_runWithPriority=function(B,P){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=v;v=B;try{return P()}finally{v=z}},t.unstable_scheduleCallback=function(B,P,z){var ee=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?ee+z:ee):z=ee,B){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=z+A,B={id:y++,callback:P,priorityLevel:B,startTime:z,expirationTime:A,sortIndex:-1},z>ee?(B.sortIndex=z,e(p,B),n(h)===null&&B===n(p)&&(T?(_(G),G=-1):T=!0,W(O,z-ee))):(B.sortIndex=A,e(h,B),w||S||(w=!0,J||(J=!0,ge()))),B},t.unstable_shouldYield=oe,t.unstable_wrapCallback=function(B){var P=v;return function(){var z=v;v=P;try{return B.apply(this,arguments)}finally{v=z}}}}(Ih)),Ih}var cS;function qM(){return cS||(cS=1,qh.exports=PM()),qh.exports}var Hh={exports:{}},Ht={};/**
39
+ */var cS;function PM(){return cS||(cS=1,function(t){function e(B,P){var z=B.length;B.push(P);e:for(;0<z;){var ee=z-1>>>1,A=B[ee];if(0<o(A,P))B[ee]=P,B[z]=A,z=ee;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var P=B[0],z=B.pop();if(z!==P){B[0]=z;e:for(var ee=0,A=B.length,I=A>>>1;ee<I;){var te=2*(ee+1)-1,X=B[te],se=te+1,ue=B[se];if(0>o(X,z))se<A&&0>o(ue,X)?(B[ee]=ue,B[se]=z,ee=se):(B[ee]=X,B[te]=z,ee=te);else if(se<A&&0>o(ue,z))B[ee]=ue,B[se]=z,ee=se;else break e}}return P}function o(B,P){var z=B.sortIndex-P.sortIndex;return z!==0?z:B.id-P.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,d=u.now();t.unstable_now=function(){return u.now()-d}}var h=[],p=[],y=1,g=null,v=3,S=!1,w=!1,T=!1,D=!1,$=typeof setTimeout=="function"?setTimeout:null,_=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function C(B){for(var P=n(p);P!==null;){if(P.callback===null)r(p);else if(P.startTime<=B)r(p),P.sortIndex=P.expirationTime,e(h,P);else break;P=n(p)}}function O(B){if(T=!1,C(B),!w)if(n(h)!==null)w=!0,J||(J=!0,ge());else{var P=n(p);P!==null&&W(O,P.startTime-B)}}var J=!1,G=-1,H=5,ie=-1;function oe(){return D?!0:!(t.unstable_now()-ie<H)}function fe(){if(D=!1,J){var B=t.unstable_now();ie=B;var P=!0;try{e:{w=!1,T&&(T=!1,_(G),G=-1),S=!0;var z=v;try{t:{for(C(B),g=n(h);g!==null&&!(g.expirationTime>B&&oe());){var ee=g.callback;if(typeof ee=="function"){g.callback=null,v=g.priorityLevel;var A=ee(g.expirationTime<=B);if(B=t.unstable_now(),typeof A=="function"){g.callback=A,C(B),P=!0;break t}g===n(h)&&r(h),C(B)}else r(h);g=n(h)}if(g!==null)P=!0;else{var I=n(p);I!==null&&W(O,I.startTime-B),P=!1}}break e}finally{g=null,v=z,S=!1}P=void 0}}finally{P?ge():J=!1}}}var ge;if(typeof k=="function")ge=function(){k(fe)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,Q=be.port2;be.port1.onmessage=fe,ge=function(){Q.postMessage(null)}}else ge=function(){$(fe,0)};function W(B,P){G=$(function(){B(t.unstable_now())},P)}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(B){B.callback=null},t.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):H=0<B?Math.floor(1e3/B):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(B){switch(v){case 1:case 2:case 3:var P=3;break;default:P=v}var z=v;v=P;try{return B()}finally{v=z}},t.unstable_requestPaint=function(){D=!0},t.unstable_runWithPriority=function(B,P){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=v;v=B;try{return P()}finally{v=z}},t.unstable_scheduleCallback=function(B,P,z){var ee=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?ee+z:ee):z=ee,B){case 1:var A=-1;break;case 2:A=250;break;case 5:A=1073741823;break;case 4:A=1e4;break;default:A=5e3}return A=z+A,B={id:y++,callback:P,priorityLevel:B,startTime:z,expirationTime:A,sortIndex:-1},z>ee?(B.sortIndex=z,e(p,B),n(h)===null&&B===n(p)&&(T?(_(G),G=-1):T=!0,W(O,z-ee))):(B.sortIndex=A,e(h,B),w||S||(w=!0,J||(J=!0,ge()))),B},t.unstable_shouldYield=oe,t.unstable_wrapCallback=function(B){var P=v;return function(){var z=v;v=P;try{return B.apply(this,arguments)}finally{v=z}}}}(Hh)),Hh}var uS;function qM(){return uS||(uS=1,Ih.exports=PM()),Ih.exports}var Fh={exports:{}},Ht={};/**
40
40
  * @license React
41
41
  * react-dom.production.js
42
42
  *
@@ -44,7 +44,7 @@ ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":c
44
44
  *
45
45
  * This source code is licensed under the MIT license found in the
46
46
  * LICENSE file in the root directory of this source tree.
47
- */var uS;function IM(){if(uS)return Ht;uS=1;var t=Qm();function e(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" 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},o=Symbol.for("react.portal");function c(h,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:p,implementation:y}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ht.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ht.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(h,p,null,y)},Ht.flushSync=function(h){var p=u.T,y=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=p,r.p=y,r.d.f()}},Ht.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(h,p))},Ht.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Ht.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?r.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:S}):y==="script"&&r.d.X(h,{crossOrigin:g,integrity:v,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ht.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=d(p.as,p.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(h)},Ht.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin);r.d.L(h,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ht.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=d(p.as,p.crossOrigin);r.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(h)},Ht.requestFormReset=function(h){r.d.r(h)},Ht.unstable_batchedUpdates=function(h,p){return h(p)},Ht.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},Ht.useFormStatus=function(){return u.H.useHostTransitionStatus()},Ht.version="19.1.1",Ht}var fS;function N1(){if(fS)return Hh.exports;fS=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(),Hh.exports=IM(),Hh.exports}/**
47
+ */var fS;function IM(){if(fS)return Ht;fS=1;var t=Wm();function e(h){var p="https://react.dev/errors/"+h;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var y=2;y<arguments.length;y++)p+="&args[]="+encodeURIComponent(arguments[y])}return"Minified React error #"+h+"; visit "+p+" 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},o=Symbol.for("react.portal");function c(h,p,y){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:g==null?null:""+g,children:h,containerInfo:p,implementation:y}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function d(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Ht.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Ht.createPortal=function(h,p){var y=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(h,p,null,y)},Ht.flushSync=function(h){var p=u.T,y=r.p;try{if(u.T=null,r.p=2,h)return h()}finally{u.T=p,r.p=y,r.d.f()}},Ht.preconnect=function(h,p){typeof h=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(h,p))},Ht.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},Ht.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin),v=typeof p.integrity=="string"?p.integrity:void 0,S=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;y==="style"?r.d.S(h,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:S}):y==="script"&&r.d.X(h,{crossOrigin:g,integrity:v,fetchPriority:S,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Ht.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=d(p.as,p.crossOrigin);r.d.M(h,{crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(h)},Ht.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=d(y,p.crossOrigin);r.d.L(h,y,{crossOrigin:g,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Ht.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=d(p.as,p.crossOrigin);r.d.m(h,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:y,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(h)},Ht.requestFormReset=function(h){r.d.r(h)},Ht.unstable_batchedUpdates=function(h,p){return h(p)},Ht.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},Ht.useFormStatus=function(){return u.H.useHostTransitionStatus()},Ht.version="19.1.1",Ht}var dS;function N1(){if(dS)return Fh.exports;dS=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(),Fh.exports=IM(),Fh.exports}/**
48
48
  * @license React
49
49
  * react-dom-client.production.js
50
50
  *
@@ -52,59 +52,59 @@ ${u.trace}`:"No previous disposal trace was found."),r.type){case"atom_family":c
52
52
  *
53
53
  * This source code is licensed under the MIT license found in the
54
54
  * LICENSE file in the root directory of this source tree.
55
- */var dS;function HM(){if(dS)return Ga;dS=1;var t=qM(),e=Qm(),n=N1();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}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 o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,a=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(a=s.return),i=s.return;while(i)}return s.tag===3?a:null}function u(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 d(i){if(c(i)!==i)throw Error(r(188))}function h(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,l=s;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return d(f),i;if(m===l)return d(f),s;m=m.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=m;else{for(var b=!1,x=f.child;x;){if(x===a){b=!0,a=f,l=m;break}if(x===l){b=!0,l=f,a=m;break}x=x.sibling}if(!b){for(x=m.child;x;){if(x===a){b=!0,a=m,l=f;break}if(x===l){b=!0,l=m,a=f;break}x=x.sibling}if(!b)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function p(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=p(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),_=Symbol.for("react.consumer"),k=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),fe=Symbol.iterator;function ge(i){return i===null||typeof i!="object"?null:(i=fe&&i[fe]||i["@@iterator"],typeof i=="function"?i:null)}var be=Symbol.for("react.client.reference");function Q(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 w:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case J:return"SuspenseList";case ie:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case k:return(i.displayName||"Context")+".Provider";case _:return(i._context.displayName||"Context")+".Consumer";case C:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case G:return s=i.displayName||null,s!==null?s:Q(i.type)||"Memo";case H:s=i._payload,i=i._init;try{return Q(i(s))}catch{}}return null}var W=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},ee=[],A=-1;function I(i){return{current:i}}function te(i){0>A||(i.current=ee[A],ee[A]=null,A--)}function X(i,s){A++,ee[A]=i.current,i.current=s}var se=I(null),ue=I(null),le=I(null),rt=I(null);function Ve(i,s){switch(X(le,s),X(ue,i),X(se,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?k0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=k0(s),i=M0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(se),X(se,i)}function wn(){te(se),te(ue),te(le)}function Zi(i){i.memoizedState!==null&&X(rt,i);var s=se.current,a=M0(s,i.type);s!==a&&(X(ue,i),X(se,a))}function wi(i){ue.current===i&&(te(se),te(ue)),rt.current===i&&(te(rt),Ka._currentValue=z)}var we=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,tt=t.unstable_shouldYield,Rt=t.unstable_requestPaint,Te=t.unstable_now,Pn=t.unstable_getCurrentPriorityLevel,Jt=t.unstable_ImmediatePriority,Pt=t.unstable_UserBlockingPriority,Tn=t.unstable_NormalPriority,Qn=t.unstable_LowPriority,An=t.unstable_IdlePriority,Wn=t.log,jl=t.unstable_setDisableYieldValue,Jo=null,fn=null;function Qi(i){if(typeof Wn=="function"&&jl(i),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(Jo,i)}catch{}}var dn=Math.clz32?Math.clz32:pO,dO=Math.log,hO=Math.LN2;function pO(i){return i>>>=0,i===0?32:31-(dO(i)/hO|0)|0}var Bl=256,Ll=4194304;function Lr(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:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;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 Vl(i,s,a){var l=i.pendingLanes;if(l===0)return 0;var f=0,m=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var x=l&134217727;return x!==0?(l=x&~m,l!==0?f=Lr(l):(b&=x,b!==0?f=Lr(b):a||(a=x&~i,a!==0&&(f=Lr(a))))):(x=l&~m,x!==0?f=Lr(x):b!==0?f=Lr(b):a||(a=l&~i,a!==0&&(f=Lr(a)))),f===0?0:s!==0&&s!==f&&(s&m)===0&&(m=f&-f,a=s&-s,m>=a||m===32&&(a&4194048)!==0)?s:f}function Xo(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function mO(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 dg(){var i=Bl;return Bl<<=1,(Bl&4194048)===0&&(Bl=256),i}function hg(){var i=Ll;return Ll<<=1,(Ll&62914560)===0&&(Ll=4194304),i}function _f(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function Zo(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function yO(i,s,a,l,f,m){var b=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var x=i.entanglements,E=i.expirationTimes,j=i.hiddenUpdates;for(a=b&~a;0<a;){var K=31-dn(a),F=1<<K;x[K]=0,E[K]=-1;var L=j[K];if(L!==null)for(j[K]=null,K=0;K<L.length;K++){var U=L[K];U!==null&&(U.lane&=-536870913)}a&=~F}l!==0&&pg(i,l,0),m!==0&&f===0&&i.tag!==0&&(i.suspendedLanes|=m&~(b&~s))}function pg(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-dn(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|a&4194090}function mg(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var l=31-dn(a),f=1<<l;f&s|i[l]&s&&(i[l]|=s),a&=~f}}function kf(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 Mf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function yg(){var i=P.p;return i!==0?i:(i=window.event,i===void 0?32:J0(i.type))}function gO(i,s){var a=P.p;try{return P.p=i,s()}finally{P.p=a}}var Wi=Math.random().toString(36).slice(2),qt="__reactFiber$"+Wi,tn="__reactProps$"+Wi,xs="__reactContainer$"+Wi,Cf="__reactEvents$"+Wi,bO="__reactListeners$"+Wi,vO="__reactHandles$"+Wi,gg="__reactResources$"+Wi,Qo="__reactMarker$"+Wi;function Df(i){delete i[qt],delete i[tn],delete i[Cf],delete i[bO],delete i[vO]}function ws(i){var s=i[qt];if(s)return s;for(var a=i.parentNode;a;){if(s=a[xs]||a[qt]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=$0(i);i!==null;){if(a=i[qt])return a;i=$0(i)}return s}i=a,a=i.parentNode}return null}function Ts(i){if(i=i[qt]||i[xs]){var s=i.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return i}return null}function Wo(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function As(i){var s=i[gg];return s||(s=i[gg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ct(i){i[Qo]=!0}var bg=new Set,vg={};function Vr(i,s){Es(i,s),Es(i+"Capture",s)}function Es(i,s){for(vg[i]=s,i=0;i<s.length;i++)bg.add(s[i])}var SO=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]*$"),Sg={},xg={};function xO(i){return we.call(xg,i)?!0:we.call(Sg,i)?!1:SO.test(i)?xg[i]=!0:(Sg[i]=!0,!1)}function Ul(i,s,a){if(xO(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){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,""+a)}}function zl(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+a)}}function Ti(i,s,a,l){if(l===null)i.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,""+l)}}var Nf,wg;function Rs(i){if(Nf===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Nf=s&&s[1]||"",wg=-1<a.stack.indexOf(`
55
+ */var hS;function HM(){if(hS)return Ga;hS=1;var t=qM(),e=Wm(),n=N1();function r(i){var s="https://react.dev/errors/"+i;if(1<arguments.length){s+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)s+="&args[]="+encodeURIComponent(arguments[a])}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 o(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function c(i){var s=i,a=i;if(i.alternate)for(;s.return;)s=s.return;else{i=s;do s=i,(s.flags&4098)!==0&&(a=s.return),i=s.return;while(i)}return s.tag===3?a:null}function u(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 d(i){if(c(i)!==i)throw Error(r(188))}function h(i){var s=i.alternate;if(!s){if(s=c(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,l=s;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(l=f.return,l!==null){a=l;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return d(f),i;if(m===l)return d(f),s;m=m.sibling}throw Error(r(188))}if(a.return!==l.return)a=f,l=m;else{for(var b=!1,x=f.child;x;){if(x===a){b=!0,a=f,l=m;break}if(x===l){b=!0,l=f,a=m;break}x=x.sibling}if(!b){for(x=m.child;x;){if(x===a){b=!0,a=m,l=f;break}if(x===l){b=!0,l=m,a=f;break}x=x.sibling}if(!b)throw Error(r(189))}}if(a.alternate!==l)throw Error(r(190))}if(a.tag!==3)throw Error(r(188));return a.stateNode.current===a?i:s}function p(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i;for(i=i.child;i!==null;){if(s=p(i),s!==null)return s;i=i.sibling}return null}var y=Object.assign,g=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),$=Symbol.for("react.provider"),_=Symbol.for("react.consumer"),k=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),G=Symbol.for("react.memo"),H=Symbol.for("react.lazy"),ie=Symbol.for("react.activity"),oe=Symbol.for("react.memo_cache_sentinel"),fe=Symbol.iterator;function ge(i){return i===null||typeof i!="object"?null:(i=fe&&i[fe]||i["@@iterator"],typeof i=="function"?i:null)}var be=Symbol.for("react.client.reference");function Q(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 w:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case J:return"SuspenseList";case ie:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case k:return(i.displayName||"Context")+".Provider";case _:return(i._context.displayName||"Context")+".Consumer";case C:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case G:return s=i.displayName||null,s!==null?s:Q(i.type)||"Memo";case H:s=i._payload,i=i._init;try{return Q(i(s))}catch{}}return null}var W=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},ee=[],A=-1;function I(i){return{current:i}}function te(i){0>A||(i.current=ee[A],ee[A]=null,A--)}function X(i,s){A++,ee[A]=i.current,i.current=s}var se=I(null),ue=I(null),le=I(null),rt=I(null);function Ve(i,s){switch(X(le,s),X(ue,i),X(se,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?M0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=M0(s),i=C0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(se),X(se,i)}function wn(){te(se),te(ue),te(le)}function Zi(i){i.memoizedState!==null&&X(rt,i);var s=se.current,a=C0(s,i.type);s!==a&&(X(ue,i),X(se,a))}function wi(i){ue.current===i&&(te(se),te(ue)),rt.current===i&&(te(rt),Ka._currentValue=z)}var we=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ee=t.unstable_cancelCallback,tt=t.unstable_shouldYield,Rt=t.unstable_requestPaint,Te=t.unstable_now,Pn=t.unstable_getCurrentPriorityLevel,Jt=t.unstable_ImmediatePriority,Pt=t.unstable_UserBlockingPriority,Tn=t.unstable_NormalPriority,Qn=t.unstable_LowPriority,An=t.unstable_IdlePriority,Wn=t.log,jl=t.unstable_setDisableYieldValue,Jo=null,fn=null;function Qi(i){if(typeof Wn=="function"&&jl(i),fn&&typeof fn.setStrictMode=="function")try{fn.setStrictMode(Jo,i)}catch{}}var dn=Math.clz32?Math.clz32:pO,dO=Math.log,hO=Math.LN2;function pO(i){return i>>>=0,i===0?32:31-(dO(i)/hO|0)|0}var Bl=256,Ll=4194304;function Lr(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:case 262144:case 524288:case 1048576:case 2097152:return i&4194048;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 Vl(i,s,a){var l=i.pendingLanes;if(l===0)return 0;var f=0,m=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var x=l&134217727;return x!==0?(l=x&~m,l!==0?f=Lr(l):(b&=x,b!==0?f=Lr(b):a||(a=x&~i,a!==0&&(f=Lr(a))))):(x=l&~m,x!==0?f=Lr(x):b!==0?f=Lr(b):a||(a=l&~i,a!==0&&(f=Lr(a)))),f===0?0:s!==0&&s!==f&&(s&m)===0&&(m=f&-f,a=s&-s,m>=a||m===32&&(a&4194048)!==0)?s:f}function Xo(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function mO(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 hg(){var i=Bl;return Bl<<=1,(Bl&4194048)===0&&(Bl=256),i}function pg(){var i=Ll;return Ll<<=1,(Ll&62914560)===0&&(Ll=4194304),i}function kf(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function Zo(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function yO(i,s,a,l,f,m){var b=i.pendingLanes;i.pendingLanes=a,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=a,i.entangledLanes&=a,i.errorRecoveryDisabledLanes&=a,i.shellSuspendCounter=0;var x=i.entanglements,E=i.expirationTimes,j=i.hiddenUpdates;for(a=b&~a;0<a;){var K=31-dn(a),F=1<<K;x[K]=0,E[K]=-1;var L=j[K];if(L!==null)for(j[K]=null,K=0;K<L.length;K++){var U=L[K];U!==null&&(U.lane&=-536870913)}a&=~F}l!==0&&mg(i,l,0),m!==0&&f===0&&i.tag!==0&&(i.suspendedLanes|=m&~(b&~s))}function mg(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var l=31-dn(s);i.entangledLanes|=s,i.entanglements[l]=i.entanglements[l]|1073741824|a&4194090}function yg(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var l=31-dn(a),f=1<<l;f&s|i[l]&s&&(i[l]|=s),a&=~f}}function Mf(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 Cf(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function gg(){var i=P.p;return i!==0?i:(i=window.event,i===void 0?32:X0(i.type))}function gO(i,s){var a=P.p;try{return P.p=i,s()}finally{P.p=a}}var Wi=Math.random().toString(36).slice(2),qt="__reactFiber$"+Wi,tn="__reactProps$"+Wi,xs="__reactContainer$"+Wi,Df="__reactEvents$"+Wi,bO="__reactListeners$"+Wi,vO="__reactHandles$"+Wi,bg="__reactResources$"+Wi,Qo="__reactMarker$"+Wi;function Nf(i){delete i[qt],delete i[tn],delete i[Df],delete i[bO],delete i[vO]}function ws(i){var s=i[qt];if(s)return s;for(var a=i.parentNode;a;){if(s=a[xs]||a[qt]){if(a=s.alternate,s.child!==null||a!==null&&a.child!==null)for(i=j0(i);i!==null;){if(a=i[qt])return a;i=j0(i)}return s}i=a,a=i.parentNode}return null}function Ts(i){if(i=i[qt]||i[xs]){var s=i.tag;if(s===5||s===6||s===13||s===26||s===27||s===3)return i}return null}function Wo(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function As(i){var s=i[bg];return s||(s=i[bg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Ct(i){i[Qo]=!0}var vg=new Set,Sg={};function Vr(i,s){Es(i,s),Es(i+"Capture",s)}function Es(i,s){for(Sg[i]=s,i=0;i<s.length;i++)vg.add(s[i])}var SO=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]*$"),xg={},wg={};function xO(i){return we.call(wg,i)?!0:we.call(xg,i)?!1:SO.test(i)?wg[i]=!0:(xg[i]=!0,!1)}function Ul(i,s,a){if(xO(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){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,""+a)}}function zl(i,s,a){if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(s);return}i.setAttribute(s,""+a)}}function Ti(i,s,a,l){if(l===null)i.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,""+l)}}var $f,Tg;function Rs(i){if($f===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);$f=s&&s[1]||"",Tg=-1<a.stack.indexOf(`
56
56
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
57
- `+Nf+i+wg}var $f=!1;function jf(i,s){if(!i||$f)return"";$f=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(U){var L=U}Reflect.construct(i,[],F)}else{try{F.call()}catch(U){L=U}i.call(F.prototype)}}else{try{throw Error()}catch(U){L=U}(F=i())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(U){if(U&&L&&typeof U.stack=="string")return[U.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),b=m[0],x=m[1];if(b&&x){var E=b.split(`
57
+ `+$f+i+Tg}var jf=!1;function Bf(i,s){if(!i||jf)return"";jf=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(s){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(U){var L=U}Reflect.construct(i,[],F)}else{try{F.call()}catch(U){L=U}i.call(F.prototype)}}else{try{throw Error()}catch(U){L=U}(F=i())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(U){if(U&&L&&typeof U.stack=="string")return[U.stack,L.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var f=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");f&&f.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=l.DetermineComponentFrameRoot(),b=m[0],x=m[1];if(b&&x){var E=b.split(`
58
58
  `),j=x.split(`
59
59
  `);for(f=l=0;l<E.length&&!E[l].includes("DetermineComponentFrameRoot");)l++;for(;f<j.length&&!j[f].includes("DetermineComponentFrameRoot");)f++;if(l===E.length||f===j.length)for(l=E.length-1,f=j.length-1;1<=l&&0<=f&&E[l]!==j[f];)f--;for(;1<=l&&0<=f;l--,f--)if(E[l]!==j[f]){if(l!==1||f!==1)do if(l--,f--,0>f||E[l]!==j[f]){var K=`
60
- `+E[l].replace(" at new "," at ");return i.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",i.displayName)),K}while(1<=l&&0<=f);break}}}finally{$f=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?Rs(a):""}function wO(i){switch(i.tag){case 26:case 27:case 5:return Rs(i.type);case 16:return Rs("Lazy");case 13:return Rs("Suspense");case 19:return Rs("SuspenseList");case 0:case 15:return jf(i.type,!1);case 11:return jf(i.type.render,!1);case 1:return jf(i.type,!0);case 31:return Rs("Activity");default:return""}}function Tg(i){try{var s="";do s+=wO(i),i=i.return;while(i);return s}catch(a){return`
60
+ `+E[l].replace(" at new "," at ");return i.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",i.displayName)),K}while(1<=l&&0<=f);break}}}finally{jf=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?Rs(a):""}function wO(i){switch(i.tag){case 26:case 27:case 5:return Rs(i.type);case 16:return Rs("Lazy");case 13:return Rs("Suspense");case 19:return Rs("SuspenseList");case 0:case 15:return Bf(i.type,!1);case 11:return Bf(i.type.render,!1);case 1:return Bf(i.type,!0);case 31:return Rs("Activity");default:return""}}function Ag(i){try{var s="";do s+=wO(i),i=i.return;while(i);return s}catch(a){return`
61
61
  Error generating stack: `+a.message+`
62
- `+a.stack}}function En(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ag(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function TO(i){var s=Ag(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),l=""+i[s];if(!i.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,m=a.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return f.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(i,s,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Kl(i){i._valueTracker||(i._valueTracker=TO(i))}function Eg(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),l="";return i&&(l=Ag(i)?i.checked?"true":"false":i.value),i=l,i!==a?(s.setValue(i),!0):!1}function Pl(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 AO=/[\n"\\]/g;function Rn(i){return i.replace(AO,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Bf(i,s,a,l,f,m,b,x){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),s!=null?b==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+En(s)):i.value!==""+En(s)&&(i.value=""+En(s)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),s!=null?Lf(i,b,En(s)):a!=null?Lf(i,b,En(a)):l!=null&&i.removeAttribute("value"),f==null&&m!=null&&(i.defaultChecked=!!m),f!=null&&(i.checked=f&&typeof f!="function"&&typeof f!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?i.name=""+En(x):i.removeAttribute("name")}function Rg(i,s,a,l,f,m,b,x){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),s!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||s!=null))return;a=a!=null?""+En(a):"",s=s!=null?""+En(s):a,x||s===i.value||(i.value=s),i.defaultValue=s}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=x?i.checked:!!l,i.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b)}function Lf(i,s,a){s==="number"&&Pl(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function Os(i,s,a,l){if(i=i.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=s.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&l&&(i[a].defaultSelected=!0)}else{for(a=""+En(a),s=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,l&&(i[f].defaultSelected=!0);return}s!==null||i[f].disabled||(s=i[f])}s!==null&&(s.selected=!0)}}function Og(i,s,a){if(s!=null&&(s=""+En(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+En(a):""}function _g(i,s,a,l){if(s==null){if(l!=null){if(a!=null)throw Error(r(92));if(W(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),s=a}a=En(s),i.defaultValue=a,l=i.textContent,l===a&&l!==""&&l!==null&&(i.value=l)}function _s(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var EO=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 kg(i,s,a){var l=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,a):typeof a!="number"||a===0||EO.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function Mg(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var f in s)l=s[f],s.hasOwnProperty(f)&&a[f]!==l&&kg(i,f,l)}else for(var m in s)s.hasOwnProperty(m)&&kg(i,m,s[m])}function Vf(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 RO=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"]]),OO=/^[\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 ql(i){return OO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Uf=null;function zf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ks=null,Ms=null;function Cg(i){var s=Ts(i);if(s&&(i=s.stateNode)){var a=i[tn]||null;e:switch(i=s.stateNode,s.type){case"input":if(Bf(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Rn(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var l=a[s];if(l!==i&&l.form===i.form){var f=l[tn]||null;if(!f)throw Error(r(90));Bf(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<a.length;s++)l=a[s],l.form===i.form&&Eg(l)}break e;case"textarea":Og(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Os(i,!!a.multiple,s,!1)}}}var Kf=!1;function Dg(i,s,a){if(Kf)return i(s,a);Kf=!0;try{var l=i(s);return l}finally{if(Kf=!1,(ks!==null||Ms!==null)&&(_c(),ks&&(s=ks,i=Ms,Ms=ks=null,Cg(s),i)))for(s=0;s<i.length;s++)Cg(i[s])}}function ea(i,s){var a=i.stateNode;if(a===null)return null;var l=a[tn]||null;if(l===null)return null;a=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(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Ai=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Pf=!1;if(Ai)try{var ta={};Object.defineProperty(ta,"passive",{get:function(){Pf=!0}}),window.addEventListener("test",ta,ta),window.removeEventListener("test",ta,ta)}catch{Pf=!1}var er=null,qf=null,Il=null;function Ng(){if(Il)return Il;var i,s=qf,a=s.length,l,f="value"in er?er.value:er.textContent,m=f.length;for(i=0;i<a&&s[i]===f[i];i++);var b=a-i;for(l=1;l<=b&&s[a-l]===f[m-l];l++);return Il=f.slice(i,1<l?1-l:void 0)}function Hl(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 Fl(){return!0}function $g(){return!1}function nn(i){function s(a,l,f,m,b){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var x in i)i.hasOwnProperty(x)&&(a=i[x],this[x]=a?a(m):m[x]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Fl:$g,this.isPropagationStopped=$g,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Fl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Fl)},persist:function(){},isPersistent:Fl}),s}var Ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gl=nn(Ur),na=y({},Ur,{view:0,detail:0}),_O=nn(na),If,Hf,ia,Yl=y({},na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gf,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!==ia&&(ia&&i.type==="mousemove"?(If=i.screenX-ia.screenX,Hf=i.screenY-ia.screenY):Hf=If=0,ia=i),If)},movementY:function(i){return"movementY"in i?i.movementY:Hf}}),jg=nn(Yl),kO=y({},Yl,{dataTransfer:0}),MO=nn(kO),CO=y({},na,{relatedTarget:0}),Ff=nn(CO),DO=y({},Ur,{animationName:0,elapsedTime:0,pseudoElement:0}),NO=nn(DO),$O=y({},Ur,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),jO=nn($O),BO=y({},Ur,{data:0}),Bg=nn(BO),LO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},VO={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"},UO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zO(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=UO[i])?!!s[i]:!1}function Gf(){return zO}var KO=y({},na,{key:function(i){if(i.key){var s=LO[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Hl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?VO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gf,charCode:function(i){return i.type==="keypress"?Hl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Hl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),PO=nn(KO),qO=y({},Yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Lg=nn(qO),IO=y({},na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gf}),HO=nn(IO),FO=y({},Ur,{propertyName:0,elapsedTime:0,pseudoElement:0}),GO=nn(FO),YO=y({},Yl,{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}),JO=nn(YO),XO=y({},Ur,{newState:0,oldState:0}),ZO=nn(XO),QO=[9,13,27,32],Yf=Ai&&"CompositionEvent"in window,ra=null;Ai&&"documentMode"in document&&(ra=document.documentMode);var WO=Ai&&"TextEvent"in window&&!ra,Vg=Ai&&(!Yf||ra&&8<ra&&11>=ra),Ug=" ",zg=!1;function Kg(i,s){switch(i){case"keyup":return QO.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Pg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Cs=!1;function e_(i,s){switch(i){case"compositionend":return Pg(s);case"keypress":return s.which!==32?null:(zg=!0,Ug);case"textInput":return i=s.data,i===Ug&&zg?null:i;default:return null}}function t_(i,s){if(Cs)return i==="compositionend"||!Yf&&Kg(i,s)?(i=Ng(),Il=qf=er=null,Cs=!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 Vg&&s.locale!=="ko"?null:s.data;default:return null}}var n_={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 qg(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!n_[i.type]:s==="textarea"}function Ig(i,s,a,l){ks?Ms?Ms.push(l):Ms=[l]:ks=l,s=$c(s,"onChange"),0<s.length&&(a=new Gl("onChange","change",null,a,l),i.push({event:a,listeners:s}))}var sa=null,oa=null;function i_(i){A0(i,0)}function Jl(i){var s=Wo(i);if(Eg(s))return i}function Hg(i,s){if(i==="change")return s}var Fg=!1;if(Ai){var Jf;if(Ai){var Xf="oninput"in document;if(!Xf){var Gg=document.createElement("div");Gg.setAttribute("oninput","return;"),Xf=typeof Gg.oninput=="function"}Jf=Xf}else Jf=!1;Fg=Jf&&(!document.documentMode||9<document.documentMode)}function Yg(){sa&&(sa.detachEvent("onpropertychange",Jg),oa=sa=null)}function Jg(i){if(i.propertyName==="value"&&Jl(oa)){var s=[];Ig(s,oa,i,zf(i)),Dg(i_,s)}}function r_(i,s,a){i==="focusin"?(Yg(),sa=s,oa=a,sa.attachEvent("onpropertychange",Jg)):i==="focusout"&&Yg()}function s_(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Jl(oa)}function o_(i,s){if(i==="click")return Jl(s)}function a_(i,s){if(i==="input"||i==="change")return Jl(s)}function l_(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var hn=typeof Object.is=="function"?Object.is:l_;function aa(i,s){if(hn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),l=Object.keys(s);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!we.call(s,f)||!hn(i[f],s[f]))return!1}return!0}function Xg(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Zg(i,s){var a=Xg(i);i=0;for(var l;a;){if(a.nodeType===3){if(l=i+a.textContent.length,i<=s&&l>=s)return{node:a,offset:s-i};i=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Xg(a)}}function Qg(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Qg(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function Wg(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Pl(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=Pl(i.document)}return s}function Zf(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 c_=Ai&&"documentMode"in document&&11>=document.documentMode,Ds=null,Qf=null,la=null,Wf=!1;function eb(i,s,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Wf||Ds==null||Ds!==Pl(l)||(l=Ds,"selectionStart"in l&&Zf(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}),la&&aa(la,l)||(la=l,l=$c(Qf,"onSelect"),0<l.length&&(s=new Gl("onSelect","select",null,s,a),i.push({event:s,listeners:l}),s.target=Ds)))}function zr(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Ns={animationend:zr("Animation","AnimationEnd"),animationiteration:zr("Animation","AnimationIteration"),animationstart:zr("Animation","AnimationStart"),transitionrun:zr("Transition","TransitionRun"),transitionstart:zr("Transition","TransitionStart"),transitioncancel:zr("Transition","TransitionCancel"),transitionend:zr("Transition","TransitionEnd")},ed={},tb={};Ai&&(tb=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);function Kr(i){if(ed[i])return ed[i];if(!Ns[i])return i;var s=Ns[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in tb)return ed[i]=s[a];return i}var nb=Kr("animationend"),ib=Kr("animationiteration"),rb=Kr("animationstart"),u_=Kr("transitionrun"),f_=Kr("transitionstart"),d_=Kr("transitioncancel"),sb=Kr("transitionend"),ob=new Map,td="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(" ");td.push("scrollEnd");function qn(i,s){ob.set(i,s),Vr(s,[i])}var ab=new WeakMap;function On(i,s){if(typeof i=="object"&&i!==null){var a=ab.get(i);return a!==void 0?a:(s={value:i,source:s,stack:Tg(s)},ab.set(i,s),s)}return{value:i,source:s,stack:Tg(s)}}var _n=[],$s=0,nd=0;function Xl(){for(var i=$s,s=nd=$s=0;s<i;){var a=_n[s];_n[s++]=null;var l=_n[s];_n[s++]=null;var f=_n[s];_n[s++]=null;var m=_n[s];if(_n[s++]=null,l!==null&&f!==null){var b=l.pending;b===null?f.next=f:(f.next=b.next,b.next=f),l.pending=f}m!==0&&lb(a,f,m)}}function Zl(i,s,a,l){_n[$s++]=i,_n[$s++]=s,_n[$s++]=a,_n[$s++]=l,nd|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function id(i,s,a,l){return Zl(i,s,a,l),Ql(i)}function js(i,s){return Zl(i,null,null,s),Ql(i)}function lb(i,s,a){i.lanes|=a;var l=i.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=i.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(f=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,f&&s!==null&&(f=31-dn(a),i=m.hiddenUpdates,l=i[f],l===null?i[f]=[s]:l.push(s),s.lane=a|536870912),m):null}function Ql(i){if(50<Na)throw Na=0,ch=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Bs={};function h_(i,s,a,l){this.tag=i,this.key=a,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 pn(i,s,a,l){return new h_(i,s,a,l)}function rd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ei(i,s){var a=i.alternate;return a===null?(a=pn(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&65011712,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function cb(i,s){i.flags&=65011714;var a=i.alternate;return a===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=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Wl(i,s,a,l,f,m){var b=0;if(l=i,typeof i=="function")rd(i)&&(b=1);else if(typeof i=="string")b=mk(i,a,se.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ie:return i=pn(31,a,s,f),i.elementType=ie,i.lanes=m,i;case w:return Pr(a.children,f,m,s);case T:b=8,f|=24;break;case D:return i=pn(12,a,s,f|2),i.elementType=D,i.lanes=m,i;case O:return i=pn(13,a,s,f),i.elementType=O,i.lanes=m,i;case J:return i=pn(19,a,s,f),i.elementType=J,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case $:case k:b=10;break e;case _:b=9;break e;case C:b=11;break e;case G:b=14;break e;case H:b=16,l=null;break e}b=29,a=Error(r(130,i===null?"null":typeof i,"")),l=null}return s=pn(b,a,s,f),s.elementType=i,s.type=l,s.lanes=m,s}function Pr(i,s,a,l){return i=pn(7,i,l,s),i.lanes=a,i}function sd(i,s,a){return i=pn(6,i,null,s),i.lanes=a,i}function od(i,s,a){return s=pn(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Ls=[],Vs=0,ec=null,tc=0,kn=[],Mn=0,qr=null,Ri=1,Oi="";function Ir(i,s){Ls[Vs++]=tc,Ls[Vs++]=ec,ec=i,tc=s}function ub(i,s,a){kn[Mn++]=Ri,kn[Mn++]=Oi,kn[Mn++]=qr,qr=i;var l=Ri;i=Oi;var f=32-dn(l)-1;l&=~(1<<f),a+=1;var m=32-dn(s)+f;if(30<m){var b=f-f%5;m=(l&(1<<b)-1).toString(32),l>>=b,f-=b,Ri=1<<32-dn(s)+f|a<<f|l,Oi=m+i}else Ri=1<<m|a<<f|l,Oi=i}function ad(i){i.return!==null&&(Ir(i,1),ub(i,1,0))}function ld(i){for(;i===ec;)ec=Ls[--Vs],Ls[Vs]=null,tc=Ls[--Vs],Ls[Vs]=null;for(;i===qr;)qr=kn[--Mn],kn[Mn]=null,Oi=kn[--Mn],kn[Mn]=null,Ri=kn[--Mn],kn[Mn]=null}var Xt=null,st=null,$e=!1,Hr=null,ei=!1,cd=Error(r(519));function Fr(i){var s=Error(r(418,""));throw fa(On(s,i)),cd}function fb(i){var s=i.stateNode,a=i.type,l=i.memoizedProps;switch(s[qt]=i,s[tn]=l,a){case"dialog":_e("cancel",s),_e("close",s);break;case"iframe":case"object":case"embed":_e("load",s);break;case"video":case"audio":for(a=0;a<ja.length;a++)_e(ja[a],s);break;case"source":_e("error",s);break;case"img":case"image":case"link":_e("error",s),_e("load",s);break;case"details":_e("toggle",s);break;case"input":_e("invalid",s),Rg(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),Kl(s);break;case"select":_e("invalid",s);break;case"textarea":_e("invalid",s),_g(s,l.value,l.defaultValue,l.children),Kl(s)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||l.suppressHydrationWarning===!0||_0(s.textContent,a)?(l.popover!=null&&(_e("beforetoggle",s),_e("toggle",s)),l.onScroll!=null&&_e("scroll",s),l.onScrollEnd!=null&&_e("scrollend",s),l.onClick!=null&&(s.onclick=jc),s=!0):s=!1,s||Fr(i)}function db(i){for(Xt=i.return;Xt;)switch(Xt.tag){case 5:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:Xt=Xt.return}}function ca(i){if(i!==Xt)return!1;if(!$e)return db(i),$e=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||Eh(i.type,i.memoizedProps)),a=!a),a&&st&&Fr(i),db(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8)if(a=i.data,a==="/$"){if(s===0){st=Hn(i.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++;i=i.nextSibling}st=null}}else s===27?(s=st,yr(i.type)?(i=kh,kh=null,st=i):st=s):st=Xt?Hn(i.stateNode.nextSibling):null;return!0}function ua(){st=Xt=null,$e=!1}function hb(){var i=Hr;return i!==null&&(on===null?on=i:on.push.apply(on,i),Hr=null),i}function fa(i){Hr===null?Hr=[i]:Hr.push(i)}var ud=I(null),Gr=null,_i=null;function tr(i,s,a){X(ud,s._currentValue),s._currentValue=a}function ki(i){i._currentValue=ud.current,te(ud)}function fd(i,s,a){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===a)break;i=i.return}}function dd(i,s,a,l){var f=i.child;for(f!==null&&(f.return=i);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var x=m;m=f;for(var E=0;E<s.length;E++)if(x.context===s[E]){m.lanes|=a,x=m.alternate,x!==null&&(x.lanes|=a),fd(m.return,a,i),l||(b=null);break e}m=x.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(r(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),fd(b,a,i),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===i){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function da(i,s,a,l){i=null;for(var f=s,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var x=f.type;hn(f.pendingProps.value,b.value)||(i!==null?i.push(x):i=[x])}}else if(f===rt.current){if(b=f.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(i!==null?i.push(Ka):i=[Ka])}f=f.return}i!==null&&dd(s,i,a,l),s.flags|=262144}function nc(i){for(i=i.firstContext;i!==null;){if(!hn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Yr(i){Gr=i,_i=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function It(i){return pb(Gr,i)}function ic(i,s){return Gr===null&&Yr(i),pb(i,s)}function pb(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},_i===null){if(i===null)throw Error(r(308));_i=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else _i=_i.next=s;return a}var p_=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},m_=t.unstable_scheduleCallback,y_=t.unstable_NormalPriority,Ot={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function hd(){return{controller:new p_,data:new Map,refCount:0}}function ha(i){i.refCount--,i.refCount===0&&m_(y_,function(){i.controller.abort()})}var pa=null,pd=0,Us=0,zs=null;function g_(i,s){if(pa===null){var a=pa=[];pd=0,Us=yh(),zs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return pd++,s.then(mb,mb),s}function mb(){if(--pd===0&&pa!==null){zs!==null&&(zs.status="fulfilled");var i=pa;pa=null,Us=0,zs=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function b_(i,s){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var f=0;f<a.length;f++)(0,a[f])(s)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var yb=B.S;B.S=function(i,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&g_(i,s),yb!==null&&yb(i,s)};var Jr=I(null);function md(){var i=Jr.current;return i!==null?i:Fe.pooledCache}function rc(i,s){s===null?X(Jr,Jr.current):X(Jr,s.pool)}function gb(){var i=md();return i===null?null:{parent:Ot._currentValue,pool:i}}var ma=Error(r(460)),bb=Error(r(474)),sc=Error(r(542)),yd={then:function(){}};function vb(i){return i=i.status,i==="fulfilled"||i==="rejected"}function oc(){}function Sb(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(oc,oc),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,wb(i),i;default:if(typeof s.status=="string")s.then(oc,oc);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=l}},function(l){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,wb(i),i}throw ya=s,ma}}var ya=null;function xb(){if(ya===null)throw Error(r(459));var i=ya;return ya=null,i}function wb(i){if(i===ma||i===sc)throw Error(r(483))}var nr=!1;function gd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bd(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 ir(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function rr(i,s,a){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Be&2)!==0){var f=l.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),l.pending=s,s=Ql(i),lb(i,null,a),s}return Zl(i,l,s,a),Ql(i)}function ga(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,mg(i,a)}}function vd(i,s){var a=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,a=a.next}while(a!==null);m===null?f=m=s:m=m.next=s}else f=m=s;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var Sd=!1;function ba(){if(Sd){var i=zs;if(i!==null)throw i}}function va(i,s,a,l){Sd=!1;var f=i.updateQueue;nr=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,x=f.shared.pending;if(x!==null){f.shared.pending=null;var E=x,j=E.next;E.next=null,b===null?m=j:b.next=j,b=E;var K=i.alternate;K!==null&&(K=K.updateQueue,x=K.lastBaseUpdate,x!==b&&(x===null?K.firstBaseUpdate=j:x.next=j,K.lastBaseUpdate=E))}if(m!==null){var F=f.baseState;b=0,K=j=E=null,x=m;do{var L=x.lane&-536870913,U=L!==x.lane;if(U?(Ce&L)===L:(l&L)===L){L!==0&&L===Us&&(Sd=!0),K!==null&&(K=K.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var me=i,de=x;L=s;var Ke=a;switch(de.tag){case 1:if(me=de.payload,typeof me=="function"){F=me.call(Ke,F,L);break e}F=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=de.payload,L=typeof me=="function"?me.call(Ke,F,L):me,L==null)break e;F=y({},F,L);break e;case 2:nr=!0}}L=x.callback,L!==null&&(i.flags|=64,U&&(i.flags|=8192),U=f.callbacks,U===null?f.callbacks=[L]:U.push(L))}else U={lane:L,tag:x.tag,payload:x.payload,callback:x.callback,next:null},K===null?(j=K=U,E=F):K=K.next=U,b|=L;if(x=x.next,x===null){if(x=f.shared.pending,x===null)break;U=x,x=U.next,U.next=null,f.lastBaseUpdate=U,f.shared.pending=null}}while(!0);K===null&&(E=F),f.baseState=E,f.firstBaseUpdate=j,f.lastBaseUpdate=K,m===null&&(f.shared.lanes=0),dr|=b,i.lanes=b,i.memoizedState=F}}function Tb(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Ab(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Tb(a[i],s)}var Ks=I(null),ac=I(0);function Eb(i,s){i=Bi,X(ac,i),X(Ks,s),Bi=i|s.baseLanes}function xd(){X(ac,Bi),X(Ks,Ks.current)}function wd(){Bi=ac.current,te(Ks),te(ac)}var sr=0,Ae=null,Ue=null,gt=null,lc=!1,Ps=!1,Xr=!1,cc=0,Sa=0,qs=null,v_=0;function ut(){throw Error(r(321))}function Td(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!hn(i[a],s[a]))return!1;return!0}function Ad(i,s,a,l,f,m){return sr=m,Ae=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=i===null||i.memoizedState===null?lv:cv,Xr=!1,m=a(l,f),Xr=!1,Ps&&(m=Ob(s,a,l,f)),Rb(i),m}function Rb(i){B.H=mc;var s=Ue!==null&&Ue.next!==null;if(sr=0,gt=Ue=Ae=null,lc=!1,Sa=0,qs=null,s)throw Error(r(300));i===null||Dt||(i=i.dependencies,i!==null&&nc(i)&&(Dt=!0))}function Ob(i,s,a,l){Ae=i;var f=0;do{if(Ps&&(qs=null),Sa=0,Ps=!1,25<=f)throw Error(r(301));if(f+=1,gt=Ue=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}B.H=R_,m=s(a,l)}while(Ps);return m}function S_(){var i=B.H,s=i.useState()[0];return s=typeof s.then=="function"?xa(s):s,i=i.useState()[0],(Ue!==null?Ue.memoizedState:null)!==i&&(Ae.flags|=1024),s}function Ed(){var i=cc!==0;return cc=0,i}function Rd(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function Od(i){if(lc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}lc=!1}sr=0,gt=Ue=Ae=null,Ps=!1,Sa=cc=0,qs=null}function rn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Ae.memoizedState=gt=i:gt=gt.next=i,gt}function bt(){if(Ue===null){var i=Ae.alternate;i=i!==null?i.memoizedState:null}else i=Ue.next;var s=gt===null?Ae.memoizedState:gt.next;if(s!==null)gt=s,Ue=i;else{if(i===null)throw Ae.alternate===null?Error(r(467)):Error(r(310));Ue=i,i={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},gt===null?Ae.memoizedState=gt=i:gt=gt.next=i}return gt}function _d(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xa(i){var s=Sa;return Sa+=1,qs===null&&(qs=[]),i=Sb(qs,i,s),s=Ae,(gt===null?s.memoizedState:gt.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?lv:cv),i}function uc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return xa(i);if(i.$$typeof===k)return It(i)}throw Error(r(438,String(i)))}function kd(i){var s=null,a=Ae.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var l=Ae.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=_d(),Ae.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),l=0;l<i;l++)a[l]=oe;return s.index++,a}function Mi(i,s){return typeof s=="function"?s(i):s}function fc(i){var s=bt();return Md(s,Ue,i)}function Md(i,s,a){var l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=i.baseQueue,m=l.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}s.baseQueue=f=m,l.pending=null}if(m=i.baseState,f===null)i.memoizedState=m;else{s=f.next;var x=b=null,E=null,j=s,K=!1;do{var F=j.lane&-536870913;if(F!==j.lane?(Ce&F)===F:(sr&F)===F){var L=j.revertLane;if(L===0)E!==null&&(E=E.next={lane:0,revertLane:0,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),F===Us&&(K=!0);else if((sr&L)===L){j=j.next,L===Us&&(K=!0);continue}else F={lane:0,revertLane:j.revertLane,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},E===null?(x=E=F,b=m):E=E.next=F,Ae.lanes|=L,dr|=L;F=j.action,Xr&&a(m,F),m=j.hasEagerState?j.eagerState:a(m,F)}else L={lane:F,revertLane:j.revertLane,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},E===null?(x=E=L,b=m):E=E.next=L,Ae.lanes|=F,dr|=F;j=j.next}while(j!==null&&j!==s);if(E===null?b=m:E.next=x,!hn(m,i.memoizedState)&&(Dt=!0,K&&(a=zs,a!==null)))throw a;i.memoizedState=m,i.baseState=b,i.baseQueue=E,l.lastRenderedState=m}return f===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Cd(i){var s=bt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var l=a.dispatch,f=a.pending,m=s.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do m=i(m,b.action),b=b.next;while(b!==f);hn(m,s.memoizedState)||(Dt=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),a.lastRenderedState=m}return[m,l]}function _b(i,s,a){var l=Ae,f=bt(),m=$e;if(m){if(a===void 0)throw Error(r(407));a=a()}else a=s();var b=!hn((Ue||f).memoizedState,a);b&&(f.memoizedState=a,Dt=!0),f=f.queue;var x=Cb.bind(null,l,f,i);if(wa(2048,8,x,[i]),f.getSnapshot!==s||b||gt!==null&&gt.memoizedState.tag&1){if(l.flags|=2048,Is(9,dc(),Mb.bind(null,l,f,a,s),null),Fe===null)throw Error(r(349));m||(sr&124)!==0||kb(l,s,a)}return a}function kb(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Ae.updateQueue,s===null?(s=_d(),Ae.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Mb(i,s,a,l){s.value=a,s.getSnapshot=l,Db(s)&&Nb(i)}function Cb(i,s,a){return a(function(){Db(s)&&Nb(i)})}function Db(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!hn(i,a)}catch{return!0}}function Nb(i){var s=js(i,2);s!==null&&vn(s,i,2)}function Dd(i){var s=rn();if(typeof i=="function"){var a=i;if(i=a(),Xr){Qi(!0);try{a()}finally{Qi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:i},s}function $b(i,s,a,l){return i.baseState=a,Md(i,Ue,typeof l=="function"?l:Mi)}function x_(i,s,a,l,f){if(pc(i))throw Error(r(485));if(i=s.action,i!==null){var m={payload:f,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};B.T!==null?a(!0):m.isTransition=!1,l(m),a=s.pending,a===null?(m.next=s.pending=m,jb(s,m)):(m.next=a.next,s.pending=a.next=m)}}function jb(i,s){var a=s.action,l=s.payload,f=i.state;if(s.isTransition){var m=B.T,b={};B.T=b;try{var x=a(f,l),E=B.S;E!==null&&E(b,x),Bb(i,s,x)}catch(j){Nd(i,s,j)}finally{B.T=m}}else try{m=a(f,l),Bb(i,s,m)}catch(j){Nd(i,s,j)}}function Bb(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Lb(i,s,l)},function(l){return Nd(i,s,l)}):Lb(i,s,a)}function Lb(i,s,a){s.status="fulfilled",s.value=a,Vb(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,jb(i,a)))}function Nd(i,s,a){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=a,Vb(s),s=s.next;while(s!==l)}i.action=null}function Vb(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function Ub(i,s){return s}function zb(i,s){if($e){var a=Fe.formState;if(a!==null){e:{var l=Ae;if($e){if(st){t:{for(var f=st,m=ei;f.nodeType!==8;){if(!m){f=null;break t}if(f=Hn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){st=Hn(f.nextSibling),l=f.data==="F!";break e}}Fr(l)}l=!1}l&&(s=a[0])}}return a=rn(),a.memoizedState=a.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ub,lastRenderedState:s},a.queue=l,a=sv.bind(null,Ae,l),l.dispatch=a,l=Dd(!1),m=Vd.bind(null,Ae,!1,l.queue),l=rn(),f={state:s,dispatch:null,action:i,pending:null},l.queue=f,a=x_.bind(null,Ae,f,m,a),f.dispatch=a,l.memoizedState=i,[s,a,!1]}function Kb(i){var s=bt();return Pb(s,Ue,i)}function Pb(i,s,a){if(s=Md(i,s,Ub)[0],i=fc(Mi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=xa(s)}catch(b){throw b===ma?sc:b}else l=s;s=bt();var f=s.queue,m=f.dispatch;return a!==s.memoizedState&&(Ae.flags|=2048,Is(9,dc(),w_.bind(null,f,a),null)),[l,m,i]}function w_(i,s){i.action=s}function qb(i){var s=bt(),a=Ue;if(a!==null)return Pb(s,a,i);bt(),s=s.memoizedState,a=bt();var l=a.queue.dispatch;return a.memoizedState=i,[s,l,!1]}function Is(i,s,a,l){return i={tag:i,create:a,deps:l,inst:s,next:null},s=Ae.updateQueue,s===null&&(s=_d(),Ae.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(l=a.next,a.next=i,i.next=l,s.lastEffect=i),i}function dc(){return{destroy:void 0,resource:void 0}}function Ib(){return bt().memoizedState}function hc(i,s,a,l){var f=rn();l=l===void 0?null:l,Ae.flags|=i,f.memoizedState=Is(1|s,dc(),a,l)}function wa(i,s,a,l){var f=bt();l=l===void 0?null:l;var m=f.memoizedState.inst;Ue!==null&&l!==null&&Td(l,Ue.memoizedState.deps)?f.memoizedState=Is(s,m,a,l):(Ae.flags|=i,f.memoizedState=Is(1|s,m,a,l))}function Hb(i,s){hc(8390656,8,i,s)}function Fb(i,s){wa(2048,8,i,s)}function Gb(i,s){return wa(4,2,i,s)}function Yb(i,s){return wa(4,4,i,s)}function Jb(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Xb(i,s,a){a=a!=null?a.concat([i]):null,wa(4,4,Jb.bind(null,s,i),a)}function $d(){}function Zb(i,s){var a=bt();s=s===void 0?null:s;var l=a.memoizedState;return s!==null&&Td(s,l[1])?l[0]:(a.memoizedState=[i,s],i)}function Qb(i,s){var a=bt();s=s===void 0?null:s;var l=a.memoizedState;if(s!==null&&Td(s,l[1]))return l[0];if(l=i(),Xr){Qi(!0);try{i()}finally{Qi(!1)}}return a.memoizedState=[l,s],l}function jd(i,s,a){return a===void 0||(sr&1073741824)!==0?i.memoizedState=s:(i.memoizedState=a,i=t0(),Ae.lanes|=i,dr|=i,a)}function Wb(i,s,a,l){return hn(a,s)?a:Ks.current!==null?(i=jd(i,a,l),hn(i,s)||(Dt=!0),i):(sr&42)===0?(Dt=!0,i.memoizedState=a):(i=t0(),Ae.lanes|=i,dr|=i,s)}function ev(i,s,a,l,f){var m=P.p;P.p=m!==0&&8>m?m:8;var b=B.T,x={};B.T=x,Vd(i,!1,s,a);try{var E=f(),j=B.S;if(j!==null&&j(x,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var K=b_(E,l);Ta(i,s,K,bn(i))}else Ta(i,s,l,bn(i))}catch(F){Ta(i,s,{then:function(){},status:"rejected",reason:F},bn())}finally{P.p=m,B.T=b}}function T_(){}function Bd(i,s,a,l){if(i.tag!==5)throw Error(r(476));var f=tv(i).queue;ev(i,f,s,z,a===null?T_:function(){return nv(i),a(l)})}function tv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:z},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function nv(i){var s=tv(i).next.queue;Ta(i,s,{},bn())}function Ld(){return It(Ka)}function iv(){return bt().memoizedState}function rv(){return bt().memoizedState}function A_(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=bn();i=ir(a);var l=rr(s,i,a);l!==null&&(vn(l,s,a),ga(l,s,a)),s={cache:hd()},i.payload=s;return}s=s.return}}function E_(i,s,a){var l=bn();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},pc(i)?ov(s,a):(a=id(i,s,a,l),a!==null&&(vn(a,i,l),av(a,s,l)))}function sv(i,s,a){var l=bn();Ta(i,s,a,l)}function Ta(i,s,a,l){var f={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(pc(i))ov(s,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var b=s.lastRenderedState,x=m(b,a);if(f.hasEagerState=!0,f.eagerState=x,hn(x,b))return Zl(i,s,f,0),Fe===null&&Xl(),!1}catch{}finally{}if(a=id(i,s,f,l),a!==null)return vn(a,i,l),av(a,s,l),!0}return!1}function Vd(i,s,a,l){if(l={lane:2,revertLane:yh(),action:l,hasEagerState:!1,eagerState:null,next:null},pc(i)){if(s)throw Error(r(479))}else s=id(i,a,l,2),s!==null&&vn(s,i,2)}function pc(i){var s=i.alternate;return i===Ae||s!==null&&s===Ae}function ov(i,s){Ps=lc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function av(i,s,a){if((a&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,mg(i,a)}}var mc={readContext:It,use:uc,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut},lv={readContext:It,use:uc,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:It,useEffect:Hb,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,hc(4194308,4,Jb.bind(null,s,i),a)},useLayoutEffect:function(i,s){return hc(4194308,4,i,s)},useInsertionEffect:function(i,s){hc(4,2,i,s)},useMemo:function(i,s){var a=rn();s=s===void 0?null:s;var l=i();if(Xr){Qi(!0);try{i()}finally{Qi(!1)}}return a.memoizedState=[l,s],l},useReducer:function(i,s,a){var l=rn();if(a!==void 0){var f=a(s);if(Xr){Qi(!0);try{a(s)}finally{Qi(!1)}}}else f=s;return l.memoizedState=l.baseState=f,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:f},l.queue=i,i=i.dispatch=E_.bind(null,Ae,i),[l.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Dd(i);var s=i.queue,a=sv.bind(null,Ae,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:$d,useDeferredValue:function(i,s){var a=rn();return jd(a,i,s)},useTransition:function(){var i=Dd(!1);return i=ev.bind(null,Ae,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var l=Ae,f=rn();if($e){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),Fe===null)throw Error(r(349));(Ce&124)!==0||kb(l,s,a)}f.memoizedState=a;var m={value:a,getSnapshot:s};return f.queue=m,Hb(Cb.bind(null,l,m,i),[i]),l.flags|=2048,Is(9,dc(),Mb.bind(null,l,m,a,s),null),a},useId:function(){var i=rn(),s=Fe.identifierPrefix;if($e){var a=Oi,l=Ri;a=(l&~(1<<32-dn(l)-1)).toString(32)+a,s="«"+s+"R"+a,a=cc++,0<a&&(s+="H"+a.toString(32)),s+="»"}else a=v_++,s="«"+s+"r"+a.toString(32)+"»";return i.memoizedState=s},useHostTransitionStatus:Ld,useFormState:zb,useActionState:zb,useOptimistic:function(i){var s=rn();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=Vd.bind(null,Ae,!0,a),a.dispatch=s,[i,s]},useMemoCache:kd,useCacheRefresh:function(){return rn().memoizedState=A_.bind(null,Ae)}},cv={readContext:It,use:uc,useCallback:Zb,useContext:It,useEffect:Fb,useImperativeHandle:Xb,useInsertionEffect:Gb,useLayoutEffect:Yb,useMemo:Qb,useReducer:fc,useRef:Ib,useState:function(){return fc(Mi)},useDebugValue:$d,useDeferredValue:function(i,s){var a=bt();return Wb(a,Ue.memoizedState,i,s)},useTransition:function(){var i=fc(Mi)[0],s=bt().memoizedState;return[typeof i=="boolean"?i:xa(i),s]},useSyncExternalStore:_b,useId:iv,useHostTransitionStatus:Ld,useFormState:Kb,useActionState:Kb,useOptimistic:function(i,s){var a=bt();return $b(a,Ue,i,s)},useMemoCache:kd,useCacheRefresh:rv},R_={readContext:It,use:uc,useCallback:Zb,useContext:It,useEffect:Fb,useImperativeHandle:Xb,useInsertionEffect:Gb,useLayoutEffect:Yb,useMemo:Qb,useReducer:Cd,useRef:Ib,useState:function(){return Cd(Mi)},useDebugValue:$d,useDeferredValue:function(i,s){var a=bt();return Ue===null?jd(a,i,s):Wb(a,Ue.memoizedState,i,s)},useTransition:function(){var i=Cd(Mi)[0],s=bt().memoizedState;return[typeof i=="boolean"?i:xa(i),s]},useSyncExternalStore:_b,useId:iv,useHostTransitionStatus:Ld,useFormState:qb,useActionState:qb,useOptimistic:function(i,s){var a=bt();return Ue!==null?$b(a,Ue,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:kd,useCacheRefresh:rv},Hs=null,Aa=0;function yc(i){var s=Aa;return Aa+=1,Hs===null&&(Hs=[]),Sb(Hs,i,s)}function Ea(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function gc(i,s){throw s.$$typeof===g?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function uv(i){var s=i._init;return s(i._payload)}function fv(i){function s(M,R){if(i){var N=M.deletions;N===null?(M.deletions=[R],M.flags|=16):N.push(R)}}function a(M,R){if(!i)return null;for(;R!==null;)s(M,R),R=R.sibling;return null}function l(M){for(var R=new Map;M!==null;)M.key!==null?R.set(M.key,M):R.set(M.index,M),M=M.sibling;return R}function f(M,R){return M=Ei(M,R),M.index=0,M.sibling=null,M}function m(M,R,N){return M.index=N,i?(N=M.alternate,N!==null?(N=N.index,N<R?(M.flags|=67108866,R):N):(M.flags|=67108866,R)):(M.flags|=1048576,R)}function b(M){return i&&M.alternate===null&&(M.flags|=67108866),M}function x(M,R,N,q){return R===null||R.tag!==6?(R=sd(N,M.mode,q),R.return=M,R):(R=f(R,N),R.return=M,R)}function E(M,R,N,q){var re=N.type;return re===w?K(M,R,N.props.children,q,N.key):R!==null&&(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===H&&uv(re)===R.type)?(R=f(R,N.props),Ea(R,N),R.return=M,R):(R=Wl(N.type,N.key,N.props,null,M.mode,q),Ea(R,N),R.return=M,R)}function j(M,R,N,q){return R===null||R.tag!==4||R.stateNode.containerInfo!==N.containerInfo||R.stateNode.implementation!==N.implementation?(R=od(N,M.mode,q),R.return=M,R):(R=f(R,N.children||[]),R.return=M,R)}function K(M,R,N,q,re){return R===null||R.tag!==7?(R=Pr(N,M.mode,q,re),R.return=M,R):(R=f(R,N),R.return=M,R)}function F(M,R,N){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=sd(""+R,M.mode,N),R.return=M,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return N=Wl(R.type,R.key,R.props,null,M.mode,N),Ea(N,R),N.return=M,N;case S:return R=od(R,M.mode,N),R.return=M,R;case H:var q=R._init;return R=q(R._payload),F(M,R,N)}if(W(R)||ge(R))return R=Pr(R,M.mode,N,null),R.return=M,R;if(typeof R.then=="function")return F(M,yc(R),N);if(R.$$typeof===k)return F(M,ic(M,R),N);gc(M,R)}return null}function L(M,R,N,q){var re=R!==null?R.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return re!==null?null:x(M,R,""+N,q);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case v:return N.key===re?E(M,R,N,q):null;case S:return N.key===re?j(M,R,N,q):null;case H:return re=N._init,N=re(N._payload),L(M,R,N,q)}if(W(N)||ge(N))return re!==null?null:K(M,R,N,q,null);if(typeof N.then=="function")return L(M,R,yc(N),q);if(N.$$typeof===k)return L(M,R,ic(M,N),q);gc(M,N)}return null}function U(M,R,N,q,re){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return M=M.get(N)||null,x(R,M,""+q,re);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return M=M.get(q.key===null?N:q.key)||null,E(R,M,q,re);case S:return M=M.get(q.key===null?N:q.key)||null,j(R,M,q,re);case H:var Re=q._init;return q=Re(q._payload),U(M,R,N,q,re)}if(W(q)||ge(q))return M=M.get(N)||null,K(R,M,q,re,null);if(typeof q.then=="function")return U(M,R,N,yc(q),re);if(q.$$typeof===k)return U(M,R,N,ic(R,q),re);gc(R,q)}return null}function me(M,R,N,q){for(var re=null,Re=null,ce=R,he=R=0,$t=null;ce!==null&&he<N.length;he++){ce.index>he?($t=ce,ce=null):$t=ce.sibling;var Ne=L(M,ce,N[he],q);if(Ne===null){ce===null&&(ce=$t);break}i&&ce&&Ne.alternate===null&&s(M,ce),R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne,ce=$t}if(he===N.length)return a(M,ce),$e&&Ir(M,he),re;if(ce===null){for(;he<N.length;he++)ce=F(M,N[he],q),ce!==null&&(R=m(ce,R,he),Re===null?re=ce:Re.sibling=ce,Re=ce);return $e&&Ir(M,he),re}for(ce=l(ce);he<N.length;he++)$t=U(ce,M,he,N[he],q),$t!==null&&(i&&$t.alternate!==null&&ce.delete($t.key===null?he:$t.key),R=m($t,R,he),Re===null?re=$t:Re.sibling=$t,Re=$t);return i&&ce.forEach(function(xr){return s(M,xr)}),$e&&Ir(M,he),re}function de(M,R,N,q){if(N==null)throw Error(r(151));for(var re=null,Re=null,ce=R,he=R=0,$t=null,Ne=N.next();ce!==null&&!Ne.done;he++,Ne=N.next()){ce.index>he?($t=ce,ce=null):$t=ce.sibling;var xr=L(M,ce,Ne.value,q);if(xr===null){ce===null&&(ce=$t);break}i&&ce&&xr.alternate===null&&s(M,ce),R=m(xr,R,he),Re===null?re=xr:Re.sibling=xr,Re=xr,ce=$t}if(Ne.done)return a(M,ce),$e&&Ir(M,he),re;if(ce===null){for(;!Ne.done;he++,Ne=N.next())Ne=F(M,Ne.value,q),Ne!==null&&(R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne);return $e&&Ir(M,he),re}for(ce=l(ce);!Ne.done;he++,Ne=N.next())Ne=U(ce,M,he,Ne.value,q),Ne!==null&&(i&&Ne.alternate!==null&&ce.delete(Ne.key===null?he:Ne.key),R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne);return i&&ce.forEach(function(Ok){return s(M,Ok)}),$e&&Ir(M,he),re}function Ke(M,R,N,q){if(typeof N=="object"&&N!==null&&N.type===w&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case v:e:{for(var re=N.key;R!==null;){if(R.key===re){if(re=N.type,re===w){if(R.tag===7){a(M,R.sibling),q=f(R,N.props.children),q.return=M,M=q;break e}}else if(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===H&&uv(re)===R.type){a(M,R.sibling),q=f(R,N.props),Ea(q,N),q.return=M,M=q;break e}a(M,R);break}else s(M,R);R=R.sibling}N.type===w?(q=Pr(N.props.children,M.mode,q,N.key),q.return=M,M=q):(q=Wl(N.type,N.key,N.props,null,M.mode,q),Ea(q,N),q.return=M,M=q)}return b(M);case S:e:{for(re=N.key;R!==null;){if(R.key===re)if(R.tag===4&&R.stateNode.containerInfo===N.containerInfo&&R.stateNode.implementation===N.implementation){a(M,R.sibling),q=f(R,N.children||[]),q.return=M,M=q;break e}else{a(M,R);break}else s(M,R);R=R.sibling}q=od(N,M.mode,q),q.return=M,M=q}return b(M);case H:return re=N._init,N=re(N._payload),Ke(M,R,N,q)}if(W(N))return me(M,R,N,q);if(ge(N)){if(re=ge(N),typeof re!="function")throw Error(r(150));return N=re.call(N),de(M,R,N,q)}if(typeof N.then=="function")return Ke(M,R,yc(N),q);if(N.$$typeof===k)return Ke(M,R,ic(M,N),q);gc(M,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,R!==null&&R.tag===6?(a(M,R.sibling),q=f(R,N),q.return=M,M=q):(a(M,R),q=sd(N,M.mode,q),q.return=M,M=q),b(M)):a(M,R)}return function(M,R,N,q){try{Aa=0;var re=Ke(M,R,N,q);return Hs=null,re}catch(ce){if(ce===ma||ce===sc)throw ce;var Re=pn(29,ce,null,M.mode);return Re.lanes=q,Re.return=M,Re}finally{}}}var Fs=fv(!0),dv=fv(!1),Cn=I(null),ti=null;function or(i){var s=i.alternate;X(_t,_t.current&1),X(Cn,i),ti===null&&(s===null||Ks.current!==null||s.memoizedState!==null)&&(ti=i)}function hv(i){if(i.tag===22){if(X(_t,_t.current),X(Cn,i),ti===null){var s=i.alternate;s!==null&&s.memoizedState!==null&&(ti=i)}}else ar()}function ar(){X(_t,_t.current),X(Cn,Cn.current)}function Ci(i){te(Cn),ti===i&&(ti=null),te(_t)}var _t=I(0);function bc(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||_h(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){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}function Ud(i,s,a,l){s=i.memoizedState,a=a(l,s),a=a==null?s:y({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var zd={enqueueSetState:function(i,s,a){i=i._reactInternals;var l=bn(),f=ir(l);f.payload=s,a!=null&&(f.callback=a),s=rr(i,f,l),s!==null&&(vn(s,i,l),ga(s,i,l))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var l=bn(),f=ir(l);f.tag=1,f.payload=s,a!=null&&(f.callback=a),s=rr(i,f,l),s!==null&&(vn(s,i,l),ga(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=bn(),l=ir(a);l.tag=2,s!=null&&(l.callback=s),s=rr(i,l,a),s!==null&&(vn(s,i,a),ga(s,i,a))}};function pv(i,s,a,l,f,m,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,m,b):s.prototype&&s.prototype.isPureReactComponent?!aa(a,l)||!aa(f,m):!0}function mv(i,s,a,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,l),s.state!==i&&zd.enqueueReplaceState(s,s.state,null)}function Zr(i,s){var a=s;if("ref"in s){a={};for(var l in s)l!=="ref"&&(a[l]=s[l])}if(i=i.defaultProps){a===s&&(a=y({},a));for(var f in i)a[f]===void 0&&(a[f]=i[f])}return a}var vc=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)};function yv(i){vc(i)}function gv(i){console.error(i)}function bv(i){vc(i)}function Sc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function vv(i,s,a){try{var l=i.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Kd(i,s,a){return a=ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Sc(i,s)},a}function Sv(i){return i=ir(i),i.tag=3,i}function xv(i,s,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;i.payload=function(){return f(m)},i.callback=function(){vv(s,a,l)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){vv(s,a,l),typeof f!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function O_(i,s,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=a.alternate,s!==null&&da(s,a,f,!0),a=Cn.current,a!==null){switch(a.tag){case 13:return ti===null?fh():a.alternate===null&&ot===0&&(ot=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===yd?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([l]):s.add(l),hh(i,l,f)),!1;case 22:return a.flags|=65536,l===yd?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([l]):a.add(l)),hh(i,l,f)),!1}throw Error(r(435,a.tag))}return hh(i,l,f),fh(),!1}if($e)return s=Cn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,l!==cd&&(i=Error(r(422),{cause:l}),fa(On(i,a)))):(l!==cd&&(s=Error(r(423),{cause:l}),fa(On(s,a))),i=i.current.alternate,i.flags|=65536,f&=-f,i.lanes|=f,l=On(l,a),f=Kd(i.stateNode,l,f),vd(i,f),ot!==4&&(ot=2)),!1;var m=Error(r(520),{cause:l});if(m=On(m,a),Da===null?Da=[m]:Da.push(m),ot!==4&&(ot=2),s===null)return!0;l=On(l,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=f&-f,a.lanes|=i,i=Kd(a.stateNode,l,i),vd(a,i),!1;case 1:if(s=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(hr===null||!hr.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Sv(f),xv(f,i,a,l),vd(a,f),!1}a=a.return}while(a!==null);return!1}var wv=Error(r(461)),Dt=!1;function Vt(i,s,a,l){s.child=i===null?dv(s,null,a,l):Fs(s,i.child,a,l)}function Tv(i,s,a,l,f){a=a.render;var m=s.ref;if("ref"in l){var b={};for(var x in l)x!=="ref"&&(b[x]=l[x])}else b=l;return Yr(s),l=Ad(i,s,a,b,m,f),x=Ed(),i!==null&&!Dt?(Rd(i,s,f),Di(i,s,f)):($e&&x&&ad(s),s.flags|=1,Vt(i,s,l,f),s.child)}function Av(i,s,a,l,f){if(i===null){var m=a.type;return typeof m=="function"&&!rd(m)&&m.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=m,Ev(i,s,m,l,f)):(i=Wl(a.type,null,l,s,s.mode,f),i.ref=s.ref,i.return=s,s.child=i)}if(m=i.child,!Jd(i,f)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:aa,a(b,l)&&i.ref===s.ref)return Di(i,s,f)}return s.flags|=1,i=Ei(m,l),i.ref=s.ref,i.return=s,s.child=i}function Ev(i,s,a,l,f){if(i!==null){var m=i.memoizedProps;if(aa(m,l)&&i.ref===s.ref)if(Dt=!1,s.pendingProps=l=m,Jd(i,f))(i.flags&131072)!==0&&(Dt=!0);else return s.lanes=i.lanes,Di(i,s,f)}return Pd(i,s,a,l,f)}function Rv(i,s,a){var l=s.pendingProps,f=l.children,m=i!==null?i.memoizedState:null;if(l.mode==="hidden"){if((s.flags&128)!==0){if(l=m!==null?m.baseLanes|a:a,i!==null){for(f=s.child=i.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;s.childLanes=m&~l}else s.childLanes=0,s.child=null;return Ov(i,s,l,a)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&rc(s,m!==null?m.cachePool:null),m!==null?Eb(s,m):xd(),hv(s);else return s.lanes=s.childLanes=536870912,Ov(i,s,m!==null?m.baseLanes|a:a,a)}else m!==null?(rc(s,m.cachePool),Eb(s,m),ar(),s.memoizedState=null):(i!==null&&rc(s,null),xd(),ar());return Vt(i,s,f,a),s.child}function Ov(i,s,a,l){var f=md();return f=f===null?null:{parent:Ot._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&rc(s,null),xd(),hv(s),i!==null&&da(i,s,l,!0),null}function xc(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function Pd(i,s,a,l,f){return Yr(s),a=Ad(i,s,a,l,void 0,f),l=Ed(),i!==null&&!Dt?(Rd(i,s,f),Di(i,s,f)):($e&&l&&ad(s),s.flags|=1,Vt(i,s,a,f),s.child)}function _v(i,s,a,l,f,m){return Yr(s),s.updateQueue=null,a=Ob(s,l,a,f),Rb(i),l=Ed(),i!==null&&!Dt?(Rd(i,s,m),Di(i,s,m)):($e&&l&&ad(s),s.flags|=1,Vt(i,s,a,m),s.child)}function kv(i,s,a,l,f){if(Yr(s),s.stateNode===null){var m=Bs,b=a.contextType;typeof b=="object"&&b!==null&&(m=It(b)),m=new a(l,m),s.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=zd,s.stateNode=m,m._reactInternals=s,m=s.stateNode,m.props=l,m.state=s.memoizedState,m.refs={},gd(s),b=a.contextType,m.context=typeof b=="object"&&b!==null?It(b):Bs,m.state=s.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(Ud(s,a,b,l),m.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&zd.enqueueReplaceState(m,m.state,null),va(s,l,m,f),ba(),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){m=s.stateNode;var x=s.memoizedProps,E=Zr(a,x);m.props=E;var j=m.context,K=a.contextType;b=Bs,typeof K=="object"&&K!==null&&(b=It(K));var F=a.getDerivedStateFromProps;K=typeof F=="function"||typeof m.getSnapshotBeforeUpdate=="function",x=s.pendingProps!==x,K||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x||j!==b)&&mv(s,m,l,b),nr=!1;var L=s.memoizedState;m.state=L,va(s,l,m,f),ba(),j=s.memoizedState,x||L!==j||nr?(typeof F=="function"&&(Ud(s,a,F,l),j=s.memoizedState),(E=nr||pv(s,a,E,l,L,j,b))?(K||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(s.flags|=4194308)):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=j),m.props=l,m.state=j,m.context=b,l=E):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{m=s.stateNode,bd(i,s),b=s.memoizedProps,K=Zr(a,b),m.props=K,F=s.pendingProps,L=m.context,j=a.contextType,E=Bs,typeof j=="object"&&j!==null&&(E=It(j)),x=a.getDerivedStateFromProps,(j=typeof x=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==F||L!==E)&&mv(s,m,l,E),nr=!1,L=s.memoizedState,m.state=L,va(s,l,m,f),ba();var U=s.memoizedState;b!==F||L!==U||nr||i!==null&&i.dependencies!==null&&nc(i.dependencies)?(typeof x=="function"&&(Ud(s,a,x,l),U=s.memoizedState),(K=nr||pv(s,a,K,l,L,U,E)||i!==null&&i.dependencies!==null&&nc(i.dependencies))?(j||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,U,E),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,U,E)),typeof m.componentDidUpdate=="function"&&(s.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=U),m.props=l,m.state=U,m.context=E,l=K):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=1024),l=!1)}return m=l,xc(i,s),l=(s.flags&128)!==0,m||l?(m=s.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.render(),s.flags|=1,i!==null&&l?(s.child=Fs(s,i.child,null,f),s.child=Fs(s,null,a,f)):Vt(i,s,a,f),s.memoizedState=m.state,i=s.child):i=Di(i,s,f),i}function Mv(i,s,a,l){return ua(),s.flags|=256,Vt(i,s,a,l),s.child}var qd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Id(i){return{baseLanes:i,cachePool:gb()}}function Hd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Dn),i}function Cv(i,s,a){var l=s.pendingProps,f=!1,m=(s.flags&128)!==0,b;if((b=m)||(b=i!==null&&i.memoizedState===null?!1:(_t.current&2)!==0),b&&(f=!0,s.flags&=-129),b=(s.flags&32)!==0,s.flags&=-33,i===null){if($e){if(f?or(s):ar(),$e){var x=st,E;if(E=x){e:{for(E=x,x=ei;E.nodeType!==8;){if(!x){x=null;break e}if(E=Hn(E.nextSibling),E===null){x=null;break e}}x=E}x!==null?(s.memoizedState={dehydrated:x,treeContext:qr!==null?{id:Ri,overflow:Oi}:null,retryLane:536870912,hydrationErrors:null},E=pn(18,null,null,0),E.stateNode=x,E.return=s,s.child=E,Xt=s,st=null,E=!0):E=!1}E||Fr(s)}if(x=s.memoizedState,x!==null&&(x=x.dehydrated,x!==null))return _h(x)?s.lanes=32:s.lanes=536870912,null;Ci(s)}return x=l.children,l=l.fallback,f?(ar(),f=s.mode,x=wc({mode:"hidden",children:x},f),l=Pr(l,f,a,null),x.return=s,l.return=s,x.sibling=l,s.child=x,f=s.child,f.memoizedState=Id(a),f.childLanes=Hd(i,b,a),s.memoizedState=qd,l):(or(s),Fd(s,x))}if(E=i.memoizedState,E!==null&&(x=E.dehydrated,x!==null)){if(m)s.flags&256?(or(s),s.flags&=-257,s=Gd(i,s,a)):s.memoizedState!==null?(ar(),s.child=i.child,s.flags|=128,s=null):(ar(),f=l.fallback,x=s.mode,l=wc({mode:"visible",children:l.children},x),f=Pr(f,x,a,null),f.flags|=2,l.return=s,f.return=s,l.sibling=f,s.child=l,Fs(s,i.child,null,a),l=s.child,l.memoizedState=Id(a),l.childLanes=Hd(i,b,a),s.memoizedState=qd,s=f);else if(or(s),_h(x)){if(b=x.nextSibling&&x.nextSibling.dataset,b)var j=b.dgst;b=j,l=Error(r(419)),l.stack="",l.digest=b,fa({value:l,source:null,stack:null}),s=Gd(i,s,a)}else if(Dt||da(i,s,a,!1),b=(a&i.childLanes)!==0,Dt||b){if(b=Fe,b!==null&&(l=a&-a,l=(l&42)!==0?1:kf(l),l=(l&(b.suspendedLanes|a))!==0?0:l,l!==0&&l!==E.retryLane))throw E.retryLane=l,js(i,l),vn(b,i,l),wv;x.data==="$?"||fh(),s=Gd(i,s,a)}else x.data==="$?"?(s.flags|=192,s.child=i.child,s=null):(i=E.treeContext,st=Hn(x.nextSibling),Xt=s,$e=!0,Hr=null,ei=!1,i!==null&&(kn[Mn++]=Ri,kn[Mn++]=Oi,kn[Mn++]=qr,Ri=i.id,Oi=i.overflow,qr=s),s=Fd(s,l.children),s.flags|=4096);return s}return f?(ar(),f=l.fallback,x=s.mode,E=i.child,j=E.sibling,l=Ei(E,{mode:"hidden",children:l.children}),l.subtreeFlags=E.subtreeFlags&65011712,j!==null?f=Ei(j,f):(f=Pr(f,x,a,null),f.flags|=2),f.return=s,l.return=s,l.sibling=f,s.child=l,l=f,f=s.child,x=i.child.memoizedState,x===null?x=Id(a):(E=x.cachePool,E!==null?(j=Ot._currentValue,E=E.parent!==j?{parent:j,pool:j}:E):E=gb(),x={baseLanes:x.baseLanes|a,cachePool:E}),f.memoizedState=x,f.childLanes=Hd(i,b,a),s.memoizedState=qd,l):(or(s),a=i.child,i=a.sibling,a=Ei(a,{mode:"visible",children:l.children}),a.return=s,a.sibling=null,i!==null&&(b=s.deletions,b===null?(s.deletions=[i],s.flags|=16):b.push(i)),s.child=a,s.memoizedState=null,a)}function Fd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=pn(22,i,null,s),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Gd(i,s,a){return Fs(s,i.child,null,a),i=Fd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Dv(i,s,a){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),fd(i.return,s,a)}function Yd(i,s,a,l,f){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=a,m.tailMode=f)}function Nv(i,s,a){var l=s.pendingProps,f=l.revealOrder,m=l.tail;if(Vt(i,s,l.children,a),l=_t.current,(l&2)!==0)l=l&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Dv(i,a,s);else if(i.tag===19)Dv(i,a,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}l&=1}switch(X(_t,l),f){case"forwards":for(a=s.child,f=null;a!==null;)i=a.alternate,i!==null&&bc(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),Yd(s,!1,f,a,m);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(i=f.alternate,i!==null&&bc(i)===null){s.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}Yd(s,!0,a,null,m);break;case"together":Yd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Di(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),dr|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(da(i,s,a,!1),(a&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,a=Ei(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Ei(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function Jd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&nc(i)))}function __(i,s,a){switch(s.tag){case 3:Ve(s,s.stateNode.containerInfo),tr(s,Ot,i.memoizedState.cache),ua();break;case 27:case 5:Zi(s);break;case 4:Ve(s,s.stateNode.containerInfo);break;case 10:tr(s,s.type,s.memoizedProps.value);break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(or(s),s.flags|=128,null):(a&s.child.childLanes)!==0?Cv(i,s,a):(or(s),i=Di(i,s,a),i!==null?i.sibling:null);or(s);break;case 19:var f=(i.flags&128)!==0;if(l=(a&s.childLanes)!==0,l||(da(i,s,a,!1),l=(a&s.childLanes)!==0),f){if(l)return Nv(i,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),X(_t,_t.current),l)break;return null;case 22:case 23:return s.lanes=0,Rv(i,s,a);case 24:tr(s,Ot,i.memoizedState.cache)}return Di(i,s,a)}function $v(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)Dt=!0;else{if(!Jd(i,a)&&(s.flags&128)===0)return Dt=!1,__(i,s,a);Dt=(i.flags&131072)!==0}else Dt=!1,$e&&(s.flags&1048576)!==0&&ub(s,tc,s.index);switch(s.lanes=0,s.tag){case 16:e:{i=s.pendingProps;var l=s.elementType,f=l._init;if(l=f(l._payload),s.type=l,typeof l=="function")rd(l)?(i=Zr(l,i),s.tag=1,s=kv(null,s,l,i,a)):(s.tag=0,s=Pd(null,s,l,i,a));else{if(l!=null){if(f=l.$$typeof,f===C){s.tag=11,s=Tv(null,s,l,i,a);break e}else if(f===G){s.tag=14,s=Av(null,s,l,i,a);break e}}throw s=Q(l)||l,Error(r(306,s,""))}}return s;case 0:return Pd(i,s,s.type,s.pendingProps,a);case 1:return l=s.type,f=Zr(l,s.pendingProps),kv(i,s,l,f,a);case 3:e:{if(Ve(s,s.stateNode.containerInfo),i===null)throw Error(r(387));l=s.pendingProps;var m=s.memoizedState;f=m.element,bd(i,s),va(s,l,null,a);var b=s.memoizedState;if(l=b.cache,tr(s,Ot,l),l!==m.cache&&dd(s,[Ot],a,!0),ba(),l=b.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:b.cache},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){s=Mv(i,s,l,a);break e}else if(l!==f){f=On(Error(r(424)),s),fa(f),s=Mv(i,s,l,a);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(st=Hn(i.firstChild),Xt=s,$e=!0,Hr=null,ei=!0,a=dv(s,null,l,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ua(),l===f){s=Di(i,s,a);break e}Vt(i,s,l,a)}s=s.child}return s;case 26:return xc(i,s),i===null?(a=V0(s.type,null,s.pendingProps,null))?s.memoizedState=a:$e||(a=s.type,i=s.pendingProps,l=Bc(le.current).createElement(a),l[qt]=s,l[tn]=i,zt(l,a,i),Ct(l),s.stateNode=l):s.memoizedState=V0(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Zi(s),i===null&&$e&&(l=s.stateNode=j0(s.type,s.pendingProps,le.current),Xt=s,ei=!0,f=st,yr(s.type)?(kh=f,st=Hn(l.firstChild)):st=f),Vt(i,s,s.pendingProps.children,a),xc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&$e&&((f=l=st)&&(l=nk(l,s.type,s.pendingProps,ei),l!==null?(s.stateNode=l,Xt=s,st=Hn(l.firstChild),ei=!1,f=!0):f=!1),f||Fr(s)),Zi(s),f=s.type,m=s.pendingProps,b=i!==null?i.memoizedProps:null,l=m.children,Eh(f,m)?l=null:b!==null&&Eh(f,b)&&(s.flags|=32),s.memoizedState!==null&&(f=Ad(i,s,S_,null,null,a),Ka._currentValue=f),xc(i,s),Vt(i,s,l,a),s.child;case 6:return i===null&&$e&&((i=a=st)&&(a=ik(a,s.pendingProps,ei),a!==null?(s.stateNode=a,Xt=s,st=null,i=!0):i=!1),i||Fr(s)),null;case 13:return Cv(i,s,a);case 4:return Ve(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Fs(s,null,l,a):Vt(i,s,l,a),s.child;case 11:return Tv(i,s,s.type,s.pendingProps,a);case 7:return Vt(i,s,s.pendingProps,a),s.child;case 8:return Vt(i,s,s.pendingProps.children,a),s.child;case 12:return Vt(i,s,s.pendingProps.children,a),s.child;case 10:return l=s.pendingProps,tr(s,s.type,l.value),Vt(i,s,l.children,a),s.child;case 9:return f=s.type._context,l=s.pendingProps.children,Yr(s),f=It(f),l=l(f),s.flags|=1,Vt(i,s,l,a),s.child;case 14:return Av(i,s,s.type,s.pendingProps,a);case 15:return Ev(i,s,s.type,s.pendingProps,a);case 19:return Nv(i,s,a);case 31:return l=s.pendingProps,a=s.mode,l={mode:l.mode,children:l.children},i===null?(a=wc(l,a),a.ref=s.ref,s.child=a,a.return=s,s=a):(a=Ei(i.child,l),a.ref=s.ref,s.child=a,a.return=s,s=a),s;case 22:return Rv(i,s,a);case 24:return Yr(s),l=It(Ot),i===null?(f=md(),f===null&&(f=Fe,m=hd(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),s.memoizedState={parent:l,cache:f},gd(s),tr(s,Ot,f)):((i.lanes&a)!==0&&(bd(i,s),va(s,null,null,a),ba()),f=i.memoizedState,m=s.memoizedState,f.parent!==l?(f={parent:l,cache:l},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),tr(s,Ot,l)):(l=m.cache,tr(s,Ot,l),l!==f.cache&&dd(s,[Ot],a,!0))),Vt(i,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ni(i){i.flags|=4}function jv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!q0(s)){if(s=Cn.current,s!==null&&((Ce&4194048)===Ce?ti!==null:(Ce&62914560)!==Ce&&(Ce&536870912)===0||s!==ti))throw ya=yd,bb;i.flags|=8192}}function Tc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?hg():536870912,i.lanes|=s,Xs|=s)}function Ra(i,s){if(!$e)switch(i.tailMode){case"hidden":s=i.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function nt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,l=0;if(s)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=l,i.childLanes=a,s}function k_(i,s,a){var l=s.pendingProps;switch(ld(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(s),null;case 1:return nt(s),null;case 3:return a=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),ki(Ot),wn(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(ca(s)?Ni(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,hb())),nt(s),null;case 26:return a=s.memoizedState,i===null?(Ni(s),a!==null?(nt(s),jv(s,a)):(nt(s),s.flags&=-16777217)):a?a!==i.memoizedState?(Ni(s),nt(s),jv(s,a)):(nt(s),s.flags&=-16777217):(i.memoizedProps!==l&&Ni(s),nt(s),s.flags&=-16777217),null;case 27:wi(s),a=le.current;var f=s.type;if(i!==null&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return nt(s),null}i=se.current,ca(s)?fb(s):(i=j0(f,l,a),s.stateNode=i,Ni(s))}return nt(s),null;case 5:if(wi(s),a=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return nt(s),null}if(i=se.current,ca(s))fb(s);else{switch(f=Bc(le.current),i){case 1:i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":i=f.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?i.multiple=!0:l.size&&(i.size=l.size);break;default:i=typeof l.is=="string"?f.createElement(a,{is:l.is}):f.createElement(a)}}i[qt]=s,i[tn]=l;e:for(f=s.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===s)break e;for(;f.sibling===null;){if(f.return===null||f.return===s)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}s.stateNode=i;e:switch(zt(i,a,l),a){case"button":case"input":case"select":case"textarea":i=!!l.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ni(s)}}return nt(s),s.flags&=-16777217,null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(r(166));if(i=le.current,ca(s)){if(i=s.stateNode,a=s.memoizedProps,l=null,f=Xt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}i[qt]=s,i=!!(i.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||_0(i.nodeValue,a)),i||Fr(s)}else i=Bc(i).createTextNode(l),i[qt]=s,s.stateNode=i}return nt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(f=ca(s),l!==null&&l.dehydrated!==null){if(i===null){if(!f)throw Error(r(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[qt]=s}else ua(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;nt(s),f=!1}else f=hb(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(Ci(s),s):(Ci(s),null)}if(Ci(s),(s.flags&128)!==0)return s.lanes=a,s;if(a=l!==null,i=i!==null&&i.memoizedState!==null,a){l=s.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool);var m=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)}return a!==i&&a&&(s.child.flags|=8192),Tc(s,s.updateQueue),nt(s),null;case 4:return wn(),i===null&&Sh(s.stateNode.containerInfo),nt(s),null;case 10:return ki(s.type),nt(s),null;case 19:if(te(_t),f=s.memoizedState,f===null)return nt(s),null;if(l=(s.flags&128)!==0,m=f.rendering,m===null)if(l)Ra(f,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(m=bc(i),m!==null){for(s.flags|=128,Ra(f,!1),i=m.updateQueue,s.updateQueue=i,Tc(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)cb(a,i),a=a.sibling;return X(_t,_t.current&1|2),s.child}i=i.sibling}f.tail!==null&&Te()>Rc&&(s.flags|=128,l=!0,Ra(f,!1),s.lanes=4194304)}else{if(!l)if(i=bc(m),i!==null){if(s.flags|=128,l=!0,i=i.updateQueue,s.updateQueue=i,Tc(s,i),Ra(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!$e)return nt(s),null}else 2*Te()-f.renderingStartTime>Rc&&a!==536870912&&(s.flags|=128,l=!0,Ra(f,!1),s.lanes=4194304);f.isBackwards?(m.sibling=s.child,s.child=m):(i=f.last,i!==null?i.sibling=m:s.child=m,f.last=m)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=Te(),s.sibling=null,i=_t.current,X(_t,l?i&1|2:i&1),s):(nt(s),null);case 22:case 23:return Ci(s),wd(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(a&536870912)!==0&&(s.flags&128)===0&&(nt(s),s.subtreeFlags&6&&(s.flags|=8192)):nt(s),a=s.updateQueue,a!==null&&Tc(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==a&&(s.flags|=2048),i!==null&&te(Jr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),ki(Ot),nt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function M_(i,s){switch(ld(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ki(Ot),wn(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return wi(s),null;case 13:if(Ci(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ua()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return te(_t),null;case 4:return wn(),null;case 10:return ki(s.type),null;case 22:case 23:return Ci(s),wd(),i!==null&&te(Jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return ki(Ot),null;case 25:return null;default:return null}}function Bv(i,s){switch(ld(s),s.tag){case 3:ki(Ot),wn();break;case 26:case 27:case 5:wi(s);break;case 4:wn();break;case 13:Ci(s);break;case 19:te(_t);break;case 10:ki(s.type);break;case 22:case 23:Ci(s),wd(),i!==null&&te(Jr);break;case 24:ki(Ot)}}function Oa(i,s){try{var a=s.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&i)===i){l=void 0;var m=a.create,b=a.inst;l=m(),b.destroy=l}a=a.next}while(a!==f)}}catch(x){qe(s,s.return,x)}}function lr(i,s,a){try{var l=s.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&i)===i){var b=l.inst,x=b.destroy;if(x!==void 0){b.destroy=void 0,f=s;var E=a,j=x;try{j()}catch(K){qe(f,E,K)}}}l=l.next}while(l!==m)}}catch(K){qe(s,s.return,K)}}function Lv(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Ab(s,a)}catch(l){qe(i,i.return,l)}}}function Vv(i,s,a){a.props=Zr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(l){qe(i,s,l)}}function _a(i,s){try{var a=i.ref;if(a!==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 a=="function"?i.refCleanup=a(l):a.current=l}}catch(f){qe(i,s,f)}}function ni(i,s){var a=i.ref,l=i.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){qe(i,s,f)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){qe(i,s,f)}else a.current=null}function Uv(i){var s=i.type,a=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){qe(i,i.return,f)}}function Xd(i,s,a){try{var l=i.stateNode;Z_(l,i.type,a,s),l[tn]=s}catch(f){qe(i,i.return,f)}}function zv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&yr(i.type)||i.tag===4}function Zd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||zv(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&&yr(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 Qd(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(i),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=jc));else if(l!==4&&(l===27&&yr(i.type)&&(a=i.stateNode,s=null),i=i.child,i!==null))for(Qd(i,s,a),i=i.sibling;i!==null;)Qd(i,s,a),i=i.sibling}function Ac(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?a.insertBefore(i,s):a.appendChild(i);else if(l!==4&&(l===27&&yr(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(Ac(i,s,a),i=i.sibling;i!==null;)Ac(i,s,a),i=i.sibling}function Kv(i){var s=i.stateNode,a=i.memoizedProps;try{for(var l=i.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);zt(s,l,a),s[qt]=i,s[tn]=a}catch(m){qe(i,i.return,m)}}var $i=!1,ft=!1,Wd=!1,Pv=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function C_(i,s){if(i=i.containerInfo,Th=Pc,i=Wg(i),Zf(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,x=-1,E=-1,j=0,K=0,F=i,L=null;t:for(;;){for(var U;F!==a||f!==0&&F.nodeType!==3||(x=b+f),F!==m||l!==0&&F.nodeType!==3||(E=b+l),F.nodeType===3&&(b+=F.nodeValue.length),(U=F.firstChild)!==null;)L=F,F=U;for(;;){if(F===i)break t;if(L===a&&++j===f&&(x=b),L===m&&++K===l&&(E=b),(U=F.nextSibling)!==null)break;F=L,L=F.parentNode}F=U}a=x===-1||E===-1?null:{start:x,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(Ah={focusedElem:i,selectionRange:a},Pc=!1,Nt=s;Nt!==null;)if(s=Nt,i=s.child,(s.subtreeFlags&1024)!==0&&i!==null)i.return=s,Nt=i;else for(;Nt!==null;){switch(s=Nt,m=s.alternate,i=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,a=s,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var me=Zr(a.type,f,a.elementType===a.type);i=l.getSnapshotBeforeUpdate(me,m),l.__reactInternalSnapshotBeforeUpdate=i}catch(de){qe(a,a.return,de)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,a=i.nodeType,a===9)Oh(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Oh(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,Nt=i;break}Nt=s.return}}function qv(i,s,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:cr(i,a),l&4&&Oa(5,a);break;case 1:if(cr(i,a),l&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(b){qe(a,a.return,b)}else{var f=Zr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(f,s,i.__reactInternalSnapshotBeforeUpdate)}catch(b){qe(a,a.return,b)}}l&64&&Lv(a),l&512&&_a(a,a.return);break;case 3:if(cr(i,a),l&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Ab(i,s)}catch(b){qe(a,a.return,b)}}break;case 27:s===null&&l&4&&Kv(a);case 26:case 5:cr(i,a),s===null&&l&4&&Uv(a),l&512&&_a(a,a.return);break;case 12:cr(i,a);break;case 13:cr(i,a),l&4&&Fv(i,a),l&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=z_.bind(null,a),rk(i,a))));break;case 22:if(l=a.memoizedState!==null||$i,!l){s=s!==null&&s.memoizedState!==null||ft,f=$i;var m=ft;$i=l,(ft=s)&&!m?ur(i,a,(a.subtreeFlags&8772)!==0):cr(i,a),$i=f,ft=m}break;case 30:break;default:cr(i,a)}}function Iv(i){var s=i.alternate;s!==null&&(i.alternate=null,Iv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Df(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 Xe=null,sn=!1;function ji(i,s,a){for(a=a.child;a!==null;)Hv(i,s,a),a=a.sibling}function Hv(i,s,a){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(Jo,a)}catch{}switch(a.tag){case 26:ft||ni(a,s),ji(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ft||ni(a,s);var l=Xe,f=sn;yr(a.type)&&(Xe=a.stateNode,sn=!1),ji(i,s,a),La(a.stateNode),Xe=l,sn=f;break;case 5:ft||ni(a,s);case 6:if(l=Xe,f=sn,Xe=null,ji(i,s,a),Xe=l,sn=f,Xe!==null)if(sn)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(a.stateNode)}catch(m){qe(a,s,m)}else try{Xe.removeChild(a.stateNode)}catch(m){qe(a,s,m)}break;case 18:Xe!==null&&(sn?(i=Xe,N0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Ha(i)):N0(Xe,a.stateNode));break;case 4:l=Xe,f=sn,Xe=a.stateNode.containerInfo,sn=!0,ji(i,s,a),Xe=l,sn=f;break;case 0:case 11:case 14:case 15:ft||lr(2,a,s),ft||lr(4,a,s),ji(i,s,a);break;case 1:ft||(ni(a,s),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Vv(a,s,l)),ji(i,s,a);break;case 21:ji(i,s,a);break;case 22:ft=(l=ft)||a.memoizedState!==null,ji(i,s,a),ft=l;break;default:ji(i,s,a)}}function Fv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ha(i)}catch(a){qe(s,s.return,a)}}function D_(i){switch(i.tag){case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Pv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Pv),s;default:throw Error(r(435,i.tag))}}function eh(i,s){var a=D_(i);s.forEach(function(l){var f=K_.bind(null,i,l);a.has(l)||(a.add(l),l.then(f,f))})}function mn(i,s){var a=s.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=i,b=s,x=b;e:for(;x!==null;){switch(x.tag){case 27:if(yr(x.type)){Xe=x.stateNode,sn=!1;break e}break;case 5:Xe=x.stateNode,sn=!1;break e;case 3:case 4:Xe=x.stateNode.containerInfo,sn=!0;break e}x=x.return}if(Xe===null)throw Error(r(160));Hv(m,b,f),Xe=null,sn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Gv(s,i),s=s.sibling}var In=null;function Gv(i,s){var a=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:mn(s,i),yn(i),l&4&&(lr(3,i,i.return),Oa(3,i),lr(5,i,i.return));break;case 1:mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),l&64&&$i&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=In;if(mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),l&4){var m=a!==null?a.memoizedState:null;if(l=i.memoizedState,a===null)if(l===null)if(i.stateNode===null){e:{l=i.type,a=i.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[Qo]||m[qt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),zt(m,l,a),m[qt]=i,Ct(m),l=m;break e;case"link":var b=K0("link","href",f).get(l+(a.href||""));if(b){for(var x=0;x<b.length;x++)if(m=b[x],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(x,1);break t}}m=f.createElement(l),zt(m,l,a),f.head.appendChild(m);break;case"meta":if(b=K0("meta","content",f).get(l+(a.content||""))){for(x=0;x<b.length;x++)if(m=b[x],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(x,1);break t}}m=f.createElement(l),zt(m,l,a),f.head.appendChild(m);break;default:throw Error(r(468,l))}m[qt]=i,Ct(m),l=m}i.stateNode=l}else P0(f,i.type,i.stateNode);else i.stateNode=z0(f,l,i.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?P0(f,i.type,i.stateNode):z0(f,l,i.memoizedProps)):l===null&&i.stateNode!==null&&Xd(i,i.memoizedProps,a.memoizedProps)}break;case 27:mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),a!==null&&l&4&&Xd(i,i.memoizedProps,a.memoizedProps);break;case 5:if(mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),i.flags&32){f=i.stateNode;try{_s(f,"")}catch(U){qe(i,i.return,U)}}l&4&&i.stateNode!=null&&(f=i.memoizedProps,Xd(i,f,a!==null?a.memoizedProps:f)),l&1024&&(Wd=!0);break;case 6:if(mn(s,i),yn(i),l&4){if(i.stateNode===null)throw Error(r(162));l=i.memoizedProps,a=i.stateNode;try{a.nodeValue=l}catch(U){qe(i,i.return,U)}}break;case 3:if(Uc=null,f=In,In=Lc(s.containerInfo),mn(s,i),In=f,yn(i),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ha(s.containerInfo)}catch(U){qe(i,i.return,U)}Wd&&(Wd=!1,Yv(i));break;case 4:l=In,In=Lc(i.stateNode.containerInfo),mn(s,i),yn(i),In=l;break;case 12:mn(s,i),yn(i);break;case 13:mn(s,i),yn(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(oh=Te()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,eh(i,l)));break;case 22:f=i.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,j=$i,K=ft;if($i=j||f,ft=K||E,mn(s,i),ft=K,$i=j,yn(i),l&8192)e:for(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(a===null||E||$i||ft||Qr(i)),a=null,s=i;;){if(s.tag===5||s.tag===26){if(a===null){E=a=s;try{if(m=E.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{x=E.stateNode;var F=E.memoizedProps.style,L=F!=null&&F.hasOwnProperty("display")?F.display:null;x.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(U){qe(E,E.return,U)}}}else if(s.tag===6){if(a===null){E=s;try{E.stateNode.nodeValue=f?"":E.memoizedProps}catch(U){qe(E,E.return,U)}}}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;a===s&&(a=null),s=s.return}a===s&&(a=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,eh(i,a))));break;case 19:mn(s,i),yn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,eh(i,l)));break;case 30:break;case 21:break;default:mn(s,i),yn(i)}}function yn(i){var s=i.flags;if(s&2){try{for(var a,l=i.return;l!==null;){if(zv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,m=Zd(i);Ac(i,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(_s(b,""),a.flags&=-33);var x=Zd(i);Ac(i,x,b);break;case 3:case 4:var E=a.stateNode.containerInfo,j=Zd(i);Qd(i,j,E);break;default:throw Error(r(161))}}catch(K){qe(i,i.return,K)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Yv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Yv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function cr(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)qv(i,s.alternate,s),s=s.sibling}function Qr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:lr(4,s,s.return),Qr(s);break;case 1:ni(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&Vv(s,s.return,a),Qr(s);break;case 27:La(s.stateNode);case 26:case 5:ni(s,s.return),Qr(s);break;case 22:s.memoizedState===null&&Qr(s);break;case 30:Qr(s);break;default:Qr(s)}i=i.sibling}}function ur(i,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,f=i,m=s,b=m.flags;switch(m.tag){case 0:case 11:case 15:ur(f,m,a),Oa(4,m);break;case 1:if(ur(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(j){qe(l,l.return,j)}if(l=m,f=l.updateQueue,f!==null){var x=l.stateNode;try{var E=f.shared.hiddenCallbacks;if(E!==null)for(f.shared.hiddenCallbacks=null,f=0;f<E.length;f++)Tb(E[f],x)}catch(j){qe(l,l.return,j)}}a&&b&64&&Lv(m),_a(m,m.return);break;case 27:Kv(m);case 26:case 5:ur(f,m,a),a&&l===null&&b&4&&Uv(m),_a(m,m.return);break;case 12:ur(f,m,a);break;case 13:ur(f,m,a),a&&b&4&&Fv(f,m);break;case 22:m.memoizedState===null&&ur(f,m,a),_a(m,m.return);break;case 30:break;default:ur(f,m,a)}s=s.sibling}}function th(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&ha(a))}function nh(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ha(i))}function ii(i,s,a,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Jv(i,s,a,l),s=s.sibling}function Jv(i,s,a,l){var f=s.flags;switch(s.tag){case 0:case 11:case 15:ii(i,s,a,l),f&2048&&Oa(9,s);break;case 1:ii(i,s,a,l);break;case 3:ii(i,s,a,l),f&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ha(i)));break;case 12:if(f&2048){ii(i,s,a,l),i=s.stateNode;try{var m=s.memoizedProps,b=m.id,x=m.onPostCommit;typeof x=="function"&&x(b,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(E){qe(s,s.return,E)}}else ii(i,s,a,l);break;case 13:ii(i,s,a,l);break;case 23:break;case 22:m=s.stateNode,b=s.alternate,s.memoizedState!==null?m._visibility&2?ii(i,s,a,l):ka(i,s):m._visibility&2?ii(i,s,a,l):(m._visibility|=2,Gs(i,s,a,l,(s.subtreeFlags&10256)!==0)),f&2048&&th(b,s);break;case 24:ii(i,s,a,l),f&2048&&nh(s.alternate,s);break;default:ii(i,s,a,l)}}function Gs(i,s,a,l,f){for(f=f&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var m=i,b=s,x=a,E=l,j=b.flags;switch(b.tag){case 0:case 11:case 15:Gs(m,b,x,E,f),Oa(8,b);break;case 23:break;case 22:var K=b.stateNode;b.memoizedState!==null?K._visibility&2?Gs(m,b,x,E,f):ka(m,b):(K._visibility|=2,Gs(m,b,x,E,f)),f&&j&2048&&th(b.alternate,b);break;case 24:Gs(m,b,x,E,f),f&&j&2048&&nh(b.alternate,b);break;default:Gs(m,b,x,E,f)}s=s.sibling}}function ka(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,l=s,f=l.flags;switch(l.tag){case 22:ka(a,l),f&2048&&th(l.alternate,l);break;case 24:ka(a,l),f&2048&&nh(l.alternate,l);break;default:ka(a,l)}s=s.sibling}}var Ma=8192;function Ys(i){if(i.subtreeFlags&Ma)for(i=i.child;i!==null;)Xv(i),i=i.sibling}function Xv(i){switch(i.tag){case 26:Ys(i),i.flags&Ma&&i.memoizedState!==null&&gk(In,i.memoizedState,i.memoizedProps);break;case 5:Ys(i);break;case 3:case 4:var s=In;In=Lc(i.stateNode.containerInfo),Ys(i),In=s;break;case 22:i.memoizedState===null&&(s=i.alternate,s!==null&&s.memoizedState!==null?(s=Ma,Ma=16777216,Ys(i),Ma=s):Ys(i));break;default:Ys(i)}}function Zv(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 Ca(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,Wv(l,i)}Zv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Qv(i),i=i.sibling}function Qv(i){switch(i.tag){case 0:case 11:case 15:Ca(i),i.flags&2048&&lr(9,i,i.return);break;case 3:Ca(i);break;case 12:Ca(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Ec(i)):Ca(i);break;default:Ca(i)}}function Ec(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,Wv(l,i)}Zv(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:lr(8,s,s.return),Ec(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Ec(s));break;default:Ec(s)}i=i.sibling}}function Wv(i,s){for(;Nt!==null;){var a=Nt;switch(a.tag){case 0:case 11:case 15:lr(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ha(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Nt=l;else e:for(a=i;Nt!==null;){l=Nt;var f=l.sibling,m=l.return;if(Iv(l),l===a){Nt=null;break e}if(f!==null){f.return=m,Nt=f;break e}Nt=m}}}var N_={getCacheForType:function(i){var s=It(Ot),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a}},$_=typeof WeakMap=="function"?WeakMap:Map,Be=0,Fe=null,Oe=null,Ce=0,Le=0,gn=null,fr=!1,Js=!1,ih=!1,Bi=0,ot=0,dr=0,Wr=0,rh=0,Dn=0,Xs=0,Da=null,on=null,sh=!1,oh=0,Rc=1/0,Oc=null,hr=null,Ut=0,pr=null,Zs=null,Qs=0,ah=0,lh=null,e0=null,Na=0,ch=null;function bn(){if((Be&2)!==0&&Ce!==0)return Ce&-Ce;if(B.T!==null){var i=Us;return i!==0?i:yh()}return yg()}function t0(){Dn===0&&(Dn=(Ce&536870912)===0||$e?dg():536870912);var i=Cn.current;return i!==null&&(i.flags|=32),Dn}function vn(i,s,a){(i===Fe&&(Le===2||Le===9)||i.cancelPendingCommit!==null)&&(Ws(i,0),mr(i,Ce,Dn,!1)),Zo(i,a),((Be&2)===0||i!==Fe)&&(i===Fe&&((Be&2)===0&&(Wr|=a),ot===4&&mr(i,Ce,Dn,!1)),ri(i))}function n0(i,s,a){if((Be&6)!==0)throw Error(r(327));var l=!a&&(s&124)===0&&(s&i.expiredLanes)===0||Xo(i,s),f=l?L_(i,s):dh(i,s,!0),m=l;do{if(f===0){Js&&!l&&mr(i,s,0,!1);break}else{if(a=i.current.alternate,m&&!j_(a)){f=dh(i,s,!1),m=!1;continue}if(f===2){if(m=s,i.errorRecoveryDisabledLanes&m)var b=0;else b=i.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){s=b;e:{var x=i;f=Da;var E=x.current.memoizedState.isDehydrated;if(E&&(Ws(x,b).flags|=256),b=dh(x,b,!1),b!==2){if(ih&&!E){x.errorRecoveryDisabledLanes|=m,Wr|=m,f=4;break e}m=on,on=f,m!==null&&(on===null?on=m:on.push.apply(on,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){Ws(i,0),mr(i,s,0,!0);break}e:{switch(l=i,m=f,m){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:mr(l,s,Dn,!fr);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(f=oh+300-Te(),10<f)){if(mr(l,s,Dn,!fr),Vl(l,0,!0)!==0)break e;l.timeoutHandle=C0(i0.bind(null,l,a,on,Oc,sh,s,Dn,Wr,Xs,fr,m,2,-0,0),f);break e}i0(l,a,on,Oc,sh,s,Dn,Wr,Xs,fr,m,0,-0,0)}}break}while(!0);ri(i)}function i0(i,s,a,l,f,m,b,x,E,j,K,F,L,U){if(i.timeoutHandle=-1,F=s.subtreeFlags,(F&8192||(F&16785408)===16785408)&&(za={stylesheets:null,count:0,unsuspend:yk},Xv(s),F=bk(),F!==null)){i.cancelPendingCommit=F(u0.bind(null,i,s,m,a,l,f,b,x,E,K,1,L,U)),mr(i,m,b,!j);return}u0(i,s,m,a,l,f,b,x,E)}function j_(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],m=f.getSnapshot;f=f.value;try{if(!hn(m(),f))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;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 mr(i,s,a,l){s&=~rh,s&=~Wr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var f=s;0<f;){var m=31-dn(f),b=1<<m;l[m]=-1,f&=~b}a!==0&&pg(i,a,s)}function _c(){return(Be&6)===0?($a(0),!1):!0}function uh(){if(Oe!==null){if(Le===0)var i=Oe.return;else i=Oe,_i=Gr=null,Od(i),Hs=null,Aa=0,i=Oe;for(;i!==null;)Bv(i.alternate,i),i=i.return;Oe=null}}function Ws(i,s){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,W_(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),uh(),Fe=i,Oe=a=Ei(i.current,null),Ce=s,Le=0,gn=null,fr=!1,Js=Xo(i,s),ih=!1,Xs=Dn=rh=Wr=dr=ot=0,on=Da=null,sh=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var f=31-dn(l),m=1<<f;s|=i[f],l&=~m}return Bi=s,Xl(),a}function r0(i,s){Ae=null,B.H=mc,s===ma||s===sc?(s=xb(),Le=3):s===bb?(s=xb(),Le=4):Le=s===wv?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,gn=s,Oe===null&&(ot=1,Sc(i,On(s,i.current)))}function s0(){var i=B.H;return B.H=mc,i===null?mc:i}function o0(){var i=B.A;return B.A=N_,i}function fh(){ot=4,fr||(Ce&4194048)!==Ce&&Cn.current!==null||(Js=!0),(dr&134217727)===0&&(Wr&134217727)===0||Fe===null||mr(Fe,Ce,Dn,!1)}function dh(i,s,a){var l=Be;Be|=2;var f=s0(),m=o0();(Fe!==i||Ce!==s)&&(Oc=null,Ws(i,s)),s=!1;var b=ot;e:do try{if(Le!==0&&Oe!==null){var x=Oe,E=gn;switch(Le){case 8:uh(),b=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(s=!0);var j=Le;if(Le=0,gn=null,eo(i,x,E,j),a&&Js){b=0;break e}break;default:j=Le,Le=0,gn=null,eo(i,x,E,j)}}B_(),b=ot;break}catch(K){r0(i,K)}while(!0);return s&&i.shellSuspendCounter++,_i=Gr=null,Be=l,B.H=f,B.A=m,Oe===null&&(Fe=null,Ce=0,Xl()),b}function B_(){for(;Oe!==null;)a0(Oe)}function L_(i,s){var a=Be;Be|=2;var l=s0(),f=o0();Fe!==i||Ce!==s?(Oc=null,Rc=Te()+500,Ws(i,s)):Js=Xo(i,s);e:do try{if(Le!==0&&Oe!==null){s=Oe;var m=gn;t:switch(Le){case 1:Le=0,gn=null,eo(i,s,m,1);break;case 2:case 9:if(vb(m)){Le=0,gn=null,l0(s);break}s=function(){Le!==2&&Le!==9||Fe!==i||(Le=7),ri(i)},m.then(s,s);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:vb(m)?(Le=0,gn=null,l0(s)):(Le=0,gn=null,eo(i,s,m,7));break;case 5:var b=null;switch(Oe.tag){case 26:b=Oe.memoizedState;case 5:case 27:var x=Oe;if(!b||q0(b)){Le=0,gn=null;var E=x.sibling;if(E!==null)Oe=E;else{var j=x.return;j!==null?(Oe=j,kc(j)):Oe=null}break t}}Le=0,gn=null,eo(i,s,m,5);break;case 6:Le=0,gn=null,eo(i,s,m,6);break;case 8:uh(),ot=6;break e;default:throw Error(r(462))}}V_();break}catch(K){r0(i,K)}while(!0);return _i=Gr=null,B.H=l,B.A=f,Be=a,Oe!==null?0:(Fe=null,Ce=0,Xl(),ot)}function V_(){for(;Oe!==null&&!tt();)a0(Oe)}function a0(i){var s=$v(i.alternate,i,Bi);i.memoizedProps=i.pendingProps,s===null?kc(i):Oe=s}function l0(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=_v(a,s,s.pendingProps,s.type,void 0,Ce);break;case 11:s=_v(a,s,s.pendingProps,s.type.render,s.ref,Ce);break;case 5:Od(s);default:Bv(a,s),s=Oe=cb(s,Bi),s=$v(a,s,Bi)}i.memoizedProps=i.pendingProps,s===null?kc(i):Oe=s}function eo(i,s,a,l){_i=Gr=null,Od(s),Hs=null,Aa=0;var f=s.return;try{if(O_(i,f,s,a,Ce)){ot=1,Sc(i,On(a,i.current)),Oe=null;return}}catch(m){if(f!==null)throw Oe=f,m;ot=1,Sc(i,On(a,i.current)),Oe=null;return}s.flags&32768?($e||l===1?i=!0:Js||(Ce&536870912)!==0?i=!1:(fr=i=!0,(l===2||l===9||l===3||l===6)&&(l=Cn.current,l!==null&&l.tag===13&&(l.flags|=16384))),c0(s,i)):kc(s)}function kc(i){var s=i;do{if((s.flags&32768)!==0){c0(s,fr);return}i=s.return;var a=k_(s.alternate,s,Bi);if(a!==null){Oe=a;return}if(s=s.sibling,s!==null){Oe=s;return}Oe=s=i}while(s!==null);ot===0&&(ot=5)}function c0(i,s){do{var a=M_(i.alternate,i);if(a!==null){a.flags&=32767,Oe=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Oe=i;return}Oe=i=a}while(i!==null);ot=6,Oe=null}function u0(i,s,a,l,f,m,b,x,E){i.cancelPendingCommit=null;do Mc();while(Ut!==0);if((Be&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(m=s.lanes|s.childLanes,m|=nd,yO(i,a,m,b,x,E),i===Fe&&(Oe=Fe=null,Ce=0),Zs=s,pr=i,Qs=a,ah=m,lh=f,e0=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,P_(Tn,function(){return m0(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=P.p,P.p=2,b=Be,Be|=4;try{C_(i,s,a)}finally{Be=b,P.p=f,B.T=l}}Ut=1,f0(),d0(),h0()}}function f0(){if(Ut===1){Ut=0;var i=pr,s=Zs,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=P.p;P.p=2;var f=Be;Be|=4;try{Gv(s,i);var m=Ah,b=Wg(i.containerInfo),x=m.focusedElem,E=m.selectionRange;if(b!==x&&x&&x.ownerDocument&&Qg(x.ownerDocument.documentElement,x)){if(E!==null&&Zf(x)){var j=E.start,K=E.end;if(K===void 0&&(K=j),"selectionStart"in x)x.selectionStart=j,x.selectionEnd=Math.min(K,x.value.length);else{var F=x.ownerDocument||document,L=F&&F.defaultView||window;if(L.getSelection){var U=L.getSelection(),me=x.textContent.length,de=Math.min(E.start,me),Ke=E.end===void 0?de:Math.min(E.end,me);!U.extend&&de>Ke&&(b=Ke,Ke=de,de=b);var M=Zg(x,de),R=Zg(x,Ke);if(M&&R&&(U.rangeCount!==1||U.anchorNode!==M.node||U.anchorOffset!==M.offset||U.focusNode!==R.node||U.focusOffset!==R.offset)){var N=F.createRange();N.setStart(M.node,M.offset),U.removeAllRanges(),de>Ke?(U.addRange(N),U.extend(R.node,R.offset)):(N.setEnd(R.node,R.offset),U.addRange(N))}}}}for(F=[],U=x;U=U.parentNode;)U.nodeType===1&&F.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<F.length;x++){var q=F[x];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Pc=!!Th,Ah=Th=null}finally{Be=f,P.p=l,B.T=a}}i.current=s,Ut=2}}function d0(){if(Ut===2){Ut=0;var i=pr,s=Zs,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=P.p;P.p=2;var f=Be;Be|=4;try{qv(i,s.alternate,s)}finally{Be=f,P.p=l,B.T=a}}Ut=3}}function h0(){if(Ut===4||Ut===3){Ut=0,Rt();var i=pr,s=Zs,a=Qs,l=e0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Ut=5:(Ut=0,Zs=pr=null,p0(i,i.pendingLanes));var f=i.pendingLanes;if(f===0&&(hr=null),Mf(a),s=s.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(Jo,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=B.T,f=P.p,P.p=2,B.T=null;try{for(var m=i.onRecoverableError,b=0;b<l.length;b++){var x=l[b];m(x.value,{componentStack:x.stack})}}finally{B.T=s,P.p=f}}(Qs&3)!==0&&Mc(),ri(i),f=i.pendingLanes,(a&4194090)!==0&&(f&42)!==0?i===ch?Na++:(Na=0,ch=i):Na=0,$a(0)}}function p0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ha(s)))}function Mc(i){return f0(),d0(),h0(),m0()}function m0(){if(Ut!==5)return!1;var i=pr,s=ah;ah=0;var a=Mf(Qs),l=B.T,f=P.p;try{P.p=32>a?32:a,B.T=null,a=lh,lh=null;var m=pr,b=Qs;if(Ut=0,Zs=pr=null,Qs=0,(Be&6)!==0)throw Error(r(331));var x=Be;if(Be|=4,Qv(m.current),Jv(m,m.current,b,a),Be=x,$a(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(Jo,m)}catch{}return!0}finally{P.p=f,B.T=l,p0(i,s)}}function y0(i,s,a){s=On(a,s),s=Kd(i.stateNode,s,2),i=rr(i,s,2),i!==null&&(Zo(i,2),ri(i))}function qe(i,s,a){if(i.tag===3)y0(i,i,a);else for(;s!==null;){if(s.tag===3){y0(s,i,a);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(hr===null||!hr.has(l))){i=On(a,i),a=Sv(2),l=rr(s,a,2),l!==null&&(xv(a,l,s,i),Zo(l,2),ri(l));break}}s=s.return}}function hh(i,s,a){var l=i.pingCache;if(l===null){l=i.pingCache=new $_;var f=new Set;l.set(s,f)}else f=l.get(s),f===void 0&&(f=new Set,l.set(s,f));f.has(a)||(ih=!0,f.add(a),i=U_.bind(null,i,s,a),s.then(i,i))}function U_(i,s,a){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Fe===i&&(Ce&a)===a&&(ot===4||ot===3&&(Ce&62914560)===Ce&&300>Te()-oh?(Be&2)===0&&Ws(i,0):rh|=a,Xs===Ce&&(Xs=0)),ri(i)}function g0(i,s){s===0&&(s=hg()),i=js(i,s),i!==null&&(Zo(i,s),ri(i))}function z_(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),g0(i,a)}function K_(i,s){var a=0;switch(i.tag){case 13:var l=i.stateNode,f=i.memoizedState;f!==null&&(a=f.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),g0(i,a)}function P_(i,s){return Me(i,s)}var Cc=null,to=null,ph=!1,Dc=!1,mh=!1,es=0;function ri(i){i!==to&&i.next===null&&(to===null?Cc=to=i:to=to.next=i),Dc=!0,ph||(ph=!0,I_())}function $a(i,s){if(!mh&&Dc){mh=!0;do for(var a=!1,l=Cc;l!==null;){if(i!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var b=l.suspendedLanes,x=l.pingedLanes;m=(1<<31-dn(42|i)+1)-1,m&=f&~(b&~x),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,x0(l,m))}else m=Ce,m=Vl(l,l===Fe?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||Xo(l,m)||(a=!0,x0(l,m));l=l.next}while(a);mh=!1}}function q_(){b0()}function b0(){Dc=ph=!1;var i=0;es!==0&&(Q_()&&(i=es),es=0);for(var s=Te(),a=null,l=Cc;l!==null;){var f=l.next,m=v0(l,s);m===0?(l.next=null,a===null?Cc=f:a.next=f,f===null&&(to=a)):(a=l,(i!==0||(m&3)!==0)&&(Dc=!0)),l=f}$a(i)}function v0(i,s){for(var a=i.suspendedLanes,l=i.pingedLanes,f=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var b=31-dn(m),x=1<<b,E=f[b];E===-1?((x&a)===0||(x&l)!==0)&&(f[b]=mO(x,s)):E<=s&&(i.expiredLanes|=x),m&=~x}if(s=Fe,a=Ce,a=Vl(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,a===0||i===s&&(Le===2||Le===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Ee(l),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Xo(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(l!==null&&Ee(l),Mf(a)){case 2:case 8:a=Pt;break;case 32:a=Tn;break;case 268435456:a=An;break;default:a=Tn}return l=S0.bind(null,i),a=Me(a,l),i.callbackPriority=s,i.callbackNode=a,s}return l!==null&&l!==null&&Ee(l),i.callbackPriority=2,i.callbackNode=null,2}function S0(i,s){if(Ut!==0&&Ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Mc()&&i.callbackNode!==a)return null;var l=Ce;return l=Vl(i,i===Fe?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(n0(i,l,s),v0(i,Te()),i.callbackNode!=null&&i.callbackNode===a?S0.bind(null,i):null)}function x0(i,s){if(Mc())return null;n0(i,s,!0)}function I_(){ek(function(){(Be&6)!==0?Me(Jt,q_):b0()})}function yh(){return es===0&&(es=dg()),es}function w0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ql(""+i)}function T0(i,s){var a=s.ownerDocument.createElement("input");return a.name=s.name,a.value=s.value,i.id&&a.setAttribute("form",i.id),s.parentNode.insertBefore(a,s),i=new FormData(i),a.parentNode.removeChild(a),i}function H_(i,s,a,l,f){if(s==="submit"&&a&&a.stateNode===f){var m=w0((f[tn]||null).action),b=l.submitter;b&&(s=(s=b[tn]||null)?w0(s.formAction):b.getAttribute("formAction"),s!==null&&(m=s,b=null));var x=new Gl("action","action",null,l,f);i.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(es!==0){var E=b?T0(f,b):new FormData(f);Bd(a,{pending:!0,data:E,method:f.method,action:m},null,E)}}else typeof m=="function"&&(x.preventDefault(),E=b?T0(f,b):new FormData(f),Bd(a,{pending:!0,data:E,method:f.method,action:m},m,E))},currentTarget:f}]})}}for(var gh=0;gh<td.length;gh++){var bh=td[gh],F_=bh.toLowerCase(),G_=bh[0].toUpperCase()+bh.slice(1);qn(F_,"on"+G_)}qn(nb,"onAnimationEnd"),qn(ib,"onAnimationIteration"),qn(rb,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(u_,"onTransitionRun"),qn(f_,"onTransitionStart"),qn(d_,"onTransitionCancel"),qn(sb,"onTransitionEnd"),Es("onMouseEnter",["mouseout","mouseover"]),Es("onMouseLeave",["mouseout","mouseover"]),Es("onPointerEnter",["pointerout","pointerover"]),Es("onPointerLeave",["pointerout","pointerover"]),Vr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ja="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(" "),Y_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ja));function A0(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var l=i[a],f=l.event;l=l.listeners;e:{var m=void 0;if(s)for(var b=l.length-1;0<=b;b--){var x=l[b],E=x.instance,j=x.currentTarget;if(x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=j;try{m(f)}catch(K){vc(K)}f.currentTarget=null,m=E}else for(b=0;b<l.length;b++){if(x=l[b],E=x.instance,j=x.currentTarget,x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=j;try{m(f)}catch(K){vc(K)}f.currentTarget=null,m=E}}}}function _e(i,s){var a=s[Cf];a===void 0&&(a=s[Cf]=new Set);var l=i+"__bubble";a.has(l)||(E0(s,i,2,!1),a.add(l))}function vh(i,s,a){var l=0;s&&(l|=4),E0(a,i,l,s)}var Nc="_reactListening"+Math.random().toString(36).slice(2);function Sh(i){if(!i[Nc]){i[Nc]=!0,bg.forEach(function(a){a!=="selectionchange"&&(Y_.has(a)||vh(a,!1,i),vh(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Nc]||(s[Nc]=!0,vh("selectionchange",!1,s))}}function E0(i,s,a,l){switch(J0(s)){case 2:var f=xk;break;case 8:f=wk;break;default:f=$h}a=f.bind(null,s,a,i),f=void 0,!Pf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),l?f!==void 0?i.addEventListener(s,a,{capture:!0,passive:f}):i.addEventListener(s,a,!0):f!==void 0?i.addEventListener(s,a,{passive:f}):i.addEventListener(s,a,!1)}function xh(i,s,a,l,f){var m=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var b=l.tag;if(b===3||b===4){var x=l.stateNode.containerInfo;if(x===f)break;if(b===4)for(b=l.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;x!==null;){if(b=ws(x),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){l=m=b;continue e}x=x.parentNode}}l=l.return}Dg(function(){var j=m,K=zf(a),F=[];e:{var L=ob.get(i);if(L!==void 0){var U=Gl,me=i;switch(i){case"keypress":if(Hl(a)===0)break e;case"keydown":case"keyup":U=PO;break;case"focusin":me="focus",U=Ff;break;case"focusout":me="blur",U=Ff;break;case"beforeblur":case"afterblur":U=Ff;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=jg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=MO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=HO;break;case nb:case ib:case rb:U=NO;break;case sb:U=GO;break;case"scroll":case"scrollend":U=_O;break;case"wheel":U=JO;break;case"copy":case"cut":case"paste":U=jO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Lg;break;case"toggle":case"beforetoggle":U=ZO}var de=(s&4)!==0,Ke=!de&&(i==="scroll"||i==="scrollend"),M=de?L!==null?L+"Capture":null:L;de=[];for(var R=j,N;R!==null;){var q=R;if(N=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||N===null||M===null||(q=ea(R,M),q!=null&&de.push(Ba(R,q,N))),Ke)break;R=R.return}0<de.length&&(L=new U(L,me,null,a,K),F.push({event:L,listeners:de}))}}if((s&7)===0){e:{if(L=i==="mouseover"||i==="pointerover",U=i==="mouseout"||i==="pointerout",L&&a!==Uf&&(me=a.relatedTarget||a.fromElement)&&(ws(me)||me[xs]))break e;if((U||L)&&(L=K.window===K?K:(L=K.ownerDocument)?L.defaultView||L.parentWindow:window,U?(me=a.relatedTarget||a.toElement,U=j,me=me?ws(me):null,me!==null&&(Ke=c(me),de=me.tag,me!==Ke||de!==5&&de!==27&&de!==6)&&(me=null)):(U=null,me=j),U!==me)){if(de=jg,q="onMouseLeave",M="onMouseEnter",R="mouse",(i==="pointerout"||i==="pointerover")&&(de=Lg,q="onPointerLeave",M="onPointerEnter",R="pointer"),Ke=U==null?L:Wo(U),N=me==null?L:Wo(me),L=new de(q,R+"leave",U,a,K),L.target=Ke,L.relatedTarget=N,q=null,ws(K)===j&&(de=new de(M,R+"enter",me,a,K),de.target=N,de.relatedTarget=Ke,q=de),Ke=q,U&&me)t:{for(de=U,M=me,R=0,N=de;N;N=no(N))R++;for(N=0,q=M;q;q=no(q))N++;for(;0<R-N;)de=no(de),R--;for(;0<N-R;)M=no(M),N--;for(;R--;){if(de===M||M!==null&&de===M.alternate)break t;de=no(de),M=no(M)}de=null}else de=null;U!==null&&R0(F,L,U,de,!1),me!==null&&Ke!==null&&R0(F,Ke,me,de,!0)}}e:{if(L=j?Wo(j):window,U=L.nodeName&&L.nodeName.toLowerCase(),U==="select"||U==="input"&&L.type==="file")var re=Hg;else if(qg(L))if(Fg)re=a_;else{re=s_;var Re=r_}else U=L.nodeName,!U||U.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?j&&Vf(j.elementType)&&(re=Hg):re=o_;if(re&&(re=re(i,j))){Ig(F,re,a,K);break e}Re&&Re(i,L,j),i==="focusout"&&j&&L.type==="number"&&j.memoizedProps.value!=null&&Lf(L,"number",L.value)}switch(Re=j?Wo(j):window,i){case"focusin":(qg(Re)||Re.contentEditable==="true")&&(Ds=Re,Qf=j,la=null);break;case"focusout":la=Qf=Ds=null;break;case"mousedown":Wf=!0;break;case"contextmenu":case"mouseup":case"dragend":Wf=!1,eb(F,a,K);break;case"selectionchange":if(c_)break;case"keydown":case"keyup":eb(F,a,K)}var ce;if(Yf)e:{switch(i){case"compositionstart":var he="onCompositionStart";break e;case"compositionend":he="onCompositionEnd";break e;case"compositionupdate":he="onCompositionUpdate";break e}he=void 0}else Cs?Kg(i,a)&&(he="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(he="onCompositionStart");he&&(Vg&&a.locale!=="ko"&&(Cs||he!=="onCompositionStart"?he==="onCompositionEnd"&&Cs&&(ce=Ng()):(er=K,qf="value"in er?er.value:er.textContent,Cs=!0)),Re=$c(j,he),0<Re.length&&(he=new Bg(he,i,null,a,K),F.push({event:he,listeners:Re}),ce?he.data=ce:(ce=Pg(a),ce!==null&&(he.data=ce)))),(ce=WO?e_(i,a):t_(i,a))&&(he=$c(j,"onBeforeInput"),0<he.length&&(Re=new Bg("onBeforeInput","beforeinput",null,a,K),F.push({event:Re,listeners:he}),Re.data=ce)),H_(F,i,j,a,K)}A0(F,s)})}function Ba(i,s,a){return{instance:i,listener:s,currentTarget:a}}function $c(i,s){for(var a=s+"Capture",l=[];i!==null;){var f=i,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=ea(i,a),f!=null&&l.unshift(Ba(i,f,m)),f=ea(i,s),f!=null&&l.push(Ba(i,f,m))),i.tag===3)return l;i=i.return}return[]}function no(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function R0(i,s,a,l,f){for(var m=s._reactName,b=[];a!==null&&a!==l;){var x=a,E=x.alternate,j=x.stateNode;if(x=x.tag,E!==null&&E===l)break;x!==5&&x!==26&&x!==27||j===null||(E=j,f?(j=ea(a,m),j!=null&&b.unshift(Ba(a,j,E))):f||(j=ea(a,m),j!=null&&b.push(Ba(a,j,E)))),a=a.return}b.length!==0&&i.push({event:s,listeners:b})}var J_=/\r\n?/g,X_=/\u0000|\uFFFD/g;function O0(i){return(typeof i=="string"?i:""+i).replace(J_,`
63
- `).replace(X_,"")}function _0(i,s){return s=O0(s),O0(i)===s}function jc(){}function ze(i,s,a,l,f,m){switch(a){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||_s(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&_s(i,""+l);break;case"className":zl(i,"class",l);break;case"tabIndex":zl(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":zl(i,a,l);break;case"style":Mg(i,l,m);break;case"data":if(s!=="object"){zl(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=ql(""+l),i.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(a,"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 m=="function"&&(a==="formAction"?(s!=="input"&&ze(i,s,"name",f.name,f,null),ze(i,s,"formEncType",f.formEncType,f,null),ze(i,s,"formMethod",f.formMethod,f,null),ze(i,s,"formTarget",f.formTarget,f,null)):(ze(i,s,"encType",f.encType,f,null),ze(i,s,"method",f.method,f,null),ze(i,s,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=ql(""+l),i.setAttribute(a,l);break;case"onClick":l!=null&&(i.onclick=jc);break;case"onScroll":l!=null&&_e("scroll",i);break;case"onScrollEnd":l!=null&&_e("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}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}a=ql(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+l):i.removeAttribute(a);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(a,""):i.removeAttribute(a);break;case"capture":case"download":l===!0?i.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,l):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(a,l):i.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(a):i.setAttribute(a,l);break;case"popover":_e("beforetoggle",i),_e("toggle",i),Ul(i,"popover",l);break;case"xlinkActuate":Ti(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ti(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ti(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ti(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ti(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ti(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ul(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=RO.get(a)||a,Ul(i,a,l))}}function wh(i,s,a,l,f,m){switch(a){case"style":Mg(i,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof l=="string"?_s(i,l):(typeof l=="number"||typeof l=="bigint")&&_s(i,""+l);break;case"onScroll":l!=null&&_e("scroll",i);break;case"onScrollEnd":l!=null&&_e("scrollend",i);break;case"onClick":l!=null&&(i.onclick=jc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!vg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),s=a.slice(2,f?a.length-7:void 0),m=i[tn]||null,m=m!=null?m[a]:null,typeof m=="function"&&i.removeEventListener(s,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(s,l,f);break e}a in i?i[a]=l:l===!0?i.setAttribute(a,""):Ul(i,a,l)}}}function zt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",i),_e("load",i);var l=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,m,b,a,null)}}f&&ze(i,s,"srcSet",a.srcSet,a,null),l&&ze(i,s,"src",a.src,a,null);return;case"input":_e("invalid",i);var x=m=b=f=null,E=null,j=null;for(l in a)if(a.hasOwnProperty(l)){var K=a[l];if(K!=null)switch(l){case"name":f=K;break;case"type":b=K;break;case"checked":E=K;break;case"defaultChecked":j=K;break;case"value":m=K;break;case"defaultValue":x=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,s));break;default:ze(i,s,l,K,a,null)}}Rg(i,m,x,E,j,b,f,!1),Kl(i);return;case"select":_e("invalid",i),l=b=m=null;for(f in a)if(a.hasOwnProperty(f)&&(x=a[f],x!=null))switch(f){case"value":m=x;break;case"defaultValue":b=x;break;case"multiple":l=x;default:ze(i,s,f,x,a,null)}s=m,a=b,i.multiple=!!l,s!=null?Os(i,!!l,s,!1):a!=null&&Os(i,!!l,a,!0);return;case"textarea":_e("invalid",i),m=f=l=null;for(b in a)if(a.hasOwnProperty(b)&&(x=a[b],x!=null))switch(b){case"value":l=x;break;case"defaultValue":f=x;break;case"children":m=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:ze(i,s,b,x,a,null)}_g(i,l,f,m),Kl(i);return;case"option":for(E in a)if(a.hasOwnProperty(E)&&(l=a[E],l!=null))switch(E){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ze(i,s,E,l,a,null)}return;case"dialog":_e("beforetoggle",i),_e("toggle",i),_e("cancel",i),_e("close",i);break;case"iframe":case"object":_e("load",i);break;case"video":case"audio":for(l=0;l<ja.length;l++)_e(ja[l],i);break;case"image":_e("error",i),_e("load",i);break;case"details":_e("toggle",i);break;case"embed":case"source":case"link":_e("error",i),_e("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(j in a)if(a.hasOwnProperty(j)&&(l=a[j],l!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,j,l,a,null)}return;default:if(Vf(s)){for(K in a)a.hasOwnProperty(K)&&(l=a[K],l!==void 0&&wh(i,s,K,l,a,void 0));return}}for(x in a)a.hasOwnProperty(x)&&(l=a[x],l!=null&&ze(i,s,x,l,a,null))}function Z_(i,s,a,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,b=null,x=null,E=null,j=null,K=null;for(U in a){var F=a[U];if(a.hasOwnProperty(U)&&F!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":E=F;default:l.hasOwnProperty(U)||ze(i,s,U,null,l,F)}}for(var L in l){var U=l[L];if(F=a[L],l.hasOwnProperty(L)&&(U!=null||F!=null))switch(L){case"type":m=U;break;case"name":f=U;break;case"checked":j=U;break;case"defaultChecked":K=U;break;case"value":b=U;break;case"defaultValue":x=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(r(137,s));break;default:U!==F&&ze(i,s,L,U,l,F)}}Bf(i,b,x,E,j,K,m,f);return;case"select":U=b=x=L=null;for(m in a)if(E=a[m],a.hasOwnProperty(m)&&E!=null)switch(m){case"value":break;case"multiple":U=E;default:l.hasOwnProperty(m)||ze(i,s,m,null,l,E)}for(f in l)if(m=l[f],E=a[f],l.hasOwnProperty(f)&&(m!=null||E!=null))switch(f){case"value":L=m;break;case"defaultValue":x=m;break;case"multiple":b=m;default:m!==E&&ze(i,s,f,m,l,E)}s=x,a=b,l=U,L!=null?Os(i,!!a,L,!1):!!l!=!!a&&(s!=null?Os(i,!!a,s,!0):Os(i,!!a,a?[]:"",!1));return;case"textarea":U=L=null;for(x in a)if(f=a[x],a.hasOwnProperty(x)&&f!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:ze(i,s,x,null,l,f)}for(b in l)if(f=l[b],m=a[b],l.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":L=f;break;case"defaultValue":U=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==m&&ze(i,s,b,f,l,m)}Og(i,L,U);return;case"option":for(var me in a)if(L=a[me],a.hasOwnProperty(me)&&L!=null&&!l.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:ze(i,s,me,null,l,L)}for(E in l)if(L=l[E],U=a[E],l.hasOwnProperty(E)&&L!==U&&(L!=null||U!=null))switch(E){case"selected":i.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:ze(i,s,E,L,l,U)}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 de in a)L=a[de],a.hasOwnProperty(de)&&L!=null&&!l.hasOwnProperty(de)&&ze(i,s,de,null,l,L);for(j in l)if(L=l[j],U=a[j],l.hasOwnProperty(j)&&L!==U&&(L!=null||U!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(137,s));break;default:ze(i,s,j,L,l,U)}return;default:if(Vf(s)){for(var Ke in a)L=a[Ke],a.hasOwnProperty(Ke)&&L!==void 0&&!l.hasOwnProperty(Ke)&&wh(i,s,Ke,void 0,l,L);for(K in l)L=l[K],U=a[K],!l.hasOwnProperty(K)||L===U||L===void 0&&U===void 0||wh(i,s,K,L,l,U);return}}for(var M in a)L=a[M],a.hasOwnProperty(M)&&L!=null&&!l.hasOwnProperty(M)&&ze(i,s,M,null,l,L);for(F in l)L=l[F],U=a[F],!l.hasOwnProperty(F)||L===U||L==null&&U==null||ze(i,s,F,L,l,U)}var Th=null,Ah=null;function Bc(i){return i.nodeType===9?i:i.ownerDocument}function k0(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 M0(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 Eh(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 Rh=null;function Q_(){var i=window.event;return i&&i.type==="popstate"?i===Rh?!1:(Rh=i,!0):(Rh=null,!1)}var C0=typeof setTimeout=="function"?setTimeout:void 0,W_=typeof clearTimeout=="function"?clearTimeout:void 0,D0=typeof Promise=="function"?Promise:void 0,ek=typeof queueMicrotask=="function"?queueMicrotask:typeof D0<"u"?function(i){return D0.resolve(null).then(i).catch(tk)}:C0;function tk(i){setTimeout(function(){throw i})}function yr(i){return i==="head"}function N0(i,s){var a=s,l=0,f=0;do{var m=a.nextSibling;if(i.removeChild(a),m&&m.nodeType===8)if(a=m.data,a==="/$"){if(0<l&&8>l){a=l;var b=i.ownerDocument;if(a&1&&La(b.documentElement),a&2&&La(b.body),a&4)for(a=b.head,La(a),b=a.firstChild;b;){var x=b.nextSibling,E=b.nodeName;b[Qo]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&b.rel.toLowerCase()==="stylesheet"||a.removeChild(b),b=x}}if(f===0){i.removeChild(m),Ha(s);return}f--}else a==="$"||a==="$?"||a==="$!"?f++:l=a.charCodeAt(0)-48;else l=0;a=m}while(a);Ha(s)}function Oh(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Oh(a),Df(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function nk(i,s,a,l){for(;i.nodeType===1;){var f=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Qo])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==f.rel||i.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||i.getAttribute("title")!==(f.title==null?null:f.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(f.src==null?null:f.src)||i.getAttribute("type")!==(f.type==null?null:f.type)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Hn(i.nextSibling),i===null)break}return null}function ik(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Hn(i.nextSibling),i===null))return null;return i}function _h(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function rk(i,s){var a=i.ownerDocument;if(i.data!=="$?"||a.readyState==="complete")s();else{var l=function(){s(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function Hn(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==="F!"||s==="F")break;if(s==="/$")return null}}return i}var kh=null;function $0(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return i;s--}else a==="/$"&&s++}i=i.previousSibling}return null}function j0(i,s,a){switch(s=Bc(a),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 La(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);Df(i)}var Nn=new Map,B0=new Set;function Lc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Li=P.d;P.d={f:sk,r:ok,D:ak,C:lk,L:ck,m:uk,X:dk,S:fk,M:hk};function sk(){var i=Li.f(),s=_c();return i||s}function ok(i){var s=Ts(i);s!==null&&s.tag===5&&s.type==="form"?nv(s):Li.r(i)}var io=typeof document>"u"?null:document;function L0(i,s,a){var l=io;if(l&&typeof s=="string"&&s){var f=Rn(s);f='link[rel="'+i+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),B0.has(f)||(B0.add(f),i={rel:i,crossOrigin:a,href:s},l.querySelector(f)===null&&(s=l.createElement("link"),zt(s,"link",i),Ct(s),l.head.appendChild(s)))}}function ak(i){Li.D(i),L0("dns-prefetch",i,null)}function lk(i,s){Li.C(i,s),L0("preconnect",i,s)}function ck(i,s,a){Li.L(i,s,a);var l=io;if(l&&i&&s){var f='link[rel="preload"][as="'+Rn(s)+'"]';s==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Rn(a.imageSizes)+'"]')):f+='[href="'+Rn(i)+'"]';var m=f;switch(s){case"style":m=ro(i);break;case"script":m=so(i)}Nn.has(m)||(i=y({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Nn.set(m,i),l.querySelector(f)!==null||s==="style"&&l.querySelector(Va(m))||s==="script"&&l.querySelector(Ua(m))||(s=l.createElement("link"),zt(s,"link",i),Ct(s),l.head.appendChild(s)))}}function uk(i,s){Li.m(i,s);var a=io;if(a&&i){var l=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+Rn(l)+'"][href="'+Rn(i)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=so(i)}if(!Nn.has(m)&&(i=y({rel:"modulepreload",href:i},s),Nn.set(m,i),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(m)))return}l=a.createElement("link"),zt(l,"link",i),Ct(l),a.head.appendChild(l)}}}function fk(i,s,a){Li.S(i,s,a);var l=io;if(l&&i){var f=As(l).hoistableStyles,m=ro(i);s=s||"default";var b=f.get(m);if(!b){var x={loading:0,preload:null};if(b=l.querySelector(Va(m)))x.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Nn.get(m))&&Mh(i,a);var E=b=l.createElement("link");Ct(E),zt(E,"link",i),E._p=new Promise(function(j,K){E.onload=j,E.onerror=K}),E.addEventListener("load",function(){x.loading|=1}),E.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Vc(b,s,l)}b={type:"stylesheet",instance:b,count:1,state:x},f.set(m,b)}}}function dk(i,s){Li.X(i,s);var a=io;if(a&&i){var l=As(a).hoistableScripts,f=so(i),m=l.get(f);m||(m=a.querySelector(Ua(f)),m||(i=y({src:i,async:!0},s),(s=Nn.get(f))&&Ch(i,s),m=a.createElement("script"),Ct(m),zt(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function hk(i,s){Li.M(i,s);var a=io;if(a&&i){var l=As(a).hoistableScripts,f=so(i),m=l.get(f);m||(m=a.querySelector(Ua(f)),m||(i=y({src:i,async:!0,type:"module"},s),(s=Nn.get(f))&&Ch(i,s),m=a.createElement("script"),Ct(m),zt(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function V0(i,s,a,l){var f=(f=le.current)?Lc(f):null;if(!f)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=ro(a.href),a=As(f).hoistableStyles,l=a.get(s),l||(l={type:"style",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=ro(a.href);var m=As(f).hoistableStyles,b=m.get(i);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,b),(m=f.querySelector(Va(i)))&&!m._p&&(b.instance=m,b.state.loading=5),Nn.has(i)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Nn.set(i,a),m||pk(f,i,a,b.state))),s&&l===null)throw Error(r(528,""));return b}if(s&&l!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=so(a),a=As(f).hoistableScripts,l=a.get(s),l||(l={type:"script",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ro(i){return'href="'+Rn(i)+'"'}function Va(i){return'link[rel="stylesheet"]['+i+"]"}function U0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function pk(i,s,a,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}),zt(s,"link",a),Ct(s),i.head.appendChild(s))}function so(i){return'[src="'+Rn(i)+'"]'}function Ua(i){return"script[async]"+i}function z0(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(l)return s.instance=l,Ct(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Ct(l),zt(l,"style",f),Vc(l,a.precedence,i),s.instance=l;case"stylesheet":f=ro(a.href);var m=i.querySelector(Va(f));if(m)return s.state.loading|=4,s.instance=m,Ct(m),m;l=U0(a),(f=Nn.get(f))&&Mh(l,f),m=(i.ownerDocument||i).createElement("link"),Ct(m);var b=m;return b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),zt(m,"link",l),s.state.loading|=4,Vc(m,a.precedence,i),s.instance=m;case"script":return m=so(a.src),(f=i.querySelector(Ua(m)))?(s.instance=f,Ct(f),f):(l=a,(f=Nn.get(m))&&(l=y({},a),Ch(l,f)),i=i.ownerDocument||i,f=i.createElement("script"),Ct(f),zt(f,"link",l),i.head.appendChild(f),s.instance=f);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,Vc(l,a.precedence,i));return s.instance}function Vc(i,s,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,b=0;b<l.length;b++){var x=l[b];if(x.dataset.precedence===s)m=x;else if(m!==f)break}m?m.parentNode.insertBefore(i,m.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function Mh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Ch(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Uc=null;function K0(i,s,a){if(Uc===null){var l=new Map,f=Uc=new Map;f.set(a,l)}else f=Uc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(i))return l;for(l.set(i,null),a=a.getElementsByTagName(i),f=0;f<a.length;f++){var m=a[f];if(!(m[Qo]||m[qt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(s)||"";b=i+b;var x=l.get(b);x?x.push(m):l.set(b,[m])}}return l}function P0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function mk(i,s,a){if(a===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 q0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var za=null;function yk(){}function gk(i,s,a){if(za===null)throw Error(r(475));var l=za;if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var f=ro(a.href),m=i.querySelector(Va(f));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(l.count++,l=zc.bind(l),i.then(l,l)),s.state.loading|=4,s.instance=m,Ct(m);return}m=i.ownerDocument||i,a=U0(a),(f=Nn.get(f))&&Mh(a,f),m=m.createElement("link"),Ct(m);var b=m;b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),zt(m,"link",a),s.instance=m}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(l.count++,s=zc.bind(l),i.addEventListener("load",s),i.addEventListener("error",s))}}function bk(){if(za===null)throw Error(r(475));var i=za;return i.stylesheets&&i.count===0&&Dh(i,i.stylesheets),0<i.count?function(s){var a=setTimeout(function(){if(i.stylesheets&&Dh(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(a)}}:null}function zc(){if(this.count--,this.count===0){if(this.stylesheets)Dh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Kc=null;function Dh(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Kc=new Map,s.forEach(vk,i),Kc=null,zc.call(i))}function vk(i,s){if(!(s.state.loading&4)){var a=Kc.get(i);if(a)var l=a.get(null);else{a=new Map,Kc.set(i,a);for(var f=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),l=b)}l&&a.set(null,l)}f=s.instance,b=f.getAttribute("data-precedence"),m=a.get(b)||l,m===l&&a.set(null,f),a.set(b,f),this.count++,l=zc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(f,i.firstChild)),s.state.loading|=4}}var Ka={$$typeof:k,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function Sk(i,s,a,l,f,m,b,x){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=_f(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=_f(0),this.hiddenUpdates=_f(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function I0(i,s,a,l,f,m,b,x,E,j,K,F){return i=new Sk(i,s,a,b,x,E,j,F),s=1,m===!0&&(s|=24),m=pn(3,null,null,s),i.current=m,m.stateNode=i,s=hd(),s.refCount++,i.pooledCache=s,s.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:s},gd(m),i}function H0(i){return i?(i=Bs,i):Bs}function F0(i,s,a,l,f,m){f=H0(f),l.context===null?l.context=f:l.pendingContext=f,l=ir(s),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=rr(i,l,s),a!==null&&(vn(a,i,s),ga(a,i,s))}function G0(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function Nh(i,s){G0(i,s),(i=i.alternate)&&G0(i,s)}function Y0(i){if(i.tag===13){var s=js(i,67108864);s!==null&&vn(s,i,67108864),Nh(i,67108864)}}var Pc=!0;function xk(i,s,a,l){var f=B.T;B.T=null;var m=P.p;try{P.p=2,$h(i,s,a,l)}finally{P.p=m,B.T=f}}function wk(i,s,a,l){var f=B.T;B.T=null;var m=P.p;try{P.p=8,$h(i,s,a,l)}finally{P.p=m,B.T=f}}function $h(i,s,a,l){if(Pc){var f=jh(l);if(f===null)xh(i,s,l,qc,a),X0(i,l);else if(Ak(f,i,s,a,l))l.stopPropagation();else if(X0(i,l),s&4&&-1<Tk.indexOf(i)){for(;f!==null;){var m=Ts(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Lr(m.pendingLanes);if(b!==0){var x=m;for(x.pendingLanes|=2,x.entangledLanes|=2;b;){var E=1<<31-dn(b);x.entanglements[1]|=E,b&=~E}ri(m),(Be&6)===0&&(Rc=Te()+500,$a(0))}}break;case 13:x=js(m,2),x!==null&&vn(x,m,2),_c(),Nh(m,2)}if(m=jh(l),m===null&&xh(i,s,l,qc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else xh(i,s,l,null,a)}}function jh(i){return i=zf(i),Bh(i)}var qc=null;function Bh(i){if(qc=null,i=ws(i),i!==null){var s=c(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=u(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return qc=i,null}function J0(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(Pn()){case Jt:return 2;case Pt:return 8;case Tn:case Qn:return 32;case An:return 268435456;default:return 32}default:return 32}}var Lh=!1,gr=null,br=null,vr=null,Pa=new Map,qa=new Map,Sr=[],Tk="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 X0(i,s){switch(i){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":br=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":Pa.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":qa.delete(s.pointerId)}}function Ia(i,s,a,l,f,m){return i===null||i.nativeEvent!==m?(i={blockedOn:s,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},s!==null&&(s=Ts(s),s!==null&&Y0(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),i)}function Ak(i,s,a,l,f){switch(s){case"focusin":return gr=Ia(gr,i,s,a,l,f),!0;case"dragenter":return br=Ia(br,i,s,a,l,f),!0;case"mouseover":return vr=Ia(vr,i,s,a,l,f),!0;case"pointerover":var m=f.pointerId;return Pa.set(m,Ia(Pa.get(m)||null,i,s,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,qa.set(m,Ia(qa.get(m)||null,i,s,a,l,f)),!0}return!1}function Z0(i){var s=ws(i.target);if(s!==null){var a=c(s);if(a!==null){if(s=a.tag,s===13){if(s=u(a),s!==null){i.blockedOn=s,gO(i.priority,function(){if(a.tag===13){var l=bn();l=kf(l);var f=js(a,l);f!==null&&vn(f,a,l),Nh(a,l)}});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ic(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=jh(i.nativeEvent);if(a===null){a=i.nativeEvent;var l=new a.constructor(a.type,a);Uf=l,a.target.dispatchEvent(l),Uf=null}else return s=Ts(a),s!==null&&Y0(s),i.blockedOn=a,!1;s.shift()}return!0}function Q0(i,s,a){Ic(i)&&a.delete(s)}function Ek(){Lh=!1,gr!==null&&Ic(gr)&&(gr=null),br!==null&&Ic(br)&&(br=null),vr!==null&&Ic(vr)&&(vr=null),Pa.forEach(Q0),qa.forEach(Q0)}function Hc(i,s){i.blockedOn===s&&(i.blockedOn=null,Lh||(Lh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ek)))}var Fc=null;function W0(i){Fc!==i&&(Fc=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fc===i&&(Fc=null);for(var s=0;s<i.length;s+=3){var a=i[s],l=i[s+1],f=i[s+2];if(typeof l!="function"){if(Bh(l||a)===null)continue;break}var m=Ts(a);m!==null&&(i.splice(s,3),s-=3,Bd(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ha(i){function s(E){return Hc(E,i)}gr!==null&&Hc(gr,i),br!==null&&Hc(br,i),vr!==null&&Hc(vr,i),Pa.forEach(s),qa.forEach(s);for(var a=0;a<Sr.length;a++){var l=Sr[a];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Sr.length&&(a=Sr[0],a.blockedOn===null);)Z0(a),a.blockedOn===null&&Sr.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],b=f[tn]||null;if(typeof m=="function")b||W0(a);else if(b){var x=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[tn]||null)x=b.formAction;else if(Bh(f)!==null)continue}else x=b.action;typeof x=="function"?a[l+1]=x:(a.splice(l,3),l-=3),W0(a)}}}function Vh(i){this._internalRoot=i}Gc.prototype.render=Vh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,l=bn();F0(a,l,i,s,null,null)},Gc.prototype.unmount=Vh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;F0(i.current,2,null,i,null,null),_c(),s[xs]=null}};function Gc(i){this._internalRoot=i}Gc.prototype.unstable_scheduleHydration=function(i){if(i){var s=yg();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Sr.length&&s!==0&&s<Sr[a].priority;a++);Sr.splice(a,0,i),a===0&&Z0(i)}};var eS=e.version;if(eS!=="19.1.1")throw Error(r(527,eS,"19.1.1"));P.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=h(s),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var Rk={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yc.isDisabled&&Yc.supportsFiber)try{Jo=Yc.inject(Rk),fn=Yc}catch{}}return Ga.createRoot=function(i,s){if(!o(i))throw Error(r(299));var a=!1,l="",f=yv,m=gv,b=bv,x=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(m=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(x=s.unstable_transitionCallbacks)),s=I0(i,1,!1,null,null,a,l,f,m,b,x,null),i[xs]=s.current,Sh(i),new Vh(s)},Ga.hydrateRoot=function(i,s,a){if(!o(i))throw Error(r(299));var l=!1,f="",m=yv,b=gv,x=bv,E=null,j=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(E=a.unstable_transitionCallbacks),a.formState!==void 0&&(j=a.formState)),s=I0(i,1,!0,s,a??null,l,f,m,b,x,E,j),s.context=H0(null),a=s.current,l=bn(),l=kf(l),f=ir(l),f.callback=null,rr(a,f,l),a=l,s.current.lanes=a,Zo(s,a),ri(s),i[xs]=s.current,Sh(i),new Gc(s)},Ga.version="19.1.1",Ga}var hS;function FM(){if(hS)return Ph.exports;hS=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(),Ph.exports=HM(),Ph.exports}var GM=FM();function rf(){return typeof window<"u"}function jr(t){return $1(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=($1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $1(t){return rf()?t instanceof Node||t instanceof xn(t).Node:!1}function ht(t){return rf()?t instanceof Element||t instanceof xn(t).Element:!1}function Mt(t){return rf()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Bp(t){return!rf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}const YM=new Set(["inline","contents"]);function vl(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Kn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!YM.has(o)}const JM=new Set(["table","td","th"]);function XM(t){return JM.has(jr(t))}const ZM=[":popover-open",":modal"];function sf(t){return ZM.some(e=>{try{return t.matches(e)}catch{return!1}})}const QM=["transform","translate","scale","rotate","perspective"],WM=["transform","translate","scale","rotate","perspective","filter"],eC=["paint","layout","strict","content"];function ey(t){const e=of(),n=ht(t)?Kn(t):t;return QM.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)||WM.some(r=>(n.willChange||"").includes(r))||eC.some(r=>(n.contain||"").includes(r))}function tC(t){let e=qi(t);for(;Mt(e)&&!Ki(e);){if(ey(e))return e;if(sf(e))return null;e=qi(e)}return null}function of(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const nC=new Set(["html","body","#document"]);function Ki(t){return nC.has(jr(t))}function Kn(t){return xn(t).getComputedStyle(t)}function af(t){return ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function qi(t){if(jr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Bp(t)&&t.host||bi(t);return Bp(e)?e.host:e}function j1(t){const e=qi(t);return Ki(e)?t.ownerDocument?t.ownerDocument.body:t.body:Mt(e)&&vl(e)?e:j1(e)}function kr(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=j1(t),c=o===((r=t.ownerDocument)==null?void 0:r.body),u=xn(o);if(c){const d=Lp(u);return e.concat(u,u.visualViewport||[],vl(o)?o:[],d&&n?kr(d):[])}return e.concat(o,kr(o,[],n))}function Lp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const ku=Math.min,ls=Math.max,Mu=Math.round,Xc=Math.floor,ci=t=>({x:t,y:t}),iC={left:"right",right:"left",bottom:"top",top:"bottom"},rC={start:"end",end:"start"};function pS(t,e,n){return ls(t,ku(e,n))}function lf(t,e){return typeof t=="function"?t(e):t}function ds(t){return t.split("-")[0]}function cf(t){return t.split("-")[1]}function B1(t){return t==="x"?"y":"x"}function L1(t){return t==="y"?"height":"width"}const sC=new Set(["top","bottom"]);function Rr(t){return sC.has(ds(t))?"y":"x"}function V1(t){return B1(Rr(t))}function oC(t,e,n){n===void 0&&(n=!1);const r=cf(t),o=V1(t),c=L1(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(u=Cu(u)),[u,Cu(u)]}function aC(t){const e=Cu(t);return[Vp(t),e,Vp(e)]}function Vp(t){return t.replace(/start|end/g,e=>rC[e])}const mS=["left","right"],yS=["right","left"],lC=["top","bottom"],cC=["bottom","top"];function uC(t,e,n){switch(t){case"top":case"bottom":return n?e?yS:mS:e?mS:yS;case"left":case"right":return e?lC:cC;default:return[]}}function fC(t,e,n,r){const o=cf(t);let c=uC(ds(t),n==="start",r);return o&&(c=c.map(u=>u+"-"+o),e&&(c=c.concat(c.map(Vp)))),c}function Cu(t){return t.replace(/left|right|bottom|top/g,e=>iC[e])}function dC(t){return{top:0,right:0,bottom:0,left:0,...t}}function hC(t){return typeof t!="number"?dC(t):{top:t,right:t,bottom:t,left:t}}function Du(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
62
+ `+a.stack}}function En(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Eg(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function TO(i){var s=Eg(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),l=""+i[s];if(!i.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,m=a.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return f.call(this)},set:function(b){l=""+b,m.call(this,b)}}),Object.defineProperty(i,s,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(b){l=""+b},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Kl(i){i._valueTracker||(i._valueTracker=TO(i))}function Rg(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),l="";return i&&(l=Eg(i)?i.checked?"true":"false":i.value),i=l,i!==a?(s.setValue(i),!0):!1}function Pl(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 AO=/[\n"\\]/g;function Rn(i){return i.replace(AO,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function Lf(i,s,a,l,f,m,b,x){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),s!=null?b==="number"?(s===0&&i.value===""||i.value!=s)&&(i.value=""+En(s)):i.value!==""+En(s)&&(i.value=""+En(s)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),s!=null?Vf(i,b,En(s)):a!=null?Vf(i,b,En(a)):l!=null&&i.removeAttribute("value"),f==null&&m!=null&&(i.defaultChecked=!!m),f!=null&&(i.checked=f&&typeof f!="function"&&typeof f!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?i.name=""+En(x):i.removeAttribute("name")}function Og(i,s,a,l,f,m,b,x){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),s!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||s!=null))return;a=a!=null?""+En(a):"",s=s!=null?""+En(s):a,x||s===i.value||(i.value=s),i.defaultValue=s}l=l??f,l=typeof l!="function"&&typeof l!="symbol"&&!!l,i.checked=x?i.checked:!!l,i.defaultChecked=!!l,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b)}function Vf(i,s,a){s==="number"&&Pl(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function Os(i,s,a,l){if(i=i.options,s){s={};for(var f=0;f<a.length;f++)s["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=s.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&l&&(i[a].defaultSelected=!0)}else{for(a=""+En(a),s=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,l&&(i[f].defaultSelected=!0);return}s!==null||i[f].disabled||(s=i[f])}s!==null&&(s.selected=!0)}}function _g(i,s,a){if(s!=null&&(s=""+En(s),s!==i.value&&(i.value=s),a==null)){i.defaultValue!==s&&(i.defaultValue=s);return}i.defaultValue=a!=null?""+En(a):""}function kg(i,s,a,l){if(s==null){if(l!=null){if(a!=null)throw Error(r(92));if(W(l)){if(1<l.length)throw Error(r(93));l=l[0]}a=l}a==null&&(a=""),s=a}a=En(s),i.defaultValue=a,l=i.textContent,l===a&&l!==""&&l!==null&&(i.value=l)}function _s(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var EO=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 Mg(i,s,a){var l=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":l?i.setProperty(s,a):typeof a!="number"||a===0||EO.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function Cg(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||s!=null&&s.hasOwnProperty(l)||(l.indexOf("--")===0?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="");for(var f in s)l=s[f],s.hasOwnProperty(f)&&a[f]!==l&&Mg(i,f,l)}else for(var m in s)s.hasOwnProperty(m)&&Mg(i,m,s[m])}function Uf(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 RO=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"]]),OO=/^[\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 ql(i){return OO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var zf=null;function Kf(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var ks=null,Ms=null;function Dg(i){var s=Ts(i);if(s&&(i=s.stateNode)){var a=i[tn]||null;e:switch(i=s.stateNode,s.type){case"input":if(Lf(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),s=a.name,a.type==="radio"&&s!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Rn(""+s)+'"][type="radio"]'),s=0;s<a.length;s++){var l=a[s];if(l!==i&&l.form===i.form){var f=l[tn]||null;if(!f)throw Error(r(90));Lf(l,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(s=0;s<a.length;s++)l=a[s],l.form===i.form&&Rg(l)}break e;case"textarea":_g(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&Os(i,!!a.multiple,s,!1)}}}var Pf=!1;function Ng(i,s,a){if(Pf)return i(s,a);Pf=!0;try{var l=i(s);return l}finally{if(Pf=!1,(ks!==null||Ms!==null)&&(_c(),ks&&(s=ks,i=Ms,Ms=ks=null,Dg(s),i)))for(s=0;s<i.length;s++)Dg(i[s])}}function ea(i,s){var a=i.stateNode;if(a===null)return null;var l=a[tn]||null;if(l===null)return null;a=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(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var Ai=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),qf=!1;if(Ai)try{var ta={};Object.defineProperty(ta,"passive",{get:function(){qf=!0}}),window.addEventListener("test",ta,ta),window.removeEventListener("test",ta,ta)}catch{qf=!1}var er=null,If=null,Il=null;function $g(){if(Il)return Il;var i,s=If,a=s.length,l,f="value"in er?er.value:er.textContent,m=f.length;for(i=0;i<a&&s[i]===f[i];i++);var b=a-i;for(l=1;l<=b&&s[a-l]===f[m-l];l++);return Il=f.slice(i,1<l?1-l:void 0)}function Hl(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 Fl(){return!0}function jg(){return!1}function nn(i){function s(a,l,f,m,b){this._reactName=a,this._targetInst=f,this.type=l,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var x in i)i.hasOwnProperty(x)&&(a=i[x],this[x]=a?a(m):m[x]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Fl:jg,this.isPropagationStopped=jg,this}return y(s.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Fl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Fl)},persist:function(){},isPersistent:Fl}),s}var Ur={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gl=nn(Ur),na=y({},Ur,{view:0,detail:0}),_O=nn(na),Hf,Ff,ia,Yl=y({},na,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yf,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!==ia&&(ia&&i.type==="mousemove"?(Hf=i.screenX-ia.screenX,Ff=i.screenY-ia.screenY):Ff=Hf=0,ia=i),Hf)},movementY:function(i){return"movementY"in i?i.movementY:Ff}}),Bg=nn(Yl),kO=y({},Yl,{dataTransfer:0}),MO=nn(kO),CO=y({},na,{relatedTarget:0}),Gf=nn(CO),DO=y({},Ur,{animationName:0,elapsedTime:0,pseudoElement:0}),NO=nn(DO),$O=y({},Ur,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),jO=nn($O),BO=y({},Ur,{data:0}),Lg=nn(BO),LO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},VO={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"},UO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function zO(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=UO[i])?!!s[i]:!1}function Yf(){return zO}var KO=y({},na,{key:function(i){if(i.key){var s=LO[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Hl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?VO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yf,charCode:function(i){return i.type==="keypress"?Hl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Hl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),PO=nn(KO),qO=y({},Yl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Vg=nn(qO),IO=y({},na,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yf}),HO=nn(IO),FO=y({},Ur,{propertyName:0,elapsedTime:0,pseudoElement:0}),GO=nn(FO),YO=y({},Yl,{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}),JO=nn(YO),XO=y({},Ur,{newState:0,oldState:0}),ZO=nn(XO),QO=[9,13,27,32],Jf=Ai&&"CompositionEvent"in window,ra=null;Ai&&"documentMode"in document&&(ra=document.documentMode);var WO=Ai&&"TextEvent"in window&&!ra,Ug=Ai&&(!Jf||ra&&8<ra&&11>=ra),zg=" ",Kg=!1;function Pg(i,s){switch(i){case"keyup":return QO.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function qg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Cs=!1;function e_(i,s){switch(i){case"compositionend":return qg(s);case"keypress":return s.which!==32?null:(Kg=!0,zg);case"textInput":return i=s.data,i===zg&&Kg?null:i;default:return null}}function t_(i,s){if(Cs)return i==="compositionend"||!Jf&&Pg(i,s)?(i=$g(),Il=If=er=null,Cs=!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 Ug&&s.locale!=="ko"?null:s.data;default:return null}}var n_={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 Ig(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!n_[i.type]:s==="textarea"}function Hg(i,s,a,l){ks?Ms?Ms.push(l):Ms=[l]:ks=l,s=$c(s,"onChange"),0<s.length&&(a=new Gl("onChange","change",null,a,l),i.push({event:a,listeners:s}))}var sa=null,oa=null;function i_(i){E0(i,0)}function Jl(i){var s=Wo(i);if(Rg(s))return i}function Fg(i,s){if(i==="change")return s}var Gg=!1;if(Ai){var Xf;if(Ai){var Zf="oninput"in document;if(!Zf){var Yg=document.createElement("div");Yg.setAttribute("oninput","return;"),Zf=typeof Yg.oninput=="function"}Xf=Zf}else Xf=!1;Gg=Xf&&(!document.documentMode||9<document.documentMode)}function Jg(){sa&&(sa.detachEvent("onpropertychange",Xg),oa=sa=null)}function Xg(i){if(i.propertyName==="value"&&Jl(oa)){var s=[];Hg(s,oa,i,Kf(i)),Ng(i_,s)}}function r_(i,s,a){i==="focusin"?(Jg(),sa=s,oa=a,sa.attachEvent("onpropertychange",Xg)):i==="focusout"&&Jg()}function s_(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Jl(oa)}function o_(i,s){if(i==="click")return Jl(s)}function a_(i,s){if(i==="input"||i==="change")return Jl(s)}function l_(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var hn=typeof Object.is=="function"?Object.is:l_;function aa(i,s){if(hn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),l=Object.keys(s);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var f=a[l];if(!we.call(s,f)||!hn(i[f],s[f]))return!1}return!0}function Zg(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function Qg(i,s){var a=Zg(i);i=0;for(var l;a;){if(a.nodeType===3){if(l=i+a.textContent.length,i<=s&&l>=s)return{node:a,offset:s-i};i=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Zg(a)}}function Wg(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?Wg(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function eb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Pl(i.document);s instanceof i.HTMLIFrameElement;){try{var a=typeof s.contentWindow.location.href=="string"}catch{a=!1}if(a)i=s.contentWindow;else break;s=Pl(i.document)}return s}function Qf(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 c_=Ai&&"documentMode"in document&&11>=document.documentMode,Ds=null,Wf=null,la=null,ed=!1;function tb(i,s,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;ed||Ds==null||Ds!==Pl(l)||(l=Ds,"selectionStart"in l&&Qf(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}),la&&aa(la,l)||(la=l,l=$c(Wf,"onSelect"),0<l.length&&(s=new Gl("onSelect","select",null,s,a),i.push({event:s,listeners:l}),s.target=Ds)))}function zr(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var Ns={animationend:zr("Animation","AnimationEnd"),animationiteration:zr("Animation","AnimationIteration"),animationstart:zr("Animation","AnimationStart"),transitionrun:zr("Transition","TransitionRun"),transitionstart:zr("Transition","TransitionStart"),transitioncancel:zr("Transition","TransitionCancel"),transitionend:zr("Transition","TransitionEnd")},td={},nb={};Ai&&(nb=document.createElement("div").style,"AnimationEvent"in window||(delete Ns.animationend.animation,delete Ns.animationiteration.animation,delete Ns.animationstart.animation),"TransitionEvent"in window||delete Ns.transitionend.transition);function Kr(i){if(td[i])return td[i];if(!Ns[i])return i;var s=Ns[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in nb)return td[i]=s[a];return i}var ib=Kr("animationend"),rb=Kr("animationiteration"),sb=Kr("animationstart"),u_=Kr("transitionrun"),f_=Kr("transitionstart"),d_=Kr("transitioncancel"),ob=Kr("transitionend"),ab=new Map,nd="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(" ");nd.push("scrollEnd");function qn(i,s){ab.set(i,s),Vr(s,[i])}var lb=new WeakMap;function On(i,s){if(typeof i=="object"&&i!==null){var a=lb.get(i);return a!==void 0?a:(s={value:i,source:s,stack:Ag(s)},lb.set(i,s),s)}return{value:i,source:s,stack:Ag(s)}}var _n=[],$s=0,id=0;function Xl(){for(var i=$s,s=id=$s=0;s<i;){var a=_n[s];_n[s++]=null;var l=_n[s];_n[s++]=null;var f=_n[s];_n[s++]=null;var m=_n[s];if(_n[s++]=null,l!==null&&f!==null){var b=l.pending;b===null?f.next=f:(f.next=b.next,b.next=f),l.pending=f}m!==0&&cb(a,f,m)}}function Zl(i,s,a,l){_n[$s++]=i,_n[$s++]=s,_n[$s++]=a,_n[$s++]=l,id|=l,i.lanes|=l,i=i.alternate,i!==null&&(i.lanes|=l)}function rd(i,s,a,l){return Zl(i,s,a,l),Ql(i)}function js(i,s){return Zl(i,null,null,s),Ql(i)}function cb(i,s,a){i.lanes|=a;var l=i.alternate;l!==null&&(l.lanes|=a);for(var f=!1,m=i.return;m!==null;)m.childLanes|=a,l=m.alternate,l!==null&&(l.childLanes|=a),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(f=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,f&&s!==null&&(f=31-dn(a),i=m.hiddenUpdates,l=i[f],l===null?i[f]=[s]:l.push(s),s.lane=a|536870912),m):null}function Ql(i){if(50<Na)throw Na=0,uh=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Bs={};function h_(i,s,a,l){this.tag=i,this.key=a,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 pn(i,s,a,l){return new h_(i,s,a,l)}function sd(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ei(i,s){var a=i.alternate;return a===null?(a=pn(i.tag,s,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=s,a.type=i.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=i.flags&65011712,a.childLanes=i.childLanes,a.lanes=i.lanes,a.child=i.child,a.memoizedProps=i.memoizedProps,a.memoizedState=i.memoizedState,a.updateQueue=i.updateQueue,s=i.dependencies,a.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function ub(i,s){i.flags&=65011714;var a=i.alternate;return a===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=a.childLanes,i.lanes=a.lanes,i.child=a.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=a.memoizedProps,i.memoizedState=a.memoizedState,i.updateQueue=a.updateQueue,i.type=a.type,s=a.dependencies,i.dependencies=s===null?null:{lanes:s.lanes,firstContext:s.firstContext}),i}function Wl(i,s,a,l,f,m){var b=0;if(l=i,typeof i=="function")sd(i)&&(b=1);else if(typeof i=="string")b=mk(i,a,se.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ie:return i=pn(31,a,s,f),i.elementType=ie,i.lanes=m,i;case w:return Pr(a.children,f,m,s);case T:b=8,f|=24;break;case D:return i=pn(12,a,s,f|2),i.elementType=D,i.lanes=m,i;case O:return i=pn(13,a,s,f),i.elementType=O,i.lanes=m,i;case J:return i=pn(19,a,s,f),i.elementType=J,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case $:case k:b=10;break e;case _:b=9;break e;case C:b=11;break e;case G:b=14;break e;case H:b=16,l=null;break e}b=29,a=Error(r(130,i===null?"null":typeof i,"")),l=null}return s=pn(b,a,s,f),s.elementType=i,s.type=l,s.lanes=m,s}function Pr(i,s,a,l){return i=pn(7,i,l,s),i.lanes=a,i}function od(i,s,a){return i=pn(6,i,null,s),i.lanes=a,i}function ad(i,s,a){return s=pn(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Ls=[],Vs=0,ec=null,tc=0,kn=[],Mn=0,qr=null,Ri=1,Oi="";function Ir(i,s){Ls[Vs++]=tc,Ls[Vs++]=ec,ec=i,tc=s}function fb(i,s,a){kn[Mn++]=Ri,kn[Mn++]=Oi,kn[Mn++]=qr,qr=i;var l=Ri;i=Oi;var f=32-dn(l)-1;l&=~(1<<f),a+=1;var m=32-dn(s)+f;if(30<m){var b=f-f%5;m=(l&(1<<b)-1).toString(32),l>>=b,f-=b,Ri=1<<32-dn(s)+f|a<<f|l,Oi=m+i}else Ri=1<<m|a<<f|l,Oi=i}function ld(i){i.return!==null&&(Ir(i,1),fb(i,1,0))}function cd(i){for(;i===ec;)ec=Ls[--Vs],Ls[Vs]=null,tc=Ls[--Vs],Ls[Vs]=null;for(;i===qr;)qr=kn[--Mn],kn[Mn]=null,Oi=kn[--Mn],kn[Mn]=null,Ri=kn[--Mn],kn[Mn]=null}var Xt=null,st=null,$e=!1,Hr=null,ei=!1,ud=Error(r(519));function Fr(i){var s=Error(r(418,""));throw fa(On(s,i)),ud}function db(i){var s=i.stateNode,a=i.type,l=i.memoizedProps;switch(s[qt]=i,s[tn]=l,a){case"dialog":_e("cancel",s),_e("close",s);break;case"iframe":case"object":case"embed":_e("load",s);break;case"video":case"audio":for(a=0;a<ja.length;a++)_e(ja[a],s);break;case"source":_e("error",s);break;case"img":case"image":case"link":_e("error",s),_e("load",s);break;case"details":_e("toggle",s);break;case"input":_e("invalid",s),Og(s,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),Kl(s);break;case"select":_e("invalid",s);break;case"textarea":_e("invalid",s),kg(s,l.value,l.defaultValue,l.children),Kl(s)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||l.suppressHydrationWarning===!0||k0(s.textContent,a)?(l.popover!=null&&(_e("beforetoggle",s),_e("toggle",s)),l.onScroll!=null&&_e("scroll",s),l.onScrollEnd!=null&&_e("scrollend",s),l.onClick!=null&&(s.onclick=jc),s=!0):s=!1,s||Fr(i)}function hb(i){for(Xt=i.return;Xt;)switch(Xt.tag){case 5:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:Xt=Xt.return}}function ca(i){if(i!==Xt)return!1;if(!$e)return hb(i),$e=!0,!1;var s=i.tag,a;if((a=s!==3&&s!==27)&&((a=s===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||Rh(i.type,i.memoizedProps)),a=!a),a&&st&&Fr(i),hb(i),s===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));e:{for(i=i.nextSibling,s=0;i;){if(i.nodeType===8)if(a=i.data,a==="/$"){if(s===0){st=Hn(i.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++;i=i.nextSibling}st=null}}else s===27?(s=st,yr(i.type)?(i=Mh,Mh=null,st=i):st=s):st=Xt?Hn(i.stateNode.nextSibling):null;return!0}function ua(){st=Xt=null,$e=!1}function pb(){var i=Hr;return i!==null&&(on===null?on=i:on.push.apply(on,i),Hr=null),i}function fa(i){Hr===null?Hr=[i]:Hr.push(i)}var fd=I(null),Gr=null,_i=null;function tr(i,s,a){X(fd,s._currentValue),s._currentValue=a}function ki(i){i._currentValue=fd.current,te(fd)}function dd(i,s,a){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===a)break;i=i.return}}function hd(i,s,a,l){var f=i.child;for(f!==null&&(f.return=i);f!==null;){var m=f.dependencies;if(m!==null){var b=f.child;m=m.firstContext;e:for(;m!==null;){var x=m;m=f;for(var E=0;E<s.length;E++)if(x.context===s[E]){m.lanes|=a,x=m.alternate,x!==null&&(x.lanes|=a),dd(m.return,a,i),l||(b=null);break e}m=x.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(r(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),dd(b,a,i),b=null}else b=f.child;if(b!==null)b.return=f;else for(b=f;b!==null;){if(b===i){b=null;break}if(f=b.sibling,f!==null){f.return=b.return,b=f;break}b=b.return}f=b}}function da(i,s,a,l){i=null;for(var f=s,m=!1;f!==null;){if(!m){if((f.flags&524288)!==0)m=!0;else if((f.flags&262144)!==0)break}if(f.tag===10){var b=f.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var x=f.type;hn(f.pendingProps.value,b.value)||(i!==null?i.push(x):i=[x])}}else if(f===rt.current){if(b=f.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(i!==null?i.push(Ka):i=[Ka])}f=f.return}i!==null&&hd(s,i,a,l),s.flags|=262144}function nc(i){for(i=i.firstContext;i!==null;){if(!hn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Yr(i){Gr=i,_i=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function It(i){return mb(Gr,i)}function ic(i,s){return Gr===null&&Yr(i),mb(i,s)}function mb(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},_i===null){if(i===null)throw Error(r(308));_i=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else _i=_i.next=s;return a}var p_=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,l){i.push(l)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},m_=t.unstable_scheduleCallback,y_=t.unstable_NormalPriority,Ot={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function pd(){return{controller:new p_,data:new Map,refCount:0}}function ha(i){i.refCount--,i.refCount===0&&m_(y_,function(){i.controller.abort()})}var pa=null,md=0,Us=0,zs=null;function g_(i,s){if(pa===null){var a=pa=[];md=0,Us=gh(),zs={status:"pending",value:void 0,then:function(l){a.push(l)}}}return md++,s.then(yb,yb),s}function yb(){if(--md===0&&pa!==null){zs!==null&&(zs.status="fulfilled");var i=pa;pa=null,Us=0,zs=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function b_(i,s){var a=[],l={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return i.then(function(){l.status="fulfilled",l.value=s;for(var f=0;f<a.length;f++)(0,a[f])(s)},function(f){for(l.status="rejected",l.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),l}var gb=B.S;B.S=function(i,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&g_(i,s),gb!==null&&gb(i,s)};var Jr=I(null);function yd(){var i=Jr.current;return i!==null?i:Fe.pooledCache}function rc(i,s){s===null?X(Jr,Jr.current):X(Jr,s.pool)}function bb(){var i=yd();return i===null?null:{parent:Ot._currentValue,pool:i}}var ma=Error(r(460)),vb=Error(r(474)),sc=Error(r(542)),gd={then:function(){}};function Sb(i){return i=i.status,i==="fulfilled"||i==="rejected"}function oc(){}function xb(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(oc,oc),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Tb(i),i;default:if(typeof s.status=="string")s.then(oc,oc);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(l){if(s.status==="pending"){var f=s;f.status="fulfilled",f.value=l}},function(l){if(s.status==="pending"){var f=s;f.status="rejected",f.reason=l}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,Tb(i),i}throw ya=s,ma}}var ya=null;function wb(){if(ya===null)throw Error(r(459));var i=ya;return ya=null,i}function Tb(i){if(i===ma||i===sc)throw Error(r(483))}var nr=!1;function bd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vd(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 ir(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function rr(i,s,a){var l=i.updateQueue;if(l===null)return null;if(l=l.shared,(Be&2)!==0){var f=l.pending;return f===null?s.next=s:(s.next=f.next,f.next=s),l.pending=s,s=Ql(i),cb(i,null,a),s}return Zl(i,l,s,a),Ql(i)}function ga(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,yg(i,a)}}function Sd(i,s){var a=i.updateQueue,l=i.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var f=null,m=null;if(a=a.firstBaseUpdate,a!==null){do{var b={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};m===null?f=m=b:m=m.next=b,a=a.next}while(a!==null);m===null?f=m=s:m=m.next=s}else f=m=s;a={baseState:l.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:l.shared,callbacks:l.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var xd=!1;function ba(){if(xd){var i=zs;if(i!==null)throw i}}function va(i,s,a,l){xd=!1;var f=i.updateQueue;nr=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,x=f.shared.pending;if(x!==null){f.shared.pending=null;var E=x,j=E.next;E.next=null,b===null?m=j:b.next=j,b=E;var K=i.alternate;K!==null&&(K=K.updateQueue,x=K.lastBaseUpdate,x!==b&&(x===null?K.firstBaseUpdate=j:x.next=j,K.lastBaseUpdate=E))}if(m!==null){var F=f.baseState;b=0,K=j=E=null,x=m;do{var L=x.lane&-536870913,U=L!==x.lane;if(U?(Ce&L)===L:(l&L)===L){L!==0&&L===Us&&(xd=!0),K!==null&&(K=K.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var me=i,de=x;L=s;var Ke=a;switch(de.tag){case 1:if(me=de.payload,typeof me=="function"){F=me.call(Ke,F,L);break e}F=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=de.payload,L=typeof me=="function"?me.call(Ke,F,L):me,L==null)break e;F=y({},F,L);break e;case 2:nr=!0}}L=x.callback,L!==null&&(i.flags|=64,U&&(i.flags|=8192),U=f.callbacks,U===null?f.callbacks=[L]:U.push(L))}else U={lane:L,tag:x.tag,payload:x.payload,callback:x.callback,next:null},K===null?(j=K=U,E=F):K=K.next=U,b|=L;if(x=x.next,x===null){if(x=f.shared.pending,x===null)break;U=x,x=U.next,U.next=null,f.lastBaseUpdate=U,f.shared.pending=null}}while(!0);K===null&&(E=F),f.baseState=E,f.firstBaseUpdate=j,f.lastBaseUpdate=K,m===null&&(f.shared.lanes=0),dr|=b,i.lanes=b,i.memoizedState=F}}function Ab(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Eb(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)Ab(a[i],s)}var Ks=I(null),ac=I(0);function Rb(i,s){i=Bi,X(ac,i),X(Ks,s),Bi=i|s.baseLanes}function wd(){X(ac,Bi),X(Ks,Ks.current)}function Td(){Bi=ac.current,te(Ks),te(ac)}var sr=0,Ae=null,Ue=null,gt=null,lc=!1,Ps=!1,Xr=!1,cc=0,Sa=0,qs=null,v_=0;function ut(){throw Error(r(321))}function Ad(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!hn(i[a],s[a]))return!1;return!0}function Ed(i,s,a,l,f,m){return sr=m,Ae=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=i===null||i.memoizedState===null?cv:uv,Xr=!1,m=a(l,f),Xr=!1,Ps&&(m=_b(s,a,l,f)),Ob(i),m}function Ob(i){B.H=mc;var s=Ue!==null&&Ue.next!==null;if(sr=0,gt=Ue=Ae=null,lc=!1,Sa=0,qs=null,s)throw Error(r(300));i===null||Dt||(i=i.dependencies,i!==null&&nc(i)&&(Dt=!0))}function _b(i,s,a,l){Ae=i;var f=0;do{if(Ps&&(qs=null),Sa=0,Ps=!1,25<=f)throw Error(r(301));if(f+=1,gt=Ue=null,i.updateQueue!=null){var m=i.updateQueue;m.lastEffect=null,m.events=null,m.stores=null,m.memoCache!=null&&(m.memoCache.index=0)}B.H=R_,m=s(a,l)}while(Ps);return m}function S_(){var i=B.H,s=i.useState()[0];return s=typeof s.then=="function"?xa(s):s,i=i.useState()[0],(Ue!==null?Ue.memoizedState:null)!==i&&(Ae.flags|=1024),s}function Rd(){var i=cc!==0;return cc=0,i}function Od(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function _d(i){if(lc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}lc=!1}sr=0,gt=Ue=Ae=null,Ps=!1,Sa=cc=0,qs=null}function rn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?Ae.memoizedState=gt=i:gt=gt.next=i,gt}function bt(){if(Ue===null){var i=Ae.alternate;i=i!==null?i.memoizedState:null}else i=Ue.next;var s=gt===null?Ae.memoizedState:gt.next;if(s!==null)gt=s,Ue=i;else{if(i===null)throw Ae.alternate===null?Error(r(467)):Error(r(310));Ue=i,i={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},gt===null?Ae.memoizedState=gt=i:gt=gt.next=i}return gt}function kd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function xa(i){var s=Sa;return Sa+=1,qs===null&&(qs=[]),i=xb(qs,i,s),s=Ae,(gt===null?s.memoizedState:gt.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?cv:uv),i}function uc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return xa(i);if(i.$$typeof===k)return It(i)}throw Error(r(438,String(i)))}function Md(i){var s=null,a=Ae.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var l=Ae.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(s={data:l.data.map(function(f){return f.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=kd(),Ae.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),l=0;l<i;l++)a[l]=oe;return s.index++,a}function Mi(i,s){return typeof s=="function"?s(i):s}function fc(i){var s=bt();return Cd(s,Ue,i)}function Cd(i,s,a){var l=i.queue;if(l===null)throw Error(r(311));l.lastRenderedReducer=a;var f=i.baseQueue,m=l.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}s.baseQueue=f=m,l.pending=null}if(m=i.baseState,f===null)i.memoizedState=m;else{s=f.next;var x=b=null,E=null,j=s,K=!1;do{var F=j.lane&-536870913;if(F!==j.lane?(Ce&F)===F:(sr&F)===F){var L=j.revertLane;if(L===0)E!==null&&(E=E.next={lane:0,revertLane:0,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null}),F===Us&&(K=!0);else if((sr&L)===L){j=j.next,L===Us&&(K=!0);continue}else F={lane:0,revertLane:j.revertLane,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},E===null?(x=E=F,b=m):E=E.next=F,Ae.lanes|=L,dr|=L;F=j.action,Xr&&a(m,F),m=j.hasEagerState?j.eagerState:a(m,F)}else L={lane:F,revertLane:j.revertLane,action:j.action,hasEagerState:j.hasEagerState,eagerState:j.eagerState,next:null},E===null?(x=E=L,b=m):E=E.next=L,Ae.lanes|=F,dr|=F;j=j.next}while(j!==null&&j!==s);if(E===null?b=m:E.next=x,!hn(m,i.memoizedState)&&(Dt=!0,K&&(a=zs,a!==null)))throw a;i.memoizedState=m,i.baseState=b,i.baseQueue=E,l.lastRenderedState=m}return f===null&&(l.lanes=0),[i.memoizedState,l.dispatch]}function Dd(i){var s=bt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var l=a.dispatch,f=a.pending,m=s.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do m=i(m,b.action),b=b.next;while(b!==f);hn(m,s.memoizedState)||(Dt=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),a.lastRenderedState=m}return[m,l]}function kb(i,s,a){var l=Ae,f=bt(),m=$e;if(m){if(a===void 0)throw Error(r(407));a=a()}else a=s();var b=!hn((Ue||f).memoizedState,a);b&&(f.memoizedState=a,Dt=!0),f=f.queue;var x=Db.bind(null,l,f,i);if(wa(2048,8,x,[i]),f.getSnapshot!==s||b||gt!==null&&gt.memoizedState.tag&1){if(l.flags|=2048,Is(9,dc(),Cb.bind(null,l,f,a,s),null),Fe===null)throw Error(r(349));m||(sr&124)!==0||Mb(l,s,a)}return a}function Mb(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Ae.updateQueue,s===null?(s=kd(),Ae.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Cb(i,s,a,l){s.value=a,s.getSnapshot=l,Nb(s)&&$b(i)}function Db(i,s,a){return a(function(){Nb(s)&&$b(i)})}function Nb(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!hn(i,a)}catch{return!0}}function $b(i){var s=js(i,2);s!==null&&vn(s,i,2)}function Nd(i){var s=rn();if(typeof i=="function"){var a=i;if(i=a(),Xr){Qi(!0);try{a()}finally{Qi(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:i},s}function jb(i,s,a,l){return i.baseState=a,Cd(i,Ue,typeof l=="function"?l:Mi)}function x_(i,s,a,l,f){if(pc(i))throw Error(r(485));if(i=s.action,i!==null){var m={payload:f,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(b){m.listeners.push(b)}};B.T!==null?a(!0):m.isTransition=!1,l(m),a=s.pending,a===null?(m.next=s.pending=m,Bb(s,m)):(m.next=a.next,s.pending=a.next=m)}}function Bb(i,s){var a=s.action,l=s.payload,f=i.state;if(s.isTransition){var m=B.T,b={};B.T=b;try{var x=a(f,l),E=B.S;E!==null&&E(b,x),Lb(i,s,x)}catch(j){$d(i,s,j)}finally{B.T=m}}else try{m=a(f,l),Lb(i,s,m)}catch(j){$d(i,s,j)}}function Lb(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){Vb(i,s,l)},function(l){return $d(i,s,l)}):Vb(i,s,a)}function Vb(i,s,a){s.status="fulfilled",s.value=a,Ub(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,Bb(i,a)))}function $d(i,s,a){var l=i.pending;if(i.pending=null,l!==null){l=l.next;do s.status="rejected",s.reason=a,Ub(s),s=s.next;while(s!==l)}i.action=null}function Ub(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function zb(i,s){return s}function Kb(i,s){if($e){var a=Fe.formState;if(a!==null){e:{var l=Ae;if($e){if(st){t:{for(var f=st,m=ei;f.nodeType!==8;){if(!m){f=null;break t}if(f=Hn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){st=Hn(f.nextSibling),l=f.data==="F!";break e}}Fr(l)}l=!1}l&&(s=a[0])}}return a=rn(),a.memoizedState=a.baseState=s,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:zb,lastRenderedState:s},a.queue=l,a=ov.bind(null,Ae,l),l.dispatch=a,l=Nd(!1),m=Ud.bind(null,Ae,!1,l.queue),l=rn(),f={state:s,dispatch:null,action:i,pending:null},l.queue=f,a=x_.bind(null,Ae,f,m,a),f.dispatch=a,l.memoizedState=i,[s,a,!1]}function Pb(i){var s=bt();return qb(s,Ue,i)}function qb(i,s,a){if(s=Cd(i,s,zb)[0],i=fc(Mi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var l=xa(s)}catch(b){throw b===ma?sc:b}else l=s;s=bt();var f=s.queue,m=f.dispatch;return a!==s.memoizedState&&(Ae.flags|=2048,Is(9,dc(),w_.bind(null,f,a),null)),[l,m,i]}function w_(i,s){i.action=s}function Ib(i){var s=bt(),a=Ue;if(a!==null)return qb(s,a,i);bt(),s=s.memoizedState,a=bt();var l=a.queue.dispatch;return a.memoizedState=i,[s,l,!1]}function Is(i,s,a,l){return i={tag:i,create:a,deps:l,inst:s,next:null},s=Ae.updateQueue,s===null&&(s=kd(),Ae.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(l=a.next,a.next=i,i.next=l,s.lastEffect=i),i}function dc(){return{destroy:void 0,resource:void 0}}function Hb(){return bt().memoizedState}function hc(i,s,a,l){var f=rn();l=l===void 0?null:l,Ae.flags|=i,f.memoizedState=Is(1|s,dc(),a,l)}function wa(i,s,a,l){var f=bt();l=l===void 0?null:l;var m=f.memoizedState.inst;Ue!==null&&l!==null&&Ad(l,Ue.memoizedState.deps)?f.memoizedState=Is(s,m,a,l):(Ae.flags|=i,f.memoizedState=Is(1|s,m,a,l))}function Fb(i,s){hc(8390656,8,i,s)}function Gb(i,s){wa(2048,8,i,s)}function Yb(i,s){return wa(4,2,i,s)}function Jb(i,s){return wa(4,4,i,s)}function Xb(i,s){if(typeof s=="function"){i=i();var a=s(i);return function(){typeof a=="function"?a():s(null)}}if(s!=null)return i=i(),s.current=i,function(){s.current=null}}function Zb(i,s,a){a=a!=null?a.concat([i]):null,wa(4,4,Xb.bind(null,s,i),a)}function jd(){}function Qb(i,s){var a=bt();s=s===void 0?null:s;var l=a.memoizedState;return s!==null&&Ad(s,l[1])?l[0]:(a.memoizedState=[i,s],i)}function Wb(i,s){var a=bt();s=s===void 0?null:s;var l=a.memoizedState;if(s!==null&&Ad(s,l[1]))return l[0];if(l=i(),Xr){Qi(!0);try{i()}finally{Qi(!1)}}return a.memoizedState=[l,s],l}function Bd(i,s,a){return a===void 0||(sr&1073741824)!==0?i.memoizedState=s:(i.memoizedState=a,i=n0(),Ae.lanes|=i,dr|=i,a)}function ev(i,s,a,l){return hn(a,s)?a:Ks.current!==null?(i=Bd(i,a,l),hn(i,s)||(Dt=!0),i):(sr&42)===0?(Dt=!0,i.memoizedState=a):(i=n0(),Ae.lanes|=i,dr|=i,s)}function tv(i,s,a,l,f){var m=P.p;P.p=m!==0&&8>m?m:8;var b=B.T,x={};B.T=x,Ud(i,!1,s,a);try{var E=f(),j=B.S;if(j!==null&&j(x,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var K=b_(E,l);Ta(i,s,K,bn(i))}else Ta(i,s,l,bn(i))}catch(F){Ta(i,s,{then:function(){},status:"rejected",reason:F},bn())}finally{P.p=m,B.T=b}}function T_(){}function Ld(i,s,a,l){if(i.tag!==5)throw Error(r(476));var f=nv(i).queue;tv(i,f,s,z,a===null?T_:function(){return iv(i),a(l)})}function nv(i){var s=i.memoizedState;if(s!==null)return s;s={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:z},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mi,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function iv(i){var s=nv(i).next.queue;Ta(i,s,{},bn())}function Vd(){return It(Ka)}function rv(){return bt().memoizedState}function sv(){return bt().memoizedState}function A_(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=bn();i=ir(a);var l=rr(s,i,a);l!==null&&(vn(l,s,a),ga(l,s,a)),s={cache:pd()},i.payload=s;return}s=s.return}}function E_(i,s,a){var l=bn();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},pc(i)?av(s,a):(a=rd(i,s,a,l),a!==null&&(vn(a,i,l),lv(a,s,l)))}function ov(i,s,a){var l=bn();Ta(i,s,a,l)}function Ta(i,s,a,l){var f={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(pc(i))av(s,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var b=s.lastRenderedState,x=m(b,a);if(f.hasEagerState=!0,f.eagerState=x,hn(x,b))return Zl(i,s,f,0),Fe===null&&Xl(),!1}catch{}finally{}if(a=rd(i,s,f,l),a!==null)return vn(a,i,l),lv(a,s,l),!0}return!1}function Ud(i,s,a,l){if(l={lane:2,revertLane:gh(),action:l,hasEagerState:!1,eagerState:null,next:null},pc(i)){if(s)throw Error(r(479))}else s=rd(i,a,l,2),s!==null&&vn(s,i,2)}function pc(i){var s=i.alternate;return i===Ae||s!==null&&s===Ae}function av(i,s){Ps=lc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function lv(i,s,a){if((a&4194048)!==0){var l=s.lanes;l&=i.pendingLanes,a|=l,s.lanes=a,yg(i,a)}}var mc={readContext:It,use:uc,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut},cv={readContext:It,use:uc,useCallback:function(i,s){return rn().memoizedState=[i,s===void 0?null:s],i},useContext:It,useEffect:Fb,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,hc(4194308,4,Xb.bind(null,s,i),a)},useLayoutEffect:function(i,s){return hc(4194308,4,i,s)},useInsertionEffect:function(i,s){hc(4,2,i,s)},useMemo:function(i,s){var a=rn();s=s===void 0?null:s;var l=i();if(Xr){Qi(!0);try{i()}finally{Qi(!1)}}return a.memoizedState=[l,s],l},useReducer:function(i,s,a){var l=rn();if(a!==void 0){var f=a(s);if(Xr){Qi(!0);try{a(s)}finally{Qi(!1)}}}else f=s;return l.memoizedState=l.baseState=f,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:f},l.queue=i,i=i.dispatch=E_.bind(null,Ae,i),[l.memoizedState,i]},useRef:function(i){var s=rn();return i={current:i},s.memoizedState=i},useState:function(i){i=Nd(i);var s=i.queue,a=ov.bind(null,Ae,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:jd,useDeferredValue:function(i,s){var a=rn();return Bd(a,i,s)},useTransition:function(){var i=Nd(!1);return i=tv.bind(null,Ae,i.queue,!0,!1),rn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var l=Ae,f=rn();if($e){if(a===void 0)throw Error(r(407));a=a()}else{if(a=s(),Fe===null)throw Error(r(349));(Ce&124)!==0||Mb(l,s,a)}f.memoizedState=a;var m={value:a,getSnapshot:s};return f.queue=m,Fb(Db.bind(null,l,m,i),[i]),l.flags|=2048,Is(9,dc(),Cb.bind(null,l,m,a,s),null),a},useId:function(){var i=rn(),s=Fe.identifierPrefix;if($e){var a=Oi,l=Ri;a=(l&~(1<<32-dn(l)-1)).toString(32)+a,s="«"+s+"R"+a,a=cc++,0<a&&(s+="H"+a.toString(32)),s+="»"}else a=v_++,s="«"+s+"r"+a.toString(32)+"»";return i.memoizedState=s},useHostTransitionStatus:Vd,useFormState:Kb,useActionState:Kb,useOptimistic:function(i){var s=rn();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=Ud.bind(null,Ae,!0,a),a.dispatch=s,[i,s]},useMemoCache:Md,useCacheRefresh:function(){return rn().memoizedState=A_.bind(null,Ae)}},uv={readContext:It,use:uc,useCallback:Qb,useContext:It,useEffect:Gb,useImperativeHandle:Zb,useInsertionEffect:Yb,useLayoutEffect:Jb,useMemo:Wb,useReducer:fc,useRef:Hb,useState:function(){return fc(Mi)},useDebugValue:jd,useDeferredValue:function(i,s){var a=bt();return ev(a,Ue.memoizedState,i,s)},useTransition:function(){var i=fc(Mi)[0],s=bt().memoizedState;return[typeof i=="boolean"?i:xa(i),s]},useSyncExternalStore:kb,useId:rv,useHostTransitionStatus:Vd,useFormState:Pb,useActionState:Pb,useOptimistic:function(i,s){var a=bt();return jb(a,Ue,i,s)},useMemoCache:Md,useCacheRefresh:sv},R_={readContext:It,use:uc,useCallback:Qb,useContext:It,useEffect:Gb,useImperativeHandle:Zb,useInsertionEffect:Yb,useLayoutEffect:Jb,useMemo:Wb,useReducer:Dd,useRef:Hb,useState:function(){return Dd(Mi)},useDebugValue:jd,useDeferredValue:function(i,s){var a=bt();return Ue===null?Bd(a,i,s):ev(a,Ue.memoizedState,i,s)},useTransition:function(){var i=Dd(Mi)[0],s=bt().memoizedState;return[typeof i=="boolean"?i:xa(i),s]},useSyncExternalStore:kb,useId:rv,useHostTransitionStatus:Vd,useFormState:Ib,useActionState:Ib,useOptimistic:function(i,s){var a=bt();return Ue!==null?jb(a,Ue,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:Md,useCacheRefresh:sv},Hs=null,Aa=0;function yc(i){var s=Aa;return Aa+=1,Hs===null&&(Hs=[]),xb(Hs,i,s)}function Ea(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function gc(i,s){throw s.$$typeof===g?Error(r(525)):(i=Object.prototype.toString.call(s),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":i)))}function fv(i){var s=i._init;return s(i._payload)}function dv(i){function s(M,R){if(i){var N=M.deletions;N===null?(M.deletions=[R],M.flags|=16):N.push(R)}}function a(M,R){if(!i)return null;for(;R!==null;)s(M,R),R=R.sibling;return null}function l(M){for(var R=new Map;M!==null;)M.key!==null?R.set(M.key,M):R.set(M.index,M),M=M.sibling;return R}function f(M,R){return M=Ei(M,R),M.index=0,M.sibling=null,M}function m(M,R,N){return M.index=N,i?(N=M.alternate,N!==null?(N=N.index,N<R?(M.flags|=67108866,R):N):(M.flags|=67108866,R)):(M.flags|=1048576,R)}function b(M){return i&&M.alternate===null&&(M.flags|=67108866),M}function x(M,R,N,q){return R===null||R.tag!==6?(R=od(N,M.mode,q),R.return=M,R):(R=f(R,N),R.return=M,R)}function E(M,R,N,q){var re=N.type;return re===w?K(M,R,N.props.children,q,N.key):R!==null&&(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===H&&fv(re)===R.type)?(R=f(R,N.props),Ea(R,N),R.return=M,R):(R=Wl(N.type,N.key,N.props,null,M.mode,q),Ea(R,N),R.return=M,R)}function j(M,R,N,q){return R===null||R.tag!==4||R.stateNode.containerInfo!==N.containerInfo||R.stateNode.implementation!==N.implementation?(R=ad(N,M.mode,q),R.return=M,R):(R=f(R,N.children||[]),R.return=M,R)}function K(M,R,N,q,re){return R===null||R.tag!==7?(R=Pr(N,M.mode,q,re),R.return=M,R):(R=f(R,N),R.return=M,R)}function F(M,R,N){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=od(""+R,M.mode,N),R.return=M,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return N=Wl(R.type,R.key,R.props,null,M.mode,N),Ea(N,R),N.return=M,N;case S:return R=ad(R,M.mode,N),R.return=M,R;case H:var q=R._init;return R=q(R._payload),F(M,R,N)}if(W(R)||ge(R))return R=Pr(R,M.mode,N,null),R.return=M,R;if(typeof R.then=="function")return F(M,yc(R),N);if(R.$$typeof===k)return F(M,ic(M,R),N);gc(M,R)}return null}function L(M,R,N,q){var re=R!==null?R.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return re!==null?null:x(M,R,""+N,q);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case v:return N.key===re?E(M,R,N,q):null;case S:return N.key===re?j(M,R,N,q):null;case H:return re=N._init,N=re(N._payload),L(M,R,N,q)}if(W(N)||ge(N))return re!==null?null:K(M,R,N,q,null);if(typeof N.then=="function")return L(M,R,yc(N),q);if(N.$$typeof===k)return L(M,R,ic(M,N),q);gc(M,N)}return null}function U(M,R,N,q,re){if(typeof q=="string"&&q!==""||typeof q=="number"||typeof q=="bigint")return M=M.get(N)||null,x(R,M,""+q,re);if(typeof q=="object"&&q!==null){switch(q.$$typeof){case v:return M=M.get(q.key===null?N:q.key)||null,E(R,M,q,re);case S:return M=M.get(q.key===null?N:q.key)||null,j(R,M,q,re);case H:var Re=q._init;return q=Re(q._payload),U(M,R,N,q,re)}if(W(q)||ge(q))return M=M.get(N)||null,K(R,M,q,re,null);if(typeof q.then=="function")return U(M,R,N,yc(q),re);if(q.$$typeof===k)return U(M,R,N,ic(R,q),re);gc(R,q)}return null}function me(M,R,N,q){for(var re=null,Re=null,ce=R,he=R=0,$t=null;ce!==null&&he<N.length;he++){ce.index>he?($t=ce,ce=null):$t=ce.sibling;var Ne=L(M,ce,N[he],q);if(Ne===null){ce===null&&(ce=$t);break}i&&ce&&Ne.alternate===null&&s(M,ce),R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne,ce=$t}if(he===N.length)return a(M,ce),$e&&Ir(M,he),re;if(ce===null){for(;he<N.length;he++)ce=F(M,N[he],q),ce!==null&&(R=m(ce,R,he),Re===null?re=ce:Re.sibling=ce,Re=ce);return $e&&Ir(M,he),re}for(ce=l(ce);he<N.length;he++)$t=U(ce,M,he,N[he],q),$t!==null&&(i&&$t.alternate!==null&&ce.delete($t.key===null?he:$t.key),R=m($t,R,he),Re===null?re=$t:Re.sibling=$t,Re=$t);return i&&ce.forEach(function(xr){return s(M,xr)}),$e&&Ir(M,he),re}function de(M,R,N,q){if(N==null)throw Error(r(151));for(var re=null,Re=null,ce=R,he=R=0,$t=null,Ne=N.next();ce!==null&&!Ne.done;he++,Ne=N.next()){ce.index>he?($t=ce,ce=null):$t=ce.sibling;var xr=L(M,ce,Ne.value,q);if(xr===null){ce===null&&(ce=$t);break}i&&ce&&xr.alternate===null&&s(M,ce),R=m(xr,R,he),Re===null?re=xr:Re.sibling=xr,Re=xr,ce=$t}if(Ne.done)return a(M,ce),$e&&Ir(M,he),re;if(ce===null){for(;!Ne.done;he++,Ne=N.next())Ne=F(M,Ne.value,q),Ne!==null&&(R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne);return $e&&Ir(M,he),re}for(ce=l(ce);!Ne.done;he++,Ne=N.next())Ne=U(ce,M,he,Ne.value,q),Ne!==null&&(i&&Ne.alternate!==null&&ce.delete(Ne.key===null?he:Ne.key),R=m(Ne,R,he),Re===null?re=Ne:Re.sibling=Ne,Re=Ne);return i&&ce.forEach(function(Ok){return s(M,Ok)}),$e&&Ir(M,he),re}function Ke(M,R,N,q){if(typeof N=="object"&&N!==null&&N.type===w&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case v:e:{for(var re=N.key;R!==null;){if(R.key===re){if(re=N.type,re===w){if(R.tag===7){a(M,R.sibling),q=f(R,N.props.children),q.return=M,M=q;break e}}else if(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===H&&fv(re)===R.type){a(M,R.sibling),q=f(R,N.props),Ea(q,N),q.return=M,M=q;break e}a(M,R);break}else s(M,R);R=R.sibling}N.type===w?(q=Pr(N.props.children,M.mode,q,N.key),q.return=M,M=q):(q=Wl(N.type,N.key,N.props,null,M.mode,q),Ea(q,N),q.return=M,M=q)}return b(M);case S:e:{for(re=N.key;R!==null;){if(R.key===re)if(R.tag===4&&R.stateNode.containerInfo===N.containerInfo&&R.stateNode.implementation===N.implementation){a(M,R.sibling),q=f(R,N.children||[]),q.return=M,M=q;break e}else{a(M,R);break}else s(M,R);R=R.sibling}q=ad(N,M.mode,q),q.return=M,M=q}return b(M);case H:return re=N._init,N=re(N._payload),Ke(M,R,N,q)}if(W(N))return me(M,R,N,q);if(ge(N)){if(re=ge(N),typeof re!="function")throw Error(r(150));return N=re.call(N),de(M,R,N,q)}if(typeof N.then=="function")return Ke(M,R,yc(N),q);if(N.$$typeof===k)return Ke(M,R,ic(M,N),q);gc(M,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,R!==null&&R.tag===6?(a(M,R.sibling),q=f(R,N),q.return=M,M=q):(a(M,R),q=od(N,M.mode,q),q.return=M,M=q),b(M)):a(M,R)}return function(M,R,N,q){try{Aa=0;var re=Ke(M,R,N,q);return Hs=null,re}catch(ce){if(ce===ma||ce===sc)throw ce;var Re=pn(29,ce,null,M.mode);return Re.lanes=q,Re.return=M,Re}finally{}}}var Fs=dv(!0),hv=dv(!1),Cn=I(null),ti=null;function or(i){var s=i.alternate;X(_t,_t.current&1),X(Cn,i),ti===null&&(s===null||Ks.current!==null||s.memoizedState!==null)&&(ti=i)}function pv(i){if(i.tag===22){if(X(_t,_t.current),X(Cn,i),ti===null){var s=i.alternate;s!==null&&s.memoizedState!==null&&(ti=i)}}else ar()}function ar(){X(_t,_t.current),X(Cn,Cn.current)}function Ci(i){te(Cn),ti===i&&(ti=null),te(_t)}var _t=I(0);function bc(i){for(var s=i;s!==null;){if(s.tag===13){var a=s.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||kh(a)))return s}else if(s.tag===19&&s.memoizedProps.revealOrder!==void 0){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}function zd(i,s,a,l){s=i.memoizedState,a=a(l,s),a=a==null?s:y({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Kd={enqueueSetState:function(i,s,a){i=i._reactInternals;var l=bn(),f=ir(l);f.payload=s,a!=null&&(f.callback=a),s=rr(i,f,l),s!==null&&(vn(s,i,l),ga(s,i,l))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var l=bn(),f=ir(l);f.tag=1,f.payload=s,a!=null&&(f.callback=a),s=rr(i,f,l),s!==null&&(vn(s,i,l),ga(s,i,l))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=bn(),l=ir(a);l.tag=2,s!=null&&(l.callback=s),s=rr(i,l,a),s!==null&&(vn(s,i,a),ga(s,i,a))}};function mv(i,s,a,l,f,m,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(l,m,b):s.prototype&&s.prototype.isPureReactComponent?!aa(a,l)||!aa(f,m):!0}function yv(i,s,a,l){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,l),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,l),s.state!==i&&Kd.enqueueReplaceState(s,s.state,null)}function Zr(i,s){var a=s;if("ref"in s){a={};for(var l in s)l!=="ref"&&(a[l]=s[l])}if(i=i.defaultProps){a===s&&(a=y({},a));for(var f in i)a[f]===void 0&&(a[f]=i[f])}return a}var vc=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)};function gv(i){vc(i)}function bv(i){console.error(i)}function vv(i){vc(i)}function Sc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(l){setTimeout(function(){throw l})}}function Sv(i,s,a){try{var l=i.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Pd(i,s,a){return a=ir(a),a.tag=3,a.payload={element:null},a.callback=function(){Sc(i,s)},a}function xv(i){return i=ir(i),i.tag=3,i}function wv(i,s,a,l){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=l.value;i.payload=function(){return f(m)},i.callback=function(){Sv(s,a,l)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){Sv(s,a,l),typeof f!="function"&&(hr===null?hr=new Set([this]):hr.add(this));var x=l.stack;this.componentDidCatch(l.value,{componentStack:x!==null?x:""})})}function O_(i,s,a,l,f){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(s=a.alternate,s!==null&&da(s,a,f,!0),a=Cn.current,a!==null){switch(a.tag){case 13:return ti===null?dh():a.alternate===null&&ot===0&&(ot=3),a.flags&=-257,a.flags|=65536,a.lanes=f,l===gd?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([l]):s.add(l),ph(i,l,f)),!1;case 22:return a.flags|=65536,l===gd?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([l]):a.add(l)),ph(i,l,f)),!1}throw Error(r(435,a.tag))}return ph(i,l,f),dh(),!1}if($e)return s=Cn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=f,l!==ud&&(i=Error(r(422),{cause:l}),fa(On(i,a)))):(l!==ud&&(s=Error(r(423),{cause:l}),fa(On(s,a))),i=i.current.alternate,i.flags|=65536,f&=-f,i.lanes|=f,l=On(l,a),f=Pd(i.stateNode,l,f),Sd(i,f),ot!==4&&(ot=2)),!1;var m=Error(r(520),{cause:l});if(m=On(m,a),Da===null?Da=[m]:Da.push(m),ot!==4&&(ot=2),s===null)return!0;l=On(l,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=f&-f,a.lanes|=i,i=Pd(a.stateNode,l,i),Sd(a,i),!1;case 1:if(s=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof s.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(hr===null||!hr.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=xv(f),wv(f,i,a,l),Sd(a,f),!1}a=a.return}while(a!==null);return!1}var Tv=Error(r(461)),Dt=!1;function Vt(i,s,a,l){s.child=i===null?hv(s,null,a,l):Fs(s,i.child,a,l)}function Av(i,s,a,l,f){a=a.render;var m=s.ref;if("ref"in l){var b={};for(var x in l)x!=="ref"&&(b[x]=l[x])}else b=l;return Yr(s),l=Ed(i,s,a,b,m,f),x=Rd(),i!==null&&!Dt?(Od(i,s,f),Di(i,s,f)):($e&&x&&ld(s),s.flags|=1,Vt(i,s,l,f),s.child)}function Ev(i,s,a,l,f){if(i===null){var m=a.type;return typeof m=="function"&&!sd(m)&&m.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=m,Rv(i,s,m,l,f)):(i=Wl(a.type,null,l,s,s.mode,f),i.ref=s.ref,i.return=s,s.child=i)}if(m=i.child,!Xd(i,f)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:aa,a(b,l)&&i.ref===s.ref)return Di(i,s,f)}return s.flags|=1,i=Ei(m,l),i.ref=s.ref,i.return=s,s.child=i}function Rv(i,s,a,l,f){if(i!==null){var m=i.memoizedProps;if(aa(m,l)&&i.ref===s.ref)if(Dt=!1,s.pendingProps=l=m,Xd(i,f))(i.flags&131072)!==0&&(Dt=!0);else return s.lanes=i.lanes,Di(i,s,f)}return qd(i,s,a,l,f)}function Ov(i,s,a){var l=s.pendingProps,f=l.children,m=i!==null?i.memoizedState:null;if(l.mode==="hidden"){if((s.flags&128)!==0){if(l=m!==null?m.baseLanes|a:a,i!==null){for(f=s.child=i.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;s.childLanes=m&~l}else s.childLanes=0,s.child=null;return _v(i,s,l,a)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&rc(s,m!==null?m.cachePool:null),m!==null?Rb(s,m):wd(),pv(s);else return s.lanes=s.childLanes=536870912,_v(i,s,m!==null?m.baseLanes|a:a,a)}else m!==null?(rc(s,m.cachePool),Rb(s,m),ar(),s.memoizedState=null):(i!==null&&rc(s,null),wd(),ar());return Vt(i,s,f,a),s.child}function _v(i,s,a,l){var f=yd();return f=f===null?null:{parent:Ot._currentValue,pool:f},s.memoizedState={baseLanes:a,cachePool:f},i!==null&&rc(s,null),wd(),pv(s),i!==null&&da(i,s,l,!0),null}function xc(i,s){var a=s.ref;if(a===null)i!==null&&i.ref!==null&&(s.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(r(284));(i===null||i.ref!==a)&&(s.flags|=4194816)}}function qd(i,s,a,l,f){return Yr(s),a=Ed(i,s,a,l,void 0,f),l=Rd(),i!==null&&!Dt?(Od(i,s,f),Di(i,s,f)):($e&&l&&ld(s),s.flags|=1,Vt(i,s,a,f),s.child)}function kv(i,s,a,l,f,m){return Yr(s),s.updateQueue=null,a=_b(s,l,a,f),Ob(i),l=Rd(),i!==null&&!Dt?(Od(i,s,m),Di(i,s,m)):($e&&l&&ld(s),s.flags|=1,Vt(i,s,a,m),s.child)}function Mv(i,s,a,l,f){if(Yr(s),s.stateNode===null){var m=Bs,b=a.contextType;typeof b=="object"&&b!==null&&(m=It(b)),m=new a(l,m),s.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Kd,s.stateNode=m,m._reactInternals=s,m=s.stateNode,m.props=l,m.state=s.memoizedState,m.refs={},bd(s),b=a.contextType,m.context=typeof b=="object"&&b!==null?It(b):Bs,m.state=s.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(zd(s,a,b,l),m.state=s.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof m.getSnapshotBeforeUpdate=="function"||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(b=m.state,typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount(),b!==m.state&&Kd.enqueueReplaceState(m,m.state,null),va(s,l,m,f),ba(),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308),l=!0}else if(i===null){m=s.stateNode;var x=s.memoizedProps,E=Zr(a,x);m.props=E;var j=m.context,K=a.contextType;b=Bs,typeof K=="object"&&K!==null&&(b=It(K));var F=a.getDerivedStateFromProps;K=typeof F=="function"||typeof m.getSnapshotBeforeUpdate=="function",x=s.pendingProps!==x,K||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(x||j!==b)&&yv(s,m,l,b),nr=!1;var L=s.memoizedState;m.state=L,va(s,l,m,f),ba(),j=s.memoizedState,x||L!==j||nr?(typeof F=="function"&&(zd(s,a,F,l),j=s.memoizedState),(E=nr||mv(s,a,E,l,L,j,b))?(K||typeof m.UNSAFE_componentWillMount!="function"&&typeof m.componentWillMount!="function"||(typeof m.componentWillMount=="function"&&m.componentWillMount(),typeof m.UNSAFE_componentWillMount=="function"&&m.UNSAFE_componentWillMount()),typeof m.componentDidMount=="function"&&(s.flags|=4194308)):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),s.memoizedProps=l,s.memoizedState=j),m.props=l,m.state=j,m.context=b,l=E):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),l=!1)}else{m=s.stateNode,vd(i,s),b=s.memoizedProps,K=Zr(a,b),m.props=K,F=s.pendingProps,L=m.context,j=a.contextType,E=Bs,typeof j=="object"&&j!==null&&(E=It(j)),x=a.getDerivedStateFromProps,(j=typeof x=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==F||L!==E)&&yv(s,m,l,E),nr=!1,L=s.memoizedState,m.state=L,va(s,l,m,f),ba();var U=s.memoizedState;b!==F||L!==U||nr||i!==null&&i.dependencies!==null&&nc(i.dependencies)?(typeof x=="function"&&(zd(s,a,x,l),U=s.memoizedState),(K=nr||mv(s,a,K,l,L,U,E)||i!==null&&i.dependencies!==null&&nc(i.dependencies))?(j||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(l,U,E),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(l,U,E)),typeof m.componentDidUpdate=="function"&&(s.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(s.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=1024),s.memoizedProps=l,s.memoizedState=U),m.props=l,m.state=U,m.context=E,l=K):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(s.flags|=1024),l=!1)}return m=l,xc(i,s),l=(s.flags&128)!==0,m||l?(m=s.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:m.render(),s.flags|=1,i!==null&&l?(s.child=Fs(s,i.child,null,f),s.child=Fs(s,null,a,f)):Vt(i,s,a,f),s.memoizedState=m.state,i=s.child):i=Di(i,s,f),i}function Cv(i,s,a,l){return ua(),s.flags|=256,Vt(i,s,a,l),s.child}var Id={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Hd(i){return{baseLanes:i,cachePool:bb()}}function Fd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Dn),i}function Dv(i,s,a){var l=s.pendingProps,f=!1,m=(s.flags&128)!==0,b;if((b=m)||(b=i!==null&&i.memoizedState===null?!1:(_t.current&2)!==0),b&&(f=!0,s.flags&=-129),b=(s.flags&32)!==0,s.flags&=-33,i===null){if($e){if(f?or(s):ar(),$e){var x=st,E;if(E=x){e:{for(E=x,x=ei;E.nodeType!==8;){if(!x){x=null;break e}if(E=Hn(E.nextSibling),E===null){x=null;break e}}x=E}x!==null?(s.memoizedState={dehydrated:x,treeContext:qr!==null?{id:Ri,overflow:Oi}:null,retryLane:536870912,hydrationErrors:null},E=pn(18,null,null,0),E.stateNode=x,E.return=s,s.child=E,Xt=s,st=null,E=!0):E=!1}E||Fr(s)}if(x=s.memoizedState,x!==null&&(x=x.dehydrated,x!==null))return kh(x)?s.lanes=32:s.lanes=536870912,null;Ci(s)}return x=l.children,l=l.fallback,f?(ar(),f=s.mode,x=wc({mode:"hidden",children:x},f),l=Pr(l,f,a,null),x.return=s,l.return=s,x.sibling=l,s.child=x,f=s.child,f.memoizedState=Hd(a),f.childLanes=Fd(i,b,a),s.memoizedState=Id,l):(or(s),Gd(s,x))}if(E=i.memoizedState,E!==null&&(x=E.dehydrated,x!==null)){if(m)s.flags&256?(or(s),s.flags&=-257,s=Yd(i,s,a)):s.memoizedState!==null?(ar(),s.child=i.child,s.flags|=128,s=null):(ar(),f=l.fallback,x=s.mode,l=wc({mode:"visible",children:l.children},x),f=Pr(f,x,a,null),f.flags|=2,l.return=s,f.return=s,l.sibling=f,s.child=l,Fs(s,i.child,null,a),l=s.child,l.memoizedState=Hd(a),l.childLanes=Fd(i,b,a),s.memoizedState=Id,s=f);else if(or(s),kh(x)){if(b=x.nextSibling&&x.nextSibling.dataset,b)var j=b.dgst;b=j,l=Error(r(419)),l.stack="",l.digest=b,fa({value:l,source:null,stack:null}),s=Yd(i,s,a)}else if(Dt||da(i,s,a,!1),b=(a&i.childLanes)!==0,Dt||b){if(b=Fe,b!==null&&(l=a&-a,l=(l&42)!==0?1:Mf(l),l=(l&(b.suspendedLanes|a))!==0?0:l,l!==0&&l!==E.retryLane))throw E.retryLane=l,js(i,l),vn(b,i,l),Tv;x.data==="$?"||dh(),s=Yd(i,s,a)}else x.data==="$?"?(s.flags|=192,s.child=i.child,s=null):(i=E.treeContext,st=Hn(x.nextSibling),Xt=s,$e=!0,Hr=null,ei=!1,i!==null&&(kn[Mn++]=Ri,kn[Mn++]=Oi,kn[Mn++]=qr,Ri=i.id,Oi=i.overflow,qr=s),s=Gd(s,l.children),s.flags|=4096);return s}return f?(ar(),f=l.fallback,x=s.mode,E=i.child,j=E.sibling,l=Ei(E,{mode:"hidden",children:l.children}),l.subtreeFlags=E.subtreeFlags&65011712,j!==null?f=Ei(j,f):(f=Pr(f,x,a,null),f.flags|=2),f.return=s,l.return=s,l.sibling=f,s.child=l,l=f,f=s.child,x=i.child.memoizedState,x===null?x=Hd(a):(E=x.cachePool,E!==null?(j=Ot._currentValue,E=E.parent!==j?{parent:j,pool:j}:E):E=bb(),x={baseLanes:x.baseLanes|a,cachePool:E}),f.memoizedState=x,f.childLanes=Fd(i,b,a),s.memoizedState=Id,l):(or(s),a=i.child,i=a.sibling,a=Ei(a,{mode:"visible",children:l.children}),a.return=s,a.sibling=null,i!==null&&(b=s.deletions,b===null?(s.deletions=[i],s.flags|=16):b.push(i)),s.child=a,s.memoizedState=null,a)}function Gd(i,s){return s=wc({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function wc(i,s){return i=pn(22,i,null,s),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Yd(i,s,a){return Fs(s,i.child,null,a),i=Gd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Nv(i,s,a){i.lanes|=s;var l=i.alternate;l!==null&&(l.lanes|=s),dd(i.return,s,a)}function Jd(i,s,a,l,f){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:f}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=l,m.tail=a,m.tailMode=f)}function $v(i,s,a){var l=s.pendingProps,f=l.revealOrder,m=l.tail;if(Vt(i,s,l.children,a),l=_t.current,(l&2)!==0)l=l&1|2,s.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=s.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Nv(i,a,s);else if(i.tag===19)Nv(i,a,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}l&=1}switch(X(_t,l),f){case"forwards":for(a=s.child,f=null;a!==null;)i=a.alternate,i!==null&&bc(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=s.child,s.child=null):(f=a.sibling,a.sibling=null),Jd(s,!1,f,a,m);break;case"backwards":for(a=null,f=s.child,s.child=null;f!==null;){if(i=f.alternate,i!==null&&bc(i)===null){s.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}Jd(s,!0,a,null,m);break;case"together":Jd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function Di(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),dr|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(da(i,s,a,!1),(a&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,a=Ei(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=Ei(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function Xd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&nc(i)))}function __(i,s,a){switch(s.tag){case 3:Ve(s,s.stateNode.containerInfo),tr(s,Ot,i.memoizedState.cache),ua();break;case 27:case 5:Zi(s);break;case 4:Ve(s,s.stateNode.containerInfo);break;case 10:tr(s,s.type,s.memoizedProps.value);break;case 13:var l=s.memoizedState;if(l!==null)return l.dehydrated!==null?(or(s),s.flags|=128,null):(a&s.child.childLanes)!==0?Dv(i,s,a):(or(s),i=Di(i,s,a),i!==null?i.sibling:null);or(s);break;case 19:var f=(i.flags&128)!==0;if(l=(a&s.childLanes)!==0,l||(da(i,s,a,!1),l=(a&s.childLanes)!==0),f){if(l)return $v(i,s,a);s.flags|=128}if(f=s.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),X(_t,_t.current),l)break;return null;case 22:case 23:return s.lanes=0,Ov(i,s,a);case 24:tr(s,Ot,i.memoizedState.cache)}return Di(i,s,a)}function jv(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)Dt=!0;else{if(!Xd(i,a)&&(s.flags&128)===0)return Dt=!1,__(i,s,a);Dt=(i.flags&131072)!==0}else Dt=!1,$e&&(s.flags&1048576)!==0&&fb(s,tc,s.index);switch(s.lanes=0,s.tag){case 16:e:{i=s.pendingProps;var l=s.elementType,f=l._init;if(l=f(l._payload),s.type=l,typeof l=="function")sd(l)?(i=Zr(l,i),s.tag=1,s=Mv(null,s,l,i,a)):(s.tag=0,s=qd(null,s,l,i,a));else{if(l!=null){if(f=l.$$typeof,f===C){s.tag=11,s=Av(null,s,l,i,a);break e}else if(f===G){s.tag=14,s=Ev(null,s,l,i,a);break e}}throw s=Q(l)||l,Error(r(306,s,""))}}return s;case 0:return qd(i,s,s.type,s.pendingProps,a);case 1:return l=s.type,f=Zr(l,s.pendingProps),Mv(i,s,l,f,a);case 3:e:{if(Ve(s,s.stateNode.containerInfo),i===null)throw Error(r(387));l=s.pendingProps;var m=s.memoizedState;f=m.element,vd(i,s),va(s,l,null,a);var b=s.memoizedState;if(l=b.cache,tr(s,Ot,l),l!==m.cache&&hd(s,[Ot],a,!0),ba(),l=b.element,m.isDehydrated)if(m={element:l,isDehydrated:!1,cache:b.cache},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){s=Cv(i,s,l,a);break e}else if(l!==f){f=On(Error(r(424)),s),fa(f),s=Cv(i,s,l,a);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(st=Hn(i.firstChild),Xt=s,$e=!0,Hr=null,ei=!0,a=hv(s,null,l,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ua(),l===f){s=Di(i,s,a);break e}Vt(i,s,l,a)}s=s.child}return s;case 26:return xc(i,s),i===null?(a=U0(s.type,null,s.pendingProps,null))?s.memoizedState=a:$e||(a=s.type,i=s.pendingProps,l=Bc(le.current).createElement(a),l[qt]=s,l[tn]=i,zt(l,a,i),Ct(l),s.stateNode=l):s.memoizedState=U0(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Zi(s),i===null&&$e&&(l=s.stateNode=B0(s.type,s.pendingProps,le.current),Xt=s,ei=!0,f=st,yr(s.type)?(Mh=f,st=Hn(l.firstChild)):st=f),Vt(i,s,s.pendingProps.children,a),xc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&$e&&((f=l=st)&&(l=nk(l,s.type,s.pendingProps,ei),l!==null?(s.stateNode=l,Xt=s,st=Hn(l.firstChild),ei=!1,f=!0):f=!1),f||Fr(s)),Zi(s),f=s.type,m=s.pendingProps,b=i!==null?i.memoizedProps:null,l=m.children,Rh(f,m)?l=null:b!==null&&Rh(f,b)&&(s.flags|=32),s.memoizedState!==null&&(f=Ed(i,s,S_,null,null,a),Ka._currentValue=f),xc(i,s),Vt(i,s,l,a),s.child;case 6:return i===null&&$e&&((i=a=st)&&(a=ik(a,s.pendingProps,ei),a!==null?(s.stateNode=a,Xt=s,st=null,i=!0):i=!1),i||Fr(s)),null;case 13:return Dv(i,s,a);case 4:return Ve(s,s.stateNode.containerInfo),l=s.pendingProps,i===null?s.child=Fs(s,null,l,a):Vt(i,s,l,a),s.child;case 11:return Av(i,s,s.type,s.pendingProps,a);case 7:return Vt(i,s,s.pendingProps,a),s.child;case 8:return Vt(i,s,s.pendingProps.children,a),s.child;case 12:return Vt(i,s,s.pendingProps.children,a),s.child;case 10:return l=s.pendingProps,tr(s,s.type,l.value),Vt(i,s,l.children,a),s.child;case 9:return f=s.type._context,l=s.pendingProps.children,Yr(s),f=It(f),l=l(f),s.flags|=1,Vt(i,s,l,a),s.child;case 14:return Ev(i,s,s.type,s.pendingProps,a);case 15:return Rv(i,s,s.type,s.pendingProps,a);case 19:return $v(i,s,a);case 31:return l=s.pendingProps,a=s.mode,l={mode:l.mode,children:l.children},i===null?(a=wc(l,a),a.ref=s.ref,s.child=a,a.return=s,s=a):(a=Ei(i.child,l),a.ref=s.ref,s.child=a,a.return=s,s=a),s;case 22:return Ov(i,s,a);case 24:return Yr(s),l=It(Ot),i===null?(f=yd(),f===null&&(f=Fe,m=pd(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),s.memoizedState={parent:l,cache:f},bd(s),tr(s,Ot,f)):((i.lanes&a)!==0&&(vd(i,s),va(s,null,null,a),ba()),f=i.memoizedState,m=s.memoizedState,f.parent!==l?(f={parent:l,cache:l},s.memoizedState=f,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=f),tr(s,Ot,l)):(l=m.cache,tr(s,Ot,l),l!==f.cache&&hd(s,[Ot],a,!0))),Vt(i,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Ni(i){i.flags|=4}function Bv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!I0(s)){if(s=Cn.current,s!==null&&((Ce&4194048)===Ce?ti!==null:(Ce&62914560)!==Ce&&(Ce&536870912)===0||s!==ti))throw ya=gd,vb;i.flags|=8192}}function Tc(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?pg():536870912,i.lanes|=s,Xs|=s)}function Ra(i,s){if(!$e)switch(i.tailMode){case"hidden":s=i.tail;for(var a=null;s!==null;)s.alternate!==null&&(a=s),s=s.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:l.sibling=null}}function nt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,l=0;if(s)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags&65011712,l|=f.flags&65011712,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,l|=f.subtreeFlags,l|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=l,i.childLanes=a,s}function k_(i,s,a){var l=s.pendingProps;switch(cd(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return nt(s),null;case 1:return nt(s),null;case 3:return a=s.stateNode,l=null,i!==null&&(l=i.memoizedState.cache),s.memoizedState.cache!==l&&(s.flags|=2048),ki(Ot),wn(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(ca(s)?Ni(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,pb())),nt(s),null;case 26:return a=s.memoizedState,i===null?(Ni(s),a!==null?(nt(s),Bv(s,a)):(nt(s),s.flags&=-16777217)):a?a!==i.memoizedState?(Ni(s),nt(s),Bv(s,a)):(nt(s),s.flags&=-16777217):(i.memoizedProps!==l&&Ni(s),nt(s),s.flags&=-16777217),null;case 27:wi(s),a=le.current;var f=s.type;if(i!==null&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return nt(s),null}i=se.current,ca(s)?db(s):(i=B0(f,l,a),s.stateNode=i,Ni(s))}return nt(s),null;case 5:if(wi(s),a=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(!l){if(s.stateNode===null)throw Error(r(166));return nt(s),null}if(i=se.current,ca(s))db(s);else{switch(f=Bc(le.current),i){case 1:i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=f.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=f.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":i=f.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof l.is=="string"?f.createElement("select",{is:l.is}):f.createElement("select"),l.multiple?i.multiple=!0:l.size&&(i.size=l.size);break;default:i=typeof l.is=="string"?f.createElement(a,{is:l.is}):f.createElement(a)}}i[qt]=s,i[tn]=l;e:for(f=s.child;f!==null;){if(f.tag===5||f.tag===6)i.appendChild(f.stateNode);else if(f.tag!==4&&f.tag!==27&&f.child!==null){f.child.return=f,f=f.child;continue}if(f===s)break e;for(;f.sibling===null;){if(f.return===null||f.return===s)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}s.stateNode=i;e:switch(zt(i,a,l),a){case"button":case"input":case"select":case"textarea":i=!!l.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Ni(s)}}return nt(s),s.flags&=-16777217,null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==l&&Ni(s);else{if(typeof l!="string"&&s.stateNode===null)throw Error(r(166));if(i=le.current,ca(s)){if(i=s.stateNode,a=s.memoizedProps,l=null,f=Xt,f!==null)switch(f.tag){case 27:case 5:l=f.memoizedProps}i[qt]=s,i=!!(i.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||k0(i.nodeValue,a)),i||Fr(s)}else i=Bc(i).createTextNode(l),i[qt]=s,s.stateNode=i}return nt(s),null;case 13:if(l=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(f=ca(s),l!==null&&l.dehydrated!==null){if(i===null){if(!f)throw Error(r(318));if(f=s.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(r(317));f[qt]=s}else ua(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;nt(s),f=!1}else f=pb(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=f),f=!0;if(!f)return s.flags&256?(Ci(s),s):(Ci(s),null)}if(Ci(s),(s.flags&128)!==0)return s.lanes=a,s;if(a=l!==null,i=i!==null&&i.memoizedState!==null,a){l=s.child,f=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(f=l.alternate.memoizedState.cachePool.pool);var m=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(m=l.memoizedState.cachePool.pool),m!==f&&(l.flags|=2048)}return a!==i&&a&&(s.child.flags|=8192),Tc(s,s.updateQueue),nt(s),null;case 4:return wn(),i===null&&xh(s.stateNode.containerInfo),nt(s),null;case 10:return ki(s.type),nt(s),null;case 19:if(te(_t),f=s.memoizedState,f===null)return nt(s),null;if(l=(s.flags&128)!==0,m=f.rendering,m===null)if(l)Ra(f,!1);else{if(ot!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(m=bc(i),m!==null){for(s.flags|=128,Ra(f,!1),i=m.updateQueue,s.updateQueue=i,Tc(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)ub(a,i),a=a.sibling;return X(_t,_t.current&1|2),s.child}i=i.sibling}f.tail!==null&&Te()>Rc&&(s.flags|=128,l=!0,Ra(f,!1),s.lanes=4194304)}else{if(!l)if(i=bc(m),i!==null){if(s.flags|=128,l=!0,i=i.updateQueue,s.updateQueue=i,Tc(s,i),Ra(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!$e)return nt(s),null}else 2*Te()-f.renderingStartTime>Rc&&a!==536870912&&(s.flags|=128,l=!0,Ra(f,!1),s.lanes=4194304);f.isBackwards?(m.sibling=s.child,s.child=m):(i=f.last,i!==null?i.sibling=m:s.child=m,f.last=m)}return f.tail!==null?(s=f.tail,f.rendering=s,f.tail=s.sibling,f.renderingStartTime=Te(),s.sibling=null,i=_t.current,X(_t,l?i&1|2:i&1),s):(nt(s),null);case 22:case 23:return Ci(s),Td(),l=s.memoizedState!==null,i!==null?i.memoizedState!==null!==l&&(s.flags|=8192):l&&(s.flags|=8192),l?(a&536870912)!==0&&(s.flags&128)===0&&(nt(s),s.subtreeFlags&6&&(s.flags|=8192)):nt(s),a=s.updateQueue,a!==null&&Tc(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),l=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(l=s.memoizedState.cachePool.pool),l!==a&&(s.flags|=2048),i!==null&&te(Jr),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),s.memoizedState.cache!==a&&(s.flags|=2048),ki(Ot),nt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function M_(i,s){switch(cd(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return ki(Ot),wn(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return wi(s),null;case 13:if(Ci(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ua()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return te(_t),null;case 4:return wn(),null;case 10:return ki(s.type),null;case 22:case 23:return Ci(s),Td(),i!==null&&te(Jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return ki(Ot),null;case 25:return null;default:return null}}function Lv(i,s){switch(cd(s),s.tag){case 3:ki(Ot),wn();break;case 26:case 27:case 5:wi(s);break;case 4:wn();break;case 13:Ci(s);break;case 19:te(_t);break;case 10:ki(s.type);break;case 22:case 23:Ci(s),Td(),i!==null&&te(Jr);break;case 24:ki(Ot)}}function Oa(i,s){try{var a=s.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var f=l.next;a=f;do{if((a.tag&i)===i){l=void 0;var m=a.create,b=a.inst;l=m(),b.destroy=l}a=a.next}while(a!==f)}}catch(x){qe(s,s.return,x)}}function lr(i,s,a){try{var l=s.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var m=f.next;l=m;do{if((l.tag&i)===i){var b=l.inst,x=b.destroy;if(x!==void 0){b.destroy=void 0,f=s;var E=a,j=x;try{j()}catch(K){qe(f,E,K)}}}l=l.next}while(l!==m)}}catch(K){qe(s,s.return,K)}}function Vv(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Eb(s,a)}catch(l){qe(i,i.return,l)}}}function Uv(i,s,a){a.props=Zr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(l){qe(i,s,l)}}function _a(i,s){try{var a=i.ref;if(a!==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 a=="function"?i.refCleanup=a(l):a.current=l}}catch(f){qe(i,s,f)}}function ni(i,s){var a=i.ref,l=i.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(f){qe(i,s,f)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){qe(i,s,f)}else a.current=null}function zv(i){var s=i.type,a=i.memoizedProps,l=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(f){qe(i,i.return,f)}}function Zd(i,s,a){try{var l=i.stateNode;Z_(l,i.type,a,s),l[tn]=s}catch(f){qe(i,i.return,f)}}function Kv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&yr(i.type)||i.tag===4}function Qd(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Kv(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&&yr(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 Wd(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,s):(s=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,s.appendChild(i),a=a._reactRootContainer,a!=null||s.onclick!==null||(s.onclick=jc));else if(l!==4&&(l===27&&yr(i.type)&&(a=i.stateNode,s=null),i=i.child,i!==null))for(Wd(i,s,a),i=i.sibling;i!==null;)Wd(i,s,a),i=i.sibling}function Ac(i,s,a){var l=i.tag;if(l===5||l===6)i=i.stateNode,s?a.insertBefore(i,s):a.appendChild(i);else if(l!==4&&(l===27&&yr(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(Ac(i,s,a),i=i.sibling;i!==null;)Ac(i,s,a),i=i.sibling}function Pv(i){var s=i.stateNode,a=i.memoizedProps;try{for(var l=i.type,f=s.attributes;f.length;)s.removeAttributeNode(f[0]);zt(s,l,a),s[qt]=i,s[tn]=a}catch(m){qe(i,i.return,m)}}var $i=!1,ft=!1,eh=!1,qv=typeof WeakSet=="function"?WeakSet:Set,Nt=null;function C_(i,s){if(i=i.containerInfo,Ah=Pc,i=eb(i),Qf(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var f=l.anchorOffset,m=l.focusNode;l=l.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,x=-1,E=-1,j=0,K=0,F=i,L=null;t:for(;;){for(var U;F!==a||f!==0&&F.nodeType!==3||(x=b+f),F!==m||l!==0&&F.nodeType!==3||(E=b+l),F.nodeType===3&&(b+=F.nodeValue.length),(U=F.firstChild)!==null;)L=F,F=U;for(;;){if(F===i)break t;if(L===a&&++j===f&&(x=b),L===m&&++K===l&&(E=b),(U=F.nextSibling)!==null)break;F=L,L=F.parentNode}F=U}a=x===-1||E===-1?null:{start:x,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(Eh={focusedElem:i,selectionRange:a},Pc=!1,Nt=s;Nt!==null;)if(s=Nt,i=s.child,(s.subtreeFlags&1024)!==0&&i!==null)i.return=s,Nt=i;else for(;Nt!==null;){switch(s=Nt,m=s.alternate,i=s.flags,s.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,a=s,f=m.memoizedProps,m=m.memoizedState,l=a.stateNode;try{var me=Zr(a.type,f,a.elementType===a.type);i=l.getSnapshotBeforeUpdate(me,m),l.__reactInternalSnapshotBeforeUpdate=i}catch(de){qe(a,a.return,de)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,a=i.nodeType,a===9)_h(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":_h(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,Nt=i;break}Nt=s.return}}function Iv(i,s,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:cr(i,a),l&4&&Oa(5,a);break;case 1:if(cr(i,a),l&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(b){qe(a,a.return,b)}else{var f=Zr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(f,s,i.__reactInternalSnapshotBeforeUpdate)}catch(b){qe(a,a.return,b)}}l&64&&Vv(a),l&512&&_a(a,a.return);break;case 3:if(cr(i,a),l&64&&(i=a.updateQueue,i!==null)){if(s=null,a.child!==null)switch(a.child.tag){case 27:case 5:s=a.child.stateNode;break;case 1:s=a.child.stateNode}try{Eb(i,s)}catch(b){qe(a,a.return,b)}}break;case 27:s===null&&l&4&&Pv(a);case 26:case 5:cr(i,a),s===null&&l&4&&zv(a),l&512&&_a(a,a.return);break;case 12:cr(i,a);break;case 13:cr(i,a),l&4&&Gv(i,a),l&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=z_.bind(null,a),rk(i,a))));break;case 22:if(l=a.memoizedState!==null||$i,!l){s=s!==null&&s.memoizedState!==null||ft,f=$i;var m=ft;$i=l,(ft=s)&&!m?ur(i,a,(a.subtreeFlags&8772)!==0):cr(i,a),$i=f,ft=m}break;case 30:break;default:cr(i,a)}}function Hv(i){var s=i.alternate;s!==null&&(i.alternate=null,Hv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Nf(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 Xe=null,sn=!1;function ji(i,s,a){for(a=a.child;a!==null;)Fv(i,s,a),a=a.sibling}function Fv(i,s,a){if(fn&&typeof fn.onCommitFiberUnmount=="function")try{fn.onCommitFiberUnmount(Jo,a)}catch{}switch(a.tag){case 26:ft||ni(a,s),ji(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ft||ni(a,s);var l=Xe,f=sn;yr(a.type)&&(Xe=a.stateNode,sn=!1),ji(i,s,a),La(a.stateNode),Xe=l,sn=f;break;case 5:ft||ni(a,s);case 6:if(l=Xe,f=sn,Xe=null,ji(i,s,a),Xe=l,sn=f,Xe!==null)if(sn)try{(Xe.nodeType===9?Xe.body:Xe.nodeName==="HTML"?Xe.ownerDocument.body:Xe).removeChild(a.stateNode)}catch(m){qe(a,s,m)}else try{Xe.removeChild(a.stateNode)}catch(m){qe(a,s,m)}break;case 18:Xe!==null&&(sn?(i=Xe,$0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Ha(i)):$0(Xe,a.stateNode));break;case 4:l=Xe,f=sn,Xe=a.stateNode.containerInfo,sn=!0,ji(i,s,a),Xe=l,sn=f;break;case 0:case 11:case 14:case 15:ft||lr(2,a,s),ft||lr(4,a,s),ji(i,s,a);break;case 1:ft||(ni(a,s),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Uv(a,s,l)),ji(i,s,a);break;case 21:ji(i,s,a);break;case 22:ft=(l=ft)||a.memoizedState!==null,ji(i,s,a),ft=l;break;default:ji(i,s,a)}}function Gv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ha(i)}catch(a){qe(s,s.return,a)}}function D_(i){switch(i.tag){case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new qv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new qv),s;default:throw Error(r(435,i.tag))}}function th(i,s){var a=D_(i);s.forEach(function(l){var f=K_.bind(null,i,l);a.has(l)||(a.add(l),l.then(f,f))})}function mn(i,s){var a=s.deletions;if(a!==null)for(var l=0;l<a.length;l++){var f=a[l],m=i,b=s,x=b;e:for(;x!==null;){switch(x.tag){case 27:if(yr(x.type)){Xe=x.stateNode,sn=!1;break e}break;case 5:Xe=x.stateNode,sn=!1;break e;case 3:case 4:Xe=x.stateNode.containerInfo,sn=!0;break e}x=x.return}if(Xe===null)throw Error(r(160));Fv(m,b,f),Xe=null,sn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Yv(s,i),s=s.sibling}var In=null;function Yv(i,s){var a=i.alternate,l=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:mn(s,i),yn(i),l&4&&(lr(3,i,i.return),Oa(3,i),lr(5,i,i.return));break;case 1:mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),l&64&&$i&&(i=i.updateQueue,i!==null&&(l=i.callbacks,l!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var f=In;if(mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),l&4){var m=a!==null?a.memoizedState:null;if(l=i.memoizedState,a===null)if(l===null)if(i.stateNode===null){e:{l=i.type,a=i.memoizedProps,f=f.ownerDocument||f;t:switch(l){case"title":m=f.getElementsByTagName("title")[0],(!m||m[Qo]||m[qt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(l),f.head.insertBefore(m,f.querySelector("head > title"))),zt(m,l,a),m[qt]=i,Ct(m),l=m;break e;case"link":var b=P0("link","href",f).get(l+(a.href||""));if(b){for(var x=0;x<b.length;x++)if(m=b[x],m.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&m.getAttribute("rel")===(a.rel==null?null:a.rel)&&m.getAttribute("title")===(a.title==null?null:a.title)&&m.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){b.splice(x,1);break t}}m=f.createElement(l),zt(m,l,a),f.head.appendChild(m);break;case"meta":if(b=P0("meta","content",f).get(l+(a.content||""))){for(x=0;x<b.length;x++)if(m=b[x],m.getAttribute("content")===(a.content==null?null:""+a.content)&&m.getAttribute("name")===(a.name==null?null:a.name)&&m.getAttribute("property")===(a.property==null?null:a.property)&&m.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&m.getAttribute("charset")===(a.charSet==null?null:a.charSet)){b.splice(x,1);break t}}m=f.createElement(l),zt(m,l,a),f.head.appendChild(m);break;default:throw Error(r(468,l))}m[qt]=i,Ct(m),l=m}i.stateNode=l}else q0(f,i.type,i.stateNode);else i.stateNode=K0(f,l,i.memoizedProps);else m!==l?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,l===null?q0(f,i.type,i.stateNode):K0(f,l,i.memoizedProps)):l===null&&i.stateNode!==null&&Zd(i,i.memoizedProps,a.memoizedProps)}break;case 27:mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),a!==null&&l&4&&Zd(i,i.memoizedProps,a.memoizedProps);break;case 5:if(mn(s,i),yn(i),l&512&&(ft||a===null||ni(a,a.return)),i.flags&32){f=i.stateNode;try{_s(f,"")}catch(U){qe(i,i.return,U)}}l&4&&i.stateNode!=null&&(f=i.memoizedProps,Zd(i,f,a!==null?a.memoizedProps:f)),l&1024&&(eh=!0);break;case 6:if(mn(s,i),yn(i),l&4){if(i.stateNode===null)throw Error(r(162));l=i.memoizedProps,a=i.stateNode;try{a.nodeValue=l}catch(U){qe(i,i.return,U)}}break;case 3:if(Uc=null,f=In,In=Lc(s.containerInfo),mn(s,i),In=f,yn(i),l&4&&a!==null&&a.memoizedState.isDehydrated)try{Ha(s.containerInfo)}catch(U){qe(i,i.return,U)}eh&&(eh=!1,Jv(i));break;case 4:l=In,In=Lc(i.stateNode.containerInfo),mn(s,i),yn(i),In=l;break;case 12:mn(s,i),yn(i);break;case 13:mn(s,i),yn(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ah=Te()),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,th(i,l)));break;case 22:f=i.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,j=$i,K=ft;if($i=j||f,ft=K||E,mn(s,i),ft=K,$i=j,yn(i),l&8192)e:for(s=i.stateNode,s._visibility=f?s._visibility&-2:s._visibility|1,f&&(a===null||E||$i||ft||Qr(i)),a=null,s=i;;){if(s.tag===5||s.tag===26){if(a===null){E=a=s;try{if(m=E.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{x=E.stateNode;var F=E.memoizedProps.style,L=F!=null&&F.hasOwnProperty("display")?F.display:null;x.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(U){qe(E,E.return,U)}}}else if(s.tag===6){if(a===null){E=s;try{E.stateNode.nodeValue=f?"":E.memoizedProps}catch(U){qe(E,E.return,U)}}}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;a===s&&(a=null),s=s.return}a===s&&(a=null),s.sibling.return=s.return,s=s.sibling}l&4&&(l=i.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,th(i,a))));break;case 19:mn(s,i),yn(i),l&4&&(l=i.updateQueue,l!==null&&(i.updateQueue=null,th(i,l)));break;case 30:break;case 21:break;default:mn(s,i),yn(i)}}function yn(i){var s=i.flags;if(s&2){try{for(var a,l=i.return;l!==null;){if(Kv(l)){a=l;break}l=l.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var f=a.stateNode,m=Qd(i);Ac(i,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(_s(b,""),a.flags&=-33);var x=Qd(i);Ac(i,x,b);break;case 3:case 4:var E=a.stateNode.containerInfo,j=Qd(i);Wd(i,j,E);break;default:throw Error(r(161))}}catch(K){qe(i,i.return,K)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function Jv(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;Jv(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function cr(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Iv(i,s.alternate,s),s=s.sibling}function Qr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:lr(4,s,s.return),Qr(s);break;case 1:ni(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&Uv(s,s.return,a),Qr(s);break;case 27:La(s.stateNode);case 26:case 5:ni(s,s.return),Qr(s);break;case 22:s.memoizedState===null&&Qr(s);break;case 30:Qr(s);break;default:Qr(s)}i=i.sibling}}function ur(i,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var l=s.alternate,f=i,m=s,b=m.flags;switch(m.tag){case 0:case 11:case 15:ur(f,m,a),Oa(4,m);break;case 1:if(ur(f,m,a),l=m,f=l.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch(j){qe(l,l.return,j)}if(l=m,f=l.updateQueue,f!==null){var x=l.stateNode;try{var E=f.shared.hiddenCallbacks;if(E!==null)for(f.shared.hiddenCallbacks=null,f=0;f<E.length;f++)Ab(E[f],x)}catch(j){qe(l,l.return,j)}}a&&b&64&&Vv(m),_a(m,m.return);break;case 27:Pv(m);case 26:case 5:ur(f,m,a),a&&l===null&&b&4&&zv(m),_a(m,m.return);break;case 12:ur(f,m,a);break;case 13:ur(f,m,a),a&&b&4&&Gv(f,m);break;case 22:m.memoizedState===null&&ur(f,m,a),_a(m,m.return);break;case 30:break;default:ur(f,m,a)}s=s.sibling}}function nh(i,s){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(i=s.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&ha(a))}function ih(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ha(i))}function ii(i,s,a,l){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Xv(i,s,a,l),s=s.sibling}function Xv(i,s,a,l){var f=s.flags;switch(s.tag){case 0:case 11:case 15:ii(i,s,a,l),f&2048&&Oa(9,s);break;case 1:ii(i,s,a,l);break;case 3:ii(i,s,a,l),f&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&ha(i)));break;case 12:if(f&2048){ii(i,s,a,l),i=s.stateNode;try{var m=s.memoizedProps,b=m.id,x=m.onPostCommit;typeof x=="function"&&x(b,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(E){qe(s,s.return,E)}}else ii(i,s,a,l);break;case 13:ii(i,s,a,l);break;case 23:break;case 22:m=s.stateNode,b=s.alternate,s.memoizedState!==null?m._visibility&2?ii(i,s,a,l):ka(i,s):m._visibility&2?ii(i,s,a,l):(m._visibility|=2,Gs(i,s,a,l,(s.subtreeFlags&10256)!==0)),f&2048&&nh(b,s);break;case 24:ii(i,s,a,l),f&2048&&ih(s.alternate,s);break;default:ii(i,s,a,l)}}function Gs(i,s,a,l,f){for(f=f&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var m=i,b=s,x=a,E=l,j=b.flags;switch(b.tag){case 0:case 11:case 15:Gs(m,b,x,E,f),Oa(8,b);break;case 23:break;case 22:var K=b.stateNode;b.memoizedState!==null?K._visibility&2?Gs(m,b,x,E,f):ka(m,b):(K._visibility|=2,Gs(m,b,x,E,f)),f&&j&2048&&nh(b.alternate,b);break;case 24:Gs(m,b,x,E,f),f&&j&2048&&ih(b.alternate,b);break;default:Gs(m,b,x,E,f)}s=s.sibling}}function ka(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,l=s,f=l.flags;switch(l.tag){case 22:ka(a,l),f&2048&&nh(l.alternate,l);break;case 24:ka(a,l),f&2048&&ih(l.alternate,l);break;default:ka(a,l)}s=s.sibling}}var Ma=8192;function Ys(i){if(i.subtreeFlags&Ma)for(i=i.child;i!==null;)Zv(i),i=i.sibling}function Zv(i){switch(i.tag){case 26:Ys(i),i.flags&Ma&&i.memoizedState!==null&&gk(In,i.memoizedState,i.memoizedProps);break;case 5:Ys(i);break;case 3:case 4:var s=In;In=Lc(i.stateNode.containerInfo),Ys(i),In=s;break;case 22:i.memoizedState===null&&(s=i.alternate,s!==null&&s.memoizedState!==null?(s=Ma,Ma=16777216,Ys(i),Ma=s):Ys(i));break;default:Ys(i)}}function Qv(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 Ca(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,e0(l,i)}Qv(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)Wv(i),i=i.sibling}function Wv(i){switch(i.tag){case 0:case 11:case 15:Ca(i),i.flags&2048&&lr(9,i,i.return);break;case 3:Ca(i);break;case 12:Ca(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Ec(i)):Ca(i);break;default:Ca(i)}}function Ec(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var l=s[a];Nt=l,e0(l,i)}Qv(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:lr(8,s,s.return),Ec(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Ec(s));break;default:Ec(s)}i=i.sibling}}function e0(i,s){for(;Nt!==null;){var a=Nt;switch(a.tag){case 0:case 11:case 15:lr(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:ha(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Nt=l;else e:for(a=i;Nt!==null;){l=Nt;var f=l.sibling,m=l.return;if(Hv(l),l===a){Nt=null;break e}if(f!==null){f.return=m,Nt=f;break e}Nt=m}}}var N_={getCacheForType:function(i){var s=It(Ot),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a}},$_=typeof WeakMap=="function"?WeakMap:Map,Be=0,Fe=null,Oe=null,Ce=0,Le=0,gn=null,fr=!1,Js=!1,rh=!1,Bi=0,ot=0,dr=0,Wr=0,sh=0,Dn=0,Xs=0,Da=null,on=null,oh=!1,ah=0,Rc=1/0,Oc=null,hr=null,Ut=0,pr=null,Zs=null,Qs=0,lh=0,ch=null,t0=null,Na=0,uh=null;function bn(){if((Be&2)!==0&&Ce!==0)return Ce&-Ce;if(B.T!==null){var i=Us;return i!==0?i:gh()}return gg()}function n0(){Dn===0&&(Dn=(Ce&536870912)===0||$e?hg():536870912);var i=Cn.current;return i!==null&&(i.flags|=32),Dn}function vn(i,s,a){(i===Fe&&(Le===2||Le===9)||i.cancelPendingCommit!==null)&&(Ws(i,0),mr(i,Ce,Dn,!1)),Zo(i,a),((Be&2)===0||i!==Fe)&&(i===Fe&&((Be&2)===0&&(Wr|=a),ot===4&&mr(i,Ce,Dn,!1)),ri(i))}function i0(i,s,a){if((Be&6)!==0)throw Error(r(327));var l=!a&&(s&124)===0&&(s&i.expiredLanes)===0||Xo(i,s),f=l?L_(i,s):hh(i,s,!0),m=l;do{if(f===0){Js&&!l&&mr(i,s,0,!1);break}else{if(a=i.current.alternate,m&&!j_(a)){f=hh(i,s,!1),m=!1;continue}if(f===2){if(m=s,i.errorRecoveryDisabledLanes&m)var b=0;else b=i.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){s=b;e:{var x=i;f=Da;var E=x.current.memoizedState.isDehydrated;if(E&&(Ws(x,b).flags|=256),b=hh(x,b,!1),b!==2){if(rh&&!E){x.errorRecoveryDisabledLanes|=m,Wr|=m,f=4;break e}m=on,on=f,m!==null&&(on===null?on=m:on.push.apply(on,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){Ws(i,0),mr(i,s,0,!0);break}e:{switch(l=i,m=f,m){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:mr(l,s,Dn,!fr);break e;case 2:on=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(f=ah+300-Te(),10<f)){if(mr(l,s,Dn,!fr),Vl(l,0,!0)!==0)break e;l.timeoutHandle=D0(r0.bind(null,l,a,on,Oc,oh,s,Dn,Wr,Xs,fr,m,2,-0,0),f);break e}r0(l,a,on,Oc,oh,s,Dn,Wr,Xs,fr,m,0,-0,0)}}break}while(!0);ri(i)}function r0(i,s,a,l,f,m,b,x,E,j,K,F,L,U){if(i.timeoutHandle=-1,F=s.subtreeFlags,(F&8192||(F&16785408)===16785408)&&(za={stylesheets:null,count:0,unsuspend:yk},Zv(s),F=bk(),F!==null)){i.cancelPendingCommit=F(f0.bind(null,i,s,m,a,l,f,b,x,E,K,1,L,U)),mr(i,m,b,!j);return}f0(i,s,m,a,l,f,b,x,E)}function j_(i){for(var s=i;;){var a=s.tag;if((a===0||a===11||a===15)&&s.flags&16384&&(a=s.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var f=a[l],m=f.getSnapshot;f=f.value;try{if(!hn(m(),f))return!1}catch{return!1}}if(a=s.child,s.subtreeFlags&16384&&a!==null)a.return=s,s=a;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 mr(i,s,a,l){s&=~sh,s&=~Wr,i.suspendedLanes|=s,i.pingedLanes&=~s,l&&(i.warmLanes|=s),l=i.expirationTimes;for(var f=s;0<f;){var m=31-dn(f),b=1<<m;l[m]=-1,f&=~b}a!==0&&mg(i,a,s)}function _c(){return(Be&6)===0?($a(0),!1):!0}function fh(){if(Oe!==null){if(Le===0)var i=Oe.return;else i=Oe,_i=Gr=null,_d(i),Hs=null,Aa=0,i=Oe;for(;i!==null;)Lv(i.alternate,i),i=i.return;Oe=null}}function Ws(i,s){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,W_(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),fh(),Fe=i,Oe=a=Ei(i.current,null),Ce=s,Le=0,gn=null,fr=!1,Js=Xo(i,s),rh=!1,Xs=Dn=sh=Wr=dr=ot=0,on=Da=null,oh=!1,(s&8)!==0&&(s|=s&32);var l=i.entangledLanes;if(l!==0)for(i=i.entanglements,l&=s;0<l;){var f=31-dn(l),m=1<<f;s|=i[f],l&=~m}return Bi=s,Xl(),a}function s0(i,s){Ae=null,B.H=mc,s===ma||s===sc?(s=wb(),Le=3):s===vb?(s=wb(),Le=4):Le=s===Tv?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,gn=s,Oe===null&&(ot=1,Sc(i,On(s,i.current)))}function o0(){var i=B.H;return B.H=mc,i===null?mc:i}function a0(){var i=B.A;return B.A=N_,i}function dh(){ot=4,fr||(Ce&4194048)!==Ce&&Cn.current!==null||(Js=!0),(dr&134217727)===0&&(Wr&134217727)===0||Fe===null||mr(Fe,Ce,Dn,!1)}function hh(i,s,a){var l=Be;Be|=2;var f=o0(),m=a0();(Fe!==i||Ce!==s)&&(Oc=null,Ws(i,s)),s=!1;var b=ot;e:do try{if(Le!==0&&Oe!==null){var x=Oe,E=gn;switch(Le){case 8:fh(),b=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(s=!0);var j=Le;if(Le=0,gn=null,eo(i,x,E,j),a&&Js){b=0;break e}break;default:j=Le,Le=0,gn=null,eo(i,x,E,j)}}B_(),b=ot;break}catch(K){s0(i,K)}while(!0);return s&&i.shellSuspendCounter++,_i=Gr=null,Be=l,B.H=f,B.A=m,Oe===null&&(Fe=null,Ce=0,Xl()),b}function B_(){for(;Oe!==null;)l0(Oe)}function L_(i,s){var a=Be;Be|=2;var l=o0(),f=a0();Fe!==i||Ce!==s?(Oc=null,Rc=Te()+500,Ws(i,s)):Js=Xo(i,s);e:do try{if(Le!==0&&Oe!==null){s=Oe;var m=gn;t:switch(Le){case 1:Le=0,gn=null,eo(i,s,m,1);break;case 2:case 9:if(Sb(m)){Le=0,gn=null,c0(s);break}s=function(){Le!==2&&Le!==9||Fe!==i||(Le=7),ri(i)},m.then(s,s);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:Sb(m)?(Le=0,gn=null,c0(s)):(Le=0,gn=null,eo(i,s,m,7));break;case 5:var b=null;switch(Oe.tag){case 26:b=Oe.memoizedState;case 5:case 27:var x=Oe;if(!b||I0(b)){Le=0,gn=null;var E=x.sibling;if(E!==null)Oe=E;else{var j=x.return;j!==null?(Oe=j,kc(j)):Oe=null}break t}}Le=0,gn=null,eo(i,s,m,5);break;case 6:Le=0,gn=null,eo(i,s,m,6);break;case 8:fh(),ot=6;break e;default:throw Error(r(462))}}V_();break}catch(K){s0(i,K)}while(!0);return _i=Gr=null,B.H=l,B.A=f,Be=a,Oe!==null?0:(Fe=null,Ce=0,Xl(),ot)}function V_(){for(;Oe!==null&&!tt();)l0(Oe)}function l0(i){var s=jv(i.alternate,i,Bi);i.memoizedProps=i.pendingProps,s===null?kc(i):Oe=s}function c0(i){var s=i,a=s.alternate;switch(s.tag){case 15:case 0:s=kv(a,s,s.pendingProps,s.type,void 0,Ce);break;case 11:s=kv(a,s,s.pendingProps,s.type.render,s.ref,Ce);break;case 5:_d(s);default:Lv(a,s),s=Oe=ub(s,Bi),s=jv(a,s,Bi)}i.memoizedProps=i.pendingProps,s===null?kc(i):Oe=s}function eo(i,s,a,l){_i=Gr=null,_d(s),Hs=null,Aa=0;var f=s.return;try{if(O_(i,f,s,a,Ce)){ot=1,Sc(i,On(a,i.current)),Oe=null;return}}catch(m){if(f!==null)throw Oe=f,m;ot=1,Sc(i,On(a,i.current)),Oe=null;return}s.flags&32768?($e||l===1?i=!0:Js||(Ce&536870912)!==0?i=!1:(fr=i=!0,(l===2||l===9||l===3||l===6)&&(l=Cn.current,l!==null&&l.tag===13&&(l.flags|=16384))),u0(s,i)):kc(s)}function kc(i){var s=i;do{if((s.flags&32768)!==0){u0(s,fr);return}i=s.return;var a=k_(s.alternate,s,Bi);if(a!==null){Oe=a;return}if(s=s.sibling,s!==null){Oe=s;return}Oe=s=i}while(s!==null);ot===0&&(ot=5)}function u0(i,s){do{var a=M_(i.alternate,i);if(a!==null){a.flags&=32767,Oe=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Oe=i;return}Oe=i=a}while(i!==null);ot=6,Oe=null}function f0(i,s,a,l,f,m,b,x,E){i.cancelPendingCommit=null;do Mc();while(Ut!==0);if((Be&6)!==0)throw Error(r(327));if(s!==null){if(s===i.current)throw Error(r(177));if(m=s.lanes|s.childLanes,m|=id,yO(i,a,m,b,x,E),i===Fe&&(Oe=Fe=null,Ce=0),Zs=s,pr=i,Qs=a,lh=m,ch=f,t0=l,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,P_(Tn,function(){return y0(),null})):(i.callbackNode=null,i.callbackPriority=0),l=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||l){l=B.T,B.T=null,f=P.p,P.p=2,b=Be,Be|=4;try{C_(i,s,a)}finally{Be=b,P.p=f,B.T=l}}Ut=1,d0(),h0(),p0()}}function d0(){if(Ut===1){Ut=0;var i=pr,s=Zs,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var l=P.p;P.p=2;var f=Be;Be|=4;try{Yv(s,i);var m=Eh,b=eb(i.containerInfo),x=m.focusedElem,E=m.selectionRange;if(b!==x&&x&&x.ownerDocument&&Wg(x.ownerDocument.documentElement,x)){if(E!==null&&Qf(x)){var j=E.start,K=E.end;if(K===void 0&&(K=j),"selectionStart"in x)x.selectionStart=j,x.selectionEnd=Math.min(K,x.value.length);else{var F=x.ownerDocument||document,L=F&&F.defaultView||window;if(L.getSelection){var U=L.getSelection(),me=x.textContent.length,de=Math.min(E.start,me),Ke=E.end===void 0?de:Math.min(E.end,me);!U.extend&&de>Ke&&(b=Ke,Ke=de,de=b);var M=Qg(x,de),R=Qg(x,Ke);if(M&&R&&(U.rangeCount!==1||U.anchorNode!==M.node||U.anchorOffset!==M.offset||U.focusNode!==R.node||U.focusOffset!==R.offset)){var N=F.createRange();N.setStart(M.node,M.offset),U.removeAllRanges(),de>Ke?(U.addRange(N),U.extend(R.node,R.offset)):(N.setEnd(R.node,R.offset),U.addRange(N))}}}}for(F=[],U=x;U=U.parentNode;)U.nodeType===1&&F.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<F.length;x++){var q=F[x];q.element.scrollLeft=q.left,q.element.scrollTop=q.top}}Pc=!!Ah,Eh=Ah=null}finally{Be=f,P.p=l,B.T=a}}i.current=s,Ut=2}}function h0(){if(Ut===2){Ut=0;var i=pr,s=Zs,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var l=P.p;P.p=2;var f=Be;Be|=4;try{Iv(i,s.alternate,s)}finally{Be=f,P.p=l,B.T=a}}Ut=3}}function p0(){if(Ut===4||Ut===3){Ut=0,Rt();var i=pr,s=Zs,a=Qs,l=t0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Ut=5:(Ut=0,Zs=pr=null,m0(i,i.pendingLanes));var f=i.pendingLanes;if(f===0&&(hr=null),Cf(a),s=s.stateNode,fn&&typeof fn.onCommitFiberRoot=="function")try{fn.onCommitFiberRoot(Jo,s,void 0,(s.current.flags&128)===128)}catch{}if(l!==null){s=B.T,f=P.p,P.p=2,B.T=null;try{for(var m=i.onRecoverableError,b=0;b<l.length;b++){var x=l[b];m(x.value,{componentStack:x.stack})}}finally{B.T=s,P.p=f}}(Qs&3)!==0&&Mc(),ri(i),f=i.pendingLanes,(a&4194090)!==0&&(f&42)!==0?i===uh?Na++:(Na=0,uh=i):Na=0,$a(0)}}function m0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,ha(s)))}function Mc(i){return d0(),h0(),p0(),y0()}function y0(){if(Ut!==5)return!1;var i=pr,s=lh;lh=0;var a=Cf(Qs),l=B.T,f=P.p;try{P.p=32>a?32:a,B.T=null,a=ch,ch=null;var m=pr,b=Qs;if(Ut=0,Zs=pr=null,Qs=0,(Be&6)!==0)throw Error(r(331));var x=Be;if(Be|=4,Wv(m.current),Xv(m,m.current,b,a),Be=x,$a(0,!1),fn&&typeof fn.onPostCommitFiberRoot=="function")try{fn.onPostCommitFiberRoot(Jo,m)}catch{}return!0}finally{P.p=f,B.T=l,m0(i,s)}}function g0(i,s,a){s=On(a,s),s=Pd(i.stateNode,s,2),i=rr(i,s,2),i!==null&&(Zo(i,2),ri(i))}function qe(i,s,a){if(i.tag===3)g0(i,i,a);else for(;s!==null;){if(s.tag===3){g0(s,i,a);break}else if(s.tag===1){var l=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(hr===null||!hr.has(l))){i=On(a,i),a=xv(2),l=rr(s,a,2),l!==null&&(wv(a,l,s,i),Zo(l,2),ri(l));break}}s=s.return}}function ph(i,s,a){var l=i.pingCache;if(l===null){l=i.pingCache=new $_;var f=new Set;l.set(s,f)}else f=l.get(s),f===void 0&&(f=new Set,l.set(s,f));f.has(a)||(rh=!0,f.add(a),i=U_.bind(null,i,s,a),s.then(i,i))}function U_(i,s,a){var l=i.pingCache;l!==null&&l.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Fe===i&&(Ce&a)===a&&(ot===4||ot===3&&(Ce&62914560)===Ce&&300>Te()-ah?(Be&2)===0&&Ws(i,0):sh|=a,Xs===Ce&&(Xs=0)),ri(i)}function b0(i,s){s===0&&(s=pg()),i=js(i,s),i!==null&&(Zo(i,s),ri(i))}function z_(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),b0(i,a)}function K_(i,s){var a=0;switch(i.tag){case 13:var l=i.stateNode,f=i.memoizedState;f!==null&&(a=f.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),b0(i,a)}function P_(i,s){return Me(i,s)}var Cc=null,to=null,mh=!1,Dc=!1,yh=!1,es=0;function ri(i){i!==to&&i.next===null&&(to===null?Cc=to=i:to=to.next=i),Dc=!0,mh||(mh=!0,I_())}function $a(i,s){if(!yh&&Dc){yh=!0;do for(var a=!1,l=Cc;l!==null;){if(i!==0){var f=l.pendingLanes;if(f===0)var m=0;else{var b=l.suspendedLanes,x=l.pingedLanes;m=(1<<31-dn(42|i)+1)-1,m&=f&~(b&~x),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,w0(l,m))}else m=Ce,m=Vl(l,l===Fe?m:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(m&3)===0||Xo(l,m)||(a=!0,w0(l,m));l=l.next}while(a);yh=!1}}function q_(){v0()}function v0(){Dc=mh=!1;var i=0;es!==0&&(Q_()&&(i=es),es=0);for(var s=Te(),a=null,l=Cc;l!==null;){var f=l.next,m=S0(l,s);m===0?(l.next=null,a===null?Cc=f:a.next=f,f===null&&(to=a)):(a=l,(i!==0||(m&3)!==0)&&(Dc=!0)),l=f}$a(i)}function S0(i,s){for(var a=i.suspendedLanes,l=i.pingedLanes,f=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var b=31-dn(m),x=1<<b,E=f[b];E===-1?((x&a)===0||(x&l)!==0)&&(f[b]=mO(x,s)):E<=s&&(i.expiredLanes|=x),m&=~x}if(s=Fe,a=Ce,a=Vl(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l=i.callbackNode,a===0||i===s&&(Le===2||Le===9)||i.cancelPendingCommit!==null)return l!==null&&l!==null&&Ee(l),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Xo(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(l!==null&&Ee(l),Cf(a)){case 2:case 8:a=Pt;break;case 32:a=Tn;break;case 268435456:a=An;break;default:a=Tn}return l=x0.bind(null,i),a=Me(a,l),i.callbackPriority=s,i.callbackNode=a,s}return l!==null&&l!==null&&Ee(l),i.callbackPriority=2,i.callbackNode=null,2}function x0(i,s){if(Ut!==0&&Ut!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Mc()&&i.callbackNode!==a)return null;var l=Ce;return l=Vl(i,i===Fe?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),l===0?null:(i0(i,l,s),S0(i,Te()),i.callbackNode!=null&&i.callbackNode===a?x0.bind(null,i):null)}function w0(i,s){if(Mc())return null;i0(i,s,!0)}function I_(){ek(function(){(Be&6)!==0?Me(Jt,q_):v0()})}function gh(){return es===0&&(es=hg()),es}function T0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ql(""+i)}function A0(i,s){var a=s.ownerDocument.createElement("input");return a.name=s.name,a.value=s.value,i.id&&a.setAttribute("form",i.id),s.parentNode.insertBefore(a,s),i=new FormData(i),a.parentNode.removeChild(a),i}function H_(i,s,a,l,f){if(s==="submit"&&a&&a.stateNode===f){var m=T0((f[tn]||null).action),b=l.submitter;b&&(s=(s=b[tn]||null)?T0(s.formAction):b.getAttribute("formAction"),s!==null&&(m=s,b=null));var x=new Gl("action","action",null,l,f);i.push({event:x,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(es!==0){var E=b?A0(f,b):new FormData(f);Ld(a,{pending:!0,data:E,method:f.method,action:m},null,E)}}else typeof m=="function"&&(x.preventDefault(),E=b?A0(f,b):new FormData(f),Ld(a,{pending:!0,data:E,method:f.method,action:m},m,E))},currentTarget:f}]})}}for(var bh=0;bh<nd.length;bh++){var vh=nd[bh],F_=vh.toLowerCase(),G_=vh[0].toUpperCase()+vh.slice(1);qn(F_,"on"+G_)}qn(ib,"onAnimationEnd"),qn(rb,"onAnimationIteration"),qn(sb,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(u_,"onTransitionRun"),qn(f_,"onTransitionStart"),qn(d_,"onTransitionCancel"),qn(ob,"onTransitionEnd"),Es("onMouseEnter",["mouseout","mouseover"]),Es("onMouseLeave",["mouseout","mouseover"]),Es("onPointerEnter",["pointerout","pointerover"]),Es("onPointerLeave",["pointerout","pointerover"]),Vr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Vr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Vr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Vr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Vr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ja="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(" "),Y_=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ja));function E0(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var l=i[a],f=l.event;l=l.listeners;e:{var m=void 0;if(s)for(var b=l.length-1;0<=b;b--){var x=l[b],E=x.instance,j=x.currentTarget;if(x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=j;try{m(f)}catch(K){vc(K)}f.currentTarget=null,m=E}else for(b=0;b<l.length;b++){if(x=l[b],E=x.instance,j=x.currentTarget,x=x.listener,E!==m&&f.isPropagationStopped())break e;m=x,f.currentTarget=j;try{m(f)}catch(K){vc(K)}f.currentTarget=null,m=E}}}}function _e(i,s){var a=s[Df];a===void 0&&(a=s[Df]=new Set);var l=i+"__bubble";a.has(l)||(R0(s,i,2,!1),a.add(l))}function Sh(i,s,a){var l=0;s&&(l|=4),R0(a,i,l,s)}var Nc="_reactListening"+Math.random().toString(36).slice(2);function xh(i){if(!i[Nc]){i[Nc]=!0,vg.forEach(function(a){a!=="selectionchange"&&(Y_.has(a)||Sh(a,!1,i),Sh(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[Nc]||(s[Nc]=!0,Sh("selectionchange",!1,s))}}function R0(i,s,a,l){switch(X0(s)){case 2:var f=xk;break;case 8:f=wk;break;default:f=jh}a=f.bind(null,s,a,i),f=void 0,!qf||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(f=!0),l?f!==void 0?i.addEventListener(s,a,{capture:!0,passive:f}):i.addEventListener(s,a,!0):f!==void 0?i.addEventListener(s,a,{passive:f}):i.addEventListener(s,a,!1)}function wh(i,s,a,l,f){var m=l;if((s&1)===0&&(s&2)===0&&l!==null)e:for(;;){if(l===null)return;var b=l.tag;if(b===3||b===4){var x=l.stateNode.containerInfo;if(x===f)break;if(b===4)for(b=l.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;x!==null;){if(b=ws(x),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){l=m=b;continue e}x=x.parentNode}}l=l.return}Ng(function(){var j=m,K=Kf(a),F=[];e:{var L=ab.get(i);if(L!==void 0){var U=Gl,me=i;switch(i){case"keypress":if(Hl(a)===0)break e;case"keydown":case"keyup":U=PO;break;case"focusin":me="focus",U=Gf;break;case"focusout":me="blur",U=Gf;break;case"beforeblur":case"afterblur":U=Gf;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=Bg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=MO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=HO;break;case ib:case rb:case sb:U=NO;break;case ob:U=GO;break;case"scroll":case"scrollend":U=_O;break;case"wheel":U=JO;break;case"copy":case"cut":case"paste":U=jO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Vg;break;case"toggle":case"beforetoggle":U=ZO}var de=(s&4)!==0,Ke=!de&&(i==="scroll"||i==="scrollend"),M=de?L!==null?L+"Capture":null:L;de=[];for(var R=j,N;R!==null;){var q=R;if(N=q.stateNode,q=q.tag,q!==5&&q!==26&&q!==27||N===null||M===null||(q=ea(R,M),q!=null&&de.push(Ba(R,q,N))),Ke)break;R=R.return}0<de.length&&(L=new U(L,me,null,a,K),F.push({event:L,listeners:de}))}}if((s&7)===0){e:{if(L=i==="mouseover"||i==="pointerover",U=i==="mouseout"||i==="pointerout",L&&a!==zf&&(me=a.relatedTarget||a.fromElement)&&(ws(me)||me[xs]))break e;if((U||L)&&(L=K.window===K?K:(L=K.ownerDocument)?L.defaultView||L.parentWindow:window,U?(me=a.relatedTarget||a.toElement,U=j,me=me?ws(me):null,me!==null&&(Ke=c(me),de=me.tag,me!==Ke||de!==5&&de!==27&&de!==6)&&(me=null)):(U=null,me=j),U!==me)){if(de=Bg,q="onMouseLeave",M="onMouseEnter",R="mouse",(i==="pointerout"||i==="pointerover")&&(de=Vg,q="onPointerLeave",M="onPointerEnter",R="pointer"),Ke=U==null?L:Wo(U),N=me==null?L:Wo(me),L=new de(q,R+"leave",U,a,K),L.target=Ke,L.relatedTarget=N,q=null,ws(K)===j&&(de=new de(M,R+"enter",me,a,K),de.target=N,de.relatedTarget=Ke,q=de),Ke=q,U&&me)t:{for(de=U,M=me,R=0,N=de;N;N=no(N))R++;for(N=0,q=M;q;q=no(q))N++;for(;0<R-N;)de=no(de),R--;for(;0<N-R;)M=no(M),N--;for(;R--;){if(de===M||M!==null&&de===M.alternate)break t;de=no(de),M=no(M)}de=null}else de=null;U!==null&&O0(F,L,U,de,!1),me!==null&&Ke!==null&&O0(F,Ke,me,de,!0)}}e:{if(L=j?Wo(j):window,U=L.nodeName&&L.nodeName.toLowerCase(),U==="select"||U==="input"&&L.type==="file")var re=Fg;else if(Ig(L))if(Gg)re=a_;else{re=s_;var Re=r_}else U=L.nodeName,!U||U.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?j&&Uf(j.elementType)&&(re=Fg):re=o_;if(re&&(re=re(i,j))){Hg(F,re,a,K);break e}Re&&Re(i,L,j),i==="focusout"&&j&&L.type==="number"&&j.memoizedProps.value!=null&&Vf(L,"number",L.value)}switch(Re=j?Wo(j):window,i){case"focusin":(Ig(Re)||Re.contentEditable==="true")&&(Ds=Re,Wf=j,la=null);break;case"focusout":la=Wf=Ds=null;break;case"mousedown":ed=!0;break;case"contextmenu":case"mouseup":case"dragend":ed=!1,tb(F,a,K);break;case"selectionchange":if(c_)break;case"keydown":case"keyup":tb(F,a,K)}var ce;if(Jf)e:{switch(i){case"compositionstart":var he="onCompositionStart";break e;case"compositionend":he="onCompositionEnd";break e;case"compositionupdate":he="onCompositionUpdate";break e}he=void 0}else Cs?Pg(i,a)&&(he="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(he="onCompositionStart");he&&(Ug&&a.locale!=="ko"&&(Cs||he!=="onCompositionStart"?he==="onCompositionEnd"&&Cs&&(ce=$g()):(er=K,If="value"in er?er.value:er.textContent,Cs=!0)),Re=$c(j,he),0<Re.length&&(he=new Lg(he,i,null,a,K),F.push({event:he,listeners:Re}),ce?he.data=ce:(ce=qg(a),ce!==null&&(he.data=ce)))),(ce=WO?e_(i,a):t_(i,a))&&(he=$c(j,"onBeforeInput"),0<he.length&&(Re=new Lg("onBeforeInput","beforeinput",null,a,K),F.push({event:Re,listeners:he}),Re.data=ce)),H_(F,i,j,a,K)}E0(F,s)})}function Ba(i,s,a){return{instance:i,listener:s,currentTarget:a}}function $c(i,s){for(var a=s+"Capture",l=[];i!==null;){var f=i,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=ea(i,a),f!=null&&l.unshift(Ba(i,f,m)),f=ea(i,s),f!=null&&l.push(Ba(i,f,m))),i.tag===3)return l;i=i.return}return[]}function no(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function O0(i,s,a,l,f){for(var m=s._reactName,b=[];a!==null&&a!==l;){var x=a,E=x.alternate,j=x.stateNode;if(x=x.tag,E!==null&&E===l)break;x!==5&&x!==26&&x!==27||j===null||(E=j,f?(j=ea(a,m),j!=null&&b.unshift(Ba(a,j,E))):f||(j=ea(a,m),j!=null&&b.push(Ba(a,j,E)))),a=a.return}b.length!==0&&i.push({event:s,listeners:b})}var J_=/\r\n?/g,X_=/\u0000|\uFFFD/g;function _0(i){return(typeof i=="string"?i:""+i).replace(J_,`
63
+ `).replace(X_,"")}function k0(i,s){return s=_0(s),_0(i)===s}function jc(){}function ze(i,s,a,l,f,m){switch(a){case"children":typeof l=="string"?s==="body"||s==="textarea"&&l===""||_s(i,l):(typeof l=="number"||typeof l=="bigint")&&s!=="body"&&_s(i,""+l);break;case"className":zl(i,"class",l);break;case"tabIndex":zl(i,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":zl(i,a,l);break;case"style":Cg(i,l,m);break;case"data":if(s!=="object"){zl(i,"data",l);break}case"src":case"href":if(l===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=ql(""+l),i.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){i.setAttribute(a,"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 m=="function"&&(a==="formAction"?(s!=="input"&&ze(i,s,"name",f.name,f,null),ze(i,s,"formEncType",f.formEncType,f,null),ze(i,s,"formMethod",f.formMethod,f,null),ze(i,s,"formTarget",f.formTarget,f,null)):(ze(i,s,"encType",f.encType,f,null),ze(i,s,"method",f.method,f,null),ze(i,s,"target",f.target,f,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){i.removeAttribute(a);break}l=ql(""+l),i.setAttribute(a,l);break;case"onClick":l!=null&&(i.onclick=jc);break;case"onScroll":l!=null&&_e("scroll",i);break;case"onScrollEnd":l!=null&&_e("scrollend",i);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}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}a=ql(""+l),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);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(a,""+l):i.removeAttribute(a);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(a,""):i.removeAttribute(a);break;case"capture":case"download":l===!0?i.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?i.setAttribute(a,l):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?i.setAttribute(a,l):i.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?i.removeAttribute(a):i.setAttribute(a,l);break;case"popover":_e("beforetoggle",i),_e("toggle",i),Ul(i,"popover",l);break;case"xlinkActuate":Ti(i,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":Ti(i,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":Ti(i,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":Ti(i,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":Ti(i,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":Ti(i,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":Ti(i,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":Ul(i,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=RO.get(a)||a,Ul(i,a,l))}}function Th(i,s,a,l,f,m){switch(a){case"style":Cg(i,l,m);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(r(61));if(a=l.__html,a!=null){if(f.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof l=="string"?_s(i,l):(typeof l=="number"||typeof l=="bigint")&&_s(i,""+l);break;case"onScroll":l!=null&&_e("scroll",i);break;case"onScrollEnd":l!=null&&_e("scrollend",i);break;case"onClick":l!=null&&(i.onclick=jc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Sg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),s=a.slice(2,f?a.length-7:void 0),m=i[tn]||null,m=m!=null?m[a]:null,typeof m=="function"&&i.removeEventListener(s,m,f),typeof l=="function")){typeof m!="function"&&m!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(s,l,f);break e}a in i?i[a]=l:l===!0?i.setAttribute(a,""):Ul(i,a,l)}}}function zt(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":_e("error",i),_e("load",i);var l=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":l=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,m,b,a,null)}}f&&ze(i,s,"srcSet",a.srcSet,a,null),l&&ze(i,s,"src",a.src,a,null);return;case"input":_e("invalid",i);var x=m=b=f=null,E=null,j=null;for(l in a)if(a.hasOwnProperty(l)){var K=a[l];if(K!=null)switch(l){case"name":f=K;break;case"type":b=K;break;case"checked":E=K;break;case"defaultChecked":j=K;break;case"value":m=K;break;case"defaultValue":x=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,s));break;default:ze(i,s,l,K,a,null)}}Og(i,m,x,E,j,b,f,!1),Kl(i);return;case"select":_e("invalid",i),l=b=m=null;for(f in a)if(a.hasOwnProperty(f)&&(x=a[f],x!=null))switch(f){case"value":m=x;break;case"defaultValue":b=x;break;case"multiple":l=x;default:ze(i,s,f,x,a,null)}s=m,a=b,i.multiple=!!l,s!=null?Os(i,!!l,s,!1):a!=null&&Os(i,!!l,a,!0);return;case"textarea":_e("invalid",i),m=f=l=null;for(b in a)if(a.hasOwnProperty(b)&&(x=a[b],x!=null))switch(b){case"value":l=x;break;case"defaultValue":f=x;break;case"children":m=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:ze(i,s,b,x,a,null)}kg(i,l,f,m),Kl(i);return;case"option":for(E in a)if(a.hasOwnProperty(E)&&(l=a[E],l!=null))switch(E){case"selected":i.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:ze(i,s,E,l,a,null)}return;case"dialog":_e("beforetoggle",i),_e("toggle",i),_e("cancel",i),_e("close",i);break;case"iframe":case"object":_e("load",i);break;case"video":case"audio":for(l=0;l<ja.length;l++)_e(ja[l],i);break;case"image":_e("error",i),_e("load",i);break;case"details":_e("toggle",i);break;case"embed":case"source":case"link":_e("error",i),_e("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(j in a)if(a.hasOwnProperty(j)&&(l=a[j],l!=null))switch(j){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,j,l,a,null)}return;default:if(Uf(s)){for(K in a)a.hasOwnProperty(K)&&(l=a[K],l!==void 0&&Th(i,s,K,l,a,void 0));return}}for(x in a)a.hasOwnProperty(x)&&(l=a[x],l!=null&&ze(i,s,x,l,a,null))}function Z_(i,s,a,l){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var f=null,m=null,b=null,x=null,E=null,j=null,K=null;for(U in a){var F=a[U];if(a.hasOwnProperty(U)&&F!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":E=F;default:l.hasOwnProperty(U)||ze(i,s,U,null,l,F)}}for(var L in l){var U=l[L];if(F=a[L],l.hasOwnProperty(L)&&(U!=null||F!=null))switch(L){case"type":m=U;break;case"name":f=U;break;case"checked":j=U;break;case"defaultChecked":K=U;break;case"value":b=U;break;case"defaultValue":x=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(r(137,s));break;default:U!==F&&ze(i,s,L,U,l,F)}}Lf(i,b,x,E,j,K,m,f);return;case"select":U=b=x=L=null;for(m in a)if(E=a[m],a.hasOwnProperty(m)&&E!=null)switch(m){case"value":break;case"multiple":U=E;default:l.hasOwnProperty(m)||ze(i,s,m,null,l,E)}for(f in l)if(m=l[f],E=a[f],l.hasOwnProperty(f)&&(m!=null||E!=null))switch(f){case"value":L=m;break;case"defaultValue":x=m;break;case"multiple":b=m;default:m!==E&&ze(i,s,f,m,l,E)}s=x,a=b,l=U,L!=null?Os(i,!!a,L,!1):!!l!=!!a&&(s!=null?Os(i,!!a,s,!0):Os(i,!!a,a?[]:"",!1));return;case"textarea":U=L=null;for(x in a)if(f=a[x],a.hasOwnProperty(x)&&f!=null&&!l.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:ze(i,s,x,null,l,f)}for(b in l)if(f=l[b],m=a[b],l.hasOwnProperty(b)&&(f!=null||m!=null))switch(b){case"value":L=f;break;case"defaultValue":U=f;break;case"children":break;case"dangerouslySetInnerHTML":if(f!=null)throw Error(r(91));break;default:f!==m&&ze(i,s,b,f,l,m)}_g(i,L,U);return;case"option":for(var me in a)if(L=a[me],a.hasOwnProperty(me)&&L!=null&&!l.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:ze(i,s,me,null,l,L)}for(E in l)if(L=l[E],U=a[E],l.hasOwnProperty(E)&&L!==U&&(L!=null||U!=null))switch(E){case"selected":i.selected=L&&typeof L!="function"&&typeof L!="symbol";break;default:ze(i,s,E,L,l,U)}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 de in a)L=a[de],a.hasOwnProperty(de)&&L!=null&&!l.hasOwnProperty(de)&&ze(i,s,de,null,l,L);for(j in l)if(L=l[j],U=a[j],l.hasOwnProperty(j)&&L!==U&&(L!=null||U!=null))switch(j){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(137,s));break;default:ze(i,s,j,L,l,U)}return;default:if(Uf(s)){for(var Ke in a)L=a[Ke],a.hasOwnProperty(Ke)&&L!==void 0&&!l.hasOwnProperty(Ke)&&Th(i,s,Ke,void 0,l,L);for(K in l)L=l[K],U=a[K],!l.hasOwnProperty(K)||L===U||L===void 0&&U===void 0||Th(i,s,K,L,l,U);return}}for(var M in a)L=a[M],a.hasOwnProperty(M)&&L!=null&&!l.hasOwnProperty(M)&&ze(i,s,M,null,l,L);for(F in l)L=l[F],U=a[F],!l.hasOwnProperty(F)||L===U||L==null&&U==null||ze(i,s,F,L,l,U)}var Ah=null,Eh=null;function Bc(i){return i.nodeType===9?i:i.ownerDocument}function M0(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 C0(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 Rh(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 Oh=null;function Q_(){var i=window.event;return i&&i.type==="popstate"?i===Oh?!1:(Oh=i,!0):(Oh=null,!1)}var D0=typeof setTimeout=="function"?setTimeout:void 0,W_=typeof clearTimeout=="function"?clearTimeout:void 0,N0=typeof Promise=="function"?Promise:void 0,ek=typeof queueMicrotask=="function"?queueMicrotask:typeof N0<"u"?function(i){return N0.resolve(null).then(i).catch(tk)}:D0;function tk(i){setTimeout(function(){throw i})}function yr(i){return i==="head"}function $0(i,s){var a=s,l=0,f=0;do{var m=a.nextSibling;if(i.removeChild(a),m&&m.nodeType===8)if(a=m.data,a==="/$"){if(0<l&&8>l){a=l;var b=i.ownerDocument;if(a&1&&La(b.documentElement),a&2&&La(b.body),a&4)for(a=b.head,La(a),b=a.firstChild;b;){var x=b.nextSibling,E=b.nodeName;b[Qo]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&b.rel.toLowerCase()==="stylesheet"||a.removeChild(b),b=x}}if(f===0){i.removeChild(m),Ha(s);return}f--}else a==="$"||a==="$?"||a==="$!"?f++:l=a.charCodeAt(0)-48;else l=0;a=m}while(a);Ha(s)}function _h(i){var s=i.firstChild;for(s&&s.nodeType===10&&(s=s.nextSibling);s;){var a=s;switch(s=s.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":_h(a),Nf(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function nk(i,s,a,l){for(;i.nodeType===1;){var f=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!l&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(l){if(!i[Qo])switch(s){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(m=i.getAttribute("rel"),m==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(m!==f.rel||i.getAttribute("href")!==(f.href==null||f.href===""?null:f.href)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin)||i.getAttribute("title")!==(f.title==null?null:f.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(f.src==null?null:f.src)||i.getAttribute("type")!==(f.type==null?null:f.type)||i.getAttribute("crossorigin")!==(f.crossOrigin==null?null:f.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var m=f.name==null?null:""+f.name;if(f.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=Hn(i.nextSibling),i===null)break}return null}function ik(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Hn(i.nextSibling),i===null))return null;return i}function kh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function rk(i,s){var a=i.ownerDocument;if(i.data!=="$?"||a.readyState==="complete")s();else{var l=function(){s(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),i._reactRetry=l}}function Hn(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==="F!"||s==="F")break;if(s==="/$")return null}}return i}var Mh=null;function j0(i){i=i.previousSibling;for(var s=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(s===0)return i;s--}else a==="/$"&&s++}i=i.previousSibling}return null}function B0(i,s,a){switch(s=Bc(a),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 La(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);Nf(i)}var Nn=new Map,L0=new Set;function Lc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Li=P.d;P.d={f:sk,r:ok,D:ak,C:lk,L:ck,m:uk,X:dk,S:fk,M:hk};function sk(){var i=Li.f(),s=_c();return i||s}function ok(i){var s=Ts(i);s!==null&&s.tag===5&&s.type==="form"?iv(s):Li.r(i)}var io=typeof document>"u"?null:document;function V0(i,s,a){var l=io;if(l&&typeof s=="string"&&s){var f=Rn(s);f='link[rel="'+i+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),L0.has(f)||(L0.add(f),i={rel:i,crossOrigin:a,href:s},l.querySelector(f)===null&&(s=l.createElement("link"),zt(s,"link",i),Ct(s),l.head.appendChild(s)))}}function ak(i){Li.D(i),V0("dns-prefetch",i,null)}function lk(i,s){Li.C(i,s),V0("preconnect",i,s)}function ck(i,s,a){Li.L(i,s,a);var l=io;if(l&&i&&s){var f='link[rel="preload"][as="'+Rn(s)+'"]';s==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+Rn(a.imageSizes)+'"]')):f+='[href="'+Rn(i)+'"]';var m=f;switch(s){case"style":m=ro(i);break;case"script":m=so(i)}Nn.has(m)||(i=y({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Nn.set(m,i),l.querySelector(f)!==null||s==="style"&&l.querySelector(Va(m))||s==="script"&&l.querySelector(Ua(m))||(s=l.createElement("link"),zt(s,"link",i),Ct(s),l.head.appendChild(s)))}}function uk(i,s){Li.m(i,s);var a=io;if(a&&i){var l=s&&typeof s.as=="string"?s.as:"script",f='link[rel="modulepreload"][as="'+Rn(l)+'"][href="'+Rn(i)+'"]',m=f;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=so(i)}if(!Nn.has(m)&&(i=y({rel:"modulepreload",href:i},s),Nn.set(m,i),a.querySelector(f)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ua(m)))return}l=a.createElement("link"),zt(l,"link",i),Ct(l),a.head.appendChild(l)}}}function fk(i,s,a){Li.S(i,s,a);var l=io;if(l&&i){var f=As(l).hoistableStyles,m=ro(i);s=s||"default";var b=f.get(m);if(!b){var x={loading:0,preload:null};if(b=l.querySelector(Va(m)))x.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Nn.get(m))&&Ch(i,a);var E=b=l.createElement("link");Ct(E),zt(E,"link",i),E._p=new Promise(function(j,K){E.onload=j,E.onerror=K}),E.addEventListener("load",function(){x.loading|=1}),E.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Vc(b,s,l)}b={type:"stylesheet",instance:b,count:1,state:x},f.set(m,b)}}}function dk(i,s){Li.X(i,s);var a=io;if(a&&i){var l=As(a).hoistableScripts,f=so(i),m=l.get(f);m||(m=a.querySelector(Ua(f)),m||(i=y({src:i,async:!0},s),(s=Nn.get(f))&&Dh(i,s),m=a.createElement("script"),Ct(m),zt(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function hk(i,s){Li.M(i,s);var a=io;if(a&&i){var l=As(a).hoistableScripts,f=so(i),m=l.get(f);m||(m=a.querySelector(Ua(f)),m||(i=y({src:i,async:!0,type:"module"},s),(s=Nn.get(f))&&Dh(i,s),m=a.createElement("script"),Ct(m),zt(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},l.set(f,m))}}function U0(i,s,a,l){var f=(f=le.current)?Lc(f):null;if(!f)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=ro(a.href),a=As(f).hoistableStyles,l=a.get(s),l||(l={type:"style",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=ro(a.href);var m=As(f).hoistableStyles,b=m.get(i);if(b||(f=f.ownerDocument||f,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,b),(m=f.querySelector(Va(i)))&&!m._p&&(b.instance=m,b.state.loading=5),Nn.has(i)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Nn.set(i,a),m||pk(f,i,a,b.state))),s&&l===null)throw Error(r(528,""));return b}if(s&&l!==null)throw Error(r(529,""));return null;case"script":return s=a.async,a=a.src,typeof a=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(s=so(a),a=As(f).hoistableScripts,l=a.get(s),l||(l={type:"script",instance:null,count:0,state:null},a.set(s,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ro(i){return'href="'+Rn(i)+'"'}function Va(i){return'link[rel="stylesheet"]['+i+"]"}function z0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function pk(i,s,a,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}),zt(s,"link",a),Ct(s),i.head.appendChild(s))}function so(i){return'[src="'+Rn(i)+'"]'}function Ua(i){return"script[async]"+i}function K0(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var l=i.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(l)return s.instance=l,Ct(l),l;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(i.ownerDocument||i).createElement("style"),Ct(l),zt(l,"style",f),Vc(l,a.precedence,i),s.instance=l;case"stylesheet":f=ro(a.href);var m=i.querySelector(Va(f));if(m)return s.state.loading|=4,s.instance=m,Ct(m),m;l=z0(a),(f=Nn.get(f))&&Ch(l,f),m=(i.ownerDocument||i).createElement("link"),Ct(m);var b=m;return b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),zt(m,"link",l),s.state.loading|=4,Vc(m,a.precedence,i),s.instance=m;case"script":return m=so(a.src),(f=i.querySelector(Ua(m)))?(s.instance=f,Ct(f),f):(l=a,(f=Nn.get(m))&&(l=y({},a),Dh(l,f)),i=i.ownerDocument||i,f=i.createElement("script"),Ct(f),zt(f,"link",l),i.head.appendChild(f),s.instance=f);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,Vc(l,a.precedence,i));return s.instance}function Vc(i,s,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=l.length?l[l.length-1]:null,m=f,b=0;b<l.length;b++){var x=l[b];if(x.dataset.precedence===s)m=x;else if(m!==f)break}m?m.parentNode.insertBefore(i,m.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function Ch(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function Dh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Uc=null;function P0(i,s,a){if(Uc===null){var l=new Map,f=Uc=new Map;f.set(a,l)}else f=Uc,l=f.get(a),l||(l=new Map,f.set(a,l));if(l.has(i))return l;for(l.set(i,null),a=a.getElementsByTagName(i),f=0;f<a.length;f++){var m=a[f];if(!(m[Qo]||m[qt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(s)||"";b=i+b;var x=l.get(b);x?x.push(m):l.set(b,[m])}}return l}function q0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function mk(i,s,a){if(a===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 I0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var za=null;function yk(){}function gk(i,s,a){if(za===null)throw Error(r(475));var l=za;if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var f=ro(a.href),m=i.querySelector(Va(f));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(l.count++,l=zc.bind(l),i.then(l,l)),s.state.loading|=4,s.instance=m,Ct(m);return}m=i.ownerDocument||i,a=z0(a),(f=Nn.get(f))&&Ch(a,f),m=m.createElement("link"),Ct(m);var b=m;b._p=new Promise(function(x,E){b.onload=x,b.onerror=E}),zt(m,"link",a),s.instance=m}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(l.count++,s=zc.bind(l),i.addEventListener("load",s),i.addEventListener("error",s))}}function bk(){if(za===null)throw Error(r(475));var i=za;return i.stylesheets&&i.count===0&&Nh(i,i.stylesheets),0<i.count?function(s){var a=setTimeout(function(){if(i.stylesheets&&Nh(i,i.stylesheets),i.unsuspend){var l=i.unsuspend;i.unsuspend=null,l()}},6e4);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(a)}}:null}function zc(){if(this.count--,this.count===0){if(this.stylesheets)Nh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Kc=null;function Nh(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Kc=new Map,s.forEach(vk,i),Kc=null,zc.call(i))}function vk(i,s){if(!(s.state.loading&4)){var a=Kc.get(i);if(a)var l=a.get(null);else{a=new Map,Kc.set(i,a);for(var f=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<f.length;m++){var b=f[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),l=b)}l&&a.set(null,l)}f=s.instance,b=f.getAttribute("data-precedence"),m=a.get(b)||l,m===l&&a.set(null,f),a.set(b,f),this.count++,l=zc.bind(this),f.addEventListener("load",l),f.addEventListener("error",l),m?m.parentNode.insertBefore(f,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(f,i.firstChild)),s.state.loading|=4}}var Ka={$$typeof:k,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function Sk(i,s,a,l,f,m,b,x){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=kf(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=kf(0),this.hiddenUpdates=kf(null),this.identifierPrefix=l,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=x,this.incompleteTransitions=new Map}function H0(i,s,a,l,f,m,b,x,E,j,K,F){return i=new Sk(i,s,a,b,x,E,j,F),s=1,m===!0&&(s|=24),m=pn(3,null,null,s),i.current=m,m.stateNode=i,s=pd(),s.refCount++,i.pooledCache=s,s.refCount++,m.memoizedState={element:l,isDehydrated:a,cache:s},bd(m),i}function F0(i){return i?(i=Bs,i):Bs}function G0(i,s,a,l,f,m){f=F0(f),l.context===null?l.context=f:l.pendingContext=f,l=ir(s),l.payload={element:a},m=m===void 0?null:m,m!==null&&(l.callback=m),a=rr(i,l,s),a!==null&&(vn(a,i,s),ga(a,i,s))}function Y0(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function $h(i,s){Y0(i,s),(i=i.alternate)&&Y0(i,s)}function J0(i){if(i.tag===13){var s=js(i,67108864);s!==null&&vn(s,i,67108864),$h(i,67108864)}}var Pc=!0;function xk(i,s,a,l){var f=B.T;B.T=null;var m=P.p;try{P.p=2,jh(i,s,a,l)}finally{P.p=m,B.T=f}}function wk(i,s,a,l){var f=B.T;B.T=null;var m=P.p;try{P.p=8,jh(i,s,a,l)}finally{P.p=m,B.T=f}}function jh(i,s,a,l){if(Pc){var f=Bh(l);if(f===null)wh(i,s,l,qc,a),Z0(i,l);else if(Ak(f,i,s,a,l))l.stopPropagation();else if(Z0(i,l),s&4&&-1<Tk.indexOf(i)){for(;f!==null;){var m=Ts(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Lr(m.pendingLanes);if(b!==0){var x=m;for(x.pendingLanes|=2,x.entangledLanes|=2;b;){var E=1<<31-dn(b);x.entanglements[1]|=E,b&=~E}ri(m),(Be&6)===0&&(Rc=Te()+500,$a(0))}}break;case 13:x=js(m,2),x!==null&&vn(x,m,2),_c(),$h(m,2)}if(m=Bh(l),m===null&&wh(i,s,l,qc,a),m===f)break;f=m}f!==null&&l.stopPropagation()}else wh(i,s,l,null,a)}}function Bh(i){return i=Kf(i),Lh(i)}var qc=null;function Lh(i){if(qc=null,i=ws(i),i!==null){var s=c(i);if(s===null)i=null;else{var a=s.tag;if(a===13){if(i=u(s),i!==null)return i;i=null}else if(a===3){if(s.stateNode.current.memoizedState.isDehydrated)return s.tag===3?s.stateNode.containerInfo:null;i=null}else s!==i&&(i=null)}}return qc=i,null}function X0(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(Pn()){case Jt:return 2;case Pt:return 8;case Tn:case Qn:return 32;case An:return 268435456;default:return 32}default:return 32}}var Vh=!1,gr=null,br=null,vr=null,Pa=new Map,qa=new Map,Sr=[],Tk="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 Z0(i,s){switch(i){case"focusin":case"focusout":gr=null;break;case"dragenter":case"dragleave":br=null;break;case"mouseover":case"mouseout":vr=null;break;case"pointerover":case"pointerout":Pa.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":qa.delete(s.pointerId)}}function Ia(i,s,a,l,f,m){return i===null||i.nativeEvent!==m?(i={blockedOn:s,domEventName:a,eventSystemFlags:l,nativeEvent:m,targetContainers:[f]},s!==null&&(s=Ts(s),s!==null&&J0(s)),i):(i.eventSystemFlags|=l,s=i.targetContainers,f!==null&&s.indexOf(f)===-1&&s.push(f),i)}function Ak(i,s,a,l,f){switch(s){case"focusin":return gr=Ia(gr,i,s,a,l,f),!0;case"dragenter":return br=Ia(br,i,s,a,l,f),!0;case"mouseover":return vr=Ia(vr,i,s,a,l,f),!0;case"pointerover":var m=f.pointerId;return Pa.set(m,Ia(Pa.get(m)||null,i,s,a,l,f)),!0;case"gotpointercapture":return m=f.pointerId,qa.set(m,Ia(qa.get(m)||null,i,s,a,l,f)),!0}return!1}function Q0(i){var s=ws(i.target);if(s!==null){var a=c(s);if(a!==null){if(s=a.tag,s===13){if(s=u(a),s!==null){i.blockedOn=s,gO(i.priority,function(){if(a.tag===13){var l=bn();l=Mf(l);var f=js(a,l);f!==null&&vn(f,a,l),$h(a,l)}});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Ic(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=Bh(i.nativeEvent);if(a===null){a=i.nativeEvent;var l=new a.constructor(a.type,a);zf=l,a.target.dispatchEvent(l),zf=null}else return s=Ts(a),s!==null&&J0(s),i.blockedOn=a,!1;s.shift()}return!0}function W0(i,s,a){Ic(i)&&a.delete(s)}function Ek(){Vh=!1,gr!==null&&Ic(gr)&&(gr=null),br!==null&&Ic(br)&&(br=null),vr!==null&&Ic(vr)&&(vr=null),Pa.forEach(W0),qa.forEach(W0)}function Hc(i,s){i.blockedOn===s&&(i.blockedOn=null,Vh||(Vh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Ek)))}var Fc=null;function eS(i){Fc!==i&&(Fc=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fc===i&&(Fc=null);for(var s=0;s<i.length;s+=3){var a=i[s],l=i[s+1],f=i[s+2];if(typeof l!="function"){if(Lh(l||a)===null)continue;break}var m=Ts(a);m!==null&&(i.splice(s,3),s-=3,Ld(m,{pending:!0,data:f,method:a.method,action:l},l,f))}}))}function Ha(i){function s(E){return Hc(E,i)}gr!==null&&Hc(gr,i),br!==null&&Hc(br,i),vr!==null&&Hc(vr,i),Pa.forEach(s),qa.forEach(s);for(var a=0;a<Sr.length;a++){var l=Sr[a];l.blockedOn===i&&(l.blockedOn=null)}for(;0<Sr.length&&(a=Sr[0],a.blockedOn===null);)Q0(a),a.blockedOn===null&&Sr.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var f=a[l],m=a[l+1],b=f[tn]||null;if(typeof m=="function")b||eS(a);else if(b){var x=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[tn]||null)x=b.formAction;else if(Lh(f)!==null)continue}else x=b.action;typeof x=="function"?a[l+1]=x:(a.splice(l,3),l-=3),eS(a)}}}function Uh(i){this._internalRoot=i}Gc.prototype.render=Uh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,l=bn();G0(a,l,i,s,null,null)},Gc.prototype.unmount=Uh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;G0(i.current,2,null,i,null,null),_c(),s[xs]=null}};function Gc(i){this._internalRoot=i}Gc.prototype.unstable_scheduleHydration=function(i){if(i){var s=gg();i={blockedOn:null,target:i,priority:s};for(var a=0;a<Sr.length&&s!==0&&s<Sr[a].priority;a++);Sr.splice(a,0,i),a===0&&Q0(i)}};var tS=e.version;if(tS!=="19.1.1")throw Error(r(527,tS,"19.1.1"));P.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=h(s),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var Rk={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Yc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Yc.isDisabled&&Yc.supportsFiber)try{Jo=Yc.inject(Rk),fn=Yc}catch{}}return Ga.createRoot=function(i,s){if(!o(i))throw Error(r(299));var a=!1,l="",f=gv,m=bv,b=vv,x=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(l=s.identifierPrefix),s.onUncaughtError!==void 0&&(f=s.onUncaughtError),s.onCaughtError!==void 0&&(m=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(x=s.unstable_transitionCallbacks)),s=H0(i,1,!1,null,null,a,l,f,m,b,x,null),i[xs]=s.current,xh(i),new Uh(s)},Ga.hydrateRoot=function(i,s,a){if(!o(i))throw Error(r(299));var l=!1,f="",m=gv,b=bv,x=vv,E=null,j=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(f=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(x=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(E=a.unstable_transitionCallbacks),a.formState!==void 0&&(j=a.formState)),s=H0(i,1,!0,s,a??null,l,f,m,b,x,E,j),s.context=F0(null),a=s.current,l=bn(),l=Mf(l),f=ir(l),f.callback=null,rr(a,f,l),a=l,s.current.lanes=a,Zo(s,a),ri(s),i[xs]=s.current,xh(i),new Gc(s)},Ga.version="19.1.1",Ga}var pS;function FM(){if(pS)return qh.exports;pS=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(),qh.exports=HM(),qh.exports}var GM=FM();function sf(){return typeof window<"u"}function jr(t){return $1(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=($1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function $1(t){return sf()?t instanceof Node||t instanceof xn(t).Node:!1}function ht(t){return sf()?t instanceof Element||t instanceof xn(t).Element:!1}function Mt(t){return sf()?t instanceof HTMLElement||t instanceof xn(t).HTMLElement:!1}function Lp(t){return!sf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof xn(t).ShadowRoot}const YM=new Set(["inline","contents"]);function vl(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Kn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!YM.has(o)}const JM=new Set(["table","td","th"]);function XM(t){return JM.has(jr(t))}const ZM=[":popover-open",":modal"];function of(t){return ZM.some(e=>{try{return t.matches(e)}catch{return!1}})}const QM=["transform","translate","scale","rotate","perspective"],WM=["transform","translate","scale","rotate","perspective","filter"],eC=["paint","layout","strict","content"];function ty(t){const e=af(),n=ht(t)?Kn(t):t;return QM.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)||WM.some(r=>(n.willChange||"").includes(r))||eC.some(r=>(n.contain||"").includes(r))}function tC(t){let e=qi(t);for(;Mt(e)&&!Ki(e);){if(ty(e))return e;if(of(e))return null;e=qi(e)}return null}function af(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const nC=new Set(["html","body","#document"]);function Ki(t){return nC.has(jr(t))}function Kn(t){return xn(t).getComputedStyle(t)}function lf(t){return ht(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function qi(t){if(jr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Lp(t)&&t.host||bi(t);return Lp(e)?e.host:e}function j1(t){const e=qi(t);return Ki(e)?t.ownerDocument?t.ownerDocument.body:t.body:Mt(e)&&vl(e)?e:j1(e)}function kr(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=j1(t),c=o===((r=t.ownerDocument)==null?void 0:r.body),u=xn(o);if(c){const d=Vp(u);return e.concat(u,u.visualViewport||[],vl(o)?o:[],d&&n?kr(d):[])}return e.concat(o,kr(o,[],n))}function Vp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const ku=Math.min,ls=Math.max,Mu=Math.round,Xc=Math.floor,ci=t=>({x:t,y:t}),iC={left:"right",right:"left",bottom:"top",top:"bottom"},rC={start:"end",end:"start"};function mS(t,e,n){return ls(t,ku(e,n))}function cf(t,e){return typeof t=="function"?t(e):t}function ds(t){return t.split("-")[0]}function uf(t){return t.split("-")[1]}function B1(t){return t==="x"?"y":"x"}function L1(t){return t==="y"?"height":"width"}const sC=new Set(["top","bottom"]);function Rr(t){return sC.has(ds(t))?"y":"x"}function V1(t){return B1(Rr(t))}function oC(t,e,n){n===void 0&&(n=!1);const r=uf(t),o=V1(t),c=L1(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[c]>e.floating[c]&&(u=Cu(u)),[u,Cu(u)]}function aC(t){const e=Cu(t);return[Up(t),e,Up(e)]}function Up(t){return t.replace(/start|end/g,e=>rC[e])}const yS=["left","right"],gS=["right","left"],lC=["top","bottom"],cC=["bottom","top"];function uC(t,e,n){switch(t){case"top":case"bottom":return n?e?gS:yS:e?yS:gS;case"left":case"right":return e?lC:cC;default:return[]}}function fC(t,e,n,r){const o=uf(t);let c=uC(ds(t),n==="start",r);return o&&(c=c.map(u=>u+"-"+o),e&&(c=c.concat(c.map(Up)))),c}function Cu(t){return t.replace(/left|right|bottom|top/g,e=>iC[e])}function dC(t){return{top:0,right:0,bottom:0,left:0,...t}}function hC(t){return typeof t!="number"?dC(t):{top:t,right:t,bottom:t,left:t}}function Du(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}/*!
64
64
  * tabbable 6.2.0
65
65
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
66
- */var pC=["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])"],Nu=pC.join(","),U1=typeof Element>"u",Co=U1?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$u=!U1&&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},ju=function t(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),c=o===""||o==="true",u=c||n&&e&&t(e.parentNode);return u},mC=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},z1=function(e,n,r){if(ju(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Nu));return n&&Co.call(e,Nu)&&o.unshift(e),o=o.filter(r),o},K1=function t(e,n,r){for(var o=[],c=Array.from(e);c.length;){var u=c.shift();if(!ju(u,!1))if(u.tagName==="SLOT"){var d=u.assignedElements(),h=d.length?d:u.children,p=t(h,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:u,candidates:p})}else{var y=Co.call(u,Nu);y&&r.filter(u)&&(n||!e.includes(u))&&o.push(u);var g=u.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(u),v=!ju(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(u));if(g&&v){var S=t(g===!0?u.children:g.children,!0,r);r.flatten?o.push.apply(o,S):o.push({scopeParent:u,candidates:S})}else c.unshift.apply(c,u.children)}}return o},P1=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},q1=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||mC(e))&&!P1(e)?0:e.tabIndex},yC=function(e,n){var r=q1(e);return r<0&&n&&!P1(e)?0:r},gC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},I1=function(e){return e.tagName==="INPUT"},bC=function(e){return I1(e)&&e.type==="hidden"},vC=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},SC=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},xC=function(e){if(!e.name)return!0;var n=e.form||$u(e),r=function(d){return n.querySelectorAll('input[type="radio"][name="'+d+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(u){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",u.message),!1}var c=SC(o,e.form);return!c||c===e},wC=function(e){return I1(e)&&e.type==="radio"},TC=function(e){return wC(e)&&!xC(e)},AC=function(e){var n,r=e&&$u(e),o=(n=r)===null||n===void 0?void 0:n.host,c=!1;if(r&&r!==e){var u,d,h;for(c=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!c&&o;){var p,y,g;r=$u(o),o=(p=r)===null||p===void 0?void 0:p.host,c=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return c},gS=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},EC=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var c=Co.call(e,"details>summary:first-of-type"),u=c?e.parentElement:e;if(Co.call(u,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var h=e.parentElement,p=$u(e);if(h&&!h.shadowRoot&&o(h)===!0)return gS(e);e.assignedSlot?e=e.assignedSlot:!h&&p!==e.ownerDocument?e=p.host:e=h}e=d}if(AC(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return gS(e);return!1},RC=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 o=n.children.item(r);if(o.tagName==="LEGEND")return Co.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Up=function(e,n){return!(n.disabled||ju(n)||bC(n)||EC(n,e)||vC(n)||RC(n))},zp=function(e,n){return!(TC(n)||q1(n)<0||!Up(e,n))},OC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},_C=function t(e){var n=[],r=[];return e.forEach(function(o,c){var u=!!o.scopeParent,d=u?o.scopeParent:o,h=yC(d,u),p=u?t(o.candidates):d;h===0?u?n.push.apply(n,p):n.push(d):r.push({documentOrder:c,tabIndex:h,item:o,isScope:u,content:p})}),r.sort(gC).reduce(function(o,c){return c.isScope?o.push.apply(o,c.content):o.push(c.content),o},[]).concat(n)},ty=function(e,n){n=n||{};var r;return n.getShadowRoot?r=K1([e],n.includeContainer,{filter:zp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:OC}):r=z1(e,n.includeContainer,zp.bind(null,n)),_C(r)},kC=function(e,n){n=n||{};var r;return n.getShadowRoot?r=K1([e],n.includeContainer,{filter:Up.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=z1(e,n.includeContainer,Up.bind(null,n)),r},H1=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Co.call(e,Nu)===!1?!1:zp(n,e)};function MC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function F1(){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 CC(){return/apple/i.test(navigator.vendor)}function Kp(){const t=/android/i;return t.test(MC())||t.test(F1())}function DC(){return F1().includes("jsdom/")}const bS="data-floating-ui-focusable",NC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function uo(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 Sn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Bp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Ar(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Fh(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 $C(t){return t.matches("html,body")}function Jn(t){return t?.ownerDocument||document}function G1(t){return Mt(t)&&t.matches(NC)}function vS(t){return t?t.getAttribute("role")==="combobox"&&G1(t):!1}function Pp(t){return t?t.hasAttribute(bS)?t:t.querySelector("["+bS+"]")||t:null}function So(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var c;return o.parentId===e&&(!n||((c=o.context)==null?void 0:c.open))}).flatMap(o=>[o,...So(t,o.id,n)])}function SS(t,e){var n;let r=[],o=(n=t.find(c=>c.id===e))==null?void 0:n.parentId;for(;o;){const c=t.find(u=>u.id===o);o=c?.parentId,c&&(r=r.concat(c))}return r}function Gh(t){t.preventDefault(),t.stopPropagation()}function jC(t){return"nativeEvent"in t}function BC(t){return t.mozInputSource===0&&t.isTrusted?!0:Kp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function LC(t){return DC()?!1:!Kp()&&t.width===0&&t.height===0||Kp()&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function xS(t,e){return["mouse","pen"].includes(t)}var VC=typeof document<"u",UC=function(){},zi=VC?V.useLayoutEffect:UC;const zC={..._1};function Yh(t){const e=V.useRef(t);return zi(()=>{e.current=t}),e}const KC=zC.useInsertionEffect,PC=KC||(t=>t());function ai(t){const e=V.useRef(()=>{});return PC(()=>{e.current=t}),V.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const uf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Y1(t,e){const n=ty(t,uf()),r=n.length;if(r===0)return;const o=uo(Jn(t)),c=n.indexOf(o),u=c===-1?e===1?0:r-1:c+e;return n[u]}function qC(t){return Y1(Jn(t).body,1)||t}function IC(t){return Y1(Jn(t).body,-1)||t}function wS(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Sn(n,r)}var HC=N1();function TS(t,e,n){let{reference:r,floating:o}=t;const c=Rr(e),u=V1(e),d=L1(u),h=ds(e),p=c==="y",y=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,v=r[d]/2-o[d]/2;let S;switch(h){case"top":S={x:y,y:r.y-o.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-o.width,y:g};break;default:S={x:r.x,y:r.y}}switch(cf(e)){case"start":S[u]-=v*(n&&p?-1:1);break;case"end":S[u]+=v*(n&&p?-1:1);break}return S}const FC=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:c=[],platform:u}=n,d=c.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(e));let p=await u.getElementRects({reference:t,floating:e,strategy:o}),{x:y,y:g}=TS(p,r,h),v=r,S={},w=0;for(let T=0;T<d.length;T++){const{name:D,fn:$}=d[T],{x:_,y:k,data:C,reset:O}=await $({x:y,y:g,initialPlacement:r,placement:v,strategy:o,middlewareData:S,rects:p,platform:u,elements:{reference:t,floating:e}});y=_??y,g=k??g,S={...S,[D]:{...S[D],...C}},O&&w<=50&&(w++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(p=O.rects===!0?await u.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:y,y:g}=TS(p,v,h)),T=-1)}return{x:y,y:g,placement:v,strategy:o,middlewareData:S}};async function J1(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:c,rects:u,elements:d,strategy:h}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:S=0}=lf(e,t),w=hC(S),D=d[v?g==="floating"?"reference":"floating":g],$=Du(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(D)))==null||n?D:D.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:h})),_=g==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),C=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},O=Du(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:k,strategy:h}):_);return{top:($.top-O.top+w.top)/C.y,bottom:(O.bottom-$.bottom+w.bottom)/C.y,left:($.left-O.left+w.left)/C.x,right:(O.right-$.right+w.right)/C.x}}const GC=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:c,rects:u,initialPlacement:d,platform:h,elements:p}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:T=!0,...D}=lf(t,e);if((n=c.arrow)!=null&&n.alignmentOffset)return{};const $=ds(o),_=Rr(d),k=ds(d)===d,C=await(h.isRTL==null?void 0:h.isRTL(p.floating)),O=v||(k||!T?[Cu(d)]:aC(d)),J=w!=="none";!v&&J&&O.push(...fC(d,T,w,C));const G=[d,...O],H=await J1(e,D),ie=[];let oe=((r=c.flip)==null?void 0:r.overflows)||[];if(y&&ie.push(H[$]),g){const Q=oC(o,u,C);ie.push(H[Q[0]],H[Q[1]])}if(oe=[...oe,{placement:o,overflows:ie}],!ie.every(Q=>Q<=0)){var fe,ge;const Q=(((fe=c.flip)==null?void 0:fe.index)||0)+1,W=G[Q];if(W&&(!(g==="alignment"?_!==Rr(W):!1)||oe.every(z=>z.overflows[0]>0&&Rr(z.placement)===_)))return{data:{index:Q,overflows:oe},reset:{placement:W}};let B=(ge=oe.filter(P=>P.overflows[0]<=0).sort((P,z)=>P.overflows[1]-z.overflows[1])[0])==null?void 0:ge.placement;if(!B)switch(S){case"bestFit":{var be;const P=(be=oe.filter(z=>{if(J){const ee=Rr(z.placement);return ee===_||ee==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ee=>ee>0).reduce((ee,A)=>ee+A,0)]).sort((z,ee)=>z[1]-ee[1])[0])==null?void 0:be[0];P&&(B=P);break}case"initialPlacement":B=d;break}if(o!==B)return{reset:{placement:B}}}return{}}}},YC=new Set(["left","top"]);async function JC(t,e){const{placement:n,platform:r,elements:o}=t,c=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=ds(n),d=cf(n),h=Rr(n)==="y",p=YC.has(u)?-1:1,y=c&&h?-1:1,g=lf(e,t);let{mainAxis:v,crossAxis:S,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof w=="number"&&(S=d==="end"?w*-1:w),h?{x:S*y,y:v*p}:{x:v*p,y:S*y}}const XC=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:c,placement:u,middlewareData:d}=e,h=await JC(e,t);return u===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:c+h.y,data:{...h,placement:u}}}}},ZC=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:D=>{let{x:$,y:_}=D;return{x:$,y:_}}},...h}=lf(t,e),p={x:n,y:r},y=await J1(e,h),g=Rr(ds(o)),v=B1(g);let S=p[v],w=p[g];if(c){const D=v==="y"?"top":"left",$=v==="y"?"bottom":"right",_=S+y[D],k=S-y[$];S=pS(_,S,k)}if(u){const D=g==="y"?"top":"left",$=g==="y"?"bottom":"right",_=w+y[D],k=w-y[$];w=pS(_,w,k)}const T=d.fn({...e,[v]:S,[g]:w});return{...T,data:{x:T.x-n,y:T.y-r,enabled:{[v]:c,[g]:u}}}}}};function X1(t){const e=Kn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Mt(t),c=o?t.offsetWidth:n,u=o?t.offsetHeight:r,d=Mu(n)!==c||Mu(r)!==u;return d&&(n=c,r=u),{width:n,height:r,$:d}}function ny(t){return ht(t)?t:t.contextElement}function xo(t){const e=ny(t);if(!Mt(e))return ci(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:c}=X1(e);let u=(c?Mu(n.width):n.width)/r,d=(c?Mu(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const QC=ci(0);function Z1(t){const e=xn(t);return!of()||!e.visualViewport?QC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function hs(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),c=ny(t);let u=ci(1);e&&(r?ht(r)&&(u=xo(r)):u=xo(t));const d=WC(c,n,r)?Z1(c):ci(0);let h=(o.left+d.x)/u.x,p=(o.top+d.y)/u.y,y=o.width/u.x,g=o.height/u.y;if(c){const v=xn(c),S=r&&ht(r)?xn(r):r;let w=v,T=Lp(w);for(;T&&r&&S!==w;){const D=xo(T),$=T.getBoundingClientRect(),_=Kn(T),k=$.left+(T.clientLeft+parseFloat(_.paddingLeft))*D.x,C=$.top+(T.clientTop+parseFloat(_.paddingTop))*D.y;h*=D.x,p*=D.y,y*=D.x,g*=D.y,h+=k,p+=C,w=xn(T),T=Lp(w)}}return Du({width:y,height:g,x:h,y:p})}function iy(t,e){const n=af(t).scrollLeft;return e?e.left+n:hs(bi(t)).left+n}function Q1(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:iy(t,r)),c=r.top+e.scrollTop;return{x:o,y:c}}function eD(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const c=o==="fixed",u=bi(r),d=e?sf(e.floating):!1;if(r===u||d&&c)return n;let h={scrollLeft:0,scrollTop:0},p=ci(1);const y=ci(0),g=Mt(r);if((g||!g&&!c)&&((jr(r)!=="body"||vl(u))&&(h=af(r)),Mt(r))){const S=hs(r);p=xo(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const v=u&&!g&&!c?Q1(u,h,!0):ci(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+y.x+v.x,y:n.y*p.y-h.scrollTop*p.y+y.y+v.y}}function tD(t){return Array.from(t.getClientRects())}function nD(t){const e=bi(t),n=af(t),r=t.ownerDocument.body,o=ls(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),c=ls(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+iy(t);const d=-n.scrollTop;return Kn(r).direction==="rtl"&&(u+=ls(e.clientWidth,r.clientWidth)-o),{width:o,height:c,x:u,y:d}}function iD(t,e){const n=xn(t),r=bi(t),o=n.visualViewport;let c=r.clientWidth,u=r.clientHeight,d=0,h=0;if(o){c=o.width,u=o.height;const p=of();(!p||p&&e==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}return{width:c,height:u,x:d,y:h}}const rD=new Set(["absolute","fixed"]);function sD(t,e){const n=hs(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,c=Mt(t)?xo(t):ci(1),u=t.clientWidth*c.x,d=t.clientHeight*c.y,h=o*c.x,p=r*c.y;return{width:u,height:d,x:h,y:p}}function AS(t,e,n){let r;if(e==="viewport")r=iD(t,n);else if(e==="document")r=nD(bi(t));else if(ht(e))r=sD(e,n);else{const o=Z1(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Du(r)}function W1(t,e){const n=qi(t);return n===e||!ht(n)||Ki(n)?!1:Kn(n).position==="fixed"||W1(n,e)}function oD(t,e){const n=e.get(t);if(n)return n;let r=kr(t,[],!1).filter(d=>ht(d)&&jr(d)!=="body"),o=null;const c=Kn(t).position==="fixed";let u=c?qi(t):t;for(;ht(u)&&!Ki(u);){const d=Kn(u),h=ey(u);!h&&d.position==="fixed"&&(o=null),(c?!h&&!o:!h&&d.position==="static"&&!!o&&rD.has(o.position)||vl(u)&&!h&&W1(t,u))?r=r.filter(y=>y!==u):o=d,u=qi(u)}return e.set(t,r),r}function aD(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const u=[...n==="clippingAncestors"?sf(e)?[]:oD(e,this._c):[].concat(n),r],d=u[0],h=u.reduce((p,y)=>{const g=AS(e,y,o);return p.top=ls(g.top,p.top),p.right=ku(g.right,p.right),p.bottom=ku(g.bottom,p.bottom),p.left=ls(g.left,p.left),p},AS(e,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function lD(t){const{width:e,height:n}=X1(t);return{width:e,height:n}}function cD(t,e,n){const r=Mt(e),o=bi(e),c=n==="fixed",u=hs(t,!0,c,e);let d={scrollLeft:0,scrollTop:0};const h=ci(0);function p(){h.x=iy(o)}if(r||!r&&!c)if((jr(e)!=="body"||vl(o))&&(d=af(e)),r){const S=hs(e,!0,c,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else o&&p();c&&!r&&o&&p();const y=o&&!r&&!c?Q1(o,d):ci(0),g=u.left+d.scrollLeft-h.x-y.x,v=u.top+d.scrollTop-h.y-y.y;return{x:g,y:v,width:u.width,height:u.height}}function Jh(t){return Kn(t).position==="static"}function ES(t,e){if(!Mt(t)||Kn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bi(t)===n&&(n=n.ownerDocument.body),n}function eT(t,e){const n=xn(t);if(sf(t))return n;if(!Mt(t)){let o=qi(t);for(;o&&!Ki(o);){if(ht(o)&&!Jh(o))return o;o=qi(o)}return n}let r=ES(t,e);for(;r&&XM(r)&&Jh(r);)r=ES(r,e);return r&&Ki(r)&&Jh(r)&&!ey(r)?n:r||tC(t)||n}const uD=async function(t){const e=this.getOffsetParent||eT,n=this.getDimensions,r=await n(t.floating);return{reference:cD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fD(t){return Kn(t).direction==="rtl"}const dD={convertOffsetParentRelativeRectToViewportRelativeRect:eD,getDocumentElement:bi,getClippingRect:aD,getOffsetParent:eT,getElementRects:uD,getClientRects:tD,getDimensions:lD,getScale:xo,isElement:ht,isRTL:fD};function tT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function hD(t,e){let n=null,r;const o=bi(t);function c(){var d;clearTimeout(r),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),c();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:S}=p;if(d||e(),!v||!S)return;const w=Xc(g),T=Xc(o.clientWidth-(y+v)),D=Xc(o.clientHeight-(g+S)),$=Xc(y),k={rootMargin:-w+"px "+-T+"px "+-D+"px "+-$+"px",threshold:ls(0,ku(1,h))||1};let C=!0;function O(J){const G=J[0].intersectionRatio;if(G!==h){if(!C)return u();G?u(!1,G):r=setTimeout(()=>{u(!1,1e-7)},1e3)}G===1&&!tT(p,t.getBoundingClientRect())&&u(),C=!1}try{n=new IntersectionObserver(O,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(O,k)}n.observe(t)}return u(!0),c}function pD(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=ny(t),y=o||c?[...p?kr(p):[],...kr(e)]:[];y.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),c&&$.addEventListener("resize",n)});const g=p&&d?hD(p,n):null;let v=-1,S=null;u&&(S=new ResizeObserver($=>{let[_]=$;_&&_.target===p&&S&&(S.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=S)==null||k.observe(e)})),n()}),p&&!h&&S.observe(p),S.observe(e));let w,T=h?hs(t):null;h&&D();function D(){const $=hs(t);T&&!tT(T,$)&&n(),T=$,w=requestAnimationFrame(D)}return n(),()=>{var $;y.forEach(_=>{o&&_.removeEventListener("scroll",n),c&&_.removeEventListener("resize",n)}),g?.(),($=S)==null||$.disconnect(),S=null,h&&cancelAnimationFrame(w)}}const mD=XC,yD=ZC,gD=GC,bD=(t,e,n)=>{const r=new Map,o={platform:dD,...n},c={...o.platform,_c:r};return FC(t,e,{...o,platform:c})};var vD=typeof document<"u",SD=function(){},du=vD?V.useLayoutEffect:SD;function Bu(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,o;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(!Bu(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const c=o[r];if(!(c==="_owner"&&t.$$typeof)&&!Bu(t[c],e[c]))return!1}return!0}return t!==t&&e!==e}function nT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function RS(t,e){const n=nT(t);return Math.round(e*n)/n}function Xh(t){const e=V.useRef(t);return du(()=>{e.current=t}),e}function xD(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:c,floating:u}={},transform:d=!0,whileElementsMounted:h,open:p}=t,[y,g]=V.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[v,S]=V.useState(r);Bu(v,r)||S(r);const[w,T]=V.useState(null),[D,$]=V.useState(null),_=V.useCallback(z=>{z!==J.current&&(J.current=z,T(z))},[]),k=V.useCallback(z=>{z!==G.current&&(G.current=z,$(z))},[]),C=c||w,O=u||D,J=V.useRef(null),G=V.useRef(null),H=V.useRef(y),ie=h!=null,oe=Xh(h),fe=Xh(o),ge=Xh(p),be=V.useCallback(()=>{if(!J.current||!G.current)return;const z={placement:e,strategy:n,middleware:v};fe.current&&(z.platform=fe.current),bD(J.current,G.current,z).then(ee=>{const A={...ee,isPositioned:ge.current!==!1};Q.current&&!Bu(H.current,A)&&(H.current=A,HC.flushSync(()=>{g(A)}))})},[v,e,n,fe,ge]);du(()=>{p===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[p]);const Q=V.useRef(!1);du(()=>(Q.current=!0,()=>{Q.current=!1}),[]),du(()=>{if(C&&(J.current=C),O&&(G.current=O),C&&O){if(oe.current)return oe.current(C,O,be);be()}},[C,O,be,oe,ie]);const W=V.useMemo(()=>({reference:J,floating:G,setReference:_,setFloating:k}),[_,k]),B=V.useMemo(()=>({reference:C,floating:O}),[C,O]),P=V.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const ee=RS(B.floating,y.x),A=RS(B.floating,y.y);return d?{...z,transform:"translate("+ee+"px, "+A+"px)",...nT(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ee,top:A}},[n,d,B.floating,y.x,y.y]);return V.useMemo(()=>({...y,update:be,refs:W,elements:B,floatingStyles:P}),[y,be,W,B,P])}const wD=(t,e)=>({...mD(t),options:[t,e]}),TD=(t,e)=>({...yD(t),options:[t,e]}),AD=(t,e)=>({...gD(t),options:[t,e]}),ED="data-floating-ui-focusable",OS="active",_S="selected",RD={..._1};let kS=!1,OD=0;const MS=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+OD++;function _D(){const[t,e]=V.useState(()=>kS?MS():void 0);return zi(()=>{t==null&&e(MS())},[]),V.useEffect(()=>{kS=!0},[]),t}const kD=RD.useId,iT=kD||_D;function MD(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(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 CD=V.createContext(null),DD=V.createContext(null),rT=()=>{var t;return((t=V.useContext(CD))==null?void 0:t.id)||null},ry=()=>V.useContext(DD);function Lu(t){return"data-floating-ui-"+t}function ND(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let CS=0;function oo(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(CS);const c=()=>t?.focus({preventScroll:n});o?c():CS=requestAnimationFrame(c)}function $D(t){return t?.ownerDocument||document}const wo={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function DS(t){return t==="inert"?wo.inert:t==="aria-hidden"?wo["aria-hidden"]:wo.none}let Zc=new WeakSet,Qc={},Zh=0;const jD=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,sT=t=>t&&(t.host||sT(t.parentNode)),BD=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=sT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function LD(t,e,n,r){const o="data-floating-ui-inert",c=r?"inert":n?"aria-hidden":null,u=BD(e,t),d=new Set,h=new Set(u),p=[];Qc[o]||(Qc[o]=new WeakMap);const y=Qc[o];u.forEach(g),v(e),d.clear();function g(S){!S||d.has(S)||(d.add(S),S.parentNode&&g(S.parentNode))}function v(S){!S||h.has(S)||[].forEach.call(S.children,w=>{if(jr(w)!=="script")if(d.has(w))v(w);else{const T=c?w.getAttribute(c):null,D=T!==null&&T!=="false",$=DS(c),_=($.get(w)||0)+1,k=(y.get(w)||0)+1;$.set(w,_),y.set(w,k),p.push(w),_===1&&D&&Zc.add(w),k===1&&w.setAttribute(o,""),!D&&c&&w.setAttribute(c,c==="inert"?"":"true")}})}return Zh++,()=>{p.forEach(S=>{const w=DS(c),D=(w.get(S)||0)-1,$=(y.get(S)||0)-1;w.set(S,D),y.set(S,$),D||(!Zc.has(S)&&c&&S.removeAttribute(c),Zc.delete(S)),$||S.removeAttribute(o)}),Zh--,Zh||(wo.inert=new WeakMap,wo["aria-hidden"]=new WeakMap,wo.none=new WeakMap,Zc=new WeakSet,Qc={})}}function NS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=$D(t[0]).body;return LD(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const sy={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},$S=V.forwardRef(function(e,n){const[r,o]=V.useState();zi(()=>{CC()&&o("button")},[]);const c={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Lu("focus-guard")]:"",style:sy};return Y.jsx("span",{...e,...c})}),VD=V.createContext(null),UD=()=>V.useContext(VD);function jS(t){return V.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const zD=20;let Or=[];function oy(){Or=Or.filter(t=>t.isConnected)}function KD(t){oy(),t&&jr(t)!=="body"&&(Or.push(t),Or.length>zD&&(Or=Or.slice(-20)))}function BS(){return oy(),Or[Or.length-1]}function PD(t){const e=uf();return H1(t,e)?t:ty(t,e)[0]||t}function LS(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=uf(),c=kC(t,r).filter(d=>{const h=d.getAttribute("data-tabindex")||"";return H1(d,r)||d.hasAttribute("data-tabindex")&&!h.startsWith("-")}),u=t.getAttribute("tabindex");e.current.includes("floating")||c.length===0?u!=="0"&&t.setAttribute("tabindex","0"):(u!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const qD=V.forwardRef(function(e,n){return Y.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:sy})});function ID(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:c=!0,initialFocus:u=0,returnFocus:d=!0,restoreFocus:h=!1,modal:p=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:v=!1,getInsideElements:S=()=>[]}=t,{open:w,onOpenChange:T,events:D,dataRef:$,elements:{domReference:_,floating:k}}=e,C=ai(()=>{var we;return(we=$.current.floatingContext)==null?void 0:we.nodeId}),O=ai(S),J=typeof u=="number"&&u<0,G=vS(_)&&J,H=jD(),ie=H?c:!0,oe=!ie||H&&v,fe=Yh(o),ge=Yh(u),be=Yh(d),Q=ry(),W=UD(),B=V.useRef(null),P=V.useRef(null),z=V.useRef(!1),ee=V.useRef(!1),A=V.useRef(-1),I=V.useRef(-1),te=W!=null,X=Pp(k),se=ai(function(we){return we===void 0&&(we=X),we?ty(we,uf()):[]}),ue=ai(we=>{const Me=se(we);return fe.current.map(Ee=>_&&Ee==="reference"?_:X&&Ee==="floating"?X:Me).filter(Boolean).flat()});V.useEffect(()=>{if(r||!p)return;function we(Ee){if(Ee.key==="Tab"){Sn(X,uo(Jn(X)))&&se().length===0&&!G&&Gh(Ee);const tt=ue(),Rt=Ar(Ee);fe.current[0]==="reference"&&Rt===_&&(Gh(Ee),Ee.shiftKey?oo(tt[tt.length-1]):oo(tt[1])),fe.current[1]==="floating"&&Rt===X&&Ee.shiftKey&&(Gh(Ee),oo(tt[0]))}}const Me=Jn(X);return Me.addEventListener("keydown",we),()=>{Me.removeEventListener("keydown",we)}},[r,_,X,p,fe,G,se,ue]),V.useEffect(()=>{if(r||!k)return;function we(Me){const Ee=Ar(Me),Rt=se().indexOf(Ee);Rt!==-1&&(A.current=Rt)}return k.addEventListener("focusin",we),()=>{k.removeEventListener("focusin",we)}},[r,k,se]),V.useEffect(()=>{if(r||!g)return;function we(){ee.current=!0,setTimeout(()=>{ee.current=!1})}function Me(Rt){const Te=Rt.relatedTarget,Pn=Rt.currentTarget,Jt=Ar(Rt);queueMicrotask(()=>{const Pt=C(),Tn=!(Sn(_,Te)||Sn(k,Te)||Sn(Te,k)||Sn(W?.portalNode,Te)||Te!=null&&Te.hasAttribute(Lu("focus-guard"))||Q&&(So(Q.nodesRef.current,Pt).find(Qn=>{var An,Wn;return Sn((An=Qn.context)==null?void 0:An.elements.floating,Te)||Sn((Wn=Qn.context)==null?void 0:Wn.elements.domReference,Te)})||SS(Q.nodesRef.current,Pt).find(Qn=>{var An,Wn,jl;return[(An=Qn.context)==null?void 0:An.elements.floating,Pp((Wn=Qn.context)==null?void 0:Wn.elements.floating)].includes(Te)||((jl=Qn.context)==null?void 0:jl.elements.domReference)===Te})));if(Pn===_&&X&&LS(X,fe),h&&Pn!==_&&!(Jt!=null&&Jt.isConnected)&&uo(Jn(X))===Jn(X).body){Mt(X)&&X.focus();const Qn=A.current,An=se(),Wn=An[Qn]||An[An.length-1]||X;Mt(Wn)&&Wn.focus()}if($.current.insideReactTree){$.current.insideReactTree=!1;return}(G||!p)&&Te&&Tn&&!ee.current&&Te!==BS()&&(z.current=!0,T(!1,Rt,"focus-out"))})}const Ee=!!(!Q&&W);function tt(){ND(I),$.current.insideReactTree=!0,I.current=window.setTimeout(()=>{$.current.insideReactTree=!1})}if(k&&Mt(_))return _.addEventListener("focusout",Me),_.addEventListener("pointerdown",we),k.addEventListener("focusout",Me),Ee&&k.addEventListener("focusout",tt,!0),()=>{_.removeEventListener("focusout",Me),_.removeEventListener("pointerdown",we),k.removeEventListener("focusout",Me),Ee&&k.removeEventListener("focusout",tt,!0)}},[r,_,k,X,p,Q,W,T,g,h,se,G,C,fe,$]);const le=V.useRef(null),rt=V.useRef(null),Ve=jS([le,W?.beforeInsideRef]),wn=jS([rt,W?.afterInsideRef]);V.useEffect(()=>{var we,Me;if(r||!k)return;const Ee=Array.from((W==null||(we=W.portalNode)==null?void 0:we.querySelectorAll("["+Lu("portal")+"]"))||[]),Rt=(Me=(Q?SS(Q.nodesRef.current,C()):[]).find(Jt=>{var Pt;return vS(((Pt=Jt.context)==null?void 0:Pt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,Te=[k,Rt,...Ee,...O(),B.current,P.current,le.current,rt.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,fe.current.includes("reference")||G?_:null].filter(Jt=>Jt!=null),Pn=p||G?NS(Te,!oe,oe):NS(Te);return()=>{Pn()}},[r,_,k,p,fe,W,G,ie,oe,Q,C,O]),zi(()=>{if(r||!Mt(X))return;const we=Jn(X),Me=uo(we);queueMicrotask(()=>{const Ee=ue(X),tt=ge.current,Rt=(typeof tt=="number"?Ee[tt]:tt.current)||X,Te=Sn(X,Me);!J&&!Te&&w&&oo(Rt,{preventScroll:Rt===X})})},[r,w,X,J,ue,ge]),zi(()=>{if(r||!X)return;const we=Jn(X),Me=uo(we);KD(Me);function Ee(Te){let{reason:Pn,event:Jt,nested:Pt}=Te;if(["hover","safe-polygon"].includes(Pn)&&Jt.type==="mouseleave"&&(z.current=!0),Pn==="outside-press")if(Pt)z.current=!1;else if(BC(Jt)||LC(Jt))z.current=!1;else{let Tn=!1;document.createElement("div").focus({get preventScroll(){return Tn=!0,!1}}),Tn?z.current=!1:z.current=!0}}D.on("openchange",Ee);const tt=we.createElement("span");tt.setAttribute("tabindex","-1"),tt.setAttribute("aria-hidden","true"),Object.assign(tt.style,sy),te&&_&&_.insertAdjacentElement("afterend",tt);function Rt(){if(typeof be.current=="boolean"){const Te=_||BS();return Te&&Te.isConnected?Te:tt}return be.current.current||tt}return()=>{D.off("openchange",Ee);const Te=uo(we),Pn=Sn(k,Te)||Q&&So(Q.nodesRef.current,C(),!1).some(Pt=>{var Tn;return Sn((Tn=Pt.context)==null?void 0:Tn.elements.floating,Te)}),Jt=Rt();queueMicrotask(()=>{const Pt=PD(Jt);be.current&&!z.current&&Mt(Pt)&&(!(Pt!==Te&&Te!==we.body)||Pn)&&Pt.focus({preventScroll:!0}),tt.remove()})}},[r,k,X,be,$,D,Q,te,_,C]),V.useEffect(()=>(queueMicrotask(()=>{z.current=!1}),()=>{queueMicrotask(oy)}),[r]),zi(()=>{if(!r&&W)return W.setFocusManagerState({modal:p,closeOnFocusOut:g,open:w,onOpenChange:T,domReference:_}),()=>{W.setFocusManagerState(null)}},[r,W,p,w,T,g,_]),zi(()=>{r||X&&LS(X,fe)},[r,X,fe]);function Zi(we){return r||!y||!p?null:Y.jsx(qD,{ref:we==="start"?B:P,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const wi=!r&&ie&&(p?!G:!0)&&(te||p);return Y.jsxs(Y.Fragment,{children:[wi&&Y.jsx($S,{"data-type":"inside",ref:Ve,onFocus:we=>{if(p){const Ee=ue();oo(o[0]==="reference"?Ee[0]:Ee[Ee.length-1])}else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(z.current=!1,wS(we,W.portalNode)){const Ee=qC(_);Ee?.focus()}else{var Me;(Me=W.beforeOutsideRef.current)==null||Me.focus()}}}),!G&&Zi("start"),n,Zi("end"),wi&&Y.jsx($S,{"data-type":"inside",ref:wn,onFocus:we=>{if(p)oo(ue()[0]);else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(g&&(z.current=!0),wS(we,W.portalNode)){const Ee=IC(_);Ee?.focus()}else{var Me;(Me=W.afterOutsideRef.current)==null||Me.focus()}}})]})}function VS(t){return Mt(t.target)&&t.target.tagName==="BUTTON"}function HD(t){return Mt(t.target)&&t.target.tagName==="A"}function US(t){return G1(t)}function FD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:c}}=t,{enabled:u=!0,event:d="click",toggle:h=!0,ignoreMouse:p=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,v=V.useRef(),S=V.useRef(!1),w=V.useMemo(()=>({onPointerDown(T){v.current=T.pointerType},onMouseDown(T){const D=v.current;T.button===0&&d!=="click"&&(xS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="mousedown")?r(!1,T.nativeEvent,"click"):(T.preventDefault(),r(!0,T.nativeEvent,"click"))))},onClick(T){const D=v.current;if(d==="mousedown"&&v.current){v.current=void 0;return}xS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="click")?r(!1,T.nativeEvent,"click"):r(!0,T.nativeEvent,"click"))},onKeyDown(T){v.current=void 0,!(T.defaultPrevented||!y||VS(T))&&(T.key===" "&&!US(c)&&(T.preventDefault(),S.current=!0),!HD(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||VS(T)||US(c)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[o,c,d,p,y,r,n,g,h]);return V.useMemo(()=>u?{reference:w}:{},[u,w])}const GD={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},YD={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},zS=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 JD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:c}=t,{enabled:u=!0,escapeKey:d=!0,outsidePress:h=!0,outsidePressEvent:p="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:v=!1,bubbles:S,capture:w}=e,T=ry(),D=ai(typeof h=="function"?h:()=>!1),$=typeof h=="function"?D:h,_=V.useRef(!1),{escapeKey:k,outsidePress:C}=zS(S),{escapeKey:O,outsidePress:J}=zS(w),G=V.useRef(!1),H=ai(Q=>{var W;if(!n||!u||!d||Q.key!=="Escape"||G.current)return;const B=(W=c.current.floatingContext)==null?void 0:W.nodeId,P=T?So(T.nodesRef.current,B):[];if(!k&&(Q.stopPropagation(),P.length>0)){let z=!0;if(P.forEach(ee=>{var A;if((A=ee.context)!=null&&A.open&&!ee.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,jC(Q)?Q.nativeEvent:Q,"escape-key")}),ie=ai(Q=>{var W;const B=()=>{var P;H(Q),(P=Ar(Q))==null||P.removeEventListener("keydown",B)};(W=Ar(Q))==null||W.addEventListener("keydown",B)}),oe=ai(Q=>{var W;const B=c.current.insideReactTree;c.current.insideReactTree=!1;const P=_.current;if(_.current=!1,p==="click"&&P||B||typeof $=="function"&&!$(Q))return;const z=Ar(Q),ee="["+Lu("inert")+"]",A=Jn(o.floating).querySelectorAll(ee);let I=ht(z)?z:null;for(;I&&!Ki(I);){const ue=qi(I);if(Ki(ue)||!ht(ue))break;I=ue}if(A.length&&ht(z)&&!$C(z)&&!Sn(z,o.floating)&&Array.from(A).every(ue=>!Sn(I,ue)))return;if(Mt(z)&&be){const ue=Ki(z),le=Kn(z),rt=/auto|scroll/,Ve=ue||rt.test(le.overflowX),wn=ue||rt.test(le.overflowY),Zi=Ve&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,wi=wn&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,we=le.direction==="rtl",Me=wi&&(we?Q.offsetX<=z.offsetWidth-z.clientWidth:Q.offsetX>z.clientWidth),Ee=Zi&&Q.offsetY>z.clientHeight;if(Me||Ee)return}const te=(W=c.current.floatingContext)==null?void 0:W.nodeId,X=T&&So(T.nodesRef.current,te).some(ue=>{var le;return Fh(Q,(le=ue.context)==null?void 0:le.elements.floating)});if(Fh(Q,o.floating)||Fh(Q,o.domReference)||X)return;const se=T?So(T.nodesRef.current,te):[];if(se.length>0){let ue=!0;if(se.forEach(le=>{var rt;if((rt=le.context)!=null&&rt.open&&!le.context.dataRef.current.__outsidePressBubbles){ue=!1;return}}),!ue)return}r(!1,Q,"outside-press")}),fe=ai(Q=>{var W;const B=()=>{var P;oe(Q),(P=Ar(Q))==null||P.removeEventListener(p,B)};(W=Ar(Q))==null||W.addEventListener(p,B)});V.useEffect(()=>{if(!n||!u)return;c.current.__escapeKeyBubbles=k,c.current.__outsidePressBubbles=C;let Q=-1;function W(A){r(!1,A,"ancestor-scroll")}function B(){window.clearTimeout(Q),G.current=!0}function P(){Q=window.setTimeout(()=>{G.current=!1},of()?5:0)}const z=Jn(o.floating);d&&(z.addEventListener("keydown",O?ie:H,O),z.addEventListener("compositionstart",B),z.addEventListener("compositionend",P)),$&&z.addEventListener(p,J?fe:oe,J);let ee=[];return v&&(ht(o.domReference)&&(ee=kr(o.domReference)),ht(o.floating)&&(ee=ee.concat(kr(o.floating))),!ht(o.reference)&&o.reference&&o.reference.contextElement&&(ee=ee.concat(kr(o.reference.contextElement)))),ee=ee.filter(A=>{var I;return A!==((I=z.defaultView)==null?void 0:I.visualViewport)}),ee.forEach(A=>{A.addEventListener("scroll",W,{passive:!0})}),()=>{d&&(z.removeEventListener("keydown",O?ie:H,O),z.removeEventListener("compositionstart",B),z.removeEventListener("compositionend",P)),$&&z.removeEventListener(p,J?fe:oe,J),ee.forEach(A=>{A.removeEventListener("scroll",W)}),window.clearTimeout(Q)}},[c,o,d,$,p,n,r,v,u,k,C,H,O,ie,oe,J,fe]),V.useEffect(()=>{c.current.insideReactTree=!1},[c,$,p]);const ge=V.useMemo(()=>({onKeyDown:H,...y&&{[GD[g]]:Q=>{r(!1,Q.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Q){r(!1,Q.nativeEvent,"reference-press")}}}}),[H,r,y,g]),be=V.useMemo(()=>({onKeyDown:H,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[YD[p]]:()=>{c.current.insideReactTree=!0}}),[H,p,c]);return V.useMemo(()=>u?{reference:ge,floating:be}:{},[u,ge,be])}function XD(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=iT(),c=V.useRef({}),[u]=V.useState(()=>MD()),d=rT()!=null,[h,p]=V.useState(r.reference),y=ai((S,w,T)=>{c.current.openEvent=S?w:void 0,u.emit("openchange",{open:S,event:w,reason:T,nested:d}),n?.(S,w,T)}),g=V.useMemo(()=>({setPositionReference:p}),[]),v=V.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return V.useMemo(()=>({dataRef:c,open:e,onOpenChange:y,elements:v,events:u,floatingId:o,refs:g}),[e,y,v,u,o,g])}function ZD(t){t===void 0&&(t={});const{nodeId:e}=t,n=XD({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[c,u]=V.useState(null),[d,h]=V.useState(null),y=o?.domReference||c,g=V.useRef(null),v=ry();zi(()=>{y&&(g.current=y)},[y]);const S=xD({...t,elements:{...o,...d&&{reference:d}}}),w=V.useCallback(k=>{const C=ht(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;h(C),S.refs.setReference(C)},[S.refs]),T=V.useCallback(k=>{(ht(k)||k===null)&&(g.current=k,u(k)),(ht(S.refs.reference.current)||S.refs.reference.current===null||k!==null&&!ht(k))&&S.refs.setReference(k)},[S.refs]),D=V.useMemo(()=>({...S.refs,setReference:T,setPositionReference:w,domReference:g}),[S.refs,T,w]),$=V.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),_=V.useMemo(()=>({...S,...r,refs:D,elements:$,nodeId:e}),[S,D,$,e,r]);return zi(()=>{r.dataRef.current.floatingContext=_;const k=v?.nodesRef.current.find(C=>C.id===e);k&&(k.context=_)}),V.useMemo(()=>({...S,context:_,refs:D,elements:$}),[S,D,$,_])}function Qh(t,e,n){const r=new Map,o=n==="item";let c=t;if(o&&t){const{[OS]:u,[_S]:d,...h}=t;c=h}return{...n==="floating"&&{tabIndex:-1,[ED]:""},...c,...e.map(u=>{const d=u?u[n]:null;return typeof d=="function"?t?d(t):null:d}).concat(t).reduce((u,d)=>(d&&Object.entries(d).forEach(h=>{let[p,y]=h;if(!(o&&[OS,_S].includes(p)))if(p.indexOf("on")===0){if(r.has(p)||r.set(p,[]),typeof y=="function"){var g;(g=r.get(p))==null||g.push(y),u[p]=function(){for(var v,S=arguments.length,w=new Array(S),T=0;T<S;T++)w[T]=arguments[T];return(v=r.get(p))==null?void 0:v.map(D=>D(...w)).find(D=>D!==void 0)}}}else u[p]=y}),u),{})}}function QD(t){t===void 0&&(t=[]);const e=t.map(d=>d?.reference),n=t.map(d=>d?.floating),r=t.map(d=>d?.item),o=V.useCallback(d=>Qh(d,t,"reference"),e),c=V.useCallback(d=>Qh(d,t,"floating"),n),u=V.useCallback(d=>Qh(d,t,"item"),r);return V.useMemo(()=>({getReferenceProps:o,getFloatingProps:c,getItemProps:u}),[o,c,u])}const WD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function eN(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:c,floatingId:u}=t,{enabled:d=!0,role:h="dialog"}=e,p=iT(),y=((n=c.domReference)==null?void 0:n.id)||p,g=V.useMemo(()=>{var _;return((_=Pp(c.floating))==null?void 0:_.id)||u},[c.floating,u]),v=(r=WD.get(h))!=null?r:h,w=rT()!=null,T=V.useMemo(()=>v==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":v==="alertdialog"?"dialog":v,"aria-controls":o?g:void 0,...v==="listbox"&&{role:"combobox"},...v==="menu"&&{id:y},...v==="menu"&&w&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[v,g,w,o,y,h]),D=V.useMemo(()=>{const _={id:g,...v&&{role:v}};return v==="tooltip"||h==="label"?_:{..._,...v==="menu"&&{"aria-labelledby":y}}},[v,g,y,h]),$=V.useCallback(_=>{let{active:k,selected:C}=_;const O={role:"option",...k&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{...O,"aria-selected":C}}return{}},[g,h]);return V.useMemo(()=>d?{reference:T,floating:D,item:$}:{},[d,T,D,$])}const Sl=t=>Array.isArray(t)?t:[t],tN=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},oT=Array,ns=(t,e)=>t.includes(e),nN=(t,e=0)=>[...new Array(t)].map((n,r)=>r+e),Ie=(t,e,n)=>t===void 0?e===void 0?[]:Array.isArray(e)?e:[e]:(Array.isArray(e)?t.push(...e):t.push(e),t),ss=(t,e)=>e==null?t??[]:t==null?Sl(e):t.concat(e),iN=(...t)=>t.reduce(ss,[]),cs=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((o,c)=>o===c);for(const o of Sl(e))t.some(c=>r(c,o))||t.push(o);return t},rN=(t,e)=>t.reduce((n,r)=>{const o=r[e];return n[o]=Ie(n[o],r),n},{}),Do=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,o)=>n.isEqual(r,e[o]):(r,o)=>r===e[o]),bs=(t,e)=>Xn(t)===e,Xn=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Ii={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},sN={...Ii,function:"a function"};class oN extends Error{}const Et=t=>No(t,oN),No=(t,e=Error)=>{throw new e(t)};class aN extends Error{name="ParseError"}const Z=t=>No(t,aN),aT=t=>` ${t}`,He=(t,e)=>{const n={},r=Array.isArray(t);let o=!1;for(const[c,u]of Object.entries(t).entries()){const d=r?e(c,u[1]):e(...u,c);o||=typeof d[0]=="number";const h=Array.isArray(d[0])||d.length===0?d:[d];for(const[p,y]of h)typeof p=="object"?n[p.group]=Ie(n[p.group],y):n[p]=y}return o?Object.values(n):n},lT=Object.entries,vi=(t,e)=>t in e,ay=(t,e)=>e in t;class lN{constructor(e){Object.assign(this,e)}}const cN=class{};class cT extends cN{}const uN=(t,e)=>{const n={},r={};let o;for(o in t)o in e?n[o]=t[o]:r[o]=t[o];return[n,r]},fN=(t,e)=>uN(t,e)[1],xl=t=>Object.keys(t).length===0,Vu=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],dN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),hN=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},Ui=aT("represents an uninitialized value"),pN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),uT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},fT=globalThis.File??Blob,dT={ArrayBuffer,Blob,File:fT,FormData,Headers,Request,Response,URL},mN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},$o={...uT,...dT,...mN,String,Number,Boolean},ly=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!vi(e.constructor.name,$o)||!(t instanceof $o[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},qp=t=>typeof t=="object"&&t!==null?ly(t)??"object":Xn(t),Yt=Array.isArray,yN={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"},gN={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"},bN={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"},vN={...yN,...gN,...bN},cy=t=>{const e=Object(t).name??null;return e&&vi(e,$o)&&$o[e]===t?e:null},KS=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},SN=t=>hT(t,new Map),hT=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=cy(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)),o=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,r);for(const c in o){const u=o[c];"get"in u||"set"in u||(u.value=hT(u.value,e))}}return Object.defineProperties(r,o),r},xN=t=>{let e=Ui;return()=>e===Ui?e=t():e},ff=t=>typeof t=="function"&&t.length===0,wN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(r){return Et(`Encountered an unexpected error while compiling your definition:
66
+ */var pC=["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])"],Nu=pC.join(","),U1=typeof Element>"u",Co=U1?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,$u=!U1&&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},ju=function t(e,n){var r;n===void 0&&(n=!0);var o=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),c=o===""||o==="true",u=c||n&&e&&t(e.parentNode);return u},mC=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},z1=function(e,n,r){if(ju(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll(Nu));return n&&Co.call(e,Nu)&&o.unshift(e),o=o.filter(r),o},K1=function t(e,n,r){for(var o=[],c=Array.from(e);c.length;){var u=c.shift();if(!ju(u,!1))if(u.tagName==="SLOT"){var d=u.assignedElements(),h=d.length?d:u.children,p=t(h,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:u,candidates:p})}else{var y=Co.call(u,Nu);y&&r.filter(u)&&(n||!e.includes(u))&&o.push(u);var g=u.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(u),v=!ju(g,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(u));if(g&&v){var S=t(g===!0?u.children:g.children,!0,r);r.flatten?o.push.apply(o,S):o.push({scopeParent:u,candidates:S})}else c.unshift.apply(c,u.children)}}return o},P1=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},q1=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||mC(e))&&!P1(e)?0:e.tabIndex},yC=function(e,n){var r=q1(e);return r<0&&n&&!P1(e)?0:r},gC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},I1=function(e){return e.tagName==="INPUT"},bC=function(e){return I1(e)&&e.type==="hidden"},vC=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},SC=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},xC=function(e){if(!e.name)return!0;var n=e.form||$u(e),r=function(d){return n.querySelectorAll('input[type="radio"][name="'+d+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(e.name));else try{o=r(e.name)}catch(u){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",u.message),!1}var c=SC(o,e.form);return!c||c===e},wC=function(e){return I1(e)&&e.type==="radio"},TC=function(e){return wC(e)&&!xC(e)},AC=function(e){var n,r=e&&$u(e),o=(n=r)===null||n===void 0?void 0:n.host,c=!1;if(r&&r!==e){var u,d,h;for(c=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!c&&o;){var p,y,g;r=$u(o),o=(p=r)===null||p===void 0?void 0:p.host,c=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return c},bS=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},EC=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var c=Co.call(e,"details>summary:first-of-type"),u=c?e.parentElement:e;if(Co.call(u,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var h=e.parentElement,p=$u(e);if(h&&!h.shadowRoot&&o(h)===!0)return bS(e);e.assignedSlot?e=e.assignedSlot:!h&&p!==e.ownerDocument?e=p.host:e=h}e=d}if(AC(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return bS(e);return!1},RC=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 o=n.children.item(r);if(o.tagName==="LEGEND")return Co.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},zp=function(e,n){return!(n.disabled||ju(n)||bC(n)||EC(n,e)||vC(n)||RC(n))},Kp=function(e,n){return!(TC(n)||q1(n)<0||!zp(e,n))},OC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},_C=function t(e){var n=[],r=[];return e.forEach(function(o,c){var u=!!o.scopeParent,d=u?o.scopeParent:o,h=yC(d,u),p=u?t(o.candidates):d;h===0?u?n.push.apply(n,p):n.push(d):r.push({documentOrder:c,tabIndex:h,item:o,isScope:u,content:p})}),r.sort(gC).reduce(function(o,c){return c.isScope?o.push.apply(o,c.content):o.push(c.content),o},[]).concat(n)},ny=function(e,n){n=n||{};var r;return n.getShadowRoot?r=K1([e],n.includeContainer,{filter:Kp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:OC}):r=z1(e,n.includeContainer,Kp.bind(null,n)),_C(r)},kC=function(e,n){n=n||{};var r;return n.getShadowRoot?r=K1([e],n.includeContainer,{filter:zp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=z1(e,n.includeContainer,zp.bind(null,n)),r},H1=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Co.call(e,Nu)===!1?!1:Kp(n,e)};function MC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function F1(){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 CC(){return/apple/i.test(navigator.vendor)}function Pp(){const t=/android/i;return t.test(MC())||t.test(F1())}function DC(){return F1().includes("jsdom/")}const vS="data-floating-ui-focusable",NC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function uo(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 Sn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Lp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Ar(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Gh(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 $C(t){return t.matches("html,body")}function Jn(t){return t?.ownerDocument||document}function G1(t){return Mt(t)&&t.matches(NC)}function SS(t){return t?t.getAttribute("role")==="combobox"&&G1(t):!1}function qp(t){return t?t.hasAttribute(vS)?t:t.querySelector("["+vS+"]")||t:null}function So(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var c;return o.parentId===e&&(!n||((c=o.context)==null?void 0:c.open))}).flatMap(o=>[o,...So(t,o.id,n)])}function xS(t,e){var n;let r=[],o=(n=t.find(c=>c.id===e))==null?void 0:n.parentId;for(;o;){const c=t.find(u=>u.id===o);o=c?.parentId,c&&(r=r.concat(c))}return r}function Yh(t){t.preventDefault(),t.stopPropagation()}function jC(t){return"nativeEvent"in t}function BC(t){return t.mozInputSource===0&&t.isTrusted?!0:Pp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function LC(t){return DC()?!1:!Pp()&&t.width===0&&t.height===0||Pp()&&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 wS(t,e){return["mouse","pen"].includes(t)}var VC=typeof document<"u",UC=function(){},zi=VC?V.useLayoutEffect:UC;const zC={..._1};function Jh(t){const e=V.useRef(t);return zi(()=>{e.current=t}),e}const KC=zC.useInsertionEffect,PC=KC||(t=>t());function ai(t){const e=V.useRef(()=>{});return PC(()=>{e.current=t}),V.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.current==null?void 0:e.current(...r)},[])}const ff=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Y1(t,e){const n=ny(t,ff()),r=n.length;if(r===0)return;const o=uo(Jn(t)),c=n.indexOf(o),u=c===-1?e===1?0:r-1:c+e;return n[u]}function qC(t){return Y1(Jn(t).body,1)||t}function IC(t){return Y1(Jn(t).body,-1)||t}function TS(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Sn(n,r)}var HC=N1();function AS(t,e,n){let{reference:r,floating:o}=t;const c=Rr(e),u=V1(e),d=L1(u),h=ds(e),p=c==="y",y=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,v=r[d]/2-o[d]/2;let S;switch(h){case"top":S={x:y,y:r.y-o.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-o.width,y:g};break;default:S={x:r.x,y:r.y}}switch(uf(e)){case"start":S[u]-=v*(n&&p?-1:1);break;case"end":S[u]+=v*(n&&p?-1:1);break}return S}const FC=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:c=[],platform:u}=n,d=c.filter(Boolean),h=await(u.isRTL==null?void 0:u.isRTL(e));let p=await u.getElementRects({reference:t,floating:e,strategy:o}),{x:y,y:g}=AS(p,r,h),v=r,S={},w=0;for(let T=0;T<d.length;T++){const{name:D,fn:$}=d[T],{x:_,y:k,data:C,reset:O}=await $({x:y,y:g,initialPlacement:r,placement:v,strategy:o,middlewareData:S,rects:p,platform:u,elements:{reference:t,floating:e}});y=_??y,g=k??g,S={...S,[D]:{...S[D],...C}},O&&w<=50&&(w++,typeof O=="object"&&(O.placement&&(v=O.placement),O.rects&&(p=O.rects===!0?await u.getElementRects({reference:t,floating:e,strategy:o}):O.rects),{x:y,y:g}=AS(p,v,h)),T=-1)}return{x:y,y:g,placement:v,strategy:o,middlewareData:S}};async function J1(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:c,rects:u,elements:d,strategy:h}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:S=0}=cf(e,t),w=hC(S),D=d[v?g==="floating"?"reference":"floating":g],$=Du(await c.getClippingRect({element:(n=await(c.isElement==null?void 0:c.isElement(D)))==null||n?D:D.contextElement||await(c.getDocumentElement==null?void 0:c.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:h})),_=g==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,k=await(c.getOffsetParent==null?void 0:c.getOffsetParent(d.floating)),C=await(c.isElement==null?void 0:c.isElement(k))?await(c.getScale==null?void 0:c.getScale(k))||{x:1,y:1}:{x:1,y:1},O=Du(c.convertOffsetParentRelativeRectToViewportRelativeRect?await c.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:_,offsetParent:k,strategy:h}):_);return{top:($.top-O.top+w.top)/C.y,bottom:(O.bottom-$.bottom+w.bottom)/C.y,left:($.left-O.left+w.left)/C.x,right:(O.right-$.right+w.right)/C.x}}const GC=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:c,rects:u,initialPlacement:d,platform:h,elements:p}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:w="none",flipAlignment:T=!0,...D}=cf(t,e);if((n=c.arrow)!=null&&n.alignmentOffset)return{};const $=ds(o),_=Rr(d),k=ds(d)===d,C=await(h.isRTL==null?void 0:h.isRTL(p.floating)),O=v||(k||!T?[Cu(d)]:aC(d)),J=w!=="none";!v&&J&&O.push(...fC(d,T,w,C));const G=[d,...O],H=await J1(e,D),ie=[];let oe=((r=c.flip)==null?void 0:r.overflows)||[];if(y&&ie.push(H[$]),g){const Q=oC(o,u,C);ie.push(H[Q[0]],H[Q[1]])}if(oe=[...oe,{placement:o,overflows:ie}],!ie.every(Q=>Q<=0)){var fe,ge;const Q=(((fe=c.flip)==null?void 0:fe.index)||0)+1,W=G[Q];if(W&&(!(g==="alignment"?_!==Rr(W):!1)||oe.every(z=>Rr(z.placement)===_?z.overflows[0]>0:!0)))return{data:{index:Q,overflows:oe},reset:{placement:W}};let B=(ge=oe.filter(P=>P.overflows[0]<=0).sort((P,z)=>P.overflows[1]-z.overflows[1])[0])==null?void 0:ge.placement;if(!B)switch(S){case"bestFit":{var be;const P=(be=oe.filter(z=>{if(J){const ee=Rr(z.placement);return ee===_||ee==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ee=>ee>0).reduce((ee,A)=>ee+A,0)]).sort((z,ee)=>z[1]-ee[1])[0])==null?void 0:be[0];P&&(B=P);break}case"initialPlacement":B=d;break}if(o!==B)return{reset:{placement:B}}}return{}}}},YC=new Set(["left","top"]);async function JC(t,e){const{placement:n,platform:r,elements:o}=t,c=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=ds(n),d=uf(n),h=Rr(n)==="y",p=YC.has(u)?-1:1,y=c&&h?-1:1,g=cf(e,t);let{mainAxis:v,crossAxis:S,alignmentAxis:w}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof w=="number"&&(S=d==="end"?w*-1:w),h?{x:S*y,y:v*p}:{x:v*p,y:S*y}}const XC=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:c,placement:u,middlewareData:d}=e,h=await JC(e,t);return u===((n=d.offset)==null?void 0:n.placement)&&(r=d.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:c+h.y,data:{...h,placement:u}}}}},ZC=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:D=>{let{x:$,y:_}=D;return{x:$,y:_}}},...h}=cf(t,e),p={x:n,y:r},y=await J1(e,h),g=Rr(ds(o)),v=B1(g);let S=p[v],w=p[g];if(c){const D=v==="y"?"top":"left",$=v==="y"?"bottom":"right",_=S+y[D],k=S-y[$];S=mS(_,S,k)}if(u){const D=g==="y"?"top":"left",$=g==="y"?"bottom":"right",_=w+y[D],k=w-y[$];w=mS(_,w,k)}const T=d.fn({...e,[v]:S,[g]:w});return{...T,data:{x:T.x-n,y:T.y-r,enabled:{[v]:c,[g]:u}}}}}};function X1(t){const e=Kn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=Mt(t),c=o?t.offsetWidth:n,u=o?t.offsetHeight:r,d=Mu(n)!==c||Mu(r)!==u;return d&&(n=c,r=u),{width:n,height:r,$:d}}function iy(t){return ht(t)?t:t.contextElement}function xo(t){const e=iy(t);if(!Mt(e))return ci(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:c}=X1(e);let u=(c?Mu(n.width):n.width)/r,d=(c?Mu(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const QC=ci(0);function Z1(t){const e=xn(t);return!af()||!e.visualViewport?QC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function WC(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==xn(t)?!1:e}function hs(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),c=iy(t);let u=ci(1);e&&(r?ht(r)&&(u=xo(r)):u=xo(t));const d=WC(c,n,r)?Z1(c):ci(0);let h=(o.left+d.x)/u.x,p=(o.top+d.y)/u.y,y=o.width/u.x,g=o.height/u.y;if(c){const v=xn(c),S=r&&ht(r)?xn(r):r;let w=v,T=Vp(w);for(;T&&r&&S!==w;){const D=xo(T),$=T.getBoundingClientRect(),_=Kn(T),k=$.left+(T.clientLeft+parseFloat(_.paddingLeft))*D.x,C=$.top+(T.clientTop+parseFloat(_.paddingTop))*D.y;h*=D.x,p*=D.y,y*=D.x,g*=D.y,h+=k,p+=C,w=xn(T),T=Vp(w)}}return Du({width:y,height:g,x:h,y:p})}function ry(t,e){const n=lf(t).scrollLeft;return e?e.left+n:hs(bi(t)).left+n}function Q1(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:ry(t,r)),c=r.top+e.scrollTop;return{x:o,y:c}}function eD(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const c=o==="fixed",u=bi(r),d=e?of(e.floating):!1;if(r===u||d&&c)return n;let h={scrollLeft:0,scrollTop:0},p=ci(1);const y=ci(0),g=Mt(r);if((g||!g&&!c)&&((jr(r)!=="body"||vl(u))&&(h=lf(r)),Mt(r))){const S=hs(r);p=xo(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const v=u&&!g&&!c?Q1(u,h,!0):ci(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+y.x+v.x,y:n.y*p.y-h.scrollTop*p.y+y.y+v.y}}function tD(t){return Array.from(t.getClientRects())}function nD(t){const e=bi(t),n=lf(t),r=t.ownerDocument.body,o=ls(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),c=ls(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+ry(t);const d=-n.scrollTop;return Kn(r).direction==="rtl"&&(u+=ls(e.clientWidth,r.clientWidth)-o),{width:o,height:c,x:u,y:d}}function iD(t,e){const n=xn(t),r=bi(t),o=n.visualViewport;let c=r.clientWidth,u=r.clientHeight,d=0,h=0;if(o){c=o.width,u=o.height;const p=af();(!p||p&&e==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}return{width:c,height:u,x:d,y:h}}const rD=new Set(["absolute","fixed"]);function sD(t,e){const n=hs(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,c=Mt(t)?xo(t):ci(1),u=t.clientWidth*c.x,d=t.clientHeight*c.y,h=o*c.x,p=r*c.y;return{width:u,height:d,x:h,y:p}}function ES(t,e,n){let r;if(e==="viewport")r=iD(t,n);else if(e==="document")r=nD(bi(t));else if(ht(e))r=sD(e,n);else{const o=Z1(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Du(r)}function W1(t,e){const n=qi(t);return n===e||!ht(n)||Ki(n)?!1:Kn(n).position==="fixed"||W1(n,e)}function oD(t,e){const n=e.get(t);if(n)return n;let r=kr(t,[],!1).filter(d=>ht(d)&&jr(d)!=="body"),o=null;const c=Kn(t).position==="fixed";let u=c?qi(t):t;for(;ht(u)&&!Ki(u);){const d=Kn(u),h=ty(u);!h&&d.position==="fixed"&&(o=null),(c?!h&&!o:!h&&d.position==="static"&&!!o&&rD.has(o.position)||vl(u)&&!h&&W1(t,u))?r=r.filter(y=>y!==u):o=d,u=qi(u)}return e.set(t,r),r}function aD(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const u=[...n==="clippingAncestors"?of(e)?[]:oD(e,this._c):[].concat(n),r],d=u[0],h=u.reduce((p,y)=>{const g=ES(e,y,o);return p.top=ls(g.top,p.top),p.right=ku(g.right,p.right),p.bottom=ku(g.bottom,p.bottom),p.left=ls(g.left,p.left),p},ES(e,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function lD(t){const{width:e,height:n}=X1(t);return{width:e,height:n}}function cD(t,e,n){const r=Mt(e),o=bi(e),c=n==="fixed",u=hs(t,!0,c,e);let d={scrollLeft:0,scrollTop:0};const h=ci(0);function p(){h.x=ry(o)}if(r||!r&&!c)if((jr(e)!=="body"||vl(o))&&(d=lf(e)),r){const S=hs(e,!0,c,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else o&&p();c&&!r&&o&&p();const y=o&&!r&&!c?Q1(o,d):ci(0),g=u.left+d.scrollLeft-h.x-y.x,v=u.top+d.scrollTop-h.y-y.y;return{x:g,y:v,width:u.width,height:u.height}}function Xh(t){return Kn(t).position==="static"}function RS(t,e){if(!Mt(t)||Kn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return bi(t)===n&&(n=n.ownerDocument.body),n}function eT(t,e){const n=xn(t);if(of(t))return n;if(!Mt(t)){let o=qi(t);for(;o&&!Ki(o);){if(ht(o)&&!Xh(o))return o;o=qi(o)}return n}let r=RS(t,e);for(;r&&XM(r)&&Xh(r);)r=RS(r,e);return r&&Ki(r)&&Xh(r)&&!ty(r)?n:r||tC(t)||n}const uD=async function(t){const e=this.getOffsetParent||eT,n=this.getDimensions,r=await n(t.floating);return{reference:cD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function fD(t){return Kn(t).direction==="rtl"}const dD={convertOffsetParentRelativeRectToViewportRelativeRect:eD,getDocumentElement:bi,getClippingRect:aD,getOffsetParent:eT,getElementRects:uD,getClientRects:tD,getDimensions:lD,getScale:xo,isElement:ht,isRTL:fD};function tT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function hD(t,e){let n=null,r;const o=bi(t);function c(){var d;clearTimeout(r),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),c();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:S}=p;if(d||e(),!v||!S)return;const w=Xc(g),T=Xc(o.clientWidth-(y+v)),D=Xc(o.clientHeight-(g+S)),$=Xc(y),k={rootMargin:-w+"px "+-T+"px "+-D+"px "+-$+"px",threshold:ls(0,ku(1,h))||1};let C=!0;function O(J){const G=J[0].intersectionRatio;if(G!==h){if(!C)return u();G?u(!1,G):r=setTimeout(()=>{u(!1,1e-7)},1e3)}G===1&&!tT(p,t.getBoundingClientRect())&&u(),C=!1}try{n=new IntersectionObserver(O,{...k,root:o.ownerDocument})}catch{n=new IntersectionObserver(O,k)}n.observe(t)}return u(!0),c}function pD(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:c=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=iy(t),y=o||c?[...p?kr(p):[],...kr(e)]:[];y.forEach($=>{o&&$.addEventListener("scroll",n,{passive:!0}),c&&$.addEventListener("resize",n)});const g=p&&d?hD(p,n):null;let v=-1,S=null;u&&(S=new ResizeObserver($=>{let[_]=$;_&&_.target===p&&S&&(S.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var k;(k=S)==null||k.observe(e)})),n()}),p&&!h&&S.observe(p),S.observe(e));let w,T=h?hs(t):null;h&&D();function D(){const $=hs(t);T&&!tT(T,$)&&n(),T=$,w=requestAnimationFrame(D)}return n(),()=>{var $;y.forEach(_=>{o&&_.removeEventListener("scroll",n),c&&_.removeEventListener("resize",n)}),g?.(),($=S)==null||$.disconnect(),S=null,h&&cancelAnimationFrame(w)}}const mD=XC,yD=ZC,gD=GC,bD=(t,e,n)=>{const r=new Map,o={platform:dD,...n},c={...o.platform,_c:r};return FC(t,e,{...o,platform:c})};var vD=typeof document<"u",SD=function(){},du=vD?V.useLayoutEffect:SD;function Bu(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,o;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(!Bu(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const c=o[r];if(!(c==="_owner"&&t.$$typeof)&&!Bu(t[c],e[c]))return!1}return!0}return t!==t&&e!==e}function nT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function OS(t,e){const n=nT(t);return Math.round(e*n)/n}function Zh(t){const e=V.useRef(t);return du(()=>{e.current=t}),e}function xD(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:c,floating:u}={},transform:d=!0,whileElementsMounted:h,open:p}=t,[y,g]=V.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[v,S]=V.useState(r);Bu(v,r)||S(r);const[w,T]=V.useState(null),[D,$]=V.useState(null),_=V.useCallback(z=>{z!==J.current&&(J.current=z,T(z))},[]),k=V.useCallback(z=>{z!==G.current&&(G.current=z,$(z))},[]),C=c||w,O=u||D,J=V.useRef(null),G=V.useRef(null),H=V.useRef(y),ie=h!=null,oe=Zh(h),fe=Zh(o),ge=Zh(p),be=V.useCallback(()=>{if(!J.current||!G.current)return;const z={placement:e,strategy:n,middleware:v};fe.current&&(z.platform=fe.current),bD(J.current,G.current,z).then(ee=>{const A={...ee,isPositioned:ge.current!==!1};Q.current&&!Bu(H.current,A)&&(H.current=A,HC.flushSync(()=>{g(A)}))})},[v,e,n,fe,ge]);du(()=>{p===!1&&H.current.isPositioned&&(H.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[p]);const Q=V.useRef(!1);du(()=>(Q.current=!0,()=>{Q.current=!1}),[]),du(()=>{if(C&&(J.current=C),O&&(G.current=O),C&&O){if(oe.current)return oe.current(C,O,be);be()}},[C,O,be,oe,ie]);const W=V.useMemo(()=>({reference:J,floating:G,setReference:_,setFloating:k}),[_,k]),B=V.useMemo(()=>({reference:C,floating:O}),[C,O]),P=V.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const ee=OS(B.floating,y.x),A=OS(B.floating,y.y);return d?{...z,transform:"translate("+ee+"px, "+A+"px)",...nT(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ee,top:A}},[n,d,B.floating,y.x,y.y]);return V.useMemo(()=>({...y,update:be,refs:W,elements:B,floatingStyles:P}),[y,be,W,B,P])}const wD=(t,e)=>({...mD(t),options:[t,e]}),TD=(t,e)=>({...yD(t),options:[t,e]}),AD=(t,e)=>({...gD(t),options:[t,e]}),ED="data-floating-ui-focusable",_S="active",kS="selected",RD={..._1};let MS=!1,OD=0;const CS=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+OD++;function _D(){const[t,e]=V.useState(()=>MS?CS():void 0);return zi(()=>{t==null&&e(CS())},[]),V.useEffect(()=>{MS=!0},[]),t}const kD=RD.useId,iT=kD||_D;function MD(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(o=>o(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 CD=V.createContext(null),DD=V.createContext(null),rT=()=>{var t;return((t=V.useContext(CD))==null?void 0:t.id)||null},sy=()=>V.useContext(DD);function Lu(t){return"data-floating-ui-"+t}function ND(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let DS=0;function oo(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(DS);const c=()=>t?.focus({preventScroll:n});o?c():DS=requestAnimationFrame(c)}function $D(t){return t?.ownerDocument||document}const wo={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function NS(t){return t==="inert"?wo.inert:t==="aria-hidden"?wo["aria-hidden"]:wo.none}let Zc=new WeakSet,Qc={},Qh=0;const jD=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,sT=t=>t&&(t.host||sT(t.parentNode)),BD=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=sT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function LD(t,e,n,r){const o="data-floating-ui-inert",c=r?"inert":n?"aria-hidden":null,u=BD(e,t),d=new Set,h=new Set(u),p=[];Qc[o]||(Qc[o]=new WeakMap);const y=Qc[o];u.forEach(g),v(e),d.clear();function g(S){!S||d.has(S)||(d.add(S),S.parentNode&&g(S.parentNode))}function v(S){!S||h.has(S)||[].forEach.call(S.children,w=>{if(jr(w)!=="script")if(d.has(w))v(w);else{const T=c?w.getAttribute(c):null,D=T!==null&&T!=="false",$=NS(c),_=($.get(w)||0)+1,k=(y.get(w)||0)+1;$.set(w,_),y.set(w,k),p.push(w),_===1&&D&&Zc.add(w),k===1&&w.setAttribute(o,""),!D&&c&&w.setAttribute(c,c==="inert"?"":"true")}})}return Qh++,()=>{p.forEach(S=>{const w=NS(c),D=(w.get(S)||0)-1,$=(y.get(S)||0)-1;w.set(S,D),y.set(S,$),D||(!Zc.has(S)&&c&&S.removeAttribute(c),Zc.delete(S)),$||S.removeAttribute(o)}),Qh--,Qh||(wo.inert=new WeakMap,wo["aria-hidden"]=new WeakMap,wo.none=new WeakMap,Zc=new WeakSet,Qc={})}}function $S(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=$D(t[0]).body;return LD(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const oy={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},jS=V.forwardRef(function(e,n){const[r,o]=V.useState();zi(()=>{CC()&&o("button")},[]);const c={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Lu("focus-guard")]:"",style:oy};return Y.jsx("span",{...e,...c})}),VD=V.createContext(null),UD=()=>V.useContext(VD);function BS(t){return V.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const zD=20;let Or=[];function ay(){Or=Or.filter(t=>t.isConnected)}function KD(t){ay(),t&&jr(t)!=="body"&&(Or.push(t),Or.length>zD&&(Or=Or.slice(-20)))}function LS(){return ay(),Or[Or.length-1]}function PD(t){const e=ff();return H1(t,e)?t:ny(t,e)[0]||t}function VS(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=ff(),c=kC(t,r).filter(d=>{const h=d.getAttribute("data-tabindex")||"";return H1(d,r)||d.hasAttribute("data-tabindex")&&!h.startsWith("-")}),u=t.getAttribute("tabindex");e.current.includes("floating")||c.length===0?u!=="0"&&t.setAttribute("tabindex","0"):(u!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const qD=V.forwardRef(function(e,n){return Y.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:oy})});function ID(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:c=!0,initialFocus:u=0,returnFocus:d=!0,restoreFocus:h=!1,modal:p=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:v=!1,getInsideElements:S=()=>[]}=t,{open:w,onOpenChange:T,events:D,dataRef:$,elements:{domReference:_,floating:k}}=e,C=ai(()=>{var we;return(we=$.current.floatingContext)==null?void 0:we.nodeId}),O=ai(S),J=typeof u=="number"&&u<0,G=SS(_)&&J,H=jD(),ie=H?c:!0,oe=!ie||H&&v,fe=Jh(o),ge=Jh(u),be=Jh(d),Q=sy(),W=UD(),B=V.useRef(null),P=V.useRef(null),z=V.useRef(!1),ee=V.useRef(!1),A=V.useRef(-1),I=V.useRef(-1),te=W!=null,X=qp(k),se=ai(function(we){return we===void 0&&(we=X),we?ny(we,ff()):[]}),ue=ai(we=>{const Me=se(we);return fe.current.map(Ee=>_&&Ee==="reference"?_:X&&Ee==="floating"?X:Me).filter(Boolean).flat()});V.useEffect(()=>{if(r||!p)return;function we(Ee){if(Ee.key==="Tab"){Sn(X,uo(Jn(X)))&&se().length===0&&!G&&Yh(Ee);const tt=ue(),Rt=Ar(Ee);fe.current[0]==="reference"&&Rt===_&&(Yh(Ee),Ee.shiftKey?oo(tt[tt.length-1]):oo(tt[1])),fe.current[1]==="floating"&&Rt===X&&Ee.shiftKey&&(Yh(Ee),oo(tt[0]))}}const Me=Jn(X);return Me.addEventListener("keydown",we),()=>{Me.removeEventListener("keydown",we)}},[r,_,X,p,fe,G,se,ue]),V.useEffect(()=>{if(r||!k)return;function we(Me){const Ee=Ar(Me),Rt=se().indexOf(Ee);Rt!==-1&&(A.current=Rt)}return k.addEventListener("focusin",we),()=>{k.removeEventListener("focusin",we)}},[r,k,se]),V.useEffect(()=>{if(r||!g)return;function we(){ee.current=!0,setTimeout(()=>{ee.current=!1})}function Me(Rt){const Te=Rt.relatedTarget,Pn=Rt.currentTarget,Jt=Ar(Rt);queueMicrotask(()=>{const Pt=C(),Tn=!(Sn(_,Te)||Sn(k,Te)||Sn(Te,k)||Sn(W?.portalNode,Te)||Te!=null&&Te.hasAttribute(Lu("focus-guard"))||Q&&(So(Q.nodesRef.current,Pt).find(Qn=>{var An,Wn;return Sn((An=Qn.context)==null?void 0:An.elements.floating,Te)||Sn((Wn=Qn.context)==null?void 0:Wn.elements.domReference,Te)})||xS(Q.nodesRef.current,Pt).find(Qn=>{var An,Wn,jl;return[(An=Qn.context)==null?void 0:An.elements.floating,qp((Wn=Qn.context)==null?void 0:Wn.elements.floating)].includes(Te)||((jl=Qn.context)==null?void 0:jl.elements.domReference)===Te})));if(Pn===_&&X&&VS(X,fe),h&&Pn!==_&&!(Jt!=null&&Jt.isConnected)&&uo(Jn(X))===Jn(X).body){Mt(X)&&X.focus();const Qn=A.current,An=se(),Wn=An[Qn]||An[An.length-1]||X;Mt(Wn)&&Wn.focus()}if($.current.insideReactTree){$.current.insideReactTree=!1;return}(G||!p)&&Te&&Tn&&!ee.current&&Te!==LS()&&(z.current=!0,T(!1,Rt,"focus-out"))})}const Ee=!!(!Q&&W);function tt(){ND(I),$.current.insideReactTree=!0,I.current=window.setTimeout(()=>{$.current.insideReactTree=!1})}if(k&&Mt(_))return _.addEventListener("focusout",Me),_.addEventListener("pointerdown",we),k.addEventListener("focusout",Me),Ee&&k.addEventListener("focusout",tt,!0),()=>{_.removeEventListener("focusout",Me),_.removeEventListener("pointerdown",we),k.removeEventListener("focusout",Me),Ee&&k.removeEventListener("focusout",tt,!0)}},[r,_,k,X,p,Q,W,T,g,h,se,G,C,fe,$]);const le=V.useRef(null),rt=V.useRef(null),Ve=BS([le,W?.beforeInsideRef]),wn=BS([rt,W?.afterInsideRef]);V.useEffect(()=>{var we,Me;if(r||!k)return;const Ee=Array.from((W==null||(we=W.portalNode)==null?void 0:we.querySelectorAll("["+Lu("portal")+"]"))||[]),Rt=(Me=(Q?xS(Q.nodesRef.current,C()):[]).find(Jt=>{var Pt;return SS(((Pt=Jt.context)==null?void 0:Pt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,Te=[k,Rt,...Ee,...O(),B.current,P.current,le.current,rt.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,fe.current.includes("reference")||G?_:null].filter(Jt=>Jt!=null),Pn=p||G?$S(Te,!oe,oe):$S(Te);return()=>{Pn()}},[r,_,k,p,fe,W,G,ie,oe,Q,C,O]),zi(()=>{if(r||!Mt(X))return;const we=Jn(X),Me=uo(we);queueMicrotask(()=>{const Ee=ue(X),tt=ge.current,Rt=(typeof tt=="number"?Ee[tt]:tt.current)||X,Te=Sn(X,Me);!J&&!Te&&w&&oo(Rt,{preventScroll:Rt===X})})},[r,w,X,J,ue,ge]),zi(()=>{if(r||!X)return;const we=Jn(X),Me=uo(we);KD(Me);function Ee(Te){let{reason:Pn,event:Jt,nested:Pt}=Te;if(["hover","safe-polygon"].includes(Pn)&&Jt.type==="mouseleave"&&(z.current=!0),Pn==="outside-press")if(Pt)z.current=!1;else if(BC(Jt)||LC(Jt))z.current=!1;else{let Tn=!1;document.createElement("div").focus({get preventScroll(){return Tn=!0,!1}}),Tn?z.current=!1:z.current=!0}}D.on("openchange",Ee);const tt=we.createElement("span");tt.setAttribute("tabindex","-1"),tt.setAttribute("aria-hidden","true"),Object.assign(tt.style,oy),te&&_&&_.insertAdjacentElement("afterend",tt);function Rt(){if(typeof be.current=="boolean"){const Te=_||LS();return Te&&Te.isConnected?Te:tt}return be.current.current||tt}return()=>{D.off("openchange",Ee);const Te=uo(we),Pn=Sn(k,Te)||Q&&So(Q.nodesRef.current,C(),!1).some(Pt=>{var Tn;return Sn((Tn=Pt.context)==null?void 0:Tn.elements.floating,Te)}),Jt=Rt();queueMicrotask(()=>{const Pt=PD(Jt);be.current&&!z.current&&Mt(Pt)&&(!(Pt!==Te&&Te!==we.body)||Pn)&&Pt.focus({preventScroll:!0}),tt.remove()})}},[r,k,X,be,$,D,Q,te,_,C]),V.useEffect(()=>(queueMicrotask(()=>{z.current=!1}),()=>{queueMicrotask(ay)}),[r]),zi(()=>{if(!r&&W)return W.setFocusManagerState({modal:p,closeOnFocusOut:g,open:w,onOpenChange:T,domReference:_}),()=>{W.setFocusManagerState(null)}},[r,W,p,w,T,g,_]),zi(()=>{r||X&&VS(X,fe)},[r,X,fe]);function Zi(we){return r||!y||!p?null:Y.jsx(qD,{ref:we==="start"?B:P,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const wi=!r&&ie&&(p?!G:!0)&&(te||p);return Y.jsxs(Y.Fragment,{children:[wi&&Y.jsx(jS,{"data-type":"inside",ref:Ve,onFocus:we=>{if(p){const Ee=ue();oo(o[0]==="reference"?Ee[0]:Ee[Ee.length-1])}else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(z.current=!1,TS(we,W.portalNode)){const Ee=qC(_);Ee?.focus()}else{var Me;(Me=W.beforeOutsideRef.current)==null||Me.focus()}}}),!G&&Zi("start"),n,Zi("end"),wi&&Y.jsx(jS,{"data-type":"inside",ref:wn,onFocus:we=>{if(p)oo(ue()[0]);else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(g&&(z.current=!0),TS(we,W.portalNode)){const Ee=IC(_);Ee?.focus()}else{var Me;(Me=W.afterOutsideRef.current)==null||Me.focus()}}})]})}function US(t){return Mt(t.target)&&t.target.tagName==="BUTTON"}function HD(t){return Mt(t.target)&&t.target.tagName==="A"}function zS(t){return G1(t)}function FD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:c}}=t,{enabled:u=!0,event:d="click",toggle:h=!0,ignoreMouse:p=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,v=V.useRef(),S=V.useRef(!1),w=V.useMemo(()=>({onPointerDown(T){v.current=T.pointerType},onMouseDown(T){const D=v.current;T.button===0&&d!=="click"&&(wS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="mousedown")?r(!1,T.nativeEvent,"click"):(T.preventDefault(),r(!0,T.nativeEvent,"click"))))},onClick(T){const D=v.current;if(d==="mousedown"&&v.current){v.current=void 0;return}wS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="click")?r(!1,T.nativeEvent,"click"):r(!0,T.nativeEvent,"click"))},onKeyDown(T){v.current=void 0,!(T.defaultPrevented||!y||US(T))&&(T.key===" "&&!zS(c)&&(T.preventDefault(),S.current=!0),!HD(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||US(T)||zS(c)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[o,c,d,p,y,r,n,g,h]);return V.useMemo(()=>u?{reference:w}:{},[u,w])}const GD={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},YD={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},KS=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 JD(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:c}=t,{enabled:u=!0,escapeKey:d=!0,outsidePress:h=!0,outsidePressEvent:p="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:v=!1,bubbles:S,capture:w}=e,T=sy(),D=ai(typeof h=="function"?h:()=>!1),$=typeof h=="function"?D:h,_=V.useRef(!1),{escapeKey:k,outsidePress:C}=KS(S),{escapeKey:O,outsidePress:J}=KS(w),G=V.useRef(!1),H=ai(Q=>{var W;if(!n||!u||!d||Q.key!=="Escape"||G.current)return;const B=(W=c.current.floatingContext)==null?void 0:W.nodeId,P=T?So(T.nodesRef.current,B):[];if(!k&&(Q.stopPropagation(),P.length>0)){let z=!0;if(P.forEach(ee=>{var A;if((A=ee.context)!=null&&A.open&&!ee.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,jC(Q)?Q.nativeEvent:Q,"escape-key")}),ie=ai(Q=>{var W;const B=()=>{var P;H(Q),(P=Ar(Q))==null||P.removeEventListener("keydown",B)};(W=Ar(Q))==null||W.addEventListener("keydown",B)}),oe=ai(Q=>{var W;const B=c.current.insideReactTree;c.current.insideReactTree=!1;const P=_.current;if(_.current=!1,p==="click"&&P||B||typeof $=="function"&&!$(Q))return;const z=Ar(Q),ee="["+Lu("inert")+"]",A=Jn(o.floating).querySelectorAll(ee);let I=ht(z)?z:null;for(;I&&!Ki(I);){const ue=qi(I);if(Ki(ue)||!ht(ue))break;I=ue}if(A.length&&ht(z)&&!$C(z)&&!Sn(z,o.floating)&&Array.from(A).every(ue=>!Sn(I,ue)))return;if(Mt(z)&&be){const ue=Ki(z),le=Kn(z),rt=/auto|scroll/,Ve=ue||rt.test(le.overflowX),wn=ue||rt.test(le.overflowY),Zi=Ve&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,wi=wn&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,we=le.direction==="rtl",Me=wi&&(we?Q.offsetX<=z.offsetWidth-z.clientWidth:Q.offsetX>z.clientWidth),Ee=Zi&&Q.offsetY>z.clientHeight;if(Me||Ee)return}const te=(W=c.current.floatingContext)==null?void 0:W.nodeId,X=T&&So(T.nodesRef.current,te).some(ue=>{var le;return Gh(Q,(le=ue.context)==null?void 0:le.elements.floating)});if(Gh(Q,o.floating)||Gh(Q,o.domReference)||X)return;const se=T?So(T.nodesRef.current,te):[];if(se.length>0){let ue=!0;if(se.forEach(le=>{var rt;if((rt=le.context)!=null&&rt.open&&!le.context.dataRef.current.__outsidePressBubbles){ue=!1;return}}),!ue)return}r(!1,Q,"outside-press")}),fe=ai(Q=>{var W;const B=()=>{var P;oe(Q),(P=Ar(Q))==null||P.removeEventListener(p,B)};(W=Ar(Q))==null||W.addEventListener(p,B)});V.useEffect(()=>{if(!n||!u)return;c.current.__escapeKeyBubbles=k,c.current.__outsidePressBubbles=C;let Q=-1;function W(A){r(!1,A,"ancestor-scroll")}function B(){window.clearTimeout(Q),G.current=!0}function P(){Q=window.setTimeout(()=>{G.current=!1},af()?5:0)}const z=Jn(o.floating);d&&(z.addEventListener("keydown",O?ie:H,O),z.addEventListener("compositionstart",B),z.addEventListener("compositionend",P)),$&&z.addEventListener(p,J?fe:oe,J);let ee=[];return v&&(ht(o.domReference)&&(ee=kr(o.domReference)),ht(o.floating)&&(ee=ee.concat(kr(o.floating))),!ht(o.reference)&&o.reference&&o.reference.contextElement&&(ee=ee.concat(kr(o.reference.contextElement)))),ee=ee.filter(A=>{var I;return A!==((I=z.defaultView)==null?void 0:I.visualViewport)}),ee.forEach(A=>{A.addEventListener("scroll",W,{passive:!0})}),()=>{d&&(z.removeEventListener("keydown",O?ie:H,O),z.removeEventListener("compositionstart",B),z.removeEventListener("compositionend",P)),$&&z.removeEventListener(p,J?fe:oe,J),ee.forEach(A=>{A.removeEventListener("scroll",W)}),window.clearTimeout(Q)}},[c,o,d,$,p,n,r,v,u,k,C,H,O,ie,oe,J,fe]),V.useEffect(()=>{c.current.insideReactTree=!1},[c,$,p]);const ge=V.useMemo(()=>({onKeyDown:H,...y&&{[GD[g]]:Q=>{r(!1,Q.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Q){r(!1,Q.nativeEvent,"reference-press")}}}}),[H,r,y,g]),be=V.useMemo(()=>({onKeyDown:H,onMouseDown(){_.current=!0},onMouseUp(){_.current=!0},[YD[p]]:()=>{c.current.insideReactTree=!0}}),[H,p,c]);return V.useMemo(()=>u?{reference:ge,floating:be}:{},[u,ge,be])}function XD(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=iT(),c=V.useRef({}),[u]=V.useState(()=>MD()),d=rT()!=null,[h,p]=V.useState(r.reference),y=ai((S,w,T)=>{c.current.openEvent=S?w:void 0,u.emit("openchange",{open:S,event:w,reason:T,nested:d}),n?.(S,w,T)}),g=V.useMemo(()=>({setPositionReference:p}),[]),v=V.useMemo(()=>({reference:h||r.reference||null,floating:r.floating||null,domReference:r.reference}),[h,r.reference,r.floating]);return V.useMemo(()=>({dataRef:c,open:e,onOpenChange:y,elements:v,events:u,floatingId:o,refs:g}),[e,y,v,u,o,g])}function ZD(t){t===void 0&&(t={});const{nodeId:e}=t,n=XD({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[c,u]=V.useState(null),[d,h]=V.useState(null),y=o?.domReference||c,g=V.useRef(null),v=sy();zi(()=>{y&&(g.current=y)},[y]);const S=xD({...t,elements:{...o,...d&&{reference:d}}}),w=V.useCallback(k=>{const C=ht(k)?{getBoundingClientRect:()=>k.getBoundingClientRect(),getClientRects:()=>k.getClientRects(),contextElement:k}:k;h(C),S.refs.setReference(C)},[S.refs]),T=V.useCallback(k=>{(ht(k)||k===null)&&(g.current=k,u(k)),(ht(S.refs.reference.current)||S.refs.reference.current===null||k!==null&&!ht(k))&&S.refs.setReference(k)},[S.refs]),D=V.useMemo(()=>({...S.refs,setReference:T,setPositionReference:w,domReference:g}),[S.refs,T,w]),$=V.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),_=V.useMemo(()=>({...S,...r,refs:D,elements:$,nodeId:e}),[S,D,$,e,r]);return zi(()=>{r.dataRef.current.floatingContext=_;const k=v?.nodesRef.current.find(C=>C.id===e);k&&(k.context=_)}),V.useMemo(()=>({...S,context:_,refs:D,elements:$}),[S,D,$,_])}function Wh(t,e,n){const r=new Map,o=n==="item";let c=t;if(o&&t){const{[_S]:u,[kS]:d,...h}=t;c=h}return{...n==="floating"&&{tabIndex:-1,[ED]:""},...c,...e.map(u=>{const d=u?u[n]:null;return typeof d=="function"?t?d(t):null:d}).concat(t).reduce((u,d)=>(d&&Object.entries(d).forEach(h=>{let[p,y]=h;if(!(o&&[_S,kS].includes(p)))if(p.indexOf("on")===0){if(r.has(p)||r.set(p,[]),typeof y=="function"){var g;(g=r.get(p))==null||g.push(y),u[p]=function(){for(var v,S=arguments.length,w=new Array(S),T=0;T<S;T++)w[T]=arguments[T];return(v=r.get(p))==null?void 0:v.map(D=>D(...w)).find(D=>D!==void 0)}}}else u[p]=y}),u),{})}}function QD(t){t===void 0&&(t=[]);const e=t.map(d=>d?.reference),n=t.map(d=>d?.floating),r=t.map(d=>d?.item),o=V.useCallback(d=>Wh(d,t,"reference"),e),c=V.useCallback(d=>Wh(d,t,"floating"),n),u=V.useCallback(d=>Wh(d,t,"item"),r);return V.useMemo(()=>({getReferenceProps:o,getFloatingProps:c,getItemProps:u}),[o,c,u])}const WD=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function eN(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:c,floatingId:u}=t,{enabled:d=!0,role:h="dialog"}=e,p=iT(),y=((n=c.domReference)==null?void 0:n.id)||p,g=V.useMemo(()=>{var _;return((_=qp(c.floating))==null?void 0:_.id)||u},[c.floating,u]),v=(r=WD.get(h))!=null?r:h,w=rT()!=null,T=V.useMemo(()=>v==="tooltip"||h==="label"?{["aria-"+(h==="label"?"labelledby":"describedby")]:o?g:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":v==="alertdialog"?"dialog":v,"aria-controls":o?g:void 0,...v==="listbox"&&{role:"combobox"},...v==="menu"&&{id:y},...v==="menu"&&w&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[v,g,w,o,y,h]),D=V.useMemo(()=>{const _={id:g,...v&&{role:v}};return v==="tooltip"||h==="label"?_:{..._,...v==="menu"&&{"aria-labelledby":y}}},[v,g,y,h]),$=V.useCallback(_=>{let{active:k,selected:C}=_;const O={role:"option",...k&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{...O,"aria-selected":C}}return{}},[g,h]);return V.useMemo(()=>d?{reference:T,floating:D,item:$}:{},[d,T,D,$])}const Sl=t=>Array.isArray(t)?t:[t],tN=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},oT=Array,ns=(t,e)=>t.includes(e),nN=(t,e=0)=>[...new Array(t)].map((n,r)=>r+e),Ie=(t,e,n)=>t===void 0?e===void 0?[]:Array.isArray(e)?e:[e]:(Array.isArray(e)?t.push(...e):t.push(e),t),ss=(t,e)=>e==null?t??[]:t==null?Sl(e):t.concat(e),iN=(...t)=>t.reduce(ss,[]),cs=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((o,c)=>o===c);for(const o of Sl(e))t.some(c=>r(c,o))||t.push(o);return t},rN=(t,e)=>t.reduce((n,r)=>{const o=r[e];return n[o]=Ie(n[o],r),n},{}),Do=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,o)=>n.isEqual(r,e[o]):(r,o)=>r===e[o]),bs=(t,e)=>Xn(t)===e,Xn=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},Ii={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},sN={...Ii,function:"a function"};class oN extends Error{}const Et=t=>No(t,oN),No=(t,e=Error)=>{throw new e(t)};class aN extends Error{name="ParseError"}const Z=t=>No(t,aN),aT=t=>` ${t}`,He=(t,e)=>{const n={},r=Array.isArray(t);let o=!1;for(const[c,u]of Object.entries(t).entries()){const d=r?e(c,u[1]):e(...u,c);o||=typeof d[0]=="number";const h=Array.isArray(d[0])||d.length===0?d:[d];for(const[p,y]of h)typeof p=="object"?n[p.group]=Ie(n[p.group],y):n[p]=y}return o?Object.values(n):n},lT=Object.entries,vi=(t,e)=>t in e,ly=(t,e)=>e in t;class lN{constructor(e){Object.assign(this,e)}}const cN=class{};class cT extends cN{}const uN=(t,e)=>{const n={},r={};let o;for(o in t)o in e?n[o]=t[o]:r[o]=t[o];return[n,r]},fN=(t,e)=>uN(t,e)[1],xl=t=>Object.keys(t).length===0,Vu=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],dN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),hN=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},Ui=aT("represents an uninitialized value"),pN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),uT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},fT=globalThis.File??Blob,dT={ArrayBuffer,Blob,File:fT,FormData,Headers,Request,Response,URL},mN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},$o={...uT,...dT,...mN,String,Number,Boolean},cy=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!vi(e.constructor.name,$o)||!(t instanceof $o[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},Ip=t=>typeof t=="object"&&t!==null?cy(t)??"object":Xn(t),Yt=Array.isArray,yN={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"},gN={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"},bN={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"},vN={...yN,...gN,...bN},uy=t=>{const e=Object(t).name??null;return e&&vi(e,$o)&&$o[e]===t?e:null},PS=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},SN=t=>hT(t,new Map),hT=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=uy(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)),o=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,r);for(const c in o){const u=o[c];"get"in u||"set"in u||(u.value=hT(u.value,e))}}return Object.defineProperties(r,o),r},xN=t=>{let e=Ui;return()=>e===Ui?e=t():e},df=t=>typeof t=="function"&&t.length===0,wN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(r){return Et(`Encountered an unexpected error while compiling your definition:
67
67
  Message: ${r}
68
68
  Source: (${t.slice(0,-1)}) => {
69
69
  ${t.at(-1)}
70
70
  }`)}}};class Po{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const TN=xN(()=>{try{return new Function("return false")()}catch{return!0}});class Si{constructor(){}}var AN={};const EN=()=>{try{return((new Error().stack?.split(`
71
- `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},RN=AN??{},ON={fileName:EN,env:RN},_N=t=>t[0].toUpperCase()+t.slice(1),pT=t=>new RegExp(kN(t),typeof t=="string"?"":t.flags),kN=t=>`^(?:${typeof t=="string"?t:t.source})$`,Er={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},Ip="\\",df={" ":1,"\n":1," ":1},MN=/^-0\.?0*$/.source,mT=/[1-9]\d*/.source,CN=/\.\d+/.source,DN=/\.\d*[1-9]/.source,yT=t=>pT(Er.negativeLookahead(MN)+Er.nonCapturingGroup("-?"+Er.nonCapturingGroup(Er.nonCapturingGroup("0|"+mT)+Er.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),PS=yT({decimalPattern:DN,allowDecimalOnly:!1}),NN=PS.test.bind(PS),Hp=yT({decimalPattern:CN,allowDecimalOnly:!0});Hp.test.bind(Hp);const $N=/^-?\d*\.?\d*$/,jN=t=>t.length!==0&&$N.test(t),Uu=pT(Er.negativeLookahead("^-0$")+"-?"+Er.nonCapturingGroup(Er.nonCapturingGroup("0|"+mT))),BN=Uu.test.bind(Uu),Fp=/^-?\d+$/,LN=Fp.test.bind(Fp),gT={number:"a number",bigint:"a bigint",integer:"an integer"},bT=(t,e)=>`'${t}' was parsed as ${gT[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,VN=(t,e)=>e==="number"?NN(t):BN(t),UN=(t,e)=>e==="number"?Number(t):Number.parseInt(t),zN=(t,e)=>e==="number"?jN(t):LN(t),KN=(t,e)=>uy(t,"number",e),PN=(t,e)=>uy(t,"number",{...e,strict:!0}),qN=(t,e)=>uy(t,"integer",e),uy=(t,e,n)=>{const r=UN(t,e);return!Number.isNaN(r)&&zN(t,e)?n?.strict?VN(t,e)?r:Z(bT(t,e)):r:n?.errorOnFail?Z(n?.errorOnFail===!0?`Failed to parse ${gT[e]} from '${t}'`:n?.errorOnFail):void 0},IN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Uu.test(e))return n;if(Fp.test(e))return Z(bT(t,"bigint"))},HN="0.46.0",FN={version:HN,filename:ON.fileName(),FileConstructor:fT},wl=FN,qS=new Map,Wh=Object.create(null),Gp=t=>{const e=qS.get(t);if(e)return e;let n=GN(t);return Wh[n]?n=`${n}${Wh[n]++}`:Wh[n]=1,wl[n]=t,qS.set(t,n),n},al=t=>/^[$A-Z_a-z][\w$]*$/.test(t),GN=t=>{switch(typeof t){case"object":{if(t===null)break;const e=ly(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return al(t.name)?t.name:"fn";case"symbol":return t.description&&al(t.description)?t.description:"symbol"}return Et(`Unexpected attempt to register serializable value of type ${Xn(t)}`)},fy=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,YN=(t,e={})=>el(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Pe=(t,e)=>{switch(Xn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?zu(n,e?.indent??0,""):JSON.stringify(el(n,jo,[]),null,e?.indent):zu(n,e?.indent??0,"");case"symbol":return jo.onSymbol(t);default:return fy(t)}},zu=(t,e,n)=>{if(typeof t=="function")return jo.onFunction(t);if(typeof t!="object"||t===null)return fy(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const c=t.map(u=>zu(u,e,r)).join(`,
71
+ `)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},RN=AN??{},ON={fileName:EN,env:RN},_N=t=>t[0].toUpperCase()+t.slice(1),pT=t=>new RegExp(kN(t),typeof t=="string"?"":t.flags),kN=t=>`^(?:${typeof t=="string"?t:t.source})$`,Er={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},Hp="\\",hf={" ":1,"\n":1," ":1},MN=/^-0\.?0*$/.source,mT=/[1-9]\d*/.source,CN=/\.\d+/.source,DN=/\.\d*[1-9]/.source,yT=t=>pT(Er.negativeLookahead(MN)+Er.nonCapturingGroup("-?"+Er.nonCapturingGroup(Er.nonCapturingGroup("0|"+mT)+Er.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),qS=yT({decimalPattern:DN,allowDecimalOnly:!1}),NN=qS.test.bind(qS),Fp=yT({decimalPattern:CN,allowDecimalOnly:!0});Fp.test.bind(Fp);const $N=/^-?\d*\.?\d*$/,jN=t=>t.length!==0&&$N.test(t),Uu=pT(Er.negativeLookahead("^-0$")+"-?"+Er.nonCapturingGroup(Er.nonCapturingGroup("0|"+mT))),BN=Uu.test.bind(Uu),Gp=/^-?\d+$/,LN=Gp.test.bind(Gp),gT={number:"a number",bigint:"a bigint",integer:"an integer"},bT=(t,e)=>`'${t}' was parsed as ${gT[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,VN=(t,e)=>e==="number"?NN(t):BN(t),UN=(t,e)=>e==="number"?Number(t):Number.parseInt(t),zN=(t,e)=>e==="number"?jN(t):LN(t),KN=(t,e)=>fy(t,"number",e),PN=(t,e)=>fy(t,"number",{...e,strict:!0}),qN=(t,e)=>fy(t,"integer",e),fy=(t,e,n)=>{const r=UN(t,e);return!Number.isNaN(r)&&zN(t,e)?n?.strict?VN(t,e)?r:Z(bT(t,e)):r:n?.errorOnFail?Z(n?.errorOnFail===!0?`Failed to parse ${gT[e]} from '${t}'`:n?.errorOnFail):void 0},IN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(Uu.test(e))return n;if(Gp.test(e))return Z(bT(t,"bigint"))},HN="0.46.0",FN={version:HN,filename:ON.fileName(),FileConstructor:fT},wl=FN,IS=new Map,ep=Object.create(null),Yp=t=>{const e=IS.get(t);if(e)return e;let n=GN(t);return ep[n]?n=`${n}${ep[n]++}`:ep[n]=1,wl[n]=t,IS.set(t,n),n},al=t=>/^[$A-Z_a-z][\w$]*$/.test(t),GN=t=>{switch(typeof t){case"object":{if(t===null)break;const e=cy(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return al(t.name)?t.name:"fn";case"symbol":return t.description&&al(t.description)?t.description:"symbol"}return Et(`Unexpected attempt to register serializable value of type ${Xn(t)}`)},dy=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,YN=(t,e={})=>el(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),Pe=(t,e)=>{switch(Xn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?zu(n,e?.indent??0,""):JSON.stringify(el(n,jo,[]),null,e?.indent):zu(n,e?.indent??0,"");case"symbol":return jo.onSymbol(t);default:return dy(t)}},zu=(t,e,n)=>{if(typeof t=="function")return jo.onFunction(t);if(typeof t!="object"||t===null)return dy(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const c=t.map(u=>zu(u,e,r)).join(`,
72
72
  `+r);return e?`[
73
73
  ${r}${c}
74
74
  ${n}]`:`[${c}]`}const o=t.constructor.name;if(o==="Object"){const c=Vu(t).map(([u,d])=>{const h=typeof u=="symbol"?jo.onSymbol(u):al(u)?u:JSON.stringify(u),p=zu(d,e,r);return`${r}${h}: ${p}`});return c.length===0?"{}":e?`{
75
75
  ${c.join(`,
76
76
  `)}
77
- ${n}}`:`{${c.join(", ")}}`}return t instanceof Date?Tl(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},jo={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${Gp(t)})`,onFunction:t=>`Function(${Gp(t)})`},el=(t,e,n)=>{switch(Xn(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return jo.onFunction(r);if(n.includes(r))return"(cycle)";const o=[...n,r];if(Array.isArray(r))return r.map(u=>el(u,e,o));if(r instanceof Date)return r.toDateString();const c={};for(const u in r)c[u]=el(r[u],e,o);for(const u of Object.getOwnPropertySymbols(r))c[e.onSymbol?.(u)??u.toString()]=el(r[u],e,o);return c}case"symbol":return jo.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},Tl=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),c=t.getMinutes(),u=t.getSeconds(),d=t.getMilliseconds();if(n===0&&r===1&&o===0&&c===0&&u===0&&d===0)return`${e}`;const h=`${JN[n]} ${r}, ${e}`;if(o===0&&c===0&&u===0&&d===0)return h;let p=t.toLocaleTimeString();const y=p.endsWith(" AM")||p.endsWith(" PM")?p.slice(-3):"";return y&&(p=p.slice(0,-y.length)),d?p+=`.${ZN(d,3)}`:XN.test(p)&&(p=p.slice(0,-3)),`${p+y}, ${h}`},JN=["January","February","March","April","May","June","July","August","September","October","November","December"],XN=/:\d\d:00$/,ZN=(t,e)=>String(t).padStart(e,"0"),vT=(t,e,...[n])=>{const r=n?.stringifySymbol??Pe;let o=t;switch(typeof e){case"string":o=al(e)?t===""?e:`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;break;case"number":o=`${t}[${e}]`;break;case"symbol":o=`${t}[${r(e)}]`;break;default:n?.stringifyNonKey?o=`${t}[${n.stringifyNonKey(e)}]`:Z(`${Pe(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},Al=(t,...e)=>t.reduce((n,r)=>vT(n,r,...e),"");class ST extends oT{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]=="symbol"?Pe(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Al(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=vT(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class QN{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;){if(e(this,n))if(n[n.length-1]===Ip)n=n.slice(0,-1);else 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 df))}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}}let Yp="$ark",WN=2;for(;Yp in globalThis;)Yp=`$ark${WN++}`;const xT=Yp;globalThis[xT]=wl;const ne=wl,e2=t=>`${xT}.${t}`,en=t=>e2(Gp(t));class wT extends cT{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 TT(e,n)}index(e,n=!1){return AT(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
77
+ ${n}}`:`{${c.join(", ")}}`}return t instanceof Date?Tl(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},jo={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${Yp(t)})`,onFunction:t=>`Function(${Yp(t)})`},el=(t,e,n)=>{switch(Xn(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return jo.onFunction(r);if(n.includes(r))return"(cycle)";const o=[...n,r];if(Array.isArray(r))return r.map(u=>el(u,e,o));if(r instanceof Date)return r.toDateString();const c={};for(const u in r)c[u]=el(r[u],e,o);for(const u of Object.getOwnPropertySymbols(r))c[e.onSymbol?.(u)??u.toString()]=el(r[u],e,o);return c}case"symbol":return jo.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},Tl=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),c=t.getMinutes(),u=t.getSeconds(),d=t.getMilliseconds();if(n===0&&r===1&&o===0&&c===0&&u===0&&d===0)return`${e}`;const h=`${JN[n]} ${r}, ${e}`;if(o===0&&c===0&&u===0&&d===0)return h;let p=t.toLocaleTimeString();const y=p.endsWith(" AM")||p.endsWith(" PM")?p.slice(-3):"";return y&&(p=p.slice(0,-y.length)),d?p+=`.${ZN(d,3)}`:XN.test(p)&&(p=p.slice(0,-3)),`${p+y}, ${h}`},JN=["January","February","March","April","May","June","July","August","September","October","November","December"],XN=/:\d\d:00$/,ZN=(t,e)=>String(t).padStart(e,"0"),vT=(t,e,...[n])=>{const r=n?.stringifySymbol??Pe;let o=t;switch(typeof e){case"string":o=al(e)?t===""?e:`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;break;case"number":o=`${t}[${e}]`;break;case"symbol":o=`${t}[${r(e)}]`;break;default:n?.stringifyNonKey?o=`${t}[${n.stringifyNonKey(e)}]`:Z(`${Pe(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},Al=(t,...e)=>t.reduce((n,r)=>vT(n,r,...e),"");class ST extends oT{cache={};constructor(...e){super(),this.push(...e)}toJSON(){if(this.cache.json)return this.cache.json;this.cache.json=[];for(let e=0;e<this.length;e++)this.cache.json.push(typeof this[e]=="symbol"?Pe(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Al(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=vT(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class QN{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;){if(e(this,n))if(n[n.length-1]===Hp)n=n.slice(0,-1);else 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 hf))}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}}let Jp="$ark",WN=2;for(;Jp in globalThis;)Jp=`$ark${WN++}`;const xT=Jp;globalThis[xT]=wl;const ne=wl,e2=t=>`${xT}.${t}`,en=t=>e2(Yp(t));class wT extends cT{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 TT(e,n)}index(e,n=!1){return AT(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
78
78
  `,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(`
79
79
  `).map(r=>" ".repeat(n)+`${r}`).join(`
80
- `):this.body} }`}compile(){return new wN(...this.argNames,this.body)}}const El=t=>bs(t,"object")||typeof t=="symbol"?en(t):fy(t),TT=(t,e=!1)=>typeof t=="string"&&al(t)?`${e?"?":""}.${t}`:AT(t2(t),e),t2=t=>typeof t=="symbol"?en(t):JSON.stringify(t),AT=(t,e=!1)=>`${e?"?.":""}[${t}]`;class ep extends wT{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,o=typeof e=="string"?!0:this.requiresContextFor(e),c=typeof e=="string"?e:e.id;return o?`${this.referenceToId(c,n)}(${r}, ${this.ctx})`:`${this.referenceToId(c,n)}(${r})`}referenceToId(e,n){const r=n?.kind??this.traversalKind,o=`this.${e}${r}`;return n?.bind?`${o}.bind(${n?.bind})`:o}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 o=this.requiresContextFor(r);return o&&this.line(`${this.ctx}.path.push(${e})`),this.check(r,{arg:n}),o&&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 ET=t=>He(t,(e,n)=>[e,Yt(n)?[...n]:n]),Hi=aT("arkKind"),pe=(t,e)=>t?.[Hi]===e,Qt=t=>pe(t,"root")||pe(t,"constraint"),n2=["unit","proto","domain"],hf=["required","optional","index","sequence"],RT=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],dy=[...RT,...hf,"structure","predicate"],pf=["alias","union","morph","unit","intersection","proto","domain"],i2=[...pf,...dy],OT=He(dy,(t,e)=>[e,1]),r2=He([...hf,"undeclared"],(t,e)=>[e,1]),_T=He(i2,(t,e)=>[e,t]),hu=t=>typeof t=="string"&&t in _T,Ku=t=>_T[t],hy=t=>pf.slice(Ku(t)+1);[...hy("union")];[...hy("morph")];const ps=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:El(t),mf=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${El(r)}, `;return e+" }"},ct=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>Pe(n),e.defaults.problem??=n=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,e.defaults.message??=n=>{if(n.path.length===0)return n.problem;const r=`${n.propString} ${n.problem}`;return r[0]==="["?`value at ${r}`:r}),e};class s2 extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Pe(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const o2={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>kt.throw("arrayObject",t),arrayPostfix:t=>kt.throw("arrayPostfix",t),defaultValue:t=>kt.throw("defaultValue",t),domain:t=>kt.throw("domain",t),morph:t=>kt.throw("morph",t),patternIntersection:t=>kt.throw("patternIntersection",t),predicate:t=>kt.throw("predicate",t),proto:t=>kt.throw("proto",t),symbolKey:t=>kt.throw("symbolKey",t),unit:t=>kt.throw("unit",t),date:t=>kt.throw("date",t)}},kt={Error:s2,throw:(...t)=>{throw new kt.Error(...t)},throwInternalOperandError:(t,e)=>Et(`Unexpected JSON Schema input for ${t}: ${Pe(e)}`),defaultConfig:o2};ne.config??={};const Jp=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const o={...t.keywords};if(r==="keywords"){for(const c in e[r]){const u=e.keywords[c];u!==void 0&&(o[c]=typeof u=="string"?{description:u}:u)}n.keywords=o}else r==="toJsonSchema"?n[r]=kT(t.toJsonSchema,e.toJsonSchema):hu(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},kT=(t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=a2(t.fallback,e.fallback):n[r]=e[r];return n},a2=(t,e)=>{t=IS(t),e=IS(e);const n={};let r;for(r in kt.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??kt.defaultConfig.fallback[r];return n},IS=t=>typeof t=="function"?{default:t}:t??{};class Bo extends cT{[Hi]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},o){super(),this.input=r,this.ctx=o,dN(this,r);const c=o.data;r.code==="union"&&(r.errors=r.errors.flatMap(d=>{const h=d.hasCode("union")?d.errors:[d];return!e&&!n?h:h.map(p=>p.transform(y=>({...y,path:iN(e,y.path,n)})))})),this.nodeConfig=o.config[this.code];const u=[...r.path??o.path];n&&u.push(...n),e&&u.unshift(...e),this.path=new ST(...u),this.data="data"in r?r.data:c}transform(e){return new Bo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return Al(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 Cr extends oT{[Hi]="errors";ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return He(this.byPath,(e,n)=>[e,n.flat])}get flatProblemsByPath(){return He(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 l2(this)}add(e){this.includes(e)||this._add(e)}transform(e){const n=new Cr(this.ctx);for(const r of this)n.add(e(r));return n}merge(e){for(const n of e)this.includes(n)||this._add(new Bo({...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(`
80
+ `):this.body} }`}compile(){return new wN(...this.argNames,this.body)}}const El=t=>bs(t,"object")||typeof t=="symbol"?en(t):dy(t),TT=(t,e=!1)=>typeof t=="string"&&al(t)?`${e?"?":""}.${t}`:AT(t2(t),e),t2=t=>typeof t=="symbol"?en(t):JSON.stringify(t),AT=(t,e=!1)=>`${e?"?.":""}[${t}]`;class tp extends wT{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,o=typeof e=="string"?!0:this.requiresContextFor(e),c=typeof e=="string"?e:e.id;return o?`${this.referenceToId(c,n)}(${r}, ${this.ctx})`:`${this.referenceToId(c,n)}(${r})`}referenceToId(e,n){const r=n?.kind??this.traversalKind,o=`this.${e}${r}`;return n?.bind?`${o}.bind(${n?.bind})`:o}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 o=this.requiresContextFor(r);return o&&this.line(`${this.ctx}.path.push(${e})`),this.check(r,{arg:n}),o&&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 ET=t=>He(t,(e,n)=>[e,Yt(n)?[...n]:n]),Hi=aT("arkKind"),pe=(t,e)=>t?.[Hi]===e,Qt=t=>pe(t,"root")||pe(t,"constraint"),n2=["unit","proto","domain"],pf=["required","optional","index","sequence"],RT=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],hy=[...RT,...pf,"structure","predicate"],mf=["alias","union","morph","unit","intersection","proto","domain"],i2=[...mf,...hy],OT=He(hy,(t,e)=>[e,1]),r2=He([...pf,"undeclared"],(t,e)=>[e,1]),_T=He(i2,(t,e)=>[e,t]),hu=t=>typeof t=="string"&&t in _T,Ku=t=>_T[t],py=t=>mf.slice(Ku(t)+1);[...py("union")];[...py("morph")];const ps=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:El(t),yf=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${El(r)}, `;return e+" }"},ct=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>Pe(n),e.defaults.problem??=n=>`must be ${n.expected}${n.actual?` (was ${n.actual})`:""}`,e.defaults.message??=n=>{if(n.path.length===0)return n.problem;const r=`${n.propString} ${n.problem}`;return r[0]==="["?`value at ${r}`:r}),e};class s2 extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(Pe(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const o2={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>kt.throw("arrayObject",t),arrayPostfix:t=>kt.throw("arrayPostfix",t),defaultValue:t=>kt.throw("defaultValue",t),domain:t=>kt.throw("domain",t),morph:t=>kt.throw("morph",t),patternIntersection:t=>kt.throw("patternIntersection",t),predicate:t=>kt.throw("predicate",t),proto:t=>kt.throw("proto",t),symbolKey:t=>kt.throw("symbolKey",t),unit:t=>kt.throw("unit",t),date:t=>kt.throw("date",t)}},kt={Error:s2,throw:(...t)=>{throw new kt.Error(...t)},throwInternalOperandError:(t,e)=>Et(`Unexpected JSON Schema input for ${t}: ${Pe(e)}`),defaultConfig:o2};ne.config??={};const Xp=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const o={...t.keywords};if(r==="keywords"){for(const c in e[r]){const u=e.keywords[c];u!==void 0&&(o[c]=typeof u=="string"?{description:u}:u)}n.keywords=o}else r==="toJsonSchema"?n[r]=kT(t.toJsonSchema,e.toJsonSchema):hu(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},kT=(t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=a2(t.fallback,e.fallback):n[r]=e[r];return n},a2=(t,e)=>{t=HS(t),e=HS(e);const n={};let r;for(r in kt.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??kt.defaultConfig.fallback[r];return n},HS=t=>typeof t=="function"?{default:t}:t??{};class Bo extends cT{[Hi]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},o){super(),this.input=r,this.ctx=o,dN(this,r);const c=o.data;r.code==="union"&&(r.errors=r.errors.flatMap(d=>{const h=d.hasCode("union")?d.errors:[d];return!e&&!n?h:h.map(p=>p.transform(y=>({...y,path:iN(e,y.path,n)})))})),this.nodeConfig=o.config[this.code];const u=[...r.path??o.path];n&&u.push(...n),e&&u.unshift(...e),this.path=new ST(...u),this.data="data"in r?r.data:c}transform(e){return new Bo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return Al(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 Cr extends oT{[Hi]="errors";ctx;constructor(e){super(),this.ctx=e}byPath=Object.create(null);get flatByPath(){return He(this.byPath,(e,n)=>[e,n.flat])}get flatProblemsByPath(){return He(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 l2(this)}add(e){this.includes(e)||this._add(e)}transform(e){const n=new Cr(this.ctx);for(const r of this)n.add(e(r));return n}merge(e){for(const n of e)this.includes(n)||this._add(new Bo({...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(`
81
81
  `)}_add(e){const n=this.byPath[e.propString];if(n){if(n.hasCode("union")&&n.errors.length===0)return;const r=e.hasCode("union")&&e.errors.length===0?e:new Bo({code:"intersection",errors:n.hasCode("intersection")?[...n.errors,e]:[n,e]},this.ctx),o=this.indexOf(n);this.mutable[o===-1?this.length:o]=r,this.byPath[e.propString]=r,this.addAncestorPaths(e)}else this.byPath[e.propString]=e,this.addAncestorPaths(e),this.mutable.push(e);this.count++}addAncestorPaths(e){for(const n of e.path.stringifyAncestors())this.byAncestorPath[n]=Ie(this.byAncestorPath[n],e)}}class l2 extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
82
82
  `+e.map(n=>` • ${c2(n)}`).join(`
83
83
  `)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const c2=t=>t.toString().split(`
84
84
  `).join(`
85
- `);class po{path=[];errors=new Cr(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 Al(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 ST(...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 Bo(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 o;if(r!==void 0){o=this.root;for(let c=0;c<e.length-1;c++)o=o[e[c]]}this.path=[...e];for(const c of n){const u=Qt(c),d=c(o===void 0?this.root:o[r],this);if(d instanceof Bo){this.errors.add(d);break}if(d instanceof Cr){u||this.errors.merge(d);break}o===void 0?this.root=d:o[r]=d,this.applyQueuedMorphs()}}}const Fi=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class MT extends Po{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,c,u=this.onFail)=>c?(this.traverseApply(o,c),c.hasError()?c.errors:c.data):this.rootApply(o,u),{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.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((o,c)=>h2(o,c.shallowReferences),[this]);const r=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let o=0;o<this.children.length;o++){if(this.includesTransform||=this.children[o].includesTransform,this.includesContextualPredicate||=this.children[o].includesContextualPredicate,this.isCyclic||=this.children[o].isCyclic,!r){const c=this.children[o].flatRefs;for(let u=0;u<c.length;u++){const d=c[u];if(!this.flatRefs.some(h=>CT(h,d))){this.flatRefs.push(d);for(const h of d.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:d.path,propString:d.propString,node:h})}}}Object.assign(this.referencesById,this.children[o].referencesById)}this.flatRefs.sort((o,c)=>o.path.length>c.path.length?1:o.path.length<c.path.length?-1:o.propString>c.propString?1:o.propString<c.propString||o.node.expression<c.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(o=>o.length===1||o.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(o=>o.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?o=>this.traverseAllows(o,new po(o,this.$.resolvedConfig)):o=>this.traverseAllows(o)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,r)=>{if(this.allows(n))return n;const o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"contextual":return(n,r)=>{const o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.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 o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Et(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=d2(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=Ku(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.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(e){if(!this.includesTransform)return this;const n={};for(const[r,o]of this.innerEntries){const c=this.impl.keys[r];if(c.reduceIo)c.reduceIo(e,n,o);else if(c.child){const u=o;n[r]=Yt(u)?u.map(d=>d[e]):u[e]}else n[r]=o}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&&No(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return ns(e,this.kind)||No(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return ns(n2,this.kind)}isConstraint(){return ns(dy,this.kind)}isStructural(){return ns(hf,this.kind)}isRefinement(){return ns(RT,this.kind)}isRoot(){return ns(pf,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=Xa.normalize(e);return this._select(n)}_select(e){let n=Xa.applyBoundary[e.boundary??"references"](this);return e.kind&&(n=n.filter(r=>r.kind===e.kind)),e.where&&(n=n.filter(e.where)),Xa.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 o;n.seen[this.id]=()=>o,this.hasKind("structure")&&this.undeclared!==n.undeclaredKeyHandling&&(n={...n,undeclaredKeyHandling:this.undeclared});const c=He(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const v=g;if(!Yt(v)){const w=v._transform(e,n);return w?[y,w]:[]}if(v.length===0)return[y,g];const S=v.flatMap(w=>w._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const u=Object.assign(c,{meta:this.meta}),d=n.selected&&!n.selected.includes(this)?u:e(this.kind,u,n);if(d===null)return null;if(Qt(d))return o=d;const h=Object.keys(d);return(h.length===0||h.length===1&&h[0]==="meta")&&!xl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in d)?n.undeclaredKeyHandling?{...d,value:ne.intrinsic.unknown}:null:(this.kind==="morph"&&(d.in??=ne.intrinsic.unknown),o=r.node(this.kind,d,n.parseOptions))}configureReferences(e,n="references"){const r=Xa.normalize(n),o=typeof e=="string"?(h,p)=>({...p,meta:{...p.meta,description:e}}):typeof e=="function"?(h,p)=>({...p,meta:e(p.meta)}):(h,p)=>({...p,meta:{...p.meta,...e}});if(r.boundary==="self")return this.$.node(this.kind,o(this.kind,{...this.inner,meta:this.meta}));const c=this._select(r),u=c&&Sl(c),d=r.boundary==="child"?(h,p)=>p.root.children.includes(h):r.boundary==="shallow"?h=>h.kind!=="structure":()=>!0;return this.$.finalize(this.transform(o,{shouldTransform:d,selected:u}))}}const Xa={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&&No(HS(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&No(HS(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?vi(t,Xa.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},HS=(t,e)=>`${t} had no references matching ${Pe(e)}.`,u2=t=>Al(t,{stringifyNonKey:e=>e.expression}),f2=/"(\$ark\.[^"]+)"/g,d2=t=>JSON.stringify(t).replaceAll(f2,"$1"),_r=(t,e)=>({path:t,node:e,propString:u2(t)}),CT=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),FS=(t,e)=>cs(t,e,{isEqual:CT}),h2=(t,e)=>cs(t,e,{isEqual:(n,r)=>n.equals(r)});class ae extends Array{static init(e,n,r,o){return new ae({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1})}add(e,n,r,o){return this.push({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r}=this[0],o=Al(e);return DT(`Intersection${o&&` at ${o}`} of ${GS(n,r)}`)}return`The following intersections result in unsatisfiable types:
86
- • ${this.map(({path:e,l:n,r})=>`${e}: ${GS(n,r)}`).join(`
87
- • `)}`}throw(){return Z(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 ne.intrinsic.never}}const GS=(t,e)=>`${Xp(t)} and ${Xp(e)}`,Xp=t=>Qt(t)?t.expression:Yt(t)?t.map(Xp).join(" | ")||"never":String(t),DT=t=>`${t} results in an unsatisfiable type`,ao={},Gi=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),Zp=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!0}),Bt=(t,e,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${e.hash}`;if(ao[o]!==void 0)return ao[o];if(!n.pipe){const d=`${e.hash}${r}${t.hash}`;if(ao[d]!==void 0){const h=ao[d],p=h instanceof ae?h.invert():h;return ao[o]=p,p}}const c=!n.pipe||!t.includesTransform&&!e.includesTransform;if(c&&t.equals(e))return t;let u=c?Qp(t,e,n):t.hasKindIn(...pf)?p2(t,e,n):Qp(t,e,n);return Qt(u)&&(t.equals(u)?u=t:e.equals(u)&&(u=e)),ao[o]=u,u},Qp=(t,e,n)=>{const r=t.precedence<e.precedence?t.kind:e.kind,o=t.impl.intersections[e.kind]??e.impl.intersections[t.kind];if(o===void 0)return null;if(r===t.kind)return o(t,e,n);{let c=o(e,t,{...n,invert:!n.invert});return c instanceof ae&&(c=c.invert()),c}},p2=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?YS(e,t,n):YS(t,e,n):Qp(t,e,n),YS=(t,e,n)=>t.distribute(r=>m2(r,e,n),r=>{const o=r.filter(Qt);if(o.length===0)return ae.init("union",t.branches,e.branches);if(o.length<t.branches.length||!t.branches.every((u,d)=>u.in.equals(o[d].in)))return n.$.parseSchema(o);if(o.length===1)return o[0];const c={branches:o};return n.$.parseSchema(c)}),m2=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const c=Bt(t.lastMorphIfNode,e,n);if(c instanceof ae)return c;o[o.length-1]=c}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=Bt(t,e.in,n);return o instanceof ae?o:n.$.node("morph",{morphs:[e],in:o})}return n.$.node("morph",{morphs:[e],in:t})};class qo extends MT{constructor(e,n){super(e,n),Object.defineProperty(this,Hi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Gi(this,e,this.$)}}class yf extends qo{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(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return mf(this.errorContext)}}const ln=t=>(e,n)=>{if(Yt(e)){if(e.length===0)return;const o=e.map(c=>n.$.node(t,c));return t==="predicate"?o:o.sort((c,u)=>c.hash<u.hash?-1:1)}const r=n.$.node(t,e);return r.hasOpenIntersection()?[r]:r},Pu=t=>{const e=t.r.shift();if(!e){let r=t.l.length===0&&t.kind==="structure"?ne.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,y2(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof ae)return r;r=Bt(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=Bt(t.l[r],e,t.ctx);if(o!==null){if(o instanceof ae)return o;if(n){if(!t.l.includes(o))return Et(`Unexpectedly encountered multiple distinct intersection results for refinement ${o}`)}else{if(o.isRoot())return t.roots.push(o),t.l.splice(r),Pu(t);t.l[r]=o,n=!0}}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const r of e.impliedSiblings)cs(t.r,r);return Pu(t)},qu=t=>Object.entries(t).flatMap(([n,r])=>n in OT?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),y2=t=>{const e={};for(const n of t)if(n.hasOpenIntersection())e[n.kind]=Ie(e[n.kind],n);else{if(e[n.kind])return Et(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},g2=(...t)=>Z(b2(...t)),b2=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${_N(t)} operand must be ${e.description} (was ${r})`},v2=(t,e,n)=>new Iu(t,e,n,n,null);class NT extends Po{}class Iu extends Po{[Hi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,o,c){super((...u)=>{const d=He(this.names,(h,p)=>{const y=this.arg$.parse(u[h]);return y.extends(this.constraints[h])||Z(S2(p,this.constraints[h].expression,y.expression)),[p,y]});if(this.defIsLazy()){const h=this.bodyDef(d);return this.$.parse(h)}return this.$.parse(n,{args:d})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=o,this.hkt=c,this.description=c?new c().description??`a generic type for ${c.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof NT}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:YN(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,ne.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 S2=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,x2=ct({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 w2 extends qo{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=mf(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 $T={implementation:x2,Node:w2},T2=ct({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Z(E2(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/R2(t.rule,e.rule))})},obviatesBasisDescription:!0});class A2 extends yf{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=ne.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const jT={implementation:T2,Node:A2},E2=t=>`divisor must be an integer (was ${t})`,R2=(t,e)=>{let n,r=t,o=e;for(;o!==0;)n=o,o=r%o,r=n;return r};class Io extends yf{boundOperandKind=M2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=C2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${O2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?D2(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 O2={"<":">=","<=":">",">":"<=",">=":"<"},_2={min:"max",minLength:"maxLength",after:"before"},BT={parse:t=>t||void 0},LT=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},VT=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 o=typeof r.rule=="number"?r.rule:typeof r.rule=="string"?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:t==="after"?o+1:o-1}:r},UT=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,k2=(t,e)=>`${t} bound must be a positive integer (was ${e})`,py=t=>e=>((!Number.isInteger(e)||e<0)&&Z(k2(t,e)),e),M2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},C2=(t,e)=>`${vi(t,_2)?">":"<"}${e?"":"="}`,D2=t=>typeof t=="string"?t:new Date(t).toLocaleString(),N2=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,$2=ct({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:UT,serialize:t=>t.toISOString()}},normalize:VT("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:Tl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class j2 extends Io{impliedBasis=ne.intrinsic.Date.internal;collapsibleLimitString=Tl(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const zT={implementation:$2,Node:j2},B2=ct({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:UT,serialize:t=>t.toISOString()}},normalize:VT("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:Tl},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 L2 extends Io{collapsibleLimitString=Tl(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=ne.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const KT={implementation:B2,Node:L2},V2=ct({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:py("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 U2 extends yf{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=ne.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 kt.throwInternalOperandError("exactLength",e)}}}const PT={implementation:V2,Node:U2},z2=ct({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:BT},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 K2 extends Io{impliedBasis=ne.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 qT={implementation:z2,Node:K2},P2=ct({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:py("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:LT("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 q2 extends Io{impliedBasis=ne.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 kt.throwInternalOperandError("maxLength",e)}}}const IT={implementation:P2,Node:q2},I2=ct({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:BT},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 H2 extends Io{impliedBasis=ne.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 HT={implementation:I2,Node:H2},F2=ct({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:py("minLength")}},reduce:t=>t.rule===0?ne.intrinsic.unknown:void 0,normalize:LT("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 G2 extends Io{impliedBasis=ne.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 kt.throwInternalOperandError("minLength",e)}}}const FT={implementation:F2,Node:G2},Y2={min:HT.implementation,max:qT.implementation,minLength:FT.implementation,maxLength:IT.implementation,exactLength:PT.implementation,after:zT.implementation,before:KT.implementation},J2={min:HT.Node,max:qT.Node,minLength:FT.Node,maxLength:IT.Node,exactLength:PT.Node,after:zT.Node,before:KT.Node},X2=ct({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 Z2 extends yf{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=ne.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 GT={implementation:X2,Node:Z2},pu=(t,e)=>{const n=Q2(t);return e&&!e.includes(n)?Z(`Root of kind ${n} should be one of ${e}`):n},Q2=t=>{if(pe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Ii?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Z(JS(t));if("morphs"in t)return"morph";if("branches"in t||Yt(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 OT)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Z(JS(t))},JS=t=>`${Pe(t)} is not a valid type schema`,XS={},W2=t=>Yt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Ln={};ne.nodesByRegisteredId=Ln;const YT=t=>(XS[t]??=0,`${t}${++XS[t]}`),JT=t=>{const e=gf[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:o,...c}=n,u=o===void 0?{}:typeof o=="string"?{description:o}:o,d=lT(c).sort(([p],[y])=>hu(p)?hu(y)?Ku(p)-Ku(y):1:hu(y)||p<y?-1:1).filter(([p,y])=>{if(p.startsWith("meta.")){const g=p.slice(5);return u[g]=y,!1}return!0});for(const p of d){const y=p[0],g=e.keys[y];if(!g)return Z(`Key ${y} is not valid on ${t.kind} schema`);const v=g.parse?g.parse(p[1],t):p[1];v!==Ui&&(v!==void 0||g.preserveUndefined)&&(r[y]=v)}if(e.reduce&&!t.prereduced){const p=e.reduce(r,t.$);if(p)return p instanceof ae?p.throw():t$(p,u)}return my({id:t.id,kind:t.kind,inner:r,meta:u,$:t.$})},my=({id:t,kind:e,inner:n,meta:r,$:o,ignoreCache:c})=>{const u=gf[e],d=lT(n),h=[];let p={};for(const[$,_]of d){const k=u.keys[$],C=k.serialize??(k.child?W2:ps);if(p[$]=C(_),k.child===!0){const O=_;Yt(O)?h.push(...O):h.push(O)}else typeof k.child=="function"&&h.push(...k.child(_))}u.finalizeInnerJson&&(p=u.finalizeInnerJson(p));let y={...p},g={};xl(r)||(g=He(r,($,_)=>[$,$==="examples"?_:ps(_)]),y.meta=Wc(g,"description",!0)),p=Wc(p,u.collapsibleKey,!1);const v=JSON.stringify({kind:e,...p});y=Wc(y,u.collapsibleKey,!1);const S=Wc(y,u.collapsibleKey,!0),w=JSON.stringify({kind:e,...y});if(o.nodesByHash[w]&&!c)return o.nodesByHash[w];const T={id:t,kind:e,impl:u,inner:n,innerEntries:d,innerJson:p,innerHash:v,meta:r,metaJson:g,json:y,hash:w,collapsibleJson:S,children:h};if(e!=="intersection")for(const $ in n)$!=="in"&&$!=="out"&&(T[$]=n[$]);const D=new aj[e](T,o);return o.nodesByHash[w]=D},e$=(t,e)=>t.id===e?t:(Qt(Ln[e])&&Et(`Unexpected attempt to overwrite node id ${e}`),my({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),t$=(t,e,n)=>my({id:YT(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),Wc=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const o=t[e];if(n||bs(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},Wp=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let o=Bt(t.value,e.value,n);const c=t.required||e.required?"required":"optional";if(o instanceof ae)if(c==="optional")o=ne.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(c==="required")return n.$.node("required",{key:r,value:o});const u=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Z(ZT(t.default,e.default)):t.default:e.hasDefault()?e.default:Ui;return n.$.node("optional",{key:r,value:o,default:u})};class XT extends qo{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=ne.intrinsic.object.internal;serializedKey=El(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Ie(this.value.flatRefs.map(e=>_r([this.key,...e.path],e.node)),_r([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?Fi(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Fi(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 ZT=(t,e)=>`Invalid intersection of default values ${Pe(t)} & ${Pe(e)}`,n$=ct({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(ve.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:Wp}});class i$ extends XT{constructor(...e){super(...e),"default"in this.inner&&gy(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;const{default:e,...n}=this.inner;return this.cacheGetter("outProp",this.$.node("required",n,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Pe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=s$(this);defaultValueMorphRef=this.defaultValueMorph&&en(this.defaultValueMorph)}const yy={implementation:n$,Node:i$},r$={},s$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${ps(t.default)}}`;return r$[e]??=QT(t.key,t.value,t.default)},QT=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,c)=>(Fi(t,()=>e(o[t]=n(),c),c),o):o=>(o[t]=n(),o);const r=e.includesTransform?e.assert(n):n;return bs(r,"object")?(o,c)=>(Fi(t,()=>e(o[t]=n,c),c),o):o=>(o[t]=r,o)},gy=(t,e,n)=>{const r=ff(e);bs(e,"object")&&!r&&Z(o$(n));const o=t.in(r?e():e);if(o instanceof Cr){n===null&&Z(`Default ${o.summary}`);const c=o.transform(u=>u.transform(d=>({...d,prefixPath:[n]})));Z(`Default for ${c.summary}`)}return e},o$=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${El(t)} `}must be specified as a function like () => ({my: 'object'})`;class Rl extends MT{constructor(e,n){super(e,n),Object.defineProperty(this,Hi,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Cr?n:{value:n}}}}as(){return this}brand(e){return e===""?Z(a$):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=kT(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=He(this.references,(o,c)=>c.isRoot()&&!c.alwaysExpandJsonSchema?[c.id,c.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 Gi(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(),ne.intrinsic.unknown.internal);return e.branches.length===0&&Z(DT(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Z(l$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[ZS(r)??Z(QS("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(ne.intrinsic.object)&&e!=="merge")return r;const o=ZS(r);if(o||Z(QS(e,r.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const c=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{...r.inner,structure:o[c](...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){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 gy(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(o),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(pe(o,"root")?o:(c,u)=>{try{return o(c,u)}catch(d){return u.error({code:"predicate",predicate:o,actual:`aborted due to error:
85
+ `);class po{path=[];errors=new Cr(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 Al(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 ST(...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 Bo(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 o;if(r!==void 0){o=this.root;for(let c=0;c<e.length-1;c++)o=o[e[c]]}this.path=[...e];for(const c of n){const u=Qt(c),d=c(o===void 0?this.root:o[r],this);if(d instanceof Bo){this.errors.add(d);break}if(d instanceof Cr){u||this.errors.merge(d);break}o===void 0?this.root=d:o[r]=d,this.applyQueuedMorphs()}}}const Fi=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class MT extends Po{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,c,u=this.onFail)=>c?(this.traverseApply(o,c),c.hasError()?c.errors:c.data):this.rootApply(o,u),{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.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((o,c)=>h2(o,c.shallowReferences),[this]);const r=this.isStructural();this.flatRefs=[],this.flatMorphs=[];for(let o=0;o<this.children.length;o++){if(this.includesTransform||=this.children[o].includesTransform,this.includesContextualPredicate||=this.children[o].includesContextualPredicate,this.isCyclic||=this.children[o].isCyclic,!r){const c=this.children[o].flatRefs;for(let u=0;u<c.length;u++){const d=c[u];if(!this.flatRefs.some(h=>CT(h,d))){this.flatRefs.push(d);for(const h of d.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:d.path,propString:d.propString,node:h})}}}Object.assign(this.referencesById,this.children[o].referencesById)}this.flatRefs.sort((o,c)=>o.path.length>c.path.length?1:o.path.length<c.path.length?-1:o.propString>c.propString?1:o.propString<c.propString||o.node.expression<c.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(o=>o.length===1||o.name==="$arkStructuralMorph")?this.hasKind("union")?this.branches.some(o=>o.shallowMorphs.length>1)?"contextual":"branchedOptimistic":this.shallowMorphs.length>1?"contextual":"optimistic":"contextual":"contextual",this.rootApply=this.createRootApply(),this.allows=this.allowsRequiresContext?o=>this.traverseAllows(o,new po(o,this.$.resolvedConfig)):o=>this.traverseAllows(o)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,r)=>{if(this.allows(n))return n;const o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"contextual":return(n,r)=>{const o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.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 o=new po(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Et(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=d2(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=Ku(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.getIo("in"))}get out(){return this.cacheGetter("out",this.getIo("out"))}getIo(e){if(!this.includesTransform)return this;const n={};for(const[r,o]of this.innerEntries){const c=this.impl.keys[r];if(c.reduceIo)c.reduceIo(e,n,o);else if(c.child){const u=o;n[r]=Yt(u)?u.map(d=>d[e]):u[e]}else n[r]=o}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&&No(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return ns(e,this.kind)||No(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return ns(n2,this.kind)}isConstraint(){return ns(hy,this.kind)}isStructural(){return ns(pf,this.kind)}isRefinement(){return ns(RT,this.kind)}isRoot(){return ns(mf,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=Xa.normalize(e);return this._select(n)}_select(e){let n=Xa.applyBoundary[e.boundary??"references"](this);return e.kind&&(n=n.filter(r=>r.kind===e.kind)),e.where&&(n=n.filter(e.where)),Xa.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 o;n.seen[this.id]=()=>o,this.hasKind("structure")&&this.undeclared!==n.undeclaredKeyHandling&&(n={...n,undeclaredKeyHandling:this.undeclared});const c=He(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const v=g;if(!Yt(v)){const w=v._transform(e,n);return w?[y,w]:[]}if(v.length===0)return[y,g];const S=v.flatMap(w=>w._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const u=Object.assign(c,{meta:this.meta}),d=n.selected&&!n.selected.includes(this)?u:e(this.kind,u,n);if(d===null)return null;if(Qt(d))return o=d;const h=Object.keys(d);return(h.length===0||h.length===1&&h[0]==="meta")&&!xl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in d)?n.undeclaredKeyHandling?{...d,value:ne.intrinsic.unknown}:null:(this.kind==="morph"&&(d.in??=ne.intrinsic.unknown),o=r.node(this.kind,d,n.parseOptions))}configureReferences(e,n="references"){const r=Xa.normalize(n),o=typeof e=="string"?(h,p)=>({...p,meta:{...p.meta,description:e}}):typeof e=="function"?(h,p)=>({...p,meta:e(p.meta)}):(h,p)=>({...p,meta:{...p.meta,...e}});if(r.boundary==="self")return this.$.node(this.kind,o(this.kind,{...this.inner,meta:this.meta}));const c=this._select(r),u=c&&Sl(c),d=r.boundary==="child"?(h,p)=>p.root.children.includes(h):r.boundary==="shallow"?h=>h.kind!=="structure":()=>!0;return this.$.finalize(this.transform(o,{shouldTransform:d,selected:u}))}}const Xa={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&&No(FS(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&No(FS(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?vi(t,Xa.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},FS=(t,e)=>`${t} had no references matching ${Pe(e)}.`,u2=t=>Al(t,{stringifyNonKey:e=>e.expression}),f2=/"(\$ark\.[^"]+)"/g,d2=t=>JSON.stringify(t).replaceAll(f2,"$1"),_r=(t,e)=>({path:t,node:e,propString:u2(t)}),CT=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),GS=(t,e)=>cs(t,e,{isEqual:CT}),h2=(t,e)=>cs(t,e,{isEqual:(n,r)=>n.equals(r)});class ae extends Array{static init(e,n,r,o){return new ae({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1})}add(e,n,r,o){return this.push({kind:e,l:n,r,path:o?.path??[],optional:o?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r}=this[0],o=Al(e);return DT(`Intersection${o&&` at ${o}`} of ${YS(n,r)}`)}return`The following intersections result in unsatisfiable types:
86
+ • ${this.map(({path:e,l:n,r})=>`${e}: ${YS(n,r)}`).join(`
87
+ • `)}`}throw(){return Z(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 ne.intrinsic.never}}const YS=(t,e)=>`${Zp(t)} and ${Zp(e)}`,Zp=t=>Qt(t)?t.expression:Yt(t)?t.map(Zp).join(" | ")||"never":String(t),DT=t=>`${t} results in an unsatisfiable type`,ao={},Gi=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!1}),Qp=(t,e,n)=>Bt(t,e,{$:n,invert:!1,pipe:!0}),Bt=(t,e,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${e.hash}`;if(ao[o]!==void 0)return ao[o];if(!n.pipe){const d=`${e.hash}${r}${t.hash}`;if(ao[d]!==void 0){const h=ao[d],p=h instanceof ae?h.invert():h;return ao[o]=p,p}}const c=!n.pipe||!t.includesTransform&&!e.includesTransform;if(c&&t.equals(e))return t;let u=c?Wp(t,e,n):t.hasKindIn(...mf)?p2(t,e,n):Wp(t,e,n);return Qt(u)&&(t.equals(u)?u=t:e.equals(u)&&(u=e)),ao[o]=u,u},Wp=(t,e,n)=>{const r=t.precedence<e.precedence?t.kind:e.kind,o=t.impl.intersections[e.kind]??e.impl.intersections[t.kind];if(o===void 0)return null;if(r===t.kind)return o(t,e,n);{let c=o(e,t,{...n,invert:!n.invert});return c instanceof ae&&(c=c.invert()),c}},p2=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?JS(e,t,n):JS(t,e,n):Wp(t,e,n),JS=(t,e,n)=>t.distribute(r=>m2(r,e,n),r=>{const o=r.filter(Qt);if(o.length===0)return ae.init("union",t.branches,e.branches);if(o.length<t.branches.length||!t.branches.every((u,d)=>u.in.equals(o[d].in)))return n.$.parseSchema(o);if(o.length===1)return o[0];const c={branches:o};return n.$.parseSchema(c)}),m2=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const c=Bt(t.lastMorphIfNode,e,n);if(c instanceof ae)return c;o[o.length-1]=c}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=Bt(t,e.in,n);return o instanceof ae?o:n.$.node("morph",{morphs:[e],in:o})}return n.$.node("morph",{morphs:[e],in:t})};class qo extends MT{constructor(e,n){super(e,n),Object.defineProperty(this,Hi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Gi(this,e,this.$)}}class gf extends qo{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(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}get errorContext(){return{code:this.kind,description:this.description,meta:this.meta,...this.inner}}get compiledErrorContext(){return yf(this.errorContext)}}const ln=t=>(e,n)=>{if(Yt(e)){if(e.length===0)return;const o=e.map(c=>n.$.node(t,c));return t==="predicate"?o:o.sort((c,u)=>c.hash<u.hash?-1:1)}const r=n.$.node(t,e);return r.hasOpenIntersection()?[r]:r},Pu=t=>{const e=t.r.shift();if(!e){let r=t.l.length===0&&t.kind==="structure"?ne.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,y2(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof ae)return r;r=Bt(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=Bt(t.l[r],e,t.ctx);if(o!==null){if(o instanceof ae)return o;if(n){if(!t.l.includes(o))return Et(`Unexpectedly encountered multiple distinct intersection results for refinement ${o}`)}else{if(o.isRoot())return t.roots.push(o),t.l.splice(r),Pu(t);t.l[r]=o,n=!0}}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const r of e.impliedSiblings)cs(t.r,r);return Pu(t)},qu=t=>Object.entries(t).flatMap(([n,r])=>n in OT?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),y2=t=>{const e={};for(const n of t)if(n.hasOpenIntersection())e[n.kind]=Ie(e[n.kind],n);else{if(e[n.kind])return Et(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},g2=(...t)=>Z(b2(...t)),b2=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${_N(t)} operand must be ${e.description} (was ${r})`},v2=(t,e,n)=>new Iu(t,e,n,n,null);class NT extends Po{}class Iu extends Po{[Hi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,o,c){super((...u)=>{const d=He(this.names,(h,p)=>{const y=this.arg$.parse(u[h]);return y.extends(this.constraints[h])||Z(S2(p,this.constraints[h].expression,y.expression)),[p,y]});if(this.defIsLazy()){const h=this.bodyDef(d);return this.$.parse(h)}return this.$.parse(n,{args:d})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=o,this.hkt=c,this.description=c?new c().description??`a generic type for ${c.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof NT}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:YN(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,ne.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 S2=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,x2=ct({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 w2 extends qo{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=yf(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 $T={implementation:x2,Node:w2},T2=ct({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Z(E2(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/R2(t.rule,e.rule))})},obviatesBasisDescription:!0});class A2 extends gf{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=ne.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const jT={implementation:T2,Node:A2},E2=t=>`divisor must be an integer (was ${t})`,R2=(t,e)=>{let n,r=t,o=e;for(;o!==0;)n=o,o=r%o,r=n;return r};class Io extends gf{boundOperandKind=M2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=C2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${O2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?D2(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 O2={"<":">=","<=":">",">":"<=",">=":"<"},_2={min:"max",minLength:"maxLength",after:"before"},BT={parse:t=>t||void 0},LT=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},VT=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 o=typeof r.rule=="number"?r.rule:typeof r.rule=="string"?new Date(r.rule).valueOf():r.rule.valueOf();return n?{...r,rule:t==="after"?o+1:o-1}:r},UT=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,k2=(t,e)=>`${t} bound must be a positive integer (was ${e})`,my=t=>e=>((!Number.isInteger(e)||e<0)&&Z(k2(t,e)),e),M2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},C2=(t,e)=>`${vi(t,_2)?">":"<"}${e?"":"="}`,D2=t=>typeof t=="string"?t:new Date(t).toLocaleString(),N2=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,$2=ct({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:UT,serialize:t=>t.toISOString()}},normalize:VT("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:Tl},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class j2 extends Io{impliedBasis=ne.intrinsic.Date.internal;collapsibleLimitString=Tl(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const zT={implementation:$2,Node:j2},B2=ct({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:UT,serialize:t=>t.toISOString()}},normalize:VT("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:Tl},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 L2 extends Io{collapsibleLimitString=Tl(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=ne.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const KT={implementation:B2,Node:L2},V2=ct({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:my("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 U2 extends gf{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=ne.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 kt.throwInternalOperandError("exactLength",e)}}}const PT={implementation:V2,Node:U2},z2=ct({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:BT},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 K2 extends Io{impliedBasis=ne.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 qT={implementation:z2,Node:K2},P2=ct({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:my("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:LT("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 q2 extends Io{impliedBasis=ne.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 kt.throwInternalOperandError("maxLength",e)}}}const IT={implementation:P2,Node:q2},I2=ct({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:BT},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 H2 extends Io{impliedBasis=ne.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 HT={implementation:I2,Node:H2},F2=ct({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:my("minLength")}},reduce:t=>t.rule===0?ne.intrinsic.unknown:void 0,normalize:LT("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 G2 extends Io{impliedBasis=ne.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 kt.throwInternalOperandError("minLength",e)}}}const FT={implementation:F2,Node:G2},Y2={min:HT.implementation,max:qT.implementation,minLength:FT.implementation,maxLength:IT.implementation,exactLength:PT.implementation,after:zT.implementation,before:KT.implementation},J2={min:HT.Node,max:qT.Node,minLength:FT.Node,maxLength:IT.Node,exactLength:PT.Node,after:zT.Node,before:KT.Node},X2=ct({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 Z2 extends gf{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=ne.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 GT={implementation:X2,Node:Z2},pu=(t,e)=>{const n=Q2(t);return e&&!e.includes(n)?Z(`Root of kind ${n} should be one of ${e}`):n},Q2=t=>{if(pe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in Ii?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Z(XS(t));if("morphs"in t)return"morph";if("branches"in t||Yt(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 OT)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Z(XS(t))},XS=t=>`${Pe(t)} is not a valid type schema`,ZS={},W2=t=>Yt(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Ln={};ne.nodesByRegisteredId=Ln;const YT=t=>(ZS[t]??=0,`${t}${++ZS[t]}`),JT=t=>{const e=bf[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:o,...c}=n,u=o===void 0?{}:typeof o=="string"?{description:o}:o,d=lT(c).sort(([p],[y])=>hu(p)?hu(y)?Ku(p)-Ku(y):1:hu(y)||p<y?-1:1).filter(([p,y])=>{if(p.startsWith("meta.")){const g=p.slice(5);return u[g]=y,!1}return!0});for(const p of d){const y=p[0],g=e.keys[y];if(!g)return Z(`Key ${y} is not valid on ${t.kind} schema`);const v=g.parse?g.parse(p[1],t):p[1];v!==Ui&&(v!==void 0||g.preserveUndefined)&&(r[y]=v)}if(e.reduce&&!t.prereduced){const p=e.reduce(r,t.$);if(p)return p instanceof ae?p.throw():t$(p,u)}return yy({id:t.id,kind:t.kind,inner:r,meta:u,$:t.$})},yy=({id:t,kind:e,inner:n,meta:r,$:o,ignoreCache:c})=>{const u=bf[e],d=lT(n),h=[];let p={};for(const[$,_]of d){const k=u.keys[$],C=k.serialize??(k.child?W2:ps);if(p[$]=C(_),k.child===!0){const O=_;Yt(O)?h.push(...O):h.push(O)}else typeof k.child=="function"&&h.push(...k.child(_))}u.finalizeInnerJson&&(p=u.finalizeInnerJson(p));let y={...p},g={};xl(r)||(g=He(r,($,_)=>[$,$==="examples"?_:ps(_)]),y.meta=Wc(g,"description",!0)),p=Wc(p,u.collapsibleKey,!1);const v=JSON.stringify({kind:e,...p});y=Wc(y,u.collapsibleKey,!1);const S=Wc(y,u.collapsibleKey,!0),w=JSON.stringify({kind:e,...y});if(o.nodesByHash[w]&&!c)return o.nodesByHash[w];const T={id:t,kind:e,impl:u,inner:n,innerEntries:d,innerJson:p,innerHash:v,meta:r,metaJson:g,json:y,hash:w,collapsibleJson:S,children:h};if(e!=="intersection")for(const $ in n)$!=="in"&&$!=="out"&&(T[$]=n[$]);const D=new aj[e](T,o);return o.nodesByHash[w]=D},e$=(t,e)=>t.id===e?t:(Qt(Ln[e])&&Et(`Unexpected attempt to overwrite node id ${e}`),yy({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),t$=(t,e,n)=>yy({id:YT(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),Wc=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const o=t[e];if(n||bs(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},em=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let o=Bt(t.value,e.value,n);const c=t.required||e.required?"required":"optional";if(o instanceof ae)if(c==="optional")o=ne.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(c==="required")return n.$.node("required",{key:r,value:o});const u=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Z(ZT(t.default,e.default)):t.default:e.hasDefault()?e.default:Ui;return n.$.node("optional",{key:r,value:o,default:u})};class XT extends qo{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=ne.intrinsic.object.internal;serializedKey=El(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Ie(this.value.flatRefs.map(e=>_r([this.key,...e.path],e.node)),_r([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?Fi(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Fi(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 ZT=(t,e)=>`Invalid intersection of default values ${Pe(t)} & ${Pe(e)}`,n$=ct({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(ve.undefined)},{prereduced:!0})},defaults:{description:t=>`${t.compiledKey}?: ${t.value.description}`},intersections:{optional:em}});class i$ extends XT{constructor(...e){super(...e),"default"in this.inner&&by(this.value,this.inner.default,this.key)}get outProp(){if(!this.hasDefault())return this;const{default:e,...n}=this.inner;return this.cacheGetter("outProp",this.$.node("required",n,{prereduced:!0}))}expression=this.hasDefault()?`${this.compiledKey}: ${this.value.expression} = ${Pe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=s$(this);defaultValueMorphRef=this.defaultValueMorph&&en(this.defaultValueMorph)}const gy={implementation:n$,Node:i$},r$={},s$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${ps(t.default)}}`;return r$[e]??=QT(t.key,t.value,t.default)},QT=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,c)=>(Fi(t,()=>e(o[t]=n(),c),c),o):o=>(o[t]=n(),o);const r=e.includesTransform?e.assert(n):n;return bs(r,"object")?(o,c)=>(Fi(t,()=>e(o[t]=n,c),c),o):o=>(o[t]=r,o)},by=(t,e,n)=>{const r=df(e);bs(e,"object")&&!r&&Z(o$(n));const o=t.in(r?e():e);if(o instanceof Cr){n===null&&Z(`Default ${o.summary}`);const c=o.transform(u=>u.transform(d=>({...d,prefixPath:[n]})));Z(`Default for ${c.summary}`)}return e},o$=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${El(t)} `}must be specified as a function like () => ({my: 'object'})`;class Rl extends MT{constructor(e,n){super(e,n),Object.defineProperty(this,Hi,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Cr?n:{value:n}}}}as(){return this}brand(e){return e===""?Z(a$):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=kT(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=He(this.references,(o,c)=>c.isRoot()&&!c.alwaysExpandJsonSchema?[c.id,c.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 Gi(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(),ne.intrinsic.unknown.internal);return e.branches.length===0&&Z(DT(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Z(l$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[QS(r)??Z(WS("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(ne.intrinsic.object)&&e!=="merge")return r;const o=QS(r);if(o||Z(WS(e,r.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const c=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{...r.inner,structure:o[c](...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){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 by(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(o),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((r,o)=>r.rawPipeOnce(pe(o,"root")?o:(c,u)=>{try{return o(c,u)}catch(d){return u.error({code:"predicate",predicate:o,actual:`aborted due to error:
88
88
  ${d}
89
- `})}}),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=Zp(this,e,this.$);return n instanceof ae?n.throw():n}rawPipeOnce(e){return pe(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 o=this.$.node(n,r);if(o.isRoot())return o.isUnknown()?this:Et(`Unexpected constraint node ${o}`);const c=e==="root"?this:this[e];if(c.hasKind("morph")||o.impliedBasis&&!c.extends(o.impliedBasis))return g2(n,o.impliedBasis,this);const u=this.$.node("intersection",{[o.kind]:o}),d=e==="out"?Zp(this,u,this.$):Gi(this,u,this.$);return d instanceof ae&&d.throw(),this.$.finalize(d)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((o,c)=>o==="structure"?n==="ignore"?fN(c,{undeclared:1}):{...c,undeclared:n}:c,r?void 0:{shouldTransform:o=>!ns(hf,o.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!Do(this.shallowMorphs,e.shallowMorphs)||!Do(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",lo(e))}lessThan(e){return this.constrain("max",lo(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",lo(e))}lessThanLength(e){return this.constrain("maxLength",lo(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",lo(e))}earlierThan(e){return this.constrain("before",lo(e))}}const a$="Expected a non-empty brand name after #",lo=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},eu=(t,e)=>pe(e,"root")?pe(t,"root")?t.extends(e):e.allows(t):pe(t,"root")?t.hasUnit(e):e===t,ZS=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(ne.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(ne.intrinsic.emptyStructure):null,l$=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
90
- ${t}`,QS=(t,e)=>`${t} operand must be an object (was ${e})`,Ol=(t,e)=>He(hy(t),(n,r)=>[r,e]),c$=t=>typeof t=="string"?{reference:t}:t,WS=t=>t instanceof ae?ne.intrinsic.never.internal:t,u$=ct({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:c$,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>WS(Bt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...Ol("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(ne.intrinsic.object)?ae.init("assignability",ne.intrinsic.object,e):n.$.lazilyResolve(()=>WS(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class f$ extends Rl{expression=this.reference;structure=void 0;get resolution(){const e=this._resolve();return Ln[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=Ln[e];const r=[];for(;pe(n,"context");){if(r.includes(n.id))return Z(d$(n.id,r));r.push(n.id),n=Ln[n.id]}return pe(n,"root")?n:Et(`Unexpected resolution for reference ${this.reference}
89
+ `})}}),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=Qp(this,e,this.$);return n instanceof ae?n.throw():n}rawPipeOnce(e){return pe(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 o=this.$.node(n,r);if(o.isRoot())return o.isUnknown()?this:Et(`Unexpected constraint node ${o}`);const c=e==="root"?this:this[e];if(c.hasKind("morph")||o.impliedBasis&&!c.extends(o.impliedBasis))return g2(n,o.impliedBasis,this);const u=this.$.node("intersection",{[o.kind]:o}),d=e==="out"?Qp(this,u,this.$):Gi(this,u,this.$);return d instanceof ae&&d.throw(),this.$.finalize(d)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((o,c)=>o==="structure"?n==="ignore"?fN(c,{undeclared:1}):{...c,undeclared:n}:c,r?void 0:{shouldTransform:o=>!ns(pf,o.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!Do(this.shallowMorphs,e.shallowMorphs)||!Do(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",lo(e))}lessThan(e){return this.constrain("max",lo(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",lo(e))}lessThanLength(e){return this.constrain("maxLength",lo(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",lo(e))}earlierThan(e){return this.constrain("before",lo(e))}}const a$="Expected a non-empty brand name after #",lo=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},eu=(t,e)=>pe(e,"root")?pe(t,"root")?t.extends(e):e.allows(t):pe(t,"root")?t.hasUnit(e):e===t,QS=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(ne.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(ne.intrinsic.emptyStructure):null,l$=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
90
+ ${t}`,WS=(t,e)=>`${t} operand must be an object (was ${e})`,Ol=(t,e)=>He(py(t),(n,r)=>[r,e]),c$=t=>typeof t=="string"?{reference:t}:t,ex=t=>t instanceof ae?ne.intrinsic.never.internal:t,u$=ct({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:c$,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>ex(Bt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...Ol("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(ne.intrinsic.object)?ae.init("assignability",ne.intrinsic.object,e):n.$.lazilyResolve(()=>ex(Bt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class f$ extends Rl{expression=this.reference;structure=void 0;get resolution(){const e=this._resolve();return Ln[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=Ln[e];const r=[];for(;pe(n,"context");){if(r.includes(n.id))return Z(d$(n.id,r));r.push(n.id),n=Ln[n.id]}return pe(n,"root")?n:Et(`Unexpected resolution for reference ${this.reference}
91
91
  Seen: [${r.join("->")}]
92
- Resolution: ${Pe(n)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const e=this.reference.slice(1),n=this.$.resolutions[e];return typeof n=="string"?n:pe(n,"root")?n.id:Et(`Unexpected resolution for reference ${this.reference}: ${Pe(n)}`)}get defaultShortDescription(){return Ii.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]=Ie(r,e),this.resolution.traverseAllows(e,n))};traverseApply=(e,n)=>{const r=n.seen[this.reference];r?.includes(e)||(n.seen[this.reference]=Ie(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 d$=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,by={implementation:u$,Node:f$};class vy extends Rl{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 mf(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const h$=ct({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:ay(t,"numberAllowsNaN")&&t.domain!=="number"?Z(Sy.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Ii[t.domain],actual:t=>Number.isNaN(t)?"NaN":Ii[Xn(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:ae.init("domain",t,e)}});class p$ extends vy{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>Xn(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 Ii[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const Sy={implementation:h$,Node:p$,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},m$=ct({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Qt(t))return t;const{structure:e,...n}=t,r=!!e,o=e??{},c=He(n,(u,d)=>vi(u,r2)?(r&&Z(`Flattened structure key ${u} cannot be specified alongside a root 'structure' key.`),o[u]=d,[]):[u,d]);return(pe(o,"constraint")||!xl(o))&&(c.structure=o),c},finalizeInnerJson:({structure:t,...e})=>bs(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,...o}=e,c=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:c}}},divisor:{child:!0,parse:ln("divisor")},max:{child:!0,parse:ln("max")},min:{child:!0,parse:ln("min")},maxLength:{child:!0,parse:ln("maxLength")},minLength:{child:!0,parse:ln("minLength")},exactLength:{child:!0,parse:ln("exactLength")},before:{child:!0,parse:ln("before")},after:{child:!0,parse:ln("after")},pattern:{child:!0,parse:ln("pattern")},predicate:{child:!0,parse:ln("predicate")}},reduce:(t,e)=>ex({},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.refinements.some(n=>n.impl.obviatesBasisDescription)&&e.push(t.basis.description),t.refinements.length){const n=t.refinements.toSorted((r,o)=>r.kind==="min"&&o.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(`
92
+ Resolution: ${Pe(n)}`)}get resolutionId(){if(this.reference.includes("&")||this.reference.includes("=>"))return this.resolution.id;if(this.reference[0]!=="$")return this.reference;const e=this.reference.slice(1),n=this.$.resolutions[e];return typeof n=="string"?n:pe(n,"root")?n.id:Et(`Unexpected resolution for reference ${this.reference}: ${Pe(n)}`)}get defaultShortDescription(){return Ii.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]=Ie(r,e),this.resolution.traverseAllows(e,n))};traverseApply=(e,n)=>{const r=n.seen[this.reference];r?.includes(e)||(n.seen[this.reference]=Ie(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 d$=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,vy={implementation:u$,Node:f$};class Sy extends Rl{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 yf(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const h$=ct({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:ly(t,"numberAllowsNaN")&&t.domain!=="number"?Z(xy.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>Ii[t.domain],actual:t=>Number.isNaN(t)?"NaN":Ii[Xn(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:ae.init("domain",t,e)}});class p$ extends Sy{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>Xn(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 Ii[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const xy={implementation:h$,Node:p$,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},m$=ct({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Qt(t))return t;const{structure:e,...n}=t,r=!!e,o=e??{},c=He(n,(u,d)=>vi(u,r2)?(r&&Z(`Flattened structure key ${u} cannot be specified alongside a root 'structure' key.`),o[u]=d,[]):[u,d]);return(pe(o,"constraint")||!xl(o))&&(c.structure=o),c},finalizeInnerJson:({structure:t,...e})=>bs(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,...o}=e,c=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:c}}},divisor:{child:!0,parse:ln("divisor")},max:{child:!0,parse:ln("max")},min:{child:!0,parse:ln("min")},maxLength:{child:!0,parse:ln("maxLength")},minLength:{child:!0,parse:ln("minLength")},exactLength:{child:!0,parse:ln("exactLength")},before:{child:!0,parse:ln("before")},after:{child:!0,parse:ln("after")},pattern:{child:!0,parse:ln("pattern")},predicate:{child:!0,parse:ln("predicate")}},reduce:(t,e)=>tx({},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.refinements.some(n=>n.impl.obviatesBasisDescription)&&e.push(t.basis.description),t.refinements.length){const n=t.refinements.toSorted((r,o)=>r.kind==="min"&&o.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(`
93
93
  ◦ `)}`,problem:t=>`(${t.actual}) must be...
94
- ${t.expected}`},intersections:{intersection:(t,e,n)=>ex(t.inner,e.inner,n),...Ol("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:o,...c}=t.inner,u=o??r,d=u?Bt(u,e,n):e;return d instanceof ae?d:t?.basis?.equals(d)?t:t.$.node("intersection",{...c,[d.kind]:d},{prereduced:!0})})}});class y$ extends Rl{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(e=>e.isRefinement());structure=this.inner.structure;expression=g$(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.refinements.length){for(let o=0;o<this.refinements.length-1;o++)if(this.refinements[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;if(this.refinements.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 o=0;o<this.inner.predicate.length-1;o++)if(this.inner.predicate[o].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.refinements.length){for(let n=0;n<this.refinements.length-1;n++)e.check(this.refinements[n]),e.returnIfFailFast();e.check(this.refinements.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 WT={implementation:m$,Node:y$},g$=t=>{let e=t.structure?.expression||`${t.basis&&!t.refinements.some(n=>n.impl.obviatesBasisExpression)?t.basis.nestableExpression+" ":""}${t.refinements.map(n=>n.expression).join(" & ")}`||"unknown";return e==="Array == 0"&&(e="[]"),e},ex=(t,e,n)=>{const r={},o=t.proto??t.domain,c=e.proto??e.domain,u=o?c?Bt(o,c,n):o:c;return u instanceof ae?u:(u&&(r[u.kind]=u),Pu({kind:"intersection",baseInner:r,l:qu(t),r:qu(e),roots:[],ctx:n}))},b$=ct({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:Sl,serialize:t=>t.map(e=>pe(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.in.description} to ${t.out?.description??"unknown"}`},intersections:{morph:(t,e,n)=>{if(!t.hasEqualMorphs(e))return Z(S$(t.expression,e.expression));const r=Bt(t.in,e.in,n);if(r instanceof ae)return r;const o={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const c=Bt(t.in,e.in,n);if(c instanceof ae)return c.throw();o.declaredIn=c}if(t.declaredOut||e.declaredOut){const c=Bt(t.out,e.out,n);if(c instanceof ae)return c.throw();o.declaredOut=c}return r.distribute(c=>n.$.node("morph",{...o,in:c}),n.$.parseSchema)},...Ol("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 v$ extends Rl{serializedMorphs=this.morphs.map(en);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=pe(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??ne.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??ne.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.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:"morph",base:this.in.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 Do(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||pe(n,"root")&&pe(r,"root")&&n.equals(r)})}}const eA={implementation:b$,Node:v$},S$=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
94
+ ${t.expected}`},intersections:{intersection:(t,e,n)=>tx(t.inner,e.inner,n),...Ol("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:o,...c}=t.inner,u=o??r,d=u?Bt(u,e,n):e;return d instanceof ae?d:t?.basis?.equals(d)?t:t.$.node("intersection",{...c,[d.kind]:d},{prereduced:!0})})}});class y$ extends Rl{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(e=>e.isRefinement());structure=this.inner.structure;expression=g$(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.refinements.length){for(let o=0;o<this.refinements.length-1;o++)if(this.refinements[o].traverseApply(e,n),n.failFast&&n.currentErrorCount>r)return;if(this.refinements.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 o=0;o<this.inner.predicate.length-1;o++)if(this.inner.predicate[o].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.refinements.length){for(let n=0;n<this.refinements.length-1;n++)e.check(this.refinements[n]),e.returnIfFailFast();e.check(this.refinements.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 WT={implementation:m$,Node:y$},g$=t=>{let e=t.structure?.expression||`${t.basis&&!t.refinements.some(n=>n.impl.obviatesBasisExpression)?t.basis.nestableExpression+" ":""}${t.refinements.map(n=>n.expression).join(" & ")}`||"unknown";return e==="Array == 0"&&(e="[]"),e},tx=(t,e,n)=>{const r={},o=t.proto??t.domain,c=e.proto??e.domain,u=o?c?Bt(o,c,n):o:c;return u instanceof ae?u:(u&&(r[u.kind]=u),Pu({kind:"intersection",baseInner:r,l:qu(t),r:qu(e),roots:[],ctx:n}))},b$=ct({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:Sl,serialize:t=>t.map(e=>pe(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.in.description} to ${t.out?.description??"unknown"}`},intersections:{morph:(t,e,n)=>{if(!t.hasEqualMorphs(e))return Z(S$(t.expression,e.expression));const r=Bt(t.in,e.in,n);if(r instanceof ae)return r;const o={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const c=Bt(t.in,e.in,n);if(c instanceof ae)return c.throw();o.declaredIn=c}if(t.declaredOut||e.declaredOut){const c=Bt(t.out,e.out,n);if(c instanceof ae)return c.throw();o.declaredOut=c}return r.distribute(c=>n.$.node("morph",{...o,in:c}),n.$.parseSchema)},...Ol("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 v$ extends Rl{serializedMorphs=this.morphs.map(en);compiledMorphs=`[${this.serializedMorphs}]`;lastMorph=this.inner.morphs.at(-1);lastMorphIfNode=pe(this.lastMorph,"root")?this.lastMorph:void 0;introspectableIn=this.inner.in;introspectableOut=this.lastMorphIfNode?Object.assign(this.referencesById,this.lastMorphIfNode.referencesById)&&this.lastMorphIfNode.out:void 0;get shallowMorphs(){return Array.isArray(this.inner.in?.shallowMorphs)?[...this.inner.in.shallowMorphs,...this.morphs]:this.morphs}get in(){return this.declaredIn??this.inner.in?.in??ne.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??ne.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.in.expression}) => ${this.lastMorphIfNode?"To":"Out"}<${this.out.expression}>`;get defaultShortDescription(){return this.in.meta.description??this.in.defaultShortDescription}innerToJsonSchema(e){return e.fallback.morph({code:"morph",base:this.in.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 Do(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||pe(n,"root")&&pe(r,"root")&&n.equals(r)})}}const eA={implementation:b$,Node:v$},S$=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
95
95
  Left: ${t}
96
- Right: ${e}`,x$=ct({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>cy(t)??ps(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:$o[t]}:typeof t=="function"?Qt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:$o[t.proto]}:t;return typeof e.proto!="function"&&Z(Hu.writeInvalidSchemaMessage(e.proto)),ay(e,"dateAllowsInvalid")&&e.proto!==Date&&Z(Hu.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?vN[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":qp(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:KS(t.proto,e.proto)?t:KS(e.proto,t.proto)?e:ae.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:ae.init("domain",ne.intrinsic.object.internal,e)}});class w$ extends vy{builtinName=cy(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 Hu={implementation:x$,Node:w$,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${Xn(t)})`},T$=ct({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,e)=>{const n=[];for(const r of t){const o=pe(r,"root")?r.branches:e.$.parseSchema(r).branches;for(const c of o)if(c.hasKind("morph")){const u=n.findIndex(d=>d.hasKind("morph")&&d.hasEqualMorphs(c));if(u===-1)n.push(c);else{const d=n[u];n[u]=e.$.node("morph",{...d.inner,in:d.in.rawOr(c.in)})}}else n.push(c)}return e.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Yt(t)?{branches:t}:t,reduce:(t,e)=>{const n=$$(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,To),expected:t=>{const e=rN(t.errors,"propString"),n=Object.entries(e).map(([r,o])=>{const c=[];for(const h of o)cs(c,h.expected);const u=To(c),d=o.every(h=>h.actual===o[0].actual)?o[0].actual:Pe(o[0].data);return`${r&&`${r} `}must be ${u}${d&&` (was ${d})`}`});return To(n)},problem:t=>t.expected,message:t=>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&&Z(B$(t.expression,e.expression)),r=tp(e.branches,t.branches,n),r instanceof ae&&r.invert()):r=tp(t.branches,e.branches,n),r instanceof ae?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...Ol("union",(t,e,n)=>{const r=tp(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 A$ extends Rl{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]=ne.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?C$(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,N$);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==Ui)return r;const o=new po(e,this.$.resolvedConfig);return this.traverseApply(e,o),o.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>cs(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,To)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(ne.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&ay(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 o=0;o<this.branches.length;o++){if(n.pushBranch(),this.branches[o].traverseApply(e,n),!n.hasError())return this.branches[o].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 Ui};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,o=Object.keys(r),{optimistic:c}=e;if(e.optimistic=!1,e.block(`switch(${n})`,()=>{for(const y in r){const g=r[y],v=y==="default"?y:`case ${y}`;e.line(`${v}: return ${g===!0?c?e.data:g:c?`${e.invoke(g)} ? ${g.contextFreeMorph?`${en(g.contextFreeMorph)}(${e.data})`:e.data} : "${Ui}"`:e.invoke(g)}`)}return e}),e.traversalKind==="Allows"){e.return(c?`"${Ui}"`:!1);return}const u=To(this.discriminant.kind==="domain"?o.map(y=>{const g=y.slice(1,-1);return g==="function"?Ii.object:Ii[g]}):o),d=this.discriminant.path.map(y=>typeof y=="symbol"?en(y):JSON.stringify(y)),h=JSON.stringify(u),p=this.discriminant.kind==="domain"?`${k$}[${n}]`:`${M$}(${n})`;e.line(`ctx.errorFromNodeContext({
96
+ Right: ${e}`,x$=ct({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>uy(t)??ps(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:$o[t]}:typeof t=="function"?Qt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:$o[t.proto]}:t;return typeof e.proto!="function"&&Z(Hu.writeInvalidSchemaMessage(e.proto)),ly(e,"dateAllowsInvalid")&&e.proto!==Date&&Z(Hu.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?vN[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":Ip(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:PS(t.proto,e.proto)?t:PS(e.proto,t.proto)?e:ae.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:ae.init("domain",ne.intrinsic.object.internal,e)}});class w$ extends Sy{builtinName=uy(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 Hu={implementation:x$,Node:w$,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${Xn(t)})`},T$=ct({kind:"union",hasAssociatedError:!0,collapsibleKey:"branches",keys:{ordered:{},branches:{child:!0,parse:(t,e)=>{const n=[];for(const r of t){const o=pe(r,"root")?r.branches:e.$.parseSchema(r).branches;for(const c of o)if(c.hasKind("morph")){const u=n.findIndex(d=>d.hasKind("morph")&&d.hasEqualMorphs(c));if(u===-1)n.push(c);else{const d=n[u];n[u]=e.$.node("morph",{...d.inner,in:d.in.rawOr(c.in)})}}else n.push(c)}return e.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Yt(t)?{branches:t}:t,reduce:(t,e)=>{const n=$$(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,To),expected:t=>{const e=rN(t.errors,"propString"),n=Object.entries(e).map(([r,o])=>{const c=[];for(const h of o)cs(c,h.expected);const u=To(c),d=o.every(h=>h.actual===o[0].actual)?o[0].actual:Pe(o[0].data);return`${r&&`${r} `}must be ${u}${d&&` (was ${d})`}`});return To(n)},problem:t=>t.expected,message:t=>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&&Z(B$(t.expression,e.expression)),r=np(e.branches,t.branches,n),r instanceof ae&&r.invert()):r=np(t.branches,e.branches,n),r instanceof ae?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...Ol("union",(t,e,n)=>{const r=np(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 A$ extends Rl{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]=ne.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?C$(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,N$);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==Ui)return r;const o=new po(e,this.$.resolvedConfig);return this.traverseApply(e,o),o.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>cs(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,To)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(ne.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&ly(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 o=0;o<this.branches.length;o++){if(n.pushBranch(),this.branches[o].traverseApply(e,n),!n.hasError())return this.branches[o].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 Ui};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,o=Object.keys(r),{optimistic:c}=e;if(e.optimistic=!1,e.block(`switch(${n})`,()=>{for(const y in r){const g=r[y],v=y==="default"?y:`case ${y}`;e.line(`${v}: return ${g===!0?c?e.data:g:c?`${e.invoke(g)} ? ${g.contextFreeMorph?`${en(g.contextFreeMorph)}(${e.data})`:e.data} : "${Ui}"`:e.invoke(g)}`)}return e}),e.traversalKind==="Allows"){e.return(c?`"${Ui}"`:!1);return}const u=To(this.discriminant.kind==="domain"?o.map(y=>{const g=y.slice(1,-1);return g==="function"?Ii.object:Ii[g]}):o),d=this.discriminant.path.map(y=>typeof y=="symbol"?en(y):JSON.stringify(y)),h=JSON.stringify(u),p=this.discriminant.kind==="domain"?`${k$}[${n}]`:`${M$}(${n})`;e.line(`ctx.errorFromNodeContext({
97
97
  code: "predicate",
98
98
  expected: ${h},
99
99
  actual: ${p},
100
100
  relativePath: [${d}],
101
101
  meta: ${this.compiledMeta}
102
- })`)}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)}(${e.data})`:e.data:!0));e.return(n?`"${Ui}"`:!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 c=He(this.unitBranches,(u,d)=>[`${d.in.serializedValue}`,d.hasKind("morph")?d:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:c}}const e=[];for(let c=0;c<this.branches.length-1;c++){const u=this.branches[c];for(let d=c+1;d<this.branches.length;d++){const h=this.branches[d],p=Gi(u.in,h.in,u.$);if(p instanceof ae)for(const y of p){if(!y.kind||y.optional)continue;let g,v;if(y.kind==="domain"){const w=y.l,T=y.r;g=`"${typeof w=="string"?w:w.domain}"`,v=`"${typeof T=="string"?T:T.domain}"`}else if(y.kind==="unit")g=y.l.serializedValue,v=y.r.serializedValue;else continue;const S=e.find(w=>Do(w.path,y.path)&&w.kind===y.kind);S?(S.cases[g]?S.cases[g].branchIndices=cs(S.cases[g].branchIndices,c):S.cases[g]??={branchIndices:[c],condition:y.l},S.cases[v]?S.cases[v].branchIndices=cs(S.cases[v].branchIndices,d):S.cases[v]??={branchIndices:[d],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[c],condition:y.l},[v]:{branchIndices:[d],condition:y.r}},path:y.path})}}}const n=this.ordered?O$(e,this.branches):e;if(!n.length)return null;const r=E$(n,this),o={};for(const c in r.best.cases){const u=R$(r,c);if(u===null){o[c]=!0;continue}if(u.length===this.branches.length)return null;this.ordered&&u.sort((p,y)=>p.originalIndex-y.originalIndex);const d=u.map(p=>p.branch),h=d.length===1?d[0]:this.$.node("union",this.ordered?{branches:d,ordered:!0}:d);Object.assign(this.referencesById,h.referencesById),o[c]=h}if(r.defaultEntries.length){const c=r.defaultEntries.map(u=>u.branch);o.default=this.$.node("union",this.ordered?{branches:c,ordered:!0}:c,{prereduced:!0}),Object.assign(this.referencesById,o.default.referencesById)}return Object.assign(r.location,{cases:o})}}const E$=(t,e)=>{const n=t.sort((c,u)=>Object.keys(u.cases).length-Object.keys(c.cases).length)[0],r={kind:n.kind,path:n.path,optionallyChainedPropString:tA(n.path)},o=e.branches.map((c,u)=>({originalIndex:u,branch:c}));return{best:n,location:r,defaultEntries:o,node:e}},R$=(t,e)=>{const n=t.best.cases[e],r=_$(n.condition,t.location.path,t.node.$);let o=[];const c=[];for(let u=0;u<t.defaultEntries.length;u++){const d=t.defaultEntries[u];if(n.branchIndices.includes(d.originalIndex)){const h=tx(t.node.branches[d.originalIndex],t.location);h===null?o=null:o?.push({originalIndex:d.originalIndex,branch:h})}else if(d.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o?.push(d);else{if(d.branch.in.overlaps(r)){const h=tx(d.branch,t.location);o?.push({originalIndex:d.originalIndex,branch:h})}c.push(d)}}return t.defaultEntries=c,o},O$=(t,e)=>t.filter(r=>{const o=Object.values(r.cases).map(c=>c.branchIndices);for(let c=0;c<o.length-1;c++){const u=o[c];for(let d=c+1;d<o.length;d++){const h=o[d];for(const p of u)for(const y of h)if(p>y&&e[p].overlaps(e[y]))return!1}}return!0}),_$=(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 o=e.length-1;o>=0;o--){const c=e[o];r=n.node("intersection",typeof c=="number"?{proto:"Array",sequence:[...nN(c).map(u=>({})),r]}:{domain:"object",required:[{key:c,value:r}]})}return r},tA=t=>t.reduce((e,n)=>e+TT(n,!0),"data"),k$=en(sN),M$=en(Pe),nA={implementation:T$,Node:A$},C$=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:El(e)),cases:He(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),D$={delimiter:" | ",finalDelimiter:" | "},N$=t=>To(t,D$),To=(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 o={},c=t.filter(d=>o[d]?!1:o[d]=!0),u=c.pop();return`${c.join(n)}${c.length?r:""}${u}`},tp=(t,e,n)=>{const r=e.map(()=>[]);for(let c=0;c<t.length;c++){let u={};for(let d=0;d<e.length;d++){if(r[d]===null)continue;if(t[c].equals(e[d])){r[d]=null,u={};break}const h=Bt(t[c],e[d],n);if(!(h instanceof ae)){if(h.equals(t[c])){r[d].push(t[c]),u={};break}h.equals(e[d])?r[d]=null:u[d]=h}}for(const d in u)r[d][c]=u[d]}const o=r.flatMap((c,u)=>c?.flatMap(d=>d.branches)??e[u]);return o.length===0?ae.init("union",t,e):o},$$=({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 o=r+1;o<t.length&&n[r]&&n[o];o++){if(t[r].equals(t[o])){n[o]=!1;continue}const c=Gi(t[r].in,t[o].in,t[0].$);c instanceof ae||(e||j$(t[r],t[o]),c.equals(t[r].in)?n[r]=!!e:c.equals(t[o].in)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},j$=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Do(t.shallowMorphs,e.shallowMorphs)||Z(nx(t.expression,e.expression)),Do(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)})||Z(nx(t.expression,e.expression)))},tx=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=tA(r.path);return e.optionallyChainedPropString.startsWith(o)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||e.kind==="unit")&&o===e.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),nx=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
102
+ })`)}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)}(${e.data})`:e.data:!0));e.return(n?`"${Ui}"`:!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 c=He(this.unitBranches,(u,d)=>[`${d.in.serializedValue}`,d.hasKind("morph")?d:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:c}}const e=[];for(let c=0;c<this.branches.length-1;c++){const u=this.branches[c];for(let d=c+1;d<this.branches.length;d++){const h=this.branches[d],p=Gi(u.in,h.in,u.$);if(p instanceof ae)for(const y of p){if(!y.kind||y.optional)continue;let g,v;if(y.kind==="domain"){const w=y.l,T=y.r;g=`"${typeof w=="string"?w:w.domain}"`,v=`"${typeof T=="string"?T:T.domain}"`}else if(y.kind==="unit")g=y.l.serializedValue,v=y.r.serializedValue;else continue;const S=e.find(w=>Do(w.path,y.path)&&w.kind===y.kind);S?(S.cases[g]?S.cases[g].branchIndices=cs(S.cases[g].branchIndices,c):S.cases[g]??={branchIndices:[c],condition:y.l},S.cases[v]?S.cases[v].branchIndices=cs(S.cases[v].branchIndices,d):S.cases[v]??={branchIndices:[d],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[c],condition:y.l},[v]:{branchIndices:[d],condition:y.r}},path:y.path})}}}const n=this.ordered?O$(e,this.branches):e;if(!n.length)return null;const r=E$(n,this),o={};for(const c in r.best.cases){const u=R$(r,c);if(u===null){o[c]=!0;continue}if(u.length===this.branches.length)return null;this.ordered&&u.sort((p,y)=>p.originalIndex-y.originalIndex);const d=u.map(p=>p.branch),h=d.length===1?d[0]:this.$.node("union",this.ordered?{branches:d,ordered:!0}:d);Object.assign(this.referencesById,h.referencesById),o[c]=h}if(r.defaultEntries.length){const c=r.defaultEntries.map(u=>u.branch);o.default=this.$.node("union",this.ordered?{branches:c,ordered:!0}:c,{prereduced:!0}),Object.assign(this.referencesById,o.default.referencesById)}return Object.assign(r.location,{cases:o})}}const E$=(t,e)=>{const n=t.sort((c,u)=>Object.keys(u.cases).length-Object.keys(c.cases).length)[0],r={kind:n.kind,path:n.path,optionallyChainedPropString:tA(n.path)},o=e.branches.map((c,u)=>({originalIndex:u,branch:c}));return{best:n,location:r,defaultEntries:o,node:e}},R$=(t,e)=>{const n=t.best.cases[e],r=_$(n.condition,t.location.path,t.node.$);let o=[];const c=[];for(let u=0;u<t.defaultEntries.length;u++){const d=t.defaultEntries[u];if(n.branchIndices.includes(d.originalIndex)){const h=nx(t.node.branches[d.originalIndex],t.location);h===null?o=null:o?.push({originalIndex:d.originalIndex,branch:h})}else if(d.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o?.push(d);else{if(d.branch.in.overlaps(r)){const h=nx(d.branch,t.location);o?.push({originalIndex:d.originalIndex,branch:h})}c.push(d)}}return t.defaultEntries=c,o},O$=(t,e)=>t.filter(r=>{const o=Object.values(r.cases).map(c=>c.branchIndices);for(let c=0;c<o.length-1;c++){const u=o[c];for(let d=c+1;d<o.length;d++){const h=o[d];for(const p of u)for(const y of h)if(p>y&&e[p].overlaps(e[y]))return!1}}return!0}),_$=(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 o=e.length-1;o>=0;o--){const c=e[o];r=n.node("intersection",typeof c=="number"?{proto:"Array",sequence:[...nN(c).map(u=>({})),r]}:{domain:"object",required:[{key:c,value:r}]})}return r},tA=t=>t.reduce((e,n)=>e+TT(n,!0),"data"),k$=en(sN),M$=en(Pe),nA={implementation:T$,Node:A$},C$=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:El(e)),cases:He(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),D$={delimiter:" | ",finalDelimiter:" | "},N$=t=>To(t,D$),To=(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 o={},c=t.filter(d=>o[d]?!1:o[d]=!0),u=c.pop();return`${c.join(n)}${c.length?r:""}${u}`},np=(t,e,n)=>{const r=e.map(()=>[]);for(let c=0;c<t.length;c++){let u={};for(let d=0;d<e.length;d++){if(r[d]===null)continue;if(t[c].equals(e[d])){r[d]=null,u={};break}const h=Bt(t[c],e[d],n);if(!(h instanceof ae)){if(h.equals(t[c])){r[d].push(t[c]),u={};break}h.equals(e[d])?r[d]=null:u[d]=h}}for(const d in u)r[d][c]=u[d]}const o=r.flatMap((c,u)=>c?.flatMap(d=>d.branches)??e[u]);return o.length===0?ae.init("union",t,e):o},$$=({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 o=r+1;o<t.length&&n[r]&&n[o];o++){if(t[r].equals(t[o])){n[o]=!1;continue}const c=Gi(t[r].in,t[o].in,t[0].$);c instanceof ae||(e||j$(t[r],t[o]),c.equals(t[r].in)?n[r]=!!e:c.equals(t[o].in)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},j$=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Do(t.shallowMorphs,e.shallowMorphs)||Z(ix(t.expression,e.expression)),Do(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)})||Z(ix(t.expression,e.expression)))},nx=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=tA(r.path);return e.optionallyChainedPropString.startsWith(o)?n.hasKind("domain")&&n.domain==="object"||(n.hasKind("domain")||e.kind==="unit")&&o===e.optionallyChainedPropString?!0:n.children.length!==0&&n.kind!=="index":!1}}),ix=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
103
103
  Left: ${t}
104
104
  Right: ${e}`,B$=(t,e)=>`The intersection of two ordered unions is indeterminate:
105
105
  Left: ${t}
106
- Right: ${e}`,L$=ct({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():ps(t)}},normalize:t=>t,defaults:{description:t=>Pe(t.unit),problem:({expected:t,actual:e})=>`${t===e?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${e})`}`},intersections:{unit:(t,e)=>ae.init("unit",t,e),...Ol("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:ne.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:ne.intrinsic[t.domain];return ae.init("domain",o,r)}}return ae.init("assignability",t,e.hasKind("intersection")?e.children.find(r=>!r.allows(t.unit)):e)})}});class V$ extends vy{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=ix(this.unit,this.serializedValue);compiledNegation=ix(this.unit,this.serializedValue,"negated");expression=Pe(this.unit);domain=Xn(this.unit);get defaultShortDescription(){return this.domain==="object"?Ii.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:ne.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 iA={implementation:L$,Node:V$},ix=(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}`},U$=ct({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(ne.intrinsic.key))return Z(P$(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?Z(K$(r.map(o=>Pe(o.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),o=r instanceof ae?ne.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:o})}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 z$ extends qo{impliedBasis=ne.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ie(this.value.flatRefs.map(e=>_r([this.signature,...e.path],e.node)),_r([this.signature],this.value));traverseAllows=(e,n)=>Vu(e).every(r=>this.signature.traverseAllows(r[0],n)?Fi(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Vu(e))this.signature.traverseAllows(r[0],n)&&Fi(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 rA={implementation:U$,Node:z$},K$=t=>`Index keys ${t.join(", ")} should be specified as named props.`,P$=t=>`Indexed key definition '${t}' must be a string or symbol`,q$=ct({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:Wp,optional:Wp}});class I$ extends XT{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=mf(this.errorContext)}const sA={implementation:q$,Node:I$},H$=ct({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 gy(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,ps(e[1])])},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 Z(X$);if(t.optionals?.length||t.defaultables?.length)return Z(aA)}return t.minVariadicLength&&!t.variadic?Z("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()??[],o=t.defaultables?.slice()??[],c=t.optionals?.slice()??[],u=t.postfix?.slice()??[];if(t.variadic){for(;c.at(-1)?.equals(t.variadic);)c.pop();if(c.length===0&&o.length===0)for(;r.at(-1)?.equals(t.variadic);)r.pop(),n++;for(;u[0]?.equals(t.variadic);)u.shift(),n++}else c.length===0&&o.length===0&&r.push(...u.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return e.node("sequence",{...t,prefix:r,defaultables:o,optionals:c,postfix:u,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Pe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const r=Za({l:t.tuple,r:e.tuple,disjoint:new ae,result:[],fixedVariants:[],ctx:n}),o=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return o.length===0?r.disjoint:o.length===1?n.$.node("sequence",rx(o[0].result)):n.$.node("union",o.map(c=>({proto:Array,sequence:rx(c.result)})))}}});class F$ extends qo{impliedBasis=ne.intrinsic.Array.internal;tuple=J$(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=ss(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return FS(this.flatRefs,this.prevariadic.flatMap((e,n)=>Ie(e.node.flatRefs.map(r=>_r([`${n}`,...r.path],r.node)),_r([`${n}`],e.node)))),FS(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Ie(e.flatRefs.map(n=>_r([ne.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),_r([ne.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=Y$(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??Et(`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++)Fi(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 o=`${n+this.prefixLength}`;e.if(`${o} >= ${e.data}.length`,()=>e.traversalKind==="Allows"?e.return(!0):e.return()),e.traverseKey(o,`data[${o}]`,r)}if(this.variadic&&(this.postfix&&e.const("firstPostfixIndex",`${e.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 o=`firstPostfixIndex + ${n}`;e.traverseKey(o,`data[${o}]`,r)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(ne.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 o=r.node.toJsonSchemaRecurse(n);if(r.kind==="defaultables"){const c=typeof r.default=="function"?r.default():r.default;o.default=ne.intrinsic.jsonData.allows(c)?c:n.fallback.defaultValue({code:"defaultValue",base:o,value:c})}return o})),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 o=this.postfix.map(c=>c.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:r,elements:o})}}else e.items=!1,delete e.maxItems;return e}}const G$={},Y$=t=>{if(!t.defaultables)return[];const e=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=r;o++){const[c,u]=t.defaultables[o-t.prefixLength];e.push(QT(o,c,u)),n+=`${o}: ${c.id} = ${ps(u)}, `}return n+="]",G$[n]??=e},oA={implementation:H$,Node:F$},J$=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},rx=t=>t.reduce((e,n)=>(n.kind==="variadic"?e.variadic=n.node:n.kind==="defaultables"?e.defaultables=Ie(e.defaultables,[[n.node,n.default]]):e[n.kind]=Ie(e[n.kind],n.node),e),{}),aA="A postfix required element cannot follow an optional or defaultable element",X$="A postfix element requires a variadic element",Za=t=>{const[e,...n]=t.l,[r,...o]=t.r;if(!e||!r)return t;const c=n.at(-1)?.kind==="postfix",u=o.at(-1)?.kind==="postfix",d=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":c||u?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&u){const g=Za({...t,fixedVariants:[],r:o.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(r.kind==="prefix"&&e.kind==="variadic"&&c){const g=Za({...t,fixedVariants:[],l:n.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=Bt(e.node,r.node,t.ctx);if(h instanceof ae)if(d==="prefix"||d==="postfix")t.disjoint.push(...h.withPrefixKey(d==="prefix"?t.result.length:`-${n.length+1}`,"required")),t.result=[...t.result,{kind:d,node:ne.intrinsic.never.internal}];else return d==="optionals"||d==="defaultables"?t:Za({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else d==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Z(ZT(e.default,r.default)),t.result=[...t.result,{kind:d,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:Et(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:d,node:h}];const p=t.l.length,y=t.r.length;return(e.kind!=="variadic"||p>=y&&(r.kind==="variadic"||y===1))&&(t.l=n),(r.kind!=="variadic"||y>=p&&(e.kind==="variadic"||p===1))&&(t.r=o),Za(t)},lA=t=>e=>{if(e.props.length||e.index){const n=e.index?.map(o=>o[t])??[];for(const o of e.props)n.push(o[t]);e.undeclared&&n.push(`+ (undeclared): ${e.undeclared}`);const r=`{ ${n.join(", ")} }`;return e.sequence?`${r} & ${e.sequence.description}`:r}return e.sequence?.description??"{}"},Z$=lA("description"),Q$=lA("expression"),sx=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Gi(t.value,e.value,n);return o instanceof ae?r==="optional"?n.node("optional",{key:t.key,value:ne.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},W$=ct({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:ln("required"),reduceIo:(t,e,n)=>{e.required=Ie(e.required,n.map(r=>r[t]))}},optional:{child:!0,parse:ln("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(r=>r.in);return}for(const r of n)e[r.outProp.kind]=Ie(e[r.outProp.kind],r.outProp.out)}},index:{child:!0,parse:ln("index")},sequence:{child:!0,parse:ln("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,e,n)=>{n==="delete"&&(t==="in"?delete e.undeclared:e.undeclared="reject")}}},defaults:{description:Z$},intersections:{structure:(t,e,n)=>{const r={...t.inner},o={...e.inner},c=new ae;if(t.undeclared){const h=t.keyof();for(const p of e.requiredKeys)h.allows(p)||c.add("presence",ne.intrinsic.never.internal,e.propsByKey[p].value,{path:[p]});o.optional&&(o.optional=o.optional.filter(p=>h.allows(p.key))),o.index&&(o.index=o.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Gi(h,p.signature,n.$);if(y instanceof ae)return[];const g=em(y,p.value,n.$);return g.required&&(o.required=ss(o.required,g.required)),g.optional&&(o.optional=ss(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const p of t.requiredKeys)h.allows(p)||c.add("presence",t.propsByKey[p].value,ne.intrinsic.never.internal,{path:[p]});r.optional&&(r.optional=r.optional.filter(p=>h.allows(p.key))),r.index&&(r.index=r.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Gi(h,p.signature,n.$);if(y instanceof ae)return[];const g=em(y,p.value,n.$);return g.required&&(r.required=ss(r.required,g.required)),g.optional&&(r.optional=ss(r.optional,g.optional)),g.index??[]}))}const u={};(t.undeclared||e.undeclared)&&(u.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const d=Pu({kind:"structure",baseInner:u,l:qu(r),r:qu(o),roots:[],ctx:n});return d instanceof ae&&c.push(...d),c.length?c:d}},reduce:(t,e)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const r=t.required??[],o=t.optional??[],c=[...o];for(const u of t.index){for(const d of r){const h=sx(d,u,e);if(h instanceof ae)return h}for(const[d,h]of o.entries()){const p=sx(h,u,e);if(p instanceof ae)return p;p!==null&&(c[d]=p,n=!0)}}if(n)return e.node("structure",{...t,optional:c},{prereduced:!0})}}});class ej extends qo{impliedBasis=ne.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=ss(this.required,this.optional);propsByKey=He(this.props,(e,n)=>[n.key,n]);propsByKeyReference=en(this.propsByKey);expression=Q$(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 o=this.propsByKey[r.key];if(Qt(r))return r.kind!=="required"&&r.kind!=="optional"?Z(`Map result must have kind "required" or "optional" (was ${r.kind})`):(n[r.kind]=Ie(n[r.kind],r),n);const c=r.kind??o?.kind??"required",u=He(r,(d,h)=>d in yy.implementation.keys?[d,h]:[]);return n[c]=Ie(n[c],this.$.node(c,u)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!eu(r,this.keyof()));if(n.length)return Z(ox(this.expression,n))}get(e,...n){let r,o=!1;const c=rj(e);if((typeof c=="string"||typeof c=="symbol")&&this.propsByKey[c]&&(r=this.propsByKey[c].value,o=this.propsByKey[c].required),this.index)for(const d of this.index)eu(c,d.signature)&&(r=r?.and(d.value)??d.value);if(this.sequence&&eu(c,ne.intrinsic.nonNegativeIntegerString))if(pe(c,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const d=Number.parseInt(c);if(d<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[d].node;r=r?.and(h)??h,o||=d<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&&pe(c,"root")&&c.extends(ne.intrinsic.number)?Z(sj(c.expression,this.sequence.expression)):Z(ox(this.expression,[c]));const u=r.get(...n);return o?u:u.or(ne.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=Ie(n.required,e.required)),e.optional&&(n.optional=Ie(n.optional,e.optional)),e.index&&(n.index=Ie(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=ET(this.inner),o=c=>{const u=n.some(d=>eu(c,d));return e==="pick"?u:!u};return r.required&&(r.required=r.required.filter(c=>o(c.key))),r.optional&&(r.optional=r.optional.filter(c=>o(c.key))),r.index&&(r.index=r.index.filter(c=>o(c.signature))),r}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,r)=>{const o=r?.currentErrorCount??0;for(let c=0;c<this.props.length;c++)if(e==="Allows"){if(!this.props[c].traverseAllows(n,r))return!1}else if(this.props[c].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)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>o)return!1}if(this.index||this.undeclared==="reject"){const c=Object.keys(n);c.push(...Object.getOwnPropertySymbols(n));for(let u=0;u<c.length;u++){const d=c[u];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(d,r)){if(e==="Allows"){if(!Fi(d,()=>h.value.traverseAllows(n[d],r),r))return!1}else if(Fi(d,()=>h.value.traverseApply(n[d],r),r),r.failFast&&r.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(d)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[d],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&&ne.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",nj(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 kt.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const r of this.props){const o=r.value.toJsonSchemaRecurse(n);if(typeof r.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:r.key,value:o,optional:r.optional});continue}if(r.hasDefault()){const c=typeof r.default=="function"?r.default():r.default;o.default=ne.intrinsic.jsonData.allows(c)?c:n.fallback.defaultValue({code:"defaultValue",base:o,value:c})}e.properties[r.key]=o}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 o=r.value.toJsonSchemaRecurse(n);if(r.signature.equals(ne.intrinsic.string)){e.additionalProperties=o;continue}for(const c of r.signature.branches){if(!c.extends(ne.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let u={type:"string"};if(c.hasKind("morph")&&(u=n.fallback.morph({code:"morph",base:c.in.toJsonSchemaRecurse(n),out:c.out.toJsonSchemaRecurse(n)})),!c.hasKind("intersection"))return Et(`Unexpected index branch kind ${c.kind}.`);const{pattern:d}=c.inner;if(d){const h=Object.assign(u,{pattern:d[0].rule});for(let p=1;p<d.length;p++)u=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:d[p].rule});e.patternProperties??={},e.patternProperties[h.pattern]=o}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const np={},tj=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+=ve.nonNegativeIntegerString.id;else for(let n=0;n<t.sequence.tuple.length;n++)e+=n+" | ";e+=")"}return e},nj=t=>{const e=tj(t);if(!e)return;if(np[e])return np[e];const n=(r,o)=>{for(let c=0;c<t.defaultable.length;c++)t.defaultable[c].key in r||t.defaultable[c].defaultValueMorph(r,o);if(t.sequence?.defaultables)for(let c=r.length-t.sequence.prefixLength;c<t.sequence.defaultables.length;c++)t.sequence.defaultValueMorphs[c](r,o);if(t.undeclared==="delete")for(const c in r)t.declaresKey(c)||delete r[c];return r};return np[e]=n},ij=(t,e)=>{const r=`(data${e.defaultable.some(o=>o.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(o=>o.length===2)?", ctx":""})`;return t.block(`${r} => `,o=>{for(let c=0;c<e.defaultable.length;c++){const{serializedKey:u,defaultValueMorphRef:d}=e.defaultable[c];o.if(`!(${u} in data)`,h=>h.line(`${d}${r}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,c=>c.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",c=>c.if(`!(${e._compileDeclaresKey(c)})`,u=>u.line("delete data[k]"))),o.return("data")})},cA={implementation:W$,Node:ej},rj=t=>(pe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),sj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,em=(t,e,n)=>{const[r,o]=tN(t.branches,u=>u.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const c={};for(const u of r){const d=n.node("required",{key:u.unit,value:e});c[d.kind]=Ie(c[d.kind],d)}return o.length&&(c.index=n.node("index",{signature:o,value:e})),c},oj=t=>pe(t,"root")?t.expression:Pe(t),ox=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(oj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,gf={...Y2,alias:by.implementation,domain:Sy.implementation,unit:iA.implementation,proto:Hu.implementation,union:nA.implementation,morph:eA.implementation,intersection:WT.implementation,divisor:jT.implementation,pattern:GT.implementation,predicate:$T.implementation,required:sA.implementation,optional:yy.implementation,index:rA.implementation,sequence:oA.implementation,structure:cA.implementation};ne.defaultConfig=hN(Object.assign(He(gf,(t,e)=>[t,e.defaults]),{jitless:TN(),clone:SN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:kt.defaultConfig}));ne.resolvedConfig=Jp(ne.defaultConfig,ne.config);const aj={...J2,alias:by.Node,domain:Sy.Node,unit:iA.Node,proto:Hu.Node,union:nA.Node,morph:eA.Node,intersection:WT.Node,divisor:jT.Node,pattern:GT.Node,predicate:$T.Node,required:sA.Node,optional:yy.Node,index:rA.Node,sequence:oA.Node,structure:cA.Node};class tm extends lN{get[Hi](){return"module"}}const uA=(t,e)=>new tm(He(t,(n,r)=>[n,pe(r,"module")?uA(r,e):e.bindReference(r)])),lj=t=>Yt(t)?t:"branches"in t&&Yt(t.branches)?t.branches:void 0,cj=(t,e)=>Z(`Node of kind ${e} is not valid as a ${t} definition`),ax=t=>`#${t} duplicates public alias ${t}`,ip={};ne.ambient??={};let lx;const fA="function $",uj=t=>dA(t,hA(t)),dA=(t,e)=>{const n=e.write(fA,4),r=e.compile()();for(const o of t)o.precompilation||(o.traverseAllows=r[`${o.id}Allows`].bind(r),o.isRoot()&&!o.allowsRequiresContext&&(o.allows=o.traverseAllows),o.traverseApply=r[`${o.id}Apply`].bind(r),r[`${o.id}Optimistic`]&&(o.traverseOptimistic=r[`${o.id}Optimistic`].bind(r)),o.precompilation=n)},hA=t=>new wT().return(t.reduce((e,n)=>{const r=new ep({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),c=new ep({kind:"Apply"}).indent();n.compile(c);const u=c.write(`${n.id}Apply`),d=`${e}${o},
106
+ Right: ${e}`,L$=ct({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():ps(t)}},normalize:t=>t,defaults:{description:t=>Pe(t.unit),problem:({expected:t,actual:e})=>`${t===e?`must be reference equal to ${t} (serialized to the same value)`:`must be ${t} (was ${e})`}`},intersections:{unit:(t,e)=>ae.init("unit",t,e),...Ol("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:ne.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:ne.intrinsic[t.domain];return ae.init("domain",o,r)}}return ae.init("assignability",t,e.hasKind("intersection")?e.children.find(r=>!r.allows(t.unit)):e)})}});class V$ extends Sy{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=rx(this.unit,this.serializedValue);compiledNegation=rx(this.unit,this.serializedValue,"negated");expression=Pe(this.unit);domain=Xn(this.unit);get defaultShortDescription(){return this.domain==="object"?Ii.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:ne.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 iA={implementation:L$,Node:V$},rx=(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}`},U$=ct({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(ne.intrinsic.key))return Z(P$(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?Z(K$(r.map(o=>Pe(o.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),o=r instanceof ae?ne.intrinsic.never.internal:r;return n.$.node("index",{signature:t.signature,value:o})}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 z$ extends qo{impliedBasis=ne.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ie(this.value.flatRefs.map(e=>_r([this.signature,...e.path],e.node)),_r([this.signature],this.value));traverseAllows=(e,n)=>Vu(e).every(r=>this.signature.traverseAllows(r[0],n)?Fi(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Vu(e))this.signature.traverseAllows(r[0],n)&&Fi(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 rA={implementation:U$,Node:z$},K$=t=>`Index keys ${t.join(", ")} should be specified as named props.`,P$=t=>`Indexed key definition '${t}' must be a string or symbol`,q$=ct({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:em,optional:em}});class I$ extends XT{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=yf(this.errorContext)}const sA={implementation:q$,Node:I$},H$=ct({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 by(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,ps(e[1])])},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 Z(X$);if(t.optionals?.length||t.defaultables?.length)return Z(aA)}return t.minVariadicLength&&!t.variadic?Z("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()??[],o=t.defaultables?.slice()??[],c=t.optionals?.slice()??[],u=t.postfix?.slice()??[];if(t.variadic){for(;c.at(-1)?.equals(t.variadic);)c.pop();if(c.length===0&&o.length===0)for(;r.at(-1)?.equals(t.variadic);)r.pop(),n++;for(;u[0]?.equals(t.variadic);)u.shift(),n++}else c.length===0&&o.length===0&&r.push(...u.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==r.length)return e.node("sequence",{...t,prefix:r,defaultables:o,optionals:c,postfix:u,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${Pe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const r=Za({l:t.tuple,r:e.tuple,disjoint:new ae,result:[],fixedVariants:[],ctx:n}),o=r.disjoint.length===0?[r,...r.fixedVariants]:r.fixedVariants;return o.length===0?r.disjoint:o.length===1?n.$.node("sequence",sx(o[0].result)):n.$.node("union",o.map(c=>({proto:Array,sequence:sx(c.result)})))}}});class F$ extends qo{impliedBasis=ne.intrinsic.Array.internal;tuple=J$(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=ss(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return GS(this.flatRefs,this.prevariadic.flatMap((e,n)=>Ie(e.node.flatRefs.map(r=>_r([`${n}`,...r.path],r.node)),_r([`${n}`],e.node)))),GS(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Ie(e.flatRefs.map(n=>_r([ne.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),_r([ne.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=Y$(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??Et(`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++)Fi(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 o=`${n+this.prefixLength}`;e.if(`${o} >= ${e.data}.length`,()=>e.traversalKind==="Allows"?e.return(!0):e.return()),e.traverseKey(o,`data[${o}]`,r)}if(this.variadic&&(this.postfix&&e.const("firstPostfixIndex",`${e.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 o=`firstPostfixIndex + ${n}`;e.traverseKey(o,`data[${o}]`,r)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(ne.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 o=r.node.toJsonSchemaRecurse(n);if(r.kind==="defaultables"){const c=typeof r.default=="function"?r.default():r.default;o.default=ne.intrinsic.jsonData.allows(c)?c:n.fallback.defaultValue({code:"defaultValue",base:o,value:c})}return o})),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 o=this.postfix.map(c=>c.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:r,elements:o})}}else e.items=!1,delete e.maxItems;return e}}const G$={},Y$=t=>{if(!t.defaultables)return[];const e=[];let n="[";const r=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=r;o++){const[c,u]=t.defaultables[o-t.prefixLength];e.push(QT(o,c,u)),n+=`${o}: ${c.id} = ${ps(u)}, `}return n+="]",G$[n]??=e},oA={implementation:H$,Node:F$},J$=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},sx=t=>t.reduce((e,n)=>(n.kind==="variadic"?e.variadic=n.node:n.kind==="defaultables"?e.defaultables=Ie(e.defaultables,[[n.node,n.default]]):e[n.kind]=Ie(e[n.kind],n.node),e),{}),aA="A postfix required element cannot follow an optional or defaultable element",X$="A postfix element requires a variadic element",Za=t=>{const[e,...n]=t.l,[r,...o]=t.r;if(!e||!r)return t;const c=n.at(-1)?.kind==="postfix",u=o.at(-1)?.kind==="postfix",d=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":c||u?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&u){const g=Za({...t,fixedVariants:[],r:o.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(r.kind==="prefix"&&e.kind==="variadic"&&c){const g=Za({...t,fixedVariants:[],l:n.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=Bt(e.node,r.node,t.ctx);if(h instanceof ae)if(d==="prefix"||d==="postfix")t.disjoint.push(...h.withPrefixKey(d==="prefix"?t.result.length:`-${n.length+1}`,"required")),t.result=[...t.result,{kind:d,node:ne.intrinsic.never.internal}];else return d==="optionals"||d==="defaultables"?t:Za({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else d==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Z(ZT(e.default,r.default)),t.result=[...t.result,{kind:d,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:Et(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:d,node:h}];const p=t.l.length,y=t.r.length;return(e.kind!=="variadic"||p>=y&&(r.kind==="variadic"||y===1))&&(t.l=n),(r.kind!=="variadic"||y>=p&&(e.kind==="variadic"||p===1))&&(t.r=o),Za(t)},lA=t=>e=>{if(e.props.length||e.index){const n=e.index?.map(o=>o[t])??[];for(const o of e.props)n.push(o[t]);e.undeclared&&n.push(`+ (undeclared): ${e.undeclared}`);const r=`{ ${n.join(", ")} }`;return e.sequence?`${r} & ${e.sequence.description}`:r}return e.sequence?.description??"{}"},Z$=lA("description"),Q$=lA("expression"),ox=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Gi(t.value,e.value,n);return o instanceof ae?r==="optional"?n.node("optional",{key:t.key,value:ne.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},W$=ct({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:ln("required"),reduceIo:(t,e,n)=>{e.required=Ie(e.required,n.map(r=>r[t]))}},optional:{child:!0,parse:ln("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(r=>r.in);return}for(const r of n)e[r.outProp.kind]=Ie(e[r.outProp.kind],r.outProp.out)}},index:{child:!0,parse:ln("index")},sequence:{child:!0,parse:ln("sequence")},undeclared:{parse:t=>t==="ignore"?void 0:t,reduceIo:(t,e,n)=>{n==="delete"&&(t==="in"?delete e.undeclared:e.undeclared="reject")}}},defaults:{description:Z$},intersections:{structure:(t,e,n)=>{const r={...t.inner},o={...e.inner},c=new ae;if(t.undeclared){const h=t.keyof();for(const p of e.requiredKeys)h.allows(p)||c.add("presence",ne.intrinsic.never.internal,e.propsByKey[p].value,{path:[p]});o.optional&&(o.optional=o.optional.filter(p=>h.allows(p.key))),o.index&&(o.index=o.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Gi(h,p.signature,n.$);if(y instanceof ae)return[];const g=tm(y,p.value,n.$);return g.required&&(o.required=ss(o.required,g.required)),g.optional&&(o.optional=ss(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const p of t.requiredKeys)h.allows(p)||c.add("presence",t.propsByKey[p].value,ne.intrinsic.never.internal,{path:[p]});r.optional&&(r.optional=r.optional.filter(p=>h.allows(p.key))),r.index&&(r.index=r.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Gi(h,p.signature,n.$);if(y instanceof ae)return[];const g=tm(y,p.value,n.$);return g.required&&(r.required=ss(r.required,g.required)),g.optional&&(r.optional=ss(r.optional,g.optional)),g.index??[]}))}const u={};(t.undeclared||e.undeclared)&&(u.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const d=Pu({kind:"structure",baseInner:u,l:qu(r),r:qu(o),roots:[],ctx:n});return d instanceof ae&&c.push(...d),c.length?c:d}},reduce:(t,e)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const r=t.required??[],o=t.optional??[],c=[...o];for(const u of t.index){for(const d of r){const h=ox(d,u,e);if(h instanceof ae)return h}for(const[d,h]of o.entries()){const p=ox(h,u,e);if(p instanceof ae)return p;p!==null&&(c[d]=p,n=!0)}}if(n)return e.node("structure",{...t,optional:c},{prereduced:!0})}}});class ej extends qo{impliedBasis=ne.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=ss(this.required,this.optional);propsByKey=He(this.props,(e,n)=>[n.key,n]);propsByKeyReference=en(this.propsByKey);expression=Q$(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 o=this.propsByKey[r.key];if(Qt(r))return r.kind!=="required"&&r.kind!=="optional"?Z(`Map result must have kind "required" or "optional" (was ${r.kind})`):(n[r.kind]=Ie(n[r.kind],r),n);const c=r.kind??o?.kind??"required",u=He(r,(d,h)=>d in gy.implementation.keys?[d,h]:[]);return n[c]=Ie(n[c],this.$.node(c,u)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!eu(r,this.keyof()));if(n.length)return Z(ax(this.expression,n))}get(e,...n){let r,o=!1;const c=rj(e);if((typeof c=="string"||typeof c=="symbol")&&this.propsByKey[c]&&(r=this.propsByKey[c].value,o=this.propsByKey[c].required),this.index)for(const d of this.index)eu(c,d.signature)&&(r=r?.and(d.value)??d.value);if(this.sequence&&eu(c,ne.intrinsic.nonNegativeIntegerString))if(pe(c,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const d=Number.parseInt(c);if(d<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[d].node;r=r?.and(h)??h,o||=d<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&&pe(c,"root")&&c.extends(ne.intrinsic.number)?Z(sj(c.expression,this.sequence.expression)):Z(ax(this.expression,[c]));const u=r.get(...n);return o?u:u.or(ne.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=Ie(n.required,e.required)),e.optional&&(n.optional=Ie(n.optional,e.optional)),e.index&&(n.index=Ie(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=ET(this.inner),o=c=>{const u=n.some(d=>eu(c,d));return e==="pick"?u:!u};return r.required&&(r.required=r.required.filter(c=>o(c.key))),r.optional&&(r.optional=r.optional.filter(c=>o(c.key))),r.index&&(r.index=r.index.filter(c=>o(c.signature))),r}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,r)=>{const o=r?.currentErrorCount??0;for(let c=0;c<this.props.length;c++)if(e==="Allows"){if(!this.props[c].traverseAllows(n,r))return!1}else if(this.props[c].traverseApply(n,r),r.failFast&&r.currentErrorCount>o)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>o)return!1}if(this.index||this.undeclared==="reject"){const c=Object.keys(n);c.push(...Object.getOwnPropertySymbols(n));for(let u=0;u<c.length;u++){const d=c[u];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(d,r)){if(e==="Allows"){if(!Fi(d,()=>h.value.traverseAllows(n[d],r),r))return!1}else if(Fi(d,()=>h.value.traverseApply(n[d],r),r),r.failFast&&r.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(d)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[d],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&&ne.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",nj(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 kt.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const r of this.props){const o=r.value.toJsonSchemaRecurse(n);if(typeof r.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:r.key,value:o,optional:r.optional});continue}if(r.hasDefault()){const c=typeof r.default=="function"?r.default():r.default;o.default=ne.intrinsic.jsonData.allows(c)?c:n.fallback.defaultValue({code:"defaultValue",base:o,value:c})}e.properties[r.key]=o}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 o=r.value.toJsonSchemaRecurse(n);if(r.signature.equals(ne.intrinsic.string)){e.additionalProperties=o;continue}for(const c of r.signature.branches){if(!c.extends(ne.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let u={type:"string"};if(c.hasKind("morph")&&(u=n.fallback.morph({code:"morph",base:c.in.toJsonSchemaRecurse(n),out:c.out.toJsonSchemaRecurse(n)})),!c.hasKind("intersection"))return Et(`Unexpected index branch kind ${c.kind}.`);const{pattern:d}=c.inner;if(d){const h=Object.assign(u,{pattern:d[0].rule});for(let p=1;p<d.length;p++)u=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:d[p].rule});e.patternProperties??={},e.patternProperties[h.pattern]=o}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const ip={},tj=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+=ve.nonNegativeIntegerString.id;else for(let n=0;n<t.sequence.tuple.length;n++)e+=n+" | ";e+=")"}return e},nj=t=>{const e=tj(t);if(!e)return;if(ip[e])return ip[e];const n=(r,o)=>{for(let c=0;c<t.defaultable.length;c++)t.defaultable[c].key in r||t.defaultable[c].defaultValueMorph(r,o);if(t.sequence?.defaultables)for(let c=r.length-t.sequence.prefixLength;c<t.sequence.defaultables.length;c++)t.sequence.defaultValueMorphs[c](r,o);if(t.undeclared==="delete")for(const c in r)t.declaresKey(c)||delete r[c];return r};return ip[e]=n},ij=(t,e)=>{const r=`(data${e.defaultable.some(o=>o.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(o=>o.length===2)?", ctx":""})`;return t.block(`${r} => `,o=>{for(let c=0;c<e.defaultable.length;c++){const{serializedKey:u,defaultValueMorphRef:d}=e.defaultable[c];o.if(`!(${u} in data)`,h=>h.line(`${d}${r}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,c=>c.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",c=>c.if(`!(${e._compileDeclaresKey(c)})`,u=>u.line("delete data[k]"))),o.return("data")})},cA={implementation:W$,Node:ej},rj=t=>(pe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),sj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,tm=(t,e,n)=>{const[r,o]=tN(t.branches,u=>u.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const c={};for(const u of r){const d=n.node("required",{key:u.unit,value:e});c[d.kind]=Ie(c[d.kind],d)}return o.length&&(c.index=n.node("index",{signature:o,value:e})),c},oj=t=>pe(t,"root")?t.expression:Pe(t),ax=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(oj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,bf={...Y2,alias:vy.implementation,domain:xy.implementation,unit:iA.implementation,proto:Hu.implementation,union:nA.implementation,morph:eA.implementation,intersection:WT.implementation,divisor:jT.implementation,pattern:GT.implementation,predicate:$T.implementation,required:sA.implementation,optional:gy.implementation,index:rA.implementation,sequence:oA.implementation,structure:cA.implementation};ne.defaultConfig=hN(Object.assign(He(bf,(t,e)=>[t,e.defaults]),{jitless:TN(),clone:SN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:kt.defaultConfig}));ne.resolvedConfig=Xp(ne.defaultConfig,ne.config);const aj={...J2,alias:vy.Node,domain:xy.Node,unit:iA.Node,proto:Hu.Node,union:nA.Node,morph:eA.Node,intersection:WT.Node,divisor:jT.Node,pattern:GT.Node,predicate:$T.Node,required:sA.Node,optional:gy.Node,index:rA.Node,sequence:oA.Node,structure:cA.Node};class nm extends lN{get[Hi](){return"module"}}const uA=(t,e)=>new nm(He(t,(n,r)=>[n,pe(r,"module")?uA(r,e):e.bindReference(r)])),lj=t=>Yt(t)?t:"branches"in t&&Yt(t.branches)?t.branches:void 0,cj=(t,e)=>Z(`Node of kind ${e} is not valid as a ${t} definition`),lx=t=>`#${t} duplicates public alias ${t}`,rp={};ne.ambient??={};let cx;const fA="function $",uj=t=>dA(t,hA(t)),dA=(t,e)=>{const n=e.write(fA,4),r=e.compile()();for(const o of t)o.precompilation||(o.traverseAllows=r[`${o.id}Allows`].bind(r),o.isRoot()&&!o.allowsRequiresContext&&(o.allows=o.traverseAllows),o.traverseApply=r[`${o.id}Apply`].bind(r),r[`${o.id}Optimistic`]&&(o.traverseOptimistic=r[`${o.id}Optimistic`].bind(r)),o.precompilation=n)},hA=t=>new wT().return(t.reduce((e,n)=>{const r=new tp({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),c=new tp({kind:"Apply"}).indent();n.compile(c);const u=c.write(`${n.id}Apply`),d=`${e}${o},
107
107
  ${u},
108
- `;if(!n.hasKind("union"))return d;const h=new ep({kind:"Allows",optimistic:!0}).indent();n.compile(h);const p=h.write(`${n.id}Optimistic`);return`${d}${p},
108
+ `;if(!n.hasKind("union"))return d;const h=new tp({kind:"Allows",optimistic:!0}).indent();n.compile(h);const p=h.write(`${n.id}Optimistic`);return`${d}${p},
109
109
  `},`{
110
- `)+"}");class pA{config;resolvedConfig;name;get[Hi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=Jp(ne.config,n),this.resolvedConfig=Jp(ne.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(ip).length}`,this.name in ip&&Z(`A Scope already named ${this.name} already exists`),ip[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,c]of r){let u=o;if(o[0]==="#"?(u=o.slice(1),u in this.aliases&&Z(ax(u)),this.aliases[u]=c):(u in this.aliases&&Z(ax(o)),this.aliases[u]=c,this.exportedNames.push(u)),!pe(c,"module")&&!pe(c,"generic")&&!ff(c)){const d=this.preparseOwnDefinitionFormat(c,{alias:u});this.resolutions[u]=pe(d,"root")?this.bindReference(d):this.createParseContext(d).id}}lx??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[lx.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=ne.intrinsic?He(ne.intrinsic,(o,c)=>o.startsWith("json")?[]:[o,this.bindReference(c)]):{}}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,o)=>new Iu(e,o?new NT(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const c of e)r.includes(c)||r.push(c);const o=r.map(c=>this.node("unit",{unit:c},n));return this.node("union",o,{...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(pu(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:pu(n,e);if(Qt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:d}=by.implementation.normalize(n,this);if(d.startsWith("$")){const h=this.resolveRoot(d.slice(1));n=h,o=h.kind}}else if(o==="union"&&bs(n,"object")){const d=lj(n);d?.length===1&&(n=d[0],o=pu(n))}if(Qt(n)&&n.kind===o)return n;const u=gf[o].normalize?.(n,this)??n;return Qt(u)?u.kind===o?u:cj(o,u.kind):{...r,$:this,kind:o,def:u,prefix:r.alias??o}}bindReference(e){let n;return Qt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Iu(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Z(bA(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!pe(n,"generic"))return n}maybeResolveSubalias(e){return nm(this.aliases,e)??nm(this.ambient,e)}get ambient(){return ne.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=Ln[n];if(pe(o,"root"))return this.resolutions[e]=o;if(pe(o,"context")){if(o.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(o.phase==="resolved")return Et(`Unexpected resolved context for was uncached by its scope: ${Pe(o)}`);o.phase="resolving";const c=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Ln[c.id]=c,Ln[o.id]=c,this.resolutions[e]=c}return Et(`Unexpected nodesById entry for ${n}: ${Pe(o)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),pe(r,"generic")?this.resolutions[e]=this.bindReference(r):pe(r,"module")?(r.root||Z(vA(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??YT(e.prefix);return Ln[n]=Object.assign(e,{[Hi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new po(e,this.resolvedConfig)}import(...e){return new tm(He(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=pe(o,"module")?uA(o,this):cx(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=gA(this,this._exports),this._json=yA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=hA(this.references);this.precompilation=r.write(fA,4),dA(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new tm(He(n,(r,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const o=this.preparseNode(e,n,r);if(Qt(o))return this.bindReference(o);const c=this.createParseContext(o),u=JT(c),d=this.bindReference(u);return Ln[c.id]=d};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(pe(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(pe(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);Ln[o.id]=o;let c=this.bindReference(this.parseOwnDefinitionFormat(e,o));return c.isCyclic&&(c=e$(c,o.id)),Ln[o.id]=c,c}finalize(e){return cx(e),!e.precompilation&&!this.resolvedConfig.jitless&&uj(e.references),e}}class mA extends pA{parseOwnDefinitionFormat(e,n){return JT(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(pu(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const cx=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},yA=t=>He(t,(e,n)=>[e,pe(n,"root")||pe(n,"generic")?n.json:pe(n,"module")?yA(n):Et(`Unexpected resolution ${Pe(n)}`)]),nm=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),o=t[r];if(o===void 0)return;if(!pe(o,"module"))return Z(fj(r));const c=e.slice(n+1),u=o[c];if(u===void 0)return nm(o,c);if(pe(u,"root")||pe(u,"generic"))return u;if(pe(u,"module"))return u.root??Z(vA(e));Et(`Unexpected resolution for alias '${e}': ${Pe(u)}`)},xy=(t,e)=>new mA(t,e),_l=new mA({}),gA=(t,e)=>{const n={};for(const r in e){const o=e[r];if(pe(o,"module")){const c=gA(t,o),u=He(c,(d,h)=>[`${r}.${d}`,h]);Object.assign(n,u)}else pe(o,"root")||pe(o,"generic")?n[r]=o:Et(`Unexpected scope resolution ${Pe(o)}`)}return n},bA=t=>`'${t}' is unresolvable`,fj=t=>`'${t}' must reference a module to be accessed using dot syntax`,vA=t=>`Reference to submodule '${t}' must specify an alias`;_l.export();const Ge=_l.schema,wy=_l.node;_l.defineSchema;const Xi=_l.generic,SA="^(?:0|[1-9]\\d*)$",dj=new RegExp(SA);en(dj);const xA=xy({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();ne.intrinsic={...xA};const wA=xy({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:SA}},{prereducedAliases:!0}).export();Object.assign(ne.intrinsic,wA);const hj=xy({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ve={...xA,...wA,...hj,emptyStructure:wy("structure",{},{prereduced:!0})};ne.intrinsic={...ve};const pj=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],ux=t=>t.toString()!=="Invalid Date",mj=t=>t.slice(2,-1),TA=t=>`'${t}' could not be parsed by the Date constructor`,yj=(t,e)=>gj(t,e),gj=(t,e)=>{const n=new Date(t);if(ux(n))return n;const r=KN(t);if(r!==void 0){const o=new Date(r);if(ux(o))return o}return e?Z(e===!0?TA(t):e):void 0},fx=(t,e)=>{const n=t.scanner.shiftUntil(vj[EA[e]]);if(t.scanner.lookahead==="")return t.error(xj(n,e));if(t.scanner.shift(),e==="/"){try{new RegExp(n)}catch(r){Z(String(r))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(vi(e,AA))t.root=t.ctx.$.node("unit",{unit:n});else{const r=yj(n,TA(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},AA={"'":1,'"':1},bj={"/":1,"'":1,'"':1},EA={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},vj={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},Sj={'"':"double-quote","'":"single-quote","/":"forward slash"},xj=(t,e)=>`${e}${t} requires a closing ${Sj[EA[e]]}`,wj=t=>`Private type references should not include '#'. Use '${t}' instead.`,RA="Optional definitions like 'string?' are only valid as properties in an object or tuple",OA="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Tj={">":!0,">=":!0},Aj={"<":!0,"<=":!0},Fu={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},Ej=t=>`Unmatched )${t===""?"":` before ${t}`}`,_A=t=>`Missing ${t}`,Rj=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,kA=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,Oj=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Fu[e]}, ${n}${Fu[r]})`,_j=(t,e,n)=>MA(t,e,n,[]),MA=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(CA(t,e.names,r.map(c=>c.expression))):r:o.finalizer===","?MA(t,e,n,r):o.error(_A(">"))},CA=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,dx=t=>{const e=t.scanner.shiftUntilNextTerminator();e==="keyof"?t.addPrefix("keyof"):t.root=Mj(t,e)},kj=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(CA(t,e.names,[]));const o=_j(t,e,n);return e(...o)},Mj=(t,e)=>Cj(t,e)??Dj(t,e)??t.error(e===""?t.scanner.lookahead==="#"?wj(t.shiftedByOne().scanner.shiftUntilNextTerminator()):DA(t):bA(e)),Cj=(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(pe(n,"root"))return n;if(n!==void 0)return pe(n,"generic")?kj(e,n,t):Z(`Unexpected resolution ${Pe(n)}`)},Dj=(t,e)=>{const n=PN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=IN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},DA=t=>{const e=t.previousOperator();return e?NA(e,t.scanner.unscanned):Nj(t.scanner.unscanned)},NA=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,Nj=t=>`Expected an expression${t?` before '${t}'`:""}`,$A=t=>t.scanner.lookahead===""?t.error(DA(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(bj)?fx(t,t.scanner.shift()):t.scanner.lookaheadIsIn(df)?$A(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in AA?fx(t,`${t.scanner.shift()}${t.scanner.shift()}`):dx(t);class Lo extends QN{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Lo.terminatingChars)}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...df};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(e,n)=>e===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||vi(n.trimStart()[0],Lo.terminatingChars):e==="="?n[0]!=="=":e===","||e==="?"}const $j=(t,e)=>{const n=Bj(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 Vj(t,n)},jj={"<":1,">":1,"=":1},Bj=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,hx=(t,e,n,r)=>n.extends(ne.intrinsic.number)?typeof e!="number"?Z(im(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(ne.intrinsic.lengthBoundable)?typeof e!="number"?Z(im(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(ne.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Z(N2(n.expression)),Lj=t=>({rule:pj(t.limit)?mj(t.limit):t.limit,exclusive:t.comparator.length===1}),Vj=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),c=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(im(e,c,"right"));const u=o.unit,d=e.length===1,h=hx(e,typeof u=="number"?u:c,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:u}:{rule:u,exclusive:d});if(!t.branches.leftBound)return;if(!vi(e,Aj))return t.error(kA(e));const p=hx(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(p[0],Lj(t.branches.leftBound)),t.branches.leftBound=null},im=(t,e,n)=>`Comparator ${n==="left"?Fu[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,Uj=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(e)},zj=t=>{const e=t.scanner.shiftUntilNextTerminator(),n=qN(e,{errorOnFail:px(e)});n===0&&t.error(px(0)),t.root=t.root.constrain("divisor",n)},px=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,jA=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(Kj):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():Lo.lookaheadIsFinalizing(e,t.scanner.unscanned)?t.finalize(e):vi(e,jj)?$j(t,e):e==="%"?zj(t):e==="#"?Uj(t):e in df?jA(t):t.error(Ty(e))},Ty=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,Kj="Missing expected ']'",Pj=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(qj(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},qj=t=>`Default value '${t}' must a literal value`,mx=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const c=e.$.maybeResolveRoot(t.slice(0,-2));if(c)return c.array()}const r=new bf(new Lo(t),e),o=Ij(r);return r.finalizer===">"&&Z(Ty(">")),o},Ij=t=>{t.parseOperand();let e=Ay(t).root;return e?(t.finalizer==="="?e=Pj(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Z(Ty(t.scanner.lookahead)),e):Et(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Ay=t=>{for(;t.finalizer===void 0;)Hj(t);return t},Hj=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class bf{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 Z(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(_A(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Fu[n];if(!vi(r,Tj))return this.error(kA(n));if(this.branches.leftBound)return this.error(Oj(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(Ej(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():Et(`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 Ay(new bf(this.scanner,this.ctx))}parseOperator(){return jA(this)}parseOperand(){return $A(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(Rj(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 Fj="An empty string is not a valid generic parameter name",rm=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&e.length?e:Z(Fj):(t.shiftUntilNonWhitespace(),Gj(t,r,e,n))},yx="extends ",Gj=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(yx))t.jumpForward(yx.length);else return t.lookahead===","&&t.shift(),n.push(e),rm(t,n,r);const o=Ay(new bf(t,r));return n.push([e,o.root]),rm(t,n,r)};class Yj extends Po{$;constructor(e){super((...n)=>new tu(e)(...n),{bind:e}),this.$=e}in(e){return new tu(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new tu(this.$).at(e,n)}case(e,n){return new tu(this.$).case(e,n)}}class tu extends Po{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,c])=>o==="default"?[o,c]:[this.$.parse(o),c]))),this.$=e,this.in=n}at(e,n){return this.key&&Z(Xj),this.branches.length&&Z(Jj),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),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,o]=e[n];if(r==="default")return n!==e.length-1&&Z("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Z(`Value for case "${r}" must be a function (was ${Xn(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(ve.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:gx});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:gx},"self")),this.$.finalize(o)}}const gx=t=>t.throw(),Jj="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Xj="At most one key matcher may be specified per expression",BA=(t,e)=>{if(Yt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return qA(t,e)},Zj="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Qj="Only required keys may specify default values, e.g. { value: 'number = 0' }",Wj=(t,e)=>{let n;const r={},o=Vu(t);for(const[u,d]of o){const h=nB(u);if(h.kind==="spread"){if(!xl(r))return Z(tB);const S=e.$.parseOwnDefinitionFormat(d,e);if(S.equals(ve.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(ve.object))return Z(iB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){d!=="reject"&&d!=="delete"&&d!=="ignore"&&Z(eB(d)),r.undeclared=d;continue}const p=BA(d,e),y=h;if(h.kind==="required"){Yt(p)?rp(r,"optional",p[1]==="="?{key:h.normalized,value:p[0],default:p[2]}:{key:h.normalized,value:p[0]},e):rp(r,"required",{key:h.normalized,value:p},e);continue}if(Yt(p)&&(p[1]==="?"&&Z(Zj),p[1]==="="&&Z(Qj)),h.kind==="optional"){rp(r,"optional",{key:h.normalized,value:p},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),v=em(g,p,e.$);v.index&&(r.index=Ie(r.index,v.index)),v.required&&(r.required=Ie(r.required,v.required))}const c=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(c)??c})},rp=(t,e,n,r)=>{t[e]=Ie(t[e],r.$.node(e,n))},eB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Pe(t)})`,tB="Spread operator may only be used as the first key in an object",nB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===Ip?{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]===Ip&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},iB=t=>`Spread operand must resolve to an object literal type (was ${t})`,rB=(t,e)=>pB(t)?zA[t[0]](t,e):dB(t)?UA[t[1]](t,e):null,sB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),sp=(t,e)=>{if(t[2]===void 0)return Z(NA(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 o=t[1]==="&"?Gi(n,r,e.$):Zp(n,r,e.$);return o instanceof ae?o.throw():o},oB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),aB=(t,e)=>typeof t[2]!="function"?Z(LA("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),LA=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,lB=(t,e)=>typeof t[2]!="function"?Z(LA(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),cB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configureReferences(t[2],"shallow"),VA=t=>t,uB=VA({"[]":oB,"?":()=>Z(RA)}),fB=VA({"|":sp,"&":sp,":":lB,"=>":aB,"|>":sp,"@":cB,"=":()=>Z(OA)}),UA={...uB,...fB},dB=t=>UA[t[1]]!==void 0,hB=t=>t,zA=hB({keyof:sB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Z(bx(qp(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Z(bx(qp(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),pB=t=>zA[t[0]]!==void 0,bx=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,mB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const c=BA(t[r],e),[u,d,h]=Yt(c)?c:[c];if(r++,o){if(!u.extends(ne.intrinsic.Array))return Z(bB(u.expression));n=n.flatMap(p=>u.distribute(y=>gB(ET(p),y)))}else n=n.map(p=>d==="?"?KA(p,u):d==="="?yB(p,u,h):sm(p,u))}return e.$.parseSchema(n.map(o=>xl(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},sm=(t,e)=>t.defaultables||t.optionals?Z(t.variadic?aA:vB):(t.variadic?t.postfix=Ie(t.postfix,e):t.prefix=Ie(t.prefix,e),t),KA=(t,e)=>t.variadic?Z(PA):(t.optionals=Ie(t.optionals,e),t),yB=(t,e,n)=>t.variadic?Z(PA):t.optionals?Z(SB):(t.defaultables=Ie(t.defaultables,[[e,n]]),t),vx=(t,e)=>(t.postfix&&Z(Sx),t.variadic?t.variadic.equals(e)||Z(Sx):t.variadic=e.internal,t),gB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return vx(t,ne.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)sm(t,r);if(n.optionals)for(const r of n.optionals)KA(t,r);if(n.variadic&&vx(t,n.variadic),n.postfix)for(const r of n.postfix)sm(t,r);return t},bB=t=>`Spread element must be an array (was ${t})`,Sx="A tuple may have at most one variadic element",vB="A required element may not follow an optional element",PA="An optional element may not follow a variadic element",SB="A defaultable element may not follow an optional element without a default",xB={},qA=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return mx(t,e);const n=xB[e.$.name]??={};return n[t]??=mx(t,e)}return bs(t,"object")?wB(t,e):Z(om(Xn(t)))},wB=(t,e)=>{const n=ly(t);switch(n){case void 0:return pe(t,"root")?t:Wj(t,e);case"Array":return TB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=ff(t)?t():t;return pe(r,"root")?r:Z(om("Function"))}default:return Z(om(n??Pe(t)))}},TB=(t,e)=>rB(t,e)??mB(t,e),om=t=>`Type definitions must be strings or objects (was ${t})`;class AB extends Po{constructor(e){const n=Object.assign({errors:Cr,hkt:Si,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,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},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 o=r[0].slice(1,-1),c=e.parseGenericParams(o,{});return new Iu(c,r[1],e,e,null)}return e.parse(r)},{bind:e,attach:n})}}const ll=ne;class vf extends pA{get ambientAttachments(){if(ll.typeAttachments)return this.cacheGetter("ambientAttachments",He(ll.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(pe(n,"module")||pe(n,"generic"))return[e,n];const u=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,d=this.resolvedConfig.keywords?.[u];return d&&(n=[n,"@",d]),[e,n]}e.at(-1)!==">"&&Z("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),c=e.slice(r+1,-1);return[o,()=>{const u=this.parseGenericParams(c,{alias:o});return v2(u,n,this)}]}parseGenericParams(e,n){return rm(new Lo(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return ff(e)&&!pe(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 o=qA(e,n);if(Yt(o)){if(o[1]==="=")return Z(OA);if(o[1]==="?")return Z(RA)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(pN(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);match=new Yj(this);declare=()=>({type:this.type});define(e){return e}type=new AB(this);static scope=(e,n={})=>new vf(e,n);static module=(e,n={})=>this.scope(e,n).export()}const EB=Object.assign(vf.scope,{define:t=>t}),je=vf;class RB extends Si{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const OB=Xi(["base",ve.object],["props",ve.object])(t=>t.base.merge(t.props),RB),_B=je.module({Key:ve.key,Merge:OB});class kB extends Si{}const MB=Xi("element")(t=>{const e=t.element.exclude(ve.Array),n=e.array();return e.rawOr(n).pipe(Sl).distribute(r=>r.assertHasKind("morph").declareOut(n),Ge)},kB),CB=je.module({root:ve.Array,readonly:"root",index:ve.nonNegativeIntegerString,liftFrom:MB},{name:"Array"}),am=Ge(["string",wl.FileConstructor]),DB=am.rawOr(am.array()),xx=Ge({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:DB}}),NB=je.module({root:["instanceof",FormData],value:am,parsed:xx,parse:Ge({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof wl.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:xx})},{name:"FormData"}),$B=je.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"}),jB={Boolean:1,Number:1,String:1},BB=je.module({...He({...uT,...dT},(t,e)=>t in jB?[]:[t,["instanceof",e]]),Array:CB,TypedArray:$B,FormData:NB}),LB=Ge({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"}),VB=Ge({domain:"number",divisor:1}),IA=je.module({root:ve.number,integer:VB,epoch:LB,safe:Ge({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"}),Ye=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),wy("intersection",r)},wx=Ye(Uu,"a well-formed integer string"),HA=je.module({root:wx,parse:Ge({in:wx,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:ve.integer})},{name:"string.integer"}),UB=Ye(/^[\dA-Fa-f]+$/,"hex characters only"),zB=je.module({root:Ye(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Ye(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Tx=Ye(/^[A-Z].*$/,"capitalized"),KB=je.module({root:Ge({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:Tx}),preformatted:Tx},{name:"string.capitalize"}),PB=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,r,o,c=!1;for(let u=e.length-1;u>=0;u--)r=e.substring(u,u+1),o=Number.parseInt(r,10),c?(o*=2,n+=o>=10?o%10+1:o):n+=o,c=!c;return!!(n%10===0&&e)},qB=/^(?: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}))$/,IB=Ge({domain:"string",pattern:{meta:"a credit card number",rule:qB.source},predicate:{meta:"a credit card number",predicate:PB}}),HB=/^([+-]?\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)?)?)?)?$/,FB=t=>!Number.isNaN(new Date(t).valueOf()),Ax=Ge({domain:"string",predicate:{meta:"a parsable date",predicate:FB}}).assertHasKind("intersection"),Ex=HA.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=IA.epoch(n);return r instanceof Cr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),GB=je.module({root:Ex,parse:Ge({in:Ex,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.epoch"}),Rx=Ye(HB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),YB=je.module({root:Rx,parse:Ge({in:Rx,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.iso"}),JB=je.module({root:Ax,parse:Ge({declaredIn:Ax,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:ve.Date}),iso:YB,epoch:GB},{name:"string.date"}),XB=Ye(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),Ox="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",wr=`(${Ox}[.]){3}${Ox}`,ZB=new RegExp(`^${wr}$`),vt="(?:[0-9a-fA-F]{1,4})",QB=new RegExp(`^((?:${vt}:){7}(?:${vt}|:)|(?:${vt}:){6}(?:${wr}|:${vt}|:)|(?:${vt}:){5}(?::${wr}|(:${vt}){1,2}|:)|(?:${vt}:){4}(?:(:${vt}){0,1}:${wr}|(:${vt}){1,3}|:)|(?:${vt}:){3}(?:(:${vt}){0,2}:${wr}|(:${vt}){1,4}|:)|(?:${vt}:){2}(?:(:${vt}){0,3}:${wr}|(:${vt}){1,5}|:)|(?:${vt}:){1}(?:(:${vt}){0,4}:${wr}|(:${vt}){1,6}|:)|(?::((?::${vt}){0,5}:${wr}|(?::${vt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),WB=je.module({root:["v4 | v6","@","an IP address"],v4:Ye(ZB,"an IPv4 address","ipv4"),v6:Ye(QB,"an IPv6 address","ipv6")},{name:"string.ip"}),Ao="a JSON string",FA=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Ao} (${t})`},e3=Ge({meta:Ao,domain:"string",predicate:{meta:Ao,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Ao,problem:FA(n)})}}}}),t3=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Ao,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Ao,problem:FA(n)})}},n3=je.module({root:e3,parse:Ge({meta:"safe JSON string parser",in:"string",morphs:t3,declaredOut:ve.jsonObject})},{name:"string.json"}),_x=Ye(/^[a-z]*$/,"only lowercase letters"),i3=je.module({root:Ge({in:"string",morphs:t=>t.toLowerCase(),declaredOut:_x}),preformatted:_x},{name:"string.lower"}),GA=["NFC","NFD","NFKC","NFKD"],kl=He(GA,(t,e)=>[e,Ge({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Sf=He(GA,(t,e)=>[e,Ge({in:"string",morphs:n=>n.normalize(e),declaredOut:kl[e]})]),r3=je.module({root:Sf.NFC,preformatted:kl.NFC},{name:"string.normalize.NFC"}),s3=je.module({root:Sf.NFD,preformatted:kl.NFD},{name:"string.normalize.NFD"}),o3=je.module({root:Sf.NFKC,preformatted:kl.NFKC},{name:"string.normalize.NFKC"}),a3=je.module({root:Sf.NFKD,preformatted:kl.NFKD},{name:"string.normalize.NFKD"}),l3=je.module({root:"NFC",NFC:r3,NFD:s3,NFKC:o3,NFKD:a3},{name:"string.normalize"}),kx=Ye(Hp,"a well-formed numeric string"),c3=je.module({root:kx,parse:Ge({in:kx,morphs:t=>Number.parseFloat(t),declaredOut:ve.number})},{name:"string.numeric"}),Mx="a regex pattern",u3=Ge({domain:"string",predicate:{meta:Mx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:Mx,problem:String(n)})}}},meta:{format:"regex"}}),f3=/^(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-]+)*))?$/,d3=Ye(f3,"a semantic version (see https://semver.org/)"),Cx=Ye(/^\S.*\S$|^\S?$/,"trimmed"),h3=je.module({root:Ge({in:"string",morphs:t=>t.trim(),declaredOut:Cx}),preformatted:Cx},{name:"string.trim"}),Dx=Ye(/^[A-Z]*$/,"only uppercase letters"),p3=je.module({root:Ge({in:"string",morphs:t=>t.toUpperCase(),declaredOut:Dx}),preformatted:Dx},{name:"string.upper"}),m3=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},Nx=Ge({domain:"string",predicate:{meta:"a URL string",predicate:m3},meta:{format:"uri"}}),y3=je.module({root:Nx,parse:Ge({declaredIn:Nx,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ge(URL)})},{name:"string.url"}),g3=je.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:Ye(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Ye(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Ye(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Ye(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Ye(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Ye(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Ye(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Ye(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),b3=je.module({root:ve.string,alpha:Ye(/^[A-Za-z]*$/,"only letters"),alphanumeric:Ye(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:UB,base64:zB,capitalize:KB,creditCard:IB,date:JB,digits:Ye(/^\d*$/,"only digits 0-9"),email:XB,integer:HA,ip:WB,json:n3,lower:i3,normalize:l3,numeric:c3,regex:u3,semver:d3,trim:h3,upper:p3,url:y3,uuid:g3},{name:"string"}),v3=je.module({bigint:ve.bigint,boolean:ve.boolean,false:ve.false,never:ve.never,null:ve.null,number:ve.number,object:ve.object,string:ve.string,symbol:ve.symbol,true:ve.true,unknown:ve.unknown,undefined:ve.undefined}),S3=je.module({root:ve.unknown,any:ve.unknown},{name:"unknown"}),x3=je.module({root:ve.jsonObject,stringify:wy("morph",{in:ve.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ve.string})},{name:"object.json"}),w3=je.module({root:ve.object,json:x3},{name:"object"});class T3 extends Si{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const A3=Xi(["K",ve.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),T3);class E3 extends Si{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const R3=Xi(["T",ve.object],["K",ve.key])(t=>t.T.pick(t.K),E3);class O3 extends Si{description='omit a set of properties from an object like `Omit(User, "age")`'}const _3=Xi(["T",ve.object],["K",ve.key])(t=>t.T.omit(t.K),O3);class k3 extends Si{description="make all named properties of an object optional like `Partial(User)`"}const M3=Xi(["T",ve.object])(t=>t.T.partial(),k3);class C3 extends Si{description="make all named properties of an object required like `Required(User)`"}const D3=Xi(["T",ve.object])(t=>t.T.required(),C3);class N3 extends Si{description='exclude branches of a union like `Exclude("boolean", "true")`'}const $3=Xi("T","U")(t=>t.T.exclude(t.U),N3);class j3 extends Si{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const B3=Xi("T","U")(t=>t.T.extract(t.U),j3),L3=je.module({Exclude:$3,Extract:B3,Omit:_3,Partial:M3,Pick:R3,Record:A3,Required:D3}),vs=EB({...v3,...L3,...BB,..._B,string:b3,number:IA,object:w3,unknown:S3},{prereducedAliases:!0,name:"ark"}),jt=vs.export();Object.assign(ll.ambient,jt);ll.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 wt=Object.assign(vs.type,ll.typeAttachments);vs.match;vs.generic;vs.schema;vs.define;vs.declare;const YA={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 V3(t){return Number.parseInt(t,10)}const U3=wt(YA),z3=U3.keyof().pipe(t=>V3(t));wt([z3,"string"]);function K3(t){return Y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[Y.jsx("title",{children:"Tempest Games Logo"}),Y.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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 JA(t){return Y.jsx("a",{...t})}const P3={class:"_class_1riwg_1"},op=["⠋","⠙","⠸","⠴","⠦","⠇"];function q3({input:t}){const e=V.useRef(null),[n,r]=V.useState(typeof t=="string"?t:null);return V.useEffect(()=>{let o=!0,c;if(typeof t=="string")r(t);else{let u=0;c=setInterval(()=>{e.current&&(e.current.textContent=op[u],u=(u+1)%op.length)},100),t.then(d=>{o&&(clearInterval(c),r(d))})}return()=>{o=!1,c&&clearInterval(c)}},[t]),Y.jsx("span",{ref:e,children:n??op[0]})}var I3=Object.create,XA=Object.defineProperty,H3=Object.getOwnPropertyDescriptor,ZA=Object.getOwnPropertyNames,F3=Object.getPrototypeOf,G3=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[ZA(t)[0]])((e={exports:{}}).exports,e),e.exports},Y3=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=ZA(e),c=0,u=o.length,d;c<u;c++)d=o[c],!G3.call(t,d)&&d!==n&&XA(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=H3(e,d))||r.enumerable});return t},yt=(t,e,n)=>(n=t!=null?I3(F3(t)):{},Y3(XA(n,"default",{value:t,enumerable:!0}),t)),QA=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(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),J3=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=QA().default;function r(o,c){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,c||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),X3=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=QA().default,r=J3();function o(c){var u=r(c,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ss=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=X3();function r(o,c,u){return(c=n(c))in o?Object.defineProperty(o,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[c]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Zn=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=Ss();function r(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(c,p).enumerable})),d.push.apply(d,h)}return d}function o(c){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?r(Object(d),!0).forEach(function(h){n(c,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(c,h,Object.getOwnPropertyDescriptor(d,h))})}return c}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function xf(t){const e={subscribe(n){let r=null,o=!1,c=!1,u=!1;function d(){if(r===null){u=!0;return}c||(c=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var p;o||(p=n.next)===null||p===void 0||p.call(n,h)},error(h){var p;o||(o=!0,(p=n.error)===null||p===void 0||p.call(n,h),d())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),d())}}),u&&d(),{unsubscribe:d}},pipe(...n){return n.reduce(Z3,e)}};return e}function Z3(t,e){return e(t)}function Q3(t){const e=new AbortController;return new Promise((r,o)=>{let c=!1;function u(){c||(c=!0,d.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const d=t.subscribe({next(h){c=!0,r(h),u()},error(h){o(h)},complete(){e.abort(),u()}})})}function W3(t){return e=>{let n=0,r=null;const o=[];function c(){r||(r=e.subscribe({next(d){for(const p of o){var h;(h=p.next)===null||h===void 0||h.call(p,d)}},error(d){for(const p of o){var h;(h=p.error)===null||h===void 0||h.call(p,d)}},complete(){for(const h of o){var d;(d=h.complete)===null||d===void 0||d.call(h)}}}))}function u(){if(n===0&&r){const d=r;r=null,d.unsubscribe()}}return xf(d=>(n++,o.push(d),c(),{unsubscribe(){n--,u();const h=o.findIndex(p=>p===d);h>-1&&o.splice(h,1)}}))}}function eL(t){let e=t;const n=[],r=u=>{e!==void 0&&u.next(e),n.push(u)},o=u=>{n.splice(n.indexOf(u),1)},c=xf(u=>(r(u),()=>{o(u)}));return c.next=u=>{if(e!==u){e=u;for(const d of n)d.next(u)}},c.get=()=>e,c}function tL(t){return xf(e=>{function n(o=0,c=t.op){const u=t.links[o];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:c,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function cl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var nL=Object.create,WA=Object.defineProperty,iL=Object.getOwnPropertyDescriptor,eE=Object.getOwnPropertyNames,rL=Object.getPrototypeOf,sL=Object.prototype.hasOwnProperty,Ml=(t,e)=>function(){return e||(0,t[eE(t)[0]])((e={exports:{}}).exports,e),e.exports},oL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=eE(e),c=0,u=o.length,d;c<u;c++)d=o[c],!sL.call(t,d)&&d!==n&&WA(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=iL(e,d))||r.enumerable});return t},wf=(t,e,n)=>(n=t!=null?nL(rL(t)):{},oL(WA(n,"default",{value:t,enumerable:!0}),t));const tE=()=>{},$x=t=>{Object.freeze&&Object.freeze(t)};function nE(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(tE,{get(c,u){if(!(typeof u!="string"||u==="then"))return nE(t,[...e,u],n)},apply(c,u,d){const h=e[e.length-1];let p={args:d,path:e};return h==="call"?p={args:d.length>=2?[d[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(p={args:d.length>=2?d[1]:[],path:e.slice(0,-1)}),$x(p.args),$x(p.path),t(p)}})),n[o]}const aL=t=>nE(t,[],Object.create(null)),lL=t=>new Proxy(tE,{get(e,n){if(n!=="then")return t(n)}});var iE=Ml({"../../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(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),cL=Ml({"../../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(o,c){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,c||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),uL=Ml({"../../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=cL();function o(c){var u=r(c,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),rE=Ml({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=uL();function r(o,c,u){return(c=n(c))in o?Object.defineProperty(o,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[c]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ey=Ml({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=rE();function r(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(c,p).enumerable})),d.push.apply(d,h)}return d}function o(c){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?r(Object(d),!0).forEach(function(h){n(c,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(c,h,Object.getOwnPropertyDescriptor(d,h))})}return c}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});wf(Ey());wf(rE());var nu=wf(Ey());function fL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,nu.default)((0,nu.default)({},t),{},{error:r})}}return{ok:!0,result:(0,nu.default)((0,nu.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var ap=class extends Error{constructor(){super("Unable to transform response from server")}};function dL(t,e){let n;try{n=fL(t,e)}catch{throw new ap}if(!n.ok&&(!cl(n.error.error)||typeof n.error.error.code!="number"))throw new ap;if(n.ok&&!cl(n.result))throw new ap;return n}wf(Ey());var iu=yt(Ss()),co=yt(Zn());function hL(t){return t instanceof Vo}function pL(t){return cl(t)&&cl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function mL(t,e){return typeof t=="string"?t:cl(t)&&typeof t.message=="string"?t.message:e}var Vo=class mu extends Error{constructor(e,n){var r,o;const c=n?.cause;super(e,{cause:c}),(0,iu.default)(this,"cause",void 0),(0,iu.default)(this,"shape",void 0),(0,iu.default)(this,"data",void 0),(0,iu.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=c,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,mu.prototype)}static from(e,n={}){const r=e;return hL(r)?(n.meta&&(r.meta=(0,co.default)((0,co.default)({},r.meta),n.meta)),r):pL(r)?new mu(r.error.message,(0,co.default)((0,co.default)({},n),{},{result:r})):new mu(mL(r,"Unknown error"),(0,co.default)((0,co.default)({},n),{},{cause:r}))}};function yL(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 jx=t=>typeof t=="function";function gL(t){if(t)return t;if(typeof window<"u"&&jx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&jx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var tl=yt(Zn());function bL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:yL(t.transformer),methodOverride:t.methodOverride}}function vL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const SL={query:"GET",mutation:"POST",subscription:"PATCH"};function sE(t){return"input"in t?t.transformer.input.serialize(t.input):vL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const oE=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const c=sE(t);c!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(c))}`)}return o.length&&(r+="?"+o.join("&")),r},xL=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=sE(t);return e!==void 0?JSON.stringify(e):void 0},wL=t=>RL((0,tl.default)((0,tl.default)({},t),{},{contentTypeHeader:"application/json",getUrl:oE,getBody:xL}));var TL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const AL=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 TL};async function EL(t){var e;AL(t.signal);const n=t.getUrl(t),r=t.getBody(t),{type:o}=t,c=await(async()=>{const d=await t.headers();return Symbol.iterator in d?Object.fromEntries(d):d})(),u=(0,tl.default)((0,tl.default)((0,tl.default)({},t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),c);return gL(t.fetch)(n,{method:(e=t.methodOverride)!==null&&e!==void 0?e:SL[o],signal:t.signal,body:r,headers:u})}async function RL(t){const e={},n=await EL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}yt(Zn());const Bx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Lx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(d){const h=[[]];let p=0;for(;;){const v=d[p];if(!v)break;const S=h[h.length-1];if(v.aborted){var y;(y=v.reject)===null||y===void 0||y.call(v,new Error("Aborted")),p++;continue}if(t.validate(S.concat(v).map(T=>T.key))){S.push(v),p++;continue}if(S.length===0){var g;(g=v.reject)===null||g===void 0||g.call(v,new Error("Input is too big for a single dispatch")),p++;continue}h.push([])}return h}function c(){const d=o(e);r();for(const h of d){if(!h.length)continue;const p={items:h};for(const g of h)g.batch=p;t.fetch(p.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,w)=>{const T=p.items[w];try{var D;const _=await Promise.resolve(S);(D=T.resolve)===null||D===void 0||D.call(T,_)}catch(_){var $;($=T.reject)===null||$===void 0||$.call(T,_)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of p.items){var v;(v=S.reject)===null||v===void 0||v.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of p.items){var v;(v=S.reject)===null||v===void 0||v.call(S,g),S.batch=null}})}}function u(d){var h;const p={aborted:!1,key:d,batch:null,resolve:Bx,reject:Bx},y=new Promise((g,v)=>{var S;p.reject=v,p.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(p)});return(h=n)!==null&&h!==void 0||(n=setTimeout(c)),y}return{load:u}}function OL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const c of t)c?.aborted?o():c?.addEventListener("abort",o,{once:!0});return e.signal}var ru=yt(Zn());function _L(t){var e,n;const r=bL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,c=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const u=y=>({validate(g){if(o===1/0&&c===1/0)return!0;if(g.length>c)return!1;const v=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return oE((0,ru.default)((0,ru.default)({},r),{},{type:y,path:v,inputs:S,signal:null})).length<=o},async fetch(g){const v=g.map(_=>_.path).join(","),S=g.map(_=>_.input),w=OL(...g.map(_=>_.signal)),T=await wL((0,ru.default)((0,ru.default)({},r),{},{path:v,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:w}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(_=>({meta:T.meta,json:_}))}}),d=Lx(u("query")),h=Lx(u("mutation")),p={query:d,mutation:h};return({op:y})=>xf(g=>{/* istanbul ignore if -- @preserve */if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=p[y.type].load(y);let w;return S.then(T=>{w=T;const D=dL(T.json,r.transformer.output);if(!D.ok){g.error(Vo.from(D.error,{meta:T.meta}));return}g.next({context:T.meta,result:D.result}),g.complete()}).catch(T=>{g.error(Vo.from(T,{meta:w?.meta}))}),()=>{}})}}yt(Zn());const aE=(t,...e)=>typeof t=="function"?t(...e):t;yt(Ss());function kL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function ML(t){const e=await aE(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function CL(t){const e={method:"connectionParams",data:await aE(t)};return JSON.stringify(e)}yt(Ss());var is=yt(Ss());function DL(t){const{promise:e,resolve:n,reject:r}=kL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function NL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function c(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function u(){clearTimeout(r),c()}function d(){clearTimeout(o),u()}t.addEventListener("open",c),t.addEventListener("message",({data:h})=>{clearTimeout(r),c(),h==="PONG"&&d()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var $L=class lm{constructor(e){var n;if((0,is.default)(this,"id",++lm.connectCount),(0,is.default)(this,"WebSocketPonyfill",void 0),(0,is.default)(this,"urlOptions",void 0),(0,is.default)(this,"keepAliveOpts",void 0),(0,is.default)(this,"wsObservable",eL(null)),(0,is.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=++lm.connectCount;const n=ML(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&NL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await DL(r),e.urlOptions.connectionParams&&r.send(await CL(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,is.default)($L,"connectCount",0);yt(Ss());yt(Zn());var lp=yt(Ss()),Vx=yt(Zn()),jL=class{constructor(t){(0,lp.default)(this,"links",void 0),(0,lp.default)(this,"runtime",void 0),(0,lp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return tL({links:this.links,op:(0,Vx.default)((0,Vx.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(W3())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await Q3(n)).result.data}catch(n){throw Vo.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(o){switch(o.result.type){case"state":{var c;(c=n.onConnectionStateChange)===null||c===void 0||c.call(n,o.result);break}case"started":{var u;(u=n.onStarted)===null||u===void 0||u.call(n,{context:o.context});break}case"stopped":{var d;(d=n.onStopped)===null||d===void 0||d.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var c;(c=n.onError)===null||c===void 0||c.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const BL=Symbol.for("trpc_untypedClient"),LL={query:"query",mutate:"mutation",subscribe:"subscription"},VL=t=>LL[t];function UL(t){const e=aL(({path:n,args:r})=>{const o=[...n],c=VL(o.pop()),u=o.join(".");return t[c](u,...r)});return lL(n=>n===BL?t:e[n])}function zL(t){const e=new jL(t);return UL(e)}yt(Zn());yt(Zn());var KL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var c,u,d,h=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,d=Symbol.iterator);h--;){if(u&&(c=o[u])!=null)return c.call(o);if(d&&(c=o[d])!=null)return new r(c.call(o));u="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function c(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var d=u.done;return Promise.resolve(u.value).then(function(h){return{value:h,done:d}})}return r=function(d){this.s=d,this.n=d.next},r.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var h=this.s.return;return h===void 0?Promise.resolve({value:d,done:!0}):c(h.apply(this.s,arguments))},throw:function(d){var h=this.s.return;return h===void 0?Promise.reject(d):c(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});yt(KL());yt(Zn());var PL=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(d,h){var p=Error();return p.name="SuppressedError",p.error=d,p.suppressed=h,p},o={},c=[];function u(d,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var p=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(p===void 0&&(p=h[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var y=p;if(typeof p!="function")throw new TypeError("Object is not disposable.");y&&(p=function(){try{y.call(h)}catch(v){return Promise.reject(v)}}),c.push({v:h,d:p,a:d})}else d&&c.push({d:h,a:d});return h}return{e:o,u:u.bind(null,!1),a:u.bind(null,!0),d:function(){var h,p=this.e,y=0;function g(){for(;h=c.pop();)try{if(!h.a&&y===1)return y=0,c.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,v)}else y|=1}catch(w){return v(w)}if(y===1)return p!==o?Promise.reject(p):Promise.resolve();if(p!==o)throw p}function v(S){return p=p!==o?new r(S,p):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),lE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),qL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=lE();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),IL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=lE();function r(c){return function(){return new o(c.apply(this,arguments))}}function o(c){var u,d;function h(y,g){try{var v=c[y](g),S=v.value,w=S instanceof n;Promise.resolve(w?S.v:S).then(function(T){if(w){var D=y==="return"?"return":"next";if(!S.k||T.done)return h(D,T);T=c[D](T).value}p(v.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){p("throw",T)}}function p(y,g){switch(y){case"return":u.resolve({value:g,done:!0});break;case"throw":u.reject(g);break;default:u.resolve({value:g,done:!1})}(u=u.next)?h(u.key,u.arg):d=null}this._invoke=function(y,g){return new Promise(function(v,S){var w={key:y,arg:g,resolve:v,reject:S,next:null};d?d=d.next=w:(u=d=w,h(y,g))})},typeof c.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(c){return this._invoke("next",c)},o.prototype.throw=function(c){return this._invoke("throw",c)},o.prototype.return=function(c){return this._invoke("return",c)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});yt(PL());yt(qL());yt(IL());yt(Zn());var HL={};function cE(t,e){if(t instanceof Promise)throw new Error(e)}function FL(t,e){const n={},r=[];for(const o in t){const c=t[o]["~standard"].validate(e[o]);if(cE(c,`Validation must be synchronous, but ${o} returned a Promise.`),c.issues){r.push(...c.issues.map(u=>({...u,message:u.message,path:[o,...u.path??[]]})));continue}n[o]=c.value}return r.length?{issues:r}:{value:n}}function GL(t){const e=t.runtimeEnvStrict??t.runtimeEnv??HL;if(t.emptyStringAsUndefined??!1)for(const[_,k]of Object.entries(e))k===""&&delete e[_];if(!!t.skipValidation)return e;const o=typeof t.client=="object"?t.client:{},c=typeof t.server=="object"?t.server:{},u=typeof t.shared=="object"?t.shared:{},d=t.isServer??(typeof window>"u"||"Deno"in window),h=d?{...c,...u,...o}:{...o,...u},p=t.createFinalSchema?.(h,d)["~standard"].validate(e)??FL(h,e);cE(p,"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(p.issues)return y(p.issues);const v=_=>t.clientPrefix?!_.startsWith(t.clientPrefix)&&!(_ in u):!0,S=_=>d||!v(_),w=_=>_==="__esModule"||_==="$$typeof",T=(t.extends??[]).reduce((_,k)=>Object.assign(_,k),{}),D=Object.assign(T,p.value);return new Proxy(D,{get(_,k){if(typeof k=="string"&&!w(k))return S(k)?Reflect.get(_,k):g(k)}})}const YL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},JL="__vite_start_time"in globalThis,XL=typeof window<"u",Vi=wt("string"),Ux=wt('"true" | "false" | undefined'),uE=GL({isServer:!JL&&!XL,server:{CI:wt("string | undefined").pipe(Boolean),POSTGRES_USER:Vi,POSTGRES_PASSWORD:Vi,POSTGRES_DATABASE:Vi,POSTGRES_HOST:Vi,POSTGRES_PORT:Vi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:Vi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:Ux.pipe(t=>t==="true"),FRONTEND_PORT:Vi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:Vi.pipe.try(t=>JSON.parse(t),wt("string[]")),API_KEY_OPENAI:wt("string | undefined"),API_KEY_RESEND:wt("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Vi,VITE_DEV_FRONTEND_HOST:wt("string | undefined"),VITE_DEV_HTTPS:Ux.pipe(t=>t==="true")},runtimeEnv:YL,emptyStringAsUndefined:!0}),cn=zL({links:[_L({url:uE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),ZL=Object.freeze(Object.defineProperty({__proto__:null,trpcClient:cn},Symbol.toStringTag,{value:"Module"})),QL=et({key:"appVersionQuery",default:cn.version.query});et({key:"lastKnownVersion",default:null,effects:[M1(localStorage,JSON,"lastKnownVersion")]});const WL=yi({key:"appVersion",get:async({get:t})=>{const e=t(QL);return e instanceof Promise?e.then(n=>n.version):e.version}});function cp(t){return["optional",t]}function eV(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const c=[],u=o[1],d=u[r];d!==void 0&&c.push(d);const h=Object.keys(u).find(p=>p.startsWith("$"));if(h){const p=u[h];p&&c.push(p)}return c})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const tV="modulepreload",nV=function(t){return"/"+t},zx={},fE=function(e,n,r){let o=Promise.resolve();if(n&&n.length>0){let p=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};var u=p;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");o=p(n.map(y=>{if(y=nV(y),y in zx)return;zx[y]=!0;const g=y.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${v}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":tV,g||(S.as="script"),S.crossOrigin="",S.href=y,h&&S.setAttribute("nonce",h),document.head.appendChild(S),g)return new Promise((w,T)=>{S.addEventListener("load",w),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${y}`)))})}))}function c(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&c(h.reason);return e().catch(c)})},pi=Object.create(null);pi.open="0";pi.close="1";pi.ping="2";pi.pong="3";pi.message="4";pi.upgrade="5";pi.noop="6";const yu=Object.create(null);Object.keys(pi).forEach(t=>{yu[pi[t]]=t});const cm={type:"error",data:"parser error"},dE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",hE=typeof ArrayBuffer=="function",pE=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Ry=({type:t,data:e},n,r)=>dE&&e instanceof Blob?n?r(e):Kx(e,r):hE&&(e instanceof ArrayBuffer||pE(e))?n?r(e):Kx(new Blob([e]),r):r(pi[t]+(e||"")),Kx=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Px(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let up;function iV(t,e){if(dE&&t.data instanceof Blob)return t.data.arrayBuffer().then(Px).then(e);if(hE&&(t.data instanceof ArrayBuffer||pE(t.data)))return e(Px(t.data));Ry(t,!1,n=>{up||(up=new TextEncoder),e(up.encode(n))})}const qx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<qx.length;t++)Qa[qx.charCodeAt(t)]=t;const rV=t=>{let e=t.length*.75,n=t.length,r,o=0,c,u,d,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const p=new ArrayBuffer(e),y=new Uint8Array(p);for(r=0;r<n;r+=4)c=Qa[t.charCodeAt(r)],u=Qa[t.charCodeAt(r+1)],d=Qa[t.charCodeAt(r+2)],h=Qa[t.charCodeAt(r+3)],y[o++]=c<<2|u>>4,y[o++]=(u&15)<<4|d>>2,y[o++]=(d&3)<<6|h&63;return p},sV=typeof ArrayBuffer=="function",Oy=(t,e)=>{if(typeof t!="string")return{type:"message",data:mE(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:oV(t.substring(1),e)}:yu[n]?t.length>1?{type:yu[n],data:t.substring(1)}:{type:yu[n]}:cm},oV=(t,e)=>{if(sV){const n=rV(t);return mE(n,e)}else return{base64:!0,data:t}},mE=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},yE="",aV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((c,u)=>{Ry(c,!1,d=>{r[u]=d,++o===n&&e(r.join(yE))})})},lV=(t,e)=>{const n=t.split(yE),r=[];for(let o=0;o<n.length;o++){const c=Oy(n[o],e);if(r.push(c),c.type==="error")break}return r};function cV(){return new TransformStream({transform(t,e){iV(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,r)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let fp;function su(t){return t.reduce((e,n)=>e+n.length,0)}function ou(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=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 uV(t,e){fp||(fp=new TextDecoder);const n=[];let r=0,o=-1,c=!1;return new TransformStream({transform(u,d){for(n.push(u);;){if(r===0){if(su(n)<1)break;const h=ou(n,1);c=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(su(n)<2)break;const h=ou(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(su(n)<8)break;const h=ou(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(cm);break}o=y*Math.pow(2,32)+p.getUint32(4),r=3}else{if(su(n)<o)break;const h=ou(n,o);d.enqueue(Oy(c?h:fp.decode(h),e)),r=0}if(o===0||o>t){d.enqueue(cm);break}}}})}const gE=4;function At(t){if(t)return fV(t)}function fV(t){for(var e in At.prototype)t[e]=At.prototype[e];return t}At.prototype.on=At.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};At.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};At.prototype.off=At.prototype.removeListener=At.prototype.removeAllListeners=At.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,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};At.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,o=n.length;r<o;++r)n[r].apply(this,e)}return this};At.prototype.emitReserved=At.prototype.emit;At.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};At.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Tf=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),dV="arraybuffer";function bE(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const hV=Vn.setTimeout,pV=Vn.clearTimeout;function Af(t,e){e.useNativeTimers?(t.setTimeoutFn=hV.bind(Vn),t.clearTimeoutFn=pV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const mV=1.33;function yV(t){return typeof t=="string"?gV(t):Math.ceil((t.byteLength||t.size)*mV)}function gV(t){let e=0,n=0;for(let r=0,o=t.length;r<o;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 vE(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function bV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function vV(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let c=n[r].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class SV extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class _y extends At{constructor(e){super(),this.writable=!1,Af(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 SV(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=Oy(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=bV(e);return n.length?"?"+n:""}}class xV extends _y{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)};lV(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,aV(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]=vE()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let SE=!1;try{SE=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const wV=SE;function TV(){}class AV extends xV{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",(o,c)=>{this.onError("xhr post error",o,c)})}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 Eo=class gu extends At{constructor(e,n,r){super(),this.createRequest=e,Af(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=bE(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}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 o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=gu.requestsCount++,gu.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=TV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete gu.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()}};Eo.requestsCount=0;Eo.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Ix);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,Ix,!1)}}function Ix(){for(let t in Eo.requests)Eo.requests.hasOwnProperty(t)&&Eo.requests[t].abort()}const EV=function(){const t=xE({xdomain:!1});return t&&t.responseType!==null}();class RV extends AV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=EV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Eo(xE,this.uri(),e)}}function xE(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||wV))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const wE=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class OV extends _y{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=wE?{}:bE(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(o){return this.emitReserved("error",o)}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],o=n===e.length-1;Ry(r,this.supportsBinary,c=>{try{this.doWrite(r,c)}catch{}o&&Tf(()=>{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]=vE()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const dp=Vn.WebSocket||Vn.MozWebSocket;class _V extends OV{createSocket(e,n,r){return wE?new dp(e,n,r):n?new dp(e,n):new dp(e)}doWrite(e,n){this.ws.send(n)}}class kV extends _y{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=uV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=cV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),c())}).catch(d=>{})};c();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&Tf(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const MV={websocket:_V,webtransport:kV,polling:RV},CV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,DV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function um(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 o=CV.exec(t||""),c={},u=14;for(;u--;)c[DV[u]]=o[u]||"";return n!=-1&&r!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=NV(c,c.path),c.queryKey=$V(c,c.query),c}function NV(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 $V(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,c){o&&(n[o]=c)}),n}const fm=typeof addEventListener=="function"&&typeof removeEventListener=="function",bu=[];fm&&addEventListener("offline",()=>{bu.forEach(t=>t())},!1);class Mr extends At{constructor(e,n){if(super(),this.binaryType=dV,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=um(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=um(n.host).host);Af(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 o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=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=vV(this.opts.query)),fm&&(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"})},bu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=gE,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&&Mr.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",Mr.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 o=this.writeBuffer[r].data;if(o&&(n+=yV(o)),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,Tf(()=>{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,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const c={type:e,data:n,options:r};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),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(Mr.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(),fm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=bu.indexOf(this._offlineEventListener);r!==-1&&bu.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Mr.protocol=gE;class jV extends Mr{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;Mr.priorWebsocketSuccess=!1;const o=()=>{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;Mr.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 v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function c(){r||(r=!0,y(),n.close(),n=null)}const u=g=>{const v=new Error("probe error: "+g);v.transport=n.name,c(),this.emitReserved("upgradeError",v)};function d(){u("transport closed")}function h(){u("socket closed")}function p(g){n&&g.name!==n.name&&c()}const y=()=>{n.removeListener("open",o),n.removeListener("error",u),n.removeListener("close",d),this.off("close",h),this.off("upgrading",p)};n.once("open",o),n.once("error",u),n.once("close",d),this.once("close",h),this.once("upgrading",p),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 BV=class extends jV{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(o=>MV[o]).filter(o=>!!o)),super(e,r)}};function LV(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=um(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 c=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+c+":"+r.port+e,r.href=r.protocol+"://"+c+(n&&n.port===r.port?"":":"+r.port),r}const VV=typeof ArrayBuffer=="function",UV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,TE=Object.prototype.toString,zV=typeof Blob=="function"||typeof Blob<"u"&&TE.call(Blob)==="[object BlobConstructor]",KV=typeof File=="function"||typeof File<"u"&&TE.call(File)==="[object FileConstructor]";function ky(t){return VV&&(t instanceof ArrayBuffer||UV(t))||zV&&t instanceof Blob||KV&&t instanceof File}function vu(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(vu(t[n]))return!0;return!1}if(ky(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return vu(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&vu(t[n]))return!0;return!1}function PV(t){const e=[],n=t.data,r=t;return r.data=dm(n,e),r.attachments=e.length,{packet:r,buffers:e}}function dm(t,e){if(!t)return t;if(ky(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]=dm(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]=dm(t[r],e));return n}return t}function qV(t,e){return t.data=hm(t.data,e),delete t.attachments,t}function hm(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]=hm(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=hm(t[n],e));return t}const IV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],HV=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 FV{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&vu(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=PV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Hx(t){return Object.prototype.toString.call(t)==="[object Object]"}class My extends At{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 GV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(ky(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 c=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const u=e.substring(c,n);if(u!=Number(u)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(u)}if(e.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(c,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const c=n+1;for(;++n;){const u=e.charAt(n);if(u==null||Number(u)!=u){--n;break}if(n===e.length)break}r.id=Number(e.substring(c,n+1))}if(e.charAt(++n)){const c=this.tryParse(e.substr(n));if(My.isPayloadValid(r.type,c))r.data=c;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 Hx(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||Hx(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&IV.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 GV{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=qV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const YV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:My,Encoder:FV,get PacketType(){return ke},protocol:HV},Symbol.toStringTag,{value:"Module"}));function Gn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const JV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class AE extends At{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=[Gn(e,"open",this.onopen.bind(this)),Gn(e,"packet",this.onpacket.bind(this)),Gn(e,"error",this.onerror.bind(this)),Gn(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,o,c;if(JV.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 u={type:ke.EVENT,data:n};if(u.options={},u.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),u.id=y}const d=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(u),this.packet(u)):this.sendBuffer.push(u)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===e&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},o),u=(...d)=>{this.io.clearTimeoutFn(c),n.apply(this,d)};u.withError=!0,this.acks[e]=u}emitWithAck(e,...n){return new Promise((r,o)=>{const c=(u,d)=>u?o(u):r(d);c.withError=!0,n.push(c),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((o,...c)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...c)),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(...o){r||(r=!0,n.packet({type:ke.ACK,id:e,data:o}))}}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 Ho(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}Ho.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};Ho.prototype.reset=function(){this.attempts=0};Ho.prototype.setMin=function(t){this.ms=t};Ho.prototype.setMax=function(t){this.max=t};Ho.prototype.setJitter=function(t){this.jitter=t};class pm extends At{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,Af(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 Ho({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||YV;this.encoder=new o.Encoder,this.decoder=new o.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 BV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Gn(n,"open",function(){r.onopen(),e&&e()}),c=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),e?e(d):this.maybeReconnectOnOpen()},u=Gn(n,"error",c);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Gn(e,"ping",this.onping.bind(this)),Gn(e,"data",this.ondata.bind(this)),Gn(e,"error",this.onerror.bind(this)),Gn(e,"close",this.onclose.bind(this)),Gn(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){Tf(()=>{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 AE(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(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):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 Su(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=LV(t,e.path||"/socket.io"),r=n.source,o=n.id,c=n.path,u=Ya[o]&&c in Ya[o].nsps,d=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let h;return d?h=new pm(r,e):(Ya[o]||(Ya[o]=new pm(r,e)),h=Ya[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Su,{Manager:pm,Socket:AE,io:Su,connect:Su});const XV=["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"],ZV=3,QV=15,WV=/^[a-zA-Z0-9_-]+$/,eU=wt(WV).pipe(wt(`string > ${ZV} & string < ${QV}`)).brand("username"),Fx=20,Gx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function tU(t){let e="";for(const n of t)n in Gx?e+=Gx[n]:e+=n;return e}function nU(t){const e=t.toLocaleLowerCase(),n=tU(e);for(const r of XV)if(n.includes(r)||e.includes(r))return!0;return!1}function iU(t){const e=new Set(t).size;return t.length*Math.log2(e)}function rU(t){let e=0;return nU(t)&&(e-=100),e+=iU(t)*.5,Math.max(e,0)}const sU=wt("string").narrow((t,e)=>{const n=rU(t);return n>=Fx?!0:e.mustBe(`Of complexity ${Fx} or more. Was ${n.toFixed(2)}.`)}).brand("password");wt({"+":"delete",email:"string",password:"string"});const oU=wt("string").brand("email");wt({"+":"delete",username:"string",password:"string",email:"string"});const aU=wt({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),mi=Su(uE.VITE_BACKEND_ORIGIN,{auth:t=>{const e=Ze(lt);e&&t(e)},withCredentials:!0,autoConnect:!1});mi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(lt,null)}).on("usernameChanged",t=>{De(lt,e=>e===null?null:{...e,username:t})});const lt=et({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=$r(e),r=aU(n);return r instanceof wt.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),mi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(async({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(Ro,n.username),localStorage.setItem("auth",Je(n)),n.verification==="verified"?(console.log("connecting..."),mi.connect()):await fE(async()=>{const{navigate:r}=await Promise.resolve().then(()=>fU);return{navigate:r}},void 0).then(({navigate:r})=>{r("/verify")})):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),Ro=et({key:"username",default:Ze(lt)?.username??""}),hp=et({key:"usernameDebounce",default:!0}),lU=et({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{Pk(Ro,()=>{Ze(hp)&&(t(Ze(Ro)),De(hp,!1),setTimeout(()=>{De(hp,!0),t(Ze(Ro))},2e3))})}]}),cU=yi({key:"isUsernameTakenQuery",get:async({get:t})=>{const e=t(lU);if(!e)return!1;const n=Ze(lt);if(e===n?.username)return!1;const{trpcClient:r}=await fE(async()=>{const{trpcClient:o}=await Promise.resolve().then(()=>ZL);return{trpcClient:o}},void 0);return r.isUsernameTaken.query({username:e})}}),EE=yi({key:"usernameIssues",get:({get:t})=>{const e=t(Ro),n=eU(e);return n instanceof wt.errors?n:null}}),li=et({key:"password0",default:""}),RE=yi({key:"password0Issues",get:({get:t})=>{const e=t(li),n=sU(e);return n instanceof wt.errors?n:null}}),Uo=et({key:"email",default:""}),OE=yi({key:"emailIssues",get:({get:t})=>{const e=t(Uo),n=oU(e);return n instanceof wt.errors?n:null}});yi({key:"signupReady",get:({get:t})=>{const e=t(EE),n=t(RE),r=t(OE);return!(e??n??r)}});const Pi=et({key:"oneTimeCode",default:""}),mm=et({key:"oneTimeCodeNewEmail",default:""}),oi=et({key:"authTarget",default:null}),Cy=cp({verify:cp({$token:null}),game:cp({clicker:null}),account:null,admin:null});function _E(t){return eV(Cy,t)}const kE=[[]];function uU(t){return kE.some(e=>e.join("/")===t.join("/"))}function ms(t){history.pushState(null,"",t),De(Dy,t)}const Dy=et({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const c=Ze(lt);switch(console.log("/","auth",c),c?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{Ze(lt)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{Ze(lt)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const c=Ze(lt);if(!c){n("/");break}c.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({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)})}]}),ME=yi({key:"route",get:({get:t})=>{const n=t(Dy).split("/").slice(1).filter(Boolean);return _E(n)?uU(n)||t(lt)?n:401:404}}),fU=Object.freeze(Object.defineProperty({__proto__:null,PUBLIC_ROUTES:kE,ROUTES:Cy,isRoute:_E,navigate:ms,pathnameAtom:Dy,routeSelector:ME},Symbol.toStringTag,{value:"Module"})),Yx=et({key:"buttonBlockActive",default:!1}),jn=et({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{Ze(CE)?.focus();break}case"new-password":{Ze(DE)?.focus();break}case"username":{Ze(NE)?.focus();break}}})}]}),CE=et({key:"emailInputElement",default:null}),DE=et({key:"password0InputElement",default:null}),NE=et({key:"usernameInputElement",default:null});function dU(t){const e=V.useRef(null);return V.useEffect(()=>{De(t,e.current)},[t]),e}const hU=yi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(lt);return e?`Code sent to ${e.email}`:""}}),pU=yi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Uo);return e?`Code sent to ${e}`:""}});function pp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:c,onOpen:u,onCancel:d,extraIssues:h}){const p=xt(e),y=Yn(e),g=xt(Pi),v=Yn(Pi),S=xt(mm),w=Yn(mm),T=xt(li),D=Yn(li),$=xt(Yx),_=Yn(Yx),k=xt(jn),C=Yn(jn),O=xt(n),J=xt(hU),G=xt(pU),H=dU(r),ie=k[0]===t,oe=k.at(-1),[fe,...ge]=k;return Y.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),$){_(!1);return}console.log(`submitted! changing ${t} to`,p);const Q=await c(p);Error.isError(Q)&&console.error(Q)},children:[ie?Y.jsx("button",{type:"button",onClick:async()=>{await d?.(),C([])},children:"x"}):null,Y.jsxs("main",{children:[Y.jsxs("label",{htmlFor:t,children:[O||h?Y.jsxs("aside",{children:[h,O?.map(be=>Y.jsx("span",{children:be.message},be.path.join(".")))]}):null,Y.jsx("span",{children:t==="new-password"?"Password":an(t)}),Y.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:H,value:p,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:oe!==t})]}),ie?ge.map(be=>Y.jsxs("label",{htmlFor:`${t}-${be}`,children:[Y.jsx("span",{children:(()=>{switch(be){case"otcLogin":return J;case"otcVerify":return G;case"passwordLogin":return"Password"}})()}),Y.jsx("input",{id:`${t}-otc`,type:"text",ref:H,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Q=>{switch(be){case"otcLogin":v(Q.target.value);break;case"otcVerify":if(t==="email"){w(Q.target.value);break}v(Q.target.value);break;case"passwordLogin":D(Q.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==oe})]},`${t}-${be}`)):null]}),k[0]===t?Y.jsx("button",{type:"submit",children:"->"}):Y.jsx("button",{type:"button",onMouseDown:async()=>{_(!0),await u?.(),C(o)},onMouseUp:()=>{_(!1)},children:"/"})]})}function mU(){const t=xt(lt),e=xt(cU);return _u(()=>{t&&De(Uo,t.email),t?.password&&De(li,"••••••••••••")}),t?Y.jsxs("article",{"data-css":"editor",children:[Y.jsx(pp,{label:"username",inputToken:Ro,issuesToken:EE,inputElementToken:NE,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{mi.once("usernameChanged",r),mi.emit("changeUsername",n)}),De(jn,[]),n),extraIssues:e?Y.jsx("span",{children:"This username is taken."}):null}),Y.jsx(pp,{label:"email",inputToken:Uo,issuesToken:OE,inputElementToken:CE,initialState:["email"],onSubmit:async n=>{const r=Ze(jn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:c}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:c}),c){case"otc_login":{De(oi,o),De(jn,["email","otcLogin"]);break}case"password_login":{De(oi,o),De(jn,["email","passwordLogin"]);break}case"otc_verify":{De(oi,o),De(Pi,"not needed"),De(jn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=Ze(oi);if(!o)return new Error("No auth target");const c=Ze(Pi),u=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:o});return De(lt,u),De(jn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=Ze(oi);if(!o)return new Error("No auth target");const c=Ze(mm),u=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:o});return De(lt,u),De(jn,[]),u.email}}}}),Y.jsx(pp,{label:"new-password",inputToken:li,issuesToken:RE,inputElementToken:DE,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=Ze(jn);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(li,"••••••••••••"),De(lt,o=>o&&{...o,password:!0}),De(jn,[]),"done";case 2:{const o=Ze(oi);return o?(await cn.verifyAccountAction.mutate({oneTimeCode:Ze(Pi),userKey:o}),De(lt,c=>c&&{...c,password:!1}),De(li,""),De(jn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(li,"••••••••••••")},onOpen:async()=>{if(t.password){const n=Ze(oi);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):Y.jsx("p",{children:"You must be logged in to verify your account."})}function yU(){return Y.jsx("article",{children:Y.jsx("h1",{children:"admin"})})}var gU=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)}clear(){throw new Error("Cannot clear an InvariantMap")}},bU=class ym{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new gU;static create(e,n){const r=new ym(e),{type:o,globals:c,actions:u,perspectives:d}=n(r),h={type:o,key:e,globals:c,actions:u,perspectives:d};return ym.existing.set(e,h),h}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[r,o]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:r,viewAtoms:o})}break}return this}};function vU(t){const{key:e,config:n}=t,r=bU.create(e,n),{actions:o}=r;for(const c of o)S1(mt.STORE,e,c.key);return Ym(mt.STORE,e,-1),r}et({key:"usersInRoomIndex",mutable:!0,default:()=>new _o,toJson:t=>t.toJSON(),fromJson:t=>_o.fromJSON(t)});et({key:"roomIndex",default:()=>new _o,mutable:!0,toJson:t=>t.toJSON(),fromJson:t=>_o.fromJSON(t)});const SU={enteredAtEpoch:0},xU=jk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},SU);Kk({key:"usersInMyRoomView",get:t=>({find:e})=>{const n=Bk(xU);return[e(n,t)]}});const Ny=et({key:"count",default:0}),$E=qk({key:"incrementTX",do:({set:t})=>{t(Ny,e=>e+1)}}),wU=vU({key:"countContinuity",config:t=>t.add(Ny).add($E)});function TU({route:[,t]}){return Y.jsx("article",{children:t?Y.jsx(EU,{gameId:t}):Y.jsx(AU,{})})}function AU(){return Y.jsx("nav",{children:Y.jsx(JA,{href:"/game/clicker",children:"Clicker"})})}Dk(Cy[1].game[1]);function EU({gameId:t}){console.log(t);const e=xt(Ny),n=Ik($E);return KM(wU),Y.jsxs("article",{children:[Y.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),Y.jsx("p",{children:"Let's see how high we can count!"})]})}const jE=V.createContext({});function RU(t){const e=V.useRef(null);return e.current===null&&(e.current=t()),e.current}const $y=typeof window<"u",OU=$y?V.useLayoutEffect:V.useEffect,jy=V.createContext(null);function By(t,e){t.indexOf(e)===-1&&t.push(e)}function Ly(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Yi=(t,e,n)=>n>e?e:n<t?t:n;let Vy=()=>{};const Ji={},BE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function LE(t){return typeof t=="object"&&t!==null}const VE=t=>/^0[^.\s]+$/u.test(t);function Uy(t){let e;return()=>(e===void 0&&(e=t()),e)}const Un=t=>t,_U=(t,e)=>n=>e(t(n)),Cl=(...t)=>t.reduce(_U),ul=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class zy{constructor(){this.subscriptions=[]}add(e){return By(this.subscriptions,e),()=>Ly(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let c=0;c<o;c++){const u=this.subscriptions[c];u&&u(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ui=t=>t*1e3,fi=t=>t/1e3;function UE(t,e){return e?t*(1e3/e):0}const zE=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,kU=1e-7,MU=12;function CU(t,e,n,r,o){let c,u,d=0;do u=e+(n-e)/2,c=zE(u,r,o)-t,c>0?n=u:e=u;while(Math.abs(c)>kU&&++d<MU);return u}function Dl(t,e,n,r){if(t===e&&n===r)return Un;const o=c=>CU(c,0,1,t,n);return c=>c===0||c===1?c:zE(o(c),e,r)}const KE=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,PE=t=>e=>1-t(1-e),qE=Dl(.33,1.53,.69,.99),Ky=PE(qE),IE=KE(Ky),HE=t=>(t*=2)<1?.5*Ky(t):.5*(2-Math.pow(2,-10*(t-1))),Py=t=>1-Math.sin(Math.acos(t)),FE=PE(Py),GE=KE(Py),DU=Dl(.42,0,1,1),NU=Dl(0,0,.58,1),YE=Dl(.42,0,.58,1),$U=t=>Array.isArray(t)&&typeof t[0]!="number",JE=t=>Array.isArray(t)&&typeof t[0]=="number",jU={linear:Un,easeIn:DU,easeInOut:YE,easeOut:NU,circIn:Py,circInOut:GE,circOut:FE,backIn:Ky,backInOut:IE,backOut:qE,anticipate:HE},BU=t=>typeof t=="string",Jx=t=>{if(JE(t)){Vy(t.length===4);const[e,n,r,o]=t;return Dl(e,n,r,o)}else if(BU(t))return jU[t];return t},au=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function LU(t,e){let n=new Set,r=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function h(y){u.has(y)&&(p.schedule(y),t()),y(d)}const p={schedule:(y,g=!1,v=!1)=>{const w=v&&o?n:r;return g&&u.add(y),w.has(y)||w.add(y),y},cancel:y=>{r.delete(y),u.delete(y)},process:y=>{if(d=y,o){c=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const VU=40;function XE(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>n=!0,u=au.reduce((k,C)=>(k[C]=LU(c),k),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:y,update:g,preRender:v,render:S,postRender:w}=u,T=()=>{const k=Ji.useManualTiming?o.timestamp:performance.now();n=!1,Ji.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(k-o.timestamp,VU),1)),o.timestamp=k,o.isProcessing=!0,d.process(o),h.process(o),p.process(o),y.process(o),g.process(o),v.process(o),S.process(o),w.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},D=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:au.reduce((k,C)=>{const O=u[C];return k[C]=(J,G=!1,H=!1)=>(n||D(),O.schedule(J,G,H)),k},{}),cancel:k=>{for(let C=0;C<au.length;C++)u[au[C]].cancel(k)},state:o,steps:u}}const{schedule:We,cancel:Dr,state:Kt,steps:mp}=XE(typeof requestAnimationFrame<"u"?requestAnimationFrame:Un,!0);let xu;function UU(){xu=void 0}const un={now:()=>(xu===void 0&&un.set(Kt.isProcessing||Ji.useManualTiming?Kt.timestamp:performance.now()),xu),set:t=>{xu=t,queueMicrotask(UU)}},ZE=t=>e=>typeof e=="string"&&e.startsWith(t),qy=ZE("--"),zU=ZE("var(--"),Iy=t=>zU(t)?KU.test(t.split("/*")[0].trim()):!1,KU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Fo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},fl={...Fo,transform:t=>Yi(0,1,t)},lu={...Fo,default:1},nl=t=>Math.round(t*1e5)/1e5,Hy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function PU(t){return t==null}const qU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Fy=(t,e)=>n=>!!(typeof n=="string"&&qU.test(n)&&n.startsWith(t)||e&&!PU(n)&&Object.prototype.hasOwnProperty.call(n,e)),QE=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,c,u,d]=r.match(Hy);return{[t]:parseFloat(o),[e]:parseFloat(c),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},IU=t=>Yi(0,255,t),yp={...Fo,transform:t=>Math.round(IU(t))},os={test:Fy("rgb","red"),parse:QE("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+yp.transform(t)+", "+yp.transform(e)+", "+yp.transform(n)+", "+nl(fl.transform(r))+")"};function HU(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const gm={test:Fy("#"),parse:HU,transform:os.transform},Nl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Tr=Nl("deg"),di=Nl("%"),ye=Nl("px"),FU=Nl("vh"),GU=Nl("vw"),Xx={...di,parse:t=>di.parse(t)/100,transform:t=>di.transform(t*100)},mo={test:Fy("hsl","hue"),parse:QE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+di.transform(nl(e))+", "+di.transform(nl(n))+", "+nl(fl.transform(r))+")"},St={test:t=>os.test(t)||gm.test(t)||mo.test(t),parse:t=>os.test(t)?os.parse(t):mo.test(t)?mo.parse(t):gm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?os.transform(t):mo.transform(t),getAnimatableNone:t=>{const e=St.parse(t);return e.alpha=0,St.transform(e)}},YU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function JU(t){return isNaN(t)&&typeof t=="string"&&(t.match(Hy)?.length||0)+(t.match(YU)?.length||0)>0}const WE="number",eR="color",XU="var",ZU="var(",Zx="${}",QU=/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 dl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let c=0;const d=e.replace(QU,h=>(St.test(h)?(r.color.push(c),o.push(eR),n.push(St.parse(h))):h.startsWith(ZU)?(r.var.push(c),o.push(XU),n.push(h)):(r.number.push(c),o.push(WE),n.push(parseFloat(h))),++c,Zx)).split(Zx);return{values:n,split:d,indexes:r,types:o}}function tR(t){return dl(t).values}function nR(t){const{split:e,types:n}=dl(t),r=e.length;return o=>{let c="";for(let u=0;u<r;u++)if(c+=e[u],o[u]!==void 0){const d=n[u];d===WE?c+=nl(o[u]):d===eR?c+=St.transform(o[u]):c+=o[u]}return c}}const WU=t=>typeof t=="number"?0:St.test(t)?St.getAnimatableNone(t):t;function e4(t){const e=tR(t);return nR(t)(e.map(WU))}const Nr={test:JU,parse:tR,createTransformer:nR,getAnimatableNone:e4};function gp(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 t4({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,c=0,u=0;if(!e)o=c=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=gp(h,d,t+1/3),c=gp(h,d,t),u=gp(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:r}}function Gu(t,e){return n=>n>0?e:t}const it=(t,e,n)=>t+(e-t)*n,bp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},n4=[gm,os,mo],i4=t=>n4.find(e=>e.test(t));function Qx(t){const e=i4(t);if(!e)return!1;let n=e.parse(t);return e===mo&&(n=t4(n)),n}const Wx=(t,e)=>{const n=Qx(t),r=Qx(e);if(!n||!r)return Gu(t,e);const o={...n};return c=>(o.red=bp(n.red,r.red,c),o.green=bp(n.green,r.green,c),o.blue=bp(n.blue,r.blue,c),o.alpha=it(n.alpha,r.alpha,c),os.transform(o))},bm=new Set(["none","hidden"]);function r4(t,e){return bm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function s4(t,e){return n=>it(t,e,n)}function Gy(t){return typeof t=="number"?s4:typeof t=="string"?Iy(t)?Gu:St.test(t)?Wx:l4:Array.isArray(t)?iR:typeof t=="object"?St.test(t)?Wx:o4:Gu}function iR(t,e){const n=[...t],r=n.length,o=t.map((c,u)=>Gy(c)(c,e[u]));return c=>{for(let u=0;u<r;u++)n[u]=o[u](c);return n}}function o4(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=Gy(t[o])(t[o],e[o]));return o=>{for(const c in r)n[c]=r[c](o);return n}}function a4(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const c=e.types[o],u=t.indexes[c][r[c]],d=t.values[u]??0;n[o]=d,r[c]++}return n}const l4=(t,e)=>{const n=Nr.createTransformer(e),r=dl(t),o=dl(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?bm.has(t)&&!o.values.length||bm.has(e)&&!r.values.length?r4(t,e):Cl(iR(a4(r,o),o.values),n):Gu(t,e)};function rR(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?it(t,e,n):Gy(t)(t,e)}const c4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>We.update(e,n),stop:()=>Dr(e),now:()=>Kt.isProcessing?Kt.timestamp:un.now()}},sR=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let c=0;c<o;c++)r+=Math.round(t(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Yu=2e4;function Yy(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Yu;)e+=n,r=t.next(e);return e>=Yu?1/0:e}function u4(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(Yy(r),Yu);return{type:"keyframes",ease:c=>r.next(o*c).value/e,duration:fi(o)}}const f4=5;function oR(t,e,n){const r=Math.max(e-f4,0);return UE(n-t(r),e-r)}const at={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},vp=.001;function d4({duration:t=at.duration,bounce:e=at.bounce,velocity:n=at.velocity,mass:r=at.mass}){let o,c,u=1-e;u=Yi(at.minDamping,at.maxDamping,u),t=Yi(at.minDuration,at.maxDuration,fi(t)),u<1?(o=p=>{const y=p*u,g=y*t,v=y-n,S=vm(p,u),w=Math.exp(-g);return vp-v/S*w},c=p=>{const g=p*u*t,v=g*n+n,S=Math.pow(u,2)*Math.pow(p,2)*t,w=Math.exp(-g),T=vm(Math.pow(p,2),u);return(-o(p)+vp>0?-1:1)*((v-S)*w)/T}):(o=p=>{const y=Math.exp(-p*t),g=(p-n)*t+1;return-vp+y*g},c=p=>{const y=Math.exp(-p*t),g=(n-p)*(t*t);return y*g});const d=5/t,h=p4(o,c,d);if(t=ui(t),isNaN(h))return{stiffness:at.stiffness,damping:at.damping,duration:t};{const p=Math.pow(h,2)*r;return{stiffness:p,damping:u*2*Math.sqrt(r*p),duration:t}}}const h4=12;function p4(t,e,n){let r=n;for(let o=1;o<h4;o++)r=r-t(r)/e(r);return r}function vm(t,e){return t*Math.sqrt(1-e*e)}const m4=["duration","bounce"],y4=["stiffness","damping","mass"];function ew(t,e){return e.some(n=>t[n]!==void 0)}function g4(t){let e={velocity:at.velocity,stiffness:at.stiffness,damping:at.damping,mass:at.mass,isResolvedFromDuration:!1,...t};if(!ew(t,y4)&&ew(t,m4))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,c=2*Yi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:at.mass,stiffness:o,damping:c}}else{const n=d4(t);e={...e,...n,mass:at.mass},e.isResolvedFromDuration=!0}return e}function Ju(t=at.visualDuration,e=at.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const c=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:c},{stiffness:h,damping:p,mass:y,duration:g,velocity:v,isResolvedFromDuration:S}=g4({...n,velocity:-fi(n.velocity||0)}),w=v||0,T=p/(2*Math.sqrt(h*y)),D=u-c,$=fi(Math.sqrt(h/y)),_=Math.abs(D)<5;r||(r=_?at.restSpeed.granular:at.restSpeed.default),o||(o=_?at.restDelta.granular:at.restDelta.default);let k;if(T<1){const O=vm($,T);k=J=>{const G=Math.exp(-T*$*J);return u-G*((w+T*$*D)/O*Math.sin(O*J)+D*Math.cos(O*J))}}else if(T===1)k=O=>u-Math.exp(-$*O)*(D+(w+$*D)*O);else{const O=$*Math.sqrt(T*T-1);k=J=>{const G=Math.exp(-T*$*J),H=Math.min(O*J,300);return u-G*((w+T*$*D)*Math.sinh(H)+O*D*Math.cosh(H))/O}}const C={calculatedDuration:S&&g||null,next:O=>{const J=k(O);if(S)d.done=O>=g;else{let G=O===0?w:0;T<1&&(G=O===0?ui(w):oR(k,O,J));const H=Math.abs(G)<=r,ie=Math.abs(u-J)<=o;d.done=H&&ie}return d.value=d.done?u:J,d},toString:()=>{const O=Math.min(Yy(C),Yu),J=sR(G=>C.next(O*G).value,O,30);return O+"ms "+J},toTransition:()=>{}};return C}Ju.applyToOptions=t=>{const e=u4(t,100,Ju);return t.ease=e.ease,t.duration=ui(e.duration),t.type="keyframes",t};function Sm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:u,min:d,max:h,restDelta:p=.5,restSpeed:y}){const g=t[0],v={done:!1,value:g},S=H=>d!==void 0&&H<d||h!==void 0&&H>h,w=H=>d===void 0?h:h===void 0||Math.abs(d-H)<Math.abs(h-H)?d:h;let T=n*e;const D=g+T,$=u===void 0?D:u(D);$!==D&&(T=$-g);const _=H=>-T*Math.exp(-H/r),k=H=>$+_(H),C=H=>{const ie=_(H),oe=k(H);v.done=Math.abs(ie)<=p,v.value=v.done?$:oe};let O,J;const G=H=>{S(v.value)&&(O=H,J=Ju({keyframes:[v.value,w(v.value)],velocity:oR(k,H,v.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return G(0),{calculatedDuration:null,next:H=>{let ie=!1;return!J&&O===void 0&&(ie=!0,C(H),G(H)),O!==void 0&&H>=O?J.next(H-O):(!ie&&C(H),v)}}}function b4(t,e,n){const r=[],o=n||Ji.mix||rR,c=t.length-1;for(let u=0;u<c;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Un:e;d=Cl(h,d)}r.push(d)}return r}function v4(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const c=t.length;if(Vy(c===e.length),c===1)return()=>e[0];if(c===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[c-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=b4(e,r,o),h=d.length,p=y=>{if(u&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const v=ul(t[g],t[g+1],y);return d[g](v)};return n?y=>p(Yi(t[0],t[c-1],y)):p}function S4(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=ul(0,e,r);t.push(it(n,1,o))}}function x4(t){const e=[0];return S4(e,t.length-1),e}function w4(t,e){return t.map(n=>n*e)}function T4(t,e){return t.map(()=>e||YE).splice(0,t.length-1)}function il({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=$U(r)?r.map(Jx):Jx(r),c={done:!1,value:e[0]},u=w4(n&&n.length===e.length?n:x4(e),t),d=v4(u,e,{ease:Array.isArray(o)?o:T4(e,o)});return{calculatedDuration:t,next:h=>(c.value=d(h),c.done=h>=t,c)}}const A4=t=>t!==null;function Jy(t,{repeat:e,repeatType:n="loop"},r,o=1){const c=t.filter(A4),d=o<0||e&&n!=="loop"&&e%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const E4={decay:Sm,inertia:Sm,tween:il,keyframes:il,spring:Ju};function aR(t){typeof t.type=="string"&&(t.type=E4[t.type])}class Xy{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 R4=t=>t/100;class Zy extends Xy{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!==un.now()&&this.tick(un.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;aR(e);const{type:n=il,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:u=0}=e;let{keyframes:d}=e;const h=n||il;h!==il&&typeof d[0]!="number"&&(this.mixKeyframes=Cl(R4,rR(d[0],d[1])),d=[0,100]);const p=h({...e,keyframes:d});c==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=Yy(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}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:o,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:g,repeatType:v,repeatDelay:S,type:w,onUpdate:T,finalKeyframe:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const $=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?$<0:$>o;this.currentTime=Math.max($,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let k=this.currentTime,C=r;if(g){const H=Math.min(this.currentTime,o)/d;let ie=Math.floor(H),oe=H%1;!oe&&H>=1&&(oe=1),oe===1&&ie--,ie=Math.min(ie,g+1),!!(ie%2)&&(v==="reverse"?(oe=1-oe,S&&(oe-=S/d)):v==="mirror"&&(C=u)),k=Yi(0,1,oe)*d}const O=_?{done:!1,value:y[0]}:C.next(k);c&&(O.value=c(O.value));let{done:J}=O;!_&&h!==null&&(J=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const G=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return G&&w!==Sm&&(O.value=Jy(y,this.options,D,this.speed)),T&&T(O.value),G&&this.finish(),O}then(e,n){return this.finished.then(e,n)}get duration(){return fi(this.calculatedDuration)}get time(){return fi(this.currentTime)}set time(e){e=ui(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(un.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=fi(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=c4,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),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(un.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 O4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const as=t=>t*180/Math.PI,xm=t=>{const e=as(Math.atan2(t[1],t[0]));return wm(e)},_4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:xm,rotateZ:xm,skewX:t=>as(Math.atan(t[1])),skewY:t=>as(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},wm=t=>(t=t%360,t<0&&(t+=360),t),tw=xm,nw=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),iw=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),k4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:nw,scaleY:iw,scale:t=>(nw(t)+iw(t))/2,rotateX:t=>wm(as(Math.atan2(t[6],t[5]))),rotateY:t=>wm(as(Math.atan2(-t[2],t[0]))),rotateZ:tw,rotate:tw,skewX:t=>as(Math.atan(t[4])),skewY:t=>as(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Tm(t){return t.includes("scale")?1:0}function Am(t,e){if(!t||t==="none")return Tm(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=k4,o=n;else{const d=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=_4,o=d}if(!o)return Tm(e);const c=r[e],u=o[1].split(",").map(C4);return typeof c=="function"?c(u):u[c]}const M4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Am(n,e)};function C4(t){return parseFloat(t.trim())}const Go=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Yo=new Set(Go),rw=t=>t===Fo||t===ye,D4=new Set(["x","y","z"]),N4=Go.filter(t=>!D4.has(t));function $4(t){const e=[];return N4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const us={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})=>Am(e,"x"),y:(t,{transform:e})=>Am(e,"y")};us.translateX=us.x;us.translateY=us.y;const fs=new Set;let Em=!1,Rm=!1,Om=!1;function lR(){if(Rm){const t=Array.from(fs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=$4(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([c,u])=>{r.getValue(c)?.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Rm=!1,Em=!1,fs.forEach(t=>t.complete(Om)),fs.clear()}function cR(){fs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Rm=!0)})}function j4(){Om=!0,cR(),lR(),Om=!1}class Qy{constructor(e,n,r,o,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(fs.add(this),Em||(Em=!0,We.read(cR),We.resolveKeyframes(lR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const c=o?.get(),u=e[e.length-1];if(c!==void 0)e[0]=c;else if(r&&n){const d=r.readValue(n,u);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=u),o&&c===void 0&&o.set(e[0])}O4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),fs.delete(this)}cancel(){this.state==="scheduled"&&(fs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const B4=t=>t.startsWith("--");function L4(t,e,n){B4(e)?t.style.setProperty(e,n):t.style[e]=n}const V4=Uy(()=>window.ScrollTimeline!==void 0),U4={};function z4(t,e){const n=Uy(t);return()=>U4[e]??n()}const uR=z4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wa=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,sw={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wa([0,.65,.55,1]),circOut:Wa([.55,0,1,.45]),backIn:Wa([.31,.01,.66,-.59]),backOut:Wa([.33,1.53,.69,.99])};function fR(t,e){if(t)return typeof t=="function"?uR()?sR(t,e):"ease-out":JE(t)?Wa(t):Array.isArray(t)?t.map(n=>fR(n,e)||sw.easeOut):sw[t]}function K4(t,e,n,{delay:r=0,duration:o=300,repeat:c=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const y={[e]:n};h&&(y.offset=h);const g=fR(d,o);Array.isArray(g)&&(y.easing=g);const v={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),t.animate(y,v)}function dR(t){return typeof t=="function"&&"applyToOptions"in t}function P4({type:t,...e}){return dR(t)&&uR()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class q4 extends Xy{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=e;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=e,Vy(typeof e.type!="string");const p=P4(e);this.animation=K4(n,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=Jy(o,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):L4(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 fi(Number(e))}get time(){return fi(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=ui(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&&V4()?(this.animation.timeline=e,Un):n(this)}}const hR={anticipate:HE,backInOut:IE,circInOut:GE};function I4(t){return t in hR}function H4(t){typeof t.ease=="string"&&I4(t.ease)&&(t.ease=hR[t.ease])}const ow=10;class F4 extends q4{constructor(e){H4(e),aR(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:c,...u}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const d=new Zy({...u,autoplay:!1}),h=ui(this.finishedTime??this.time);n.setWithVelocity(d.sample(h-ow).value,d.sample(h).value,ow),d.stop()}}const aw=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Nr.test(t)||t==="0")&&!t.startsWith("url("));function G4(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 Y4(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const c=t[t.length-1],u=aw(o,e),d=aw(c,e);return!u||!d?!1:G4(t)||(n==="spring"||dR(n))&&r}function _m(t){t.duration=0,t.type}const J4=new Set(["opacity","clipPath","filter","transform"]),X4=Uy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Z4(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:c,type:u}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=e.owner.getProps();return X4()&&n&&J4.has(n)&&(n!=="transform"||!p)&&!h&&!r&&o!=="mirror"&&c!==0&&u!=="inertia"}const Q4=40;class W4 extends Xy{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u="loop",keyframes:d,name:h,motionValue:p,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=un.now();const v={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:c,repeatType:u,name:h,motionValue:p,element:y,...g},S=y?.KeyframeResolver||Qy;this.keyframeResolver=new S(d,(w,T,D)=>this.onKeyframesResolved(w,T,v,!D),h,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:c,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:y}=r;this.resolvedAt=un.now(),Y4(e,c,u,d)||((Ji.instantAnimations||!h)&&y?.(Jy(e,r,n)),e[0]=e[e.length-1],_m(r),r.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Q4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!p&&Z4(v)?new F4({...v,element:v.motionValue.owner.current}):new Zy(v);S.finished.then(()=>this.notifyFinished()).catch(Un),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(),j4()),this._animation}get duration(){return this.animation.duration}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 ez=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tz(t){const e=ez.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function pR(t,e,n=1){const[r,o]=tz(t);if(!r)return;const c=window.getComputedStyle(e).getPropertyValue(r);if(c){const u=c.trim();return BE(u)?parseFloat(u):u}return Iy(o)?pR(o,e,n+1):o}function Wy(t,e){return t?.[e]??t?.default??t}const mR=new Set(["width","height","top","left","right","bottom",...Go]),nz={test:t=>t==="auto",parse:t=>t},yR=t=>e=>e.test(t),gR=[Fo,ye,di,Tr,GU,FU,nz],lw=t=>gR.find(yR(t));function iz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||VE(t):!0}const rz=new Set(["brightness","contrast","saturate","opacity"]);function sz(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Hy)||[];if(!r)return t;const o=n.replace(r,"");let c=rz.has(e)?1:0;return r!==n&&(c*=100),e+"("+c+o+")"}const oz=/\b([a-z-]*)\(.*?\)/gu,km={...Nr,getAnimatableNone:t=>{const e=t.match(oz);return e?e.map(sz).join(" "):t}},cw={...Fo,transform:Math.round},az={rotate:Tr,rotateX:Tr,rotateY:Tr,rotateZ:Tr,scale:lu,scaleX:lu,scaleY:lu,scaleZ:lu,skew:Tr,skewX:Tr,skewY:Tr,distance:ye,translateX:ye,translateY:ye,translateZ:ye,x:ye,y:ye,z:ye,perspective:ye,transformPerspective:ye,opacity:fl,originX:Xx,originY:Xx,originZ:ye},eg={borderWidth:ye,borderTopWidth:ye,borderRightWidth:ye,borderBottomWidth:ye,borderLeftWidth:ye,borderRadius:ye,radius:ye,borderTopLeftRadius:ye,borderTopRightRadius:ye,borderBottomRightRadius:ye,borderBottomLeftRadius:ye,width:ye,maxWidth:ye,height:ye,maxHeight:ye,top:ye,right:ye,bottom:ye,left:ye,padding:ye,paddingTop:ye,paddingRight:ye,paddingBottom:ye,paddingLeft:ye,margin:ye,marginTop:ye,marginRight:ye,marginBottom:ye,marginLeft:ye,backgroundPositionX:ye,backgroundPositionY:ye,...az,zIndex:cw,fillOpacity:fl,strokeOpacity:fl,numOctaves:cw},lz={...eg,color:St,backgroundColor:St,outlineColor:St,fill:St,stroke:St,borderColor:St,borderTopColor:St,borderRightColor:St,borderBottomColor:St,borderLeftColor:St,filter:km,WebkitFilter:km},bR=t=>lz[t];function vR(t,e){let n=bR(t);return n!==km&&(n=Nr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const cz=new Set(["auto","none","0"]);function uz(t,e,n){let r=0,o;for(;r<t.length&&!o;){const c=t[r];typeof c=="string"&&!cz.has(c)&&dl(c).values.length&&(o=t[r]),r++}if(o&&n)for(const c of e)t[c]=vR(n,o)}class fz extends Qy{constructor(e,n,r,o,c){super(e,n,r,o,c,!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 p=e[h];if(typeof p=="string"&&(p=p.trim(),Iy(p))){const y=pR(p,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!mR.has(r)||e.length!==2)return;const[o,c]=e,u=lw(o),d=lw(c);if(u!==d)if(rw(u)&&rw(d))for(let h=0;h<e.length;h++){const p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}else us[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||iz(e[o]))&&r.push(o);r.length&&uz(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=us[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,u=r[c];r[c]=us[n](e.measureViewportBox(),window.getComputedStyle(e.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{e.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function dz(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const SR=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function hz(t){return LE(t)&&"offsetHeight"in t}const uw=30,pz=t=>!isNaN(parseFloat(t));class mz{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=un.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=pz(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 zy);const r=this.events[e].add(n);return e==="change"?()=>{r(),We.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=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>uw)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,uw);return UE(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 zo(t,e){return new mz(t,e)}const{schedule:tg}=XE(queueMicrotask,!1),Fn={x:!1,y:!1};function xR(){return Fn.x||Fn.y}function yz(t){return t==="x"||t==="y"?Fn[t]?null:(Fn[t]=!0,()=>{Fn[t]=!1}):Fn.x||Fn.y?null:(Fn.x=Fn.y=!0,()=>{Fn.x=Fn.y=!1})}function wR(t,e){const n=dz(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function fw(t){return!(t.pointerType==="touch"||xR())}function gz(t,e,n={}){const[r,o,c]=wR(t,n),u=d=>{if(!fw(d))return;const{target:h}=d,p=e(h,d);if(typeof p!="function"||!h)return;const y=g=>{fw(g)&&(p(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(d=>{d.addEventListener("pointerenter",u,o)}),c}const TR=(t,e)=>e?t===e?!0:TR(t,e.parentElement):!1,ng=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function vz(t){return bz.has(t.tagName)||t.tabIndex!==-1}const wu=new WeakSet;function dw(t){return e=>{e.key==="Enter"&&t(e)}}function Sp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Sz=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=dw(()=>{if(wu.has(n))return;Sp(n,"down");const o=dw(()=>{Sp(n,"up")}),c=()=>Sp(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",c,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function hw(t){return ng(t)&&!xR()}function xz(t,e,n={}){const[r,o,c]=wR(t,n),u=d=>{const h=d.currentTarget;if(!hw(d))return;wu.add(h);const p=e(h,d),y=(S,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),wu.has(h)&&wu.delete(h),hw(S)&&typeof p=="function"&&p(S,{success:w})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||TR(h,S.target))},v=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",v,o)};return r.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),hz(d)&&(d.addEventListener("focus",p=>Sz(p,o)),!vz(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),c}function AR(t){return LE(t)&&"ownerSVGElement"in t}function wz(t){return AR(t)&&t.tagName==="svg"}const Ft=t=>!!(t&&t.getVelocity),Tz=[...gR,St,Nr],Az=t=>Tz.find(yR(t)),ER=V.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Ez(t=!0){const e=V.useContext(jy);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,c=V.useId();V.useEffect(()=>{if(t)return o(c)},[t]);const u=V.useCallback(()=>t&&r&&r(c),[c,r,t]);return!n&&r?[!1,u]:[!0]}const RR=V.createContext({strict:!1}),pw={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"]},Ko={};for(const t in pw)Ko[t]={isEnabled:e=>pw[t].some(n=>!!e[n])};function Rz(t){for(const e in t)Ko[e]={...Ko[e],...t[e]}}const Oz=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 Xu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Oz.has(t)}let OR=t=>!Xu(t);function _z(t){typeof t=="function"&&(OR=e=>e.startsWith("on")?!Xu(e):t(e))}try{_z(require("@emotion/is-prop-valid").default)}catch{}function kz(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(OR(o)||n===!0&&Xu(o)||!e&&!Xu(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const Ef=V.createContext({});function Rf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function hl(t){return typeof t=="string"||Array.isArray(t)}const ig=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],rg=["initial",...ig];function Of(t){return Rf(t.animate)||rg.some(e=>hl(t[e]))}function _R(t){return!!(Of(t)||t.variants)}function Mz(t,e){if(Of(t)){const{initial:n,animate:r}=t;return{initial:n===!1||hl(n)?n:void 0,animate:hl(r)?r:void 0}}return t.inherit!==!1?e:{}}function Cz(t){const{initial:e,animate:n}=Mz(t,V.useContext(Ef));return V.useMemo(()=>({initial:e,animate:n}),[mw(e),mw(n)])}function mw(t){return Array.isArray(t)?t.join(" "):t}const pl={};function Dz(t){for(const e in t)pl[e]=t[e],qy(e)&&(pl[e].isCSSVariable=!0)}function kR(t,{layout:e,layoutId:n}){return Yo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!pl[t]||t==="opacity")}const Nz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$z=Go.length;function jz(t,e,n){let r="",o=!0;for(let c=0;c<$z;c++){const u=Go[c],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const p=SR(d,eg[u]);if(!h){o=!1;const y=Nz[u]||u;r+=`${y}(${p}) `}n&&(e[u]=p)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function sg(t,e,n){const{style:r,vars:o,transformOrigin:c}=t;let u=!1,d=!1;for(const h in e){const p=e[h];if(Yo.has(h)){u=!0;continue}else if(qy(h)){o[h]=p;continue}else{const y=SR(p,eg[h]);h.startsWith("origin")?(d=!0,c[h]=y):r[h]=y}}if(e.transform||(u||n?r.transform=jz(e,t.transform,n):r.transform&&(r.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:y=0}=c;r.transformOrigin=`${h} ${p} ${y}`}}const og=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function MR(t,e,n){for(const r in e)!Ft(e[r])&&!kR(r,n)&&(t[r]=e[r])}function Bz({transformTemplate:t},e){return V.useMemo(()=>{const n=og();return sg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Lz(t,e){const n=t.style||{},r={};return MR(r,n,t),Object.assign(r,Bz(t,e)),r}function Vz(t,e){const n={},r=Lz(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 Uz={offset:"stroke-dashoffset",array:"stroke-dasharray"},zz={offset:"strokeDashoffset",array:"strokeDasharray"};function Kz(t,e,n=1,r=0,o=!0){t.pathLength=1;const c=o?Uz:zz;t[c.offset]=ye.transform(-r);const u=ye.transform(e),d=ye.transform(n);t[c.array]=`${u} ${d}`}function CR(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:c=1,pathOffset:u=0,...d},h,p,y){if(sg(t,d,p),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:v}=t;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.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),o!==void 0&&Kz(g,o,c,u,!1)}const DR=()=>({...og(),attrs:{}}),NR=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Pz(t,e,n,r){const o=V.useMemo(()=>{const c=DR();return CR(c,e,NR(r),t.transformTemplate,t.style),{...c.attrs,style:{...c.style}}},[e]);if(t.style){const c={};MR(c,t.style,t),o.style={...c,...o.style}}return o}const qz=["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 ag(t){return typeof t!="string"||t.includes("-")?!1:!!(qz.indexOf(t)>-1||/[A-Z]/u.test(t))}function Iz(t,e,n,{latestValues:r},o,c=!1){const d=(ag(t)?Pz:Vz)(e,r,o,t),h=kz(e,typeof t=="string",c),p=t!==V.Fragment?{...h,...d,ref:n}:{},{children:y}=e,g=V.useMemo(()=>Ft(y)?y.get():y,[y]);return V.createElement(t,{...p,children:g})}function yw(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function lg(t,e,n,r){if(typeof e=="function"){const[o,c]=yw(r);e=e(n!==void 0?n:t.custom,o,c)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,c]=yw(r);e=e(n!==void 0?n:t.custom,o,c)}return e}function Tu(t){return Ft(t)?t.get():t}function Hz({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:Fz(n,r,o,t),renderState:e()}}function Fz(t,e,n,r){const o={},c=r(t,{});for(const v in c)o[v]=Tu(c[v]);let{initial:u,animate:d}=t;const h=Of(t),p=_R(t);e&&p&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const g=y?d:u;if(g&&typeof g!="boolean"&&!Rf(g)){const v=Array.isArray(g)?g:[g];for(let S=0;S<v.length;S++){const w=lg(t,v[S]);if(w){const{transitionEnd:T,transition:D,...$}=w;for(const _ in $){let k=$[_];if(Array.isArray(k)){const C=y?k.length-1:0;k=k[C]}k!==null&&(o[_]=k)}for(const _ in T)o[_]=T[_]}}}return o}const $R=t=>(e,n)=>{const r=V.useContext(Ef),o=V.useContext(jy),c=()=>Hz(t,e,r,o);return n?c():RU(c)};function cg(t,e,n){const{style:r}=t,o={};for(const c in r)(Ft(r[c])||e.style&&Ft(e.style[c])||kR(c,t)||n?.getValue(c)?.liveStyle!==void 0)&&(o[c]=r[c]);return o}const Gz=$R({scrapeMotionValuesFromProps:cg,createRenderState:og});function jR(t,e,n){const r=cg(t,e,n);for(const o in t)if(Ft(t[o])||Ft(e[o])){const c=Go.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[c]=t[o]}return r}const Yz=$R({scrapeMotionValuesFromProps:jR,createRenderState:DR}),Jz=Symbol.for("motionComponentSymbol");function yo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Xz(t,e,n){return V.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):yo(n)&&(n.current=r))},[e])}const ug=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Zz="framerAppearId",BR="data-"+ug(Zz),LR=V.createContext({});function Qz(t,e,n,r,o){const{visualElement:c}=V.useContext(Ef),u=V.useContext(RR),d=V.useContext(jy),h=V.useContext(ER).reducedMotion,p=V.useRef(null);r=r||u.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:c,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current,g=V.useContext(LR);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&Wz(p.current,n,o,g);const v=V.useRef(!1);V.useInsertionEffect(()=>{y&&v.current&&y.update(n,d)});const S=n[BR],w=V.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return OU(()=>{y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),w.current&&y.animationState&&y.animationState.animateChanges())}),V.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),w.current=!1),y.enteringChildren=void 0)}),y}function Wz(t,e,n,r){const{layoutId:o,layout:c,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:VR(t.parent)),t.projection.setOptions({layoutId:o,layout:c,alwaysMeasureLayout:!!u||d&&yo(d),visualElement:t,animationType:typeof c=="string"?c:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:p})}function VR(t){if(t)return t.options.allowProjection!==!1?t.projection:VR(t.parent)}function xp(t,{forwardMotionProps:e=!1}={},n,r){n&&Rz(n);const o=ag(t)?Yz:Gz;function c(d,h){let p;const y={...V.useContext(ER),...d,layoutId:eK(d)},{isStatic:g}=y,v=Cz(d),S=o(d,g);if(!g&&$y){tK();const w=nK(y);p=w.MeasureLayout,v.visualElement=Qz(t,S,y,r,w.ProjectionNode)}return Y.jsxs(Ef.Provider,{value:v,children:[p&&v.visualElement?Y.jsx(p,{visualElement:v.visualElement,...y}):null,Iz(t,d,Xz(S,v.visualElement,h),S,g,e)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=V.forwardRef(c);return u[Jz]=t,u}function eK({layoutId:t}){const e=V.useContext(jE).id;return e&&t!==void 0?e+"-"+t:t}function tK(t,e){V.useContext(RR).strict}function nK(t){const{drag:e,layout:n}=Ko;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function iK(t,e){if(typeof Proxy>"u")return xp;const n=new Map,r=(c,u)=>xp(c,u,t,e),o=(c,u)=>r(c,u);return new Proxy(o,{get:(c,u)=>u==="create"?r:(n.has(u)||n.set(u,xp(u,void 0,t,e)),n.get(u))})}function UR({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function rK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function sK(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 wp(t){return t===void 0||t===1}function Mm({scale:t,scaleX:e,scaleY:n}){return!wp(t)||!wp(e)||!wp(n)}function rs(t){return Mm(t)||zR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function zR(t){return gw(t.x)||gw(t.y)}function gw(t){return t&&t!=="0%"}function Zu(t,e,n){const r=t-n,o=e*r;return n+o}function bw(t,e,n,r,o){return o!==void 0&&(t=Zu(t,o,r)),Zu(t,n,r)+e}function Cm(t,e=0,n=1,r,o){t.min=bw(t.min,e,n,r,o),t.max=bw(t.max,e,n,r,o)}function KR(t,{x:e,y:n}){Cm(t.x,e.translate,e.scale,e.originPoint),Cm(t.y,n.translate,n.scale,n.originPoint)}const vw=.999999999999,Sw=1.0000000000001;function oK(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let c,u;for(let d=0;d<o;d++){c=n[d],u=c.projectionDelta;const{visualElement:h}=c.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&c.options.layoutScroll&&c.scroll&&c!==c.root&&bo(t,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,KR(t,u)),r&&rs(c.latestValues)&&bo(t,c.latestValues))}e.x<Sw&&e.x>vw&&(e.x=1),e.y<Sw&&e.y>vw&&(e.y=1)}function go(t,e){t.min=t.min+e,t.max=t.max+e}function xw(t,e,n,r,o=.5){const c=it(t.min,t.max,o);Cm(t,e,n,c,r)}function bo(t,e){xw(t.x,e.x,e.scaleX,e.scale,e.originX),xw(t.y,e.y,e.scaleY,e.scale,e.originY)}function PR(t,e){return UR(sK(t.getBoundingClientRect(),e))}function aK(t,e,n){const r=PR(t,n),{scroll:o}=e;return o&&(go(r.x,o.offset.x),go(r.y,o.offset.y)),r}const ww=()=>({translate:0,scale:1,origin:0,originPoint:0}),vo=()=>({x:ww(),y:ww()}),Tw=()=>({min:0,max:0}),dt=()=>({x:Tw(),y:Tw()}),Dm={current:null},qR={current:!1};function lK(){if(qR.current=!0,!!$y)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Dm.current=t.matches;t.addEventListener("change",e),e()}else Dm.current=!1}const cK=new WeakMap;function uK(t,e,n){for(const r in e){const o=e[r],c=n[r];if(Ft(o))t.addValue(r,o);else if(Ft(c))t.addValue(r,zo(o,{owner:t}));else if(c!==o)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(r);t.addValue(r,zo(u!==void 0?u:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Aw=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class fK{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:c,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Qy,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 v=un.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,We.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!c,this.isControllingVariants=Of(n),this.isVariantNode=_R(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in g){const S=g[v];h[v]!==void 0&&Ft(S)&&S.set(h[v])}}mount(e){this.current=e,cK.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)),qR.current||lK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Dm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Dr(this.notifyUpdate),Dr(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=Yo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",u=>{this.latestValues[e]=u,this.props.onUpdate&&We.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),c&&c(),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 Ko){const n=Ko[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const c=this.features[e];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):dt()}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<Aw.length;r++){const o=Aw[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const c="on"+o,u=e[c];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=uK(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=zo(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"&&(BE(r)||VE(r))?r=parseFloat(r):!Az(r)&&Nr.test(n)&&(r=vR(e,n)),this.setBaseTarget(e,Ft(r)?r.get():r)),Ft(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 c=lg(this.props,n,this.presenceContext?.custom);c&&(r=c[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Ft(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new zy),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){tg.render(this.render)}}class IR extends fK{constructor(){super(...arguments),this.KeyframeResolver=fz}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;Ft(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function HR(t,{style:e,vars:n},r,o){const c=t.style;let u;for(u in e)c[u]=e[u];o?.applyProjectionStyles(c,r);for(u in n)c.setProperty(u,n[u])}function dK(t){return window.getComputedStyle(t)}class hK extends IR{constructor(){super(...arguments),this.type="html",this.renderInstance=HR}readValueFromInstance(e,n){if(Yo.has(n))return this.projection?.isProjecting?Tm(n):M4(e,n);{const r=dK(e),o=(qy(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return PR(e,n)}build(e,n,r){sg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return cg(e,n,r)}}const FR=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 pK(t,e,n,r){HR(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(FR.has(o)?o:ug(o),e.attrs[o])}class mK extends IR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=dt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Yo.has(n)){const r=bR(n);return r&&r.default||0}return n=FR.has(n)?n:ug(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return jR(e,n,r)}build(e,n,r){CR(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){pK(e,n,r,o)}mount(e){this.isSVGTag=NR(e.tagName),super.mount(e)}}const yK=(t,e)=>ag(t)?new mK(e):new hK(e,{allowProjection:t!==V.Fragment});function Oo(t,e,n){const r=t.getProps();return lg(r,e,n!==void 0?n:r.custom,t)}const Nm=t=>Array.isArray(t);function gK(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,zo(n))}function bK(t){return Nm(t)?t[t.length-1]||0:t}function vK(t,e){const n=Oo(t,e);let{transitionEnd:r={},transition:o={},...c}=n||{};c={...c,...r};for(const u in c){const d=bK(c[u]);gK(t,u,d)}}function SK(t){return!!(Ft(t)&&t.add)}function $m(t,e){const n=t.getValue("willChange");if(SK(n))return n.add(e);if(!n&&Ji.WillChange){const r=new Ji.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function GR(t){return t.props[BR]}const xK=t=>t!==null;function wK(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(xK),c=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[c]}const TK={type:"spring",stiffness:500,damping:25,restSpeed:10},AK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),EK={type:"keyframes",duration:.8},RK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},OK=(t,{keyframes:e})=>e.length>2?EK:Yo.has(t)?t.startsWith("scale")?AK(e[1]):TK:RK;function _K({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:c,repeatType:u,repeatDelay:d,from:h,elapsed:p,...y}){return!!Object.keys(y).length}const fg=(t,e,n,r={},o,c)=>u=>{const d=Wy(r,t)||{},h=d.delay||r.delay||0;let{elapsed:p=0}=r;p=p-ui(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-p,onUpdate:v=>{e.set(v),d.onUpdate&&d.onUpdate(v)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:c?void 0:o};_K(d)||Object.assign(y,OK(t,y)),y.duration&&(y.duration=ui(y.duration)),y.repeatDelay&&(y.repeatDelay=ui(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(_m(y),y.delay===0&&(g=!0)),(Ji.instantAnimations||Ji.skipAnimations)&&(g=!0,_m(y),y.delay=0),y.allowFlatten=!d.type&&!d.ease,g&&!c&&e.get()!==void 0){const v=wK(y.keyframes,d);if(v!==void 0){We.update(()=>{y.onUpdate(v),y.onComplete()});return}}return d.isSync?new Zy(y):new W4(y)};function kK({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function YR(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:c=t.getDefaultTransition(),transitionEnd:u,...d}=e;r&&(c=r);const h=[],p=o&&t.animationState&&t.animationState.getState()[o];for(const y in d){const g=t.getValue(y,t.latestValues[y]??null),v=d[y];if(v===void 0||p&&kK(p,y))continue;const S={delay:n,...Wy(c||{},y)},w=g.get();if(w!==void 0&&!g.isAnimating&&!Array.isArray(v)&&v===w&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const $=GR(t);if($){const _=window.MotionHandoffAnimation($,y,We);_!==null&&(S.startTime=_,T=!0)}}$m(t,y),g.start(fg(y,g,v,t.shouldReduceMotion&&mR.has(y)?{type:!1}:S,t,T));const D=g.animation;D&&h.push(D)}return u&&Promise.all(h).then(()=>{We.update(()=>{u&&vK(t,u)})}),h}function JR(t,e,n,r=0,o=1){const c=Array.from(t).sort((p,y)=>p.sortNodePosition(y)).indexOf(e),u=t.size,d=(u-1)*r;return typeof n=="function"?n(c,u):o===1?c*r:d-c*r}function jm(t,e,n={}){const r=Oo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const c=r?()=>Promise.all(YR(t,r,n)):()=>Promise.resolve(),u=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:g}=o;return MK(t,e,h,p,y,g,n)}:()=>Promise.resolve(),{when:d}=o;if(d){const[h,p]=d==="beforeChildren"?[c,u]:[u,c];return h().then(()=>p())}else return Promise.all([c(),u(n.delay)])}function MK(t,e,n=0,r=0,o=0,c=1,u){const d=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),d.push(jm(h,e,{...u,delay:n+(typeof r=="function"?0:r)+JR(t.variantChildren,h,r,o,c)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(d)}function CK(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(c=>jm(t,c,n));r=Promise.all(o)}else if(typeof e=="string")r=jm(t,e,n);else{const o=typeof e=="function"?Oo(t,e,n.custom):e;r=Promise.all(YR(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function XR(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 DK=rg.length;function ZR(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?ZR(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<DK;n++){const r=rg[n],o=t.props[r];(hl(o)||o===!1)&&(e[r]=o)}return e}const NK=[...ig].reverse(),$K=ig.length;function jK(t){return e=>Promise.all(e.map(({animation:n,options:r})=>CK(t,n,r)))}function BK(t){let e=jK(t),n=Ew(),r=!0;const o=h=>(p,y)=>{const g=Oo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:v,transitionEnd:S,...w}=g;p={...p,...w,...S}}return p};function c(h){e=h(t)}function u(h){const{props:p}=t,y=ZR(t.parent)||{},g=[],v=new Set;let S={},w=1/0;for(let D=0;D<$K;D++){const $=NK[D],_=n[$],k=p[$]!==void 0?p[$]:y[$],C=hl(k),O=$===h?_.isActive:null;O===!1&&(w=D);let J=k===y[$]&&k!==p[$]&&C;if(J&&r&&t.manuallyAnimateOnMount&&(J=!1),_.protectedKeys={...S},!_.isActive&&O===null||!k&&!_.prevProp||Rf(k)||typeof k=="boolean")continue;const G=LK(_.prevProp,k);let H=G||$===h&&_.isActive&&!J&&C||D>w&&C,ie=!1;const oe=Array.isArray(k)?k:[k];let fe=oe.reduce(o($),{});O===!1&&(fe={});const{prevResolvedValues:ge={}}=_,be={...ge,...fe},Q=P=>{H=!0,v.has(P)&&(ie=!0,v.delete(P)),_.needsAnimating[P]=!0;const z=t.getValue(P);z&&(z.liveStyle=!1)};for(const P in be){const z=fe[P],ee=ge[P];if(S.hasOwnProperty(P))continue;let A=!1;Nm(z)&&Nm(ee)?A=!XR(z,ee):A=z!==ee,A?z!=null?Q(P):v.add(P):z!==void 0&&v.has(P)?Q(P):_.protectedKeys[P]=!0}_.prevProp=k,_.prevResolvedValues=fe,_.isActive&&(S={...S,...fe}),r&&t.blockInitialAnimation&&(H=!1);const W=J&&G;H&&(!W||ie)&&g.push(...oe.map(P=>{const z={type:$};if(typeof P=="string"&&r&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ee}=t,A=Oo(ee,P);if(ee.enteringChildren&&A){const{delayChildren:I}=A.transition||{};z.delay=JR(ee.enteringChildren,t,I)}}return{animation:P,options:z}}))}if(v.size){const D={};if(typeof p.initial!="boolean"){const $=Oo(t,Array.isArray(p.initial)?p.initial[0]:p.initial);$&&$.transition&&(D.transition=$.transition)}v.forEach($=>{const _=t.getBaseTarget($),k=t.getValue($);k&&(k.liveStyle=!0),D[$]=_??null}),g.push({animation:D})}let T=!!g.length;return r&&(p.initial===!1||p.initial===p.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function d(h,p){if(n[h].isActive===p)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,p)),n[h].isActive=p;const y=u(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:u,setActive:d,setAnimateFunction:c,getState:()=>n,reset:()=>{n=Ew(),r=!0}}}function LK(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!XR(e,t):!1}function ts(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ew(){return{animate:ts(!0),whileInView:ts(),whileHover:ts(),whileTap:ts(),whileDrag:ts(),whileFocus:ts(),exit:ts()}}class Br{constructor(e){this.isMounted=!1,this.node=e}update(){}}class VK extends Br{constructor(e){super(e),e.animationState||(e.animationState=BK(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Rf(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 UK=0;class zK extends Br{constructor(){super(...arguments),this.id=UK++}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 o=this.node.animationState.setActive("exit",!e);n&&!e&&o.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 KK={animation:{Feature:VK},exit:{Feature:zK}};function ml(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function $l(t){return{point:{x:t.pageX,y:t.pageY}}}const PK=t=>e=>ng(e)&&t(e,$l(e));function rl(t,e,n,r){return ml(t,e,PK(n),r)}const QR=1e-4,qK=1-QR,IK=1+QR,WR=.01,HK=0-WR,FK=0+WR;function Wt(t){return t.max-t.min}function GK(t,e,n){return Math.abs(t-e)<=n}function Rw(t,e,n,r=.5){t.origin=r,t.originPoint=it(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=it(n.min,n.max,t.origin)-t.originPoint,(t.scale>=qK&&t.scale<=IK||isNaN(t.scale))&&(t.scale=1),(t.translate>=HK&&t.translate<=FK||isNaN(t.translate))&&(t.translate=0)}function sl(t,e,n,r){Rw(t.x,e.x,n.x,r?r.originX:void 0),Rw(t.y,e.y,n.y,r?r.originY:void 0)}function Ow(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function YK(t,e,n){Ow(t.x,e.x,n.x),Ow(t.y,e.y,n.y)}function _w(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function ol(t,e,n){_w(t.x,e.x,n.x),_w(t.y,e.y,n.y)}function Bn(t){return[t("x"),t("y")]}const eO=({current:t})=>t?t.ownerDocument.defaultView:null,kw=(t,e)=>Math.abs(t-e);function JK(t,e){const n=kw(t.x,e.x),r=kw(t.y,e.y);return Math.sqrt(n**2+r**2)}class tO{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:c=!1,distanceThreshold:u=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 v=Ap(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,w=JK(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!w)return;const{point:T}=v,{timestamp:D}=Kt;this.history.push({...T,timestamp:D});const{onStart:$,onMove:_}=this.handlers;S||($&&$(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,v)},this.handlePointerMove=(v,S)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=Tp(S,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(v,S)=>{this.end();const{onEnd:w,onSessionEnd:T,resumeAnimation:D}=this.handlers;if(this.dragSnapToOrigin&&D&&D(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const $=Ap(v.type==="pointercancel"?this.lastMoveEventInfo:Tp(S,this.transformPagePoint),this.history);this.startEvent&&w&&w(v,$),T&&T(v,$)},!ng(e))return;this.dragSnapToOrigin=c,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=u,this.contextWindow=o||window;const d=$l(e),h=Tp(d,this.transformPagePoint),{point:p}=h,{timestamp:y}=Kt;this.history=[{...p,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,Ap(h,this.history)),this.removeListeners=Cl(rl(this.contextWindow,"pointermove",this.handlePointerMove),rl(this.contextWindow,"pointerup",this.handlePointerUp),rl(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Dr(this.updatePoint)}}function Tp(t,e){return e?{point:e(t.point)}:t}function Mw(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ap({point:t},e){return{point:t,delta:Mw(t,nO(e)),offset:Mw(t,XK(e)),velocity:ZK(e,.1)}}function XK(t){return t[0]}function nO(t){return t[t.length-1]}function ZK(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=nO(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>ui(e)));)n--;if(!r)return{x:0,y:0};const c=fi(o.timestamp-r.timestamp);if(c===0)return{x:0,y:0};const u={x:(o.x-r.x)/c,y:(o.y-r.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function QK(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?it(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?it(n,t,r.max):Math.min(t,n)),t}function Cw(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 WK(t,{top:e,left:n,bottom:r,right:o}){return{x:Cw(t.x,n,o),y:Cw(t.y,e,r)}}function Dw(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 eP(t,e){return{x:Dw(t.x,e.x),y:Dw(t.y,e.y)}}function tP(t,e){let n=.5;const r=Wt(t),o=Wt(e);return o>r?n=ul(e.min,e.max-r,t.min):r>o&&(n=ul(t.min,t.max-o,e.min)),Yi(0,1,n)}function nP(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 Bm=.35;function iP(t=Bm){return t===!1?t=0:t===!0&&(t=Bm),{x:Nw(t,"left","right"),y:Nw(t,"top","bottom")}}function Nw(t,e,n){return{min:$w(t,e),max:$w(t,n)}}function $w(t,e){return typeof t=="number"?t:t[e]||0}const rP=new WeakMap;class sP{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=dt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=g=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor($l(g).point)},u=(g,v)=>{const{drag:S,dragPropagation:w,onDragStart:T}=this.getProps();if(S&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=yz(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bn($=>{let _=this.getAxisMotionValue($).get()||0;if(di.test(_)){const{projection:k}=this.visualElement;if(k&&k.layout){const C=k.layout.layoutBox[$];C&&(_=Wt(C)*(parseFloat(_)/100))}}this.originPoint[$]=_}),T&&We.postRender(()=>T(g,v)),$m(this.visualElement,"transform");const{animationState:D}=this.visualElement;D&&D.setActive("whileDrag",!0)},d=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:S,dragDirectionLock:w,onDirectionLock:T,onDrag:D}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:$}=v;if(w&&this.currentDirection===null){this.currentDirection=oP($),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",v.point,$),this.updateAxis("y",v.point,$),this.visualElement.render(),D&&D(g,v)},h=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v,this.stop(g,v),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>Bn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new tO(e,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:eO(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!o||!r)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&We.postRender(()=>d(r,o))}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:o}=this.getProps();if(!r||!cu(e,o,this.currentDirection))return;const c=this.getAxisMotionValue(e);let u=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(u=QK(u,this.constraints[e],this.elastic[e])),c.set(u)}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,o=this.constraints;e&&yo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=WK(r.layoutBox,e):this.constraints=!1,this.elastic=iP(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bn(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=nP(r.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!yo(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const c=aK(r,o.root,this.visualElement.getTransformPagePoint());let u=eP(o.layout.layoutBox,c);if(n){const d=n(rK(u));this.hasMutatedConstraints=!!d,d&&(u=UR(d))}return u}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=Bn(y=>{if(!cu(y,n,this.currentDirection))return;let g=h&&h[y]||{};u&&(g={min:0,max:0});const v=o?200:1e6,S=o?40:1e7,w={type:"inertia",velocity:r?e[y]:0,bounceStiffness:v,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...c,...g};return this.startAxisValueAnimation(y,w)});return Promise.all(p).then(d)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return $m(this.visualElement,e),r.start(fg(e,r,0,n,this.visualElement,!1))}stopAnimation(){Bn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bn(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(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Bn(n=>{const{drag:r}=this.getProps();if(!cu(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,c=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];c.set(e[n]-it(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!yo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bn(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=tP({min:h,max:h},this.constraints[u])}});const{transformTemplate:c}=this.visualElement.getProps();this.visualElement.current.style.transform=c?c({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Bn(u=>{if(!cu(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(it(h,p,o[u]))})}addListeners(){if(!this.visualElement.current)return;rP.set(this.visualElement,this);const e=this.visualElement.current,n=rl(e,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps();p&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();yo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,c=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),We.read(r);const u=ml(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Bn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())});return()=>{u(),n(),c(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:c=!1,dragElastic:u=Bm,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:c,dragElastic:u,dragMomentum:d}}}function cu(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function oP(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class aP extends Br{constructor(e){super(e),this.removeGroupControls=Un,this.removeListeners=Un,this.controls=new sP(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Un}unmount(){this.removeGroupControls(),this.removeListeners()}}const jw=t=>(e,n)=>{t&&We.postRender(()=>t(e,n))};class lP extends Br{constructor(){super(...arguments),this.removePointerDownListener=Un}onPointerDown(e){this.session=new tO(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:jw(e),onStart:jw(n),onMove:r,onEnd:(c,u)=>{delete this.session,o&&We.postRender(()=>o(c,u))}}}mount(){this.removePointerDownListener=rl(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 Au={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Bw(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(ye.test(t))t=parseFloat(t);else return t;const n=Bw(t,e.target.x),r=Bw(t,e.target.y);return`${n}% ${r}%`}},cP={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Nr.parse(t);if(o.length>5)return r;const c=Nr.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const p=it(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),c(o)}};let Ep=!1;class uP extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:c}=e;Dz(fP),c&&(n.group&&n.group.add(c),r&&r.register&&o&&r.register(c),Ep&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,onExitComplete:()=>this.safeToRemove()})),Au.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:c}=this.props,{projection:u}=r;return u&&(u.isPresent=c,Ep=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==c?u.willUpdate():this.safeToRemove(),e.isPresent!==c&&(c?u.promote():u.relegate()||We.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),tg.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Ep=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function iO(t){const[e,n]=Ez(),r=V.useContext(jE);return Y.jsx(uP,{...t,layoutGroup:r,switchLayoutGroup:V.useContext(LR),isPresent:e,safeToRemove:n})}const fP={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:cP};function dP(t,e,n){const r=Ft(t)?t:zo(t);return r.start(fg("",r,e,n)),r.animation}const hP=(t,e)=>t.depth-e.depth;class pP{constructor(){this.children=[],this.isDirty=!1}add(e){By(this.children,e),this.isDirty=!0}remove(e){Ly(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hP),this.isDirty=!1,this.children.forEach(e)}}function mP(t,e){const n=un.now(),r=({timestamp:o})=>{const c=o-n;c>=e&&(Dr(r),t(c-e))};return We.setup(r,!0),()=>Dr(r)}const rO=["TopLeft","TopRight","BottomLeft","BottomRight"],yP=rO.length,Lw=t=>typeof t=="string"?parseFloat(t):t,Vw=t=>typeof t=="number"||ye.test(t);function gP(t,e,n,r,o,c){o?(t.opacity=it(0,n.opacity??1,bP(r)),t.opacityExit=it(e.opacity??1,0,vP(r))):c&&(t.opacity=it(e.opacity??1,n.opacity??1,r));for(let u=0;u<yP;u++){const d=`border${rO[u]}Radius`;let h=Uw(e,d),p=Uw(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||Vw(h)===Vw(p)?(t[d]=Math.max(it(Lw(h),Lw(p),r),0),(di.test(p)||di.test(h))&&(t[d]+="%")):t[d]=p}(e.rotate||n.rotate)&&(t.rotate=it(e.rotate||0,n.rotate||0,r))}function Uw(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const bP=sO(0,.5,FE),vP=sO(.5,.95,Un);function sO(t,e,n){return r=>r<t?0:r>e?1:n(ul(t,e,r))}function zw(t,e){t.min=e.min,t.max=e.max}function $n(t,e){zw(t.x,e.x),zw(t.y,e.y)}function Kw(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Pw(t,e,n,r,o){return t-=e,t=Zu(t,1/n,r),o!==void 0&&(t=Zu(t,1/o,r)),t}function SP(t,e=0,n=1,r=.5,o,c=t,u=t){if(di.test(e)&&(e=parseFloat(e),e=it(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=it(c.min,c.max,r);t===c&&(d-=e),t.min=Pw(t.min,e,n,d,o),t.max=Pw(t.max,e,n,d,o)}function qw(t,e,[n,r,o],c,u){SP(t,e[n],e[r],e[o],e.scale,c,u)}const xP=["x","scaleX","originX"],wP=["y","scaleY","originY"];function Iw(t,e,n,r){qw(t.x,e,xP,n?n.x:void 0,r?r.x:void 0),qw(t.y,e,wP,n?n.y:void 0,r?r.y:void 0)}function Hw(t){return t.translate===0&&t.scale===1}function oO(t){return Hw(t.x)&&Hw(t.y)}function Fw(t,e){return t.min===e.min&&t.max===e.max}function TP(t,e){return Fw(t.x,e.x)&&Fw(t.y,e.y)}function Gw(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function aO(t,e){return Gw(t.x,e.x)&&Gw(t.y,e.y)}function Yw(t){return Wt(t.x)/Wt(t.y)}function Jw(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class AP{constructor(){this.members=[]}add(e){By(this.members,e),e.scheduleRender()}remove(e){if(Ly(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(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const c=this.members[o];if(c.isPresent!==!1){r=c;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:o}=e.options;o===!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 EP(t,e,n){let r="";const o=t.x.translate/e.x,c=t.y.translate/e.y,u=n?.z||0;if((o||c||u)&&(r=`translate3d(${o}px, ${c}px, ${u}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:p,rotate:y,rotateX:g,rotateY:v,skewX:S,skewY:w}=n;p&&(r=`perspective(${p}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),v&&(r+=`rotateY(${v}deg) `),S&&(r+=`skewX(${S}deg) `),w&&(r+=`skewY(${w}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(r+=`scale(${d}, ${h})`),r||"none"}const Rp=["","X","Y","Z"],RP=1e3;let OP=0;function Op(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function lO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=GR(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:c}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",We,!(o||c))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&lO(r)}function cO({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=OP++,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(MP),this.nodes.forEach($P),this.nodes.forEach(jP),this.nodes.forEach(CP)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new pP)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new zy),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=AR(u)&&!wz(u),this.instance=u;const{layoutId:d,layout:h,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),t){let y,g=0;const v=()=>this.root.updateBlockedByResize=!1;We.read(()=>{g=window.innerWidth}),t(u,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=mP(v,250),Au.hasAnimatedSinceResize&&(Au.hasAnimatedSinceResize=!1,this.nodes.forEach(Qw)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||p.getDefaultTransition()||zP,{onLayoutAnimationStart:T,onLayoutAnimationComplete:D}=p.getProps(),$=!this.targetLayout||!aO(this.targetLayout,S),_=!g&&v;if(this.options.layoutRoot||this.resumeFrom||_||g&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...Wy(w,"layout"),onPlay:T,onComplete:D};(p.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(y,_)}else g||Qw(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Dr(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(BP),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&lO(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:d,layout:h}=this.options;if(d===void 0&&!h)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Xw);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Zw);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(NP),this.nodes.forEach(_P),this.nodes.forEach(kP)):this.nodes.forEach(Zw),this.clearAllSnapshots();const d=un.now();Kt.delta=Yi(0,1e3/60,d-Kt.timestamp),Kt.timestamp=d,Kt.isProcessing=!0,mp.update.process(Kt),mp.preRender.process(Kt),mp.render.process(Kt),Kt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,tg.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(DP),this.sharedNodes.forEach(LP)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,We.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){We.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 u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=dt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!oO(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||rs(this.latestValues)||y)&&(o(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),KP(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return dt();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(PP))){const{scroll:p}=this.root;p&&(go(d.x,p.offset.x),go(d.y,p.offset.y))}return d}removeElementScroll(u){const d=dt();if($n(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const p=this.path[h],{scroll:y,options:g}=p;p!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&$n(d,u),go(d.x,y.offset.x),go(d.y,y.offset.y))}return d}applyTransform(u,d=!1){const h=dt();$n(h,u);for(let p=0;p<this.path.length;p++){const y=this.path[p];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&bo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),rs(y.latestValues)&&bo(h,y.latestValues)}return rs(this.latestValues)&&bo(h,this.latestValues),h}removeTransform(u){const d=dt();$n(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!rs(p.latestValues))continue;Mm(p.latestValues)&&p.updateSnapshot();const y=dt(),g=p.measurePageBox();$n(y,g),Iw(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,y)}return rs(this.latestValues)&&Iw(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.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!==Kt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(u||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=Kt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),ol(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=dt(),this.targetWithTransforms=dt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),YK(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$n(this.target,this.layout.layoutBox),KR(this.target,this.targetDelta)):$n(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),ol(this.relativeTargetOrigin,this.target,v.target),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Mm(this.parent.latestValues)||zR(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 u=this.getLead(),d=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Kt.timestamp&&(h=!1),h)return;const{layout:p,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||!(p||y))return;$n(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;oK(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=dt());const{target:S}=u;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Kw(this.prevProjectionDelta.x,this.projectionDelta.x),Kw(this.prevProjectionDelta.y,this.projectionDelta.y)),sl(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!Jw(this.projectionDelta.x,this.prevProjectionDelta.x)||!Jw(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vo(),this.projectionDelta=vo(),this.projectionDeltaWithTransform=vo()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},y={...this.latestValues},g=vo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const v=dt(),S=h?h.source:void 0,w=this.layout?this.layout.source:void 0,T=S!==w,D=this.getStack(),$=!D||D.members.length<=1,_=!!(T&&!$&&this.options.crossfade===!0&&!this.path.some(UP));this.animationProgress=0;let k;this.mixTargetDelta=C=>{const O=C/1e3;Ww(g.x,u.x,O),Ww(g.y,u.y,O),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ol(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),VP(this.relativeTarget,this.relativeTargetOrigin,v,O),k&&TP(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=dt()),$n(k,this.relativeTarget)),T&&(this.animationValues=y,gP(y,p,this.latestValues,O,_,$)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=O},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Dr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{Au.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=zo(0)),this.currentAnimation=dP(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:y}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&uO(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||dt();const g=Wt(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+g;const v=Wt(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+v}$n(d,h),bo(d,y),sl(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new AP),this.sharedNodes.get(u).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const p={};h.z&&Op("z",u,p,this.animationValues);for(let y=0;y<Rp.length;y++)Op(`rotate${Rp[y]}`,u,p,this.animationValues),Op(`skew${Rp[y]}`,u,p,this.animationValues);u.render();for(const y in p)u.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Tu(d?.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Tu(d?.pointerEvents)||""),this.hasProjected&&!rs(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let g=EP(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),u.transform=g;const{x:v,y:S}=this.projectionDelta;u.transformOrigin=`${v.origin*100}% ${S.origin*100}% 0`,p.animationValues?u.opacity=p===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:u.opacity=p===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const w in pl){if(y[w]===void 0)continue;const{correct:T,applyTo:D,isCSSVariable:$}=pl[w],_=g==="none"?y[w]:T(y[w],p);if(D){const k=D.length;for(let C=0;C<k;C++)u[D[C]]=_}else $?this.options.visualElement.renderState.vars[w]=_:u[w]=_}this.options.layoutId&&(u.pointerEvents=p===this?Tu(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(Xw),this.root.sharedNodes.clear()}}}function _P(t){t.updateLayout()}function kP(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:o}=t.options,c=e.source!==t.layout.source;o==="size"?Bn(y=>{const g=c?e.measuredBox[y]:e.layoutBox[y],v=Wt(g);g.min=n[y].min,g.max=g.min+v}):uO(o,e.layoutBox,n)&&Bn(y=>{const g=c?e.measuredBox[y]:e.layoutBox[y],v=Wt(n[y]);g.max=g.min+v,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+v)});const u=vo();sl(u,n,e.layoutBox);const d=vo();c?sl(d,t.applyTransform(r,!0),e.measuredBox):sl(d,n,e.layoutBox);const h=!oO(u);let p=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:v}=y;if(g&&v){const S=dt();ol(S,e.layoutBox,g.layoutBox);const w=dt();ol(w,n,v.layoutBox),aO(S,w)||(p=!0),y.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:d,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function MP(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 CP(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function DP(t){t.clearSnapshot()}function Xw(t){t.clearMeasurements()}function Zw(t){t.isLayoutDirty=!1}function NP(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Qw(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $P(t){t.resolveTargetDelta()}function jP(t){t.calcProjection()}function BP(t){t.resetSkewAndRotation()}function LP(t){t.removeLeadSnapshot()}function Ww(t,e,n){t.translate=it(e.translate,0,n),t.scale=it(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function e1(t,e,n,r){t.min=it(e.min,n.min,r),t.max=it(e.max,n.max,r)}function VP(t,e,n,r){e1(t.x,e.x,n.x,r),e1(t.y,e.y,n.y,r)}function UP(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const zP={duration:.45,ease:[.4,0,.1,1]},t1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),n1=t1("applewebkit/")&&!t1("chrome/")?Math.round:Un;function i1(t){t.min=n1(t.min),t.max=n1(t.max)}function KP(t){i1(t.x),i1(t.y)}function uO(t,e,n){return t==="position"||t==="preserve-aspect"&&!GK(Yw(e),Yw(n),.2)}function PP(t){return t!==t.root&&t.scroll?.wasRoot}const qP=cO({attachResizeListener:(t,e)=>ml(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),_p={current:void 0},fO=cO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!_p.current){const t=new qP({});t.mount(window),t.setOptions({layoutScroll:!0}),_p.current=t}return _p.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),IP={pan:{Feature:lP},drag:{Feature:aP,ProjectionNode:fO,MeasureLayout:iO}};function r1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,c=r[o];c&&We.postRender(()=>c(e,$l(e)))}class HP extends Br{mount(){const{current:e}=this.node;e&&(this.unmount=gz(e,(n,r)=>(r1(this.node,r,"Start"),o=>r1(this.node,o,"End"))))}unmount(){}}class FP extends Br{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=Cl(ml(this.node.current,"focus",()=>this.onFocus()),ml(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function s1(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 o="onTap"+(n==="End"?"":n),c=r[o];c&&We.postRender(()=>c(e,$l(e)))}class GP extends Br{mount(){const{current:e}=this.node;e&&(this.unmount=xz(e,(n,r)=>(s1(this.node,r,"Start"),(o,{success:c})=>s1(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Lm=new WeakMap,kp=new WeakMap,YP=t=>{const e=Lm.get(t.target);e&&e(t)},JP=t=>{t.forEach(YP)};function XP({root:t,...e}){const n=t||document;kp.has(n)||kp.set(n,{});const r=kp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(JP,{root:t,...e})),r[o]}function ZP(t,e,n){const r=XP(e);return Lm.set(t,n),r.observe(t),()=>{Lm.delete(t),r.unobserve(t)}}const QP={some:0,all:1};class WP extends Br{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:c}=e,u={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:QP[o]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,c&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),v=p?y:g;v&&v(h)};return ZP(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(eq(e,n))&&this.startObserver()}unmount(){}}function eq({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const tq={inView:{Feature:WP},tap:{Feature:GP},focus:{Feature:FP},hover:{Feature:HP}},nq={layout:{ProjectionNode:fO,MeasureLayout:iO}},iq={...KK,...tq,...IP,...nq},rq=iK(iq,yK);function sq(){const t=Yn(Uo),e=Yn(li),n=Yn(Pi),r=xt(Uo),o=xt(li),c=xt(Pi),u=`email-${V.useId()}`,d=`password-${V.useId()}`,h=`one-time-code-${V.useId()}`,[p,y]=V.useState(null),[g,v]=V.useState("email");return Y.jsx("form",{onSubmit:async S=>{S.preventDefault();const w=Ze(oi);try{switch(g){case"email":{const{nextStep:T,userKey:D}=await cn.declareAuthTarget.query({email:r});switch(De(oi,D),T){case"otc_login":case"otc_verify":{v("otc");break}case"password_login":{v("password");break}}break}case"otc":{if(!w){console.error("somehow userKey is null");return}const T=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:w});De(lt,T),mi.once("connect",()=>{ms("/game"),t(""),n("")});break}case"password":{const T=await cn.openSession.mutate({email:r,password:o});De(lt,T),mi.once("connect",()=>{ms("/game"),t(""),e("")});break}}}catch(T){T instanceof Vo&&y(T.message)}},children:Y.jsxs("main",{children:[p?Y.jsx("aside",{children:p}):null,Y.jsxs(rq.label,{htmlFor:u,children:[Y.jsx("span",{children:"Email"}),Y.jsx("input",{id:u,type:"text",value:r,onChange:S=>{t(S.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?Y.jsxs("label",{htmlFor:d,children:[Y.jsx("span",{children:"Password"}),Y.jsx("input",{id:d,type:"password",value:o,onChange:S=>{e(S.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?Y.jsxs("label",{htmlFor:h,children:[Y.jsx("span",{children:"One-time Code"}),Y.jsx("input",{id:h,type:"otc",value:c,onChange:S=>{n(S.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,Y.jsxs("footer",{children:[g==="password"?Y.jsx("button",{type:"button",onClick:async()=>{const S=Ze(oi);if(!S)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:S}),v("otc")},children:"Forgot Password?"}):null,Y.jsx("span",{}),Y.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!c&&g==="otc",children:">>->"})]})]})})}function oq({route:[,t]}){const e=xt(lt),n=xt(Pi),r=Yn(Pi);$p.useState(!1);const[o,c]=$p.useState(null),u=`code-${V.useId()}`;if(_u(()=>{t&&r(t)}),!e)return Y.jsx("p",{children:"You must be logged in to verify your account."});const{verification:d}=e;return _u(()=>{n&&console.log("verifying token",n)}),Y.jsx("form",{onSubmit:async h=>{h.preventDefault();try{const p=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(lt,p),p.action==="resetPassword"?ms("/account"):ms("/game")}catch(p){p instanceof Vo&&c(p.message)}},children:Y.jsxs("main",{children:[Y.jsx("p",{children:"Check your email for a verification code."}),Y.jsxs("label",{htmlFor:u,children:[Y.jsx("span",{children:"Verification code"}),Y.jsx("input",{id:u,type:"text",value:n,onChange:h=>{r(h.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})}function aq(){const t=xt(ME),e=xt(lt),[n,r]=V.useState(!1),{refs:o,floatingStyles:c,context:u}=ZD({open:n,onOpenChange:r,placement:"bottom-end",middleware:[wD(5),AD(),TD()],whileElementsMounted:pD}),d=FD(u),h=JD(u),p=eN(u),{getReferenceProps:y,getFloatingProps:g}=QD([d,h,p]),v=xt(WL);return Y.jsxs("main",{className:P3.class,children:[Y.jsxs("header",{children:[Y.jsxs("main",{children:[Y.jsx(K3,{}),Y.jsx("span",{children:Y.jsx(q3,{input:v})})]}),Y.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&Y.jsx(ID,{context:u,modal:!1,children:Y.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:c,...g(),children:[Y.jsx("span",{children:e.username}),Y.jsx("button",{type:"button",onClick:()=>{ms("/account")},children:"Account"}),Y.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),mi.once("disconnect",()=>{De(lt,null),ms("/")}),mi.disconnect())},children:"Sign out"})]})})]}),Y.jsx("main",{children:typeof t=="number"?Y.jsxs("article",{children:[Y.jsx("h1",{children:t}),Y.jsx("h2",{children:JSON.parse(YA[t])}),Y.jsx(JA,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return Y.jsx(sq,{});case"admin":return Y.jsx(yU,{});case"game":return Y.jsx(TU,{route:t});case"verify":return Y.jsx(oq,{route:t});case"account":return Y.jsx(mU,{})}})()})]})}GM.createRoot(document.getElementById("root")).render(Y.jsx(V.StrictMode,{children:Y.jsx(UM,{socket:mi,children:Y.jsx(aq,{})})}));
110
+ `)+"}");class pA{config;resolvedConfig;name;get[Hi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=Xp(ne.config,n),this.resolvedConfig=Xp(ne.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(rp).length}`,this.name in rp&&Z(`A Scope already named ${this.name} already exists`),rp[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,c]of r){let u=o;if(o[0]==="#"?(u=o.slice(1),u in this.aliases&&Z(lx(u)),this.aliases[u]=c):(u in this.aliases&&Z(lx(o)),this.aliases[u]=c,this.exportedNames.push(u)),!pe(c,"module")&&!pe(c,"generic")&&!df(c)){const d=this.preparseOwnDefinitionFormat(c,{alias:u});this.resolutions[u]=pe(d,"root")?this.bindReference(d):this.createParseContext(d).id}}cx??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[cx.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=ne.intrinsic?He(ne.intrinsic,(o,c)=>o.startsWith("json")?[]:[o,this.bindReference(c)]):{}}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,o)=>new Iu(e,o?new NT(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const c of e)r.includes(c)||r.push(c);const o=r.map(c=>this.node("unit",{unit:c},n));return this.node("union",o,{...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(pu(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:pu(n,e);if(Qt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:d}=vy.implementation.normalize(n,this);if(d.startsWith("$")){const h=this.resolveRoot(d.slice(1));n=h,o=h.kind}}else if(o==="union"&&bs(n,"object")){const d=lj(n);d?.length===1&&(n=d[0],o=pu(n))}if(Qt(n)&&n.kind===o)return n;const u=bf[o].normalize?.(n,this)??n;return Qt(u)?u.kind===o?u:cj(o,u.kind):{...r,$:this,kind:o,def:u,prefix:r.alias??o}}bindReference(e){let n;return Qt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Iu(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Z(bA(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!pe(n,"generic"))return n}maybeResolveSubalias(e){return im(this.aliases,e)??im(this.ambient,e)}get ambient(){return ne.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=Ln[n];if(pe(o,"root"))return this.resolutions[e]=o;if(pe(o,"context")){if(o.phase==="resolving")return this.node("alias",{reference:`$${e}`},{prereduced:!0});if(o.phase==="resolved")return Et(`Unexpected resolved context for was uncached by its scope: ${Pe(o)}`);o.phase="resolving";const c=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Ln[c.id]=c,Ln[o.id]=c,this.resolutions[e]=c}return Et(`Unexpected nodesById entry for ${n}: ${Pe(o)}`)}let r=this.aliases[e]??this.ambient?.[e];return r?(r=this.normalizeRootScopeValue(r),pe(r,"generic")?this.resolutions[e]=this.bindReference(r):pe(r,"module")?(r.root||Z(vA(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??YT(e.prefix);return Ln[n]=Object.assign(e,{[Hi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new po(e,this.resolvedConfig)}import(...e){return new nm(He(this.export(...e),(n,r)=>[`#${n}`,r]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const r of this.exportedNames){const o=this.aliases[r];this._exports[r]=pe(o,"module")?uA(o,this):ux(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=gA(this,this._exports),this._json=yA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=hA(this.references);this.precompilation=r.write(fA,4),dA(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new nm(He(n,(r,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,r={})=>{const o=this.preparseNode(e,n,r);if(Qt(o))return this.bindReference(o);const c=this.createParseContext(o),u=JT(c),d=this.bindReference(u);return Ln[c.id]=d};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(pe(e,"root"))return this.bindReference(e);const r=this.preparseOwnDefinitionFormat(e,n);if(pe(r,"root"))return this.bindReference(r);const o=this.createParseContext(r);Ln[o.id]=o;let c=this.bindReference(this.parseOwnDefinitionFormat(e,o));return c.isCyclic&&(c=e$(c,o.id)),Ln[o.id]=c,c}finalize(e){return ux(e),!e.precompilation&&!this.resolvedConfig.jitless&&uj(e.references),e}}class mA extends pA{parseOwnDefinitionFormat(e,n){return JT(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(pu(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const ux=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},yA=t=>He(t,(e,n)=>[e,pe(n,"root")||pe(n,"generic")?n.json:pe(n,"module")?yA(n):Et(`Unexpected resolution ${Pe(n)}`)]),im=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const r=e.slice(0,n),o=t[r];if(o===void 0)return;if(!pe(o,"module"))return Z(fj(r));const c=e.slice(n+1),u=o[c];if(u===void 0)return im(o,c);if(pe(u,"root")||pe(u,"generic"))return u;if(pe(u,"module"))return u.root??Z(vA(e));Et(`Unexpected resolution for alias '${e}': ${Pe(u)}`)},wy=(t,e)=>new mA(t,e),_l=new mA({}),gA=(t,e)=>{const n={};for(const r in e){const o=e[r];if(pe(o,"module")){const c=gA(t,o),u=He(c,(d,h)=>[`${r}.${d}`,h]);Object.assign(n,u)}else pe(o,"root")||pe(o,"generic")?n[r]=o:Et(`Unexpected scope resolution ${Pe(o)}`)}return n},bA=t=>`'${t}' is unresolvable`,fj=t=>`'${t}' must reference a module to be accessed using dot syntax`,vA=t=>`Reference to submodule '${t}' must specify an alias`;_l.export();const Ge=_l.schema,Ty=_l.node;_l.defineSchema;const Xi=_l.generic,SA="^(?:0|[1-9]\\d*)$",dj=new RegExp(SA);en(dj);const xA=wy({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();ne.intrinsic={...xA};const wA=wy({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:SA}},{prereducedAliases:!0}).export();Object.assign(ne.intrinsic,wA);const hj=wy({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ve={...xA,...wA,...hj,emptyStructure:Ty("structure",{},{prereduced:!0})};ne.intrinsic={...ve};const pj=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],fx=t=>t.toString()!=="Invalid Date",mj=t=>t.slice(2,-1),TA=t=>`'${t}' could not be parsed by the Date constructor`,yj=(t,e)=>gj(t,e),gj=(t,e)=>{const n=new Date(t);if(fx(n))return n;const r=KN(t);if(r!==void 0){const o=new Date(r);if(fx(o))return o}return e?Z(e===!0?TA(t):e):void 0},dx=(t,e)=>{const n=t.scanner.shiftUntil(vj[EA[e]]);if(t.scanner.lookahead==="")return t.error(xj(n,e));if(t.scanner.shift(),e==="/"){try{new RegExp(n)}catch(r){Z(String(r))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(vi(e,AA))t.root=t.ctx.$.node("unit",{unit:n});else{const r=yj(n,TA(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},AA={"'":1,'"':1},bj={"/":1,"'":1,'"':1},EA={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},vj={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},Sj={'"':"double-quote","'":"single-quote","/":"forward slash"},xj=(t,e)=>`${e}${t} requires a closing ${Sj[EA[e]]}`,wj=t=>`Private type references should not include '#'. Use '${t}' instead.`,RA="Optional definitions like 'string?' are only valid as properties in an object or tuple",OA="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Tj={">":!0,">=":!0},Aj={"<":!0,"<=":!0},Fu={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},Ej=t=>`Unmatched )${t===""?"":` before ${t}`}`,_A=t=>`Missing ${t}`,Rj=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,kA=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,Oj=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Fu[e]}, ${n}${Fu[r]})`,_j=(t,e,n)=>MA(t,e,n,[]),MA=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(CA(t,e.names,r.map(c=>c.expression))):r:o.finalizer===","?MA(t,e,n,r):o.error(_A(">"))},CA=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,hx=t=>{const e=t.scanner.shiftUntilNextTerminator();e==="keyof"?t.addPrefix("keyof"):t.root=Mj(t,e)},kj=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(CA(t,e.names,[]));const o=_j(t,e,n);return e(...o)},Mj=(t,e)=>Cj(t,e)??Dj(t,e)??t.error(e===""?t.scanner.lookahead==="#"?wj(t.shiftedByOne().scanner.shiftUntilNextTerminator()):DA(t):bA(e)),Cj=(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(pe(n,"root"))return n;if(n!==void 0)return pe(n,"generic")?kj(e,n,t):Z(`Unexpected resolution ${Pe(n)}`)},Dj=(t,e)=>{const n=PN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=IN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},DA=t=>{const e=t.previousOperator();return e?NA(e,t.scanner.unscanned):Nj(t.scanner.unscanned)},NA=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,Nj=t=>`Expected an expression${t?` before '${t}'`:""}`,$A=t=>t.scanner.lookahead===""?t.error(DA(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(bj)?dx(t,t.scanner.shift()):t.scanner.lookaheadIsIn(hf)?$A(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in AA?dx(t,`${t.scanner.shift()}${t.scanner.shift()}`):hx(t);class Lo extends QN{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Lo.terminatingChars)}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...hf};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(e,n)=>e===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||vi(n.trimStart()[0],Lo.terminatingChars):e==="="?n[0]!=="=":e===","||e==="?"}const $j=(t,e)=>{const n=Bj(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 Vj(t,n)},jj={"<":1,">":1,"=":1},Bj=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,px=(t,e,n,r)=>n.extends(ne.intrinsic.number)?typeof e!="number"?Z(rm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(ne.intrinsic.lengthBoundable)?typeof e!="number"?Z(rm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(ne.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Z(N2(n.expression)),Lj=t=>({rule:pj(t.limit)?mj(t.limit):t.limit,exclusive:t.comparator.length===1}),Vj=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),c=t.scanner.sliceChars(r,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(rm(e,c,"right"));const u=o.unit,d=e.length===1,h=px(e,typeof u=="number"?u:c,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:u}:{rule:u,exclusive:d});if(!t.branches.leftBound)return;if(!vi(e,Aj))return t.error(kA(e));const p=px(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(p[0],Lj(t.branches.leftBound)),t.branches.leftBound=null},rm=(t,e,n)=>`Comparator ${n==="left"?Fu[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,Uj=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(e)},zj=t=>{const e=t.scanner.shiftUntilNextTerminator(),n=qN(e,{errorOnFail:mx(e)});n===0&&t.error(mx(0)),t.root=t.root.constrain("divisor",n)},mx=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,jA=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(Kj):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():Lo.lookaheadIsFinalizing(e,t.scanner.unscanned)?t.finalize(e):vi(e,jj)?$j(t,e):e==="%"?zj(t):e==="#"?Uj(t):e in hf?jA(t):t.error(Ay(e))},Ay=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,Kj="Missing expected ']'",Pj=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(qj(n.expression));const r=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",r]},qj=t=>`Default value '${t}' must a literal value`,yx=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const c=e.$.maybeResolveRoot(t.slice(0,-2));if(c)return c.array()}const r=new vf(new Lo(t),e),o=Ij(r);return r.finalizer===">"&&Z(Ay(">")),o},Ij=t=>{t.parseOperand();let e=Ey(t).root;return e?(t.finalizer==="="?e=Pj(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Z(Ay(t.scanner.lookahead)),e):Et(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Ey=t=>{for(;t.finalizer===void 0;)Hj(t);return t},Hj=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class vf{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 Z(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(_A(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Fu[n];if(!vi(r,Tj))return this.error(kA(n));if(this.branches.leftBound)return this.error(Oj(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(Ej(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():Et(`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 Ey(new vf(this.scanner,this.ctx))}parseOperator(){return jA(this)}parseOperand(){return $A(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(Rj(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 Fj="An empty string is not a valid generic parameter name",sm=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&e.length?e:Z(Fj):(t.shiftUntilNonWhitespace(),Gj(t,r,e,n))},gx="extends ",Gj=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(gx))t.jumpForward(gx.length);else return t.lookahead===","&&t.shift(),n.push(e),sm(t,n,r);const o=Ey(new vf(t,r));return n.push([e,o.root]),sm(t,n,r)};class Yj extends Po{$;constructor(e){super((...n)=>new tu(e)(...n),{bind:e}),this.$=e}in(e){return new tu(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new tu(this.$).at(e,n)}case(e,n){return new tu(this.$).case(e,n)}}class tu extends Po{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,c])=>o==="default"?[o,c]:[this.$.parse(o),c]))),this.$=e,this.in=n}at(e,n){return this.key&&Z(Xj),this.branches.length&&Z(Jj),this.key=e,n?this.match(n):this}case(e,n){return this.caseEntry(this.$.parse(e),n)}caseEntry(e,n){const o=(this.key?this.$.parse({[this.key]:e}):e).pipe(n);return this.branches.push(o),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,o]=e[n];if(r==="default")return n!==e.length-1&&Z("default may only be specified as the last key of a switch definition"),this.default(o);if(typeof o!="function")return Z(`Value for case "${r}" must be a function (was ${Xn(o)})`);this.caseEntry(r,o)}return this}default(e){typeof e=="function"&&this.case(ve.unknown,e);const n={branches:this.branches,ordered:!0};(e==="never"||e==="assert")&&(n.meta={onFail:bx});const r=this.$.node("union",n);if(!this.in)return this.$.finalize(r);let o=this.in.pipe(r);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:bx},"self")),this.$.finalize(o)}}const bx=t=>t.throw(),Jj="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",Xj="At most one key matcher may be specified per expression",BA=(t,e)=>{if(Yt(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return qA(t,e)},Zj="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",Qj="Only required keys may specify default values, e.g. { value: 'number = 0' }",Wj=(t,e)=>{let n;const r={},o=Vu(t);for(const[u,d]of o){const h=nB(u);if(h.kind==="spread"){if(!xl(r))return Z(tB);const S=e.$.parseOwnDefinitionFormat(d,e);if(S.equals(ve.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(ve.object))return Z(iB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){d!=="reject"&&d!=="delete"&&d!=="ignore"&&Z(eB(d)),r.undeclared=d;continue}const p=BA(d,e),y=h;if(h.kind==="required"){Yt(p)?sp(r,"optional",p[1]==="="?{key:h.normalized,value:p[0],default:p[2]}:{key:h.normalized,value:p[0]},e):sp(r,"required",{key:h.normalized,value:p},e);continue}if(Yt(p)&&(p[1]==="?"&&Z(Zj),p[1]==="="&&Z(Qj)),h.kind==="optional"){sp(r,"optional",{key:h.normalized,value:p},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),v=tm(g,p,e.$);v.index&&(r.index=Ie(r.index,v.index)),v.required&&(r.required=Ie(r.required,v.required))}const c=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(c)??c})},sp=(t,e,n,r)=>{t[e]=Ie(t[e],r.$.node(e,n))},eB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${Pe(t)})`,tB="Spread operator may only be used as the first key in an object",nB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===Hp?{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]===Hp&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},iB=t=>`Spread operand must resolve to an object literal type (was ${t})`,rB=(t,e)=>pB(t)?zA[t[0]](t,e):dB(t)?UA[t[1]](t,e):null,sB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),op=(t,e)=>{if(t[2]===void 0)return Z(NA(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 o=t[1]==="&"?Gi(n,r,e.$):Qp(n,r,e.$);return o instanceof ae?o.throw():o},oB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),aB=(t,e)=>typeof t[2]!="function"?Z(LA("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),LA=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,lB=(t,e)=>typeof t[2]!="function"?Z(LA(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),cB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configureReferences(t[2],"shallow"),VA=t=>t,uB=VA({"[]":oB,"?":()=>Z(RA)}),fB=VA({"|":op,"&":op,":":lB,"=>":aB,"|>":op,"@":cB,"=":()=>Z(OA)}),UA={...uB,...fB},dB=t=>UA[t[1]]!==void 0,hB=t=>t,zA=hB({keyof:sB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Z(vx(Ip(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Z(vx(Ip(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),pB=t=>zA[t[0]]!==void 0,vx=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,mB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const c=BA(t[r],e),[u,d,h]=Yt(c)?c:[c];if(r++,o){if(!u.extends(ne.intrinsic.Array))return Z(bB(u.expression));n=n.flatMap(p=>u.distribute(y=>gB(ET(p),y)))}else n=n.map(p=>d==="?"?KA(p,u):d==="="?yB(p,u,h):om(p,u))}return e.$.parseSchema(n.map(o=>xl(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},om=(t,e)=>t.defaultables||t.optionals?Z(t.variadic?aA:vB):(t.variadic?t.postfix=Ie(t.postfix,e):t.prefix=Ie(t.prefix,e),t),KA=(t,e)=>t.variadic?Z(PA):(t.optionals=Ie(t.optionals,e),t),yB=(t,e,n)=>t.variadic?Z(PA):t.optionals?Z(SB):(t.defaultables=Ie(t.defaultables,[[e,n]]),t),Sx=(t,e)=>(t.postfix&&Z(xx),t.variadic?t.variadic.equals(e)||Z(xx):t.variadic=e.internal,t),gB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return Sx(t,ne.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)om(t,r);if(n.optionals)for(const r of n.optionals)KA(t,r);if(n.variadic&&Sx(t,n.variadic),n.postfix)for(const r of n.postfix)om(t,r);return t},bB=t=>`Spread element must be an array (was ${t})`,xx="A tuple may have at most one variadic element",vB="A required element may not follow an optional element",PA="An optional element may not follow a variadic element",SB="A defaultable element may not follow an optional element without a default",xB={},qA=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return yx(t,e);const n=xB[e.$.name]??={};return n[t]??=yx(t,e)}return bs(t,"object")?wB(t,e):Z(am(Xn(t)))},wB=(t,e)=>{const n=cy(t);switch(n){case void 0:return pe(t,"root")?t:Wj(t,e);case"Array":return TB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=df(t)?t():t;return pe(r,"root")?r:Z(am("Function"))}default:return Z(am(n??Pe(t)))}},TB=(t,e)=>rB(t,e)??mB(t,e),am=t=>`Type definitions must be strings or objects (was ${t})`;class AB extends Po{constructor(e){const n=Object.assign({errors:Cr,hkt:Si,$:e,raw:e.parse,module:e.constructor.module,scope:e.constructor.scope,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},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 o=r[0].slice(1,-1),c=e.parseGenericParams(o,{});return new Iu(c,r[1],e,e,null)}return e.parse(r)},{bind:e,attach:n})}}const ll=ne;class Sf extends pA{get ambientAttachments(){if(ll.typeAttachments)return this.cacheGetter("ambientAttachments",He(ll.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const r=e.indexOf("<");if(r===-1){if(pe(n,"module")||pe(n,"generic"))return[e,n];const u=this.name==="ark"?e:e==="root"?this.name:`${this.name}.${e}`,d=this.resolvedConfig.keywords?.[u];return d&&(n=[n,"@",d]),[e,n]}e.at(-1)!==">"&&Z("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),c=e.slice(r+1,-1);return[o,()=>{const u=this.parseGenericParams(c,{alias:o});return v2(u,n,this)}]}parseGenericParams(e,n){return sm(new Lo(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return df(e)&&!pe(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 o=qA(e,n);if(Yt(o)){if(o[1]==="=")return Z(OA);if(o[1]==="?")return Z(RA)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(pN(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);match=new Yj(this);declare=()=>({type:this.type});define(e){return e}type=new AB(this);static scope=(e,n={})=>new Sf(e,n);static module=(e,n={})=>this.scope(e,n).export()}const EB=Object.assign(Sf.scope,{define:t=>t}),je=Sf;class RB extends Si{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const OB=Xi(["base",ve.object],["props",ve.object])(t=>t.base.merge(t.props),RB),_B=je.module({Key:ve.key,Merge:OB});class kB extends Si{}const MB=Xi("element")(t=>{const e=t.element.exclude(ve.Array),n=e.array();return e.rawOr(n).pipe(Sl).distribute(r=>r.assertHasKind("morph").declareOut(n),Ge)},kB),CB=je.module({root:ve.Array,readonly:"root",index:ve.nonNegativeIntegerString,liftFrom:MB},{name:"Array"}),lm=Ge(["string",wl.FileConstructor]),DB=lm.rawOr(lm.array()),wx=Ge({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:DB}}),NB=je.module({root:["instanceof",FormData],value:lm,parsed:wx,parse:Ge({in:FormData,morphs:t=>{const e={};for(const[n,r]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof wl.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:wx})},{name:"FormData"}),$B=je.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"}),jB={Boolean:1,Number:1,String:1},BB=je.module({...He({...uT,...dT},(t,e)=>t in jB?[]:[t,["instanceof",e]]),Array:CB,TypedArray:$B,FormData:NB}),LB=Ge({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"}),VB=Ge({domain:"number",divisor:1}),IA=je.module({root:ve.number,integer:VB,epoch:LB,safe:Ge({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"}),Ye=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),Ty("intersection",r)},Tx=Ye(Uu,"a well-formed integer string"),HA=je.module({root:Tx,parse:Ge({in:Tx,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:ve.integer})},{name:"string.integer"}),UB=Ye(/^[\dA-Fa-f]+$/,"hex characters only"),zB=je.module({root:Ye(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Ye(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Ax=Ye(/^[A-Z].*$/,"capitalized"),KB=je.module({root:Ge({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:Ax}),preformatted:Ax},{name:"string.capitalize"}),PB=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,r,o,c=!1;for(let u=e.length-1;u>=0;u--)r=e.substring(u,u+1),o=Number.parseInt(r,10),c?(o*=2,n+=o>=10?o%10+1:o):n+=o,c=!c;return!!(n%10===0&&e)},qB=/^(?: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}))$/,IB=Ge({domain:"string",pattern:{meta:"a credit card number",rule:qB.source},predicate:{meta:"a credit card number",predicate:PB}}),HB=/^([+-]?\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)?)?)?)?$/,FB=t=>!Number.isNaN(new Date(t).valueOf()),Ex=Ge({domain:"string",predicate:{meta:"a parsable date",predicate:FB}}).assertHasKind("intersection"),Rx=HA.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=IA.epoch(n);return r instanceof Cr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),GB=je.module({root:Rx,parse:Ge({in:Rx,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.epoch"}),Ox=Ye(HB,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),YB=je.module({root:Ox,parse:Ge({in:Ox,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.iso"}),JB=je.module({root:Ex,parse:Ge({declaredIn:Ex,in:"string",morphs:(t,e)=>{const n=new Date(t);return Number.isNaN(n.valueOf())?e.error("a parsable date"):n},declaredOut:ve.Date}),iso:YB,epoch:GB},{name:"string.date"}),XB=Ye(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),_x="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",wr=`(${_x}[.]){3}${_x}`,ZB=new RegExp(`^${wr}$`),vt="(?:[0-9a-fA-F]{1,4})",QB=new RegExp(`^((?:${vt}:){7}(?:${vt}|:)|(?:${vt}:){6}(?:${wr}|:${vt}|:)|(?:${vt}:){5}(?::${wr}|(:${vt}){1,2}|:)|(?:${vt}:){4}(?:(:${vt}){0,1}:${wr}|(:${vt}){1,3}|:)|(?:${vt}:){3}(?:(:${vt}){0,2}:${wr}|(:${vt}){1,4}|:)|(?:${vt}:){2}(?:(:${vt}){0,3}:${wr}|(:${vt}){1,5}|:)|(?:${vt}:){1}(?:(:${vt}){0,4}:${wr}|(:${vt}){1,6}|:)|(?::((?::${vt}){0,5}:${wr}|(?::${vt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),WB=je.module({root:["v4 | v6","@","an IP address"],v4:Ye(ZB,"an IPv4 address","ipv4"),v6:Ye(QB,"an IPv6 address","ipv6")},{name:"string.ip"}),Ao="a JSON string",FA=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Ao} (${t})`},e3=Ge({meta:Ao,domain:"string",predicate:{meta:Ao,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Ao,problem:FA(n)})}}}}),t3=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Ao,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Ao,problem:FA(n)})}},n3=je.module({root:e3,parse:Ge({meta:"safe JSON string parser",in:"string",morphs:t3,declaredOut:ve.jsonObject})},{name:"string.json"}),kx=Ye(/^[a-z]*$/,"only lowercase letters"),i3=je.module({root:Ge({in:"string",morphs:t=>t.toLowerCase(),declaredOut:kx}),preformatted:kx},{name:"string.lower"}),GA=["NFC","NFD","NFKC","NFKD"],kl=He(GA,(t,e)=>[e,Ge({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),xf=He(GA,(t,e)=>[e,Ge({in:"string",morphs:n=>n.normalize(e),declaredOut:kl[e]})]),r3=je.module({root:xf.NFC,preformatted:kl.NFC},{name:"string.normalize.NFC"}),s3=je.module({root:xf.NFD,preformatted:kl.NFD},{name:"string.normalize.NFD"}),o3=je.module({root:xf.NFKC,preformatted:kl.NFKC},{name:"string.normalize.NFKC"}),a3=je.module({root:xf.NFKD,preformatted:kl.NFKD},{name:"string.normalize.NFKD"}),l3=je.module({root:"NFC",NFC:r3,NFD:s3,NFKC:o3,NFKD:a3},{name:"string.normalize"}),Mx=Ye(Fp,"a well-formed numeric string"),c3=je.module({root:Mx,parse:Ge({in:Mx,morphs:t=>Number.parseFloat(t),declaredOut:ve.number})},{name:"string.numeric"}),Cx="a regex pattern",u3=Ge({domain:"string",predicate:{meta:Cx,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:Cx,problem:String(n)})}}},meta:{format:"regex"}}),f3=/^(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-]+)*))?$/,d3=Ye(f3,"a semantic version (see https://semver.org/)"),Dx=Ye(/^\S.*\S$|^\S?$/,"trimmed"),h3=je.module({root:Ge({in:"string",morphs:t=>t.trim(),declaredOut:Dx}),preformatted:Dx},{name:"string.trim"}),Nx=Ye(/^[A-Z]*$/,"only uppercase letters"),p3=je.module({root:Ge({in:"string",morphs:t=>t.toUpperCase(),declaredOut:Nx}),preformatted:Nx},{name:"string.upper"}),m3=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},$x=Ge({domain:"string",predicate:{meta:"a URL string",predicate:m3},meta:{format:"uri"}}),y3=je.module({root:$x,parse:Ge({declaredIn:$x,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ge(URL)})},{name:"string.url"}),g3=je.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:Ye(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Ye(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Ye(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Ye(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Ye(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Ye(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Ye(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Ye(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),b3=je.module({root:ve.string,alpha:Ye(/^[A-Za-z]*$/,"only letters"),alphanumeric:Ye(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:UB,base64:zB,capitalize:KB,creditCard:IB,date:JB,digits:Ye(/^\d*$/,"only digits 0-9"),email:XB,integer:HA,ip:WB,json:n3,lower:i3,normalize:l3,numeric:c3,regex:u3,semver:d3,trim:h3,upper:p3,url:y3,uuid:g3},{name:"string"}),v3=je.module({bigint:ve.bigint,boolean:ve.boolean,false:ve.false,never:ve.never,null:ve.null,number:ve.number,object:ve.object,string:ve.string,symbol:ve.symbol,true:ve.true,unknown:ve.unknown,undefined:ve.undefined}),S3=je.module({root:ve.unknown,any:ve.unknown},{name:"unknown"}),x3=je.module({root:ve.jsonObject,stringify:Ty("morph",{in:ve.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ve.string})},{name:"object.json"}),w3=je.module({root:ve.object,json:x3},{name:"object"});class T3 extends Si{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const A3=Xi(["K",ve.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),T3);class E3 extends Si{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const R3=Xi(["T",ve.object],["K",ve.key])(t=>t.T.pick(t.K),E3);class O3 extends Si{description='omit a set of properties from an object like `Omit(User, "age")`'}const _3=Xi(["T",ve.object],["K",ve.key])(t=>t.T.omit(t.K),O3);class k3 extends Si{description="make all named properties of an object optional like `Partial(User)`"}const M3=Xi(["T",ve.object])(t=>t.T.partial(),k3);class C3 extends Si{description="make all named properties of an object required like `Required(User)`"}const D3=Xi(["T",ve.object])(t=>t.T.required(),C3);class N3 extends Si{description='exclude branches of a union like `Exclude("boolean", "true")`'}const $3=Xi("T","U")(t=>t.T.exclude(t.U),N3);class j3 extends Si{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const B3=Xi("T","U")(t=>t.T.extract(t.U),j3),L3=je.module({Exclude:$3,Extract:B3,Omit:_3,Partial:M3,Pick:R3,Record:A3,Required:D3}),vs=EB({...v3,...L3,...BB,..._B,string:b3,number:IA,object:w3,unknown:S3},{prereducedAliases:!0,name:"ark"}),jt=vs.export();Object.assign(ll.ambient,jt);ll.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 wt=Object.assign(vs.type,ll.typeAttachments);vs.match;vs.generic;vs.schema;vs.define;vs.declare;const YA={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 V3(t){return Number.parseInt(t,10)}const U3=wt(YA),z3=U3.keyof().pipe(t=>V3(t));wt([z3,"string"]);function K3(t){return Y.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[Y.jsx("title",{children:"Tempest Games Logo"}),Y.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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}}),Y.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 JA(t){return Y.jsx("a",{...t})}const P3={class:"_class_1riwg_1"},ap=["⠋","⠙","⠸","⠴","⠦","⠇"];function q3({input:t}){const e=V.useRef(null),[n,r]=V.useState(typeof t=="string"?t:null);return V.useEffect(()=>{let o=!0,c;if(typeof t=="string")r(t);else{let u=0;c=setInterval(()=>{e.current&&(e.current.textContent=ap[u],u=(u+1)%ap.length)},100),t.then(d=>{o&&(clearInterval(c),r(d))})}return()=>{o=!1,c&&clearInterval(c)}},[t]),Y.jsx("span",{ref:e,children:n??ap[0]})}var I3=Object.create,XA=Object.defineProperty,H3=Object.getOwnPropertyDescriptor,ZA=Object.getOwnPropertyNames,F3=Object.getPrototypeOf,G3=Object.prototype.hasOwnProperty,xi=(t,e)=>function(){return e||(0,t[ZA(t)[0]])((e={exports:{}}).exports,e),e.exports},Y3=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=ZA(e),c=0,u=o.length,d;c<u;c++)d=o[c],!G3.call(t,d)&&d!==n&&XA(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=H3(e,d))||r.enumerable});return t},yt=(t,e,n)=>(n=t!=null?I3(F3(t)):{},Y3(XA(n,"default",{value:t,enumerable:!0}),t)),QA=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(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),J3=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=QA().default;function r(o,c){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,c||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),X3=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=QA().default,r=J3();function o(c){var u=r(c,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ss=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=X3();function r(o,c,u){return(c=n(c))in o?Object.defineProperty(o,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[c]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Zn=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=Ss();function r(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(c,p).enumerable})),d.push.apply(d,h)}return d}function o(c){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?r(Object(d),!0).forEach(function(h){n(c,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(c,h,Object.getOwnPropertyDescriptor(d,h))})}return c}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function wf(t){const e={subscribe(n){let r=null,o=!1,c=!1,u=!1;function d(){if(r===null){u=!0;return}c||(c=!0,typeof r=="function"?r():r&&r.unsubscribe())}return r=t({next(h){var p;o||(p=n.next)===null||p===void 0||p.call(n,h)},error(h){var p;o||(o=!0,(p=n.error)===null||p===void 0||p.call(n,h),d())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),d())}}),u&&d(),{unsubscribe:d}},pipe(...n){return n.reduce(Z3,e)}};return e}function Z3(t,e){return e(t)}function Q3(t){const e=new AbortController;return new Promise((r,o)=>{let c=!1;function u(){c||(c=!0,d.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const d=t.subscribe({next(h){c=!0,r(h),u()},error(h){o(h)},complete(){e.abort(),u()}})})}function W3(t){return e=>{let n=0,r=null;const o=[];function c(){r||(r=e.subscribe({next(d){for(const p of o){var h;(h=p.next)===null||h===void 0||h.call(p,d)}},error(d){for(const p of o){var h;(h=p.error)===null||h===void 0||h.call(p,d)}},complete(){for(const h of o){var d;(d=h.complete)===null||d===void 0||d.call(h)}}}))}function u(){if(n===0&&r){const d=r;r=null,d.unsubscribe()}}return wf(d=>(n++,o.push(d),c(),{unsubscribe(){n--,u();const h=o.findIndex(p=>p===d);h>-1&&o.splice(h,1)}}))}}function eL(t){let e=t;const n=[],r=u=>{e!==void 0&&u.next(e),n.push(u)},o=u=>{n.splice(n.indexOf(u),1)},c=wf(u=>(r(u),()=>{o(u)}));return c.next=u=>{if(e!==u){e=u;for(const d of n)d.next(u)}},c.get=()=>e,c}function tL(t){return wf(e=>{function n(o=0,c=t.op){const u=t.links[o];if(!u)throw new Error("No more links to execute - did you forget to add an ending link?");return u({op:c,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function cl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var nL=Object.create,WA=Object.defineProperty,iL=Object.getOwnPropertyDescriptor,eE=Object.getOwnPropertyNames,rL=Object.getPrototypeOf,sL=Object.prototype.hasOwnProperty,Ml=(t,e)=>function(){return e||(0,t[eE(t)[0]])((e={exports:{}}).exports,e),e.exports},oL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=eE(e),c=0,u=o.length,d;c<u;c++)d=o[c],!sL.call(t,d)&&d!==n&&WA(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(r=iL(e,d))||r.enumerable});return t},Tf=(t,e,n)=>(n=t!=null?nL(rL(t)):{},oL(WA(n,"default",{value:t,enumerable:!0}),t));const tE=()=>{},jx=t=>{Object.freeze&&Object.freeze(t)};function nE(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(tE,{get(c,u){if(!(typeof u!="string"||u==="then"))return nE(t,[...e,u],n)},apply(c,u,d){const h=e[e.length-1];let p={args:d,path:e};return h==="call"?p={args:d.length>=2?[d[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(p={args:d.length>=2?d[1]:[],path:e.slice(0,-1)}),jx(p.args),jx(p.path),t(p)}})),n[o]}const aL=t=>nE(t,[],Object.create(null)),lL=t=>new Proxy(tE,{get(e,n){if(n!=="then")return t(n)}});var iE=Ml({"../../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(o){return typeof o}:function(o){return o&&typeof Symbol=="function"&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},e.exports.__esModule=!0,e.exports.default=e.exports,n(r)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),cL=Ml({"../../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(o,c){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,c||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),uL=Ml({"../../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=cL();function o(c){var u=r(c,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),rE=Ml({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=uL();function r(o,c,u){return(c=n(c))in o?Object.defineProperty(o,c,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[c]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ry=Ml({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=rE();function r(c,u){var d=Object.keys(c);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(c);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(c,p).enumerable})),d.push.apply(d,h)}return d}function o(c){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?r(Object(d),!0).forEach(function(h){n(c,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(d)):r(Object(d)).forEach(function(h){Object.defineProperty(c,h,Object.getOwnPropertyDescriptor(d,h))})}return c}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Tf(Ry());Tf(rE());var nu=Tf(Ry());function fL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,nu.default)((0,nu.default)({},t),{},{error:r})}}return{ok:!0,result:(0,nu.default)((0,nu.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var lp=class extends Error{constructor(){super("Unable to transform response from server")}};function dL(t,e){let n;try{n=fL(t,e)}catch{throw new lp}if(!n.ok&&(!cl(n.error.error)||typeof n.error.error.code!="number"))throw new lp;if(n.ok&&!cl(n.result))throw new lp;return n}Tf(Ry());var iu=yt(Ss()),co=yt(Zn());function hL(t){return t instanceof Vo}function pL(t){return cl(t)&&cl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function mL(t,e){return typeof t=="string"?t:cl(t)&&typeof t.message=="string"?t.message:e}var Vo=class mu extends Error{constructor(e,n){var r,o;const c=n?.cause;super(e,{cause:c}),(0,iu.default)(this,"cause",void 0),(0,iu.default)(this,"shape",void 0),(0,iu.default)(this,"data",void 0),(0,iu.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=c,this.shape=n==null||(r=n.result)===null||r===void 0?void 0:r.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,mu.prototype)}static from(e,n={}){const r=e;return hL(r)?(n.meta&&(r.meta=(0,co.default)((0,co.default)({},r.meta),n.meta)),r):pL(r)?new mu(r.error.message,(0,co.default)((0,co.default)({},n),{},{result:r})):new mu(mL(r,"Unknown error"),(0,co.default)((0,co.default)({},n),{},{cause:r}))}};function yL(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 Bx=t=>typeof t=="function";function gL(t){if(t)return t;if(typeof window<"u"&&Bx(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Bx(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var tl=yt(Zn());function bL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:yL(t.transformer),methodOverride:t.methodOverride}}function vL(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const SL={query:"GET",mutation:"POST",subscription:"PATCH"};function sE(t){return"input"in t?t.transformer.input.serialize(t.input):vL(t.inputs.map(e=>t.transformer.input.serialize(e)))}const oE=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const c=sE(t);c!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(c))}`)}return o.length&&(r+="?"+o.join("&")),r},xL=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=sE(t);return e!==void 0?JSON.stringify(e):void 0},wL=t=>RL((0,tl.default)((0,tl.default)({},t),{},{contentTypeHeader:"application/json",getUrl:oE,getBody:xL}));var TL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const AL=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 TL};async function EL(t){var e;AL(t.signal);const n=t.getUrl(t),r=t.getBody(t),{type:o}=t,c=await(async()=>{const d=await t.headers();return Symbol.iterator in d?Object.fromEntries(d):d})(),u=(0,tl.default)((0,tl.default)((0,tl.default)({},t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),c);return gL(t.fetch)(n,{method:(e=t.methodOverride)!==null&&e!==void 0?e:SL[o],signal:t.signal,body:r,headers:u})}async function RL(t){const e={},n=await EL(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}yt(Zn());const Lx=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Vx(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(d){const h=[[]];let p=0;for(;;){const v=d[p];if(!v)break;const S=h[h.length-1];if(v.aborted){var y;(y=v.reject)===null||y===void 0||y.call(v,new Error("Aborted")),p++;continue}if(t.validate(S.concat(v).map(T=>T.key))){S.push(v),p++;continue}if(S.length===0){var g;(g=v.reject)===null||g===void 0||g.call(v,new Error("Input is too big for a single dispatch")),p++;continue}h.push([])}return h}function c(){const d=o(e);r();for(const h of d){if(!h.length)continue;const p={items:h};for(const g of h)g.batch=p;t.fetch(p.items.map(g=>g.key)).then(async g=>{await Promise.all(g.map(async(S,w)=>{const T=p.items[w];try{var D;const _=await Promise.resolve(S);(D=T.resolve)===null||D===void 0||D.call(T,_)}catch(_){var $;($=T.reject)===null||$===void 0||$.call(T,_)}T.batch=null,T.reject=null,T.resolve=null}));for(const S of p.items){var v;(v=S.reject)===null||v===void 0||v.call(S,new Error("Missing result")),S.batch=null}}).catch(g=>{for(const S of p.items){var v;(v=S.reject)===null||v===void 0||v.call(S,g),S.batch=null}})}}function u(d){var h;const p={aborted:!1,key:d,batch:null,resolve:Lx,reject:Lx},y=new Promise((g,v)=>{var S;p.reject=v,p.resolve=g,(S=e)!==null&&S!==void 0||(e=[]),e.push(p)});return(h=n)!==null&&h!==void 0||(n=setTimeout(c)),y}return{load:u}}function OL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const c of t)c?.aborted?o():c?.addEventListener("abort",o,{once:!0});return e.signal}var ru=yt(Zn());function _L(t){var e,n;const r=bL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,c=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const u=y=>({validate(g){if(o===1/0&&c===1/0)return!0;if(g.length>c)return!1;const v=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return oE((0,ru.default)((0,ru.default)({},r),{},{type:y,path:v,inputs:S,signal:null})).length<=o},async fetch(g){const v=g.map(_=>_.path).join(","),S=g.map(_=>_.input),w=OL(...g.map(_=>_.signal)),T=await wL((0,ru.default)((0,ru.default)({},r),{},{path:v,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:w}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(_=>({meta:T.meta,json:_}))}}),d=Vx(u("query")),h=Vx(u("mutation")),p={query:d,mutation:h};return({op:y})=>wf(g=>{/* istanbul ignore if -- @preserve */if(y.type==="subscription")throw new Error("Subscriptions are unsupported by `httpLink` - use `httpSubscriptionLink` or `wsLink`");const S=p[y.type].load(y);let w;return S.then(T=>{w=T;const D=dL(T.json,r.transformer.output);if(!D.ok){g.error(Vo.from(D.error,{meta:T.meta}));return}g.next({context:T.meta,result:D.result}),g.complete()}).catch(T=>{g.error(Vo.from(T,{meta:w?.meta}))}),()=>{}})}}yt(Zn());const aE=(t,...e)=>typeof t=="function"?t(...e):t;yt(Ss());function kL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function ML(t){const e=await aE(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function CL(t){const e={method:"connectionParams",data:await aE(t)};return JSON.stringify(e)}yt(Ss());var is=yt(Ss());function DL(t){const{promise:e,resolve:n,reject:r}=kL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function NL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function c(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function u(){clearTimeout(r),c()}function d(){clearTimeout(o),u()}t.addEventListener("open",c),t.addEventListener("message",({data:h})=>{clearTimeout(r),c(),h==="PONG"&&d()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var $L=class cm{constructor(e){var n;if((0,is.default)(this,"id",++cm.connectCount),(0,is.default)(this,"WebSocketPonyfill",void 0),(0,is.default)(this,"urlOptions",void 0),(0,is.default)(this,"keepAliveOpts",void 0),(0,is.default)(this,"wsObservable",eL(null)),(0,is.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=++cm.connectCount;const n=ML(e.urlOptions).then(r=>new e.WebSocketPonyfill(r));e.openPromise=n.then(async r=>{e.ws=r,r.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&NL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await DL(r),e.urlOptions.connectionParams&&r.send(await CL(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,is.default)($L,"connectCount",0);yt(Ss());yt(Zn());var cp=yt(Ss()),Ux=yt(Zn()),jL=class{constructor(t){(0,cp.default)(this,"links",void 0),(0,cp.default)(this,"runtime",void 0),(0,cp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return tL({links:this.links,op:(0,Ux.default)((0,Ux.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(W3())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await Q3(n)).result.data}catch(n){throw Vo.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(o){switch(o.result.type){case"state":{var c;(c=n.onConnectionStateChange)===null||c===void 0||c.call(n,o.result);break}case"started":{var u;(u=n.onStarted)===null||u===void 0||u.call(n,{context:o.context});break}case"stopped":{var d;(d=n.onStopped)===null||d===void 0||d.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var c;(c=n.onError)===null||c===void 0||c.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const BL=Symbol.for("trpc_untypedClient"),LL={query:"query",mutate:"mutation",subscribe:"subscription"},VL=t=>LL[t];function UL(t){const e=aL(({path:n,args:r})=>{const o=[...n],c=VL(o.pop()),u=o.join(".");return t[c](u,...r)});return lL(n=>n===BL?t:e[n])}function zL(t){const e=new jL(t);return UL(e)}yt(Zn());yt(Zn());var KL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var c,u,d,h=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,d=Symbol.iterator);h--;){if(u&&(c=o[u])!=null)return c.call(o);if(d&&(c=o[d])!=null)return new r(c.call(o));u="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function c(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var d=u.done;return Promise.resolve(u.value).then(function(h){return{value:h,done:d}})}return r=function(d){this.s=d,this.n=d.next},r.prototype={s:null,n:null,next:function(){return c(this.n.apply(this.s,arguments))},return:function(d){var h=this.s.return;return h===void 0?Promise.resolve({value:d,done:!0}):c(h.apply(this.s,arguments))},throw:function(d){var h=this.s.return;return h===void 0?Promise.reject(d):c(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});yt(KL());yt(Zn());var PL=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(d,h){var p=Error();return p.name="SuppressedError",p.error=d,p.suppressed=h,p},o={},c=[];function u(d,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(d)var p=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(p===void 0&&(p=h[Symbol.dispose||Symbol.for("Symbol.dispose")],d))var y=p;if(typeof p!="function")throw new TypeError("Object is not disposable.");y&&(p=function(){try{y.call(h)}catch(v){return Promise.reject(v)}}),c.push({v:h,d:p,a:d})}else d&&c.push({d:h,a:d});return h}return{e:o,u:u.bind(null,!1),a:u.bind(null,!0),d:function(){var h,p=this.e,y=0;function g(){for(;h=c.pop();)try{if(!h.a&&y===1)return y=0,c.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,v)}else y|=1}catch(w){return v(w)}if(y===1)return p!==o?Promise.reject(p):Promise.resolve();if(p!==o)throw p}function v(S){return p=p!==o?new r(S,p):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),lE=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(r,o){this.v=r,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),qL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=lE();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),IL=xi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=lE();function r(c){return function(){return new o(c.apply(this,arguments))}}function o(c){var u,d;function h(y,g){try{var v=c[y](g),S=v.value,w=S instanceof n;Promise.resolve(w?S.v:S).then(function(T){if(w){var D=y==="return"?"return":"next";if(!S.k||T.done)return h(D,T);T=c[D](T).value}p(v.done?"return":"normal",T)},function(T){h("throw",T)})}catch(T){p("throw",T)}}function p(y,g){switch(y){case"return":u.resolve({value:g,done:!0});break;case"throw":u.reject(g);break;default:u.resolve({value:g,done:!1})}(u=u.next)?h(u.key,u.arg):d=null}this._invoke=function(y,g){return new Promise(function(v,S){var w={key:y,arg:g,resolve:v,reject:S,next:null};d?d=d.next=w:(u=d=w,h(y,g))})},typeof c.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(c){return this._invoke("next",c)},o.prototype.throw=function(c){return this._invoke("throw",c)},o.prototype.return=function(c){return this._invoke("return",c)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});yt(PL());yt(qL());yt(IL());yt(Zn());var HL={};function cE(t,e){if(t instanceof Promise)throw new Error(e)}function FL(t,e){const n={},r=[];for(const o in t){const c=t[o]["~standard"].validate(e[o]);if(cE(c,`Validation must be synchronous, but ${o} returned a Promise.`),c.issues){r.push(...c.issues.map(u=>({...u,message:u.message,path:[o,...u.path??[]]})));continue}n[o]=c.value}return r.length?{issues:r}:{value:n}}function GL(t){const e=t.runtimeEnvStrict??t.runtimeEnv??HL;if(t.emptyStringAsUndefined??!1)for(const[_,k]of Object.entries(e))k===""&&delete e[_];if(!!t.skipValidation)return e;const o=typeof t.client=="object"?t.client:{},c=typeof t.server=="object"?t.server:{},u=typeof t.shared=="object"?t.shared:{},d=t.isServer??(typeof window>"u"||"Deno"in window),h=d?{...c,...u,...o}:{...o,...u},p=t.createFinalSchema?.(h,d)["~standard"].validate(e)??FL(h,e);cE(p,"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(p.issues)return y(p.issues);const v=_=>t.clientPrefix?!_.startsWith(t.clientPrefix)&&!(_ in u):!0,S=_=>d||!v(_),w=_=>_==="__esModule"||_==="$$typeof",T=(t.extends??[]).reduce((_,k)=>Object.assign(_,k),{}),D=Object.assign(T,p.value);return new Proxy(D,{get(_,k){if(typeof k=="string"&&!w(k))return S(k)?Reflect.get(_,k):g(k)}})}const YL={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},JL="__vite_start_time"in globalThis,XL=typeof window<"u",Vi=wt("string"),zx=wt('"true" | "false" | undefined'),uE=GL({isServer:!JL&&!XL,server:{CI:wt("string | undefined").pipe(Boolean),POSTGRES_USER:Vi,POSTGRES_PASSWORD:Vi,POSTGRES_DATABASE:Vi,POSTGRES_HOST:Vi,POSTGRES_PORT:Vi.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:Vi.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:zx.pipe(t=>t==="true"),FRONTEND_PORT:Vi.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:Vi.pipe.try(t=>JSON.parse(t),wt("string[]")),API_KEY_OPENAI:wt("string | undefined"),API_KEY_RESEND:wt("string | undefined")},clientPrefix:"VITE_",client:{VITE_BACKEND_ORIGIN:Vi,VITE_DEV_FRONTEND_HOST:wt("string | undefined"),VITE_DEV_HTTPS:zx.pipe(t=>t==="true")},runtimeEnv:YL,emptyStringAsUndefined:!0}),cn=zL({links:[_L({url:uE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),ZL=Object.freeze(Object.defineProperty({__proto__:null,trpcClient:cn},Symbol.toStringTag,{value:"Module"})),QL=et({key:"appVersionQuery",default:cn.version.query});et({key:"lastKnownVersion",default:null,effects:[M1(localStorage,JSON,"lastKnownVersion")]});const WL=yi({key:"appVersion",get:async({get:t})=>{const e=t(QL);return e instanceof Promise?e.then(n=>n.version):e.version}});function up(t){return["optional",t]}function eV(t,e){let n=[t];for(const r of e){if(typeof r!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const c=[],u=o[1],d=u[r];d!==void 0&&c.push(d);const h=Object.keys(u).find(p=>p.startsWith("$"));if(h){const p=u[h];p&&c.push(p)}return c})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const tV="modulepreload",nV=function(t){return"/"+t},Kx={},fE=function(e,n,r){let o=Promise.resolve();if(n&&n.length>0){let p=function(y){return Promise.all(y.map(g=>Promise.resolve(g).then(v=>({status:"fulfilled",value:v}),v=>({status:"rejected",reason:v}))))};var u=p;document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),h=d?.nonce||d?.getAttribute("nonce");o=p(n.map(y=>{if(y=nV(y),y in Kx)return;Kx[y]=!0;const g=y.endsWith(".css"),v=g?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${y}"]${v}`))return;const S=document.createElement("link");if(S.rel=g?"stylesheet":tV,g||(S.as="script"),S.crossOrigin="",S.href=y,h&&S.setAttribute("nonce",h),document.head.appendChild(S),g)return new Promise((w,T)=>{S.addEventListener("load",w),S.addEventListener("error",()=>T(new Error(`Unable to preload CSS for ${y}`)))})}))}function c(d){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=d,window.dispatchEvent(h),!h.defaultPrevented)throw d}return o.then(d=>{for(const h of d||[])h.status==="rejected"&&c(h.reason);return e().catch(c)})},pi=Object.create(null);pi.open="0";pi.close="1";pi.ping="2";pi.pong="3";pi.message="4";pi.upgrade="5";pi.noop="6";const yu=Object.create(null);Object.keys(pi).forEach(t=>{yu[pi[t]]=t});const um={type:"error",data:"parser error"},dE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",hE=typeof ArrayBuffer=="function",pE=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Oy=({type:t,data:e},n,r)=>dE&&e instanceof Blob?n?r(e):Px(e,r):hE&&(e instanceof ArrayBuffer||pE(e))?n?r(e):Px(new Blob([e]),r):r(pi[t]+(e||"")),Px=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function qx(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let fp;function iV(t,e){if(dE&&t.data instanceof Blob)return t.data.arrayBuffer().then(qx).then(e);if(hE&&(t.data instanceof ArrayBuffer||pE(t.data)))return e(qx(t.data));Oy(t,!1,n=>{fp||(fp=new TextEncoder),e(fp.encode(n))})}const Ix="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Qa=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Ix.length;t++)Qa[Ix.charCodeAt(t)]=t;const rV=t=>{let e=t.length*.75,n=t.length,r,o=0,c,u,d,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const p=new ArrayBuffer(e),y=new Uint8Array(p);for(r=0;r<n;r+=4)c=Qa[t.charCodeAt(r)],u=Qa[t.charCodeAt(r+1)],d=Qa[t.charCodeAt(r+2)],h=Qa[t.charCodeAt(r+3)],y[o++]=c<<2|u>>4,y[o++]=(u&15)<<4|d>>2,y[o++]=(d&3)<<6|h&63;return p},sV=typeof ArrayBuffer=="function",_y=(t,e)=>{if(typeof t!="string")return{type:"message",data:mE(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:oV(t.substring(1),e)}:yu[n]?t.length>1?{type:yu[n],data:t.substring(1)}:{type:yu[n]}:um},oV=(t,e)=>{if(sV){const n=rV(t);return mE(n,e)}else return{base64:!0,data:t}},mE=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},yE="",aV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((c,u)=>{Oy(c,!1,d=>{r[u]=d,++o===n&&e(r.join(yE))})})},lV=(t,e)=>{const n=t.split(yE),r=[];for(let o=0;o<n.length;o++){const c=_y(n[o],e);if(r.push(c),c.type==="error")break}return r};function cV(){return new TransformStream({transform(t,e){iV(t,n=>{const r=n.length;let o;if(r<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,r);else if(r<65536){o=new Uint8Array(3);const c=new DataView(o.buffer);c.setUint8(0,126),c.setUint16(1,r)}else{o=new Uint8Array(9);const c=new DataView(o.buffer);c.setUint8(0,127),c.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let dp;function su(t){return t.reduce((e,n)=>e+n.length,0)}function ou(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let o=0;o<e;o++)n[o]=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 uV(t,e){dp||(dp=new TextDecoder);const n=[];let r=0,o=-1,c=!1;return new TransformStream({transform(u,d){for(n.push(u);;){if(r===0){if(su(n)<1)break;const h=ou(n,1);c=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(su(n)<2)break;const h=ou(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(su(n)<8)break;const h=ou(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(um);break}o=y*Math.pow(2,32)+p.getUint32(4),r=3}else{if(su(n)<o)break;const h=ou(n,o);d.enqueue(_y(c?h:dp.decode(h),e)),r=0}if(o===0||o>t){d.enqueue(um);break}}}})}const gE=4;function At(t){if(t)return fV(t)}function fV(t){for(var e in At.prototype)t[e]=At.prototype[e];return t}At.prototype.on=At.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};At.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};At.prototype.off=At.prototype.removeListener=At.prototype.removeAllListeners=At.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,o=0;o<n.length;o++)if(r=n[o],r===e||r.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};At.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,o=n.length;r<o;++r)n[r].apply(this,e)}return this};At.prototype.emitReserved=At.prototype.emit;At.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};At.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Af=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Vn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),dV="arraybuffer";function bE(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const hV=Vn.setTimeout,pV=Vn.clearTimeout;function Ef(t,e){e.useNativeTimers?(t.setTimeoutFn=hV.bind(Vn),t.clearTimeoutFn=pV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const mV=1.33;function yV(t){return typeof t=="string"?gV(t):Math.ceil((t.byteLength||t.size)*mV)}function gV(t){let e=0,n=0;for(let r=0,o=t.length;r<o;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 vE(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function bV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function vV(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let c=n[r].split("=");e[decodeURIComponent(c[0])]=decodeURIComponent(c[1])}return e}class SV extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class ky extends At{constructor(e){super(),this.writable=!1,Ef(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 SV(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=_y(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=bV(e);return n.length?"?"+n:""}}class xV extends ky{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)};lV(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,aV(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]=vE()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let SE=!1;try{SE=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const wV=SE;function TV(){}class AV extends xV{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",(o,c)=>{this.onError("xhr post error",o,c)})}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 Eo=class gu extends At{constructor(e,n,r){super(),this.createRequest=e,Ef(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=bE(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 o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&r.setRequestHeader(o,this._opts.extraHeaders[o])}}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 o;r.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.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(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=gu.requestsCount++,gu.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=TV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete gu.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()}};Eo.requestsCount=0;Eo.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Hx);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,Hx,!1)}}function Hx(){for(let t in Eo.requests)Eo.requests.hasOwnProperty(t)&&Eo.requests[t].abort()}const EV=function(){const t=xE({xdomain:!1});return t&&t.responseType!==null}();class RV extends AV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=EV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Eo(xE,this.uri(),e)}}function xE(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||wV))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const wE=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class OV extends ky{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=wE?{}:bE(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(o){return this.emitReserved("error",o)}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],o=n===e.length-1;Oy(r,this.supportsBinary,c=>{try{this.doWrite(r,c)}catch{}o&&Af(()=>{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]=vE()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const hp=Vn.WebSocket||Vn.MozWebSocket;class _V extends OV{createSocket(e,n,r){return wE?new hp(e,n,r):n?new hp(e,n):new hp(e)}doWrite(e,n){this.ws.send(n)}}class kV extends ky{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=uV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=cV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const c=()=>{r.read().then(({done:d,value:h})=>{d||(this.onPacket(h),c())}).catch(d=>{})};c();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],o=n===e.length-1;this._writer.write(r).then(()=>{o&&Af(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const MV={websocket:_V,webtransport:kV,polling:RV},CV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,DV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fm(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 o=CV.exec(t||""),c={},u=14;for(;u--;)c[DV[u]]=o[u]||"";return n!=-1&&r!=-1&&(c.source=e,c.host=c.host.substring(1,c.host.length-1).replace(/;/g,":"),c.authority=c.authority.replace("[","").replace("]","").replace(/;/g,":"),c.ipv6uri=!0),c.pathNames=NV(c,c.path),c.queryKey=$V(c,c.query),c}function NV(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 $V(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,c){o&&(n[o]=c)}),n}const dm=typeof addEventListener=="function"&&typeof removeEventListener=="function",bu=[];dm&&addEventListener("offline",()=>{bu.forEach(t=>t())},!1);class Mr extends At{constructor(e,n){if(super(),this.binaryType=dV,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=fm(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=fm(n.host).host);Ef(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 o=r.prototype.name;this.transports.push(o),this._transportsByName[o]=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=vV(this.opts.query)),dm&&(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"})},bu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=gE,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&&Mr.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",Mr.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 o=this.writeBuffer[r].data;if(o&&(n+=yV(o)),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,Af(()=>{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,o){if(typeof n=="function"&&(o=n,n=void 0),typeof r=="function"&&(o=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const c={type:e,data:n,options:r};this.emitReserved("packetCreate",c),this.writeBuffer.push(c),o&&this.once("flush",o),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(Mr.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(),dm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=bu.indexOf(this._offlineEventListener);r!==-1&&bu.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}Mr.protocol=gE;class jV extends Mr{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;Mr.priorWebsocketSuccess=!1;const o=()=>{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;Mr.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 v=new Error("probe error");v.transport=n.name,this.emitReserved("upgradeError",v)}}))};function c(){r||(r=!0,y(),n.close(),n=null)}const u=g=>{const v=new Error("probe error: "+g);v.transport=n.name,c(),this.emitReserved("upgradeError",v)};function d(){u("transport closed")}function h(){u("socket closed")}function p(g){n&&g.name!==n.name&&c()}const y=()=>{n.removeListener("open",o),n.removeListener("error",u),n.removeListener("close",d),this.off("close",h),this.off("upgrading",p)};n.once("open",o),n.once("error",u),n.once("close",d),this.once("close",h),this.once("upgrading",p),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 BV=class extends jV{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(o=>MV[o]).filter(o=>!!o)),super(e,r)}};function LV(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=fm(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 c=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+c+":"+r.port+e,r.href=r.protocol+"://"+c+(n&&n.port===r.port?"":":"+r.port),r}const VV=typeof ArrayBuffer=="function",UV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,TE=Object.prototype.toString,zV=typeof Blob=="function"||typeof Blob<"u"&&TE.call(Blob)==="[object BlobConstructor]",KV=typeof File=="function"||typeof File<"u"&&TE.call(File)==="[object FileConstructor]";function My(t){return VV&&(t instanceof ArrayBuffer||UV(t))||zV&&t instanceof Blob||KV&&t instanceof File}function vu(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(vu(t[n]))return!0;return!1}if(My(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return vu(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&vu(t[n]))return!0;return!1}function PV(t){const e=[],n=t.data,r=t;return r.data=hm(n,e),r.attachments=e.length,{packet:r,buffers:e}}function hm(t,e){if(!t)return t;if(My(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]=hm(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]=hm(t[r],e));return n}return t}function qV(t,e){return t.data=pm(t.data,e),delete t.attachments,t}function pm(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]=pm(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=pm(t[n],e));return t}const IV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],HV=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 FV{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&vu(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=PV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Fx(t){return Object.prototype.toString.call(t)==="[object Object]"}class Cy extends At{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 GV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(My(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 c=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const u=e.substring(c,n);if(u!=Number(u)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(u)}if(e.charAt(n+1)==="/"){const c=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(c,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const c=n+1;for(;++n;){const u=e.charAt(n);if(u==null||Number(u)!=u){--n;break}if(n===e.length)break}r.id=Number(e.substring(c,n+1))}if(e.charAt(++n)){const c=this.tryParse(e.substr(n));if(Cy.isPayloadValid(r.type,c))r.data=c;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 Fx(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||Fx(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&IV.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 GV{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=qV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const YV=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Cy,Encoder:FV,get PacketType(){return ke},protocol:HV},Symbol.toStringTag,{value:"Module"}));function Gn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const JV=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class AE extends At{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=[Gn(e,"open",this.onopen.bind(this)),Gn(e,"packet",this.onpacket.bind(this)),Gn(e,"error",this.onerror.bind(this)),Gn(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,o,c;if(JV.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 u={type:ke.EVENT,data:n};if(u.options={},u.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const y=this.ids++,g=n.pop();this._registerAckCallback(y,g),u.id=y}const d=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((c=this.io.engine)===null||c===void 0)&&c._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(u),this.packet(u)):this.sendBuffer.push(u)),this.flags={},this}_registerAckCallback(e,n){var r;const o=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const c=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let d=0;d<this.sendBuffer.length;d++)this.sendBuffer[d].id===e&&this.sendBuffer.splice(d,1);n.call(this,new Error("operation has timed out"))},o),u=(...d)=>{this.io.clearTimeoutFn(c),n.apply(this,d)};u.withError=!0,this.acks[e]=u}emitWithAck(e,...n){return new Promise((r,o)=>{const c=(u,d)=>u?o(u):r(d);c.withError=!0,n.push(c),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((o,...c)=>r!==this._queue[0]?void 0:(o!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...c)),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(...o){r||(r=!0,n.packet({type:ke.ACK,id:e,data:o}))}}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 Ho(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}Ho.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};Ho.prototype.reset=function(){this.attempts=0};Ho.prototype.setMin=function(t){this.ms=t};Ho.prototype.setMax=function(t){this.max=t};Ho.prototype.setJitter=function(t){this.jitter=t};class mm extends At{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,Ef(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 Ho({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const o=n.parser||YV;this.encoder=new o.Encoder,this.decoder=new o.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 BV(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const o=Gn(n,"open",function(){r.onopen(),e&&e()}),c=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),e?e(d):this.maybeReconnectOnOpen()},u=Gn(n,"error",c);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{o(),c(new Error("timeout")),n.close()},d);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(o),this.subs.push(u),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Gn(e,"ping",this.onping.bind(this)),Gn(e,"data",this.ondata.bind(this)),Gn(e,"error",this.onerror.bind(this)),Gn(e,"close",this.onclose.bind(this)),Gn(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){Af(()=>{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 AE(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(o=>{o?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",o)):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 Su(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=LV(t,e.path||"/socket.io"),r=n.source,o=n.id,c=n.path,u=Ya[o]&&c in Ya[o].nsps,d=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let h;return d?h=new mm(r,e):(Ya[o]||(Ya[o]=new mm(r,e)),h=Ya[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(Su,{Manager:mm,Socket:AE,io:Su,connect:Su});const XV=["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"],ZV=3,QV=15,WV=/^[a-zA-Z0-9_-]+$/,eU=wt(WV).pipe(wt(`string > ${ZV} & string < ${QV}`)).brand("username"),Gx=20,Yx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function tU(t){let e="";for(const n of t)n in Yx?e+=Yx[n]:e+=n;return e}function nU(t){const e=t.toLocaleLowerCase(),n=tU(e);for(const r of XV)if(n.includes(r)||e.includes(r))return!0;return!1}function iU(t){const e=new Set(t).size;return t.length*Math.log2(e)}function rU(t){let e=0;return nU(t)&&(e-=100),e+=iU(t)*.5,Math.max(e,0)}const sU=wt("string").narrow((t,e)=>{const n=rU(t);return n>=Gx?!0:e.mustBe(`Of complexity ${Gx} or more. Was ${n.toFixed(2)}.`)}).brand("password");wt({"+":"delete",email:"string",password:"string"});const oU=wt("string").brand("email");wt({"+":"delete",username:"string",password:"string",email:"string"});const aU=wt({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),mi=Su(uE.VITE_BACKEND_ORIGIN,{auth:t=>{const e=Ze(lt);e&&t(e)},withCredentials:!0,autoConnect:!1});mi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(lt,null)}).on("usernameChanged",t=>{De(lt,e=>e===null?null:{...e,username:t})});const lt=et({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=$r(e),r=aU(n);return r instanceof wt.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),mi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(async({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(Ro,n.username),localStorage.setItem("auth",Je(n)),n.verification==="verified"?(console.log("connecting..."),mi.connect()):await fE(async()=>{const{navigate:r}=await Promise.resolve().then(()=>fU);return{navigate:r}},void 0).then(({navigate:r})=>{r("/verify")})):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),Ro=et({key:"username",default:Ze(lt)?.username??""}),pp=et({key:"usernameDebounce",default:!0}),lU=et({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{Pk(Ro,()=>{Ze(pp)&&(t(Ze(Ro)),De(pp,!1),setTimeout(()=>{De(pp,!0),t(Ze(Ro))},2e3))})}]}),cU=yi({key:"isUsernameTakenQuery",get:async({get:t})=>{const e=t(lU);if(!e)return!1;const n=Ze(lt);if(e===n?.username)return!1;const{trpcClient:r}=await fE(async()=>{const{trpcClient:o}=await Promise.resolve().then(()=>ZL);return{trpcClient:o}},void 0);return r.isUsernameTaken.query({username:e})}}),EE=yi({key:"usernameIssues",get:({get:t})=>{const e=t(Ro),n=eU(e);return n instanceof wt.errors?n:null}}),li=et({key:"password0",default:""}),RE=yi({key:"password0Issues",get:({get:t})=>{const e=t(li),n=sU(e);return n instanceof wt.errors?n:null}}),Uo=et({key:"email",default:""}),OE=yi({key:"emailIssues",get:({get:t})=>{const e=t(Uo),n=oU(e);return n instanceof wt.errors?n:null}});yi({key:"signupReady",get:({get:t})=>{const e=t(EE),n=t(RE),r=t(OE);return!(e??n??r)}});const Pi=et({key:"oneTimeCode",default:""}),ym=et({key:"oneTimeCodeNewEmail",default:""}),oi=et({key:"authTarget",default:null}),Dy=up({verify:up({$token:null}),game:up({clicker:null}),account:null,admin:null});function _E(t){return eV(Dy,t)}const kE=[[]];function uU(t){return kE.some(e=>e.join("/")===t.join("/"))}function ms(t){history.pushState(null,"",t),De(Ny,t)}const Ny=et({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},r=o=>{switch(o){case"/":{const c=Ze(lt);switch(console.log("/","auth",c),c?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{Ze(lt)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{Ze(lt)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const c=Ze(lt);if(!c){n("/");break}c.verification==="unverified"&&n("/verify");break}}};r(window.location.pathname),t(({newValue:o})=>{r(o)})},({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)})}]}),ME=yi({key:"route",get:({get:t})=>{const n=t(Ny).split("/").slice(1).filter(Boolean);return _E(n)?uU(n)||t(lt)?n:401:404}}),fU=Object.freeze(Object.defineProperty({__proto__:null,PUBLIC_ROUTES:kE,ROUTES:Dy,isRoute:_E,navigate:ms,pathnameAtom:Ny,routeSelector:ME},Symbol.toStringTag,{value:"Module"})),Jx=et({key:"buttonBlockActive",default:!1}),jn=et({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{Ze(CE)?.focus();break}case"new-password":{Ze(DE)?.focus();break}case"username":{Ze(NE)?.focus();break}}})}]}),CE=et({key:"emailInputElement",default:null}),DE=et({key:"password0InputElement",default:null}),NE=et({key:"usernameInputElement",default:null});function dU(t){const e=V.useRef(null);return V.useEffect(()=>{De(t,e.current)},[t]),e}const hU=yi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(lt);return e?`Code sent to ${e.email}`:""}}),pU=yi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Uo);return e?`Code sent to ${e}`:""}});function mp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:c,onOpen:u,onCancel:d,extraIssues:h}){const p=xt(e),y=Yn(e),g=xt(Pi),v=Yn(Pi),S=xt(ym),w=Yn(ym),T=xt(li),D=Yn(li),$=xt(Jx),_=Yn(Jx),k=xt(jn),C=Yn(jn),O=xt(n),J=xt(hU),G=xt(pU),H=dU(r),ie=k[0]===t,oe=k.at(-1),[fe,...ge]=k;return Y.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),$){_(!1);return}console.log(`submitted! changing ${t} to`,p);const Q=await c(p);Error.isError(Q)&&console.error(Q)},children:[ie?Y.jsx("button",{type:"button",onClick:async()=>{await d?.(),C([])},children:"x"}):null,Y.jsxs("main",{children:[Y.jsxs("label",{htmlFor:t,children:[O||h?Y.jsxs("aside",{children:[h,O?.map(be=>Y.jsx("span",{children:be.message},be.path.join(".")))]}):null,Y.jsx("span",{children:t==="new-password"?"Password":an(t)}),Y.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:H,value:p,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:oe!==t})]}),ie?ge.map(be=>Y.jsxs("label",{htmlFor:`${t}-${be}`,children:[Y.jsx("span",{children:(()=>{switch(be){case"otcLogin":return J;case"otcVerify":return G;case"passwordLogin":return"Password"}})()}),Y.jsx("input",{id:`${t}-otc`,type:"text",ref:H,value:(()=>{switch(be){case"otcLogin":return g;case"otcVerify":return t==="email"?S:g;case"passwordLogin":return T}})(),onChange:Q=>{switch(be){case"otcLogin":v(Q.target.value);break;case"otcVerify":if(t==="email"){w(Q.target.value);break}v(Q.target.value);break;case"passwordLogin":D(Q.target.value)}},autoComplete:t.includes("otc")?"one-time-code":t.includes("password")?"password":"",autoCapitalize:"none",disabled:be!==oe})]},`${t}-${be}`)):null]}),k[0]===t?Y.jsx("button",{type:"submit",children:"->"}):Y.jsx("button",{type:"button",onMouseDown:async()=>{_(!0),await u?.(),C(o)},onMouseUp:()=>{_(!1)},children:"/"})]})}function mU(){const t=xt(lt),e=xt(cU);return _u(()=>{t&&De(Uo,t.email),t?.password&&De(li,"••••••••••••")}),t?Y.jsxs("article",{"data-css":"editor",children:[Y.jsx(mp,{label:"username",inputToken:Ro,issuesToken:EE,inputElementToken:NE,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{mi.once("usernameChanged",r),mi.emit("changeUsername",n)}),De(jn,[]),n),extraIssues:e?Y.jsx("span",{children:"This username is taken."}):null}),Y.jsx(mp,{label:"email",inputToken:Uo,issuesToken:OE,inputElementToken:CE,initialState:["email"],onSubmit:async n=>{const r=Ze(jn);if(r[0]!=="email")return new Error("field not email");switch(r.length){case 1:{const{userKey:o,nextStep:c}=await cn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:c}),c){case"otc_login":{De(oi,o),De(jn,["email","otcLogin"]);break}case"password_login":{De(oi,o),De(jn,["email","passwordLogin"]);break}case"otc_verify":{De(oi,o),De(Pi,"not needed"),De(jn,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),r[1]){case"otcLogin":{console.log("case 2.1");const o=Ze(oi);if(!o)return new Error("No auth target");const c=Ze(Pi),u=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:o});return De(lt,u),De(jn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=Ze(oi);if(!o)return new Error("No auth target");const c=Ze(ym),u=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:o});return De(lt,u),De(jn,[]),u.email}}}}),Y.jsx(mp,{label:"new-password",inputToken:li,issuesToken:RE,inputElementToken:DE,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const r=Ze(jn);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(li,"••••••••••••"),De(lt,o=>o&&{...o,password:!0}),De(jn,[]),"done";case 2:{const o=Ze(oi);return o?(await cn.verifyAccountAction.mutate({oneTimeCode:Ze(Pi),userKey:o}),De(lt,c=>c&&{...c,password:!1}),De(li,""),De(jn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(li,"••••••••••••")},onOpen:async()=>{if(t.password){const n=Ze(oi);if(!n)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:n})}}})]}):Y.jsx("p",{children:"You must be logged in to verify your account."})}function yU(){return Y.jsx("article",{children:Y.jsx("h1",{children:"admin"})})}var gU=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)}clear(){throw new Error("Cannot clear an InvariantMap")}},bU=class gm{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new gU;static create(e,n){const r=new gm(e),{type:o,globals:c,actions:u,perspectives:d}=n(r),h={type:o,key:e,globals:c,actions:u,perspectives:d};return gm.existing.set(e,h),h}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[r,o]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:r,viewAtoms:o})}break}return this}};function vU(t){const{key:e,config:n}=t,r=bU.create(e,n),{actions:o}=r;for(const c of o)S1(mt.STORE,e,c.key);return Jm(mt.STORE,e,-1),r}et({key:"usersInRoomIndex",mutable:!0,default:()=>new _o,toJson:t=>t.toJSON(),fromJson:t=>_o.fromJSON(t)});et({key:"roomIndex",default:()=>new _o,mutable:!0,toJson:t=>t.toJSON(),fromJson:t=>_o.fromJSON(t)});const SU={enteredAtEpoch:0},xU=jk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},SU);Kk({key:"usersInMyRoomView",get:t=>({find:e})=>{const n=Bk(xU);return[e(n,t)]}});const $y=et({key:"count",default:0}),$E=qk({key:"incrementTX",do:({set:t})=>{t($y,e=>e+1)}}),wU=vU({key:"countContinuity",config:t=>t.add($y).add($E)});function TU({route:[,t]}){return Y.jsx("article",{children:t?Y.jsx(EU,{gameId:t}):Y.jsx(AU,{})})}function AU(){return Y.jsx("nav",{children:Y.jsx(JA,{href:"/game/clicker",children:"Clicker"})})}Dk(Dy[1].game[1]);function EU({gameId:t}){console.log(t);const e=xt($y),n=Ik($E);return KM(wU),Y.jsxs("article",{children:[Y.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),Y.jsx("p",{children:"Let's see how high we can count!"})]})}const jE=V.createContext({});function RU(t){const e=V.useRef(null);return e.current===null&&(e.current=t()),e.current}const jy=typeof window<"u",OU=jy?V.useLayoutEffect:V.useEffect,By=V.createContext(null);function Ly(t,e){t.indexOf(e)===-1&&t.push(e)}function Vy(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Yi=(t,e,n)=>n>e?e:n<t?t:n;let Uy=()=>{};const Ji={},BE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function LE(t){return typeof t=="object"&&t!==null}const VE=t=>/^0[^.\s]+$/u.test(t);function zy(t){let e;return()=>(e===void 0&&(e=t()),e)}const Un=t=>t,_U=(t,e)=>n=>e(t(n)),Cl=(...t)=>t.reduce(_U),ul=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Ky{constructor(){this.subscriptions=[]}add(e){return Ly(this.subscriptions,e),()=>Vy(this.subscriptions,e)}notify(e,n,r){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,r);else for(let c=0;c<o;c++){const u=this.subscriptions[c];u&&u(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ui=t=>t*1e3,fi=t=>t/1e3;function UE(t,e){return e?t*(1e3/e):0}const zE=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,kU=1e-7,MU=12;function CU(t,e,n,r,o){let c,u,d=0;do u=e+(n-e)/2,c=zE(u,r,o)-t,c>0?n=u:e=u;while(Math.abs(c)>kU&&++d<MU);return u}function Dl(t,e,n,r){if(t===e&&n===r)return Un;const o=c=>CU(c,0,1,t,n);return c=>c===0||c===1?c:zE(o(c),e,r)}const KE=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,PE=t=>e=>1-t(1-e),qE=Dl(.33,1.53,.69,.99),Py=PE(qE),IE=KE(Py),HE=t=>(t*=2)<1?.5*Py(t):.5*(2-Math.pow(2,-10*(t-1))),qy=t=>1-Math.sin(Math.acos(t)),FE=PE(qy),GE=KE(qy),DU=Dl(.42,0,1,1),NU=Dl(0,0,.58,1),YE=Dl(.42,0,.58,1),$U=t=>Array.isArray(t)&&typeof t[0]!="number",JE=t=>Array.isArray(t)&&typeof t[0]=="number",jU={linear:Un,easeIn:DU,easeInOut:YE,easeOut:NU,circIn:qy,circInOut:GE,circOut:FE,backIn:Py,backInOut:IE,backOut:qE,anticipate:HE},BU=t=>typeof t=="string",Xx=t=>{if(JE(t)){Uy(t.length===4);const[e,n,r,o]=t;return Dl(e,n,r,o)}else if(BU(t))return jU[t];return t},au=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function LU(t,e){let n=new Set,r=new Set,o=!1,c=!1;const u=new WeakSet;let d={delta:0,timestamp:0,isProcessing:!1};function h(y){u.has(y)&&(p.schedule(y),t()),y(d)}const p={schedule:(y,g=!1,v=!1)=>{const w=v&&o?n:r;return g&&u.add(y),w.has(y)||w.add(y),y},cancel:y=>{r.delete(y),u.delete(y)},process:y=>{if(d=y,o){c=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,c&&(c=!1,p.process(y))}};return p}const VU=40;function XE(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},c=()=>n=!0,u=au.reduce((k,C)=>(k[C]=LU(c),k),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:y,update:g,preRender:v,render:S,postRender:w}=u,T=()=>{const k=Ji.useManualTiming?o.timestamp:performance.now();n=!1,Ji.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(k-o.timestamp,VU),1)),o.timestamp=k,o.isProcessing=!0,d.process(o),h.process(o),p.process(o),y.process(o),g.process(o),v.process(o),S.process(o),w.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},D=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:au.reduce((k,C)=>{const O=u[C];return k[C]=(J,G=!1,H=!1)=>(n||D(),O.schedule(J,G,H)),k},{}),cancel:k=>{for(let C=0;C<au.length;C++)u[au[C]].cancel(k)},state:o,steps:u}}const{schedule:We,cancel:Dr,state:Kt,steps:yp}=XE(typeof requestAnimationFrame<"u"?requestAnimationFrame:Un,!0);let xu;function UU(){xu=void 0}const un={now:()=>(xu===void 0&&un.set(Kt.isProcessing||Ji.useManualTiming?Kt.timestamp:performance.now()),xu),set:t=>{xu=t,queueMicrotask(UU)}},ZE=t=>e=>typeof e=="string"&&e.startsWith(t),Iy=ZE("--"),zU=ZE("var(--"),Hy=t=>zU(t)?KU.test(t.split("/*")[0].trim()):!1,KU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Fo={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},fl={...Fo,transform:t=>Yi(0,1,t)},lu={...Fo,default:1},nl=t=>Math.round(t*1e5)/1e5,Fy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function PU(t){return t==null}const qU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Gy=(t,e)=>n=>!!(typeof n=="string"&&qU.test(n)&&n.startsWith(t)||e&&!PU(n)&&Object.prototype.hasOwnProperty.call(n,e)),QE=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,c,u,d]=r.match(Fy);return{[t]:parseFloat(o),[e]:parseFloat(c),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},IU=t=>Yi(0,255,t),gp={...Fo,transform:t=>Math.round(IU(t))},os={test:Gy("rgb","red"),parse:QE("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+gp.transform(t)+", "+gp.transform(e)+", "+gp.transform(n)+", "+nl(fl.transform(r))+")"};function HU(t){let e="",n="",r="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,r+=r,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:o?parseInt(o,16)/255:1}}const bm={test:Gy("#"),parse:HU,transform:os.transform},Nl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Tr=Nl("deg"),di=Nl("%"),ye=Nl("px"),FU=Nl("vh"),GU=Nl("vw"),Zx={...di,parse:t=>di.parse(t)/100,transform:t=>di.transform(t*100)},mo={test:Gy("hsl","hue"),parse:QE("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+di.transform(nl(e))+", "+di.transform(nl(n))+", "+nl(fl.transform(r))+")"},St={test:t=>os.test(t)||bm.test(t)||mo.test(t),parse:t=>os.test(t)?os.parse(t):mo.test(t)?mo.parse(t):bm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?os.transform(t):mo.transform(t),getAnimatableNone:t=>{const e=St.parse(t);return e.alpha=0,St.transform(e)}},YU=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function JU(t){return isNaN(t)&&typeof t=="string"&&(t.match(Fy)?.length||0)+(t.match(YU)?.length||0)>0}const WE="number",eR="color",XU="var",ZU="var(",Qx="${}",QU=/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 dl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let c=0;const d=e.replace(QU,h=>(St.test(h)?(r.color.push(c),o.push(eR),n.push(St.parse(h))):h.startsWith(ZU)?(r.var.push(c),o.push(XU),n.push(h)):(r.number.push(c),o.push(WE),n.push(parseFloat(h))),++c,Qx)).split(Qx);return{values:n,split:d,indexes:r,types:o}}function tR(t){return dl(t).values}function nR(t){const{split:e,types:n}=dl(t),r=e.length;return o=>{let c="";for(let u=0;u<r;u++)if(c+=e[u],o[u]!==void 0){const d=n[u];d===WE?c+=nl(o[u]):d===eR?c+=St.transform(o[u]):c+=o[u]}return c}}const WU=t=>typeof t=="number"?0:St.test(t)?St.getAnimatableNone(t):t;function e4(t){const e=tR(t);return nR(t)(e.map(WU))}const Nr={test:JU,parse:tR,createTransformer:nR,getAnimatableNone:e4};function bp(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 t4({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,c=0,u=0;if(!e)o=c=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=bp(h,d,t+1/3),c=bp(h,d,t),u=bp(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(c*255),blue:Math.round(u*255),alpha:r}}function Gu(t,e){return n=>n>0?e:t}const it=(t,e,n)=>t+(e-t)*n,vp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},n4=[bm,os,mo],i4=t=>n4.find(e=>e.test(t));function Wx(t){const e=i4(t);if(!e)return!1;let n=e.parse(t);return e===mo&&(n=t4(n)),n}const ew=(t,e)=>{const n=Wx(t),r=Wx(e);if(!n||!r)return Gu(t,e);const o={...n};return c=>(o.red=vp(n.red,r.red,c),o.green=vp(n.green,r.green,c),o.blue=vp(n.blue,r.blue,c),o.alpha=it(n.alpha,r.alpha,c),os.transform(o))},vm=new Set(["none","hidden"]);function r4(t,e){return vm.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function s4(t,e){return n=>it(t,e,n)}function Yy(t){return typeof t=="number"?s4:typeof t=="string"?Hy(t)?Gu:St.test(t)?ew:l4:Array.isArray(t)?iR:typeof t=="object"?St.test(t)?ew:o4:Gu}function iR(t,e){const n=[...t],r=n.length,o=t.map((c,u)=>Yy(c)(c,e[u]));return c=>{for(let u=0;u<r;u++)n[u]=o[u](c);return n}}function o4(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=Yy(t[o])(t[o],e[o]));return o=>{for(const c in r)n[c]=r[c](o);return n}}function a4(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const c=e.types[o],u=t.indexes[c][r[c]],d=t.values[u]??0;n[o]=d,r[c]++}return n}const l4=(t,e)=>{const n=Nr.createTransformer(e),r=dl(t),o=dl(e);return r.indexes.var.length===o.indexes.var.length&&r.indexes.color.length===o.indexes.color.length&&r.indexes.number.length>=o.indexes.number.length?vm.has(t)&&!o.values.length||vm.has(e)&&!r.values.length?r4(t,e):Cl(iR(a4(r,o),o.values),n):Gu(t,e)};function rR(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?it(t,e,n):Yy(t)(t,e)}const c4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>We.update(e,n),stop:()=>Dr(e),now:()=>Kt.isProcessing?Kt.timestamp:un.now()}},sR=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let c=0;c<o;c++)r+=Math.round(t(c/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Yu=2e4;function Jy(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Yu;)e+=n,r=t.next(e);return e>=Yu?1/0:e}function u4(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(Jy(r),Yu);return{type:"keyframes",ease:c=>r.next(o*c).value/e,duration:fi(o)}}const f4=5;function oR(t,e,n){const r=Math.max(e-f4,0);return UE(n-t(r),e-r)}const at={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},Sp=.001;function d4({duration:t=at.duration,bounce:e=at.bounce,velocity:n=at.velocity,mass:r=at.mass}){let o,c,u=1-e;u=Yi(at.minDamping,at.maxDamping,u),t=Yi(at.minDuration,at.maxDuration,fi(t)),u<1?(o=p=>{const y=p*u,g=y*t,v=y-n,S=Sm(p,u),w=Math.exp(-g);return Sp-v/S*w},c=p=>{const g=p*u*t,v=g*n+n,S=Math.pow(u,2)*Math.pow(p,2)*t,w=Math.exp(-g),T=Sm(Math.pow(p,2),u);return(-o(p)+Sp>0?-1:1)*((v-S)*w)/T}):(o=p=>{const y=Math.exp(-p*t),g=(p-n)*t+1;return-Sp+y*g},c=p=>{const y=Math.exp(-p*t),g=(n-p)*(t*t);return y*g});const d=5/t,h=p4(o,c,d);if(t=ui(t),isNaN(h))return{stiffness:at.stiffness,damping:at.damping,duration:t};{const p=Math.pow(h,2)*r;return{stiffness:p,damping:u*2*Math.sqrt(r*p),duration:t}}}const h4=12;function p4(t,e,n){let r=n;for(let o=1;o<h4;o++)r=r-t(r)/e(r);return r}function Sm(t,e){return t*Math.sqrt(1-e*e)}const m4=["duration","bounce"],y4=["stiffness","damping","mass"];function tw(t,e){return e.some(n=>t[n]!==void 0)}function g4(t){let e={velocity:at.velocity,stiffness:at.stiffness,damping:at.damping,mass:at.mass,isResolvedFromDuration:!1,...t};if(!tw(t,y4)&&tw(t,m4))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,c=2*Yi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:at.mass,stiffness:o,damping:c}}else{const n=d4(t);e={...e,...n,mass:at.mass},e.isResolvedFromDuration=!0}return e}function Ju(t=at.visualDuration,e=at.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const c=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:c},{stiffness:h,damping:p,mass:y,duration:g,velocity:v,isResolvedFromDuration:S}=g4({...n,velocity:-fi(n.velocity||0)}),w=v||0,T=p/(2*Math.sqrt(h*y)),D=u-c,$=fi(Math.sqrt(h/y)),_=Math.abs(D)<5;r||(r=_?at.restSpeed.granular:at.restSpeed.default),o||(o=_?at.restDelta.granular:at.restDelta.default);let k;if(T<1){const O=Sm($,T);k=J=>{const G=Math.exp(-T*$*J);return u-G*((w+T*$*D)/O*Math.sin(O*J)+D*Math.cos(O*J))}}else if(T===1)k=O=>u-Math.exp(-$*O)*(D+(w+$*D)*O);else{const O=$*Math.sqrt(T*T-1);k=J=>{const G=Math.exp(-T*$*J),H=Math.min(O*J,300);return u-G*((w+T*$*D)*Math.sinh(H)+O*D*Math.cosh(H))/O}}const C={calculatedDuration:S&&g||null,next:O=>{const J=k(O);if(S)d.done=O>=g;else{let G=O===0?w:0;T<1&&(G=O===0?ui(w):oR(k,O,J));const H=Math.abs(G)<=r,ie=Math.abs(u-J)<=o;d.done=H&&ie}return d.value=d.done?u:J,d},toString:()=>{const O=Math.min(Jy(C),Yu),J=sR(G=>C.next(O*G).value,O,30);return O+"ms "+J},toTransition:()=>{}};return C}Ju.applyToOptions=t=>{const e=u4(t,100,Ju);return t.ease=e.ease,t.duration=ui(e.duration),t.type="keyframes",t};function xm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:c=500,modifyTarget:u,min:d,max:h,restDelta:p=.5,restSpeed:y}){const g=t[0],v={done:!1,value:g},S=H=>d!==void 0&&H<d||h!==void 0&&H>h,w=H=>d===void 0?h:h===void 0||Math.abs(d-H)<Math.abs(h-H)?d:h;let T=n*e;const D=g+T,$=u===void 0?D:u(D);$!==D&&(T=$-g);const _=H=>-T*Math.exp(-H/r),k=H=>$+_(H),C=H=>{const ie=_(H),oe=k(H);v.done=Math.abs(ie)<=p,v.value=v.done?$:oe};let O,J;const G=H=>{S(v.value)&&(O=H,J=Ju({keyframes:[v.value,w(v.value)],velocity:oR(k,H,v.value),damping:o,stiffness:c,restDelta:p,restSpeed:y}))};return G(0),{calculatedDuration:null,next:H=>{let ie=!1;return!J&&O===void 0&&(ie=!0,C(H),G(H)),O!==void 0&&H>=O?J.next(H-O):(!ie&&C(H),v)}}}function b4(t,e,n){const r=[],o=n||Ji.mix||rR,c=t.length-1;for(let u=0;u<c;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Un:e;d=Cl(h,d)}r.push(d)}return r}function v4(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const c=t.length;if(Uy(c===e.length),c===1)return()=>e[0];if(c===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[c-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=b4(e,r,o),h=d.length,p=y=>{if(u&&y<t[0])return e[0];let g=0;if(h>1)for(;g<t.length-2&&!(y<t[g+1]);g++);const v=ul(t[g],t[g+1],y);return d[g](v)};return n?y=>p(Yi(t[0],t[c-1],y)):p}function S4(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=ul(0,e,r);t.push(it(n,1,o))}}function x4(t){const e=[0];return S4(e,t.length-1),e}function w4(t,e){return t.map(n=>n*e)}function T4(t,e){return t.map(()=>e||YE).splice(0,t.length-1)}function il({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=$U(r)?r.map(Xx):Xx(r),c={done:!1,value:e[0]},u=w4(n&&n.length===e.length?n:x4(e),t),d=v4(u,e,{ease:Array.isArray(o)?o:T4(e,o)});return{calculatedDuration:t,next:h=>(c.value=d(h),c.done=h>=t,c)}}const A4=t=>t!==null;function Xy(t,{repeat:e,repeatType:n="loop"},r,o=1){const c=t.filter(A4),d=o<0||e&&n!=="loop"&&e%2===1?0:c.length-1;return!d||r===void 0?c[d]:r}const E4={decay:xm,inertia:xm,tween:il,keyframes:il,spring:Ju};function aR(t){typeof t.type=="string"&&(t.type=E4[t.type])}class Zy{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 R4=t=>t/100;class Qy extends Zy{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!==un.now()&&this.tick(un.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;aR(e);const{type:n=il,repeat:r=0,repeatDelay:o=0,repeatType:c,velocity:u=0}=e;let{keyframes:d}=e;const h=n||il;h!==il&&typeof d[0]!="number"&&(this.mixKeyframes=Cl(R4,rR(d[0],d[1])),d=[0,100]);const p=h({...e,keyframes:d});c==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=Jy(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(r+1)-o,this.generator=p}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:o,mixKeyframes:c,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:g,repeatType:v,repeatDelay:S,type:w,onUpdate:T,finalKeyframe:D}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-o/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const $=this.currentTime-p*(this.playbackSpeed>=0?1:-1),_=this.playbackSpeed>=0?$<0:$>o;this.currentTime=Math.max($,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let k=this.currentTime,C=r;if(g){const H=Math.min(this.currentTime,o)/d;let ie=Math.floor(H),oe=H%1;!oe&&H>=1&&(oe=1),oe===1&&ie--,ie=Math.min(ie,g+1),!!(ie%2)&&(v==="reverse"?(oe=1-oe,S&&(oe-=S/d)):v==="mirror"&&(C=u)),k=Yi(0,1,oe)*d}const O=_?{done:!1,value:y[0]}:C.next(k);c&&(O.value=c(O.value));let{done:J}=O;!_&&h!==null&&(J=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const G=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return G&&w!==xm&&(O.value=Xy(y,this.options,D,this.speed)),T&&T(O.value),G&&this.finish(),O}then(e,n){return this.finished.then(e,n)}get duration(){return fi(this.calculatedDuration)}get time(){return fi(this.currentTime)}set time(e){e=ui(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(un.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=fi(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=c4,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),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(un.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 O4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const as=t=>t*180/Math.PI,wm=t=>{const e=as(Math.atan2(t[1],t[0]));return Tm(e)},_4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:wm,rotateZ:wm,skewX:t=>as(Math.atan(t[1])),skewY:t=>as(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Tm=t=>(t=t%360,t<0&&(t+=360),t),nw=wm,iw=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),rw=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),k4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:iw,scaleY:rw,scale:t=>(iw(t)+rw(t))/2,rotateX:t=>Tm(as(Math.atan2(t[6],t[5]))),rotateY:t=>Tm(as(Math.atan2(-t[2],t[0]))),rotateZ:nw,rotate:nw,skewX:t=>as(Math.atan(t[4])),skewY:t=>as(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Am(t){return t.includes("scale")?1:0}function Em(t,e){if(!t||t==="none")return Am(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=k4,o=n;else{const d=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=_4,o=d}if(!o)return Am(e);const c=r[e],u=o[1].split(",").map(C4);return typeof c=="function"?c(u):u[c]}const M4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Em(n,e)};function C4(t){return parseFloat(t.trim())}const Go=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Yo=new Set(Go),sw=t=>t===Fo||t===ye,D4=new Set(["x","y","z"]),N4=Go.filter(t=>!D4.has(t));function $4(t){const e=[];return N4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const us={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})=>Em(e,"x"),y:(t,{transform:e})=>Em(e,"y")};us.translateX=us.x;us.translateY=us.y;const fs=new Set;let Rm=!1,Om=!1,_m=!1;function lR(){if(Om){const t=Array.from(fs).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=$4(r);o.length&&(n.set(r,o),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const o=n.get(r);o&&o.forEach(([c,u])=>{r.getValue(c)?.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Om=!1,Rm=!1,fs.forEach(t=>t.complete(_m)),fs.clear()}function cR(){fs.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Om=!0)})}function j4(){_m=!0,cR(),lR(),_m=!1}class Wy{constructor(e,n,r,o,c,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=o,this.element=c,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(fs.add(this),Rm||(Rm=!0,We.read(cR),We.resolveKeyframes(lR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const c=o?.get(),u=e[e.length-1];if(c!==void 0)e[0]=c;else if(r&&n){const d=r.readValue(n,u);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=u),o&&c===void 0&&o.set(e[0])}O4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),fs.delete(this)}cancel(){this.state==="scheduled"&&(fs.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const B4=t=>t.startsWith("--");function L4(t,e,n){B4(e)?t.style.setProperty(e,n):t.style[e]=n}const V4=zy(()=>window.ScrollTimeline!==void 0),U4={};function z4(t,e){const n=zy(t);return()=>U4[e]??n()}const uR=z4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Wa=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,ow={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Wa([0,.65,.55,1]),circOut:Wa([.55,0,1,.45]),backIn:Wa([.31,.01,.66,-.59]),backOut:Wa([.33,1.53,.69,.99])};function fR(t,e){if(t)return typeof t=="function"?uR()?sR(t,e):"ease-out":JE(t)?Wa(t):Array.isArray(t)?t.map(n=>fR(n,e)||ow.easeOut):ow[t]}function K4(t,e,n,{delay:r=0,duration:o=300,repeat:c=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const y={[e]:n};h&&(y.offset=h);const g=fR(d,o);Array.isArray(g)&&(y.easing=g);const v={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:c+1,direction:u==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),t.animate(y,v)}function dR(t){return typeof t=="function"&&"applyToOptions"in t}function P4({type:t,...e}){return dR(t)&&uR()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class q4 extends Zy{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:c,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=e;this.isPseudoElement=!!c,this.allowFlatten=u,this.options=e,Uy(typeof e.type!="string");const p=P4(e);this.animation=K4(n,r,o,p,c),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!c){const y=Xy(o,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):L4(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 fi(Number(e))}get time(){return fi(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=ui(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&&V4()?(this.animation.timeline=e,Un):n(this)}}const hR={anticipate:HE,backInOut:IE,circInOut:GE};function I4(t){return t in hR}function H4(t){typeof t.ease=="string"&&I4(t.ease)&&(t.ease=hR[t.ease])}const aw=10;class F4 extends q4{constructor(e){H4(e),aR(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:c,...u}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const d=new Qy({...u,autoplay:!1}),h=ui(this.finishedTime??this.time);n.setWithVelocity(d.sample(h-aw).value,d.sample(h).value,aw),d.stop()}}const lw=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Nr.test(t)||t==="0")&&!t.startsWith("url("));function G4(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 Y4(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const c=t[t.length-1],u=lw(o,e),d=lw(c,e);return!u||!d?!1:G4(t)||(n==="spring"||dR(n))&&r}function km(t){t.duration=0,t.type}const J4=new Set(["opacity","clipPath","filter","transform"]),X4=zy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Z4(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:c,type:u}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=e.owner.getProps();return X4()&&n&&J4.has(n)&&(n!=="transform"||!p)&&!h&&!r&&o!=="mirror"&&c!==0&&u!=="inertia"}const Q4=40;class W4 extends Zy{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:c=0,repeatType:u="loop",keyframes:d,name:h,motionValue:p,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=un.now();const v={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:c,repeatType:u,name:h,motionValue:p,element:y,...g},S=y?.KeyframeResolver||Wy;this.keyframeResolver=new S(d,(w,T,D)=>this.onKeyframesResolved(w,T,v,!D),h,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:c,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:y}=r;this.resolvedAt=un.now(),Y4(e,c,u,d)||((Ji.instantAnimations||!h)&&y?.(Xy(e,r,n)),e[0]=e[e.length-1],km(r),r.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>Q4?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!p&&Z4(v)?new F4({...v,element:v.motionValue.owner.current}):new Qy(v);S.finished.then(()=>this.notifyFinished()).catch(Un),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(),j4()),this._animation}get duration(){return this.animation.duration}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 ez=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function tz(t){const e=ez.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function pR(t,e,n=1){const[r,o]=tz(t);if(!r)return;const c=window.getComputedStyle(e).getPropertyValue(r);if(c){const u=c.trim();return BE(u)?parseFloat(u):u}return Hy(o)?pR(o,e,n+1):o}function eg(t,e){return t?.[e]??t?.default??t}const mR=new Set(["width","height","top","left","right","bottom",...Go]),nz={test:t=>t==="auto",parse:t=>t},yR=t=>e=>e.test(t),gR=[Fo,ye,di,Tr,GU,FU,nz],cw=t=>gR.find(yR(t));function iz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||VE(t):!0}const rz=new Set(["brightness","contrast","saturate","opacity"]);function sz(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Fy)||[];if(!r)return t;const o=n.replace(r,"");let c=rz.has(e)?1:0;return r!==n&&(c*=100),e+"("+c+o+")"}const oz=/\b([a-z-]*)\(.*?\)/gu,Mm={...Nr,getAnimatableNone:t=>{const e=t.match(oz);return e?e.map(sz).join(" "):t}},uw={...Fo,transform:Math.round},az={rotate:Tr,rotateX:Tr,rotateY:Tr,rotateZ:Tr,scale:lu,scaleX:lu,scaleY:lu,scaleZ:lu,skew:Tr,skewX:Tr,skewY:Tr,distance:ye,translateX:ye,translateY:ye,translateZ:ye,x:ye,y:ye,z:ye,perspective:ye,transformPerspective:ye,opacity:fl,originX:Zx,originY:Zx,originZ:ye},tg={borderWidth:ye,borderTopWidth:ye,borderRightWidth:ye,borderBottomWidth:ye,borderLeftWidth:ye,borderRadius:ye,radius:ye,borderTopLeftRadius:ye,borderTopRightRadius:ye,borderBottomRightRadius:ye,borderBottomLeftRadius:ye,width:ye,maxWidth:ye,height:ye,maxHeight:ye,top:ye,right:ye,bottom:ye,left:ye,padding:ye,paddingTop:ye,paddingRight:ye,paddingBottom:ye,paddingLeft:ye,margin:ye,marginTop:ye,marginRight:ye,marginBottom:ye,marginLeft:ye,backgroundPositionX:ye,backgroundPositionY:ye,...az,zIndex:uw,fillOpacity:fl,strokeOpacity:fl,numOctaves:uw},lz={...tg,color:St,backgroundColor:St,outlineColor:St,fill:St,stroke:St,borderColor:St,borderTopColor:St,borderRightColor:St,borderBottomColor:St,borderLeftColor:St,filter:Mm,WebkitFilter:Mm},bR=t=>lz[t];function vR(t,e){let n=bR(t);return n!==Mm&&(n=Nr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const cz=new Set(["auto","none","0"]);function uz(t,e,n){let r=0,o;for(;r<t.length&&!o;){const c=t[r];typeof c=="string"&&!cz.has(c)&&dl(c).values.length&&(o=t[r]),r++}if(o&&n)for(const c of e)t[c]=vR(n,o)}class fz extends Wy{constructor(e,n,r,o,c){super(e,n,r,o,c,!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 p=e[h];if(typeof p=="string"&&(p=p.trim(),Hy(p))){const y=pR(p,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!mR.has(r)||e.length!==2)return;const[o,c]=e,u=cw(o),d=cw(c);if(u!==d)if(sw(u)&&sw(d))for(let h=0;h<e.length;h++){const p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}else us[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||iz(e[o]))&&r.push(o);r.length&&uz(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=us[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(r,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const c=r.length-1,u=r[c];r[c]=us[n](e.measureViewportBox(),window.getComputedStyle(e.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([d,h])=>{e.getValue(d).set(h)}),this.resolveNoneKeyframes()}}function dz(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let r=document;const o=n?.[t]??r.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const SR=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function hz(t){return LE(t)&&"offsetHeight"in t}const fw=30,pz=t=>!isNaN(parseFloat(t));class mz{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=un.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const c of this.dependents)c.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=un.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=pz(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 Ky);const r=this.events[e].add(n);return e==="change"?()=>{r(),We.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=un.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>fw)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,fw);return UE(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 zo(t,e){return new mz(t,e)}const{schedule:ng}=XE(queueMicrotask,!1),Fn={x:!1,y:!1};function xR(){return Fn.x||Fn.y}function yz(t){return t==="x"||t==="y"?Fn[t]?null:(Fn[t]=!0,()=>{Fn[t]=!1}):Fn.x||Fn.y?null:(Fn.x=Fn.y=!0,()=>{Fn.x=Fn.y=!1})}function wR(t,e){const n=dz(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function dw(t){return!(t.pointerType==="touch"||xR())}function gz(t,e,n={}){const[r,o,c]=wR(t,n),u=d=>{if(!dw(d))return;const{target:h}=d,p=e(h,d);if(typeof p!="function"||!h)return;const y=g=>{dw(g)&&(p(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(d=>{d.addEventListener("pointerenter",u,o)}),c}const TR=(t,e)=>e?t===e?!0:TR(t,e.parentElement):!1,ig=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function vz(t){return bz.has(t.tagName)||t.tabIndex!==-1}const wu=new WeakSet;function hw(t){return e=>{e.key==="Enter"&&t(e)}}function xp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Sz=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=hw(()=>{if(wu.has(n))return;xp(n,"down");const o=hw(()=>{xp(n,"up")}),c=()=>xp(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",c,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function pw(t){return ig(t)&&!xR()}function xz(t,e,n={}){const[r,o,c]=wR(t,n),u=d=>{const h=d.currentTarget;if(!pw(d))return;wu.add(h);const p=e(h,d),y=(S,w)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),wu.has(h)&&wu.delete(h),pw(S)&&typeof p=="function"&&p(S,{success:w})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||TR(h,S.target))},v=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",v,o)};return r.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),hz(d)&&(d.addEventListener("focus",p=>Sz(p,o)),!vz(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),c}function AR(t){return LE(t)&&"ownerSVGElement"in t}function wz(t){return AR(t)&&t.tagName==="svg"}const Ft=t=>!!(t&&t.getVelocity),Tz=[...gR,St,Nr],Az=t=>Tz.find(yR(t)),ER=V.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Ez(t=!0){const e=V.useContext(By);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,c=V.useId();V.useEffect(()=>{if(t)return o(c)},[t]);const u=V.useCallback(()=>t&&r&&r(c),[c,r,t]);return!n&&r?[!1,u]:[!0]}const RR=V.createContext({strict:!1}),mw={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"]},Ko={};for(const t in mw)Ko[t]={isEnabled:e=>mw[t].some(n=>!!e[n])};function Rz(t){for(const e in t)Ko[e]={...Ko[e],...t[e]}}const Oz=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 Xu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||Oz.has(t)}let OR=t=>!Xu(t);function _z(t){typeof t=="function"&&(OR=e=>e.startsWith("on")?!Xu(e):t(e))}try{_z(require("@emotion/is-prop-valid").default)}catch{}function kz(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(OR(o)||n===!0&&Xu(o)||!e&&!Xu(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const Rf=V.createContext({});function Of(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function hl(t){return typeof t=="string"||Array.isArray(t)}const rg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],sg=["initial",...rg];function _f(t){return Of(t.animate)||sg.some(e=>hl(t[e]))}function _R(t){return!!(_f(t)||t.variants)}function Mz(t,e){if(_f(t)){const{initial:n,animate:r}=t;return{initial:n===!1||hl(n)?n:void 0,animate:hl(r)?r:void 0}}return t.inherit!==!1?e:{}}function Cz(t){const{initial:e,animate:n}=Mz(t,V.useContext(Rf));return V.useMemo(()=>({initial:e,animate:n}),[yw(e),yw(n)])}function yw(t){return Array.isArray(t)?t.join(" "):t}const pl={};function Dz(t){for(const e in t)pl[e]=t[e],Iy(e)&&(pl[e].isCSSVariable=!0)}function kR(t,{layout:e,layoutId:n}){return Yo.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!pl[t]||t==="opacity")}const Nz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},$z=Go.length;function jz(t,e,n){let r="",o=!0;for(let c=0;c<$z;c++){const u=Go[c],d=t[u];if(d===void 0)continue;let h=!0;if(typeof d=="number"?h=d===(u.startsWith("scale")?1:0):h=parseFloat(d)===0,!h||n){const p=SR(d,tg[u]);if(!h){o=!1;const y=Nz[u]||u;r+=`${y}(${p}) `}n&&(e[u]=p)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function og(t,e,n){const{style:r,vars:o,transformOrigin:c}=t;let u=!1,d=!1;for(const h in e){const p=e[h];if(Yo.has(h)){u=!0;continue}else if(Iy(h)){o[h]=p;continue}else{const y=SR(p,tg[h]);h.startsWith("origin")?(d=!0,c[h]=y):r[h]=y}}if(e.transform||(u||n?r.transform=jz(e,t.transform,n):r.transform&&(r.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:y=0}=c;r.transformOrigin=`${h} ${p} ${y}`}}const ag=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function MR(t,e,n){for(const r in e)!Ft(e[r])&&!kR(r,n)&&(t[r]=e[r])}function Bz({transformTemplate:t},e){return V.useMemo(()=>{const n=ag();return og(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Lz(t,e){const n=t.style||{},r={};return MR(r,n,t),Object.assign(r,Bz(t,e)),r}function Vz(t,e){const n={},r=Lz(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 Uz={offset:"stroke-dashoffset",array:"stroke-dasharray"},zz={offset:"strokeDashoffset",array:"strokeDasharray"};function Kz(t,e,n=1,r=0,o=!0){t.pathLength=1;const c=o?Uz:zz;t[c.offset]=ye.transform(-r);const u=ye.transform(e),d=ye.transform(n);t[c.array]=`${u} ${d}`}function CR(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:c=1,pathOffset:u=0,...d},h,p,y){if(og(t,d,p),h){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:g,style:v}=t;g.transform&&(v.transform=g.transform,delete g.transform),(v.transform||g.transformOrigin)&&(v.transformOrigin=g.transformOrigin??"50% 50%",delete g.transformOrigin),v.transform&&(v.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),o!==void 0&&Kz(g,o,c,u,!1)}const DR=()=>({...ag(),attrs:{}}),NR=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Pz(t,e,n,r){const o=V.useMemo(()=>{const c=DR();return CR(c,e,NR(r),t.transformTemplate,t.style),{...c.attrs,style:{...c.style}}},[e]);if(t.style){const c={};MR(c,t.style,t),o.style={...c,...o.style}}return o}const qz=["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 lg(t){return typeof t!="string"||t.includes("-")?!1:!!(qz.indexOf(t)>-1||/[A-Z]/u.test(t))}function Iz(t,e,n,{latestValues:r},o,c=!1){const d=(lg(t)?Pz:Vz)(e,r,o,t),h=kz(e,typeof t=="string",c),p=t!==V.Fragment?{...h,...d,ref:n}:{},{children:y}=e,g=V.useMemo(()=>Ft(y)?y.get():y,[y]);return V.createElement(t,{...p,children:g})}function gw(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function cg(t,e,n,r){if(typeof e=="function"){const[o,c]=gw(r);e=e(n!==void 0?n:t.custom,o,c)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,c]=gw(r);e=e(n!==void 0?n:t.custom,o,c)}return e}function Tu(t){return Ft(t)?t.get():t}function Hz({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:Fz(n,r,o,t),renderState:e()}}function Fz(t,e,n,r){const o={},c=r(t,{});for(const v in c)o[v]=Tu(c[v]);let{initial:u,animate:d}=t;const h=_f(t),p=_R(t);e&&p&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),d===void 0&&(d=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const g=y?d:u;if(g&&typeof g!="boolean"&&!Of(g)){const v=Array.isArray(g)?g:[g];for(let S=0;S<v.length;S++){const w=cg(t,v[S]);if(w){const{transitionEnd:T,transition:D,...$}=w;for(const _ in $){let k=$[_];if(Array.isArray(k)){const C=y?k.length-1:0;k=k[C]}k!==null&&(o[_]=k)}for(const _ in T)o[_]=T[_]}}}return o}const $R=t=>(e,n)=>{const r=V.useContext(Rf),o=V.useContext(By),c=()=>Hz(t,e,r,o);return n?c():RU(c)};function ug(t,e,n){const{style:r}=t,o={};for(const c in r)(Ft(r[c])||e.style&&Ft(e.style[c])||kR(c,t)||n?.getValue(c)?.liveStyle!==void 0)&&(o[c]=r[c]);return o}const Gz=$R({scrapeMotionValuesFromProps:ug,createRenderState:ag});function jR(t,e,n){const r=ug(t,e,n);for(const o in t)if(Ft(t[o])||Ft(e[o])){const c=Go.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[c]=t[o]}return r}const Yz=$R({scrapeMotionValuesFromProps:jR,createRenderState:DR}),Jz=Symbol.for("motionComponentSymbol");function yo(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function Xz(t,e,n){return V.useCallback(r=>{r&&t.onMount&&t.onMount(r),e&&(r?e.mount(r):e.unmount()),n&&(typeof n=="function"?n(r):yo(n)&&(n.current=r))},[e])}const fg=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Zz="framerAppearId",BR="data-"+fg(Zz),LR=V.createContext({});function Qz(t,e,n,r,o){const{visualElement:c}=V.useContext(Rf),u=V.useContext(RR),d=V.useContext(By),h=V.useContext(ER).reducedMotion,p=V.useRef(null);r=r||u.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:c,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current,g=V.useContext(LR);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&Wz(p.current,n,o,g);const v=V.useRef(!1);V.useInsertionEffect(()=>{y&&v.current&&y.update(n,d)});const S=n[BR],w=V.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return OU(()=>{y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),w.current&&y.animationState&&y.animationState.animateChanges())}),V.useEffect(()=>{y&&(!w.current&&y.animationState&&y.animationState.animateChanges(),w.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),w.current=!1),y.enteringChildren=void 0)}),y}function Wz(t,e,n,r){const{layoutId:o,layout:c,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:VR(t.parent)),t.projection.setOptions({layoutId:o,layout:c,alwaysMeasureLayout:!!u||d&&yo(d),visualElement:t,animationType:typeof c=="string"?c:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:p})}function VR(t){if(t)return t.options.allowProjection!==!1?t.projection:VR(t.parent)}function wp(t,{forwardMotionProps:e=!1}={},n,r){n&&Rz(n);const o=lg(t)?Yz:Gz;function c(d,h){let p;const y={...V.useContext(ER),...d,layoutId:eK(d)},{isStatic:g}=y,v=Cz(d),S=o(d,g);if(!g&&jy){tK();const w=nK(y);p=w.MeasureLayout,v.visualElement=Qz(t,S,y,r,w.ProjectionNode)}return Y.jsxs(Rf.Provider,{value:v,children:[p&&v.visualElement?Y.jsx(p,{visualElement:v.visualElement,...y}):null,Iz(t,d,Xz(S,v.visualElement,h),S,g,e)]})}c.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=V.forwardRef(c);return u[Jz]=t,u}function eK({layoutId:t}){const e=V.useContext(jE).id;return e&&t!==void 0?e+"-"+t:t}function tK(t,e){V.useContext(RR).strict}function nK(t){const{drag:e,layout:n}=Ko;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function iK(t,e){if(typeof Proxy>"u")return wp;const n=new Map,r=(c,u)=>wp(c,u,t,e),o=(c,u)=>r(c,u);return new Proxy(o,{get:(c,u)=>u==="create"?r:(n.has(u)||n.set(u,wp(u,void 0,t,e)),n.get(u))})}function UR({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function rK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function sK(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 Tp(t){return t===void 0||t===1}function Cm({scale:t,scaleX:e,scaleY:n}){return!Tp(t)||!Tp(e)||!Tp(n)}function rs(t){return Cm(t)||zR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function zR(t){return bw(t.x)||bw(t.y)}function bw(t){return t&&t!=="0%"}function Zu(t,e,n){const r=t-n,o=e*r;return n+o}function vw(t,e,n,r,o){return o!==void 0&&(t=Zu(t,o,r)),Zu(t,n,r)+e}function Dm(t,e=0,n=1,r,o){t.min=vw(t.min,e,n,r,o),t.max=vw(t.max,e,n,r,o)}function KR(t,{x:e,y:n}){Dm(t.x,e.translate,e.scale,e.originPoint),Dm(t.y,n.translate,n.scale,n.originPoint)}const Sw=.999999999999,xw=1.0000000000001;function oK(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let c,u;for(let d=0;d<o;d++){c=n[d],u=c.projectionDelta;const{visualElement:h}=c.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&c.options.layoutScroll&&c.scroll&&c!==c.root&&bo(t,{x:-c.scroll.offset.x,y:-c.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,KR(t,u)),r&&rs(c.latestValues)&&bo(t,c.latestValues))}e.x<xw&&e.x>Sw&&(e.x=1),e.y<xw&&e.y>Sw&&(e.y=1)}function go(t,e){t.min=t.min+e,t.max=t.max+e}function ww(t,e,n,r,o=.5){const c=it(t.min,t.max,o);Dm(t,e,n,c,r)}function bo(t,e){ww(t.x,e.x,e.scaleX,e.scale,e.originX),ww(t.y,e.y,e.scaleY,e.scale,e.originY)}function PR(t,e){return UR(sK(t.getBoundingClientRect(),e))}function aK(t,e,n){const r=PR(t,n),{scroll:o}=e;return o&&(go(r.x,o.offset.x),go(r.y,o.offset.y)),r}const Tw=()=>({translate:0,scale:1,origin:0,originPoint:0}),vo=()=>({x:Tw(),y:Tw()}),Aw=()=>({min:0,max:0}),dt=()=>({x:Aw(),y:Aw()}),Nm={current:null},qR={current:!1};function lK(){if(qR.current=!0,!!jy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Nm.current=t.matches;t.addEventListener("change",e),e()}else Nm.current=!1}const cK=new WeakMap;function uK(t,e,n){for(const r in e){const o=e[r],c=n[r];if(Ft(o))t.addValue(r,o);else if(Ft(c))t.addValue(r,zo(o,{owner:t}));else if(c!==o)if(t.hasValue(r)){const u=t.getValue(r);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(r);t.addValue(r,zo(u!==void 0?u:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Ew=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class fK{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:c,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Wy,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 v=un.now();this.renderScheduledAt<v&&(this.renderScheduledAt=v,We.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!c,this.isControllingVariants=_f(n),this.isVariantNode=_R(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:y,...g}=this.scrapeMotionValuesFromProps(n,{},this);for(const v in g){const S=g[v];h[v]!==void 0&&Ft(S)&&S.set(h[v])}}mount(e){this.current=e,cK.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)),qR.current||lK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Nm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Dr(this.notifyUpdate),Dr(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=Yo.has(e);r&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",u=>{this.latestValues[e]=u,this.props.onUpdate&&We.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let c;window.MotionCheckAppearSync&&(c=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),c&&c(),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 Ko){const n=Ko[e];if(!n)continue;const{isEnabled:r,Feature:o}=n;if(!this.features[e]&&o&&r(this.props)&&(this.features[e]=new o(this)),this.features[e]){const c=this.features[e];c.isMounted?c.update():(c.mount(),c.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):dt()}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<Ew.length;r++){const o=Ew[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const c="on"+o,u=e[c];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=uK(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=zo(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"&&(BE(r)||VE(r))?r=parseFloat(r):!Az(r)&&Nr.test(n)&&(r=vR(e,n)),this.setBaseTarget(e,Ft(r)?r.get():r)),Ft(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 c=cg(this.props,n,this.presenceContext?.custom);c&&(r=c[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Ft(o)?o:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Ky),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){ng.render(this.render)}}class IR extends fK{constructor(){super(...arguments),this.KeyframeResolver=fz}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;Ft(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function HR(t,{style:e,vars:n},r,o){const c=t.style;let u;for(u in e)c[u]=e[u];o?.applyProjectionStyles(c,r);for(u in n)c.setProperty(u,n[u])}function dK(t){return window.getComputedStyle(t)}class hK extends IR{constructor(){super(...arguments),this.type="html",this.renderInstance=HR}readValueFromInstance(e,n){if(Yo.has(n))return this.projection?.isProjecting?Am(n):M4(e,n);{const r=dK(e),o=(Iy(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return PR(e,n)}build(e,n,r){og(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return ug(e,n,r)}}const FR=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 pK(t,e,n,r){HR(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(FR.has(o)?o:fg(o),e.attrs[o])}class mK extends IR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=dt}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Yo.has(n)){const r=bR(n);return r&&r.default||0}return n=FR.has(n)?n:fg(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return jR(e,n,r)}build(e,n,r){CR(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){pK(e,n,r,o)}mount(e){this.isSVGTag=NR(e.tagName),super.mount(e)}}const yK=(t,e)=>lg(t)?new mK(e):new hK(e,{allowProjection:t!==V.Fragment});function Oo(t,e,n){const r=t.getProps();return cg(r,e,n!==void 0?n:r.custom,t)}const $m=t=>Array.isArray(t);function gK(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,zo(n))}function bK(t){return $m(t)?t[t.length-1]||0:t}function vK(t,e){const n=Oo(t,e);let{transitionEnd:r={},transition:o={},...c}=n||{};c={...c,...r};for(const u in c){const d=bK(c[u]);gK(t,u,d)}}function SK(t){return!!(Ft(t)&&t.add)}function jm(t,e){const n=t.getValue("willChange");if(SK(n))return n.add(e);if(!n&&Ji.WillChange){const r=new Ji.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function GR(t){return t.props[BR]}const xK=t=>t!==null;function wK(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(xK),c=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[c]}const TK={type:"spring",stiffness:500,damping:25,restSpeed:10},AK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),EK={type:"keyframes",duration:.8},RK={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},OK=(t,{keyframes:e})=>e.length>2?EK:Yo.has(t)?t.startsWith("scale")?AK(e[1]):TK:RK;function _K({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:c,repeatType:u,repeatDelay:d,from:h,elapsed:p,...y}){return!!Object.keys(y).length}const dg=(t,e,n,r={},o,c)=>u=>{const d=eg(r,t)||{},h=d.delay||r.delay||0;let{elapsed:p=0}=r;p=p-ui(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...d,delay:-p,onUpdate:v=>{e.set(v),d.onUpdate&&d.onUpdate(v)},onComplete:()=>{u(),d.onComplete&&d.onComplete()},name:t,motionValue:e,element:c?void 0:o};_K(d)||Object.assign(y,OK(t,y)),y.duration&&(y.duration=ui(y.duration)),y.repeatDelay&&(y.repeatDelay=ui(y.repeatDelay)),y.from!==void 0&&(y.keyframes[0]=y.from);let g=!1;if((y.type===!1||y.duration===0&&!y.repeatDelay)&&(km(y),y.delay===0&&(g=!0)),(Ji.instantAnimations||Ji.skipAnimations)&&(g=!0,km(y),y.delay=0),y.allowFlatten=!d.type&&!d.ease,g&&!c&&e.get()!==void 0){const v=wK(y.keyframes,d);if(v!==void 0){We.update(()=>{y.onUpdate(v),y.onComplete()});return}}return d.isSync?new Qy(y):new W4(y)};function kK({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function YR(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:c=t.getDefaultTransition(),transitionEnd:u,...d}=e;r&&(c=r);const h=[],p=o&&t.animationState&&t.animationState.getState()[o];for(const y in d){const g=t.getValue(y,t.latestValues[y]??null),v=d[y];if(v===void 0||p&&kK(p,y))continue;const S={delay:n,...eg(c||{},y)},w=g.get();if(w!==void 0&&!g.isAnimating&&!Array.isArray(v)&&v===w&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const $=GR(t);if($){const _=window.MotionHandoffAnimation($,y,We);_!==null&&(S.startTime=_,T=!0)}}jm(t,y),g.start(dg(y,g,v,t.shouldReduceMotion&&mR.has(y)?{type:!1}:S,t,T));const D=g.animation;D&&h.push(D)}return u&&Promise.all(h).then(()=>{We.update(()=>{u&&vK(t,u)})}),h}function JR(t,e,n,r=0,o=1){const c=Array.from(t).sort((p,y)=>p.sortNodePosition(y)).indexOf(e),u=t.size,d=(u-1)*r;return typeof n=="function"?n(c,u):o===1?c*r:d-c*r}function Bm(t,e,n={}){const r=Oo(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const c=r?()=>Promise.all(YR(t,r,n)):()=>Promise.resolve(),u=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:g}=o;return MK(t,e,h,p,y,g,n)}:()=>Promise.resolve(),{when:d}=o;if(d){const[h,p]=d==="beforeChildren"?[c,u]:[u,c];return h().then(()=>p())}else return Promise.all([c(),u(n.delay)])}function MK(t,e,n=0,r=0,o=0,c=1,u){const d=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),d.push(Bm(h,e,{...u,delay:n+(typeof r=="function"?0:r)+JR(t.variantChildren,h,r,o,c)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(d)}function CK(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(c=>Bm(t,c,n));r=Promise.all(o)}else if(typeof e=="string")r=Bm(t,e,n);else{const o=typeof e=="function"?Oo(t,e,n.custom):e;r=Promise.all(YR(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function XR(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 DK=sg.length;function ZR(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?ZR(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<DK;n++){const r=sg[n],o=t.props[r];(hl(o)||o===!1)&&(e[r]=o)}return e}const NK=[...rg].reverse(),$K=rg.length;function jK(t){return e=>Promise.all(e.map(({animation:n,options:r})=>CK(t,n,r)))}function BK(t){let e=jK(t),n=Rw(),r=!0;const o=h=>(p,y)=>{const g=Oo(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:v,transitionEnd:S,...w}=g;p={...p,...w,...S}}return p};function c(h){e=h(t)}function u(h){const{props:p}=t,y=ZR(t.parent)||{},g=[],v=new Set;let S={},w=1/0;for(let D=0;D<$K;D++){const $=NK[D],_=n[$],k=p[$]!==void 0?p[$]:y[$],C=hl(k),O=$===h?_.isActive:null;O===!1&&(w=D);let J=k===y[$]&&k!==p[$]&&C;if(J&&r&&t.manuallyAnimateOnMount&&(J=!1),_.protectedKeys={...S},!_.isActive&&O===null||!k&&!_.prevProp||Of(k)||typeof k=="boolean")continue;const G=LK(_.prevProp,k);let H=G||$===h&&_.isActive&&!J&&C||D>w&&C,ie=!1;const oe=Array.isArray(k)?k:[k];let fe=oe.reduce(o($),{});O===!1&&(fe={});const{prevResolvedValues:ge={}}=_,be={...ge,...fe},Q=P=>{H=!0,v.has(P)&&(ie=!0,v.delete(P)),_.needsAnimating[P]=!0;const z=t.getValue(P);z&&(z.liveStyle=!1)};for(const P in be){const z=fe[P],ee=ge[P];if(S.hasOwnProperty(P))continue;let A=!1;$m(z)&&$m(ee)?A=!XR(z,ee):A=z!==ee,A?z!=null?Q(P):v.add(P):z!==void 0&&v.has(P)?Q(P):_.protectedKeys[P]=!0}_.prevProp=k,_.prevResolvedValues=fe,_.isActive&&(S={...S,...fe}),r&&t.blockInitialAnimation&&(H=!1);const W=J&&G;H&&(!W||ie)&&g.push(...oe.map(P=>{const z={type:$};if(typeof P=="string"&&r&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ee}=t,A=Oo(ee,P);if(ee.enteringChildren&&A){const{delayChildren:I}=A.transition||{};z.delay=JR(ee.enteringChildren,t,I)}}return{animation:P,options:z}}))}if(v.size){const D={};if(typeof p.initial!="boolean"){const $=Oo(t,Array.isArray(p.initial)?p.initial[0]:p.initial);$&&$.transition&&(D.transition=$.transition)}v.forEach($=>{const _=t.getBaseTarget($),k=t.getValue($);k&&(k.liveStyle=!0),D[$]=_??null}),g.push({animation:D})}let T=!!g.length;return r&&(p.initial===!1||p.initial===p.animate)&&!t.manuallyAnimateOnMount&&(T=!1),r=!1,T?e(g):Promise.resolve()}function d(h,p){if(n[h].isActive===p)return Promise.resolve();t.variantChildren?.forEach(g=>g.animationState?.setActive(h,p)),n[h].isActive=p;const y=u(h);for(const g in n)n[g].protectedKeys={};return y}return{animateChanges:u,setActive:d,setAnimateFunction:c,getState:()=>n,reset:()=>{n=Rw(),r=!0}}}function LK(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!XR(e,t):!1}function ts(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Rw(){return{animate:ts(!0),whileInView:ts(),whileHover:ts(),whileTap:ts(),whileDrag:ts(),whileFocus:ts(),exit:ts()}}class Br{constructor(e){this.isMounted=!1,this.node=e}update(){}}class VK extends Br{constructor(e){super(e),e.animationState||(e.animationState=BK(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Of(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 UK=0;class zK extends Br{constructor(){super(...arguments),this.id=UK++}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 o=this.node.animationState.setActive("exit",!e);n&&!e&&o.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 KK={animation:{Feature:VK},exit:{Feature:zK}};function ml(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function $l(t){return{point:{x:t.pageX,y:t.pageY}}}const PK=t=>e=>ig(e)&&t(e,$l(e));function rl(t,e,n,r){return ml(t,e,PK(n),r)}const QR=1e-4,qK=1-QR,IK=1+QR,WR=.01,HK=0-WR,FK=0+WR;function Wt(t){return t.max-t.min}function GK(t,e,n){return Math.abs(t-e)<=n}function Ow(t,e,n,r=.5){t.origin=r,t.originPoint=it(e.min,e.max,t.origin),t.scale=Wt(n)/Wt(e),t.translate=it(n.min,n.max,t.origin)-t.originPoint,(t.scale>=qK&&t.scale<=IK||isNaN(t.scale))&&(t.scale=1),(t.translate>=HK&&t.translate<=FK||isNaN(t.translate))&&(t.translate=0)}function sl(t,e,n,r){Ow(t.x,e.x,n.x,r?r.originX:void 0),Ow(t.y,e.y,n.y,r?r.originY:void 0)}function _w(t,e,n){t.min=n.min+e.min,t.max=t.min+Wt(e)}function YK(t,e,n){_w(t.x,e.x,n.x),_w(t.y,e.y,n.y)}function kw(t,e,n){t.min=e.min-n.min,t.max=t.min+Wt(e)}function ol(t,e,n){kw(t.x,e.x,n.x),kw(t.y,e.y,n.y)}function Bn(t){return[t("x"),t("y")]}const eO=({current:t})=>t?t.ownerDocument.defaultView:null,Mw=(t,e)=>Math.abs(t-e);function JK(t,e){const n=Mw(t.x,e.x),r=Mw(t.y,e.y);return Math.sqrt(n**2+r**2)}class tO{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:c=!1,distanceThreshold:u=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 v=Ep(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,w=JK(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!w)return;const{point:T}=v,{timestamp:D}=Kt;this.history.push({...T,timestamp:D});const{onStart:$,onMove:_}=this.handlers;S||($&&$(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),_&&_(this.lastMoveEvent,v)},this.handlePointerMove=(v,S)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=Ap(S,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(v,S)=>{this.end();const{onEnd:w,onSessionEnd:T,resumeAnimation:D}=this.handlers;if(this.dragSnapToOrigin&&D&&D(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const $=Ep(v.type==="pointercancel"?this.lastMoveEventInfo:Ap(S,this.transformPagePoint),this.history);this.startEvent&&w&&w(v,$),T&&T(v,$)},!ig(e))return;this.dragSnapToOrigin=c,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=u,this.contextWindow=o||window;const d=$l(e),h=Ap(d,this.transformPagePoint),{point:p}=h,{timestamp:y}=Kt;this.history=[{...p,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,Ep(h,this.history)),this.removeListeners=Cl(rl(this.contextWindow,"pointermove",this.handlePointerMove),rl(this.contextWindow,"pointerup",this.handlePointerUp),rl(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Dr(this.updatePoint)}}function Ap(t,e){return e?{point:e(t.point)}:t}function Cw(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Ep({point:t},e){return{point:t,delta:Cw(t,nO(e)),offset:Cw(t,XK(e)),velocity:ZK(e,.1)}}function XK(t){return t[0]}function nO(t){return t[t.length-1]}function ZK(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=nO(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>ui(e)));)n--;if(!r)return{x:0,y:0};const c=fi(o.timestamp-r.timestamp);if(c===0)return{x:0,y:0};const u={x:(o.x-r.x)/c,y:(o.y-r.y)/c};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function QK(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?it(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?it(n,t,r.max):Math.min(t,n)),t}function Dw(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 WK(t,{top:e,left:n,bottom:r,right:o}){return{x:Dw(t.x,n,o),y:Dw(t.y,e,r)}}function Nw(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 eP(t,e){return{x:Nw(t.x,e.x),y:Nw(t.y,e.y)}}function tP(t,e){let n=.5;const r=Wt(t),o=Wt(e);return o>r?n=ul(e.min,e.max-r,t.min):r>o&&(n=ul(t.min,t.max-o,e.min)),Yi(0,1,n)}function nP(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 Lm=.35;function iP(t=Lm){return t===!1?t=0:t===!0&&(t=Lm),{x:$w(t,"left","right"),y:$w(t,"top","bottom")}}function $w(t,e,n){return{min:jw(t,e),max:jw(t,n)}}function jw(t,e){return typeof t=="number"?t:t[e]||0}const rP=new WeakMap;class sP{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=dt(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const c=g=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor($l(g).point)},u=(g,v)=>{const{drag:S,dragPropagation:w,onDragStart:T}=this.getProps();if(S&&!w&&(this.openDragLock&&this.openDragLock(),this.openDragLock=yz(S),!this.openDragLock))return;this.latestPointerEvent=g,this.latestPanInfo=v,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Bn($=>{let _=this.getAxisMotionValue($).get()||0;if(di.test(_)){const{projection:k}=this.visualElement;if(k&&k.layout){const C=k.layout.layoutBox[$];C&&(_=Wt(C)*(parseFloat(_)/100))}}this.originPoint[$]=_}),T&&We.postRender(()=>T(g,v)),jm(this.visualElement,"transform");const{animationState:D}=this.visualElement;D&&D.setActive("whileDrag",!0)},d=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:S,dragDirectionLock:w,onDirectionLock:T,onDrag:D}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:$}=v;if(w&&this.currentDirection===null){this.currentDirection=oP($),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",v.point,$),this.updateAxis("y",v.point,$),this.visualElement.render(),D&&D(g,v)},h=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v,this.stop(g,v),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>Bn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new tO(e,{onSessionStart:c,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:eO(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,c=this.isDragging;if(this.cancel(),!c||!o||!r)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&We.postRender(()=>d(r,o))}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:o}=this.getProps();if(!r||!cu(e,o,this.currentDirection))return;const c=this.getAxisMotionValue(e);let u=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(u=QK(u,this.constraints[e],this.elastic[e])),c.set(u)}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,o=this.constraints;e&&yo(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=WK(r.layoutBox,e):this.constraints=!1,this.elastic=iP(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bn(c=>{this.constraints!==!1&&this.getAxisMotionValue(c)&&(this.constraints[c]=nP(r.layoutBox[c],this.constraints[c]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!yo(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const c=aK(r,o.root,this.visualElement.getTransformPagePoint());let u=eP(o.layout.layoutBox,c);if(n){const d=n(rK(u));this.hasMutatedConstraints=!!d,d&&(u=UR(d))}return u}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:c,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=Bn(y=>{if(!cu(y,n,this.currentDirection))return;let g=h&&h[y]||{};u&&(g={min:0,max:0});const v=o?200:1e6,S=o?40:1e7,w={type:"inertia",velocity:r?e[y]:0,bounceStiffness:v,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...c,...g};return this.startAxisValueAnimation(y,w)});return Promise.all(p).then(d)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return jm(this.visualElement,e),r.start(dg(e,r,0,n,this.visualElement,!1))}stopAnimation(){Bn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){Bn(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(),o=r[n];return o||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){Bn(n=>{const{drag:r}=this.getProps();if(!cu(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,c=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];c.set(e[n]-it(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!yo(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bn(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=tP({min:h,max:h},this.constraints[u])}});const{transformTemplate:c}=this.visualElement.getProps();this.visualElement.current.style.transform=c?c({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Bn(u=>{if(!cu(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(it(h,p,o[u]))})}addListeners(){if(!this.visualElement.current)return;rP.set(this.visualElement,this);const e=this.visualElement.current,n=rl(e,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps();p&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();yo(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,c=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),We.read(r);const u=ml(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(Bn(y=>{const g=this.getAxisMotionValue(y);g&&(this.originPoint[y]+=h[y].translate,g.set(g.get()+h[y].translate))}),this.visualElement.render())});return()=>{u(),n(),c(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:c=!1,dragElastic:u=Lm,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:c,dragElastic:u,dragMomentum:d}}}function cu(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function oP(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class aP extends Br{constructor(e){super(e),this.removeGroupControls=Un,this.removeListeners=Un,this.controls=new sP(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Un}unmount(){this.removeGroupControls(),this.removeListeners()}}const Bw=t=>(e,n)=>{t&&We.postRender(()=>t(e,n))};class lP extends Br{constructor(){super(...arguments),this.removePointerDownListener=Un}onPointerDown(e){this.session=new tO(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:Bw(e),onStart:Bw(n),onMove:r,onEnd:(c,u)=>{delete this.session,o&&We.postRender(()=>o(c,u))}}}mount(){this.removePointerDownListener=rl(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 Au={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Lw(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(ye.test(t))t=parseFloat(t);else return t;const n=Lw(t,e.target.x),r=Lw(t,e.target.y);return`${n}% ${r}%`}},cP={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Nr.parse(t);if(o.length>5)return r;const c=Nr.createTransformer(t),u=typeof o[0]!="number"?1:0,d=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=d,o[1+u]/=h;const p=it(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),c(o)}};let Rp=!1;class uP extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:c}=e;Dz(fP),c&&(n.group&&n.group.add(c),r&&r.register&&o&&r.register(c),Rp&&c.root.didUpdate(),c.addEventListener("animationComplete",()=>{this.safeToRemove()}),c.setOptions({...c.options,onExitComplete:()=>this.safeToRemove()})),Au.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:c}=this.props,{projection:u}=r;return u&&(u.isPresent=c,Rp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==c?u.willUpdate():this.safeToRemove(),e.isPresent!==c&&(c?u.promote():u.relegate()||We.postRender(()=>{const d=u.getStack();(!d||!d.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ng.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Rp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),r&&r.deregister&&r.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function iO(t){const[e,n]=Ez(),r=V.useContext(jE);return Y.jsx(uP,{...t,layoutGroup:r,switchLayoutGroup:V.useContext(LR),isPresent:e,safeToRemove:n})}const fP={borderRadius:{...Ja,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ja,borderTopRightRadius:Ja,borderBottomLeftRadius:Ja,borderBottomRightRadius:Ja,boxShadow:cP};function dP(t,e,n){const r=Ft(t)?t:zo(t);return r.start(dg("",r,e,n)),r.animation}const hP=(t,e)=>t.depth-e.depth;class pP{constructor(){this.children=[],this.isDirty=!1}add(e){Ly(this.children,e),this.isDirty=!0}remove(e){Vy(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(hP),this.isDirty=!1,this.children.forEach(e)}}function mP(t,e){const n=un.now(),r=({timestamp:o})=>{const c=o-n;c>=e&&(Dr(r),t(c-e))};return We.setup(r,!0),()=>Dr(r)}const rO=["TopLeft","TopRight","BottomLeft","BottomRight"],yP=rO.length,Vw=t=>typeof t=="string"?parseFloat(t):t,Uw=t=>typeof t=="number"||ye.test(t);function gP(t,e,n,r,o,c){o?(t.opacity=it(0,n.opacity??1,bP(r)),t.opacityExit=it(e.opacity??1,0,vP(r))):c&&(t.opacity=it(e.opacity??1,n.opacity??1,r));for(let u=0;u<yP;u++){const d=`border${rO[u]}Radius`;let h=zw(e,d),p=zw(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||Uw(h)===Uw(p)?(t[d]=Math.max(it(Vw(h),Vw(p),r),0),(di.test(p)||di.test(h))&&(t[d]+="%")):t[d]=p}(e.rotate||n.rotate)&&(t.rotate=it(e.rotate||0,n.rotate||0,r))}function zw(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const bP=sO(0,.5,FE),vP=sO(.5,.95,Un);function sO(t,e,n){return r=>r<t?0:r>e?1:n(ul(t,e,r))}function Kw(t,e){t.min=e.min,t.max=e.max}function $n(t,e){Kw(t.x,e.x),Kw(t.y,e.y)}function Pw(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function qw(t,e,n,r,o){return t-=e,t=Zu(t,1/n,r),o!==void 0&&(t=Zu(t,1/o,r)),t}function SP(t,e=0,n=1,r=.5,o,c=t,u=t){if(di.test(e)&&(e=parseFloat(e),e=it(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=it(c.min,c.max,r);t===c&&(d-=e),t.min=qw(t.min,e,n,d,o),t.max=qw(t.max,e,n,d,o)}function Iw(t,e,[n,r,o],c,u){SP(t,e[n],e[r],e[o],e.scale,c,u)}const xP=["x","scaleX","originX"],wP=["y","scaleY","originY"];function Hw(t,e,n,r){Iw(t.x,e,xP,n?n.x:void 0,r?r.x:void 0),Iw(t.y,e,wP,n?n.y:void 0,r?r.y:void 0)}function Fw(t){return t.translate===0&&t.scale===1}function oO(t){return Fw(t.x)&&Fw(t.y)}function Gw(t,e){return t.min===e.min&&t.max===e.max}function TP(t,e){return Gw(t.x,e.x)&&Gw(t.y,e.y)}function Yw(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function aO(t,e){return Yw(t.x,e.x)&&Yw(t.y,e.y)}function Jw(t){return Wt(t.x)/Wt(t.y)}function Xw(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class AP{constructor(){this.members=[]}add(e){Ly(this.members,e),e.scheduleRender()}remove(e){if(Vy(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(o=>e===o);if(n===0)return!1;let r;for(let o=n;o>=0;o--){const c=this.members[o];if(c.isPresent!==!1){r=c;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:o}=e.options;o===!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 EP(t,e,n){let r="";const o=t.x.translate/e.x,c=t.y.translate/e.y,u=n?.z||0;if((o||c||u)&&(r=`translate3d(${o}px, ${c}px, ${u}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:p,rotate:y,rotateX:g,rotateY:v,skewX:S,skewY:w}=n;p&&(r=`perspective(${p}px) ${r}`),y&&(r+=`rotate(${y}deg) `),g&&(r+=`rotateX(${g}deg) `),v&&(r+=`rotateY(${v}deg) `),S&&(r+=`skewX(${S}deg) `),w&&(r+=`skewY(${w}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(r+=`scale(${d}, ${h})`),r||"none"}const Op=["","X","Y","Z"],RP=1e3;let OP=0;function _p(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function lO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=GR(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:c}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",We,!(o||c))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&lO(r)}function cO({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=OP++,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(MP),this.nodes.forEach($P),this.nodes.forEach(jP),this.nodes.forEach(CP)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=d?d.root||d:this,this.path=d?[...d.path,d]:[],this.parent=d,this.depth=d?d.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new pP)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Ky),this.eventHandlers.get(u).add(d)}notifyListeners(u,...d){const h=this.eventHandlers.get(u);h&&h.notify(...d)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=AR(u)&&!wz(u),this.instance=u;const{layoutId:d,layout:h,visualElement:p}=this.options;if(p&&!p.current&&p.mount(u),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(h||d)&&(this.isLayoutDirty=!0),t){let y,g=0;const v=()=>this.root.updateBlockedByResize=!1;We.read(()=>{g=window.innerWidth}),t(u,()=>{const S=window.innerWidth;S!==g&&(g=S,this.root.updateBlockedByResize=!0,y&&y(),y=mP(v,250),Au.hasAnimatedSinceResize&&(Au.hasAnimatedSinceResize=!1,this.nodes.forEach(Ww)))})}d&&this.root.registerSharedNode(d,this),this.options.animate!==!1&&p&&(d||h)&&this.addEventListener("didUpdate",({delta:y,hasLayoutChanged:g,hasRelativeLayoutChanged:v,layout:S})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const w=this.options.transition||p.getDefaultTransition()||zP,{onLayoutAnimationStart:T,onLayoutAnimationComplete:D}=p.getProps(),$=!this.targetLayout||!aO(this.targetLayout,S),_=!g&&v;if(this.options.layoutRoot||this.resumeFrom||_||g&&($||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...eg(w,"layout"),onPlay:T,onComplete:D};(p.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(y,_)}else g||Ww(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=S})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const u=this.getStack();u&&u.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Dr(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(BP),this.animationId++)}getTransformTemplate(){const{visualElement:u}=this.options;return u&&u.getProps().transformTemplate}willUpdate(u=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&lO(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:d,layout:h}=this.options;if(d===void 0&&!h)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),u&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(Zw);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(Qw);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(NP),this.nodes.forEach(_P),this.nodes.forEach(kP)):this.nodes.forEach(Qw),this.clearAllSnapshots();const d=un.now();Kt.delta=Yi(0,1e3/60,d-Kt.timestamp),Kt.timestamp=d,Kt.isProcessing=!0,yp.update.process(Kt),yp.preRender.process(Kt),yp.render.process(Kt),Kt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ng.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(DP),this.sharedNodes.forEach(LP)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,We.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){We.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 u=this.layout;this.layout=this.measure(!1),this.layoutCorrected=dt(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:d}=this.options;d&&d.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let d=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(d=!1),d&&this.instance){const h=r(this.instance);this.scroll={animationId:this.root.animationId,phase:u,isRoot:h,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:h}}}resetTransform(){if(!o)return;const u=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,d=this.projectionDelta&&!oO(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||rs(this.latestValues)||y)&&(o(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const d=this.measurePageBox();let h=this.removeElementScroll(d);return u&&(h=this.removeTransform(h)),KP(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return dt();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(PP))){const{scroll:p}=this.root;p&&(go(d.x,p.offset.x),go(d.y,p.offset.y))}return d}removeElementScroll(u){const d=dt();if($n(d,u),this.scroll?.wasRoot)return d;for(let h=0;h<this.path.length;h++){const p=this.path[h],{scroll:y,options:g}=p;p!==this.root&&y&&g.layoutScroll&&(y.wasRoot&&$n(d,u),go(d.x,y.offset.x),go(d.y,y.offset.y))}return d}applyTransform(u,d=!1){const h=dt();$n(h,u);for(let p=0;p<this.path.length;p++){const y=this.path[p];!d&&y.options.layoutScroll&&y.scroll&&y!==y.root&&bo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),rs(y.latestValues)&&bo(h,y.latestValues)}return rs(this.latestValues)&&bo(h,this.latestValues),h}removeTransform(u){const d=dt();$n(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!rs(p.latestValues))continue;Cm(p.latestValues)&&p.updateSnapshot();const y=dt(),g=p.measurePageBox();$n(y,g),Hw(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,y)}return rs(this.latestValues)&&Hw(d,this.latestValues),d}setTargetDelta(u){this.targetDelta=u,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(u){this.options={...this.options,...u,crossfade:u.crossfade!==void 0?u.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!==Kt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const d=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=d.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=d.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=d.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==d;if(!(u||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=Kt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),ol(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=dt(),this.targetWithTransforms=dt()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),YK(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$n(this.target,this.layout.layoutBox),KR(this.target,this.targetDelta)):$n(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const v=this.getClosestProjectingParent();v&&!!v.resumingFrom==!!this.resumingFrom&&!v.options.layoutScroll&&v.target&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=dt(),this.relativeTargetOrigin=dt(),ol(this.relativeTargetOrigin,this.target,v.target),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Cm(this.parent.latestValues)||zR(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 u=this.getLead(),d=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),d&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===Kt.timestamp&&(h=!1),h)return;const{layout:p,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||!(p||y))return;$n(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;oK(this.layoutCorrected,this.treeScale,this.path,d),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=dt());const{target:S}=u;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Pw(this.prevProjectionDelta.x,this.projectionDelta.x),Pw(this.prevProjectionDelta.y,this.projectionDelta.y)),sl(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!Xw(this.projectionDelta.x,this.prevProjectionDelta.x)||!Xw(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",S))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(u=!0){if(this.options.visualElement?.scheduleRender(),u){const d=this.getStack();d&&d.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vo(),this.projectionDelta=vo(),this.projectionDeltaWithTransform=vo()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},y={...this.latestValues},g=vo();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const v=dt(),S=h?h.source:void 0,w=this.layout?this.layout.source:void 0,T=S!==w,D=this.getStack(),$=!D||D.members.length<=1,_=!!(T&&!$&&this.options.crossfade===!0&&!this.path.some(UP));this.animationProgress=0;let k;this.mixTargetDelta=C=>{const O=C/1e3;e1(g.x,u.x,O),e1(g.y,u.y,O),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(ol(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),VP(this.relativeTarget,this.relativeTargetOrigin,v,O),k&&TP(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=dt()),$n(k,this.relativeTarget)),T&&(this.animationValues=y,gP(y,p,this.latestValues,O,_,$)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=O},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Dr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{Au.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=zo(0)),this.currentAnimation=dP(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),u.onUpdate&&u.onUpdate(d)},onStop:()=>{},onComplete:()=>{u.onComplete&&u.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 u=this.getStack();u&&u.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(RP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:d,target:h,layout:p,latestValues:y}=u;if(!(!d||!h||!p)){if(this!==u&&this.layout&&p&&uO(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||dt();const g=Wt(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+g;const v=Wt(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+v}$n(d,h),bo(d,y),sl(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new AP),this.sharedNodes.get(u).add(d);const p=d.options.initialPromotionConfig;d.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(d):void 0})}isLead(){const u=this.getStack();return u?u.lead===this:!0}getLead(){const{layoutId:u}=this.options;return u?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:u}=this.options;return u?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:u}=this.options;if(u)return this.root.sharedNodes.get(u)}promote({needsReset:u,transition:d,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),d&&this.setOptions({transition:d})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let d=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(d=!0),!d)return;const p={};h.z&&_p("z",u,p,this.animationValues);for(let y=0;y<Op.length;y++)_p(`rotate${Op[y]}`,u,p,this.animationValues),_p(`skew${Op[y]}`,u,p,this.animationValues);u.render();for(const y in p)u.setStaticValue(y,p[y]),this.animationValues&&(this.animationValues[y]=p[y]);u.scheduleRender()}applyProjectionStyles(u,d){if(!this.instance||this.isSVG)return;if(!this.isVisible){u.visibility="hidden";return}const h=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,u.visibility="",u.opacity="",u.pointerEvents=Tu(d?.pointerEvents)||"",u.transform=h?h(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(u.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,u.pointerEvents=Tu(d?.pointerEvents)||""),this.hasProjected&&!rs(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let g=EP(this.projectionDeltaWithTransform,this.treeScale,y);h&&(g=h(y,g)),u.transform=g;const{x:v,y:S}=this.projectionDelta;u.transformOrigin=`${v.origin*100}% ${S.origin*100}% 0`,p.animationValues?u.opacity=p===this?y.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:y.opacityExit:u.opacity=p===this?y.opacity!==void 0?y.opacity:"":y.opacityExit!==void 0?y.opacityExit:0;for(const w in pl){if(y[w]===void 0)continue;const{correct:T,applyTo:D,isCSSVariable:$}=pl[w],_=g==="none"?y[w]:T(y[w],p);if(D){const k=D.length;for(let C=0;C<k;C++)u[D[C]]=_}else $?this.options.visualElement.renderState.vars[w]=_:u[w]=_}this.options.layoutId&&(u.pointerEvents=p===this?Tu(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(Zw),this.root.sharedNodes.clear()}}}function _P(t){t.updateLayout()}function kP(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:o}=t.options,c=e.source!==t.layout.source;o==="size"?Bn(y=>{const g=c?e.measuredBox[y]:e.layoutBox[y],v=Wt(g);g.min=n[y].min,g.max=g.min+v}):uO(o,e.layoutBox,n)&&Bn(y=>{const g=c?e.measuredBox[y]:e.layoutBox[y],v=Wt(n[y]);g.max=g.min+v,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[y].max=t.relativeTarget[y].min+v)});const u=vo();sl(u,n,e.layoutBox);const d=vo();c?sl(d,t.applyTransform(r,!0),e.measuredBox):sl(d,n,e.layoutBox);const h=!oO(u);let p=!1;if(!t.resumeFrom){const y=t.getClosestProjectingParent();if(y&&!y.resumeFrom){const{snapshot:g,layout:v}=y;if(g&&v){const S=dt();ol(S,e.layoutBox,g.layoutBox);const w=dt();ol(w,n,v.layoutBox),aO(S,w)||(p=!0),y.options.layoutRoot&&(t.relativeTarget=w,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:d,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function MP(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 CP(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function DP(t){t.clearSnapshot()}function Zw(t){t.clearMeasurements()}function Qw(t){t.isLayoutDirty=!1}function NP(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function Ww(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $P(t){t.resolveTargetDelta()}function jP(t){t.calcProjection()}function BP(t){t.resetSkewAndRotation()}function LP(t){t.removeLeadSnapshot()}function e1(t,e,n){t.translate=it(e.translate,0,n),t.scale=it(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function t1(t,e,n,r){t.min=it(e.min,n.min,r),t.max=it(e.max,n.max,r)}function VP(t,e,n,r){t1(t.x,e.x,n.x,r),t1(t.y,e.y,n.y,r)}function UP(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const zP={duration:.45,ease:[.4,0,.1,1]},n1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),i1=n1("applewebkit/")&&!n1("chrome/")?Math.round:Un;function r1(t){t.min=i1(t.min),t.max=i1(t.max)}function KP(t){r1(t.x),r1(t.y)}function uO(t,e,n){return t==="position"||t==="preserve-aspect"&&!GK(Jw(e),Jw(n),.2)}function PP(t){return t!==t.root&&t.scroll?.wasRoot}const qP=cO({attachResizeListener:(t,e)=>ml(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),kp={current:void 0},fO=cO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!kp.current){const t=new qP({});t.mount(window),t.setOptions({layoutScroll:!0}),kp.current=t}return kp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),IP={pan:{Feature:lP},drag:{Feature:aP,ProjectionNode:fO,MeasureLayout:iO}};function s1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,c=r[o];c&&We.postRender(()=>c(e,$l(e)))}class HP extends Br{mount(){const{current:e}=this.node;e&&(this.unmount=gz(e,(n,r)=>(s1(this.node,r,"Start"),o=>s1(this.node,o,"End"))))}unmount(){}}class FP extends Br{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=Cl(ml(this.node.current,"focus",()=>this.onFocus()),ml(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function o1(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 o="onTap"+(n==="End"?"":n),c=r[o];c&&We.postRender(()=>c(e,$l(e)))}class GP extends Br{mount(){const{current:e}=this.node;e&&(this.unmount=xz(e,(n,r)=>(o1(this.node,r,"Start"),(o,{success:c})=>o1(this.node,o,c?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Vm=new WeakMap,Mp=new WeakMap,YP=t=>{const e=Vm.get(t.target);e&&e(t)},JP=t=>{t.forEach(YP)};function XP({root:t,...e}){const n=t||document;Mp.has(n)||Mp.set(n,{});const r=Mp.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(JP,{root:t,...e})),r[o]}function ZP(t,e,n){const r=XP(e);return Vm.set(t,n),r.observe(t),()=>{Vm.delete(t),r.unobserve(t)}}const QP={some:0,all:1};class WP extends Br{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:o="some",once:c}=e,u={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:QP[o]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,c&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:y,onViewportLeave:g}=this.node.getProps(),v=p?y:g;v&&v(h)};return ZP(this.node.current,u,d)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(eq(e,n))&&this.startObserver()}unmount(){}}function eq({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const tq={inView:{Feature:WP},tap:{Feature:GP},focus:{Feature:FP},hover:{Feature:HP}},nq={layout:{ProjectionNode:fO,MeasureLayout:iO}},iq={...KK,...tq,...IP,...nq},rq=iK(iq,yK);function sq(){const t=Yn(Uo),e=Yn(li),n=Yn(Pi),r=xt(Uo),o=xt(li),c=xt(Pi),u=`email-${V.useId()}`,d=`password-${V.useId()}`,h=`one-time-code-${V.useId()}`,[p,y]=V.useState(null),[g,v]=V.useState("email");return Y.jsx("form",{onSubmit:async S=>{S.preventDefault();const w=Ze(oi);try{switch(g){case"email":{const{nextStep:T,userKey:D}=await cn.declareAuthTarget.query({email:r});switch(De(oi,D),T){case"otc_login":case"otc_verify":{v("otc");break}case"password_login":{v("password");break}}break}case"otc":{if(!w){console.error("somehow userKey is null");return}const T=await cn.verifyAccountAction.mutate({oneTimeCode:c,userKey:w});De(lt,T),mi.once("connect",()=>{ms("/game"),t(""),n("")});break}case"password":{const T=await cn.openSession.mutate({email:r,password:o});De(lt,T),mi.once("connect",()=>{ms("/game"),t(""),e("")});break}}}catch(T){T instanceof Vo&&y(T.message)}},children:Y.jsxs("main",{children:[p?Y.jsx("aside",{children:p}):null,Y.jsxs(rq.label,{htmlFor:u,children:[Y.jsx("span",{children:"Email"}),Y.jsx("input",{id:u,type:"text",value:r,onChange:S=>{t(S.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?Y.jsxs("label",{htmlFor:d,children:[Y.jsx("span",{children:"Password"}),Y.jsx("input",{id:d,type:"password",value:o,onChange:S=>{e(S.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?Y.jsxs("label",{htmlFor:h,children:[Y.jsx("span",{children:"One-time Code"}),Y.jsx("input",{id:h,type:"otc",value:c,onChange:S=>{n(S.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,Y.jsxs("footer",{children:[g==="password"?Y.jsx("button",{type:"button",onClick:async()=>{const S=Ze(oi);if(!S)return new Error("No userKey");await cn.startPasswordReset.mutate({userKey:S}),v("otc")},children:"Forgot Password?"}):null,Y.jsx("span",{}),Y.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!c&&g==="otc",children:">>->"})]})]})})}function oq({route:[,t]}){const e=xt(lt),n=xt(Pi),r=Yn(Pi);jp.useState(!1);const[o,c]=jp.useState(null),u=`code-${V.useId()}`;if(_u(()=>{t&&r(t)}),!e)return Y.jsx("p",{children:"You must be logged in to verify your account."});const{verification:d}=e;return _u(()=>{n&&console.log("verifying token",n)}),Y.jsx("form",{onSubmit:async h=>{h.preventDefault();try{const p=await cn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(lt,p),p.action==="resetPassword"?ms("/account"):ms("/game")}catch(p){p instanceof Vo&&c(p.message)}},children:Y.jsxs("main",{children:[Y.jsx("p",{children:"Check your email for a verification code."}),Y.jsxs("label",{htmlFor:u,children:[Y.jsx("span",{children:"Verification code"}),Y.jsx("input",{id:u,type:"text",value:n,onChange:h=>{r(h.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})}function aq(){const t=xt(ME),e=xt(lt),[n,r]=V.useState(!1),{refs:o,floatingStyles:c,context:u}=ZD({open:n,onOpenChange:r,placement:"bottom-end",middleware:[wD(5),AD(),TD()],whileElementsMounted:pD}),d=FD(u),h=JD(u),p=eN(u),{getReferenceProps:y,getFloatingProps:g}=QD([d,h,p]),v=xt(WL);return Y.jsxs("main",{className:P3.class,children:[Y.jsxs("header",{children:[Y.jsxs("main",{children:[Y.jsx(K3,{}),Y.jsx("span",{children:Y.jsx(q3,{input:v})})]}),Y.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&Y.jsx(ID,{context:u,modal:!1,children:Y.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:c,...g(),children:[Y.jsx("span",{children:e.username}),Y.jsx("button",{type:"button",onClick:()=>{ms("/account")},children:"Account"}),Y.jsx("button",{type:"button",onClick:async()=>{e&&(await cn.closeSession.mutate({username:e.username}),mi.once("disconnect",()=>{De(lt,null),ms("/")}),mi.disconnect())},children:"Sign out"})]})})]}),Y.jsx("main",{children:typeof t=="number"?Y.jsxs("article",{children:[Y.jsx("h1",{children:t}),Y.jsx("h2",{children:JSON.parse(YA[t])}),Y.jsx(JA,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return Y.jsx(sq,{});case"admin":return Y.jsx(yU,{});case"game":return Y.jsx(TU,{route:t});case"verify":return Y.jsx(oq,{route:t});case"account":return Y.jsx(mU,{})}})()})]})}GM.createRoot(document.getElementById("root")).render(Y.jsx(V.StrictMode,{children:Y.jsx(UM,{socket:mi,children:Y.jsx(aq,{})})}));