tempest.games 0.2.47 → 0.2.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/app/assets/{index-C0taM2pq.js → index-BInxQBUV.js} +45 -45
- package/app/index.html +1 -1
- package/bin/backend.bun.js +99 -99
- package/bin/backend.worker.game.bun.js +5 -5
- package/bin/backend.worker.tribunal.bun.js +44 -44
- package/bin/frontend.bun.js +25 -25
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function Lk(t,e){for(var n=0;n<e.length;n++){const
|
|
1
|
+
function Lk(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 l=Object.getOwnPropertyDescriptor(r,o);l&&Object.defineProperty(t,o,l.get?l:{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 l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&r(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function r(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}})();function Vk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ph={exports:{}},Ha={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,19 +6,19 @@ function Lk(t,e){for(var n=0;n<e.length;n++){const s=e[n];if(typeof s!="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 aS;function Uk(){if(aS)return Ha;aS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var d in o)d!=="key"&&(l[d]=o[d])}else l=o;return o=l.ref,{$$typeof:t,type:s,key:u,ref:o!==void 0?o:null,props:l}}return Ha.Fragment=e,Ha.jsx=n,Ha.jsxs=n,Ha}var lS;function zk(){return lS||(lS=1,Ph.exports=Uk()),Ph.exports}var G=zk();function Kk(t){return Object.entries(t)}function Ns(t){return JSON.parse(t)}const Ge=t=>JSON.stringify(t);function ct(t){return of(Bt.STORE,t,void 0)}function p1(t){return ry(Bt.STORE,t,void 0)}function Ze(...t){return an(Bt.STORE,...t)}function qk(t,e){return jM(Bt.STORE,t,e)}function Pk(t){return LM(t,Bt.STORE)}const $s={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"},Ih=t=>(e,n,s,o,...l)=>{console[t](`${e} ${$s[n]} \`${s}\` ${o}`,...l)},Ik={error:Ih("error"),info:Ih("info"),warn:Ih("warn")};var Hk=class{logLevel;filter;logger;constructor(t,e,n=Ik){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{if(this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.error(...t):e&&this.logger.error(...e)}};info=(...t)=>{if(this.logLevel==="info"){const e=this.filter?.(...t)??!0;e===!0?this.logger.info(...t):e&&this.logger.info(...e)}};warn=(...t)=>{if(this.logLevel!=="error"&&this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.warn(...t):e&&this.logger.warn(...e)}}},Fk=class{store;deallocateTX;claimTX;constructor(t=Bt.STORE){this.store=t,this.deallocateTX=hM(t),this.claimTX=pM(t),dM("root",t)}allocate(t,e,n){Ym(this.store,t,e,n)}deallocate(t){ef(this.store,this.deallocateTX,Sl())(t)}claim(t,e,n){Ou(this.store,t,e,n)}};function hi(t){return M1(Bt.STORE,t)}function Gk(t){return CM(Bt.STORE,t)}function De(...t){kt(Bt.STORE,...t)}function Yk(t,e,n=Sl()){return DM(Bt.STORE,t,e,n)}function Xk(t){return nf(Bt.STORE,t)}function Jk(t,e=Sl()){return ef(Bt.STORE,t,e)}var Im=class du extends Set{mode="record";subject=new Qe;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(e,n=0){super(e),e instanceof du&&(this.parent=e,this.cacheUpdateNumber=e.cacheUpdateNumber),n&&(this.cacheLimit=n,this.cache=new Array(n),this.subscribe("auto cache",s=>{this.cacheIdx++,this.cacheIdx%=this.cacheLimit,this.cache[this.cacheIdx]=s}))}READONLY_VIEW=this;toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(e){const n=new du(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:${Ge(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:${Ge(e)}`)),n}parent=null;child=null;transactionUpdates=null;transaction(e){this.mode="transaction",this.transactionUpdates=[],this.child=new du(this);const n=this.child._subscribe("transaction",s=>{this.transactionUpdates?.push(s)});try{if(e(this.child)){for(const o of this.transactionUpdates)this.doStep(o);this.cacheUpdateNumber++,this.emit(`tx:${this.transactionUpdates.join(";")}`)}}catch(s){throw console.warn("Did not apply transaction to SetRTX; this error was thrown:",s),s}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,s=>{n(`${this.cacheUpdateNumber}=${s}`)})}emit(e){this.subject.next(e)}doStep(e){const n=e.indexOf(":"),s=e.substring(0,n),o=e.substring(n+1);switch(s){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 l of o.split(";"))this.doStep(l)}}getUpdateNumber(e){const n=e.indexOf("=");return Number(e.substring(0,n))}do(e){const n=e.indexOf("="),s=Number(e.substring(0,n)),o=s-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=s,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=s,null}return"OUT_OF_RANGE"}undoStep(e){const n=e.indexOf(":"),s=e.substring(0,n),o=e.substring(n+1);switch(s){case"add":this.delete(JSON.parse(o));break;case"del":this.add(JSON.parse(o));break;case"clear":{const l=JSON.parse(o);for(const u of l)this.add(u);break}case"tx":{const l=o.split(";");for(let u=l.length-1;u>=0;u--)this.undoStep(l[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 Sl(t=Math.random){return t().toString(36).slice(2)}function _e(t){for(;t.child!==null;)t=t.child;return t}function Zk(t){for(;t.parent!==null;)t=t.parent;return t}var Qk=class m1{_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 m1([...this._buffer]);return e._index=this._index,e}};function ks(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}const Wk=Symbol("counterfeit"),eM={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 cS(t,e,n){const s=Ge(e),o=`${t.key}(${s})`,l=eM[t.type],u={key:o,type:l,family:{key:t.key,subKey:s}};return n&&(u.counterfeit=!0),u}var In=class extends Map{deleted=new Set;changed=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t))return this.source.get(t)}set(t,e){return this.deleted.delete(t),this.source.has(t)&&this.changed.add(t),super.set(t,e)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)&&(this.deleted.add(t),this.changed.delete(t)),super.delete(t)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const[t,e]of this.source)!this.deleted.has(t)&&!this.changed.has(t)&&(yield[t,e])}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(const t of this.source.keys())!this.deleted.has(t)&&!this.changed.has(t)&&(yield t)}*values(){for(const[,t]of this[Symbol.iterator]())yield t}forEach(t){for(const[e,n]of this[Symbol.iterator]())t(n,e,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},y1=class extends Set{deleted=new Set;source;constructor(t){super(),this.source=t}add(t){return this.source.has(t)?(this.deleted.delete(t),this):super.add(t)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)?(this.deleted.add(t),!0):super.delete(t)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const t of this.source)this.deleted.has(t)||(yield t)}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},tM=class extends Map{deleted=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t)){const n=this.source.get(t),s=new y1(n);return super.set(t,s),s}}set(t,e){return this.deleted.delete(t),super.set(t,e)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.deleted.add(t),super.delete(t)}},ji=class g1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,n)=>`${e}:${n}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,n){let s=this.relations.get(e),o=this.relations.get(n);s?s.add(n):(s=new Set([n]),this.relations.set(e,s)),o?o.add(e):(o=new Set([e]),this.relations.set(n,o))}deleteRelation(e,n){const s=this.relations.get(e);if(s){s.delete(n),s.size===0&&this.relations.delete(e);const o=this.relations.get(n);o&&(o.delete(e),o.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(e,n){this.relations.set(e,new Set(n));for(const s of n){const o=new Set().add(e);this.relations.set(s,o)}}replaceRelationsSafely(e,n){const s=this.relations.get(e);let o=this.isAType?.(e)?e:void 0,l=o===void 0?e:void 0;if(s)for(const u of s){o??=u,l??=u;const d=this.relations.get(u);d&&(d.size===1?this.relations.delete(u):d.delete(e),this.contents.delete(this.makeContentKey(o,l)))}this.relations.set(e,new Set(n));for(const u of n){let d=this.relations.get(u);d?d.add(e):(d=new Set().add(e),this.relations.set(u,d))}}getContentInternal(e){return this.contents.get(e)}setContent(e,n){this.contents.set(e,n)}deleteContent(e){this.contents.delete(e)}constructor(e,n){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,this.isAType=n?.isAType??null,this.isBType=n?.isBType??null,this.isContent=n?.isContent??null,n?.makeContentKey&&(this.makeContentKey=n.makeContentKey),!n?.externalStore){const s=n?.source;s===void 0&&(this.relations=new Map(e.relations?.map(([o,l])=>[o,new Set(l)])),this.contents=new Map(e.contents)),s&&(this.relations=new tM(s.relations),this.contents=new In(s.contents))}if(n?.externalStore){const s=n.externalStore;this.has=(o,l)=>s.has(o,l),this.addRelation=(o,l)=>{s.addRelation(o,l)},this.deleteRelation=(o,l)=>{s.deleteRelation(o,l)},this.replaceRelationsSafely=(o,l)=>{s.replaceRelationsSafely(o,l)},this.replaceRelationsUnsafely=(o,l)=>{s.replaceRelationsUnsafely(o,l)},this.getRelatedKeys=(o=>s.getRelatedKeys(o)),s.getContent&&(this.getContentInternal=o=>s.getContent(o),this.setContent=(o,l)=>{s.setContent(o,l)},this.deleteContent=o=>{s.deleteContent(o)});for(const[o,l]of e.relations??[]){let u=this.isAType?.(o)?o:void 0,d=u===void 0?o:void 0;for(const h of l)u??=h,d??=h,this.addRelation(u,d)}for(const[o,l]of e.contents??[])this.setContent(o,l)}n?.warn&&(this.warn=n.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,n])=>[e,[...n]]),contents:[...this.contents.entries()]}}set(...e){let n,s,o;switch(e.length){case 1:{const l=e[0];n=l[this.a],s=l[this.b],o=void 0;break}case 2:{const l=e[0];typeof l=="string"?[n,s]=e:(n=l[this.a],s=l[this.b],o=e[1]);break}default:n=e[0],s=e[1],o=e[2];break}switch(this.cardinality){case"1:1":{const l=this.getRelatedKey(n);l&&l!==s&&this.delete(n,l)}case"1:n":{const l=this.getRelatedKey(s);l&&l!==n&&this.delete(l,s)}break}if(o){const l=this.makeContentKey(n,s);this.setContent(l,o)}return this.addRelation(n,s),this}delete(e,n){n=typeof n=="string"?n:e[this.b];const s=typeof e=="string"?e:e[this.a];if(s===void 0&&typeof n=="string"){const o=this.getRelatedKeys(n);if(o)for(const l of o)this.delete(l,n)}else if(typeof s=="string"&&n===void 0){const o=this.getRelatedKeys(s);if(o)for(const l of o)this.delete(s,l)}else if(typeof s=="string"&&typeof n=="string"){this.deleteRelation(s,n);const o=this.makeContentKey(s,n);this.deleteContent(o)}return this}getRelatedKey(e){const n=this.getRelatedKeys(e);if(n){n.size>1&&this.warn?.(`${n.size} related keys were found for key "${e}": (${[...n].map(o=>`"${o}"`).join(", ")}). Only one related key was expected.`);let s;for(const o of n){s=o;break}return s}}replaceRelations(e,n,s){const o=!Array.isArray(n),l=o?Object.keys(n):n;if(s?.reckless?this.replaceRelationsUnsafely(e,l):this.replaceRelationsSafely(e,l),o)for(const u of l){const d=this.makeContentKey(e,u),h=n[u];this.setContent(d,h)}return this}getContent(e,n){const s=this.makeContentKey(e,n);return this.getContentInternal(s)}getRelationEntries(e){const n=e[this.a],s=e[this.b];if(n!==void 0&&s===void 0){const o=this.getRelatedKeys(n);if(o)return[...o].map(l=>[l,this.getContent(n,l)])}if(n===void 0&&s!==void 0){const o=this.getRelatedKeys(s);if(o)return[...o].map(l=>[l,this.getContent(l,s)])}return[]}has(e,n){return n?this.getRelatedKeys(e)?.has(n)??!1:this.relations.has(e)}overlay(){const e={source:this,makeContentKey:this.makeContentKey};return this.isAType&&(e.isAType=this.isAType),this.isBType&&(e.isBType=this.isBType),this.isContent&&(e.isContent=this.isContent),this.warn&&(e.warn=this.warn),new g1({between:[this.a,this.b],cardinality:this.cardinality},e)}incorporate(e){const{relations:n,contents:s}=e;for(const[o,l]of n)if(l instanceof y1){const{source:u}=l;for(const d of l.iterateOwn())u.add(d)}else this.relations.set(o,l);for(const o of n.deleted)this.relations.delete(o);for(const[o,l]of s)this.contents.set(o,l);for(const o of s.deleted)this.contents.delete(o)}},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)}},nM=class extends Qe{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}};const iM=(t,e)=>{const n=_e(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)};function b1(t,e,n,s){const o=t.disposalTraces.buffer.find(l=>l?.key===Ge(s));switch(t.logger.error("❌",e.type,e.key,"gets a fallback value because key",s,"is not allocated",o?`This key was previously disposed:
|
|
10
|
-
${o.trace}`:"(no previous disposal trace found)"),n.type){case"mutable_atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const l=new n.class;return t.defaults.set(n.key,l),l}case"atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const l=n.default,u=l(
|
|
9
|
+
*/var aS;function Uk(){if(aS)return Ha;aS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,o,l){var u=null;if(l!==void 0&&(u=""+l),o.key!==void 0&&(u=""+o.key),"key"in o){l={};for(var f in o)f!=="key"&&(l[f]=o[f])}else l=o;return o=l.ref,{$$typeof:t,type:r,key:u,ref:o!==void 0?o:null,props:l}}return Ha.Fragment=e,Ha.jsx=n,Ha.jsxs=n,Ha}var lS;function zk(){return lS||(lS=1,Ph.exports=Uk()),Ph.exports}var G=zk();function Kk(t){return Object.entries(t)}function Nr(t){return JSON.parse(t)}const Ge=t=>JSON.stringify(t);function ct(t){return of(Bt.STORE,t,void 0)}function p1(t){return sy(Bt.STORE,t,void 0)}function Ze(...t){return ln(Bt.STORE,...t)}function qk(t,e){return jM(Bt.STORE,t,e)}function Pk(t){return LM(t,Bt.STORE)}const $r={atom_family:"atom family",atom:"atom",continuity:"continuity",key:"key",mutable_atom_family:"atom family [m]",mutable_atom:"atom [m]",readonly_held_selector_family:"selector family [h]",readonly_held_selector:"selector [h]",readonly_pure_selector_family:"selector family",readonly_pure_selector:"selector",state:"state",timeline:"timeline",transaction:"transaction",unknown:"unknown",writable_held_selector_family:"selector family [wh]",writable_held_selector:"selector [wh]",writable_pure_selector_family:"selector family [w]",writable_pure_selector:"selector [w]"},Ih=t=>(e,n,r,o,...l)=>{console[t](`${e} ${$r[n]} \`${r}\` ${o}`,...l)},Ik={error:Ih("error"),info:Ih("info"),warn:Ih("warn")};var Hk=class{logLevel;filter;logger;constructor(t,e,n=Ik){this.logLevel=t,this.filter=e,this.logger=n}error=(...t)=>{if(this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.error(...t):e&&this.logger.error(...e)}};info=(...t)=>{if(this.logLevel==="info"){const e=this.filter?.(...t)??!0;e===!0?this.logger.info(...t):e&&this.logger.info(...e)}};warn=(...t)=>{if(this.logLevel!=="error"&&this.logLevel!==null){const e=this.filter?.(...t)??!0;e===!0?this.logger.warn(...t):e&&this.logger.warn(...e)}}},Fk=class{store;deallocateTX;claimTX;constructor(t=Bt.STORE){this.store=t,this.deallocateTX=hM(t),this.claimTX=pM(t),dM("root",t)}allocate(t,e,n){Ym(this.store,t,e,n)}deallocate(t){ef(this.store,this.deallocateTX,Sl())(t)}claim(t,e,n){Ou(this.store,t,e,n)}};function pi(t){return M1(Bt.STORE,t)}function Gk(t){return CM(Bt.STORE,t)}function De(...t){kt(Bt.STORE,...t)}function Yk(t,e,n=Sl()){return DM(Bt.STORE,t,e,n)}function Xk(t){return nf(Bt.STORE,t)}function Jk(t,e=Sl()){return ef(Bt.STORE,t,e)}var Im=class du extends Set{mode="record";subject=new Qe;cacheLimit=0;cache=[];cacheIdx=-1;cacheUpdateNumber=-1;constructor(e,n=0){super(e),e instanceof du&&(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}))}READONLY_VIEW=this;toJSON(){return{members:[...this],cache:this.cache,cacheLimit:this.cacheLimit,cacheIdx:this.cacheIdx,cacheUpdateNumber:this.cacheUpdateNumber}}static fromJSON(e){const n=new du(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:${Ge(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:${Ge(e)}`)),n}parent=null;child=null;transactionUpdates=null;transaction(e){this.mode="transaction",this.transactionUpdates=[],this.child=new du(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 l of o.split(";"))this.doStep(l)}}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 l=JSON.parse(o);for(const u of l)this.add(u);break}case"tx":{const l=o.split(";");for(let u=l.length-1;u>=0;u--)this.undoStep(l[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 Sl(t=Math.random){return t().toString(36).slice(2)}function _e(t){for(;t.child!==null;)t=t.child;return t}function Zk(t){for(;t.parent!==null;)t=t.parent;return t}var Qk=class m1{_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 m1([...this._buffer]);return e._index=this._index,e}};function kr(t){const e={key:t.key,type:t.type};return"family"in t&&(e.family=t.family),e}const Wk=Symbol("counterfeit"),eM={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 cS(t,e,n){const r=Ge(e),o=`${t.key}(${r})`,l=eM[t.type],u={key:o,type:l,family:{key:t.key,subKey:r}};return n&&(u.counterfeit=!0),u}var Hn=class extends Map{deleted=new Set;changed=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t))return this.source.get(t)}set(t,e){return this.deleted.delete(t),this.source.has(t)&&this.changed.add(t),super.set(t,e)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)&&(this.deleted.add(t),this.changed.delete(t)),super.delete(t)}clear(){this.deleted=new Set(this.source.keys()),this.changed.clear(),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const[t,e]of this.source)!this.deleted.has(t)&&!this.changed.has(t)&&(yield[t,e])}*entries(){yield*this[Symbol.iterator]()}*keys(){yield*super.keys();for(const t of this.source.keys())!this.deleted.has(t)&&!this.changed.has(t)&&(yield t)}*values(){for(const[,t]of this[Symbol.iterator]())yield t}forEach(t){for(const[e,n]of this[Symbol.iterator]())t(n,e,this)}get size(){return super.size+this.source.size-this.changed.size-this.deleted.size}},y1=class extends Set{deleted=new Set;source;constructor(t){super(),this.source=t}add(t){return this.source.has(t)?(this.deleted.delete(t),this):super.add(t)}hasOwn(t){return super.has(t)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.source.has(t)?(this.deleted.add(t),!0):super.delete(t)}clear(){this.deleted=new Set(this.source),super.clear()}*[Symbol.iterator](){yield*super[Symbol.iterator]();for(const t of this.source)this.deleted.has(t)||(yield t)}*iterateOwn(){yield*super[Symbol.iterator]()}get size(){return super.size+this.source.size-this.deleted.size}},tM=class extends Map{deleted=new Set;source;constructor(t){super(),this.source=t}get(t){if(super.has(t))return super.get(t);if(!this.deleted.has(t)&&this.source.has(t)){const n=this.source.get(t),r=new y1(n);return super.set(t,r),r}}set(t,e){return this.deleted.delete(t),super.set(t,e)}has(t){return!this.deleted.has(t)&&(super.has(t)||this.source.has(t))}delete(t){return this.deleted.add(t),super.delete(t)}},Bi=class g1{a;b;cardinality;relations=new Map;contents=new Map;isAType;isBType;isContent;makeContentKey=(e,n)=>`${e}:${n}`;warn;getRelatedKeys(e){return this.relations.get(e)}addRelation(e,n){let r=this.relations.get(e),o=this.relations.get(n);r?r.add(n):(r=new Set([n]),this.relations.set(e,r)),o?o.add(e):(o=new Set([e]),this.relations.set(n,o))}deleteRelation(e,n){const r=this.relations.get(e);if(r){r.delete(n),r.size===0&&this.relations.delete(e);const o=this.relations.get(n);o&&(o.delete(e),o.size===0&&this.relations.delete(n))}}replaceRelationsUnsafely(e,n){this.relations.set(e,new Set(n));for(const r of n){const o=new Set().add(e);this.relations.set(r,o)}}replaceRelationsSafely(e,n){const r=this.relations.get(e);let o=this.isAType?.(e)?e:void 0,l=o===void 0?e:void 0;if(r)for(const u of r){o??=u,l??=u;const f=this.relations.get(u);f&&(f.size===1?this.relations.delete(u):f.delete(e),this.contents.delete(this.makeContentKey(o,l)))}this.relations.set(e,new Set(n));for(const u of n){let f=this.relations.get(u);f?f.add(e):(f=new Set().add(e),this.relations.set(u,f))}}getContentInternal(e){return this.contents.get(e)}setContent(e,n){this.contents.set(e,n)}deleteContent(e){this.contents.delete(e)}constructor(e,n){if(this.a=e.between[0],this.b=e.between[1],this.cardinality=e.cardinality,this.isAType=n?.isAType??null,this.isBType=n?.isBType??null,this.isContent=n?.isContent??null,n?.makeContentKey&&(this.makeContentKey=n.makeContentKey),!n?.externalStore){const r=n?.source;r===void 0&&(this.relations=new Map(e.relations?.map(([o,l])=>[o,new Set(l)])),this.contents=new Map(e.contents)),r&&(this.relations=new tM(r.relations),this.contents=new Hn(r.contents))}if(n?.externalStore){const r=n.externalStore;this.has=(o,l)=>r.has(o,l),this.addRelation=(o,l)=>{r.addRelation(o,l)},this.deleteRelation=(o,l)=>{r.deleteRelation(o,l)},this.replaceRelationsSafely=(o,l)=>{r.replaceRelationsSafely(o,l)},this.replaceRelationsUnsafely=(o,l)=>{r.replaceRelationsUnsafely(o,l)},this.getRelatedKeys=(o=>r.getRelatedKeys(o)),r.getContent&&(this.getContentInternal=o=>r.getContent(o),this.setContent=(o,l)=>{r.setContent(o,l)},this.deleteContent=o=>{r.deleteContent(o)});for(const[o,l]of e.relations??[]){let u=this.isAType?.(o)?o:void 0,f=u===void 0?o:void 0;for(const h of l)u??=h,f??=h,this.addRelation(u,f)}for(const[o,l]of e.contents??[])this.setContent(o,l)}n?.warn&&(this.warn=n.warn)}toJSON(){return{between:[this.a,this.b],cardinality:this.cardinality,relations:[...this.relations.entries()].map(([e,n])=>[e,[...n]]),contents:[...this.contents.entries()]}}set(...e){let n,r,o;switch(e.length){case 1:{const l=e[0];n=l[this.a],r=l[this.b],o=void 0;break}case 2:{const l=e[0];typeof l=="string"?[n,r]=e:(n=l[this.a],r=l[this.b],o=e[1]);break}default:n=e[0],r=e[1],o=e[2];break}switch(this.cardinality){case"1:1":{const l=this.getRelatedKey(n);l&&l!==r&&this.delete(n,l)}case"1:n":{const l=this.getRelatedKey(r);l&&l!==n&&this.delete(l,r)}break}if(o){const l=this.makeContentKey(n,r);this.setContent(l,o)}return this.addRelation(n,r),this}delete(e,n){n=typeof n=="string"?n:e[this.b];const r=typeof e=="string"?e:e[this.a];if(r===void 0&&typeof n=="string"){const o=this.getRelatedKeys(n);if(o)for(const l of o)this.delete(l,n)}else if(typeof r=="string"&&n===void 0){const o=this.getRelatedKeys(r);if(o)for(const l of o)this.delete(r,l)}else if(typeof r=="string"&&typeof n=="string"){this.deleteRelation(r,n);const o=this.makeContentKey(r,n);this.deleteContent(o)}return this}getRelatedKey(e){const n=this.getRelatedKeys(e);if(n){n.size>1&&this.warn?.(`${n.size} related keys were found for key "${e}": (${[...n].map(o=>`"${o}"`).join(", ")}). Only one related key was expected.`);let r;for(const o of n){r=o;break}return r}}replaceRelations(e,n,r){const o=!Array.isArray(n),l=o?Object.keys(n):n;if(r?.reckless?this.replaceRelationsUnsafely(e,l):this.replaceRelationsSafely(e,l),o)for(const u of l){const f=this.makeContentKey(e,u),h=n[u];this.setContent(f,h)}return this}getContent(e,n){const r=this.makeContentKey(e,n);return this.getContentInternal(r)}getRelationEntries(e){const n=e[this.a],r=e[this.b];if(n!==void 0&&r===void 0){const o=this.getRelatedKeys(n);if(o)return[...o].map(l=>[l,this.getContent(n,l)])}if(n===void 0&&r!==void 0){const o=this.getRelatedKeys(r);if(o)return[...o].map(l=>[l,this.getContent(l,r)])}return[]}has(e,n){return n?this.getRelatedKeys(e)?.has(n)??!1:this.relations.has(e)}overlay(){const e={source:this,makeContentKey:this.makeContentKey};return this.isAType&&(e.isAType=this.isAType),this.isBType&&(e.isBType=this.isBType),this.isContent&&(e.isContent=this.isContent),this.warn&&(e.warn=this.warn),new g1({between:[this.a,this.b],cardinality:this.cardinality},e)}incorporate(e){const{relations:n,contents:r}=e;for(const[o,l]of n)if(l instanceof y1){const{source:u}=l;for(const f of l.iterateOwn())u.add(f)}else this.relations.set(o,l);for(const o of n.deleted)this.relations.delete(o);for(const[o,l]of r)this.contents.set(o,l);for(const o of r.deleted)this.contents.delete(o)}},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)}},nM=class extends Qe{state;constructor(t){super(),this.state=t}next(t){this.state=t,super.next(t)}};const iM=(t,e)=>{const n=_e(t);return n.operation.open?n.operation.prev.get(e.key):n.valueMap.get(e.key)};function b1(t,e,n,r){const o=t.disposalTraces.buffer.find(l=>l?.key===Ge(r));switch(t.logger.error("❌",e.type,e.key,"gets a fallback value because key",r,"is not allocated",o?`This key was previously disposed:
|
|
10
|
+
${o.trace}`:"(no previous disposal trace found)"),n.type){case"mutable_atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const l=new n.class;return t.defaults.set(n.key,l),l.READONLY_VIEW}case"atom_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const l=n.default,u=l(r);return t.defaults.set(n.key,u),u}case"readonly_pure_selector_family":case"writable_pure_selector_family":case"readonly_held_selector_family":case"writable_held_selector_family":{if(t.defaults.has(n.key))return t.defaults.get(n.key);const l=n.default(r);return t.defaults.set(n.key,l),l}}}var jp=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(this!==t)if(t instanceof Promise){const e=t;this.fate=e,e.then(n=>{this.pass(e,n)},n=>{this.fail(e,n)})}else this.resolve(t),this.fate=void 0}};function ol(t){return"epoch"in t.transactionMeta}function wn(t){return"phase"in t.transactionMeta}function v1(t,e){if(t.operation.open){const n=performance.now();return t.logger.info("🚫",e.type,e.key,`deferring setState at T-${n} until setState for "${t.operation.token.key}" is done`),n}return t.operation={open:!0,done:new Set,prev:new Map,timestamp:Date.now(),token:e,subEvents:[]},t.logger.info("⭕",e.type,e.key,`operation start in store "${t.config.name}"${wn(t)?` ${t.transactionMeta.phase} "${t.transactionMeta.update.token.key}"`:""}`),t}function S1(t){t.operation.open&&t.logger.info("🔴",t.operation.token.type,t.operation.token.key,`operation done in store "${t.config.name}"`),t.operation={open:!1},t.on.operationClose.next(t.operation)}const w1=(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),Wu=(t,e)=>{if(!t.operation.open){t.logger.error("🐞","unknown",e,"markDone called outside of an operation. This is probably a bug in AtomIO.");return}t.operation.done.add(e)};function Hm(t,e){const n=_e(t),{key:r,type:o}=e,l=n.selectorAtoms.getRelatedKeys(r);if(n.logger.info("🧹",o,r,l?`evicting ${l.size} states downstream:`:"no downstream states",l??"to evict"),l){n.operation.open&&n.logger.info("🧹",o,r,`[ ${[...n.operation.done].join(", ")} ] already done`);for(const u of l)w1(n,u)||(T1(n,u),Wu(n,u))}}function x1(t,e){const n=_e(t),r=n.selectorGraph.getRelationEntries({upstreamSelectorKey:e}).filter(([o,{source:l}])=>l===e);for(const[o]of r)w1(n,o)||(T1(n,o),Wu(n,o),x1(t,o))}function sn(t,e,n){const{key:r,subject:o,type:l}=e,u=t.valueMap.get(r);if(u instanceof jp&&!u.done){const f=u;return n instanceof Promise?(f.use(n),f):(t.valueMap.set(r,n),n)}if(n instanceof Promise){const f=new jp(n);return t.valueMap.set(r,f),f.then(function(p){if(t.valueMap.get(r)===f){switch(v1(t,e),sn(t,e,p),l){case"atom":case"mutable_atom":Hm(t,e);break;case"readonly_pure_selector":case"writable_pure_selector":x1(t,r);break}S1(t),o.next({newValue:p,oldValue:f})}}).catch(h=>{t.logger.error("💥","state",r,"rejected:",h)}),f}return t.logger.info("📝",e.type,e.key,"writing to cache",n),t.valueMap.set(r,n),n}function rM(t,e,n){t.logger.info("📖",e.type,e.key,"reading cached value");let r=t.valueMap.get(e.key);if(n==="mut"&&e.type==="mutable_atom"&&wn(t)){const l=e,{parent:u}=t;if(t.valueMap.hasOwn(l.key))return r;const f=u.valueMap.get(l.key);t.logger.info("📃","atom",l.key,"copying");const h=f.toJSON(),p=l.class.fromJSON(h);t.valueMap.set(l.key,p),new ry(l,u),r=p}return r}function T1(t,e){const n=t.valueMap.get(e);if(n instanceof jp){const r=t.writableSelectors.get(e)??t.readonlySelectors.get(e);r&&r.getFrom(t);return}t.operation.open&&t.operation.prev.set(e,n),t.valueMap.delete(e),t.logger.info("🗑","state",e,"evicted")}const sM=/^\[object (?:Async|Generator|AsyncGenerator)?Function\]$/;function al(t){const e=Object.prototype.toString.call(t);return sM.test(e)}function gs(t,e,n){if(t.valueMap.has(e.key))return rM(t,e,n);t.logger.info("❔",e.type,e.key,"value not found in cache");const{key:r}=e;switch(e.type){case"readonly_held_selector":case"writable_held_selector":return t.logger.info("🧮",e.type,r,"computing value"),e.getFrom(t);case"readonly_pure_selector":case"writable_pure_selector":{let o;t.logger.info("🧮",e.type,r,"computing value");try{if(o=e.getFrom(t),o instanceof Promise)return o.catch(u=>{if(t.logger.error("💥",e.type,r,"rejected:",u),e.catch){for(const f of e.catch)if(u instanceof f)return sn(t,e,u)}throw u})}catch(u){if(t.logger.error("💥",e.type,r,"rejected:",u),e.catch){for(const f of e.catch)if(u instanceof f)return sn(t,e,u)}throw u}return sn(t,e,o)}case"atom":{let o;if(al(e.default))try{o=e.default(),o instanceof Promise&&(o=o.catch(u=>{if(t.logger.error("💥",e.type,r,"rejected:",u),e.catch){for(const f of e.catch)if(u instanceof f)return o=sn(t,e,u),o}throw u}))}catch(u){if(t.logger.error("💥",e.type,r,"rejected:",u),e.catch){for(const f of e.catch)if(u instanceof f)return o=sn(t,e,u),t.logger.info("✨",e.type,r,"computed default",o),o}throw u}else o=e.default,t.logger.info("✨",e.type,r,"using static default",o);return sn(t,e,o)}case"mutable_atom":{const o=new e.class;return t.logger.info("✨",e.type,r,"created new instance",o),sn(t,e,o)}}}function Fm(t,e){return lt(t,{key:e.family.key,type:`${e.type}_family`})}const ll=Symbol("MUST_CREATE");function cl(t,e,n,r){const o=Ge(n),l=t.molecules.get(o);if(!l&&t.config.lifespan==="immortal")return t.logger.warn("💣","key",o,"was used to mint a counterfeit token for",e.type,`"${e.key}"`),cS(e,n,Wk);let f;return r===ll?(t.logger.info("👪",e.type,e.key,"adds member",typeof n=="string"?`\`${n}\``:n),f=e(n),l&&t.moleculeData.set(o,e.key)):f=cS(e,n),f}const oM=t=>{t.logger.info("🪂","transaction",t.transactionMeta.update.token.key,"Aborting transaction"),t.parent.child=null};function ef(t,e,n){return(...r)=>lt(t,e).run(r,n)}function Bp(t,e){return al(t)?t(e):t}const Lp=(t,e,n)=>{const r=gs(t,e,"mut");let o=Bp(n,r);return t.logger.info("⭐","atom",e.key,"setting value",o),o=sn(t,e,o),Wu(t,e.key),Hm(t,e),{oldValue:r,newValue:o}};function uS(t,e){switch(e.type){case"mutable_atom":return Lp(t,e,new e.class);case"atom":{let n=e.default;return al(n)&&(n=n()),Lp(t,e,n)}}}function aM(t,e){let n;switch(e.type){case"atom":case"mutable_atom":n=uS(t,e);break;case"writable_pure_selector":case"writable_held_selector":{const r=e.getFrom(t),o=_u(t,e.key);for(const u of o.values()){const f=uS(t,u);_1(t,e,f,!1)}const l=e.getFrom(t);n={oldValue:r,newValue:l}}break}return n}function kt(t,...e){Jm(t,Up,...e)}const Vp=Symbol("RESET");function Gm(t,...e){const n=[...e,Vp];kt(t,...n)}function lM(t,e,n){let r,o,l;const{type:u,key:f}=e;switch(e.type){case"writable_pure_selector":r=gs(t,e,"mut"),o=Bp(n,r),o=sn(t,e,o);break;case"writable_held_selector":l=e.const,Bp(n,l),r=l,o=l}return t.logger.info("⭐",u,f,"setting to",o),Wu(t,f),e.setSelf(o),{oldValue:r,newValue:o}}const cM=(t,e,n)=>{let r;switch(e.type){case"atom":case"mutable_atom":r=Lp(t,e,n);break;case"writable_pure_selector":case"writable_held_selector":r=lM(t,e,n);break}return r};function uM(t,e,n){const{token:r,update:{newValue:o,oldValue:l}}=e;kt(t,r,n==="newValue"?o:l)}function fM(t){const{stack:e}=t;return e?`
|
|
11
11
|
`+e.split(`
|
|
12
12
|
`)?.slice(1)?.join(`
|
|
13
|
-
`):""}function dM(t,e=Bt.STORE){const n={key:t,stringKey:Ge(t),dependsOn:"any"};return e.molecules.set(Ge(t),n),t}function Ym(t,e,n,
|
|
13
|
+
`):""}function dM(t,e=Bt.STORE){const n={key:t,stringKey:Ge(t),dependsOn:"any"};return e.molecules.set(Ge(t),n),t}function Ym(t,e,n,r="any"){const o=e,l=Ge(n),u=[],f=_e(t);if(Array.isArray(o))for(const y of o){const g=Ge(y);f.molecules.get(g)?t.moleculeGraph.set(g,l,{source:g}):u.push(g)}else{const y=Ge(o);f.molecules.get(y)?t.moleculeGraph.set(y,l,{source:y}):u.push(y)}u.length===0&&f.molecules.set(l,{key:n,stringKey:l,dependsOn:r});const h={type:"molecule_creation",key:n,provenance:o,timestamp:Date.now()};wn(f)&&f.transactionMeta.phase==="building"?f.transactionMeta.update.subEvents.push(h):f.on.moleculeCreation.next(h);for(const y of u){const g=t.disposalTraces.buffer.find(v=>v?.key===y);t.logger.error("❌","key",n,"allocation failed:",`Could not allocate to ${y} in store "${t.config.name}".`,g?`
|
|
14
14
|
${y} was most recently disposed
|
|
15
|
-
${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function hM(t){return nf(t,{key:"[Internal] deallocate",do:(e,n)=>{tf(_e(t),n)}})}function tf(t,e){const n=Ge(e),
|
|
15
|
+
${g.trace}`:`No previous disposal trace for ${y} was found.`)}return n}function hM(t){return nf(t,{key:"[Internal] deallocate",do:(e,n)=>{tf(_e(t),n)}})}function tf(t,e){const n=Ge(e),r=t.molecules.get(n);if(!r){const v=t.disposalTraces.buffer.find(S=>S?.key===n);t.logger.error("❌","key",e,"deallocation failed:",`Could not find allocation for ${n} in store "${t.config.name}".`,v?`
|
|
16
16
|
This state was most recently deallocated
|
|
17
|
-
${v.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.moleculeJoins.getRelatedKeys(n);if(o)for(const v of o){const S=t.joins.get(v);S&&S.relations.delete(e)}t.moleculeJoins.delete(n);const l=[],u=[],
|
|
17
|
+
${v.trace}`:`No previous disposal trace for ${n} was found.`);return}const o=t.moleculeJoins.getRelatedKeys(n);if(o)for(const v of o){const S=t.joins.get(v);S&&S.relations.delete(e)}t.moleculeJoins.delete(n);const l=[],u=[],f=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:n});if(f)for(const[v,{source:S}]of f)if(S===n){const x=Nr(v);tf(t,x)}else l.push(S);const h=t.moleculeData.getRelatedKeys(r.stringKey);if(h)for(const v of h){const S=t.families.get(v),x=ln(t,S,e);u.push([S.key,x]),sf(t,S,e)}const p={type:"molecule_disposal",key:r.key,values:u,provenance:l,timestamp:Date.now()};t.molecules.delete(n);const y=wn(t)&&t.transactionMeta.phase==="building";y&&t.transactionMeta.update.subEvents.push(p),t.moleculeGraph.delete(r.stringKey),t.moleculeJoins.delete(r.stringKey),t.moleculeData.delete(r.stringKey),y||t.on.moleculeDisposal.next(p),t.molecules.delete(r.stringKey);const g=fM(new Error);t.disposalTraces.add({key:n,trace:g})}function pM(t){return nf(t,{key:"[Internal] claim",do:(e,n,r,o)=>{Ou(t,n,r,o)}})}function Ou(t,e,n,r){const o=Ge(n),l=_e(t),u=l.molecules.get(o);if(!u){const v=t.disposalTraces.buffer.find(S=>S?.key===o);return t.logger.error("❌","key",o,"claim failed:",`Could not allocate to ${o} in store "${t.config.name}".`,v?`
|
|
18
18
|
${o} was most recently disposed
|
|
19
|
-
${v.trace}`:`No previous disposal trace for ${o} was found.`),n}const
|
|
20
|
-
${
|
|
21
|
-
${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])=>Ns(v));s&&l.moleculeGraph.delete(o),l.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:u.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:u.key,exclusive:!!s,from:p,to:[h.key],timestamp:Date.now()};return Sn(l)&&l.transactionMeta.phase==="building"&&l.transactionMeta.update.subEvents.push(y),n}function mM(t,e,n){switch(n){case"newValue":A1(t,e);break;case"oldValue":rf(t,e.token);break}}function yM(t,e,n){switch(n){case"newValue":rf(t,e.token);break;case"oldValue":A1(t,e),e.subType==="atom"&&t.valueMap.set(e.token.key,e.value);break}}function A1(t,e){const{token:n}=e;e.subType==="writable"&&e.value?kt(t,n,e.value):an(t,n)}function gM(t,e,n){switch(n){case"newValue":Ym(t,e.provenance,e.key);break;case"oldValue":tf(t,e.key);break}}function bM(t,e,n){switch(n){case"newValue":tf(t,e.key);break;case"oldValue":{const s=e.provenance.map(Ns);Ym(t,s,e.key);for(const[o,l]of e.values){const u=t.families.get(o);if(u){an(t,u,e.key);const d=`${o}(${Ge(e.key)})`;t.valueMap.set(d,l)}}}break}}function vM(t,e,n){switch(n){case"newValue":for(const s of e.to)Ou(t,s,e.key,e.exclusive?"exclusive":void 0);break;case"oldValue":{let s="exclusive";for(const o of e.from)Ou(t,o,e.key,s),s=void 0}break}}function ho(t,e,n){const s=n==="newValue"?e.subEvents:[...e.subEvents].reverse();for(const o of s)switch(o.type){case"atom_update":uM(t,o,n);break;case"state_creation":mM(t,o,n);break;case"state_disposal":yM(t,o,n);break;case"molecule_creation":gM(t,o,n);break;case"molecule_disposal":bM(t,o,n);break;case"molecule_transfer":vM(t,o,n);break;case"transaction_outcome":ho(t,o,n);break}}function E1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function R1(t,e){return t.transactionMeta.epoch.get(e)}function SM(t,e){const n=E1(t,e);if(n!==void 0)return R1(t,n)}function Xm(t,e,n){t.transactionMeta.epoch.set(e,n)}function wM(t,e,n){const s=E1(t,e);s!==void 0&&t.transactionMeta.epoch.set(s,n)}function xM(t,e){const n=_e(t),{parent:s}=n;n.transactionMeta.phase="applying",n.transactionMeta.update.output=e,s.child=null,s.on.transactionApplying.next(n.transactionMeta);const{subEvents:o}=n.transactionMeta.update;t.logger.info("🛄","transaction",n.transactionMeta.update.token.key,`applying ${o.length} subEvents:`,o),ho(s,n.transactionMeta.update,"newValue"),ol(s)?(wM(s,n.transactionMeta.update.token.key,n.transactionMeta.update.epoch),lt(t,{key:n.transactionMeta.update.token.key,type:"transaction"})?.subject.next(n.transactionMeta.update),t.logger.info("🛬","transaction",n.transactionMeta.update.token.key,"applied")):Sn(s)&&s.transactionMeta.update.subEvents.push(n.transactionMeta.update),s.on.transactionApplying.next(null)}function O1(t,e,n){const{epoch:s,actionContinuities:o}=t.transactionMeta;o.set(e,n),s.has(e)||s.set(e,-1)}function TM(t){return{store:t}}const AM=(t,e,n,s)=>{const o=_e(t),l={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new In(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new In(o.families),joins:new In(o.joins),operation:{open:!1},readonlySelectors:new In(o.readonlySelectors),timelines:new In(o.timelines),timelineTopics:o.timelineTopics.overlay(),trackers:new Map,transactions:new In(o.transactions),selectorAtoms:o.selectorAtoms.overlay(),selectorGraph:o.selectorGraph.overlay(),writableSelectors:new In(o.writableSelectors),valueMap:new In(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new In(o.molecules),moleculeGraph:o.moleculeGraph.overlay(),moleculeData:o.moleculeData.overlay(),moleculeJoins:o.moleculeJoins.overlay(),miscResources:new In(o.miscResources)},u=SM(t,e.key),d={phase:"building",update:{type:"transaction_outcome",token:e,id:s,epoch:u===void 0?NaN:u+1,timestamp:Date.now(),subEvents:[],params:n,output:void 0},toolkit:{get:((...p)=>an(h,...p)),set:((...p)=>{kt(h,...p)}),reset:((...p)=>{Gm(h,...p)}),run:(p,y=Sl())=>ef(h,p,y),find:((...p)=>js(t,...p)),json:p=>br(h,p),dispose:((...p)=>{rf(h,...p)}),env:()=>TM(h)}},h=Object.assign(l,{transactionMeta:d});return o.child=h,t.logger.info("🛫","transaction",e.key,"building with params:",n),h};function nf(t,e){const{key:n}=e,s=t.transactions.has(n),o={key:n,type:"transaction",run:(d,h)=>{const p=ks(o),y=AM(t,p,d,h);try{const{toolkit:g}=y.transactionMeta,v=e.do(g,...d);return xM(y,v),v}catch(g){throw oM(y),t.logger.warn("💥","transaction",n,"caught:",g),g}},install:d=>nf(d,e),subject:new Qe};_e(t).transactions.set(n,o);const u=ks(o);return s||t.on.transactionCreation.next(u),u}function _1(t,e,{oldValue:n,newValue:s},o,l){const u=ks(e);if(o&&l){e.subject.next({newValue:s});const g={checkpoint:!0,type:"state_creation",subType:"writable",token:u,timestamp:Date.now(),value:s};t.operation.subEvents.push(g),l.subject.next(g);const S=_e(t);if(u.family)if(ol(S))switch(u.type){case"atom":case"mutable_atom":t.on.atomCreation.next(u);break;case"writable_pure_selector":case"writable_held_selector":t.on.selectorCreation.next(u);break}else Sn(S)&&S.on.transactionApplying.state===null&&S.transactionMeta.update.subEvents.push(g);return}const{key:d,subject:h,type:p}=e,y={oldValue:Hh(n)?n.READONLY_VIEW:n,newValue:Hh(s)?s.READONLY_VIEW:s};if(ol(t)){switch(p){case"mutable_atom":t.logger.info("📢",p,d,"is now (",s,") subscribers:",h.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":t.logger.info("📢",p,d,"went (",n,"->",s,") subscribers:",h.subscribers.keys())}h.next(y)}if(Sn(t)&&(p==="mutable_atom"||p==="atom")){if(t.on.transactionApplying.state===null){if(Hh(s))return;const{timestamp:g}=t.operation,v={type:"atom_update",token:u,timestamp:g,update:y};t.transactionMeta.update.subEvents.push(v),t.logger.info("📁","atom",d,"stowed (",n,"->",s,")");return}if(L1(e,"tracker:signal")){const g=d.slice(1),v=t.atoms.get(g);gr(t,v,"mut").do(y.newValue)===null===!0&&Hm(t,v)}}}const Up=Symbol("OWN_OP"),EM=Symbol("JOIN_OP");function Jm(t,e,...n){let s,o,l,u,d,h;n.length===2?(l=n[0],h=n[1],"family"in l&&(u=Fm(t,l),d=Ns(l.family.subKey),s=ul(t,u,d),s?l=s:l=o=cl(t,u,d,ll))):(u=lt(t,n[0]),d=n[1],h=n[2],s=ul(t,u,d),s?l=s:l=o=cl(t,u,d,ll));const p=h===Vp?"reset":"set";let y;if(e===Up){const x=v1(t,l);if(typeof x=="number"){const D=x,M=t.on.operationClose.subscribe(`waiting to ${p} "${l.key}" at T-${D}`,function(){M(),t.logger.info("🟢",l.type,l.key,"resuming deferred",p,`from T-${D}`),Jm(t,e,l,h)});return}y=x}else y=t;if("counterfeit"in l&&"family"in l){const x=l.family.subKey,T=t.disposalTraces.buffer.find(D=>D?.key===x);t.logger.error("❌",l.type,l.key,"could not be",p,"because key",x,"is not allocated.",T?`this key was previously disposed:${T.trace}`:"(no previous disposal trace found)");return}const g=lt(y,l);let v;h===Vp?v=aM(y,g):v=cM(y,g,h),_1(y,g,v,!!o,u),e===Up&&S1(y)}const k1=(t,e)=>_e(t).atoms.has(e),RM=(t,e)=>_e(t).writableSelectors.has(e),OM=(t,e)=>_e(t).readonlySelectors.has(e),_M=(t,e)=>k1(t,e)||RM(t,e)||OM(t,e);function fS(t,e){return _e(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([s,{source:o}])=>o!==e).map(([s,{source:o}])=>o).filter(s=>_M(t,s))}function _u(t,e,n=new Set){const s=fS(t,e),o=new Map;for(;s.length>0;){const l=s.pop();if(!n.has(l))if(n.add(l),k1(t,l)){const u=t.atoms.get(l);o.set(u.key,u)}else s.push(...fS(t,l))}return o}function kM(t,e,n,s,o){const l=_e(t),{type:u,key:d}=s;if(u==="atom"||u==="mutable_atom")l.selectorAtoms.set({selectorKey:n,atomKey:d}),t.logger.info("🔍",e,n,`discovers root atom "${d}"`);else{const h=_u(t,d,o);t.logger.info("🔍",e,n,`discovers root atoms: [ ${[...h.values()].map(p=>`"${p.key}"`).join(", ")} ]`);for(const{key:p}of h.values())l.selectorAtoms=l.selectorAtoms.set({selectorKey:n,atomKey:p})}o.add(d)}function sf(t,e,n,s){return{get:(...o)=>{const l=_e(t),{token:u,family:d,subKey:h}=iy(t,...o);let p;if("counterfeit"in u&&d&&h)p=b1(t,u,d,h);else{const y=lt(t,u);p=gr(t,y)}return t.logger.info("🔌",e,n,`registers dependency ( "${u.key}" =`,p,")"),l.selectorGraph.set({upstreamSelectorKey:u.key,downstreamSelectorKey:n},{source:u.key}),kM(t,e,n,u,s),p},set:((...o)=>{const l=_e(t);Jm(l,EM,...o)}),find:((...o)=>js(t,...o)),json:o=>br(t,o)}}function Zm(t,e,n){const s=_e(t),o=new Qe,l=new Set,{key:u,const:d}=e,h="readonly_held_selector";t.logger.info("🔨",h,u,"is being created");const{get:p,find:y,json:g}=sf(s,h,u,l),S={...e,type:h,subject:o,getFrom:T=>{const D=T.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[M,{source:O}]of D)O!==u&&T.selectorGraph.delete(M,u);return T.selectorAtoms.delete(u),e.get({get:p,find:y,json:g},d),zi(T,S,d),t.logger.info("✨",h,u,"=",d),l.clear(),d},install:T=>Zm(T,e,n)};n&&(S.family=n),s.readonlySelectors.set(u,S);const x={key:u,type:h};return n&&(x.family=n),x}function Qm(t,e,n){const s=_e(t),o=new Qe,l=new Set,u=e.key,d="readonly_pure_selector";t.logger.info("🔨",d,u,"is being created");const{get:h,find:p,json:y}=sf(s,d,u,l),v={...e,type:d,subject:o,getFrom:()=>{const x=_e(t),T=x.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[O,{source:C}]of T)C!==u&&x.selectorGraph.delete(O,u);x.selectorAtoms.delete(u);const D=e.get({get:h,find:p,json:y}),M=zi(x,v,D);return t.logger.info("✨",d,u,"=",M),l.clear(),M},install:x=>Qm(x,e,n)};n&&(v.family=n),s.readonlySelectors.set(u,v);const S={key:u,type:d};return n&&(S.family=n),S}function Wm(t,e,n){const s=_e(t),o=new Qe,l=new Set,{key:u,const:d}=e,h="writable_held_selector";t.logger.info("🔨",h,u,"is being created");const p=sf(s,h,u,l),{find:y,get:g,json:v}=p,S={find:y,get:g,json:v},D={...e,type:h,subject:o,getFrom:O=>{const C=O.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[j,{source:_}]of C)_!==u&&O.selectorGraph.delete(j,u);return O.selectorAtoms.delete(u),e.get(S,d),zi(O,D,d),t.logger.info("✨",h,u,"=",d),l.clear(),d},setSelf:()=>{e.set(p,d)},install:O=>Wm(O,e,n)};n&&(D.family=n),s.writableSelectors.set(u,D);const M={key:u,type:h};return n&&(M.family=n),M}function ey(t,e,n){const s=_e(t),o=new Qe,l=new Set,u=e.key,d="writable_pure_selector";t.logger.info("🔨",d,u,"is being created");const h=sf(s,d,u,l),{find:p,get:y,json:g}=h,v={find:p,get:y,json:g},T={...e,type:d,subject:o,getFrom:M=>{const O=M.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[_,{source:J}]of O)J!==u&&M.selectorGraph.delete(_,u);M.selectorAtoms.delete(u);const C=e.get(v),j=zi(M,T,C);return t.logger.info("✨",d,u,"=",j),l.clear(),j},setSelf:M=>{e.set(h,M)},install:M=>ey(M,e,n)};n&&(T.family=n),s.writableSelectors.set(u,T);const D={key:u,type:d};return n&&(D.family=n),D}function M1(t,e){const n="set"in e,s="const"in e;if(s&&n){const l=Wm(t,e,void 0);return t.on.selectorCreation.next(l),l}if(s){const l=Zm(t,e,void 0);return t.on.selectorCreation.next(l),l}if(n){const l=ey(t,e,void 0);return t.on.selectorCreation.next(l),l}const o=Qm(t,e,void 0);return t.on.selectorCreation.next(o),o}function MM(t,e){const n=_e(t),{key:s,type:o,family:l}=e;if(!l)t.logger.error("❌",o,s,"Standalone selectors cannot be disposed.");else{n.molecules.get(l.subKey)&&n.moleculeData.delete(l.subKey,l.key);let d;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(s),d={key:l.key,type:"writable_held_selector_family"},lt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"writable_pure_selector":n.writableSelectors.delete(s),d={key:l.key,type:"writable_pure_selector_family"},lt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_held_selector":n.readonlySelectors.delete(s),d={key:l.key,type:"readonly_held_selector_family"},lt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_pure_selector":n.readonlySelectors.delete(s),d={key:l.key,type:"readonly_pure_selector_family"},lt(t,d).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break}n.valueMap.delete(s),n.selectorAtoms.delete(s),n.selectorGraph.delete(s),n.moleculeData.delete(l.key,l.subKey),t.logger.info("🔥",e.type,s,"deleted"),Sn(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()}):t.on.selectorDisposal.next(e)}}function po(t,e,n){const s=e.key,o="readonly_pure_selector_family",l={key:s,type:o},u=t.families.get(s);u&&t.logger.error("❗",o,s,`Overwriting an existing ${$s[u.type]} "${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=Ge(y),v={key:s,subKey:g},S=`${s}(${g})`,x=_e(t);return Qm(x,{key:S,get:e.get(y)},v)},l,{internalRoles:n,subject:d,install:y=>po(y,e),default:y=>e.get(y)({get:((...v)=>an(t,...v)),find:((...v)=>js(t,...v)),json:v=>br(t,v)})});return t.families.set(s,p),l}function ty(t,e,n){const s={key:e.key,type:"atom_family"},o=t.families.get(e.key);o&&t.logger.error("❗","atom_family",e.key,`Overwriting an existing ${$s[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const l=new Qe,d=Object.assign(h=>{const p=Ge(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=_e(t),S=e.default,x={key:g,default:al(S)?()=>S(h):S};return e.effects&&(x.effects=e.effects(h)),of(v,x,y)},s,{default:e.default,subject:l,install:h=>ty(h,e),internalRoles:n});return t.families.set(e.key,d),al(e.default)===!1&&t.defaults.set(e.key,e.default),s}function C1(t,e,n){const s=e.key,o="readonly_held_selector_family",l={key:s,type:o},u=t.families.get(s);u&&t.logger.error("❗",o,s,`Overwriting an existing ${$s[u.type]} "${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=Ge(y),v={key:s,subKey:g},S=`${s}(${g})`,x=_e(t);return Zm(x,{key:S,const:e.const(y),get:e.get(y)},v)},l,{internalRoles:n,subject:d,install:y=>C1(y,e),default:e.const});return t.families.set(s,p),l}function D1(t,e,n){const s=e.key,o="writable_held_selector_family",l={key:s,type:o},u=t.families.get(s);u&&t.logger.error("❗",o,s,`Overwriting an existing ${$s[u.type]} "${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=Ge(y),v={key:s,subKey:g},S=`${s}(${g})`,x=_e(t);return Wm(x,{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},v)},l,{internalRoles:n,subject:d,install:y=>D1(y,e),default:e.const});return t.families.set(s,p),l}function ny(t,e,n){const s=e.key,o="writable_pure_selector_family",l={key:s,type:o},u=t.families.get(s);u&&t.logger.error("❗",o,s,`Overwriting an existing ${$s[u.type]} "${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=Ge(y),v={key:s,subKey:g},S=`${s}(${g})`,x=_e(t);return ey(x,{key:S,get:e.get(y),set:e.set(y)},v)},l,{internalRoles:n,subject:d,install:y=>ny(y,e),default:y=>e.get(y)({get:((...v)=>an(t,...v)),find:((...v)=>js(t,...v)),json:v=>br(t,v)})});return t.families.set(s,p),l}function CM(t,e){const n="set"in e,s="const"in e;return s&&n?D1(t,e,void 0):s?C1(t,e,void 0):n?ny(t,e):po(t,e)}function ul(t,e,n){const s=Ge(n),o=`${e.key}(${s})`,l=_e(t);let u;switch(e.type){case"atom_family":case"mutable_atom_family":u=l.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":u=l.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":u=l.readonlySelectors.get(o);break}return u&&ks(u)}function js(t,e,n){const s=lt(t,e),o=ul(t,e,n);return o||cl(t,s,n)}function rf(t,...e){let n;if(e.length===1)n=e[0];else{const s=e[0],o=e[1];n=js(t,s,o)}try{lt(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":oy(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":MM(t,n);break}}function iy(t,...e){let n,s,o,l,u;if(e.length===1){if(u=e[0],"family"in u){const p=Fm(t,u);if(o=lt(t,p),l=Ns(u.family.subKey),n=ul(t,p,l),"counterfeit"in u)return{token:u,family:o,subKey:l,isNew:!1};n?u=n:(s=cl(t,p,l,ll),u=s)}}else o=lt(t,e[0]),l=e[1],n=ul(t,o,l),n?u=n:(s=cl(t,o,l,ll),u=s);const d="counterfeit"in u;if(!!s&&d===!1&&o){let p;switch(u.type){case"readonly_pure_selector":case"readonly_held_selector":p="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":p="writable";break}const y={type:"state_creation",subType:p,token:u,timestamp:Date.now()};o.subject.next(y);const v=_e(t);if(u.family)if(ol(v))switch(u.type){case"atom":case"mutable_atom":t.on.atomCreation.next(u);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(u);break}else Sn(v)&&v.on.transactionApplying.state===null&&v.transactionMeta.update.subEvents.push(y)}return{token:u,family:o,subKey:l,isNew:!!s}}function an(t,...e){const{token:n,family:s,subKey:o}=iy(t,...e);if("counterfeit"in n&&s&&o)return b1(t,n,s,o);const l=lt(t,n);return gr(t,l)}const dS=(t,e,n)=>n.subject.subscribe(`${e.type}:${e.key}`,s=>{t.logger.info("📢",e.type,e.key,"root",n.key,"went",s.oldValue,"->",s.newValue);const o=iM(t,e),l=gr(t,e);t.logger.info("✨",e.type,e.key,"went",o,"->",l),e.subject.next({newValue:l,oldValue:o})});function ko(t,e,n,s){function o(g){if(t.operation.open){const v=t.on.operationClose.subscribe(`state subscription ${n}`,()=>{v(),s(g)})}else s(g)}iy(t,e);const l=lt(t,e);t.logger.info("👀",l.type,l.key,`Adding subscription "${n}"`);const u=l.type==="writable_pure_selector"||l.type==="readonly_pure_selector",d=new Map;let h=o;if(u){gr(t,l);for(const[g,v]of _u(t,l.key))d.set(g,dS(t,l,v));h=function(v){const S=_u(t,l.key);for(const[x,T]of d)S.get(x)?S.delete(x):(T(),d.delete(x));for(const[x,T]of S)d.set(x,dS(t,l,T));o(v)}}const p=l.subject.subscribe(n,h);return()=>{t.logger.info("🙈",l.type,l.key,`Removing subscription "${n}"`),p();for(const g of d.values())g()}}function lt(t,e){let n,s=t;for(;s!==null;){switch(e.type){case"atom":case"mutable_atom":n=s.atoms.get(e.key);break;case"writable_pure_selector":case"writable_held_selector":n=s.writableSelectors.get(e.key);break;case"readonly_pure_selector":case"readonly_held_selector":n=s.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=s.families.get(e.key);break;case"timeline":n=s.timelines.get(e.key);break;case"transaction":n=s.transactions.get(e.key);break}if(n)return n;s=s.child}throw new VM(e,t)}const N1=(t,e,n,s)=>{const o=lt(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const l=o.subject.subscribe(n,s);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),l()}},$1=(t,e,n,s)=>{const o=lt(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const l=o.subject.subscribe(n,s);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),l()}};function DM(t,e,n,s=Sl()){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 ko(t,e,s,n);case"transaction":return $1(t,e,s,n);case"timeline":return N1(t,e,s,n)}}var sy=class{initializeSignalAtom(t,e){const n=`*${t.key}`;e.atoms.delete(n),e.valueMap.delete(n);const s=t.family?{key:`*${t.family.key}`,subKey:t.family.subKey}:void 0,o=of(e,{key:n,default:null},s,["tracker:signal"]);if(e.parent?.valueMap.has(n)){const l=e.parent.valueMap.get(n);e.valueMap.set(n,l)}return o}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore(t,e,n){const s=t.key,o=n.config.name,l=Sn(n)?n.transactionMeta.update.token.key:"main",u=`tracker:${o}:${l}:${s}`,d=p=>{kt(n,e,p)},h=an(n,t);this.unsubscribeFromInnerValue=h.subscribe(u,d),this.unsubscribeFromState=ko(n,t,u,(function(y){y.newValue!==y.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=y.newValue.subscribe(u,d))}).bind(this))}supplySignalsToCore(t,e,n){const s=`tracker:${n.config.name}:${Sn(n)?n.transactionMeta.update.token.key:"main"}:${t.key}`;ko(n,e,s,function({newValue:l,oldValue:u}){const d=n.timelineTopics.getRelatedKey(e.key);if(d&&n.timelines.get(d)?.timeTraveling){const g=N1(n,{key:d,type:"timeline"},s,function(S){g(),kt(n,t,x=>(S==="redo"&&l?x.do(l):S==="undo"&&u&&x.undo(u),x))});return}const h=an(n,t),p=h.getUpdateNumber(l),y=p-h.cacheUpdateNumber;if(l&&y===1)kt(n,t,g=>(g.do(l),g));else{const g=h.cacheUpdateNumber+1;n.logger.info("❌","mutable_atom",t.key,"could not be updated. Expected update number",g,"but got",p)}})}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor(t,e){const n=_e(e),s=this.initializeSignalAtom(t,n);this.mutableAtomToken=t,this.latestSignalToken=s,this.captureSignalsFromCore(t,s,n),this.supplySignalsToCore(t,s,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function ry(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const s=_e(t),{key:o}=e,l=s.atoms.get(o),u="mutable_atom";if(l&&l.type===u)return t.logger.error("❌",u,o,"Tried to create atom, but it already exists in the store."),ks(l);const d=new Qe,h={...e,type:u,install:y=>(y.logger.info("🛠️","atom",o,`installing in store "${y.config.name}"`),ry(y,e,n)),subject:d};n&&(h.family=n),s.atoms.set(h.key,h);const p=ks(h);if(e.effects){let y=0;const g=[];for(const v of e.effects){const S=v({resetSelf:()=>{Gm(t,p)},setSelf:x=>{kt(t,p,x)},onSet:x=>ko(t,p,`effect[${y}]`,x)});S&&g.push(S),++y}h.cleanup=()=>{for(const v of g)v()}}return new sy(p,t),n||M1(t,{key:`${o}:JSON`,get:({get:y})=>y(p).toJSON(),set:({set:y},g)=>{y(p,e.class.fromJSON(g))}}),t.on.atomCreation.next(p),p}var NM=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(t,e){const n=ty(e,{key:`*${t.key}`,default:null},["mutable","updates"]);this.latestSignalAtoms=lt(e,n),this.mutableAtoms=t;const s=o=>{const{type:l,token:u}=o;if(u.family){const d=Ns(u.family.subKey);switch(l){case"state_creation":this.trackers.set(d,new sy(u,e));break;case"state_disposal":{const h=this.trackers.get(d);h&&(h[Symbol.dispose](),this.trackers.delete(d))}}}};this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,s)}};function j1(t,e,n){const s={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 ${$s[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const l=new Qe,d=Object.assign(h=>{const p=Ge(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=_e(t),S={key:g,class:e.class};return e.effects&&(S.effects=e.effects(h)),ry(v,S,y)},s,{class:e.class,subject:l,install:h=>j1(h,e),internalRoles:n});return t.families.set(e.key,d),ny(t,{key:`${e.key}:JSON`,get:h=>({get:p})=>p(s,h).toJSON(),set:h=>({set:p},y)=>{p(s,h,e.class.fromJSON(y))}},["mutable","json"]),new NM(d,t),s}const hS=(t,e)=>{const n=_e(e),s=`${t.key}:JSON`;return n.families.get(s)},br=(t,e)=>{if(e.family){const s=_e(t),l={key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"},u=lt(s,l),d=Ns(e.family.subKey);return js(t,u,d)}return{type:"writable_pure_selector",key:`${e.key}:JSON`}},B1=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function Hh(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t&&"cacheUpdateNumber"in t&&"getUpdateNumber"in t&&"READONLY_VIEW"in t&&"toJSON"in t}var $M=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 ji({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new ji({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 ji({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new ji({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Qk(100);molecules=new Map;moleculeJoins=new ji({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeGraph=new ji({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new ji({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 nM(null),operationClose:new Qe,moleculeCreation:new Qe,moleculeDisposal:new Qe};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new Hk("warn",(t,e,n)=>!UM(n))];logger={error:(...t)=>{for(const e of this.loggers)e.error(...t)},info:(...t)=>{for(const e of this.loggers)e.info(...t)},warn:(...t)=>{for(const e of this.loggers)e.warn(...t)}};constructor(t,e=null){if(this.config={...e?.config,...t},e!==null){this.operation={...e?.operation},ol(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new ji(e?.transactionMeta.actionContinuities.toJSON())});for(const[,s]of e.families)s.internalRoles?.includes("mutable")||s.internalRoles?.includes("join")||s.install(this);const n=new Set;for(const[,s]of e.atoms)if(!n.has(s.key)&&(s.install(this),s.type==="mutable_atom")){const o=br(e,s),l=B1(s);n.add(o.key),n.add(l.key)}for(const[,s]of e.readonlySelectors)s.install(this);for(const[,s]of e.writableSelectors)n.has(s.key)||s.install(this);for(const[,s]of e.transactions)s.install(this);for(const[,s]of e.timelines)s.install(this)}}};const Bt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new $M({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function of(t,e,n,s){const o="atom",{key:l}=e;t.logger.info("🔨",o,l,"is being created");const u=_e(t),d=u.atoms.get(l);if(d&&d.type===o)return t.logger.error("❌","atom",l,"Tried to create atom, but it already exists in the store."),ks(d);const h=new Qe,p={...e,type:o,install:g=>(g.logger.info("🛠️",o,l,`installing in store "${g.config.name}"`),of(g,e,n)),subject:h};n&&(p.family=n),s&&(p.internalRoles=s),u.atoms.set(l,p);const y=ks(p);if(e.effects){let g=0;const v=[];for(const S of e.effects){const x=S({resetSelf:()=>{Gm(t,y)},setSelf:T=>{kt(t,y,T)},onSet:T=>ko(t,y,`effect[${g}]`,T)});x&&v.push(x),++g}p.cleanup=()=>{for(const S of v)S()}}return t.on.atomCreation.next(y),y}function oy(t,e){const n=_e(t),{key:s,family:o}=e,l=lt(n,e);if(!o)t.logger.error("❌","atom",s,"Standalone atoms cannot be disposed.");else{l.cleanup?.();const u=t.valueMap.get(l.key),d=Fm(t,e),p=lt(t,d).subject,y={type:"state_disposal",subType:"atom",token:e,value:u,timestamp:Date.now()};p.next(y);const g=Sn(n);if(n.atoms.delete(s),n.valueMap.delete(s),n.selectorAtoms.delete(s),n.atomsThatAreDefault.delete(s),n.moleculeData.delete(o.key,o.subKey),t.timelineTopics.delete(s),e.type==="mutable_atom"){const v=B1(e);oy(t,v),t.trackers.delete(s)}if(t.logger.info("🔥","atom",s,"deleted"),g&&n.transactionMeta.phase==="building"){const v=n.transactionMeta.update.subEvents.at(-1),x=v?.type==="molecule_disposal"&&v.values.some(([D])=>D===l.family?.key),T=L1(l,"tracker:signal");!x&&!T&&n.transactionMeta.update.subEvents.push(y)}else t.on.atomDisposal.next(e)}}function L1(t,e){return"internalRoles"in t?t.internalRoles.includes(e):!1}function gn(t){return t[0].toUpperCase()+t.slice(1)}var V1=class{toolkit;options;defaultContent;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=Bt.STORE){this.store=n,this.realm=new Fk(n),this.options=t,this.defaultContent=e,this.store.miscResources.set(`join:${t.key}`,this),this.realm.allocate("root",t.key),this.toolkit={get:((...j)=>an(n,...j)),set:((...j)=>{kt(n,...j)}),find:((...j)=>js(n,...j)),json:j=>br(n,j)};const s=t.between[0],o=t.between[1],l=j1(n,{key:`${t.key}/relatedKeys`,class:Im},["join","relations"]);this.core={relatedKeysAtoms:l};const u=({get:j},_)=>j(l,_),d=({set:j},_,J)=>{this.store.molecules.has(Ge(_))||this.realm.allocate(t.key,_),j(l,_,Y=>Y.add(J)),j(l,J,Y=>Y.add(_))},h=({set:j},_,J)=>{j(l,_,se=>(se.delete(J),se)),j(l,J,se=>(se.delete(_),se));const[Y,F]=[_,J].sort(),ee=`${Y}:${F}`;this.store.moleculeJoins.delete(ee)},p=(j,_,J)=>{const{find:Y,get:F,set:ee}=j,se=Y(l,_),ue=F(se);for(const ge of ue)J.includes(ge)||ee(l,ge,Q=>(Q.delete(_),Q));ee(se,ge=>(ge.transaction(be=>{be.clear();for(const Q of J){const W=u(j,Q),B=W.has(_);if(this.relations.cardinality==="1:n"){const q=[];for(const z of W){if(z===_)continue;const ne=u(j,z);ne.delete(Q),ne.size===0&&q.push(z)}!B&&W.size>0&&W.clear();for(const z of q){const[ne,A]=[Q,z].sort(),P=`${ne}:${A}`;n.moleculeJoins.delete(P)}}B||W.add(_),be.add(Q)}return!0}),ge))},y=(j,_,J)=>{const{set:Y}=j;Y(l,_,F=>(F.transaction(ee=>{for(const se of J)ee.add(se);return!0}),F));for(const F of J)Y(l,F,ee=>(ee.add(_),ee));return!0},g=(j,_,J)=>{const Y=u(j,_);return J?Y.has(J):Y.size>0},v={getRelatedKeys:j=>u(this.toolkit,j),addRelation:(j,_)=>{this.store.moleculeJoins.set(`"${j}"`,t.key),this.store.moleculeJoins.set(`"${_}"`,t.key),d(this.toolkit,j,_)},deleteRelation:(j,_)=>{h(this.toolkit,j,_)},replaceRelationsSafely:(j,_)=>{p(this.toolkit,j,_)},replaceRelationsUnsafely:(j,_)=>{y(this.toolkit,j,_)},has:(j,_)=>g(this.toolkit,j,_)};let S,x;if(e){x=ty(n,{key:`${t.key}/content`,default:e},["join","content"]);const j=({get:Y},F)=>Y(x,F),_=({set:Y},F,ee)=>{Y(x,F,ee)};S=Object.assign(v,{getContent:Y=>j(this.toolkit,Y),setContent:(Y,F)=>{_(this.toolkit,Y,F)},deleteContent:Y=>{}})}else S=v;const T=new ji(t,{externalStore:S,isAType:t.isAType,isBType:t.isBType,makeContentKey:(...j)=>{const[_,J]=j,[Y,F]=j.sort(),ee=`${Y}:${F}`,se=n.molecules.get(Ge(_)),ue=n.molecules.get(Ge(J));return se||this.realm.allocate(t.key,_),ue||this.realm.allocate(t.key,J),this.realm.allocate(_,ee,"all"),this.realm.claim(J,ee),this.store.moleculeJoins.set(ee,t.key),ee}}),D=()=>po(n,{key:`${t.key}/singleRelatedKey`,get:j=>({get:_})=>{const J=_(l,j);for(const Y of J)return Y;return null}},["join","keys"]),M=()=>po(n,{key:`${t.key}/multipleRelatedKeys`,get:j=>({get:_})=>{const J=hS(l,n);return _(J,j).members}},["join","keys"]),O=()=>po(n,{key:`${t.key}/singleRelatedEntry`,get:j=>({get:_})=>{const J=_(l,j);for(const Y of J){let F=T.isAType?.(j)?j:void 0,ee=F===void 0?j:void 0;F??=Y,ee??=Y;const se=T.makeContentKey(F,ee),ue=_(x,se);return[Y,ue]}return null}},["join","entries"]),C=()=>po(n,{key:`${t.key}/multipleRelatedEntries`,get:j=>({get:_})=>{const J=hS(l,n);return _(J,j).members.map(F=>{let ee=T.isAType?.(j)?j:void 0,se=ee===void 0?j:void 0;ee??=F,se??=F;const ue=T.makeContentKey(ee,se),ge=_(x,ue);return[F,ge]})}},["join","entries"]);switch(t.cardinality){case"1:1":{const j=D(),_=`${s}KeyOf${gn(o)}`,J=`${o}KeyOf${gn(s)}`,Y={[_]:j,[J]:j};let F;if(e){const ee=O(),se=`${s}EntryOf${gn(o)}`,ue=`${o}EntryOf${gn(s)}`,ge={[se]:ee,[ue]:ee};F=Object.assign(Y,ge)}else F=Y;this.relations=T,this.states=F;break}case"1:n":{const j=D(),_=M(),J=`${s}KeyOf${gn(o)}`,Y=`${o}KeysOf${gn(s)}`,F={[J]:j,[Y]:_};let ee;if(e){const se=O(),ue=C(),ge=`${s}EntryOf${gn(o)}`,be=`${o}EntriesOf${gn(s)}`,Q={[ge]:se,[be]:ue};ee=Object.assign(F,Q)}else ee=F;this.relations=T,this.states=ee;break}case"n:n":{const j=M(),_=`${s}KeysOf${gn(o)}`,J=`${o}KeysOf${gn(s)}`,Y={[_]:j,[J]:j};let F;if(e){const ee=C(),se=`${s}EntriesOf${gn(o)}`,ue=`${o}EntriesOf${gn(s)}`,ge={[se]:ee,[ue]:ee};F=Object.assign(Y,ge)}else F=Y;this.relations=T,this.states=F}}}};function jM(t,e,n){return t.joins.set(e.key,new V1(e,n,t)),{key:e.key,type:"join",a:e.between[0],b:e.between[1],cardinality:e.cardinality}}function BM(t,e){let n=e.joins.get(t.key);if(n===void 0){const o=Bt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${e.config.name}"`);const l=Zk(e);n=new V1(o.options,o.defaultContent,l),e.joins.set(t.key,n)}return n}function LM(t,e){return BM(t,e).core.relatedKeysAtoms}var VM=class extends Error{constructor(t,e){super(`${$s[t.type]} ${Ge(t.key)} not found in store "${e.config.name}".`)}};function UM(t){return t.startsWith("🔍 ")}var Fh={exports:{}},Se={};/**
|
|
19
|
+
${v.trace}`:`No previous disposal trace for ${o} was found.`),n}const f=Ge(e),h=l.molecules.get(f);if(!h){const v=t.disposalTraces.buffer.find(S=>S?.key===f);return t.logger.error("❌","key",n,"claim failed:",`Could not allocate to ${f} in store "${t.config.name}".`,v?`
|
|
20
|
+
${f} was most recently disposed
|
|
21
|
+
${v.trace}`:`No previous disposal trace for ${f} was found.`),n}const p=t.moleculeGraph.getRelationEntries({downstreamMoleculeKey:u.stringKey}).filter(([,{source:v}])=>v!==o).map(([v])=>Nr(v));r&&l.moleculeGraph.delete(o),l.moleculeGraph.set({upstreamMoleculeKey:h.stringKey,downstreamMoleculeKey:u.stringKey},{source:h.stringKey});const y={type:"molecule_transfer",key:u.key,exclusive:!!r,from:p,to:[h.key],timestamp:Date.now()};return wn(l)&&l.transactionMeta.phase==="building"&&l.transactionMeta.update.subEvents.push(y),n}function mM(t,e,n){switch(n){case"newValue":A1(t,e);break;case"oldValue":sf(t,e.token);break}}function yM(t,e,n){switch(n){case"newValue":sf(t,e.token);break;case"oldValue":A1(t,e),e.subType==="atom"&&t.valueMap.set(e.token.key,e.value);break}}function A1(t,e){const{token:n}=e;e.subType==="writable"&&e.value?kt(t,n,e.value):ln(t,n)}function gM(t,e,n){switch(n){case"newValue":Ym(t,e.provenance,e.key);break;case"oldValue":tf(t,e.key);break}}function bM(t,e,n){switch(n){case"newValue":tf(t,e.key);break;case"oldValue":{const r=e.provenance.map(Nr);Ym(t,r,e.key);for(const[o,l]of e.values){const u=t.families.get(o);if(u){ln(t,u,e.key);const f=`${o}(${Ge(e.key)})`;t.valueMap.set(f,l)}}}break}}function vM(t,e,n){switch(n){case"newValue":for(const r of e.to)Ou(t,r,e.key,e.exclusive?"exclusive":void 0);break;case"oldValue":{let r="exclusive";for(const o of e.from)Ou(t,o,e.key,r),r=void 0}break}}function ho(t,e,n){const r=n==="newValue"?e.subEvents:[...e.subEvents].reverse();for(const o of r)switch(o.type){case"atom_update":uM(t,o,n);break;case"state_creation":mM(t,o,n);break;case"state_disposal":yM(t,o,n);break;case"molecule_creation":gM(t,o,n);break;case"molecule_disposal":bM(t,o,n);break;case"molecule_transfer":vM(t,o,n);break;case"transaction_outcome":ho(t,o,n);break}}function E1(t,e){return t.transactionMeta.actionContinuities.getRelatedKey(e)}function R1(t,e){return t.transactionMeta.epoch.get(e)}function SM(t,e){const n=E1(t,e);if(n!==void 0)return R1(t,n)}function Xm(t,e,n){t.transactionMeta.epoch.set(e,n)}function wM(t,e,n){const r=E1(t,e);r!==void 0&&t.transactionMeta.epoch.set(r,n)}function xM(t,e){const n=_e(t),{parent:r}=n;n.transactionMeta.phase="applying",n.transactionMeta.update.output=e,r.child=null,r.on.transactionApplying.next(n.transactionMeta);const{subEvents:o}=n.transactionMeta.update;t.logger.info("🛄","transaction",n.transactionMeta.update.token.key,`applying ${o.length} subEvents:`,o),ho(r,n.transactionMeta.update,"newValue"),ol(r)?(wM(r,n.transactionMeta.update.token.key,n.transactionMeta.update.epoch),lt(t,{key:n.transactionMeta.update.token.key,type:"transaction"})?.subject.next(n.transactionMeta.update),t.logger.info("🛬","transaction",n.transactionMeta.update.token.key,"applied")):wn(r)&&r.transactionMeta.update.subEvents.push(n.transactionMeta.update),r.on.transactionApplying.next(null)}function O1(t,e,n){const{epoch:r,actionContinuities:o}=t.transactionMeta;o.set(e,n),r.has(e)||r.set(e,-1)}function TM(t){return{store:t}}const AM=(t,e,n,r)=>{const o=_e(t),l={parent:o,child:null,on:o.on,loggers:o.loggers,logger:o.logger,config:o.config,atoms:new Hn(o.atoms),atomsThatAreDefault:new Set(o.atomsThatAreDefault),families:new Hn(o.families),joins:new Hn(o.joins),operation:{open:!1},readonlySelectors:new Hn(o.readonlySelectors),timelines:new Hn(o.timelines),timelineTopics:o.timelineTopics.overlay(),trackers:new Map,transactions:new Hn(o.transactions),selectorAtoms:o.selectorAtoms.overlay(),selectorGraph:o.selectorGraph.overlay(),writableSelectors:new Hn(o.writableSelectors),valueMap:new Hn(o.valueMap),defaults:o.defaults,disposalTraces:t.disposalTraces.copy(),molecules:new Hn(o.molecules),moleculeGraph:o.moleculeGraph.overlay(),moleculeData:o.moleculeData.overlay(),moleculeJoins:o.moleculeJoins.overlay(),miscResources:new Hn(o.miscResources)},u=SM(t,e.key),f={phase:"building",update:{type:"transaction_outcome",token:e,id:r,epoch:u===void 0?NaN:u+1,timestamp:Date.now(),subEvents:[],params:n,output:void 0},toolkit:{get:((...p)=>ln(h,...p)),set:((...p)=>{kt(h,...p)}),reset:((...p)=>{Gm(h,...p)}),run:(p,y=Sl())=>ef(h,p,y),find:((...p)=>jr(t,...p)),json:p=>bs(h,p),dispose:((...p)=>{sf(h,...p)}),env:()=>TM(h)}},h=Object.assign(l,{transactionMeta:f});return o.child=h,t.logger.info("🛫","transaction",e.key,"building with params:",n),h};function nf(t,e){const{key:n}=e,r=t.transactions.has(n),o={key:n,type:"transaction",run:(f,h)=>{const p=kr(o),y=AM(t,p,f,h);try{const{toolkit:g}=y.transactionMeta,v=e.do(g,...f);return xM(y,v),v}catch(g){throw oM(y),t.logger.warn("💥","transaction",n,"caught:",g),g}},install:f=>nf(f,e),subject:new Qe};_e(t).transactions.set(n,o);const u=kr(o);return r||t.on.transactionCreation.next(u),u}function _1(t,e,{oldValue:n,newValue:r},o,l){const u=kr(e);if(o&&l){e.subject.next({newValue:r});const g={checkpoint:!0,type:"state_creation",subType:"writable",token:u,timestamp:Date.now(),value:r};t.operation.subEvents.push(g),l.subject.next(g);const S=_e(t);if(u.family)if(ol(S))switch(u.type){case"atom":case"mutable_atom":t.on.atomCreation.next(u);break;case"writable_pure_selector":case"writable_held_selector":t.on.selectorCreation.next(u);break}else wn(S)&&S.on.transactionApplying.state===null&&S.transactionMeta.update.subEvents.push(g);return}const{key:f,subject:h,type:p}=e,y={oldValue:Hh(n)?n.READONLY_VIEW:n,newValue:Hh(r)?r.READONLY_VIEW:r};if(ol(t)){switch(p){case"mutable_atom":t.logger.info("📢",p,f,"is now (",r,") subscribers:",h.subscribers.keys());break;case"atom":case"writable_pure_selector":case"writable_held_selector":t.logger.info("📢",p,f,"went (",n,"->",r,") subscribers:",h.subscribers.keys())}h.next(y)}if(wn(t)&&(p==="mutable_atom"||p==="atom")){if(t.on.transactionApplying.state===null){if(Hh(r))return;const{timestamp:g}=t.operation,v={type:"atom_update",token:u,timestamp:g,update:y};t.transactionMeta.update.subEvents.push(v),t.logger.info("📁","atom",f,"stowed (",n,"->",r,")");return}if(L1(e,"tracker:signal")){const g=f.slice(1),v=t.atoms.get(g);gs(t,v,"mut").do(y.newValue)===null===!0&&Hm(t,v)}}}const Up=Symbol("OWN_OP"),EM=Symbol("JOIN_OP");function Jm(t,e,...n){let r,o,l,u,f,h;n.length===2?(l=n[0],h=n[1],"family"in l&&(u=Fm(t,l),f=Nr(l.family.subKey),r=ul(t,u,f),r?l=r:l=o=cl(t,u,f,ll))):(u=lt(t,n[0]),f=n[1],h=n[2],r=ul(t,u,f),r?l=r:l=o=cl(t,u,f,ll));const p=h===Vp?"reset":"set";let y;if(e===Up){const x=v1(t,l);if(typeof x=="number"){const D=x,M=t.on.operationClose.subscribe(`waiting to ${p} "${l.key}" at T-${D}`,function(){M(),t.logger.info("🟢",l.type,l.key,"resuming deferred",p,`from T-${D}`),Jm(t,e,l,h)});return}y=x}else y=t;if("counterfeit"in l&&"family"in l){const x=l.family.subKey,T=t.disposalTraces.buffer.find(D=>D?.key===x);t.logger.error("❌",l.type,l.key,"could not be",p,"because key",x,"is not allocated.",T?`this key was previously disposed:${T.trace}`:"(no previous disposal trace found)");return}const g=lt(y,l);let v;h===Vp?v=aM(y,g):v=cM(y,g,h),_1(y,g,v,!!o,u),e===Up&&S1(y)}const k1=(t,e)=>_e(t).atoms.has(e),RM=(t,e)=>_e(t).writableSelectors.has(e),OM=(t,e)=>_e(t).readonlySelectors.has(e),_M=(t,e)=>k1(t,e)||RM(t,e)||OM(t,e);function fS(t,e){return _e(t).selectorGraph.getRelationEntries({downstreamSelectorKey:e}).filter(([r,{source:o}])=>o!==e).map(([r,{source:o}])=>o).filter(r=>_M(t,r))}function _u(t,e,n=new Set){const r=fS(t,e),o=new Map;for(;r.length>0;){const l=r.pop();if(!n.has(l))if(n.add(l),k1(t,l)){const u=t.atoms.get(l);o.set(u.key,u)}else r.push(...fS(t,l))}return o}function kM(t,e,n,r,o){const l=_e(t),{type:u,key:f}=r;if(u==="atom"||u==="mutable_atom")l.selectorAtoms.set({selectorKey:n,atomKey:f}),t.logger.info("🔍",e,n,`discovers root atom "${f}"`);else{const h=_u(t,f,o);t.logger.info("🔍",e,n,`discovers root atoms: [ ${[...h.values()].map(p=>`"${p.key}"`).join(", ")} ]`);for(const{key:p}of h.values())l.selectorAtoms=l.selectorAtoms.set({selectorKey:n,atomKey:p})}o.add(f)}function rf(t,e,n,r){return{get:(...o)=>{const l=_e(t),{token:u,family:f,subKey:h}=iy(t,...o);let p;if("counterfeit"in u&&f&&h)p=b1(t,u,f,h);else{const y=lt(t,u);p=gs(t,y)}return t.logger.info("🔌",e,n,`registers dependency ( "${u.key}" =`,p,")"),l.selectorGraph.set({upstreamSelectorKey:u.key,downstreamSelectorKey:n},{source:u.key}),kM(t,e,n,u,r),p},set:((...o)=>{const l=_e(t);Jm(l,EM,...o)}),find:((...o)=>jr(t,...o)),json:o=>bs(t,o)}}function Zm(t,e,n){const r=_e(t),o=new Qe,l=new Set,{key:u,const:f}=e,h="readonly_held_selector";t.logger.info("🔨",h,u,"is being created");const{get:p,find:y,json:g}=rf(r,h,u,l),S={...e,type:h,subject:o,getFrom:T=>{const D=T.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[M,{source:O}]of D)O!==u&&T.selectorGraph.delete(M,u);return T.selectorAtoms.delete(u),e.get({get:p,find:y,json:g},f),sn(T,S,f),t.logger.info("✨",h,u,"=",f),l.clear(),f},install:T=>Zm(T,e,n)};n&&(S.family=n),r.readonlySelectors.set(u,S);const x={key:u,type:h};return n&&(x.family=n),x}function Qm(t,e,n){const r=_e(t),o=new Qe,l=new Set,u=e.key,f="readonly_pure_selector";t.logger.info("🔨",f,u,"is being created");const{get:h,find:p,json:y}=rf(r,f,u,l),v={...e,type:f,subject:o,getFrom:()=>{const x=_e(t),T=x.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[O,{source:C}]of T)C!==u&&x.selectorGraph.delete(O,u);x.selectorAtoms.delete(u);const D=e.get({get:h,find:p,json:y}),M=sn(x,v,D);return t.logger.info("✨",f,u,"=",M),l.clear(),M},install:x=>Qm(x,e,n)};n&&(v.family=n),r.readonlySelectors.set(u,v);const S={key:u,type:f};return n&&(S.family=n),S}function Wm(t,e,n){const r=_e(t),o=new Qe,l=new Set,{key:u,const:f}=e,h="writable_held_selector";t.logger.info("🔨",h,u,"is being created");const p=rf(r,h,u,l),{find:y,get:g,json:v}=p,S={find:y,get:g,json:v},D={...e,type:h,subject:o,getFrom:O=>{const C=O.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[j,{source:_}]of C)_!==u&&O.selectorGraph.delete(j,u);return O.selectorAtoms.delete(u),e.get(S,f),sn(O,D,f),t.logger.info("✨",h,u,"=",f),l.clear(),f},setSelf:()=>{e.set(p,f)},install:O=>Wm(O,e,n)};n&&(D.family=n),r.writableSelectors.set(u,D);const M={key:u,type:h};return n&&(M.family=n),M}function ey(t,e,n){const r=_e(t),o=new Qe,l=new Set,u=e.key,f="writable_pure_selector";t.logger.info("🔨",f,u,"is being created");const h=rf(r,f,u,l),{find:p,get:y,json:g}=h,v={find:p,get:y,json:g},T={...e,type:f,subject:o,getFrom:M=>{const O=M.selectorGraph.getRelationEntries({downstreamSelectorKey:u});for(const[_,{source:J}]of O)J!==u&&M.selectorGraph.delete(_,u);M.selectorAtoms.delete(u);const C=e.get(v),j=sn(M,T,C);return t.logger.info("✨",f,u,"=",j),l.clear(),j},setSelf:M=>{e.set(h,M)},install:M=>ey(M,e,n)};n&&(T.family=n),r.writableSelectors.set(u,T);const D={key:u,type:f};return n&&(D.family=n),D}function M1(t,e){const n="set"in e,r="const"in e;if(r&&n){const l=Wm(t,e,void 0);return t.on.selectorCreation.next(l),l}if(r){const l=Zm(t,e,void 0);return t.on.selectorCreation.next(l),l}if(n){const l=ey(t,e,void 0);return t.on.selectorCreation.next(l),l}const o=Qm(t,e,void 0);return t.on.selectorCreation.next(o),o}function MM(t,e){const n=_e(t),{key:r,type:o,family:l}=e;if(!l)t.logger.error("❌",o,r,"Standalone selectors cannot be disposed.");else{n.molecules.get(l.subKey)&&n.moleculeData.delete(l.subKey,l.key);let f;switch(e.type){case"writable_held_selector":n.writableSelectors.delete(r),f={key:l.key,type:"writable_held_selector_family"},lt(t,f).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"writable_pure_selector":n.writableSelectors.delete(r),f={key:l.key,type:"writable_pure_selector_family"},lt(t,f).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_held_selector":n.readonlySelectors.delete(r),f={key:l.key,type:"readonly_held_selector_family"},lt(t,f).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break;case"readonly_pure_selector":n.readonlySelectors.delete(r),f={key:l.key,type:"readonly_pure_selector_family"},lt(t,f).subject.next({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()});break}n.valueMap.delete(r),n.selectorAtoms.delete(r),n.selectorGraph.delete(r),n.moleculeData.delete(l.key,l.subKey),t.logger.info("🔥",e.type,r,"deleted"),wn(n)&&n.transactionMeta.phase==="building"?n.transactionMeta.update.subEvents.push({type:"state_disposal",subType:"selector",token:e,timestamp:Date.now()}):t.on.selectorDisposal.next(e)}}function po(t,e,n){const r=e.key,o="readonly_pure_selector_family",l={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${$r[u.type]} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new Qe,p=Object.assign(y=>{const g=Ge(y),v={key:r,subKey:g},S=`${r}(${g})`,x=_e(t),T={key:S,get:e.get(y)};return e.catch&&(T.catch=e.catch),Qm(x,T,v)},l,{internalRoles:n,subject:f,install:y=>po(y,e),default:y=>e.get(y)({get:((...v)=>ln(t,...v)),find:((...v)=>jr(t,...v)),json:v=>bs(t,v)}),...e.catch?{catch:e.catch}:{}});return t.families.set(r,p),l}function ty(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 ${$r[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const l=new Qe,f=Object.assign(h=>{const p=Ge(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=_e(t),S=e.default,x={key:g,default:al(S)?()=>S(h):S};return e.effects&&(x.effects=e.effects(h)),e.catch&&(x.catch=e.catch),of(v,x,y)},{...r,default:e.default,subject:l,install:h=>ty(h,e),internalRoles:n,...e.catch?{catch:e.catch}:{}});return t.families.set(e.key,f),al(e.default)===!1&&t.defaults.set(e.key,e.default),r}function C1(t,e,n){const r=e.key,o="readonly_held_selector_family",l={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${$r[u.type]} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new Qe,p=Object.assign(y=>{const g=Ge(y),v={key:r,subKey:g},S=`${r}(${g})`,x=_e(t);return Zm(x,{key:S,const:e.const(y),get:e.get(y)},v)},l,{internalRoles:n,subject:f,install:y=>C1(y,e),default:e.const});return t.families.set(r,p),l}function D1(t,e,n){const r=e.key,o="writable_held_selector_family",l={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${$r[u.type]} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new Qe,p=Object.assign(y=>{const g=Ge(y),v={key:r,subKey:g},S=`${r}(${g})`,x=_e(t);return Wm(x,{key:S,const:e.const(y),get:e.get(y),set:e.set(y)},v)},l,{internalRoles:n,subject:f,install:y=>D1(y,e),default:e.const});return t.families.set(r,p),l}function ny(t,e,n){const r=e.key,o="writable_pure_selector_family",l={key:r,type:o},u=t.families.get(r);u&&t.logger.error("❗",o,r,`Overwriting an existing ${$r[u.type]} "${u.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const f=new Qe,p=Object.assign(y=>{const g=Ge(y),v={key:r,subKey:g},S=`${r}(${g})`,x=_e(t),T={key:S,get:e.get(y),set:e.set(y)};return e.catch&&(T.catch=e.catch),ey(x,T,v)},l,{internalRoles:n,subject:f,install:y=>ny(y,e),default:y=>e.get(y)({get:((...v)=>ln(t,...v)),find:((...v)=>jr(t,...v)),json:v=>bs(t,v)}),...e.catch?{catch:e.catch}:{}});return t.families.set(r,p),l}function CM(t,e){const n="set"in e,r="const"in e;return r&&n?D1(t,e,void 0):r?C1(t,e,void 0):n?ny(t,e):po(t,e)}function ul(t,e,n){const r=Ge(n),o=`${e.key}(${r})`,l=_e(t);let u;switch(e.type){case"atom_family":case"mutable_atom_family":u=l.atoms.get(o);break;case"writable_held_selector_family":case"writable_pure_selector_family":u=l.writableSelectors.get(o);break;case"readonly_held_selector_family":case"readonly_pure_selector_family":u=l.readonlySelectors.get(o);break}return u&&kr(u)}function jr(t,e,n){const r=lt(t,e),o=ul(t,e,n);return o||cl(t,r,n)}function sf(t,...e){let n;if(e.length===1)n=e[0];else{const r=e[0],o=e[1];n=jr(t,r,o)}try{lt(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":oy(t,n);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":MM(t,n);break}}function iy(t,...e){let n,r,o,l,u;if(e.length===1){if(u=e[0],"family"in u){const p=Fm(t,u);if(o=lt(t,p),l=Nr(u.family.subKey),n=ul(t,p,l),"counterfeit"in u)return{token:u,family:o,subKey:l,isNew:!1};n?u=n:(r=cl(t,p,l,ll),u=r)}}else o=lt(t,e[0]),l=e[1],n=ul(t,o,l),n?u=n:(r=cl(t,o,l,ll),u=r);const f="counterfeit"in u;if(!!r&&f===!1&&o){let p;switch(u.type){case"readonly_pure_selector":case"readonly_held_selector":p="readable";break;case"atom":case"mutable_atom":case"writable_pure_selector":case"writable_held_selector":p="writable";break}const y={type:"state_creation",subType:p,token:u,timestamp:Date.now()};o.subject.next(y);const v=_e(t);if(u.family)if(ol(v))switch(u.type){case"atom":case"mutable_atom":t.on.atomCreation.next(u);break;case"writable_pure_selector":case"readonly_pure_selector":case"writable_held_selector":case"readonly_held_selector":t.on.selectorCreation.next(u);break}else wn(v)&&v.on.transactionApplying.state===null&&v.transactionMeta.update.subEvents.push(y)}return{token:u,family:o,subKey:l,isNew:!!r}}function ln(t,...e){const{token:n,family:r,subKey:o}=iy(t,...e);if("counterfeit"in n&&r&&o)return b1(t,n,r,o);const l=lt(t,n);return gs(t,l)}const dS=(t,e,n)=>n.subject.subscribe(`${e.type}:${e.key}`,r=>{t.logger.info("📢",e.type,e.key,"root",n.key,"went",r.oldValue,"->",r.newValue);const o=iM(t,e),l=gs(t,e);t.logger.info("✨",e.type,e.key,"went",o,"->",l),e.subject.next({newValue:l,oldValue:o})});function ko(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)}iy(t,e);const l=lt(t,e);t.logger.info("👀",l.type,l.key,`Adding subscription "${n}"`);const u=l.type==="writable_pure_selector"||l.type==="readonly_pure_selector",f=new Map;let h=o;if(u){gs(t,l);for(const[g,v]of _u(t,l.key))f.set(g,dS(t,l,v));h=function(v){const S=_u(t,l.key);for(const[x,T]of f)S.get(x)?S.delete(x):(T(),f.delete(x));for(const[x,T]of S)f.set(x,dS(t,l,T));o(v)}}const p=l.subject.subscribe(n,h);return()=>{t.logger.info("🙈",l.type,l.key,`Removing subscription "${n}"`),p();for(const g of f.values())g()}}function lt(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 N1=(t,e,n,r)=>{const o=lt(t,e);t.logger.info("👀","timeline",e.key,`Adding subscription "${n}"`);const l=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","timeline",e.key,`Removing subscription "${n}" from timeline`),l()}},$1=(t,e,n,r)=>{const o=lt(t,e);t.logger.info("👀","transaction",e.key,`Adding subscription "${n}"`);const l=o.subject.subscribe(n,r);return()=>{t.logger.info("🙈","transaction",e.key,`Removing subscription "${n}"`),l()}};function DM(t,e,n,r=Sl()){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 ko(t,e,r,n);case"transaction":return $1(t,e,r,n);case"timeline":return N1(t,e,r,n)}}var ry=class{initializeSignalAtom(t,e){const n=`*${t.key}`;e.atoms.delete(n),e.valueMap.delete(n);const r=t.family?{key:`*${t.family.key}`,subKey:t.family.subKey}:void 0,o=of(e,{key:n,default:null},r,["tracker:signal"]);if(e.parent?.valueMap.has(n)){const l=e.parent.valueMap.get(n);e.valueMap.set(n,l)}return o}unsubscribeFromInnerValue;unsubscribeFromState;captureSignalsFromCore(t,e,n){const r=t.key,o=n.config.name,l=wn(n)?n.transactionMeta.update.token.key:"main",u=`tracker:${o}:${l}:${r}`,f=p=>{kt(n,e,p)},h=ln(n,t);this.unsubscribeFromInnerValue=h.subscribe(u,f),this.unsubscribeFromState=ko(n,t,u,(function(y){y.newValue!==y.oldValue&&(this.unsubscribeFromInnerValue(),this.unsubscribeFromInnerValue=y.newValue.subscribe(u,f))}).bind(this))}supplySignalsToCore(t,e,n){const r=`tracker:${n.config.name}:${wn(n)?n.transactionMeta.update.token.key:"main"}:${t.key}`;ko(n,e,r,function({newValue:l,oldValue:u}){const f=n.timelineTopics.getRelatedKey(e.key);if(f&&n.timelines.get(f)?.timeTraveling){const g=N1(n,{key:f,type:"timeline"},r,function(S){g(),kt(n,t,x=>(S==="redo"&&l?x.do(l):S==="undo"&&u&&x.undo(u),x))});return}const h=ln(n,t),p=h.getUpdateNumber(l),y=p-h.cacheUpdateNumber;if(l&&y===1)kt(n,t,g=>(g.do(l),g));else{const g=h.cacheUpdateNumber+1;n.logger.info("❌","mutable_atom",t.key,"could not be updated. Expected update number",g,"but got",p)}})}mutableAtomToken;latestSignalToken;[Symbol.dispose];constructor(t,e){const n=_e(e),r=this.initializeSignalAtom(t,n);this.mutableAtomToken=t,this.latestSignalToken=r,this.captureSignalsFromCore(t,r,n),this.supplySignalsToCore(t,r,n),n.trackers.set(t.key,this),this[Symbol.dispose]=()=>{this.unsubscribeFromInnerValue(),this.unsubscribeFromState(),n.trackers.delete(t.key)}}};function sy(t,e,n){t.logger.info("🔨","atom",e.key,`creating in store "${t.config.name}"`);const r=_e(t),{key:o}=e,l=r.atoms.get(o),u="mutable_atom";if(l&&l.type===u)return t.logger.error("❌",u,o,"Tried to create atom, but it already exists in the store."),kr(l);const f=new Qe,h={...e,type:u,install:y=>(y.logger.info("🛠️","atom",o,`installing in store "${y.config.name}"`),sy(y,e,n)),subject:f};n&&(h.family=n),r.atoms.set(h.key,h);const p=kr(h);if(e.effects){let y=0;const g=[];for(const v of e.effects){const S=v({resetSelf:()=>{Gm(t,p)},setSelf:x=>{kt(t,p,x)},onSet:x=>ko(t,p,`effect[${y}]`,x)});S&&g.push(S),++y}h.cleanup=()=>{for(const v of g)v()}}return new ry(p,t),n||M1(t,{key:`${o}:JSON`,get:({get:y})=>y(p).toJSON(),set:({set:y},g)=>{y(p,e.class.fromJSON(g))}}),t.on.atomCreation.next(p),p}var NM=class{trackers=new Map;latestSignalAtoms;mutableAtoms;constructor(t,e){const n=ty(e,{key:`*${t.key}`,default:null},["mutable","updates"]);this.latestSignalAtoms=lt(e,n),this.mutableAtoms=t;const r=o=>{const{type:l,token:u}=o;if(u.family){const f=Nr(u.family.subKey);switch(l){case"state_creation":this.trackers.set(f,new ry(u,e));break;case"state_disposal":{const h=this.trackers.get(f);h&&(h[Symbol.dispose](),this.trackers.delete(f))}}}};this.mutableAtoms.subject.subscribe(`store=${e.config.name}::tracker-atom-family`,r)}};function j1(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 ${$r[o.type]} "${o.key}" in store "${t.config.name}". You can safely ignore this warning if it is due to hot module replacement.`);const l=new Qe,f=Object.assign(h=>{const p=Ge(h),y={key:e.key,subKey:p},g=`${e.key}(${p})`,v=_e(t),S={key:g,class:e.class};return e.effects&&(S.effects=e.effects(h)),sy(v,S,y)},r,{class:e.class,subject:l,install:h=>j1(h,e),internalRoles:n});return t.families.set(e.key,f),ny(t,{key:`${e.key}:JSON`,get:h=>({get:p})=>p(r,h).toJSON(),set:h=>({set:p},y)=>{p(r,h,e.class.fromJSON(y))}},["mutable","json"]),new NM(f,t),r}const hS=(t,e)=>{const n=_e(e),r=`${t.key}:JSON`;return n.families.get(r)},bs=(t,e)=>{if(e.family){const r=_e(t),l={key:`${e.family.key}:JSON`,type:"writable_pure_selector_family"},u=lt(r,l),f=Nr(e.family.subKey);return jr(t,u,f)}return{type:"writable_pure_selector",key:`${e.key}:JSON`}},B1=t=>{const n={type:"atom",key:`*${t.key}`};return t.family&&(n.family={key:`*${t.family.key}`,subKey:t.family.subKey}),n};function Hh(t){return typeof t=="object"&&t!==null&&"do"in t&&"undo"in t&&"subscribe"in t&&"cacheUpdateNumber"in t&&"getUpdateNumber"in t&&"READONLY_VIEW"in t&&"toJSON"in t}var $M=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 Bi({between:["selectorKey","atomKey"],cardinality:"n:n"});selectorGraph=new Bi({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 Bi({between:["continuity","action"],cardinality:"1:n"})};timelines=new Map;timelineTopics=new Bi({between:["timelineKey","topicKey"],cardinality:"1:n"});disposalTraces=new Qk(100);molecules=new Map;moleculeJoins=new Bi({between:["moleculeKey","joinKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeGraph=new Bi({between:["upstreamMoleculeKey","downstreamMoleculeKey"],cardinality:"n:n"},{makeContentKey:(...t)=>t.sort().join(":")});moleculeData=new Bi({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 nM(null),operationClose:new Qe,moleculeCreation:new Qe,moleculeDisposal:new Qe};operation={open:!1};config={name:"IMPLICIT_STORE",lifespan:"ephemeral"};loggers=[new Hk("warn",(t,e,n)=>!UM(n))];logger={error:(...t)=>{for(const e of this.loggers)e.error(...t)},info:(...t)=>{for(const e of this.loggers)e.info(...t)},warn:(...t)=>{for(const e of this.loggers)e.warn(...t)}};constructor(t,e=null){if(this.config={...e?.config,...t},e!==null){this.operation={...e?.operation},ol(e)&&(this.transactionMeta={epoch:new Map(e?.transactionMeta.epoch),actionContinuities:new Bi(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=bs(e,r),l=B1(r);n.add(o.key),n.add(l.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 Bt={get STORE(){return globalThis.ATOM_IO_IMPLICIT_STORE??=new $M({name:"IMPLICIT_STORE",lifespan:"ephemeral"}),globalThis.ATOM_IO_IMPLICIT_STORE}};function of(t,e,n,r){const o="atom",{key:l}=e;t.logger.info("🔨",o,l,"is being created");const u=_e(t),f=u.atoms.get(l);if(f&&f.type===o)return t.logger.error("❌","atom",l,"Tried to create atom, but it already exists in the store."),kr(f);const h=new Qe,p={...e,type:o,install:g=>(g.logger.info("🛠️",o,l,`installing in store "${g.config.name}"`),of(g,e,n)),subject:h};n&&(p.family=n),r&&(p.internalRoles=r),u.atoms.set(l,p);const y=kr(p);if(e.effects){let g=0;const v=[];for(const S of e.effects){const x=S({resetSelf:()=>{Gm(t,y)},setSelf:T=>{kt(t,y,T)},onSet:T=>ko(t,y,`effect[${g}]`,T)});x&&v.push(x),++g}p.cleanup=()=>{for(const S of v)S()}}return t.on.atomCreation.next(y),y}function oy(t,e){const n=_e(t),{key:r,family:o}=e,l=lt(n,e);if(!o)t.logger.error("❌","atom",r,"Standalone atoms cannot be disposed.");else{l.cleanup?.();const u=t.valueMap.get(l.key),f=Fm(t,e),p=lt(t,f).subject,y={type:"state_disposal",subType:"atom",token:e,value:u,timestamp:Date.now()};p.next(y);const g=wn(n);if(n.atoms.delete(r),n.valueMap.delete(r),n.selectorAtoms.delete(r),n.atomsThatAreDefault.delete(r),n.moleculeData.delete(o.key,o.subKey),t.timelineTopics.delete(r),e.type==="mutable_atom"){const v=B1(e);oy(t,v),t.trackers.delete(r)}if(t.logger.info("🔥","atom",r,"deleted"),g&&n.transactionMeta.phase==="building"){const v=n.transactionMeta.update.subEvents.at(-1),x=v?.type==="molecule_disposal"&&v.values.some(([D])=>D===l.family?.key),T=L1(l,"tracker:signal");!x&&!T&&n.transactionMeta.update.subEvents.push(y)}else t.on.atomDisposal.next(e)}}function L1(t,e){return"internalRoles"in t?t.internalRoles.includes(e):!1}function bn(t){return t[0].toUpperCase()+t.slice(1)}var V1=class{toolkit;options;defaultContent;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=Bt.STORE){this.store=n,this.realm=new Fk(n),this.options=t,this.defaultContent=e,this.store.miscResources.set(`join:${t.key}`,this),this.realm.allocate("root",t.key),this.toolkit={get:((...j)=>ln(n,...j)),set:((...j)=>{kt(n,...j)}),find:((...j)=>jr(n,...j)),json:j=>bs(n,j)};const r=t.between[0],o=t.between[1],l=j1(n,{key:`${t.key}/relatedKeys`,class:Im},["join","relations"]);this.core={relatedKeysAtoms:l};const u=({get:j},_)=>j(l,_),f=({set:j},_,J)=>{this.store.molecules.has(Ge(_))||this.realm.allocate(t.key,_),j(l,_,Y=>Y.add(J)),j(l,J,Y=>Y.add(_))},h=({set:j},_,J)=>{j(l,_,re=>(re.delete(J),re)),j(l,J,re=>(re.delete(_),re));const[Y,F]=[_,J].sort(),ee=`${Y}:${F}`;this.store.moleculeJoins.delete(ee)},p=(j,_,J)=>{const{find:Y,get:F,set:ee}=j,re=Y(l,_),ue=F(re);for(const ge of ue)J.includes(ge)||ee(l,ge,Q=>(Q.delete(_),Q));ee(re,ge=>(ge.transaction(be=>{be.clear();for(const Q of J){const W=u(j,Q),B=W.has(_);if(this.relations.cardinality==="1:n"){const q=[];for(const z of W){if(z===_)continue;const ne=u(j,z);ne.delete(Q),ne.size===0&&q.push(z)}!B&&W.size>0&&W.clear();for(const z of q){const[ne,A]=[Q,z].sort(),P=`${ne}:${A}`;n.moleculeJoins.delete(P)}}B||W.add(_),be.add(Q)}return!0}),ge))},y=(j,_,J)=>{const{set:Y}=j;Y(l,_,F=>(F.transaction(ee=>{for(const re of J)ee.add(re);return!0}),F));for(const F of J)Y(l,F,ee=>(ee.add(_),ee));return!0},g=(j,_,J)=>{const Y=u(j,_);return J?Y.has(J):Y.size>0},v={getRelatedKeys:j=>u(this.toolkit,j),addRelation:(j,_)=>{this.store.moleculeJoins.set(`"${j}"`,t.key),this.store.moleculeJoins.set(`"${_}"`,t.key),f(this.toolkit,j,_)},deleteRelation:(j,_)=>{h(this.toolkit,j,_)},replaceRelationsSafely:(j,_)=>{p(this.toolkit,j,_)},replaceRelationsUnsafely:(j,_)=>{y(this.toolkit,j,_)},has:(j,_)=>g(this.toolkit,j,_)};let S,x;if(e){x=ty(n,{key:`${t.key}/content`,default:e},["join","content"]);const j=({get:Y},F)=>Y(x,F),_=({set:Y},F,ee)=>{Y(x,F,ee)};S=Object.assign(v,{getContent:Y=>j(this.toolkit,Y),setContent:(Y,F)=>{_(this.toolkit,Y,F)},deleteContent:Y=>{}})}else S=v;const T=new Bi(t,{externalStore:S,isAType:t.isAType,isBType:t.isBType,makeContentKey:(...j)=>{const[_,J]=j,[Y,F]=j.sort(),ee=`${Y}:${F}`,re=n.molecules.get(Ge(_)),ue=n.molecules.get(Ge(J));return re||this.realm.allocate(t.key,_),ue||this.realm.allocate(t.key,J),this.realm.allocate(_,ee,"all"),this.realm.claim(J,ee),this.store.moleculeJoins.set(ee,t.key),ee}}),D=()=>po(n,{key:`${t.key}/singleRelatedKey`,get:j=>({get:_})=>{const J=_(l,j);for(const Y of J)return Y;return null}},["join","keys"]),M=()=>po(n,{key:`${t.key}/multipleRelatedKeys`,get:j=>({get:_})=>{const J=hS(l,n);return _(J,j).members}},["join","keys"]),O=()=>po(n,{key:`${t.key}/singleRelatedEntry`,get:j=>({get:_})=>{const J=_(l,j);for(const Y of J){let F=T.isAType?.(j)?j:void 0,ee=F===void 0?j:void 0;F??=Y,ee??=Y;const re=T.makeContentKey(F,ee),ue=_(x,re);return[Y,ue]}return null}},["join","entries"]),C=()=>po(n,{key:`${t.key}/multipleRelatedEntries`,get:j=>({get:_})=>{const J=hS(l,n);return _(J,j).members.map(F=>{let ee=T.isAType?.(j)?j:void 0,re=ee===void 0?j:void 0;ee??=F,re??=F;const ue=T.makeContentKey(ee,re),ge=_(x,ue);return[F,ge]})}},["join","entries"]);switch(t.cardinality){case"1:1":{const j=D(),_=`${r}KeyOf${bn(o)}`,J=`${o}KeyOf${bn(r)}`,Y={[_]:j,[J]:j};let F;if(e){const ee=O(),re=`${r}EntryOf${bn(o)}`,ue=`${o}EntryOf${bn(r)}`,ge={[re]:ee,[ue]:ee};F=Object.assign(Y,ge)}else F=Y;this.relations=T,this.states=F;break}case"1:n":{const j=D(),_=M(),J=`${r}KeyOf${bn(o)}`,Y=`${o}KeysOf${bn(r)}`,F={[J]:j,[Y]:_};let ee;if(e){const re=O(),ue=C(),ge=`${r}EntryOf${bn(o)}`,be=`${o}EntriesOf${bn(r)}`,Q={[ge]:re,[be]:ue};ee=Object.assign(F,Q)}else ee=F;this.relations=T,this.states=ee;break}case"n:n":{const j=M(),_=`${r}KeysOf${bn(o)}`,J=`${o}KeysOf${bn(r)}`,Y={[_]:j,[J]:j};let F;if(e){const ee=C(),re=`${r}EntriesOf${bn(o)}`,ue=`${o}EntriesOf${bn(r)}`,ge={[re]:ee,[ue]:ee};F=Object.assign(Y,ge)}else F=Y;this.relations=T,this.states=F}}}};function jM(t,e,n){return t.joins.set(e.key,new V1(e,n,t)),{key:e.key,type:"join",a:e.between[0],b:e.between[1],cardinality:e.cardinality}}function BM(t,e){let n=e.joins.get(t.key);if(n===void 0){const o=Bt.STORE.joins.get(t.key);if(o===void 0)throw new Error(`Join "${t.key}" not found in store "${e.config.name}"`);const l=Zk(e);n=new V1(o.options,o.defaultContent,l),e.joins.set(t.key,n)}return n}function LM(t,e){return BM(t,e).core.relatedKeysAtoms}var VM=class extends Error{constructor(t,e){super(`${$r[t.type]} ${Ge(t.key)} not found in store "${e.config.name}".`)}};function UM(t){return t.startsWith("🔍 ")}var Fh={exports:{}},Se={};/**
|
|
22
22
|
* @license React
|
|
23
23
|
* react.production.js
|
|
24
24
|
*
|
|
@@ -26,7 +26,7 @@ ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.molecu
|
|
|
26
26
|
*
|
|
27
27
|
* This source code is licensed under the MIT license found in the
|
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/var pS;function zM(){if(pS)return Se;pS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),l=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(){}},x=Object.assign,T={};function D(A,P,te){this.props=A,this.context=P,this.refs=T,this.updater=te||S}D.prototype.isReactComponent={},D.prototype.setState=function(A,P){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,P,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function M(){}M.prototype=D.prototype;function O(A,P,te){this.props=A,this.context=P,this.refs=T,this.updater=te||S}var C=O.prototype=new M;C.constructor=O,x(C,D.prototype),C.isPureReactComponent=!0;var j=Array.isArray,_={H:null,A:null,T:null,S:null,V:null},J=Object.prototype.hasOwnProperty;function Y(A,P,te,X,oe,fe){return te=fe.ref,{$$typeof:t,type:A,key:P,ref:te!==void 0?te:null,props:fe}}function F(A,P){return Y(A.type,P,void 0,void 0,void 0,A.props)}function ee(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function se(A){var P={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(te){return P[te]})}var ue=/\/+/g;function ge(A,P){return typeof A=="object"&&A!==null&&A.key!=null?se(""+A.key):P.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(P){A.status==="pending"&&(A.status="fulfilled",A.value=P)},function(P){A.status==="pending"&&(A.status="rejected",A.reason=P)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function W(A,P,te,X,oe){var fe=typeof A;(fe==="undefined"||fe==="boolean")&&(A=null);var le=!1;if(A===null)le=!0;else switch(fe){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),P,te,X,oe)}}if(le)return oe=oe(A),le=X===""?"."+ge(A,0):X,j(oe)?(te="",le!=null&&(te=le.replace(ue,"$&/")+"/"),W(oe,P,te,"",function(wn){return wn})):oe!=null&&(ee(oe)&&(oe=F(oe,te+(oe.key==null||A&&A.key===oe.key?"":(""+oe.key).replace(ue,"$&/")+"/")+le)),P.push(oe)),1;le=0;var it=X===""?".":X+":";if(j(A))for(var Ve=0;Ve<A.length;Ve++)X=A[Ve],fe=it+ge(X,Ve),le+=W(X,P,te,fe,oe);else if(Ve=v(A),typeof Ve=="function")for(A=Ve.call(A),Ve=0;!(X=A.next()).done;)X=X.value,fe=it+ge(X,Ve++),le+=W(X,P,te,fe,oe);else if(fe==="object"){if(typeof A.then=="function")return W(Q(A),P,te,X,oe);throw P=String(A),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return le}function B(A,P,te){if(A==null)return A;var X=[],oe=0;return W(A,X,"","",function(fe){return P.call(te,fe,oe++)}),X}function q(A){if(A._status===-1){var P=A._result;P=P(),P.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=P)}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 P=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(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function ne(){}return Se.Children={map:B,forEach:function(A,P,te){B(A,function(){P.apply(this,arguments)},te)},count:function(A){var P=0;return B(A,function(){P++}),P},toArray:function(A){return B(A,function(P){return P})||[]},only:function(A){if(!ee(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},Se.Component=D,Se.Fragment=n,Se.Profiler=o,Se.PureComponent=O,Se.StrictMode=s,Se.Suspense=h,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,Se.__COMPILER_RUNTIME={__proto__:null,c:function(A){return _.H.useMemoCache(A)}},Se.cache=function(A){return function(){return A.apply(null,arguments)}},Se.cloneElement=function(A,P,te){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var X=x({},A.props),oe=A.key,fe=void 0;if(P!=null)for(le in P.ref!==void 0&&(fe=void 0),P.key!==void 0&&(oe=""+P.key),P)!J.call(P,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&P.ref===void 0||(X[le]=P[le]);var le=arguments.length-2;if(le===1)X.children=te;else if(1<le){for(var it=Array(le),Ve=0;Ve<le;Ve++)it[Ve]=arguments[Ve+2];X.children=it}return Y(A.type,oe,void 0,void 0,fe,X)},Se.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:l,_context:A},A},Se.createElement=function(A,P,te){var X,oe={},fe=null;if(P!=null)for(X in P.key!==void 0&&(fe=""+P.key),P)J.call(P,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(oe[X]=P[X]);var le=arguments.length-2;if(le===1)oe.children=te;else if(1<le){for(var it=Array(le),Ve=0;Ve<le;Ve++)it[Ve]=arguments[Ve+2];oe.children=it}if(A&&A.defaultProps)for(X in le=A.defaultProps,le)oe[X]===void 0&&(oe[X]=le[X]);return Y(A,fe,void 0,void 0,null,oe)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(A){return{$$typeof:d,render:A}},Se.isValidElement=ee,Se.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:q}},Se.memo=function(A,P){return{$$typeof:p,type:A,compare:P===void 0?null:P}},Se.startTransition=function(A){var P=_.T,te={};_.T=te;try{var X=A(),oe=_.S;oe!==null&&oe(te,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(ne,z)}catch(fe){z(fe)}finally{_.T=P}},Se.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},Se.use=function(A){return _.H.use(A)},Se.useActionState=function(A,P,te){return _.H.useActionState(A,P,te)},Se.useCallback=function(A,P){return _.H.useCallback(A,P)},Se.useContext=function(A){return _.H.useContext(A)},Se.useDebugValue=function(){},Se.useDeferredValue=function(A,P){return _.H.useDeferredValue(A,P)},Se.useEffect=function(A,P,te){var X=_.H;if(typeof te=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return X.useEffect(A,P)},Se.useId=function(){return _.H.useId()},Se.useImperativeHandle=function(A,P,te){return _.H.useImperativeHandle(A,P,te)},Se.useInsertionEffect=function(A,P){return _.H.useInsertionEffect(A,P)},Se.useLayoutEffect=function(A,P){return _.H.useLayoutEffect(A,P)},Se.useMemo=function(A,P){return _.H.useMemo(A,P)},Se.useOptimistic=function(A,P){return _.H.useOptimistic(A,P)},Se.useReducer=function(A,P,te){return _.H.useReducer(A,P,te)},Se.useRef=function(A){return _.H.useRef(A)},Se.useState=function(A){return _.H.useState(A)},Se.useSyncExternalStore=function(A,P,te){return _.H.useSyncExternalStore(A,P,te)},Se.useTransition=function(){return _.H.useTransition()},Se.version="19.1.1",Se}var mS;function ay(){return mS||(mS=1,Fh.exports=zM()),Fh.exports}var V=ay();const zp=Vk(V),U1=Lk({__proto__:null,default:zp},[V]),ly=V.createContext(Bt.STORE);function z1(t,...e){let n;if(e.length===2){const s=e[0],o=e[1];n=js(t,s,o)}else n=e[0];return n}function Gn(...t){const e=V.useContext(ly),n=z1(e,...t),s=V.useRef(null);return s.current??=o=>{kt(e,n,o)},s.current}function St(...t){const e=V.useContext(ly),n=z1(e,...t),s=V.useId();return V.useSyncExternalStore(o=>ko(e,n,`use-o:${s}`,o),()=>an(e,n),()=>an(e,n))}const K1=(t,{stringify:e,parse:n},s)=>({setSelf:o,onSet:l})=>{const u=t.getItem(s);u!=null&&o(n(u)),l(({newValue:d})=>{if(d==null){t.removeItem(s);return}t.setItem(s,e(d))})},KM=(t,e,n,s,o)=>l=>{function u(h,p){if(t.logger.info("🧑⚖️","continuity",e,"reconciling updates"),kt(t,hu,g=>(g.shift(),g)),h.id===p.id){const g=JSON.stringify(h.subEvents),v=JSON.stringify(p.subEvents);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.token.key}:${h.id}, but it was actually ${p.token.key}:${p.id}`);t.logger.info("🧑⚖️","continuity",e,"updates do not match",h,p);const y=s.toReversed();for(const g of y)ho(t,g,"oldValue");t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),ho(t,h,"oldValue"),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),ho(t,p,"newValue"),t.logger.info("⏩","continuity",e,"applied confirmed update",p),n.emit(`ack:${e}`,p.epoch);for(const g of s){const v={type:"transaction",key:g.token.key},{id:S,params:x}=g;ef(t,v,S)(...x)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",s)}t.logger.info("🧑⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:l,confirmedUpdates:o,optimisticUpdates:s});const d=s[0];if(d)if(t.logger.info("🧑⚖️","continuity",e,"has optimistic updates to reconcile"),l.epoch===d.epoch){t.logger.info("🧑⚖️","continuity",e,`epoch of confirmed update #${l.epoch} matches zeroth optimistic update`),u(d,l);for(const h of o){const p=s[0];if(h.epoch===p?.epoch)u(p,h);else break}}else t.logger.info("🧑⚖️","continuity",e,`epoch of confirmed update #${l.epoch} does not match zeroth optimistic update #${d.epoch}`),o.some(p=>p.epoch===l.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",l),kt(t,Kp,p=>(p.push(l),p.sort((y,g)=>y.epoch-g.epoch),p)));else{t.logger.info("🧑⚖️","continuity",e,"has no optimistic updates to deal with");let h;h=R1(t,e),h===l.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${l.epoch} (${l.token.key} ${l.id})`),ho(t,l,"newValue"),n.emit(`ack:${e}`,l.epoch),Xm(t,e,l.epoch)):h!==void 0&&(t.logger.info("🧑⚖️","continuity",e,`received update #${l.epoch} but still waiting for update #${h+1}`,{clientEpoch:h,serverEpoch:l.epoch}),o.some(y=>y.epoch===l.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${l.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${l.epoch} to queue`),kt(t,Kp,y=>(y.push(l),y.sort((g,v)=>g.epoch-v.epoch),y))))}};function qM(t){return e=>{for(const n of e)oy(t,n)}}function PM(t){return e=>{let n=0,s,o;for(const l of e)n%2===0?s=l:(o=l,kt(t,s,o)),n++}}const q1=ct({key:"mySocketId__INTERNAL",default:void 0});hi({key:"mySocketId",get:({get:t})=>t(q1)});ct({key:"myName",default:null,effects:typeof window>"u"?[]:[K1(window.localStorage,JSON,"myUsername")]});const hu=ct({key:"updateQueue",default:()=>[]}),Kp=ct({key:"serverConfirmedUpdateQueue",default:()=>[]});function IM(t,e,n){const s=n.key,o=an(t,hu),l=an(t,Kp),u=(g,v)=>{e.off(`continuity-init:${s}`,u);let S=0,x,T;for(const D of v)S%2===0?x=D:(T=D,"type"in x&&x.type==="mutable_atom"&&(x=br(t,x)),kt(t,x,T)),S++;Xm(t,s,g)};e.off(`continuity-init:${s}`),e.on(`continuity-init:${s}`,u);const d=KM(t,s,e,o,l);e.off(`tx-new:${s}`),e.on(`tx-new:${s}`,d);const h=n.actions.map(g=>(O1(t,s,g.key),$1(t,g,`tx-run:${s}`,S=>{t.logger.info("🤞","continuity",s,"enqueuing optimistic update");const x=o.findIndex(T=>T.id===S.id);x===-1?(t.logger.info("🤞","continuity",s,"enqueuing new optimistic update"),kt(t,hu,T=>(T.push(S),T.sort((D,M)=>D.epoch-M.epoch),T))):(t.logger.info("🤞","continuity",s,`replacing existing optimistic update at index ${x}`),kt(t,hu,T=>(T[x]=S,T))),e.emit(`tx-run:${s}`,{id:S.id,token:g,params:S.params})}))),p=PM(t),y=qM(t);return e.on(`reveal:${s}`,p),e.on(`conceal:${s}`,y),e.emit(`get:${s}`),()=>{e.off(`continuity-init:${s}`),e.off(`tx-new:${s}`);for(const g of h)g()}}const{NODE_ENV:HM}=globalThis.env??{},FM=HM==="development";function Zc(){}function GM(t,e){if(FM){const n=V.useRef(Zc);V.useEffect(()=>{let s=n.current;if(s===Zc)s=t()??Zc,n.current=s;else return()=>{s(),n.current=Zc}},e)}else V.useEffect(t,e)}function ku(t){GM(t,[])}const P1=V.createContext({socket:null,services:null}),YM=({children:t,socket:e})=>{const n=V.useRef(new Map).current,s=Gn(q1);return V.useEffect(()=>{s(e?.id),e?.on("connect",()=>{s(e.id)}),e?.on("disconnect",()=>{s(void 0)})},[e,s]),G.jsx(P1.Provider,{value:{socket:e,services:n},children:t})};function XM(t,e){const{socket:n,services:s}=V.useContext(P1);ku(()=>{let o=s?.get(t);return o?o[0]++:(o=[1,n?e(n):void 0],s?.set(t,o)),()=>{o&&(o[0]--,o[0]===0&&(o[1]?.(),s?.delete(t)))}})}function JM(t){const e=V.useContext(ly);XM(`tx-sync:${t.key}`,n=>IM(e,n,t))}var Gh={exports:{}},Fa={},Yh={exports:{}},Xh={};/**
|
|
29
|
+
*/var pS;function zM(){if(pS)return Se;pS=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"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=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(){}},x=Object.assign,T={};function D(A,P,te){this.props=A,this.context=P,this.refs=T,this.updater=te||S}D.prototype.isReactComponent={},D.prototype.setState=function(A,P){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,P,"setState")},D.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function M(){}M.prototype=D.prototype;function O(A,P,te){this.props=A,this.context=P,this.refs=T,this.updater=te||S}var C=O.prototype=new M;C.constructor=O,x(C,D.prototype),C.isPureReactComponent=!0;var j=Array.isArray,_={H:null,A:null,T:null,S:null,V:null},J=Object.prototype.hasOwnProperty;function Y(A,P,te,X,oe,fe){return te=fe.ref,{$$typeof:t,type:A,key:P,ref:te!==void 0?te:null,props:fe}}function F(A,P){return Y(A.type,P,void 0,void 0,void 0,A.props)}function ee(A){return typeof A=="object"&&A!==null&&A.$$typeof===t}function re(A){var P={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(te){return P[te]})}var ue=/\/+/g;function ge(A,P){return typeof A=="object"&&A!==null&&A.key!=null?re(""+A.key):P.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(P){A.status==="pending"&&(A.status="fulfilled",A.value=P)},function(P){A.status==="pending"&&(A.status="rejected",A.reason=P)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function W(A,P,te,X,oe){var fe=typeof A;(fe==="undefined"||fe==="boolean")&&(A=null);var le=!1;if(A===null)le=!0;else switch(fe){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),P,te,X,oe)}}if(le)return oe=oe(A),le=X===""?"."+ge(A,0):X,j(oe)?(te="",le!=null&&(te=le.replace(ue,"$&/")+"/"),W(oe,P,te,"",function(xn){return xn})):oe!=null&&(ee(oe)&&(oe=F(oe,te+(oe.key==null||A&&A.key===oe.key?"":(""+oe.key).replace(ue,"$&/")+"/")+le)),P.push(oe)),1;le=0;var it=X===""?".":X+":";if(j(A))for(var Ve=0;Ve<A.length;Ve++)X=A[Ve],fe=it+ge(X,Ve),le+=W(X,P,te,fe,oe);else if(Ve=v(A),typeof Ve=="function")for(A=Ve.call(A),Ve=0;!(X=A.next()).done;)X=X.value,fe=it+ge(X,Ve++),le+=W(X,P,te,fe,oe);else if(fe==="object"){if(typeof A.then=="function")return W(Q(A),P,te,X,oe);throw P=String(A),Error("Objects are not valid as a React child (found: "+(P==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":P)+"). If you meant to render a collection of children, use an array instead.")}return le}function B(A,P,te){if(A==null)return A;var X=[],oe=0;return W(A,X,"","",function(fe){return P.call(te,fe,oe++)}),X}function q(A){if(A._status===-1){var P=A._result;P=P(),P.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=P)}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 P=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(P))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)};function ne(){}return Se.Children={map:B,forEach:function(A,P,te){B(A,function(){P.apply(this,arguments)},te)},count:function(A){var P=0;return B(A,function(){P++}),P},toArray:function(A){return B(A,function(P){return P})||[]},only:function(A){if(!ee(A))throw Error("React.Children.only expected to receive a single React element child.");return A}},Se.Component=D,Se.Fragment=n,Se.Profiler=o,Se.PureComponent=O,Se.StrictMode=r,Se.Suspense=h,Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=_,Se.__COMPILER_RUNTIME={__proto__:null,c:function(A){return _.H.useMemoCache(A)}},Se.cache=function(A){return function(){return A.apply(null,arguments)}},Se.cloneElement=function(A,P,te){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var X=x({},A.props),oe=A.key,fe=void 0;if(P!=null)for(le in P.ref!==void 0&&(fe=void 0),P.key!==void 0&&(oe=""+P.key),P)!J.call(P,le)||le==="key"||le==="__self"||le==="__source"||le==="ref"&&P.ref===void 0||(X[le]=P[le]);var le=arguments.length-2;if(le===1)X.children=te;else if(1<le){for(var it=Array(le),Ve=0;Ve<le;Ve++)it[Ve]=arguments[Ve+2];X.children=it}return Y(A.type,oe,void 0,void 0,fe,X)},Se.createContext=function(A){return A={$$typeof:u,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:l,_context:A},A},Se.createElement=function(A,P,te){var X,oe={},fe=null;if(P!=null)for(X in P.key!==void 0&&(fe=""+P.key),P)J.call(P,X)&&X!=="key"&&X!=="__self"&&X!=="__source"&&(oe[X]=P[X]);var le=arguments.length-2;if(le===1)oe.children=te;else if(1<le){for(var it=Array(le),Ve=0;Ve<le;Ve++)it[Ve]=arguments[Ve+2];oe.children=it}if(A&&A.defaultProps)for(X in le=A.defaultProps,le)oe[X]===void 0&&(oe[X]=le[X]);return Y(A,fe,void 0,void 0,null,oe)},Se.createRef=function(){return{current:null}},Se.forwardRef=function(A){return{$$typeof:f,render:A}},Se.isValidElement=ee,Se.lazy=function(A){return{$$typeof:y,_payload:{_status:-1,_result:A},_init:q}},Se.memo=function(A,P){return{$$typeof:p,type:A,compare:P===void 0?null:P}},Se.startTransition=function(A){var P=_.T,te={};_.T=te;try{var X=A(),oe=_.S;oe!==null&&oe(te,X),typeof X=="object"&&X!==null&&typeof X.then=="function"&&X.then(ne,z)}catch(fe){z(fe)}finally{_.T=P}},Se.unstable_useCacheRefresh=function(){return _.H.useCacheRefresh()},Se.use=function(A){return _.H.use(A)},Se.useActionState=function(A,P,te){return _.H.useActionState(A,P,te)},Se.useCallback=function(A,P){return _.H.useCallback(A,P)},Se.useContext=function(A){return _.H.useContext(A)},Se.useDebugValue=function(){},Se.useDeferredValue=function(A,P){return _.H.useDeferredValue(A,P)},Se.useEffect=function(A,P,te){var X=_.H;if(typeof te=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return X.useEffect(A,P)},Se.useId=function(){return _.H.useId()},Se.useImperativeHandle=function(A,P,te){return _.H.useImperativeHandle(A,P,te)},Se.useInsertionEffect=function(A,P){return _.H.useInsertionEffect(A,P)},Se.useLayoutEffect=function(A,P){return _.H.useLayoutEffect(A,P)},Se.useMemo=function(A,P){return _.H.useMemo(A,P)},Se.useOptimistic=function(A,P){return _.H.useOptimistic(A,P)},Se.useReducer=function(A,P,te){return _.H.useReducer(A,P,te)},Se.useRef=function(A){return _.H.useRef(A)},Se.useState=function(A){return _.H.useState(A)},Se.useSyncExternalStore=function(A,P,te){return _.H.useSyncExternalStore(A,P,te)},Se.useTransition=function(){return _.H.useTransition()},Se.version="19.1.1",Se}var mS;function ay(){return mS||(mS=1,Fh.exports=zM()),Fh.exports}var V=ay();const zp=Vk(V),U1=Lk({__proto__:null,default:zp},[V]),ly=V.createContext(Bt.STORE);function z1(t,...e){let n;if(e.length===2){const r=e[0],o=e[1];n=jr(t,r,o)}else n=e[0];return n}function Yn(...t){const e=V.useContext(ly),n=z1(e,...t),r=V.useRef(null);return r.current??=o=>{kt(e,n,o)},r.current}function St(...t){const e=V.useContext(ly),n=z1(e,...t),r=V.useId();return V.useSyncExternalStore(o=>ko(e,n,`use-o:${r}`,o),()=>ln(e,n),()=>ln(e,n))}const K1=(t,{stringify:e,parse:n},r)=>({setSelf:o,onSet:l})=>{const u=t.getItem(r);u!=null&&o(n(u)),l(({newValue:f})=>{if(f==null){t.removeItem(r);return}t.setItem(r,e(f))})},KM=(t,e,n,r,o)=>l=>{function u(h,p){if(t.logger.info("🧑⚖️","continuity",e,"reconciling updates"),kt(t,hu,g=>(g.shift(),g)),h.id===p.id){const g=JSON.stringify(h.subEvents),v=JSON.stringify(p.subEvents);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.token.key}:${h.id}, but it was actually ${p.token.key}:${p.id}`);t.logger.info("🧑⚖️","continuity",e,"updates do not match",h,p);const y=r.toReversed();for(const g of y)ho(t,g,"oldValue");t.logger.info("⏪","continuity",e,"undid optimistic updates:",y),ho(t,h,"oldValue"),t.logger.info("⏪","continuity",e,"undid zeroth optimistic update",h),ho(t,p,"newValue"),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.token.key},{id:S,params:x}=g;ef(t,v,S)(...x)}t.logger.info("⏩","continuity",e,"reapplied subsequent optimistic updates:",r)}t.logger.info("🧑⚖️","continuity",e,"integrating confirmed update",{confirmedUpdate:l,confirmedUpdates:o,optimisticUpdates:r});const f=r[0];if(f)if(t.logger.info("🧑⚖️","continuity",e,"has optimistic updates to reconcile"),l.epoch===f.epoch){t.logger.info("🧑⚖️","continuity",e,`epoch of confirmed update #${l.epoch} matches zeroth optimistic update`),u(f,l);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 #${l.epoch} does not match zeroth optimistic update #${f.epoch}`),o.some(p=>p.epoch===l.epoch)||(t.logger.info("👈","continuity",e,"pushing confirmed update to queue",l),kt(t,Kp,p=>(p.push(l),p.sort((y,g)=>y.epoch-g.epoch),p)));else{t.logger.info("🧑⚖️","continuity",e,"has no optimistic updates to deal with");let h;h=R1(t,e),h===l.epoch-1?(t.logger.info("✅","continuity",e,`integrating update #${l.epoch} (${l.token.key} ${l.id})`),ho(t,l,"newValue"),n.emit(`ack:${e}`,l.epoch),Xm(t,e,l.epoch)):h!==void 0&&(t.logger.info("🧑⚖️","continuity",e,`received update #${l.epoch} but still waiting for update #${h+1}`,{clientEpoch:h,serverEpoch:l.epoch}),o.some(y=>y.epoch===l.epoch)?t.logger.info("👍","continuity",e,`confirmed update #${l.epoch} is already enqueued`):(t.logger.info("👈","continuity",e,`pushing confirmed update #${l.epoch} to queue`),kt(t,Kp,y=>(y.push(l),y.sort((g,v)=>g.epoch-v.epoch),y))))}};function qM(t){return e=>{for(const n of e)oy(t,n)}}function PM(t){return e=>{let n=0,r,o;for(const l of e)n%2===0?r=l:(o=l,kt(t,r,o)),n++}}const q1=ct({key:"mySocketId__INTERNAL",default:void 0});pi({key:"mySocketId",get:({get:t})=>t(q1)});ct({key:"myName",default:null,effects:typeof window>"u"?[]:[K1(window.localStorage,JSON,"myUsername")]});const hu=ct({key:"updateQueue",default:()=>[]}),Kp=ct({key:"serverConfirmedUpdateQueue",default:()=>[]});function IM(t,e,n){const r=n.key,o=ln(t,hu),l=ln(t,Kp),u=(g,v)=>{e.off(`continuity-init:${r}`,u);let S=0,x,T;for(const D of v)S%2===0?x=D:(T=D,"type"in x&&x.type==="mutable_atom"&&(x=bs(t,x)),kt(t,x,T)),S++;Xm(t,r,g)};e.off(`continuity-init:${r}`),e.on(`continuity-init:${r}`,u);const f=KM(t,r,e,o,l);e.off(`tx-new:${r}`),e.on(`tx-new:${r}`,f);const h=n.actions.map(g=>(O1(t,r,g.key),$1(t,g,`tx-run:${r}`,S=>{t.logger.info("🤞","continuity",r,"enqueuing optimistic update");const x=o.findIndex(T=>T.id===S.id);x===-1?(t.logger.info("🤞","continuity",r,"enqueuing new optimistic update"),kt(t,hu,T=>(T.push(S),T.sort((D,M)=>D.epoch-M.epoch),T))):(t.logger.info("🤞","continuity",r,`replacing existing optimistic update at index ${x}`),kt(t,hu,T=>(T[x]=S,T))),e.emit(`tx-run:${r}`,{id:S.id,token:g,params:S.params})}))),p=PM(t),y=qM(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:HM}=globalThis.env??{},FM=HM==="development";function Zc(){}function GM(t,e){if(FM){const n=V.useRef(Zc);V.useEffect(()=>{let r=n.current;if(r===Zc)r=t()??Zc,n.current=r;else return()=>{r(),n.current=Zc}},e)}else V.useEffect(t,e)}function ku(t){GM(t,[])}const P1=V.createContext({socket:null,services:null}),YM=({children:t,socket:e})=>{const n=V.useRef(new Map).current,r=Yn(q1);return V.useEffect(()=>{r(e?.id),e?.on("connect",()=>{r(e.id)}),e?.on("disconnect",()=>{r(void 0)})},[e,r]),G.jsx(P1.Provider,{value:{socket:e,services:n},children:t})};function XM(t,e){const{socket:n,services:r}=V.useContext(P1);ku(()=>{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 JM(t){const e=V.useContext(ly);XM(`tx-sync:${t.key}`,n=>IM(e,n,t))}var Gh={exports:{}},Fa={},Yh={exports:{}},Xh={};/**
|
|
30
30
|
* @license React
|
|
31
31
|
* scheduler.production.js
|
|
32
32
|
*
|
|
@@ -34,7 +34,7 @@ ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.molecu
|
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var yS;function ZM(){return yS||(yS=1,(function(t){function e(B,q){var z=B.length;B.push(q);e:for(;0<z;){var ne=z-1>>>1,A=B[ne];if(0<o(A,q))B[ne]=q,B[z]=A,z=ne;else break e}}function n(B){return B.length===0?null:B[0]}function
|
|
37
|
+
*/var yS;function ZM(){return yS||(yS=1,(function(t){function e(B,q){var z=B.length;B.push(q);e:for(;0<z;){var ne=z-1>>>1,A=B[ne];if(0<o(A,q))B[ne]=q,B[z]=A,z=ne;else break e}}function n(B){return B.length===0?null:B[0]}function r(B){if(B.length===0)return null;var q=B[0],z=B.pop();if(z!==q){B[0]=z;e:for(var ne=0,A=B.length,P=A>>>1;ne<P;){var te=2*(ne+1)-1,X=B[te],oe=te+1,fe=B[oe];if(0>o(X,z))oe<A&&0>o(fe,X)?(B[ne]=fe,B[oe]=z,ne=oe):(B[ne]=X,B[te]=z,ne=te);else if(oe<A&&0>o(fe,z))B[ne]=fe,B[oe]=z,ne=oe;else break e}}return q}function o(B,q){var z=B.sortIndex-q.sortIndex;return z!==0?z:B.id-q.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;t.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();t.unstable_now=function(){return u.now()-f}}var h=[],p=[],y=1,g=null,v=3,S=!1,x=!1,T=!1,D=!1,M=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function j(B){for(var q=n(p);q!==null;){if(q.callback===null)r(p);else if(q.startTime<=B)r(p),q.sortIndex=q.expirationTime,e(h,q);else break;q=n(p)}}function _(B){if(T=!1,j(B),!x)if(n(h)!==null)x=!0,J||(J=!0,ge());else{var q=n(p);q!==null&&W(_,q.startTime-B)}}var J=!1,Y=-1,F=5,ee=-1;function re(){return D?!0:!(t.unstable_now()-ee<F)}function ue(){if(D=!1,J){var B=t.unstable_now();ee=B;var q=!0;try{e:{x=!1,T&&(T=!1,O(Y),Y=-1),S=!0;var z=v;try{t:{for(j(B),g=n(h);g!==null&&!(g.expirationTime>B&&re());){var ne=g.callback;if(typeof ne=="function"){g.callback=null,v=g.priorityLevel;var A=ne(g.expirationTime<=B);if(B=t.unstable_now(),typeof A=="function"){g.callback=A,j(B),q=!0;break t}g===n(h)&&r(h),j(B)}else r(h);g=n(h)}if(g!==null)q=!0;else{var P=n(p);P!==null&&W(_,P.startTime-B),q=!1}}break e}finally{g=null,v=z,S=!1}q=void 0}}finally{q?ge():J=!1}}}var ge;if(typeof C=="function")ge=function(){C(ue)};else if(typeof MessageChannel<"u"){var be=new MessageChannel,Q=be.port2;be.port1.onmessage=ue,ge=function(){Q.postMessage(null)}}else ge=function(){M(ue,0)};function W(B,q){Y=M(function(){B(t.unstable_now())},q)}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"):F=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 q=3;break;default:q=v}var z=v;v=q;try{return B()}finally{v=z}},t.unstable_requestPaint=function(){D=!0},t.unstable_runWithPriority=function(B,q){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var z=v;v=B;try{return q()}finally{v=z}},t.unstable_scheduleCallback=function(B,q,z){var ne=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?ne+z:ne):z=ne,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:q,priorityLevel:B,startTime:z,expirationTime:A,sortIndex:-1},z>ne?(B.sortIndex=z,e(p,B),n(h)===null&&B===n(p)&&(T?(O(Y),Y=-1):T=!0,W(_,z-ne))):(B.sortIndex=A,e(h,B),x||S||(x=!0,J||(J=!0,ge()))),B},t.unstable_shouldYield=re,t.unstable_wrapCallback=function(B){var q=v;return function(){var z=v;v=q;try{return B.apply(this,arguments)}finally{v=z}}}})(Xh)),Xh}var gS;function QM(){return gS||(gS=1,Yh.exports=ZM()),Yh.exports}var Jh={exports:{}},It={};/**
|
|
38
38
|
* @license React
|
|
39
39
|
* react-dom.production.js
|
|
40
40
|
*
|
|
@@ -42,7 +42,7 @@ ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.molecu
|
|
|
42
42
|
*
|
|
43
43
|
* This source code is licensed under the MIT license found in the
|
|
44
44
|
* LICENSE file in the root directory of this source tree.
|
|
45
|
-
*/var bS;function WM(){if(bS)return It;bS=1;var t=ay();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
|
|
45
|
+
*/var bS;function WM(){if(bS)return It;bS=1;var t=ay();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 l(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 f(h,p){if(h==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return It.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,It.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 l(h,p,null,y)},It.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()}},It.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))},It.prefetchDNS=function(h){typeof h=="string"&&r.d.D(h)},It.preinit=function(h,p){if(typeof h=="string"&&p&&typeof p.as=="string"){var y=p.as,g=f(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})}},It.preinitModule=function(h,p){if(typeof h=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var y=f(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)},It.preload=function(h,p){if(typeof h=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var y=p.as,g=f(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})}},It.preloadModule=function(h,p){if(typeof h=="string")if(p){var y=f(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)},It.requestFormReset=function(h){r.d.r(h)},It.unstable_batchedUpdates=function(h,p){return h(p)},It.useFormState=function(h,p,y){return u.H.useFormState(h,p,y)},It.useFormStatus=function(){return u.H.useHostTransitionStatus()},It.version="19.1.1",It}var vS;function I1(){if(vS)return Jh.exports;vS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jh.exports=WM(),Jh.exports}/**
|
|
46
46
|
* @license React
|
|
47
47
|
* react-dom-client.production.js
|
|
48
48
|
*
|
|
@@ -50,59 +50,59 @@ ${v.trace}`:`No previous disposal trace for ${d} was found.`),n}const p=t.molecu
|
|
|
50
50
|
*
|
|
51
51
|
* This source code is licensed under the MIT license found in the
|
|
52
52
|
* LICENSE file in the root directory of this source tree.
|
|
53
|
-
*/var SS;function eC(){if(SS)return Fa;SS=1;var t=QM(),e=ay(),n=I1();function s(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+i+"; visit "+r+" 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 l(i){var r=i,a=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(a=r.return),i=r.return;while(i)}return r.tag===3?a:null}function u(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function d(i){if(l(i)!==i)throw Error(s(188))}function h(i){var r=i.alternate;if(!r){if(r=l(i),r===null)throw Error(s(188));return r!==i?null:i}for(var a=i,c=r;;){var f=a.return;if(f===null)break;var m=f.alternate;if(m===null){if(c=f.return,c!==null){a=c;continue}break}if(f.child===m.child){for(m=f.child;m;){if(m===a)return d(f),i;if(m===c)return d(f),r;m=m.sibling}throw Error(s(188))}if(a.return!==c.return)a=f,c=m;else{for(var b=!1,w=f.child;w;){if(w===a){b=!0,a=f,c=m;break}if(w===c){b=!0,c=f,a=m;break}w=w.sibling}if(!b){for(w=m.child;w;){if(w===a){b=!0,a=m,c=f;break}if(w===c){b=!0,c=m,a=f;break}w=w.sibling}if(!b)throw Error(s(189))}}if(a.alternate!==c)throw Error(s(190))}if(a.tag!==3)throw Error(s(188));return a.stateNode.current===a?i:r}function p(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=p(i),r!==null)return r;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"),x=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),O=Symbol.for("react.consumer"),C=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ge(i){return i===null||typeof i!="object"?null:(i=ue&&i[ue]||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 x:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case _:return"Suspense";case J:return"SuspenseList";case ee:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case C:return(i.displayName||"Context")+".Provider";case O:return(i._context.displayName||"Context")+".Consumer";case j:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Y:return r=i.displayName||null,r!==null?r:Q(i.type)||"Memo";case F:r=i._payload,i=i._init;try{return Q(i(r))}catch{}}return null}var W=Array.isArray,B=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},ne=[],A=-1;function P(i){return{current:i}}function te(i){0>A||(i.current=ne[A],ne[A]=null,A--)}function X(i,r){A++,ne[A]=i.current,i.current=r}var oe=P(null),fe=P(null),le=P(null),it=P(null);function Ve(i,r){switch(X(le,r),X(fe,i),X(oe,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?j0(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=j0(r),i=B0(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(oe),X(oe,i)}function wn(){te(oe),te(fe),te(le)}function Xi(i){i.memoizedState!==null&&X(it,i);var r=oe.current,a=B0(r,i.type);r!==a&&(X(fe,i),X(oe,a))}function bi(i){fe.current===i&&(te(oe),te(fe)),it.current===i&&(te(it),za._currentValue=z)}var we=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,et=t.unstable_shouldYield,At=t.unstable_requestPaint,xe=t.unstable_now,zn=t.unstable_getCurrentPriorityLevel,Gt=t.unstable_ImmediatePriority,Kt=t.unstable_UserBlockingPriority,xn=t.unstable_NormalPriority,Zn=t.unstable_LowPriority,Tn=t.unstable_IdlePriority,Qn=t.log,Ll=t.unstable_setDisableYieldValue,Yo=null,ln=null;function Ji(i){if(typeof Qn=="function"&&Ll(i),ln&&typeof ln.setStrictMode=="function")try{ln.setStrictMode(Yo,i)}catch{}}var cn=Math.clz32?Math.clz32:TO,wO=Math.log,xO=Math.LN2;function TO(i){return i>>>=0,i===0?32:31-(wO(i)/xO|0)|0}var Vl=256,Ul=4194304;function Vs(i){var r=i&42;if(r!==0)return r;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 zl(i,r,a){var c=i.pendingLanes;if(c===0)return 0;var f=0,m=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var w=c&134217727;return w!==0?(c=w&~m,c!==0?f=Vs(c):(b&=w,b!==0?f=Vs(b):a||(a=w&~i,a!==0&&(f=Vs(a))))):(w=c&~m,w!==0?f=Vs(w):b!==0?f=Vs(b):a||(a=c&~i,a!==0&&(f=Vs(a)))),f===0?0:r!==0&&r!==f&&(r&m)===0&&(m=f&-f,a=r&-r,m>=a||m===32&&(a&4194048)!==0)?r:f}function Xo(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function AO(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 bg(){var i=Vl;return Vl<<=1,(Vl&4194048)===0&&(Vl=256),i}function vg(){var i=Ul;return Ul<<=1,(Ul&62914560)===0&&(Ul=4194304),i}function Df(i){for(var r=[],a=0;31>a;a++)r.push(i);return r}function Jo(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function EO(i,r,a,c,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 w=i.entanglements,E=i.expirationTimes,$=i.hiddenUpdates;for(a=b&~a;0<a;){var K=31-cn(a),H=1<<K;w[K]=0,E[K]=-1;var L=$[K];if(L!==null)for($[K]=null,K=0;K<L.length;K++){var U=L[K];U!==null&&(U.lane&=-536870913)}a&=~H}c!==0&&Sg(i,c,0),m!==0&&f===0&&i.tag!==0&&(i.suspendedLanes|=m&~(b&~r))}function Sg(i,r,a){i.pendingLanes|=r,i.suspendedLanes&=~r;var c=31-cn(r);i.entangledLanes|=r,i.entanglements[c]=i.entanglements[c]|1073741824|a&4194090}function wg(i,r){var a=i.entangledLanes|=r;for(i=i.entanglements;a;){var c=31-cn(a),f=1<<c;f&r|i[c]&r&&(i[c]|=r),a&=~f}}function Nf(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 $f(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function xg(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:tS(i.type))}function RO(i,r){var a=q.p;try{return q.p=i,r()}finally{q.p=a}}var Zi=Math.random().toString(36).slice(2),qt="__reactFiber$"+Zi,Qt="__reactProps$"+Zi,xr="__reactContainer$"+Zi,jf="__reactEvents$"+Zi,OO="__reactListeners$"+Zi,_O="__reactHandles$"+Zi,Tg="__reactResources$"+Zi,Zo="__reactMarker$"+Zi;function Bf(i){delete i[qt],delete i[Qt],delete i[jf],delete i[OO],delete i[_O]}function Tr(i){var r=i[qt];if(r)return r;for(var a=i.parentNode;a;){if(r=a[xr]||a[qt]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(i=z0(i);i!==null;){if(a=i[qt])return a;i=z0(i)}return r}i=a,a=i.parentNode}return null}function Ar(i){if(i=i[qt]||i[xr]){var r=i.tag;if(r===5||r===6||r===13||r===26||r===27||r===3)return i}return null}function Qo(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(s(33))}function Er(i){var r=i[Tg];return r||(r=i[Tg]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Mt(i){i[Zo]=!0}var Ag=new Set,Eg={};function Us(i,r){Rr(i,r),Rr(i+"Capture",r)}function Rr(i,r){for(Eg[i]=r,i=0;i<r.length;i++)Ag.add(r[i])}var kO=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]*$"),Rg={},Og={};function MO(i){return we.call(Og,i)?!0:we.call(Rg,i)?!1:kO.test(i)?Og[i]=!0:(Rg[i]=!0,!1)}function Kl(i,r,a){if(MO(r))if(a===null)i.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var c=r.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+a)}}function ql(i,r,a){if(a===null)i.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+a)}}function vi(i,r,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(r,a,""+c)}}var Lf,_g;function Or(i){if(Lf===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);Lf=r&&r[1]||"",_g=-1<a.stack.indexOf(`
|
|
53
|
+
*/var SS;function eC(){if(SS)return Fa;SS=1;var t=QM(),e=ay(),n=I1();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 l(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 f(i){if(l(i)!==i)throw Error(r(188))}function h(i){var s=i.alternate;if(!s){if(s=l(i),s===null)throw Error(r(188));return s!==i?null:i}for(var a=i,c=s;;){var d=a.return;if(d===null)break;var m=d.alternate;if(m===null){if(c=d.return,c!==null){a=c;continue}break}if(d.child===m.child){for(m=d.child;m;){if(m===a)return f(d),i;if(m===c)return f(d),s;m=m.sibling}throw Error(r(188))}if(a.return!==c.return)a=d,c=m;else{for(var b=!1,w=d.child;w;){if(w===a){b=!0,a=d,c=m;break}if(w===c){b=!0,c=d,a=m;break}w=w.sibling}if(!b){for(w=m.child;w;){if(w===a){b=!0,a=m,c=d;break}if(w===c){b=!0,c=m,a=d;break}w=w.sibling}if(!b)throw Error(r(189))}}if(a.alternate!==c)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"),x=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),M=Symbol.for("react.provider"),O=Symbol.for("react.consumer"),C=Symbol.for("react.context"),j=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),Y=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),ee=Symbol.for("react.activity"),re=Symbol.for("react.memo_cache_sentinel"),ue=Symbol.iterator;function ge(i){return i===null||typeof i!="object"?null:(i=ue&&i[ue]||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 x:return"Fragment";case D:return"Profiler";case T:return"StrictMode";case _:return"Suspense";case J:return"SuspenseList";case ee:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case S:return"Portal";case C:return(i.displayName||"Context")+".Provider";case O:return(i._context.displayName||"Context")+".Consumer";case j:var s=i.render;return i=i.displayName,i||(i=s.displayName||s.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Y:return s=i.displayName||null,s!==null?s:Q(i.type)||"Memo";case F: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,q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},ne=[],A=-1;function P(i){return{current:i}}function te(i){0>A||(i.current=ne[A],ne[A]=null,A--)}function X(i,s){A++,ne[A]=i.current,i.current=s}var oe=P(null),fe=P(null),le=P(null),it=P(null);function Ve(i,s){switch(X(le,s),X(fe,i),X(oe,null),s.nodeType){case 9:case 11:i=(i=s.documentElement)&&(i=i.namespaceURI)?j0(i):0;break;default:if(i=s.tagName,s=s.namespaceURI)s=j0(s),i=B0(s,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}te(oe),X(oe,i)}function xn(){te(oe),te(fe),te(le)}function Xi(i){i.memoizedState!==null&&X(it,i);var s=oe.current,a=B0(s,i.type);s!==a&&(X(fe,i),X(oe,a))}function vi(i){fe.current===i&&(te(oe),te(fe)),it.current===i&&(te(it),za._currentValue=z)}var we=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,Ae=t.unstable_cancelCallback,et=t.unstable_shouldYield,At=t.unstable_requestPaint,xe=t.unstable_now,Kn=t.unstable_getCurrentPriorityLevel,Gt=t.unstable_ImmediatePriority,Kt=t.unstable_UserBlockingPriority,Tn=t.unstable_NormalPriority,Qn=t.unstable_LowPriority,An=t.unstable_IdlePriority,Wn=t.log,Ll=t.unstable_setDisableYieldValue,Yo=null,cn=null;function Ji(i){if(typeof Wn=="function"&&Ll(i),cn&&typeof cn.setStrictMode=="function")try{cn.setStrictMode(Yo,i)}catch{}}var un=Math.clz32?Math.clz32:TO,wO=Math.log,xO=Math.LN2;function TO(i){return i>>>=0,i===0?32:31-(wO(i)/xO|0)|0}var Vl=256,Ul=4194304;function Vr(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 zl(i,s,a){var c=i.pendingLanes;if(c===0)return 0;var d=0,m=i.suspendedLanes,b=i.pingedLanes;i=i.warmLanes;var w=c&134217727;return w!==0?(c=w&~m,c!==0?d=Vr(c):(b&=w,b!==0?d=Vr(b):a||(a=w&~i,a!==0&&(d=Vr(a))))):(w=c&~m,w!==0?d=Vr(w):b!==0?d=Vr(b):a||(a=c&~i,a!==0&&(d=Vr(a)))),d===0?0:s!==0&&s!==d&&(s&m)===0&&(m=d&-d,a=s&-s,m>=a||m===32&&(a&4194048)!==0)?s:d}function Xo(i,s){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&s)===0}function AO(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 bg(){var i=Vl;return Vl<<=1,(Vl&4194048)===0&&(Vl=256),i}function vg(){var i=Ul;return Ul<<=1,(Ul&62914560)===0&&(Ul=4194304),i}function Df(i){for(var s=[],a=0;31>a;a++)s.push(i);return s}function Jo(i,s){i.pendingLanes|=s,s!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function EO(i,s,a,c,d,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 w=i.entanglements,E=i.expirationTimes,$=i.hiddenUpdates;for(a=b&~a;0<a;){var K=31-un(a),H=1<<K;w[K]=0,E[K]=-1;var L=$[K];if(L!==null)for($[K]=null,K=0;K<L.length;K++){var U=L[K];U!==null&&(U.lane&=-536870913)}a&=~H}c!==0&&Sg(i,c,0),m!==0&&d===0&&i.tag!==0&&(i.suspendedLanes|=m&~(b&~s))}function Sg(i,s,a){i.pendingLanes|=s,i.suspendedLanes&=~s;var c=31-un(s);i.entangledLanes|=s,i.entanglements[c]=i.entanglements[c]|1073741824|a&4194090}function wg(i,s){var a=i.entangledLanes|=s;for(i=i.entanglements;a;){var c=31-un(a),d=1<<c;d&s|i[c]&s&&(i[c]|=s),a&=~d}}function Nf(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 $f(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function xg(){var i=q.p;return i!==0?i:(i=window.event,i===void 0?32:tS(i.type))}function RO(i,s){var a=q.p;try{return q.p=i,s()}finally{q.p=a}}var Zi=Math.random().toString(36).slice(2),qt="__reactFiber$"+Zi,Qt="__reactProps$"+Zi,xs="__reactContainer$"+Zi,jf="__reactEvents$"+Zi,OO="__reactListeners$"+Zi,_O="__reactHandles$"+Zi,Tg="__reactResources$"+Zi,Zo="__reactMarker$"+Zi;function Bf(i){delete i[qt],delete i[Qt],delete i[jf],delete i[OO],delete i[_O]}function Ts(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=z0(i);i!==null;){if(a=i[qt])return a;i=z0(i)}return s}i=a,a=i.parentNode}return null}function As(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 Qo(i){var s=i.tag;if(s===5||s===26||s===27||s===6)return i.stateNode;throw Error(r(33))}function Es(i){var s=i[Tg];return s||(s=i[Tg]={hoistableStyles:new Map,hoistableScripts:new Map}),s}function Mt(i){i[Zo]=!0}var Ag=new Set,Eg={};function Ur(i,s){Rs(i,s),Rs(i+"Capture",s)}function Rs(i,s){for(Eg[i]=s,i=0;i<s.length;i++)Ag.add(s[i])}var kO=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]*$"),Rg={},Og={};function MO(i){return we.call(Og,i)?!0:we.call(Rg,i)?!1:kO.test(i)?Og[i]=!0:(Rg[i]=!0,!1)}function Kl(i,s,a){if(MO(s))if(a===null)i.removeAttribute(s);else{switch(typeof a){case"undefined":case"function":case"symbol":i.removeAttribute(s);return;case"boolean":var c=s.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){i.removeAttribute(s);return}}i.setAttribute(s,""+a)}}function ql(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 Si(i,s,a,c){if(c===null)i.removeAttribute(a);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(a);return}i.setAttributeNS(s,a,""+c)}}var Lf,_g;function Os(i){if(Lf===void 0)try{throw Error()}catch(a){var s=a.stack.trim().match(/\n( *(at )?)/);Lf=s&&s[1]||"",_g=-1<a.stack.indexOf(`
|
|
54
54
|
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
55
|
-
`+Lf+i+_g}var Vf=!1;function Uf(i,
|
|
55
|
+
`+Lf+i+_g}var Vf=!1;function Uf(i,s){if(!i||Vf)return"";Vf=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(s){var H=function(){throw Error()};if(Object.defineProperty(H.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(H,[])}catch(U){var L=U}Reflect.construct(i,[],H)}else{try{H.call()}catch(U){L=U}i.call(H.prototype)}}else{try{throw Error()}catch(U){L=U}(H=i())&&typeof H.catch=="function"&&H.catch(function(){})}}catch(U){if(U&&L&&typeof U.stack=="string")return[U.stack,L.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var d=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");d&&d.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var m=c.DetermineComponentFrameRoot(),b=m[0],w=m[1];if(b&&w){var E=b.split(`
|
|
56
56
|
`),$=w.split(`
|
|
57
|
-
`);for(
|
|
58
|
-
`+E[c].replace(" at new "," at ");return i.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",i.displayName)),K}while(1<=c&&0<=
|
|
57
|
+
`);for(d=c=0;c<E.length&&!E[c].includes("DetermineComponentFrameRoot");)c++;for(;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;if(c===E.length||d===$.length)for(c=E.length-1,d=$.length-1;1<=c&&0<=d&&E[c]!==$[d];)d--;for(;1<=c&&0<=d;c--,d--)if(E[c]!==$[d]){if(c!==1||d!==1)do if(c--,d--,0>d||E[c]!==$[d]){var K=`
|
|
58
|
+
`+E[c].replace(" at new "," at ");return i.displayName&&K.includes("<anonymous>")&&(K=K.replace("<anonymous>",i.displayName)),K}while(1<=c&&0<=d);break}}}finally{Vf=!1,Error.prepareStackTrace=a}return(a=i?i.displayName||i.name:"")?Os(a):""}function CO(i){switch(i.tag){case 26:case 27:case 5:return Os(i.type);case 16:return Os("Lazy");case 13:return Os("Suspense");case 19:return Os("SuspenseList");case 0:case 15:return Uf(i.type,!1);case 11:return Uf(i.type.render,!1);case 1:return Uf(i.type,!0);case 31:return Os("Activity");default:return""}}function kg(i){try{var s="";do s+=CO(i),i=i.return;while(i);return s}catch(a){return`
|
|
59
59
|
Error generating stack: `+a.message+`
|
|
60
|
-
`+a.stack}}function An(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Mg(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function DO(i){var r=Mg(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,r),c=""+i[r];if(!i.hasOwnProperty(r)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var f=a.get,m=a.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return f.call(this)},set:function(b){c=""+b,m.call(this,b)}}),Object.defineProperty(i,r,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(b){c=""+b},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function Pl(i){i._valueTracker||(i._valueTracker=DO(i))}function Cg(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var a=r.getValue(),c="";return i&&(c=Mg(i)?i.checked?"true":"false":i.value),i=c,i!==a?(r.setValue(i),!0):!1}function Il(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 NO=/[\n"\\]/g;function En(i){return i.replace(NO,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function zf(i,r,a,c,f,m,b,w){i.name="",b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?i.type=b:i.removeAttribute("type"),r!=null?b==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+An(r)):i.value!==""+An(r)&&(i.value=""+An(r)):b!=="submit"&&b!=="reset"||i.removeAttribute("value"),r!=null?Kf(i,b,An(r)):a!=null?Kf(i,b,An(a)):c!=null&&i.removeAttribute("value"),f==null&&m!=null&&(i.defaultChecked=!!m),f!=null&&(i.checked=f&&typeof f!="function"&&typeof f!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+An(w):i.removeAttribute("name")}function Dg(i,r,a,c,f,m,b,w){if(m!=null&&typeof m!="function"&&typeof m!="symbol"&&typeof m!="boolean"&&(i.type=m),r!=null||a!=null){if(!(m!=="submit"&&m!=="reset"||r!=null))return;a=a!=null?""+An(a):"",r=r!=null?""+An(r):a,w||r===i.value||(i.value=r),i.defaultValue=r}c=c??f,c=typeof c!="function"&&typeof c!="symbol"&&!!c,i.checked=w?i.checked:!!c,i.defaultChecked=!!c,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b)}function Kf(i,r,a){r==="number"&&Il(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function _r(i,r,a,c){if(i=i.options,r){r={};for(var f=0;f<a.length;f++)r["$"+a[f]]=!0;for(a=0;a<i.length;a++)f=r.hasOwnProperty("$"+i[a].value),i[a].selected!==f&&(i[a].selected=f),f&&c&&(i[a].defaultSelected=!0)}else{for(a=""+An(a),r=null,f=0;f<i.length;f++){if(i[f].value===a){i[f].selected=!0,c&&(i[f].defaultSelected=!0);return}r!==null||i[f].disabled||(r=i[f])}r!==null&&(r.selected=!0)}}function Ng(i,r,a){if(r!=null&&(r=""+An(r),r!==i.value&&(i.value=r),a==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=a!=null?""+An(a):""}function $g(i,r,a,c){if(r==null){if(c!=null){if(a!=null)throw Error(s(92));if(W(c)){if(1<c.length)throw Error(s(93));c=c[0]}a=c}a==null&&(a=""),r=a}a=An(r),i.defaultValue=a,c=i.textContent,c===a&&c!==""&&c!==null&&(i.value=c)}function kr(i,r){if(r){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=r;return}}i.textContent=r}var $O=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 jg(i,r,a){var c=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":c?i.setProperty(r,a):typeof a!="number"||a===0||$O.has(r)?r==="float"?i.cssFloat=a:i[r]=(""+a).trim():i[r]=a+"px"}function Bg(i,r,a){if(r!=null&&typeof r!="object")throw Error(s(62));if(i=i.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||r!=null&&r.hasOwnProperty(c)||(c.indexOf("--")===0?i.setProperty(c,""):c==="float"?i.cssFloat="":i[c]="");for(var f in r)c=r[f],r.hasOwnProperty(f)&&a[f]!==c&&jg(i,f,c)}else for(var m in r)r.hasOwnProperty(m)&&jg(i,m,r[m])}function qf(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 jO=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"]]),BO=/^[\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 Hl(i){return BO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Pf=null;function If(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Mr=null,Cr=null;function Lg(i){var r=Ar(i);if(r&&(i=r.stateNode)){var a=i[Qt]||null;e:switch(i=r.stateNode,r.type){case"input":if(zf(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=i;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+En(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var c=a[r];if(c!==i&&c.form===i.form){var f=c[Qt]||null;if(!f)throw Error(s(90));zf(c,f.value,f.defaultValue,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name)}}for(r=0;r<a.length;r++)c=a[r],c.form===i.form&&Cg(c)}break e;case"textarea":Ng(i,a.value,a.defaultValue);break e;case"select":r=a.value,r!=null&&_r(i,!!a.multiple,r,!1)}}}var Hf=!1;function Vg(i,r,a){if(Hf)return i(r,a);Hf=!0;try{var c=i(r);return c}finally{if(Hf=!1,(Mr!==null||Cr!==null)&&(Mc(),Mr&&(r=Mr,i=Cr,Cr=Mr=null,Lg(r),i)))for(r=0;r<i.length;r++)Lg(i[r])}}function Wo(i,r){var a=i.stateNode;if(a===null)return null;var c=a[Qt]||null;if(c===null)return null;a=c[r];e:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(s(231,r,typeof a));return a}var Si=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ff=!1;if(Si)try{var ea={};Object.defineProperty(ea,"passive",{get:function(){Ff=!0}}),window.addEventListener("test",ea,ea),window.removeEventListener("test",ea,ea)}catch{Ff=!1}var Qi=null,Gf=null,Fl=null;function Ug(){if(Fl)return Fl;var i,r=Gf,a=r.length,c,f="value"in Qi?Qi.value:Qi.textContent,m=f.length;for(i=0;i<a&&r[i]===f[i];i++);var b=a-i;for(c=1;c<=b&&r[a-c]===f[m-c];c++);return Fl=f.slice(i,1<c?1-c:void 0)}function Gl(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function Yl(){return!0}function zg(){return!1}function Wt(i){function r(a,c,f,m,b){this._reactName=a,this._targetInst=f,this.type=c,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(a=i[w],this[w]=a?a(m):m[w]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Yl:zg,this.isPropagationStopped=zg,this}return y(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Yl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),r}var zs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xl=Wt(zs),ta=y({},zs,{view:0,detail:0}),LO=Wt(ta),Yf,Xf,na,Jl=y({},ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zf,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!==na&&(na&&i.type==="mousemove"?(Yf=i.screenX-na.screenX,Xf=i.screenY-na.screenY):Xf=Yf=0,na=i),Yf)},movementY:function(i){return"movementY"in i?i.movementY:Xf}}),Kg=Wt(Jl),VO=y({},Jl,{dataTransfer:0}),UO=Wt(VO),zO=y({},ta,{relatedTarget:0}),Jf=Wt(zO),KO=y({},zs,{animationName:0,elapsedTime:0,pseudoElement:0}),qO=Wt(KO),PO=y({},zs,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),IO=Wt(PO),HO=y({},zs,{data:0}),qg=Wt(HO),FO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GO={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"},YO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XO(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=YO[i])?!!r[i]:!1}function Zf(){return XO}var JO=y({},ta,{key:function(i){if(i.key){var r=FO[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Gl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?GO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zf,charCode:function(i){return i.type==="keypress"?Gl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Gl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),ZO=Wt(JO),QO=y({},Jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pg=Wt(QO),WO=y({},ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zf}),e_=Wt(WO),t_=y({},zs,{propertyName:0,elapsedTime:0,pseudoElement:0}),n_=Wt(t_),i_=y({},Jl,{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}),s_=Wt(i_),r_=y({},zs,{newState:0,oldState:0}),o_=Wt(r_),a_=[9,13,27,32],Qf=Si&&"CompositionEvent"in window,ia=null;Si&&"documentMode"in document&&(ia=document.documentMode);var l_=Si&&"TextEvent"in window&&!ia,Ig=Si&&(!Qf||ia&&8<ia&&11>=ia),Hg=" ",Fg=!1;function Gg(i,r){switch(i){case"keyup":return a_.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Dr=!1;function c_(i,r){switch(i){case"compositionend":return Yg(r);case"keypress":return r.which!==32?null:(Fg=!0,Hg);case"textInput":return i=r.data,i===Hg&&Fg?null:i;default:return null}}function u_(i,r){if(Dr)return i==="compositionend"||!Qf&&Gg(i,r)?(i=Ug(),Fl=Gf=Qi=null,Dr=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return Ig&&r.locale!=="ko"?null:r.data;default:return null}}var f_={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 Xg(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!f_[i.type]:r==="textarea"}function Jg(i,r,a,c){Mr?Cr?Cr.push(c):Cr=[c]:Mr=c,r=Bc(r,"onChange"),0<r.length&&(a=new Xl("onChange","change",null,a,c),i.push({event:a,listeners:r}))}var sa=null,ra=null;function d_(i){M0(i,0)}function Zl(i){var r=Qo(i);if(Cg(r))return i}function Zg(i,r){if(i==="change")return r}var Qg=!1;if(Si){var Wf;if(Si){var ed="oninput"in document;if(!ed){var Wg=document.createElement("div");Wg.setAttribute("oninput","return;"),ed=typeof Wg.oninput=="function"}Wf=ed}else Wf=!1;Qg=Wf&&(!document.documentMode||9<document.documentMode)}function eb(){sa&&(sa.detachEvent("onpropertychange",tb),ra=sa=null)}function tb(i){if(i.propertyName==="value"&&Zl(ra)){var r=[];Jg(r,ra,i,If(i)),Vg(d_,r)}}function h_(i,r,a){i==="focusin"?(eb(),sa=r,ra=a,sa.attachEvent("onpropertychange",tb)):i==="focusout"&&eb()}function p_(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Zl(ra)}function m_(i,r){if(i==="click")return Zl(r)}function y_(i,r){if(i==="input"||i==="change")return Zl(r)}function g_(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var un=typeof Object.is=="function"?Object.is:g_;function oa(i,r){if(un(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var a=Object.keys(i),c=Object.keys(r);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var f=a[c];if(!we.call(r,f)||!un(i[f],r[f]))return!1}return!0}function nb(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function ib(i,r){var a=nb(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=r&&c>=r)return{node:a,offset:r-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=nb(a)}}function sb(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?sb(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function rb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=Il(i.document);r instanceof i.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)i=r.contentWindow;else break;r=Il(i.document)}return r}function td(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var b_=Si&&"documentMode"in document&&11>=document.documentMode,Nr=null,nd=null,aa=null,id=!1;function ob(i,r,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;id||Nr==null||Nr!==Il(c)||(c=Nr,"selectionStart"in c&&td(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),aa&&oa(aa,c)||(aa=c,c=Bc(nd,"onSelect"),0<c.length&&(r=new Xl("onSelect","select",null,r,a),i.push({event:r,listeners:c}),r.target=Nr)))}function Ks(i,r){var a={};return a[i.toLowerCase()]=r.toLowerCase(),a["Webkit"+i]="webkit"+r,a["Moz"+i]="moz"+r,a}var $r={animationend:Ks("Animation","AnimationEnd"),animationiteration:Ks("Animation","AnimationIteration"),animationstart:Ks("Animation","AnimationStart"),transitionrun:Ks("Transition","TransitionRun"),transitionstart:Ks("Transition","TransitionStart"),transitioncancel:Ks("Transition","TransitionCancel"),transitionend:Ks("Transition","TransitionEnd")},sd={},ab={};Si&&(ab=document.createElement("div").style,"AnimationEvent"in window||(delete $r.animationend.animation,delete $r.animationiteration.animation,delete $r.animationstart.animation),"TransitionEvent"in window||delete $r.transitionend.transition);function qs(i){if(sd[i])return sd[i];if(!$r[i])return i;var r=$r[i],a;for(a in r)if(r.hasOwnProperty(a)&&a in ab)return sd[i]=r[a];return i}var lb=qs("animationend"),cb=qs("animationiteration"),ub=qs("animationstart"),v_=qs("transitionrun"),S_=qs("transitionstart"),w_=qs("transitioncancel"),fb=qs("transitionend"),db=new Map,rd="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(" ");rd.push("scrollEnd");function Kn(i,r){db.set(i,r),Us(r,[i])}var hb=new WeakMap;function Rn(i,r){if(typeof i=="object"&&i!==null){var a=hb.get(i);return a!==void 0?a:(r={value:i,source:r,stack:kg(r)},hb.set(i,r),r)}return{value:i,source:r,stack:kg(r)}}var On=[],jr=0,od=0;function Ql(){for(var i=jr,r=od=jr=0;r<i;){var a=On[r];On[r++]=null;var c=On[r];On[r++]=null;var f=On[r];On[r++]=null;var m=On[r];if(On[r++]=null,c!==null&&f!==null){var b=c.pending;b===null?f.next=f:(f.next=b.next,b.next=f),c.pending=f}m!==0&&pb(a,f,m)}}function Wl(i,r,a,c){On[jr++]=i,On[jr++]=r,On[jr++]=a,On[jr++]=c,od|=c,i.lanes|=c,i=i.alternate,i!==null&&(i.lanes|=c)}function ad(i,r,a,c){return Wl(i,r,a,c),ec(i)}function Br(i,r){return Wl(i,null,null,r),ec(i)}function pb(i,r,a){i.lanes|=a;var c=i.alternate;c!==null&&(c.lanes|=a);for(var f=!1,m=i.return;m!==null;)m.childLanes|=a,c=m.alternate,c!==null&&(c.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&&r!==null&&(f=31-cn(a),i=m.hiddenUpdates,c=i[f],c===null?i[f]=[r]:c.push(r),r.lane=a|536870912),m):null}function ec(i){if(50<Da)throw Da=0,hh=null,Error(s(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var Lr={};function x_(i,r,a,c){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=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function fn(i,r,a,c){return new x_(i,r,a,c)}function ld(i){return i=i.prototype,!(!i||!i.isReactComponent)}function wi(i,r){var a=i.alternate;return a===null?(a=fn(i.tag,r,i.key,i.mode),a.elementType=i.elementType,a.type=i.type,a.stateNode=i.stateNode,a.alternate=i,i.alternate=a):(a.pendingProps=r,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,r=i.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=i.sibling,a.index=i.index,a.ref=i.ref,a.refCleanup=i.refCleanup,a}function mb(i,r){i.flags&=65011714;var a=i.alternate;return a===null?(i.childLanes=0,i.lanes=r,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,r=a.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function tc(i,r,a,c,f,m){var b=0;if(c=i,typeof i=="function")ld(i)&&(b=1);else if(typeof i=="string")b=Ak(i,a,oe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ee:return i=fn(31,a,r,f),i.elementType=ee,i.lanes=m,i;case x:return Ps(a.children,f,m,r);case T:b=8,f|=24;break;case D:return i=fn(12,a,r,f|2),i.elementType=D,i.lanes=m,i;case _:return i=fn(13,a,r,f),i.elementType=_,i.lanes=m,i;case J:return i=fn(19,a,r,f),i.elementType=J,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case M:case C:b=10;break e;case O:b=9;break e;case j:b=11;break e;case Y:b=14;break e;case F:b=16,c=null;break e}b=29,a=Error(s(130,i===null?"null":typeof i,"")),c=null}return r=fn(b,a,r,f),r.elementType=i,r.type=c,r.lanes=m,r}function Ps(i,r,a,c){return i=fn(7,i,c,r),i.lanes=a,i}function cd(i,r,a){return i=fn(6,i,null,r),i.lanes=a,i}function ud(i,r,a){return r=fn(4,i.children!==null?i.children:[],i.key,r),r.lanes=a,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var Vr=[],Ur=0,nc=null,ic=0,_n=[],kn=0,Is=null,xi=1,Ti="";function Hs(i,r){Vr[Ur++]=ic,Vr[Ur++]=nc,nc=i,ic=r}function yb(i,r,a){_n[kn++]=xi,_n[kn++]=Ti,_n[kn++]=Is,Is=i;var c=xi;i=Ti;var f=32-cn(c)-1;c&=~(1<<f),a+=1;var m=32-cn(r)+f;if(30<m){var b=f-f%5;m=(c&(1<<b)-1).toString(32),c>>=b,f-=b,xi=1<<32-cn(r)+f|a<<f|c,Ti=m+i}else xi=1<<m|a<<f|c,Ti=i}function fd(i){i.return!==null&&(Hs(i,1),yb(i,1,0))}function dd(i){for(;i===nc;)nc=Vr[--Ur],Vr[Ur]=null,ic=Vr[--Ur],Vr[Ur]=null;for(;i===Is;)Is=_n[--kn],_n[kn]=null,Ti=_n[--kn],_n[kn]=null,xi=_n[--kn],_n[kn]=null}var Yt=null,st=null,$e=!1,Fs=null,Wn=!1,hd=Error(s(519));function Gs(i){var r=Error(s(418,""));throw ua(Rn(r,i)),hd}function gb(i){var r=i.stateNode,a=i.type,c=i.memoizedProps;switch(r[qt]=i,r[Qt]=c,a){case"dialog":Oe("cancel",r),Oe("close",r);break;case"iframe":case"object":case"embed":Oe("load",r);break;case"video":case"audio":for(a=0;a<$a.length;a++)Oe($a[a],r);break;case"source":Oe("error",r);break;case"img":case"image":case"link":Oe("error",r),Oe("load",r);break;case"details":Oe("toggle",r);break;case"input":Oe("invalid",r),Dg(r,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0),Pl(r);break;case"select":Oe("invalid",r);break;case"textarea":Oe("invalid",r),$g(r,c.value,c.defaultValue,c.children),Pl(r)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||c.suppressHydrationWarning===!0||$0(r.textContent,a)?(c.popover!=null&&(Oe("beforetoggle",r),Oe("toggle",r)),c.onScroll!=null&&Oe("scroll",r),c.onScrollEnd!=null&&Oe("scrollend",r),c.onClick!=null&&(r.onclick=Lc),r=!0):r=!1,r||Gs(i)}function bb(i){for(Yt=i.return;Yt;)switch(Yt.tag){case 5:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:Yt=Yt.return}}function la(i){if(i!==Yt)return!1;if(!$e)return bb(i),$e=!0,!1;var r=i.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=i.type,a=!(a!=="form"&&a!=="button")||kh(i.type,i.memoizedProps)),a=!a),a&&st&&Gs(i),bb(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(s(317));e:{for(i=i.nextSibling,r=0;i;){if(i.nodeType===8)if(a=i.data,a==="/$"){if(r===0){st=Pn(i.nextSibling);break e}r--}else a!=="$"&&a!=="$!"&&a!=="$?"||r++;i=i.nextSibling}st=null}}else r===27?(r=st,ps(i.type)?(i=Nh,Nh=null,st=i):st=r):st=Yt?Pn(i.stateNode.nextSibling):null;return!0}function ca(){st=Yt=null,$e=!1}function vb(){var i=Fs;return i!==null&&(nn===null?nn=i:nn.push.apply(nn,i),Fs=null),i}function ua(i){Fs===null?Fs=[i]:Fs.push(i)}var pd=P(null),Ys=null,Ai=null;function Wi(i,r,a){X(pd,r._currentValue),r._currentValue=a}function Ei(i){i._currentValue=pd.current,te(pd)}function md(i,r,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,c!==null&&(c.childLanes|=r)):c!==null&&(c.childLanes&r)!==r&&(c.childLanes|=r),i===a)break;i=i.return}}function yd(i,r,a,c){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 w=m;m=f;for(var E=0;E<r.length;E++)if(w.context===r[E]){m.lanes|=a,w=m.alternate,w!==null&&(w.lanes|=a),md(m.return,a,i),c||(b=null);break e}m=w.next}}else if(f.tag===18){if(b=f.return,b===null)throw Error(s(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),md(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 fa(i,r,a,c){i=null;for(var f=r,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(s(387));if(b=b.memoizedProps,b!==null){var w=f.type;un(f.pendingProps.value,b.value)||(i!==null?i.push(w):i=[w])}}else if(f===it.current){if(b=f.alternate,b===null)throw Error(s(387));b.memoizedState.memoizedState!==f.memoizedState.memoizedState&&(i!==null?i.push(za):i=[za])}f=f.return}i!==null&&yd(r,i,a,c),r.flags|=262144}function sc(i){for(i=i.firstContext;i!==null;){if(!un(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Xs(i){Ys=i,Ai=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Pt(i){return Sb(Ys,i)}function rc(i,r){return Ys===null&&Xs(i),Sb(i,r)}function Sb(i,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},Ai===null){if(i===null)throw Error(s(308));Ai=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else Ai=Ai.next=r;return a}var T_=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(a,c){i.push(c)}};this.abort=function(){r.aborted=!0,i.forEach(function(a){return a()})}},A_=t.unstable_scheduleCallback,E_=t.unstable_NormalPriority,Et={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gd(){return{controller:new T_,data:new Map,refCount:0}}function da(i){i.refCount--,i.refCount===0&&A_(E_,function(){i.controller.abort()})}var ha=null,bd=0,zr=0,Kr=null;function R_(i,r){if(ha===null){var a=ha=[];bd=0,zr=Sh(),Kr={status:"pending",value:void 0,then:function(c){a.push(c)}}}return bd++,r.then(wb,wb),r}function wb(){if(--bd===0&&ha!==null){Kr!==null&&(Kr.status="fulfilled");var i=ha;ha=null,zr=0,Kr=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function O_(i,r){var a=[],c={status:"pending",value:null,reason:null,then:function(f){a.push(f)}};return i.then(function(){c.status="fulfilled",c.value=r;for(var f=0;f<a.length;f++)(0,a[f])(r)},function(f){for(c.status="rejected",c.reason=f,f=0;f<a.length;f++)(0,a[f])(void 0)}),c}var xb=B.S;B.S=function(i,r){typeof r=="object"&&r!==null&&typeof r.then=="function"&&R_(i,r),xb!==null&&xb(i,r)};var Js=P(null);function vd(){var i=Js.current;return i!==null?i:Fe.pooledCache}function oc(i,r){r===null?X(Js,Js.current):X(Js,r.pool)}function Tb(){var i=vd();return i===null?null:{parent:Et._currentValue,pool:i}}var pa=Error(s(460)),Ab=Error(s(474)),ac=Error(s(542)),Sd={then:function(){}};function Eb(i){return i=i.status,i==="fulfilled"||i==="rejected"}function lc(){}function Rb(i,r,a){switch(a=i[a],a===void 0?i.push(r):a!==r&&(r.then(lc,lc),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,_b(i),i;default:if(typeof r.status=="string")r.then(lc,lc);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(s(482));i=r,i.status="pending",i.then(function(c){if(r.status==="pending"){var f=r;f.status="fulfilled",f.value=c}},function(c){if(r.status==="pending"){var f=r;f.status="rejected",f.reason=c}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,_b(i),i}throw ma=r,pa}}var ma=null;function Ob(){if(ma===null)throw Error(s(459));var i=ma;return ma=null,i}function _b(i){if(i===pa||i===ac)throw Error(s(483))}var es=!1;function wd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xd(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function ts(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function ns(i,r,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Be&2)!==0){var f=c.pending;return f===null?r.next=r:(r.next=f.next,f.next=r),c.pending=r,r=ec(i),pb(i,null,a),r}return Wl(i,c,r,a),ec(i)}function ya(i,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var c=r.lanes;c&=i.pendingLanes,a|=c,r.lanes=a,wg(i,a)}}function Td(i,r){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){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=r:m=m.next=r}else f=m=r;a={baseState:c.baseState,firstBaseUpdate:f,lastBaseUpdate:m,shared:c.shared,callbacks:c.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=r:i.next=r,a.lastBaseUpdate=r}var Ad=!1;function ga(){if(Ad){var i=Kr;if(i!==null)throw i}}function ba(i,r,a,c){Ad=!1;var f=i.updateQueue;es=!1;var m=f.firstBaseUpdate,b=f.lastBaseUpdate,w=f.shared.pending;if(w!==null){f.shared.pending=null;var E=w,$=E.next;E.next=null,b===null?m=$:b.next=$,b=E;var K=i.alternate;K!==null&&(K=K.updateQueue,w=K.lastBaseUpdate,w!==b&&(w===null?K.firstBaseUpdate=$:w.next=$,K.lastBaseUpdate=E))}if(m!==null){var H=f.baseState;b=0,K=$=E=null,w=m;do{var L=w.lane&-536870913,U=L!==w.lane;if(U?(Ce&L)===L:(c&L)===L){L!==0&&L===zr&&(Ad=!0),K!==null&&(K=K.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var me=i,de=w;L=r;var Ke=a;switch(de.tag){case 1:if(me=de.payload,typeof me=="function"){H=me.call(Ke,H,L);break e}H=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=de.payload,L=typeof me=="function"?me.call(Ke,H,L):me,L==null)break e;H=y({},H,L);break e;case 2:es=!0}}L=w.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:w.tag,payload:w.payload,callback:w.callback,next:null},K===null?($=K=U,E=H):K=K.next=U,b|=L;if(w=w.next,w===null){if(w=f.shared.pending,w===null)break;U=w,w=U.next,U.next=null,f.lastBaseUpdate=U,f.shared.pending=null}}while(!0);K===null&&(E=H),f.baseState=E,f.firstBaseUpdate=$,f.lastBaseUpdate=K,m===null&&(f.shared.lanes=0),us|=b,i.lanes=b,i.memoizedState=H}}function kb(i,r){if(typeof i!="function")throw Error(s(191,i));i.call(r)}function Mb(i,r){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)kb(a[i],r)}var qr=P(null),cc=P(0);function Cb(i,r){i=Di,X(cc,i),X(qr,r),Di=i|r.baseLanes}function Ed(){X(cc,Di),X(qr,qr.current)}function Rd(){Di=cc.current,te(qr),te(cc)}var is=0,Te=null,Ue=null,yt=null,uc=!1,Pr=!1,Zs=!1,fc=0,va=0,Ir=null,__=0;function ft(){throw Error(s(321))}function Od(i,r){if(r===null)return!1;for(var a=0;a<r.length&&a<i.length;a++)if(!un(i[a],r[a]))return!1;return!0}function _d(i,r,a,c,f,m){return is=m,Te=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,B.H=i===null||i.memoizedState===null?pv:mv,Zs=!1,m=a(c,f),Zs=!1,Pr&&(m=Nb(r,a,c,f)),Db(i),m}function Db(i){B.H=gc;var r=Ue!==null&&Ue.next!==null;if(is=0,yt=Ue=Te=null,uc=!1,va=0,Ir=null,r)throw Error(s(300));i===null||Ct||(i=i.dependencies,i!==null&&sc(i)&&(Ct=!0))}function Nb(i,r,a,c){Te=i;var f=0;do{if(Pr&&(Ir=null),va=0,Pr=!1,25<=f)throw Error(s(301));if(f+=1,yt=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=j_,m=r(a,c)}while(Pr);return m}function k_(){var i=B.H,r=i.useState()[0];return r=typeof r.then=="function"?Sa(r):r,i=i.useState()[0],(Ue!==null?Ue.memoizedState:null)!==i&&(Te.flags|=1024),r}function kd(){var i=fc!==0;return fc=0,i}function Md(i,r,a){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~a}function Cd(i){if(uc){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}uc=!1}is=0,yt=Ue=Te=null,Pr=!1,va=fc=0,Ir=null}function en(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?Te.memoizedState=yt=i:yt=yt.next=i,yt}function gt(){if(Ue===null){var i=Te.alternate;i=i!==null?i.memoizedState:null}else i=Ue.next;var r=yt===null?Te.memoizedState:yt.next;if(r!==null)yt=r,Ue=i;else{if(i===null)throw Te.alternate===null?Error(s(467)):Error(s(310));Ue=i,i={memoizedState:Ue.memoizedState,baseState:Ue.baseState,baseQueue:Ue.baseQueue,queue:Ue.queue,next:null},yt===null?Te.memoizedState=yt=i:yt=yt.next=i}return yt}function Dd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sa(i){var r=va;return va+=1,Ir===null&&(Ir=[]),i=Rb(Ir,i,r),r=Te,(yt===null?r.memoizedState:yt.next)===null&&(r=r.alternate,B.H=r===null||r.memoizedState===null?pv:mv),i}function dc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Sa(i);if(i.$$typeof===C)return Pt(i)}throw Error(s(438,String(i)))}function Nd(i){var r=null,a=Te.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var c=Te.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(r={data:c.data.map(function(f){return f.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),a===null&&(a=Dd(),Te.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(i),c=0;c<i;c++)a[c]=se;return r.index++,a}function Ri(i,r){return typeof r=="function"?r(i):r}function hc(i){var r=gt();return $d(r,Ue,i)}function $d(i,r,a){var c=i.queue;if(c===null)throw Error(s(311));c.lastRenderedReducer=a;var f=i.baseQueue,m=c.pending;if(m!==null){if(f!==null){var b=f.next;f.next=m.next,m.next=b}r.baseQueue=f=m,c.pending=null}if(m=i.baseState,f===null)i.memoizedState=m;else{r=f.next;var w=b=null,E=null,$=r,K=!1;do{var H=$.lane&-536870913;if(H!==$.lane?(Ce&H)===H:(is&H)===H){var L=$.revertLane;if(L===0)E!==null&&(E=E.next={lane:0,revertLane:0,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),H===zr&&(K=!0);else if((is&L)===L){$=$.next,L===zr&&(K=!0);continue}else H={lane:0,revertLane:$.revertLane,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},E===null?(w=E=H,b=m):E=E.next=H,Te.lanes|=L,us|=L;H=$.action,Zs&&a(m,H),m=$.hasEagerState?$.eagerState:a(m,H)}else L={lane:H,revertLane:$.revertLane,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},E===null?(w=E=L,b=m):E=E.next=L,Te.lanes|=H,us|=H;$=$.next}while($!==null&&$!==r);if(E===null?b=m:E.next=w,!un(m,i.memoizedState)&&(Ct=!0,K&&(a=Kr,a!==null)))throw a;i.memoizedState=m,i.baseState=b,i.baseQueue=E,c.lastRenderedState=m}return f===null&&(c.lanes=0),[i.memoizedState,c.dispatch]}function jd(i){var r=gt(),a=r.queue;if(a===null)throw Error(s(311));a.lastRenderedReducer=i;var c=a.dispatch,f=a.pending,m=r.memoizedState;if(f!==null){a.pending=null;var b=f=f.next;do m=i(m,b.action),b=b.next;while(b!==f);un(m,r.memoizedState)||(Ct=!0),r.memoizedState=m,r.baseQueue===null&&(r.baseState=m),a.lastRenderedState=m}return[m,c]}function $b(i,r,a){var c=Te,f=gt(),m=$e;if(m){if(a===void 0)throw Error(s(407));a=a()}else a=r();var b=!un((Ue||f).memoizedState,a);b&&(f.memoizedState=a,Ct=!0),f=f.queue;var w=Lb.bind(null,c,f,i);if(wa(2048,8,w,[i]),f.getSnapshot!==r||b||yt!==null&&yt.memoizedState.tag&1){if(c.flags|=2048,Hr(9,pc(),Bb.bind(null,c,f,a,r),null),Fe===null)throw Error(s(349));m||(is&124)!==0||jb(c,r,a)}return a}function jb(i,r,a){i.flags|=16384,i={getSnapshot:r,value:a},r=Te.updateQueue,r===null?(r=Dd(),Te.updateQueue=r,r.stores=[i]):(a=r.stores,a===null?r.stores=[i]:a.push(i))}function Bb(i,r,a,c){r.value=a,r.getSnapshot=c,Vb(r)&&Ub(i)}function Lb(i,r,a){return a(function(){Vb(r)&&Ub(i)})}function Vb(i){var r=i.getSnapshot;i=i.value;try{var a=r();return!un(i,a)}catch{return!0}}function Ub(i){var r=Br(i,2);r!==null&&yn(r,i,2)}function Bd(i){var r=en();if(typeof i=="function"){var a=i;if(i=a(),Zs){Ji(!0);try{a()}finally{Ji(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:i},r}function zb(i,r,a,c){return i.baseState=a,$d(i,Ue,typeof c=="function"?c:Ri)}function M_(i,r,a,c,f){if(yc(i))throw Error(s(485));if(i=r.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,c(m),a=r.pending,a===null?(m.next=r.pending=m,Kb(r,m)):(m.next=a.next,r.pending=a.next=m)}}function Kb(i,r){var a=r.action,c=r.payload,f=i.state;if(r.isTransition){var m=B.T,b={};B.T=b;try{var w=a(f,c),E=B.S;E!==null&&E(b,w),qb(i,r,w)}catch($){Ld(i,r,$)}finally{B.T=m}}else try{m=a(f,c),qb(i,r,m)}catch($){Ld(i,r,$)}}function qb(i,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){Pb(i,r,c)},function(c){return Ld(i,r,c)}):Pb(i,r,a)}function Pb(i,r,a){r.status="fulfilled",r.value=a,Ib(r),i.state=a,r=i.pending,r!==null&&(a=r.next,a===r?i.pending=null:(a=a.next,r.next=a,Kb(i,a)))}function Ld(i,r,a){var c=i.pending;if(i.pending=null,c!==null){c=c.next;do r.status="rejected",r.reason=a,Ib(r),r=r.next;while(r!==c)}i.action=null}function Ib(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function Hb(i,r){return r}function Fb(i,r){if($e){var a=Fe.formState;if(a!==null){e:{var c=Te;if($e){if(st){t:{for(var f=st,m=Wn;f.nodeType!==8;){if(!m){f=null;break t}if(f=Pn(f.nextSibling),f===null){f=null;break t}}m=f.data,f=m==="F!"||m==="F"?f:null}if(f){st=Pn(f.nextSibling),c=f.data==="F!";break e}}Gs(c)}c=!1}c&&(r=a[0])}}return a=en(),a.memoizedState=a.baseState=r,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hb,lastRenderedState:r},a.queue=c,a=fv.bind(null,Te,c),c.dispatch=a,c=Bd(!1),m=qd.bind(null,Te,!1,c.queue),c=en(),f={state:r,dispatch:null,action:i,pending:null},c.queue=f,a=M_.bind(null,Te,f,m,a),f.dispatch=a,c.memoizedState=i,[r,a,!1]}function Gb(i){var r=gt();return Yb(r,Ue,i)}function Yb(i,r,a){if(r=$d(i,r,Hb)[0],i=hc(Ri)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var c=Sa(r)}catch(b){throw b===pa?ac:b}else c=r;r=gt();var f=r.queue,m=f.dispatch;return a!==r.memoizedState&&(Te.flags|=2048,Hr(9,pc(),C_.bind(null,f,a),null)),[c,m,i]}function C_(i,r){i.action=r}function Xb(i){var r=gt(),a=Ue;if(a!==null)return Yb(r,a,i);gt(),r=r.memoizedState,a=gt();var c=a.queue.dispatch;return a.memoizedState=i,[r,c,!1]}function Hr(i,r,a,c){return i={tag:i,create:a,deps:c,inst:r,next:null},r=Te.updateQueue,r===null&&(r=Dd(),Te.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,r.lastEffect=i),i}function pc(){return{destroy:void 0,resource:void 0}}function Jb(){return gt().memoizedState}function mc(i,r,a,c){var f=en();c=c===void 0?null:c,Te.flags|=i,f.memoizedState=Hr(1|r,pc(),a,c)}function wa(i,r,a,c){var f=gt();c=c===void 0?null:c;var m=f.memoizedState.inst;Ue!==null&&c!==null&&Od(c,Ue.memoizedState.deps)?f.memoizedState=Hr(r,m,a,c):(Te.flags|=i,f.memoizedState=Hr(1|r,m,a,c))}function Zb(i,r){mc(8390656,8,i,r)}function Qb(i,r){wa(2048,8,i,r)}function Wb(i,r){return wa(4,2,i,r)}function ev(i,r){return wa(4,4,i,r)}function tv(i,r){if(typeof r=="function"){i=i();var a=r(i);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function nv(i,r,a){a=a!=null?a.concat([i]):null,wa(4,4,tv.bind(null,r,i),a)}function Vd(){}function iv(i,r){var a=gt();r=r===void 0?null:r;var c=a.memoizedState;return r!==null&&Od(r,c[1])?c[0]:(a.memoizedState=[i,r],i)}function sv(i,r){var a=gt();r=r===void 0?null:r;var c=a.memoizedState;if(r!==null&&Od(r,c[1]))return c[0];if(c=i(),Zs){Ji(!0);try{i()}finally{Ji(!1)}}return a.memoizedState=[c,r],c}function Ud(i,r,a){return a===void 0||(is&1073741824)!==0?i.memoizedState=r:(i.memoizedState=a,i=a0(),Te.lanes|=i,us|=i,a)}function rv(i,r,a,c){return un(a,r)?a:qr.current!==null?(i=Ud(i,a,c),un(i,r)||(Ct=!0),i):(is&42)===0?(Ct=!0,i.memoizedState=a):(i=a0(),Te.lanes|=i,us|=i,r)}function ov(i,r,a,c,f){var m=q.p;q.p=m!==0&&8>m?m:8;var b=B.T,w={};B.T=w,qd(i,!1,r,a);try{var E=f(),$=B.S;if($!==null&&$(w,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var K=O_(E,c);xa(i,r,K,mn(i))}else xa(i,r,c,mn(i))}catch(H){xa(i,r,{then:function(){},status:"rejected",reason:H},mn())}finally{q.p=m,B.T=b}}function D_(){}function zd(i,r,a,c){if(i.tag!==5)throw Error(s(476));var f=av(i).queue;ov(i,f,r,z,a===null?D_:function(){return lv(i),a(c)})}function av(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:z},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ri,lastRenderedState:a},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function lv(i){var r=av(i).next.queue;xa(i,r,{},mn())}function Kd(){return Pt(za)}function cv(){return gt().memoizedState}function uv(){return gt().memoizedState}function N_(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var a=mn();i=ts(a);var c=ns(r,i,a);c!==null&&(yn(c,r,a),ya(c,r,a)),r={cache:gd()},i.payload=r;return}r=r.return}}function $_(i,r,a){var c=mn();a={lane:c,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},yc(i)?dv(r,a):(a=ad(i,r,a,c),a!==null&&(yn(a,i,c),hv(a,r,c)))}function fv(i,r,a){var c=mn();xa(i,r,a,c)}function xa(i,r,a,c){var f={lane:c,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(yc(i))dv(r,f);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=r.lastRenderedReducer,m!==null))try{var b=r.lastRenderedState,w=m(b,a);if(f.hasEagerState=!0,f.eagerState=w,un(w,b))return Wl(i,r,f,0),Fe===null&&Ql(),!1}catch{}finally{}if(a=ad(i,r,f,c),a!==null)return yn(a,i,c),hv(a,r,c),!0}return!1}function qd(i,r,a,c){if(c={lane:2,revertLane:Sh(),action:c,hasEagerState:!1,eagerState:null,next:null},yc(i)){if(r)throw Error(s(479))}else r=ad(i,a,c,2),r!==null&&yn(r,i,2)}function yc(i){var r=i.alternate;return i===Te||r!==null&&r===Te}function dv(i,r){Pr=uc=!0;var a=i.pending;a===null?r.next=r:(r.next=a.next,a.next=r),i.pending=r}function hv(i,r,a){if((a&4194048)!==0){var c=r.lanes;c&=i.pendingLanes,a|=c,r.lanes=a,wg(i,a)}}var gc={readContext:Pt,use:dc,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useLayoutEffect:ft,useInsertionEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useSyncExternalStore:ft,useId:ft,useHostTransitionStatus:ft,useFormState:ft,useActionState:ft,useOptimistic:ft,useMemoCache:ft,useCacheRefresh:ft},pv={readContext:Pt,use:dc,useCallback:function(i,r){return en().memoizedState=[i,r===void 0?null:r],i},useContext:Pt,useEffect:Zb,useImperativeHandle:function(i,r,a){a=a!=null?a.concat([i]):null,mc(4194308,4,tv.bind(null,r,i),a)},useLayoutEffect:function(i,r){return mc(4194308,4,i,r)},useInsertionEffect:function(i,r){mc(4,2,i,r)},useMemo:function(i,r){var a=en();r=r===void 0?null:r;var c=i();if(Zs){Ji(!0);try{i()}finally{Ji(!1)}}return a.memoizedState=[c,r],c},useReducer:function(i,r,a){var c=en();if(a!==void 0){var f=a(r);if(Zs){Ji(!0);try{a(r)}finally{Ji(!1)}}}else f=r;return c.memoizedState=c.baseState=f,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:f},c.queue=i,i=i.dispatch=$_.bind(null,Te,i),[c.memoizedState,i]},useRef:function(i){var r=en();return i={current:i},r.memoizedState=i},useState:function(i){i=Bd(i);var r=i.queue,a=fv.bind(null,Te,r);return r.dispatch=a,[i.memoizedState,a]},useDebugValue:Vd,useDeferredValue:function(i,r){var a=en();return Ud(a,i,r)},useTransition:function(){var i=Bd(!1);return i=ov.bind(null,Te,i.queue,!0,!1),en().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,a){var c=Te,f=en();if($e){if(a===void 0)throw Error(s(407));a=a()}else{if(a=r(),Fe===null)throw Error(s(349));(Ce&124)!==0||jb(c,r,a)}f.memoizedState=a;var m={value:a,getSnapshot:r};return f.queue=m,Zb(Lb.bind(null,c,m,i),[i]),c.flags|=2048,Hr(9,pc(),Bb.bind(null,c,m,a,r),null),a},useId:function(){var i=en(),r=Fe.identifierPrefix;if($e){var a=Ti,c=xi;a=(c&~(1<<32-cn(c)-1)).toString(32)+a,r="«"+r+"R"+a,a=fc++,0<a&&(r+="H"+a.toString(32)),r+="»"}else a=__++,r="«"+r+"r"+a.toString(32)+"»";return i.memoizedState=r},useHostTransitionStatus:Kd,useFormState:Fb,useActionState:Fb,useOptimistic:function(i){var r=en();r.memoizedState=r.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=qd.bind(null,Te,!0,a),a.dispatch=r,[i,r]},useMemoCache:Nd,useCacheRefresh:function(){return en().memoizedState=N_.bind(null,Te)}},mv={readContext:Pt,use:dc,useCallback:iv,useContext:Pt,useEffect:Qb,useImperativeHandle:nv,useInsertionEffect:Wb,useLayoutEffect:ev,useMemo:sv,useReducer:hc,useRef:Jb,useState:function(){return hc(Ri)},useDebugValue:Vd,useDeferredValue:function(i,r){var a=gt();return rv(a,Ue.memoizedState,i,r)},useTransition:function(){var i=hc(Ri)[0],r=gt().memoizedState;return[typeof i=="boolean"?i:Sa(i),r]},useSyncExternalStore:$b,useId:cv,useHostTransitionStatus:Kd,useFormState:Gb,useActionState:Gb,useOptimistic:function(i,r){var a=gt();return zb(a,Ue,i,r)},useMemoCache:Nd,useCacheRefresh:uv},j_={readContext:Pt,use:dc,useCallback:iv,useContext:Pt,useEffect:Qb,useImperativeHandle:nv,useInsertionEffect:Wb,useLayoutEffect:ev,useMemo:sv,useReducer:jd,useRef:Jb,useState:function(){return jd(Ri)},useDebugValue:Vd,useDeferredValue:function(i,r){var a=gt();return Ue===null?Ud(a,i,r):rv(a,Ue.memoizedState,i,r)},useTransition:function(){var i=jd(Ri)[0],r=gt().memoizedState;return[typeof i=="boolean"?i:Sa(i),r]},useSyncExternalStore:$b,useId:cv,useHostTransitionStatus:Kd,useFormState:Xb,useActionState:Xb,useOptimistic:function(i,r){var a=gt();return Ue!==null?zb(a,Ue,i,r):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:Nd,useCacheRefresh:uv},Fr=null,Ta=0;function bc(i){var r=Ta;return Ta+=1,Fr===null&&(Fr=[]),Rb(Fr,i,r)}function Aa(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function vc(i,r){throw r.$$typeof===g?Error(s(525)):(i=Object.prototype.toString.call(r),Error(s(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function yv(i){var r=i._init;return r(i._payload)}function gv(i){function r(k,R){if(i){var N=k.deletions;N===null?(k.deletions=[R],k.flags|=16):N.push(R)}}function a(k,R){if(!i)return null;for(;R!==null;)r(k,R),R=R.sibling;return null}function c(k){for(var R=new Map;k!==null;)k.key!==null?R.set(k.key,k):R.set(k.index,k),k=k.sibling;return R}function f(k,R){return k=wi(k,R),k.index=0,k.sibling=null,k}function m(k,R,N){return k.index=N,i?(N=k.alternate,N!==null?(N=N.index,N<R?(k.flags|=67108866,R):N):(k.flags|=67108866,R)):(k.flags|=1048576,R)}function b(k){return i&&k.alternate===null&&(k.flags|=67108866),k}function w(k,R,N,I){return R===null||R.tag!==6?(R=cd(N,k.mode,I),R.return=k,R):(R=f(R,N),R.return=k,R)}function E(k,R,N,I){var re=N.type;return re===x?K(k,R,N.props.children,I,N.key):R!==null&&(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===F&&yv(re)===R.type)?(R=f(R,N.props),Aa(R,N),R.return=k,R):(R=tc(N.type,N.key,N.props,null,k.mode,I),Aa(R,N),R.return=k,R)}function $(k,R,N,I){return R===null||R.tag!==4||R.stateNode.containerInfo!==N.containerInfo||R.stateNode.implementation!==N.implementation?(R=ud(N,k.mode,I),R.return=k,R):(R=f(R,N.children||[]),R.return=k,R)}function K(k,R,N,I,re){return R===null||R.tag!==7?(R=Ps(N,k.mode,I,re),R.return=k,R):(R=f(R,N),R.return=k,R)}function H(k,R,N){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=cd(""+R,k.mode,N),R.return=k,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return N=tc(R.type,R.key,R.props,null,k.mode,N),Aa(N,R),N.return=k,N;case S:return R=ud(R,k.mode,N),R.return=k,R;case F:var I=R._init;return R=I(R._payload),H(k,R,N)}if(W(R)||ge(R))return R=Ps(R,k.mode,N,null),R.return=k,R;if(typeof R.then=="function")return H(k,bc(R),N);if(R.$$typeof===C)return H(k,rc(k,R),N);vc(k,R)}return null}function L(k,R,N,I){var re=R!==null?R.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return re!==null?null:w(k,R,""+N,I);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case v:return N.key===re?E(k,R,N,I):null;case S:return N.key===re?$(k,R,N,I):null;case F:return re=N._init,N=re(N._payload),L(k,R,N,I)}if(W(N)||ge(N))return re!==null?null:K(k,R,N,I,null);if(typeof N.then=="function")return L(k,R,bc(N),I);if(N.$$typeof===C)return L(k,R,rc(k,N),I);vc(k,N)}return null}function U(k,R,N,I,re){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return k=k.get(N)||null,w(R,k,""+I,re);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case v:return k=k.get(I.key===null?N:I.key)||null,E(R,k,I,re);case S:return k=k.get(I.key===null?N:I.key)||null,$(R,k,I,re);case F:var Ee=I._init;return I=Ee(I._payload),U(k,R,N,I,re)}if(W(I)||ge(I))return k=k.get(N)||null,K(R,k,I,re,null);if(typeof I.then=="function")return U(k,R,N,bc(I),re);if(I.$$typeof===C)return U(k,R,N,rc(R,I),re);vc(R,I)}return null}function me(k,R,N,I){for(var re=null,Ee=null,ce=R,he=R=0,Nt=null;ce!==null&&he<N.length;he++){ce.index>he?(Nt=ce,ce=null):Nt=ce.sibling;var Ne=L(k,ce,N[he],I);if(Ne===null){ce===null&&(ce=Nt);break}i&&ce&&Ne.alternate===null&&r(k,ce),R=m(Ne,R,he),Ee===null?re=Ne:Ee.sibling=Ne,Ee=Ne,ce=Nt}if(he===N.length)return a(k,ce),$e&&Hs(k,he),re;if(ce===null){for(;he<N.length;he++)ce=H(k,N[he],I),ce!==null&&(R=m(ce,R,he),Ee===null?re=ce:Ee.sibling=ce,Ee=ce);return $e&&Hs(k,he),re}for(ce=c(ce);he<N.length;he++)Nt=U(ce,k,he,N[he],I),Nt!==null&&(i&&Nt.alternate!==null&&ce.delete(Nt.key===null?he:Nt.key),R=m(Nt,R,he),Ee===null?re=Nt:Ee.sibling=Nt,Ee=Nt);return i&&ce.forEach(function(vs){return r(k,vs)}),$e&&Hs(k,he),re}function de(k,R,N,I){if(N==null)throw Error(s(151));for(var re=null,Ee=null,ce=R,he=R=0,Nt=null,Ne=N.next();ce!==null&&!Ne.done;he++,Ne=N.next()){ce.index>he?(Nt=ce,ce=null):Nt=ce.sibling;var vs=L(k,ce,Ne.value,I);if(vs===null){ce===null&&(ce=Nt);break}i&&ce&&vs.alternate===null&&r(k,ce),R=m(vs,R,he),Ee===null?re=vs:Ee.sibling=vs,Ee=vs,ce=Nt}if(Ne.done)return a(k,ce),$e&&Hs(k,he),re;if(ce===null){for(;!Ne.done;he++,Ne=N.next())Ne=H(k,Ne.value,I),Ne!==null&&(R=m(Ne,R,he),Ee===null?re=Ne:Ee.sibling=Ne,Ee=Ne);return $e&&Hs(k,he),re}for(ce=c(ce);!Ne.done;he++,Ne=N.next())Ne=U(ce,k,he,Ne.value,I),Ne!==null&&(i&&Ne.alternate!==null&&ce.delete(Ne.key===null?he:Ne.key),R=m(Ne,R,he),Ee===null?re=Ne:Ee.sibling=Ne,Ee=Ne);return i&&ce.forEach(function(Bk){return r(k,Bk)}),$e&&Hs(k,he),re}function Ke(k,R,N,I){if(typeof N=="object"&&N!==null&&N.type===x&&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===x){if(R.tag===7){a(k,R.sibling),I=f(R,N.props.children),I.return=k,k=I;break e}}else if(R.elementType===re||typeof re=="object"&&re!==null&&re.$$typeof===F&&yv(re)===R.type){a(k,R.sibling),I=f(R,N.props),Aa(I,N),I.return=k,k=I;break e}a(k,R);break}else r(k,R);R=R.sibling}N.type===x?(I=Ps(N.props.children,k.mode,I,N.key),I.return=k,k=I):(I=tc(N.type,N.key,N.props,null,k.mode,I),Aa(I,N),I.return=k,k=I)}return b(k);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(k,R.sibling),I=f(R,N.children||[]),I.return=k,k=I;break e}else{a(k,R);break}else r(k,R);R=R.sibling}I=ud(N,k.mode,I),I.return=k,k=I}return b(k);case F:return re=N._init,N=re(N._payload),Ke(k,R,N,I)}if(W(N))return me(k,R,N,I);if(ge(N)){if(re=ge(N),typeof re!="function")throw Error(s(150));return N=re.call(N),de(k,R,N,I)}if(typeof N.then=="function")return Ke(k,R,bc(N),I);if(N.$$typeof===C)return Ke(k,R,rc(k,N),I);vc(k,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,R!==null&&R.tag===6?(a(k,R.sibling),I=f(R,N),I.return=k,k=I):(a(k,R),I=cd(N,k.mode,I),I.return=k,k=I),b(k)):a(k,R)}return function(k,R,N,I){try{Ta=0;var re=Ke(k,R,N,I);return Fr=null,re}catch(ce){if(ce===pa||ce===ac)throw ce;var Ee=fn(29,ce,null,k.mode);return Ee.lanes=I,Ee.return=k,Ee}finally{}}}var Gr=gv(!0),bv=gv(!1),Mn=P(null),ei=null;function ss(i){var r=i.alternate;X(Rt,Rt.current&1),X(Mn,i),ei===null&&(r===null||qr.current!==null||r.memoizedState!==null)&&(ei=i)}function vv(i){if(i.tag===22){if(X(Rt,Rt.current),X(Mn,i),ei===null){var r=i.alternate;r!==null&&r.memoizedState!==null&&(ei=i)}}else rs()}function rs(){X(Rt,Rt.current),X(Mn,Mn.current)}function Oi(i){te(Mn),ei===i&&(ei=null),te(Rt)}var Rt=P(0);function Sc(i){for(var r=i;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||Dh(a)))return r}else if(r.tag===19&&r.memoizedProps.revealOrder!==void 0){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}function Pd(i,r,a,c){r=i.memoizedState,a=a(c,r),a=a==null?r:y({},r,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Id={enqueueSetState:function(i,r,a){i=i._reactInternals;var c=mn(),f=ts(c);f.payload=r,a!=null&&(f.callback=a),r=ns(i,f,c),r!==null&&(yn(r,i,c),ya(r,i,c))},enqueueReplaceState:function(i,r,a){i=i._reactInternals;var c=mn(),f=ts(c);f.tag=1,f.payload=r,a!=null&&(f.callback=a),r=ns(i,f,c),r!==null&&(yn(r,i,c),ya(r,i,c))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var a=mn(),c=ts(a);c.tag=2,r!=null&&(c.callback=r),r=ns(i,c,a),r!==null&&(yn(r,i,a),ya(r,i,a))}};function Sv(i,r,a,c,f,m,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,m,b):r.prototype&&r.prototype.isPureReactComponent?!oa(a,c)||!oa(f,m):!0}function wv(i,r,a,c){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,c),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,c),r.state!==i&&Id.enqueueReplaceState(r,r.state,null)}function Qs(i,r){var a=r;if("ref"in r){a={};for(var c in r)c!=="ref"&&(a[c]=r[c])}if(i=i.defaultProps){a===r&&(a=y({},a));for(var f in i)a[f]===void 0&&(a[f]=i[f])}return a}var wc=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=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(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)};function xv(i){wc(i)}function Tv(i){console.error(i)}function Av(i){wc(i)}function xc(i,r){try{var a=i.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(c){setTimeout(function(){throw c})}}function Ev(i,r,a){try{var c=i.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(f){setTimeout(function(){throw f})}}function Hd(i,r,a){return a=ts(a),a.tag=3,a.payload={element:null},a.callback=function(){xc(i,r)},a}function Rv(i){return i=ts(i),i.tag=3,i}function Ov(i,r,a,c){var f=a.type.getDerivedStateFromError;if(typeof f=="function"){var m=c.value;i.payload=function(){return f(m)},i.callback=function(){Ev(r,a,c)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){Ev(r,a,c),typeof f!="function"&&(fs===null?fs=new Set([this]):fs.add(this));var w=c.stack;this.componentDidCatch(c.value,{componentStack:w!==null?w:""})})}function B_(i,r,a,c,f){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(r=a.alternate,r!==null&&fa(r,a,f,!0),a=Mn.current,a!==null){switch(a.tag){case 13:return ei===null?mh():a.alternate===null&&rt===0&&(rt=3),a.flags&=-257,a.flags|=65536,a.lanes=f,c===Sd?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([c]):r.add(c),gh(i,c,f)),!1;case 22:return a.flags|=65536,c===Sd?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([c]):a.add(c)),gh(i,c,f)),!1}throw Error(s(435,a.tag))}return gh(i,c,f),mh(),!1}if($e)return r=Mn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=f,c!==hd&&(i=Error(s(422),{cause:c}),ua(Rn(i,a)))):(c!==hd&&(r=Error(s(423),{cause:c}),ua(Rn(r,a))),i=i.current.alternate,i.flags|=65536,f&=-f,i.lanes|=f,c=Rn(c,a),f=Hd(i.stateNode,c,f),Td(i,f),rt!==4&&(rt=2)),!1;var m=Error(s(520),{cause:c});if(m=Rn(m,a),Ca===null?Ca=[m]:Ca.push(m),rt!==4&&(rt=2),r===null)return!0;c=Rn(c,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,i=f&-f,a.lanes|=i,i=Hd(a.stateNode,c,i),Td(a,i),!1;case 1:if(r=a.type,m=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||m!==null&&typeof m.componentDidCatch=="function"&&(fs===null||!fs.has(m))))return a.flags|=65536,f&=-f,a.lanes|=f,f=Rv(f),Ov(f,i,a,c),Td(a,f),!1}a=a.return}while(a!==null);return!1}var _v=Error(s(461)),Ct=!1;function Lt(i,r,a,c){r.child=i===null?bv(r,null,a,c):Gr(r,i.child,a,c)}function kv(i,r,a,c,f){a=a.render;var m=r.ref;if("ref"in c){var b={};for(var w in c)w!=="ref"&&(b[w]=c[w])}else b=c;return Xs(r),c=_d(i,r,a,b,m,f),w=kd(),i!==null&&!Ct?(Md(i,r,f),_i(i,r,f)):($e&&w&&fd(r),r.flags|=1,Lt(i,r,c,f),r.child)}function Mv(i,r,a,c,f){if(i===null){var m=a.type;return typeof m=="function"&&!ld(m)&&m.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=m,Cv(i,r,m,c,f)):(i=tc(a.type,null,c,r,r.mode,f),i.ref=r.ref,i.return=r,r.child=i)}if(m=i.child,!Wd(i,f)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:oa,a(b,c)&&i.ref===r.ref)return _i(i,r,f)}return r.flags|=1,i=wi(m,c),i.ref=r.ref,i.return=r,r.child=i}function Cv(i,r,a,c,f){if(i!==null){var m=i.memoizedProps;if(oa(m,c)&&i.ref===r.ref)if(Ct=!1,r.pendingProps=c=m,Wd(i,f))(i.flags&131072)!==0&&(Ct=!0);else return r.lanes=i.lanes,_i(i,r,f)}return Fd(i,r,a,c,f)}function Dv(i,r,a){var c=r.pendingProps,f=c.children,m=i!==null?i.memoizedState:null;if(c.mode==="hidden"){if((r.flags&128)!==0){if(c=m!==null?m.baseLanes|a:a,i!==null){for(f=r.child=i.child,m=0;f!==null;)m=m|f.lanes|f.childLanes,f=f.sibling;r.childLanes=m&~c}else r.childLanes=0,r.child=null;return Nv(i,r,c,a)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&oc(r,m!==null?m.cachePool:null),m!==null?Cb(r,m):Ed(),vv(r);else return r.lanes=r.childLanes=536870912,Nv(i,r,m!==null?m.baseLanes|a:a,a)}else m!==null?(oc(r,m.cachePool),Cb(r,m),rs(),r.memoizedState=null):(i!==null&&oc(r,null),Ed(),rs());return Lt(i,r,f,a),r.child}function Nv(i,r,a,c){var f=vd();return f=f===null?null:{parent:Et._currentValue,pool:f},r.memoizedState={baseLanes:a,cachePool:f},i!==null&&oc(r,null),Ed(),vv(r),i!==null&&fa(i,r,c,!0),null}function Tc(i,r){var a=r.ref;if(a===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(s(284));(i===null||i.ref!==a)&&(r.flags|=4194816)}}function Fd(i,r,a,c,f){return Xs(r),a=_d(i,r,a,c,void 0,f),c=kd(),i!==null&&!Ct?(Md(i,r,f),_i(i,r,f)):($e&&c&&fd(r),r.flags|=1,Lt(i,r,a,f),r.child)}function $v(i,r,a,c,f,m){return Xs(r),r.updateQueue=null,a=Nb(r,c,a,f),Db(i),c=kd(),i!==null&&!Ct?(Md(i,r,m),_i(i,r,m)):($e&&c&&fd(r),r.flags|=1,Lt(i,r,a,m),r.child)}function jv(i,r,a,c,f){if(Xs(r),r.stateNode===null){var m=Lr,b=a.contextType;typeof b=="object"&&b!==null&&(m=Pt(b)),m=new a(c,m),r.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Id,r.stateNode=m,m._reactInternals=r,m=r.stateNode,m.props=c,m.state=r.memoizedState,m.refs={},wd(r),b=a.contextType,m.context=typeof b=="object"&&b!==null?Pt(b):Lr,m.state=r.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(Pd(r,a,b,c),m.state=r.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&&Id.enqueueReplaceState(m,m.state,null),ba(r,c,m,f),ga(),m.state=r.memoizedState),typeof m.componentDidMount=="function"&&(r.flags|=4194308),c=!0}else if(i===null){m=r.stateNode;var w=r.memoizedProps,E=Qs(a,w);m.props=E;var $=m.context,K=a.contextType;b=Lr,typeof K=="object"&&K!==null&&(b=Pt(K));var H=a.getDerivedStateFromProps;K=typeof H=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=r.pendingProps!==w,K||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||$!==b)&&wv(r,m,c,b),es=!1;var L=r.memoizedState;m.state=L,ba(r,c,m,f),ga(),$=r.memoizedState,w||L!==$||es?(typeof H=="function"&&(Pd(r,a,H,c),$=r.memoizedState),(E=es||Sv(r,a,E,c,L,$,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"&&(r.flags|=4194308)):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=c,r.memoizedState=$),m.props=c,m.state=$,m.context=b,c=E):(typeof m.componentDidMount=="function"&&(r.flags|=4194308),c=!1)}else{m=r.stateNode,xd(i,r),b=r.memoizedProps,K=Qs(a,b),m.props=K,H=r.pendingProps,L=m.context,$=a.contextType,E=Lr,typeof $=="object"&&$!==null&&(E=Pt($)),w=a.getDerivedStateFromProps,($=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==H||L!==E)&&wv(r,m,c,E),es=!1,L=r.memoizedState,m.state=L,ba(r,c,m,f),ga();var U=r.memoizedState;b!==H||L!==U||es||i!==null&&i.dependencies!==null&&sc(i.dependencies)?(typeof w=="function"&&(Pd(r,a,w,c),U=r.memoizedState),(K=es||Sv(r,a,K,c,L,U,E)||i!==null&&i.dependencies!==null&&sc(i.dependencies))?($||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(c,U,E),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(c,U,E)),typeof m.componentDidUpdate=="function"&&(r.flags|=4),typeof m.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(r.flags|=1024),r.memoizedProps=c,r.memoizedState=U),m.props=c,m.state=U,m.context=E,c=K):(typeof m.componentDidUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(r.flags|=4),typeof m.getSnapshotBeforeUpdate!="function"||b===i.memoizedProps&&L===i.memoizedState||(r.flags|=1024),c=!1)}return m=c,Tc(i,r),c=(r.flags&128)!==0,m||c?(m=r.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:m.render(),r.flags|=1,i!==null&&c?(r.child=Gr(r,i.child,null,f),r.child=Gr(r,null,a,f)):Lt(i,r,a,f),r.memoizedState=m.state,i=r.child):i=_i(i,r,f),i}function Bv(i,r,a,c){return ca(),r.flags|=256,Lt(i,r,a,c),r.child}var Gd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yd(i){return{baseLanes:i,cachePool:Tb()}}function Xd(i,r,a){return i=i!==null?i.childLanes&~a:0,r&&(i|=Cn),i}function Lv(i,r,a){var c=r.pendingProps,f=!1,m=(r.flags&128)!==0,b;if((b=m)||(b=i!==null&&i.memoizedState===null?!1:(Rt.current&2)!==0),b&&(f=!0,r.flags&=-129),b=(r.flags&32)!==0,r.flags&=-33,i===null){if($e){if(f?ss(r):rs(),$e){var w=st,E;if(E=w){e:{for(E=w,w=Wn;E.nodeType!==8;){if(!w){w=null;break e}if(E=Pn(E.nextSibling),E===null){w=null;break e}}w=E}w!==null?(r.memoizedState={dehydrated:w,treeContext:Is!==null?{id:xi,overflow:Ti}:null,retryLane:536870912,hydrationErrors:null},E=fn(18,null,null,0),E.stateNode=w,E.return=r,r.child=E,Yt=r,st=null,E=!0):E=!1}E||Gs(r)}if(w=r.memoizedState,w!==null&&(w=w.dehydrated,w!==null))return Dh(w)?r.lanes=32:r.lanes=536870912,null;Oi(r)}return w=c.children,c=c.fallback,f?(rs(),f=r.mode,w=Ac({mode:"hidden",children:w},f),c=Ps(c,f,a,null),w.return=r,c.return=r,w.sibling=c,r.child=w,f=r.child,f.memoizedState=Yd(a),f.childLanes=Xd(i,b,a),r.memoizedState=Gd,c):(ss(r),Jd(r,w))}if(E=i.memoizedState,E!==null&&(w=E.dehydrated,w!==null)){if(m)r.flags&256?(ss(r),r.flags&=-257,r=Zd(i,r,a)):r.memoizedState!==null?(rs(),r.child=i.child,r.flags|=128,r=null):(rs(),f=c.fallback,w=r.mode,c=Ac({mode:"visible",children:c.children},w),f=Ps(f,w,a,null),f.flags|=2,c.return=r,f.return=r,c.sibling=f,r.child=c,Gr(r,i.child,null,a),c=r.child,c.memoizedState=Yd(a),c.childLanes=Xd(i,b,a),r.memoizedState=Gd,r=f);else if(ss(r),Dh(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var $=b.dgst;b=$,c=Error(s(419)),c.stack="",c.digest=b,ua({value:c,source:null,stack:null}),r=Zd(i,r,a)}else if(Ct||fa(i,r,a,!1),b=(a&i.childLanes)!==0,Ct||b){if(b=Fe,b!==null&&(c=a&-a,c=(c&42)!==0?1:Nf(c),c=(c&(b.suspendedLanes|a))!==0?0:c,c!==0&&c!==E.retryLane))throw E.retryLane=c,Br(i,c),yn(b,i,c),_v;w.data==="$?"||mh(),r=Zd(i,r,a)}else w.data==="$?"?(r.flags|=192,r.child=i.child,r=null):(i=E.treeContext,st=Pn(w.nextSibling),Yt=r,$e=!0,Fs=null,Wn=!1,i!==null&&(_n[kn++]=xi,_n[kn++]=Ti,_n[kn++]=Is,xi=i.id,Ti=i.overflow,Is=r),r=Jd(r,c.children),r.flags|=4096);return r}return f?(rs(),f=c.fallback,w=r.mode,E=i.child,$=E.sibling,c=wi(E,{mode:"hidden",children:c.children}),c.subtreeFlags=E.subtreeFlags&65011712,$!==null?f=wi($,f):(f=Ps(f,w,a,null),f.flags|=2),f.return=r,c.return=r,c.sibling=f,r.child=c,c=f,f=r.child,w=i.child.memoizedState,w===null?w=Yd(a):(E=w.cachePool,E!==null?($=Et._currentValue,E=E.parent!==$?{parent:$,pool:$}:E):E=Tb(),w={baseLanes:w.baseLanes|a,cachePool:E}),f.memoizedState=w,f.childLanes=Xd(i,b,a),r.memoizedState=Gd,c):(ss(r),a=i.child,i=a.sibling,a=wi(a,{mode:"visible",children:c.children}),a.return=r,a.sibling=null,i!==null&&(b=r.deletions,b===null?(r.deletions=[i],r.flags|=16):b.push(i)),r.child=a,r.memoizedState=null,a)}function Jd(i,r){return r=Ac({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function Ac(i,r){return i=fn(22,i,null,r),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Zd(i,r,a){return Gr(r,i.child,null,a),i=Jd(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function Vv(i,r,a){i.lanes|=r;var c=i.alternate;c!==null&&(c.lanes|=r),md(i.return,r,a)}function Qd(i,r,a,c,f){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:f}:(m.isBackwards=r,m.rendering=null,m.renderingStartTime=0,m.last=c,m.tail=a,m.tailMode=f)}function Uv(i,r,a){var c=r.pendingProps,f=c.revealOrder,m=c.tail;if(Lt(i,r,c.children,a),c=Rt.current,(c&2)!==0)c=c&1|2,r.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Vv(i,a,r);else if(i.tag===19)Vv(i,a,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}c&=1}switch(X(Rt,c),f){case"forwards":for(a=r.child,f=null;a!==null;)i=a.alternate,i!==null&&Sc(i)===null&&(f=a),a=a.sibling;a=f,a===null?(f=r.child,r.child=null):(f=a.sibling,a.sibling=null),Qd(r,!1,f,a,m);break;case"backwards":for(a=null,f=r.child,r.child=null;f!==null;){if(i=f.alternate,i!==null&&Sc(i)===null){r.child=f;break}i=f.sibling,f.sibling=a,a=f,f=i}Qd(r,!0,a,null,m);break;case"together":Qd(r,!1,null,null,void 0);break;default:r.memoizedState=null}return r.child}function _i(i,r,a){if(i!==null&&(r.dependencies=i.dependencies),us|=r.lanes,(a&r.childLanes)===0)if(i!==null){if(fa(i,r,a,!1),(a&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(s(153));if(r.child!==null){for(i=r.child,a=wi(i,i.pendingProps),r.child=a,a.return=r;i.sibling!==null;)i=i.sibling,a=a.sibling=wi(i,i.pendingProps),a.return=r;a.sibling=null}return r.child}function Wd(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&sc(i)))}function L_(i,r,a){switch(r.tag){case 3:Ve(r,r.stateNode.containerInfo),Wi(r,Et,i.memoizedState.cache),ca();break;case 27:case 5:Xi(r);break;case 4:Ve(r,r.stateNode.containerInfo);break;case 10:Wi(r,r.type,r.memoizedProps.value);break;case 13:var c=r.memoizedState;if(c!==null)return c.dehydrated!==null?(ss(r),r.flags|=128,null):(a&r.child.childLanes)!==0?Lv(i,r,a):(ss(r),i=_i(i,r,a),i!==null?i.sibling:null);ss(r);break;case 19:var f=(i.flags&128)!==0;if(c=(a&r.childLanes)!==0,c||(fa(i,r,a,!1),c=(a&r.childLanes)!==0),f){if(c)return Uv(i,r,a);r.flags|=128}if(f=r.memoizedState,f!==null&&(f.rendering=null,f.tail=null,f.lastEffect=null),X(Rt,Rt.current),c)break;return null;case 22:case 23:return r.lanes=0,Dv(i,r,a);case 24:Wi(r,Et,i.memoizedState.cache)}return _i(i,r,a)}function zv(i,r,a){if(i!==null)if(i.memoizedProps!==r.pendingProps)Ct=!0;else{if(!Wd(i,a)&&(r.flags&128)===0)return Ct=!1,L_(i,r,a);Ct=(i.flags&131072)!==0}else Ct=!1,$e&&(r.flags&1048576)!==0&&yb(r,ic,r.index);switch(r.lanes=0,r.tag){case 16:e:{i=r.pendingProps;var c=r.elementType,f=c._init;if(c=f(c._payload),r.type=c,typeof c=="function")ld(c)?(i=Qs(c,i),r.tag=1,r=jv(null,r,c,i,a)):(r.tag=0,r=Fd(null,r,c,i,a));else{if(c!=null){if(f=c.$$typeof,f===j){r.tag=11,r=kv(null,r,c,i,a);break e}else if(f===Y){r.tag=14,r=Mv(null,r,c,i,a);break e}}throw r=Q(c)||c,Error(s(306,r,""))}}return r;case 0:return Fd(i,r,r.type,r.pendingProps,a);case 1:return c=r.type,f=Qs(c,r.pendingProps),jv(i,r,c,f,a);case 3:e:{if(Ve(r,r.stateNode.containerInfo),i===null)throw Error(s(387));c=r.pendingProps;var m=r.memoizedState;f=m.element,xd(i,r),ba(r,c,null,a);var b=r.memoizedState;if(c=b.cache,Wi(r,Et,c),c!==m.cache&&yd(r,[Et],a,!0),ga(),c=b.element,m.isDehydrated)if(m={element:c,isDehydrated:!1,cache:b.cache},r.updateQueue.baseState=m,r.memoizedState=m,r.flags&256){r=Bv(i,r,c,a);break e}else if(c!==f){f=Rn(Error(s(424)),r),ua(f),r=Bv(i,r,c,a);break e}else{switch(i=r.stateNode.containerInfo,i.nodeType){case 9:i=i.body;break;default:i=i.nodeName==="HTML"?i.ownerDocument.body:i}for(st=Pn(i.firstChild),Yt=r,$e=!0,Fs=null,Wn=!0,a=bv(r,null,c,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ca(),c===f){r=_i(i,r,a);break e}Lt(i,r,c,a)}r=r.child}return r;case 26:return Tc(i,r),i===null?(a=I0(r.type,null,r.pendingProps,null))?r.memoizedState=a:$e||(a=r.type,i=r.pendingProps,c=Vc(le.current).createElement(a),c[qt]=r,c[Qt]=i,Ut(c,a,i),Mt(c),r.stateNode=c):r.memoizedState=I0(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Xi(r),i===null&&$e&&(c=r.stateNode=K0(r.type,r.pendingProps,le.current),Yt=r,Wn=!0,f=st,ps(r.type)?(Nh=f,st=Pn(c.firstChild)):st=f),Lt(i,r,r.pendingProps.children,a),Tc(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&$e&&((f=c=st)&&(c=fk(c,r.type,r.pendingProps,Wn),c!==null?(r.stateNode=c,Yt=r,st=Pn(c.firstChild),Wn=!1,f=!0):f=!1),f||Gs(r)),Xi(r),f=r.type,m=r.pendingProps,b=i!==null?i.memoizedProps:null,c=m.children,kh(f,m)?c=null:b!==null&&kh(f,b)&&(r.flags|=32),r.memoizedState!==null&&(f=_d(i,r,k_,null,null,a),za._currentValue=f),Tc(i,r),Lt(i,r,c,a),r.child;case 6:return i===null&&$e&&((i=a=st)&&(a=dk(a,r.pendingProps,Wn),a!==null?(r.stateNode=a,Yt=r,st=null,i=!0):i=!1),i||Gs(r)),null;case 13:return Lv(i,r,a);case 4:return Ve(r,r.stateNode.containerInfo),c=r.pendingProps,i===null?r.child=Gr(r,null,c,a):Lt(i,r,c,a),r.child;case 11:return kv(i,r,r.type,r.pendingProps,a);case 7:return Lt(i,r,r.pendingProps,a),r.child;case 8:return Lt(i,r,r.pendingProps.children,a),r.child;case 12:return Lt(i,r,r.pendingProps.children,a),r.child;case 10:return c=r.pendingProps,Wi(r,r.type,c.value),Lt(i,r,c.children,a),r.child;case 9:return f=r.type._context,c=r.pendingProps.children,Xs(r),f=Pt(f),c=c(f),r.flags|=1,Lt(i,r,c,a),r.child;case 14:return Mv(i,r,r.type,r.pendingProps,a);case 15:return Cv(i,r,r.type,r.pendingProps,a);case 19:return Uv(i,r,a);case 31:return c=r.pendingProps,a=r.mode,c={mode:c.mode,children:c.children},i===null?(a=Ac(c,a),a.ref=r.ref,r.child=a,a.return=r,r=a):(a=wi(i.child,c),a.ref=r.ref,r.child=a,a.return=r,r=a),r;case 22:return Dv(i,r,a);case 24:return Xs(r),c=Pt(Et),i===null?(f=vd(),f===null&&(f=Fe,m=gd(),f.pooledCache=m,m.refCount++,m!==null&&(f.pooledCacheLanes|=a),f=m),r.memoizedState={parent:c,cache:f},wd(r),Wi(r,Et,f)):((i.lanes&a)!==0&&(xd(i,r),ba(r,null,null,a),ga()),f=i.memoizedState,m=r.memoizedState,f.parent!==c?(f={parent:c,cache:c},r.memoizedState=f,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=f),Wi(r,Et,c)):(c=m.cache,Wi(r,Et,c),c!==f.cache&&yd(r,[Et],a,!0))),Lt(i,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(s(156,r.tag))}function ki(i){i.flags|=4}function Kv(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!X0(r)){if(r=Mn.current,r!==null&&((Ce&4194048)===Ce?ei!==null:(Ce&62914560)!==Ce&&(Ce&536870912)===0||r!==ei))throw ma=Sd,Ab;i.flags|=8192}}function Ec(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?vg():536870912,i.lanes|=r,Zr|=r)}function Ea(i,r){if(!$e)switch(i.tailMode){case"hidden":r=i.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?i.tail=null:a.sibling=null;break;case"collapsed":a=i.tail;for(var c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function tt(i){var r=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(r)for(var f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags&65011712,c|=f.flags&65011712,f.return=i,f=f.sibling;else for(f=i.child;f!==null;)a|=f.lanes|f.childLanes,c|=f.subtreeFlags,c|=f.flags,f.return=i,f=f.sibling;return i.subtreeFlags|=c,i.childLanes=a,r}function V_(i,r,a){var c=r.pendingProps;switch(dd(r),r.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(r),null;case 1:return tt(r),null;case 3:return a=r.stateNode,c=null,i!==null&&(c=i.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Ei(Et),wn(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(la(r)?ki(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,vb())),tt(r),null;case 26:return a=r.memoizedState,i===null?(ki(r),a!==null?(tt(r),Kv(r,a)):(tt(r),r.flags&=-16777217)):a?a!==i.memoizedState?(ki(r),tt(r),Kv(r,a)):(tt(r),r.flags&=-16777217):(i.memoizedProps!==c&&ki(r),tt(r),r.flags&=-16777217),null;case 27:bi(r),a=le.current;var f=r.type;if(i!==null&&r.stateNode!=null)i.memoizedProps!==c&&ki(r);else{if(!c){if(r.stateNode===null)throw Error(s(166));return tt(r),null}i=oe.current,la(r)?gb(r):(i=K0(f,c,a),r.stateNode=i,ki(r))}return tt(r),null;case 5:if(bi(r),a=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==c&&ki(r);else{if(!c){if(r.stateNode===null)throw Error(s(166));return tt(r),null}if(i=oe.current,la(r))gb(r);else{switch(f=Vc(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 c.is=="string"?f.createElement("select",{is:c.is}):f.createElement("select"),c.multiple?i.multiple=!0:c.size&&(i.size=c.size);break;default:i=typeof c.is=="string"?f.createElement(a,{is:c.is}):f.createElement(a)}}i[qt]=r,i[Qt]=c;e:for(f=r.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===r)break e;for(;f.sibling===null;){if(f.return===null||f.return===r)break e;f=f.return}f.sibling.return=f.return,f=f.sibling}r.stateNode=i;e:switch(Ut(i,a,c),a){case"button":case"input":case"select":case"textarea":i=!!c.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&ki(r)}}return tt(r),r.flags&=-16777217,null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==c&&ki(r);else{if(typeof c!="string"&&r.stateNode===null)throw Error(s(166));if(i=le.current,la(r)){if(i=r.stateNode,a=r.memoizedProps,c=null,f=Yt,f!==null)switch(f.tag){case 27:case 5:c=f.memoizedProps}i[qt]=r,i=!!(i.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||$0(i.nodeValue,a)),i||Gs(r)}else i=Vc(i).createTextNode(c),i[qt]=r,r.stateNode=i}return tt(r),null;case 13:if(c=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(f=la(r),c!==null&&c.dehydrated!==null){if(i===null){if(!f)throw Error(s(318));if(f=r.memoizedState,f=f!==null?f.dehydrated:null,!f)throw Error(s(317));f[qt]=r}else ca(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;tt(r),f=!1}else f=vb(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=f),f=!0;if(!f)return r.flags&256?(Oi(r),r):(Oi(r),null)}if(Oi(r),(r.flags&128)!==0)return r.lanes=a,r;if(a=c!==null,i=i!==null&&i.memoizedState!==null,a){c=r.child,f=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(f=c.alternate.memoizedState.cachePool.pool);var m=null;c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(m=c.memoizedState.cachePool.pool),m!==f&&(c.flags|=2048)}return a!==i&&a&&(r.child.flags|=8192),Ec(r,r.updateQueue),tt(r),null;case 4:return wn(),i===null&&Ah(r.stateNode.containerInfo),tt(r),null;case 10:return Ei(r.type),tt(r),null;case 19:if(te(Rt),f=r.memoizedState,f===null)return tt(r),null;if(c=(r.flags&128)!==0,m=f.rendering,m===null)if(c)Ea(f,!1);else{if(rt!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(m=Sc(i),m!==null){for(r.flags|=128,Ea(f,!1),i=m.updateQueue,r.updateQueue=i,Ec(r,i),r.subtreeFlags=0,i=a,a=r.child;a!==null;)mb(a,i),a=a.sibling;return X(Rt,Rt.current&1|2),r.child}i=i.sibling}f.tail!==null&&xe()>_c&&(r.flags|=128,c=!0,Ea(f,!1),r.lanes=4194304)}else{if(!c)if(i=Sc(m),i!==null){if(r.flags|=128,c=!0,i=i.updateQueue,r.updateQueue=i,Ec(r,i),Ea(f,!0),f.tail===null&&f.tailMode==="hidden"&&!m.alternate&&!$e)return tt(r),null}else 2*xe()-f.renderingStartTime>_c&&a!==536870912&&(r.flags|=128,c=!0,Ea(f,!1),r.lanes=4194304);f.isBackwards?(m.sibling=r.child,r.child=m):(i=f.last,i!==null?i.sibling=m:r.child=m,f.last=m)}return f.tail!==null?(r=f.tail,f.rendering=r,f.tail=r.sibling,f.renderingStartTime=xe(),r.sibling=null,i=Rt.current,X(Rt,c?i&1|2:i&1),r):(tt(r),null);case 22:case 23:return Oi(r),Rd(),c=r.memoizedState!==null,i!==null?i.memoizedState!==null!==c&&(r.flags|=8192):c&&(r.flags|=8192),c?(a&536870912)!==0&&(r.flags&128)===0&&(tt(r),r.subtreeFlags&6&&(r.flags|=8192)):tt(r),a=r.updateQueue,a!==null&&Ec(r,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==a&&(r.flags|=2048),i!==null&&te(Js),null;case 24:return a=null,i!==null&&(a=i.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),Ei(Et),tt(r),null;case 25:return null;case 30:return null}throw Error(s(156,r.tag))}function U_(i,r){switch(dd(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return Ei(Et),wn(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return bi(r),null;case 13:if(Oi(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(s(340));ca()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return te(Rt),null;case 4:return wn(),null;case 10:return Ei(r.type),null;case 22:case 23:return Oi(r),Rd(),i!==null&&te(Js),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return Ei(Et),null;case 25:return null;default:return null}}function qv(i,r){switch(dd(r),r.tag){case 3:Ei(Et),wn();break;case 26:case 27:case 5:bi(r);break;case 4:wn();break;case 13:Oi(r);break;case 19:te(Rt);break;case 10:Ei(r.type);break;case 22:case 23:Oi(r),Rd(),i!==null&&te(Js);break;case 24:Ei(Et)}}function Ra(i,r){try{var a=r.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var f=c.next;a=f;do{if((a.tag&i)===i){c=void 0;var m=a.create,b=a.inst;c=m(),b.destroy=c}a=a.next}while(a!==f)}}catch(w){Pe(r,r.return,w)}}function os(i,r,a){try{var c=r.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var m=f.next;c=m;do{if((c.tag&i)===i){var b=c.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,f=r;var E=a,$=w;try{$()}catch(K){Pe(f,E,K)}}}c=c.next}while(c!==m)}}catch(K){Pe(r,r.return,K)}}function Pv(i){var r=i.updateQueue;if(r!==null){var a=i.stateNode;try{Mb(r,a)}catch(c){Pe(i,i.return,c)}}}function Iv(i,r,a){a.props=Qs(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(c){Pe(i,r,c)}}function Oa(i,r){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var c=i.stateNode;break;case 30:c=i.stateNode;break;default:c=i.stateNode}typeof a=="function"?i.refCleanup=a(c):a.current=c}}catch(f){Pe(i,r,f)}}function ti(i,r){var a=i.ref,c=i.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(f){Pe(i,r,f)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(f){Pe(i,r,f)}else a.current=null}function Hv(i){var r=i.type,a=i.memoizedProps,c=i.stateNode;try{e:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(f){Pe(i,i.return,f)}}function eh(i,r,a){try{var c=i.stateNode;ok(c,i.type,a,r),c[Qt]=r}catch(f){Pe(i,i.return,f)}}function Fv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&ps(i.type)||i.tag===4}function th(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Fv(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&&ps(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 nh(i,r,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(i,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(i),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=Lc));else if(c!==4&&(c===27&&ps(i.type)&&(a=i.stateNode,r=null),i=i.child,i!==null))for(nh(i,r,a),i=i.sibling;i!==null;)nh(i,r,a),i=i.sibling}function Rc(i,r,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,r?a.insertBefore(i,r):a.appendChild(i);else if(c!==4&&(c===27&&ps(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(Rc(i,r,a),i=i.sibling;i!==null;)Rc(i,r,a),i=i.sibling}function Gv(i){var r=i.stateNode,a=i.memoizedProps;try{for(var c=i.type,f=r.attributes;f.length;)r.removeAttributeNode(f[0]);Ut(r,c,a),r[qt]=i,r[Qt]=a}catch(m){Pe(i,i.return,m)}}var Mi=!1,dt=!1,ih=!1,Yv=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function z_(i,r){if(i=i.containerInfo,Oh=Ic,i=rb(i),td(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var f=c.anchorOffset,m=c.focusNode;c=c.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,w=-1,E=-1,$=0,K=0,H=i,L=null;t:for(;;){for(var U;H!==a||f!==0&&H.nodeType!==3||(w=b+f),H!==m||c!==0&&H.nodeType!==3||(E=b+c),H.nodeType===3&&(b+=H.nodeValue.length),(U=H.firstChild)!==null;)L=H,H=U;for(;;){if(H===i)break t;if(L===a&&++$===f&&(w=b),L===m&&++K===c&&(E=b),(U=H.nextSibling)!==null)break;H=L,L=H.parentNode}H=U}a=w===-1||E===-1?null:{start:w,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(_h={focusedElem:i,selectionRange:a},Ic=!1,Dt=r;Dt!==null;)if(r=Dt,i=r.child,(r.subtreeFlags&1024)!==0&&i!==null)i.return=r,Dt=i;else for(;Dt!==null;){switch(r=Dt,m=r.alternate,i=r.flags,r.tag){case 0:break;case 11:case 15:break;case 1:if((i&1024)!==0&&m!==null){i=void 0,a=r,f=m.memoizedProps,m=m.memoizedState,c=a.stateNode;try{var me=Qs(a.type,f,a.elementType===a.type);i=c.getSnapshotBeforeUpdate(me,m),c.__reactInternalSnapshotBeforeUpdate=i}catch(de){Pe(a,a.return,de)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,a=i.nodeType,a===9)Ch(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Ch(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(s(163))}if(i=r.sibling,i!==null){i.return=r.return,Dt=i;break}Dt=r.return}}function Xv(i,r,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:as(i,a),c&4&&Ra(5,a);break;case 1:if(as(i,a),c&4)if(i=a.stateNode,r===null)try{i.componentDidMount()}catch(b){Pe(a,a.return,b)}else{var f=Qs(a.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(f,r,i.__reactInternalSnapshotBeforeUpdate)}catch(b){Pe(a,a.return,b)}}c&64&&Pv(a),c&512&&Oa(a,a.return);break;case 3:if(as(i,a),c&64&&(i=a.updateQueue,i!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{Mb(i,r)}catch(b){Pe(a,a.return,b)}}break;case 27:r===null&&c&4&&Gv(a);case 26:case 5:as(i,a),r===null&&c&4&&Hv(a),c&512&&Oa(a,a.return);break;case 12:as(i,a);break;case 13:as(i,a),c&4&&Qv(i,a),c&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=X_.bind(null,a),hk(i,a))));break;case 22:if(c=a.memoizedState!==null||Mi,!c){r=r!==null&&r.memoizedState!==null||dt,f=Mi;var m=dt;Mi=c,(dt=r)&&!m?ls(i,a,(a.subtreeFlags&8772)!==0):as(i,a),Mi=f,dt=m}break;case 30:break;default:as(i,a)}}function Jv(i){var r=i.alternate;r!==null&&(i.alternate=null,Jv(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Bf(r)),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 Je=null,tn=!1;function Ci(i,r,a){for(a=a.child;a!==null;)Zv(i,r,a),a=a.sibling}function Zv(i,r,a){if(ln&&typeof ln.onCommitFiberUnmount=="function")try{ln.onCommitFiberUnmount(Yo,a)}catch{}switch(a.tag){case 26:dt||ti(a,r),Ci(i,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dt||ti(a,r);var c=Je,f=tn;ps(a.type)&&(Je=a.stateNode,tn=!1),Ci(i,r,a),Ba(a.stateNode),Je=c,tn=f;break;case 5:dt||ti(a,r);case 6:if(c=Je,f=tn,Je=null,Ci(i,r,a),Je=c,tn=f,Je!==null)if(tn)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(a.stateNode)}catch(m){Pe(a,r,m)}else try{Je.removeChild(a.stateNode)}catch(m){Pe(a,r,m)}break;case 18:Je!==null&&(tn?(i=Je,U0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Ia(i)):U0(Je,a.stateNode));break;case 4:c=Je,f=tn,Je=a.stateNode.containerInfo,tn=!0,Ci(i,r,a),Je=c,tn=f;break;case 0:case 11:case 14:case 15:dt||os(2,a,r),dt||os(4,a,r),Ci(i,r,a);break;case 1:dt||(ti(a,r),c=a.stateNode,typeof c.componentWillUnmount=="function"&&Iv(a,r,c)),Ci(i,r,a);break;case 21:Ci(i,r,a);break;case 22:dt=(c=dt)||a.memoizedState!==null,Ci(i,r,a),dt=c;break;default:Ci(i,r,a)}}function Qv(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ia(i)}catch(a){Pe(r,r.return,a)}}function K_(i){switch(i.tag){case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new Yv),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new Yv),r;default:throw Error(s(435,i.tag))}}function sh(i,r){var a=K_(i);r.forEach(function(c){var f=J_.bind(null,i,c);a.has(c)||(a.add(c),c.then(f,f))})}function dn(i,r){var a=r.deletions;if(a!==null)for(var c=0;c<a.length;c++){var f=a[c],m=i,b=r,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(ps(w.type)){Je=w.stateNode,tn=!1;break e}break;case 5:Je=w.stateNode,tn=!1;break e;case 3:case 4:Je=w.stateNode.containerInfo,tn=!0;break e}w=w.return}if(Je===null)throw Error(s(160));Zv(m,b,f),Je=null,tn=!1,m=f.alternate,m!==null&&(m.return=null),f.return=null}if(r.subtreeFlags&13878)for(r=r.child;r!==null;)Wv(r,i),r=r.sibling}var qn=null;function Wv(i,r){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:dn(r,i),hn(i),c&4&&(os(3,i,i.return),Ra(3,i),os(5,i,i.return));break;case 1:dn(r,i),hn(i),c&512&&(dt||a===null||ti(a,a.return)),c&64&&Mi&&(i=i.updateQueue,i!==null&&(c=i.callbacks,c!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?c:a.concat(c))));break;case 26:var f=qn;if(dn(r,i),hn(i),c&512&&(dt||a===null||ti(a,a.return)),c&4){var m=a!==null?a.memoizedState:null;if(c=i.memoizedState,a===null)if(c===null)if(i.stateNode===null){e:{c=i.type,a=i.memoizedProps,f=f.ownerDocument||f;t:switch(c){case"title":m=f.getElementsByTagName("title")[0],(!m||m[Zo]||m[qt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=f.createElement(c),f.head.insertBefore(m,f.querySelector("head > title"))),Ut(m,c,a),m[qt]=i,Mt(m),c=m;break e;case"link":var b=G0("link","href",f).get(c+(a.href||""));if(b){for(var w=0;w<b.length;w++)if(m=b[w],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(w,1);break t}}m=f.createElement(c),Ut(m,c,a),f.head.appendChild(m);break;case"meta":if(b=G0("meta","content",f).get(c+(a.content||""))){for(w=0;w<b.length;w++)if(m=b[w],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(w,1);break t}}m=f.createElement(c),Ut(m,c,a),f.head.appendChild(m);break;default:throw Error(s(468,c))}m[qt]=i,Mt(m),c=m}i.stateNode=c}else Y0(f,i.type,i.stateNode);else i.stateNode=F0(f,c,i.memoizedProps);else m!==c?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,c===null?Y0(f,i.type,i.stateNode):F0(f,c,i.memoizedProps)):c===null&&i.stateNode!==null&&eh(i,i.memoizedProps,a.memoizedProps)}break;case 27:dn(r,i),hn(i),c&512&&(dt||a===null||ti(a,a.return)),a!==null&&c&4&&eh(i,i.memoizedProps,a.memoizedProps);break;case 5:if(dn(r,i),hn(i),c&512&&(dt||a===null||ti(a,a.return)),i.flags&32){f=i.stateNode;try{kr(f,"")}catch(U){Pe(i,i.return,U)}}c&4&&i.stateNode!=null&&(f=i.memoizedProps,eh(i,f,a!==null?a.memoizedProps:f)),c&1024&&(ih=!0);break;case 6:if(dn(r,i),hn(i),c&4){if(i.stateNode===null)throw Error(s(162));c=i.memoizedProps,a=i.stateNode;try{a.nodeValue=c}catch(U){Pe(i,i.return,U)}}break;case 3:if(Kc=null,f=qn,qn=Uc(r.containerInfo),dn(r,i),qn=f,hn(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ia(r.containerInfo)}catch(U){Pe(i,i.return,U)}ih&&(ih=!1,e0(i));break;case 4:c=qn,qn=Uc(i.stateNode.containerInfo),dn(r,i),hn(i),qn=c;break;case 12:dn(r,i),hn(i);break;case 13:dn(r,i),hn(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(uh=xe()),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,sh(i,c)));break;case 22:f=i.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,$=Mi,K=dt;if(Mi=$||f,dt=K||E,dn(r,i),dt=K,Mi=$,hn(i),c&8192)e:for(r=i.stateNode,r._visibility=f?r._visibility&-2:r._visibility|1,f&&(a===null||E||Mi||dt||Ws(i)),a=null,r=i;;){if(r.tag===5||r.tag===26){if(a===null){E=a=r;try{if(m=E.stateNode,f)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=E.stateNode;var H=E.memoizedProps.style,L=H!=null&&H.hasOwnProperty("display")?H.display:null;w.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(U){Pe(E,E.return,U)}}}else if(r.tag===6){if(a===null){E=r;try{E.stateNode.nodeValue=f?"":E.memoizedProps}catch(U){Pe(E,E.return,U)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}c&4&&(c=i.updateQueue,c!==null&&(a=c.retryQueue,a!==null&&(c.retryQueue=null,sh(i,a))));break;case 19:dn(r,i),hn(i),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,sh(i,c)));break;case 30:break;case 21:break;default:dn(r,i),hn(i)}}function hn(i){var r=i.flags;if(r&2){try{for(var a,c=i.return;c!==null;){if(Fv(c)){a=c;break}c=c.return}if(a==null)throw Error(s(160));switch(a.tag){case 27:var f=a.stateNode,m=th(i);Rc(i,m,f);break;case 5:var b=a.stateNode;a.flags&32&&(kr(b,""),a.flags&=-33);var w=th(i);Rc(i,w,b);break;case 3:case 4:var E=a.stateNode.containerInfo,$=th(i);nh(i,$,E);break;default:throw Error(s(161))}}catch(K){Pe(i,i.return,K)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function e0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;e0(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function as(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)Xv(i,r.alternate,r),r=r.sibling}function Ws(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:os(4,r,r.return),Ws(r);break;case 1:ti(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&Iv(r,r.return,a),Ws(r);break;case 27:Ba(r.stateNode);case 26:case 5:ti(r,r.return),Ws(r);break;case 22:r.memoizedState===null&&Ws(r);break;case 30:Ws(r);break;default:Ws(r)}i=i.sibling}}function ls(i,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var c=r.alternate,f=i,m=r,b=m.flags;switch(m.tag){case 0:case 11:case 15:ls(f,m,a),Ra(4,m);break;case 1:if(ls(f,m,a),c=m,f=c.stateNode,typeof f.componentDidMount=="function")try{f.componentDidMount()}catch($){Pe(c,c.return,$)}if(c=m,f=c.updateQueue,f!==null){var w=c.stateNode;try{var E=f.shared.hiddenCallbacks;if(E!==null)for(f.shared.hiddenCallbacks=null,f=0;f<E.length;f++)kb(E[f],w)}catch($){Pe(c,c.return,$)}}a&&b&64&&Pv(m),Oa(m,m.return);break;case 27:Gv(m);case 26:case 5:ls(f,m,a),a&&c===null&&b&4&&Hv(m),Oa(m,m.return);break;case 12:ls(f,m,a);break;case 13:ls(f,m,a),a&&b&4&&Qv(f,m);break;case 22:m.memoizedState===null&&ls(f,m,a),Oa(m,m.return);break;case 30:break;default:ls(f,m,a)}r=r.sibling}}function rh(i,r){var a=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==a&&(i!=null&&i.refCount++,a!=null&&da(a))}function oh(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&da(i))}function ni(i,r,a,c){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)t0(i,r,a,c),r=r.sibling}function t0(i,r,a,c){var f=r.flags;switch(r.tag){case 0:case 11:case 15:ni(i,r,a,c),f&2048&&Ra(9,r);break;case 1:ni(i,r,a,c);break;case 3:ni(i,r,a,c),f&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&da(i)));break;case 12:if(f&2048){ni(i,r,a,c),i=r.stateNode;try{var m=r.memoizedProps,b=m.id,w=m.onPostCommit;typeof w=="function"&&w(b,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(E){Pe(r,r.return,E)}}else ni(i,r,a,c);break;case 13:ni(i,r,a,c);break;case 23:break;case 22:m=r.stateNode,b=r.alternate,r.memoizedState!==null?m._visibility&2?ni(i,r,a,c):_a(i,r):m._visibility&2?ni(i,r,a,c):(m._visibility|=2,Yr(i,r,a,c,(r.subtreeFlags&10256)!==0)),f&2048&&rh(b,r);break;case 24:ni(i,r,a,c),f&2048&&oh(r.alternate,r);break;default:ni(i,r,a,c)}}function Yr(i,r,a,c,f){for(f=f&&(r.subtreeFlags&10256)!==0,r=r.child;r!==null;){var m=i,b=r,w=a,E=c,$=b.flags;switch(b.tag){case 0:case 11:case 15:Yr(m,b,w,E,f),Ra(8,b);break;case 23:break;case 22:var K=b.stateNode;b.memoizedState!==null?K._visibility&2?Yr(m,b,w,E,f):_a(m,b):(K._visibility|=2,Yr(m,b,w,E,f)),f&&$&2048&&rh(b.alternate,b);break;case 24:Yr(m,b,w,E,f),f&&$&2048&&oh(b.alternate,b);break;default:Yr(m,b,w,E,f)}r=r.sibling}}function _a(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=i,c=r,f=c.flags;switch(c.tag){case 22:_a(a,c),f&2048&&rh(c.alternate,c);break;case 24:_a(a,c),f&2048&&oh(c.alternate,c);break;default:_a(a,c)}r=r.sibling}}var ka=8192;function Xr(i){if(i.subtreeFlags&ka)for(i=i.child;i!==null;)n0(i),i=i.sibling}function n0(i){switch(i.tag){case 26:Xr(i),i.flags&ka&&i.memoizedState!==null&&Rk(qn,i.memoizedState,i.memoizedProps);break;case 5:Xr(i);break;case 3:case 4:var r=qn;qn=Uc(i.stateNode.containerInfo),Xr(i),qn=r;break;case 22:i.memoizedState===null&&(r=i.alternate,r!==null&&r.memoizedState!==null?(r=ka,ka=16777216,Xr(i),ka=r):Xr(i));break;default:Xr(i)}}function i0(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function Ma(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var c=r[a];Dt=c,r0(c,i)}i0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)s0(i),i=i.sibling}function s0(i){switch(i.tag){case 0:case 11:case 15:Ma(i),i.flags&2048&&os(9,i,i.return);break;case 3:Ma(i);break;case 12:Ma(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,Oc(i)):Ma(i);break;default:Ma(i)}}function Oc(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var c=r[a];Dt=c,r0(c,i)}i0(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:os(8,r,r.return),Oc(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,Oc(r));break;default:Oc(r)}i=i.sibling}}function r0(i,r){for(;Dt!==null;){var a=Dt;switch(a.tag){case 0:case 11:case 15:os(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:da(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,Dt=c;else e:for(a=i;Dt!==null;){c=Dt;var f=c.sibling,m=c.return;if(Jv(c),c===a){Dt=null;break e}if(f!==null){f.return=m,Dt=f;break e}Dt=m}}}var q_={getCacheForType:function(i){var r=Pt(Et),a=r.data.get(i);return a===void 0&&(a=i(),r.data.set(i,a)),a}},P_=typeof WeakMap=="function"?WeakMap:Map,Be=0,Fe=null,Re=null,Ce=0,Le=0,pn=null,cs=!1,Jr=!1,ah=!1,Di=0,rt=0,us=0,er=0,lh=0,Cn=0,Zr=0,Ca=null,nn=null,ch=!1,uh=0,_c=1/0,kc=null,fs=null,Vt=0,ds=null,Qr=null,Wr=0,fh=0,dh=null,o0=null,Da=0,hh=null;function mn(){if((Be&2)!==0&&Ce!==0)return Ce&-Ce;if(B.T!==null){var i=zr;return i!==0?i:Sh()}return xg()}function a0(){Cn===0&&(Cn=(Ce&536870912)===0||$e?bg():536870912);var i=Mn.current;return i!==null&&(i.flags|=32),Cn}function yn(i,r,a){(i===Fe&&(Le===2||Le===9)||i.cancelPendingCommit!==null)&&(eo(i,0),hs(i,Ce,Cn,!1)),Jo(i,a),((Be&2)===0||i!==Fe)&&(i===Fe&&((Be&2)===0&&(er|=a),rt===4&&hs(i,Ce,Cn,!1)),ii(i))}function l0(i,r,a){if((Be&6)!==0)throw Error(s(327));var c=!a&&(r&124)===0&&(r&i.expiredLanes)===0||Xo(i,r),f=c?F_(i,r):yh(i,r,!0),m=c;do{if(f===0){Jr&&!c&&hs(i,r,0,!1);break}else{if(a=i.current.alternate,m&&!I_(a)){f=yh(i,r,!1),m=!1;continue}if(f===2){if(m=r,i.errorRecoveryDisabledLanes&m)var b=0;else b=i.pendingLanes&-536870913,b=b!==0?b:b&536870912?536870912:0;if(b!==0){r=b;e:{var w=i;f=Ca;var E=w.current.memoizedState.isDehydrated;if(E&&(eo(w,b).flags|=256),b=yh(w,b,!1),b!==2){if(ah&&!E){w.errorRecoveryDisabledLanes|=m,er|=m,f=4;break e}m=nn,nn=f,m!==null&&(nn===null?nn=m:nn.push.apply(nn,m))}f=b}if(m=!1,f!==2)continue}}if(f===1){eo(i,0),hs(i,r,0,!0);break}e:{switch(c=i,m=f,m){case 0:case 1:throw Error(s(345));case 4:if((r&4194048)!==r)break;case 6:hs(c,r,Cn,!cs);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(s(329))}if((r&62914560)===r&&(f=uh+300-xe(),10<f)){if(hs(c,r,Cn,!cs),zl(c,0,!0)!==0)break e;c.timeoutHandle=L0(c0.bind(null,c,a,nn,kc,ch,r,Cn,er,Zr,cs,m,2,-0,0),f);break e}c0(c,a,nn,kc,ch,r,Cn,er,Zr,cs,m,0,-0,0)}}break}while(!0);ii(i)}function c0(i,r,a,c,f,m,b,w,E,$,K,H,L,U){if(i.timeoutHandle=-1,H=r.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(Ua={stylesheets:null,count:0,unsuspend:Ek},n0(r),H=Ok(),H!==null)){i.cancelPendingCommit=H(y0.bind(null,i,r,m,a,c,f,b,w,E,K,1,L,U)),hs(i,m,b,!$);return}y0(i,r,m,a,c,f,b,w,E)}function I_(i){for(var r=i;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var c=0;c<a.length;c++){var f=a[c],m=f.getSnapshot;f=f.value;try{if(!un(m(),f))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function hs(i,r,a,c){r&=~lh,r&=~er,i.suspendedLanes|=r,i.pingedLanes&=~r,c&&(i.warmLanes|=r),c=i.expirationTimes;for(var f=r;0<f;){var m=31-cn(f),b=1<<m;c[m]=-1,f&=~b}a!==0&&Sg(i,a,r)}function Mc(){return(Be&6)===0?(Na(0),!1):!0}function ph(){if(Re!==null){if(Le===0)var i=Re.return;else i=Re,Ai=Ys=null,Cd(i),Fr=null,Ta=0,i=Re;for(;i!==null;)qv(i.alternate,i),i=i.return;Re=null}}function eo(i,r){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,lk(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),ph(),Fe=i,Re=a=wi(i.current,null),Ce=r,Le=0,pn=null,cs=!1,Jr=Xo(i,r),ah=!1,Zr=Cn=lh=er=us=rt=0,nn=Ca=null,ch=!1,(r&8)!==0&&(r|=r&32);var c=i.entangledLanes;if(c!==0)for(i=i.entanglements,c&=r;0<c;){var f=31-cn(c),m=1<<f;r|=i[f],c&=~m}return Di=r,Ql(),a}function u0(i,r){Te=null,B.H=gc,r===pa||r===ac?(r=Ob(),Le=3):r===Ab?(r=Ob(),Le=4):Le=r===_v?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,pn=r,Re===null&&(rt=1,xc(i,Rn(r,i.current)))}function f0(){var i=B.H;return B.H=gc,i===null?gc:i}function d0(){var i=B.A;return B.A=q_,i}function mh(){rt=4,cs||(Ce&4194048)!==Ce&&Mn.current!==null||(Jr=!0),(us&134217727)===0&&(er&134217727)===0||Fe===null||hs(Fe,Ce,Cn,!1)}function yh(i,r,a){var c=Be;Be|=2;var f=f0(),m=d0();(Fe!==i||Ce!==r)&&(kc=null,eo(i,r)),r=!1;var b=rt;e:do try{if(Le!==0&&Re!==null){var w=Re,E=pn;switch(Le){case 8:ph(),b=6;break e;case 3:case 2:case 9:case 6:Mn.current===null&&(r=!0);var $=Le;if(Le=0,pn=null,to(i,w,E,$),a&&Jr){b=0;break e}break;default:$=Le,Le=0,pn=null,to(i,w,E,$)}}H_(),b=rt;break}catch(K){u0(i,K)}while(!0);return r&&i.shellSuspendCounter++,Ai=Ys=null,Be=c,B.H=f,B.A=m,Re===null&&(Fe=null,Ce=0,Ql()),b}function H_(){for(;Re!==null;)h0(Re)}function F_(i,r){var a=Be;Be|=2;var c=f0(),f=d0();Fe!==i||Ce!==r?(kc=null,_c=xe()+500,eo(i,r)):Jr=Xo(i,r);e:do try{if(Le!==0&&Re!==null){r=Re;var m=pn;t:switch(Le){case 1:Le=0,pn=null,to(i,r,m,1);break;case 2:case 9:if(Eb(m)){Le=0,pn=null,p0(r);break}r=function(){Le!==2&&Le!==9||Fe!==i||(Le=7),ii(i)},m.then(r,r);break e;case 3:Le=7;break e;case 4:Le=5;break e;case 7:Eb(m)?(Le=0,pn=null,p0(r)):(Le=0,pn=null,to(i,r,m,7));break;case 5:var b=null;switch(Re.tag){case 26:b=Re.memoizedState;case 5:case 27:var w=Re;if(!b||X0(b)){Le=0,pn=null;var E=w.sibling;if(E!==null)Re=E;else{var $=w.return;$!==null?(Re=$,Cc($)):Re=null}break t}}Le=0,pn=null,to(i,r,m,5);break;case 6:Le=0,pn=null,to(i,r,m,6);break;case 8:ph(),rt=6;break e;default:throw Error(s(462))}}G_();break}catch(K){u0(i,K)}while(!0);return Ai=Ys=null,B.H=c,B.A=f,Be=a,Re!==null?0:(Fe=null,Ce=0,Ql(),rt)}function G_(){for(;Re!==null&&!et();)h0(Re)}function h0(i){var r=zv(i.alternate,i,Di);i.memoizedProps=i.pendingProps,r===null?Cc(i):Re=r}function p0(i){var r=i,a=r.alternate;switch(r.tag){case 15:case 0:r=$v(a,r,r.pendingProps,r.type,void 0,Ce);break;case 11:r=$v(a,r,r.pendingProps,r.type.render,r.ref,Ce);break;case 5:Cd(r);default:qv(a,r),r=Re=mb(r,Di),r=zv(a,r,Di)}i.memoizedProps=i.pendingProps,r===null?Cc(i):Re=r}function to(i,r,a,c){Ai=Ys=null,Cd(r),Fr=null,Ta=0;var f=r.return;try{if(B_(i,f,r,a,Ce)){rt=1,xc(i,Rn(a,i.current)),Re=null;return}}catch(m){if(f!==null)throw Re=f,m;rt=1,xc(i,Rn(a,i.current)),Re=null;return}r.flags&32768?($e||c===1?i=!0:Jr||(Ce&536870912)!==0?i=!1:(cs=i=!0,(c===2||c===9||c===3||c===6)&&(c=Mn.current,c!==null&&c.tag===13&&(c.flags|=16384))),m0(r,i)):Cc(r)}function Cc(i){var r=i;do{if((r.flags&32768)!==0){m0(r,cs);return}i=r.return;var a=V_(r.alternate,r,Di);if(a!==null){Re=a;return}if(r=r.sibling,r!==null){Re=r;return}Re=r=i}while(r!==null);rt===0&&(rt=5)}function m0(i,r){do{var a=U_(i.alternate,i);if(a!==null){a.flags&=32767,Re=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(i=i.sibling,i!==null)){Re=i;return}Re=i=a}while(i!==null);rt=6,Re=null}function y0(i,r,a,c,f,m,b,w,E){i.cancelPendingCommit=null;do Dc();while(Vt!==0);if((Be&6)!==0)throw Error(s(327));if(r!==null){if(r===i.current)throw Error(s(177));if(m=r.lanes|r.childLanes,m|=od,EO(i,a,m,b,w,E),i===Fe&&(Re=Fe=null,Ce=0),Qr=r,ds=i,Wr=a,fh=m,dh=f,o0=c,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Z_(xn,function(){return w0(),null})):(i.callbackNode=null,i.callbackPriority=0),c=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||c){c=B.T,B.T=null,f=q.p,q.p=2,b=Be,Be|=4;try{z_(i,r,a)}finally{Be=b,q.p=f,B.T=c}}Vt=1,g0(),b0(),v0()}}function g0(){if(Vt===1){Vt=0;var i=ds,r=Qr,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var c=q.p;q.p=2;var f=Be;Be|=4;try{Wv(r,i);var m=_h,b=rb(i.containerInfo),w=m.focusedElem,E=m.selectionRange;if(b!==w&&w&&w.ownerDocument&&sb(w.ownerDocument.documentElement,w)){if(E!==null&&td(w)){var $=E.start,K=E.end;if(K===void 0&&(K=$),"selectionStart"in w)w.selectionStart=$,w.selectionEnd=Math.min(K,w.value.length);else{var H=w.ownerDocument||document,L=H&&H.defaultView||window;if(L.getSelection){var U=L.getSelection(),me=w.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 k=ib(w,de),R=ib(w,Ke);if(k&&R&&(U.rangeCount!==1||U.anchorNode!==k.node||U.anchorOffset!==k.offset||U.focusNode!==R.node||U.focusOffset!==R.offset)){var N=H.createRange();N.setStart(k.node,k.offset),U.removeAllRanges(),de>Ke?(U.addRange(N),U.extend(R.node,R.offset)):(N.setEnd(R.node,R.offset),U.addRange(N))}}}}for(H=[],U=w;U=U.parentNode;)U.nodeType===1&&H.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<H.length;w++){var I=H[w];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Ic=!!Oh,_h=Oh=null}finally{Be=f,q.p=c,B.T=a}}i.current=r,Vt=2}}function b0(){if(Vt===2){Vt=0;var i=ds,r=Qr,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var c=q.p;q.p=2;var f=Be;Be|=4;try{Xv(i,r.alternate,r)}finally{Be=f,q.p=c,B.T=a}}Vt=3}}function v0(){if(Vt===4||Vt===3){Vt=0,At();var i=ds,r=Qr,a=Wr,c=o0;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Vt=5:(Vt=0,Qr=ds=null,S0(i,i.pendingLanes));var f=i.pendingLanes;if(f===0&&(fs=null),$f(a),r=r.stateNode,ln&&typeof ln.onCommitFiberRoot=="function")try{ln.onCommitFiberRoot(Yo,r,void 0,(r.current.flags&128)===128)}catch{}if(c!==null){r=B.T,f=q.p,q.p=2,B.T=null;try{for(var m=i.onRecoverableError,b=0;b<c.length;b++){var w=c[b];m(w.value,{componentStack:w.stack})}}finally{B.T=r,q.p=f}}(Wr&3)!==0&&Dc(),ii(i),f=i.pendingLanes,(a&4194090)!==0&&(f&42)!==0?i===hh?Da++:(Da=0,hh=i):Da=0,Na(0)}}function S0(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,da(r)))}function Dc(i){return g0(),b0(),v0(),w0()}function w0(){if(Vt!==5)return!1;var i=ds,r=fh;fh=0;var a=$f(Wr),c=B.T,f=q.p;try{q.p=32>a?32:a,B.T=null,a=dh,dh=null;var m=ds,b=Wr;if(Vt=0,Qr=ds=null,Wr=0,(Be&6)!==0)throw Error(s(331));var w=Be;if(Be|=4,s0(m.current),t0(m,m.current,b,a),Be=w,Na(0,!1),ln&&typeof ln.onPostCommitFiberRoot=="function")try{ln.onPostCommitFiberRoot(Yo,m)}catch{}return!0}finally{q.p=f,B.T=c,S0(i,r)}}function x0(i,r,a){r=Rn(a,r),r=Hd(i.stateNode,r,2),i=ns(i,r,2),i!==null&&(Jo(i,2),ii(i))}function Pe(i,r,a){if(i.tag===3)x0(i,i,a);else for(;r!==null;){if(r.tag===3){x0(r,i,a);break}else if(r.tag===1){var c=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(fs===null||!fs.has(c))){i=Rn(a,i),a=Rv(2),c=ns(r,a,2),c!==null&&(Ov(a,c,r,i),Jo(c,2),ii(c));break}}r=r.return}}function gh(i,r,a){var c=i.pingCache;if(c===null){c=i.pingCache=new P_;var f=new Set;c.set(r,f)}else f=c.get(r),f===void 0&&(f=new Set,c.set(r,f));f.has(a)||(ah=!0,f.add(a),i=Y_.bind(null,i,r,a),r.then(i,i))}function Y_(i,r,a){var c=i.pingCache;c!==null&&c.delete(r),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Fe===i&&(Ce&a)===a&&(rt===4||rt===3&&(Ce&62914560)===Ce&&300>xe()-uh?(Be&2)===0&&eo(i,0):lh|=a,Zr===Ce&&(Zr=0)),ii(i)}function T0(i,r){r===0&&(r=vg()),i=Br(i,r),i!==null&&(Jo(i,r),ii(i))}function X_(i){var r=i.memoizedState,a=0;r!==null&&(a=r.retryLane),T0(i,a)}function J_(i,r){var a=0;switch(i.tag){case 13:var c=i.stateNode,f=i.memoizedState;f!==null&&(a=f.retryLane);break;case 19:c=i.stateNode;break;case 22:c=i.stateNode._retryCache;break;default:throw Error(s(314))}c!==null&&c.delete(r),T0(i,a)}function Z_(i,r){return Me(i,r)}var Nc=null,no=null,bh=!1,$c=!1,vh=!1,tr=0;function ii(i){i!==no&&i.next===null&&(no===null?Nc=no=i:no=no.next=i),$c=!0,bh||(bh=!0,W_())}function Na(i,r){if(!vh&&$c){vh=!0;do for(var a=!1,c=Nc;c!==null;){if(i!==0){var f=c.pendingLanes;if(f===0)var m=0;else{var b=c.suspendedLanes,w=c.pingedLanes;m=(1<<31-cn(42|i)+1)-1,m&=f&~(b&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,O0(c,m))}else m=Ce,m=zl(c,c===Fe?m:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(m&3)===0||Xo(c,m)||(a=!0,O0(c,m));c=c.next}while(a);vh=!1}}function Q_(){A0()}function A0(){$c=bh=!1;var i=0;tr!==0&&(ak()&&(i=tr),tr=0);for(var r=xe(),a=null,c=Nc;c!==null;){var f=c.next,m=E0(c,r);m===0?(c.next=null,a===null?Nc=f:a.next=f,f===null&&(no=a)):(a=c,(i!==0||(m&3)!==0)&&($c=!0)),c=f}Na(i)}function E0(i,r){for(var a=i.suspendedLanes,c=i.pingedLanes,f=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var b=31-cn(m),w=1<<b,E=f[b];E===-1?((w&a)===0||(w&c)!==0)&&(f[b]=AO(w,r)):E<=r&&(i.expiredLanes|=w),m&=~w}if(r=Fe,a=Ce,a=zl(i,i===r?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c=i.callbackNode,a===0||i===r&&(Le===2||Le===9)||i.cancelPendingCommit!==null)return c!==null&&c!==null&&Ae(c),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Xo(i,a)){if(r=a&-a,r===i.callbackPriority)return r;switch(c!==null&&Ae(c),$f(a)){case 2:case 8:a=Kt;break;case 32:a=xn;break;case 268435456:a=Tn;break;default:a=xn}return c=R0.bind(null,i),a=Me(a,c),i.callbackPriority=r,i.callbackNode=a,r}return c!==null&&c!==null&&Ae(c),i.callbackPriority=2,i.callbackNode=null,2}function R0(i,r){if(Vt!==0&&Vt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Dc()&&i.callbackNode!==a)return null;var c=Ce;return c=zl(i,i===Fe?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c===0?null:(l0(i,c,r),E0(i,xe()),i.callbackNode!=null&&i.callbackNode===a?R0.bind(null,i):null)}function O0(i,r){if(Dc())return null;l0(i,r,!0)}function W_(){ck(function(){(Be&6)!==0?Me(Gt,Q_):A0()})}function Sh(){return tr===0&&(tr=bg()),tr}function _0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Hl(""+i)}function k0(i,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,i.id&&a.setAttribute("form",i.id),r.parentNode.insertBefore(a,r),i=new FormData(i),a.parentNode.removeChild(a),i}function ek(i,r,a,c,f){if(r==="submit"&&a&&a.stateNode===f){var m=_0((f[Qt]||null).action),b=c.submitter;b&&(r=(r=b[Qt]||null)?_0(r.formAction):b.getAttribute("formAction"),r!==null&&(m=r,b=null));var w=new Xl("action","action",null,c,f);i.push({event:w,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(tr!==0){var E=b?k0(f,b):new FormData(f);zd(a,{pending:!0,data:E,method:f.method,action:m},null,E)}}else typeof m=="function"&&(w.preventDefault(),E=b?k0(f,b):new FormData(f),zd(a,{pending:!0,data:E,method:f.method,action:m},m,E))},currentTarget:f}]})}}for(var wh=0;wh<rd.length;wh++){var xh=rd[wh],tk=xh.toLowerCase(),nk=xh[0].toUpperCase()+xh.slice(1);Kn(tk,"on"+nk)}Kn(lb,"onAnimationEnd"),Kn(cb,"onAnimationIteration"),Kn(ub,"onAnimationStart"),Kn("dblclick","onDoubleClick"),Kn("focusin","onFocus"),Kn("focusout","onBlur"),Kn(v_,"onTransitionRun"),Kn(S_,"onTransitionStart"),Kn(w_,"onTransitionCancel"),Kn(fb,"onTransitionEnd"),Rr("onMouseEnter",["mouseout","mouseover"]),Rr("onMouseLeave",["mouseout","mouseover"]),Rr("onPointerEnter",["pointerout","pointerover"]),Rr("onPointerLeave",["pointerout","pointerover"]),Us("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Us("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Us("onBeforeInput",["compositionend","keypress","textInput","paste"]),Us("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Us("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Us("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $a="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(" "),ik=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($a));function M0(i,r){r=(r&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],f=c.event;c=c.listeners;e:{var m=void 0;if(r)for(var b=c.length-1;0<=b;b--){var w=c[b],E=w.instance,$=w.currentTarget;if(w=w.listener,E!==m&&f.isPropagationStopped())break e;m=w,f.currentTarget=$;try{m(f)}catch(K){wc(K)}f.currentTarget=null,m=E}else for(b=0;b<c.length;b++){if(w=c[b],E=w.instance,$=w.currentTarget,w=w.listener,E!==m&&f.isPropagationStopped())break e;m=w,f.currentTarget=$;try{m(f)}catch(K){wc(K)}f.currentTarget=null,m=E}}}}function Oe(i,r){var a=r[jf];a===void 0&&(a=r[jf]=new Set);var c=i+"__bubble";a.has(c)||(C0(r,i,2,!1),a.add(c))}function Th(i,r,a){var c=0;r&&(c|=4),C0(a,i,c,r)}var jc="_reactListening"+Math.random().toString(36).slice(2);function Ah(i){if(!i[jc]){i[jc]=!0,Ag.forEach(function(a){a!=="selectionchange"&&(ik.has(a)||Th(a,!1,i),Th(a,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[jc]||(r[jc]=!0,Th("selectionchange",!1,r))}}function C0(i,r,a,c){switch(tS(r)){case 2:var f=Mk;break;case 8:f=Ck;break;default:f=Vh}a=f.bind(null,r,a,i),f=void 0,!Ff||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(f=!0),c?f!==void 0?i.addEventListener(r,a,{capture:!0,passive:f}):i.addEventListener(r,a,!0):f!==void 0?i.addEventListener(r,a,{passive:f}):i.addEventListener(r,a,!1)}function Eh(i,r,a,c,f){var m=c;if((r&1)===0&&(r&2)===0&&c!==null)e:for(;;){if(c===null)return;var b=c.tag;if(b===3||b===4){var w=c.stateNode.containerInfo;if(w===f)break;if(b===4)for(b=c.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===f)return;b=b.return}for(;w!==null;){if(b=Tr(w),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){c=m=b;continue e}w=w.parentNode}}c=c.return}Vg(function(){var $=m,K=If(a),H=[];e:{var L=db.get(i);if(L!==void 0){var U=Xl,me=i;switch(i){case"keypress":if(Gl(a)===0)break e;case"keydown":case"keyup":U=ZO;break;case"focusin":me="focus",U=Jf;break;case"focusout":me="blur",U=Jf;break;case"beforeblur":case"afterblur":U=Jf;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=Kg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=UO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=e_;break;case lb:case cb:case ub:U=qO;break;case fb:U=n_;break;case"scroll":case"scrollend":U=LO;break;case"wheel":U=s_;break;case"copy":case"cut":case"paste":U=IO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Pg;break;case"toggle":case"beforetoggle":U=o_}var de=(r&4)!==0,Ke=!de&&(i==="scroll"||i==="scrollend"),k=de?L!==null?L+"Capture":null:L;de=[];for(var R=$,N;R!==null;){var I=R;if(N=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||N===null||k===null||(I=Wo(R,k),I!=null&&de.push(ja(R,I,N))),Ke)break;R=R.return}0<de.length&&(L=new U(L,me,null,a,K),H.push({event:L,listeners:de}))}}if((r&7)===0){e:{if(L=i==="mouseover"||i==="pointerover",U=i==="mouseout"||i==="pointerout",L&&a!==Pf&&(me=a.relatedTarget||a.fromElement)&&(Tr(me)||me[xr]))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=$,me=me?Tr(me):null,me!==null&&(Ke=l(me),de=me.tag,me!==Ke||de!==5&&de!==27&&de!==6)&&(me=null)):(U=null,me=$),U!==me)){if(de=Kg,I="onMouseLeave",k="onMouseEnter",R="mouse",(i==="pointerout"||i==="pointerover")&&(de=Pg,I="onPointerLeave",k="onPointerEnter",R="pointer"),Ke=U==null?L:Qo(U),N=me==null?L:Qo(me),L=new de(I,R+"leave",U,a,K),L.target=Ke,L.relatedTarget=N,I=null,Tr(K)===$&&(de=new de(k,R+"enter",me,a,K),de.target=N,de.relatedTarget=Ke,I=de),Ke=I,U&&me)t:{for(de=U,k=me,R=0,N=de;N;N=io(N))R++;for(N=0,I=k;I;I=io(I))N++;for(;0<R-N;)de=io(de),R--;for(;0<N-R;)k=io(k),N--;for(;R--;){if(de===k||k!==null&&de===k.alternate)break t;de=io(de),k=io(k)}de=null}else de=null;U!==null&&D0(H,L,U,de,!1),me!==null&&Ke!==null&&D0(H,Ke,me,de,!0)}}e:{if(L=$?Qo($):window,U=L.nodeName&&L.nodeName.toLowerCase(),U==="select"||U==="input"&&L.type==="file")var re=Zg;else if(Xg(L))if(Qg)re=y_;else{re=p_;var Ee=h_}else U=L.nodeName,!U||U.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?$&&qf($.elementType)&&(re=Zg):re=m_;if(re&&(re=re(i,$))){Jg(H,re,a,K);break e}Ee&&Ee(i,L,$),i==="focusout"&&$&&L.type==="number"&&$.memoizedProps.value!=null&&Kf(L,"number",L.value)}switch(Ee=$?Qo($):window,i){case"focusin":(Xg(Ee)||Ee.contentEditable==="true")&&(Nr=Ee,nd=$,aa=null);break;case"focusout":aa=nd=Nr=null;break;case"mousedown":id=!0;break;case"contextmenu":case"mouseup":case"dragend":id=!1,ob(H,a,K);break;case"selectionchange":if(b_)break;case"keydown":case"keyup":ob(H,a,K)}var ce;if(Qf)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 Dr?Gg(i,a)&&(he="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(he="onCompositionStart");he&&(Ig&&a.locale!=="ko"&&(Dr||he!=="onCompositionStart"?he==="onCompositionEnd"&&Dr&&(ce=Ug()):(Qi=K,Gf="value"in Qi?Qi.value:Qi.textContent,Dr=!0)),Ee=Bc($,he),0<Ee.length&&(he=new qg(he,i,null,a,K),H.push({event:he,listeners:Ee}),ce?he.data=ce:(ce=Yg(a),ce!==null&&(he.data=ce)))),(ce=l_?c_(i,a):u_(i,a))&&(he=Bc($,"onBeforeInput"),0<he.length&&(Ee=new qg("onBeforeInput","beforeinput",null,a,K),H.push({event:Ee,listeners:he}),Ee.data=ce)),ek(H,i,$,a,K)}M0(H,r)})}function ja(i,r,a){return{instance:i,listener:r,currentTarget:a}}function Bc(i,r){for(var a=r+"Capture",c=[];i!==null;){var f=i,m=f.stateNode;if(f=f.tag,f!==5&&f!==26&&f!==27||m===null||(f=Wo(i,a),f!=null&&c.unshift(ja(i,f,m)),f=Wo(i,r),f!=null&&c.push(ja(i,f,m))),i.tag===3)return c;i=i.return}return[]}function io(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function D0(i,r,a,c,f){for(var m=r._reactName,b=[];a!==null&&a!==c;){var w=a,E=w.alternate,$=w.stateNode;if(w=w.tag,E!==null&&E===c)break;w!==5&&w!==26&&w!==27||$===null||(E=$,f?($=Wo(a,m),$!=null&&b.unshift(ja(a,$,E))):f||($=Wo(a,m),$!=null&&b.push(ja(a,$,E)))),a=a.return}b.length!==0&&i.push({event:r,listeners:b})}var sk=/\r\n?/g,rk=/\u0000|\uFFFD/g;function N0(i){return(typeof i=="string"?i:""+i).replace(sk,`
|
|
61
|
-
`).replace(rk,"")}function $0(i,r){return r=N0(r),N0(i)===r}function Lc(){}function ze(i,r,a,c,f,m){switch(a){case"children":typeof c=="string"?r==="body"||r==="textarea"&&c===""||kr(i,c):(typeof c=="number"||typeof c=="bigint")&&r!=="body"&&kr(i,""+c);break;case"className":ql(i,"class",c);break;case"tabIndex":ql(i,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":ql(i,a,c);break;case"style":Bg(i,c,m);break;case"data":if(r!=="object"){ql(i,"data",c);break}case"src":case"href":if(c===""&&(r!=="a"||a!=="href")){i.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Hl(""+c),i.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="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"?(r!=="input"&&ze(i,r,"name",f.name,f,null),ze(i,r,"formEncType",f.formEncType,f,null),ze(i,r,"formMethod",f.formMethod,f,null),ze(i,r,"formTarget",f.formTarget,f,null)):(ze(i,r,"encType",f.encType,f,null),ze(i,r,"method",f.method,f,null),ze(i,r,"target",f.target,f,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Hl(""+c),i.setAttribute(a,c);break;case"onClick":c!=null&&(i.onclick=Lc);break;case"onScroll":c!=null&&Oe("scroll",i);break;case"onScrollEnd":c!=null&&Oe("scrollend",i);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(a=c.__html,a!=null){if(f.children!=null)throw Error(s(60));i.innerHTML=a}}break;case"multiple":i.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":i.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){i.removeAttribute("xlink:href");break}a=Hl(""+c),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":c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""+c):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":c&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":c===!0?i.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,c):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?i.setAttribute(a,c):i.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?i.removeAttribute(a):i.setAttribute(a,c);break;case"popover":Oe("beforetoggle",i),Oe("toggle",i),Kl(i,"popover",c);break;case"xlinkActuate":vi(i,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":vi(i,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":vi(i,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":vi(i,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":vi(i,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":vi(i,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":vi(i,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":vi(i,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":vi(i,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Kl(i,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=jO.get(a)||a,Kl(i,a,c))}}function Rh(i,r,a,c,f,m){switch(a){case"style":Bg(i,c,m);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(s(61));if(a=c.__html,a!=null){if(f.children!=null)throw Error(s(60));i.innerHTML=a}}break;case"children":typeof c=="string"?kr(i,c):(typeof c=="number"||typeof c=="bigint")&&kr(i,""+c);break;case"onScroll":c!=null&&Oe("scroll",i);break;case"onScrollEnd":c!=null&&Oe("scrollend",i);break;case"onClick":c!=null&&(i.onclick=Lc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Eg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(f=a.endsWith("Capture"),r=a.slice(2,f?a.length-7:void 0),m=i[Qt]||null,m=m!=null?m[a]:null,typeof m=="function"&&i.removeEventListener(r,m,f),typeof c=="function")){typeof m!="function"&&m!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(r,c,f);break e}a in i?i[a]=c:c===!0?i.setAttribute(a,""):Kl(i,a,c)}}}function Ut(i,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",i),Oe("load",i);var c=!1,f=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":c=!0;break;case"srcSet":f=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:ze(i,r,m,b,a,null)}}f&&ze(i,r,"srcSet",a.srcSet,a,null),c&&ze(i,r,"src",a.src,a,null);return;case"input":Oe("invalid",i);var w=m=b=f=null,E=null,$=null;for(c in a)if(a.hasOwnProperty(c)){var K=a[c];if(K!=null)switch(c){case"name":f=K;break;case"type":b=K;break;case"checked":E=K;break;case"defaultChecked":$=K;break;case"value":m=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(s(137,r));break;default:ze(i,r,c,K,a,null)}}Dg(i,m,w,E,$,b,f,!1),Pl(i);return;case"select":Oe("invalid",i),c=b=m=null;for(f in a)if(a.hasOwnProperty(f)&&(w=a[f],w!=null))switch(f){case"value":m=w;break;case"defaultValue":b=w;break;case"multiple":c=w;default:ze(i,r,f,w,a,null)}r=m,a=b,i.multiple=!!c,r!=null?_r(i,!!c,r,!1):a!=null&&_r(i,!!c,a,!0);return;case"textarea":Oe("invalid",i),m=f=c=null;for(b in a)if(a.hasOwnProperty(b)&&(w=a[b],w!=null))switch(b){case"value":c=w;break;case"defaultValue":f=w;break;case"children":m=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(s(91));break;default:ze(i,r,b,w,a,null)}$g(i,c,f,m),Pl(i);return;case"option":for(E in a)if(a.hasOwnProperty(E)&&(c=a[E],c!=null))switch(E){case"selected":i.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:ze(i,r,E,c,a,null)}return;case"dialog":Oe("beforetoggle",i),Oe("toggle",i),Oe("cancel",i),Oe("close",i);break;case"iframe":case"object":Oe("load",i);break;case"video":case"audio":for(c=0;c<$a.length;c++)Oe($a[c],i);break;case"image":Oe("error",i),Oe("load",i);break;case"details":Oe("toggle",i);break;case"embed":case"source":case"link":Oe("error",i),Oe("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($ in a)if(a.hasOwnProperty($)&&(c=a[$],c!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,r));default:ze(i,r,$,c,a,null)}return;default:if(qf(r)){for(K in a)a.hasOwnProperty(K)&&(c=a[K],c!==void 0&&Rh(i,r,K,c,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(c=a[w],c!=null&&ze(i,r,w,c,a,null))}function ok(i,r,a,c){switch(r){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,w=null,E=null,$=null,K=null;for(U in a){var H=a[U];if(a.hasOwnProperty(U)&&H!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":E=H;default:c.hasOwnProperty(U)||ze(i,r,U,null,c,H)}}for(var L in c){var U=c[L];if(H=a[L],c.hasOwnProperty(L)&&(U!=null||H!=null))switch(L){case"type":m=U;break;case"name":f=U;break;case"checked":$=U;break;case"defaultChecked":K=U;break;case"value":b=U;break;case"defaultValue":w=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(s(137,r));break;default:U!==H&&ze(i,r,L,U,c,H)}}zf(i,b,w,E,$,K,m,f);return;case"select":U=b=w=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:c.hasOwnProperty(m)||ze(i,r,m,null,c,E)}for(f in c)if(m=c[f],E=a[f],c.hasOwnProperty(f)&&(m!=null||E!=null))switch(f){case"value":L=m;break;case"defaultValue":w=m;break;case"multiple":b=m;default:m!==E&&ze(i,r,f,m,c,E)}r=w,a=b,c=U,L!=null?_r(i,!!a,L,!1):!!c!=!!a&&(r!=null?_r(i,!!a,r,!0):_r(i,!!a,a?[]:"",!1));return;case"textarea":U=L=null;for(w in a)if(f=a[w],a.hasOwnProperty(w)&&f!=null&&!c.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ze(i,r,w,null,c,f)}for(b in c)if(f=c[b],m=a[b],c.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(s(91));break;default:f!==m&&ze(i,r,b,f,c,m)}Ng(i,L,U);return;case"option":for(var me in a)if(L=a[me],a.hasOwnProperty(me)&&L!=null&&!c.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:ze(i,r,me,null,c,L)}for(E in c)if(L=c[E],U=a[E],c.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,r,E,L,c,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&&!c.hasOwnProperty(de)&&ze(i,r,de,null,c,L);for($ in c)if(L=c[$],U=a[$],c.hasOwnProperty($)&&L!==U&&(L!=null||U!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(s(137,r));break;default:ze(i,r,$,L,c,U)}return;default:if(qf(r)){for(var Ke in a)L=a[Ke],a.hasOwnProperty(Ke)&&L!==void 0&&!c.hasOwnProperty(Ke)&&Rh(i,r,Ke,void 0,c,L);for(K in c)L=c[K],U=a[K],!c.hasOwnProperty(K)||L===U||L===void 0&&U===void 0||Rh(i,r,K,L,c,U);return}}for(var k in a)L=a[k],a.hasOwnProperty(k)&&L!=null&&!c.hasOwnProperty(k)&&ze(i,r,k,null,c,L);for(H in c)L=c[H],U=a[H],!c.hasOwnProperty(H)||L===U||L==null&&U==null||ze(i,r,H,L,c,U)}var Oh=null,_h=null;function Vc(i){return i.nodeType===9?i:i.ownerDocument}function j0(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 B0(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function kh(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var Mh=null;function ak(){var i=window.event;return i&&i.type==="popstate"?i===Mh?!1:(Mh=i,!0):(Mh=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,lk=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,ck=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(i){return V0.resolve(null).then(i).catch(uk)}:L0;function uk(i){setTimeout(function(){throw i})}function ps(i){return i==="head"}function U0(i,r){var a=r,c=0,f=0;do{var m=a.nextSibling;if(i.removeChild(a),m&&m.nodeType===8)if(a=m.data,a==="/$"){if(0<c&&8>c){a=c;var b=i.ownerDocument;if(a&1&&Ba(b.documentElement),a&2&&Ba(b.body),a&4)for(a=b.head,Ba(a),b=a.firstChild;b;){var w=b.nextSibling,E=b.nodeName;b[Zo]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&b.rel.toLowerCase()==="stylesheet"||a.removeChild(b),b=w}}if(f===0){i.removeChild(m),Ia(r);return}f--}else a==="$"||a==="$?"||a==="$!"?f++:c=a.charCodeAt(0)-48;else c=0;a=m}while(a);Ia(r)}function Ch(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Ch(a),Bf(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function fk(i,r,a,c){for(;i.nodeType===1;){var f=a;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!c&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(c){if(!i[Zo])switch(r){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(r==="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=Pn(i.nextSibling),i===null)break}return null}function dk(i,r,a){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=Pn(i.nextSibling),i===null))return null;return i}function Dh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function hk(i,r){var a=i.ownerDocument;if(i.data!=="$?"||a.readyState==="complete")r();else{var c=function(){r(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),i._reactRetry=c}}function Pn(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="F!"||r==="F")break;if(r==="/$")return null}}return i}var Nh=null;function z0(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var a=i.data;if(a==="$"||a==="$!"||a==="$?"){if(r===0)return i;r--}else a==="/$"&&r++}i=i.previousSibling}return null}function K0(i,r,a){switch(r=Vc(a),i){case"html":if(i=r.documentElement,!i)throw Error(s(452));return i;case"head":if(i=r.head,!i)throw Error(s(453));return i;case"body":if(i=r.body,!i)throw Error(s(454));return i;default:throw Error(s(451))}}function Ba(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Bf(i)}var Dn=new Map,q0=new Set;function Uc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Ni=q.d;q.d={f:pk,r:mk,D:yk,C:gk,L:bk,m:vk,X:wk,S:Sk,M:xk};function pk(){var i=Ni.f(),r=Mc();return i||r}function mk(i){var r=Ar(i);r!==null&&r.tag===5&&r.type==="form"?lv(r):Ni.r(i)}var so=typeof document>"u"?null:document;function P0(i,r,a){var c=so;if(c&&typeof r=="string"&&r){var f=En(r);f='link[rel="'+i+'"][href="'+f+'"]',typeof a=="string"&&(f+='[crossorigin="'+a+'"]'),q0.has(f)||(q0.add(f),i={rel:i,crossOrigin:a,href:r},c.querySelector(f)===null&&(r=c.createElement("link"),Ut(r,"link",i),Mt(r),c.head.appendChild(r)))}}function yk(i){Ni.D(i),P0("dns-prefetch",i,null)}function gk(i,r){Ni.C(i,r),P0("preconnect",i,r)}function bk(i,r,a){Ni.L(i,r,a);var c=so;if(c&&i&&r){var f='link[rel="preload"][as="'+En(r)+'"]';r==="image"&&a&&a.imageSrcSet?(f+='[imagesrcset="'+En(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(f+='[imagesizes="'+En(a.imageSizes)+'"]')):f+='[href="'+En(i)+'"]';var m=f;switch(r){case"style":m=ro(i);break;case"script":m=oo(i)}Dn.has(m)||(i=y({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:i,as:r},a),Dn.set(m,i),c.querySelector(f)!==null||r==="style"&&c.querySelector(La(m))||r==="script"&&c.querySelector(Va(m))||(r=c.createElement("link"),Ut(r,"link",i),Mt(r),c.head.appendChild(r)))}}function vk(i,r){Ni.m(i,r);var a=so;if(a&&i){var c=r&&typeof r.as=="string"?r.as:"script",f='link[rel="modulepreload"][as="'+En(c)+'"][href="'+En(i)+'"]',m=f;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=oo(i)}if(!Dn.has(m)&&(i=y({rel:"modulepreload",href:i},r),Dn.set(m,i),a.querySelector(f)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Va(m)))return}c=a.createElement("link"),Ut(c,"link",i),Mt(c),a.head.appendChild(c)}}}function Sk(i,r,a){Ni.S(i,r,a);var c=so;if(c&&i){var f=Er(c).hoistableStyles,m=ro(i);r=r||"default";var b=f.get(m);if(!b){var w={loading:0,preload:null};if(b=c.querySelector(La(m)))w.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":r},a),(a=Dn.get(m))&&$h(i,a);var E=b=c.createElement("link");Mt(E),Ut(E,"link",i),E._p=new Promise(function($,K){E.onload=$,E.onerror=K}),E.addEventListener("load",function(){w.loading|=1}),E.addEventListener("error",function(){w.loading|=2}),w.loading|=4,zc(b,r,c)}b={type:"stylesheet",instance:b,count:1,state:w},f.set(m,b)}}}function wk(i,r){Ni.X(i,r);var a=so;if(a&&i){var c=Er(a).hoistableScripts,f=oo(i),m=c.get(f);m||(m=a.querySelector(Va(f)),m||(i=y({src:i,async:!0},r),(r=Dn.get(f))&&jh(i,r),m=a.createElement("script"),Mt(m),Ut(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(f,m))}}function xk(i,r){Ni.M(i,r);var a=so;if(a&&i){var c=Er(a).hoistableScripts,f=oo(i),m=c.get(f);m||(m=a.querySelector(Va(f)),m||(i=y({src:i,async:!0,type:"module"},r),(r=Dn.get(f))&&jh(i,r),m=a.createElement("script"),Mt(m),Ut(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(f,m))}}function I0(i,r,a,c){var f=(f=le.current)?Uc(f):null;if(!f)throw Error(s(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=ro(a.href),a=Er(f).hoistableStyles,c=a.get(r),c||(c={type:"style",instance:null,count:0,state:null},a.set(r,c)),c):{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=Er(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(La(i)))&&!m._p&&(b.instance=m,b.state.loading=5),Dn.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},Dn.set(i,a),m||Tk(f,i,a,b.state))),r&&c===null)throw Error(s(528,""));return b}if(r&&c!==null)throw Error(s(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=oo(a),a=Er(f).hoistableScripts,c=a.get(r),c||(c={type:"script",instance:null,count:0,state:null},a.set(r,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,i))}}function ro(i){return'href="'+En(i)+'"'}function La(i){return'link[rel="stylesheet"]['+i+"]"}function H0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function Tk(i,r,a,c){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?c.loading=1:(r=i.createElement("link"),c.preload=r,r.addEventListener("load",function(){return c.loading|=1}),r.addEventListener("error",function(){return c.loading|=2}),Ut(r,"link",a),Mt(r),i.head.appendChild(r))}function oo(i){return'[src="'+En(i)+'"]'}function Va(i){return"script[async]"+i}function F0(i,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var c=i.querySelector('style[data-href~="'+En(a.href)+'"]');if(c)return r.instance=c,Mt(c),c;var f=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(i.ownerDocument||i).createElement("style"),Mt(c),Ut(c,"style",f),zc(c,a.precedence,i),r.instance=c;case"stylesheet":f=ro(a.href);var m=i.querySelector(La(f));if(m)return r.state.loading|=4,r.instance=m,Mt(m),m;c=H0(a),(f=Dn.get(f))&&$h(c,f),m=(i.ownerDocument||i).createElement("link"),Mt(m);var b=m;return b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Ut(m,"link",c),r.state.loading|=4,zc(m,a.precedence,i),r.instance=m;case"script":return m=oo(a.src),(f=i.querySelector(Va(m)))?(r.instance=f,Mt(f),f):(c=a,(f=Dn.get(m))&&(c=y({},a),jh(c,f)),i=i.ownerDocument||i,f=i.createElement("script"),Mt(f),Ut(f,"link",c),i.head.appendChild(f),r.instance=f);case"void":return null;default:throw Error(s(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(c=r.instance,r.state.loading|=4,zc(c,a.precedence,i));return r.instance}function zc(i,r,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),f=c.length?c[c.length-1]:null,m=f,b=0;b<c.length;b++){var w=c[b];if(w.dataset.precedence===r)m=w;else if(m!==f)break}m?m.parentNode.insertBefore(i,m.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(i,r.firstChild))}function $h(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function jh(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Kc=null;function G0(i,r,a){if(Kc===null){var c=new Map,f=Kc=new Map;f.set(a,c)}else f=Kc,c=f.get(a),c||(c=new Map,f.set(a,c));if(c.has(i))return c;for(c.set(i,null),a=a.getElementsByTagName(i),f=0;f<a.length;f++){var m=a[f];if(!(m[Zo]||m[qt]||i==="link"&&m.getAttribute("rel")==="stylesheet")&&m.namespaceURI!=="http://www.w3.org/2000/svg"){var b=m.getAttribute(r)||"";b=i+b;var w=c.get(b);w?w.push(m):c.set(b,[m])}}return c}function Y0(i,r,a){i=i.ownerDocument||i,i.head.insertBefore(a,r==="title"?i.querySelector("head > title"):null)}function Ak(i,r,a){if(a===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;switch(r.rel){case"stylesheet":return i=r.disabled,typeof r.precedence=="string"&&i==null;default:return!0}case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function X0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var Ua=null;function Ek(){}function Rk(i,r,a){if(Ua===null)throw Error(s(475));var c=Ua;if(r.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(r.state.loading&4)===0){if(r.instance===null){var f=ro(a.href),m=i.querySelector(La(f));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(c.count++,c=qc.bind(c),i.then(c,c)),r.state.loading|=4,r.instance=m,Mt(m);return}m=i.ownerDocument||i,a=H0(a),(f=Dn.get(f))&&$h(a,f),m=m.createElement("link"),Mt(m);var b=m;b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Ut(m,"link",a),r.instance=m}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(r,i),(i=r.state.preload)&&(r.state.loading&3)===0&&(c.count++,r=qc.bind(c),i.addEventListener("load",r),i.addEventListener("error",r))}}function Ok(){if(Ua===null)throw Error(s(475));var i=Ua;return i.stylesheets&&i.count===0&&Bh(i,i.stylesheets),0<i.count?function(r){var a=setTimeout(function(){if(i.stylesheets&&Bh(i,i.stylesheets),i.unsuspend){var c=i.unsuspend;i.unsuspend=null,c()}},6e4);return i.unsuspend=r,function(){i.unsuspend=null,clearTimeout(a)}}:null}function qc(){if(this.count--,this.count===0){if(this.stylesheets)Bh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Pc=null;function Bh(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Pc=new Map,r.forEach(_k,i),Pc=null,qc.call(i))}function _k(i,r){if(!(r.state.loading&4)){var a=Pc.get(i);if(a)var c=a.get(null);else{a=new Map,Pc.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),c=b)}c&&a.set(null,c)}f=r.instance,b=f.getAttribute("data-precedence"),m=a.get(b)||c,m===c&&a.set(null,f),a.set(b,f),this.count++,c=qc.bind(this),f.addEventListener("load",c),f.addEventListener("error",c),m?m.parentNode.insertBefore(f,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(f,i.firstChild)),r.state.loading|=4}}var za={$$typeof:C,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function kk(i,r,a,c,f,m,b,w){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=Df(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Df(0),this.hiddenUpdates=Df(null),this.identifierPrefix=c,this.onUncaughtError=f,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function J0(i,r,a,c,f,m,b,w,E,$,K,H){return i=new kk(i,r,a,b,w,E,$,H),r=1,m===!0&&(r|=24),m=fn(3,null,null,r),i.current=m,m.stateNode=i,r=gd(),r.refCount++,i.pooledCache=r,r.refCount++,m.memoizedState={element:c,isDehydrated:a,cache:r},wd(m),i}function Z0(i){return i?(i=Lr,i):Lr}function Q0(i,r,a,c,f,m){f=Z0(f),c.context===null?c.context=f:c.pendingContext=f,c=ts(r),c.payload={element:a},m=m===void 0?null:m,m!==null&&(c.callback=m),a=ns(i,c,r),a!==null&&(yn(a,i,r),ya(a,i,r))}function W0(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<r?a:r}}function Lh(i,r){W0(i,r),(i=i.alternate)&&W0(i,r)}function eS(i){if(i.tag===13){var r=Br(i,67108864);r!==null&&yn(r,i,67108864),Lh(i,67108864)}}var Ic=!0;function Mk(i,r,a,c){var f=B.T;B.T=null;var m=q.p;try{q.p=2,Vh(i,r,a,c)}finally{q.p=m,B.T=f}}function Ck(i,r,a,c){var f=B.T;B.T=null;var m=q.p;try{q.p=8,Vh(i,r,a,c)}finally{q.p=m,B.T=f}}function Vh(i,r,a,c){if(Ic){var f=Uh(c);if(f===null)Eh(i,r,c,Hc,a),nS(i,c);else if(Nk(f,i,r,a,c))c.stopPropagation();else if(nS(i,c),r&4&&-1<Dk.indexOf(i)){for(;f!==null;){var m=Ar(f);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Vs(m.pendingLanes);if(b!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var E=1<<31-cn(b);w.entanglements[1]|=E,b&=~E}ii(m),(Be&6)===0&&(_c=xe()+500,Na(0))}}break;case 13:w=Br(m,2),w!==null&&yn(w,m,2),Mc(),Lh(m,2)}if(m=Uh(c),m===null&&Eh(i,r,c,Hc,a),m===f)break;f=m}f!==null&&c.stopPropagation()}else Eh(i,r,c,null,a)}}function Uh(i){return i=If(i),zh(i)}var Hc=null;function zh(i){if(Hc=null,i=Tr(i),i!==null){var r=l(i);if(r===null)i=null;else{var a=r.tag;if(a===13){if(i=u(r),i!==null)return i;i=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return Hc=i,null}function tS(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(zn()){case Gt:return 2;case Kt:return 8;case xn:case Zn:return 32;case Tn:return 268435456;default:return 32}default:return 32}}var Kh=!1,ms=null,ys=null,gs=null,Ka=new Map,qa=new Map,bs=[],Dk="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 nS(i,r){switch(i){case"focusin":case"focusout":ms=null;break;case"dragenter":case"dragleave":ys=null;break;case"mouseover":case"mouseout":gs=null;break;case"pointerover":case"pointerout":Ka.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":qa.delete(r.pointerId)}}function Pa(i,r,a,c,f,m){return i===null||i.nativeEvent!==m?(i={blockedOn:r,domEventName:a,eventSystemFlags:c,nativeEvent:m,targetContainers:[f]},r!==null&&(r=Ar(r),r!==null&&eS(r)),i):(i.eventSystemFlags|=c,r=i.targetContainers,f!==null&&r.indexOf(f)===-1&&r.push(f),i)}function Nk(i,r,a,c,f){switch(r){case"focusin":return ms=Pa(ms,i,r,a,c,f),!0;case"dragenter":return ys=Pa(ys,i,r,a,c,f),!0;case"mouseover":return gs=Pa(gs,i,r,a,c,f),!0;case"pointerover":var m=f.pointerId;return Ka.set(m,Pa(Ka.get(m)||null,i,r,a,c,f)),!0;case"gotpointercapture":return m=f.pointerId,qa.set(m,Pa(qa.get(m)||null,i,r,a,c,f)),!0}return!1}function iS(i){var r=Tr(i.target);if(r!==null){var a=l(r);if(a!==null){if(r=a.tag,r===13){if(r=u(a),r!==null){i.blockedOn=r,RO(i.priority,function(){if(a.tag===13){var c=mn();c=Nf(c);var f=Br(a,c);f!==null&&yn(f,a,c),Lh(a,c)}});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Fc(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var a=Uh(i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);Pf=c,a.target.dispatchEvent(c),Pf=null}else return r=Ar(a),r!==null&&eS(r),i.blockedOn=a,!1;r.shift()}return!0}function sS(i,r,a){Fc(i)&&a.delete(r)}function $k(){Kh=!1,ms!==null&&Fc(ms)&&(ms=null),ys!==null&&Fc(ys)&&(ys=null),gs!==null&&Fc(gs)&&(gs=null),Ka.forEach(sS),qa.forEach(sS)}function Gc(i,r){i.blockedOn===r&&(i.blockedOn=null,Kh||(Kh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,$k)))}var Yc=null;function rS(i){Yc!==i&&(Yc=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yc===i&&(Yc=null);for(var r=0;r<i.length;r+=3){var a=i[r],c=i[r+1],f=i[r+2];if(typeof c!="function"){if(zh(c||a)===null)continue;break}var m=Ar(a);m!==null&&(i.splice(r,3),r-=3,zd(m,{pending:!0,data:f,method:a.method,action:c},c,f))}}))}function Ia(i){function r(E){return Gc(E,i)}ms!==null&&Gc(ms,i),ys!==null&&Gc(ys,i),gs!==null&&Gc(gs,i),Ka.forEach(r),qa.forEach(r);for(var a=0;a<bs.length;a++){var c=bs[a];c.blockedOn===i&&(c.blockedOn=null)}for(;0<bs.length&&(a=bs[0],a.blockedOn===null);)iS(a),a.blockedOn===null&&bs.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var f=a[c],m=a[c+1],b=f[Qt]||null;if(typeof m=="function")b||rS(a);else if(b){var w=null;if(m&&m.hasAttribute("formAction")){if(f=m,b=m[Qt]||null)w=b.formAction;else if(zh(f)!==null)continue}else w=b.action;typeof w=="function"?a[c+1]=w:(a.splice(c,3),c-=3),rS(a)}}}function qh(i){this._internalRoot=i}Xc.prototype.render=qh.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(s(409));var a=r.current,c=mn();Q0(a,c,i,r,null,null)},Xc.prototype.unmount=qh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;Q0(i.current,2,null,i,null,null),Mc(),r[xr]=null}};function Xc(i){this._internalRoot=i}Xc.prototype.unstable_scheduleHydration=function(i){if(i){var r=xg();i={blockedOn:null,target:i,priority:r};for(var a=0;a<bs.length&&r!==0&&r<bs[a].priority;a++);bs.splice(a,0,i),a===0&&iS(i)}};var oS=e.version;if(oS!=="19.1.1")throw Error(s(527,oS,"19.1.1"));q.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(s(188)):(i=Object.keys(i).join(","),Error(s(268,i)));return i=h(r),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var jk={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{Yo=Jc.inject(jk),ln=Jc}catch{}}return Fa.createRoot=function(i,r){if(!o(i))throw Error(s(299));var a=!1,c="",f=xv,m=Tv,b=Av,w=null;return r!=null&&(r.unstable_strictMode===!0&&(a=!0),r.identifierPrefix!==void 0&&(c=r.identifierPrefix),r.onUncaughtError!==void 0&&(f=r.onUncaughtError),r.onCaughtError!==void 0&&(m=r.onCaughtError),r.onRecoverableError!==void 0&&(b=r.onRecoverableError),r.unstable_transitionCallbacks!==void 0&&(w=r.unstable_transitionCallbacks)),r=J0(i,1,!1,null,null,a,c,f,m,b,w,null),i[xr]=r.current,Ah(i),new qh(r)},Fa.hydrateRoot=function(i,r,a){if(!o(i))throw Error(s(299));var c=!1,f="",m=xv,b=Tv,w=Av,E=null,$=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!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&&(w=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(E=a.unstable_transitionCallbacks),a.formState!==void 0&&($=a.formState)),r=J0(i,1,!0,r,a??null,c,f,m,b,w,E,$),r.context=Z0(null),a=r.current,c=mn(),c=Nf(c),f=ts(c),f.callback=null,ns(a,f,c),a=c,r.current.lanes=a,Jo(r,a),ii(r),i[xr]=r.current,Ah(i),new Xc(r)},Fa.version="19.1.1",Fa}var wS;function tC(){if(wS)return Gh.exports;wS=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(),Gh.exports=eC(),Gh.exports}var nC=tC();function af(){return typeof window<"u"}function Bs(t){return H1(t)?(t.nodeName||"").toLowerCase():"#document"}function vn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function pi(t){var e;return(e=(H1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function H1(t){return af()?t instanceof Node||t instanceof vn(t).Node:!1}function pt(t){return af()?t instanceof Element||t instanceof vn(t).Element:!1}function _t(t){return af()?t instanceof HTMLElement||t instanceof vn(t).HTMLElement:!1}function qp(t){return!af()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof vn(t).ShadowRoot}const iC=new Set(["inline","contents"]);function wl(t){const{overflow:e,overflowX:n,overflowY:s,display:o}=Un(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!iC.has(o)}const sC=new Set(["table","td","th"]);function rC(t){return sC.has(Bs(t))}const oC=[":popover-open",":modal"];function lf(t){return oC.some(e=>{try{return t.matches(e)}catch{return!1}})}const aC=["transform","translate","scale","rotate","perspective"],lC=["transform","translate","scale","rotate","perspective","filter"],cC=["paint","layout","strict","content"];function cy(t){const e=cf(),n=pt(t)?Un(t):t;return aC.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||lC.some(s=>(n.willChange||"").includes(s))||cC.some(s=>(n.contain||"").includes(s))}function uC(t){let e=Ki(t);for(;_t(e)&&!Vi(e);){if(cy(e))return e;if(lf(e))return null;e=Ki(e)}return null}function cf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fC=new Set(["html","body","#document"]);function Vi(t){return fC.has(Bs(t))}function Un(t){return vn(t).getComputedStyle(t)}function uf(t){return pt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ki(t){if(Bs(t)==="html")return t;const e=t.assignedSlot||t.parentNode||qp(t)&&t.host||pi(t);return qp(e)?e.host:e}function F1(t){const e=Ki(t);return Vi(e)?t.ownerDocument?t.ownerDocument.body:t.body:_t(e)&&wl(e)?e:F1(e)}function Os(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=F1(t),l=o===((s=t.ownerDocument)==null?void 0:s.body),u=vn(o);if(l){const d=Pp(u);return e.concat(u,u.visualViewport||[],wl(o)?o:[],d&&n?Os(d):[])}return e.concat(o,Os(o,[],n))}function Pp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Mu=Math.min,cr=Math.max,Cu=Math.round,Qc=Math.floor,ai=t=>({x:t,y:t}),dC={left:"right",right:"left",bottom:"top",top:"bottom"},hC={start:"end",end:"start"};function xS(t,e,n){return cr(t,Mu(e,n))}function ff(t,e){return typeof t=="function"?t(e):t}function hr(t){return t.split("-")[0]}function df(t){return t.split("-")[1]}function G1(t){return t==="x"?"y":"x"}function Y1(t){return t==="y"?"height":"width"}const pC=new Set(["top","bottom"]);function As(t){return pC.has(hr(t))?"y":"x"}function X1(t){return G1(As(t))}function mC(t,e,n){n===void 0&&(n=!1);const s=df(t),o=X1(t),l=Y1(o);let u=o==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[l]>e.floating[l]&&(u=Du(u)),[u,Du(u)]}function yC(t){const e=Du(t);return[Ip(t),e,Ip(e)]}function Ip(t){return t.replace(/start|end/g,e=>hC[e])}const TS=["left","right"],AS=["right","left"],gC=["top","bottom"],bC=["bottom","top"];function vC(t,e,n){switch(t){case"top":case"bottom":return n?e?AS:TS:e?TS:AS;case"left":case"right":return e?gC:bC;default:return[]}}function SC(t,e,n,s){const o=df(t);let l=vC(hr(t),n==="start",s);return o&&(l=l.map(u=>u+"-"+o),e&&(l=l.concat(l.map(Ip)))),l}function Du(t){return t.replace(/left|right|bottom|top/g,e=>dC[e])}function wC(t){return{top:0,right:0,bottom:0,left:0,...t}}function xC(t){return typeof t!="number"?wC(t):{top:t,right:t,bottom:t,left:t}}function Nu(t){const{x:e,y:n,width:s,height:o}=t;return{width:s,height:o,top:n,left:e,right:e+s,bottom:n+o,x:e,y:n}}/*!
|
|
60
|
+
`+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 Mg(i){var s=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(s==="checkbox"||s==="radio")}function DO(i){var s=Mg(i)?"checked":"value",a=Object.getOwnPropertyDescriptor(i.constructor.prototype,s),c=""+i[s];if(!i.hasOwnProperty(s)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var d=a.get,m=a.set;return Object.defineProperty(i,s,{configurable:!0,get:function(){return d.call(this)},set:function(b){c=""+b,m.call(this,b)}}),Object.defineProperty(i,s,{enumerable:a.enumerable}),{getValue:function(){return c},setValue:function(b){c=""+b},stopTracking:function(){i._valueTracker=null,delete i[s]}}}}function Pl(i){i._valueTracker||(i._valueTracker=DO(i))}function Cg(i){if(!i)return!1;var s=i._valueTracker;if(!s)return!0;var a=s.getValue(),c="";return i&&(c=Mg(i)?i.checked?"true":"false":i.value),i=c,i!==a?(s.setValue(i),!0):!1}function Il(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 NO=/[\n"\\]/g;function Rn(i){return i.replace(NO,function(s){return"\\"+s.charCodeAt(0).toString(16)+" "})}function zf(i,s,a,c,d,m,b,w){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?Kf(i,b,En(s)):a!=null?Kf(i,b,En(a)):c!=null&&i.removeAttribute("value"),d==null&&m!=null&&(i.defaultChecked=!!m),d!=null&&(i.checked=d&&typeof d!="function"&&typeof d!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?i.name=""+En(w):i.removeAttribute("name")}function Dg(i,s,a,c,d,m,b,w){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,w||s===i.value||(i.value=s),i.defaultValue=s}c=c??d,c=typeof c!="function"&&typeof c!="symbol"&&!!c,i.checked=w?i.checked:!!c,i.defaultChecked=!!c,b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"&&(i.name=b)}function Kf(i,s,a){s==="number"&&Il(i.ownerDocument)===i||i.defaultValue===""+a||(i.defaultValue=""+a)}function _s(i,s,a,c){if(i=i.options,s){s={};for(var d=0;d<a.length;d++)s["$"+a[d]]=!0;for(a=0;a<i.length;a++)d=s.hasOwnProperty("$"+i[a].value),i[a].selected!==d&&(i[a].selected=d),d&&c&&(i[a].defaultSelected=!0)}else{for(a=""+En(a),s=null,d=0;d<i.length;d++){if(i[d].value===a){i[d].selected=!0,c&&(i[d].defaultSelected=!0);return}s!==null||i[d].disabled||(s=i[d])}s!==null&&(s.selected=!0)}}function Ng(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,c){if(s==null){if(c!=null){if(a!=null)throw Error(r(92));if(W(c)){if(1<c.length)throw Error(r(93));c=c[0]}a=c}a==null&&(a=""),s=a}a=En(s),i.defaultValue=a,c=i.textContent,c===a&&c!==""&&c!==null&&(i.value=c)}function ks(i,s){if(s){var a=i.firstChild;if(a&&a===i.lastChild&&a.nodeType===3){a.nodeValue=s;return}}i.textContent=s}var $O=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 jg(i,s,a){var c=s.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?c?i.setProperty(s,""):s==="float"?i.cssFloat="":i[s]="":c?i.setProperty(s,a):typeof a!="number"||a===0||$O.has(s)?s==="float"?i.cssFloat=a:i[s]=(""+a).trim():i[s]=a+"px"}function Bg(i,s,a){if(s!=null&&typeof s!="object")throw Error(r(62));if(i=i.style,a!=null){for(var c in a)!a.hasOwnProperty(c)||s!=null&&s.hasOwnProperty(c)||(c.indexOf("--")===0?i.setProperty(c,""):c==="float"?i.cssFloat="":i[c]="");for(var d in s)c=s[d],s.hasOwnProperty(d)&&a[d]!==c&&jg(i,d,c)}else for(var m in s)s.hasOwnProperty(m)&&jg(i,m,s[m])}function qf(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 jO=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"]]),BO=/^[\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 Hl(i){return BO.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}var Pf=null;function If(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ms=null,Cs=null;function Lg(i){var s=As(i);if(s&&(i=s.stateNode)){var a=i[Qt]||null;e:switch(i=s.stateNode,s.type){case"input":if(zf(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 c=a[s];if(c!==i&&c.form===i.form){var d=c[Qt]||null;if(!d)throw Error(r(90));zf(c,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name)}}for(s=0;s<a.length;s++)c=a[s],c.form===i.form&&Cg(c)}break e;case"textarea":Ng(i,a.value,a.defaultValue);break e;case"select":s=a.value,s!=null&&_s(i,!!a.multiple,s,!1)}}}var Hf=!1;function Vg(i,s,a){if(Hf)return i(s,a);Hf=!0;try{var c=i(s);return c}finally{if(Hf=!1,(Ms!==null||Cs!==null)&&(Mc(),Ms&&(s=Ms,i=Cs,Cs=Ms=null,Lg(s),i)))for(s=0;s<i.length;s++)Lg(i[s])}}function Wo(i,s){var a=i.stateNode;if(a===null)return null;var c=a[Qt]||null;if(c===null)return null;a=c[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":(c=!c.disabled)||(i=i.type,c=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!c;break e;default:i=!1}if(i)return null;if(a&&typeof a!="function")throw Error(r(231,s,typeof a));return a}var wi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ff=!1;if(wi)try{var ea={};Object.defineProperty(ea,"passive",{get:function(){Ff=!0}}),window.addEventListener("test",ea,ea),window.removeEventListener("test",ea,ea)}catch{Ff=!1}var Qi=null,Gf=null,Fl=null;function Ug(){if(Fl)return Fl;var i,s=Gf,a=s.length,c,d="value"in Qi?Qi.value:Qi.textContent,m=d.length;for(i=0;i<a&&s[i]===d[i];i++);var b=a-i;for(c=1;c<=b&&s[a-c]===d[m-c];c++);return Fl=d.slice(i,1<c?1-c:void 0)}function Gl(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 Yl(){return!0}function zg(){return!1}function Wt(i){function s(a,c,d,m,b){this._reactName=a,this._targetInst=d,this.type=c,this.nativeEvent=m,this.target=b,this.currentTarget=null;for(var w in i)i.hasOwnProperty(w)&&(a=i[w],this[w]=a?a(m):m[w]);return this.isDefaultPrevented=(m.defaultPrevented!=null?m.defaultPrevented:m.returnValue===!1)?Yl:zg,this.isPropagationStopped=zg,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=Yl)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Yl)},persist:function(){},isPersistent:Yl}),s}var zr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Xl=Wt(zr),ta=y({},zr,{view:0,detail:0}),LO=Wt(ta),Yf,Xf,na,Jl=y({},ta,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zf,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!==na&&(na&&i.type==="mousemove"?(Yf=i.screenX-na.screenX,Xf=i.screenY-na.screenY):Xf=Yf=0,na=i),Yf)},movementY:function(i){return"movementY"in i?i.movementY:Xf}}),Kg=Wt(Jl),VO=y({},Jl,{dataTransfer:0}),UO=Wt(VO),zO=y({},ta,{relatedTarget:0}),Jf=Wt(zO),KO=y({},zr,{animationName:0,elapsedTime:0,pseudoElement:0}),qO=Wt(KO),PO=y({},zr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),IO=Wt(PO),HO=y({},zr,{data:0}),qg=Wt(HO),FO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},GO={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"},YO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function XO(i){var s=this.nativeEvent;return s.getModifierState?s.getModifierState(i):(i=YO[i])?!!s[i]:!1}function Zf(){return XO}var JO=y({},ta,{key:function(i){if(i.key){var s=FO[i.key]||i.key;if(s!=="Unidentified")return s}return i.type==="keypress"?(i=Gl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?GO[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zf,charCode:function(i){return i.type==="keypress"?Gl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Gl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),ZO=Wt(JO),QO=y({},Jl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Pg=Wt(QO),WO=y({},ta,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zf}),e_=Wt(WO),t_=y({},zr,{propertyName:0,elapsedTime:0,pseudoElement:0}),n_=Wt(t_),i_=y({},Jl,{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}),r_=Wt(i_),s_=y({},zr,{newState:0,oldState:0}),o_=Wt(s_),a_=[9,13,27,32],Qf=wi&&"CompositionEvent"in window,ia=null;wi&&"documentMode"in document&&(ia=document.documentMode);var l_=wi&&"TextEvent"in window&&!ia,Ig=wi&&(!Qf||ia&&8<ia&&11>=ia),Hg=" ",Fg=!1;function Gg(i,s){switch(i){case"keyup":return a_.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yg(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ds=!1;function c_(i,s){switch(i){case"compositionend":return Yg(s);case"keypress":return s.which!==32?null:(Fg=!0,Hg);case"textInput":return i=s.data,i===Hg&&Fg?null:i;default:return null}}function u_(i,s){if(Ds)return i==="compositionend"||!Qf&&Gg(i,s)?(i=Ug(),Fl=Gf=Qi=null,Ds=!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 Ig&&s.locale!=="ko"?null:s.data;default:return null}}var f_={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 Xg(i){var s=i&&i.nodeName&&i.nodeName.toLowerCase();return s==="input"?!!f_[i.type]:s==="textarea"}function Jg(i,s,a,c){Ms?Cs?Cs.push(c):Cs=[c]:Ms=c,s=Bc(s,"onChange"),0<s.length&&(a=new Xl("onChange","change",null,a,c),i.push({event:a,listeners:s}))}var ra=null,sa=null;function d_(i){M0(i,0)}function Zl(i){var s=Qo(i);if(Cg(s))return i}function Zg(i,s){if(i==="change")return s}var Qg=!1;if(wi){var Wf;if(wi){var ed="oninput"in document;if(!ed){var Wg=document.createElement("div");Wg.setAttribute("oninput","return;"),ed=typeof Wg.oninput=="function"}Wf=ed}else Wf=!1;Qg=Wf&&(!document.documentMode||9<document.documentMode)}function eb(){ra&&(ra.detachEvent("onpropertychange",tb),sa=ra=null)}function tb(i){if(i.propertyName==="value"&&Zl(sa)){var s=[];Jg(s,sa,i,If(i)),Vg(d_,s)}}function h_(i,s,a){i==="focusin"?(eb(),ra=s,sa=a,ra.attachEvent("onpropertychange",tb)):i==="focusout"&&eb()}function p_(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Zl(sa)}function m_(i,s){if(i==="click")return Zl(s)}function y_(i,s){if(i==="input"||i==="change")return Zl(s)}function g_(i,s){return i===s&&(i!==0||1/i===1/s)||i!==i&&s!==s}var fn=typeof Object.is=="function"?Object.is:g_;function oa(i,s){if(fn(i,s))return!0;if(typeof i!="object"||i===null||typeof s!="object"||s===null)return!1;var a=Object.keys(i),c=Object.keys(s);if(a.length!==c.length)return!1;for(c=0;c<a.length;c++){var d=a[c];if(!we.call(s,d)||!fn(i[d],s[d]))return!1}return!0}function nb(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function ib(i,s){var a=nb(i);i=0;for(var c;a;){if(a.nodeType===3){if(c=i+a.textContent.length,i<=s&&c>=s)return{node:a,offset:s-i};i=c}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=nb(a)}}function rb(i,s){return i&&s?i===s?!0:i&&i.nodeType===3?!1:s&&s.nodeType===3?rb(i,s.parentNode):"contains"in i?i.contains(s):i.compareDocumentPosition?!!(i.compareDocumentPosition(s)&16):!1:!1}function sb(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var s=Il(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=Il(i.document)}return s}function td(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 b_=wi&&"documentMode"in document&&11>=document.documentMode,Ns=null,nd=null,aa=null,id=!1;function ob(i,s,a){var c=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;id||Ns==null||Ns!==Il(c)||(c=Ns,"selectionStart"in c&&td(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),aa&&oa(aa,c)||(aa=c,c=Bc(nd,"onSelect"),0<c.length&&(s=new Xl("onSelect","select",null,s,a),i.push({event:s,listeners:c}),s.target=Ns)))}function Kr(i,s){var a={};return a[i.toLowerCase()]=s.toLowerCase(),a["Webkit"+i]="webkit"+s,a["Moz"+i]="moz"+s,a}var $s={animationend:Kr("Animation","AnimationEnd"),animationiteration:Kr("Animation","AnimationIteration"),animationstart:Kr("Animation","AnimationStart"),transitionrun:Kr("Transition","TransitionRun"),transitionstart:Kr("Transition","TransitionStart"),transitioncancel:Kr("Transition","TransitionCancel"),transitionend:Kr("Transition","TransitionEnd")},rd={},ab={};wi&&(ab=document.createElement("div").style,"AnimationEvent"in window||(delete $s.animationend.animation,delete $s.animationiteration.animation,delete $s.animationstart.animation),"TransitionEvent"in window||delete $s.transitionend.transition);function qr(i){if(rd[i])return rd[i];if(!$s[i])return i;var s=$s[i],a;for(a in s)if(s.hasOwnProperty(a)&&a in ab)return rd[i]=s[a];return i}var lb=qr("animationend"),cb=qr("animationiteration"),ub=qr("animationstart"),v_=qr("transitionrun"),S_=qr("transitionstart"),w_=qr("transitioncancel"),fb=qr("transitionend"),db=new Map,sd="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(" ");sd.push("scrollEnd");function qn(i,s){db.set(i,s),Ur(s,[i])}var hb=new WeakMap;function On(i,s){if(typeof i=="object"&&i!==null){var a=hb.get(i);return a!==void 0?a:(s={value:i,source:s,stack:kg(s)},hb.set(i,s),s)}return{value:i,source:s,stack:kg(s)}}var _n=[],js=0,od=0;function Ql(){for(var i=js,s=od=js=0;s<i;){var a=_n[s];_n[s++]=null;var c=_n[s];_n[s++]=null;var d=_n[s];_n[s++]=null;var m=_n[s];if(_n[s++]=null,c!==null&&d!==null){var b=c.pending;b===null?d.next=d:(d.next=b.next,b.next=d),c.pending=d}m!==0&&pb(a,d,m)}}function Wl(i,s,a,c){_n[js++]=i,_n[js++]=s,_n[js++]=a,_n[js++]=c,od|=c,i.lanes|=c,i=i.alternate,i!==null&&(i.lanes|=c)}function ad(i,s,a,c){return Wl(i,s,a,c),ec(i)}function Bs(i,s){return Wl(i,null,null,s),ec(i)}function pb(i,s,a){i.lanes|=a;var c=i.alternate;c!==null&&(c.lanes|=a);for(var d=!1,m=i.return;m!==null;)m.childLanes|=a,c=m.alternate,c!==null&&(c.childLanes|=a),m.tag===22&&(i=m.stateNode,i===null||i._visibility&1||(d=!0)),i=m,m=m.return;return i.tag===3?(m=i.stateNode,d&&s!==null&&(d=31-un(a),i=m.hiddenUpdates,c=i[d],c===null?i[d]=[s]:c.push(s),s.lane=a|536870912),m):null}function ec(i){if(50<Da)throw Da=0,hh=null,Error(r(185));for(var s=i.return;s!==null;)i=s,s=i.return;return i.tag===3?i.stateNode:null}var Ls={};function x_(i,s,a,c){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=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function dn(i,s,a,c){return new x_(i,s,a,c)}function ld(i){return i=i.prototype,!(!i||!i.isReactComponent)}function xi(i,s){var a=i.alternate;return a===null?(a=dn(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 mb(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 tc(i,s,a,c,d,m){var b=0;if(c=i,typeof i=="function")ld(i)&&(b=1);else if(typeof i=="string")b=Ak(i,a,oe.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case ee:return i=dn(31,a,s,d),i.elementType=ee,i.lanes=m,i;case x:return Pr(a.children,d,m,s);case T:b=8,d|=24;break;case D:return i=dn(12,a,s,d|2),i.elementType=D,i.lanes=m,i;case _:return i=dn(13,a,s,d),i.elementType=_,i.lanes=m,i;case J:return i=dn(19,a,s,d),i.elementType=J,i.lanes=m,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case M:case C:b=10;break e;case O:b=9;break e;case j:b=11;break e;case Y:b=14;break e;case F:b=16,c=null;break e}b=29,a=Error(r(130,i===null?"null":typeof i,"")),c=null}return s=dn(b,a,s,d),s.elementType=i,s.type=c,s.lanes=m,s}function Pr(i,s,a,c){return i=dn(7,i,c,s),i.lanes=a,i}function cd(i,s,a){return i=dn(6,i,null,s),i.lanes=a,i}function ud(i,s,a){return s=dn(4,i.children!==null?i.children:[],i.key,s),s.lanes=a,s.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},s}var Vs=[],Us=0,nc=null,ic=0,kn=[],Mn=0,Ir=null,Ti=1,Ai="";function Hr(i,s){Vs[Us++]=ic,Vs[Us++]=nc,nc=i,ic=s}function yb(i,s,a){kn[Mn++]=Ti,kn[Mn++]=Ai,kn[Mn++]=Ir,Ir=i;var c=Ti;i=Ai;var d=32-un(c)-1;c&=~(1<<d),a+=1;var m=32-un(s)+d;if(30<m){var b=d-d%5;m=(c&(1<<b)-1).toString(32),c>>=b,d-=b,Ti=1<<32-un(s)+d|a<<d|c,Ai=m+i}else Ti=1<<m|a<<d|c,Ai=i}function fd(i){i.return!==null&&(Hr(i,1),yb(i,1,0))}function dd(i){for(;i===nc;)nc=Vs[--Us],Vs[Us]=null,ic=Vs[--Us],Vs[Us]=null;for(;i===Ir;)Ir=kn[--Mn],kn[Mn]=null,Ai=kn[--Mn],kn[Mn]=null,Ti=kn[--Mn],kn[Mn]=null}var Yt=null,rt=null,$e=!1,Fr=null,ei=!1,hd=Error(r(519));function Gr(i){var s=Error(r(418,""));throw ua(On(s,i)),hd}function gb(i){var s=i.stateNode,a=i.type,c=i.memoizedProps;switch(s[qt]=i,s[Qt]=c,a){case"dialog":Oe("cancel",s),Oe("close",s);break;case"iframe":case"object":case"embed":Oe("load",s);break;case"video":case"audio":for(a=0;a<$a.length;a++)Oe($a[a],s);break;case"source":Oe("error",s);break;case"img":case"image":case"link":Oe("error",s),Oe("load",s);break;case"details":Oe("toggle",s);break;case"input":Oe("invalid",s),Dg(s,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0),Pl(s);break;case"select":Oe("invalid",s);break;case"textarea":Oe("invalid",s),$g(s,c.value,c.defaultValue,c.children),Pl(s)}a=c.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||s.textContent===""+a||c.suppressHydrationWarning===!0||$0(s.textContent,a)?(c.popover!=null&&(Oe("beforetoggle",s),Oe("toggle",s)),c.onScroll!=null&&Oe("scroll",s),c.onScrollEnd!=null&&Oe("scrollend",s),c.onClick!=null&&(s.onclick=Lc),s=!0):s=!1,s||Gr(i)}function bb(i){for(Yt=i.return;Yt;)switch(Yt.tag){case 5:case 13:ei=!1;return;case 27:case 3:ei=!0;return;default:Yt=Yt.return}}function la(i){if(i!==Yt)return!1;if(!$e)return bb(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")||kh(i.type,i.memoizedProps)),a=!a),a&&rt&&Gr(i),bb(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){rt=In(i.nextSibling);break e}s--}else a!=="$"&&a!=="$!"&&a!=="$?"||s++;i=i.nextSibling}rt=null}}else s===27?(s=rt,pr(i.type)?(i=Nh,Nh=null,rt=i):rt=s):rt=Yt?In(i.stateNode.nextSibling):null;return!0}function ca(){rt=Yt=null,$e=!1}function vb(){var i=Fr;return i!==null&&(nn===null?nn=i:nn.push.apply(nn,i),Fr=null),i}function ua(i){Fr===null?Fr=[i]:Fr.push(i)}var pd=P(null),Yr=null,Ei=null;function Wi(i,s,a){X(pd,s._currentValue),s._currentValue=a}function Ri(i){i._currentValue=pd.current,te(pd)}function md(i,s,a){for(;i!==null;){var c=i.alternate;if((i.childLanes&s)!==s?(i.childLanes|=s,c!==null&&(c.childLanes|=s)):c!==null&&(c.childLanes&s)!==s&&(c.childLanes|=s),i===a)break;i=i.return}}function yd(i,s,a,c){var d=i.child;for(d!==null&&(d.return=i);d!==null;){var m=d.dependencies;if(m!==null){var b=d.child;m=m.firstContext;e:for(;m!==null;){var w=m;m=d;for(var E=0;E<s.length;E++)if(w.context===s[E]){m.lanes|=a,w=m.alternate,w!==null&&(w.lanes|=a),md(m.return,a,i),c||(b=null);break e}m=w.next}}else if(d.tag===18){if(b=d.return,b===null)throw Error(r(341));b.lanes|=a,m=b.alternate,m!==null&&(m.lanes|=a),md(b,a,i),b=null}else b=d.child;if(b!==null)b.return=d;else for(b=d;b!==null;){if(b===i){b=null;break}if(d=b.sibling,d!==null){d.return=b.return,b=d;break}b=b.return}d=b}}function fa(i,s,a,c){i=null;for(var d=s,m=!1;d!==null;){if(!m){if((d.flags&524288)!==0)m=!0;else if((d.flags&262144)!==0)break}if(d.tag===10){var b=d.alternate;if(b===null)throw Error(r(387));if(b=b.memoizedProps,b!==null){var w=d.type;fn(d.pendingProps.value,b.value)||(i!==null?i.push(w):i=[w])}}else if(d===it.current){if(b=d.alternate,b===null)throw Error(r(387));b.memoizedState.memoizedState!==d.memoizedState.memoizedState&&(i!==null?i.push(za):i=[za])}d=d.return}i!==null&&yd(s,i,a,c),s.flags|=262144}function rc(i){for(i=i.firstContext;i!==null;){if(!fn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Xr(i){Yr=i,Ei=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Pt(i){return Sb(Yr,i)}function sc(i,s){return Yr===null&&Xr(i),Sb(i,s)}function Sb(i,s){var a=s._currentValue;if(s={context:s,memoizedValue:a,next:null},Ei===null){if(i===null)throw Error(r(308));Ei=s,i.dependencies={lanes:0,firstContext:s},i.flags|=524288}else Ei=Ei.next=s;return a}var T_=typeof AbortController<"u"?AbortController:function(){var i=[],s=this.signal={aborted:!1,addEventListener:function(a,c){i.push(c)}};this.abort=function(){s.aborted=!0,i.forEach(function(a){return a()})}},A_=t.unstable_scheduleCallback,E_=t.unstable_NormalPriority,Et={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function gd(){return{controller:new T_,data:new Map,refCount:0}}function da(i){i.refCount--,i.refCount===0&&A_(E_,function(){i.controller.abort()})}var ha=null,bd=0,zs=0,Ks=null;function R_(i,s){if(ha===null){var a=ha=[];bd=0,zs=Sh(),Ks={status:"pending",value:void 0,then:function(c){a.push(c)}}}return bd++,s.then(wb,wb),s}function wb(){if(--bd===0&&ha!==null){Ks!==null&&(Ks.status="fulfilled");var i=ha;ha=null,zs=0,Ks=null;for(var s=0;s<i.length;s++)(0,i[s])()}}function O_(i,s){var a=[],c={status:"pending",value:null,reason:null,then:function(d){a.push(d)}};return i.then(function(){c.status="fulfilled",c.value=s;for(var d=0;d<a.length;d++)(0,a[d])(s)},function(d){for(c.status="rejected",c.reason=d,d=0;d<a.length;d++)(0,a[d])(void 0)}),c}var xb=B.S;B.S=function(i,s){typeof s=="object"&&s!==null&&typeof s.then=="function"&&R_(i,s),xb!==null&&xb(i,s)};var Jr=P(null);function vd(){var i=Jr.current;return i!==null?i:Fe.pooledCache}function oc(i,s){s===null?X(Jr,Jr.current):X(Jr,s.pool)}function Tb(){var i=vd();return i===null?null:{parent:Et._currentValue,pool:i}}var pa=Error(r(460)),Ab=Error(r(474)),ac=Error(r(542)),Sd={then:function(){}};function Eb(i){return i=i.status,i==="fulfilled"||i==="rejected"}function lc(){}function Rb(i,s,a){switch(a=i[a],a===void 0?i.push(s):a!==s&&(s.then(lc,lc),s=a),s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,_b(i),i;default:if(typeof s.status=="string")s.then(lc,lc);else{if(i=Fe,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=s,i.status="pending",i.then(function(c){if(s.status==="pending"){var d=s;d.status="fulfilled",d.value=c}},function(c){if(s.status==="pending"){var d=s;d.status="rejected",d.reason=c}})}switch(s.status){case"fulfilled":return s.value;case"rejected":throw i=s.reason,_b(i),i}throw ma=s,pa}}var ma=null;function Ob(){if(ma===null)throw Error(r(459));var i=ma;return ma=null,i}function _b(i){if(i===pa||i===ac)throw Error(r(483))}var er=!1;function wd(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function xd(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 tr(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function nr(i,s,a){var c=i.updateQueue;if(c===null)return null;if(c=c.shared,(Be&2)!==0){var d=c.pending;return d===null?s.next=s:(s.next=d.next,d.next=s),c.pending=s,s=ec(i),pb(i,null,a),s}return Wl(i,c,s,a),ec(i)}function ya(i,s,a){if(s=s.updateQueue,s!==null&&(s=s.shared,(a&4194048)!==0)){var c=s.lanes;c&=i.pendingLanes,a|=c,s.lanes=a,wg(i,a)}}function Td(i,s){var a=i.updateQueue,c=i.alternate;if(c!==null&&(c=c.updateQueue,a===c)){var d=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?d=m=b:m=m.next=b,a=a.next}while(a!==null);m===null?d=m=s:m=m.next=s}else d=m=s;a={baseState:c.baseState,firstBaseUpdate:d,lastBaseUpdate:m,shared:c.shared,callbacks:c.callbacks},i.updateQueue=a;return}i=a.lastBaseUpdate,i===null?a.firstBaseUpdate=s:i.next=s,a.lastBaseUpdate=s}var Ad=!1;function ga(){if(Ad){var i=Ks;if(i!==null)throw i}}function ba(i,s,a,c){Ad=!1;var d=i.updateQueue;er=!1;var m=d.firstBaseUpdate,b=d.lastBaseUpdate,w=d.shared.pending;if(w!==null){d.shared.pending=null;var E=w,$=E.next;E.next=null,b===null?m=$:b.next=$,b=E;var K=i.alternate;K!==null&&(K=K.updateQueue,w=K.lastBaseUpdate,w!==b&&(w===null?K.firstBaseUpdate=$:w.next=$,K.lastBaseUpdate=E))}if(m!==null){var H=d.baseState;b=0,K=$=E=null,w=m;do{var L=w.lane&-536870913,U=L!==w.lane;if(U?(Ce&L)===L:(c&L)===L){L!==0&&L===zs&&(Ad=!0),K!==null&&(K=K.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var me=i,de=w;L=s;var Ke=a;switch(de.tag){case 1:if(me=de.payload,typeof me=="function"){H=me.call(Ke,H,L);break e}H=me;break e;case 3:me.flags=me.flags&-65537|128;case 0:if(me=de.payload,L=typeof me=="function"?me.call(Ke,H,L):me,L==null)break e;H=y({},H,L);break e;case 2:er=!0}}L=w.callback,L!==null&&(i.flags|=64,U&&(i.flags|=8192),U=d.callbacks,U===null?d.callbacks=[L]:U.push(L))}else U={lane:L,tag:w.tag,payload:w.payload,callback:w.callback,next:null},K===null?($=K=U,E=H):K=K.next=U,b|=L;if(w=w.next,w===null){if(w=d.shared.pending,w===null)break;U=w,w=U.next,U.next=null,d.lastBaseUpdate=U,d.shared.pending=null}}while(!0);K===null&&(E=H),d.baseState=E,d.firstBaseUpdate=$,d.lastBaseUpdate=K,m===null&&(d.shared.lanes=0),ur|=b,i.lanes=b,i.memoizedState=H}}function kb(i,s){if(typeof i!="function")throw Error(r(191,i));i.call(s)}function Mb(i,s){var a=i.callbacks;if(a!==null)for(i.callbacks=null,i=0;i<a.length;i++)kb(a[i],s)}var qs=P(null),cc=P(0);function Cb(i,s){i=Ni,X(cc,i),X(qs,s),Ni=i|s.baseLanes}function Ed(){X(cc,Ni),X(qs,qs.current)}function Rd(){Ni=cc.current,te(qs),te(cc)}var ir=0,Te=null,Ue=null,yt=null,uc=!1,Ps=!1,Zr=!1,fc=0,va=0,Is=null,__=0;function ft(){throw Error(r(321))}function Od(i,s){if(s===null)return!1;for(var a=0;a<s.length&&a<i.length;a++)if(!fn(i[a],s[a]))return!1;return!0}function _d(i,s,a,c,d,m){return ir=m,Te=s,s.memoizedState=null,s.updateQueue=null,s.lanes=0,B.H=i===null||i.memoizedState===null?pv:mv,Zr=!1,m=a(c,d),Zr=!1,Ps&&(m=Nb(s,a,c,d)),Db(i),m}function Db(i){B.H=gc;var s=Ue!==null&&Ue.next!==null;if(ir=0,yt=Ue=Te=null,uc=!1,va=0,Is=null,s)throw Error(r(300));i===null||Ct||(i=i.dependencies,i!==null&&rc(i)&&(Ct=!0))}function Nb(i,s,a,c){Te=i;var d=0;do{if(Ps&&(Is=null),va=0,Ps=!1,25<=d)throw Error(r(301));if(d+=1,yt=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=j_,m=s(a,c)}while(Ps);return m}function k_(){var i=B.H,s=i.useState()[0];return s=typeof s.then=="function"?Sa(s):s,i=i.useState()[0],(Ue!==null?Ue.memoizedState:null)!==i&&(Te.flags|=1024),s}function kd(){var i=fc!==0;return fc=0,i}function Md(i,s,a){s.updateQueue=i.updateQueue,s.flags&=-2053,i.lanes&=~a}function Cd(i){if(uc){for(i=i.memoizedState;i!==null;){var s=i.queue;s!==null&&(s.pending=null),i=i.next}uc=!1}ir=0,yt=Ue=Te=null,Ps=!1,va=fc=0,Is=null}function en(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?Te.memoizedState=yt=i:yt=yt.next=i,yt}function gt(){if(Ue===null){var i=Te.alternate;i=i!==null?i.memoizedState:null}else i=Ue.next;var s=yt===null?Te.memoizedState:yt.next;if(s!==null)yt=s,Ue=i;else{if(i===null)throw Te.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},yt===null?Te.memoizedState=yt=i:yt=yt.next=i}return yt}function Dd(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sa(i){var s=va;return va+=1,Is===null&&(Is=[]),i=Rb(Is,i,s),s=Te,(yt===null?s.memoizedState:yt.next)===null&&(s=s.alternate,B.H=s===null||s.memoizedState===null?pv:mv),i}function dc(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return Sa(i);if(i.$$typeof===C)return Pt(i)}throw Error(r(438,String(i)))}function Nd(i){var s=null,a=Te.updateQueue;if(a!==null&&(s=a.memoCache),s==null){var c=Te.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(s={data:c.data.map(function(d){return d.slice()}),index:0})))}if(s==null&&(s={data:[],index:0}),a===null&&(a=Dd(),Te.updateQueue=a),a.memoCache=s,a=s.data[s.index],a===void 0)for(a=s.data[s.index]=Array(i),c=0;c<i;c++)a[c]=re;return s.index++,a}function Oi(i,s){return typeof s=="function"?s(i):s}function hc(i){var s=gt();return $d(s,Ue,i)}function $d(i,s,a){var c=i.queue;if(c===null)throw Error(r(311));c.lastRenderedReducer=a;var d=i.baseQueue,m=c.pending;if(m!==null){if(d!==null){var b=d.next;d.next=m.next,m.next=b}s.baseQueue=d=m,c.pending=null}if(m=i.baseState,d===null)i.memoizedState=m;else{s=d.next;var w=b=null,E=null,$=s,K=!1;do{var H=$.lane&-536870913;if(H!==$.lane?(Ce&H)===H:(ir&H)===H){var L=$.revertLane;if(L===0)E!==null&&(E=E.next={lane:0,revertLane:0,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null}),H===zs&&(K=!0);else if((ir&L)===L){$=$.next,L===zs&&(K=!0);continue}else H={lane:0,revertLane:$.revertLane,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},E===null?(w=E=H,b=m):E=E.next=H,Te.lanes|=L,ur|=L;H=$.action,Zr&&a(m,H),m=$.hasEagerState?$.eagerState:a(m,H)}else L={lane:H,revertLane:$.revertLane,action:$.action,hasEagerState:$.hasEagerState,eagerState:$.eagerState,next:null},E===null?(w=E=L,b=m):E=E.next=L,Te.lanes|=H,ur|=H;$=$.next}while($!==null&&$!==s);if(E===null?b=m:E.next=w,!fn(m,i.memoizedState)&&(Ct=!0,K&&(a=Ks,a!==null)))throw a;i.memoizedState=m,i.baseState=b,i.baseQueue=E,c.lastRenderedState=m}return d===null&&(c.lanes=0),[i.memoizedState,c.dispatch]}function jd(i){var s=gt(),a=s.queue;if(a===null)throw Error(r(311));a.lastRenderedReducer=i;var c=a.dispatch,d=a.pending,m=s.memoizedState;if(d!==null){a.pending=null;var b=d=d.next;do m=i(m,b.action),b=b.next;while(b!==d);fn(m,s.memoizedState)||(Ct=!0),s.memoizedState=m,s.baseQueue===null&&(s.baseState=m),a.lastRenderedState=m}return[m,c]}function $b(i,s,a){var c=Te,d=gt(),m=$e;if(m){if(a===void 0)throw Error(r(407));a=a()}else a=s();var b=!fn((Ue||d).memoizedState,a);b&&(d.memoizedState=a,Ct=!0),d=d.queue;var w=Lb.bind(null,c,d,i);if(wa(2048,8,w,[i]),d.getSnapshot!==s||b||yt!==null&&yt.memoizedState.tag&1){if(c.flags|=2048,Hs(9,pc(),Bb.bind(null,c,d,a,s),null),Fe===null)throw Error(r(349));m||(ir&124)!==0||jb(c,s,a)}return a}function jb(i,s,a){i.flags|=16384,i={getSnapshot:s,value:a},s=Te.updateQueue,s===null?(s=Dd(),Te.updateQueue=s,s.stores=[i]):(a=s.stores,a===null?s.stores=[i]:a.push(i))}function Bb(i,s,a,c){s.value=a,s.getSnapshot=c,Vb(s)&&Ub(i)}function Lb(i,s,a){return a(function(){Vb(s)&&Ub(i)})}function Vb(i){var s=i.getSnapshot;i=i.value;try{var a=s();return!fn(i,a)}catch{return!0}}function Ub(i){var s=Bs(i,2);s!==null&&gn(s,i,2)}function Bd(i){var s=en();if(typeof i=="function"){var a=i;if(i=a(),Zr){Ji(!0);try{a()}finally{Ji(!1)}}}return s.memoizedState=s.baseState=i,s.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:i},s}function zb(i,s,a,c){return i.baseState=a,$d(i,Ue,typeof c=="function"?c:Oi)}function M_(i,s,a,c,d){if(yc(i))throw Error(r(485));if(i=s.action,i!==null){var m={payload:d,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,c(m),a=s.pending,a===null?(m.next=s.pending=m,Kb(s,m)):(m.next=a.next,s.pending=a.next=m)}}function Kb(i,s){var a=s.action,c=s.payload,d=i.state;if(s.isTransition){var m=B.T,b={};B.T=b;try{var w=a(d,c),E=B.S;E!==null&&E(b,w),qb(i,s,w)}catch($){Ld(i,s,$)}finally{B.T=m}}else try{m=a(d,c),qb(i,s,m)}catch($){Ld(i,s,$)}}function qb(i,s,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(c){Pb(i,s,c)},function(c){return Ld(i,s,c)}):Pb(i,s,a)}function Pb(i,s,a){s.status="fulfilled",s.value=a,Ib(s),i.state=a,s=i.pending,s!==null&&(a=s.next,a===s?i.pending=null:(a=a.next,s.next=a,Kb(i,a)))}function Ld(i,s,a){var c=i.pending;if(i.pending=null,c!==null){c=c.next;do s.status="rejected",s.reason=a,Ib(s),s=s.next;while(s!==c)}i.action=null}function Ib(i){i=i.listeners;for(var s=0;s<i.length;s++)(0,i[s])()}function Hb(i,s){return s}function Fb(i,s){if($e){var a=Fe.formState;if(a!==null){e:{var c=Te;if($e){if(rt){t:{for(var d=rt,m=ei;d.nodeType!==8;){if(!m){d=null;break t}if(d=In(d.nextSibling),d===null){d=null;break t}}m=d.data,d=m==="F!"||m==="F"?d:null}if(d){rt=In(d.nextSibling),c=d.data==="F!";break e}}Gr(c)}c=!1}c&&(s=a[0])}}return a=en(),a.memoizedState=a.baseState=s,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hb,lastRenderedState:s},a.queue=c,a=fv.bind(null,Te,c),c.dispatch=a,c=Bd(!1),m=qd.bind(null,Te,!1,c.queue),c=en(),d={state:s,dispatch:null,action:i,pending:null},c.queue=d,a=M_.bind(null,Te,d,m,a),d.dispatch=a,c.memoizedState=i,[s,a,!1]}function Gb(i){var s=gt();return Yb(s,Ue,i)}function Yb(i,s,a){if(s=$d(i,s,Hb)[0],i=hc(Oi)[0],typeof s=="object"&&s!==null&&typeof s.then=="function")try{var c=Sa(s)}catch(b){throw b===pa?ac:b}else c=s;s=gt();var d=s.queue,m=d.dispatch;return a!==s.memoizedState&&(Te.flags|=2048,Hs(9,pc(),C_.bind(null,d,a),null)),[c,m,i]}function C_(i,s){i.action=s}function Xb(i){var s=gt(),a=Ue;if(a!==null)return Yb(s,a,i);gt(),s=s.memoizedState,a=gt();var c=a.queue.dispatch;return a.memoizedState=i,[s,c,!1]}function Hs(i,s,a,c){return i={tag:i,create:a,deps:c,inst:s,next:null},s=Te.updateQueue,s===null&&(s=Dd(),Te.updateQueue=s),a=s.lastEffect,a===null?s.lastEffect=i.next=i:(c=a.next,a.next=i,i.next=c,s.lastEffect=i),i}function pc(){return{destroy:void 0,resource:void 0}}function Jb(){return gt().memoizedState}function mc(i,s,a,c){var d=en();c=c===void 0?null:c,Te.flags|=i,d.memoizedState=Hs(1|s,pc(),a,c)}function wa(i,s,a,c){var d=gt();c=c===void 0?null:c;var m=d.memoizedState.inst;Ue!==null&&c!==null&&Od(c,Ue.memoizedState.deps)?d.memoizedState=Hs(s,m,a,c):(Te.flags|=i,d.memoizedState=Hs(1|s,m,a,c))}function Zb(i,s){mc(8390656,8,i,s)}function Qb(i,s){wa(2048,8,i,s)}function Wb(i,s){return wa(4,2,i,s)}function ev(i,s){return wa(4,4,i,s)}function tv(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 nv(i,s,a){a=a!=null?a.concat([i]):null,wa(4,4,tv.bind(null,s,i),a)}function Vd(){}function iv(i,s){var a=gt();s=s===void 0?null:s;var c=a.memoizedState;return s!==null&&Od(s,c[1])?c[0]:(a.memoizedState=[i,s],i)}function rv(i,s){var a=gt();s=s===void 0?null:s;var c=a.memoizedState;if(s!==null&&Od(s,c[1]))return c[0];if(c=i(),Zr){Ji(!0);try{i()}finally{Ji(!1)}}return a.memoizedState=[c,s],c}function Ud(i,s,a){return a===void 0||(ir&1073741824)!==0?i.memoizedState=s:(i.memoizedState=a,i=a0(),Te.lanes|=i,ur|=i,a)}function sv(i,s,a,c){return fn(a,s)?a:qs.current!==null?(i=Ud(i,a,c),fn(i,s)||(Ct=!0),i):(ir&42)===0?(Ct=!0,i.memoizedState=a):(i=a0(),Te.lanes|=i,ur|=i,s)}function ov(i,s,a,c,d){var m=q.p;q.p=m!==0&&8>m?m:8;var b=B.T,w={};B.T=w,qd(i,!1,s,a);try{var E=d(),$=B.S;if($!==null&&$(w,E),E!==null&&typeof E=="object"&&typeof E.then=="function"){var K=O_(E,c);xa(i,s,K,yn(i))}else xa(i,s,c,yn(i))}catch(H){xa(i,s,{then:function(){},status:"rejected",reason:H},yn())}finally{q.p=m,B.T=b}}function D_(){}function zd(i,s,a,c){if(i.tag!==5)throw Error(r(476));var d=av(i).queue;ov(i,d,s,z,a===null?D_:function(){return lv(i),a(c)})}function av(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:Oi,lastRenderedState:z},next:null};var a={};return s.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Oi,lastRenderedState:a},next:null},i.memoizedState=s,i=i.alternate,i!==null&&(i.memoizedState=s),s}function lv(i){var s=av(i).next.queue;xa(i,s,{},yn())}function Kd(){return Pt(za)}function cv(){return gt().memoizedState}function uv(){return gt().memoizedState}function N_(i){for(var s=i.return;s!==null;){switch(s.tag){case 24:case 3:var a=yn();i=tr(a);var c=nr(s,i,a);c!==null&&(gn(c,s,a),ya(c,s,a)),s={cache:gd()},i.payload=s;return}s=s.return}}function $_(i,s,a){var c=yn();a={lane:c,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},yc(i)?dv(s,a):(a=ad(i,s,a,c),a!==null&&(gn(a,i,c),hv(a,s,c)))}function fv(i,s,a){var c=yn();xa(i,s,a,c)}function xa(i,s,a,c){var d={lane:c,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(yc(i))dv(s,d);else{var m=i.alternate;if(i.lanes===0&&(m===null||m.lanes===0)&&(m=s.lastRenderedReducer,m!==null))try{var b=s.lastRenderedState,w=m(b,a);if(d.hasEagerState=!0,d.eagerState=w,fn(w,b))return Wl(i,s,d,0),Fe===null&&Ql(),!1}catch{}finally{}if(a=ad(i,s,d,c),a!==null)return gn(a,i,c),hv(a,s,c),!0}return!1}function qd(i,s,a,c){if(c={lane:2,revertLane:Sh(),action:c,hasEagerState:!1,eagerState:null,next:null},yc(i)){if(s)throw Error(r(479))}else s=ad(i,a,c,2),s!==null&&gn(s,i,2)}function yc(i){var s=i.alternate;return i===Te||s!==null&&s===Te}function dv(i,s){Ps=uc=!0;var a=i.pending;a===null?s.next=s:(s.next=a.next,a.next=s),i.pending=s}function hv(i,s,a){if((a&4194048)!==0){var c=s.lanes;c&=i.pendingLanes,a|=c,s.lanes=a,wg(i,a)}}var gc={readContext:Pt,use:dc,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useLayoutEffect:ft,useInsertionEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useSyncExternalStore:ft,useId:ft,useHostTransitionStatus:ft,useFormState:ft,useActionState:ft,useOptimistic:ft,useMemoCache:ft,useCacheRefresh:ft},pv={readContext:Pt,use:dc,useCallback:function(i,s){return en().memoizedState=[i,s===void 0?null:s],i},useContext:Pt,useEffect:Zb,useImperativeHandle:function(i,s,a){a=a!=null?a.concat([i]):null,mc(4194308,4,tv.bind(null,s,i),a)},useLayoutEffect:function(i,s){return mc(4194308,4,i,s)},useInsertionEffect:function(i,s){mc(4,2,i,s)},useMemo:function(i,s){var a=en();s=s===void 0?null:s;var c=i();if(Zr){Ji(!0);try{i()}finally{Ji(!1)}}return a.memoizedState=[c,s],c},useReducer:function(i,s,a){var c=en();if(a!==void 0){var d=a(s);if(Zr){Ji(!0);try{a(s)}finally{Ji(!1)}}}else d=s;return c.memoizedState=c.baseState=d,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:d},c.queue=i,i=i.dispatch=$_.bind(null,Te,i),[c.memoizedState,i]},useRef:function(i){var s=en();return i={current:i},s.memoizedState=i},useState:function(i){i=Bd(i);var s=i.queue,a=fv.bind(null,Te,s);return s.dispatch=a,[i.memoizedState,a]},useDebugValue:Vd,useDeferredValue:function(i,s){var a=en();return Ud(a,i,s)},useTransition:function(){var i=Bd(!1);return i=ov.bind(null,Te,i.queue,!0,!1),en().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,s,a){var c=Te,d=en();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||jb(c,s,a)}d.memoizedState=a;var m={value:a,getSnapshot:s};return d.queue=m,Zb(Lb.bind(null,c,m,i),[i]),c.flags|=2048,Hs(9,pc(),Bb.bind(null,c,m,a,s),null),a},useId:function(){var i=en(),s=Fe.identifierPrefix;if($e){var a=Ai,c=Ti;a=(c&~(1<<32-un(c)-1)).toString(32)+a,s="«"+s+"R"+a,a=fc++,0<a&&(s+="H"+a.toString(32)),s+="»"}else a=__++,s="«"+s+"r"+a.toString(32)+"»";return i.memoizedState=s},useHostTransitionStatus:Kd,useFormState:Fb,useActionState:Fb,useOptimistic:function(i){var s=en();s.memoizedState=s.baseState=i;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return s.queue=a,s=qd.bind(null,Te,!0,a),a.dispatch=s,[i,s]},useMemoCache:Nd,useCacheRefresh:function(){return en().memoizedState=N_.bind(null,Te)}},mv={readContext:Pt,use:dc,useCallback:iv,useContext:Pt,useEffect:Qb,useImperativeHandle:nv,useInsertionEffect:Wb,useLayoutEffect:ev,useMemo:rv,useReducer:hc,useRef:Jb,useState:function(){return hc(Oi)},useDebugValue:Vd,useDeferredValue:function(i,s){var a=gt();return sv(a,Ue.memoizedState,i,s)},useTransition:function(){var i=hc(Oi)[0],s=gt().memoizedState;return[typeof i=="boolean"?i:Sa(i),s]},useSyncExternalStore:$b,useId:cv,useHostTransitionStatus:Kd,useFormState:Gb,useActionState:Gb,useOptimistic:function(i,s){var a=gt();return zb(a,Ue,i,s)},useMemoCache:Nd,useCacheRefresh:uv},j_={readContext:Pt,use:dc,useCallback:iv,useContext:Pt,useEffect:Qb,useImperativeHandle:nv,useInsertionEffect:Wb,useLayoutEffect:ev,useMemo:rv,useReducer:jd,useRef:Jb,useState:function(){return jd(Oi)},useDebugValue:Vd,useDeferredValue:function(i,s){var a=gt();return Ue===null?Ud(a,i,s):sv(a,Ue.memoizedState,i,s)},useTransition:function(){var i=jd(Oi)[0],s=gt().memoizedState;return[typeof i=="boolean"?i:Sa(i),s]},useSyncExternalStore:$b,useId:cv,useHostTransitionStatus:Kd,useFormState:Xb,useActionState:Xb,useOptimistic:function(i,s){var a=gt();return Ue!==null?zb(a,Ue,i,s):(a.baseState=i,[i,a.queue.dispatch])},useMemoCache:Nd,useCacheRefresh:uv},Fs=null,Ta=0;function bc(i){var s=Ta;return Ta+=1,Fs===null&&(Fs=[]),Rb(Fs,i,s)}function Aa(i,s){s=s.props.ref,i.ref=s!==void 0?s:null}function vc(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 yv(i){var s=i._init;return s(i._payload)}function gv(i){function s(k,R){if(i){var N=k.deletions;N===null?(k.deletions=[R],k.flags|=16):N.push(R)}}function a(k,R){if(!i)return null;for(;R!==null;)s(k,R),R=R.sibling;return null}function c(k){for(var R=new Map;k!==null;)k.key!==null?R.set(k.key,k):R.set(k.index,k),k=k.sibling;return R}function d(k,R){return k=xi(k,R),k.index=0,k.sibling=null,k}function m(k,R,N){return k.index=N,i?(N=k.alternate,N!==null?(N=N.index,N<R?(k.flags|=67108866,R):N):(k.flags|=67108866,R)):(k.flags|=1048576,R)}function b(k){return i&&k.alternate===null&&(k.flags|=67108866),k}function w(k,R,N,I){return R===null||R.tag!==6?(R=cd(N,k.mode,I),R.return=k,R):(R=d(R,N),R.return=k,R)}function E(k,R,N,I){var se=N.type;return se===x?K(k,R,N.props.children,I,N.key):R!==null&&(R.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===F&&yv(se)===R.type)?(R=d(R,N.props),Aa(R,N),R.return=k,R):(R=tc(N.type,N.key,N.props,null,k.mode,I),Aa(R,N),R.return=k,R)}function $(k,R,N,I){return R===null||R.tag!==4||R.stateNode.containerInfo!==N.containerInfo||R.stateNode.implementation!==N.implementation?(R=ud(N,k.mode,I),R.return=k,R):(R=d(R,N.children||[]),R.return=k,R)}function K(k,R,N,I,se){return R===null||R.tag!==7?(R=Pr(N,k.mode,I,se),R.return=k,R):(R=d(R,N),R.return=k,R)}function H(k,R,N){if(typeof R=="string"&&R!==""||typeof R=="number"||typeof R=="bigint")return R=cd(""+R,k.mode,N),R.return=k,R;if(typeof R=="object"&&R!==null){switch(R.$$typeof){case v:return N=tc(R.type,R.key,R.props,null,k.mode,N),Aa(N,R),N.return=k,N;case S:return R=ud(R,k.mode,N),R.return=k,R;case F:var I=R._init;return R=I(R._payload),H(k,R,N)}if(W(R)||ge(R))return R=Pr(R,k.mode,N,null),R.return=k,R;if(typeof R.then=="function")return H(k,bc(R),N);if(R.$$typeof===C)return H(k,sc(k,R),N);vc(k,R)}return null}function L(k,R,N,I){var se=R!==null?R.key:null;if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return se!==null?null:w(k,R,""+N,I);if(typeof N=="object"&&N!==null){switch(N.$$typeof){case v:return N.key===se?E(k,R,N,I):null;case S:return N.key===se?$(k,R,N,I):null;case F:return se=N._init,N=se(N._payload),L(k,R,N,I)}if(W(N)||ge(N))return se!==null?null:K(k,R,N,I,null);if(typeof N.then=="function")return L(k,R,bc(N),I);if(N.$$typeof===C)return L(k,R,sc(k,N),I);vc(k,N)}return null}function U(k,R,N,I,se){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return k=k.get(N)||null,w(R,k,""+I,se);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case v:return k=k.get(I.key===null?N:I.key)||null,E(R,k,I,se);case S:return k=k.get(I.key===null?N:I.key)||null,$(R,k,I,se);case F:var Ee=I._init;return I=Ee(I._payload),U(k,R,N,I,se)}if(W(I)||ge(I))return k=k.get(N)||null,K(R,k,I,se,null);if(typeof I.then=="function")return U(k,R,N,bc(I),se);if(I.$$typeof===C)return U(k,R,N,sc(R,I),se);vc(R,I)}return null}function me(k,R,N,I){for(var se=null,Ee=null,ce=R,he=R=0,Nt=null;ce!==null&&he<N.length;he++){ce.index>he?(Nt=ce,ce=null):Nt=ce.sibling;var Ne=L(k,ce,N[he],I);if(Ne===null){ce===null&&(ce=Nt);break}i&&ce&&Ne.alternate===null&&s(k,ce),R=m(Ne,R,he),Ee===null?se=Ne:Ee.sibling=Ne,Ee=Ne,ce=Nt}if(he===N.length)return a(k,ce),$e&&Hr(k,he),se;if(ce===null){for(;he<N.length;he++)ce=H(k,N[he],I),ce!==null&&(R=m(ce,R,he),Ee===null?se=ce:Ee.sibling=ce,Ee=ce);return $e&&Hr(k,he),se}for(ce=c(ce);he<N.length;he++)Nt=U(ce,k,he,N[he],I),Nt!==null&&(i&&Nt.alternate!==null&&ce.delete(Nt.key===null?he:Nt.key),R=m(Nt,R,he),Ee===null?se=Nt:Ee.sibling=Nt,Ee=Nt);return i&&ce.forEach(function(vr){return s(k,vr)}),$e&&Hr(k,he),se}function de(k,R,N,I){if(N==null)throw Error(r(151));for(var se=null,Ee=null,ce=R,he=R=0,Nt=null,Ne=N.next();ce!==null&&!Ne.done;he++,Ne=N.next()){ce.index>he?(Nt=ce,ce=null):Nt=ce.sibling;var vr=L(k,ce,Ne.value,I);if(vr===null){ce===null&&(ce=Nt);break}i&&ce&&vr.alternate===null&&s(k,ce),R=m(vr,R,he),Ee===null?se=vr:Ee.sibling=vr,Ee=vr,ce=Nt}if(Ne.done)return a(k,ce),$e&&Hr(k,he),se;if(ce===null){for(;!Ne.done;he++,Ne=N.next())Ne=H(k,Ne.value,I),Ne!==null&&(R=m(Ne,R,he),Ee===null?se=Ne:Ee.sibling=Ne,Ee=Ne);return $e&&Hr(k,he),se}for(ce=c(ce);!Ne.done;he++,Ne=N.next())Ne=U(ce,k,he,Ne.value,I),Ne!==null&&(i&&Ne.alternate!==null&&ce.delete(Ne.key===null?he:Ne.key),R=m(Ne,R,he),Ee===null?se=Ne:Ee.sibling=Ne,Ee=Ne);return i&&ce.forEach(function(Bk){return s(k,Bk)}),$e&&Hr(k,he),se}function Ke(k,R,N,I){if(typeof N=="object"&&N!==null&&N.type===x&&N.key===null&&(N=N.props.children),typeof N=="object"&&N!==null){switch(N.$$typeof){case v:e:{for(var se=N.key;R!==null;){if(R.key===se){if(se=N.type,se===x){if(R.tag===7){a(k,R.sibling),I=d(R,N.props.children),I.return=k,k=I;break e}}else if(R.elementType===se||typeof se=="object"&&se!==null&&se.$$typeof===F&&yv(se)===R.type){a(k,R.sibling),I=d(R,N.props),Aa(I,N),I.return=k,k=I;break e}a(k,R);break}else s(k,R);R=R.sibling}N.type===x?(I=Pr(N.props.children,k.mode,I,N.key),I.return=k,k=I):(I=tc(N.type,N.key,N.props,null,k.mode,I),Aa(I,N),I.return=k,k=I)}return b(k);case S:e:{for(se=N.key;R!==null;){if(R.key===se)if(R.tag===4&&R.stateNode.containerInfo===N.containerInfo&&R.stateNode.implementation===N.implementation){a(k,R.sibling),I=d(R,N.children||[]),I.return=k,k=I;break e}else{a(k,R);break}else s(k,R);R=R.sibling}I=ud(N,k.mode,I),I.return=k,k=I}return b(k);case F:return se=N._init,N=se(N._payload),Ke(k,R,N,I)}if(W(N))return me(k,R,N,I);if(ge(N)){if(se=ge(N),typeof se!="function")throw Error(r(150));return N=se.call(N),de(k,R,N,I)}if(typeof N.then=="function")return Ke(k,R,bc(N),I);if(N.$$typeof===C)return Ke(k,R,sc(k,N),I);vc(k,N)}return typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint"?(N=""+N,R!==null&&R.tag===6?(a(k,R.sibling),I=d(R,N),I.return=k,k=I):(a(k,R),I=cd(N,k.mode,I),I.return=k,k=I),b(k)):a(k,R)}return function(k,R,N,I){try{Ta=0;var se=Ke(k,R,N,I);return Fs=null,se}catch(ce){if(ce===pa||ce===ac)throw ce;var Ee=dn(29,ce,null,k.mode);return Ee.lanes=I,Ee.return=k,Ee}finally{}}}var Gs=gv(!0),bv=gv(!1),Cn=P(null),ti=null;function rr(i){var s=i.alternate;X(Rt,Rt.current&1),X(Cn,i),ti===null&&(s===null||qs.current!==null||s.memoizedState!==null)&&(ti=i)}function vv(i){if(i.tag===22){if(X(Rt,Rt.current),X(Cn,i),ti===null){var s=i.alternate;s!==null&&s.memoizedState!==null&&(ti=i)}}else sr()}function sr(){X(Rt,Rt.current),X(Cn,Cn.current)}function _i(i){te(Cn),ti===i&&(ti=null),te(Rt)}var Rt=P(0);function Sc(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==="$?"||Dh(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 Pd(i,s,a,c){s=i.memoizedState,a=a(c,s),a=a==null?s:y({},s,a),i.memoizedState=a,i.lanes===0&&(i.updateQueue.baseState=a)}var Id={enqueueSetState:function(i,s,a){i=i._reactInternals;var c=yn(),d=tr(c);d.payload=s,a!=null&&(d.callback=a),s=nr(i,d,c),s!==null&&(gn(s,i,c),ya(s,i,c))},enqueueReplaceState:function(i,s,a){i=i._reactInternals;var c=yn(),d=tr(c);d.tag=1,d.payload=s,a!=null&&(d.callback=a),s=nr(i,d,c),s!==null&&(gn(s,i,c),ya(s,i,c))},enqueueForceUpdate:function(i,s){i=i._reactInternals;var a=yn(),c=tr(a);c.tag=2,s!=null&&(c.callback=s),s=nr(i,c,a),s!==null&&(gn(s,i,a),ya(s,i,a))}};function Sv(i,s,a,c,d,m,b){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(c,m,b):s.prototype&&s.prototype.isPureReactComponent?!oa(a,c)||!oa(d,m):!0}function wv(i,s,a,c){i=s.state,typeof s.componentWillReceiveProps=="function"&&s.componentWillReceiveProps(a,c),typeof s.UNSAFE_componentWillReceiveProps=="function"&&s.UNSAFE_componentWillReceiveProps(a,c),s.state!==i&&Id.enqueueReplaceState(s,s.state,null)}function Qr(i,s){var a=s;if("ref"in s){a={};for(var c in s)c!=="ref"&&(a[c]=s[c])}if(i=i.defaultProps){a===s&&(a=y({},a));for(var d in i)a[d]===void 0&&(a[d]=i[d])}return a}var wc=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 xv(i){wc(i)}function Tv(i){console.error(i)}function Av(i){wc(i)}function xc(i,s){try{var a=i.onUncaughtError;a(s.value,{componentStack:s.stack})}catch(c){setTimeout(function(){throw c})}}function Ev(i,s,a){try{var c=i.onCaughtError;c(a.value,{componentStack:a.stack,errorBoundary:s.tag===1?s.stateNode:null})}catch(d){setTimeout(function(){throw d})}}function Hd(i,s,a){return a=tr(a),a.tag=3,a.payload={element:null},a.callback=function(){xc(i,s)},a}function Rv(i){return i=tr(i),i.tag=3,i}function Ov(i,s,a,c){var d=a.type.getDerivedStateFromError;if(typeof d=="function"){var m=c.value;i.payload=function(){return d(m)},i.callback=function(){Ev(s,a,c)}}var b=a.stateNode;b!==null&&typeof b.componentDidCatch=="function"&&(i.callback=function(){Ev(s,a,c),typeof d!="function"&&(fr===null?fr=new Set([this]):fr.add(this));var w=c.stack;this.componentDidCatch(c.value,{componentStack:w!==null?w:""})})}function B_(i,s,a,c,d){if(a.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(s=a.alternate,s!==null&&fa(s,a,d,!0),a=Cn.current,a!==null){switch(a.tag){case 13:return ti===null?mh():a.alternate===null&&st===0&&(st=3),a.flags&=-257,a.flags|=65536,a.lanes=d,c===Sd?a.flags|=16384:(s=a.updateQueue,s===null?a.updateQueue=new Set([c]):s.add(c),gh(i,c,d)),!1;case 22:return a.flags|=65536,c===Sd?a.flags|=16384:(s=a.updateQueue,s===null?(s={transitions:null,markerInstances:null,retryQueue:new Set([c])},a.updateQueue=s):(a=s.retryQueue,a===null?s.retryQueue=new Set([c]):a.add(c)),gh(i,c,d)),!1}throw Error(r(435,a.tag))}return gh(i,c,d),mh(),!1}if($e)return s=Cn.current,s!==null?((s.flags&65536)===0&&(s.flags|=256),s.flags|=65536,s.lanes=d,c!==hd&&(i=Error(r(422),{cause:c}),ua(On(i,a)))):(c!==hd&&(s=Error(r(423),{cause:c}),ua(On(s,a))),i=i.current.alternate,i.flags|=65536,d&=-d,i.lanes|=d,c=On(c,a),d=Hd(i.stateNode,c,d),Td(i,d),st!==4&&(st=2)),!1;var m=Error(r(520),{cause:c});if(m=On(m,a),Ca===null?Ca=[m]:Ca.push(m),st!==4&&(st=2),s===null)return!0;c=On(c,a),a=s;do{switch(a.tag){case 3:return a.flags|=65536,i=d&-d,a.lanes|=i,i=Hd(a.stateNode,c,i),Td(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"&&(fr===null||!fr.has(m))))return a.flags|=65536,d&=-d,a.lanes|=d,d=Rv(d),Ov(d,i,a,c),Td(a,d),!1}a=a.return}while(a!==null);return!1}var _v=Error(r(461)),Ct=!1;function Lt(i,s,a,c){s.child=i===null?bv(s,null,a,c):Gs(s,i.child,a,c)}function kv(i,s,a,c,d){a=a.render;var m=s.ref;if("ref"in c){var b={};for(var w in c)w!=="ref"&&(b[w]=c[w])}else b=c;return Xr(s),c=_d(i,s,a,b,m,d),w=kd(),i!==null&&!Ct?(Md(i,s,d),ki(i,s,d)):($e&&w&&fd(s),s.flags|=1,Lt(i,s,c,d),s.child)}function Mv(i,s,a,c,d){if(i===null){var m=a.type;return typeof m=="function"&&!ld(m)&&m.defaultProps===void 0&&a.compare===null?(s.tag=15,s.type=m,Cv(i,s,m,c,d)):(i=tc(a.type,null,c,s,s.mode,d),i.ref=s.ref,i.return=s,s.child=i)}if(m=i.child,!Wd(i,d)){var b=m.memoizedProps;if(a=a.compare,a=a!==null?a:oa,a(b,c)&&i.ref===s.ref)return ki(i,s,d)}return s.flags|=1,i=xi(m,c),i.ref=s.ref,i.return=s,s.child=i}function Cv(i,s,a,c,d){if(i!==null){var m=i.memoizedProps;if(oa(m,c)&&i.ref===s.ref)if(Ct=!1,s.pendingProps=c=m,Wd(i,d))(i.flags&131072)!==0&&(Ct=!0);else return s.lanes=i.lanes,ki(i,s,d)}return Fd(i,s,a,c,d)}function Dv(i,s,a){var c=s.pendingProps,d=c.children,m=i!==null?i.memoizedState:null;if(c.mode==="hidden"){if((s.flags&128)!==0){if(c=m!==null?m.baseLanes|a:a,i!==null){for(d=s.child=i.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;s.childLanes=m&~c}else s.childLanes=0,s.child=null;return Nv(i,s,c,a)}if((a&536870912)!==0)s.memoizedState={baseLanes:0,cachePool:null},i!==null&&oc(s,m!==null?m.cachePool:null),m!==null?Cb(s,m):Ed(),vv(s);else return s.lanes=s.childLanes=536870912,Nv(i,s,m!==null?m.baseLanes|a:a,a)}else m!==null?(oc(s,m.cachePool),Cb(s,m),sr(),s.memoizedState=null):(i!==null&&oc(s,null),Ed(),sr());return Lt(i,s,d,a),s.child}function Nv(i,s,a,c){var d=vd();return d=d===null?null:{parent:Et._currentValue,pool:d},s.memoizedState={baseLanes:a,cachePool:d},i!==null&&oc(s,null),Ed(),vv(s),i!==null&&fa(i,s,c,!0),null}function Tc(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 Fd(i,s,a,c,d){return Xr(s),a=_d(i,s,a,c,void 0,d),c=kd(),i!==null&&!Ct?(Md(i,s,d),ki(i,s,d)):($e&&c&&fd(s),s.flags|=1,Lt(i,s,a,d),s.child)}function $v(i,s,a,c,d,m){return Xr(s),s.updateQueue=null,a=Nb(s,c,a,d),Db(i),c=kd(),i!==null&&!Ct?(Md(i,s,m),ki(i,s,m)):($e&&c&&fd(s),s.flags|=1,Lt(i,s,a,m),s.child)}function jv(i,s,a,c,d){if(Xr(s),s.stateNode===null){var m=Ls,b=a.contextType;typeof b=="object"&&b!==null&&(m=Pt(b)),m=new a(c,m),s.memoizedState=m.state!==null&&m.state!==void 0?m.state:null,m.updater=Id,s.stateNode=m,m._reactInternals=s,m=s.stateNode,m.props=c,m.state=s.memoizedState,m.refs={},wd(s),b=a.contextType,m.context=typeof b=="object"&&b!==null?Pt(b):Ls,m.state=s.memoizedState,b=a.getDerivedStateFromProps,typeof b=="function"&&(Pd(s,a,b,c),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&&Id.enqueueReplaceState(m,m.state,null),ba(s,c,m,d),ga(),m.state=s.memoizedState),typeof m.componentDidMount=="function"&&(s.flags|=4194308),c=!0}else if(i===null){m=s.stateNode;var w=s.memoizedProps,E=Qr(a,w);m.props=E;var $=m.context,K=a.contextType;b=Ls,typeof K=="object"&&K!==null&&(b=Pt(K));var H=a.getDerivedStateFromProps;K=typeof H=="function"||typeof m.getSnapshotBeforeUpdate=="function",w=s.pendingProps!==w,K||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(w||$!==b)&&wv(s,m,c,b),er=!1;var L=s.memoizedState;m.state=L,ba(s,c,m,d),ga(),$=s.memoizedState,w||L!==$||er?(typeof H=="function"&&(Pd(s,a,H,c),$=s.memoizedState),(E=er||Sv(s,a,E,c,L,$,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=c,s.memoizedState=$),m.props=c,m.state=$,m.context=b,c=E):(typeof m.componentDidMount=="function"&&(s.flags|=4194308),c=!1)}else{m=s.stateNode,xd(i,s),b=s.memoizedProps,K=Qr(a,b),m.props=K,H=s.pendingProps,L=m.context,$=a.contextType,E=Ls,typeof $=="object"&&$!==null&&(E=Pt($)),w=a.getDerivedStateFromProps,($=typeof w=="function"||typeof m.getSnapshotBeforeUpdate=="function")||typeof m.UNSAFE_componentWillReceiveProps!="function"&&typeof m.componentWillReceiveProps!="function"||(b!==H||L!==E)&&wv(s,m,c,E),er=!1,L=s.memoizedState,m.state=L,ba(s,c,m,d),ga();var U=s.memoizedState;b!==H||L!==U||er||i!==null&&i.dependencies!==null&&rc(i.dependencies)?(typeof w=="function"&&(Pd(s,a,w,c),U=s.memoizedState),(K=er||Sv(s,a,K,c,L,U,E)||i!==null&&i.dependencies!==null&&rc(i.dependencies))?($||typeof m.UNSAFE_componentWillUpdate!="function"&&typeof m.componentWillUpdate!="function"||(typeof m.componentWillUpdate=="function"&&m.componentWillUpdate(c,U,E),typeof m.UNSAFE_componentWillUpdate=="function"&&m.UNSAFE_componentWillUpdate(c,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=c,s.memoizedState=U),m.props=c,m.state=U,m.context=E,c=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),c=!1)}return m=c,Tc(i,s),c=(s.flags&128)!==0,m||c?(m=s.stateNode,a=c&&typeof a.getDerivedStateFromError!="function"?null:m.render(),s.flags|=1,i!==null&&c?(s.child=Gs(s,i.child,null,d),s.child=Gs(s,null,a,d)):Lt(i,s,a,d),s.memoizedState=m.state,i=s.child):i=ki(i,s,d),i}function Bv(i,s,a,c){return ca(),s.flags|=256,Lt(i,s,a,c),s.child}var Gd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Yd(i){return{baseLanes:i,cachePool:Tb()}}function Xd(i,s,a){return i=i!==null?i.childLanes&~a:0,s&&(i|=Dn),i}function Lv(i,s,a){var c=s.pendingProps,d=!1,m=(s.flags&128)!==0,b;if((b=m)||(b=i!==null&&i.memoizedState===null?!1:(Rt.current&2)!==0),b&&(d=!0,s.flags&=-129),b=(s.flags&32)!==0,s.flags&=-33,i===null){if($e){if(d?rr(s):sr(),$e){var w=rt,E;if(E=w){e:{for(E=w,w=ei;E.nodeType!==8;){if(!w){w=null;break e}if(E=In(E.nextSibling),E===null){w=null;break e}}w=E}w!==null?(s.memoizedState={dehydrated:w,treeContext:Ir!==null?{id:Ti,overflow:Ai}:null,retryLane:536870912,hydrationErrors:null},E=dn(18,null,null,0),E.stateNode=w,E.return=s,s.child=E,Yt=s,rt=null,E=!0):E=!1}E||Gr(s)}if(w=s.memoizedState,w!==null&&(w=w.dehydrated,w!==null))return Dh(w)?s.lanes=32:s.lanes=536870912,null;_i(s)}return w=c.children,c=c.fallback,d?(sr(),d=s.mode,w=Ac({mode:"hidden",children:w},d),c=Pr(c,d,a,null),w.return=s,c.return=s,w.sibling=c,s.child=w,d=s.child,d.memoizedState=Yd(a),d.childLanes=Xd(i,b,a),s.memoizedState=Gd,c):(rr(s),Jd(s,w))}if(E=i.memoizedState,E!==null&&(w=E.dehydrated,w!==null)){if(m)s.flags&256?(rr(s),s.flags&=-257,s=Zd(i,s,a)):s.memoizedState!==null?(sr(),s.child=i.child,s.flags|=128,s=null):(sr(),d=c.fallback,w=s.mode,c=Ac({mode:"visible",children:c.children},w),d=Pr(d,w,a,null),d.flags|=2,c.return=s,d.return=s,c.sibling=d,s.child=c,Gs(s,i.child,null,a),c=s.child,c.memoizedState=Yd(a),c.childLanes=Xd(i,b,a),s.memoizedState=Gd,s=d);else if(rr(s),Dh(w)){if(b=w.nextSibling&&w.nextSibling.dataset,b)var $=b.dgst;b=$,c=Error(r(419)),c.stack="",c.digest=b,ua({value:c,source:null,stack:null}),s=Zd(i,s,a)}else if(Ct||fa(i,s,a,!1),b=(a&i.childLanes)!==0,Ct||b){if(b=Fe,b!==null&&(c=a&-a,c=(c&42)!==0?1:Nf(c),c=(c&(b.suspendedLanes|a))!==0?0:c,c!==0&&c!==E.retryLane))throw E.retryLane=c,Bs(i,c),gn(b,i,c),_v;w.data==="$?"||mh(),s=Zd(i,s,a)}else w.data==="$?"?(s.flags|=192,s.child=i.child,s=null):(i=E.treeContext,rt=In(w.nextSibling),Yt=s,$e=!0,Fr=null,ei=!1,i!==null&&(kn[Mn++]=Ti,kn[Mn++]=Ai,kn[Mn++]=Ir,Ti=i.id,Ai=i.overflow,Ir=s),s=Jd(s,c.children),s.flags|=4096);return s}return d?(sr(),d=c.fallback,w=s.mode,E=i.child,$=E.sibling,c=xi(E,{mode:"hidden",children:c.children}),c.subtreeFlags=E.subtreeFlags&65011712,$!==null?d=xi($,d):(d=Pr(d,w,a,null),d.flags|=2),d.return=s,c.return=s,c.sibling=d,s.child=c,c=d,d=s.child,w=i.child.memoizedState,w===null?w=Yd(a):(E=w.cachePool,E!==null?($=Et._currentValue,E=E.parent!==$?{parent:$,pool:$}:E):E=Tb(),w={baseLanes:w.baseLanes|a,cachePool:E}),d.memoizedState=w,d.childLanes=Xd(i,b,a),s.memoizedState=Gd,c):(rr(s),a=i.child,i=a.sibling,a=xi(a,{mode:"visible",children:c.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 Jd(i,s){return s=Ac({mode:"visible",children:s},i.mode),s.return=i,i.child=s}function Ac(i,s){return i=dn(22,i,null,s),i.lanes=0,i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},i}function Zd(i,s,a){return Gs(s,i.child,null,a),i=Jd(s,s.pendingProps.children),i.flags|=2,s.memoizedState=null,i}function Vv(i,s,a){i.lanes|=s;var c=i.alternate;c!==null&&(c.lanes|=s),md(i.return,s,a)}function Qd(i,s,a,c,d){var m=i.memoizedState;m===null?i.memoizedState={isBackwards:s,rendering:null,renderingStartTime:0,last:c,tail:a,tailMode:d}:(m.isBackwards=s,m.rendering=null,m.renderingStartTime=0,m.last=c,m.tail=a,m.tailMode=d)}function Uv(i,s,a){var c=s.pendingProps,d=c.revealOrder,m=c.tail;if(Lt(i,s,c.children,a),c=Rt.current,(c&2)!==0)c=c&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&&Vv(i,a,s);else if(i.tag===19)Vv(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}c&=1}switch(X(Rt,c),d){case"forwards":for(a=s.child,d=null;a!==null;)i=a.alternate,i!==null&&Sc(i)===null&&(d=a),a=a.sibling;a=d,a===null?(d=s.child,s.child=null):(d=a.sibling,a.sibling=null),Qd(s,!1,d,a,m);break;case"backwards":for(a=null,d=s.child,s.child=null;d!==null;){if(i=d.alternate,i!==null&&Sc(i)===null){s.child=d;break}i=d.sibling,d.sibling=a,a=d,d=i}Qd(s,!0,a,null,m);break;case"together":Qd(s,!1,null,null,void 0);break;default:s.memoizedState=null}return s.child}function ki(i,s,a){if(i!==null&&(s.dependencies=i.dependencies),ur|=s.lanes,(a&s.childLanes)===0)if(i!==null){if(fa(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=xi(i,i.pendingProps),s.child=a,a.return=s;i.sibling!==null;)i=i.sibling,a=a.sibling=xi(i,i.pendingProps),a.return=s;a.sibling=null}return s.child}function Wd(i,s){return(i.lanes&s)!==0?!0:(i=i.dependencies,!!(i!==null&&rc(i)))}function L_(i,s,a){switch(s.tag){case 3:Ve(s,s.stateNode.containerInfo),Wi(s,Et,i.memoizedState.cache),ca();break;case 27:case 5:Xi(s);break;case 4:Ve(s,s.stateNode.containerInfo);break;case 10:Wi(s,s.type,s.memoizedProps.value);break;case 13:var c=s.memoizedState;if(c!==null)return c.dehydrated!==null?(rr(s),s.flags|=128,null):(a&s.child.childLanes)!==0?Lv(i,s,a):(rr(s),i=ki(i,s,a),i!==null?i.sibling:null);rr(s);break;case 19:var d=(i.flags&128)!==0;if(c=(a&s.childLanes)!==0,c||(fa(i,s,a,!1),c=(a&s.childLanes)!==0),d){if(c)return Uv(i,s,a);s.flags|=128}if(d=s.memoizedState,d!==null&&(d.rendering=null,d.tail=null,d.lastEffect=null),X(Rt,Rt.current),c)break;return null;case 22:case 23:return s.lanes=0,Dv(i,s,a);case 24:Wi(s,Et,i.memoizedState.cache)}return ki(i,s,a)}function zv(i,s,a){if(i!==null)if(i.memoizedProps!==s.pendingProps)Ct=!0;else{if(!Wd(i,a)&&(s.flags&128)===0)return Ct=!1,L_(i,s,a);Ct=(i.flags&131072)!==0}else Ct=!1,$e&&(s.flags&1048576)!==0&&yb(s,ic,s.index);switch(s.lanes=0,s.tag){case 16:e:{i=s.pendingProps;var c=s.elementType,d=c._init;if(c=d(c._payload),s.type=c,typeof c=="function")ld(c)?(i=Qr(c,i),s.tag=1,s=jv(null,s,c,i,a)):(s.tag=0,s=Fd(null,s,c,i,a));else{if(c!=null){if(d=c.$$typeof,d===j){s.tag=11,s=kv(null,s,c,i,a);break e}else if(d===Y){s.tag=14,s=Mv(null,s,c,i,a);break e}}throw s=Q(c)||c,Error(r(306,s,""))}}return s;case 0:return Fd(i,s,s.type,s.pendingProps,a);case 1:return c=s.type,d=Qr(c,s.pendingProps),jv(i,s,c,d,a);case 3:e:{if(Ve(s,s.stateNode.containerInfo),i===null)throw Error(r(387));c=s.pendingProps;var m=s.memoizedState;d=m.element,xd(i,s),ba(s,c,null,a);var b=s.memoizedState;if(c=b.cache,Wi(s,Et,c),c!==m.cache&&yd(s,[Et],a,!0),ga(),c=b.element,m.isDehydrated)if(m={element:c,isDehydrated:!1,cache:b.cache},s.updateQueue.baseState=m,s.memoizedState=m,s.flags&256){s=Bv(i,s,c,a);break e}else if(c!==d){d=On(Error(r(424)),s),ua(d),s=Bv(i,s,c,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(rt=In(i.firstChild),Yt=s,$e=!0,Fr=null,ei=!0,a=bv(s,null,c,a),s.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(ca(),c===d){s=ki(i,s,a);break e}Lt(i,s,c,a)}s=s.child}return s;case 26:return Tc(i,s),i===null?(a=I0(s.type,null,s.pendingProps,null))?s.memoizedState=a:$e||(a=s.type,i=s.pendingProps,c=Vc(le.current).createElement(a),c[qt]=s,c[Qt]=i,Ut(c,a,i),Mt(c),s.stateNode=c):s.memoizedState=I0(s.type,i.memoizedProps,s.pendingProps,i.memoizedState),null;case 27:return Xi(s),i===null&&$e&&(c=s.stateNode=K0(s.type,s.pendingProps,le.current),Yt=s,ei=!0,d=rt,pr(s.type)?(Nh=d,rt=In(c.firstChild)):rt=d),Lt(i,s,s.pendingProps.children,a),Tc(i,s),i===null&&(s.flags|=4194304),s.child;case 5:return i===null&&$e&&((d=c=rt)&&(c=fk(c,s.type,s.pendingProps,ei),c!==null?(s.stateNode=c,Yt=s,rt=In(c.firstChild),ei=!1,d=!0):d=!1),d||Gr(s)),Xi(s),d=s.type,m=s.pendingProps,b=i!==null?i.memoizedProps:null,c=m.children,kh(d,m)?c=null:b!==null&&kh(d,b)&&(s.flags|=32),s.memoizedState!==null&&(d=_d(i,s,k_,null,null,a),za._currentValue=d),Tc(i,s),Lt(i,s,c,a),s.child;case 6:return i===null&&$e&&((i=a=rt)&&(a=dk(a,s.pendingProps,ei),a!==null?(s.stateNode=a,Yt=s,rt=null,i=!0):i=!1),i||Gr(s)),null;case 13:return Lv(i,s,a);case 4:return Ve(s,s.stateNode.containerInfo),c=s.pendingProps,i===null?s.child=Gs(s,null,c,a):Lt(i,s,c,a),s.child;case 11:return kv(i,s,s.type,s.pendingProps,a);case 7:return Lt(i,s,s.pendingProps,a),s.child;case 8:return Lt(i,s,s.pendingProps.children,a),s.child;case 12:return Lt(i,s,s.pendingProps.children,a),s.child;case 10:return c=s.pendingProps,Wi(s,s.type,c.value),Lt(i,s,c.children,a),s.child;case 9:return d=s.type._context,c=s.pendingProps.children,Xr(s),d=Pt(d),c=c(d),s.flags|=1,Lt(i,s,c,a),s.child;case 14:return Mv(i,s,s.type,s.pendingProps,a);case 15:return Cv(i,s,s.type,s.pendingProps,a);case 19:return Uv(i,s,a);case 31:return c=s.pendingProps,a=s.mode,c={mode:c.mode,children:c.children},i===null?(a=Ac(c,a),a.ref=s.ref,s.child=a,a.return=s,s=a):(a=xi(i.child,c),a.ref=s.ref,s.child=a,a.return=s,s=a),s;case 22:return Dv(i,s,a);case 24:return Xr(s),c=Pt(Et),i===null?(d=vd(),d===null&&(d=Fe,m=gd(),d.pooledCache=m,m.refCount++,m!==null&&(d.pooledCacheLanes|=a),d=m),s.memoizedState={parent:c,cache:d},wd(s),Wi(s,Et,d)):((i.lanes&a)!==0&&(xd(i,s),ba(s,null,null,a),ga()),d=i.memoizedState,m=s.memoizedState,d.parent!==c?(d={parent:c,cache:c},s.memoizedState=d,s.lanes===0&&(s.memoizedState=s.updateQueue.baseState=d),Wi(s,Et,c)):(c=m.cache,Wi(s,Et,c),c!==d.cache&&yd(s,[Et],a,!0))),Lt(i,s,s.pendingProps.children,a),s.child;case 29:throw s.pendingProps}throw Error(r(156,s.tag))}function Mi(i){i.flags|=4}function Kv(i,s){if(s.type!=="stylesheet"||(s.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!X0(s)){if(s=Cn.current,s!==null&&((Ce&4194048)===Ce?ti!==null:(Ce&62914560)!==Ce&&(Ce&536870912)===0||s!==ti))throw ma=Sd,Ab;i.flags|=8192}}function Ec(i,s){s!==null&&(i.flags|=4),i.flags&16384&&(s=i.tag!==22?vg():536870912,i.lanes|=s,Zs|=s)}function Ea(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 c=null;a!==null;)a.alternate!==null&&(c=a),a=a.sibling;c===null?s||i.tail===null?i.tail=null:i.tail.sibling=null:c.sibling=null}}function tt(i){var s=i.alternate!==null&&i.alternate.child===i.child,a=0,c=0;if(s)for(var d=i.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags&65011712,c|=d.flags&65011712,d.return=i,d=d.sibling;else for(d=i.child;d!==null;)a|=d.lanes|d.childLanes,c|=d.subtreeFlags,c|=d.flags,d.return=i,d=d.sibling;return i.subtreeFlags|=c,i.childLanes=a,s}function V_(i,s,a){var c=s.pendingProps;switch(dd(s),s.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return tt(s),null;case 1:return tt(s),null;case 3:return a=s.stateNode,c=null,i!==null&&(c=i.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),Ri(Et),xn(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(i===null||i.child===null)&&(la(s)?Mi(s):i===null||i.memoizedState.isDehydrated&&(s.flags&256)===0||(s.flags|=1024,vb())),tt(s),null;case 26:return a=s.memoizedState,i===null?(Mi(s),a!==null?(tt(s),Kv(s,a)):(tt(s),s.flags&=-16777217)):a?a!==i.memoizedState?(Mi(s),tt(s),Kv(s,a)):(tt(s),s.flags&=-16777217):(i.memoizedProps!==c&&Mi(s),tt(s),s.flags&=-16777217),null;case 27:vi(s),a=le.current;var d=s.type;if(i!==null&&s.stateNode!=null)i.memoizedProps!==c&&Mi(s);else{if(!c){if(s.stateNode===null)throw Error(r(166));return tt(s),null}i=oe.current,la(s)?gb(s):(i=K0(d,c,a),s.stateNode=i,Mi(s))}return tt(s),null;case 5:if(vi(s),a=s.type,i!==null&&s.stateNode!=null)i.memoizedProps!==c&&Mi(s);else{if(!c){if(s.stateNode===null)throw Error(r(166));return tt(s),null}if(i=oe.current,la(s))gb(s);else{switch(d=Vc(le.current),i){case 1:i=d.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:i=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":i=d.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":i=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":i=d.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof c.is=="string"?d.createElement("select",{is:c.is}):d.createElement("select"),c.multiple?i.multiple=!0:c.size&&(i.size=c.size);break;default:i=typeof c.is=="string"?d.createElement(a,{is:c.is}):d.createElement(a)}}i[qt]=s,i[Qt]=c;e:for(d=s.child;d!==null;){if(d.tag===5||d.tag===6)i.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===s)break e;for(;d.sibling===null;){if(d.return===null||d.return===s)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}s.stateNode=i;e:switch(Ut(i,a,c),a){case"button":case"input":case"select":case"textarea":i=!!c.autoFocus;break e;case"img":i=!0;break e;default:i=!1}i&&Mi(s)}}return tt(s),s.flags&=-16777217,null;case 6:if(i&&s.stateNode!=null)i.memoizedProps!==c&&Mi(s);else{if(typeof c!="string"&&s.stateNode===null)throw Error(r(166));if(i=le.current,la(s)){if(i=s.stateNode,a=s.memoizedProps,c=null,d=Yt,d!==null)switch(d.tag){case 27:case 5:c=d.memoizedProps}i[qt]=s,i=!!(i.nodeValue===a||c!==null&&c.suppressHydrationWarning===!0||$0(i.nodeValue,a)),i||Gr(s)}else i=Vc(i).createTextNode(c),i[qt]=s,s.stateNode=i}return tt(s),null;case 13:if(c=s.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(d=la(s),c!==null&&c.dehydrated!==null){if(i===null){if(!d)throw Error(r(318));if(d=s.memoizedState,d=d!==null?d.dehydrated:null,!d)throw Error(r(317));d[qt]=s}else ca(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;tt(s),d=!1}else d=vb(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=d),d=!0;if(!d)return s.flags&256?(_i(s),s):(_i(s),null)}if(_i(s),(s.flags&128)!==0)return s.lanes=a,s;if(a=c!==null,i=i!==null&&i.memoizedState!==null,a){c=s.child,d=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(d=c.alternate.memoizedState.cachePool.pool);var m=null;c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(m=c.memoizedState.cachePool.pool),m!==d&&(c.flags|=2048)}return a!==i&&a&&(s.child.flags|=8192),Ec(s,s.updateQueue),tt(s),null;case 4:return xn(),i===null&&Ah(s.stateNode.containerInfo),tt(s),null;case 10:return Ri(s.type),tt(s),null;case 19:if(te(Rt),d=s.memoizedState,d===null)return tt(s),null;if(c=(s.flags&128)!==0,m=d.rendering,m===null)if(c)Ea(d,!1);else{if(st!==0||i!==null&&(i.flags&128)!==0)for(i=s.child;i!==null;){if(m=Sc(i),m!==null){for(s.flags|=128,Ea(d,!1),i=m.updateQueue,s.updateQueue=i,Ec(s,i),s.subtreeFlags=0,i=a,a=s.child;a!==null;)mb(a,i),a=a.sibling;return X(Rt,Rt.current&1|2),s.child}i=i.sibling}d.tail!==null&&xe()>_c&&(s.flags|=128,c=!0,Ea(d,!1),s.lanes=4194304)}else{if(!c)if(i=Sc(m),i!==null){if(s.flags|=128,c=!0,i=i.updateQueue,s.updateQueue=i,Ec(s,i),Ea(d,!0),d.tail===null&&d.tailMode==="hidden"&&!m.alternate&&!$e)return tt(s),null}else 2*xe()-d.renderingStartTime>_c&&a!==536870912&&(s.flags|=128,c=!0,Ea(d,!1),s.lanes=4194304);d.isBackwards?(m.sibling=s.child,s.child=m):(i=d.last,i!==null?i.sibling=m:s.child=m,d.last=m)}return d.tail!==null?(s=d.tail,d.rendering=s,d.tail=s.sibling,d.renderingStartTime=xe(),s.sibling=null,i=Rt.current,X(Rt,c?i&1|2:i&1),s):(tt(s),null);case 22:case 23:return _i(s),Rd(),c=s.memoizedState!==null,i!==null?i.memoizedState!==null!==c&&(s.flags|=8192):c&&(s.flags|=8192),c?(a&536870912)!==0&&(s.flags&128)===0&&(tt(s),s.subtreeFlags&6&&(s.flags|=8192)):tt(s),a=s.updateQueue,a!==null&&Ec(s,a.retryQueue),a=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(a=i.memoizedState.cachePool.pool),c=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),c!==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),Ri(Et),tt(s),null;case 25:return null;case 30:return null}throw Error(r(156,s.tag))}function U_(i,s){switch(dd(s),s.tag){case 1:return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 3:return Ri(Et),xn(),i=s.flags,(i&65536)!==0&&(i&128)===0?(s.flags=i&-65537|128,s):null;case 26:case 27:case 5:return vi(s),null;case 13:if(_i(s),i=s.memoizedState,i!==null&&i.dehydrated!==null){if(s.alternate===null)throw Error(r(340));ca()}return i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 19:return te(Rt),null;case 4:return xn(),null;case 10:return Ri(s.type),null;case 22:case 23:return _i(s),Rd(),i!==null&&te(Jr),i=s.flags,i&65536?(s.flags=i&-65537|128,s):null;case 24:return Ri(Et),null;case 25:return null;default:return null}}function qv(i,s){switch(dd(s),s.tag){case 3:Ri(Et),xn();break;case 26:case 27:case 5:vi(s);break;case 4:xn();break;case 13:_i(s);break;case 19:te(Rt);break;case 10:Ri(s.type);break;case 22:case 23:_i(s),Rd(),i!==null&&te(Jr);break;case 24:Ri(Et)}}function Ra(i,s){try{var a=s.updateQueue,c=a!==null?a.lastEffect:null;if(c!==null){var d=c.next;a=d;do{if((a.tag&i)===i){c=void 0;var m=a.create,b=a.inst;c=m(),b.destroy=c}a=a.next}while(a!==d)}}catch(w){Pe(s,s.return,w)}}function or(i,s,a){try{var c=s.updateQueue,d=c!==null?c.lastEffect:null;if(d!==null){var m=d.next;c=m;do{if((c.tag&i)===i){var b=c.inst,w=b.destroy;if(w!==void 0){b.destroy=void 0,d=s;var E=a,$=w;try{$()}catch(K){Pe(d,E,K)}}}c=c.next}while(c!==m)}}catch(K){Pe(s,s.return,K)}}function Pv(i){var s=i.updateQueue;if(s!==null){var a=i.stateNode;try{Mb(s,a)}catch(c){Pe(i,i.return,c)}}}function Iv(i,s,a){a.props=Qr(i.type,i.memoizedProps),a.state=i.memoizedState;try{a.componentWillUnmount()}catch(c){Pe(i,s,c)}}function Oa(i,s){try{var a=i.ref;if(a!==null){switch(i.tag){case 26:case 27:case 5:var c=i.stateNode;break;case 30:c=i.stateNode;break;default:c=i.stateNode}typeof a=="function"?i.refCleanup=a(c):a.current=c}}catch(d){Pe(i,s,d)}}function ni(i,s){var a=i.ref,c=i.refCleanup;if(a!==null)if(typeof c=="function")try{c()}catch(d){Pe(i,s,d)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(d){Pe(i,s,d)}else a.current=null}function Hv(i){var s=i.type,a=i.memoizedProps,c=i.stateNode;try{e:switch(s){case"button":case"input":case"select":case"textarea":a.autoFocus&&c.focus();break e;case"img":a.src?c.src=a.src:a.srcSet&&(c.srcset=a.srcSet)}}catch(d){Pe(i,i.return,d)}}function eh(i,s,a){try{var c=i.stateNode;ok(c,i.type,a,s),c[Qt]=s}catch(d){Pe(i,i.return,d)}}function Fv(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&pr(i.type)||i.tag===4}function th(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Fv(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&&pr(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 nh(i,s,a){var c=i.tag;if(c===5||c===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=Lc));else if(c!==4&&(c===27&&pr(i.type)&&(a=i.stateNode,s=null),i=i.child,i!==null))for(nh(i,s,a),i=i.sibling;i!==null;)nh(i,s,a),i=i.sibling}function Rc(i,s,a){var c=i.tag;if(c===5||c===6)i=i.stateNode,s?a.insertBefore(i,s):a.appendChild(i);else if(c!==4&&(c===27&&pr(i.type)&&(a=i.stateNode),i=i.child,i!==null))for(Rc(i,s,a),i=i.sibling;i!==null;)Rc(i,s,a),i=i.sibling}function Gv(i){var s=i.stateNode,a=i.memoizedProps;try{for(var c=i.type,d=s.attributes;d.length;)s.removeAttributeNode(d[0]);Ut(s,c,a),s[qt]=i,s[Qt]=a}catch(m){Pe(i,i.return,m)}}var Ci=!1,dt=!1,ih=!1,Yv=typeof WeakSet=="function"?WeakSet:Set,Dt=null;function z_(i,s){if(i=i.containerInfo,Oh=Ic,i=sb(i),td(i)){if("selectionStart"in i)var a={start:i.selectionStart,end:i.selectionEnd};else e:{a=(a=i.ownerDocument)&&a.defaultView||window;var c=a.getSelection&&a.getSelection();if(c&&c.rangeCount!==0){a=c.anchorNode;var d=c.anchorOffset,m=c.focusNode;c=c.focusOffset;try{a.nodeType,m.nodeType}catch{a=null;break e}var b=0,w=-1,E=-1,$=0,K=0,H=i,L=null;t:for(;;){for(var U;H!==a||d!==0&&H.nodeType!==3||(w=b+d),H!==m||c!==0&&H.nodeType!==3||(E=b+c),H.nodeType===3&&(b+=H.nodeValue.length),(U=H.firstChild)!==null;)L=H,H=U;for(;;){if(H===i)break t;if(L===a&&++$===d&&(w=b),L===m&&++K===c&&(E=b),(U=H.nextSibling)!==null)break;H=L,L=H.parentNode}H=U}a=w===-1||E===-1?null:{start:w,end:E}}else a=null}a=a||{start:0,end:0}}else a=null;for(_h={focusedElem:i,selectionRange:a},Ic=!1,Dt=s;Dt!==null;)if(s=Dt,i=s.child,(s.subtreeFlags&1024)!==0&&i!==null)i.return=s,Dt=i;else for(;Dt!==null;){switch(s=Dt,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,d=m.memoizedProps,m=m.memoizedState,c=a.stateNode;try{var me=Qr(a.type,d,a.elementType===a.type);i=c.getSnapshotBeforeUpdate(me,m),c.__reactInternalSnapshotBeforeUpdate=i}catch(de){Pe(a,a.return,de)}}break;case 3:if((i&1024)!==0){if(i=s.stateNode.containerInfo,a=i.nodeType,a===9)Ch(i);else if(a===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":Ch(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,Dt=i;break}Dt=s.return}}function Xv(i,s,a){var c=a.flags;switch(a.tag){case 0:case 11:case 15:ar(i,a),c&4&&Ra(5,a);break;case 1:if(ar(i,a),c&4)if(i=a.stateNode,s===null)try{i.componentDidMount()}catch(b){Pe(a,a.return,b)}else{var d=Qr(a.type,s.memoizedProps);s=s.memoizedState;try{i.componentDidUpdate(d,s,i.__reactInternalSnapshotBeforeUpdate)}catch(b){Pe(a,a.return,b)}}c&64&&Pv(a),c&512&&Oa(a,a.return);break;case 3:if(ar(i,a),c&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{Mb(i,s)}catch(b){Pe(a,a.return,b)}}break;case 27:s===null&&c&4&&Gv(a);case 26:case 5:ar(i,a),s===null&&c&4&&Hv(a),c&512&&Oa(a,a.return);break;case 12:ar(i,a);break;case 13:ar(i,a),c&4&&Qv(i,a),c&64&&(i=a.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(a=X_.bind(null,a),hk(i,a))));break;case 22:if(c=a.memoizedState!==null||Ci,!c){s=s!==null&&s.memoizedState!==null||dt,d=Ci;var m=dt;Ci=c,(dt=s)&&!m?lr(i,a,(a.subtreeFlags&8772)!==0):ar(i,a),Ci=d,dt=m}break;case 30:break;default:ar(i,a)}}function Jv(i){var s=i.alternate;s!==null&&(i.alternate=null,Jv(s)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(s=i.stateNode,s!==null&&Bf(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 Je=null,tn=!1;function Di(i,s,a){for(a=a.child;a!==null;)Zv(i,s,a),a=a.sibling}function Zv(i,s,a){if(cn&&typeof cn.onCommitFiberUnmount=="function")try{cn.onCommitFiberUnmount(Yo,a)}catch{}switch(a.tag){case 26:dt||ni(a,s),Di(i,s,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:dt||ni(a,s);var c=Je,d=tn;pr(a.type)&&(Je=a.stateNode,tn=!1),Di(i,s,a),Ba(a.stateNode),Je=c,tn=d;break;case 5:dt||ni(a,s);case 6:if(c=Je,d=tn,Je=null,Di(i,s,a),Je=c,tn=d,Je!==null)if(tn)try{(Je.nodeType===9?Je.body:Je.nodeName==="HTML"?Je.ownerDocument.body:Je).removeChild(a.stateNode)}catch(m){Pe(a,s,m)}else try{Je.removeChild(a.stateNode)}catch(m){Pe(a,s,m)}break;case 18:Je!==null&&(tn?(i=Je,U0(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,a.stateNode),Ia(i)):U0(Je,a.stateNode));break;case 4:c=Je,d=tn,Je=a.stateNode.containerInfo,tn=!0,Di(i,s,a),Je=c,tn=d;break;case 0:case 11:case 14:case 15:dt||or(2,a,s),dt||or(4,a,s),Di(i,s,a);break;case 1:dt||(ni(a,s),c=a.stateNode,typeof c.componentWillUnmount=="function"&&Iv(a,s,c)),Di(i,s,a);break;case 21:Di(i,s,a);break;case 22:dt=(c=dt)||a.memoizedState!==null,Di(i,s,a),dt=c;break;default:Di(i,s,a)}}function Qv(i,s){if(s.memoizedState===null&&(i=s.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Ia(i)}catch(a){Pe(s,s.return,a)}}function K_(i){switch(i.tag){case 13:case 19:var s=i.stateNode;return s===null&&(s=i.stateNode=new Yv),s;case 22:return i=i.stateNode,s=i._retryCache,s===null&&(s=i._retryCache=new Yv),s;default:throw Error(r(435,i.tag))}}function rh(i,s){var a=K_(i);s.forEach(function(c){var d=J_.bind(null,i,c);a.has(c)||(a.add(c),c.then(d,d))})}function hn(i,s){var a=s.deletions;if(a!==null)for(var c=0;c<a.length;c++){var d=a[c],m=i,b=s,w=b;e:for(;w!==null;){switch(w.tag){case 27:if(pr(w.type)){Je=w.stateNode,tn=!1;break e}break;case 5:Je=w.stateNode,tn=!1;break e;case 3:case 4:Je=w.stateNode.containerInfo,tn=!0;break e}w=w.return}if(Je===null)throw Error(r(160));Zv(m,b,d),Je=null,tn=!1,m=d.alternate,m!==null&&(m.return=null),d.return=null}if(s.subtreeFlags&13878)for(s=s.child;s!==null;)Wv(s,i),s=s.sibling}var Pn=null;function Wv(i,s){var a=i.alternate,c=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:hn(s,i),pn(i),c&4&&(or(3,i,i.return),Ra(3,i),or(5,i,i.return));break;case 1:hn(s,i),pn(i),c&512&&(dt||a===null||ni(a,a.return)),c&64&&Ci&&(i=i.updateQueue,i!==null&&(c=i.callbacks,c!==null&&(a=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=a===null?c:a.concat(c))));break;case 26:var d=Pn;if(hn(s,i),pn(i),c&512&&(dt||a===null||ni(a,a.return)),c&4){var m=a!==null?a.memoizedState:null;if(c=i.memoizedState,a===null)if(c===null)if(i.stateNode===null){e:{c=i.type,a=i.memoizedProps,d=d.ownerDocument||d;t:switch(c){case"title":m=d.getElementsByTagName("title")[0],(!m||m[Zo]||m[qt]||m.namespaceURI==="http://www.w3.org/2000/svg"||m.hasAttribute("itemprop"))&&(m=d.createElement(c),d.head.insertBefore(m,d.querySelector("head > title"))),Ut(m,c,a),m[qt]=i,Mt(m),c=m;break e;case"link":var b=G0("link","href",d).get(c+(a.href||""));if(b){for(var w=0;w<b.length;w++)if(m=b[w],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(w,1);break t}}m=d.createElement(c),Ut(m,c,a),d.head.appendChild(m);break;case"meta":if(b=G0("meta","content",d).get(c+(a.content||""))){for(w=0;w<b.length;w++)if(m=b[w],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(w,1);break t}}m=d.createElement(c),Ut(m,c,a),d.head.appendChild(m);break;default:throw Error(r(468,c))}m[qt]=i,Mt(m),c=m}i.stateNode=c}else Y0(d,i.type,i.stateNode);else i.stateNode=F0(d,c,i.memoizedProps);else m!==c?(m===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):m.count--,c===null?Y0(d,i.type,i.stateNode):F0(d,c,i.memoizedProps)):c===null&&i.stateNode!==null&&eh(i,i.memoizedProps,a.memoizedProps)}break;case 27:hn(s,i),pn(i),c&512&&(dt||a===null||ni(a,a.return)),a!==null&&c&4&&eh(i,i.memoizedProps,a.memoizedProps);break;case 5:if(hn(s,i),pn(i),c&512&&(dt||a===null||ni(a,a.return)),i.flags&32){d=i.stateNode;try{ks(d,"")}catch(U){Pe(i,i.return,U)}}c&4&&i.stateNode!=null&&(d=i.memoizedProps,eh(i,d,a!==null?a.memoizedProps:d)),c&1024&&(ih=!0);break;case 6:if(hn(s,i),pn(i),c&4){if(i.stateNode===null)throw Error(r(162));c=i.memoizedProps,a=i.stateNode;try{a.nodeValue=c}catch(U){Pe(i,i.return,U)}}break;case 3:if(Kc=null,d=Pn,Pn=Uc(s.containerInfo),hn(s,i),Pn=d,pn(i),c&4&&a!==null&&a.memoizedState.isDehydrated)try{Ia(s.containerInfo)}catch(U){Pe(i,i.return,U)}ih&&(ih=!1,e0(i));break;case 4:c=Pn,Pn=Uc(i.stateNode.containerInfo),hn(s,i),pn(i),Pn=c;break;case 12:hn(s,i),pn(i);break;case 13:hn(s,i),pn(i),i.child.flags&8192&&i.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(uh=xe()),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,rh(i,c)));break;case 22:d=i.memoizedState!==null;var E=a!==null&&a.memoizedState!==null,$=Ci,K=dt;if(Ci=$||d,dt=K||E,hn(s,i),dt=K,Ci=$,pn(i),c&8192)e:for(s=i.stateNode,s._visibility=d?s._visibility&-2:s._visibility|1,d&&(a===null||E||Ci||dt||Wr(i)),a=null,s=i;;){if(s.tag===5||s.tag===26){if(a===null){E=a=s;try{if(m=E.stateNode,d)b=m.style,typeof b.setProperty=="function"?b.setProperty("display","none","important"):b.display="none";else{w=E.stateNode;var H=E.memoizedProps.style,L=H!=null&&H.hasOwnProperty("display")?H.display:null;w.style.display=L==null||typeof L=="boolean"?"":(""+L).trim()}}catch(U){Pe(E,E.return,U)}}}else if(s.tag===6){if(a===null){E=s;try{E.stateNode.nodeValue=d?"":E.memoizedProps}catch(U){Pe(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}c&4&&(c=i.updateQueue,c!==null&&(a=c.retryQueue,a!==null&&(c.retryQueue=null,rh(i,a))));break;case 19:hn(s,i),pn(i),c&4&&(c=i.updateQueue,c!==null&&(i.updateQueue=null,rh(i,c)));break;case 30:break;case 21:break;default:hn(s,i),pn(i)}}function pn(i){var s=i.flags;if(s&2){try{for(var a,c=i.return;c!==null;){if(Fv(c)){a=c;break}c=c.return}if(a==null)throw Error(r(160));switch(a.tag){case 27:var d=a.stateNode,m=th(i);Rc(i,m,d);break;case 5:var b=a.stateNode;a.flags&32&&(ks(b,""),a.flags&=-33);var w=th(i);Rc(i,w,b);break;case 3:case 4:var E=a.stateNode.containerInfo,$=th(i);nh(i,$,E);break;default:throw Error(r(161))}}catch(K){Pe(i,i.return,K)}i.flags&=-3}s&4096&&(i.flags&=-4097)}function e0(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var s=i;e0(s),s.tag===5&&s.flags&1024&&s.stateNode.reset(),i=i.sibling}}function ar(i,s){if(s.subtreeFlags&8772)for(s=s.child;s!==null;)Xv(i,s.alternate,s),s=s.sibling}function Wr(i){for(i=i.child;i!==null;){var s=i;switch(s.tag){case 0:case 11:case 14:case 15:or(4,s,s.return),Wr(s);break;case 1:ni(s,s.return);var a=s.stateNode;typeof a.componentWillUnmount=="function"&&Iv(s,s.return,a),Wr(s);break;case 27:Ba(s.stateNode);case 26:case 5:ni(s,s.return),Wr(s);break;case 22:s.memoizedState===null&&Wr(s);break;case 30:Wr(s);break;default:Wr(s)}i=i.sibling}}function lr(i,s,a){for(a=a&&(s.subtreeFlags&8772)!==0,s=s.child;s!==null;){var c=s.alternate,d=i,m=s,b=m.flags;switch(m.tag){case 0:case 11:case 15:lr(d,m,a),Ra(4,m);break;case 1:if(lr(d,m,a),c=m,d=c.stateNode,typeof d.componentDidMount=="function")try{d.componentDidMount()}catch($){Pe(c,c.return,$)}if(c=m,d=c.updateQueue,d!==null){var w=c.stateNode;try{var E=d.shared.hiddenCallbacks;if(E!==null)for(d.shared.hiddenCallbacks=null,d=0;d<E.length;d++)kb(E[d],w)}catch($){Pe(c,c.return,$)}}a&&b&64&&Pv(m),Oa(m,m.return);break;case 27:Gv(m);case 26:case 5:lr(d,m,a),a&&c===null&&b&4&&Hv(m),Oa(m,m.return);break;case 12:lr(d,m,a);break;case 13:lr(d,m,a),a&&b&4&&Qv(d,m);break;case 22:m.memoizedState===null&&lr(d,m,a),Oa(m,m.return);break;case 30:break;default:lr(d,m,a)}s=s.sibling}}function sh(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&&da(a))}function oh(i,s){i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&da(i))}function ii(i,s,a,c){if(s.subtreeFlags&10256)for(s=s.child;s!==null;)t0(i,s,a,c),s=s.sibling}function t0(i,s,a,c){var d=s.flags;switch(s.tag){case 0:case 11:case 15:ii(i,s,a,c),d&2048&&Ra(9,s);break;case 1:ii(i,s,a,c);break;case 3:ii(i,s,a,c),d&2048&&(i=null,s.alternate!==null&&(i=s.alternate.memoizedState.cache),s=s.memoizedState.cache,s!==i&&(s.refCount++,i!=null&&da(i)));break;case 12:if(d&2048){ii(i,s,a,c),i=s.stateNode;try{var m=s.memoizedProps,b=m.id,w=m.onPostCommit;typeof w=="function"&&w(b,s.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(E){Pe(s,s.return,E)}}else ii(i,s,a,c);break;case 13:ii(i,s,a,c);break;case 23:break;case 22:m=s.stateNode,b=s.alternate,s.memoizedState!==null?m._visibility&2?ii(i,s,a,c):_a(i,s):m._visibility&2?ii(i,s,a,c):(m._visibility|=2,Ys(i,s,a,c,(s.subtreeFlags&10256)!==0)),d&2048&&sh(b,s);break;case 24:ii(i,s,a,c),d&2048&&oh(s.alternate,s);break;default:ii(i,s,a,c)}}function Ys(i,s,a,c,d){for(d=d&&(s.subtreeFlags&10256)!==0,s=s.child;s!==null;){var m=i,b=s,w=a,E=c,$=b.flags;switch(b.tag){case 0:case 11:case 15:Ys(m,b,w,E,d),Ra(8,b);break;case 23:break;case 22:var K=b.stateNode;b.memoizedState!==null?K._visibility&2?Ys(m,b,w,E,d):_a(m,b):(K._visibility|=2,Ys(m,b,w,E,d)),d&&$&2048&&sh(b.alternate,b);break;case 24:Ys(m,b,w,E,d),d&&$&2048&&oh(b.alternate,b);break;default:Ys(m,b,w,E,d)}s=s.sibling}}function _a(i,s){if(s.subtreeFlags&10256)for(s=s.child;s!==null;){var a=i,c=s,d=c.flags;switch(c.tag){case 22:_a(a,c),d&2048&&sh(c.alternate,c);break;case 24:_a(a,c),d&2048&&oh(c.alternate,c);break;default:_a(a,c)}s=s.sibling}}var ka=8192;function Xs(i){if(i.subtreeFlags&ka)for(i=i.child;i!==null;)n0(i),i=i.sibling}function n0(i){switch(i.tag){case 26:Xs(i),i.flags&ka&&i.memoizedState!==null&&Rk(Pn,i.memoizedState,i.memoizedProps);break;case 5:Xs(i);break;case 3:case 4:var s=Pn;Pn=Uc(i.stateNode.containerInfo),Xs(i),Pn=s;break;case 22:i.memoizedState===null&&(s=i.alternate,s!==null&&s.memoizedState!==null?(s=ka,ka=16777216,Xs(i),ka=s):Xs(i));break;default:Xs(i)}}function i0(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 Ma(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var c=s[a];Dt=c,s0(c,i)}i0(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)r0(i),i=i.sibling}function r0(i){switch(i.tag){case 0:case 11:case 15:Ma(i),i.flags&2048&&or(9,i,i.return);break;case 3:Ma(i);break;case 12:Ma(i);break;case 22:var s=i.stateNode;i.memoizedState!==null&&s._visibility&2&&(i.return===null||i.return.tag!==13)?(s._visibility&=-3,Oc(i)):Ma(i);break;default:Ma(i)}}function Oc(i){var s=i.deletions;if((i.flags&16)!==0){if(s!==null)for(var a=0;a<s.length;a++){var c=s[a];Dt=c,s0(c,i)}i0(i)}for(i=i.child;i!==null;){switch(s=i,s.tag){case 0:case 11:case 15:or(8,s,s.return),Oc(s);break;case 22:a=s.stateNode,a._visibility&2&&(a._visibility&=-3,Oc(s));break;default:Oc(s)}i=i.sibling}}function s0(i,s){for(;Dt!==null;){var a=Dt;switch(a.tag){case 0:case 11:case 15:or(8,a,s);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var c=a.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:da(a.memoizedState.cache)}if(c=a.child,c!==null)c.return=a,Dt=c;else e:for(a=i;Dt!==null;){c=Dt;var d=c.sibling,m=c.return;if(Jv(c),c===a){Dt=null;break e}if(d!==null){d.return=m,Dt=d;break e}Dt=m}}}var q_={getCacheForType:function(i){var s=Pt(Et),a=s.data.get(i);return a===void 0&&(a=i(),s.data.set(i,a)),a}},P_=typeof WeakMap=="function"?WeakMap:Map,Be=0,Fe=null,Re=null,Ce=0,Le=0,mn=null,cr=!1,Js=!1,ah=!1,Ni=0,st=0,ur=0,es=0,lh=0,Dn=0,Zs=0,Ca=null,nn=null,ch=!1,uh=0,_c=1/0,kc=null,fr=null,Vt=0,dr=null,Qs=null,Ws=0,fh=0,dh=null,o0=null,Da=0,hh=null;function yn(){if((Be&2)!==0&&Ce!==0)return Ce&-Ce;if(B.T!==null){var i=zs;return i!==0?i:Sh()}return xg()}function a0(){Dn===0&&(Dn=(Ce&536870912)===0||$e?bg():536870912);var i=Cn.current;return i!==null&&(i.flags|=32),Dn}function gn(i,s,a){(i===Fe&&(Le===2||Le===9)||i.cancelPendingCommit!==null)&&(eo(i,0),hr(i,Ce,Dn,!1)),Jo(i,a),((Be&2)===0||i!==Fe)&&(i===Fe&&((Be&2)===0&&(es|=a),st===4&&hr(i,Ce,Dn,!1)),ri(i))}function l0(i,s,a){if((Be&6)!==0)throw Error(r(327));var c=!a&&(s&124)===0&&(s&i.expiredLanes)===0||Xo(i,s),d=c?F_(i,s):yh(i,s,!0),m=c;do{if(d===0){Js&&!c&&hr(i,s,0,!1);break}else{if(a=i.current.alternate,m&&!I_(a)){d=yh(i,s,!1),m=!1;continue}if(d===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 w=i;d=Ca;var E=w.current.memoizedState.isDehydrated;if(E&&(eo(w,b).flags|=256),b=yh(w,b,!1),b!==2){if(ah&&!E){w.errorRecoveryDisabledLanes|=m,es|=m,d=4;break e}m=nn,nn=d,m!==null&&(nn===null?nn=m:nn.push.apply(nn,m))}d=b}if(m=!1,d!==2)continue}}if(d===1){eo(i,0),hr(i,s,0,!0);break}e:{switch(c=i,m=d,m){case 0:case 1:throw Error(r(345));case 4:if((s&4194048)!==s)break;case 6:hr(c,s,Dn,!cr);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((s&62914560)===s&&(d=uh+300-xe(),10<d)){if(hr(c,s,Dn,!cr),zl(c,0,!0)!==0)break e;c.timeoutHandle=L0(c0.bind(null,c,a,nn,kc,ch,s,Dn,es,Zs,cr,m,2,-0,0),d);break e}c0(c,a,nn,kc,ch,s,Dn,es,Zs,cr,m,0,-0,0)}}break}while(!0);ri(i)}function c0(i,s,a,c,d,m,b,w,E,$,K,H,L,U){if(i.timeoutHandle=-1,H=s.subtreeFlags,(H&8192||(H&16785408)===16785408)&&(Ua={stylesheets:null,count:0,unsuspend:Ek},n0(s),H=Ok(),H!==null)){i.cancelPendingCommit=H(y0.bind(null,i,s,m,a,c,d,b,w,E,K,1,L,U)),hr(i,m,b,!$);return}y0(i,s,m,a,c,d,b,w,E)}function I_(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 c=0;c<a.length;c++){var d=a[c],m=d.getSnapshot;d=d.value;try{if(!fn(m(),d))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 hr(i,s,a,c){s&=~lh,s&=~es,i.suspendedLanes|=s,i.pingedLanes&=~s,c&&(i.warmLanes|=s),c=i.expirationTimes;for(var d=s;0<d;){var m=31-un(d),b=1<<m;c[m]=-1,d&=~b}a!==0&&Sg(i,a,s)}function Mc(){return(Be&6)===0?(Na(0),!1):!0}function ph(){if(Re!==null){if(Le===0)var i=Re.return;else i=Re,Ei=Yr=null,Cd(i),Fs=null,Ta=0,i=Re;for(;i!==null;)qv(i.alternate,i),i=i.return;Re=null}}function eo(i,s){var a=i.timeoutHandle;a!==-1&&(i.timeoutHandle=-1,lk(a)),a=i.cancelPendingCommit,a!==null&&(i.cancelPendingCommit=null,a()),ph(),Fe=i,Re=a=xi(i.current,null),Ce=s,Le=0,mn=null,cr=!1,Js=Xo(i,s),ah=!1,Zs=Dn=lh=es=ur=st=0,nn=Ca=null,ch=!1,(s&8)!==0&&(s|=s&32);var c=i.entangledLanes;if(c!==0)for(i=i.entanglements,c&=s;0<c;){var d=31-un(c),m=1<<d;s|=i[d],c&=~m}return Ni=s,Ql(),a}function u0(i,s){Te=null,B.H=gc,s===pa||s===ac?(s=Ob(),Le=3):s===Ab?(s=Ob(),Le=4):Le=s===_v?8:s!==null&&typeof s=="object"&&typeof s.then=="function"?6:1,mn=s,Re===null&&(st=1,xc(i,On(s,i.current)))}function f0(){var i=B.H;return B.H=gc,i===null?gc:i}function d0(){var i=B.A;return B.A=q_,i}function mh(){st=4,cr||(Ce&4194048)!==Ce&&Cn.current!==null||(Js=!0),(ur&134217727)===0&&(es&134217727)===0||Fe===null||hr(Fe,Ce,Dn,!1)}function yh(i,s,a){var c=Be;Be|=2;var d=f0(),m=d0();(Fe!==i||Ce!==s)&&(kc=null,eo(i,s)),s=!1;var b=st;e:do try{if(Le!==0&&Re!==null){var w=Re,E=mn;switch(Le){case 8:ph(),b=6;break e;case 3:case 2:case 9:case 6:Cn.current===null&&(s=!0);var $=Le;if(Le=0,mn=null,to(i,w,E,$),a&&Js){b=0;break e}break;default:$=Le,Le=0,mn=null,to(i,w,E,$)}}H_(),b=st;break}catch(K){u0(i,K)}while(!0);return s&&i.shellSuspendCounter++,Ei=Yr=null,Be=c,B.H=d,B.A=m,Re===null&&(Fe=null,Ce=0,Ql()),b}function H_(){for(;Re!==null;)h0(Re)}function F_(i,s){var a=Be;Be|=2;var c=f0(),d=d0();Fe!==i||Ce!==s?(kc=null,_c=xe()+500,eo(i,s)):Js=Xo(i,s);e:do try{if(Le!==0&&Re!==null){s=Re;var m=mn;t:switch(Le){case 1:Le=0,mn=null,to(i,s,m,1);break;case 2:case 9:if(Eb(m)){Le=0,mn=null,p0(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:Eb(m)?(Le=0,mn=null,p0(s)):(Le=0,mn=null,to(i,s,m,7));break;case 5:var b=null;switch(Re.tag){case 26:b=Re.memoizedState;case 5:case 27:var w=Re;if(!b||X0(b)){Le=0,mn=null;var E=w.sibling;if(E!==null)Re=E;else{var $=w.return;$!==null?(Re=$,Cc($)):Re=null}break t}}Le=0,mn=null,to(i,s,m,5);break;case 6:Le=0,mn=null,to(i,s,m,6);break;case 8:ph(),st=6;break e;default:throw Error(r(462))}}G_();break}catch(K){u0(i,K)}while(!0);return Ei=Yr=null,B.H=c,B.A=d,Be=a,Re!==null?0:(Fe=null,Ce=0,Ql(),st)}function G_(){for(;Re!==null&&!et();)h0(Re)}function h0(i){var s=zv(i.alternate,i,Ni);i.memoizedProps=i.pendingProps,s===null?Cc(i):Re=s}function p0(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:Cd(s);default:qv(a,s),s=Re=mb(s,Ni),s=zv(a,s,Ni)}i.memoizedProps=i.pendingProps,s===null?Cc(i):Re=s}function to(i,s,a,c){Ei=Yr=null,Cd(s),Fs=null,Ta=0;var d=s.return;try{if(B_(i,d,s,a,Ce)){st=1,xc(i,On(a,i.current)),Re=null;return}}catch(m){if(d!==null)throw Re=d,m;st=1,xc(i,On(a,i.current)),Re=null;return}s.flags&32768?($e||c===1?i=!0:Js||(Ce&536870912)!==0?i=!1:(cr=i=!0,(c===2||c===9||c===3||c===6)&&(c=Cn.current,c!==null&&c.tag===13&&(c.flags|=16384))),m0(s,i)):Cc(s)}function Cc(i){var s=i;do{if((s.flags&32768)!==0){m0(s,cr);return}i=s.return;var a=V_(s.alternate,s,Ni);if(a!==null){Re=a;return}if(s=s.sibling,s!==null){Re=s;return}Re=s=i}while(s!==null);st===0&&(st=5)}function m0(i,s){do{var a=U_(i.alternate,i);if(a!==null){a.flags&=32767,Re=a;return}if(a=i.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!s&&(i=i.sibling,i!==null)){Re=i;return}Re=i=a}while(i!==null);st=6,Re=null}function y0(i,s,a,c,d,m,b,w,E){i.cancelPendingCommit=null;do Dc();while(Vt!==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|=od,EO(i,a,m,b,w,E),i===Fe&&(Re=Fe=null,Ce=0),Qs=s,dr=i,Ws=a,fh=m,dh=d,o0=c,(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,Z_(Tn,function(){return w0(),null})):(i.callbackNode=null,i.callbackPriority=0),c=(s.flags&13878)!==0,(s.subtreeFlags&13878)!==0||c){c=B.T,B.T=null,d=q.p,q.p=2,b=Be,Be|=4;try{z_(i,s,a)}finally{Be=b,q.p=d,B.T=c}}Vt=1,g0(),b0(),v0()}}function g0(){if(Vt===1){Vt=0;var i=dr,s=Qs,a=(s.flags&13878)!==0;if((s.subtreeFlags&13878)!==0||a){a=B.T,B.T=null;var c=q.p;q.p=2;var d=Be;Be|=4;try{Wv(s,i);var m=_h,b=sb(i.containerInfo),w=m.focusedElem,E=m.selectionRange;if(b!==w&&w&&w.ownerDocument&&rb(w.ownerDocument.documentElement,w)){if(E!==null&&td(w)){var $=E.start,K=E.end;if(K===void 0&&(K=$),"selectionStart"in w)w.selectionStart=$,w.selectionEnd=Math.min(K,w.value.length);else{var H=w.ownerDocument||document,L=H&&H.defaultView||window;if(L.getSelection){var U=L.getSelection(),me=w.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 k=ib(w,de),R=ib(w,Ke);if(k&&R&&(U.rangeCount!==1||U.anchorNode!==k.node||U.anchorOffset!==k.offset||U.focusNode!==R.node||U.focusOffset!==R.offset)){var N=H.createRange();N.setStart(k.node,k.offset),U.removeAllRanges(),de>Ke?(U.addRange(N),U.extend(R.node,R.offset)):(N.setEnd(R.node,R.offset),U.addRange(N))}}}}for(H=[],U=w;U=U.parentNode;)U.nodeType===1&&H.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<H.length;w++){var I=H[w];I.element.scrollLeft=I.left,I.element.scrollTop=I.top}}Ic=!!Oh,_h=Oh=null}finally{Be=d,q.p=c,B.T=a}}i.current=s,Vt=2}}function b0(){if(Vt===2){Vt=0;var i=dr,s=Qs,a=(s.flags&8772)!==0;if((s.subtreeFlags&8772)!==0||a){a=B.T,B.T=null;var c=q.p;q.p=2;var d=Be;Be|=4;try{Xv(i,s.alternate,s)}finally{Be=d,q.p=c,B.T=a}}Vt=3}}function v0(){if(Vt===4||Vt===3){Vt=0,At();var i=dr,s=Qs,a=Ws,c=o0;(s.subtreeFlags&10256)!==0||(s.flags&10256)!==0?Vt=5:(Vt=0,Qs=dr=null,S0(i,i.pendingLanes));var d=i.pendingLanes;if(d===0&&(fr=null),$f(a),s=s.stateNode,cn&&typeof cn.onCommitFiberRoot=="function")try{cn.onCommitFiberRoot(Yo,s,void 0,(s.current.flags&128)===128)}catch{}if(c!==null){s=B.T,d=q.p,q.p=2,B.T=null;try{for(var m=i.onRecoverableError,b=0;b<c.length;b++){var w=c[b];m(w.value,{componentStack:w.stack})}}finally{B.T=s,q.p=d}}(Ws&3)!==0&&Dc(),ri(i),d=i.pendingLanes,(a&4194090)!==0&&(d&42)!==0?i===hh?Da++:(Da=0,hh=i):Da=0,Na(0)}}function S0(i,s){(i.pooledCacheLanes&=s)===0&&(s=i.pooledCache,s!=null&&(i.pooledCache=null,da(s)))}function Dc(i){return g0(),b0(),v0(),w0()}function w0(){if(Vt!==5)return!1;var i=dr,s=fh;fh=0;var a=$f(Ws),c=B.T,d=q.p;try{q.p=32>a?32:a,B.T=null,a=dh,dh=null;var m=dr,b=Ws;if(Vt=0,Qs=dr=null,Ws=0,(Be&6)!==0)throw Error(r(331));var w=Be;if(Be|=4,r0(m.current),t0(m,m.current,b,a),Be=w,Na(0,!1),cn&&typeof cn.onPostCommitFiberRoot=="function")try{cn.onPostCommitFiberRoot(Yo,m)}catch{}return!0}finally{q.p=d,B.T=c,S0(i,s)}}function x0(i,s,a){s=On(a,s),s=Hd(i.stateNode,s,2),i=nr(i,s,2),i!==null&&(Jo(i,2),ri(i))}function Pe(i,s,a){if(i.tag===3)x0(i,i,a);else for(;s!==null;){if(s.tag===3){x0(s,i,a);break}else if(s.tag===1){var c=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(fr===null||!fr.has(c))){i=On(a,i),a=Rv(2),c=nr(s,a,2),c!==null&&(Ov(a,c,s,i),Jo(c,2),ri(c));break}}s=s.return}}function gh(i,s,a){var c=i.pingCache;if(c===null){c=i.pingCache=new P_;var d=new Set;c.set(s,d)}else d=c.get(s),d===void 0&&(d=new Set,c.set(s,d));d.has(a)||(ah=!0,d.add(a),i=Y_.bind(null,i,s,a),s.then(i,i))}function Y_(i,s,a){var c=i.pingCache;c!==null&&c.delete(s),i.pingedLanes|=i.suspendedLanes&a,i.warmLanes&=~a,Fe===i&&(Ce&a)===a&&(st===4||st===3&&(Ce&62914560)===Ce&&300>xe()-uh?(Be&2)===0&&eo(i,0):lh|=a,Zs===Ce&&(Zs=0)),ri(i)}function T0(i,s){s===0&&(s=vg()),i=Bs(i,s),i!==null&&(Jo(i,s),ri(i))}function X_(i){var s=i.memoizedState,a=0;s!==null&&(a=s.retryLane),T0(i,a)}function J_(i,s){var a=0;switch(i.tag){case 13:var c=i.stateNode,d=i.memoizedState;d!==null&&(a=d.retryLane);break;case 19:c=i.stateNode;break;case 22:c=i.stateNode._retryCache;break;default:throw Error(r(314))}c!==null&&c.delete(s),T0(i,a)}function Z_(i,s){return Me(i,s)}var Nc=null,no=null,bh=!1,$c=!1,vh=!1,ts=0;function ri(i){i!==no&&i.next===null&&(no===null?Nc=no=i:no=no.next=i),$c=!0,bh||(bh=!0,W_())}function Na(i,s){if(!vh&&$c){vh=!0;do for(var a=!1,c=Nc;c!==null;){if(i!==0){var d=c.pendingLanes;if(d===0)var m=0;else{var b=c.suspendedLanes,w=c.pingedLanes;m=(1<<31-un(42|i)+1)-1,m&=d&~(b&~w),m=m&201326741?m&201326741|1:m?m|2:0}m!==0&&(a=!0,O0(c,m))}else m=Ce,m=zl(c,c===Fe?m:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(m&3)===0||Xo(c,m)||(a=!0,O0(c,m));c=c.next}while(a);vh=!1}}function Q_(){A0()}function A0(){$c=bh=!1;var i=0;ts!==0&&(ak()&&(i=ts),ts=0);for(var s=xe(),a=null,c=Nc;c!==null;){var d=c.next,m=E0(c,s);m===0?(c.next=null,a===null?Nc=d:a.next=d,d===null&&(no=a)):(a=c,(i!==0||(m&3)!==0)&&($c=!0)),c=d}Na(i)}function E0(i,s){for(var a=i.suspendedLanes,c=i.pingedLanes,d=i.expirationTimes,m=i.pendingLanes&-62914561;0<m;){var b=31-un(m),w=1<<b,E=d[b];E===-1?((w&a)===0||(w&c)!==0)&&(d[b]=AO(w,s)):E<=s&&(i.expiredLanes|=w),m&=~w}if(s=Fe,a=Ce,a=zl(i,i===s?a:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c=i.callbackNode,a===0||i===s&&(Le===2||Le===9)||i.cancelPendingCommit!==null)return c!==null&&c!==null&&Ae(c),i.callbackNode=null,i.callbackPriority=0;if((a&3)===0||Xo(i,a)){if(s=a&-a,s===i.callbackPriority)return s;switch(c!==null&&Ae(c),$f(a)){case 2:case 8:a=Kt;break;case 32:a=Tn;break;case 268435456:a=An;break;default:a=Tn}return c=R0.bind(null,i),a=Me(a,c),i.callbackPriority=s,i.callbackNode=a,s}return c!==null&&c!==null&&Ae(c),i.callbackPriority=2,i.callbackNode=null,2}function R0(i,s){if(Vt!==0&&Vt!==5)return i.callbackNode=null,i.callbackPriority=0,null;var a=i.callbackNode;if(Dc()&&i.callbackNode!==a)return null;var c=Ce;return c=zl(i,i===Fe?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),c===0?null:(l0(i,c,s),E0(i,xe()),i.callbackNode!=null&&i.callbackNode===a?R0.bind(null,i):null)}function O0(i,s){if(Dc())return null;l0(i,s,!0)}function W_(){ck(function(){(Be&6)!==0?Me(Gt,Q_):A0()})}function Sh(){return ts===0&&(ts=bg()),ts}function _0(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:Hl(""+i)}function k0(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 ek(i,s,a,c,d){if(s==="submit"&&a&&a.stateNode===d){var m=_0((d[Qt]||null).action),b=c.submitter;b&&(s=(s=b[Qt]||null)?_0(s.formAction):b.getAttribute("formAction"),s!==null&&(m=s,b=null));var w=new Xl("action","action",null,c,d);i.push({event:w,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(ts!==0){var E=b?k0(d,b):new FormData(d);zd(a,{pending:!0,data:E,method:d.method,action:m},null,E)}}else typeof m=="function"&&(w.preventDefault(),E=b?k0(d,b):new FormData(d),zd(a,{pending:!0,data:E,method:d.method,action:m},m,E))},currentTarget:d}]})}}for(var wh=0;wh<sd.length;wh++){var xh=sd[wh],tk=xh.toLowerCase(),nk=xh[0].toUpperCase()+xh.slice(1);qn(tk,"on"+nk)}qn(lb,"onAnimationEnd"),qn(cb,"onAnimationIteration"),qn(ub,"onAnimationStart"),qn("dblclick","onDoubleClick"),qn("focusin","onFocus"),qn("focusout","onBlur"),qn(v_,"onTransitionRun"),qn(S_,"onTransitionStart"),qn(w_,"onTransitionCancel"),qn(fb,"onTransitionEnd"),Rs("onMouseEnter",["mouseout","mouseover"]),Rs("onMouseLeave",["mouseout","mouseover"]),Rs("onPointerEnter",["pointerout","pointerover"]),Rs("onPointerLeave",["pointerout","pointerover"]),Ur("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ur("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ur("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ur("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ur("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $a="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(" "),ik=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat($a));function M0(i,s){s=(s&4)!==0;for(var a=0;a<i.length;a++){var c=i[a],d=c.event;c=c.listeners;e:{var m=void 0;if(s)for(var b=c.length-1;0<=b;b--){var w=c[b],E=w.instance,$=w.currentTarget;if(w=w.listener,E!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=$;try{m(d)}catch(K){wc(K)}d.currentTarget=null,m=E}else for(b=0;b<c.length;b++){if(w=c[b],E=w.instance,$=w.currentTarget,w=w.listener,E!==m&&d.isPropagationStopped())break e;m=w,d.currentTarget=$;try{m(d)}catch(K){wc(K)}d.currentTarget=null,m=E}}}}function Oe(i,s){var a=s[jf];a===void 0&&(a=s[jf]=new Set);var c=i+"__bubble";a.has(c)||(C0(s,i,2,!1),a.add(c))}function Th(i,s,a){var c=0;s&&(c|=4),C0(a,i,c,s)}var jc="_reactListening"+Math.random().toString(36).slice(2);function Ah(i){if(!i[jc]){i[jc]=!0,Ag.forEach(function(a){a!=="selectionchange"&&(ik.has(a)||Th(a,!1,i),Th(a,!0,i))});var s=i.nodeType===9?i:i.ownerDocument;s===null||s[jc]||(s[jc]=!0,Th("selectionchange",!1,s))}}function C0(i,s,a,c){switch(tS(s)){case 2:var d=Mk;break;case 8:d=Ck;break;default:d=Vh}a=d.bind(null,s,a,i),d=void 0,!Ff||s!=="touchstart"&&s!=="touchmove"&&s!=="wheel"||(d=!0),c?d!==void 0?i.addEventListener(s,a,{capture:!0,passive:d}):i.addEventListener(s,a,!0):d!==void 0?i.addEventListener(s,a,{passive:d}):i.addEventListener(s,a,!1)}function Eh(i,s,a,c,d){var m=c;if((s&1)===0&&(s&2)===0&&c!==null)e:for(;;){if(c===null)return;var b=c.tag;if(b===3||b===4){var w=c.stateNode.containerInfo;if(w===d)break;if(b===4)for(b=c.return;b!==null;){var E=b.tag;if((E===3||E===4)&&b.stateNode.containerInfo===d)return;b=b.return}for(;w!==null;){if(b=Ts(w),b===null)return;if(E=b.tag,E===5||E===6||E===26||E===27){c=m=b;continue e}w=w.parentNode}}c=c.return}Vg(function(){var $=m,K=If(a),H=[];e:{var L=db.get(i);if(L!==void 0){var U=Xl,me=i;switch(i){case"keypress":if(Gl(a)===0)break e;case"keydown":case"keyup":U=ZO;break;case"focusin":me="focus",U=Jf;break;case"focusout":me="blur",U=Jf;break;case"beforeblur":case"afterblur":U=Jf;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=Kg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=UO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=e_;break;case lb:case cb:case ub:U=qO;break;case fb:U=n_;break;case"scroll":case"scrollend":U=LO;break;case"wheel":U=r_;break;case"copy":case"cut":case"paste":U=IO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=Pg;break;case"toggle":case"beforetoggle":U=o_}var de=(s&4)!==0,Ke=!de&&(i==="scroll"||i==="scrollend"),k=de?L!==null?L+"Capture":null:L;de=[];for(var R=$,N;R!==null;){var I=R;if(N=I.stateNode,I=I.tag,I!==5&&I!==26&&I!==27||N===null||k===null||(I=Wo(R,k),I!=null&&de.push(ja(R,I,N))),Ke)break;R=R.return}0<de.length&&(L=new U(L,me,null,a,K),H.push({event:L,listeners:de}))}}if((s&7)===0){e:{if(L=i==="mouseover"||i==="pointerover",U=i==="mouseout"||i==="pointerout",L&&a!==Pf&&(me=a.relatedTarget||a.fromElement)&&(Ts(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=$,me=me?Ts(me):null,me!==null&&(Ke=l(me),de=me.tag,me!==Ke||de!==5&&de!==27&&de!==6)&&(me=null)):(U=null,me=$),U!==me)){if(de=Kg,I="onMouseLeave",k="onMouseEnter",R="mouse",(i==="pointerout"||i==="pointerover")&&(de=Pg,I="onPointerLeave",k="onPointerEnter",R="pointer"),Ke=U==null?L:Qo(U),N=me==null?L:Qo(me),L=new de(I,R+"leave",U,a,K),L.target=Ke,L.relatedTarget=N,I=null,Ts(K)===$&&(de=new de(k,R+"enter",me,a,K),de.target=N,de.relatedTarget=Ke,I=de),Ke=I,U&&me)t:{for(de=U,k=me,R=0,N=de;N;N=io(N))R++;for(N=0,I=k;I;I=io(I))N++;for(;0<R-N;)de=io(de),R--;for(;0<N-R;)k=io(k),N--;for(;R--;){if(de===k||k!==null&&de===k.alternate)break t;de=io(de),k=io(k)}de=null}else de=null;U!==null&&D0(H,L,U,de,!1),me!==null&&Ke!==null&&D0(H,Ke,me,de,!0)}}e:{if(L=$?Qo($):window,U=L.nodeName&&L.nodeName.toLowerCase(),U==="select"||U==="input"&&L.type==="file")var se=Zg;else if(Xg(L))if(Qg)se=y_;else{se=p_;var Ee=h_}else U=L.nodeName,!U||U.toLowerCase()!=="input"||L.type!=="checkbox"&&L.type!=="radio"?$&&qf($.elementType)&&(se=Zg):se=m_;if(se&&(se=se(i,$))){Jg(H,se,a,K);break e}Ee&&Ee(i,L,$),i==="focusout"&&$&&L.type==="number"&&$.memoizedProps.value!=null&&Kf(L,"number",L.value)}switch(Ee=$?Qo($):window,i){case"focusin":(Xg(Ee)||Ee.contentEditable==="true")&&(Ns=Ee,nd=$,aa=null);break;case"focusout":aa=nd=Ns=null;break;case"mousedown":id=!0;break;case"contextmenu":case"mouseup":case"dragend":id=!1,ob(H,a,K);break;case"selectionchange":if(b_)break;case"keydown":case"keyup":ob(H,a,K)}var ce;if(Qf)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 Ds?Gg(i,a)&&(he="onCompositionEnd"):i==="keydown"&&a.keyCode===229&&(he="onCompositionStart");he&&(Ig&&a.locale!=="ko"&&(Ds||he!=="onCompositionStart"?he==="onCompositionEnd"&&Ds&&(ce=Ug()):(Qi=K,Gf="value"in Qi?Qi.value:Qi.textContent,Ds=!0)),Ee=Bc($,he),0<Ee.length&&(he=new qg(he,i,null,a,K),H.push({event:he,listeners:Ee}),ce?he.data=ce:(ce=Yg(a),ce!==null&&(he.data=ce)))),(ce=l_?c_(i,a):u_(i,a))&&(he=Bc($,"onBeforeInput"),0<he.length&&(Ee=new qg("onBeforeInput","beforeinput",null,a,K),H.push({event:Ee,listeners:he}),Ee.data=ce)),ek(H,i,$,a,K)}M0(H,s)})}function ja(i,s,a){return{instance:i,listener:s,currentTarget:a}}function Bc(i,s){for(var a=s+"Capture",c=[];i!==null;){var d=i,m=d.stateNode;if(d=d.tag,d!==5&&d!==26&&d!==27||m===null||(d=Wo(i,a),d!=null&&c.unshift(ja(i,d,m)),d=Wo(i,s),d!=null&&c.push(ja(i,d,m))),i.tag===3)return c;i=i.return}return[]}function io(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function D0(i,s,a,c,d){for(var m=s._reactName,b=[];a!==null&&a!==c;){var w=a,E=w.alternate,$=w.stateNode;if(w=w.tag,E!==null&&E===c)break;w!==5&&w!==26&&w!==27||$===null||(E=$,d?($=Wo(a,m),$!=null&&b.unshift(ja(a,$,E))):d||($=Wo(a,m),$!=null&&b.push(ja(a,$,E)))),a=a.return}b.length!==0&&i.push({event:s,listeners:b})}var rk=/\r\n?/g,sk=/\u0000|\uFFFD/g;function N0(i){return(typeof i=="string"?i:""+i).replace(rk,`
|
|
61
|
+
`).replace(sk,"")}function $0(i,s){return s=N0(s),N0(i)===s}function Lc(){}function ze(i,s,a,c,d,m){switch(a){case"children":typeof c=="string"?s==="body"||s==="textarea"&&c===""||ks(i,c):(typeof c=="number"||typeof c=="bigint")&&s!=="body"&&ks(i,""+c);break;case"className":ql(i,"class",c);break;case"tabIndex":ql(i,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":ql(i,a,c);break;case"style":Bg(i,c,m);break;case"data":if(s!=="object"){ql(i,"data",c);break}case"src":case"href":if(c===""&&(s!=="a"||a!=="href")){i.removeAttribute(a);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Hl(""+c),i.setAttribute(a,c);break;case"action":case"formAction":if(typeof c=="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",d.name,d,null),ze(i,s,"formEncType",d.formEncType,d,null),ze(i,s,"formMethod",d.formMethod,d,null),ze(i,s,"formTarget",d.formTarget,d,null)):(ze(i,s,"encType",d.encType,d,null),ze(i,s,"method",d.method,d,null),ze(i,s,"target",d.target,d,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){i.removeAttribute(a);break}c=Hl(""+c),i.setAttribute(a,c);break;case"onClick":c!=null&&(i.onclick=Lc);break;case"onScroll":c!=null&&Oe("scroll",i);break;case"onScrollEnd":c!=null&&Oe("scrollend",i);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"multiple":i.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":i.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){i.removeAttribute("xlink:href");break}a=Hl(""+c),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":c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""+c):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":c&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,""):i.removeAttribute(a);break;case"capture":case"download":c===!0?i.setAttribute(a,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?i.setAttribute(a,c):i.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?i.setAttribute(a,c):i.removeAttribute(a);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?i.removeAttribute(a):i.setAttribute(a,c);break;case"popover":Oe("beforetoggle",i),Oe("toggle",i),Kl(i,"popover",c);break;case"xlinkActuate":Si(i,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Si(i,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Si(i,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Si(i,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Si(i,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Si(i,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Si(i,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Si(i,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Si(i,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Kl(i,"is",c);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=jO.get(a)||a,Kl(i,a,c))}}function Rh(i,s,a,c,d,m){switch(a){case"style":Bg(i,c,m);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(r(61));if(a=c.__html,a!=null){if(d.children!=null)throw Error(r(60));i.innerHTML=a}}break;case"children":typeof c=="string"?ks(i,c):(typeof c=="number"||typeof c=="bigint")&&ks(i,""+c);break;case"onScroll":c!=null&&Oe("scroll",i);break;case"onScrollEnd":c!=null&&Oe("scrollend",i);break;case"onClick":c!=null&&(i.onclick=Lc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Eg.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(d=a.endsWith("Capture"),s=a.slice(2,d?a.length-7:void 0),m=i[Qt]||null,m=m!=null?m[a]:null,typeof m=="function"&&i.removeEventListener(s,m,d),typeof c=="function")){typeof m!="function"&&m!==null&&(a in i?i[a]=null:i.hasAttribute(a)&&i.removeAttribute(a)),i.addEventListener(s,c,d);break e}a in i?i[a]=c:c===!0?i.setAttribute(a,""):Kl(i,a,c)}}}function Ut(i,s,a){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Oe("error",i),Oe("load",i);var c=!1,d=!1,m;for(m in a)if(a.hasOwnProperty(m)){var b=a[m];if(b!=null)switch(m){case"src":c=!0;break;case"srcSet":d=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,m,b,a,null)}}d&&ze(i,s,"srcSet",a.srcSet,a,null),c&&ze(i,s,"src",a.src,a,null);return;case"input":Oe("invalid",i);var w=m=b=d=null,E=null,$=null;for(c in a)if(a.hasOwnProperty(c)){var K=a[c];if(K!=null)switch(c){case"name":d=K;break;case"type":b=K;break;case"checked":E=K;break;case"defaultChecked":$=K;break;case"value":m=K;break;case"defaultValue":w=K;break;case"children":case"dangerouslySetInnerHTML":if(K!=null)throw Error(r(137,s));break;default:ze(i,s,c,K,a,null)}}Dg(i,m,w,E,$,b,d,!1),Pl(i);return;case"select":Oe("invalid",i),c=b=m=null;for(d in a)if(a.hasOwnProperty(d)&&(w=a[d],w!=null))switch(d){case"value":m=w;break;case"defaultValue":b=w;break;case"multiple":c=w;default:ze(i,s,d,w,a,null)}s=m,a=b,i.multiple=!!c,s!=null?_s(i,!!c,s,!1):a!=null&&_s(i,!!c,a,!0);return;case"textarea":Oe("invalid",i),m=d=c=null;for(b in a)if(a.hasOwnProperty(b)&&(w=a[b],w!=null))switch(b){case"value":c=w;break;case"defaultValue":d=w;break;case"children":m=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(r(91));break;default:ze(i,s,b,w,a,null)}$g(i,c,d,m),Pl(i);return;case"option":for(E in a)if(a.hasOwnProperty(E)&&(c=a[E],c!=null))switch(E){case"selected":i.selected=c&&typeof c!="function"&&typeof c!="symbol";break;default:ze(i,s,E,c,a,null)}return;case"dialog":Oe("beforetoggle",i),Oe("toggle",i),Oe("cancel",i),Oe("close",i);break;case"iframe":case"object":Oe("load",i);break;case"video":case"audio":for(c=0;c<$a.length;c++)Oe($a[c],i);break;case"image":Oe("error",i),Oe("load",i);break;case"details":Oe("toggle",i);break;case"embed":case"source":case"link":Oe("error",i),Oe("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($ in a)if(a.hasOwnProperty($)&&(c=a[$],c!=null))switch($){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,s));default:ze(i,s,$,c,a,null)}return;default:if(qf(s)){for(K in a)a.hasOwnProperty(K)&&(c=a[K],c!==void 0&&Rh(i,s,K,c,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(c=a[w],c!=null&&ze(i,s,w,c,a,null))}function ok(i,s,a,c){switch(s){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var d=null,m=null,b=null,w=null,E=null,$=null,K=null;for(U in a){var H=a[U];if(a.hasOwnProperty(U)&&H!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":E=H;default:c.hasOwnProperty(U)||ze(i,s,U,null,c,H)}}for(var L in c){var U=c[L];if(H=a[L],c.hasOwnProperty(L)&&(U!=null||H!=null))switch(L){case"type":m=U;break;case"name":d=U;break;case"checked":$=U;break;case"defaultChecked":K=U;break;case"value":b=U;break;case"defaultValue":w=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(r(137,s));break;default:U!==H&&ze(i,s,L,U,c,H)}}zf(i,b,w,E,$,K,m,d);return;case"select":U=b=w=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:c.hasOwnProperty(m)||ze(i,s,m,null,c,E)}for(d in c)if(m=c[d],E=a[d],c.hasOwnProperty(d)&&(m!=null||E!=null))switch(d){case"value":L=m;break;case"defaultValue":w=m;break;case"multiple":b=m;default:m!==E&&ze(i,s,d,m,c,E)}s=w,a=b,c=U,L!=null?_s(i,!!a,L,!1):!!c!=!!a&&(s!=null?_s(i,!!a,s,!0):_s(i,!!a,a?[]:"",!1));return;case"textarea":U=L=null;for(w in a)if(d=a[w],a.hasOwnProperty(w)&&d!=null&&!c.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:ze(i,s,w,null,c,d)}for(b in c)if(d=c[b],m=a[b],c.hasOwnProperty(b)&&(d!=null||m!=null))switch(b){case"value":L=d;break;case"defaultValue":U=d;break;case"children":break;case"dangerouslySetInnerHTML":if(d!=null)throw Error(r(91));break;default:d!==m&&ze(i,s,b,d,c,m)}Ng(i,L,U);return;case"option":for(var me in a)if(L=a[me],a.hasOwnProperty(me)&&L!=null&&!c.hasOwnProperty(me))switch(me){case"selected":i.selected=!1;break;default:ze(i,s,me,null,c,L)}for(E in c)if(L=c[E],U=a[E],c.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,c,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&&!c.hasOwnProperty(de)&&ze(i,s,de,null,c,L);for($ in c)if(L=c[$],U=a[$],c.hasOwnProperty($)&&L!==U&&(L!=null||U!=null))switch($){case"children":case"dangerouslySetInnerHTML":if(L!=null)throw Error(r(137,s));break;default:ze(i,s,$,L,c,U)}return;default:if(qf(s)){for(var Ke in a)L=a[Ke],a.hasOwnProperty(Ke)&&L!==void 0&&!c.hasOwnProperty(Ke)&&Rh(i,s,Ke,void 0,c,L);for(K in c)L=c[K],U=a[K],!c.hasOwnProperty(K)||L===U||L===void 0&&U===void 0||Rh(i,s,K,L,c,U);return}}for(var k in a)L=a[k],a.hasOwnProperty(k)&&L!=null&&!c.hasOwnProperty(k)&&ze(i,s,k,null,c,L);for(H in c)L=c[H],U=a[H],!c.hasOwnProperty(H)||L===U||L==null&&U==null||ze(i,s,H,L,c,U)}var Oh=null,_h=null;function Vc(i){return i.nodeType===9?i:i.ownerDocument}function j0(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 B0(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 kh(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 Mh=null;function ak(){var i=window.event;return i&&i.type==="popstate"?i===Mh?!1:(Mh=i,!0):(Mh=null,!1)}var L0=typeof setTimeout=="function"?setTimeout:void 0,lk=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,ck=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(i){return V0.resolve(null).then(i).catch(uk)}:L0;function uk(i){setTimeout(function(){throw i})}function pr(i){return i==="head"}function U0(i,s){var a=s,c=0,d=0;do{var m=a.nextSibling;if(i.removeChild(a),m&&m.nodeType===8)if(a=m.data,a==="/$"){if(0<c&&8>c){a=c;var b=i.ownerDocument;if(a&1&&Ba(b.documentElement),a&2&&Ba(b.body),a&4)for(a=b.head,Ba(a),b=a.firstChild;b;){var w=b.nextSibling,E=b.nodeName;b[Zo]||E==="SCRIPT"||E==="STYLE"||E==="LINK"&&b.rel.toLowerCase()==="stylesheet"||a.removeChild(b),b=w}}if(d===0){i.removeChild(m),Ia(s);return}d--}else a==="$"||a==="$?"||a==="$!"?d++:c=a.charCodeAt(0)-48;else c=0;a=m}while(a);Ia(s)}function Ch(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":Ch(a),Bf(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}i.removeChild(a)}}function fk(i,s,a,c){for(;i.nodeType===1;){var d=a;if(i.nodeName.toLowerCase()!==s.toLowerCase()){if(!c&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(c){if(!i[Zo])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!==d.rel||i.getAttribute("href")!==(d.href==null||d.href===""?null:d.href)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin)||i.getAttribute("title")!==(d.title==null?null:d.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(m=i.getAttribute("src"),(m!==(d.src==null?null:d.src)||i.getAttribute("type")!==(d.type==null?null:d.type)||i.getAttribute("crossorigin")!==(d.crossOrigin==null?null:d.crossOrigin))&&m&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(s==="input"&&i.type==="hidden"){var m=d.name==null?null:""+d.name;if(d.type==="hidden"&&i.getAttribute("name")===m)return i}else return i;if(i=In(i.nextSibling),i===null)break}return null}function dk(i,s,a){if(s==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!a||(i=In(i.nextSibling),i===null))return null;return i}function Dh(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState==="complete"}function hk(i,s){var a=i.ownerDocument;if(i.data!=="$?"||a.readyState==="complete")s();else{var c=function(){s(),a.removeEventListener("DOMContentLoaded",c)};a.addEventListener("DOMContentLoaded",c),i._reactRetry=c}}function In(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 Nh=null;function z0(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 K0(i,s,a){switch(s=Vc(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 Ba(i){for(var s=i.attributes;s.length;)i.removeAttributeNode(s[0]);Bf(i)}var Nn=new Map,q0=new Set;function Uc(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var $i=q.d;q.d={f:pk,r:mk,D:yk,C:gk,L:bk,m:vk,X:wk,S:Sk,M:xk};function pk(){var i=$i.f(),s=Mc();return i||s}function mk(i){var s=As(i);s!==null&&s.tag===5&&s.type==="form"?lv(s):$i.r(i)}var ro=typeof document>"u"?null:document;function P0(i,s,a){var c=ro;if(c&&typeof s=="string"&&s){var d=Rn(s);d='link[rel="'+i+'"][href="'+d+'"]',typeof a=="string"&&(d+='[crossorigin="'+a+'"]'),q0.has(d)||(q0.add(d),i={rel:i,crossOrigin:a,href:s},c.querySelector(d)===null&&(s=c.createElement("link"),Ut(s,"link",i),Mt(s),c.head.appendChild(s)))}}function yk(i){$i.D(i),P0("dns-prefetch",i,null)}function gk(i,s){$i.C(i,s),P0("preconnect",i,s)}function bk(i,s,a){$i.L(i,s,a);var c=ro;if(c&&i&&s){var d='link[rel="preload"][as="'+Rn(s)+'"]';s==="image"&&a&&a.imageSrcSet?(d+='[imagesrcset="'+Rn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(d+='[imagesizes="'+Rn(a.imageSizes)+'"]')):d+='[href="'+Rn(i)+'"]';var m=d;switch(s){case"style":m=so(i);break;case"script":m=oo(i)}Nn.has(m)||(i=y({rel:"preload",href:s==="image"&&a&&a.imageSrcSet?void 0:i,as:s},a),Nn.set(m,i),c.querySelector(d)!==null||s==="style"&&c.querySelector(La(m))||s==="script"&&c.querySelector(Va(m))||(s=c.createElement("link"),Ut(s,"link",i),Mt(s),c.head.appendChild(s)))}}function vk(i,s){$i.m(i,s);var a=ro;if(a&&i){var c=s&&typeof s.as=="string"?s.as:"script",d='link[rel="modulepreload"][as="'+Rn(c)+'"][href="'+Rn(i)+'"]',m=d;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":m=oo(i)}if(!Nn.has(m)&&(i=y({rel:"modulepreload",href:i},s),Nn.set(m,i),a.querySelector(d)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Va(m)))return}c=a.createElement("link"),Ut(c,"link",i),Mt(c),a.head.appendChild(c)}}}function Sk(i,s,a){$i.S(i,s,a);var c=ro;if(c&&i){var d=Es(c).hoistableStyles,m=so(i);s=s||"default";var b=d.get(m);if(!b){var w={loading:0,preload:null};if(b=c.querySelector(La(m)))w.loading=5;else{i=y({rel:"stylesheet",href:i,"data-precedence":s},a),(a=Nn.get(m))&&$h(i,a);var E=b=c.createElement("link");Mt(E),Ut(E,"link",i),E._p=new Promise(function($,K){E.onload=$,E.onerror=K}),E.addEventListener("load",function(){w.loading|=1}),E.addEventListener("error",function(){w.loading|=2}),w.loading|=4,zc(b,s,c)}b={type:"stylesheet",instance:b,count:1,state:w},d.set(m,b)}}}function wk(i,s){$i.X(i,s);var a=ro;if(a&&i){var c=Es(a).hoistableScripts,d=oo(i),m=c.get(d);m||(m=a.querySelector(Va(d)),m||(i=y({src:i,async:!0},s),(s=Nn.get(d))&&jh(i,s),m=a.createElement("script"),Mt(m),Ut(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(d,m))}}function xk(i,s){$i.M(i,s);var a=ro;if(a&&i){var c=Es(a).hoistableScripts,d=oo(i),m=c.get(d);m||(m=a.querySelector(Va(d)),m||(i=y({src:i,async:!0,type:"module"},s),(s=Nn.get(d))&&jh(i,s),m=a.createElement("script"),Mt(m),Ut(m,"link",i),a.head.appendChild(m)),m={type:"script",instance:m,count:1,state:null},c.set(d,m))}}function I0(i,s,a,c){var d=(d=le.current)?Uc(d):null;if(!d)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(s=so(a.href),a=Es(d).hoistableStyles,c=a.get(s),c||(c={type:"style",instance:null,count:0,state:null},a.set(s,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){i=so(a.href);var m=Es(d).hoistableStyles,b=m.get(i);if(b||(d=d.ownerDocument||d,b={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},m.set(i,b),(m=d.querySelector(La(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||Tk(d,i,a,b.state))),s&&c===null)throw Error(r(528,""));return b}if(s&&c!==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=oo(a),a=Es(d).hoistableScripts,c=a.get(s),c||(c={type:"script",instance:null,count:0,state:null},a.set(s,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function so(i){return'href="'+Rn(i)+'"'}function La(i){return'link[rel="stylesheet"]['+i+"]"}function H0(i){return y({},i,{"data-precedence":i.precedence,precedence:null})}function Tk(i,s,a,c){i.querySelector('link[rel="preload"][as="style"]['+s+"]")?c.loading=1:(s=i.createElement("link"),c.preload=s,s.addEventListener("load",function(){return c.loading|=1}),s.addEventListener("error",function(){return c.loading|=2}),Ut(s,"link",a),Mt(s),i.head.appendChild(s))}function oo(i){return'[src="'+Rn(i)+'"]'}function Va(i){return"script[async]"+i}function F0(i,s,a){if(s.count++,s.instance===null)switch(s.type){case"style":var c=i.querySelector('style[data-href~="'+Rn(a.href)+'"]');if(c)return s.instance=c,Mt(c),c;var d=y({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return c=(i.ownerDocument||i).createElement("style"),Mt(c),Ut(c,"style",d),zc(c,a.precedence,i),s.instance=c;case"stylesheet":d=so(a.href);var m=i.querySelector(La(d));if(m)return s.state.loading|=4,s.instance=m,Mt(m),m;c=H0(a),(d=Nn.get(d))&&$h(c,d),m=(i.ownerDocument||i).createElement("link"),Mt(m);var b=m;return b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Ut(m,"link",c),s.state.loading|=4,zc(m,a.precedence,i),s.instance=m;case"script":return m=oo(a.src),(d=i.querySelector(Va(m)))?(s.instance=d,Mt(d),d):(c=a,(d=Nn.get(m))&&(c=y({},a),jh(c,d)),i=i.ownerDocument||i,d=i.createElement("script"),Mt(d),Ut(d,"link",c),i.head.appendChild(d),s.instance=d);case"void":return null;default:throw Error(r(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(c=s.instance,s.state.loading|=4,zc(c,a.precedence,i));return s.instance}function zc(i,s,a){for(var c=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),d=c.length?c[c.length-1]:null,m=d,b=0;b<c.length;b++){var w=c[b];if(w.dataset.precedence===s)m=w;else if(m!==d)break}m?m.parentNode.insertBefore(i,m.nextSibling):(s=a.nodeType===9?a.head:a,s.insertBefore(i,s.firstChild))}function $h(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.title==null&&(i.title=s.title)}function jh(i,s){i.crossOrigin==null&&(i.crossOrigin=s.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=s.referrerPolicy),i.integrity==null&&(i.integrity=s.integrity)}var Kc=null;function G0(i,s,a){if(Kc===null){var c=new Map,d=Kc=new Map;d.set(a,c)}else d=Kc,c=d.get(a),c||(c=new Map,d.set(a,c));if(c.has(i))return c;for(c.set(i,null),a=a.getElementsByTagName(i),d=0;d<a.length;d++){var m=a[d];if(!(m[Zo]||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 w=c.get(b);w?w.push(m):c.set(b,[m])}}return c}function Y0(i,s,a){i=i.ownerDocument||i,i.head.insertBefore(a,s==="title"?i.querySelector("head > title"):null)}function Ak(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 X0(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}var Ua=null;function Ek(){}function Rk(i,s,a){if(Ua===null)throw Error(r(475));var c=Ua;if(s.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var d=so(a.href),m=i.querySelector(La(d));if(m){i=m._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(c.count++,c=qc.bind(c),i.then(c,c)),s.state.loading|=4,s.instance=m,Mt(m);return}m=i.ownerDocument||i,a=H0(a),(d=Nn.get(d))&&$h(a,d),m=m.createElement("link"),Mt(m);var b=m;b._p=new Promise(function(w,E){b.onload=w,b.onerror=E}),Ut(m,"link",a),s.instance=m}c.stylesheets===null&&(c.stylesheets=new Map),c.stylesheets.set(s,i),(i=s.state.preload)&&(s.state.loading&3)===0&&(c.count++,s=qc.bind(c),i.addEventListener("load",s),i.addEventListener("error",s))}}function Ok(){if(Ua===null)throw Error(r(475));var i=Ua;return i.stylesheets&&i.count===0&&Bh(i,i.stylesheets),0<i.count?function(s){var a=setTimeout(function(){if(i.stylesheets&&Bh(i,i.stylesheets),i.unsuspend){var c=i.unsuspend;i.unsuspend=null,c()}},6e4);return i.unsuspend=s,function(){i.unsuspend=null,clearTimeout(a)}}:null}function qc(){if(this.count--,this.count===0){if(this.stylesheets)Bh(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Pc=null;function Bh(i,s){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Pc=new Map,s.forEach(_k,i),Pc=null,qc.call(i))}function _k(i,s){if(!(s.state.loading&4)){var a=Pc.get(i);if(a)var c=a.get(null);else{a=new Map,Pc.set(i,a);for(var d=i.querySelectorAll("link[data-precedence],style[data-precedence]"),m=0;m<d.length;m++){var b=d[m];(b.nodeName==="LINK"||b.getAttribute("media")!=="not all")&&(a.set(b.dataset.precedence,b),c=b)}c&&a.set(null,c)}d=s.instance,b=d.getAttribute("data-precedence"),m=a.get(b)||c,m===c&&a.set(null,d),a.set(b,d),this.count++,c=qc.bind(this),d.addEventListener("load",c),d.addEventListener("error",c),m?m.parentNode.insertBefore(d,m.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(d,i.firstChild)),s.state.loading|=4}}var za={$$typeof:C,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function kk(i,s,a,c,d,m,b,w){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=Df(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Df(0),this.hiddenUpdates=Df(null),this.identifierPrefix=c,this.onUncaughtError=d,this.onCaughtError=m,this.onRecoverableError=b,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function J0(i,s,a,c,d,m,b,w,E,$,K,H){return i=new kk(i,s,a,b,w,E,$,H),s=1,m===!0&&(s|=24),m=dn(3,null,null,s),i.current=m,m.stateNode=i,s=gd(),s.refCount++,i.pooledCache=s,s.refCount++,m.memoizedState={element:c,isDehydrated:a,cache:s},wd(m),i}function Z0(i){return i?(i=Ls,i):Ls}function Q0(i,s,a,c,d,m){d=Z0(d),c.context===null?c.context=d:c.pendingContext=d,c=tr(s),c.payload={element:a},m=m===void 0?null:m,m!==null&&(c.callback=m),a=nr(i,c,s),a!==null&&(gn(a,i,s),ya(a,i,s))}function W0(i,s){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var a=i.retryLane;i.retryLane=a!==0&&a<s?a:s}}function Lh(i,s){W0(i,s),(i=i.alternate)&&W0(i,s)}function eS(i){if(i.tag===13){var s=Bs(i,67108864);s!==null&&gn(s,i,67108864),Lh(i,67108864)}}var Ic=!0;function Mk(i,s,a,c){var d=B.T;B.T=null;var m=q.p;try{q.p=2,Vh(i,s,a,c)}finally{q.p=m,B.T=d}}function Ck(i,s,a,c){var d=B.T;B.T=null;var m=q.p;try{q.p=8,Vh(i,s,a,c)}finally{q.p=m,B.T=d}}function Vh(i,s,a,c){if(Ic){var d=Uh(c);if(d===null)Eh(i,s,c,Hc,a),nS(i,c);else if(Nk(d,i,s,a,c))c.stopPropagation();else if(nS(i,c),s&4&&-1<Dk.indexOf(i)){for(;d!==null;){var m=As(d);if(m!==null)switch(m.tag){case 3:if(m=m.stateNode,m.current.memoizedState.isDehydrated){var b=Vr(m.pendingLanes);if(b!==0){var w=m;for(w.pendingLanes|=2,w.entangledLanes|=2;b;){var E=1<<31-un(b);w.entanglements[1]|=E,b&=~E}ri(m),(Be&6)===0&&(_c=xe()+500,Na(0))}}break;case 13:w=Bs(m,2),w!==null&&gn(w,m,2),Mc(),Lh(m,2)}if(m=Uh(c),m===null&&Eh(i,s,c,Hc,a),m===d)break;d=m}d!==null&&c.stopPropagation()}else Eh(i,s,c,null,a)}}function Uh(i){return i=If(i),zh(i)}var Hc=null;function zh(i){if(Hc=null,i=Ts(i),i!==null){var s=l(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 Hc=i,null}function tS(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(Kn()){case Gt:return 2;case Kt:return 8;case Tn:case Qn:return 32;case An:return 268435456;default:return 32}default:return 32}}var Kh=!1,mr=null,yr=null,gr=null,Ka=new Map,qa=new Map,br=[],Dk="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 nS(i,s){switch(i){case"focusin":case"focusout":mr=null;break;case"dragenter":case"dragleave":yr=null;break;case"mouseover":case"mouseout":gr=null;break;case"pointerover":case"pointerout":Ka.delete(s.pointerId);break;case"gotpointercapture":case"lostpointercapture":qa.delete(s.pointerId)}}function Pa(i,s,a,c,d,m){return i===null||i.nativeEvent!==m?(i={blockedOn:s,domEventName:a,eventSystemFlags:c,nativeEvent:m,targetContainers:[d]},s!==null&&(s=As(s),s!==null&&eS(s)),i):(i.eventSystemFlags|=c,s=i.targetContainers,d!==null&&s.indexOf(d)===-1&&s.push(d),i)}function Nk(i,s,a,c,d){switch(s){case"focusin":return mr=Pa(mr,i,s,a,c,d),!0;case"dragenter":return yr=Pa(yr,i,s,a,c,d),!0;case"mouseover":return gr=Pa(gr,i,s,a,c,d),!0;case"pointerover":var m=d.pointerId;return Ka.set(m,Pa(Ka.get(m)||null,i,s,a,c,d)),!0;case"gotpointercapture":return m=d.pointerId,qa.set(m,Pa(qa.get(m)||null,i,s,a,c,d)),!0}return!1}function iS(i){var s=Ts(i.target);if(s!==null){var a=l(s);if(a!==null){if(s=a.tag,s===13){if(s=u(a),s!==null){i.blockedOn=s,RO(i.priority,function(){if(a.tag===13){var c=yn();c=Nf(c);var d=Bs(a,c);d!==null&&gn(d,a,c),Lh(a,c)}});return}}else if(s===3&&a.stateNode.current.memoizedState.isDehydrated){i.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Fc(i){if(i.blockedOn!==null)return!1;for(var s=i.targetContainers;0<s.length;){var a=Uh(i.nativeEvent);if(a===null){a=i.nativeEvent;var c=new a.constructor(a.type,a);Pf=c,a.target.dispatchEvent(c),Pf=null}else return s=As(a),s!==null&&eS(s),i.blockedOn=a,!1;s.shift()}return!0}function rS(i,s,a){Fc(i)&&a.delete(s)}function $k(){Kh=!1,mr!==null&&Fc(mr)&&(mr=null),yr!==null&&Fc(yr)&&(yr=null),gr!==null&&Fc(gr)&&(gr=null),Ka.forEach(rS),qa.forEach(rS)}function Gc(i,s){i.blockedOn===s&&(i.blockedOn=null,Kh||(Kh=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,$k)))}var Yc=null;function sS(i){Yc!==i&&(Yc=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Yc===i&&(Yc=null);for(var s=0;s<i.length;s+=3){var a=i[s],c=i[s+1],d=i[s+2];if(typeof c!="function"){if(zh(c||a)===null)continue;break}var m=As(a);m!==null&&(i.splice(s,3),s-=3,zd(m,{pending:!0,data:d,method:a.method,action:c},c,d))}}))}function Ia(i){function s(E){return Gc(E,i)}mr!==null&&Gc(mr,i),yr!==null&&Gc(yr,i),gr!==null&&Gc(gr,i),Ka.forEach(s),qa.forEach(s);for(var a=0;a<br.length;a++){var c=br[a];c.blockedOn===i&&(c.blockedOn=null)}for(;0<br.length&&(a=br[0],a.blockedOn===null);)iS(a),a.blockedOn===null&&br.shift();if(a=(i.ownerDocument||i).$$reactFormReplay,a!=null)for(c=0;c<a.length;c+=3){var d=a[c],m=a[c+1],b=d[Qt]||null;if(typeof m=="function")b||sS(a);else if(b){var w=null;if(m&&m.hasAttribute("formAction")){if(d=m,b=m[Qt]||null)w=b.formAction;else if(zh(d)!==null)continue}else w=b.action;typeof w=="function"?a[c+1]=w:(a.splice(c,3),c-=3),sS(a)}}}function qh(i){this._internalRoot=i}Xc.prototype.render=qh.prototype.render=function(i){var s=this._internalRoot;if(s===null)throw Error(r(409));var a=s.current,c=yn();Q0(a,c,i,s,null,null)},Xc.prototype.unmount=qh.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var s=i.containerInfo;Q0(i.current,2,null,i,null,null),Mc(),s[xs]=null}};function Xc(i){this._internalRoot=i}Xc.prototype.unstable_scheduleHydration=function(i){if(i){var s=xg();i={blockedOn:null,target:i,priority:s};for(var a=0;a<br.length&&s!==0&&s<br[a].priority;a++);br.splice(a,0,i),a===0&&iS(i)}};var oS=e.version;if(oS!=="19.1.1")throw Error(r(527,oS,"19.1.1"));q.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 jk={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:B,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Jc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Jc.isDisabled&&Jc.supportsFiber)try{Yo=Jc.inject(jk),cn=Jc}catch{}}return Fa.createRoot=function(i,s){if(!o(i))throw Error(r(299));var a=!1,c="",d=xv,m=Tv,b=Av,w=null;return s!=null&&(s.unstable_strictMode===!0&&(a=!0),s.identifierPrefix!==void 0&&(c=s.identifierPrefix),s.onUncaughtError!==void 0&&(d=s.onUncaughtError),s.onCaughtError!==void 0&&(m=s.onCaughtError),s.onRecoverableError!==void 0&&(b=s.onRecoverableError),s.unstable_transitionCallbacks!==void 0&&(w=s.unstable_transitionCallbacks)),s=J0(i,1,!1,null,null,a,c,d,m,b,w,null),i[xs]=s.current,Ah(i),new qh(s)},Fa.hydrateRoot=function(i,s,a){if(!o(i))throw Error(r(299));var c=!1,d="",m=xv,b=Tv,w=Av,E=null,$=null;return a!=null&&(a.unstable_strictMode===!0&&(c=!0),a.identifierPrefix!==void 0&&(d=a.identifierPrefix),a.onUncaughtError!==void 0&&(m=a.onUncaughtError),a.onCaughtError!==void 0&&(b=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(E=a.unstable_transitionCallbacks),a.formState!==void 0&&($=a.formState)),s=J0(i,1,!0,s,a??null,c,d,m,b,w,E,$),s.context=Z0(null),a=s.current,c=yn(),c=Nf(c),d=tr(c),d.callback=null,nr(a,d,c),a=c,s.current.lanes=a,Jo(s,a),ri(s),i[xs]=s.current,Ah(i),new Xc(s)},Fa.version="19.1.1",Fa}var wS;function tC(){if(wS)return Gh.exports;wS=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(),Gh.exports=eC(),Gh.exports}var nC=tC();function af(){return typeof window<"u"}function Br(t){return H1(t)?(t.nodeName||"").toLowerCase():"#document"}function Sn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mi(t){var e;return(e=(H1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function H1(t){return af()?t instanceof Node||t instanceof Sn(t).Node:!1}function pt(t){return af()?t instanceof Element||t instanceof Sn(t).Element:!1}function _t(t){return af()?t instanceof HTMLElement||t instanceof Sn(t).HTMLElement:!1}function qp(t){return!af()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Sn(t).ShadowRoot}const iC=new Set(["inline","contents"]);function wl(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=zn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!iC.has(o)}const rC=new Set(["table","td","th"]);function sC(t){return rC.has(Br(t))}const oC=[":popover-open",":modal"];function lf(t){return oC.some(e=>{try{return t.matches(e)}catch{return!1}})}const aC=["transform","translate","scale","rotate","perspective"],lC=["transform","translate","scale","rotate","perspective","filter"],cC=["paint","layout","strict","content"];function cy(t){const e=cf(),n=pt(t)?zn(t):t;return aC.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)||lC.some(r=>(n.willChange||"").includes(r))||cC.some(r=>(n.contain||"").includes(r))}function uC(t){let e=Ki(t);for(;_t(e)&&!Ui(e);){if(cy(e))return e;if(lf(e))return null;e=Ki(e)}return null}function cf(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const fC=new Set(["html","body","#document"]);function Ui(t){return fC.has(Br(t))}function zn(t){return Sn(t).getComputedStyle(t)}function uf(t){return pt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ki(t){if(Br(t)==="html")return t;const e=t.assignedSlot||t.parentNode||qp(t)&&t.host||mi(t);return qp(e)?e.host:e}function F1(t){const e=Ki(t);return Ui(e)?t.ownerDocument?t.ownerDocument.body:t.body:_t(e)&&wl(e)?e:F1(e)}function Or(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=F1(t),l=o===((r=t.ownerDocument)==null?void 0:r.body),u=Sn(o);if(l){const f=Pp(u);return e.concat(u,u.visualViewport||[],wl(o)?o:[],f&&n?Or(f):[])}return e.concat(o,Or(o,[],n))}function Pp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const Mu=Math.min,cs=Math.max,Cu=Math.round,Qc=Math.floor,li=t=>({x:t,y:t}),dC={left:"right",right:"left",bottom:"top",top:"bottom"},hC={start:"end",end:"start"};function xS(t,e,n){return cs(t,Mu(e,n))}function ff(t,e){return typeof t=="function"?t(e):t}function hs(t){return t.split("-")[0]}function df(t){return t.split("-")[1]}function G1(t){return t==="x"?"y":"x"}function Y1(t){return t==="y"?"height":"width"}const pC=new Set(["top","bottom"]);function Ar(t){return pC.has(hs(t))?"y":"x"}function X1(t){return G1(Ar(t))}function mC(t,e,n){n===void 0&&(n=!1);const r=df(t),o=X1(t),l=Y1(o);let u=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[l]>e.floating[l]&&(u=Du(u)),[u,Du(u)]}function yC(t){const e=Du(t);return[Ip(t),e,Ip(e)]}function Ip(t){return t.replace(/start|end/g,e=>hC[e])}const TS=["left","right"],AS=["right","left"],gC=["top","bottom"],bC=["bottom","top"];function vC(t,e,n){switch(t){case"top":case"bottom":return n?e?AS:TS:e?TS:AS;case"left":case"right":return e?gC:bC;default:return[]}}function SC(t,e,n,r){const o=df(t);let l=vC(hs(t),n==="start",r);return o&&(l=l.map(u=>u+"-"+o),e&&(l=l.concat(l.map(Ip)))),l}function Du(t){return t.replace(/left|right|bottom|top/g,e=>dC[e])}function wC(t){return{top:0,right:0,bottom:0,left:0,...t}}function xC(t){return typeof t!="number"?wC(t):{top:t,right:t,bottom:t,left:t}}function Nu(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
62
|
* tabbable 6.2.0
|
|
63
63
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
64
|
-
*/var TC=["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])"],$u=TC.join(","),J1=typeof Element>"u",Mo=J1?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ju=!J1&&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},Bu=function t(e,n){var s;n===void 0&&(n=!0);var o=e==null||(s=e.getAttribute)===null||s===void 0?void 0:s.call(e,"inert"),l=o===""||o==="true",u=l||n&&e&&t(e.parentNode);return u},AC=function(e){var n,s=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return s===""||s==="true"},Z1=function(e,n,s){if(Bu(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll($u));return n&&Mo.call(e,$u)&&o.unshift(e),o=o.filter(s),o},Q1=function t(e,n,s){for(var o=[],l=Array.from(e);l.length;){var u=l.shift();if(!Bu(u,!1))if(u.tagName==="SLOT"){var d=u.assignedElements(),h=d.length?d:u.children,p=t(h,!0,s);s.flatten?o.push.apply(o,p):o.push({scopeParent:u,candidates:p})}else{var y=Mo.call(u,$u);y&&s.filter(u)&&(n||!e.includes(u))&&o.push(u);var g=u.shadowRoot||typeof s.getShadowRoot=="function"&&s.getShadowRoot(u),v=!Bu(g,!1)&&(!s.shadowRootFilter||s.shadowRootFilter(u));if(g&&v){var S=t(g===!0?u.children:g.children,!0,s);s.flatten?o.push.apply(o,S):o.push({scopeParent:u,candidates:S})}else l.unshift.apply(l,u.children)}}return o},W1=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},eT=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||AC(e))&&!W1(e)?0:e.tabIndex},EC=function(e,n){var s=eT(e);return s<0&&n&&!W1(e)?0:s},RC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},tT=function(e){return e.tagName==="INPUT"},OC=function(e){return tT(e)&&e.type==="hidden"},_C=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(s){return s.tagName==="SUMMARY"});return n},kC=function(e,n){for(var s=0;s<e.length;s++)if(e[s].checked&&e[s].form===n)return e[s]},MC=function(e){if(!e.name)return!0;var n=e.form||ju(e),s=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=s(window.CSS.escape(e.name));else try{o=s(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 l=kC(o,e.form);return!l||l===e},CC=function(e){return tT(e)&&e.type==="radio"},DC=function(e){return CC(e)&&!MC(e)},NC=function(e){var n,s=e&&ju(e),o=(n=s)===null||n===void 0?void 0:n.host,l=!1;if(s&&s!==e){var u,d,h;for(l=!!((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));!l&&o;){var p,y,g;s=ju(o),o=(p=s)===null||p===void 0?void 0:p.host,l=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return l},ES=function(e){var n=e.getBoundingClientRect(),s=n.width,o=n.height;return s===0&&o===0},$C=function(e,n){var s=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var l=Mo.call(e,"details>summary:first-of-type"),u=l?e.parentElement:e;if(Mo.call(u,"details:not([open]) *"))return!0;if(!s||s==="full"||s==="legacy-full"){if(typeof o=="function"){for(var d=e;e;){var h=e.parentElement,p=ju(e);if(h&&!h.shadowRoot&&o(h)===!0)return ES(e);e.assignedSlot?e=e.assignedSlot:!h&&p!==e.ownerDocument?e=p.host:e=h}e=d}if(NC(e))return!e.getClientRects().length;if(s!=="legacy-full")return!0}else if(s==="non-zero-area")return ES(e);return!1},jC=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var s=0;s<n.children.length;s++){var o=n.children.item(s);if(o.tagName==="LEGEND")return Mo.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Hp=function(e,n){return!(n.disabled||Bu(n)||OC(n)||$C(n,e)||_C(n)||jC(n))},Fp=function(e,n){return!(DC(n)||eT(n)<0||!Hp(e,n))},BC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},LC=function t(e){var n=[],s=[];return e.forEach(function(o,l){var u=!!o.scopeParent,d=u?o.scopeParent:o,h=EC(d,u),p=u?t(o.candidates):d;h===0?u?n.push.apply(n,p):n.push(d):s.push({documentOrder:l,tabIndex:h,item:o,isScope:u,content:p})}),s.sort(RC).reduce(function(o,l){return l.isScope?o.push.apply(o,l.content):o.push(l.content),o},[]).concat(n)},uy=function(e,n){n=n||{};var s;return n.getShadowRoot?s=Q1([e],n.includeContainer,{filter:Fp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:BC}):s=Z1(e,n.includeContainer,Fp.bind(null,n)),LC(s)},VC=function(e,n){n=n||{};var s;return n.getShadowRoot?s=Q1([e],n.includeContainer,{filter:Hp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):s=Z1(e,n.includeContainer,Hp.bind(null,n)),s},nT=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Mo.call(e,$u)===!1?!1:Fp(n,e)};function UC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function iT(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:s}=e;return n+"/"+s}).join(" "):navigator.userAgent}function zC(){return/apple/i.test(navigator.vendor)}function Gp(){const t=/android/i;return t.test(UC())||t.test(iT())}function KC(){return iT().includes("jsdom/")}const RS="data-floating-ui-focusable",qC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fo(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 bn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&qp(n)){let s=e;for(;s;){if(t===s)return!0;s=s.parentNode||s.host}}return!1}function xs(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Zh(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 PC(t){return t.matches("html,body")}function Yn(t){return t?.ownerDocument||document}function sT(t){return _t(t)&&t.matches(qC)}function OS(t){return t?t.getAttribute("role")==="combobox"&&sT(t):!1}function Yp(t){return t?t.hasAttribute(RS)?t:t.querySelector("["+RS+"]")||t:null}function wo(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var l;return o.parentId===e&&(!n||((l=o.context)==null?void 0:l.open))}).flatMap(o=>[o,...wo(t,o.id,n)])}function _S(t,e){var n;let s=[],o=(n=t.find(l=>l.id===e))==null?void 0:n.parentId;for(;o;){const l=t.find(u=>u.id===o);o=l?.parentId,l&&(s=s.concat(l))}return s}function Qh(t){t.preventDefault(),t.stopPropagation()}function IC(t){return"nativeEvent"in t}function HC(t){return t.mozInputSource===0&&t.isTrusted?!0:Gp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function FC(t){return KC()?!1:!Gp()&&t.width===0&&t.height===0||Gp()&&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 kS(t,e){return["mouse","pen"].includes(t)}var GC=typeof document<"u",YC=function(){},Li=GC?V.useLayoutEffect:YC;const XC={...U1};function Wh(t){const e=V.useRef(t);return Li(()=>{e.current=t}),e}const JC=XC.useInsertionEffect,ZC=JC||(t=>t());function ri(t){const e=V.useRef(()=>{});return ZC(()=>{e.current=t}),V.useCallback(function(){for(var n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];return e.current==null?void 0:e.current(...s)},[])}const hf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function rT(t,e){const n=uy(t,hf()),s=n.length;if(s===0)return;const o=fo(Yn(t)),l=n.indexOf(o),u=l===-1?e===1?0:s-1:l+e;return n[u]}function QC(t){return rT(Yn(t).body,1)||t}function WC(t){return rT(Yn(t).body,-1)||t}function MS(t,e){const n=e||t.currentTarget,s=t.relatedTarget;return!s||!bn(n,s)}var eD=I1();function CS(t,e,n){let{reference:s,floating:o}=t;const l=As(e),u=X1(e),d=Y1(u),h=hr(e),p=l==="y",y=s.x+s.width/2-o.width/2,g=s.y+s.height/2-o.height/2,v=s[d]/2-o[d]/2;let S;switch(h){case"top":S={x:y,y:s.y-o.height};break;case"bottom":S={x:y,y:s.y+s.height};break;case"right":S={x:s.x+s.width,y:g};break;case"left":S={x:s.x-o.width,y:g};break;default:S={x:s.x,y:s.y}}switch(df(e)){case"start":S[u]-=v*(n&&p?-1:1);break;case"end":S[u]+=v*(n&&p?-1:1);break}return S}const tD=async(t,e,n)=>{const{placement:s="bottom",strategy:o="absolute",middleware:l=[],platform:u}=n,d=l.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}=CS(p,s,h),v=s,S={},x=0;for(let T=0;T<d.length;T++){const{name:D,fn:M}=d[T],{x:O,y:C,data:j,reset:_}=await M({x:y,y:g,initialPlacement:s,placement:v,strategy:o,middlewareData:S,rects:p,platform:u,elements:{reference:t,floating:e}});y=O??y,g=C??g,S={...S,[D]:{...S[D],...j}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(v=_.placement),_.rects&&(p=_.rects===!0?await u.getElementRects({reference:t,floating:e,strategy:o}):_.rects),{x:y,y:g}=CS(p,v,h)),T=-1)}return{x:y,y:g,placement:v,strategy:o,middlewareData:S}};async function oT(t,e){var n;e===void 0&&(e={});const{x:s,y:o,platform:l,rects:u,elements:d,strategy:h}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:S=0}=ff(e,t),x=xC(S),D=d[v?g==="floating"?"reference":"floating":g],M=Nu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(D)))==null||n?D:D.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(d.floating)),boundary:p,rootBoundary:y,strategy:h})),O=g==="floating"?{x:s,y:o,width:u.floating.width,height:u.floating.height}:u.reference,C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(d.floating)),j=await(l.isElement==null?void 0:l.isElement(C))?await(l.getScale==null?void 0:l.getScale(C))||{x:1,y:1}:{x:1,y:1},_=Nu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:d,rect:O,offsetParent:C,strategy:h}):O);return{top:(M.top-_.top+x.top)/j.y,bottom:(_.bottom-M.bottom+x.bottom)/j.y,left:(M.left-_.left+x.left)/j.x,right:(_.right-M.right+x.right)/j.x}}const nD=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,s;const{placement:o,middlewareData:l,rects:u,initialPlacement:d,platform:h,elements:p}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:T=!0,...D}=ff(t,e);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const M=hr(o),O=As(d),C=hr(d)===d,j=await(h.isRTL==null?void 0:h.isRTL(p.floating)),_=v||(C||!T?[Du(d)]:yC(d)),J=x!=="none";!v&&J&&_.push(...SC(d,T,x,j));const Y=[d,..._],F=await oT(e,D),ee=[];let se=((s=l.flip)==null?void 0:s.overflows)||[];if(y&&ee.push(F[M]),g){const Q=mC(o,u,j);ee.push(F[Q[0]],F[Q[1]])}if(se=[...se,{placement:o,overflows:ee}],!ee.every(Q=>Q<=0)){var ue,ge;const Q=(((ue=l.flip)==null?void 0:ue.index)||0)+1,W=Y[Q];if(W&&(!(g==="alignment"?O!==As(W):!1)||se.every(z=>As(z.placement)===O?z.overflows[0]>0:!0)))return{data:{index:Q,overflows:se},reset:{placement:W}};let B=(ge=se.filter(q=>q.overflows[0]<=0).sort((q,z)=>q.overflows[1]-z.overflows[1])[0])==null?void 0:ge.placement;if(!B)switch(S){case"bestFit":{var be;const q=(be=se.filter(z=>{if(J){const ne=As(z.placement);return ne===O||ne==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ne=>ne>0).reduce((ne,A)=>ne+A,0)]).sort((z,ne)=>z[1]-ne[1])[0])==null?void 0:be[0];q&&(B=q);break}case"initialPlacement":B=d;break}if(o!==B)return{reset:{placement:B}}}return{}}}},iD=new Set(["left","top"]);async function sD(t,e){const{placement:n,platform:s,elements:o}=t,l=await(s.isRTL==null?void 0:s.isRTL(o.floating)),u=hr(n),d=df(n),h=As(n)==="y",p=iD.has(u)?-1:1,y=l&&h?-1:1,g=ff(e,t);let{mainAxis:v,crossAxis:S,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return d&&typeof x=="number"&&(S=d==="end"?x*-1:x),h?{x:S*y,y:v*p}:{x:v*p,y:S*y}}const rD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:o,y:l,placement:u,middlewareData:d}=e,h=await sD(e,t);return u===((n=d.offset)==null?void 0:n.placement)&&(s=d.arrow)!=null&&s.alignmentOffset?{}:{x:o+h.x,y:l+h.y,data:{...h,placement:u}}}}},oD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:o}=e,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:D=>{let{x:M,y:O}=D;return{x:M,y:O}}},...h}=ff(t,e),p={x:n,y:s},y=await oT(e,h),g=As(hr(o)),v=G1(g);let S=p[v],x=p[g];if(l){const D=v==="y"?"top":"left",M=v==="y"?"bottom":"right",O=S+y[D],C=S-y[M];S=xS(O,S,C)}if(u){const D=g==="y"?"top":"left",M=g==="y"?"bottom":"right",O=x+y[D],C=x-y[M];x=xS(O,x,C)}const T=d.fn({...e,[v]:S,[g]:x});return{...T,data:{x:T.x-n,y:T.y-s,enabled:{[v]:l,[g]:u}}}}}};function aT(t){const e=Un(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const o=_t(t),l=o?t.offsetWidth:n,u=o?t.offsetHeight:s,d=Cu(n)!==l||Cu(s)!==u;return d&&(n=l,s=u),{width:n,height:s,$:d}}function fy(t){return pt(t)?t:t.contextElement}function xo(t){const e=fy(t);if(!_t(e))return ai(1);const n=e.getBoundingClientRect(),{width:s,height:o,$:l}=aT(e);let u=(l?Cu(n.width):n.width)/s,d=(l?Cu(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!d||!Number.isFinite(d))&&(d=1),{x:u,y:d}}const aD=ai(0);function lT(t){const e=vn(t);return!cf()||!e.visualViewport?aD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==vn(t)?!1:e}function pr(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),l=fy(t);let u=ai(1);e&&(s?pt(s)&&(u=xo(s)):u=xo(t));const d=lD(l,n,s)?lT(l):ai(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(l){const v=vn(l),S=s&&pt(s)?vn(s):s;let x=v,T=Pp(x);for(;T&&s&&S!==x;){const D=xo(T),M=T.getBoundingClientRect(),O=Un(T),C=M.left+(T.clientLeft+parseFloat(O.paddingLeft))*D.x,j=M.top+(T.clientTop+parseFloat(O.paddingTop))*D.y;h*=D.x,p*=D.y,y*=D.x,g*=D.y,h+=C,p+=j,x=vn(T),T=Pp(x)}}return Nu({width:y,height:g,x:h,y:p})}function pf(t,e){const n=uf(t).scrollLeft;return e?e.left+n:pr(pi(t)).left+n}function cT(t,e){const n=t.getBoundingClientRect(),s=n.left+e.scrollLeft-pf(t,n),o=n.top+e.scrollTop;return{x:s,y:o}}function cD(t){let{elements:e,rect:n,offsetParent:s,strategy:o}=t;const l=o==="fixed",u=pi(s),d=e?lf(e.floating):!1;if(s===u||d&&l)return n;let h={scrollLeft:0,scrollTop:0},p=ai(1);const y=ai(0),g=_t(s);if((g||!g&&!l)&&((Bs(s)!=="body"||wl(u))&&(h=uf(s)),_t(s))){const S=pr(s);p=xo(s),y.x=S.x+s.clientLeft,y.y=S.y+s.clientTop}const v=u&&!g&&!l?cT(u,h):ai(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 uD(t){return Array.from(t.getClientRects())}function fD(t){const e=pi(t),n=uf(t),s=t.ownerDocument.body,o=cr(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),l=cr(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let u=-n.scrollLeft+pf(t);const d=-n.scrollTop;return Un(s).direction==="rtl"&&(u+=cr(e.clientWidth,s.clientWidth)-o),{width:o,height:l,x:u,y:d}}const DS=25;function dD(t,e){const n=vn(t),s=pi(t),o=n.visualViewport;let l=s.clientWidth,u=s.clientHeight,d=0,h=0;if(o){l=o.width,u=o.height;const y=cf();(!y||y&&e==="fixed")&&(d=o.offsetLeft,h=o.offsetTop)}const p=pf(s);if(p<=0){const y=s.ownerDocument,g=y.body,v=getComputedStyle(g),S=y.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(s.clientWidth-g.clientWidth-S);x<=DS&&(l-=x)}else p<=DS&&(l+=p);return{width:l,height:u,x:d,y:h}}const hD=new Set(["absolute","fixed"]);function pD(t,e){const n=pr(t,!0,e==="fixed"),s=n.top+t.clientTop,o=n.left+t.clientLeft,l=_t(t)?xo(t):ai(1),u=t.clientWidth*l.x,d=t.clientHeight*l.y,h=o*l.x,p=s*l.y;return{width:u,height:d,x:h,y:p}}function NS(t,e,n){let s;if(e==="viewport")s=dD(t,n);else if(e==="document")s=fD(pi(t));else if(pt(e))s=pD(e,n);else{const o=lT(t);s={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Nu(s)}function uT(t,e){const n=Ki(t);return n===e||!pt(n)||Vi(n)?!1:Un(n).position==="fixed"||uT(n,e)}function mD(t,e){const n=e.get(t);if(n)return n;let s=Os(t,[],!1).filter(d=>pt(d)&&Bs(d)!=="body"),o=null;const l=Un(t).position==="fixed";let u=l?Ki(t):t;for(;pt(u)&&!Vi(u);){const d=Un(u),h=cy(u);!h&&d.position==="fixed"&&(o=null),(l?!h&&!o:!h&&d.position==="static"&&!!o&&hD.has(o.position)||wl(u)&&!h&&uT(t,u))?s=s.filter(y=>y!==u):o=d,u=Ki(u)}return e.set(t,s),s}function yD(t){let{element:e,boundary:n,rootBoundary:s,strategy:o}=t;const u=[...n==="clippingAncestors"?lf(e)?[]:mD(e,this._c):[].concat(n),s],d=u[0],h=u.reduce((p,y)=>{const g=NS(e,y,o);return p.top=cr(g.top,p.top),p.right=Mu(g.right,p.right),p.bottom=Mu(g.bottom,p.bottom),p.left=cr(g.left,p.left),p},NS(e,d,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function gD(t){const{width:e,height:n}=aT(t);return{width:e,height:n}}function bD(t,e,n){const s=_t(e),o=pi(e),l=n==="fixed",u=pr(t,!0,l,e);let d={scrollLeft:0,scrollTop:0};const h=ai(0);function p(){h.x=pf(o)}if(s||!s&&!l)if((Bs(e)!=="body"||wl(o))&&(d=uf(e)),s){const S=pr(e,!0,l,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else o&&p();l&&!s&&o&&p();const y=o&&!s&&!l?cT(o,d):ai(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 ep(t){return Un(t).position==="static"}function $S(t,e){if(!_t(t)||Un(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return pi(t)===n&&(n=n.ownerDocument.body),n}function fT(t,e){const n=vn(t);if(lf(t))return n;if(!_t(t)){let o=Ki(t);for(;o&&!Vi(o);){if(pt(o)&&!ep(o))return o;o=Ki(o)}return n}let s=$S(t,e);for(;s&&rC(s)&&ep(s);)s=$S(s,e);return s&&Vi(s)&&ep(s)&&!cy(s)?n:s||uC(t)||n}const vD=async function(t){const e=this.getOffsetParent||fT,n=this.getDimensions,s=await n(t.floating);return{reference:bD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function SD(t){return Un(t).direction==="rtl"}const wD={convertOffsetParentRelativeRectToViewportRelativeRect:cD,getDocumentElement:pi,getClippingRect:yD,getOffsetParent:fT,getElementRects:vD,getClientRects:uD,getDimensions:gD,getScale:xo,isElement:pt,isRTL:SD};function dT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xD(t,e){let n=null,s;const o=pi(t);function l(){var d;clearTimeout(s),(d=n)==null||d.disconnect(),n=null}function u(d,h){d===void 0&&(d=!1),h===void 0&&(h=1),l();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:S}=p;if(d||e(),!v||!S)return;const x=Qc(g),T=Qc(o.clientWidth-(y+v)),D=Qc(o.clientHeight-(g+S)),M=Qc(y),C={rootMargin:-x+"px "+-T+"px "+-D+"px "+-M+"px",threshold:cr(0,Mu(1,h))||1};let j=!0;function _(J){const Y=J[0].intersectionRatio;if(Y!==h){if(!j)return u();Y?u(!1,Y):s=setTimeout(()=>{u(!1,1e-7)},1e3)}Y===1&&!dT(p,t.getBoundingClientRect())&&u(),j=!1}try{n=new IntersectionObserver(_,{...C,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,C)}n.observe(t)}return u(!0),l}function TD(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:d=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=fy(t),y=o||l?[...p?Os(p):[],...Os(e)]:[];y.forEach(M=>{o&&M.addEventListener("scroll",n,{passive:!0}),l&&M.addEventListener("resize",n)});const g=p&&d?xD(p,n):null;let v=-1,S=null;u&&(S=new ResizeObserver(M=>{let[O]=M;O&&O.target===p&&S&&(S.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=S)==null||C.observe(e)})),n()}),p&&!h&&S.observe(p),S.observe(e));let x,T=h?pr(t):null;h&&D();function D(){const M=pr(t);T&&!dT(T,M)&&n(),T=M,x=requestAnimationFrame(D)}return n(),()=>{var M;y.forEach(O=>{o&&O.removeEventListener("scroll",n),l&&O.removeEventListener("resize",n)}),g?.(),(M=S)==null||M.disconnect(),S=null,h&&cancelAnimationFrame(x)}}const AD=rD,ED=oD,RD=nD,OD=(t,e,n)=>{const s=new Map,o={platform:wD,...n},l={...o.platform,_c:s};return tD(t,e,{...o,platform:l})};var _D=typeof document<"u",kD=function(){},pu=_D?V.useLayoutEffect:kD;function Lu(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,s,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(s=n;s--!==0;)if(!Lu(t[s],e[s]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(e,o[s]))return!1;for(s=n;s--!==0;){const l=o[s];if(!(l==="_owner"&&t.$$typeof)&&!Lu(t[l],e[l]))return!1}return!0}return t!==t&&e!==e}function hT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function jS(t,e){const n=hT(t);return Math.round(e*n)/n}function tp(t){const e=V.useRef(t);return pu(()=>{e.current=t}),e}function MD(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:o,elements:{reference:l,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(s);Lu(v,s)||S(s);const[x,T]=V.useState(null),[D,M]=V.useState(null),O=V.useCallback(z=>{z!==J.current&&(J.current=z,T(z))},[]),C=V.useCallback(z=>{z!==Y.current&&(Y.current=z,M(z))},[]),j=l||x,_=u||D,J=V.useRef(null),Y=V.useRef(null),F=V.useRef(y),ee=h!=null,se=tp(h),ue=tp(o),ge=tp(p),be=V.useCallback(()=>{if(!J.current||!Y.current)return;const z={placement:e,strategy:n,middleware:v};ue.current&&(z.platform=ue.current),OD(J.current,Y.current,z).then(ne=>{const A={...ne,isPositioned:ge.current!==!1};Q.current&&!Lu(F.current,A)&&(F.current=A,eD.flushSync(()=>{g(A)}))})},[v,e,n,ue,ge]);pu(()=>{p===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[p]);const Q=V.useRef(!1);pu(()=>(Q.current=!0,()=>{Q.current=!1}),[]),pu(()=>{if(j&&(J.current=j),_&&(Y.current=_),j&&_){if(se.current)return se.current(j,_,be);be()}},[j,_,be,se,ee]);const W=V.useMemo(()=>({reference:J,floating:Y,setReference:O,setFloating:C}),[O,C]),B=V.useMemo(()=>({reference:j,floating:_}),[j,_]),q=V.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const ne=jS(B.floating,y.x),A=jS(B.floating,y.y);return d?{...z,transform:"translate("+ne+"px, "+A+"px)",...hT(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:A}},[n,d,B.floating,y.x,y.y]);return V.useMemo(()=>({...y,update:be,refs:W,elements:B,floatingStyles:q}),[y,be,W,B,q])}const CD=(t,e)=>({...AD(t),options:[t,e]}),DD=(t,e)=>({...ED(t),options:[t,e]}),ND=(t,e)=>({...RD(t),options:[t,e]}),$D="data-floating-ui-focusable",BS="active",LS="selected",jD={...U1};let VS=!1,BD=0;const US=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+BD++;function LD(){const[t,e]=V.useState(()=>VS?US():void 0);return Li(()=>{t==null&&e(US())},[]),V.useEffect(()=>{VS=!0},[]),t}const VD=jD.useId,pT=VD||LD;function UD(){const t=new Map;return{emit(e,n){var s;(s=t.get(e))==null||s.forEach(o=>o(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var s;(s=t.get(e))==null||s.delete(n)}}}const zD=V.createContext(null),KD=V.createContext(null),mT=()=>{var t;return((t=V.useContext(zD))==null?void 0:t.id)||null},dy=()=>V.useContext(KD);function Vu(t){return"data-floating-ui-"+t}function qD(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let zS=0;function ao(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:s=!0,sync:o=!1}=e;s&&cancelAnimationFrame(zS);const l=()=>t?.focus({preventScroll:n});o?l():zS=requestAnimationFrame(l)}function PD(t){return t?.ownerDocument||document}const To={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function KS(t){return t==="inert"?To.inert:t==="aria-hidden"?To["aria-hidden"]:To.none}let Wc=new WeakSet,eu={},np=0;const ID=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,yT=t=>t&&(t.host||yT(t.parentNode)),HD=(t,e)=>e.map(n=>{if(t.contains(n))return n;const s=yT(n);return t.contains(s)?s:null}).filter(n=>n!=null);function FD(t,e,n,s){const o="data-floating-ui-inert",l=s?"inert":n?"aria-hidden":null,u=HD(e,t),d=new Set,h=new Set(u),p=[];eu[o]||(eu[o]=new WeakMap);const y=eu[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,x=>{if(Bs(x)!=="script")if(d.has(x))v(x);else{const T=l?x.getAttribute(l):null,D=T!==null&&T!=="false",M=KS(l),O=(M.get(x)||0)+1,C=(y.get(x)||0)+1;M.set(x,O),y.set(x,C),p.push(x),O===1&&D&&Wc.add(x),C===1&&x.setAttribute(o,""),!D&&l&&x.setAttribute(l,l==="inert"?"":"true")}})}return np++,()=>{p.forEach(S=>{const x=KS(l),D=(x.get(S)||0)-1,M=(y.get(S)||0)-1;x.set(S,D),y.set(S,M),D||(!Wc.has(S)&&l&&S.removeAttribute(l),Wc.delete(S)),M||S.removeAttribute(o)}),np--,np||(To.inert=new WeakMap,To["aria-hidden"]=new WeakMap,To.none=new WeakMap,Wc=new WeakSet,eu={})}}function qS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=PD(t[0]).body;return FD(t.concat(Array.from(s.querySelectorAll('[aria-live],[role="status"],output'))),s,e,n)}const hy={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},PS=V.forwardRef(function(e,n){const[s,o]=V.useState();Li(()=>{zC()&&o("button")},[]);const l={ref:n,tabIndex:0,role:s,"aria-hidden":s?void 0:!0,[Vu("focus-guard")]:"",style:hy};return G.jsx("span",{...e,...l})}),GD=V.createContext(null),YD=()=>V.useContext(GD);function IS(t){return V.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const XD=20;let Es=[];function py(){Es=Es.filter(t=>t.isConnected)}function JD(t){py(),t&&Bs(t)!=="body"&&(Es.push(t),Es.length>XD&&(Es=Es.slice(-20)))}function HS(){return py(),Es[Es.length-1]}function ZD(t){const e=hf();return nT(t,e)?t:uy(t,e)[0]||t}function FS(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const s=hf(),l=VC(t,s).filter(d=>{const h=d.getAttribute("data-tabindex")||"";return nT(d,s)||d.hasAttribute("data-tabindex")&&!h.startsWith("-")}),u=t.getAttribute("tabindex");e.current.includes("floating")||l.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 G.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:hy})});function WD(t){const{context:e,children:n,disabled:s=!1,order:o=["content"],guards:l=!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:x,onOpenChange:T,events:D,dataRef:M,elements:{domReference:O,floating:C}}=e,j=ri(()=>{var we;return(we=M.current.floatingContext)==null?void 0:we.nodeId}),_=ri(S),J=typeof u=="number"&&u<0,Y=OS(O)&&J,F=ID(),ee=F?l:!0,se=!ee||F&&v,ue=Wh(o),ge=Wh(u),be=Wh(d),Q=dy(),W=YD(),B=V.useRef(null),q=V.useRef(null),z=V.useRef(!1),ne=V.useRef(!1),A=V.useRef(-1),P=V.useRef(-1),te=W!=null,X=Yp(C),oe=ri(function(we){return we===void 0&&(we=X),we?uy(we,hf()):[]}),fe=ri(we=>{const Me=oe(we);return ue.current.map(Ae=>O&&Ae==="reference"?O:X&&Ae==="floating"?X:Me).filter(Boolean).flat()});V.useEffect(()=>{if(s||!p)return;function we(Ae){if(Ae.key==="Tab"){bn(X,fo(Yn(X)))&&oe().length===0&&!Y&&Qh(Ae);const et=fe(),At=xs(Ae);ue.current[0]==="reference"&&At===O&&(Qh(Ae),Ae.shiftKey?ao(et[et.length-1]):ao(et[1])),ue.current[1]==="floating"&&At===X&&Ae.shiftKey&&(Qh(Ae),ao(et[0]))}}const Me=Yn(X);return Me.addEventListener("keydown",we),()=>{Me.removeEventListener("keydown",we)}},[s,O,X,p,ue,Y,oe,fe]),V.useEffect(()=>{if(s||!C)return;function we(Me){const Ae=xs(Me),At=oe().indexOf(Ae);At!==-1&&(A.current=At)}return C.addEventListener("focusin",we),()=>{C.removeEventListener("focusin",we)}},[s,C,oe]),V.useEffect(()=>{if(s||!g)return;function we(){ne.current=!0,setTimeout(()=>{ne.current=!1})}function Me(At){const xe=At.relatedTarget,zn=At.currentTarget,Gt=xs(At);queueMicrotask(()=>{const Kt=j(),xn=!(bn(O,xe)||bn(C,xe)||bn(xe,C)||bn(W?.portalNode,xe)||xe!=null&&xe.hasAttribute(Vu("focus-guard"))||Q&&(wo(Q.nodesRef.current,Kt).find(Zn=>{var Tn,Qn;return bn((Tn=Zn.context)==null?void 0:Tn.elements.floating,xe)||bn((Qn=Zn.context)==null?void 0:Qn.elements.domReference,xe)})||_S(Q.nodesRef.current,Kt).find(Zn=>{var Tn,Qn,Ll;return[(Tn=Zn.context)==null?void 0:Tn.elements.floating,Yp((Qn=Zn.context)==null?void 0:Qn.elements.floating)].includes(xe)||((Ll=Zn.context)==null?void 0:Ll.elements.domReference)===xe})));if(zn===O&&X&&FS(X,ue),h&&zn!==O&&!(Gt!=null&&Gt.isConnected)&&fo(Yn(X))===Yn(X).body){_t(X)&&X.focus();const Zn=A.current,Tn=oe(),Qn=Tn[Zn]||Tn[Tn.length-1]||X;_t(Qn)&&Qn.focus()}if(M.current.insideReactTree){M.current.insideReactTree=!1;return}(Y||!p)&&xe&&xn&&!ne.current&&xe!==HS()&&(z.current=!0,T(!1,At,"focus-out"))})}const Ae=!!(!Q&&W);function et(){qD(P),M.current.insideReactTree=!0,P.current=window.setTimeout(()=>{M.current.insideReactTree=!1})}if(C&&_t(O))return O.addEventListener("focusout",Me),O.addEventListener("pointerdown",we),C.addEventListener("focusout",Me),Ae&&C.addEventListener("focusout",et,!0),()=>{O.removeEventListener("focusout",Me),O.removeEventListener("pointerdown",we),C.removeEventListener("focusout",Me),Ae&&C.removeEventListener("focusout",et,!0)}},[s,O,C,X,p,Q,W,T,g,h,oe,Y,j,ue,M]);const le=V.useRef(null),it=V.useRef(null),Ve=IS([le,W?.beforeInsideRef]),wn=IS([it,W?.afterInsideRef]);V.useEffect(()=>{var we,Me;if(s||!C)return;const Ae=Array.from((W==null||(we=W.portalNode)==null?void 0:we.querySelectorAll("["+Vu("portal")+"]"))||[]),At=(Me=(Q?_S(Q.nodesRef.current,j()):[]).find(Gt=>{var Kt;return OS(((Kt=Gt.context)==null?void 0:Kt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,xe=[C,At,...Ae,..._(),B.current,q.current,le.current,it.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,ue.current.includes("reference")||Y?O:null].filter(Gt=>Gt!=null),zn=p||Y?qS(xe,!se,se):qS(xe);return()=>{zn()}},[s,O,C,p,ue,W,Y,ee,se,Q,j,_]),Li(()=>{if(s||!_t(X))return;const we=Yn(X),Me=fo(we);queueMicrotask(()=>{const Ae=fe(X),et=ge.current,At=(typeof et=="number"?Ae[et]:et.current)||X,xe=bn(X,Me);!J&&!xe&&x&&ao(At,{preventScroll:At===X})})},[s,x,X,J,fe,ge]),Li(()=>{if(s||!X)return;const we=Yn(X),Me=fo(we);JD(Me);function Ae(xe){let{reason:zn,event:Gt,nested:Kt}=xe;if(["hover","safe-polygon"].includes(zn)&&Gt.type==="mouseleave"&&(z.current=!0),zn==="outside-press")if(Kt)z.current=!1;else if(HC(Gt)||FC(Gt))z.current=!1;else{let xn=!1;document.createElement("div").focus({get preventScroll(){return xn=!0,!1}}),xn?z.current=!1:z.current=!0}}D.on("openchange",Ae);const et=we.createElement("span");et.setAttribute("tabindex","-1"),et.setAttribute("aria-hidden","true"),Object.assign(et.style,hy),te&&O&&O.insertAdjacentElement("afterend",et);function At(){if(typeof be.current=="boolean"){const xe=O||HS();return xe&&xe.isConnected?xe:et}return be.current.current||et}return()=>{D.off("openchange",Ae);const xe=fo(we),zn=bn(C,xe)||Q&&wo(Q.nodesRef.current,j(),!1).some(Kt=>{var xn;return bn((xn=Kt.context)==null?void 0:xn.elements.floating,xe)}),Gt=At();queueMicrotask(()=>{const Kt=ZD(Gt);be.current&&!z.current&&_t(Kt)&&(!(Kt!==xe&&xe!==we.body)||zn)&&Kt.focus({preventScroll:!0}),et.remove()})}},[s,C,X,be,M,D,Q,te,O,j]),V.useEffect(()=>(queueMicrotask(()=>{z.current=!1}),()=>{queueMicrotask(py)}),[s]),Li(()=>{if(!s&&W)return W.setFocusManagerState({modal:p,closeOnFocusOut:g,open:x,onOpenChange:T,domReference:O}),()=>{W.setFocusManagerState(null)}},[s,W,p,x,T,g,O]),Li(()=>{s||X&&FS(X,ue)},[s,X,ue]);function Xi(we){return s||!y||!p?null:G.jsx(QD,{ref:we==="start"?B:q,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const bi=!s&&ee&&(p?!Y:!0)&&(te||p);return G.jsxs(G.Fragment,{children:[bi&&G.jsx(PS,{"data-type":"inside",ref:Ve,onFocus:we=>{if(p){const Ae=fe();ao(o[0]==="reference"?Ae[0]:Ae[Ae.length-1])}else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(z.current=!1,MS(we,W.portalNode)){const Ae=QC(O);Ae?.focus()}else{var Me;(Me=W.beforeOutsideRef.current)==null||Me.focus()}}}),!Y&&Xi("start"),n,Xi("end"),bi&&G.jsx(PS,{"data-type":"inside",ref:wn,onFocus:we=>{if(p)ao(fe()[0]);else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(g&&(z.current=!0),MS(we,W.portalNode)){const Ae=WC(O);Ae?.focus()}else{var Me;(Me=W.afterOutsideRef.current)==null||Me.focus()}}})]})}function GS(t){return _t(t.target)&&t.target.tagName==="BUTTON"}function eN(t){return _t(t.target)&&t.target.tagName==="A"}function YS(t){return sT(t)}function tN(t,e){e===void 0&&(e={});const{open:n,onOpenChange:s,dataRef:o,elements:{domReference:l}}=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),x=V.useMemo(()=>({onPointerDown(T){v.current=T.pointerType},onMouseDown(T){const D=v.current;T.button===0&&d!=="click"&&(kS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="mousedown")?s(!1,T.nativeEvent,"click"):(T.preventDefault(),s(!0,T.nativeEvent,"click"))))},onClick(T){const D=v.current;if(d==="mousedown"&&v.current){v.current=void 0;return}kS(D)&&p||(n&&h&&(!(o.current.openEvent&&g)||o.current.openEvent.type==="click")?s(!1,T.nativeEvent,"click"):s(!0,T.nativeEvent,"click"))},onKeyDown(T){v.current=void 0,!(T.defaultPrevented||!y||GS(T))&&(T.key===" "&&!YS(l)&&(T.preventDefault(),S.current=!0),!eN(T)&&T.key==="Enter"&&s(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||GS(T)||YS(l)||T.key===" "&&S.current&&(S.current=!1,s(!(n&&h),T.nativeEvent,"click"))}}),[o,l,d,p,y,s,n,g,h]);return V.useMemo(()=>u?{reference:x}:{},[u,x])}const nN={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},iN={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},XS=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 sN(t,e){e===void 0&&(e={});const{open:n,onOpenChange:s,elements:o,dataRef:l}=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:x}=e,T=dy(),D=ri(typeof h=="function"?h:()=>!1),M=typeof h=="function"?D:h,O=V.useRef(!1),{escapeKey:C,outsidePress:j}=XS(S),{escapeKey:_,outsidePress:J}=XS(x),Y=V.useRef(!1),F=ri(Q=>{var W;if(!n||!u||!d||Q.key!=="Escape"||Y.current)return;const B=(W=l.current.floatingContext)==null?void 0:W.nodeId,q=T?wo(T.nodesRef.current,B):[];if(!C&&(Q.stopPropagation(),q.length>0)){let z=!0;if(q.forEach(ne=>{var A;if((A=ne.context)!=null&&A.open&&!ne.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}s(!1,IC(Q)?Q.nativeEvent:Q,"escape-key")}),ee=ri(Q=>{var W;const B=()=>{var q;F(Q),(q=xs(Q))==null||q.removeEventListener("keydown",B)};(W=xs(Q))==null||W.addEventListener("keydown",B)}),se=ri(Q=>{var W;const B=l.current.insideReactTree;l.current.insideReactTree=!1;const q=O.current;if(O.current=!1,p==="click"&&q||B||typeof M=="function"&&!M(Q))return;const z=xs(Q),ne="["+Vu("inert")+"]",A=Yn(o.floating).querySelectorAll(ne);let P=pt(z)?z:null;for(;P&&!Vi(P);){const fe=Ki(P);if(Vi(fe)||!pt(fe))break;P=fe}if(A.length&&pt(z)&&!PC(z)&&!bn(z,o.floating)&&Array.from(A).every(fe=>!bn(P,fe)))return;if(_t(z)&&be){const fe=Vi(z),le=Un(z),it=/auto|scroll/,Ve=fe||it.test(le.overflowX),wn=fe||it.test(le.overflowY),Xi=Ve&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,bi=wn&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,we=le.direction==="rtl",Me=bi&&(we?Q.offsetX<=z.offsetWidth-z.clientWidth:Q.offsetX>z.clientWidth),Ae=Xi&&Q.offsetY>z.clientHeight;if(Me||Ae)return}const te=(W=l.current.floatingContext)==null?void 0:W.nodeId,X=T&&wo(T.nodesRef.current,te).some(fe=>{var le;return Zh(Q,(le=fe.context)==null?void 0:le.elements.floating)});if(Zh(Q,o.floating)||Zh(Q,o.domReference)||X)return;const oe=T?wo(T.nodesRef.current,te):[];if(oe.length>0){let fe=!0;if(oe.forEach(le=>{var it;if((it=le.context)!=null&&it.open&&!le.context.dataRef.current.__outsidePressBubbles){fe=!1;return}}),!fe)return}s(!1,Q,"outside-press")}),ue=ri(Q=>{var W;const B=()=>{var q;se(Q),(q=xs(Q))==null||q.removeEventListener(p,B)};(W=xs(Q))==null||W.addEventListener(p,B)});V.useEffect(()=>{if(!n||!u)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=j;let Q=-1;function W(A){s(!1,A,"ancestor-scroll")}function B(){window.clearTimeout(Q),Y.current=!0}function q(){Q=window.setTimeout(()=>{Y.current=!1},cf()?5:0)}const z=Yn(o.floating);d&&(z.addEventListener("keydown",_?ee:F,_),z.addEventListener("compositionstart",B),z.addEventListener("compositionend",q)),M&&z.addEventListener(p,J?ue:se,J);let ne=[];return v&&(pt(o.domReference)&&(ne=Os(o.domReference)),pt(o.floating)&&(ne=ne.concat(Os(o.floating))),!pt(o.reference)&&o.reference&&o.reference.contextElement&&(ne=ne.concat(Os(o.reference.contextElement)))),ne=ne.filter(A=>{var P;return A!==((P=z.defaultView)==null?void 0:P.visualViewport)}),ne.forEach(A=>{A.addEventListener("scroll",W,{passive:!0})}),()=>{d&&(z.removeEventListener("keydown",_?ee:F,_),z.removeEventListener("compositionstart",B),z.removeEventListener("compositionend",q)),M&&z.removeEventListener(p,J?ue:se,J),ne.forEach(A=>{A.removeEventListener("scroll",W)}),window.clearTimeout(Q)}},[l,o,d,M,p,n,s,v,u,C,j,F,_,ee,se,J,ue]),V.useEffect(()=>{l.current.insideReactTree=!1},[l,M,p]);const ge=V.useMemo(()=>({onKeyDown:F,...y&&{[nN[g]]:Q=>{s(!1,Q.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Q){s(!1,Q.nativeEvent,"reference-press")}}}}),[F,s,y,g]),be=V.useMemo(()=>({onKeyDown:F,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[iN[p]]:()=>{l.current.insideReactTree=!0}}),[F,p,l]);return V.useMemo(()=>u?{reference:ge,floating:be}:{},[u,ge,be])}function rN(t){const{open:e=!1,onOpenChange:n,elements:s}=t,o=pT(),l=V.useRef({}),[u]=V.useState(()=>UD()),d=mT()!=null,[h,p]=V.useState(s.reference),y=ri((S,x,T)=>{l.current.openEvent=S?x:void 0,u.emit("openchange",{open:S,event:x,reason:T,nested:d}),n?.(S,x,T)}),g=V.useMemo(()=>({setPositionReference:p}),[]),v=V.useMemo(()=>({reference:h||s.reference||null,floating:s.floating||null,domReference:s.reference}),[h,s.reference,s.floating]);return V.useMemo(()=>({dataRef:l,open:e,onOpenChange:y,elements:v,events:u,floatingId:o,refs:g}),[e,y,v,u,o,g])}function oN(t){t===void 0&&(t={});const{nodeId:e}=t,n=rN({...t,elements:{reference:null,floating:null,...t.elements}}),s=t.rootContext||n,o=s.elements,[l,u]=V.useState(null),[d,h]=V.useState(null),y=o?.domReference||l,g=V.useRef(null),v=dy();Li(()=>{y&&(g.current=y)},[y]);const S=MD({...t,elements:{...o,...d&&{reference:d}}}),x=V.useCallback(C=>{const j=pt(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;h(j),S.refs.setReference(j)},[S.refs]),T=V.useCallback(C=>{(pt(C)||C===null)&&(g.current=C,u(C)),(pt(S.refs.reference.current)||S.refs.reference.current===null||C!==null&&!pt(C))&&S.refs.setReference(C)},[S.refs]),D=V.useMemo(()=>({...S.refs,setReference:T,setPositionReference:x,domReference:g}),[S.refs,T,x]),M=V.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),O=V.useMemo(()=>({...S,...s,refs:D,elements:M,nodeId:e}),[S,D,M,e,s]);return Li(()=>{s.dataRef.current.floatingContext=O;const C=v?.nodesRef.current.find(j=>j.id===e);C&&(C.context=O)}),V.useMemo(()=>({...S,context:O,refs:D,elements:M}),[S,D,M,O])}function ip(t,e,n){const s=new Map,o=n==="item";let l=t;if(o&&t){const{[BS]:u,[LS]:d,...h}=t;l=h}return{...n==="floating"&&{tabIndex:-1,[$D]:""},...l,...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&&[BS,LS].includes(p)))if(p.indexOf("on")===0){if(s.has(p)||s.set(p,[]),typeof y=="function"){var g;(g=s.get(p))==null||g.push(y),u[p]=function(){for(var v,S=arguments.length,x=new Array(S),T=0;T<S;T++)x[T]=arguments[T];return(v=s.get(p))==null?void 0:v.map(D=>D(...x)).find(D=>D!==void 0)}}}else u[p]=y}),u),{})}}function aN(t){t===void 0&&(t=[]);const e=t.map(d=>d?.reference),n=t.map(d=>d?.floating),s=t.map(d=>d?.item),o=V.useCallback(d=>ip(d,t,"reference"),e),l=V.useCallback(d=>ip(d,t,"floating"),n),u=V.useCallback(d=>ip(d,t,"item"),s);return V.useMemo(()=>({getReferenceProps:o,getFloatingProps:l,getItemProps:u}),[o,l,u])}const lN=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function cN(t,e){var n,s;e===void 0&&(e={});const{open:o,elements:l,floatingId:u}=t,{enabled:d=!0,role:h="dialog"}=e,p=pT(),y=((n=l.domReference)==null?void 0:n.id)||p,g=V.useMemo(()=>{var O;return((O=Yp(l.floating))==null?void 0:O.id)||u},[l.floating,u]),v=(s=lN.get(h))!=null?s:h,x=mT()!=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"&&x&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[v,g,x,o,y,h]),D=V.useMemo(()=>{const O={id:g,...v&&{role:v}};return v==="tooltip"||h==="label"?O:{...O,...v==="menu"&&{"aria-labelledby":y}}},[v,g,y,h]),M=V.useCallback(O=>{let{active:C,selected:j}=O;const _={role:"option",...C&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{..._,"aria-selected":j}}return{}},[g,h]);return V.useMemo(()=>d?{reference:T,floating:D,item:M}:{},[d,T,D,M])}const xl=t=>Array.isArray(t)?t:[t],uN=(t,e)=>{const n=[[],[]];for(const s of t)e(s)?n[0].push(s):n[1].push(s);return n},gT=Array,ir=(t,e)=>t.includes(e),fN=(t,e=0)=>[...new Array(t)].map((n,s)=>s+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),or=(t,e)=>e==null?t??[]:t==null?xl(e):t.concat(e),dN=(...t)=>t.reduce(or,[]),ur=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const s=n?.isEqual??((o,l)=>o===l);for(const o of xl(e))t.some(l=>s(l,o))||t.push(o);return t},hN=(t,e)=>t.reduce((n,s)=>{const o=s[e];return n[o]=Ie(n[o],s),n},{}),Co=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(s,o)=>n.isEqual(s,e[o]):(s,o)=>s===e[o]),vr=(t,e)=>Xn(t)===e,Xn=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},qi={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},pN={...qi,function:"a function"};class mN extends Error{}const Tt=t=>Do(t,mN),Do=(t,e=Error)=>{throw new e(t)};class yN extends Error{name="ParseError"}const Z=t=>Do(t,yN),bT=t=>` ${t}`,He=(t,e)=>{const n={},s=Array.isArray(t);let o=!1;for(const[l,u]of Object.entries(t).entries()){const d=s?e(l,u[1]):e(...u,l);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},vT=Object.entries,mi=(t,e)=>t in e,my=(t,e)=>e in t;class gN{constructor(e){Object.assign(this,e)}}const bN=class{};class ST extends bN{}const vN=(t,e)=>{const n={},s={};let o;for(o in t)o in e?n[o]=t[o]:s[o]=t[o];return[n,s]},SN=(t,e)=>vN(t,e)[1],Tl=t=>Object.keys(t).length===0,Uu=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],wN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),xN=t=>{const e=Object.keys(t).sort(),n={};for(let s=0;s<e.length;s++)n[e[s]]=t[e[s]];return n},Bi=bT("represents an uninitialized value"),TN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),wT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},xT=globalThis.File??Blob,TT={ArrayBuffer,Blob,File:xT,FormData,Headers,Request,Response,URL},AN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},No={...wT,...TT,...AN,String,Number,Boolean},yy=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!mi(e.constructor.name,No)||!(t instanceof No[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},Xp=t=>typeof t=="object"&&t!==null?yy(t)??"object":Xn(t),Ft=Array.isArray,EN={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},RN={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},ON={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},_N={...EN,...RN,...ON},gy=t=>{const e=Object(t).name??null;return e&&mi(e,No)&&No[e]===t?e:null},JS=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},kN=t=>AT(t,new Map),AT=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=gy(t.constructor);if(n==="Date")return new Date(t.getTime());if(n&&n!=="Array")return t;const s=Array.isArray(t)?t.slice():Object.create(Object.getPrototypeOf(t)),o=Object.getOwnPropertyDescriptors(t);if(e){e.set(t,s);for(const l in o){const u=o[l];"get"in u||"set"in u||(u.value=AT(u.value,e))}}return Object.defineProperties(s,o),s},MN=t=>{let e=Bi;return()=>e===Bi?e=t():e},mf=t=>typeof t=="function"&&t.length===0,CN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(s){return Tt(`Encountered an unexpected error while compiling your definition:
|
|
65
|
-
Message: ${
|
|
64
|
+
*/var TC=["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])"],$u=TC.join(","),J1=typeof Element>"u",Mo=J1?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ju=!J1&&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},Bu=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"),l=o===""||o==="true",u=l||n&&e&&t(e.parentNode);return u},AC=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(Bu(e))return[];var o=Array.prototype.slice.apply(e.querySelectorAll($u));return n&&Mo.call(e,$u)&&o.unshift(e),o=o.filter(r),o},Q1=function t(e,n,r){for(var o=[],l=Array.from(e);l.length;){var u=l.shift();if(!Bu(u,!1))if(u.tagName==="SLOT"){var f=u.assignedElements(),h=f.length?f:u.children,p=t(h,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:u,candidates:p})}else{var y=Mo.call(u,$u);y&&r.filter(u)&&(n||!e.includes(u))&&o.push(u);var g=u.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(u),v=!Bu(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 l.unshift.apply(l,u.children)}}return o},W1=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},eT=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||AC(e))&&!W1(e)?0:e.tabIndex},EC=function(e,n){var r=eT(e);return r<0&&n&&!W1(e)?0:r},RC=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},tT=function(e){return e.tagName==="INPUT"},OC=function(e){return tT(e)&&e.type==="hidden"},_C=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},kC=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},MC=function(e){if(!e.name)return!0;var n=e.form||ju(e),r=function(f){return n.querySelectorAll('input[type="radio"][name="'+f+'"]')},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 l=kC(o,e.form);return!l||l===e},CC=function(e){return tT(e)&&e.type==="radio"},DC=function(e){return CC(e)&&!MC(e)},NC=function(e){var n,r=e&&ju(e),o=(n=r)===null||n===void 0?void 0:n.host,l=!1;if(r&&r!==e){var u,f,h;for(l=!!((u=o)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(o)||e!=null&&(h=e.ownerDocument)!==null&&h!==void 0&&h.contains(e));!l&&o;){var p,y,g;r=ju(o),o=(p=r)===null||p===void 0?void 0:p.host,l=!!((y=o)!==null&&y!==void 0&&(g=y.ownerDocument)!==null&&g!==void 0&&g.contains(o))}}return l},ES=function(e){var n=e.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},$C=function(e,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(e).visibility==="hidden")return!0;var l=Mo.call(e,"details>summary:first-of-type"),u=l?e.parentElement:e;if(Mo.call(u,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var f=e;e;){var h=e.parentElement,p=ju(e);if(h&&!h.shadowRoot&&o(h)===!0)return ES(e);e.assignedSlot?e=e.assignedSlot:!h&&p!==e.ownerDocument?e=p.host:e=h}e=f}if(NC(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ES(e);return!1},jC=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 Mo.call(n,"fieldset[disabled] *")?!0:!o.contains(e)}return!0}n=n.parentElement}return!1},Hp=function(e,n){return!(n.disabled||Bu(n)||OC(n)||$C(n,e)||_C(n)||jC(n))},Fp=function(e,n){return!(DC(n)||eT(n)<0||!Hp(e,n))},BC=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},LC=function t(e){var n=[],r=[];return e.forEach(function(o,l){var u=!!o.scopeParent,f=u?o.scopeParent:o,h=EC(f,u),p=u?t(o.candidates):f;h===0?u?n.push.apply(n,p):n.push(f):r.push({documentOrder:l,tabIndex:h,item:o,isScope:u,content:p})}),r.sort(RC).reduce(function(o,l){return l.isScope?o.push.apply(o,l.content):o.push(l.content),o},[]).concat(n)},uy=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Q1([e],n.includeContainer,{filter:Fp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:BC}):r=Z1(e,n.includeContainer,Fp.bind(null,n)),LC(r)},VC=function(e,n){n=n||{};var r;return n.getShadowRoot?r=Q1([e],n.includeContainer,{filter:Hp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=Z1(e,n.includeContainer,Hp.bind(null,n)),r},nT=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return Mo.call(e,$u)===!1?!1:Fp(n,e)};function UC(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function iT(){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 zC(){return/apple/i.test(navigator.vendor)}function Gp(){const t=/android/i;return t.test(UC())||t.test(iT())}function KC(){return iT().includes("jsdom/")}const RS="data-floating-ui-focusable",qC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function fo(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 vn(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&qp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function xr(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Zh(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 PC(t){return t.matches("html,body")}function Xn(t){return t?.ownerDocument||document}function rT(t){return _t(t)&&t.matches(qC)}function OS(t){return t?t.getAttribute("role")==="combobox"&&rT(t):!1}function Yp(t){return t?t.hasAttribute(RS)?t:t.querySelector("["+RS+"]")||t:null}function wo(t,e,n){return n===void 0&&(n=!0),t.filter(o=>{var l;return o.parentId===e&&(!n||((l=o.context)==null?void 0:l.open))}).flatMap(o=>[o,...wo(t,o.id,n)])}function _S(t,e){var n;let r=[],o=(n=t.find(l=>l.id===e))==null?void 0:n.parentId;for(;o;){const l=t.find(u=>u.id===o);o=l?.parentId,l&&(r=r.concat(l))}return r}function Qh(t){t.preventDefault(),t.stopPropagation()}function IC(t){return"nativeEvent"in t}function HC(t){return t.mozInputSource===0&&t.isTrusted?!0:Gp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function FC(t){return KC()?!1:!Gp()&&t.width===0&&t.height===0||Gp()&&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 kS(t,e){return["mouse","pen"].includes(t)}var GC=typeof document<"u",YC=function(){},Vi=GC?V.useLayoutEffect:YC;const XC={...U1};function Wh(t){const e=V.useRef(t);return Vi(()=>{e.current=t}),e}const JC=XC.useInsertionEffect,ZC=JC||(t=>t());function oi(t){const e=V.useRef(()=>{});return ZC(()=>{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 hf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function sT(t,e){const n=uy(t,hf()),r=n.length;if(r===0)return;const o=fo(Xn(t)),l=n.indexOf(o),u=l===-1?e===1?0:r-1:l+e;return n[u]}function QC(t){return sT(Xn(t).body,1)||t}function WC(t){return sT(Xn(t).body,-1)||t}function MS(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!vn(n,r)}var eD=I1();function CS(t,e,n){let{reference:r,floating:o}=t;const l=Ar(e),u=X1(e),f=Y1(u),h=hs(e),p=l==="y",y=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,v=r[f]/2-o[f]/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(df(e)){case"start":S[u]-=v*(n&&p?-1:1);break;case"end":S[u]+=v*(n&&p?-1:1);break}return S}const tD=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:l=[],platform:u}=n,f=l.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}=CS(p,r,h),v=r,S={},x=0;for(let T=0;T<f.length;T++){const{name:D,fn:M}=f[T],{x:O,y:C,data:j,reset:_}=await M({x:y,y:g,initialPlacement:r,placement:v,strategy:o,middlewareData:S,rects:p,platform:u,elements:{reference:t,floating:e}});y=O??y,g=C??g,S={...S,[D]:{...S[D],...j}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(v=_.placement),_.rects&&(p=_.rects===!0?await u.getElementRects({reference:t,floating:e,strategy:o}):_.rects),{x:y,y:g}=CS(p,v,h)),T=-1)}return{x:y,y:g,placement:v,strategy:o,middlewareData:S}};async function oT(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:l,rects:u,elements:f,strategy:h}=t,{boundary:p="clippingAncestors",rootBoundary:y="viewport",elementContext:g="floating",altBoundary:v=!1,padding:S=0}=ff(e,t),x=xC(S),D=f[v?g==="floating"?"reference":"floating":g],M=Nu(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(D)))==null||n?D:D.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:p,rootBoundary:y,strategy:h})),O=g==="floating"?{x:r,y:o,width:u.floating.width,height:u.floating.height}:u.reference,C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),j=await(l.isElement==null?void 0:l.isElement(C))?await(l.getScale==null?void 0:l.getScale(C))||{x:1,y:1}:{x:1,y:1},_=Nu(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:O,offsetParent:C,strategy:h}):O);return{top:(M.top-_.top+x.top)/j.y,bottom:(_.bottom-M.bottom+x.bottom)/j.y,left:(M.left-_.left+x.left)/j.x,right:(_.right-M.right+x.right)/j.x}}const nD=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:l,rects:u,initialPlacement:f,platform:h,elements:p}=e,{mainAxis:y=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:S="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:T=!0,...D}=ff(t,e);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const M=hs(o),O=Ar(f),C=hs(f)===f,j=await(h.isRTL==null?void 0:h.isRTL(p.floating)),_=v||(C||!T?[Du(f)]:yC(f)),J=x!=="none";!v&&J&&_.push(...SC(f,T,x,j));const Y=[f,..._],F=await oT(e,D),ee=[];let re=((r=l.flip)==null?void 0:r.overflows)||[];if(y&&ee.push(F[M]),g){const Q=mC(o,u,j);ee.push(F[Q[0]],F[Q[1]])}if(re=[...re,{placement:o,overflows:ee}],!ee.every(Q=>Q<=0)){var ue,ge;const Q=(((ue=l.flip)==null?void 0:ue.index)||0)+1,W=Y[Q];if(W&&(!(g==="alignment"?O!==Ar(W):!1)||re.every(z=>Ar(z.placement)===O?z.overflows[0]>0:!0)))return{data:{index:Q,overflows:re},reset:{placement:W}};let B=(ge=re.filter(q=>q.overflows[0]<=0).sort((q,z)=>q.overflows[1]-z.overflows[1])[0])==null?void 0:ge.placement;if(!B)switch(S){case"bestFit":{var be;const q=(be=re.filter(z=>{if(J){const ne=Ar(z.placement);return ne===O||ne==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(ne=>ne>0).reduce((ne,A)=>ne+A,0)]).sort((z,ne)=>z[1]-ne[1])[0])==null?void 0:be[0];q&&(B=q);break}case"initialPlacement":B=f;break}if(o!==B)return{reset:{placement:B}}}return{}}}},iD=new Set(["left","top"]);async function rD(t,e){const{placement:n,platform:r,elements:o}=t,l=await(r.isRTL==null?void 0:r.isRTL(o.floating)),u=hs(n),f=df(n),h=Ar(n)==="y",p=iD.has(u)?-1:1,y=l&&h?-1:1,g=ff(e,t);let{mainAxis:v,crossAxis:S,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof x=="number"&&(S=f==="end"?x*-1:x),h?{x:S*y,y:v*p}:{x:v*p,y:S*y}}const sD=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:l,placement:u,middlewareData:f}=e,h=await rD(e,t);return u===((n=f.offset)==null?void 0:n.placement)&&(r=f.arrow)!=null&&r.alignmentOffset?{}:{x:o+h.x,y:l+h.y,data:{...h,placement:u}}}}},oD=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:l=!0,crossAxis:u=!1,limiter:f={fn:D=>{let{x:M,y:O}=D;return{x:M,y:O}}},...h}=ff(t,e),p={x:n,y:r},y=await oT(e,h),g=Ar(hs(o)),v=G1(g);let S=p[v],x=p[g];if(l){const D=v==="y"?"top":"left",M=v==="y"?"bottom":"right",O=S+y[D],C=S-y[M];S=xS(O,S,C)}if(u){const D=g==="y"?"top":"left",M=g==="y"?"bottom":"right",O=x+y[D],C=x-y[M];x=xS(O,x,C)}const T=f.fn({...e,[v]:S,[g]:x});return{...T,data:{x:T.x-n,y:T.y-r,enabled:{[v]:l,[g]:u}}}}}};function aT(t){const e=zn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=_t(t),l=o?t.offsetWidth:n,u=o?t.offsetHeight:r,f=Cu(n)!==l||Cu(r)!==u;return f&&(n=l,r=u),{width:n,height:r,$:f}}function fy(t){return pt(t)?t:t.contextElement}function xo(t){const e=fy(t);if(!_t(e))return li(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:l}=aT(e);let u=(l?Cu(n.width):n.width)/r,f=(l?Cu(n.height):n.height)/o;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const aD=li(0);function lT(t){const e=Sn(t);return!cf()||!e.visualViewport?aD:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lD(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Sn(t)?!1:e}function ps(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),l=fy(t);let u=li(1);e&&(r?pt(r)&&(u=xo(r)):u=xo(t));const f=lD(l,n,r)?lT(l):li(0);let h=(o.left+f.x)/u.x,p=(o.top+f.y)/u.y,y=o.width/u.x,g=o.height/u.y;if(l){const v=Sn(l),S=r&&pt(r)?Sn(r):r;let x=v,T=Pp(x);for(;T&&r&&S!==x;){const D=xo(T),M=T.getBoundingClientRect(),O=zn(T),C=M.left+(T.clientLeft+parseFloat(O.paddingLeft))*D.x,j=M.top+(T.clientTop+parseFloat(O.paddingTop))*D.y;h*=D.x,p*=D.y,y*=D.x,g*=D.y,h+=C,p+=j,x=Sn(T),T=Pp(x)}}return Nu({width:y,height:g,x:h,y:p})}function pf(t,e){const n=uf(t).scrollLeft;return e?e.left+n:ps(mi(t)).left+n}function cT(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-pf(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function cD(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const l=o==="fixed",u=mi(r),f=e?lf(e.floating):!1;if(r===u||f&&l)return n;let h={scrollLeft:0,scrollTop:0},p=li(1);const y=li(0),g=_t(r);if((g||!g&&!l)&&((Br(r)!=="body"||wl(u))&&(h=uf(r)),_t(r))){const S=ps(r);p=xo(r),y.x=S.x+r.clientLeft,y.y=S.y+r.clientTop}const v=u&&!g&&!l?cT(u,h):li(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 uD(t){return Array.from(t.getClientRects())}function fD(t){const e=mi(t),n=uf(t),r=t.ownerDocument.body,o=cs(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),l=cs(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let u=-n.scrollLeft+pf(t);const f=-n.scrollTop;return zn(r).direction==="rtl"&&(u+=cs(e.clientWidth,r.clientWidth)-o),{width:o,height:l,x:u,y:f}}const DS=25;function dD(t,e){const n=Sn(t),r=mi(t),o=n.visualViewport;let l=r.clientWidth,u=r.clientHeight,f=0,h=0;if(o){l=o.width,u=o.height;const y=cf();(!y||y&&e==="fixed")&&(f=o.offsetLeft,h=o.offsetTop)}const p=pf(r);if(p<=0){const y=r.ownerDocument,g=y.body,v=getComputedStyle(g),S=y.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,x=Math.abs(r.clientWidth-g.clientWidth-S);x<=DS&&(l-=x)}else p<=DS&&(l+=p);return{width:l,height:u,x:f,y:h}}const hD=new Set(["absolute","fixed"]);function pD(t,e){const n=ps(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,l=_t(t)?xo(t):li(1),u=t.clientWidth*l.x,f=t.clientHeight*l.y,h=o*l.x,p=r*l.y;return{width:u,height:f,x:h,y:p}}function NS(t,e,n){let r;if(e==="viewport")r=dD(t,n);else if(e==="document")r=fD(mi(t));else if(pt(e))r=pD(e,n);else{const o=lT(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return Nu(r)}function uT(t,e){const n=Ki(t);return n===e||!pt(n)||Ui(n)?!1:zn(n).position==="fixed"||uT(n,e)}function mD(t,e){const n=e.get(t);if(n)return n;let r=Or(t,[],!1).filter(f=>pt(f)&&Br(f)!=="body"),o=null;const l=zn(t).position==="fixed";let u=l?Ki(t):t;for(;pt(u)&&!Ui(u);){const f=zn(u),h=cy(u);!h&&f.position==="fixed"&&(o=null),(l?!h&&!o:!h&&f.position==="static"&&!!o&&hD.has(o.position)||wl(u)&&!h&&uT(t,u))?r=r.filter(y=>y!==u):o=f,u=Ki(u)}return e.set(t,r),r}function yD(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const u=[...n==="clippingAncestors"?lf(e)?[]:mD(e,this._c):[].concat(n),r],f=u[0],h=u.reduce((p,y)=>{const g=NS(e,y,o);return p.top=cs(g.top,p.top),p.right=Mu(g.right,p.right),p.bottom=Mu(g.bottom,p.bottom),p.left=cs(g.left,p.left),p},NS(e,f,o));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function gD(t){const{width:e,height:n}=aT(t);return{width:e,height:n}}function bD(t,e,n){const r=_t(e),o=mi(e),l=n==="fixed",u=ps(t,!0,l,e);let f={scrollLeft:0,scrollTop:0};const h=li(0);function p(){h.x=pf(o)}if(r||!r&&!l)if((Br(e)!=="body"||wl(o))&&(f=uf(e)),r){const S=ps(e,!0,l,e);h.x=S.x+e.clientLeft,h.y=S.y+e.clientTop}else o&&p();l&&!r&&o&&p();const y=o&&!r&&!l?cT(o,f):li(0),g=u.left+f.scrollLeft-h.x-y.x,v=u.top+f.scrollTop-h.y-y.y;return{x:g,y:v,width:u.width,height:u.height}}function ep(t){return zn(t).position==="static"}function $S(t,e){if(!_t(t)||zn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mi(t)===n&&(n=n.ownerDocument.body),n}function fT(t,e){const n=Sn(t);if(lf(t))return n;if(!_t(t)){let o=Ki(t);for(;o&&!Ui(o);){if(pt(o)&&!ep(o))return o;o=Ki(o)}return n}let r=$S(t,e);for(;r&&sC(r)&&ep(r);)r=$S(r,e);return r&&Ui(r)&&ep(r)&&!cy(r)?n:r||uC(t)||n}const vD=async function(t){const e=this.getOffsetParent||fT,n=this.getDimensions,r=await n(t.floating);return{reference:bD(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function SD(t){return zn(t).direction==="rtl"}const wD={convertOffsetParentRelativeRectToViewportRelativeRect:cD,getDocumentElement:mi,getClippingRect:yD,getOffsetParent:fT,getElementRects:vD,getClientRects:uD,getDimensions:gD,getScale:xo,isElement:pt,isRTL:SD};function dT(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function xD(t,e){let n=null,r;const o=mi(t);function l(){var f;clearTimeout(r),(f=n)==null||f.disconnect(),n=null}function u(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),l();const p=t.getBoundingClientRect(),{left:y,top:g,width:v,height:S}=p;if(f||e(),!v||!S)return;const x=Qc(g),T=Qc(o.clientWidth-(y+v)),D=Qc(o.clientHeight-(g+S)),M=Qc(y),C={rootMargin:-x+"px "+-T+"px "+-D+"px "+-M+"px",threshold:cs(0,Mu(1,h))||1};let j=!0;function _(J){const Y=J[0].intersectionRatio;if(Y!==h){if(!j)return u();Y?u(!1,Y):r=setTimeout(()=>{u(!1,1e-7)},1e3)}Y===1&&!dT(p,t.getBoundingClientRect())&&u(),j=!1}try{n=new IntersectionObserver(_,{...C,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,C)}n.observe(t)}return u(!0),l}function TD(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=r,p=fy(t),y=o||l?[...p?Or(p):[],...Or(e)]:[];y.forEach(M=>{o&&M.addEventListener("scroll",n,{passive:!0}),l&&M.addEventListener("resize",n)});const g=p&&f?xD(p,n):null;let v=-1,S=null;u&&(S=new ResizeObserver(M=>{let[O]=M;O&&O.target===p&&S&&(S.unobserve(e),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var C;(C=S)==null||C.observe(e)})),n()}),p&&!h&&S.observe(p),S.observe(e));let x,T=h?ps(t):null;h&&D();function D(){const M=ps(t);T&&!dT(T,M)&&n(),T=M,x=requestAnimationFrame(D)}return n(),()=>{var M;y.forEach(O=>{o&&O.removeEventListener("scroll",n),l&&O.removeEventListener("resize",n)}),g?.(),(M=S)==null||M.disconnect(),S=null,h&&cancelAnimationFrame(x)}}const AD=sD,ED=oD,RD=nD,OD=(t,e,n)=>{const r=new Map,o={platform:wD,...n},l={...o.platform,_c:r};return tD(t,e,{...o,platform:l})};var _D=typeof document<"u",kD=function(){},pu=_D?V.useLayoutEffect:kD;function Lu(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(!Lu(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 l=o[r];if(!(l==="_owner"&&t.$$typeof)&&!Lu(t[l],e[l]))return!1}return!0}return t!==t&&e!==e}function hT(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function jS(t,e){const n=hT(t);return Math.round(e*n)/n}function tp(t){const e=V.useRef(t);return pu(()=>{e.current=t}),e}function MD(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:l,floating:u}={},transform:f=!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);Lu(v,r)||S(r);const[x,T]=V.useState(null),[D,M]=V.useState(null),O=V.useCallback(z=>{z!==J.current&&(J.current=z,T(z))},[]),C=V.useCallback(z=>{z!==Y.current&&(Y.current=z,M(z))},[]),j=l||x,_=u||D,J=V.useRef(null),Y=V.useRef(null),F=V.useRef(y),ee=h!=null,re=tp(h),ue=tp(o),ge=tp(p),be=V.useCallback(()=>{if(!J.current||!Y.current)return;const z={placement:e,strategy:n,middleware:v};ue.current&&(z.platform=ue.current),OD(J.current,Y.current,z).then(ne=>{const A={...ne,isPositioned:ge.current!==!1};Q.current&&!Lu(F.current,A)&&(F.current=A,eD.flushSync(()=>{g(A)}))})},[v,e,n,ue,ge]);pu(()=>{p===!1&&F.current.isPositioned&&(F.current.isPositioned=!1,g(z=>({...z,isPositioned:!1})))},[p]);const Q=V.useRef(!1);pu(()=>(Q.current=!0,()=>{Q.current=!1}),[]),pu(()=>{if(j&&(J.current=j),_&&(Y.current=_),j&&_){if(re.current)return re.current(j,_,be);be()}},[j,_,be,re,ee]);const W=V.useMemo(()=>({reference:J,floating:Y,setReference:O,setFloating:C}),[O,C]),B=V.useMemo(()=>({reference:j,floating:_}),[j,_]),q=V.useMemo(()=>{const z={position:n,left:0,top:0};if(!B.floating)return z;const ne=jS(B.floating,y.x),A=jS(B.floating,y.y);return f?{...z,transform:"translate("+ne+"px, "+A+"px)",...hT(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ne,top:A}},[n,f,B.floating,y.x,y.y]);return V.useMemo(()=>({...y,update:be,refs:W,elements:B,floatingStyles:q}),[y,be,W,B,q])}const CD=(t,e)=>({...AD(t),options:[t,e]}),DD=(t,e)=>({...ED(t),options:[t,e]}),ND=(t,e)=>({...RD(t),options:[t,e]}),$D="data-floating-ui-focusable",BS="active",LS="selected",jD={...U1};let VS=!1,BD=0;const US=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+BD++;function LD(){const[t,e]=V.useState(()=>VS?US():void 0);return Vi(()=>{t==null&&e(US())},[]),V.useEffect(()=>{VS=!0},[]),t}const VD=jD.useId,pT=VD||LD;function UD(){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 zD=V.createContext(null),KD=V.createContext(null),mT=()=>{var t;return((t=V.useContext(zD))==null?void 0:t.id)||null},dy=()=>V.useContext(KD);function Vu(t){return"data-floating-ui-"+t}function qD(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}let zS=0;function ao(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=e;r&&cancelAnimationFrame(zS);const l=()=>t?.focus({preventScroll:n});o?l():zS=requestAnimationFrame(l)}function PD(t){return t?.ownerDocument||document}const To={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function KS(t){return t==="inert"?To.inert:t==="aria-hidden"?To["aria-hidden"]:To.none}let Wc=new WeakSet,eu={},np=0;const ID=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype,yT=t=>t&&(t.host||yT(t.parentNode)),HD=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=yT(n);return t.contains(r)?r:null}).filter(n=>n!=null);function FD(t,e,n,r){const o="data-floating-ui-inert",l=r?"inert":n?"aria-hidden":null,u=HD(e,t),f=new Set,h=new Set(u),p=[];eu[o]||(eu[o]=new WeakMap);const y=eu[o];u.forEach(g),v(e),f.clear();function g(S){!S||f.has(S)||(f.add(S),S.parentNode&&g(S.parentNode))}function v(S){!S||h.has(S)||[].forEach.call(S.children,x=>{if(Br(x)!=="script")if(f.has(x))v(x);else{const T=l?x.getAttribute(l):null,D=T!==null&&T!=="false",M=KS(l),O=(M.get(x)||0)+1,C=(y.get(x)||0)+1;M.set(x,O),y.set(x,C),p.push(x),O===1&&D&&Wc.add(x),C===1&&x.setAttribute(o,""),!D&&l&&x.setAttribute(l,l==="inert"?"":"true")}})}return np++,()=>{p.forEach(S=>{const x=KS(l),D=(x.get(S)||0)-1,M=(y.get(S)||0)-1;x.set(S,D),y.set(S,M),D||(!Wc.has(S)&&l&&S.removeAttribute(l),Wc.delete(S)),M||S.removeAttribute(o)}),np--,np||(To.inert=new WeakMap,To["aria-hidden"]=new WeakMap,To.none=new WeakMap,Wc=new WeakSet,eu={})}}function qS(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=PD(t[0]).body;return FD(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const hy={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},PS=V.forwardRef(function(e,n){const[r,o]=V.useState();Vi(()=>{zC()&&o("button")},[]);const l={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Vu("focus-guard")]:"",style:hy};return G.jsx("span",{...e,...l})}),GD=V.createContext(null),YD=()=>V.useContext(GD);function IS(t){return V.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const XD=20;let Er=[];function py(){Er=Er.filter(t=>t.isConnected)}function JD(t){py(),t&&Br(t)!=="body"&&(Er.push(t),Er.length>XD&&(Er=Er.slice(-20)))}function HS(){return py(),Er[Er.length-1]}function ZD(t){const e=hf();return nT(t,e)?t:uy(t,e)[0]||t}function FS(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=hf(),l=VC(t,r).filter(f=>{const h=f.getAttribute("data-tabindex")||"";return nT(f,r)||f.hasAttribute("data-tabindex")&&!h.startsWith("-")}),u=t.getAttribute("tabindex");e.current.includes("floating")||l.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 G.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:hy})});function WD(t){const{context:e,children:n,disabled:r=!1,order:o=["content"],guards:l=!0,initialFocus:u=0,returnFocus:f=!0,restoreFocus:h=!1,modal:p=!0,visuallyHiddenDismiss:y=!1,closeOnFocusOut:g=!0,outsideElementsInert:v=!1,getInsideElements:S=()=>[]}=t,{open:x,onOpenChange:T,events:D,dataRef:M,elements:{domReference:O,floating:C}}=e,j=oi(()=>{var we;return(we=M.current.floatingContext)==null?void 0:we.nodeId}),_=oi(S),J=typeof u=="number"&&u<0,Y=OS(O)&&J,F=ID(),ee=F?l:!0,re=!ee||F&&v,ue=Wh(o),ge=Wh(u),be=Wh(f),Q=dy(),W=YD(),B=V.useRef(null),q=V.useRef(null),z=V.useRef(!1),ne=V.useRef(!1),A=V.useRef(-1),P=V.useRef(-1),te=W!=null,X=Yp(C),oe=oi(function(we){return we===void 0&&(we=X),we?uy(we,hf()):[]}),fe=oi(we=>{const Me=oe(we);return ue.current.map(Ae=>O&&Ae==="reference"?O:X&&Ae==="floating"?X:Me).filter(Boolean).flat()});V.useEffect(()=>{if(r||!p)return;function we(Ae){if(Ae.key==="Tab"){vn(X,fo(Xn(X)))&&oe().length===0&&!Y&&Qh(Ae);const et=fe(),At=xr(Ae);ue.current[0]==="reference"&&At===O&&(Qh(Ae),Ae.shiftKey?ao(et[et.length-1]):ao(et[1])),ue.current[1]==="floating"&&At===X&&Ae.shiftKey&&(Qh(Ae),ao(et[0]))}}const Me=Xn(X);return Me.addEventListener("keydown",we),()=>{Me.removeEventListener("keydown",we)}},[r,O,X,p,ue,Y,oe,fe]),V.useEffect(()=>{if(r||!C)return;function we(Me){const Ae=xr(Me),At=oe().indexOf(Ae);At!==-1&&(A.current=At)}return C.addEventListener("focusin",we),()=>{C.removeEventListener("focusin",we)}},[r,C,oe]),V.useEffect(()=>{if(r||!g)return;function we(){ne.current=!0,setTimeout(()=>{ne.current=!1})}function Me(At){const xe=At.relatedTarget,Kn=At.currentTarget,Gt=xr(At);queueMicrotask(()=>{const Kt=j(),Tn=!(vn(O,xe)||vn(C,xe)||vn(xe,C)||vn(W?.portalNode,xe)||xe!=null&&xe.hasAttribute(Vu("focus-guard"))||Q&&(wo(Q.nodesRef.current,Kt).find(Qn=>{var An,Wn;return vn((An=Qn.context)==null?void 0:An.elements.floating,xe)||vn((Wn=Qn.context)==null?void 0:Wn.elements.domReference,xe)})||_S(Q.nodesRef.current,Kt).find(Qn=>{var An,Wn,Ll;return[(An=Qn.context)==null?void 0:An.elements.floating,Yp((Wn=Qn.context)==null?void 0:Wn.elements.floating)].includes(xe)||((Ll=Qn.context)==null?void 0:Ll.elements.domReference)===xe})));if(Kn===O&&X&&FS(X,ue),h&&Kn!==O&&!(Gt!=null&&Gt.isConnected)&&fo(Xn(X))===Xn(X).body){_t(X)&&X.focus();const Qn=A.current,An=oe(),Wn=An[Qn]||An[An.length-1]||X;_t(Wn)&&Wn.focus()}if(M.current.insideReactTree){M.current.insideReactTree=!1;return}(Y||!p)&&xe&&Tn&&!ne.current&&xe!==HS()&&(z.current=!0,T(!1,At,"focus-out"))})}const Ae=!!(!Q&&W);function et(){qD(P),M.current.insideReactTree=!0,P.current=window.setTimeout(()=>{M.current.insideReactTree=!1})}if(C&&_t(O))return O.addEventListener("focusout",Me),O.addEventListener("pointerdown",we),C.addEventListener("focusout",Me),Ae&&C.addEventListener("focusout",et,!0),()=>{O.removeEventListener("focusout",Me),O.removeEventListener("pointerdown",we),C.removeEventListener("focusout",Me),Ae&&C.removeEventListener("focusout",et,!0)}},[r,O,C,X,p,Q,W,T,g,h,oe,Y,j,ue,M]);const le=V.useRef(null),it=V.useRef(null),Ve=IS([le,W?.beforeInsideRef]),xn=IS([it,W?.afterInsideRef]);V.useEffect(()=>{var we,Me;if(r||!C)return;const Ae=Array.from((W==null||(we=W.portalNode)==null?void 0:we.querySelectorAll("["+Vu("portal")+"]"))||[]),At=(Me=(Q?_S(Q.nodesRef.current,j()):[]).find(Gt=>{var Kt;return OS(((Kt=Gt.context)==null?void 0:Kt.elements.domReference)||null)}))==null||(Me=Me.context)==null?void 0:Me.elements.domReference,xe=[C,At,...Ae,..._(),B.current,q.current,le.current,it.current,W?.beforeOutsideRef.current,W?.afterOutsideRef.current,ue.current.includes("reference")||Y?O:null].filter(Gt=>Gt!=null),Kn=p||Y?qS(xe,!re,re):qS(xe);return()=>{Kn()}},[r,O,C,p,ue,W,Y,ee,re,Q,j,_]),Vi(()=>{if(r||!_t(X))return;const we=Xn(X),Me=fo(we);queueMicrotask(()=>{const Ae=fe(X),et=ge.current,At=(typeof et=="number"?Ae[et]:et.current)||X,xe=vn(X,Me);!J&&!xe&&x&&ao(At,{preventScroll:At===X})})},[r,x,X,J,fe,ge]),Vi(()=>{if(r||!X)return;const we=Xn(X),Me=fo(we);JD(Me);function Ae(xe){let{reason:Kn,event:Gt,nested:Kt}=xe;if(["hover","safe-polygon"].includes(Kn)&&Gt.type==="mouseleave"&&(z.current=!0),Kn==="outside-press")if(Kt)z.current=!1;else if(HC(Gt)||FC(Gt))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",Ae);const et=we.createElement("span");et.setAttribute("tabindex","-1"),et.setAttribute("aria-hidden","true"),Object.assign(et.style,hy),te&&O&&O.insertAdjacentElement("afterend",et);function At(){if(typeof be.current=="boolean"){const xe=O||HS();return xe&&xe.isConnected?xe:et}return be.current.current||et}return()=>{D.off("openchange",Ae);const xe=fo(we),Kn=vn(C,xe)||Q&&wo(Q.nodesRef.current,j(),!1).some(Kt=>{var Tn;return vn((Tn=Kt.context)==null?void 0:Tn.elements.floating,xe)}),Gt=At();queueMicrotask(()=>{const Kt=ZD(Gt);be.current&&!z.current&&_t(Kt)&&(!(Kt!==xe&&xe!==we.body)||Kn)&&Kt.focus({preventScroll:!0}),et.remove()})}},[r,C,X,be,M,D,Q,te,O,j]),V.useEffect(()=>(queueMicrotask(()=>{z.current=!1}),()=>{queueMicrotask(py)}),[r]),Vi(()=>{if(!r&&W)return W.setFocusManagerState({modal:p,closeOnFocusOut:g,open:x,onOpenChange:T,domReference:O}),()=>{W.setFocusManagerState(null)}},[r,W,p,x,T,g,O]),Vi(()=>{r||X&&FS(X,ue)},[r,X,ue]);function Xi(we){return r||!y||!p?null:G.jsx(QD,{ref:we==="start"?B:q,onClick:Me=>T(!1,Me.nativeEvent),children:typeof y=="string"?y:"Dismiss"})}const vi=!r&&ee&&(p?!Y:!0)&&(te||p);return G.jsxs(G.Fragment,{children:[vi&&G.jsx(PS,{"data-type":"inside",ref:Ve,onFocus:we=>{if(p){const Ae=fe();ao(o[0]==="reference"?Ae[0]:Ae[Ae.length-1])}else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(z.current=!1,MS(we,W.portalNode)){const Ae=QC(O);Ae?.focus()}else{var Me;(Me=W.beforeOutsideRef.current)==null||Me.focus()}}}),!Y&&Xi("start"),n,Xi("end"),vi&&G.jsx(PS,{"data-type":"inside",ref:xn,onFocus:we=>{if(p)ao(fe()[0]);else if(W!=null&&W.preserveTabOrder&&W.portalNode)if(g&&(z.current=!0),MS(we,W.portalNode)){const Ae=WC(O);Ae?.focus()}else{var Me;(Me=W.afterOutsideRef.current)==null||Me.focus()}}})]})}function GS(t){return _t(t.target)&&t.target.tagName==="BUTTON"}function eN(t){return _t(t.target)&&t.target.tagName==="A"}function YS(t){return rT(t)}function tN(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:l}}=t,{enabled:u=!0,event:f="click",toggle:h=!0,ignoreMouse:p=!1,keyboardHandlers:y=!0,stickIfOpen:g=!0}=e,v=V.useRef(),S=V.useRef(!1),x=V.useMemo(()=>({onPointerDown(T){v.current=T.pointerType},onMouseDown(T){const D=v.current;T.button===0&&f!=="click"&&(kS(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(f==="mousedown"&&v.current){v.current=void 0;return}kS(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||GS(T))&&(T.key===" "&&!YS(l)&&(T.preventDefault(),S.current=!0),!eN(T)&&T.key==="Enter"&&r(!(n&&h),T.nativeEvent,"click"))},onKeyUp(T){T.defaultPrevented||!y||GS(T)||YS(l)||T.key===" "&&S.current&&(S.current=!1,r(!(n&&h),T.nativeEvent,"click"))}}),[o,l,f,p,y,r,n,g,h]);return V.useMemo(()=>u?{reference:x}:{},[u,x])}const nN={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},iN={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},XS=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 rN(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:o,dataRef:l}=t,{enabled:u=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:p="pointerdown",referencePress:y=!1,referencePressEvent:g="pointerdown",ancestorScroll:v=!1,bubbles:S,capture:x}=e,T=dy(),D=oi(typeof h=="function"?h:()=>!1),M=typeof h=="function"?D:h,O=V.useRef(!1),{escapeKey:C,outsidePress:j}=XS(S),{escapeKey:_,outsidePress:J}=XS(x),Y=V.useRef(!1),F=oi(Q=>{var W;if(!n||!u||!f||Q.key!=="Escape"||Y.current)return;const B=(W=l.current.floatingContext)==null?void 0:W.nodeId,q=T?wo(T.nodesRef.current,B):[];if(!C&&(Q.stopPropagation(),q.length>0)){let z=!0;if(q.forEach(ne=>{var A;if((A=ne.context)!=null&&A.open&&!ne.context.dataRef.current.__escapeKeyBubbles){z=!1;return}}),!z)return}r(!1,IC(Q)?Q.nativeEvent:Q,"escape-key")}),ee=oi(Q=>{var W;const B=()=>{var q;F(Q),(q=xr(Q))==null||q.removeEventListener("keydown",B)};(W=xr(Q))==null||W.addEventListener("keydown",B)}),re=oi(Q=>{var W;const B=l.current.insideReactTree;l.current.insideReactTree=!1;const q=O.current;if(O.current=!1,p==="click"&&q||B||typeof M=="function"&&!M(Q))return;const z=xr(Q),ne="["+Vu("inert")+"]",A=Xn(o.floating).querySelectorAll(ne);let P=pt(z)?z:null;for(;P&&!Ui(P);){const fe=Ki(P);if(Ui(fe)||!pt(fe))break;P=fe}if(A.length&&pt(z)&&!PC(z)&&!vn(z,o.floating)&&Array.from(A).every(fe=>!vn(P,fe)))return;if(_t(z)&&be){const fe=Ui(z),le=zn(z),it=/auto|scroll/,Ve=fe||it.test(le.overflowX),xn=fe||it.test(le.overflowY),Xi=Ve&&z.clientWidth>0&&z.scrollWidth>z.clientWidth,vi=xn&&z.clientHeight>0&&z.scrollHeight>z.clientHeight,we=le.direction==="rtl",Me=vi&&(we?Q.offsetX<=z.offsetWidth-z.clientWidth:Q.offsetX>z.clientWidth),Ae=Xi&&Q.offsetY>z.clientHeight;if(Me||Ae)return}const te=(W=l.current.floatingContext)==null?void 0:W.nodeId,X=T&&wo(T.nodesRef.current,te).some(fe=>{var le;return Zh(Q,(le=fe.context)==null?void 0:le.elements.floating)});if(Zh(Q,o.floating)||Zh(Q,o.domReference)||X)return;const oe=T?wo(T.nodesRef.current,te):[];if(oe.length>0){let fe=!0;if(oe.forEach(le=>{var it;if((it=le.context)!=null&&it.open&&!le.context.dataRef.current.__outsidePressBubbles){fe=!1;return}}),!fe)return}r(!1,Q,"outside-press")}),ue=oi(Q=>{var W;const B=()=>{var q;re(Q),(q=xr(Q))==null||q.removeEventListener(p,B)};(W=xr(Q))==null||W.addEventListener(p,B)});V.useEffect(()=>{if(!n||!u)return;l.current.__escapeKeyBubbles=C,l.current.__outsidePressBubbles=j;let Q=-1;function W(A){r(!1,A,"ancestor-scroll")}function B(){window.clearTimeout(Q),Y.current=!0}function q(){Q=window.setTimeout(()=>{Y.current=!1},cf()?5:0)}const z=Xn(o.floating);f&&(z.addEventListener("keydown",_?ee:F,_),z.addEventListener("compositionstart",B),z.addEventListener("compositionend",q)),M&&z.addEventListener(p,J?ue:re,J);let ne=[];return v&&(pt(o.domReference)&&(ne=Or(o.domReference)),pt(o.floating)&&(ne=ne.concat(Or(o.floating))),!pt(o.reference)&&o.reference&&o.reference.contextElement&&(ne=ne.concat(Or(o.reference.contextElement)))),ne=ne.filter(A=>{var P;return A!==((P=z.defaultView)==null?void 0:P.visualViewport)}),ne.forEach(A=>{A.addEventListener("scroll",W,{passive:!0})}),()=>{f&&(z.removeEventListener("keydown",_?ee:F,_),z.removeEventListener("compositionstart",B),z.removeEventListener("compositionend",q)),M&&z.removeEventListener(p,J?ue:re,J),ne.forEach(A=>{A.removeEventListener("scroll",W)}),window.clearTimeout(Q)}},[l,o,f,M,p,n,r,v,u,C,j,F,_,ee,re,J,ue]),V.useEffect(()=>{l.current.insideReactTree=!1},[l,M,p]);const ge=V.useMemo(()=>({onKeyDown:F,...y&&{[nN[g]]:Q=>{r(!1,Q.nativeEvent,"reference-press")},...g!=="click"&&{onClick(Q){r(!1,Q.nativeEvent,"reference-press")}}}}),[F,r,y,g]),be=V.useMemo(()=>({onKeyDown:F,onMouseDown(){O.current=!0},onMouseUp(){O.current=!0},[iN[p]]:()=>{l.current.insideReactTree=!0}}),[F,p,l]);return V.useMemo(()=>u?{reference:ge,floating:be}:{},[u,ge,be])}function sN(t){const{open:e=!1,onOpenChange:n,elements:r}=t,o=pT(),l=V.useRef({}),[u]=V.useState(()=>UD()),f=mT()!=null,[h,p]=V.useState(r.reference),y=oi((S,x,T)=>{l.current.openEvent=S?x:void 0,u.emit("openchange",{open:S,event:x,reason:T,nested:f}),n?.(S,x,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:l,open:e,onOpenChange:y,elements:v,events:u,floatingId:o,refs:g}),[e,y,v,u,o,g])}function oN(t){t===void 0&&(t={});const{nodeId:e}=t,n=sN({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,o=r.elements,[l,u]=V.useState(null),[f,h]=V.useState(null),y=o?.domReference||l,g=V.useRef(null),v=dy();Vi(()=>{y&&(g.current=y)},[y]);const S=MD({...t,elements:{...o,...f&&{reference:f}}}),x=V.useCallback(C=>{const j=pt(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;h(j),S.refs.setReference(j)},[S.refs]),T=V.useCallback(C=>{(pt(C)||C===null)&&(g.current=C,u(C)),(pt(S.refs.reference.current)||S.refs.reference.current===null||C!==null&&!pt(C))&&S.refs.setReference(C)},[S.refs]),D=V.useMemo(()=>({...S.refs,setReference:T,setPositionReference:x,domReference:g}),[S.refs,T,x]),M=V.useMemo(()=>({...S.elements,domReference:y}),[S.elements,y]),O=V.useMemo(()=>({...S,...r,refs:D,elements:M,nodeId:e}),[S,D,M,e,r]);return Vi(()=>{r.dataRef.current.floatingContext=O;const C=v?.nodesRef.current.find(j=>j.id===e);C&&(C.context=O)}),V.useMemo(()=>({...S,context:O,refs:D,elements:M}),[S,D,M,O])}function ip(t,e,n){const r=new Map,o=n==="item";let l=t;if(o&&t){const{[BS]:u,[LS]:f,...h}=t;l=h}return{...n==="floating"&&{tabIndex:-1,[$D]:""},...l,...e.map(u=>{const f=u?u[n]:null;return typeof f=="function"?t?f(t):null:f}).concat(t).reduce((u,f)=>(f&&Object.entries(f).forEach(h=>{let[p,y]=h;if(!(o&&[BS,LS].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,x=new Array(S),T=0;T<S;T++)x[T]=arguments[T];return(v=r.get(p))==null?void 0:v.map(D=>D(...x)).find(D=>D!==void 0)}}}else u[p]=y}),u),{})}}function aN(t){t===void 0&&(t=[]);const e=t.map(f=>f?.reference),n=t.map(f=>f?.floating),r=t.map(f=>f?.item),o=V.useCallback(f=>ip(f,t,"reference"),e),l=V.useCallback(f=>ip(f,t,"floating"),n),u=V.useCallback(f=>ip(f,t,"item"),r);return V.useMemo(()=>({getReferenceProps:o,getFloatingProps:l,getItemProps:u}),[o,l,u])}const lN=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function cN(t,e){var n,r;e===void 0&&(e={});const{open:o,elements:l,floatingId:u}=t,{enabled:f=!0,role:h="dialog"}=e,p=pT(),y=((n=l.domReference)==null?void 0:n.id)||p,g=V.useMemo(()=>{var O;return((O=Yp(l.floating))==null?void 0:O.id)||u},[l.floating,u]),v=(r=lN.get(h))!=null?r:h,x=mT()!=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"&&x&&{role:"menuitem"},...h==="select"&&{"aria-autocomplete":"none"},...h==="combobox"&&{"aria-autocomplete":"list"}},[v,g,x,o,y,h]),D=V.useMemo(()=>{const O={id:g,...v&&{role:v}};return v==="tooltip"||h==="label"?O:{...O,...v==="menu"&&{"aria-labelledby":y}}},[v,g,y,h]),M=V.useCallback(O=>{let{active:C,selected:j}=O;const _={role:"option",...C&&{id:g+"-fui-option"}};switch(h){case"select":case"combobox":return{..._,"aria-selected":j}}return{}},[g,h]);return V.useMemo(()=>f?{reference:T,floating:D,item:M}:{},[f,T,D,M])}const xl=t=>Array.isArray(t)?t:[t],uN=(t,e)=>{const n=[[],[]];for(const r of t)e(r)?n[0].push(r):n[1].push(r);return n},gT=Array,is=(t,e)=>t.includes(e),fN=(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),os=(t,e)=>e==null?t??[]:t==null?xl(e):t.concat(e),dN=(...t)=>t.reduce(os,[]),us=(t,e,n)=>{if(t===void 0)return Array.isArray(e)?e:[e];const r=n?.isEqual??((o,l)=>o===l);for(const o of xl(e))t.some(l=>r(l,o))||t.push(o);return t},hN=(t,e)=>t.reduce((n,r)=>{const o=r[e];return n[o]=Ie(n[o],r),n},{}),Co=(t,e,n)=>t.length===e.length&&t.every(n?.isEqual?(r,o)=>n.isEqual(r,e[o]):(r,o)=>r===e[o]),vs=(t,e)=>Jn(t)===e,Jn=t=>{const e=typeof t;return e==="object"?t===null?"null":"object":e==="function"?"object":e},qi={boolean:"boolean",null:"null",undefined:"undefined",bigint:"a bigint",number:"a number",object:"an object",string:"a string",symbol:"a symbol"},pN={...qi,function:"a function"};class mN extends Error{}const Tt=t=>Do(t,mN),Do=(t,e=Error)=>{throw new e(t)};class yN extends Error{name="ParseError"}const Z=t=>Do(t,yN),bT=t=>` ${t}`,He=(t,e)=>{const n={},r=Array.isArray(t);let o=!1;for(const[l,u]of Object.entries(t).entries()){const f=r?e(l,u[1]):e(...u,l);o||=typeof f[0]=="number";const h=Array.isArray(f[0])||f.length===0?f:[f];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},vT=Object.entries,yi=(t,e)=>t in e,my=(t,e)=>e in t;class gN{constructor(e){Object.assign(this,e)}}const bN=class{};class ST extends bN{}const vN=(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]},SN=(t,e)=>vN(t,e)[1],Tl=t=>Object.keys(t).length===0,Uu=t=>[...Object.entries(t),...Object.getOwnPropertySymbols(t).map(e=>[e,t[e]])],wN=(t,e)=>Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)),xN=t=>{const e=Object.keys(t).sort(),n={};for(let r=0;r<e.length;r++)n[e[r]]=t[e[r]];return n},Li=bT("represents an uninitialized value"),TN=t=>Object.values(t).filter(e=>typeof e=="number"?!0:typeof t[e]!="number"),wT={Array,Boolean,Date,Error,Function,Map,Number,Promise,RegExp,Set,String,WeakMap,WeakSet},xT=globalThis.File??Blob,TT={ArrayBuffer,Blob,File:xT,FormData,Headers,Request,Response,URL},AN={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array},No={...wT,...TT,...AN,String,Number,Boolean},yy=t=>{let e=Object.getPrototypeOf(t);for(;e?.constructor&&(!yi(e.constructor.name,No)||!(t instanceof No[e.constructor.name]));)e=Object.getPrototypeOf(e);const n=e?.constructor?.name;if(!(n===void 0||n==="Object"))return n},Xp=t=>typeof t=="object"&&t!==null?yy(t)??"object":Jn(t),Ft=Array.isArray,EN={Array:"an array",Function:"a function",Date:"a Date",RegExp:"a RegExp",Error:"an Error",Map:"a Map",Set:"a Set",String:"a String object",Number:"a Number object",Boolean:"a Boolean object",Promise:"a Promise",WeakMap:"a WeakMap",WeakSet:"a WeakSet"},RN={ArrayBuffer:"an ArrayBuffer instance",Blob:"a Blob instance",File:"a File instance",FormData:"a FormData instance",Headers:"a Headers instance",Request:"a Request instance",Response:"a Response instance",URL:"a URL instance"},ON={Int8Array:"an Int8Array",Uint8Array:"a Uint8Array",Uint8ClampedArray:"a Uint8ClampedArray",Int16Array:"an Int16Array",Uint16Array:"a Uint16Array",Int32Array:"an Int32Array",Uint32Array:"a Uint32Array",Float32Array:"a Float32Array",Float64Array:"a Float64Array",BigInt64Array:"a BigInt64Array",BigUint64Array:"a BigUint64Array"},_N={...EN,...RN,...ON},gy=t=>{const e=Object(t).name??null;return e&&yi(e,No)&&No[e]===t?e:null},JS=(t,e)=>{let n=t.prototype;for(;n!==null;){if(n===e.prototype)return!0;n=Object.getPrototypeOf(n)}return!1},kN=t=>AT(t,new Map),AT=(t,e)=>{if(typeof t!="object"||t===null)return t;if(e?.has(t))return e.get(t);const n=gy(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 l in o){const u=o[l];"get"in u||"set"in u||(u.value=AT(u.value,e))}}return Object.defineProperties(r,o),r},MN=t=>{let e=Li;return()=>e===Li?e=t():e},mf=t=>typeof t=="function"&&t.length===0,CN=class extends Function{constructor(...t){const e=t.slice(0,-1),n=t.at(-1);try{super(...e,n)}catch(r){return Tt(`Encountered an unexpected error while compiling your definition:
|
|
65
|
+
Message: ${r}
|
|
66
66
|
Source: (${t.slice(0,-1)}) => {
|
|
67
67
|
${t.at(-1)}
|
|
68
|
-
}`)}}};class Ko{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const DN=MN(()=>{try{return new Function("return false")()}catch{return!0}});class
|
|
69
|
-
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},jN=NN??{},BN={fileName:$N,env:jN},LN=t=>t[0].toUpperCase()+t.slice(1),ET=t=>new RegExp(VN(t),typeof t=="string"?"":t.flags),VN=t=>`^(?:${typeof t=="string"?t:t.source})$`,
|
|
70
|
-
`+
|
|
71
|
-
${
|
|
72
|
-
${n}]`:`[${l}]`}const o=t.constructor.name;if(o==="Object"){const l=Uu(t).map(([u,
|
|
68
|
+
}`)}}};class Ko{constructor(e,...[n]){return Object.assign(Object.setPrototypeOf(e.bind(n?.bind??this),this.constructor.prototype),n?.attach)}}const DN=MN(()=>{try{return new Function("return false")()}catch{return!0}});class gi{constructor(){}}var NN={};const $N=()=>{try{return((new Error().stack?.split(`
|
|
69
|
+
`)[2]?.trim()||"").match(/\(?(.+?)(?::\d+:\d+)?\)?$/)?.[1]||"unknown").replace(/^file:\/\//,"")}catch{return"unknown"}},jN=NN??{},BN={fileName:$N,env:jN},LN=t=>t[0].toUpperCase()+t.slice(1),ET=t=>new RegExp(VN(t),typeof t=="string"?"":t.flags),VN=t=>`^(?:${typeof t=="string"?t:t.source})$`,Tr={negativeLookahead:t=>`(?!${t})`,nonCapturingGroup:t=>`(?:${t})`},Jp="\\",yf={" ":1,"\n":1," ":1},UN=/^-0\.?0*$/.source,RT=/[1-9]\d*/.source,zN=/\.\d+/.source,KN=/\.\d*[1-9]/.source,OT=t=>ET(Tr.negativeLookahead(UN)+Tr.nonCapturingGroup("-?"+Tr.nonCapturingGroup(Tr.nonCapturingGroup("0|"+RT)+Tr.nonCapturingGroup(t.decimalPattern)+"?")+(t.allowDecimalOnly?"|"+t.decimalPattern:"")+"?")),ZS=OT({decimalPattern:KN,allowDecimalOnly:!1}),qN=ZS.test.bind(ZS),Zp=OT({decimalPattern:zN,allowDecimalOnly:!0});Zp.test.bind(Zp);const PN=/^-?\d*\.?\d*$/,IN=t=>t.length!==0&&PN.test(t),zu=ET(Tr.negativeLookahead("^-0$")+"-?"+Tr.nonCapturingGroup(Tr.nonCapturingGroup("0|"+RT))),HN=zu.test.bind(zu),Qp=/^-?\d+$/,FN=Qp.test.bind(Qp),_T={number:"a number",bigint:"a bigint",integer:"an integer"},kT=(t,e)=>`'${t}' was parsed as ${_T[e]} but could not be narrowed to a literal value. Avoid unnecessary leading or trailing zeros and other abnormal notation`,GN=(t,e)=>e==="number"?qN(t):HN(t),YN=(t,e)=>e==="number"?Number(t):Number.parseInt(t),XN=(t,e)=>e==="number"?IN(t):FN(t),JN=(t,e)=>by(t,"number",e),ZN=(t,e)=>by(t,"number",{...e,strict:!0}),QN=(t,e)=>by(t,"integer",e),by=(t,e,n)=>{const r=YN(t,e);return!Number.isNaN(r)&&XN(t,e)?n?.strict?GN(t,e)?r:Z(kT(t,e)):r:n?.errorOnFail?Z(n?.errorOnFail===!0?`Failed to parse ${_T[e]} from '${t}'`:n?.errorOnFail):void 0},WN=t=>{if(t[t.length-1]!=="n")return;const e=t.slice(0,-1);let n;try{n=BigInt(e)}catch{return}if(zu.test(e))return n;if(Qp.test(e))return Z(kT(t,"bigint"))},e2="0.46.0",t2={version:e2,filename:BN.fileName(),FileConstructor:xT},Al=t2,QS=new Map,rp=Object.create(null),Wp=t=>{const e=QS.get(t);if(e)return e;let n=n2(t);return rp[n]?n=`${n}${rp[n]++}`:rp[n]=1,Al[n]=t,QS.set(t,n),n},fl=t=>/^[$A-Z_a-z][\w$]*$/.test(t),n2=t=>{switch(typeof t){case"object":{if(t===null)break;const e=yy(t)??"object";return e[0].toLowerCase()+e.slice(1)}case"function":return fl(t.name)?t.name:"fn";case"symbol":return t.description&&fl(t.description)?t.description:"symbol"}return Tt(`Unexpected attempt to register serializable value of type ${Jn(t)}`)},vy=t=>typeof t=="string"?JSON.stringify(t):typeof t=="bigint"?`${t}n`:`${t}`,i2=(t,e={})=>Wa(t,{onUndefined:"$ark.undefined",onBigInt:n=>`$ark.bigint-${n}`,...e},[]),qe=(t,e)=>{switch(Jn(t)){case"object":const n=t,r=n.constructor.name;return r==="Object"||r==="Array"?e?.quoteKeys===!1?Ku(n,e?.indent??0,""):JSON.stringify(Wa(n,$o,[]),null,e?.indent):Ku(n,e?.indent??0,"");case"symbol":return $o.onSymbol(t);default:return vy(t)}},Ku=(t,e,n)=>{if(typeof t=="function")return $o.onFunction(t);if(typeof t!="object"||t===null)return vy(t);const r=n+" ".repeat(e);if(Array.isArray(t)){if(t.length===0)return"[]";const l=t.map(u=>Ku(u,e,r)).join(`,
|
|
70
|
+
`+r);return e?`[
|
|
71
|
+
${r}${l}
|
|
72
|
+
${n}]`:`[${l}]`}const o=t.constructor.name;if(o==="Object"){const l=Uu(t).map(([u,f])=>{const h=typeof u=="symbol"?$o.onSymbol(u):fl(u)?u:JSON.stringify(u),p=Ku(f,e,r);return`${r}${h}: ${p}`});return l.length===0?"{}":e?`{
|
|
73
73
|
${l.join(`,
|
|
74
74
|
`)}
|
|
75
|
-
${n}}`:`{${l.join(", ")}}`}return t instanceof Date?El(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},$o={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${Wp(t)})`,onFunction:t=>`Function(${Wp(t)})`},Wa=(t,e,n)=>{switch(
|
|
76
|
-
`,this}const(e,n){return this.line(`const ${e} = ${n}`),this}let(e,n){return this.line(`let ${e} = ${n}`)}set(e,n){return this.line(`${e} = ${n}`)}if(e,n){return this.block(`if (${e})`,n)}elseIf(e,n){return this.block(`else if (${e})`,n)}else(e){return this.block("else",e)}for(e,n,
|
|
77
|
-
`).map(
|
|
78
|
-
`):this.body} }`}compile(){return new CN(...this.argNames,this.body)}}const Ol=t=>
|
|
79
|
-
`)}_add(e){const n=this.byPath[e.propString];if(n){if(n.hasCode("union")&&n.errors.length===0)return;const
|
|
75
|
+
${n}}`:`{${l.join(", ")}}`}return t instanceof Date?El(t):"expression"in t&&typeof t.expression=="string"?t.expression:o},$o={onCycle:()=>"(cycle)",onSymbol:t=>`Symbol(${Wp(t)})`,onFunction:t=>`Function(${Wp(t)})`},Wa=(t,e,n)=>{switch(Jn(t)){case"object":{const r=t;if("toJSON"in r&&typeof r.toJSON=="function")return r.toJSON();if(typeof r=="function")return $o.onFunction(r);if(n.includes(r))return"(cycle)";const o=[...n,r];if(Array.isArray(r))return r.map(u=>Wa(u,e,o));if(r instanceof Date)return r.toDateString();const l={};for(const u in r)l[u]=Wa(r[u],e,o);for(const u of Object.getOwnPropertySymbols(r))l[e.onSymbol?.(u)??u.toString()]=Wa(r[u],e,o);return l}case"symbol":return $o.onSymbol(t);case"bigint":return e.onBigInt?.(t)??`${t}n`;case"undefined":return e.onUndefined??"undefined";case"string":return t.replaceAll("\\","\\\\");default:return t}},El=t=>{const e=t.getFullYear(),n=t.getMonth(),r=t.getDate(),o=t.getHours(),l=t.getMinutes(),u=t.getSeconds(),f=t.getMilliseconds();if(n===0&&r===1&&o===0&&l===0&&u===0&&f===0)return`${e}`;const h=`${r2[n]} ${r}, ${e}`;if(o===0&&l===0&&u===0&&f===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)),f?p+=`.${o2(f,3)}`:s2.test(p)&&(p=p.slice(0,-3)),`${p+y}, ${h}`},r2=["January","February","March","April","May","June","July","August","September","October","November","December"],s2=/:\d\d:00$/,o2=(t,e)=>String(t).padStart(e,"0"),MT=(t,e,...[n])=>{const r=n?.stringifySymbol??qe;let o=t;switch(typeof e){case"string":o=fl(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(`${qe(e)} must be a PropertyKey or stringifyNonKey must be passed to options`)}return o},Rl=(t,...e)=>t.reduce((n,r)=>MT(n,r,...e),"");class CT extends gT{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"?qe(this[e]):this[e]);return this.cache.json}stringify(){return this.cache.stringify?this.cache.stringify:this.cache.stringify=Rl(this)}stringifyAncestors(){if(this.cache.stringifyAncestors)return this.cache.stringifyAncestors;let e="";const n=[e];for(const r of this)e=MT(e,r),n.push(e);return this.cache.stringifyAncestors=n}}class a2{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]===Jp)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 yf))}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 em="$ark",l2=2;for(;em in globalThis;)em=`$ark${l2++}`;const DT=em;globalThis[DT]=Al;const ie=Al,c2=t=>`${DT}.${t}`,Zt=t=>c2(Wp(t));class NT extends ST{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 $T(e,n)}index(e,n=!1){return jT(`${e}`,n)}line(e){return this.body+=`${" ".repeat(this.indentation)}${e}
|
|
76
|
+
`,this}const(e,n){return this.line(`const ${e} = ${n}`),this}let(e,n){return this.line(`let ${e} = ${n}`)}set(e,n){return this.line(`${e} = ${n}`)}if(e,n){return this.block(`if (${e})`,n)}elseIf(e,n){return this.block(`else if (${e})`,n)}else(e){return this.block("else",e)}for(e,n,r=0){return this.block(`for (let i = ${r}; ${e}; i++)`,n)}forIn(e,n){return this.block(`for (const k in ${e})`,n)}block(e,n,r=""){return this.line(`${e} {`),this.indent(),n(this),this.dedent(),this.line(`}${r}`)}return(e=""){return this.line(`return ${e}`)}write(e="anonymous",n=0){return`${e}(${this.argNames.join(", ")}) { ${n?this.body.split(`
|
|
77
|
+
`).map(r=>" ".repeat(n)+`${r}`).join(`
|
|
78
|
+
`):this.body} }`}compile(){return new CN(...this.argNames,this.body)}}const Ol=t=>vs(t,"object")||typeof t=="symbol"?Zt(t):vy(t),$T=(t,e=!1)=>typeof t=="string"&&fl(t)?`${e?"?":""}.${t}`:jT(u2(t),e),u2=t=>typeof t=="symbol"?Zt(t):JSON.stringify(t),jT=(t,e=!1)=>`${e?"?.":""}[${t}]`;class sp extends NT{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),l=typeof e=="string"?e:e.id;return o?`${this.referenceToId(l,n)}(${r}, ${this.ctx})`:`${this.referenceToId(l,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 BT=t=>He(t,(e,n)=>[e,Ft(n)?[...n]:n]),Pi=bT("arkKind"),pe=(t,e)=>t?.[Pi]===e,Xt=t=>pe(t,"root")||pe(t,"constraint"),f2=["unit","proto","domain"],gf=["required","optional","index","sequence"],LT=["pattern","divisor","exactLength","max","min","maxLength","minLength","before","after"],Sy=[...LT,...gf,"structure","predicate"],bf=["alias","union","morph","unit","intersection","proto","domain"],d2=[...bf,...Sy],VT=He(Sy,(t,e)=>[e,1]),h2=He([...gf,"undeclared"],(t,e)=>[e,1]),UT=He(d2,(t,e)=>[e,t]),mu=t=>typeof t=="string"&&t in UT,qu=t=>UT[t],wy=t=>bf.slice(qu(t)+1);[...wy("union")];[...wy("morph")];const ms=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:Ol(t),vf=t=>{let e="{ ";for(const[n,r]of Object.entries(t))e+=`${n}: ${Ol(r)}, `;return e+" }"},ut=t=>{const e=t;return e.hasAssociatedError&&(e.defaults.expected??=n=>"description"in n?n.description:e.defaults.description(n),e.defaults.actual??=n=>qe(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 p2 extends Error{name="ToJsonSchemaError";code;context;constructor(e,n){super(qe(n,{quoteKeys:!1,indent:4})),this.code=e,this.context=n}hasCode(e){return this.code===e}}const m2={dialect:"https://json-schema.org/draft/2020-12/schema",useRefs:!1,fallback:{arrayObject:t=>Ot.throw("arrayObject",t),arrayPostfix:t=>Ot.throw("arrayPostfix",t),defaultValue:t=>Ot.throw("defaultValue",t),domain:t=>Ot.throw("domain",t),morph:t=>Ot.throw("morph",t),patternIntersection:t=>Ot.throw("patternIntersection",t),predicate:t=>Ot.throw("predicate",t),proto:t=>Ot.throw("proto",t),symbolKey:t=>Ot.throw("symbolKey",t),unit:t=>Ot.throw("unit",t),date:t=>Ot.throw("date",t)}},Ot={Error:p2,throw:(...t)=>{throw new Ot.Error(...t)},throwInternalOperandError:(t,e)=>Tt(`Unexpected JSON Schema input for ${t}: ${qe(e)}`),defaultConfig:m2};ie.config??={};const tm=(t,e)=>{if(!e)return t;const n={...t};let r;for(r in e){const o={...t.keywords};if(r==="keywords"){for(const l in e[r]){const u=e.keywords[l];u!==void 0&&(o[l]=typeof u=="string"?{description:u}:u)}n.keywords=o}else r==="toJsonSchema"?n[r]=zT(t.toJsonSchema,e.toJsonSchema):mu(r)?n[r]={...t[r],...e[r]}:n[r]=e[r]}return n},zT=((t,e)=>{if(!t)return e??{};if(!e)return t;const n={...t};let r;for(r in e)r==="fallback"?n.fallback=y2(t.fallback,e.fallback):n[r]=e[r];return n}),y2=(t,e)=>{t=WS(t),e=WS(e);const n={};let r;for(r in Ot.defaultConfig.fallback)n[r]=e[r]??e.default??t[r]??t.default??Ot.defaultConfig.fallback[r];return n},WS=t=>typeof t=="function"?{default:t}:t??{};class jo extends ST{[Pi]="error";path;data;nodeConfig;input;ctx;constructor({prefixPath:e,relativePath:n,...r},o){super(),this.input=r,this.ctx=o,wN(this,r);const l=o.data;r.code==="union"&&(r.errors=r.errors.flatMap(f=>{const h=f.hasCode("union")?f.errors:[f];return!e&&!n?h:h.map(p=>p.transform(y=>({...y,path:dN(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 CT(...u),this.data="data"in r?r.data:l}transform(e){return new jo(e({data:this.data,path:this.path,...this.input}),this.ctx)}hasCode(e){return this.code===e}get propString(){return Rl(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 Mr extends gT{[Pi]="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 g2(this)}add(e){this.includes(e)||this._add(e)}transform(e){const n=new Mr(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 jo({...n,path:[...this.ctx.path,...n.path]},this.ctx))}affectsPath(e){return this.length===0?!1:e.stringifyAncestors().some(n=>n in this.byPath)||e.stringify()in this.byAncestorPath}get summary(){return this.toString()}get issues(){return this}toJSON(){return[...this.map(e=>e.toJSON())]}toString(){return this.join(`
|
|
79
|
+
`)}_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 jo({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 g2 extends Error{name="TraversalError";constructor(e){e.length===1?super(e.summary):super(`
|
|
80
80
|
`+e.map(n=>` • ${b2(n)}`).join(`
|
|
81
81
|
`)),Object.defineProperty(this,"arkErrors",{value:e,enumerable:!1})}}const b2=t=>t.toString().split(`
|
|
82
82
|
`).join(`
|
|
83
|
-
`);class mo{path=[];errors=new Ms(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 Rl(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 CT(...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 jo(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:s}of e)this.errors.affectsPath(n)||this.applyMorphsAtPath(n,s)}}applyMorphsAtPath(e,n){const s=e.at(-1);let o;if(s!==void 0){o=this.root;for(let l=0;l<e.length-1;l++)o=o[e[l]]}this.path=[...e];for(const l of n){const u=Xt(l),d=l(o===void 0?this.root:o[s],this);if(d instanceof jo){this.errors.add(d);break}if(d instanceof Ms){u||this.errors.merge(d);break}o===void 0?this.root=d:o[s]=d,this.applyQueuedMorphs()}}}const Ii=(t,e,n)=>{if(!n)return e();n.path.push(t);const s=e();return n.path.pop(),s};class KT extends Ko{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,l,u=this.onFail)=>l?(this.traverseApply(o,l),l.hasError()?l.errors:l.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,l)=>x2(o,l.shallowReferences),[this]);const s=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,!s){const l=this.children[o].flatRefs;for(let u=0;u<l.length;u++){const d=l[u];if(!this.flatRefs.some(h=>qT(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,l)=>o.path.length>l.path.length?1:o.path.length<l.path.length?-1:o.propString>l.propString?1:o.propString<l.propString||o.node.expression<l.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 mo(o,this.$.resolvedConfig)):o=>this.traverseAllows(o)}createRootApply(){switch(this.rootApplyStrategy){case"allows":return(n,s)=>{if(this.allows(n))return n;const o=new mo(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(s)};case"contextual":return(n,s)=>{const o=new mo(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(s)};case"optimistic":this.contextFreeMorph=this.shallowMorphs[0];const e=this.$.resolvedConfig.clone;return(n,s)=>{if(this.allows(n))return this.contextFreeMorph(e&&(typeof n=="object"&&n!==null||typeof n=="function")?e(n):n);const o=new mo(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(s)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Tt(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=w2(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=qu(this.kind);precompilation;assert=(e,n)=>this(e,n,s=>s.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[s,o]of this.innerEntries){const l=this.impl.keys[s];if(l.reduceIo)l.reduceIo(e,n,o);else if(l.child){const u=o;n[s]=Ft(u)?u.map(d=>d[e]):u[e]}else n[s]=o}return this.$.node(this.kind,n)}toJSON(){return this.json}toString(){return`Type<${this.expression}>`}equals(e){const n=Xt(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&&Do(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return ir(e,this.kind)||Do(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return ir(f2,this.kind)}isConstraint(){return ir(Sy,this.kind)}isStructural(){return ir(gf,this.kind)}isRefinement(){return ir(LT,this.kind)}isRoot(){return ir(bf,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(s=>s.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 s=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 l=He(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const v=g;if(!Ft(v)){const x=v._transform(e,n);return x?[y,x]:[]}if(v.length===0)return[y,g];const S=v.flatMap(x=>x._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const u=Object.assign(l,{meta:this.meta}),d=n.selected&&!n.selected.includes(this)?u:e(this.kind,u,n);if(d===null)return null;if(Xt(d))return o=d;const h=Object.keys(d);return(h.length===0||h.length===1&&h[0]==="meta")&&!Tl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in d)?n.undeclaredKeyHandling?{...d,value:ie.intrinsic.unknown}:null:(this.kind==="morph"&&(d.in??=ie.intrinsic.unknown),o=s.node(this.kind,d,n.parseOptions))}configureReferences(e,n="references"){const s=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(s.boundary==="self")return this.$.node(this.kind,o(this.kind,{...this.inner,meta:this.meta}));const l=this._select(s),u=l&&xl(l),d=s.boundary==="child"?(h,p)=>p.root.children.includes(h):s.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&&Do(ew(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&Do(ew(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?mi(t,Xa.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},ew=(t,e)=>`${t} had no references matching ${qe(e)}.`,v2=t=>Rl(t,{stringifyNonKey:e=>e.expression}),S2=/"(\$ark\.[^"]+)"/g,w2=t=>JSON.stringify(t).replaceAll(S2,"$1"),Rs=(t,e)=>({path:t,node:e,propString:v2(t)}),qT=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),tw=(t,e)=>ur(t,e,{isEqual:qT}),x2=(t,e)=>ur(t,e,{isEqual:(n,s)=>n.equals(s)});class ae extends Array{static init(e,n,s,o){return new ae({kind:e,l:n,r:s,path:o?.path??[],optional:o?.optional??!1})}add(e,n,s,o){return this.push({kind:e,l:n,r:s,path:o?.path??[],optional:o?.optional??!1}),this}get summary(){return this.describeReasons()}describeReasons(){if(this.length===1){const{path:e,l:n,r:s}=this[0],o=Rl(e);return PT(`Intersection${o&&` at ${o}`} of ${nw(n,s)}`)}return`The following intersections result in unsatisfiable types:
|
|
84
|
-
• ${this.map(({path:e,l:n,r
|
|
85
|
-
• `)}`}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(s=>({...s,path:[e,...s.path],optional:s.optional||n==="optional"}))}toNeverIfDisjoint(){return ie.intrinsic.never}}const nw=(t,e)=>`${nm(t)} and ${nm(e)}`,nm=t=>Xt(t)?t.expression:Ft(t)?t.map(nm).join(" | ")||"never":String(t),PT=t=>`${t} results in an unsatisfiable type`,lo={},Hi=(t,e,n)=>jt(t,e,{$:n,invert:!1,pipe:!1}),im=(t,e,n)=>jt(t,e,{$:n,invert:!1,pipe:!0}),jt=((t,e,n)=>{const s=n.pipe?"|>":"&",o=`${t.hash}${s}${e.hash}`;if(lo[o]!==void 0)return lo[o];if(!n.pipe){const d=`${e.hash}${s}${t.hash}`;if(lo[d]!==void 0){const h=lo[d],p=h instanceof ae?h.invert():h;return lo[o]=p,p}}const l=!n.pipe||!t.includesTransform&&!e.includesTransform;if(l&&t.equals(e))return t;let u=l?sm(t,e,n):t.hasKindIn(...bf)?T2(t,e,n):sm(t,e,n);return Xt(u)&&(t.equals(u)?u=t:e.equals(u)&&(u=e)),lo[o]=u,u}),sm=(t,e,n)=>{const s=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(s===t.kind)return o(t,e,n);{let l=o(e,t,{...n,invert:!n.invert});return l instanceof ae&&(l=l.invert()),l}},T2=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?iw(e,t,n):iw(t,e,n):sm(t,e,n),iw=(t,e,n)=>t.distribute(s=>A2(s,e,n),s=>{const o=s.filter(Xt);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 l={branches:o};return n.$.parseSchema(l)}),A2=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const l=jt(t.lastMorphIfNode,e,n);if(l instanceof ae)return l;o[o.length-1]=l}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=jt(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 KT{constructor(e,n){super(e,n),Object.defineProperty(this,Pi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Hi(this,e,this.$)}}class Sf 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 vf(this.errorContext)}}const sn=t=>(e,n)=>{if(Ft(e)){if(e.length===0)return;const o=e.map(l=>n.$.node(t,l));return t==="predicate"?o:o.sort((l,u)=>l.hash<u.hash?-1:1)}const s=n.$.node(t,e);return s.hasOpenIntersection()?[s]:s},Pu=t=>{const e=t.r.shift();if(!e){let s=t.l.length===0&&t.kind==="structure"?ie.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,E2(t.l)),{prereduced:!0});for(const o of t.roots){if(s instanceof ae)return s;s=jt(o,s,t.ctx)}return s}let n=!1;for(let s=0;s<t.l.length;s++){const o=jt(t.l[s],e,t.ctx);if(o!==null){if(o instanceof ae)return o;if(n){if(!t.l.includes(o))return Tt(`Unexpectedly encountered multiple distinct intersection results for refinement ${o}`)}else{if(o.isRoot())return t.roots.push(o),t.l.splice(s),Pu(t);t.l[s]=o,n=!0}}}if(n||t.l.push(e),t.kind==="intersection"&&e.impliedSiblings)for(const s of e.impliedSiblings)ur(t.r,s);return Pu(t)},Iu=t=>Object.entries(t).flatMap(([n,s])=>n in VT?s:[]).sort((n,s)=>n.precedence<s.precedence?-1:n.precedence>s.precedence?1:n.kind==="predicate"&&s.kind==="predicate"?0:n.hash<s.hash?-1:1),E2=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 Tt(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},R2=(...t)=>Z(O2(...t)),O2=(t,e,n)=>{const s=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${LN(t)} operand must be ${e.description} (was ${s})`},_2=(t,e,n)=>new Hu(t,e,n,n,null);class IT extends Ko{}class Hu extends Ko{[Pi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,s,o,l){super((...u)=>{const d=He(this.names,(h,p)=>{const y=this.arg$.parse(u[h]);return y.extends(this.constraints[h])||Z(k2(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.$=s,this.arg$=o,this.hkt=l,this.description=l?new l().description??`a generic type for ${l.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof IT}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:i2(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,ie.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 k2=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,M2=ut({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 C2 extends qo{serializedPredicate=Zt(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=vf(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 HT={implementation:M2,Node:C2},D2=ut({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Z($2(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/j2(t.rule,e.rule))})},obviatesBasisDescription:!0});class N2 extends Sf{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=ie.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const FT={implementation:D2,Node:N2},$2=t=>`divisor must be an integer (was ${t})`,j2=(t,e)=>{let n,s=t,o=e;for(;o!==0;)n=o,o=s%o,s=n;return s};class Po extends Sf{boundOperandKind=U2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=z2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${B2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?K2(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 B2={"<":">=","<=":">",">":"<=",">=":"<"},L2={min:"max",minLength:"maxLength",after:"before"},GT={parse:t=>t||void 0},YT=t=>e=>{if(typeof e=="number")return{rule:e};const{exclusive:n,...s}=e;return n?{...s,rule:t==="minLength"?s.rule+1:s.rule-1}:s},XT=t=>e=>{if(typeof e=="number"||typeof e=="string"||e instanceof Date)return{rule:e};const{exclusive:n,...s}=e;if(!n)return s;const o=typeof s.rule=="number"?s.rule:typeof s.rule=="string"?new Date(s.rule).valueOf():s.rule.valueOf();return n?{...s,rule:t==="after"?o+1:o-1}:s},JT=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,V2=(t,e)=>`${t} bound must be a positive integer (was ${e})`,xy=t=>e=>((!Number.isInteger(e)||e<0)&&Z(V2(t,e)),e),U2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},z2=(t,e)=>`${mi(t,L2)?">":"<"}${e?"":"="}`,K2=t=>typeof t=="string"?t:new Date(t).toLocaleString(),q2=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,P2=ut({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JT,serialize:t=>t.toISOString()}},normalize:XT("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:El},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class I2 extends Po{impliedBasis=ie.intrinsic.Date.internal;collapsibleLimitString=El(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const ZT={implementation:P2,Node:I2},H2=ut({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JT,serialize:t=>t.toISOString()}},normalize:XT("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:El},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 F2 extends Po{collapsibleLimitString=El(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=ie.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const QT={implementation:H2,Node:F2},G2=ut({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:xy("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 Y2 extends Sf{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=ie.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 Ot.throwInternalOperandError("exactLength",e)}}}const WT={implementation:G2,Node:Y2},X2=ut({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:GT},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 J2 extends Po{impliedBasis=ie.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 eA={implementation:X2,Node:J2},Z2=ut({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:xy("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:YT("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 Po{impliedBasis=ie.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 Ot.throwInternalOperandError("maxLength",e)}}}const tA={implementation:Z2,Node:Q2},W2=ut({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:GT},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 e$ extends Po{impliedBasis=ie.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}const nA={implementation:W2,Node:e$},t$=ut({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:xy("minLength")}},reduce:t=>t.rule===0?ie.intrinsic.unknown:void 0,normalize:YT("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 n$ extends Po{impliedBasis=ie.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 Ot.throwInternalOperandError("minLength",e)}}}const iA={implementation:t$,Node:n$},i$={min:nA.implementation,max:eA.implementation,minLength:iA.implementation,maxLength:tA.implementation,exactLength:WT.implementation,after:ZT.implementation,before:QT.implementation},s$={min:nA.Node,max:eA.Node,minLength:iA.Node,maxLength:tA.Node,exactLength:WT.Node,after:ZT.Node,before:QT.Node},r$=ut({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 o$ extends Sf{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=ie.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 sA={implementation:r$,Node:o$},yu=(t,e)=>{const n=a$(t);return e&&!e.includes(n)?Z(`Root of kind ${n} should be one of ${e}`):n},a$=t=>{if(pe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in qi?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Z(sw(t));if("morphs"in t)return"morph";if("branches"in t||Ft(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 VT)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Z(sw(t))},sw=t=>`${qe(t)} is not a valid type schema`,rw={},l$=t=>Ft(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Bn={};ie.nodesByRegisteredId=Bn;const rA=t=>(rw[t]??=0,`${t}${++rw[t]}`),oA=t=>{const e=wf[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,s={},{meta:o,...l}=n,u=o===void 0?{}:typeof o=="string"?{description:o}:o,d=vT(l).sort(([p],[y])=>mu(p)?mu(y)?qu(p)-qu(y):1:mu(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!==Bi&&(v!==void 0||g.preserveUndefined)&&(s[y]=v)}if(e.reduce&&!t.prereduced){const p=e.reduce(s,t.$);if(p)return p instanceof ae?p.throw():u$(p,u)}return Ty({id:t.id,kind:t.kind,inner:s,meta:u,$:t.$})},Ty=({id:t,kind:e,inner:n,meta:s,$:o,ignoreCache:l})=>{const u=wf[e],d=vT(n),h=[];let p={};for(const[M,O]of d){const C=u.keys[M],j=C.serialize??(C.child?l$:mr);if(p[M]=j(O),C.child===!0){const _=O;Ft(_)?h.push(..._):h.push(_)}else typeof C.child=="function"&&h.push(...C.child(O))}u.finalizeInnerJson&&(p=u.finalizeInnerJson(p));let y={...p},g={};Tl(s)||(g=He(s,(M,O)=>[M,M==="examples"?O:mr(O)]),y.meta=tu(g,"description",!0)),p=tu(p,u.collapsibleKey,!1);const v=JSON.stringify({kind:e,...p});y=tu(y,u.collapsibleKey,!1);const S=tu(y,u.collapsibleKey,!0),x=JSON.stringify({kind:e,...y});if(o.nodesByHash[x]&&!l)return o.nodesByHash[x];const T={id:t,kind:e,impl:u,inner:n,innerEntries:d,innerJson:p,innerHash:v,meta:s,metaJson:g,json:y,hash:x,collapsibleJson:S,children:h};if(e!=="intersection")for(const M in n)M!=="in"&&M!=="out"&&(T[M]=n[M]);const D=new yj[e](T,o);return o.nodesByHash[x]=D},c$=(t,e)=>t.id===e?t:(Xt(Bn[e])&&Tt(`Unexpected attempt to overwrite node id ${e}`),Ty({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),u$=(t,e,n)=>Ty({id:rA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),tu=(t,e,n)=>{const s=Object.keys(t);if(s.length===1&&s[0]===e){const o=t[e];if(n||vr(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},rm=(t,e,n)=>{if(t.key!==e.key)return null;const s=t.key;let o=jt(t.value,e.value,n);const l=t.required||e.required?"required":"optional";if(o instanceof ae)if(l==="optional")o=ie.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(l==="required")return n.$.node("required",{key:s,value:o});const u=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Z(lA(t.default,e.default)):t.default:e.hasDefault()?e.default:Bi;return n.$.node("optional",{key:s,value:o,default:u})};class aA extends qo{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=ie.intrinsic.object.internal;serializedKey=Ol(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Ie(this.value.flatRefs.map(e=>Rs([this.key,...e.path],e.node)),Rs([this.key],this.value));_transform(e,n){n.path.push(this.key);const s=super._transform(e,n);return n.path.pop(),s}hasDefault(){return"default"in this.inner}traverseAllows=(e,n)=>this.key in e?Ii(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Ii(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 lA=(t,e)=>`Invalid intersection of default values ${qe(t)} & ${qe(e)}`,f$=ut({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:rm}});class d$ extends aA{constructor(...e){super(...e),"default"in this.inner&&Ey(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} = ${qe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=p$(this);defaultValueMorphRef=this.defaultValueMorph&&Zt(this.defaultValueMorph)}const Ay={implementation:f$,Node:d$},h$={},p$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${mr(t.default)}}`;return h$[e]??=cA(t.key,t.value,t.default)},cA=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,l)=>(Ii(t,()=>e(o[t]=n(),l),l),o):o=>(o[t]=n(),o);const s=e.includesTransform?e.assert(n):n;return vr(s,"object")?(o,l)=>(Ii(t,()=>e(o[t]=n,l),l),o):o=>(o[t]=s,o)},Ey=(t,e,n)=>{const s=mf(e);vr(e,"object")&&!s&&Z(m$(n));const o=t.in(s?e():e);if(o instanceof Ms){n===null&&Z(`Default ${o.summary}`);const l=o.transform(u=>u.transform(d=>({...d,prefixPath:[n]})));Z(`Default for ${l.summary}`)}return e},m$=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${Ol(t)} `}must be specified as a function like () => ({my: 'object'})`;class _l extends KT{constructor(e,n){super(e,n),Object.defineProperty(this,Pi,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Ms?n:{value:n}}}}as(){return this}brand(e){return e===""?Z(y$):this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(e,n){const s=this.branches.map(e);return n?.(s)??s}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){const n=zT(this.$.resolvedConfig.toJsonSchema,e);n.useRefs||=this.isCyclic;const s=typeof n.dialect=="string"?{$schema:n.dialect}:{};return Object.assign(s,this.toJsonSchemaRecurse(n)),n.useRefs&&(s.$defs=He(this.references,(o,l)=>l.isRoot()&&!l.alwaysExpandJsonSchema?[l.id,l.toResolvedJsonSchema(n)]:[])),s}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),s=this.rawIntersect(n);return s instanceof ae?s:this.$.finalize(s)}rawIntersect(e){return Hi(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,s)=>n.intersect(s).toNeverIfDisjoint(),ie.intrinsic.unknown.internal);return e.branches.length===0&&Z(PT(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Z(g$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(s=>this.applyStructuralOperation("merge",[ow(s)??Z(aw("merge",s.expression))])))}applyStructuralOperation(e,n){return this.distribute(s=>{if(s.equals(ie.intrinsic.object)&&e!=="merge")return s;const o=ow(s);if(o||Z(aw(e,s.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const l=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{...s.inner,structure:o[l](...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(s=>s.extends(n)))}exclude(e){const n=this.$.parseDefinition(e);return this.$.schema(this.branches.filter(s=>!s.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 Ey(this,e,null),[this,"=",e]}from(e){return this.assert(e)}_pipe(...e){const n=e.reduce((s,o)=>s.rawPipeOnce(o),this);return this.$.finalize(n)}tryPipe(...e){const n=e.reduce((s,o)=>s.rawPipeOnce(pe(o,"root")?o:((l,u)=>{try{return o(l,u)}catch(d){return u.error({code:"predicate",predicate:o,actual:`aborted due to error:
|
|
86
|
-
${
|
|
87
|
-
`})}})),this);return this.$.finalize(n)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){const n=im(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,
|
|
88
|
-
${t}`,aw=(t,e)=>`${t} operand must be an object (was ${e})`,kl=(t,e)=>He(wy(t),(n,
|
|
89
|
-
Seen: [${
|
|
90
|
-
Resolution: ${qe(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:Tt(`Unexpected resolution for reference ${this.reference}: ${qe(n)}`)}get defaultShortDescription(){return qi.object}innerToJsonSchema(e){return this.resolution.toJsonSchemaRecurse(e)}traverseAllows=(e,n)=>{const
|
|
83
|
+
`);class mo{path=[];errors=new Mr(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 Rl(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 CT(...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 jo(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 l=0;l<e.length-1;l++)o=o[e[l]]}this.path=[...e];for(const l of n){const u=Xt(l),f=l(o===void 0?this.root:o[r],this);if(f instanceof jo){this.errors.add(f);break}if(f instanceof Mr){u||this.errors.merge(f);break}o===void 0?this.root=f:o[r]=f,this.applyQueuedMorphs()}}}const Ii=(t,e,n)=>{if(!n)return e();n.path.push(t);const r=e();return n.path.pop(),r};class KT extends Ko{attachments;$;onFail;includesTransform;includesContextualPredicate;isCyclic;allowsRequiresContext;rootApplyStrategy;contextFreeMorph;rootApply;referencesById;shallowReferences;flatRefs;flatMorphs;allows;get shallowMorphs(){return[]}constructor(e,n){super((o,l,u=this.onFail)=>l?(this.traverseApply(o,l),l.hasError()?l.errors:l.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,l)=>x2(o,l.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 l=this.children[o].flatRefs;for(let u=0;u<l.length;u++){const f=l[u];if(!this.flatRefs.some(h=>qT(h,f))){this.flatRefs.push(f);for(const h of f.node.branches)(h.hasKind("morph")||h.hasKind("intersection")&&h.structure?.structuralMorph!==void 0)&&this.flatMorphs.push({path:f.path,propString:f.propString,node:h})}}}Object.assign(this.referencesById,this.children[o].referencesById)}this.flatRefs.sort((o,l)=>o.path.length>l.path.length?1:o.path.length<l.path.length?-1:o.propString>l.propString?1:o.propString<l.propString||o.node.expression<l.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 mo(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 mo(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"contextual":return(n,r)=>{const o=new mo(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 mo(n,this.$.resolvedConfig);return this.traverseApply(n,o),o.finalize(r)};case"branchedOptimistic":return this.createBranchedOptimisticRootApply();default:return this.rootApplyStrategy,Tt(`Unexpected rootApplyStrategy ${this.rootApplyStrategy}`)}}compiledMeta=w2(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=qu(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 l=this.impl.keys[r];if(l.reduceIo)l.reduceIo(e,n,o);else if(l.child){const u=o;n[r]=Ft(u)?u.map(f=>f[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=Xt(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&&Do(`${this.kind} node was not of asserted kind ${e}`),this}hasKindIn(...e){return e.includes(this.kind)}assertHasKindIn(...e){return is(e,this.kind)||Do(`${this.kind} node was not one of asserted kinds ${e}`),this}isBasis(){return is(f2,this.kind)}isConstraint(){return is(Sy,this.kind)}isStructural(){return is(gf,this.kind)}isRefinement(){return is(LT,this.kind)}isRoot(){return is(bf,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 l=He(this.inner,(y,g)=>{if(!this.impl.keys[y].child)return[y,g];const v=g;if(!Ft(v)){const x=v._transform(e,n);return x?[y,x]:[]}if(v.length===0)return[y,g];const S=v.flatMap(x=>x._transform(e,n)??[]);return S.length?[y,S]:[]});delete n.seen[this.id];const u=Object.assign(l,{meta:this.meta}),f=n.selected&&!n.selected.includes(this)?u:e(this.kind,u,n);if(f===null)return null;if(Xt(f))return o=f;const h=Object.keys(f);return(h.length===0||h.length===1&&h[0]==="meta")&&!Tl(this.inner)?null:(this.kind==="required"||this.kind==="optional"||this.kind==="index")&&!("value"in f)?n.undeclaredKeyHandling?{...f,value:ie.intrinsic.unknown}:null:(this.kind==="morph"&&(f.in??=ie.intrinsic.unknown),o=r.node(this.kind,f,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 l=this._select(r),u=l&&xl(l),f=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:f,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&&Do(ew(e,n)),t),find:t=>t[0],assertFind:(t,e,n)=>(t.length===0&&Do(ew(e,n)),t[0])},normalize:t=>typeof t=="function"?{boundary:"references",method:"filter",where:t}:typeof t=="string"?yi(t,Xa.applyBoundary)?{method:"filter",boundary:t}:{boundary:"references",method:"filter",kind:t}:{boundary:"references",method:"filter",...t}},ew=(t,e)=>`${t} had no references matching ${qe(e)}.`,v2=t=>Rl(t,{stringifyNonKey:e=>e.expression}),S2=/"(\$ark\.[^"]+)"/g,w2=t=>JSON.stringify(t).replaceAll(S2,"$1"),Rr=(t,e)=>({path:t,node:e,propString:v2(t)}),qT=(t,e)=>t.propString===e.propString&&t.node.equals(e.node),tw=(t,e)=>us(t,e,{isEqual:qT}),x2=(t,e)=>us(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=Rl(e);return PT(`Intersection${o&&` at ${o}`} of ${nw(n,r)}`)}return`The following intersections result in unsatisfiable types:
|
|
84
|
+
• ${this.map(({path:e,l:n,r})=>`${e}: ${nw(n,r)}`).join(`
|
|
85
|
+
• `)}`}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 ie.intrinsic.never}}const nw=(t,e)=>`${nm(t)} and ${nm(e)}`,nm=t=>Xt(t)?t.expression:Ft(t)?t.map(nm).join(" | ")||"never":String(t),PT=t=>`${t} results in an unsatisfiable type`,lo={},Hi=(t,e,n)=>jt(t,e,{$:n,invert:!1,pipe:!1}),im=(t,e,n)=>jt(t,e,{$:n,invert:!1,pipe:!0}),jt=((t,e,n)=>{const r=n.pipe?"|>":"&",o=`${t.hash}${r}${e.hash}`;if(lo[o]!==void 0)return lo[o];if(!n.pipe){const f=`${e.hash}${r}${t.hash}`;if(lo[f]!==void 0){const h=lo[f],p=h instanceof ae?h.invert():h;return lo[o]=p,p}}const l=!n.pipe||!t.includesTransform&&!e.includesTransform;if(l&&t.equals(e))return t;let u=l?rm(t,e,n):t.hasKindIn(...bf)?T2(t,e,n):rm(t,e,n);return Xt(u)&&(t.equals(u)?u=t:e.equals(u)&&(u=e)),lo[o]=u,u}),rm=(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 l=o(e,t,{...n,invert:!n.invert});return l instanceof ae&&(l=l.invert()),l}},T2=(t,e,n)=>t.includesTransform||e.includesTransform?n.invert?iw(e,t,n):iw(t,e,n):rm(t,e,n),iw=(t,e,n)=>t.distribute(r=>A2(r,e,n),r=>{const o=r.filter(Xt);if(o.length===0)return ae.init("union",t.branches,e.branches);if(o.length<t.branches.length||!t.branches.every((u,f)=>u.in.equals(o[f].in)))return n.$.parseSchema(o);if(o.length===1)return o[0];const l={branches:o};return n.$.parseSchema(l)}),A2=(t,e,n)=>{if(t.hasKind("morph")){const o=[...t.morphs];if(t.lastMorphIfNode){const l=jt(t.lastMorphIfNode,e,n);if(l instanceof ae)return l;o[o.length-1]=l}else o.push(e);return n.$.node("morph",{morphs:o,in:t.inner.in})}if(e.hasKind("morph")){const o=jt(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 KT{constructor(e,n){super(e,n),Object.defineProperty(this,Pi,{value:"constraint",enumerable:!1})}impliedSiblings;intersect(e){return Hi(this,e,this.$)}}class Sf 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 vf(this.errorContext)}}const rn=t=>(e,n)=>{if(Ft(e)){if(e.length===0)return;const o=e.map(l=>n.$.node(t,l));return t==="predicate"?o:o.sort((l,u)=>l.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"?ie.intrinsic.unknown.internal:t.ctx.$.node(t.kind,Object.assign(t.baseInner,E2(t.l)),{prereduced:!0});for(const o of t.roots){if(r instanceof ae)return r;r=jt(o,r,t.ctx)}return r}let n=!1;for(let r=0;r<t.l.length;r++){const o=jt(t.l[r],e,t.ctx);if(o!==null){if(o instanceof ae)return o;if(n){if(!t.l.includes(o))return Tt(`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)us(t.r,r);return Pu(t)},Iu=t=>Object.entries(t).flatMap(([n,r])=>n in VT?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),E2=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 Tt(`Unexpected intersection of closed refinements of kind ${n.kind}`);e[n.kind]=n}return e},R2=(...t)=>Z(O2(...t)),O2=(t,e,n)=>{const r=n.hasKind("morph")?"a morph":n.isUnknown()?"unknown":n.exclude(e).defaultShortDescription;return`${LN(t)} operand must be ${e.description} (was ${r})`},_2=(t,e,n)=>new Hu(t,e,n,n,null);class IT extends Ko{}class Hu extends Ko{[Pi]="generic";paramDefs;bodyDef;$;arg$;baseInstantiation;hkt;description;constructor(e,n,r,o,l){super((...u)=>{const f=He(this.names,(h,p)=>{const y=this.arg$.parse(u[h]);return y.extends(this.constraints[h])||Z(k2(p,this.constraints[h].expression,y.expression)),[p,y]});if(this.defIsLazy()){const h=this.bodyDef(f);return this.$.parse(h)}return this.$.parse(n,{args:f})}),this.paramDefs=e,this.bodyDef=n,this.$=r,this.arg$=o,this.hkt=l,this.description=l?new l().description??`a generic type for ${l.constructor.name}`:"a generic type",this.baseInstantiation=this(...this.constraints)}defIsLazy(){return this.bodyDef instanceof IT}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:i2(this.bodyDef)})}get params(){return this.cacheGetter("params",this.paramDefs.map(e=>typeof e=="string"?[e,ie.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 k2=(t,e,n)=>`${t} must be assignable to ${e} (was ${n})`,M2=ut({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 C2 extends qo{serializedPredicate=Zt(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=vf(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 HT={implementation:M2,Node:C2},D2=ut({kind:"divisor",collapsibleKey:"rule",keys:{rule:{parse:t=>Number.isInteger(t)?t:Z($2(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/j2(t.rule,e.rule))})},obviatesBasisDescription:!0});class N2 extends Sf{traverseAllows=e=>e%this.rule===0;compiledCondition=`data % ${this.rule} === 0`;compiledNegation=`data % ${this.rule} !== 0`;impliedBasis=ie.intrinsic.number.internal;expression=`% ${this.rule}`;reduceJsonSchema(e){return e.type="integer",this.rule===1||(e.multipleOf=this.rule),e}}const FT={implementation:D2,Node:N2},$2=t=>`divisor must be an integer (was ${t})`,j2=(t,e)=>{let n,r=t,o=e;for(;o!==0;)n=o,o=r%o,r=n;return r};class Po extends Sf{boundOperandKind=U2[this.kind];compiledActual=this.boundOperandKind==="value"?"data":this.boundOperandKind==="length"?"data.length":"data.valueOf()";comparator=z2(this.kind,this.exclusive);numericLimit=this.rule.valueOf();expression=`${this.comparator} ${this.rule}`;compiledCondition=`${this.compiledActual} ${this.comparator} ${this.numericLimit}`;compiledNegation=`${this.compiledActual} ${B2[this.comparator]} ${this.numericLimit}`;stringLimit=this.boundOperandKind==="date"?K2(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 B2={"<":">=","<=":">",">":"<=",">=":"<"},L2={min:"max",minLength:"maxLength",after:"before"},GT={parse:t=>t||void 0},YT=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},XT=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},JT=t=>typeof t=="string"||typeof t=="number"?new Date(t):t,V2=(t,e)=>`${t} bound must be a positive integer (was ${e})`,xy=t=>e=>((!Number.isInteger(e)||e<0)&&Z(V2(t,e)),e),U2={min:"value",max:"value",minLength:"length",maxLength:"length",after:"date",before:"date"},z2=(t,e)=>`${yi(t,L2)?">":"<"}${e?"":"="}`,K2=t=>typeof t=="string"?t:new Date(t).toLocaleString(),q2=t=>`Bounded expression ${t} must be exactly one of number, string, Array, or Date`,P2=ut({kind:"after",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JT,serialize:t=>t.toISOString()}},normalize:XT("after"),defaults:{description:t=>`${t.collapsibleLimitString} or later`,actual:El},intersections:{after:(t,e)=>t.isStricterThan(e)?t:e}});class I2 extends Po{impliedBasis=ie.intrinsic.Date.internal;collapsibleLimitString=El(this.rule);traverseAllows=e=>e>=this.rule;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,after:this.rule})}}const ZT={implementation:P2,Node:I2},H2=ut({kind:"before",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:JT,serialize:t=>t.toISOString()}},normalize:XT("before"),defaults:{description:t=>`${t.collapsibleLimitString} or earlier`,actual:El},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 F2 extends Po{collapsibleLimitString=El(this.rule);traverseAllows=e=>e<=this.rule;impliedBasis=ie.intrinsic.Date.internal;reduceJsonSchema(e,n){return n.fallback.date({code:"date",base:e,before:this.rule})}}const QT={implementation:H2,Node:F2},G2=ut({kind:"exactLength",collapsibleKey:"rule",keys:{rule:{parse:xy("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 Y2 extends Sf{traverseAllows=e=>e.length===this.rule;compiledCondition=`data.length === ${this.rule}`;compiledNegation=`data.length !== ${this.rule}`;impliedBasis=ie.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 Ot.throwInternalOperandError("exactLength",e)}}}const WT={implementation:G2,Node:Y2},X2=ut({kind:"max",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:GT},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 J2 extends Po{impliedBasis=ie.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 eA={implementation:X2,Node:J2},Z2=ut({kind:"maxLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:xy("maxLength")}},reduce:(t,e)=>t.rule===0?e.node("exactLength",t):void 0,normalize:YT("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 Po{impliedBasis=ie.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 Ot.throwInternalOperandError("maxLength",e)}}}const tA={implementation:Z2,Node:Q2},W2=ut({kind:"min",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{},exclusive:GT},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 e$ extends Po{impliedBasis=ie.intrinsic.number.internal;traverseAllows=this.exclusive?e=>e>this.rule:e=>e>=this.rule;reduceJsonSchema(e){return this.exclusive?e.exclusiveMinimum=this.rule:e.minimum=this.rule,e}}const nA={implementation:W2,Node:e$},t$=ut({kind:"minLength",collapsibleKey:"rule",hasAssociatedError:!0,keys:{rule:{parse:xy("minLength")}},reduce:t=>t.rule===0?ie.intrinsic.unknown:void 0,normalize:YT("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 n$ extends Po{impliedBasis=ie.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 Ot.throwInternalOperandError("minLength",e)}}}const iA={implementation:t$,Node:n$},i$={min:nA.implementation,max:eA.implementation,minLength:iA.implementation,maxLength:tA.implementation,exactLength:WT.implementation,after:ZT.implementation,before:QT.implementation},r$={min:nA.Node,max:eA.Node,minLength:iA.Node,maxLength:tA.Node,exactLength:WT.Node,after:ZT.Node,before:QT.Node},s$=ut({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 o$ extends Sf{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=ie.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 rA={implementation:s$,Node:o$},yu=(t,e)=>{const n=a$(t);return e&&!e.includes(n)?Z(`Root of kind ${n} should be one of ${e}`):n},a$=t=>{if(pe(t,"root"))return t.kind;if(typeof t=="string")return t[0]==="$"?"alias":t in qi?"domain":"proto";if(typeof t=="function")return"proto";if(typeof t!="object"||t===null)return Z(rw(t));if("morphs"in t)return"morph";if("branches"in t||Ft(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 VT)?"intersection":"proto"in t?"proto":"domain"in t?"domain":Z(rw(t))},rw=t=>`${qe(t)} is not a valid type schema`,sw={},l$=t=>Ft(t)?t.map(e=>e.collapsibleJson):t.collapsibleJson,Ln={};ie.nodesByRegisteredId=Ln;const sA=t=>(sw[t]??=0,`${t}${++sw[t]}`),oA=t=>{const e=wf[t.kind],n=e.applyConfig?.(t.def,t.$.resolvedConfig)??t.def,r={},{meta:o,...l}=n,u=o===void 0?{}:typeof o=="string"?{description:o}:o,f=vT(l).sort(([p],[y])=>mu(p)?mu(y)?qu(p)-qu(y):1:mu(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 f){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!==Li&&(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():u$(p,u)}return Ty({id:t.id,kind:t.kind,inner:r,meta:u,$:t.$})},Ty=({id:t,kind:e,inner:n,meta:r,$:o,ignoreCache:l})=>{const u=wf[e],f=vT(n),h=[];let p={};for(const[M,O]of f){const C=u.keys[M],j=C.serialize??(C.child?l$:ms);if(p[M]=j(O),C.child===!0){const _=O;Ft(_)?h.push(..._):h.push(_)}else typeof C.child=="function"&&h.push(...C.child(O))}u.finalizeInnerJson&&(p=u.finalizeInnerJson(p));let y={...p},g={};Tl(r)||(g=He(r,(M,O)=>[M,M==="examples"?O:ms(O)]),y.meta=tu(g,"description",!0)),p=tu(p,u.collapsibleKey,!1);const v=JSON.stringify({kind:e,...p});y=tu(y,u.collapsibleKey,!1);const S=tu(y,u.collapsibleKey,!0),x=JSON.stringify({kind:e,...y});if(o.nodesByHash[x]&&!l)return o.nodesByHash[x];const T={id:t,kind:e,impl:u,inner:n,innerEntries:f,innerJson:p,innerHash:v,meta:r,metaJson:g,json:y,hash:x,collapsibleJson:S,children:h};if(e!=="intersection")for(const M in n)M!=="in"&&M!=="out"&&(T[M]=n[M]);const D=new yj[e](T,o);return o.nodesByHash[x]=D},c$=(t,e)=>t.id===e?t:(Xt(Ln[e])&&Tt(`Unexpected attempt to overwrite node id ${e}`),Ty({id:e,kind:t.kind,inner:t.inner,meta:t.meta,$:t.$,ignoreCache:!0})),u$=(t,e,n)=>Ty({id:sA(e.alias??t.kind),kind:t.kind,inner:t.inner,meta:e,$:t.$}),tu=(t,e,n)=>{const r=Object.keys(t);if(r.length===1&&r[0]===e){const o=t[e];if(n||vs(o,"object")&&(Object.keys(o).length===1||Array.isArray(o)))return o}return t},sm=(t,e,n)=>{if(t.key!==e.key)return null;const r=t.key;let o=jt(t.value,e.value,n);const l=t.required||e.required?"required":"optional";if(o instanceof ae)if(l==="optional")o=ie.intrinsic.never.internal;else return o.withPrefixKey(t.key,t.required&&e.required?"required":"optional");if(l==="required")return n.$.node("required",{key:r,value:o});const u=t.hasDefault()?e.hasDefault()?t.default===e.default?t.default:Z(lA(t.default,e.default)):t.default:e.hasDefault()?e.default:Li;return n.$.node("optional",{key:r,value:o,default:u})};class aA extends qo{required=this.kind==="required";optional=this.kind==="optional";impliedBasis=ie.intrinsic.object.internal;serializedKey=Ol(this.key);compiledKey=typeof this.key=="string"?this.key:this.serializedKey;flatRefs=Ie(this.value.flatRefs.map(e=>Rr([this.key,...e.path],e.node)),Rr([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?Ii(this.key,()=>this.value.traverseAllows(e[this.key],n),n):this.optional;traverseApply=(e,n)=>{this.key in e?Ii(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 lA=(t,e)=>`Invalid intersection of default values ${qe(t)} & ${qe(e)}`,f$=ut({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:sm}});class d$ extends aA{constructor(...e){super(...e),"default"in this.inner&&Ey(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} = ${qe(this.inner.default)}`:`${this.compiledKey}?: ${this.value.expression}`;defaultValueMorph=p$(this);defaultValueMorphRef=this.defaultValueMorph&&Zt(this.defaultValueMorph)}const Ay={implementation:f$,Node:d$},h$={},p$=t=>{if(!t.hasDefault())return;const e=`{${t.compiledKey}: ${t.value.id} = ${ms(t.default)}}`;return h$[e]??=cA(t.key,t.value,t.default)},cA=(t,e,n)=>{if(typeof n=="function")return e.includesTransform?(o,l)=>(Ii(t,()=>e(o[t]=n(),l),l),o):o=>(o[t]=n(),o);const r=e.includesTransform?e.assert(n):n;return vs(r,"object")?(o,l)=>(Ii(t,()=>e(o[t]=n,l),l),o):o=>(o[t]=r,o)},Ey=(t,e,n)=>{const r=mf(e);vs(e,"object")&&!r&&Z(m$(n));const o=t.in(r?e():e);if(o instanceof Mr){n===null&&Z(`Default ${o.summary}`);const l=o.transform(u=>u.transform(f=>({...f,prefixPath:[n]})));Z(`Default for ${l.summary}`)}return e},m$=t=>`Non-primitive default ${t===null?"":typeof t=="number"?`for value at [${t}] `:`for ${Ol(t)} `}must be specified as a function like () => ({my: 'object'})`;class _l extends KT{constructor(e,n){super(e,n),Object.defineProperty(this,Pi,{value:"root",enumerable:!1})}get internal(){return this}get"~standard"(){return{vendor:"arktype",version:1,validate:e=>{const n=this(e);return n instanceof Mr?n:{value:n}}}}as(){return this}brand(e){return e===""?Z(y$):this}readonly(){return this}branches=this.hasKind("union")?this.inner.branches:[this];distribute(e,n){const r=this.branches.map(e);return n?.(r)??r}get shortDescription(){return this.meta.description??this.defaultShortDescription}toJsonSchema(e={}){const n=zT(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,l)=>l.isRoot()&&!l.alwaysExpandJsonSchema?[l.id,l.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 Hi(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(),ie.intrinsic.unknown.internal);return e.branches.length===0&&Z(PT(`keyof ${this.expression}`)),this._keyof=this.$.finalize(e)}get props(){return this.branches.length!==1?Z(g$(this.expression)):[...this.applyStructuralOperation("props",[])[0]]}merge(e){const n=this.$.parseDefinition(e);return this.$.schema(n.distribute(r=>this.applyStructuralOperation("merge",[ow(r)??Z(aw("merge",r.expression))])))}applyStructuralOperation(e,n){return this.distribute(r=>{if(r.equals(ie.intrinsic.object)&&e!=="merge")return r;const o=ow(r);if(o||Z(aw(e,r.expression)),e==="keyof")return o.keyof();if(e==="get")return o.get(...n);if(e==="props")return o.props;const l=e==="required"?"require":e==="partial"?"optionalize":e;return this.$.node("intersection",{...r.inner,structure:o[l](...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 Ey(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:((l,u)=>{try{return o(l,u)}catch(f){return u.error({code:"predicate",predicate:o,actual:`aborted due to error:
|
|
86
|
+
${f}
|
|
87
|
+
`})}})),this);return this.$.finalize(n)}pipe=Object.assign(this._pipe.bind(this),{try:this.tryPipe.bind(this)});to(e){return this.$.finalize(this.toNode(this.$.parseDefinition(e)))}toNode(e){const n=im(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:Tt(`Unexpected constraint node ${o}`);const l=e==="root"?this:this[e];if(l.hasKind("morph")||o.impliedBasis&&!l.extends(o.impliedBasis))return R2(n,o.impliedBasis,this);const u=this.$.node("intersection",{[o.kind]:o}),f=e==="out"?im(this,u,this.$):Hi(this,u,this.$);return f instanceof ae&&f.throw(),this.$.finalize(f)}onUndeclaredKey(e){const n=typeof e=="string"?e:e.rule,r=typeof e=="string"?!1:e.deep;return this.$.finalize(this.transform((o,l)=>o==="structure"?n==="ignore"?SN(l,{undeclared:1}):{...l,undeclared:n}:l,r?void 0:{shouldTransform:o=>!is(gf,o.kind)}))}hasEqualMorphs(e){return!this.includesTransform&&!e.includesTransform?!0:!(!Co(this.shallowMorphs,e.shallowMorphs)||!Co(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",co(e))}lessThan(e){return this.constrain("max",co(e))}atLeastLength(e){return this.constrain("minLength",e)}atMostLength(e){return this.constrain("maxLength",e)}moreThanLength(e){return this.constrain("minLength",co(e))}lessThanLength(e){return this.constrain("maxLength",co(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",co(e))}earlierThan(e){return this.constrain("before",co(e))}}const y$="Expected a non-empty brand name after #",co=t=>typeof t=="object"&&!(t instanceof Date)?{...t,exclusive:!0}:{rule:t,exclusive:!0},nu=(t,e)=>pe(e,"root")?pe(t,"root")?t.extends(e):e.allows(t):pe(t,"root")?t.hasUnit(e):e===t,ow=t=>t.hasKind("morph")?null:t.hasKind("intersection")?t.inner.structure??(t.basis?.domain==="object"?t.$.bindReference(ie.intrinsic.emptyStructure):null):t.isBasis()&&t.domain==="object"?t.$.bindReference(ie.intrinsic.emptyStructure):null,g$=t=>`Props cannot be extracted from a union. Use .distribute to extract props from each branch instead. Received:
|
|
88
|
+
${t}`,aw=(t,e)=>`${t} operand must be an object (was ${e})`,kl=(t,e)=>He(wy(t),(n,r)=>[r,e]),b$=t=>typeof t=="string"?{reference:t}:t,lw=t=>t instanceof ae?ie.intrinsic.never.internal:t,v$=ut({kind:"alias",hasAssociatedError:!1,collapsibleKey:"reference",keys:{reference:{serialize:t=>t.startsWith("$")?t:`$ark.${t}`},resolve:{}},normalize:b$,defaults:{description:t=>t.reference},intersections:{alias:(t,e,n)=>n.$.lazilyResolve(()=>lw(jt(t.resolution,e.resolution,n)),`${t.reference}${n.pipe?"=>":"&"}${e.reference}`),...kl("alias",(t,e,n)=>e.isUnknown()?t:e.isNever()?e:e.isBasis()&&!e.overlaps(ie.intrinsic.object)?ae.init("assignability",ie.intrinsic.object,e):n.$.lazilyResolve(()=>lw(jt(t.resolution,e,n)),`${t.reference}${n.pipe?"=>":"&"}${e.id}`))}});class S$ extends _l{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(w$(n.id,r));r.push(n.id),n=Ln[n.id]}return pe(n,"root")?n:Tt(`Unexpected resolution for reference ${this.reference}
|
|
89
|
+
Seen: [${r.join("->")}]
|
|
90
|
+
Resolution: ${qe(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:Tt(`Unexpected resolution for reference ${this.reference}: ${qe(n)}`)}get defaultShortDescription(){return qi.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 w$=(t,e)=>`Alias '${t}' has a shallow resolution cycle: ${[...e,t].join("->")}`,Ry={implementation:v$,Node:S$};class Oy extends _l{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 vf(this.errorContext)}compile(e){e.traversalKind==="Allows"?e.return(this.compiledCondition):e.if(this.compiledNegation,()=>e.line(`${e.ctx}.errorFromNodeContext(${this.compiledErrorContext})`))}}const x$=ut({kind:"domain",hasAssociatedError:!0,collapsibleKey:"domain",keys:{domain:{},numberAllowsNaN:{}},normalize:t=>typeof t=="string"?{domain:t}:my(t,"numberAllowsNaN")&&t.domain!=="number"?Z(_y.writeBadAllowNanMessage(t.domain)):t,applyConfig:(t,e)=>t.numberAllowsNaN===void 0&&t.domain==="number"&&e.numberAllowsNaN?{...t,numberAllowsNaN:!0}:t,defaults:{description:t=>qi[t.domain],actual:t=>Number.isNaN(t)?"NaN":qi[Jn(t)]},intersections:{domain:(t,e)=>t.domain==="number"&&e.domain==="number"?t.numberAllowsNaN?e:t:ae.init("domain",t,e)}});class T$ extends Oy{requiresNaNCheck=this.domain==="number"&&!this.numberAllowsNaN;traverseAllows=this.requiresNaNCheck?e=>typeof e=="number"&&!Number.isNaN(e):e=>Jn(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 qi[this.domain]}innerToJsonSchema(e){return this.domain==="bigint"||this.domain==="symbol"?e.fallback.domain({code:"domain",base:{},domain:this.domain}):{type:this.domain}}}const _y={implementation:x$,Node:T$,writeBadAllowNanMessage:t=>`numberAllowsNaN may only be specified with domain "number" (was ${t})`},A$=ut({kind:"intersection",hasAssociatedError:!0,normalize:t=>{if(Xt(t))return t;const{structure:e,...n}=t,r=!!e,o=e??{},l=He(n,(u,f)=>yi(u,h2)?(r&&Z(`Flattened structure key ${u} cannot be specified alongside a root 'structure' key.`),o[u]=f,[]):[u,f]);return(pe(o,"constraint")||!Tl(o))&&(l.structure=o),l},finalizeInnerJson:({structure:t,...e})=>vs(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,l=o.variadic&&Object.keys(o).length===1?o.variadic:o;return{...n,sequence:l}}},divisor:{child:!0,parse:rn("divisor")},max:{child:!0,parse:rn("max")},min:{child:!0,parse:rn("min")},maxLength:{child:!0,parse:rn("maxLength")},minLength:{child:!0,parse:rn("minLength")},exactLength:{child:!0,parse:rn("exactLength")},before:{child:!0,parse:rn("before")},after:{child:!0,parse:rn("after")},pattern:{child:!0,parse:rn("pattern")},predicate:{child:!0,parse:rn("predicate")}},reduce:(t,e)=>cw({},t,{$:e,invert:!1,pipe:!1}),defaults:{description:t=>{if(t.children.length===0)return"unknown";if(t.structure)return t.structure.description;const e=[];if(t.basis&&!t.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(`
|
|
91
91
|
◦ `)}`,problem:t=>`(${t.actual}) must be...
|
|
92
|
-
${t.expected}`},intersections:{intersection:(t,e,n)=>cw(t.inner,e.inner,n),...kl("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:
|
|
92
|
+
${t.expected}`},intersections:{intersection:(t,e,n)=>cw(t.inner,e.inner,n),...kl("intersection",(t,e,n)=>{if(t.children.length===0)return e;const{domain:r,proto:o,...l}=t.inner,u=o??r,f=u?jt(u,e,n):e;return f instanceof ae?f:t?.basis?.equals(f)?t:t.$.node("intersection",{...l,[f.kind]:f},{prereduced:!0})})}});class E$ extends _l{basis=this.inner.domain??this.inner.proto??null;refinements=this.children.filter(e=>e.isRefinement());structure=this.inner.structure;expression=R$(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 uA={implementation:A$,Node:E$},R$=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},cw=(t,e,n)=>{const r={},o=t.proto??t.domain,l=e.proto??e.domain,u=o?l?jt(o,l,n):o:l;return u instanceof ae?u:(u&&(r[u.kind]=u),Pu({kind:"intersection",baseInner:r,l:Iu(t),r:Iu(e),roots:[],ctx:n}))},O$=ut({kind:"morph",hasAssociatedError:!1,keys:{in:{child:!0,parse:(t,e)=>e.$.parseSchema(t)},morphs:{parse:xl,serialize:t=>t.map(e=>pe(e,"root")?e.json:Zt(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(k$(t.expression,e.expression));const r=jt(t.in,e.in,n);if(r instanceof ae)return r;const o={morphs:t.morphs};if(t.declaredIn||e.declaredIn){const l=jt(t.in,e.in,n);if(l instanceof ae)return l.throw();o.declaredIn=l}if(t.declaredOut||e.declaredOut){const l=jt(t.out,e.out,n);if(l instanceof ae)return l.throw();o.declaredOut=l}return r.distribute(l=>n.$.node("morph",{...o,in:l}),n.$.parseSchema)},...kl("morph",(t,e,n)=>{const r=t.inner.in?jt(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 _$ extends _l{serializedMorphs=this.morphs.map(Zt);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??ie.intrinsic.unknown.internal}get out(){return this.declaredOut??this.introspectableOut??ie.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 Co(this.morphs,e.morphs,{isEqual:(n,r)=>n===r||pe(n,"root")&&pe(r,"root")&&n.equals(r)})}}const fA={implementation:O$,Node:_$},k$=(t,e)=>`The intersection of distinct morphs at a single path is indeterminate:
|
|
93
93
|
Left: ${t}
|
|
94
|
-
Right: ${e}`,M$=ut({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>gy(t)??
|
|
94
|
+
Right: ${e}`,M$=ut({kind:"proto",hasAssociatedError:!0,collapsibleKey:"proto",keys:{proto:{serialize:t=>gy(t)??ms(t)},dateAllowsInvalid:{}},normalize:t=>{const e=typeof t=="string"?{proto:No[t]}:typeof t=="function"?Xt(t)?t:{proto:t}:typeof t.proto=="string"?{...t,proto:No[t.proto]}:t;return typeof e.proto!="function"&&Z(Fu.writeInvalidSchemaMessage(e.proto)),my(e,"dateAllowsInvalid")&&e.proto!==Date&&Z(Fu.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?_N[t.builtinName]:`an instance of ${t.proto.name}`,actual:t=>t instanceof Date&&t.toString()==="Invalid Date"?"an invalid Date":Xp(t)},intersections:{proto:(t,e)=>t.proto===Date&&e.proto===Date?t.dateAllowsInvalid?e:t:JS(t.proto,e.proto)?t:JS(e.proto,t.proto)?e:ae.init("proto",t,e),domain:(t,e)=>e.domain==="object"?t:ae.init("domain",ie.intrinsic.object.internal,e)}});class C$ extends Oy{builtinName=gy(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 Fu={implementation:M$,Node:C$,writeBadInvalidDateMessage:t=>`dateAllowsInvalid may only be specified with constructor Date (was ${t.name})`,writeInvalidSchemaMessage:t=>`instanceOf operand must be a function (was ${Jn(t)})`},D$=ut({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 l of o)if(l.hasKind("morph")){const u=n.findIndex(f=>f.hasKind("morph")&&f.hasEqualMorphs(l));if(u===-1)n.push(l);else{const f=n[u];n[u]=e.$.node("morph",{...f.inner,in:f.in.rawOr(l.in)})}}else n.push(l)}return e.def.ordered||n.sort((r,o)=>r.hash<o.hash?-1:1),n}}},normalize:t=>Ft(t)?{branches:t}:t,reduce:(t,e)=>{const n=P$(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,Ao),expected:t=>{const e=hN(t.errors,"propString"),n=Object.entries(e).map(([r,o])=>{const l=[];for(const h of o)us(l,h.expected);const u=Ao(l),f=o.every(h=>h.actual===o[0].actual)?o[0].actual:qe(o[0].data);return`${r&&`${r} `}must be ${u}${f&&` (was ${f})`}`});return Ao(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(H$(t.expression,e.expression)),r=op(e.branches,t.branches,n),r instanceof ae&&r.invert()):r=op(t.branches,e.branches,n),r instanceof ae?r:n.$.parseSchema(t.ordered||e.ordered?{branches:r,ordered:!0}:{branches:r})},...kl("union",(t,e,n)=>{const r=op(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 N$ extends _l{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]=ie.intrinsic.boolean;continue}e.push(r)}return e}unitBranches=this.branches.filter(e=>e.in.hasKind("unit"));discriminant=this.discriminate();discriminantJson=this.discriminant?z$(this.discriminant):null;expression=this.distribute(e=>e.nestableExpression,q$);createBranchedOptimisticRootApply(){return(e,n)=>{const r=this.traverseOptimistic(e);if(r!==Li)return r;const o=new mo(e,this.$.resolvedConfig);return this.traverseApply(e,o),o.finalize(n)}}get shallowMorphs(){return this.branches.reduce((e,n)=>us(e,n.shallowMorphs),[])}get defaultShortDescription(){return this.distribute(e=>e.defaultShortDescription,Ao)}innerToJsonSchema(e){if(this.branchGroups.length===1&&this.branchGroups[0].equals(ie.intrinsic.boolean))return{type:"boolean"};const n=this.branchGroups.map(r=>r.toJsonSchemaRecurse(e));return n.every(r=>Object.keys(r).length===1&&my(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 Li};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:l}=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?l?e.data:g:l?`${e.invoke(g)} ? ${g.contextFreeMorph?`${Zt(g.contextFreeMorph)}(${e.data})`:e.data} : "${Li}"`:e.invoke(g)}`)}return e}),e.traversalKind==="Allows"){e.return(l?`"${Li}"`:!1);return}const u=Ao(this.discriminant.kind==="domain"?o.map(y=>{const g=y.slice(1,-1);return g==="function"?qi.object:qi[g]}):o),f=this.discriminant.path.map(y=>typeof y=="symbol"?Zt(y):JSON.stringify(y)),h=JSON.stringify(u),p=this.discriminant.kind==="domain"?`${V$}[${n}]`:`${U$}(${n})`;e.line(`ctx.errorFromNodeContext({
|
|
95
95
|
code: "predicate",
|
|
96
96
|
expected: ${h},
|
|
97
97
|
actual: ${p},
|
|
98
|
-
relativePath: [${
|
|
98
|
+
relativePath: [${f}],
|
|
99
99
|
meta: ${this.compiledMeta}
|
|
100
|
-
})`)}compileIndiscriminable(e){if(e.traversalKind==="Apply"){e.const("errors","[]");for(const n of this.branches)e.line("ctx.pushBranch()").line(e.invoke(n)).if("!ctx.hasError()",()=>e.return(n.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:n}=e;e.optimistic=!1;for(const
|
|
100
|
+
})`)}compileIndiscriminable(e){if(e.traversalKind==="Apply"){e.const("errors","[]");for(const n of this.branches)e.line("ctx.pushBranch()").line(e.invoke(n)).if("!ctx.hasError()",()=>e.return(n.includesTransform?"ctx.queuedMorphs.push(...ctx.popBranch().queuedMorphs)":"ctx.popBranch()")).line("errors.push(ctx.popBranch().error)");e.line(`ctx.errorFromNodeContext({ code: "union", errors, meta: ${this.compiledMeta} })`)}else{const{optimistic:n}=e;e.optimistic=!1;for(const r of this.branches)e.if(`${e.invoke(r)}`,()=>e.return(n?r.contextFreeMorph?`${Zt(r.contextFreeMorph)}(${e.data})`:e.data:!0));e.return(n?`"${Li}"`:!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 l=He(this.unitBranches,(u,f)=>[`${f.in.serializedValue}`,f.hasKind("morph")?f:!0]);return{kind:"unit",path:[],optionallyChainedPropString:"data",cases:l}}const e=[];for(let l=0;l<this.branches.length-1;l++){const u=this.branches[l];for(let f=l+1;f<this.branches.length;f++){const h=this.branches[f],p=Hi(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 x=y.l,T=y.r;g=`"${typeof x=="string"?x:x.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(x=>Co(x.path,y.path)&&x.kind===y.kind);S?(S.cases[g]?S.cases[g].branchIndices=us(S.cases[g].branchIndices,l):S.cases[g]??={branchIndices:[l],condition:y.l},S.cases[v]?S.cases[v].branchIndices=us(S.cases[v].branchIndices,f):S.cases[v]??={branchIndices:[f],condition:y.r}):e.push({kind:y.kind,cases:{[g]:{branchIndices:[l],condition:y.l},[v]:{branchIndices:[f],condition:y.r}},path:y.path})}}}const n=this.ordered?B$(e,this.branches):e;if(!n.length)return null;const r=$$(n,this),o={};for(const l in r.best.cases){const u=j$(r,l);if(u===null){o[l]=!0;continue}if(u.length===this.branches.length)return null;this.ordered&&u.sort((p,y)=>p.originalIndex-y.originalIndex);const f=u.map(p=>p.branch),h=f.length===1?f[0]:this.$.node("union",this.ordered?{branches:f,ordered:!0}:f);Object.assign(this.referencesById,h.referencesById),o[l]=h}if(r.defaultEntries.length){const l=r.defaultEntries.map(u=>u.branch);o.default=this.$.node("union",this.ordered?{branches:l,ordered:!0}:l,{prereduced:!0}),Object.assign(this.referencesById,o.default.referencesById)}return Object.assign(r.location,{cases:o})}}const $$=(t,e)=>{const n=t.sort((l,u)=>Object.keys(u.cases).length-Object.keys(l.cases).length)[0],r={kind:n.kind,path:n.path,optionallyChainedPropString:dA(n.path)},o=e.branches.map((l,u)=>({originalIndex:u,branch:l}));return{best:n,location:r,defaultEntries:o,node:e}},j$=(t,e)=>{const n=t.best.cases[e],r=L$(n.condition,t.location.path,t.node.$);let o=[];const l=[];for(let u=0;u<t.defaultEntries.length;u++){const f=t.defaultEntries[u];if(n.branchIndices.includes(f.originalIndex)){const h=uw(t.node.branches[f.originalIndex],t.location);h===null?o=null:o?.push({originalIndex:f.originalIndex,branch:h})}else if(f.branch.hasKind("alias")&&r.hasKind("domain")&&r.domain==="object")o?.push(f);else{if(f.branch.in.overlaps(r)){const h=uw(f.branch,t.location);o?.push({originalIndex:f.originalIndex,branch:h})}l.push(f)}}return t.defaultEntries=l,o},B$=(t,e)=>t.filter(r=>{const o=Object.values(r.cases).map(l=>l.branchIndices);for(let l=0;l<o.length-1;l++){const u=o[l];for(let f=l+1;f<o.length;f++){const h=o[f];for(const p of u)for(const y of h)if(p>y&&e[p].overlaps(e[y]))return!1}}return!0}),L$=(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 l=e[o];r=n.node("intersection",typeof l=="number"?{proto:"Array",sequence:[...fN(l).map(u=>({})),r]}:{domain:"object",required:[{key:l,value:r}]})}return r},dA=t=>t.reduce((e,n)=>e+$T(n,!0),"data"),V$=Zt(pN),U$=Zt(qe),hA={implementation:D$,Node:N$},z$=t=>({kind:t.kind,path:t.path.map(e=>typeof e=="string"?e:Ol(e)),cases:He(t.cases,(e,n)=>[e,n===!0?n:n.hasKind("union")&&n.discriminantJson?n.discriminantJson:n.json])}),K$={delimiter:" | ",finalDelimiter:" | "},q$=t=>Ao(t,K$),Ao=(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={},l=t.filter(f=>o[f]?!1:o[f]=!0),u=l.pop();return`${l.join(n)}${l.length?r:""}${u}`},op=(t,e,n)=>{const r=e.map(()=>[]);for(let l=0;l<t.length;l++){let u={};for(let f=0;f<e.length;f++){if(r[f]===null)continue;if(t[l].equals(e[f])){r[f]=null,u={};break}const h=jt(t[l],e[f],n);if(!(h instanceof ae)){if(h.equals(t[l])){r[f].push(t[l]),u={};break}h.equals(e[f])?r[f]=null:u[f]=h}}for(const f in u)r[f][l]=u[f]}const o=r.flatMap((l,u)=>l?.flatMap(f=>f.branches)??e[u]);return o.length===0?ae.init("union",t,e):o},P$=({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 l=Hi(t[r].in,t[o].in,t[0].$);l instanceof ae||(e||I$(t[r],t[o]),l.equals(t[r].in)?n[r]=!!e:l.equals(t[o].in)&&(n[o]=!1))}return t.filter((r,o)=>n[o])},I$=(t,e)=>{!t.includesTransform&&!e.includesTransform||(Co(t.shallowMorphs,e.shallowMorphs)||Z(fw(t.expression,e.expression)),Co(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(fw(t.expression,e.expression)))},uw=(t,e)=>t.transform((n,r)=>n==="domain"||n==="unit"?null:r,{shouldTransform:(n,r)=>{const o=dA(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}}),fw=(t,e)=>`An unordered union of a type including a morph and a type with overlapping input is indeterminate:
|
|
101
101
|
Left: ${t}
|
|
102
102
|
Right: ${e}`,H$=(t,e)=>`The intersection of two ordered unions is indeterminate:
|
|
103
103
|
Left: ${t}
|
|
104
|
-
Right: ${e}`,F$=ut({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():mr(t)}},normalize:t=>t,defaults:{description:t=>qe(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),...kl("unit",(t,e)=>{if(e.allows(t.unit))return t;const n=e.hasKind("intersection")?e.basis:e;if(n){const s=n.hasKind("domain")?n:ie.intrinsic.object;if(t.domain!==s.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:ie.intrinsic[t.domain];return ae.init("domain",o,s)}}return ae.init("assignability",t,e.hasKind("intersection")?e.children.find(s=>!s.allows(t.unit)):e)})}});class G$ extends Oy{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=dw(this.unit,this.serializedValue);compiledNegation=dw(this.unit,this.serializedValue,"negated");expression=qe(this.unit);domain=Xn(this.unit);get defaultShortDescription(){return this.domain==="object"?qi.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:ie.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 pA={implementation:F$,Node:G$},dw=(t,e,n)=>{if(t instanceof Date){const s=`data instanceof Date && data.toISOString() === ${e}`;return n?`!(${s})`:s}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${e}`},Y$=ut({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(ie.intrinsic.key))return Z(Z$(n.expression));const s=n.branches.filter(o=>o.hasKind("unit"));return s.length?Z(J$(s.map(o=>qe(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 s=jt(t.value,e.value,n),o=s instanceof ae?ie.intrinsic.never.internal:s;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 X$ extends qo{impliedBasis=ie.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ie(this.value.flatRefs.map(e=>Rs([this.signature,...e.path],e.node)),Rs([this.signature],this.value));traverseAllows=(e,n)=>Uu(e).every(s=>this.signature.traverseAllows(s[0],n)?Ii(s[0],()=>this.value.traverseAllows(s[1],n),n):!0);traverseApply=(e,n)=>{for(const s of Uu(e))this.signature.traverseAllows(s[0],n)&&Ii(s[0],()=>this.value.traverseApply(s[1],n),n)};_transform(e,n){n.path.push(this.signature);const s=super._transform(e,n);return n.path.pop(),s}compile(){}}const mA={implementation:Y$,Node:X$},J$=t=>`Index keys ${t.join(", ")} should be specified as named props.`,Z$=t=>`Indexed key definition '${t}' must be a string or symbol`,Q$=ut({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:rm,optional:rm}});class W$ extends aA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=vf(this.errorContext)}const yA={implementation:Q$,Node:W$},ej=ut({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 s=e.$.parseSchema(n[0]);return Ey(s,n[1],null),[s,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,mr(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(rj);if(t.optionals?.length||t.defaultables?.length)return Z(bA)}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 s=t.prefix?.slice()??[],o=t.defaultables?.slice()??[],l=t.optionals?.slice()??[],u=t.postfix?.slice()??[];if(t.variadic){for(;l.at(-1)?.equals(t.variadic);)l.pop();if(l.length===0&&o.length===0)for(;s.at(-1)?.equals(t.variadic);)s.pop(),n++;for(;u[0]?.equals(t.variadic);)u.shift(),n++}else l.length===0&&o.length===0&&s.push(...u.splice(0));if(n!==t.minVariadicLength||t.prefix&&t.prefix.length!==s.length)return e.node("sequence",{...t,prefix:s,defaultables:o,optionals:l,postfix:u,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${qe(n.default)}`:n.kind==="optionals"?`${n.node.nestableExpression}?`:n.kind==="variadic"?`...${n.node.nestableExpression}[]`:n.node.expression).join(", ")}]`},intersections:{sequence:(t,e,n)=>{const s=Ja({l:t.tuple,r:e.tuple,disjoint:new ae,result:[],fixedVariants:[],ctx:n}),o=s.disjoint.length===0?[s,...s.fixedVariants]:s.fixedVariants;return o.length===0?s.disjoint:o.length===1?n.$.node("sequence",hw(o[0].result)):n.$.node("union",o.map(l=>({proto:Array,sequence:hw(l.result)})))}}});class tj extends qo{impliedBasis=ie.intrinsic.Array.internal;tuple=sj(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=or(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return tw(this.flatRefs,this.prevariadic.flatMap((e,n)=>Ie(e.node.flatRefs.map(s=>Rs([`${n}`,...s.path],s.node)),Rs([`${n}`],e.node)))),tw(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Ie(e.flatRefs.map(n=>Rs([ie.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),Rs([ie.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=ij(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Zt(this.defaultValueMorphs):void 0;elementAtIndex(e,n){if(n<this.prevariadic.length)return this.tuple[n];const s=e.length-this.postfixLength;return n>=s?{kind:"postfix",node:this.postfix[n-s]}:{kind:"variadic",node:this.variadic??Tt(`Unexpected attempt to access index ${n} on ${this}`)}}traverseAllows=(e,n)=>{for(let s=0;s<e.length;s++)if(!this.elementAtIndex(e,s).node.traverseAllows(e[s],n))return!1;return!0};traverseApply=(e,n)=>{let s=0;for(;s<e.length;s++)Ii(s,()=>this.elementAtIndex(e,s).node.traverseApply(e[s],n),n)};get element(){return this.cacheGetter("element",this.$.node("union",this.children))}compile(e){if(this.prefix)for(const[n,s]of this.prefix.entries())e.traverseKey(`${n}`,`data[${n}]`,s);for(const[n,s]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}]`,s)}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,s]of this.postfix.entries()){const o=`firstPostfixIndex + ${n}`;e.traverseKey(o,`data[${o}]`,s)}e.traversalKind==="Allows"&&e.return(!0)}_transform(e,n){n.path.push(ie.intrinsic.nonNegativeIntegerString.internal);const s=super._transform(e,n);return n.path.pop(),s}expression=this.description;reduceJsonSchema(e,n){if(this.prevariadic.length&&(e.prefixItems=this.prevariadic.map(s=>{const o=s.node.toJsonSchemaRecurse(n);if(s.kind==="defaultables"){const l=typeof s.default=="function"?s.default():s.default;o.default=ie.intrinsic.jsonData.allows(l)?l:n.fallback.defaultValue({code:"defaultValue",base:o,value:l})}return o})),this.minLength&&(e.minItems=this.minLength),this.variadic){const s=Object.assign(e,{items:this.variadic.toJsonSchemaRecurse(n)});if(this.maxLength&&(s.maxItems=this.maxLength),this.postfix){const o=this.postfix.map(l=>l.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:s,elements:o})}}else e.items=!1,delete e.maxItems;return e}}const nj={},ij=t=>{if(!t.defaultables)return[];const e=[];let n="[";const s=t.prefixLength+t.defaultablesLength-1;for(let o=t.prefixLength;o<=s;o++){const[l,u]=t.defaultables[o-t.prefixLength];e.push(cA(o,l,u)),n+=`${o}: ${l.id} = ${mr(u)}, `}return n+="]",nj[n]??=e},gA={implementation:ej,Node:tj},sj=t=>{const e=[];if(t.prefix)for(const n of t.prefix)e.push({kind:"prefix",node:n});if(t.defaultables)for(const[n,s]of t.defaultables)e.push({kind:"defaultables",node:n,default:s});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},hw=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),{}),bA="A postfix required element cannot follow an optional or defaultable element",rj="A postfix element requires a variadic element",Ja=t=>{const[e,...n]=t.l,[s,...o]=t.r;if(!e||!s)return t;const l=n.at(-1)?.kind==="postfix",u=o.at(-1)?.kind==="postfix",d=e.kind==="prefix"||s.kind==="prefix"?"prefix":e.kind==="postfix"||s.kind==="postfix"?"postfix":e.kind==="variadic"&&s.kind==="variadic"?"variadic":l||u?"prefix":e.kind==="defaultables"||s.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&s.kind==="variadic"&&u){const g=Ja({...t,fixedVariants:[],r:o.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}else if(s.kind==="prefix"&&e.kind==="variadic"&&l){const g=Ja({...t,fixedVariants:[],l:n.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=jt(e.node,s.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:ie.intrinsic.never.internal}];else return d==="optionals"||d==="defaultables"?t:Ja({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else d==="defaultables"?(e.kind==="defaultables"&&s.kind==="defaultables"&&e.default!==s.default&&Z(lA(e.default,s.default)),t.result=[...t.result,{kind:d,node:h,default:e.kind==="defaultables"?e.default:s.kind==="defaultables"?s.default:Tt(`Unexpected defaultable intersection from ${e.kind} and ${s.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&&(s.kind==="variadic"||y===1))&&(t.l=n),(s.kind!=="variadic"||y>=p&&(e.kind==="variadic"||p===1))&&(t.r=o),Ja(t)},vA=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 s=`{ ${n.join(", ")} }`;return e.sequence?`${s} & ${e.sequence.description}`:s}return e.sequence?.description??"{}"},oj=vA("description"),aj=vA("expression"),pw=(t,e,n)=>{const s=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Hi(t.value,e.value,n);return o instanceof ae?s==="optional"?n.node("optional",{key:t.key,value:ie.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},lj=ut({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:sn("required"),reduceIo:(t,e,n)=>{e.required=Ie(e.required,n.map(s=>s[t]))}},optional:{child:!0,parse:sn("optional"),reduceIo:(t,e,n)=>{if(t==="in"){e.optional=n.map(s=>s.in);return}for(const s of n)e[s.outProp.kind]=Ie(e[s.outProp.kind],s.outProp.out)}},index:{child:!0,parse:sn("index")},sequence:{child:!0,parse:sn("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:oj},intersections:{structure:(t,e,n)=>{const s={...t.inner},o={...e.inner},l=new ae;if(t.undeclared){const h=t.keyof();for(const p of e.requiredKeys)h.allows(p)||l.add("presence",ie.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=Hi(h,p.signature,n.$);if(y instanceof ae)return[];const g=om(y,p.value,n.$);return g.required&&(o.required=or(o.required,g.required)),g.optional&&(o.optional=or(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const p of t.requiredKeys)h.allows(p)||l.add("presence",t.propsByKey[p].value,ie.intrinsic.never.internal,{path:[p]});s.optional&&(s.optional=s.optional.filter(p=>h.allows(p.key))),s.index&&(s.index=s.index.flatMap(p=>{if(p.signature.extends(h))return p;const y=Hi(h,p.signature,n.$);if(y instanceof ae)return[];const g=om(y,p.value,n.$);return g.required&&(s.required=or(s.required,g.required)),g.optional&&(s.optional=or(s.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:Iu(s),r:Iu(o),roots:[],ctx:n});return d instanceof ae&&l.push(...d),l.length?l:d}},reduce:(t,e)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const s=t.required??[],o=t.optional??[],l=[...o];for(const u of t.index){for(const d of s){const h=pw(d,u,e);if(h instanceof ae)return h}for(const[d,h]of o.entries()){const p=pw(h,u,e);if(p instanceof ae)return p;p!==null&&(l[d]=p,n=!0)}}if(n)return e.node("structure",{...t,optional:l},{prereduced:!0})}}});class cj extends qo{impliedBasis=ie.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=or(this.required,this.optional);propsByKey=He(this.props,(e,n)=>[n.key,n]);propsByKeyReference=Zt(this.propsByKey);expression=aj(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,s)=>{const o=this.propsByKey[s.key];if(Xt(s))return s.kind!=="required"&&s.kind!=="optional"?Z(`Map result must have kind "required" or "optional" (was ${s.kind})`):(n[s.kind]=Ie(n[s.kind],s),n);const l=s.kind??o?.kind??"required",u=He(s,(d,h)=>d in Ay.implementation.keys?[d,h]:[]);return n[l]=Ie(n[l],this.$.node(l,u)),n},{}))}assertHasKeys(e){const n=e.filter(s=>!nu(s,this.keyof()));if(n.length)return Z(mw(this.expression,n))}get(e,...n){let s,o=!1;const l=hj(e);if((typeof l=="string"||typeof l=="symbol")&&this.propsByKey[l]&&(s=this.propsByKey[l].value,o=this.propsByKey[l].required),this.index)for(const d of this.index)nu(l,d.signature)&&(s=s?.and(d.value)??d.value);if(this.sequence&&nu(l,ie.intrinsic.nonNegativeIntegerString))if(pe(l,"root"))this.sequence.variadic&&(s=s?.and(this.sequence.element)??this.sequence.element);else{const d=Number.parseInt(l);if(d<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[d].node;s=s?.and(h)??h,o||=d<this.sequence.prefixLength}else if(this.sequence.variadic){const h=this.$.node("union",this.sequence.variadicOrPostfix);s=s?.and(h)??h}}if(!s)return this.sequence?.variadic&&pe(l,"root")&&l.extends(ie.intrinsic.number)?Z(pj(l.expression,this.sequence.expression)):Z(mw(this.expression,[l]));const u=s.get(...n);return o?u:u.or(ie.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(s=>s.hasKind("required")?this.$.node("optional",s.inner):s)})}require(){const{optional:e,...n}=this.inner;return this.$.node("structure",{...n,required:this.props.map(s=>s.hasKind("optional")?{key:s.key,value:s.value}:s)})}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 s=BT(this.inner),o=l=>{const u=n.some(d=>nu(l,d));return e==="pick"?u:!u};return s.required&&(s.required=s.required.filter(l=>o(l.key))),s.optional&&(s.optional=s.optional.filter(l=>o(l.key))),s.index&&(s.index=s.index.filter(l=>o(l.signature))),s}traverseAllows=(e,n)=>this._traverse("Allows",e,n);traverseApply=(e,n)=>this._traverse("Apply",e,n);_traverse=(e,n,s)=>{const o=s?.currentErrorCount??0;for(let l=0;l<this.props.length;l++)if(e==="Allows"){if(!this.props[l].traverseAllows(n,s))return!1}else if(this.props[l].traverseApply(n,s),s.failFast&&s.currentErrorCount>o)return!1;if(this.sequence){if(e==="Allows"){if(!this.sequence.traverseAllows(n,s))return!1}else if(this.sequence.traverseApply(n,s),s.failFast&&s.currentErrorCount>o)return!1}if(this.index||this.undeclared==="reject"){const l=Object.keys(n);l.push(...Object.getOwnPropertySymbols(n));for(let u=0;u<l.length;u++){const d=l[u];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(d,s)){if(e==="Allows"){if(!Ii(d,()=>h.value.traverseAllows(n[d],s),s))return!1}else if(Ii(d,()=>h.value.traverseApply(n[d],s),s),s.failFast&&s.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(d)&&(e==="Allows"||(s.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[d],meta:this.meta}),s.failFast)))return!1}}return this.structuralMorph&&s&&!s.hasError()&&s.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&&ie.intrinsic.nonNegativeIntegerString.allows(e);_compileDeclaresKey(e){const n=[];if(this.props.length&&n.push(`k in ${this.propsByKeyReference}`),this.index)for(const s of this.index)n.push(e.invoke(s.signature,{kind:"Allows",arg:"k"}));return this.sequence&&n.push("$ark.intrinsic.nonNegativeIntegerString.allows(k)"),n.join(" || ")||"false"}get structuralMorph(){return this.cacheGetter("structuralMorph",fj(this))}structuralMorphRef=this.structuralMorph&&Zt(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(["),dj(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 s=this.sequence?.reduceJsonSchema(e,n)??e;return this.props.length||this.index?n.fallback.arrayObject({code:"arrayObject",base:s,object:this.reduceObjectJsonSchema({type:"object"},n)}):s;default:return Ot.throwInternalOperandError("structure",e)}}reduceObjectJsonSchema(e,n){if(this.props.length){e.properties={};for(const s of this.props){const o=s.value.toJsonSchemaRecurse(n);if(typeof s.key=="symbol"){n.fallback.symbolKey({code:"symbolKey",base:e,key:s.key,value:o,optional:s.optional});continue}if(s.hasDefault()){const l=typeof s.default=="function"?s.default():s.default;o.default=ie.intrinsic.jsonData.allows(l)?l:n.fallback.defaultValue({code:"defaultValue",base:o,value:l})}e.properties[s.key]=o}this.requiredKeys.length&&e.properties&&(e.required=this.requiredKeys.filter(s=>typeof s=="string"&&s in e.properties))}if(this.index)for(const s of this.index){const o=s.value.toJsonSchemaRecurse(n);if(s.signature.equals(ie.intrinsic.string)){e.additionalProperties=o;continue}for(const l of s.signature.branches){if(!l.extends(ie.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let u={type:"string"};if(l.hasKind("morph")&&(u=n.fallback.morph({code:"morph",base:l.in.toJsonSchemaRecurse(n),out:l.out.toJsonSchemaRecurse(n)})),!l.hasKind("intersection"))return Tt(`Unexpected index branch kind ${l.kind}.`);const{pattern:d}=l.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 ap={},uj=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},fj=t=>{const e=uj(t);if(!e)return;if(ap[e])return ap[e];const n=(s,o)=>{for(let l=0;l<t.defaultable.length;l++)t.defaultable[l].key in s||t.defaultable[l].defaultValueMorph(s,o);if(t.sequence?.defaultables)for(let l=s.length-t.sequence.prefixLength;l<t.sequence.defaultables.length;l++)t.sequence.defaultValueMorphs[l](s,o);if(t.undeclared==="delete")for(const l in s)t.declaresKey(l)||delete s[l];return s};return ap[e]=n},dj=(t,e)=>{const s=`(data${e.defaultable.some(o=>o.defaultValueMorph.length===2)||e.sequence?.defaultValueMorphs.some(o=>o.length===2)?", ctx":""})`;return t.block(`${s} => `,o=>{for(let l=0;l<e.defaultable.length;l++){const{serializedKey:u,defaultValueMorphRef:d}=e.defaultable[l];o.if(`!(${u} in data)`,h=>h.line(`${d}${s}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,l=>l.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",l=>l.if(`!(${e._compileDeclaresKey(l)})`,u=>u.line("delete data[k]"))),o.return("data")})},SA={implementation:lj,Node:cj},hj=t=>(pe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),pj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,om=(t,e,n)=>{const[s,o]=uN(t.branches,u=>u.hasKind("unit"));if(!s.length)return{index:n.node("index",{signature:t,value:e})};const l={};for(const u of s){const d=n.node("required",{key:u.unit,value:e});l[d.kind]=Ie(l[d.kind],d)}return o.length&&(l.index=n.node("index",{signature:o,value:e})),l},mj=t=>pe(t,"root")?t.expression:qe(t),mw=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(mj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,wf={...i$,alias:Ry.implementation,domain:_y.implementation,unit:pA.implementation,proto:Fu.implementation,union:hA.implementation,morph:fA.implementation,intersection:uA.implementation,divisor:FT.implementation,pattern:sA.implementation,predicate:HT.implementation,required:yA.implementation,optional:Ay.implementation,index:mA.implementation,sequence:gA.implementation,structure:SA.implementation};ie.defaultConfig=xN(Object.assign(He(wf,(t,e)=>[t,e.defaults]),{jitless:DN(),clone:kN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Ot.defaultConfig}));ie.resolvedConfig=tm(ie.defaultConfig,ie.config);const yj={...s$,alias:Ry.Node,domain:_y.Node,unit:pA.Node,proto:Fu.Node,union:hA.Node,morph:fA.Node,intersection:uA.Node,divisor:FT.Node,pattern:sA.Node,predicate:HT.Node,required:yA.Node,optional:Ay.Node,index:mA.Node,sequence:gA.Node,structure:SA.Node};class am extends gN{get[Pi](){return"module"}}const wA=(t,e)=>new am(He(t,(n,s)=>[n,pe(s,"module")?wA(s,e):e.bindReference(s)])),gj=t=>Ft(t)?t:"branches"in t&&Ft(t.branches)?t.branches:void 0,bj=(t,e)=>Z(`Node of kind ${e} is not valid as a ${t} definition`),yw=t=>`#${t} duplicates public alias ${t}`,lp={};ie.ambient??={};let gw;const xA="function $",vj=t=>TA(t,AA(t)),TA=(t,e)=>{const n=e.write(xA,4),s=e.compile()();for(const o of t)o.precompilation||(o.traverseAllows=s[`${o.id}Allows`].bind(s),o.isRoot()&&!o.allowsRequiresContext&&(o.allows=o.traverseAllows),o.traverseApply=s[`${o.id}Apply`].bind(s),s[`${o.id}Optimistic`]&&(o.traverseOptimistic=s[`${o.id}Optimistic`].bind(s)),o.precompilation=n)},AA=t=>new NT().return(t.reduce((e,n)=>{const s=new rp({kind:"Allows"}).indent();n.compile(s);const o=s.write(`${n.id}Allows`),l=new rp({kind:"Apply"}).indent();n.compile(l);const u=l.write(`${n.id}Apply`),d=`${e}${o},
|
|
104
|
+
Right: ${e}`,F$=ut({kind:"unit",hasAssociatedError:!0,keys:{unit:{preserveUndefined:!0,serialize:t=>t instanceof Date?t.toISOString():ms(t)}},normalize:t=>t,defaults:{description:t=>qe(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),...kl("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:ie.intrinsic.object;if(t.domain!==r.domain){const o=t.domain==="undefined"||t.domain==="null"||t.domain==="boolean"?t.domain:ie.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 G$ extends Oy{compiledValue=this.json.unit;serializedValue=typeof this.unit=="string"||this.unit instanceof Date?JSON.stringify(this.compiledValue):`${this.compiledValue}`;compiledCondition=dw(this.unit,this.serializedValue);compiledNegation=dw(this.unit,this.serializedValue,"negated");expression=qe(this.unit);domain=Jn(this.unit);get defaultShortDescription(){return this.domain==="object"?qi.object:this.description}innerToJsonSchema(e){return this.unit===null?{type:"null"}:ie.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 pA={implementation:F$,Node:G$},dw=(t,e,n)=>{if(t instanceof Date){const r=`data instanceof Date && data.toISOString() === ${e}`;return n?`!(${r})`:r}return Number.isNaN(t)?`${n?"!":""}Number.isNaN(data)`:`data ${n?"!":"="}== ${e}`},Y$=ut({kind:"index",hasAssociatedError:!1,intersectionIsOpen:!0,keys:{signature:{child:!0,parse:(t,e)=>{const n=e.$.parseSchema(t);if(!n.extends(ie.intrinsic.key))return Z(Z$(n.expression));const r=n.branches.filter(o=>o.hasKind("unit"));return r.length?Z(J$(r.map(o=>qe(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=jt(t.value,e.value,n),o=r instanceof ae?ie.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 X$ extends qo{impliedBasis=ie.intrinsic.object.internal;expression=`[${this.signature.expression}]: ${this.value.expression}`;flatRefs=Ie(this.value.flatRefs.map(e=>Rr([this.signature,...e.path],e.node)),Rr([this.signature],this.value));traverseAllows=(e,n)=>Uu(e).every(r=>this.signature.traverseAllows(r[0],n)?Ii(r[0],()=>this.value.traverseAllows(r[1],n),n):!0);traverseApply=(e,n)=>{for(const r of Uu(e))this.signature.traverseAllows(r[0],n)&&Ii(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 mA={implementation:Y$,Node:X$},J$=t=>`Index keys ${t.join(", ")} should be specified as named props.`,Z$=t=>`Indexed key definition '${t}' must be a string or symbol`,Q$=ut({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:sm,optional:sm}});class W$ extends aA{expression=`${this.compiledKey}: ${this.value.expression}`;errorContext=Object.freeze({code:"required",missingValueDescription:this.value.defaultShortDescription,relativePath:[this.key],meta:this.meta});compiledErrorContext=vf(this.errorContext)}const yA={implementation:Q$,Node:W$},ej=ut({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 Ey(r,n[1],null),[r,n[1]]})},serialize:t=>t.map(e=>[e[0].collapsibleJson,ms(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(sj);if(t.optionals?.length||t.defaultables?.length)return Z(bA)}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()??[],l=t.optionals?.slice()??[],u=t.postfix?.slice()??[];if(t.variadic){for(;l.at(-1)?.equals(t.variadic);)l.pop();if(l.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 l.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:l,postfix:u,minVariadicLength:n},{prereduced:!0})},defaults:{description:t=>t.isVariadicOnly?`${t.variadic.nestableExpression}[]`:`[${t.tuple.map(n=>n.kind==="defaultables"?`${n.node.nestableExpression} = ${qe(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=Ja({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",hw(o[0].result)):n.$.node("union",o.map(l=>({proto:Array,sequence:hw(l.result)})))}}});class tj extends qo{impliedBasis=ie.intrinsic.Array.internal;tuple=rj(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=os(this.variadic&&[this.variadic],this.postfix);flatRefs=this.addFlatRefs();addFlatRefs(){return tw(this.flatRefs,this.prevariadic.flatMap((e,n)=>Ie(e.node.flatRefs.map(r=>Rr([`${n}`,...r.path],r.node)),Rr([`${n}`],e.node)))),tw(this.flatRefs,this.variadicOrPostfix.flatMap(e=>Ie(e.flatRefs.map(n=>Rr([ie.intrinsic.nonNegativeIntegerString.internal,...n.path],n.node)),Rr([ie.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=ij(this);defaultValueMorphsReference=this.defaultValueMorphs.length?Zt(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??Tt(`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++)Ii(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(ie.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 l=typeof r.default=="function"?r.default():r.default;o.default=ie.intrinsic.jsonData.allows(l)?l:n.fallback.defaultValue({code:"defaultValue",base:o,value:l})}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(l=>l.toJsonSchemaRecurse(n));e=n.fallback.arrayPostfix({code:"arrayPostfix",base:r,elements:o})}}else e.items=!1,delete e.maxItems;return e}}const nj={},ij=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[l,u]=t.defaultables[o-t.prefixLength];e.push(cA(o,l,u)),n+=`${o}: ${l.id} = ${ms(u)}, `}return n+="]",nj[n]??=e},gA={implementation:ej,Node:tj},rj=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},hw=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),{}),bA="A postfix required element cannot follow an optional or defaultable element",sj="A postfix element requires a variadic element",Ja=t=>{const[e,...n]=t.l,[r,...o]=t.r;if(!e||!r)return t;const l=n.at(-1)?.kind==="postfix",u=o.at(-1)?.kind==="postfix",f=e.kind==="prefix"||r.kind==="prefix"?"prefix":e.kind==="postfix"||r.kind==="postfix"?"postfix":e.kind==="variadic"&&r.kind==="variadic"?"variadic":l||u?"prefix":e.kind==="defaultables"||r.kind==="defaultables"?"defaultables":"optionals";if(e.kind==="prefix"&&r.kind==="variadic"&&u){const g=Ja({...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"&&l){const g=Ja({...t,fixedVariants:[],l:n.map(v=>({...v,kind:"prefix"}))});g.disjoint.length===0&&t.fixedVariants.push(g)}const h=jt(e.node,r.node,t.ctx);if(h instanceof ae)if(f==="prefix"||f==="postfix")t.disjoint.push(...h.withPrefixKey(f==="prefix"?t.result.length:`-${n.length+1}`,"required")),t.result=[...t.result,{kind:f,node:ie.intrinsic.never.internal}];else return f==="optionals"||f==="defaultables"?t:Ja({...t,fixedVariants:[],l:n.map(g=>({...g,kind:"prefix"})),r:n.map(g=>({...g,kind:"prefix"}))});else f==="defaultables"?(e.kind==="defaultables"&&r.kind==="defaultables"&&e.default!==r.default&&Z(lA(e.default,r.default)),t.result=[...t.result,{kind:f,node:h,default:e.kind==="defaultables"?e.default:r.kind==="defaultables"?r.default:Tt(`Unexpected defaultable intersection from ${e.kind} and ${r.kind} elements.`)}]):t.result=[...t.result,{kind:f,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),Ja(t)},vA=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??"{}"},oj=vA("description"),aj=vA("expression"),pw=(t,e,n)=>{const r=t.required?"required":"optional";if(!e.signature.allows(t.key))return null;const o=Hi(t.value,e.value,n);return o instanceof ae?r==="optional"?n.node("optional",{key:t.key,value:ie.intrinsic.never.internal}):o.withPrefixKey(t.key,t.kind):null},lj=ut({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:rn("required"),reduceIo:(t,e,n)=>{e.required=Ie(e.required,n.map(r=>r[t]))}},optional:{child:!0,parse:rn("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:rn("index")},sequence:{child:!0,parse:rn("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:oj},intersections:{structure:(t,e,n)=>{const r={...t.inner},o={...e.inner},l=new ae;if(t.undeclared){const h=t.keyof();for(const p of e.requiredKeys)h.allows(p)||l.add("presence",ie.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=Hi(h,p.signature,n.$);if(y instanceof ae)return[];const g=om(y,p.value,n.$);return g.required&&(o.required=os(o.required,g.required)),g.optional&&(o.optional=os(o.optional,g.optional)),g.index??[]}))}if(e.undeclared){const h=e.keyof();for(const p of t.requiredKeys)h.allows(p)||l.add("presence",t.propsByKey[p].value,ie.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=Hi(h,p.signature,n.$);if(y instanceof ae)return[];const g=om(y,p.value,n.$);return g.required&&(r.required=os(r.required,g.required)),g.optional&&(r.optional=os(r.optional,g.optional)),g.index??[]}))}const u={};(t.undeclared||e.undeclared)&&(u.undeclared=t.undeclared==="reject"||e.undeclared==="reject"?"reject":"delete");const f=Pu({kind:"structure",baseInner:u,l:Iu(r),r:Iu(o),roots:[],ctx:n});return f instanceof ae&&l.push(...f),l.length?l:f}},reduce:(t,e)=>{if(t.index){if(!(t.required||t.optional))return;let n=!1;const r=t.required??[],o=t.optional??[],l=[...o];for(const u of t.index){for(const f of r){const h=pw(f,u,e);if(h instanceof ae)return h}for(const[f,h]of o.entries()){const p=pw(h,u,e);if(p instanceof ae)return p;p!==null&&(l[f]=p,n=!0)}}if(n)return e.node("structure",{...t,optional:l},{prereduced:!0})}}});class cj extends qo{impliedBasis=ie.intrinsic.object.internal;impliedSiblings=this.children.flatMap(e=>e.impliedSiblings??[]);props=os(this.required,this.optional);propsByKey=He(this.props,(e,n)=>[n.key,n]);propsByKeyReference=Zt(this.propsByKey);expression=aj(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(Xt(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 l=r.kind??o?.kind??"required",u=He(r,(f,h)=>f in Ay.implementation.keys?[f,h]:[]);return n[l]=Ie(n[l],this.$.node(l,u)),n},{}))}assertHasKeys(e){const n=e.filter(r=>!nu(r,this.keyof()));if(n.length)return Z(mw(this.expression,n))}get(e,...n){let r,o=!1;const l=hj(e);if((typeof l=="string"||typeof l=="symbol")&&this.propsByKey[l]&&(r=this.propsByKey[l].value,o=this.propsByKey[l].required),this.index)for(const f of this.index)nu(l,f.signature)&&(r=r?.and(f.value)??f.value);if(this.sequence&&nu(l,ie.intrinsic.nonNegativeIntegerString))if(pe(l,"root"))this.sequence.variadic&&(r=r?.and(this.sequence.element)??this.sequence.element);else{const f=Number.parseInt(l);if(f<this.sequence.prevariadic.length){const h=this.sequence.prevariadic[f].node;r=r?.and(h)??h,o||=f<this.sequence.prefixLength}else if(this.sequence.variadic){const h=this.$.node("union",this.sequence.variadicOrPostfix);r=r?.and(h)??h}}if(!r)return this.sequence?.variadic&&pe(l,"root")&&l.extends(ie.intrinsic.number)?Z(pj(l.expression,this.sequence.expression)):Z(mw(this.expression,[l]));const u=r.get(...n);return o?u:u.or(ie.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=BT(this.inner),o=l=>{const u=n.some(f=>nu(l,f));return e==="pick"?u:!u};return r.required&&(r.required=r.required.filter(l=>o(l.key))),r.optional&&(r.optional=r.optional.filter(l=>o(l.key))),r.index&&(r.index=r.index.filter(l=>o(l.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 l=0;l<this.props.length;l++)if(e==="Allows"){if(!this.props[l].traverseAllows(n,r))return!1}else if(this.props[l].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 l=Object.keys(n);l.push(...Object.getOwnPropertySymbols(n));for(let u=0;u<l.length;u++){const f=l[u];if(this.index){for(const h of this.index)if(h.signature.traverseAllows(f,r)){if(e==="Allows"){if(!Ii(f,()=>h.value.traverseAllows(n[f],r),r))return!1}else if(Ii(f,()=>h.value.traverseApply(n[f],r),r),r.failFast&&r.currentErrorCount>o)return!1}}if(this.undeclared==="reject"&&!this.declaresKey(f)&&(e==="Allows"||(r.errorFromNodeContext({code:"predicate",expected:"removed",actual:"",relativePath:[f],meta:this.meta}),r.failFast)))return!1}}return this.structuralMorph&&r&&!r.hasError()&&r.queueMorphs([this.structuralMorph]),!0};get defaultable(){return this.cacheGetter("defaultable",this.optional?.filter(e=>e.hasDefault())??[])}declaresKey=e=>e in this.propsByKey||this.index?.some(n=>n.signature.allows(e))||this.sequence!==void 0&&ie.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",fj(this))}structuralMorphRef=this.structuralMorph&&Zt(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(["),dj(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 Ot.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 l=typeof r.default=="function"?r.default():r.default;o.default=ie.intrinsic.jsonData.allows(l)?l:n.fallback.defaultValue({code:"defaultValue",base:o,value:l})}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(ie.intrinsic.string)){e.additionalProperties=o;continue}for(const l of r.signature.branches){if(!l.extends(ie.intrinsic.string)){e=n.fallback.symbolKey({code:"symbolKey",base:e,key:null,value:o,optional:!1});continue}let u={type:"string"};if(l.hasKind("morph")&&(u=n.fallback.morph({code:"morph",base:l.in.toJsonSchemaRecurse(n),out:l.out.toJsonSchemaRecurse(n)})),!l.hasKind("intersection"))return Tt(`Unexpected index branch kind ${l.kind}.`);const{pattern:f}=l.inner;if(f){const h=Object.assign(u,{pattern:f[0].rule});for(let p=1;p<f.length;p++)u=n.fallback.patternIntersection({code:"patternIntersection",base:h,pattern:f[p].rule});e.patternProperties??={},e.patternProperties[h.pattern]=o}}}return this.undeclared&&!e.additionalProperties&&(e.additionalProperties=!1),e}}const ap={},uj=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},fj=t=>{const e=uj(t);if(!e)return;if(ap[e])return ap[e];const n=(r,o)=>{for(let l=0;l<t.defaultable.length;l++)t.defaultable[l].key in r||t.defaultable[l].defaultValueMorph(r,o);if(t.sequence?.defaultables)for(let l=r.length-t.sequence.prefixLength;l<t.sequence.defaultables.length;l++)t.sequence.defaultValueMorphs[l](r,o);if(t.undeclared==="delete")for(const l in r)t.declaresKey(l)||delete r[l];return r};return ap[e]=n},dj=(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 l=0;l<e.defaultable.length;l++){const{serializedKey:u,defaultValueMorphRef:f}=e.defaultable[l];o.if(`!(${u} in data)`,h=>h.line(`${f}${r}`))}return e.sequence?.defaultables&&o.for(`i < ${e.sequence.defaultables.length}`,l=>l.set("data[i]",5),`data.length - ${e.sequence.prefixLength}`),e.undeclared==="delete"&&o.forIn("data",l=>l.if(`!(${e._compileDeclaresKey(l)})`,u=>u.line("delete data[k]"))),o.return("data")})},SA={implementation:lj,Node:cj},hj=t=>(pe(t,"root")&&t.hasKind("unit")&&(t=t.unit),typeof t=="number"&&(t=`${t}`),t),pj=(t,e)=>`${t} is not allowed as an array index on ${e}. Use the 'nonNegativeIntegerString' keyword instead.`,om=(t,e,n)=>{const[r,o]=uN(t.branches,u=>u.hasKind("unit"));if(!r.length)return{index:n.node("index",{signature:t,value:e})};const l={};for(const u of r){const f=n.node("required",{key:u.unit,value:e});l[f.kind]=Ie(l[f.kind],f)}return o.length&&(l.index=n.node("index",{signature:o,value:e})),l},mj=t=>pe(t,"root")?t.expression:qe(t),mw=(t,e)=>`Key${e.length===1?"":"s"} ${e.map(mj).join(", ")} ${e.length===1?"does":"do"} not exist on ${t}`,wf={...i$,alias:Ry.implementation,domain:_y.implementation,unit:pA.implementation,proto:Fu.implementation,union:hA.implementation,morph:fA.implementation,intersection:uA.implementation,divisor:FT.implementation,pattern:rA.implementation,predicate:HT.implementation,required:yA.implementation,optional:Ay.implementation,index:mA.implementation,sequence:gA.implementation,structure:SA.implementation};ie.defaultConfig=xN(Object.assign(He(wf,(t,e)=>[t,e.defaults]),{jitless:DN(),clone:kN,onUndeclaredKey:"ignore",exactOptionalPropertyTypes:!0,numberAllowsNaN:!1,dateAllowsInvalid:!1,onFail:null,keywords:{},toJsonSchema:Ot.defaultConfig}));ie.resolvedConfig=tm(ie.defaultConfig,ie.config);const yj={...r$,alias:Ry.Node,domain:_y.Node,unit:pA.Node,proto:Fu.Node,union:hA.Node,morph:fA.Node,intersection:uA.Node,divisor:FT.Node,pattern:rA.Node,predicate:HT.Node,required:yA.Node,optional:Ay.Node,index:mA.Node,sequence:gA.Node,structure:SA.Node};class am extends gN{get[Pi](){return"module"}}const wA=(t,e)=>new am(He(t,(n,r)=>[n,pe(r,"module")?wA(r,e):e.bindReference(r)])),gj=t=>Ft(t)?t:"branches"in t&&Ft(t.branches)?t.branches:void 0,bj=(t,e)=>Z(`Node of kind ${e} is not valid as a ${t} definition`),yw=t=>`#${t} duplicates public alias ${t}`,lp={};ie.ambient??={};let gw;const xA="function $",vj=t=>TA(t,AA(t)),TA=(t,e)=>{const n=e.write(xA,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)},AA=t=>new NT().return(t.reduce((e,n)=>{const r=new sp({kind:"Allows"}).indent();n.compile(r);const o=r.write(`${n.id}Allows`),l=new sp({kind:"Apply"}).indent();n.compile(l);const u=l.write(`${n.id}Apply`),f=`${e}${o},
|
|
105
105
|
${u},
|
|
106
|
-
`;if(!n.hasKind("union"))return
|
|
106
|
+
`;if(!n.hasKind("union"))return f;const h=new sp({kind:"Allows",optimistic:!0}).indent();n.compile(h);const p=h.write(`${n.id}Optimistic`);return`${f}${p},
|
|
107
107
|
`},`{
|
|
108
|
-
`)+"}");class EA{config;resolvedConfig;name;get[Pi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=tm(ie.config,n),this.resolvedConfig=tm(ie.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(lp).length}`,this.name in lp&&Z(`A Scope already named ${this.name} already exists`),lp[this.name]=this;const s=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,l]of s){let u=o;if(o[0]==="#"?(u=o.slice(1),u in this.aliases&&Z(yw(u)),this.aliases[u]=l):(u in this.aliases&&Z(yw(o)),this.aliases[u]=l,this.exportedNames.push(u)),!pe(l,"module")&&!pe(l,"generic")&&!mf(l)){const d=this.preparseOwnDefinitionFormat(l,{alias:u});this.resolutions[u]=pe(d,"root")?this.bindReference(d):this.createParseContext(d).id}}gw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[gw.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=ie.intrinsic?He(ie.intrinsic,(o,l)=>o.startsWith("json")?[]:[o,this.bindReference(l)]):{}}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(s,o)=>new Hu(e,o?new IT(s):s,n,n,o??null)};units=(e,n)=>{const s=[];for(const l of e)s.includes(l)||s.push(l);const o=s.map(l=>this.node("unit",{unit:l},n));return this.node("union",o,{...n,prereduced:!0})};lazyResolutions=[];lazilyResolve(e,n){const s=this.node("alias",{reference:n??"synthetic",resolve:e},{prereduced:!0});return this.resolved||this.lazyResolutions.push(s),s}schema=(e,n)=>this.finalize(this.parseSchema(e,n));parseSchema=(e,n)=>this.node(yu(e),e,n);preparseNode(e,n,s){let o=typeof e=="string"?e:yu(n,e);if(Xt(n)&&n.kind===o)return n;if(o==="alias"&&!s?.prereduced){const{reference:d}=Ry.implementation.normalize(n,this);if(d.startsWith("$")){const h=this.resolveRoot(d.slice(1));n=h,o=h.kind}}else if(o==="union"&&vr(n,"object")){const d=gj(n);d?.length===1&&(n=d[0],o=yu(n))}if(Xt(n)&&n.kind===o)return n;const u=wf[o].normalize?.(n,this)??n;return Xt(u)?u.kind===o?u:bj(o,u.kind):{...s,$:this,kind:o,def:u,prefix:s.alias??o}}bindReference(e){let n;return Xt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Hu(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Z(kA(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!pe(n,"generic"))return n}maybeResolveSubalias(e){return lm(this.aliases,e)??lm(this.ambient,e)}get ambient(){return ie.ambient}maybeResolve(e){const n=this.resolutions[e];if(n){if(typeof n!="string")return this.bindReference(n);const o=Bn[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 Tt(`Unexpected resolved context for was uncached by its scope: ${qe(o)}`);o.phase="resolving";const l=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Bn[l.id]=l,Bn[o.id]=l,this.resolutions[e]=l}return Tt(`Unexpected nodesById entry for ${n}: ${qe(o)}`)}let s=this.aliases[e]??this.ambient?.[e];return s?(s=this.normalizeRootScopeValue(s),pe(s,"generic")?this.resolutions[e]=this.bindReference(s):pe(s,"module")?(s.root||Z(MA(e)),this.resolutions[e]=this.bindReference(s.root)):this.resolutions[e]=this.parse(s,{alias:e})):this.maybeResolveSubalias(e)}createParseContext(e){const n=e.id??rA(e.prefix);return Bn[n]=Object.assign(e,{[Pi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new mo(e,this.resolvedConfig)}import(...e){return new am(He(this.export(...e),(n,s)=>[`#${n}`,s]))}precompilation;_exportedResolutions;_exports;export(...e){if(!this._exports){this._exports={};for(const s of this.exportedNames){const o=this.aliases[s];this._exports[s]=pe(o,"module")?wA(o,this):bw(this.maybeResolve(s))}for(const s of this.lazyResolutions)s.resolution;if(this._exportedResolutions=_A(this,this._exports),this._json=OA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const s=AA(this.references);this.precompilation=s.write(xA,4),TA(this.references,s)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new am(He(n,(s,o)=>[o,this._exports[o]]))}resolve(e){return this.export()[e]}node=(e,n,s={})=>{const o=this.preparseNode(e,n,s);if(Xt(o))return this.bindReference(o);const l=this.createParseContext(o),u=oA(l),d=this.bindReference(u);return Bn[l.id]=d};parse=(e,n={})=>this.finalize(this.parseDefinition(e,n));parseDefinition(e,n={}){if(pe(e,"root"))return this.bindReference(e);const s=this.preparseOwnDefinitionFormat(e,n);if(pe(s,"root"))return this.bindReference(s);const o=this.createParseContext(s);Bn[o.id]=o;let l=this.bindReference(this.parseOwnDefinitionFormat(e,o));return l.isCyclic&&(l=c$(l,o.id)),Bn[o.id]=l,l}finalize(e){return bw(e),!e.precompilation&&!this.resolvedConfig.jitless&&vj(e.references),e}}class RA extends EA{parseOwnDefinitionFormat(e,n){return oA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(yu(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const bw=t=>{const e=t.references.filter(n=>n.hasKind("alias"));for(const n of e){Object.assign(n.referencesById,n.resolution.referencesById);for(const s of t.references)n.id in s.referencesById&&Object.assign(s.referencesById,n.referencesById)}return t},OA=t=>He(t,(e,n)=>[e,pe(n,"root")||pe(n,"generic")?n.json:pe(n,"module")?OA(n):Tt(`Unexpected resolution ${qe(n)}`)]),lm=(t,e)=>{const n=e.indexOf(".");if(n===-1)return;const s=e.slice(0,n),o=t[s];if(o===void 0)return;if(!pe(o,"module"))return Z(Sj(s));const l=e.slice(n+1),u=o[l];if(u===void 0)return lm(o,l);if(pe(u,"root")||pe(u,"generic"))return u;if(pe(u,"module"))return u.root??Z(MA(e));Tt(`Unexpected resolution for alias '${e}': ${qe(u)}`)},ky=(t,e)=>new RA(t,e),Ml=new RA({}),_A=(t,e)=>{const n={};for(const s in e){const o=e[s];if(pe(o,"module")){const l=_A(t,o),u=He(l,(d,h)=>[`${s}.${d}`,h]);Object.assign(n,u)}else pe(o,"root")||pe(o,"generic")?n[s]=o:Tt(`Unexpected scope resolution ${qe(o)}`)}return n},kA=t=>`'${t}' is unresolvable`,Sj=t=>`'${t}' must reference a module to be accessed using dot syntax`,MA=t=>`Reference to submodule '${t}' must specify an alias`;Ml.export();const Ye=Ml.schema,My=Ml.node;Ml.defineSchema;const Yi=Ml.generic,CA="^(?:0|[1-9]\\d*)$",wj=new RegExp(CA);Zt(wj);const DA=ky({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();ie.intrinsic={...DA};const NA=ky({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:CA}},{prereducedAliases:!0}).export();Object.assign(ie.intrinsic,NA);const xj=ky({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ve={...DA,...NA,...xj,emptyStructure:My("structure",{},{prereduced:!0})};ie.intrinsic={...ve};const Tj=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],vw=t=>t.toString()!=="Invalid Date",Aj=t=>t.slice(2,-1),$A=t=>`'${t}' could not be parsed by the Date constructor`,Ej=(t,e)=>Rj(t,e),Rj=(t,e)=>{const n=new Date(t);if(vw(n))return n;const s=JN(t);if(s!==void 0){const o=new Date(s);if(vw(o))return o}return e?Z(e===!0?$A(t):e):void 0},Sw=(t,e)=>{const n=t.scanner.shiftUntil(_j[BA[e]]);if(t.scanner.lookahead==="")return t.error(Mj(n,e));if(t.scanner.shift(),e==="/"){try{new RegExp(n)}catch(s){Z(String(s))}t.root=t.ctx.$.node("intersection",{domain:"string",pattern:n},{prereduced:!0})}else if(mi(e,jA))t.root=t.ctx.$.node("unit",{unit:n});else{const s=Ej(n,$A(n));t.root=t.ctx.$.node("unit",{meta:n,unit:s})}},jA={"'":1,'"':1},Oj={"/":1,"'":1,'"':1},BA={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},_j={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},kj={'"':"double-quote","'":"single-quote","/":"forward slash"},Mj=(t,e)=>`${e}${t} requires a closing ${kj[BA[e]]}`,Cj=t=>`Private type references should not include '#'. Use '${t}' instead.`,LA="Optional definitions like 'string?' are only valid as properties in an object or tuple",VA="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Dj={">":!0,">=":!0},Nj={"<":!0,"<=":!0},Gu={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},$j=t=>`Unmatched )${t===""?"":` before ${t}`}`,UA=t=>`Missing ${t}`,jj=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,zA=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,Bj=(t,e,n,s)=>`An expression may have at most one left bound (parsed ${t}${Gu[e]}, ${n}${Gu[s]})`,Lj=(t,e,n)=>KA(t,e,n,[]),KA=(t,e,n,s)=>{const o=n.parseUntilFinalizer();return s.push(o.root),o.finalizer===">"?s.length!==e.params.length?n.error(qA(t,e.names,s.map(l=>l.expression))):s:o.finalizer===","?KA(t,e,n,s):o.error(UA(">"))},qA=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,ww=t=>{const e=t.scanner.shiftUntilNextTerminator();e==="keyof"?t.addPrefix("keyof"):t.root=Uj(t,e)},Vj=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(qA(t,e.names,[]));const o=Lj(t,e,n);return e(...o)},Uj=(t,e)=>zj(t,e)??Kj(t,e)??t.error(e===""?t.scanner.lookahead==="#"?Cj(t.shiftedByOne().scanner.shiftUntilNextTerminator()):PA(t):kA(e)),zj=(t,e)=>{if(t.ctx.args?.[e]){const s=t.ctx.args[e];return typeof s!="string"?s:t.ctx.$.node("alias",{reference:s},{prereduced:!0})}const n=t.ctx.$.maybeResolve(e);if(pe(n,"root"))return n;if(n!==void 0)return pe(n,"generic")?Vj(e,n,t):Z(`Unexpected resolution ${qe(n)}`)},Kj=(t,e)=>{const n=ZN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const s=WN(e);if(s!==void 0)return t.ctx.$.node("unit",{unit:s})},PA=t=>{const e=t.previousOperator();return e?IA(e,t.scanner.unscanned):qj(t.scanner.unscanned)},IA=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,qj=t=>`Expected an expression${t?` before '${t}'`:""}`,HA=t=>t.scanner.lookahead===""?t.error(PA(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(Oj)?Sw(t,t.scanner.shift()):t.scanner.lookaheadIsIn(yf)?HA(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in jA?Sw(t,`${t.scanner.shift()}${t.scanner.shift()}`):ww(t);class Bo extends a2{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Bo.terminatingChars)}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...yf};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(e,n)=>e===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||mi(n.trimStart()[0],Bo.terminatingChars):e==="="?n[0]!=="=":e===","||e==="?"}const Pj=(t,e)=>{const n=Hj(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 s=`d'${t.root.description??t.root.unit.toISOString()}'`;t.unsetRoot(),t.reduceLeftBound(s,n);return}}return Gj(t,n)},Ij={"<":1,">":1,"=":1},Hj=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,xw=(t,e,n,s)=>n.extends(ie.intrinsic.number)?typeof e!="number"?Z(cm(t,e,s)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(ie.intrinsic.lengthBoundable)?typeof e!="number"?Z(cm(t,e,s)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(ie.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Z(q2(n.expression)),Fj=t=>({rule:Tj(t.limit)?Aj(t.limit):t.limit,exclusive:t.comparator.length===1}),Gj=(t,e)=>{const n=t.unsetRoot(),s=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),l=t.scanner.sliceChars(s,t.scanner.location);if(t.root=n,!o.hasKind("unit")||typeof o.unit!="number"&&!(o.unit instanceof Date))return t.error(cm(e,l,"right"));const u=o.unit,d=e.length===1,h=xw(e,typeof u=="number"?u:l,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:u}:{rule:u,exclusive:d});if(!t.branches.leftBound)return;if(!mi(e,Nj))return t.error(zA(e));const p=xw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(p[0],Fj(t.branches.leftBound)),t.branches.leftBound=null},cm=(t,e,n)=>`Comparator ${n==="left"?Gu[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,Yj=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(e)},Xj=t=>{const e=t.scanner.shiftUntilNextTerminator(),n=QN(e,{errorOnFail:Tw(e)});n===0&&t.error(Tw(0)),t.root=t.root.constrain("divisor",n)},Tw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,FA=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(Jj):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():Bo.lookaheadIsFinalizing(e,t.scanner.unscanned)?t.finalize(e):mi(e,Ij)?Pj(t,e):e==="%"?Xj(t):e==="#"?Yj(t):e in yf?FA(t):t.error(Cy(e))},Cy=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,Jj="Missing expected ']'",Zj=t=>{const e=t.unsetRoot();t.parseOperand();const n=t.unsetRoot();if(!n.hasKind("unit"))return t.error(Qj(n.expression));const s=n.unit instanceof Date?()=>new Date(n.unit):n.unit;return[e,"=",s]},Qj=t=>`Default value '${t}' must a literal value`,Aw=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const l=e.$.maybeResolveRoot(t.slice(0,-2));if(l)return l.array()}const s=new xf(new Bo(t),e),o=Wj(s);return s.finalizer===">"&&Z(Cy(">")),o},Wj=t=>{t.parseOperand();let e=Dy(t).root;return e?(t.finalizer==="="?e=Zj(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Z(Cy(t.scanner.lookahead)),e):Tt(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Dy=t=>{for(;t.finalizer===void 0;)eB(t);return t},eB=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class xf{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(UA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const s=Gu[n];if(!mi(s,Dj))return this.error(zA(n));if(this.branches.leftBound)return this.error(Bj(this.branches.leftBound.limit,this.branches.leftBound.comparator,e,s));this.branches.leftBound={comparator:s,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($j(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():Tt(`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 Dy(new xf(this.scanner,this.ctx))}parseOperator(){return FA(this)}parseOperand(){return HA(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(jj(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 tB="An empty string is not a valid generic parameter name",um=(t,e,n)=>{t.shiftUntilNonWhitespace();const s=t.shiftUntilNextTerminator();return s===""?t.lookahead===""&&e.length?e:Z(tB):(t.shiftUntilNonWhitespace(),nB(t,s,e,n))},Ew="extends ",nB=(t,e,n,s)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(Ew))t.jumpForward(Ew.length);else return t.lookahead===","&&t.shift(),n.push(e),um(t,n,s);const o=Dy(new xf(t,s));return n.push([e,o.root]),um(t,n,s)};class iB extends Ko{$;constructor(e){super((...n)=>new iu(e)(...n),{bind:e}),this.$=e}in(e){return new iu(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new iu(this.$).at(e,n)}case(e,n){return new iu(this.$).case(e,n)}}class iu extends Ko{$;in;key;branches=[];constructor(e,n){super(s=>this.caseEntries(Object.entries(s).map(([o,l])=>o==="default"?[o,l]:[this.$.parse(o),l]))),this.$=e,this.in=n}at(e,n){return this.key&&Z(rB),this.branches.length&&Z(sB),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,s])=>n==="default"?[n,s]:[this.$.node("unit",{unit:n}),s]))}caseEntries(e){for(let n=0;n<e.length;n++){const[s,o]=e[n];if(s==="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 "${s}" must be a function (was ${Xn(o)})`);this.caseEntry(s,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:Rw});const s=this.$.node("union",n);if(!this.in)return this.$.finalize(s);let o=this.in.pipe(s);return(e==="never"||e==="assert")&&(o=o.configureReferences({onFail:Rw},"self")),this.$.finalize(o)}}const Rw=t=>t.throw(),sB="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",rB="At most one key matcher may be specified per expression",GA=(t,e)=>{if(Ft(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return eE(t,e)},oB="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",aB="Only required keys may specify default values, e.g. { value: 'number = 0' }",lB=(t,e)=>{let n;const s={},o=Uu(t);for(const[u,d]of o){const h=fB(u);if(h.kind==="spread"){if(!Tl(s))return Z(uB);const S=e.$.parseOwnDefinitionFormat(d,e);if(S.equals(ve.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(ve.object))return Z(dB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){d!=="reject"&&d!=="delete"&&d!=="ignore"&&Z(cB(d)),s.undeclared=d;continue}const p=GA(d,e),y=h;if(h.kind==="required"){Ft(p)?cp(s,"optional",p[1]==="="?{key:h.normalized,value:p[0],default:p[2]}:{key:h.normalized,value:p[0]},e):cp(s,"required",{key:h.normalized,value:p},e);continue}if(Ft(p)&&(p[1]==="?"&&Z(oB),p[1]==="="&&Z(aB)),h.kind==="optional"){cp(s,"optional",{key:h.normalized,value:p},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),v=om(g,p,e.$);v.index&&(s.index=Ie(s.index,v.index)),v.required&&(s.required=Ie(s.required,v.required))}const l=e.$.node("structure",s);return e.$.parseSchema({domain:"object",structure:n?.merge(l)??l})},cp=(t,e,n,s)=>{t[e]=Ie(t[e],s.$.node(e,n))},cB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${qe(t)})`,uB="Spread operator may only be used as the first key in an object",fB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===Jp?{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]===Jp&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},dB=t=>`Spread operand must resolve to an object literal type (was ${t})`,hB=(t,e)=>TB(t)?ZA[t[0]](t,e):wB(t)?JA[t[1]](t,e):null,pB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),up=(t,e)=>{if(t[2]===void 0)return Z(IA(t[1],""));const n=e.$.parseOwnDefinitionFormat(t[0],e),s=e.$.parseOwnDefinitionFormat(t[2],e);if(t[1]==="|")return e.$.node("union",{branches:[n,s]});const o=t[1]==="&"?Hi(n,s,e.$):im(n,s,e.$);return o instanceof ae?o.throw():o},mB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),yB=(t,e)=>typeof t[2]!="function"?Z(YA("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),YA=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,gB=(t,e)=>typeof t[2]!="function"?Z(YA(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),bB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configureReferences(t[2],"shallow"),XA=t=>t,vB=XA({"[]":mB,"?":()=>Z(LA)}),SB=XA({"|":up,"&":up,":":gB,"=>":yB,"|>":up,"@":bB,"=":()=>Z(VA)}),JA={...vB,...SB},wB=t=>JA[t[1]]!==void 0,xB=t=>t,ZA=xB({keyof:pB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Z(Ow(Xp(t[1])));const n=t.slice(1).map(s=>typeof s=="function"?e.$.node("proto",{proto:s}):Z(Ow(Xp(s))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),TB=t=>ZA[t[0]]!==void 0,Ow=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,AB=(t,e)=>{let n=[{}],s=0;for(;s<t.length;){let o=!1;t[s]==="..."&&s<t.length-1&&(o=!0,s++);const l=GA(t[s],e),[u,d,h]=Ft(l)?l:[l];if(s++,o){if(!u.extends(ie.intrinsic.Array))return Z(OB(u.expression));n=n.flatMap(p=>u.distribute(y=>RB(BT(p),y)))}else n=n.map(p=>d==="?"?QA(p,u):d==="="?EB(p,u,h):fm(p,u))}return e.$.parseSchema(n.map(o=>Tl(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},fm=(t,e)=>t.defaultables||t.optionals?Z(t.variadic?bA:_B):(t.variadic?t.postfix=Ie(t.postfix,e):t.prefix=Ie(t.prefix,e),t),QA=(t,e)=>t.variadic?Z(WA):(t.optionals=Ie(t.optionals,e),t),EB=(t,e,n)=>t.variadic?Z(WA):t.optionals?Z(kB):(t.defaultables=Ie(t.defaultables,[[e,n]]),t),_w=(t,e)=>(t.postfix&&Z(kw),t.variadic?t.variadic.equals(e)||Z(kw):t.variadic=e.internal,t),RB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return _w(t,ie.intrinsic.unknown);if(n.prefix)for(const s of n.prefix)fm(t,s);if(n.optionals)for(const s of n.optionals)QA(t,s);if(n.variadic&&_w(t,n.variadic),n.postfix)for(const s of n.postfix)fm(t,s);return t},OB=t=>`Spread element must be an array (was ${t})`,kw="A tuple may have at most one variadic element",_B="A required element may not follow an optional element",WA="An optional element may not follow a variadic element",kB="A defaultable element may not follow an optional element without a default",MB={},eE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(s=>t.includes(s)))return Aw(t,e);const n=MB[e.$.name]??={};return n[t]??=Aw(t,e)}return vr(t,"object")?CB(t,e):Z(dm(Xn(t)))},CB=(t,e)=>{const n=yy(t);switch(n){case void 0:return pe(t,"root")?t:lB(t,e);case"Array":return DB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const s=mf(t)?t():t;return pe(s,"root")?s:Z(dm("Function"))}default:return Z(dm(n??qe(t)))}},DB=(t,e)=>hB(t,e)??AB(t,e),dm=t=>`Type definitions must be strings or objects (was ${t})`;class NB extends Ko{constructor(e){const n=Object.assign({errors:Ms,hkt:yi,$: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((...s)=>{if(s.length===1)return e.parse(s[0]);if(s.length===2&&typeof s[0]=="string"&&s[0][0]==="<"&&s[0].at(-1)===">"){const o=s[0].slice(1,-1),l=e.parseGenericParams(o,{});return new Hu(l,s[1],e,e,null)}return e.parse(s)},{bind:e,attach:n})}}const dl=ie;class Tf extends EA{get ambientAttachments(){if(dl.typeAttachments)return this.cacheGetter("ambientAttachments",He(dl.typeAttachments,(e,n)=>[e,this.bindReference(n)]))}preparseOwnAliasEntry(e,n){const s=e.indexOf("<");if(s===-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,s),l=e.slice(s+1,-1);return[o,()=>{const u=this.parseGenericParams(l,{alias:o});return _2(u,n,this)}]}parseGenericParams(e,n){return um(new Bo(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return mf(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=eE(e,n);if(Ft(o)){if(o[1]==="=")return Z(VA);if(o[1]==="?")return Z(LA)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(TN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,s)=>n.and(this.parse(s)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,s)=>n.merge(this.parse(s)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);match=new iB(this);declare=()=>({type:this.type});define(e){return e}type=new NB(this);static scope=((e,n={})=>new Tf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const $B=Object.assign(Tf.scope,{define:t=>t}),je=Tf;class jB extends yi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const BB=Yi(["base",ve.object],["props",ve.object])(t=>t.base.merge(t.props),jB),LB=je.module({Key:ve.key,Merge:BB});class VB extends yi{}const UB=Yi("element")(t=>{const e=t.element.exclude(ve.Array),n=e.array();return e.rawOr(n).pipe(xl).distribute(s=>s.assertHasKind("morph").declareOut(n),Ye)},VB),zB=je.module({root:ve.Array,readonly:"root",index:ve.nonNegativeIntegerString,liftFrom:UB},{name:"Array"}),hm=Ye(["string",Al.FileConstructor]),KB=hm.rawOr(hm.array()),Mw=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:KB}}),qB=je.module({root:["instanceof",FormData],value:hm,parsed:Mw,parse:Ye({in:FormData,morphs:t=>{const e={};for(const[n,s]of t)if(n in e){const o=e[n];typeof o=="string"||o instanceof Al.FileConstructor?e[n]=[o,s]:o.push(s)}else e[n]=s;return e},declaredOut:Mw})},{name:"FormData"}),PB=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"}),IB={Boolean:1,Number:1,String:1},HB=je.module({...He({...wT,...TT},(t,e)=>t in IB?[]:[t,["instanceof",e]]),Array:zB,TypedArray:PB,FormData:qB}),FB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),GB=Ye({domain:"number",divisor:1}),tE=je.module({root:ve.number,integer:GB,epoch:FB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),Xe=(t,e,n)=>{const s={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(s.meta={format:n}),My("intersection",s)},Cw=Xe(zu,"a well-formed integer string"),nE=je.module({root:Cw,parse:Ye({in:Cw,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"}),YB=Xe(/^[\dA-Fa-f]+$/,"hex characters only"),XB=je.module({root:Xe(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Xe(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Dw=Xe(/^[A-Z].*$/,"capitalized"),JB=je.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:Dw}),preformatted:Dw},{name:"string.capitalize"}),ZB=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,s,o,l=!1;for(let u=e.length-1;u>=0;u--)s=e.substring(u,u+1),o=Number.parseInt(s,10),l?(o*=2,n+=o>=10?o%10+1:o):n+=o,l=!l;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}))$/,WB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:QB.source},predicate:{meta:"a credit card number",predicate:ZB}}),e3=/^([+-]?\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)?)?)?)?$/,t3=t=>!Number.isNaN(new Date(t).valueOf()),Nw=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:t3}}).assertHasKind("intersection"),$w=nE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),s=tE.epoch(n);return s instanceof Ms?(e.errors.merge(s),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),n3=je.module({root:$w,parse:Ye({in:$w,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.epoch"}),jw=Xe(e3,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),i3=je.module({root:jw,parse:Ye({in:jw,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.iso"}),s3=je.module({root:Nw,parse:Ye({declaredIn:Nw,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:i3,epoch:n3},{name:"string.date"}),r3=Xe(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),Bw="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Ss=`(${Bw}[.]){3}${Bw}`,o3=new RegExp(`^${Ss}$`),bt="(?:[0-9a-fA-F]{1,4})",a3=new RegExp(`^((?:${bt}:){7}(?:${bt}|:)|(?:${bt}:){6}(?:${Ss}|:${bt}|:)|(?:${bt}:){5}(?::${Ss}|(:${bt}){1,2}|:)|(?:${bt}:){4}(?:(:${bt}){0,1}:${Ss}|(:${bt}){1,3}|:)|(?:${bt}:){3}(?:(:${bt}){0,2}:${Ss}|(:${bt}){1,4}|:)|(?:${bt}:){2}(?:(:${bt}){0,3}:${Ss}|(:${bt}){1,5}|:)|(?:${bt}:){1}(?:(:${bt}){0,4}:${Ss}|(:${bt}){1,6}|:)|(?::((?::${bt}){0,5}:${Ss}|(?::${bt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),l3=je.module({root:["v4 | v6","@","an IP address"],v4:Xe(o3,"an IPv4 address","ipv4"),v6:Xe(a3,"an IPv6 address","ipv6")},{name:"string.ip"}),Eo="a JSON string",iE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Eo} (${t})`},c3=Ye({meta:Eo,domain:"string",predicate:{meta:Eo,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Eo,problem:iE(n)})}}}}),u3=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Eo,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Eo,problem:iE(n)})}},f3=je.module({root:c3,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:u3,declaredOut:ve.jsonObject})},{name:"string.json"}),Lw=Xe(/^[a-z]*$/,"only lowercase letters"),d3=je.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:Lw}),preformatted:Lw},{name:"string.lower"}),sE=["NFC","NFD","NFKC","NFKD"],Cl=He(sE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Af=He(sE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:Cl[e]})]),h3=je.module({root:Af.NFC,preformatted:Cl.NFC},{name:"string.normalize.NFC"}),p3=je.module({root:Af.NFD,preformatted:Cl.NFD},{name:"string.normalize.NFD"}),m3=je.module({root:Af.NFKC,preformatted:Cl.NFKC},{name:"string.normalize.NFKC"}),y3=je.module({root:Af.NFKD,preformatted:Cl.NFKD},{name:"string.normalize.NFKD"}),g3=je.module({root:"NFC",NFC:h3,NFD:p3,NFKC:m3,NFKD:y3},{name:"string.normalize"}),Vw=Xe(Zp,"a well-formed numeric string"),b3=je.module({root:Vw,parse:Ye({in:Vw,morphs:t=>Number.parseFloat(t),declaredOut:ve.number})},{name:"string.numeric"}),Uw="a regex pattern",v3=Ye({domain:"string",predicate:{meta:Uw,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:Uw,problem:String(n)})}}},meta:{format:"regex"}}),S3=/^(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-]+)*))?$/,w3=Xe(S3,"a semantic version (see https://semver.org/)"),zw=Xe(/^\S.*\S$|^\S?$/,"trimmed"),x3=je.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:zw}),preformatted:zw},{name:"string.trim"}),Kw=Xe(/^[A-Z]*$/,"only uppercase letters"),T3=je.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:Kw}),preformatted:Kw},{name:"string.upper"}),A3=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},qw=Ye({domain:"string",predicate:{meta:"a URL string",predicate:A3},meta:{format:"uri"}}),E3=je.module({root:qw,parse:Ye({declaredIn:qw,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),R3=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:Xe(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Xe(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Xe(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Xe(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Xe(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Xe(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Xe(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Xe(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),O3=je.module({root:ve.string,alpha:Xe(/^[A-Za-z]*$/,"only letters"),alphanumeric:Xe(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:YB,base64:XB,capitalize:JB,creditCard:WB,date:s3,digits:Xe(/^\d*$/,"only digits 0-9"),email:r3,integer:nE,ip:l3,json:f3,lower:d3,normalize:g3,numeric:b3,regex:v3,semver:w3,trim:x3,upper:T3,url:E3,uuid:R3},{name:"string"}),_3=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}),k3=je.module({root:ve.unknown,any:ve.unknown},{name:"unknown"}),M3=je.module({root:ve.jsonObject,stringify:My("morph",{in:ve.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ve.string})},{name:"object.json"}),C3=je.module({root:ve.object,json:M3},{name:"object"});class D3 extends yi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const N3=Yi(["K",ve.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),D3);class $3 extends yi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const j3=Yi(["T",ve.object],["K",ve.key])(t=>t.T.pick(t.K),$3);class B3 extends yi{description='omit a set of properties from an object like `Omit(User, "age")`'}const L3=Yi(["T",ve.object],["K",ve.key])(t=>t.T.omit(t.K),B3);class V3 extends yi{description="make all named properties of an object optional like `Partial(User)`"}const U3=Yi(["T",ve.object])(t=>t.T.partial(),V3);class z3 extends yi{description="make all named properties of an object required like `Required(User)`"}const K3=Yi(["T",ve.object])(t=>t.T.required(),z3);class q3 extends yi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const P3=Yi("T","U")(t=>t.T.exclude(t.U),q3);class I3 extends yi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const H3=Yi("T","U")(t=>t.T.extract(t.U),I3),F3=je.module({Exclude:P3,Extract:H3,Omit:L3,Partial:U3,Pick:j3,Record:N3,Required:K3}),Sr=$B({..._3,...F3,...HB,...LB,string:O3,number:tE,object:C3,unknown:k3},{prereducedAliases:!0,name:"ark"}),$t=Sr.export();Object.assign(dl.ambient,$t);dl.typeAttachments={string:$t.string.root,number:$t.number.root,bigint:$t.bigint,boolean:$t.boolean,symbol:$t.symbol,undefined:$t.undefined,null:$t.null,object:$t.object.root,unknown:$t.unknown.root,false:$t.false,true:$t.true,never:$t.never,arrayIndex:$t.Array.index,Key:$t.Key,Record:$t.Record,Array:$t.Array.root,Date:$t.Date};const wt=Object.assign(Sr.type,dl.typeAttachments);Sr.match;Sr.generic;Sr.schema;Sr.define;Sr.declare;const rE={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 G3(t){return Number.parseInt(t,10)}const Y3=wt(rE),X3=Y3.keyof().pipe(t=>G3(t));wt([X3,"string"]);function J3(t){return G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[G.jsx("title",{children:"Tempest Games Logo"}),G.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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}}),G.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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 oE(t){return G.jsx("a",{...t})}const Z3={class:"_class_1riwg_1"},fp=["⠋","⠙","⠸","⠴","⠦","⠇"];function Q3({input:t}){const e=V.useRef(null),[n,s]=V.useState(typeof t=="string"?t:null);return V.useEffect(()=>{let o=!0,l;if(typeof t=="string")s(t);else{let u=0;l=setInterval(()=>{e.current&&(e.current.textContent=fp[u],u=(u+1)%fp.length)},100),t.then(d=>{o&&(clearInterval(l),s(d))})}return()=>{o=!1,l&&clearInterval(l)}},[t]),G.jsx("span",{ref:e,children:n??fp[0]})}var W3=Object.create,aE=Object.defineProperty,eL=Object.getOwnPropertyDescriptor,lE=Object.getOwnPropertyNames,tL=Object.getPrototypeOf,nL=Object.prototype.hasOwnProperty,gi=(t,e)=>function(){return e||(0,t[lE(t)[0]])((e={exports:{}}).exports,e),e.exports},iL=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=lE(e),l=0,u=o.length,d;l<u;l++)d=o[l],!nL.call(t,d)&&d!==n&&aE(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(s=eL(e,d))||s.enumerable});return t},mt=(t,e,n)=>(n=t!=null?W3(tL(t)):{},iL(aE(n,"default",{value:t,enumerable:!0}),t)),cE=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(s){"@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(s)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),sL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=cE().default;function s(o,l){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,l||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),rL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=cE().default,s=sL();function o(l){var u=s(l,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),wr=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=rL();function s(o,l,u){return(l=n(l))in o?Object.defineProperty(o,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[l]=u,o}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),Jn=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=wr();function s(l,u){var d=Object.keys(l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(l,p).enumerable})),d.push.apply(d,h)}return d}function o(l){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?s(Object(d),!0).forEach(function(h){n(l,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):s(Object(d)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(d,h))})}return l}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function Ef(t){const e={subscribe(n){let s=null,o=!1,l=!1,u=!1;function d(){if(s===null){u=!0;return}l||(l=!0,typeof s=="function"?s():s&&s.unsubscribe())}return s=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(oL,e)}};return e}function oL(t,e){return e(t)}function aL(t){const e=new AbortController;return new Promise((s,o)=>{let l=!1;function u(){l||(l=!0,d.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const d=t.subscribe({next(h){l=!0,s(h),u()},error(h){o(h)},complete(){e.abort(),u()}})})}function lL(t){return e=>{let n=0,s=null;const o=[];function l(){s||(s=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&&s){const d=s;s=null,d.unsubscribe()}}return Ef(d=>(n++,o.push(d),l(),{unsubscribe(){n--,u();const h=o.findIndex(p=>p===d);h>-1&&o.splice(h,1)}}))}}function cL(t){let e=t;const n=[],s=u=>{e!==void 0&&u.next(e),n.push(u)},o=u=>{n.splice(n.indexOf(u),1)},l=Ef(u=>(s(u),()=>{o(u)}));return l.next=u=>{if(e!==u){e=u;for(const d of n)d.next(u)}},l.get=()=>e,l}function uL(t){return Ef(e=>{function n(o=0,l=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:l,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function hl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var fL=Object.create,uE=Object.defineProperty,dL=Object.getOwnPropertyDescriptor,fE=Object.getOwnPropertyNames,hL=Object.getPrototypeOf,pL=Object.prototype.hasOwnProperty,Dl=(t,e)=>function(){return e||(0,t[fE(t)[0]])((e={exports:{}}).exports,e),e.exports},mL=(t,e,n,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=fE(e),l=0,u=o.length,d;l<u;l++)d=o[l],!pL.call(t,d)&&d!==n&&uE(t,d,{get:(h=>e[h]).bind(null,d),enumerable:!(s=dL(e,d))||s.enumerable});return t},Rf=(t,e,n)=>(n=t!=null?fL(hL(t)):{},mL(uE(n,"default",{value:t,enumerable:!0}),t));const dE=()=>{},Pw=t=>{Object.freeze&&Object.freeze(t)};function hE(t,e,n){var s;const o=e.join(".");return(s=n[o])!==null&&s!==void 0||(n[o]=new Proxy(dE,{get(l,u){if(!(typeof u!="string"||u==="then"))return hE(t,[...e,u],n)},apply(l,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)}),Pw(p.args),Pw(p.path),t(p)}})),n[o]}const yL=t=>hE(t,[],Object.create(null)),gL=t=>new Proxy(dE,{get(e,n){if(n!=="then")return t(n)}});var pE=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/typeof.js"(t,e){function n(s){"@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(s)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),bL=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=pE().default;function s(o,l){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var d=u.call(o,l||"default");if(n(d)!="object")return d;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),vL=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=pE().default,s=bL();function o(l){var u=s(l,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),mE=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=vL();function s(o,l,u){return(l=n(l))in o?Object.defineProperty(o,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[l]=u,o}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ny=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=mE();function s(l,u){var d=Object.keys(l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(l,p).enumerable})),d.push.apply(d,h)}return d}function o(l){for(var u=1;u<arguments.length;u++){var d=arguments[u]!=null?arguments[u]:{};u%2?s(Object(d),!0).forEach(function(h){n(l,h,d[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(d)):s(Object(d)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(d,h))})}return l}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Rf(Ny());Rf(mE());var su=Rf(Ny());function SL(t,e){if("error"in t){const s=e.deserialize(t.error);return{ok:!1,error:(0,su.default)((0,su.default)({},t),{},{error:s})}}return{ok:!0,result:(0,su.default)((0,su.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var dp=class extends Error{constructor(){super("Unable to transform response from server")}};function wL(t,e){let n;try{n=SL(t,e)}catch{throw new dp}if(!n.ok&&(!hl(n.error.error)||typeof n.error.error.code!="number"))throw new dp;if(n.ok&&!hl(n.result))throw new dp;return n}Rf(Ny());var ru=mt(wr()),uo=mt(Jn());function xL(t){return t instanceof Lo}function TL(t){return hl(t)&&hl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function AL(t,e){return typeof t=="string"?t:hl(t)&&typeof t.message=="string"?t.message:e}var Lo=class gu extends Error{constructor(e,n){var s,o;const l=n?.cause;super(e,{cause:l}),(0,ru.default)(this,"cause",void 0),(0,ru.default)(this,"shape",void 0),(0,ru.default)(this,"data",void 0),(0,ru.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=l,this.shape=n==null||(s=n.result)===null||s===void 0?void 0:s.error,this.data=n==null||(o=n.result)===null||o===void 0?void 0:o.error.data,this.name="TRPCClientError",Object.setPrototypeOf(this,gu.prototype)}static from(e,n={}){const s=e;return xL(s)?(n.meta&&(s.meta=(0,uo.default)((0,uo.default)({},s.meta),n.meta)),s):TL(s)?new gu(s.error.message,(0,uo.default)((0,uo.default)({},n),{},{result:s})):new gu(AL(s,"Unknown error"),(0,uo.default)((0,uo.default)({},n),{},{cause:s}))}};function EL(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 Iw=t=>typeof t=="function";function RL(t){if(t)return t;if(typeof window<"u"&&Iw(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Iw(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var el=mt(Jn());function OL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:EL(t.transformer),methodOverride:t.methodOverride}}function _L(t){const e={};for(let n=0;n<t.length;n++){const s=t[n];e[n]=s}return e}const kL={query:"GET",mutation:"POST",subscription:"PATCH"};function yE(t){return"input"in t?t.transformer.input.serialize(t.input):_L(t.inputs.map(e=>t.transformer.input.serialize(e)))}const gE=t=>{const e=t.url.split("?");let s=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 l=yE(t);l!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(l))}`)}return o.length&&(s+="?"+o.join("&")),s},ML=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=yE(t);return e!==void 0?JSON.stringify(e):void 0},CL=t=>jL((0,el.default)((0,el.default)({},t),{},{contentTypeHeader:"application/json",getUrl:gE,getBody:ML}));var DL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const NL=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 DL};async function $L(t){var e;NL(t.signal);const n=t.getUrl(t),s=t.getBody(t),{type:o}=t,l=await(async()=>{const d=await t.headers();return Symbol.iterator in d?Object.fromEntries(d):d})(),u=(0,el.default)((0,el.default)((0,el.default)({},t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),l);return RL(t.fetch)(n,{method:(e=t.methodOverride)!==null&&e!==void 0?e:kL[o],signal:t.signal,body:s,headers:u})}async function jL(t){const e={},n=await $L(t);e.response=n;const s=await n.json();return e.responseJSON=s,{json:s,meta:e}}mt(Jn());const Hw=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Fw(t){let e=null,n=null;const s=()=>{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 l(){const d=o(e);s();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,x)=>{const T=p.items[x];try{var D;const O=await Promise.resolve(S);(D=T.resolve)===null||D===void 0||D.call(T,O)}catch(O){var M;(M=T.reject)===null||M===void 0||M.call(T,O)}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:Hw,reject:Hw},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(l)),y}return{load:u}}function BL(...t){const e=new AbortController,n=t.length;let s=0;const o=()=>{++s===n&&e.abort()};for(const l of t)l?.aborted?o():l?.addEventListener("abort",o,{once:!0});return e.signal}var ou=mt(Jn());function LL(t){var e,n;const s=OL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,l=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const u=y=>({validate(g){if(o===1/0&&l===1/0)return!0;if(g.length>l)return!1;const v=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return gE((0,ou.default)((0,ou.default)({},s),{},{type:y,path:v,inputs:S,signal:null})).length<=o},async fetch(g){const v=g.map(O=>O.path).join(","),S=g.map(O=>O.input),x=BL(...g.map(O=>O.signal)),T=await CL((0,ou.default)((0,ou.default)({},s),{},{path:v,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(O=>({meta:T.meta,json:O}))}}),d=Fw(u("query")),h=Fw(u("mutation")),p={query:d,mutation:h};return({op:y})=>Ef(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 x;return S.then(T=>{x=T;const D=wL(T.json,s.transformer.output);if(!D.ok){g.error(Lo.from(D.error,{meta:T.meta}));return}g.next({context:T.meta,result:D.result}),g.complete()}).catch(T=>{g.error(Lo.from(T,{meta:x?.meta}))}),()=>{}})}}mt(Jn());const bE=(t,...e)=>typeof t=="function"?t(...e):t;mt(wr());function VL(){let t,e;return{promise:new Promise((s,o)=>{t=s,e=o}),resolve:t,reject:e}}async function UL(t){const e=await bE(t.url);if(!t.connectionParams)return e;const s=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+s}async function zL(t){const e={method:"connectionParams",data:await bE(t)};return JSON.stringify(e)}mt(wr());var sr=mt(wr());function KL(t){const{promise:e,resolve:n,reject:s}=VL();return t.addEventListener("open",()=>{t.removeEventListener("error",s),n()}),t.addEventListener("error",s),e}function qL(t,{intervalMs:e,pongTimeoutMs:n}){let s,o;function l(){s=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function u(){clearTimeout(s),l()}function d(){clearTimeout(o),u()}t.addEventListener("open",l),t.addEventListener("message",({data:h})=>{clearTimeout(s),l(),h==="PONG"&&d()}),t.addEventListener("close",()=>{clearTimeout(s),clearTimeout(o)})}var PL=class pm{constructor(e){var n;if((0,sr.default)(this,"id",++pm.connectCount),(0,sr.default)(this,"WebSocketPonyfill",void 0),(0,sr.default)(this,"urlOptions",void 0),(0,sr.default)(this,"keepAliveOpts",void 0),(0,sr.default)(this,"wsObservable",cL(null)),(0,sr.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=++pm.connectCount;const n=UL(e.urlOptions).then(s=>new e.WebSocketPonyfill(s));e.openPromise=n.then(async s=>{e.ws=s,s.addEventListener("message",function({data:o}){o==="PING"&&this.send("PONG")}),e.keepAliveOpts.enabled&&qL(s,e.keepAliveOpts),s.addEventListener("close",()=>{e.ws===s&&(e.ws=null)}),await KL(s),e.urlOptions.connectionParams&&s.send(await zL(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,sr.default)(PL,"connectCount",0);mt(wr());mt(Jn());var hp=mt(wr()),Gw=mt(Jn()),IL=class{constructor(t){(0,hp.default)(this,"links",void 0),(0,hp.default)(this,"runtime",void 0),(0,hp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return uL({links:this.links,op:(0,Gw.default)((0,Gw.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(lL())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await aL(n)).result.data}catch(n){throw Lo.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 l;(l=n.onConnectionStateChange)===null||l===void 0||l.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 l;(l=n.onError)===null||l===void 0||l.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const HL=Symbol.for("trpc_untypedClient"),FL={query:"query",mutate:"mutation",subscribe:"subscription"},GL=t=>FL[t];function YL(t){const e=yL(({path:n,args:s})=>{const o=[...n],l=GL(o.pop()),u=o.join(".");return t[l](u,...s)});return gL(n=>n===HL?t:e[n])}function XL(t){const e=new IL(t);return YL(e)}mt(Jn());mt(Jn());var JL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var l,u,d,h=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,d=Symbol.iterator);h--;){if(u&&(l=o[u])!=null)return l.call(o);if(d&&(l=o[d])!=null)return new s(l.call(o));u="@@asyncIterator",d="@@iterator"}throw new TypeError("Object is not async iterable")}function s(o){function l(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 s=function(d){this.s=d,this.n=d.next},s.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(d){var h=this.s.return;return h===void 0?Promise.resolve({value:d,done:!0}):l(h.apply(this.s,arguments))},throw:function(d){var h=this.s.return;return h===void 0?Promise.reject(d):l(h.apply(this.s,arguments))}},new s(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});mt(JL());mt(Jn());var ZL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var s=typeof SuppressedError=="function"?SuppressedError:function(d,h){var p=Error();return p.name="SuppressedError",p.error=d,p.suppressed=h,p},o={},l=[];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)}}),l.push({v:h,d:p,a:d})}else d&&l.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=l.pop();)try{if(!h.a&&y===1)return y=0,l.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(x){return v(x)}if(y===1)return p!==o?Promise.reject(p):Promise.resolve();if(p!==o)throw p}function v(S){return p=p!==o?new s(S,p):S,g()}return g()}}}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),vE=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/OverloadYield.js"(t,e){function n(s,o){this.v=s,this.k=o}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}}),QL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=vE();function s(o){return new n(o,0)}e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}}),WL=gi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=vE();function s(l){return function(){return new o(l.apply(this,arguments))}}function o(l){var u,d;function h(y,g){try{var v=l[y](g),S=v.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var D=y==="return"?"return":"next";if(!S.k||T.done)return h(D,T);T=l[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 x={key:y,arg:g,resolve:v,reject:S,next:null};d?d=d.next=x:(u=d=x,h(y,g))})},typeof l.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(l){return this._invoke("next",l)},o.prototype.throw=function(l){return this._invoke("throw",l)},o.prototype.return=function(l){return this._invoke("return",l)},e.exports=s,e.exports.__esModule=!0,e.exports.default=e.exports}});mt(ZL());mt(QL());mt(WL());mt(Jn());var eV={};function SE(t,e){if(t instanceof Promise)throw new Error(e)}function tV(t,e){const n={},s=[];for(const o in t){const l=t[o]["~standard"].validate(e[o]);if(SE(l,`Validation must be synchronous, but ${o} returned a Promise.`),l.issues){s.push(...l.issues.map(u=>({...u,message:u.message,path:[o,...u.path??[]]})));continue}n[o]=l.value}return s.length?{issues:s}:{value:n}}function nV(t){const e=t.runtimeEnvStrict??t.runtimeEnv??eV;if(t.emptyStringAsUndefined??!1)for(const[O,C]of Object.entries(e))C===""&&delete e[O];if(!!t.skipValidation)return e;const o=typeof t.client=="object"?t.client:{},l=typeof t.server=="object"?t.server:{},u=typeof t.shared=="object"?t.shared:{},d=t.isServer??(typeof window>"u"||"Deno"in window),h=d?{...l,...u,...o}:{...o,...u},p=t.createFinalSchema?.(h,d)["~standard"].validate(e)??tV(h,e);SE(p,"Validation must be synchronous");const y=t.onValidationError??(O=>{throw console.error("❌ Invalid environment variables:",O),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=O=>t.clientPrefix?!O.startsWith(t.clientPrefix)&&!(O in u):!0,S=O=>d||!v(O),x=O=>O==="__esModule"||O==="$$typeof",T=(t.extends??[]).reduce((O,C)=>Object.assign(O,C),{}),D=Object.assign(T,p.value);return new Proxy(D,{get(O,C){if(typeof C=="string"&&!x(C))return S(C)?Reflect.get(O,C):g(C)}})}const iV={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},sV="__vite_start_time"in globalThis,rV=typeof window<"u",$i=wt("string"),Yw=wt('"true" | "false" | undefined'),wE=nV({isServer:!sV&&!rV,server:{CI:wt("string | undefined").pipe(Boolean),POSTGRES_USER:$i,POSTGRES_PASSWORD:$i,POSTGRES_DATABASE:$i,POSTGRES_HOST:$i,POSTGRES_PORT:$i.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:$i.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:Yw.pipe(t=>t==="true"),FRONTEND_PORT:$i.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:$i.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:$i,VITE_DEV_FRONTEND_HOST:wt("string | undefined"),VITE_DEV_HTTPS:Yw.pipe(t=>t==="true")},runtimeEnv:iV,emptyStringAsUndefined:!0}),rn=XL({links:[LL({url:wE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),oV=ct({key:"appVersionQuery",default:rn.version.query});ct({key:"lastKnownVersion",default:null,effects:[K1(localStorage,JSON,"lastKnownVersion")]});const aV=hi({key:"appVersion",get:async({get:t})=>{const e=t(oV),{version:n}=await e;return n}});function pp(t){return["optional",t]}function lV(t,e){let n=[t];for(const s of e){if(typeof s!="string")return!1;n=n.flatMap(o=>{if(o===null)return[];const l=[],u=o[1],d=u[s];d!==void 0&&l.push(d);const h=Object.keys(u).find(p=>p.startsWith("$"));if(h){const p=u[h];p&&l.push(p)}return l})}for(const s of n)if(s===null||s[0]==="optional")return!0;return!1}const fi=Object.create(null);fi.open="0";fi.close="1";fi.ping="2";fi.pong="3";fi.message="4";fi.upgrade="5";fi.noop="6";const bu=Object.create(null);Object.keys(fi).forEach(t=>{bu[fi[t]]=t});const mm={type:"error",data:"parser error"},xE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",TE=typeof ArrayBuffer=="function",AE=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,$y=({type:t,data:e},n,s)=>xE&&e instanceof Blob?n?s(e):Xw(e,s):TE&&(e instanceof ArrayBuffer||AE(e))?n?s(e):Xw(new Blob([e]),s):s(fi[t]+(e||"")),Xw=(t,e)=>{const n=new FileReader;return n.onload=function(){const s=n.result.split(",")[1];e("b"+(s||""))},n.readAsDataURL(t)};function Jw(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let mp;function cV(t,e){if(xE&&t.data instanceof Blob)return t.data.arrayBuffer().then(Jw).then(e);if(TE&&(t.data instanceof ArrayBuffer||AE(t.data)))return e(Jw(t.data));$y(t,!1,n=>{mp||(mp=new TextEncoder),e(mp.encode(n))})}const Zw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Za=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Zw.length;t++)Za[Zw.charCodeAt(t)]=t;const uV=t=>{let e=t.length*.75,n=t.length,s,o=0,l,u,d,h;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const p=new ArrayBuffer(e),y=new Uint8Array(p);for(s=0;s<n;s+=4)l=Za[t.charCodeAt(s)],u=Za[t.charCodeAt(s+1)],d=Za[t.charCodeAt(s+2)],h=Za[t.charCodeAt(s+3)],y[o++]=l<<2|u>>4,y[o++]=(u&15)<<4|d>>2,y[o++]=(d&3)<<6|h&63;return p},fV=typeof ArrayBuffer=="function",jy=(t,e)=>{if(typeof t!="string")return{type:"message",data:EE(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:dV(t.substring(1),e)}:bu[n]?t.length>1?{type:bu[n],data:t.substring(1)}:{type:bu[n]}:mm},dV=(t,e)=>{if(fV){const n=uV(t);return EE(n,e)}else return{base64:!0,data:t}},EE=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},RE="",hV=(t,e)=>{const n=t.length,s=new Array(n);let o=0;t.forEach((l,u)=>{$y(l,!1,d=>{s[u]=d,++o===n&&e(s.join(RE))})})},pV=(t,e)=>{const n=t.split(RE),s=[];for(let o=0;o<n.length;o++){const l=jy(n[o],e);if(s.push(l),l.type==="error")break}return s};function mV(){return new TransformStream({transform(t,e){cV(t,n=>{const s=n.length;let o;if(s<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,s);else if(s<65536){o=new Uint8Array(3);const l=new DataView(o.buffer);l.setUint8(0,126),l.setUint16(1,s)}else{o=new Uint8Array(9);const l=new DataView(o.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(s))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let yp;function au(t){return t.reduce((e,n)=>e+n.length,0)}function lu(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let s=0;for(let o=0;o<e;o++)n[o]=t[0][s++],s===t[0].length&&(t.shift(),s=0);return t.length&&s<t[0].length&&(t[0]=t[0].slice(s)),n}function yV(t,e){yp||(yp=new TextDecoder);const n=[];let s=0,o=-1,l=!1;return new TransformStream({transform(u,d){for(n.push(u);;){if(s===0){if(au(n)<1)break;const h=lu(n,1);l=(h[0]&128)===128,o=h[0]&127,o<126?s=3:o===126?s=1:s=2}else if(s===1){if(au(n)<2)break;const h=lu(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(au(n)<8)break;const h=lu(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){d.enqueue(mm);break}o=y*Math.pow(2,32)+p.getUint32(4),s=3}else{if(au(n)<o)break;const h=lu(n,o);d.enqueue(jy(l?h:yp.decode(h),e)),s=0}if(o===0||o>t){d.enqueue(mm);break}}}})}const OE=4;function xt(t){if(t)return gV(t)}function gV(t){for(var e in xt.prototype)t[e]=xt.prototype[e];return t}xt.prototype.on=xt.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};xt.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.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 s,o=0;o<n.length;o++)if(s=n[o],s===e||s.fn===e){n.splice(o,1);break}return n.length===0&&delete this._callbacks["$"+t],this};xt.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(n){n=n.slice(0);for(var s=0,o=n.length;s<o;++s)n[s].apply(this,e)}return this};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};xt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Of=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),Ln=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),bV="arraybuffer";function _E(t,...e){return e.reduce((n,s)=>(t.hasOwnProperty(s)&&(n[s]=t[s]),n),{})}const vV=Ln.setTimeout,SV=Ln.clearTimeout;function _f(t,e){e.useNativeTimers?(t.setTimeoutFn=vV.bind(Ln),t.clearTimeoutFn=SV.bind(Ln)):(t.setTimeoutFn=Ln.setTimeout.bind(Ln),t.clearTimeoutFn=Ln.clearTimeout.bind(Ln))}const wV=1.33;function xV(t){return typeof t=="string"?TV(t):Math.ceil((t.byteLength||t.size)*wV)}function TV(t){let e=0,n=0;for(let s=0,o=t.length;s<o;s++)e=t.charCodeAt(s),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(s++,n+=4);return n}function kE(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function AV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function EV(t){let e={},n=t.split("&");for(let s=0,o=n.length;s<o;s++){let l=n[s].split("=");e[decodeURIComponent(l[0])]=decodeURIComponent(l[1])}return e}class RV extends Error{constructor(e,n,s){super(e),this.description=n,this.context=s,this.type="TransportError"}}class By extends xt{constructor(e){super(),this.writable=!1,_f(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,s){return super.emitReserved("error",new RV(e,n,s)),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=jy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=AV(e);return n.length?"?"+n:""}}class OV extends By{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 s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||n()})),this.writable||(s++,this.once("drain",function(){--s||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};pV(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,hV(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]=kE()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let ME=!1;try{ME=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _V=ME;function kV(){}class MV extends OV{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let s=location.port;s||(s=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,n){const s=this.request({method:"POST",data:e});s.on("success",n),s.on("error",(o,l)=>{this.onError("xhr post error",o,l)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,s)=>{this.onError("xhr poll error",n,s)}),this.pollXhr=e}}let Ro=class vu extends xt{constructor(e,n,s){super(),this.createRequest=e,_f(this,s),this._opts=s,this._method=s.method||"GET",this._uri=n,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const n=_E(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(n);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let o in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(o)&&s.setRequestHeader(o,this._opts.extraHeaders[o])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var o;s.readyState===3&&((o=this._opts.cookieJar)===null||o===void 0||o.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(o){this.setTimeoutFn(()=>{this._onError(o)},0);return}typeof document<"u"&&(this._index=vu.requestsCount++,vu.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=kV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete vu.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()}};Ro.requestsCount=0;Ro.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Qw);else if(typeof addEventListener=="function"){const t="onpagehide"in Ln?"pagehide":"unload";addEventListener(t,Qw,!1)}}function Qw(){for(let t in Ro.requests)Ro.requests.hasOwnProperty(t)&&Ro.requests[t].abort()}const CV=(function(){const t=CE({xdomain:!1});return t&&t.responseType!==null})();class DV extends MV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=CV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ro(CE,this.uri(),e)}}function CE(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_V))return new XMLHttpRequest}catch{}if(!e)try{return new Ln[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const DE=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class NV extends By{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,s=DE?{}:_E(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,s)}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 s=e[n],o=n===e.length-1;$y(s,this.supportsBinary,l=>{try{this.doWrite(s,l)}catch{}o&&Of(()=>{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]=kE()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const gp=Ln.WebSocket||Ln.MozWebSocket;class $V extends NV{createSocket(e,n,s){return DE?new gp(e,n,s):n?new gp(e,n):new gp(e)}doWrite(e,n){this.ws.send(n)}}class jV extends By{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=yV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(n).getReader(),o=mV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const l=()=>{s.read().then(({done:d,value:h})=>{d||(this.onPacket(h),l())}).catch(d=>{})};l();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 s=e[n],o=n===e.length-1;this._writer.write(s).then(()=>{o&&Of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const BV={websocket:$V,webtransport:jV,polling:DV},LV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ym(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),s=t.indexOf("]");n!=-1&&s!=-1&&(t=t.substring(0,n)+t.substring(n,s).replace(/:/g,";")+t.substring(s,t.length));let o=LV.exec(t||""),l={},u=14;for(;u--;)l[VV[u]]=o[u]||"";return n!=-1&&s!=-1&&(l.source=e,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=UV(l,l.path),l.queryKey=zV(l,l.query),l}function UV(t,e){const n=/\/{2,9}/g,s=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function zV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,o,l){o&&(n[o]=l)}),n}const gm=typeof addEventListener=="function"&&typeof removeEventListener=="function",Su=[];gm&&addEventListener("offline",()=>{Su.forEach(t=>t())},!1);class _s extends xt{constructor(e,n){if(super(),this.binaryType=bV,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 s=ym(e);n.hostname=s.host,n.secure=s.protocol==="https"||s.protocol==="wss",n.port=s.port,s.query&&(n.query=s.query)}else n.host&&(n.hostname=ym(n.host).host);_f(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(s=>{const o=s.prototype.name;this.transports.push(o),this._transportsByName[o]=s}),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=EV(this.opts.query)),gm&&(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"})},Su.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=OE,n.transport=e,this.id&&(n.sid=this.id);const s=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](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&_s.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",_s.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 s=0;s<this.writeBuffer.length;s++){const o=this.writeBuffer[s].data;if(o&&(n+=xV(o)),s>0&&n>this._maxPayload)return this.writeBuffer.slice(0,s);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Of(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,s){return this._sendPacket("message",e,n,s),this}send(e,n,s){return this._sendPacket("message",e,n,s),this}_sendPacket(e,n,s,o){if(typeof n=="function"&&(o=n,n=void 0),typeof s=="function"&&(o=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const l={type:e,data:n,options:s};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),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()},s=()=>{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?s():e()}):this.upgrading?s():e()),this}_onError(e){if(_s.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(),gm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=Su.indexOf(this._offlineEventListener);s!==-1&&Su.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}_s.protocol=OE;class KV extends _s{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),s=!1;_s.priorWebsocketSuccess=!1;const o=()=>{s||(n.send([{type:"ping",data:"probe"}]),n.once("packet",g=>{if(!s)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;_s.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{s||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 l(){s||(s=!0,y(),n.close(),n=null)}const u=g=>{const v=new Error("probe error: "+g);v.transport=n.name,l(),this.emitReserved("upgradeError",v)};function d(){u("transport closed")}function h(){u("socket closed")}function p(g){n&&g.name!==n.name&&l()}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(()=>{s||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&n.push(e[s]);return n}}let qV=class extends KV{constructor(e,n={}){const s=typeof e=="object"?e:n;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(o=>BV[o]).filter(o=>!!o)),super(e,s)}};function PV(t,e="",n){let s=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),s=ym(t)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const l=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+l+":"+s.port+e,s.href=s.protocol+"://"+l+(n&&n.port===s.port?"":":"+s.port),s}const IV=typeof ArrayBuffer=="function",HV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,NE=Object.prototype.toString,FV=typeof Blob=="function"||typeof Blob<"u"&&NE.call(Blob)==="[object BlobConstructor]",GV=typeof File=="function"||typeof File<"u"&&NE.call(File)==="[object FileConstructor]";function Ly(t){return IV&&(t instanceof ArrayBuffer||HV(t))||FV&&t instanceof Blob||GV&&t instanceof File}function wu(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,s=t.length;n<s;n++)if(wu(t[n]))return!0;return!1}if(Ly(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return wu(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&wu(t[n]))return!0;return!1}function YV(t){const e=[],n=t.data,s=t;return s.data=bm(n,e),s.attachments=e.length,{packet:s,buffers:e}}function bm(t,e){if(!t)return t;if(Ly(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 s=0;s<t.length;s++)n[s]=bm(t[s],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[s]=bm(t[s],e));return n}return t}function XV(t,e){return t.data=vm(t.data,e),delete t.attachments,t}function vm(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]=vm(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=vm(t[n],e));return t}const JV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ZV=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 QV{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&wu(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=YV(e),s=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(s),o}}function Ww(t){return Object.prototype.toString.call(t)==="[object Object]"}class Vy extends xt{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 s=n.type===ke.BINARY_EVENT;s||n.type===ke.BINARY_ACK?(n.type=s?ke.EVENT:ke.ACK,this.reconstructor=new WV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Ly(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 s={type:Number(e.charAt(0))};if(ke[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===ke.BINARY_EVENT||s.type===ke.BINARY_ACK){const l=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const u=e.substring(l,n);if(u!=Number(u)||e.charAt(n)!=="-")throw new Error("Illegal attachments");s.attachments=Number(u)}if(e.charAt(n+1)==="/"){const l=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););s.nsp=e.substring(l,n)}else s.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const l=n+1;for(;++n;){const u=e.charAt(n);if(u==null||Number(u)!=u){--n;break}if(n===e.length)break}s.id=Number(e.substring(l,n+1))}if(e.charAt(++n)){const l=this.tryParse(e.substr(n));if(Vy.isPayloadValid(s.type,l))s.data=l;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case ke.CONNECT:return Ww(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||Ww(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&JV.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 WV{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=XV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const eU=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Vy,Encoder:QV,get PacketType(){return ke},protocol:ZV},Symbol.toStringTag,{value:"Module"}));function Fn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const tU=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $E extends xt{constructor(e,n,s){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,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Fn(e,"open",this.onopen.bind(this)),Fn(e,"packet",this.onpacket.bind(this)),Fn(e,"error",this.onerror.bind(this)),Fn(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 s,o,l;if(tU.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=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!d||(h?(this.notifyOutgoingListeners(u),this.packet(u)):this.sendBuffer.push(u)),this.flags={},this}_registerAckCallback(e,n){var s;const o=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(o===void 0){this.acks[e]=n;return}const l=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(l),n.apply(this,d)};u.withError=!0,this.acks[e]=u}emitWithAck(e,...n){return new Promise((s,o)=>{const l=(u,d)=>u?o(u):s(d);l.withError=!0,n.push(l),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((o,...l)=>s!==this._queue[0]?void 0:(o!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(o)):(this._queue.shift(),n&&n(null,...l)),s.pending=!1,this._drainQueue())),this._queue.push(s),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(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.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 s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);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 s of n)s.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 s=!1;return function(...o){s||(s=!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 s=0;s<n.length;s++)if(e===n[s])return n.splice(s,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 s=0;s<n.length;s++)if(e===n[s])return n.splice(s,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 s of n)s.apply(this,e.data)}}}function Io(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}Io.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};Io.prototype.reset=function(){this.attempts=0};Io.prototype.setMin=function(t){this.ms=t};Io.prototype.setMax=function(t){this.max=t};Io.prototype.setJitter=function(t){this.jitter=t};class Sm extends xt{constructor(e,n){var s;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,_f(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((s=n.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new Io({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||eU;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 qV(this.uri,this.opts);const n=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const o=Fn(n,"open",function(){s.onopen(),e&&e()}),l=d=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",d),e?e(d):this.maybeReconnectOnOpen()},u=Fn(n,"error",l);if(this._timeout!==!1){const d=this._timeout,h=this.setTimeoutFn(()=>{o(),l(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(Fn(e,"ping",this.onping.bind(this)),Fn(e,"data",this.ondata.bind(this)),Fn(e,"error",this.onerror.bind(this)),Fn(e,"close",this.onclose.bind(this)),Fn(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){Of(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new $E(this,e,n),this.nsps[e]=s),s}_destroy(e){const n=Object.keys(this.nsps);for(const s of n)if(this.nsps[s].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let s=0;s<n.length;s++)this.engine.write(n[s],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 s;this.cleanup(),(s=this.engine)===null||s===void 0||s.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 s=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&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ga={};function xu(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=PV(t,e.path||"/socket.io"),s=n.source,o=n.id,l=n.path,u=Ga[o]&&l in Ga[o].nsps,d=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let h;return d?h=new Sm(s,e):(Ga[o]||(Ga[o]=new Sm(s,e)),h=Ga[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(xu,{Manager:Sm,Socket:$E,io:xu,connect:xu});const nU=["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"],iU=3,sU=15,rU=/^[a-zA-Z0-9_-]+$/,oU=wt(rU).pipe(wt(`string > ${iU} & string < ${sU}`)).brand("username"),ex=20,tx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function aU(t){let e="";for(const n of t)n in tx?e+=tx[n]:e+=n;return e}function lU(t){const e=t.toLocaleLowerCase(),n=aU(e);for(const s of nU)if(n.includes(s)||e.includes(s))return!0;return!1}function cU(t){const e=new Set(t).size;return t.length*Math.log2(e)}function uU(t){let e=0;return lU(t)&&(e-=100),e+=cU(t)*.5,Math.max(e,0)}const fU=wt("string").narrow((t,e)=>{const n=uU(t);return n>=ex?!0:e.mustBe(`Of complexity ${ex} or more. Was ${n.toFixed(2)}.`)}).brand("password");wt({"+":"delete",email:"string",password:"string"});const dU=wt("string").brand("email");wt({"+":"delete",username:"string",password:"string",email:"string"});const hU=wt({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),di=xu(wE.VITE_BACKEND_ORIGIN,{auth:t=>{const e=Ze(at);e&&t(e)},withCredentials:!0,autoConnect:!1});di.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(at,null)}).on("usernameChanged",t=>{De(at,e=>e===null?null:{...e,username:t})});const at=ct({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=Ns(e),s=hU(n);return s instanceof wt.errors?(console.error("failed to parse auth data",s),null):(s.verification==="verified"&&(console.log("connecting..."),di.connect()),s)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(Oo,n.username),localStorage.setItem("auth",Ge(n)),n.verification==="verified"?(console.log("connecting..."),di.connect()):yr("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),Oo=ct({key:"username",default:Ze(at)?.username??""}),bp=ct({key:"usernameDebounce",default:!0}),pU=ct({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{Yk(Oo,()=>{Ze(bp)&&(t(Ze(Oo)),De(bp,!1),setTimeout(()=>{De(bp,!0),t(Ze(Oo))},2e3))})}]}),mU=hi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(pU);if(!e)return!1;const n=Ze(at);return e===n?.username?!1:rn.isUsernameTaken.query({username:e})}}),jE=hi({key:"usernameIssues",get:({get:t})=>{const e=t(Oo),n=oU(e);return n instanceof wt.errors?n:null}}),oi=ct({key:"password0",default:""}),BE=hi({key:"password0Issues",get:({get:t})=>{const e=t(oi),n=fU(e);return n instanceof wt.errors?n:null}}),Vo=ct({key:"email",default:""}),LE=hi({key:"emailIssues",get:({get:t})=>{const e=t(Vo),n=dU(e);return n instanceof wt.errors?n:null}});hi({key:"signupReady",get:({get:t})=>{const e=t(jE),n=t(BE),s=t(LE);return!(e??n??s)}});const Ui=ct({key:"oneTimeCode",default:""}),wm=ct({key:"oneTimeCodeNewEmail",default:""}),si=ct({key:"authTarget",default:null}),VE=pp({verify:pp({$token:null}),game:pp({clicker:null}),account:null,admin:null});function yU(t){return lV(VE,t)}const gU=[[]];function bU(t){return gU.some(e=>e.join("/")===t.join("/"))}function yr(t){history.pushState(null,"",t),De(UE,t)}const UE=ct({key:"pathName",default:window.location.pathname,effects:[({onSet:t,setSelf:e})=>{const n=o=>{history.replaceState(null,"",o),e(o)},s=o=>{switch(o){case"/":{const l=Ze(at);switch(console.log("/","auth",l),l?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{Ze(at)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{Ze(at)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const l=Ze(at);if(!l){n("/");break}l.verification==="unverified"&&n("/verify");break}}};s(window.location.pathname),t(({newValue:o})=>{s(o)})},({setSelf:t})=>{document.addEventListener("click",e=>{const n=e.target.closest("a");if(n&&n instanceof HTMLAnchorElement){const s=n.getAttribute("href");s?.startsWith("/")&&(e.preventDefault(),history.pushState(null,"",s),t(s))}}),window.addEventListener("popstate",()=>{t(window.location.pathname)})}]}),vU=hi({key:"route",get:({get:t})=>{const n=t(UE).split("/").slice(1).filter(Boolean);return yU(n)?bU(n)||t(at)?n:401:404}}),nx=ct({key:"buttonBlockActive",default:!1}),$n=ct({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{Ze(zE)?.focus();break}case"new-password":{Ze(KE)?.focus();break}case"username":{Ze(qE)?.focus();break}}})}]}),zE=ct({key:"emailInputElement",default:null}),KE=ct({key:"password0InputElement",default:null}),qE=ct({key:"usernameInputElement",default:null});function SU(t){const e=V.useRef(null);return V.useEffect(()=>{De(t,e.current)},[t]),e}const wU=hi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(at);return e?`Code sent to ${e.email}`:""}}),xU=hi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Vo);return e?`Code sent to ${e}`:""}});function vp({label:t,inputToken:e,issuesToken:n,inputElementToken:s,initialState:o,onSubmit:l,onOpen:u,onCancel:d,extraIssues:h}){const p=St(e),y=Gn(e),g=St(Ui),v=Gn(Ui),S=St(wm),x=Gn(wm),T=St(oi),D=Gn(oi),M=St(nx),O=Gn(nx),C=St($n),j=Gn($n),_=St(n),J=St(wU),Y=St(xU),F=SU(s),ee=C[0]===t,se=C.at(-1),[ue,...ge]=C;return G.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),M){O(!1);return}console.log(`submitted! changing ${t} to`,p);const Q=await l(p);Error.isError(Q)&&console.error(Q)},children:[ee?G.jsx("button",{type:"button",onClick:async()=>{await d?.(),j([])},children:"x"}):null,G.jsxs("main",{children:[G.jsxs("label",{htmlFor:t,children:[_||h?G.jsxs("aside",{children:[h,_?.map(be=>G.jsx("span",{children:be.message},be.path.join(".")))]}):null,G.jsx("span",{children:t==="new-password"?"Password":gn(t)}),G.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:F,value:p,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:se!==t})]}),ee?ge.map(be=>G.jsxs("label",{htmlFor:`${t}-${be}`,children:[G.jsx("span",{children:(()=>{switch(be){case"otcLogin":return J;case"otcVerify":return Y;case"passwordLogin":return"Password"}})()}),G.jsx("input",{id:`${t}-otc`,type:"text",ref:F,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"){x(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!==se})]},`${t}-${be}`)):null]}),C[0]===t?G.jsx("button",{type:"submit",children:"->"}):G.jsx("button",{type:"button",onMouseDown:async()=>{O(!0),await u?.(),j(o)},onMouseUp:()=>{O(!1)},children:"/"})]})}function TU(){const t=St(at),e=St(mU);return ku(()=>{t&&De(Vo,t.email),t?.password&&De(oi,"••••••••••••")}),t?G.jsxs("article",{"data-css":"editor",children:[G.jsx(vp,{label:"username",inputToken:Oo,issuesToken:jE,inputElementToken:qE,initialState:["username"],onSubmit:async n=>(await new Promise(s=>{di.once("usernameChanged",s),di.emit("changeUsername",n)}),De($n,[]),n),extraIssues:e?G.jsx("span",{children:"This username is taken."}):null}),G.jsx(vp,{label:"email",inputToken:Vo,issuesToken:LE,inputElementToken:zE,initialState:["email"],onSubmit:async n=>{const s=Ze($n);if(s[0]!=="email")return new Error("field not email");switch(s.length){case 1:{const{userKey:o,nextStep:l}=await rn.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:l}),l){case"otc_login":{De(si,o),De($n,["email","otcLogin"]);break}case"password_login":{De(si,o),De($n,["email","passwordLogin"]);break}case"otc_verify":{De(si,o),De(Ui,"not needed"),De($n,["email","otcLogin","otcVerify"]);break}}return o}case 2:switch(console.log("case 2"),s[1]){case"otcLogin":{console.log("case 2.1");const o=Ze(si);if(!o)return new Error("No auth target");const l=Ze(Ui),u=await rn.verifyAccountAction.mutate({oneTimeCode:l,userKey:o});return De(at,u),De($n,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=Ze(si);if(!o)return new Error("No auth target");const l=Ze(wm),u=await rn.verifyAccountAction.mutate({oneTimeCode:l,userKey:o});return De(at,u),De($n,[]),u.email}}}}),G.jsx(vp,{label:"new-password",inputToken:oi,issuesToken:BE,inputElementToken:KE,initialState:t.password?["new-password","otcVerify"]:["new-password"],onSubmit:async n=>{const s=Ze($n);if(s[0]!=="new-password")return new Error("field not new-password");switch(s.length){case 1:return await rn.setPassword.mutate({password:n}),De(oi,"••••••••••••"),De(at,o=>o&&{...o,password:!0}),De($n,[]),"done";case 2:{const o=Ze(si);return o?(await rn.verifyAccountAction.mutate({oneTimeCode:Ze(Ui),userKey:o}),De(at,l=>l&&{...l,password:!1}),De(oi,""),De($n,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(oi,"••••••••••••")},onOpen:async()=>{if(t.password){const n=Ze(si);if(!n)return new Error("No userKey");await rn.startPasswordReset.mutate({userKey:n})}}})]}):G.jsx("p",{children:"You must be logged in to verify your account."})}function AU(){return G.jsx("article",{children:G.jsx("h1",{children:"admin"})})}var EU=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")}},RU=class xm{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new EU;static create(e,n){const s=new xm(e),{type:o,globals:l,actions:u,perspectives:d}=n(s),h={type:o,key:e,globals:l,actions:u,perspectives:d};return xm.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[s,o]=e;this.perspectives.push({type:"realtime_perspective",resourceAtoms:s,viewAtoms:o})}break}return this}};function OU(t){const{key:e,config:n}=t,s=RU.create(e,n),{actions:o}=s;for(const l of o)O1(Bt.STORE,e,l.key);return Xm(Bt.STORE,e,-1),s}p1({key:"usersInRoomIndex",class:Im});p1({key:"roomIndex",class:Im});const _U={enteredAtEpoch:0},kU=qk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},_U);Gk({key:"usersInMyRoomView",get:t=>({find:e})=>{const n=Pk(kU);return[e(n,t)]}});const Uy=ct({key:"count",default:0}),PE=Xk({key:"incrementTX",do:({set:t})=>{t(Uy,e=>e+1)}}),MU=OU({key:"countContinuity",config:t=>t.add(Uy).add(PE)});function CU({route:[,t]}){return G.jsx("article",{children:t?G.jsx(NU,{gameId:t}):G.jsx(DU,{})})}function DU(){return G.jsx("nav",{children:G.jsx(oE,{href:"/game/clicker",children:"Clicker"})})}Kk(VE[1].game[1]);function NU({gameId:t}){console.log(t);const e=St(Uy),n=Jk(PE);return JM(MU),G.jsxs("article",{children:[G.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),G.jsx("p",{children:"Let's see how high we can count!"})]})}const IE=V.createContext({});function $U(t){const e=V.useRef(null);return e.current===null&&(e.current=t()),e.current}const zy=typeof window<"u",jU=zy?V.useLayoutEffect:V.useEffect,Ky=V.createContext(null);function qy(t,e){t.indexOf(e)===-1&&t.push(e)}function Py(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Fi=(t,e,n)=>n>e?e:n<t?t:n;let Iy=()=>{};const Gi={},HE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function FE(t){return typeof t=="object"&&t!==null}const GE=t=>/^0[^.\s]+$/u.test(t);function Hy(t){let e;return()=>(e===void 0&&(e=t()),e)}const Vn=t=>t,BU=(t,e)=>n=>e(t(n)),Nl=(...t)=>t.reduce(BU),pl=(t,e,n)=>{const s=e-t;return s===0?1:(n-t)/s};class Fy{constructor(){this.subscriptions=[]}add(e){return qy(this.subscriptions,e),()=>Py(this.subscriptions,e)}notify(e,n,s){const o=this.subscriptions.length;if(o)if(o===1)this.subscriptions[0](e,n,s);else for(let l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,s)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const li=t=>t*1e3,ci=t=>t/1e3;function YE(t,e){return e?t*(1e3/e):0}const XE=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,LU=1e-7,VU=12;function UU(t,e,n,s,o){let l,u,d=0;do u=e+(n-e)/2,l=XE(u,s,o)-t,l>0?n=u:e=u;while(Math.abs(l)>LU&&++d<VU);return u}function $l(t,e,n,s){if(t===e&&n===s)return Vn;const o=l=>UU(l,0,1,t,n);return l=>l===0||l===1?l:XE(o(l),e,s)}const JE=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ZE=t=>e=>1-t(1-e),QE=$l(.33,1.53,.69,.99),Gy=ZE(QE),WE=JE(Gy),eR=t=>(t*=2)<1?.5*Gy(t):.5*(2-Math.pow(2,-10*(t-1))),Yy=t=>1-Math.sin(Math.acos(t)),tR=ZE(Yy),nR=JE(Yy),zU=$l(.42,0,1,1),KU=$l(0,0,.58,1),iR=$l(.42,0,.58,1),qU=t=>Array.isArray(t)&&typeof t[0]!="number",sR=t=>Array.isArray(t)&&typeof t[0]=="number",PU={linear:Vn,easeIn:zU,easeInOut:iR,easeOut:KU,circIn:Yy,circInOut:nR,circOut:tR,backIn:Gy,backInOut:WE,backOut:QE,anticipate:eR},IU=t=>typeof t=="string",ix=t=>{if(sR(t)){Iy(t.length===4);const[e,n,s,o]=t;return $l(e,n,s,o)}else if(IU(t))return PU[t];return t},cu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function HU(t,e){let n=new Set,s=new Set,o=!1,l=!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 x=v&&o?n:s;return g&&u.add(y),x.has(y)||x.add(y),y},cancel:y=>{s.delete(y),u.delete(y)},process:y=>{if(d=y,o){l=!0;return}o=!0,[n,s]=[s,n],n.forEach(h),n.clear(),o=!1,l&&(l=!1,p.process(y))}};return p}const FU=40;function rR(t,e){let n=!1,s=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=cu.reduce((C,j)=>(C[j]=HU(l),C),{}),{setup:d,read:h,resolveKeyframes:p,preUpdate:y,update:g,preRender:v,render:S,postRender:x}=u,T=()=>{const C=Gi.useManualTiming?o.timestamp:performance.now();n=!1,Gi.useManualTiming||(o.delta=s?1e3/60:Math.max(Math.min(C-o.timestamp,FU),1)),o.timestamp=C,o.isProcessing=!0,d.process(o),h.process(o),p.process(o),y.process(o),g.process(o),v.process(o),S.process(o),x.process(o),o.isProcessing=!1,n&&e&&(s=!1,t(T))},D=()=>{n=!0,s=!0,o.isProcessing||t(T)};return{schedule:cu.reduce((C,j)=>{const _=u[j];return C[j]=(J,Y=!1,F=!1)=>(n||D(),_.schedule(J,Y,F)),C},{}),cancel:C=>{for(let j=0;j<cu.length;j++)u[cu[j]].cancel(C)},state:o,steps:u}}const{schedule:We,cancel:Cs,state:zt,steps:Sp}=rR(typeof requestAnimationFrame<"u"?requestAnimationFrame:Vn,!0);let Tu;function GU(){Tu=void 0}const on={now:()=>(Tu===void 0&&on.set(zt.isProcessing||Gi.useManualTiming?zt.timestamp:performance.now()),Tu),set:t=>{Tu=t,queueMicrotask(GU)}},oR=t=>e=>typeof e=="string"&&e.startsWith(t),Xy=oR("--"),YU=oR("var(--"),Jy=t=>YU(t)?XU.test(t.split("/*")[0].trim()):!1,XU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ho={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ml={...Ho,transform:t=>Fi(0,1,t)},uu={...Ho,default:1},tl=t=>Math.round(t*1e5)/1e5,Zy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JU(t){return t==null}const ZU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qy=(t,e)=>n=>!!(typeof n=="string"&&ZU.test(n)&&n.startsWith(t)||e&&!JU(n)&&Object.prototype.hasOwnProperty.call(n,e)),aR=(t,e,n)=>s=>{if(typeof s!="string")return s;const[o,l,u,d]=s.match(Zy);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:d!==void 0?parseFloat(d):1}},QU=t=>Fi(0,255,t),wp={...Ho,transform:t=>Math.round(QU(t))},ar={test:Qy("rgb","red"),parse:aR("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:s=1})=>"rgba("+wp.transform(t)+", "+wp.transform(e)+", "+wp.transform(n)+", "+tl(ml.transform(s))+")"};function WU(t){let e="",n="",s="",o="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),s=t.substring(5,7),o=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),s=t.substring(3,4),o=t.substring(4,5),e+=e,n+=n,s+=s,o+=o),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(s,16),alpha:o?parseInt(o,16)/255:1}}const Tm={test:Qy("#"),parse:WU,transform:ar.transform},jl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),ws=jl("deg"),ui=jl("%"),ye=jl("px"),e4=jl("vh"),t4=jl("vw"),sx={...ui,parse:t=>ui.parse(t)/100,transform:t=>ui.transform(t*100)},yo={test:Qy("hsl","hue"),parse:aR("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:s=1})=>"hsla("+Math.round(t)+", "+ui.transform(tl(e))+", "+ui.transform(tl(n))+", "+tl(ml.transform(s))+")"},vt={test:t=>ar.test(t)||Tm.test(t)||yo.test(t),parse:t=>ar.test(t)?ar.parse(t):yo.test(t)?yo.parse(t):Tm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?ar.transform(t):yo.transform(t),getAnimatableNone:t=>{const e=vt.parse(t);return e.alpha=0,vt.transform(e)}},n4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function i4(t){return isNaN(t)&&typeof t=="string"&&(t.match(Zy)?.length||0)+(t.match(n4)?.length||0)>0}const lR="number",cR="color",s4="var",r4="var(",rx="${}",o4=/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 yl(t){const e=t.toString(),n=[],s={color:[],number:[],var:[]},o=[];let l=0;const d=e.replace(o4,h=>(vt.test(h)?(s.color.push(l),o.push(cR),n.push(vt.parse(h))):h.startsWith(r4)?(s.var.push(l),o.push(s4),n.push(h)):(s.number.push(l),o.push(lR),n.push(parseFloat(h))),++l,rx)).split(rx);return{values:n,split:d,indexes:s,types:o}}function uR(t){return yl(t).values}function fR(t){const{split:e,types:n}=yl(t),s=e.length;return o=>{let l="";for(let u=0;u<s;u++)if(l+=e[u],o[u]!==void 0){const d=n[u];d===lR?l+=tl(o[u]):d===cR?l+=vt.transform(o[u]):l+=o[u]}return l}}const a4=t=>typeof t=="number"?0:vt.test(t)?vt.getAnimatableNone(t):t;function l4(t){const e=uR(t);return fR(t)(e.map(a4))}const Ds={test:i4,parse:uR,createTransformer:fR,getAnimatableNone:l4};function xp(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 c4({hue:t,saturation:e,lightness:n,alpha:s}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const d=n<.5?n*(1+e):n+e-n*e,h=2*n-d;o=xp(h,d,t+1/3),l=xp(h,d,t),u=xp(h,d,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:s}}function Yu(t,e){return n=>n>0?e:t}const nt=(t,e,n)=>t+(e-t)*n,Tp=(t,e,n)=>{const s=t*t,o=n*(e*e-s)+s;return o<0?0:Math.sqrt(o)},u4=[Tm,ar,yo],f4=t=>u4.find(e=>e.test(t));function ox(t){const e=f4(t);if(!e)return!1;let n=e.parse(t);return e===yo&&(n=c4(n)),n}const ax=(t,e)=>{const n=ox(t),s=ox(e);if(!n||!s)return Yu(t,e);const o={...n};return l=>(o.red=Tp(n.red,s.red,l),o.green=Tp(n.green,s.green,l),o.blue=Tp(n.blue,s.blue,l),o.alpha=nt(n.alpha,s.alpha,l),ar.transform(o))},Am=new Set(["none","hidden"]);function d4(t,e){return Am.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function h4(t,e){return n=>nt(t,e,n)}function Wy(t){return typeof t=="number"?h4:typeof t=="string"?Jy(t)?Yu:vt.test(t)?ax:y4:Array.isArray(t)?dR:typeof t=="object"?vt.test(t)?ax:p4:Yu}function dR(t,e){const n=[...t],s=n.length,o=t.map((l,u)=>Wy(l)(l,e[u]));return l=>{for(let u=0;u<s;u++)n[u]=o[u](l);return n}}function p4(t,e){const n={...t,...e},s={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(s[o]=Wy(t[o])(t[o],e[o]));return o=>{for(const l in s)n[l]=s[l](o);return n}}function m4(t,e){const n=[],s={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const l=e.types[o],u=t.indexes[l][s[l]],d=t.values[u]??0;n[o]=d,s[l]++}return n}const y4=(t,e)=>{const n=Ds.createTransformer(e),s=yl(t),o=yl(e);return s.indexes.var.length===o.indexes.var.length&&s.indexes.color.length===o.indexes.color.length&&s.indexes.number.length>=o.indexes.number.length?Am.has(t)&&!o.values.length||Am.has(e)&&!s.values.length?d4(t,e):Nl(dR(m4(s,o),o.values),n):Yu(t,e)};function hR(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?nt(t,e,n):Wy(t)(t,e)}const g4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>We.update(e,n),stop:()=>Cs(e),now:()=>zt.isProcessing?zt.timestamp:on.now()}},pR=(t,e,n=10)=>{let s="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)s+=Math.round(t(l/(o-1))*1e4)/1e4+", ";return`linear(${s.substring(0,s.length-2)})`},Xu=2e4;function eg(t){let e=0;const n=50;let s=t.next(e);for(;!s.done&&e<Xu;)e+=n,s=t.next(e);return e>=Xu?1/0:e}function b4(t,e=100,n){const s=n({...t,keyframes:[0,e]}),o=Math.min(eg(s),Xu);return{type:"keyframes",ease:l=>s.next(o*l).value/e,duration:ci(o)}}const v4=5;function mR(t,e,n){const s=Math.max(e-v4,0);return YE(n-t(s),e-s)}const ot={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},Ap=.001;function S4({duration:t=ot.duration,bounce:e=ot.bounce,velocity:n=ot.velocity,mass:s=ot.mass}){let o,l,u=1-e;u=Fi(ot.minDamping,ot.maxDamping,u),t=Fi(ot.minDuration,ot.maxDuration,ci(t)),u<1?(o=p=>{const y=p*u,g=y*t,v=y-n,S=Em(p,u),x=Math.exp(-g);return Ap-v/S*x},l=p=>{const g=p*u*t,v=g*n+n,S=Math.pow(u,2)*Math.pow(p,2)*t,x=Math.exp(-g),T=Em(Math.pow(p,2),u);return(-o(p)+Ap>0?-1:1)*((v-S)*x)/T}):(o=p=>{const y=Math.exp(-p*t),g=(p-n)*t+1;return-Ap+y*g},l=p=>{const y=Math.exp(-p*t),g=(n-p)*(t*t);return y*g});const d=5/t,h=x4(o,l,d);if(t=li(t),isNaN(h))return{stiffness:ot.stiffness,damping:ot.damping,duration:t};{const p=Math.pow(h,2)*s;return{stiffness:p,damping:u*2*Math.sqrt(s*p),duration:t}}}const w4=12;function x4(t,e,n){let s=n;for(let o=1;o<w4;o++)s=s-t(s)/e(s);return s}function Em(t,e){return t*Math.sqrt(1-e*e)}const T4=["duration","bounce"],A4=["stiffness","damping","mass"];function lx(t,e){return e.some(n=>t[n]!==void 0)}function E4(t){let e={velocity:ot.velocity,stiffness:ot.stiffness,damping:ot.damping,mass:ot.mass,isResolvedFromDuration:!1,...t};if(!lx(t,A4)&&lx(t,T4))if(t.visualDuration){const n=t.visualDuration,s=2*Math.PI/(n*1.2),o=s*s,l=2*Fi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:ot.mass,stiffness:o,damping:l}}else{const n=S4(t);e={...e,...n,mass:ot.mass},e.isResolvedFromDuration=!0}return e}function Ju(t=ot.visualDuration,e=ot.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:s,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],d={done:!1,value:l},{stiffness:h,damping:p,mass:y,duration:g,velocity:v,isResolvedFromDuration:S}=E4({...n,velocity:-ci(n.velocity||0)}),x=v||0,T=p/(2*Math.sqrt(h*y)),D=u-l,M=ci(Math.sqrt(h/y)),O=Math.abs(D)<5;s||(s=O?ot.restSpeed.granular:ot.restSpeed.default),o||(o=O?ot.restDelta.granular:ot.restDelta.default);let C;if(T<1){const _=Em(M,T);C=J=>{const Y=Math.exp(-T*M*J);return u-Y*((x+T*M*D)/_*Math.sin(_*J)+D*Math.cos(_*J))}}else if(T===1)C=_=>u-Math.exp(-M*_)*(D+(x+M*D)*_);else{const _=M*Math.sqrt(T*T-1);C=J=>{const Y=Math.exp(-T*M*J),F=Math.min(_*J,300);return u-Y*((x+T*M*D)*Math.sinh(F)+_*D*Math.cosh(F))/_}}const j={calculatedDuration:S&&g||null,next:_=>{const J=C(_);if(S)d.done=_>=g;else{let Y=_===0?x:0;T<1&&(Y=_===0?li(x):mR(C,_,J));const F=Math.abs(Y)<=s,ee=Math.abs(u-J)<=o;d.done=F&&ee}return d.value=d.done?u:J,d},toString:()=>{const _=Math.min(eg(j),Xu),J=pR(Y=>j.next(_*Y).value,_,30);return _+"ms "+J},toTransition:()=>{}};return j}Ju.applyToOptions=t=>{const e=b4(t,100,Ju);return t.ease=e.ease,t.duration=li(e.duration),t.type="keyframes",t};function Rm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:s=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:d,max:h,restDelta:p=.5,restSpeed:y}){const g=t[0],v={done:!1,value:g},S=F=>d!==void 0&&F<d||h!==void 0&&F>h,x=F=>d===void 0?h:h===void 0||Math.abs(d-F)<Math.abs(h-F)?d:h;let T=n*e;const D=g+T,M=u===void 0?D:u(D);M!==D&&(T=M-g);const O=F=>-T*Math.exp(-F/s),C=F=>M+O(F),j=F=>{const ee=O(F),se=C(F);v.done=Math.abs(ee)<=p,v.value=v.done?M:se};let _,J;const Y=F=>{S(v.value)&&(_=F,J=Ju({keyframes:[v.value,x(v.value)],velocity:mR(C,F,v.value),damping:o,stiffness:l,restDelta:p,restSpeed:y}))};return Y(0),{calculatedDuration:null,next:F=>{let ee=!1;return!J&&_===void 0&&(ee=!0,j(F),Y(F)),_!==void 0&&F>=_?J.next(F-_):(!ee&&j(F),v)}}}function R4(t,e,n){const s=[],o=n||Gi.mix||hR,l=t.length-1;for(let u=0;u<l;u++){let d=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Vn:e;d=Nl(h,d)}s.push(d)}return s}function O4(t,e,{clamp:n=!0,ease:s,mixer:o}={}){const l=t.length;if(Iy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const d=R4(e,s,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=pl(t[g],t[g+1],y);return d[g](v)};return n?y=>p(Fi(t[0],t[l-1],y)):p}function _4(t,e){const n=t[t.length-1];for(let s=1;s<=e;s++){const o=pl(0,e,s);t.push(nt(n,1,o))}}function k4(t){const e=[0];return _4(e,t.length-1),e}function M4(t,e){return t.map(n=>n*e)}function C4(t,e){return t.map(()=>e||iR).splice(0,t.length-1)}function nl({duration:t=300,keyframes:e,times:n,ease:s="easeInOut"}){const o=qU(s)?s.map(ix):ix(s),l={done:!1,value:e[0]},u=M4(n&&n.length===e.length?n:k4(e),t),d=O4(u,e,{ease:Array.isArray(o)?o:C4(e,o)});return{calculatedDuration:t,next:h=>(l.value=d(h),l.done=h>=t,l)}}const D4=t=>t!==null;function tg(t,{repeat:e,repeatType:n="loop"},s,o=1){const l=t.filter(D4),d=o<0||e&&n!=="loop"&&e%2===1?0:l.length-1;return!d||s===void 0?l[d]:s}const N4={decay:Rm,inertia:Rm,tween:nl,keyframes:nl,spring:Ju};function yR(t){typeof t.type=="string"&&(t.type=N4[t.type])}class ng{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 $4=t=>t/100;class ig extends ng{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!==on.now()&&this.tick(on.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;yR(e);const{type:n=nl,repeat:s=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=e;let{keyframes:d}=e;const h=n||nl;h!==nl&&typeof d[0]!="number"&&(this.mixKeyframes=Nl($4,hR(d[0],d[1])),d=[0,100]);const p=h({...e,keyframes:d});l==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...d].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=eg(p));const{calculatedDuration:y}=p;this.calculatedDuration=y,this.resolvedDuration=y+o,this.totalDuration=this.resolvedDuration*(s+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:s,totalDuration:o,mixKeyframes:l,mirroredGenerator:u,resolvedDuration:d,calculatedDuration:h}=this;if(this.startTime===null)return s.next(0);const{delay:p=0,keyframes:y,repeat:g,repeatType:v,repeatDelay:S,type:x,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 M=this.currentTime-p*(this.playbackSpeed>=0?1:-1),O=this.playbackSpeed>=0?M<0:M>o;this.currentTime=Math.max(M,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let C=this.currentTime,j=s;if(g){const F=Math.min(this.currentTime,o)/d;let ee=Math.floor(F),se=F%1;!se&&F>=1&&(se=1),se===1&&ee--,ee=Math.min(ee,g+1),!!(ee%2)&&(v==="reverse"?(se=1-se,S&&(se-=S/d)):v==="mirror"&&(j=u)),C=Fi(0,1,se)*d}const _=O?{done:!1,value:y[0]}:j.next(C);l&&(_.value=l(_.value));let{done:J}=_;!O&&h!==null&&(J=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const Y=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return Y&&x!==Rm&&(_.value=tg(y,this.options,D,this.speed)),T&&T(_.value),Y&&this.finish(),_}then(e,n){return this.finished.then(e,n)}get duration(){return ci(this.calculatedDuration)}get time(){return ci(this.currentTime)}set time(e){e=li(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(on.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ci(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=g4,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),this.options.onPlay?.();const s=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=s):this.holdTime!==null?this.startTime=s-this.holdTime:this.startTime||(this.startTime=n??s),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(on.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 j4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const lr=t=>t*180/Math.PI,Om=t=>{const e=lr(Math.atan2(t[1],t[0]));return _m(e)},B4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Om,rotateZ:Om,skewX:t=>lr(Math.atan(t[1])),skewY:t=>lr(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},_m=t=>(t=t%360,t<0&&(t+=360),t),cx=Om,ux=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),fx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),L4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ux,scaleY:fx,scale:t=>(ux(t)+fx(t))/2,rotateX:t=>_m(lr(Math.atan2(t[6],t[5]))),rotateY:t=>_m(lr(Math.atan2(-t[2],t[0]))),rotateZ:cx,rotate:cx,skewX:t=>lr(Math.atan(t[4])),skewY:t=>lr(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function km(t){return t.includes("scale")?1:0}function Mm(t,e){if(!t||t==="none")return km(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let s,o;if(n)s=L4,o=n;else{const d=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);s=B4,o=d}if(!o)return km(e);const l=s[e],u=o[1].split(",").map(U4);return typeof l=="function"?l(u):u[l]}const V4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Mm(n,e)};function U4(t){return parseFloat(t.trim())}const Fo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Go=new Set(Fo),dx=t=>t===Ho||t===ye,z4=new Set(["x","y","z"]),K4=Fo.filter(t=>!z4.has(t));function q4(t){const e=[];return K4.forEach(n=>{const s=t.getValue(n);s!==void 0&&(e.push([n,s.get()]),s.set(n.startsWith("scale")?1:0))}),e}const fr={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})=>Mm(e,"x"),y:(t,{transform:e})=>Mm(e,"y")};fr.translateX=fr.x;fr.translateY=fr.y;const dr=new Set;let Cm=!1,Dm=!1,Nm=!1;function gR(){if(Dm){const t=Array.from(dr).filter(s=>s.needsMeasurement),e=new Set(t.map(s=>s.element)),n=new Map;e.forEach(s=>{const o=q4(s);o.length&&(n.set(s,o),s.render())}),t.forEach(s=>s.measureInitialState()),e.forEach(s=>{s.render();const o=n.get(s);o&&o.forEach(([l,u])=>{s.getValue(l)?.set(u)})}),t.forEach(s=>s.measureEndState()),t.forEach(s=>{s.suspendedScrollY!==void 0&&window.scrollTo(0,s.suspendedScrollY)})}Dm=!1,Cm=!1,dr.forEach(t=>t.complete(Nm)),dr.clear()}function bR(){dr.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Dm=!0)})}function P4(){Nm=!0,bR(),gR(),Nm=!1}class sg{constructor(e,n,s,o,l,u=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=s,this.motionValue=o,this.element=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(dr.add(this),Cm||(Cm=!0,We.read(bR),We.resolveKeyframes(gR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:s,motionValue:o}=this;if(e[0]===null){const l=o?.get(),u=e[e.length-1];if(l!==void 0)e[0]=l;else if(s&&n){const d=s.readValue(n,u);d!=null&&(e[0]=d)}e[0]===void 0&&(e[0]=u),o&&l===void 0&&o.set(e[0])}j4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),dr.delete(this)}cancel(){this.state==="scheduled"&&(dr.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const I4=t=>t.startsWith("--");function H4(t,e,n){I4(e)?t.style.setProperty(e,n):t.style[e]=n}const F4=Hy(()=>window.ScrollTimeline!==void 0),G4={};function Y4(t,e){const n=Hy(t);return()=>G4[e]??n()}const vR=Y4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Qa=([t,e,n,s])=>`cubic-bezier(${t}, ${e}, ${n}, ${s})`,hx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Qa([0,.65,.55,1]),circOut:Qa([.55,0,1,.45]),backIn:Qa([.31,.01,.66,-.59]),backOut:Qa([.33,1.53,.69,.99])};function SR(t,e){if(t)return typeof t=="function"?vR()?pR(t,e):"ease-out":sR(t)?Qa(t):Array.isArray(t)?t.map(n=>SR(n,e)||hx.easeOut):hx[t]}function X4(t,e,n,{delay:s=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:d="easeOut",times:h}={},p=void 0){const y={[e]:n};h&&(y.offset=h);const g=SR(d,o);Array.isArray(g)&&(y.easing=g);const v={delay:s,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),t.animate(y,v)}function wR(t){return typeof t=="function"&&"applyToOptions"in t}function J4({type:t,...e}){return wR(t)&&vR()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Z4 extends ng{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:s,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:d,onComplete:h}=e;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=e,Iy(typeof e.type!="string");const p=J4(e);this.animation=X4(n,s,o,p,l),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const y=tg(o,this.options,d,this.speed);this.updateMotionValue?this.updateMotionValue(y):H4(n,s,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 ci(Number(e))}get time(){return ci(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=li(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&&F4()?(this.animation.timeline=e,Vn):n(this)}}const xR={anticipate:eR,backInOut:WE,circInOut:nR};function Q4(t){return t in xR}function W4(t){typeof t.ease=="string"&&Q4(t.ease)&&(t.ease=xR[t.ease])}const px=10;class ez extends Z4{constructor(e){W4(e),yR(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:s,onComplete:o,element:l,...u}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const d=new ig({...u,autoplay:!1}),h=li(this.finishedTime??this.time);n.setWithVelocity(d.sample(h-px).value,d.sample(h).value,px),d.stop()}}const mx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Ds.test(t)||t==="0")&&!t.startsWith("url("));function tz(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 nz(t,e,n,s){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=mx(o,e),d=mx(l,e);return!u||!d?!1:tz(t)||(n==="spring"||wR(n))&&s}function $m(t){t.duration=0,t.type}const iz=new Set(["opacity","clipPath","filter","transform"]),sz=Hy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function rz(t){const{motionValue:e,name:n,repeatDelay:s,repeatType:o,damping:l,type:u}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=e.owner.getProps();return sz()&&n&&iz.has(n)&&(n!=="transform"||!p)&&!h&&!s&&o!=="mirror"&&l!==0&&u!=="inertia"}const oz=40;class az extends ng{constructor({autoplay:e=!0,delay:n=0,type:s="keyframes",repeat:o=0,repeatDelay:l=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=on.now();const v={autoplay:e,delay:n,type:s,repeat:o,repeatDelay:l,repeatType:u,name:h,motionValue:p,element:y,...g},S=y?.KeyframeResolver||sg;this.keyframeResolver=new S(d,(x,T,D)=>this.onKeyframesResolved(x,T,v,!D),h,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,s,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:d,delay:h,isHandoff:p,onUpdate:y}=s;this.resolvedAt=on.now(),nz(e,l,u,d)||((Gi.instantAnimations||!h)&&y?.(tg(e,s,n)),e[0]=e[e.length-1],$m(s),s.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>oz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...s,keyframes:e},S=!p&&rz(v)?new ez({...v,element:v.motionValue.owner.current}):new ig(v);S.finished.then(()=>this.notifyFinished()).catch(Vn),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(),P4()),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 lz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cz(t){const e=lz.exec(t);if(!e)return[,];const[,n,s,o]=e;return[`--${n??s}`,o]}function TR(t,e,n=1){const[s,o]=cz(t);if(!s)return;const l=window.getComputedStyle(e).getPropertyValue(s);if(l){const u=l.trim();return HE(u)?parseFloat(u):u}return Jy(o)?TR(o,e,n+1):o}function rg(t,e){return t?.[e]??t?.default??t}const AR=new Set(["width","height","top","left","right","bottom",...Fo]),uz={test:t=>t==="auto",parse:t=>t},ER=t=>e=>e.test(t),RR=[Ho,ye,ui,ws,t4,e4,uz],yx=t=>RR.find(ER(t));function fz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||GE(t):!0}const dz=new Set(["brightness","contrast","saturate","opacity"]);function hz(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[s]=n.match(Zy)||[];if(!s)return t;const o=n.replace(s,"");let l=dz.has(e)?1:0;return s!==n&&(l*=100),e+"("+l+o+")"}const pz=/\b([a-z-]*)\(.*?\)/gu,jm={...Ds,getAnimatableNone:t=>{const e=t.match(pz);return e?e.map(hz).join(" "):t}},gx={...Ho,transform:Math.round},mz={rotate:ws,rotateX:ws,rotateY:ws,rotateZ:ws,scale:uu,scaleX:uu,scaleY:uu,scaleZ:uu,skew:ws,skewX:ws,skewY:ws,distance:ye,translateX:ye,translateY:ye,translateZ:ye,x:ye,y:ye,z:ye,perspective:ye,transformPerspective:ye,opacity:ml,originX:sx,originY:sx,originZ:ye},og={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,...mz,zIndex:gx,fillOpacity:ml,strokeOpacity:ml,numOctaves:gx},yz={...og,color:vt,backgroundColor:vt,outlineColor:vt,fill:vt,stroke:vt,borderColor:vt,borderTopColor:vt,borderRightColor:vt,borderBottomColor:vt,borderLeftColor:vt,filter:jm,WebkitFilter:jm},OR=t=>yz[t];function _R(t,e){let n=OR(t);return n!==jm&&(n=Ds),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const gz=new Set(["auto","none","0"]);function bz(t,e,n){let s=0,o;for(;s<t.length&&!o;){const l=t[s];typeof l=="string"&&!gz.has(l)&&yl(l).values.length&&(o=t[s]),s++}if(o&&n)for(const l of e)t[l]=_R(n,o)}class vz extends sg{constructor(e,n,s,o,l){super(e,n,s,o,l,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:s}=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(),Jy(p))){const y=TR(p,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!AR.has(s)||e.length!==2)return;const[o,l]=e,u=yx(o),d=yx(l);if(u!==d)if(dx(u)&&dx(d))for(let h=0;h<e.length;h++){const p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}else fr[s]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,s=[];for(let o=0;o<e.length;o++)(e[o]===null||fz(e[o]))&&s.push(o);s.length&&bz(e,s,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:s}=this;if(!e||!e.current)return;s==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=fr[s](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const o=n[n.length-1];o!==void 0&&e.getValue(s,o).jump(o,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:s}=this;if(!e||!e.current)return;const o=e.getValue(n);o&&o.jump(this.measuredOrigin,!1);const l=s.length-1,u=s[l];s[l]=fr[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 Sz(t,e,n){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let s=document;const o=n?.[t]??s.querySelectorAll(t);return o?Array.from(o):[]}return Array.from(t)}const kR=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function wz(t){return FE(t)&&"offsetHeight"in t}const bx=30,xz=t=>!isNaN(parseFloat(t));class Tz{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=s=>{const o=on.now();if(this.updatedAt!==o&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(s),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=on.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xz(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 Fy);const s=this.events[e].add(n);return e==="change"?()=>{s(),We.read(()=>{this.events.change.getSize()||this.stop()})}:s}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,s){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-s}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=on.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,bx);return YE(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 Uo(t,e){return new Tz(t,e)}const{schedule:ag}=rR(queueMicrotask,!1),Hn={x:!1,y:!1};function MR(){return Hn.x||Hn.y}function Az(t){return t==="x"||t==="y"?Hn[t]?null:(Hn[t]=!0,()=>{Hn[t]=!1}):Hn.x||Hn.y?null:(Hn.x=Hn.y=!0,()=>{Hn.x=Hn.y=!1})}function CR(t,e){const n=Sz(t),s=new AbortController,o={passive:!0,...e,signal:s.signal};return[n,o,()=>s.abort()]}function vx(t){return!(t.pointerType==="touch"||MR())}function Ez(t,e,n={}){const[s,o,l]=CR(t,n),u=d=>{if(!vx(d))return;const{target:h}=d,p=e(h,d);if(typeof p!="function"||!h)return;const y=g=>{vx(g)&&(p(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return s.forEach(d=>{d.addEventListener("pointerenter",u,o)}),l}const DR=(t,e)=>e?t===e?!0:DR(t,e.parentElement):!1,lg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Rz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Oz(t){return Rz.has(t.tagName)||t.tabIndex!==-1}const Au=new WeakSet;function Sx(t){return e=>{e.key==="Enter"&&t(e)}}function Ep(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const _z=(t,e)=>{const n=t.currentTarget;if(!n)return;const s=Sx(()=>{if(Au.has(n))return;Ep(n,"down");const o=Sx(()=>{Ep(n,"up")}),l=()=>Ep(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",s,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",s),e)};function wx(t){return lg(t)&&!MR()}function kz(t,e,n={}){const[s,o,l]=CR(t,n),u=d=>{const h=d.currentTarget;if(!wx(d))return;Au.add(h);const p=e(h,d),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),Au.has(h)&&Au.delete(h),wx(S)&&typeof p=="function"&&p(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||DR(h,S.target))},v=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",v,o)};return s.forEach(d=>{(n.useGlobalTarget?window:d).addEventListener("pointerdown",u,o),wz(d)&&(d.addEventListener("focus",p=>_z(p,o)),!Oz(d)&&!d.hasAttribute("tabindex")&&(d.tabIndex=0))}),l}function NR(t){return FE(t)&&"ownerSVGElement"in t}function Mz(t){return NR(t)&&t.tagName==="svg"}const Ht=t=>!!(t&&t.getVelocity),Cz=[...RR,vt,Ds],Dz=t=>Cz.find(ER(t)),$R=V.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Nz(t=!0){const e=V.useContext(Ky);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:s,register:o}=e,l=V.useId();V.useEffect(()=>{if(t)return o(l)},[t]);const u=V.useCallback(()=>t&&s&&s(l),[l,s,t]);return!n&&s?[!1,u]:[!0]}const jR=V.createContext({strict:!1}),xx={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"]},zo={};for(const t in xx)zo[t]={isEnabled:e=>xx[t].some(n=>!!e[n])};function $z(t){for(const e in t)zo[e]={...zo[e],...t[e]}}const jz=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 Zu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||jz.has(t)}let BR=t=>!Zu(t);function Bz(t){typeof t=="function"&&(BR=e=>e.startsWith("on")?!Zu(e):t(e))}try{Bz(require("@emotion/is-prop-valid").default)}catch{}function Lz(t,e,n){const s={};for(const o in t)o==="values"&&typeof t.values=="object"||(BR(o)||n===!0&&Zu(o)||!e&&!Zu(o)||t.draggable&&o.startsWith("onDrag"))&&(s[o]=t[o]);return s}const kf=V.createContext({});function Mf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function gl(t){return typeof t=="string"||Array.isArray(t)}const cg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ug=["initial",...cg];function Cf(t){return Mf(t.animate)||ug.some(e=>gl(t[e]))}function LR(t){return!!(Cf(t)||t.variants)}function Vz(t,e){if(Cf(t)){const{initial:n,animate:s}=t;return{initial:n===!1||gl(n)?n:void 0,animate:gl(s)?s:void 0}}return t.inherit!==!1?e:{}}function Uz(t){const{initial:e,animate:n}=Vz(t,V.useContext(kf));return V.useMemo(()=>({initial:e,animate:n}),[Tx(e),Tx(n)])}function Tx(t){return Array.isArray(t)?t.join(" "):t}const bl={};function zz(t){for(const e in t)bl[e]=t[e],Xy(e)&&(bl[e].isCSSVariable=!0)}function VR(t,{layout:e,layoutId:n}){return Go.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!bl[t]||t==="opacity")}const Kz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qz=Fo.length;function Pz(t,e,n){let s="",o=!0;for(let l=0;l<qz;l++){const u=Fo[l],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=kR(d,og[u]);if(!h){o=!1;const y=Kz[u]||u;s+=`${y}(${p}) `}n&&(e[u]=p)}}return s=s.trim(),n?s=n(e,o?"":s):o&&(s="none"),s}function fg(t,e,n){const{style:s,vars:o,transformOrigin:l}=t;let u=!1,d=!1;for(const h in e){const p=e[h];if(Go.has(h)){u=!0;continue}else if(Xy(h)){o[h]=p;continue}else{const y=kR(p,og[h]);h.startsWith("origin")?(d=!0,l[h]=y):s[h]=y}}if(e.transform||(u||n?s.transform=Pz(e,t.transform,n):s.transform&&(s.transform="none")),d){const{originX:h="50%",originY:p="50%",originZ:y=0}=l;s.transformOrigin=`${h} ${p} ${y}`}}const dg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function UR(t,e,n){for(const s in e)!Ht(e[s])&&!VR(s,n)&&(t[s]=e[s])}function Iz({transformTemplate:t},e){return V.useMemo(()=>{const n=dg();return fg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Hz(t,e){const n=t.style||{},s={};return UR(s,n,t),Object.assign(s,Iz(t,e)),s}function Fz(t,e){const n={},s=Hz(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,s.userSelect=s.WebkitUserSelect=s.WebkitTouchCallout="none",s.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=s,n}const Gz={offset:"stroke-dashoffset",array:"stroke-dasharray"},Yz={offset:"strokeDashoffset",array:"strokeDasharray"};function Xz(t,e,n=1,s=0,o=!0){t.pathLength=1;const l=o?Gz:Yz;t[l.offset]=ye.transform(-s);const u=ye.transform(e),d=ye.transform(n);t[l.array]=`${u} ${d}`}function zR(t,{attrX:e,attrY:n,attrScale:s,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...d},h,p,y){if(fg(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),s!==void 0&&(g.scale=s),o!==void 0&&Xz(g,o,l,u,!1)}const KR=()=>({...dg(),attrs:{}}),qR=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Jz(t,e,n,s){const o=V.useMemo(()=>{const l=KR();return zR(l,e,qR(s),t.transformTemplate,t.style),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};UR(l,t.style,t),o.style={...l,...o.style}}return o}const Zz=["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 hg(t){return typeof t!="string"||t.includes("-")?!1:!!(Zz.indexOf(t)>-1||/[A-Z]/u.test(t))}function Qz(t,e,n,{latestValues:s},o,l=!1){const d=(hg(t)?Jz:Fz)(e,s,o,t),h=Lz(e,typeof t=="string",l),p=t!==V.Fragment?{...h,...d,ref:n}:{},{children:y}=e,g=V.useMemo(()=>Ht(y)?y.get():y,[y]);return V.createElement(t,{...p,children:g})}function Ax(t){const e=[{},{}];return t?.values.forEach((n,s)=>{e[0][s]=n.get(),e[1][s]=n.getVelocity()}),e}function pg(t,e,n,s){if(typeof e=="function"){const[o,l]=Ax(s);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=Ax(s);e=e(n!==void 0?n:t.custom,o,l)}return e}function Eu(t){return Ht(t)?t.get():t}function Wz({scrapeMotionValuesFromProps:t,createRenderState:e},n,s,o){return{latestValues:eK(n,s,o,t),renderState:e()}}function eK(t,e,n,s){const o={},l=s(t,{});for(const v in l)o[v]=Eu(l[v]);let{initial:u,animate:d}=t;const h=Cf(t),p=LR(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"&&!Mf(g)){const v=Array.isArray(g)?g:[g];for(let S=0;S<v.length;S++){const x=pg(t,v[S]);if(x){const{transitionEnd:T,transition:D,...M}=x;for(const O in M){let C=M[O];if(Array.isArray(C)){const j=y?C.length-1:0;C=C[j]}C!==null&&(o[O]=C)}for(const O in T)o[O]=T[O]}}}return o}const PR=t=>(e,n)=>{const s=V.useContext(kf),o=V.useContext(Ky),l=()=>Wz(t,e,s,o);return n?l():$U(l)};function mg(t,e,n){const{style:s}=t,o={};for(const l in s)(Ht(s[l])||e.style&&Ht(e.style[l])||VR(l,t)||n?.getValue(l)?.liveStyle!==void 0)&&(o[l]=s[l]);return o}const tK=PR({scrapeMotionValuesFromProps:mg,createRenderState:dg});function IR(t,e,n){const s=mg(t,e,n);for(const o in t)if(Ht(t[o])||Ht(e[o])){const l=Fo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;s[l]=t[o]}return s}const nK=PR({scrapeMotionValuesFromProps:IR,createRenderState:KR}),iK=Symbol.for("motionComponentSymbol");function go(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function sK(t,e,n){return V.useCallback(s=>{s&&t.onMount&&t.onMount(s),e&&(s?e.mount(s):e.unmount()),n&&(typeof n=="function"?n(s):go(n)&&(n.current=s))},[e])}const yg=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),rK="framerAppearId",HR="data-"+yg(rK),FR=V.createContext({});function oK(t,e,n,s,o){const{visualElement:l}=V.useContext(kf),u=V.useContext(jR),d=V.useContext(Ky),h=V.useContext($R).reducedMotion,p=V.useRef(null);s=s||u.renderer,!p.current&&s&&(p.current=s(t,{visualState:e,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:h}));const y=p.current,g=V.useContext(FR);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&aK(p.current,n,o,g);const v=V.useRef(!1);V.useInsertionEffect(()=>{y&&v.current&&y.update(n,d)});const S=n[HR],x=V.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return jU(()=>{y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),V.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function aK(t,e,n,s){const{layoutId:o,layout:l,drag:u,dragConstraints:d,layoutScroll:h,layoutRoot:p,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:GR(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||d&&go(d),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:s,crossfade:y,layoutScroll:h,layoutRoot:p})}function GR(t){if(t)return t.options.allowProjection!==!1?t.projection:GR(t.parent)}function Rp(t,{forwardMotionProps:e=!1}={},n,s){n&&$z(n);const o=hg(t)?nK:tK;function l(d,h){let p;const y={...V.useContext($R),...d,layoutId:lK(d)},{isStatic:g}=y,v=Uz(d),S=o(d,g);if(!g&&zy){cK();const x=uK(y);p=x.MeasureLayout,v.visualElement=oK(t,S,y,s,x.ProjectionNode)}return G.jsxs(kf.Provider,{value:v,children:[p&&v.visualElement?G.jsx(p,{visualElement:v.visualElement,...y}):null,Qz(t,d,sK(S,v.visualElement,h),S,g,e)]})}l.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=V.forwardRef(l);return u[iK]=t,u}function lK({layoutId:t}){const e=V.useContext(IE).id;return e&&t!==void 0?e+"-"+t:t}function cK(t,e){V.useContext(jR).strict}function uK(t){const{drag:e,layout:n}=zo;if(!e&&!n)return{};const s={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function fK(t,e){if(typeof Proxy>"u")return Rp;const n=new Map,s=(l,u)=>Rp(l,u,t,e),o=(l,u)=>s(l,u);return new Proxy(o,{get:(l,u)=>u==="create"?s:(n.has(u)||n.set(u,Rp(u,void 0,t,e)),n.get(u))})}function YR({top:t,left:e,right:n,bottom:s}){return{x:{min:e,max:n},y:{min:t,max:s}}}function dK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hK(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),s=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:s.y,right:s.x}}function Op(t){return t===void 0||t===1}function Bm({scale:t,scaleX:e,scaleY:n}){return!Op(t)||!Op(e)||!Op(n)}function rr(t){return Bm(t)||XR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function XR(t){return Ex(t.x)||Ex(t.y)}function Ex(t){return t&&t!=="0%"}function Qu(t,e,n){const s=t-n,o=e*s;return n+o}function Rx(t,e,n,s,o){return o!==void 0&&(t=Qu(t,o,s)),Qu(t,n,s)+e}function Lm(t,e=0,n=1,s,o){t.min=Rx(t.min,e,n,s,o),t.max=Rx(t.max,e,n,s,o)}function JR(t,{x:e,y:n}){Lm(t.x,e.translate,e.scale,e.originPoint),Lm(t.y,n.translate,n.scale,n.originPoint)}const Ox=.999999999999,_x=1.0000000000001;function pK(t,e,n,s=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let d=0;d<o;d++){l=n[d],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(s&&l.options.layoutScroll&&l.scroll&&l!==l.root&&vo(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,JR(t,u)),s&&rr(l.latestValues)&&vo(t,l.latestValues))}e.x<_x&&e.x>Ox&&(e.x=1),e.y<_x&&e.y>Ox&&(e.y=1)}function bo(t,e){t.min=t.min+e,t.max=t.max+e}function kx(t,e,n,s,o=.5){const l=nt(t.min,t.max,o);Lm(t,e,n,l,s)}function vo(t,e){kx(t.x,e.x,e.scaleX,e.scale,e.originX),kx(t.y,e.y,e.scaleY,e.scale,e.originY)}function ZR(t,e){return YR(hK(t.getBoundingClientRect(),e))}function mK(t,e,n){const s=ZR(t,n),{scroll:o}=e;return o&&(bo(s.x,o.offset.x),bo(s.y,o.offset.y)),s}const Mx=()=>({translate:0,scale:1,origin:0,originPoint:0}),So=()=>({x:Mx(),y:Mx()}),Cx=()=>({min:0,max:0}),ht=()=>({x:Cx(),y:Cx()}),Vm={current:null},QR={current:!1};function yK(){if(QR.current=!0,!!zy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vm.current=t.matches;t.addEventListener("change",e),e()}else Vm.current=!1}const gK=new WeakMap;function bK(t,e,n){for(const s in e){const o=e[s],l=n[s];if(Ht(o))t.addValue(s,o);else if(Ht(l))t.addValue(s,Uo(o,{owner:t}));else if(l!==o)if(t.hasValue(s)){const u=t.getValue(s);u.liveStyle===!0?u.jump(o):u.hasAnimated||u.set(o)}else{const u=t.getStaticValue(s);t.addValue(s,Uo(u!==void 0?u:o,{owner:t}))}}for(const s in n)e[s]===void 0&&t.removeValue(s);return e}const Dx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class vK{scrapeMotionValuesFromProps(e,n,s){return{}}constructor({parent:e,props:n,presenceContext:s,reducedMotionConfig:o,blockInitialAnimation:l,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=sg,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=on.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=s,this.depth=e?e.depth+1:0,this.reducedMotionConfig=o,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=Cf(n),this.isVariantNode=LR(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&&Ht(S)&&S.set(h[v])}}mount(e){this.current=e,gK.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,s)=>this.bindToMotionValue(s,n)),QR.current||yK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Vm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Cs(this.notifyUpdate),Cs(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 s=Go.has(e);s&&this.onBindTransform&&this.onBindTransform();const o=n.on("change",u=>{this.latestValues[e]=u,this.props.onUpdate&&We.preRender(this.notifyUpdate),s&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l&&l(),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 zo){const n=zo[e];if(!n)continue;const{isEnabled:s,Feature:o}=n;if(!this.features[e]&&o&&s(this.props)&&(this.features[e]=new o(this)),this.features[e]){const l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ht()}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 s=0;s<Dx.length;s++){const o=Dx[s];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=bK(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 s=this.values.get(e);n!==s&&(s&&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 s=this.values.get(e);return s===void 0&&n!==void 0&&(s=Uo(n===null?void 0:n,{owner:this}),this.addValue(e,s)),s}readValue(e,n){let s=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return s!=null&&(typeof s=="string"&&(HE(s)||GE(s))?s=parseFloat(s):!Dz(s)&&Ds.test(n)&&(s=_R(e,n)),this.setBaseTarget(e,Ht(s)?s.get():s)),Ht(s)?s.get():s}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let s;if(typeof n=="string"||typeof n=="object"){const l=pg(this.props,n,this.presenceContext?.custom);l&&(s=l[e])}if(n&&s!==void 0)return s;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Ht(o)?o:this.initialValues[e]!==void 0&&s===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Fy),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){ag.render(this.render)}}class WR extends vK{constructor(){super(...arguments),this.KeyframeResolver=vz}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:s}){delete n[e],delete s[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Ht(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function eO(t,{style:e,vars:n},s,o){const l=t.style;let u;for(u in e)l[u]=e[u];o?.applyProjectionStyles(l,s);for(u in n)l.setProperty(u,n[u])}function SK(t){return window.getComputedStyle(t)}class wK extends WR{constructor(){super(...arguments),this.type="html",this.renderInstance=eO}readValueFromInstance(e,n){if(Go.has(n))return this.projection?.isProjecting?km(n):V4(e,n);{const s=SK(e),o=(Xy(n)?s.getPropertyValue(n):s[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return ZR(e,n)}build(e,n,s){fg(e,n,s.transformTemplate)}scrapeMotionValuesFromProps(e,n,s){return mg(e,n,s)}}const tO=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 xK(t,e,n,s){eO(t,e,void 0,s);for(const o in e.attrs)t.setAttribute(tO.has(o)?o:yg(o),e.attrs[o])}class TK extends WR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Go.has(n)){const s=OR(n);return s&&s.default||0}return n=tO.has(n)?n:yg(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,s){return IR(e,n,s)}build(e,n,s){zR(e,n,this.isSVGTag,s.transformTemplate,s.style)}renderInstance(e,n,s,o){xK(e,n,s,o)}mount(e){this.isSVGTag=qR(e.tagName),super.mount(e)}}const AK=(t,e)=>hg(t)?new TK(e):new wK(e,{allowProjection:t!==V.Fragment});function _o(t,e,n){const s=t.getProps();return pg(s,e,n!==void 0?n:s.custom,t)}const Um=t=>Array.isArray(t);function EK(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Uo(n))}function RK(t){return Um(t)?t[t.length-1]||0:t}function OK(t,e){const n=_o(t,e);let{transitionEnd:s={},transition:o={},...l}=n||{};l={...l,...s};for(const u in l){const d=RK(l[u]);EK(t,u,d)}}function _K(t){return!!(Ht(t)&&t.add)}function zm(t,e){const n=t.getValue("willChange");if(_K(n))return n.add(e);if(!n&&Gi.WillChange){const s=new Gi.WillChange("auto");t.addValue("willChange",s),s.add(e)}}function nO(t){return t.props[HR]}const kK=t=>t!==null;function MK(t,{repeat:e,repeatType:n="loop"},s){const o=t.filter(kK),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[l]}const CK={type:"spring",stiffness:500,damping:25,restSpeed:10},DK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),NK={type:"keyframes",duration:.8},$K={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jK=(t,{keyframes:e})=>e.length>2?NK:Go.has(t)?t.startsWith("scale")?DK(e[1]):CK:$K;function BK({when:t,delay:e,delayChildren:n,staggerChildren:s,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:d,from:h,elapsed:p,...y}){return!!Object.keys(y).length}const gg=(t,e,n,s={},o,l)=>u=>{const d=rg(s,t)||{},h=d.delay||s.delay||0;let{elapsed:p=0}=s;p=p-li(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:l?void 0:o};BK(d)||Object.assign(y,jK(t,y)),y.duration&&(y.duration=li(y.duration)),y.repeatDelay&&(y.repeatDelay=li(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)),(Gi.instantAnimations||Gi.skipAnimations)&&(g=!0,$m(y),y.delay=0),y.allowFlatten=!d.type&&!d.ease,g&&!l&&e.get()!==void 0){const v=MK(y.keyframes,d);if(v!==void 0){We.update(()=>{y.onUpdate(v),y.onComplete()});return}}return d.isSync?new ig(y):new az(y)};function LK({protectedKeys:t,needsAnimating:e},n){const s=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,s}function iO(t,e,{delay:n=0,transitionOverride:s,type:o}={}){let{transition:l=t.getDefaultTransition(),transitionEnd:u,...d}=e;s&&(l=s);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&&LK(p,y))continue;const S={delay:n,...rg(l||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(v)&&v===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const M=nO(t);if(M){const O=window.MotionHandoffAnimation(M,y,We);O!==null&&(S.startTime=O,T=!0)}}zm(t,y),g.start(gg(y,g,v,t.shouldReduceMotion&&AR.has(y)?{type:!1}:S,t,T));const D=g.animation;D&&h.push(D)}return u&&Promise.all(h).then(()=>{We.update(()=>{u&&OK(t,u)})}),h}function sO(t,e,n,s=0,o=1){const l=Array.from(t).sort((p,y)=>p.sortNodePosition(y)).indexOf(e),u=t.size,d=(u-1)*s;return typeof n=="function"?n(l,u):o===1?l*s:d-l*s}function Km(t,e,n={}){const s=_o(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);const l=s?()=>Promise.all(iO(t,s,n)):()=>Promise.resolve(),u=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:g}=o;return VK(t,e,h,p,y,g,n)}:()=>Promise.resolve(),{when:d}=o;if(d){const[h,p]=d==="beforeChildren"?[l,u]:[u,l];return h().then(()=>p())}else return Promise.all([l(),u(n.delay)])}function VK(t,e,n=0,s=0,o=0,l=1,u){const d=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),d.push(Km(h,e,{...u,delay:n+(typeof s=="function"?0:s)+sO(t.variantChildren,h,s,o,l)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(d)}function UK(t,e,n={}){t.notify("AnimationStart",e);let s;if(Array.isArray(e)){const o=e.map(l=>Km(t,l,n));s=Promise.all(o)}else if(typeof e=="string")s=Km(t,e,n);else{const o=typeof e=="function"?_o(t,e,n.custom):e;s=Promise.all(iO(t,o,n))}return s.then(()=>{t.notify("AnimationComplete",e)})}function rO(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let s=0;s<n;s++)if(e[s]!==t[s])return!1;return!0}const zK=ug.length;function oO(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?oO(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<zK;n++){const s=ug[n],o=t.props[s];(gl(o)||o===!1)&&(e[s]=o)}return e}const KK=[...cg].reverse(),qK=cg.length;function PK(t){return e=>Promise.all(e.map(({animation:n,options:s})=>UK(t,n,s)))}function IK(t){let e=PK(t),n=Nx(),s=!0;const o=h=>(p,y)=>{const g=_o(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:v,transitionEnd:S,...x}=g;p={...p,...x,...S}}return p};function l(h){e=h(t)}function u(h){const{props:p}=t,y=oO(t.parent)||{},g=[],v=new Set;let S={},x=1/0;for(let D=0;D<qK;D++){const M=KK[D],O=n[M],C=p[M]!==void 0?p[M]:y[M],j=gl(C),_=M===h?O.isActive:null;_===!1&&(x=D);let J=C===y[M]&&C!==p[M]&&j;if(J&&s&&t.manuallyAnimateOnMount&&(J=!1),O.protectedKeys={...S},!O.isActive&&_===null||!C&&!O.prevProp||Mf(C)||typeof C=="boolean")continue;const Y=HK(O.prevProp,C);let F=Y||M===h&&O.isActive&&!J&&j||D>x&&j,ee=!1;const se=Array.isArray(C)?C:[C];let ue=se.reduce(o(M),{});_===!1&&(ue={});const{prevResolvedValues:ge={}}=O,be={...ge,...ue},Q=q=>{F=!0,v.has(q)&&(ee=!0,v.delete(q)),O.needsAnimating[q]=!0;const z=t.getValue(q);z&&(z.liveStyle=!1)};for(const q in be){const z=ue[q],ne=ge[q];if(S.hasOwnProperty(q))continue;let A=!1;Um(z)&&Um(ne)?A=!rO(z,ne):A=z!==ne,A?z!=null?Q(q):v.add(q):z!==void 0&&v.has(q)?Q(q):O.protectedKeys[q]=!0}O.prevProp=C,O.prevResolvedValues=ue,O.isActive&&(S={...S,...ue}),s&&t.blockInitialAnimation&&(F=!1);const W=J&&Y;F&&(!W||ee)&&g.push(...se.map(q=>{const z={type:M};if(typeof q=="string"&&s&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ne}=t,A=_o(ne,q);if(ne.enteringChildren&&A){const{delayChildren:P}=A.transition||{};z.delay=sO(ne.enteringChildren,t,P)}}return{animation:q,options:z}}))}if(v.size){const D={};if(typeof p.initial!="boolean"){const M=_o(t,Array.isArray(p.initial)?p.initial[0]:p.initial);M&&M.transition&&(D.transition=M.transition)}v.forEach(M=>{const O=t.getBaseTarget(M),C=t.getValue(M);C&&(C.liveStyle=!0),D[M]=O??null}),g.push({animation:D})}let T=!!g.length;return s&&(p.initial===!1||p.initial===p.animate)&&!t.manuallyAnimateOnMount&&(T=!1),s=!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:l,getState:()=>n,reset:()=>{n=Nx(),s=!0}}}function HK(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!rO(e,t):!1}function nr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nx(){return{animate:nr(!0),whileInView:nr(),whileHover:nr(),whileTap:nr(),whileDrag:nr(),whileFocus:nr(),exit:nr()}}class Ls{constructor(e){this.isMounted=!1,this.node=e}update(){}}class FK extends Ls{constructor(e){super(e),e.animationState||(e.animationState=IK(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Mf(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 GK=0;class YK extends Ls{constructor(){super(...arguments),this.id=GK++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:s}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===s)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 XK={animation:{Feature:FK},exit:{Feature:YK}};function vl(t,e,n,s={passive:!0}){return t.addEventListener(e,n,s),()=>t.removeEventListener(e,n)}function Bl(t){return{point:{x:t.pageX,y:t.pageY}}}const JK=t=>e=>lg(e)&&t(e,Bl(e));function il(t,e,n,s){return vl(t,e,JK(n),s)}const aO=1e-4,ZK=1-aO,QK=1+aO,lO=.01,WK=0-lO,eq=0+lO;function Jt(t){return t.max-t.min}function tq(t,e,n){return Math.abs(t-e)<=n}function $x(t,e,n,s=.5){t.origin=s,t.originPoint=nt(e.min,e.max,t.origin),t.scale=Jt(n)/Jt(e),t.translate=nt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=ZK&&t.scale<=QK||isNaN(t.scale))&&(t.scale=1),(t.translate>=WK&&t.translate<=eq||isNaN(t.translate))&&(t.translate=0)}function sl(t,e,n,s){$x(t.x,e.x,n.x,s?s.originX:void 0),$x(t.y,e.y,n.y,s?s.originY:void 0)}function jx(t,e,n){t.min=n.min+e.min,t.max=t.min+Jt(e)}function nq(t,e,n){jx(t.x,e.x,n.x),jx(t.y,e.y,n.y)}function Bx(t,e,n){t.min=e.min-n.min,t.max=t.min+Jt(e)}function rl(t,e,n){Bx(t.x,e.x,n.x),Bx(t.y,e.y,n.y)}function jn(t){return[t("x"),t("y")]}const cO=({current:t})=>t?t.ownerDocument.defaultView:null,Lx=(t,e)=>Math.abs(t-e);function iq(t,e){const n=Lx(t.x,e.x),s=Lx(t.y,e.y);return Math.sqrt(n**2+s**2)}class uO{constructor(e,n,{transformPagePoint:s,contextWindow:o=window,dragSnapToOrigin:l=!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=kp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=iq(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=v,{timestamp:D}=zt;this.history.push({...T,timestamp:D});const{onStart:M,onMove:O}=this.handlers;S||(M&&M(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,v)},this.handlePointerMove=(v,S)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=_p(S,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(v,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:D}=this.handlers;if(this.dragSnapToOrigin&&D&&D(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const M=kp(v.type==="pointercancel"?this.lastMoveEventInfo:_p(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(v,M),T&&T(v,M)},!lg(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=s,this.distanceThreshold=u,this.contextWindow=o||window;const d=Bl(e),h=_p(d,this.transformPagePoint),{point:p}=h,{timestamp:y}=zt;this.history=[{...p,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,kp(h,this.history)),this.removeListeners=Nl(il(this.contextWindow,"pointermove",this.handlePointerMove),il(this.contextWindow,"pointerup",this.handlePointerUp),il(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Cs(this.updatePoint)}}function _p(t,e){return e?{point:e(t.point)}:t}function Vx(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kp({point:t},e){return{point:t,delta:Vx(t,fO(e)),offset:Vx(t,sq(e)),velocity:rq(e,.1)}}function sq(t){return t[0]}function fO(t){return t[t.length-1]}function rq(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,s=null;const o=fO(t);for(;n>=0&&(s=t[n],!(o.timestamp-s.timestamp>li(e)));)n--;if(!s)return{x:0,y:0};const l=ci(o.timestamp-s.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-s.x)/l,y:(o.y-s.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function oq(t,{min:e,max:n},s){return e!==void 0&&t<e?t=s?nt(e,t,s.min):Math.max(t,e):n!==void 0&&t>n&&(t=s?nt(n,t,s.max):Math.min(t,n)),t}function Ux(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function aq(t,{top:e,left:n,bottom:s,right:o}){return{x:Ux(t.x,n,o),y:Ux(t.y,e,s)}}function zx(t,e){let n=e.min-t.min,s=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,s]=[s,n]),{min:n,max:s}}function lq(t,e){return{x:zx(t.x,e.x),y:zx(t.y,e.y)}}function cq(t,e){let n=.5;const s=Jt(t),o=Jt(e);return o>s?n=pl(e.min,e.max-s,t.min):s>o&&(n=pl(t.min,t.max-o,e.min)),Fi(0,1,n)}function uq(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 qm=.35;function fq(t=qm){return t===!1?t=0:t===!0&&(t=qm),{x:Kx(t,"left","right"),y:Kx(t,"top","bottom")}}function Kx(t,e,n){return{min:qx(t,e),max:qx(t,n)}}function qx(t,e){return typeof t=="number"?t:t[e]||0}const dq=new WeakMap;class hq{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ht(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:s}={}){const{presenceContext:o}=this.visualElement;if(o&&o.isPresent===!1)return;const l=g=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Bl(g).point)},u=(g,v)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Az(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),jn(M=>{let O=this.getAxisMotionValue(M).get()||0;if(ui.test(O)){const{projection:C}=this.visualElement;if(C&&C.layout){const j=C.layout.layoutBox[M];j&&(O=Jt(j)*(parseFloat(O)/100))}}this.originPoint[M]=O}),T&&We.postRender(()=>T(g,v)),zm(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:x,onDirectionLock:T,onDrag:D}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:M}=v;if(x&&this.currentDirection===null){this.currentDirection=pq(M),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",v.point,M),this.updateAxis("y",v.point,M),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=()=>jn(g=>this.getAnimationState(g)==="paused"&&this.getAxisMotionValue(g).animation?.play()),{dragSnapToOrigin:y}=this.getProps();this.panSession=new uO(e,{onSessionStart:l,onStart:u,onMove:d,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:s,contextWindow:cO(this.visualElement)})}stop(e,n){const s=e||this.latestPointerEvent,o=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!s)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:d}=this.getProps();d&&We.postRender(()=>d(s,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:s}=this.getProps();!s&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}updateAxis(e,n,s){const{drag:o}=this.getProps();if(!s||!fu(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+s[e];this.constraints&&this.constraints[e]&&(u=oq(u,this.constraints[e],this.elastic[e])),l.set(u)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),s=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,o=this.constraints;e&&go(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&s?this.constraints=aq(s.layoutBox,e):this.constraints=!1,this.elastic=fq(n),o!==this.constraints&&s&&this.constraints&&!this.hasMutatedConstraints&&jn(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=uq(s.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!go(e))return!1;const s=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=mK(s,o.root,this.visualElement.getTransformPagePoint());let u=lq(o.layout.layoutBox,l);if(n){const d=n(dK(u));this.hasMutatedConstraints=!!d,d&&(u=YR(d))}return u}startAnimation(e){const{drag:n,dragMomentum:s,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:d}=this.getProps(),h=this.constraints||{},p=jn(y=>{if(!fu(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,x={type:"inertia",velocity:s?e[y]:0,bounceStiffness:v,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(p).then(d)}startAxisValueAnimation(e,n){const s=this.getAxisMotionValue(e);return zm(this.visualElement,e),s.start(gg(e,s,0,n,this.visualElement,!1))}stopAnimation(){jn(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){jn(e=>this.getAxisMotionValue(e).animation?.pause())}getAnimationState(e){return this.getAxisMotionValue(e).animation?.state}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,s=this.visualElement.getProps(),o=s[n];return o||this.visualElement.getValue(e,(s.initial?s.initial[e]:void 0)||0)}snapToCursor(e){jn(n=>{const{drag:s}=this.getProps();if(!fu(n,s,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:d}=o.layout.layoutBox[n];l.set(e[n]-nt(u,d,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:s}=this.visualElement;if(!go(n)||!s||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};jn(u=>{const d=this.getAxisMotionValue(u);if(d&&this.constraints!==!1){const h=d.get();o[u]=cq({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",s.root&&s.root.updateScroll(),s.updateLayout(),this.resolveConstraints(),jn(u=>{if(!fu(u,e,null))return;const d=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];d.set(nt(h,p,o[u]))})}addListeners(){if(!this.visualElement.current)return;dq.set(this.visualElement,this);const e=this.visualElement.current,n=il(e,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps();p&&y&&this.start(h)}),s=()=>{const{dragConstraints:h}=this.getProps();go(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",s);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),We.read(s);const u=vl(window,"resize",()=>this.scalePositionWithinConstraints()),d=o.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(jn(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(),l(),d&&d()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:s=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=qm,dragMomentum:d=!0}=e;return{...e,drag:n,dragDirectionLock:s,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:d}}}function fu(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function pq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class mq extends Ls{constructor(e){super(e),this.removeGroupControls=Vn,this.removeListeners=Vn,this.controls=new hq(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Vn}unmount(){this.removeGroupControls(),this.removeListeners()}}const Px=t=>(e,n)=>{t&&We.postRender(()=>t(e,n))};class yq extends Ls{constructor(){super(...arguments),this.removePointerDownListener=Vn}onPointerDown(e){this.session=new uO(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:s,onPanEnd:o}=this.node.getProps();return{onSessionStart:Px(e),onStart:Px(n),onMove:s,onEnd:(l,u)=>{delete this.session,o&&We.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=il(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 Ru={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ix(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ya={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ye.test(t))t=parseFloat(t);else return t;const n=Ix(t,e.target.x),s=Ix(t,e.target.y);return`${n}% ${s}%`}},gq={correct:(t,{treeScale:e,projectionDelta:n})=>{const s=t,o=Ds.parse(t);if(o.length>5)return s;const l=Ds.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=nt(d,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),l(o)}};let Mp=!1;class bq extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s,layoutId:o}=this.props,{projection:l}=e;zz(vq),l&&(n.group&&n.group.add(l),s&&s.register&&o&&s.register(l),Mp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),Ru.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:s,drag:o,isPresent:l}=this.props,{projection:u}=s;return u&&(u.isPresent=l,Mp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==l?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?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(),ag.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:s}=this.props,{projection:o}=e;Mp=!0,o&&(o.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(o),s&&s.deregister&&s.deregister(o))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function dO(t){const[e,n]=Nz(),s=V.useContext(IE);return G.jsx(bq,{...t,layoutGroup:s,switchLayoutGroup:V.useContext(FR),isPresent:e,safeToRemove:n})}const vq={borderRadius:{...Ya,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ya,borderTopRightRadius:Ya,borderBottomLeftRadius:Ya,borderBottomRightRadius:Ya,boxShadow:gq};function Sq(t,e,n){const s=Ht(t)?t:Uo(t);return s.start(gg("",s,e,n)),s.animation}const wq=(t,e)=>t.depth-e.depth;class xq{constructor(){this.children=[],this.isDirty=!1}add(e){qy(this.children,e),this.isDirty=!0}remove(e){Py(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(wq),this.isDirty=!1,this.children.forEach(e)}}function Tq(t,e){const n=on.now(),s=({timestamp:o})=>{const l=o-n;l>=e&&(Cs(s),t(l-e))};return We.setup(s,!0),()=>Cs(s)}const hO=["TopLeft","TopRight","BottomLeft","BottomRight"],Aq=hO.length,Hx=t=>typeof t=="string"?parseFloat(t):t,Fx=t=>typeof t=="number"||ye.test(t);function Eq(t,e,n,s,o,l){o?(t.opacity=nt(0,n.opacity??1,Rq(s)),t.opacityExit=nt(e.opacity??1,0,Oq(s))):l&&(t.opacity=nt(e.opacity??1,n.opacity??1,s));for(let u=0;u<Aq;u++){const d=`border${hO[u]}Radius`;let h=Gx(e,d),p=Gx(n,d);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||Fx(h)===Fx(p)?(t[d]=Math.max(nt(Hx(h),Hx(p),s),0),(ui.test(p)||ui.test(h))&&(t[d]+="%")):t[d]=p}(e.rotate||n.rotate)&&(t.rotate=nt(e.rotate||0,n.rotate||0,s))}function Gx(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Rq=pO(0,.5,tR),Oq=pO(.5,.95,Vn);function pO(t,e,n){return s=>s<t?0:s>e?1:n(pl(t,e,s))}function Yx(t,e){t.min=e.min,t.max=e.max}function Nn(t,e){Yx(t.x,e.x),Yx(t.y,e.y)}function Xx(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Jx(t,e,n,s,o){return t-=e,t=Qu(t,1/n,s),o!==void 0&&(t=Qu(t,1/o,s)),t}function _q(t,e=0,n=1,s=.5,o,l=t,u=t){if(ui.test(e)&&(e=parseFloat(e),e=nt(u.min,u.max,e/100)-u.min),typeof e!="number")return;let d=nt(l.min,l.max,s);t===l&&(d-=e),t.min=Jx(t.min,e,n,d,o),t.max=Jx(t.max,e,n,d,o)}function Zx(t,e,[n,s,o],l,u){_q(t,e[n],e[s],e[o],e.scale,l,u)}const kq=["x","scaleX","originX"],Mq=["y","scaleY","originY"];function Qx(t,e,n,s){Zx(t.x,e,kq,n?n.x:void 0,s?s.x:void 0),Zx(t.y,e,Mq,n?n.y:void 0,s?s.y:void 0)}function Wx(t){return t.translate===0&&t.scale===1}function mO(t){return Wx(t.x)&&Wx(t.y)}function e1(t,e){return t.min===e.min&&t.max===e.max}function Cq(t,e){return e1(t.x,e.x)&&e1(t.y,e.y)}function t1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function yO(t,e){return t1(t.x,e.x)&&t1(t.y,e.y)}function n1(t){return Jt(t.x)/Jt(t.y)}function i1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Dq{constructor(){this.members=[]}add(e){qy(this.members,e),e.scheduleRender()}remove(e){if(Py(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 s;for(let o=n;o>=0;o--){const l=this.members[o];if(l.isPresent!==!1){s=l;break}}return s?(this.promote(s),!0):!1}promote(e,n){const s=this.lead;if(e!==s&&(this.prevLead=s,this.lead=e,e.show(),s)){s.instance&&s.scheduleRender(),e.scheduleRender(),e.resumeFrom=s,n&&(e.resumeFrom.preserveOpacity=!0),s.snapshot&&(e.snapshot=s.snapshot,e.snapshot.latestValues=s.animationValues||s.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);const{crossfade:o}=e.options;o===!1&&s.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:s}=e;n.onExitComplete&&n.onExitComplete(),s&&s.options.onExitComplete&&s.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function Nq(t,e,n){let s="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(s=`translate3d(${o}px, ${l}px, ${u}px) `),(e.x!==1||e.y!==1)&&(s+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:p,rotate:y,rotateX:g,rotateY:v,skewX:S,skewY:x}=n;p&&(s=`perspective(${p}px) ${s}`),y&&(s+=`rotate(${y}deg) `),g&&(s+=`rotateX(${g}deg) `),v&&(s+=`rotateY(${v}deg) `),S&&(s+=`skewX(${S}deg) `),x&&(s+=`skewY(${x}deg) `)}const d=t.x.scale*e.x,h=t.y.scale*e.y;return(d!==1||h!==1)&&(s+=`scale(${d}, ${h})`),s||"none"}const Cp=["","X","Y","Z"],$q=1e3;let jq=0;function Dp(t,e,n,s){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),s&&(s[t]=0))}function gO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=nO(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",We,!(o||l))}const{parent:s}=t;s&&!s.hasCheckedOptimisedAppear&&gO(s)}function bO({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:s,resetTransform:o}){return class{constructor(u={},d=e?.()){this.id=jq++,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(Vq),this.nodes.forEach(qq),this.nodes.forEach(Pq),this.nodes.forEach(Uq)},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 xq)}addEventListener(u,d){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Fy),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=NR(u)&&!Mz(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=Tq(v,250),Ru.hasAnimatedSinceResize&&(Ru.hasAnimatedSinceResize=!1,this.nodes.forEach(o1)))})}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 x=this.options.transition||p.getDefaultTransition()||Yq,{onLayoutAnimationStart:T,onLayoutAnimationComplete:D}=p.getProps(),M=!this.targetLayout||!yO(this.targetLayout,S),O=!g&&v;if(this.options.layoutRoot||this.resumeFrom||O||g&&(M||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...rg(x,"layout"),onPlay:T,onComplete:D};(p.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(y,O)}else g||o1(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(),Cs(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(Iq),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&&gO(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(s1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(r1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Kq),this.nodes.forEach(Bq),this.nodes.forEach(Lq)):this.nodes.forEach(r1),this.clearAllSnapshots();const d=on.now();zt.delta=Fi(0,1e3/60,d-zt.timestamp),zt.timestamp=d,zt.isProcessing=!0,Sp.update.process(zt),Sp.preRender.process(zt),Sp.render.process(zt),zt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ag.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(zq),this.sharedNodes.forEach(Hq)}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&&!Jt(this.snapshot.measuredBox.x)&&!Jt(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=ht(),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=s(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&&!mO(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(d||rr(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)),Xq(h),{animationId:this.root.animationId,measuredBox:d,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return ht();const d=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Jq))){const{scroll:p}=this.root;p&&(bo(d.x,p.offset.x),bo(d.y,p.offset.y))}return d}removeElementScroll(u){const d=ht();if(Nn(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&&Nn(d,u),bo(d.x,y.offset.x),bo(d.y,y.offset.y))}return d}applyTransform(u,d=!1){const h=ht();Nn(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&&vo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),rr(y.latestValues)&&vo(h,y.latestValues)}return rr(this.latestValues)&&vo(h,this.latestValues),h}removeTransform(u){const d=ht();Nn(d,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!rr(p.latestValues))continue;Bm(p.latestValues)&&p.updateSnapshot();const y=ht(),g=p.measurePageBox();Nn(y,g),Qx(d,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,y)}return rr(this.latestValues)&&Qx(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!==zt.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=zt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),rl(this.relativeTargetOrigin,this.layout.layoutBox,v.layout.layoutBox),Nn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ht(),this.targetWithTransforms=ht()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),nq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Nn(this.target,this.layout.layoutBox),JR(this.target,this.targetDelta)):Nn(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=ht(),this.relativeTargetOrigin=ht(),rl(this.relativeTargetOrigin,this.target,v.target),Nn(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Bm(this.parent.latestValues)||XR(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===zt.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;Nn(this.layoutCorrected,this.layout.layoutBox);const g=this.treeScale.x,v=this.treeScale.y;pK(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=ht());const{target:S}=u;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Xx(this.prevProjectionDelta.x,this.projectionDelta.x),Xx(this.prevProjectionDelta.y,this.projectionDelta.y)),sl(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!i1(this.projectionDelta.x,this.prevProjectionDelta.x)||!i1(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=So(),this.projectionDelta=So(),this.projectionDeltaWithTransform=So()}setAnimationOrigin(u,d=!1){const h=this.snapshot,p=h?h.latestValues:{},y={...this.latestValues},g=So();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!d;const v=ht(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,D=this.getStack(),M=!D||D.members.length<=1,O=!!(T&&!M&&this.options.crossfade===!0&&!this.path.some(Gq));this.animationProgress=0;let C;this.mixTargetDelta=j=>{const _=j/1e3;a1(g.x,u.x,_),a1(g.y,u.y,_),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(rl(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Fq(this.relativeTarget,this.relativeTargetOrigin,v,_),C&&Cq(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=ht()),Nn(C,this.relativeTarget)),T&&(this.animationValues=y,Eq(y,p,this.latestValues,_,O,M)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Cs(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{Ru.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uo(0)),this.currentAnimation=Sq(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($q),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&&vO(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||ht();const g=Jt(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+g;const v=Jt(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+v}Nn(d,h),vo(d,y),sl(this.projectionDeltaWithTransform,this.layoutCorrected,d,y)}}registerSharedNode(u,d){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Dq),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&&Dp("z",u,p,this.animationValues);for(let y=0;y<Cp.length;y++)Dp(`rotate${Cp[y]}`,u,p,this.animationValues),Dp(`skew${Cp[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=Eu(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=Eu(d?.pointerEvents)||""),this.hasProjected&&!rr(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let g=Nq(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 x in bl){if(y[x]===void 0)continue;const{correct:T,applyTo:D,isCSSVariable:M}=bl[x],O=g==="none"?y[x]:T(y[x],p);if(D){const C=D.length;for(let j=0;j<C;j++)u[D[j]]=O}else M?this.options.visualElement.renderState.vars[x]=O:u[x]=O}this.options.layoutId&&(u.pointerEvents=p===this?Eu(d?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(s1),this.root.sharedNodes.clear()}}}function Bq(t){t.updateLayout()}function Lq(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=t.layout,{animationType:o}=t.options,l=e.source!==t.layout.source;o==="size"?jn(y=>{const g=l?e.measuredBox[y]:e.layoutBox[y],v=Jt(g);g.min=n[y].min,g.max=g.min+v}):vO(o,e.layoutBox,n)&&jn(y=>{const g=l?e.measuredBox[y]:e.layoutBox[y],v=Jt(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=So();sl(u,n,e.layoutBox);const d=So();l?sl(d,t.applyTransform(s,!0),e.measuredBox):sl(d,n,e.layoutBox);const h=!mO(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=ht();rl(S,e.layoutBox,g.layoutBox);const x=ht();rl(x,n,v.layoutBox),yO(S,x)||(p=!0),y.options.layoutRoot&&(t.relativeTarget=x,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 Vq(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 Uq(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zq(t){t.clearSnapshot()}function s1(t){t.clearMeasurements()}function r1(t){t.isLayoutDirty=!1}function Kq(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function o1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function qq(t){t.resolveTargetDelta()}function Pq(t){t.calcProjection()}function Iq(t){t.resetSkewAndRotation()}function Hq(t){t.removeLeadSnapshot()}function a1(t,e,n){t.translate=nt(e.translate,0,n),t.scale=nt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function l1(t,e,n,s){t.min=nt(e.min,n.min,s),t.max=nt(e.max,n.max,s)}function Fq(t,e,n,s){l1(t.x,e.x,n.x,s),l1(t.y,e.y,n.y,s)}function Gq(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Yq={duration:.45,ease:[.4,0,.1,1]},c1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),u1=c1("applewebkit/")&&!c1("chrome/")?Math.round:Vn;function f1(t){t.min=u1(t.min),t.max=u1(t.max)}function Xq(t){f1(t.x),f1(t.y)}function vO(t,e,n){return t==="position"||t==="preserve-aspect"&&!tq(n1(e),n1(n),.2)}function Jq(t){return t!==t.root&&t.scroll?.wasRoot}const Zq=bO({attachResizeListener:(t,e)=>vl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Np={current:void 0},SO=bO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Np.current){const t=new Zq({});t.mount(window),t.setOptions({layoutScroll:!0}),Np.current=t}return Np.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Qq={pan:{Feature:yq},drag:{Feature:mq,ProjectionNode:SO,MeasureLayout:dO}};function d1(t,e,n){const{props:s}=t;t.animationState&&s.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=s[o];l&&We.postRender(()=>l(e,Bl(e)))}class Wq extends Ls{mount(){const{current:e}=this.node;e&&(this.unmount=Ez(e,(n,s)=>(d1(this.node,s,"Start"),o=>d1(this.node,o,"End"))))}unmount(){}}class eP extends Ls{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=Nl(vl(this.node.current,"focus",()=>this.onFocus()),vl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function h1(t,e,n){const{props:s}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&s.whileTap&&t.animationState.setActive("whileTap",n==="Start");const o="onTap"+(n==="End"?"":n),l=s[o];l&&We.postRender(()=>l(e,Bl(e)))}class tP extends Ls{mount(){const{current:e}=this.node;e&&(this.unmount=kz(e,(n,s)=>(h1(this.node,s,"Start"),(o,{success:l})=>h1(this.node,o,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Pm=new WeakMap,$p=new WeakMap,nP=t=>{const e=Pm.get(t.target);e&&e(t)},iP=t=>{t.forEach(nP)};function sP({root:t,...e}){const n=t||document;$p.has(n)||$p.set(n,{});const s=$p.get(n),o=JSON.stringify(e);return s[o]||(s[o]=new IntersectionObserver(iP,{root:t,...e})),s[o]}function rP(t,e,n){const s=sP(e);return Pm.set(t,n),s.observe(t),()=>{Pm.delete(t),s.unobserve(t)}}const oP={some:0,all:1};class aP extends Ls{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:s,amount:o="some",once:l}=e,u={root:n?n.current:void 0,rootMargin:s,threshold:typeof o=="number"?o:oP[o]},d=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,l&&!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 rP(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(lP(e,n))&&this.startObserver()}unmount(){}}function lP({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const cP={inView:{Feature:aP},tap:{Feature:tP},focus:{Feature:eP},hover:{Feature:Wq}},uP={layout:{ProjectionNode:SO,MeasureLayout:dO}},fP={...XK,...cP,...Qq,...uP},dP=fK(fP,AK);function hP(){const t=Gn(Vo),e=Gn(oi),n=Gn(Ui),s=St(Vo),o=St(oi),l=St(Ui),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 G.jsx("form",{onSubmit:async S=>{S.preventDefault();const x=Ze(si);try{switch(g){case"email":{const{nextStep:T,userKey:D}=await rn.declareAuthTarget.query({email:s});switch(De(si,D),T){case"otc_login":case"otc_verify":{v("otc");break}case"password_login":{v("password");break}}break}case"otc":{if(!x){console.error("somehow userKey is null");return}const T=await rn.verifyAccountAction.mutate({oneTimeCode:l,userKey:x});De(at,T),di.once("connect",()=>{yr("/game"),t(""),n("")});break}case"password":{const T=await rn.openSession.mutate({email:s,password:o});De(at,T),di.once("connect",()=>{yr("/game"),t(""),e("")});break}}}catch(T){T instanceof Lo&&y(T.message)}},children:G.jsxs("main",{children:[p?G.jsx("aside",{children:p}):null,G.jsxs(dP.label,{htmlFor:u,children:[G.jsx("span",{children:"Email"}),G.jsx("input",{id:u,type:"text",value:s,onChange:S=>{t(S.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?G.jsxs("label",{htmlFor:d,children:[G.jsx("span",{children:"Password"}),G.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"?G.jsxs("label",{htmlFor:h,children:[G.jsx("span",{children:"One-time Code"}),G.jsx("input",{id:h,type:"otc",value:l,onChange:S=>{n(S.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,G.jsxs("footer",{children:[g==="password"?G.jsx("button",{type:"button",onClick:async()=>{const S=Ze(si);if(!S)return new Error("No userKey");await rn.startPasswordReset.mutate({userKey:S}),v("otc")},children:"Forgot Password?"}):null,G.jsx("span",{}),G.jsx("button",{type:"submit",disabled:!s&&g==="email"||!o&&g==="password"||!l&&g==="otc",children:">>->"})]})]})})}function pP({route:[,t]}){const e=St(at),n=St(Ui),s=Gn(Ui);zp.useState(!1);const[o,l]=zp.useState(null),u=`code-${V.useId()}`;return ku(()=>{t&&s(t)}),e?(ku(()=>{n&&console.log("verifying token",n)}),G.jsx("form",{onSubmit:async d=>{d.preventDefault();try{const h=await rn.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(at,h),h.action==="resetPassword"?yr("/account"):yr("/game")}catch(h){h instanceof Lo&&l(h.message)}},children:G.jsxs("main",{children:[G.jsx("p",{children:"Check your email for a verification code."}),G.jsxs("label",{htmlFor:u,children:[G.jsx("span",{children:"Verification code"}),G.jsx("input",{id:u,type:"text",value:n,onChange:d=>{s(d.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})):G.jsx("p",{children:"You must be logged in to verify your account."})}function mP(){const t=St(vU),e=St(at),[n,s]=V.useState(!1),{refs:o,floatingStyles:l,context:u}=oN({open:n,onOpenChange:s,placement:"bottom-end",middleware:[CD(5),ND(),DD()],whileElementsMounted:TD}),d=tN(u),h=sN(u),p=cN(u),{getReferenceProps:y,getFloatingProps:g}=aN([d,h,p]),v=St(aV);return G.jsxs("main",{className:Z3.class,children:[G.jsxs("header",{children:[G.jsxs("main",{children:[G.jsx(J3,{}),G.jsx("span",{children:G.jsx(Q3,{input:v})})]}),G.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&G.jsx(WD,{context:u,modal:!1,children:G.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:l,...g(),children:[G.jsx("span",{children:e.username}),G.jsx("button",{type:"button",onClick:()=>{yr("/account")},children:"Account"}),G.jsx("button",{type:"button",onClick:async()=>{e&&(await rn.closeSession.mutate({username:e.username}),di.once("disconnect",()=>{De(at,null),yr("/")}),di.disconnect())},children:"Sign out"})]})})]}),G.jsx("main",{children:typeof t=="number"?G.jsxs("article",{children:[G.jsx("h1",{children:t}),G.jsx("h2",{children:JSON.parse(rE[t])}),G.jsx(oE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return G.jsx(hP,{});case"admin":return G.jsx(AU,{});case"game":return G.jsx(CU,{route:t});case"verify":return G.jsx(pP,{route:t});case"account":return G.jsx(TU,{})}})()})]})}nC.createRoot(document.getElementById("root")).render(G.jsx(V.StrictMode,{children:G.jsx(YM,{socket:di,children:G.jsx(mP,{})})}));
|
|
108
|
+
`)+"}");class EA{config;resolvedConfig;name;get[Pi](){return"scope"}referencesById={};references=[];resolutions={};exportedNames=[];aliases={};resolved=!1;nodesByHash={};intrinsic;constructor(e,n){this.config=tm(ie.config,n),this.resolvedConfig=tm(ie.resolvedConfig,n),this.name=this.resolvedConfig.name??`anonymousScope${Object.keys(lp).length}`,this.name in lp&&Z(`A Scope already named ${this.name} already exists`),lp[this.name]=this;const r=Object.entries(e).map(o=>this.preparseOwnAliasEntry(...o));for(const[o,l]of r){let u=o;if(o[0]==="#"?(u=o.slice(1),u in this.aliases&&Z(yw(u)),this.aliases[u]=l):(u in this.aliases&&Z(yw(o)),this.aliases[u]=l,this.exportedNames.push(u)),!pe(l,"module")&&!pe(l,"generic")&&!mf(l)){const f=this.preparseOwnDefinitionFormat(l,{alias:u});this.resolutions[u]=pe(f,"root")?this.bindReference(f):this.createParseContext(f).id}}gw??=this.node("union",{branches:["string","number","object","bigint","symbol",{unit:!0},{unit:!1},{unit:void 0},{unit:null}]},{prereduced:!0}),this.nodesByHash[gw.hash]=this.node("intersection",{},{prereduced:!0}),this.intrinsic=ie.intrinsic?He(ie.intrinsic,(o,l)=>o.startsWith("json")?[]:[o,this.bindReference(l)]):{}}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 Hu(e,o?new IT(r):r,n,n,o??null)};units=(e,n)=>{const r=[];for(const l of e)r.includes(l)||r.push(l);const o=r.map(l=>this.node("unit",{unit:l},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(yu(e),e,n);preparseNode(e,n,r){let o=typeof e=="string"?e:yu(n,e);if(Xt(n)&&n.kind===o)return n;if(o==="alias"&&!r?.prereduced){const{reference:f}=Ry.implementation.normalize(n,this);if(f.startsWith("$")){const h=this.resolveRoot(f.slice(1));n=h,o=h.kind}}else if(o==="union"&&vs(n,"object")){const f=gj(n);f?.length===1&&(n=f[0],o=yu(n))}if(Xt(n)&&n.kind===o)return n;const u=wf[o].normalize?.(n,this)??n;return Xt(u)?u.kind===o?u:bj(o,u.kind):{...r,$:this,kind:o,def:u,prefix:r.alias??o}}bindReference(e){let n;return Xt(e)?n=e.$===this?e:new e.constructor(e.attachments,this):n=e.$===this?e:new Hu(e.params,e.bodyDef,e.$,this,e.hkt),this.resolved||Object.assign(this.referencesById,n.referencesById),n}resolveRoot(e){return this.maybeResolveRoot(e)??Z(kA(e))}maybeResolveRoot(e){const n=this.maybeResolve(e);if(!pe(n,"generic"))return n}maybeResolveSubalias(e){return lm(this.aliases,e)??lm(this.ambient,e)}get ambient(){return ie.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 Tt(`Unexpected resolved context for was uncached by its scope: ${qe(o)}`);o.phase="resolving";const l=this.bindReference(this.parseOwnDefinitionFormat(o.def,o));return o.phase="resolved",Ln[l.id]=l,Ln[o.id]=l,this.resolutions[e]=l}return Tt(`Unexpected nodesById entry for ${n}: ${qe(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(MA(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??sA(e.prefix);return Ln[n]=Object.assign(e,{[Pi]:"context",$:this,id:n,phase:"unresolved"})}traversal(e){return new mo(e,this.resolvedConfig)}import(...e){return new am(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")?wA(o,this):bw(this.maybeResolve(r))}for(const r of this.lazyResolutions)r.resolution;if(this._exportedResolutions=_A(this,this._exports),this._json=OA(this._exportedResolutions),Object.assign(this.resolutions,this._exportedResolutions),this.references=Object.values(this.referencesById),!this.resolvedConfig.jitless){const r=AA(this.references);this.precompilation=r.write(xA,4),TA(this.references,r)}this.resolved=!0}const n=e.length?e:this.exportedNames;return new am(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(Xt(o))return this.bindReference(o);const l=this.createParseContext(o),u=oA(l),f=this.bindReference(u);return Ln[l.id]=f};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 l=this.bindReference(this.parseOwnDefinitionFormat(e,o));return l.isCyclic&&(l=c$(l,o.id)),Ln[o.id]=l,l}finalize(e){return bw(e),!e.precompilation&&!this.resolvedConfig.jitless&&vj(e.references),e}}class RA extends EA{parseOwnDefinitionFormat(e,n){return oA(n)}preparseOwnDefinitionFormat(e,n){return this.preparseNode(yu(e),e,n)}preparseOwnAliasEntry(e,n){return[e,n]}normalizeRootScopeValue(e){return e}}const bw=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},OA=t=>He(t,(e,n)=>[e,pe(n,"root")||pe(n,"generic")?n.json:pe(n,"module")?OA(n):Tt(`Unexpected resolution ${qe(n)}`)]),lm=(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(Sj(r));const l=e.slice(n+1),u=o[l];if(u===void 0)return lm(o,l);if(pe(u,"root")||pe(u,"generic"))return u;if(pe(u,"module"))return u.root??Z(MA(e));Tt(`Unexpected resolution for alias '${e}': ${qe(u)}`)},ky=(t,e)=>new RA(t,e),Ml=new RA({}),_A=(t,e)=>{const n={};for(const r in e){const o=e[r];if(pe(o,"module")){const l=_A(t,o),u=He(l,(f,h)=>[`${r}.${f}`,h]);Object.assign(n,u)}else pe(o,"root")||pe(o,"generic")?n[r]=o:Tt(`Unexpected scope resolution ${qe(o)}`)}return n},kA=t=>`'${t}' is unresolvable`,Sj=t=>`'${t}' must reference a module to be accessed using dot syntax`,MA=t=>`Reference to submodule '${t}' must specify an alias`;Ml.export();const Ye=Ml.schema,My=Ml.node;Ml.defineSchema;const Yi=Ml.generic,CA="^(?:0|[1-9]\\d*)$",wj=new RegExp(CA);Zt(wj);const DA=ky({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();ie.intrinsic={...DA};const NA=ky({integer:{domain:"number",divisor:1},lengthBoundable:["string",Array],key:["string","symbol"],nonNegativeIntegerString:{domain:"string",pattern:CA}},{prereducedAliases:!0}).export();Object.assign(ie.intrinsic,NA);const xj=ky({jsonPrimitive:["string","number",{unit:!0},{unit:!1},{unit:null}],jsonObject:{domain:"object",index:{signature:"string",value:"$jsonData"}},jsonData:["$jsonPrimitive","$jsonObject"]},{prereducedAliases:!0}).export(),ve={...DA,...NA,...xj,emptyStructure:My("structure",{},{prereduced:!0})};ie.intrinsic={...ve};const Tj=t=>typeof t=="string"&&t[0]==="d"&&(t[1]==="'"||t[1]==='"')&&t.at(-1)===t[1],vw=t=>t.toString()!=="Invalid Date",Aj=t=>t.slice(2,-1),$A=t=>`'${t}' could not be parsed by the Date constructor`,Ej=(t,e)=>Rj(t,e),Rj=(t,e)=>{const n=new Date(t);if(vw(n))return n;const r=JN(t);if(r!==void 0){const o=new Date(r);if(vw(o))return o}return e?Z(e===!0?$A(t):e):void 0},Sw=(t,e)=>{const n=t.scanner.shiftUntil(_j[BA[e]]);if(t.scanner.lookahead==="")return t.error(Mj(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(yi(e,jA))t.root=t.ctx.$.node("unit",{unit:n});else{const r=Ej(n,$A(n));t.root=t.ctx.$.node("unit",{meta:n,unit:r})}},jA={"'":1,'"':1},Oj={"/":1,"'":1,'"':1},BA={"d'":"'",'d"':'"',"'":"'",'"':'"',"/":"/"},_j={"'":t=>t.lookahead==="'",'"':t=>t.lookahead==='"',"/":t=>t.lookahead==="/"},kj={'"':"double-quote","'":"single-quote","/":"forward slash"},Mj=(t,e)=>`${e}${t} requires a closing ${kj[BA[e]]}`,Cj=t=>`Private type references should not include '#'. Use '${t}' instead.`,LA="Optional definitions like 'string?' are only valid as properties in an object or tuple",VA="Defaultable definitions like 'number = 0' are only valid as properties in an object or tuple",Dj={">":!0,">=":!0},Nj={"<":!0,"<=":!0},Gu={"<":">",">":"<","<=":">=",">=":"<=","==":"=="},$j=t=>`Unmatched )${t===""?"":` before ${t}`}`,UA=t=>`Missing ${t}`,jj=(t,e)=>`Left bounds are only valid when paired with right bounds (try ...${e}${t})`,zA=t=>`Left-bounded expressions must specify their limits using < or <= (was ${t})`,Bj=(t,e,n,r)=>`An expression may have at most one left bound (parsed ${t}${Gu[e]}, ${n}${Gu[r]})`,Lj=(t,e,n)=>KA(t,e,n,[]),KA=(t,e,n,r)=>{const o=n.parseUntilFinalizer();return r.push(o.root),o.finalizer===">"?r.length!==e.params.length?n.error(qA(t,e.names,r.map(l=>l.expression))):r:o.finalizer===","?KA(t,e,n,r):o.error(UA(">"))},qA=(t,e,n)=>`${t}<${e.join(", ")}> requires exactly ${e.length} args (got ${n.length}${n.length===0?"":`: ${n.join(", ")}`})`,ww=t=>{const e=t.scanner.shiftUntilNextTerminator();e==="keyof"?t.addPrefix("keyof"):t.root=Uj(t,e)},Vj=(t,e,n)=>{if(n.scanner.shiftUntilNonWhitespace(),n.scanner.shift()!=="<")return n.error(qA(t,e.names,[]));const o=Lj(t,e,n);return e(...o)},Uj=(t,e)=>zj(t,e)??Kj(t,e)??t.error(e===""?t.scanner.lookahead==="#"?Cj(t.shiftedByOne().scanner.shiftUntilNextTerminator()):PA(t):kA(e)),zj=(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")?Vj(e,n,t):Z(`Unexpected resolution ${qe(n)}`)},Kj=(t,e)=>{const n=ZN(e);if(n!==void 0)return t.ctx.$.node("unit",{unit:n});const r=WN(e);if(r!==void 0)return t.ctx.$.node("unit",{unit:r})},PA=t=>{const e=t.previousOperator();return e?IA(e,t.scanner.unscanned):qj(t.scanner.unscanned)},IA=(t,e="")=>`Token '${t}' requires a right operand${e?` before '${e}'`:""}`,qj=t=>`Expected an expression${t?` before '${t}'`:""}`,HA=t=>t.scanner.lookahead===""?t.error(PA(t)):t.scanner.lookahead==="("?t.shiftedByOne().reduceGroupOpen():t.scanner.lookaheadIsIn(Oj)?Sw(t,t.scanner.shift()):t.scanner.lookaheadIsIn(yf)?HA(t.shiftedByOne()):t.scanner.lookahead==="d"&&t.scanner.nextLookahead in jA?Sw(t,`${t.scanner.shift()}${t.scanner.shift()}`):ww(t);class Bo extends a2{shiftUntilNextTerminator(){return this.shiftUntilNonWhitespace(),this.shiftUntil(()=>this.lookahead in Bo.terminatingChars)}static terminatingChars={"<":1,">":1,"=":1,"|":1,"&":1,")":1,"[":1,"%":1,",":1,":":1,"?":1,"#":1,...yf};static finalizingLookaheads={">":1,",":1,"":1,"=":1,"?":1};static lookaheadIsFinalizing=(e,n)=>e===">"?n[0]==="="?n[1]==="=":n.trimStart()===""||yi(n.trimStart()[0],Bo.terminatingChars):e==="="?n[0]!=="=":e===","||e==="?"}const Pj=(t,e)=>{const n=Hj(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 Gj(t,n)},Ij={"<":1,">":1,"=":1},Hj=(t,e)=>t.scanner.lookaheadIs("=")?`${e}${t.scanner.shift()}`:e,xw=(t,e,n,r)=>n.extends(ie.intrinsic.number)?typeof e!="number"?Z(cm(t,e,r)):t==="=="?["min","max"]:t[0]===">"?["min"]:["max"]:n.extends(ie.intrinsic.lengthBoundable)?typeof e!="number"?Z(cm(t,e,r)):t==="=="?["exactLength"]:t[0]===">"?["minLength"]:["maxLength"]:n.extends(ie.intrinsic.Date)?t==="=="?["after","before"]:t[0]===">"?["after"]:["before"]:Z(q2(n.expression)),Fj=t=>({rule:Tj(t.limit)?Aj(t.limit):t.limit,exclusive:t.comparator.length===1}),Gj=(t,e)=>{const n=t.unsetRoot(),r=t.scanner.location;t.parseOperand();const o=t.unsetRoot(),l=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(cm(e,l,"right"));const u=o.unit,f=e.length===1,h=xw(e,typeof u=="number"?u:l,n,"right");for(const y of h)t.constrainRoot(y,e==="=="?{rule:u}:{rule:u,exclusive:f});if(!t.branches.leftBound)return;if(!yi(e,Nj))return t.error(zA(e));const p=xw(t.branches.leftBound.comparator,t.branches.leftBound.limit,n,"left");t.constrainRoot(p[0],Fj(t.branches.leftBound)),t.branches.leftBound=null},cm=(t,e,n)=>`Comparator ${n==="left"?Gu[t]:t} must be ${n==="left"?"preceded":"followed"} by a corresponding literal (was ${e})`,Yj=t=>{t.scanner.shiftUntilNonWhitespace();const e=t.scanner.shiftUntilNextTerminator();t.root=t.root.brand(e)},Xj=t=>{const e=t.scanner.shiftUntilNextTerminator(),n=QN(e,{errorOnFail:Tw(e)});n===0&&t.error(Tw(0)),t.root=t.root.constrain("divisor",n)},Tw=t=>`% operator must be followed by a non-zero integer literal (was ${t})`,FA=t=>{const e=t.scanner.shift();return e===""?t.finalize(""):e==="["?t.scanner.shift()==="]"?t.setRoot(t.root.array()):t.error(Jj):e==="|"?t.scanner.lookahead===">"?t.shiftedByOne().pushRootToBranch("|>"):t.pushRootToBranch(e):e==="&"?t.pushRootToBranch(e):e===")"?t.finalizeGroup():Bo.lookaheadIsFinalizing(e,t.scanner.unscanned)?t.finalize(e):yi(e,Ij)?Pj(t,e):e==="%"?Xj(t):e==="#"?Yj(t):e in yf?FA(t):t.error(Cy(e))},Cy=(t,e="")=>`'${t}' is not allowed here${e&&` (should be ${e})`}`,Jj="Missing expected ']'",Zj=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`,Aw=(t,e)=>{const n=e.$.maybeResolveRoot(t);if(n)return n;if(t.endsWith("[]")){const l=e.$.maybeResolveRoot(t.slice(0,-2));if(l)return l.array()}const r=new xf(new Bo(t),e),o=Wj(r);return r.finalizer===">"&&Z(Cy(">")),o},Wj=t=>{t.parseOperand();let e=Dy(t).root;return e?(t.finalizer==="="?e=Zj(t):t.finalizer==="?"&&(e=[e,"?"]),t.scanner.shiftUntilNonWhitespace(),t.scanner.lookahead&&Z(Cy(t.scanner.lookahead)),e):Tt(`Root was unexpectedly unset after parsing string '${t.scanner.scanned}'`)},Dy=t=>{for(;t.finalizer===void 0;)eB(t);return t},eB=t=>t.hasRoot()?t.parseOperator():t.parseOperand();class xf{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(UA(")"));this.finalizeBranches(),this.finalizer=e}reduceLeftBound(e,n){const r=Gu[n];if(!yi(r,Dj))return this.error(zA(n));if(this.branches.leftBound)return this.error(Bj(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($j(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():Tt(`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 Dy(new xf(this.scanner,this.ctx))}parseOperator(){return FA(this)}parseOperand(){return HA(this)}assertRangeUnset(){if(this.branches.leftBound)return this.error(jj(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 tB="An empty string is not a valid generic parameter name",um=(t,e,n)=>{t.shiftUntilNonWhitespace();const r=t.shiftUntilNextTerminator();return r===""?t.lookahead===""&&e.length?e:Z(tB):(t.shiftUntilNonWhitespace(),nB(t,r,e,n))},Ew="extends ",nB=(t,e,n,r)=>{if(t.shiftUntilNonWhitespace(),t.unscanned.startsWith(Ew))t.jumpForward(Ew.length);else return t.lookahead===","&&t.shift(),n.push(e),um(t,n,r);const o=Dy(new xf(t,r));return n.push([e,o.root]),um(t,n,r)};class iB extends Ko{$;constructor(e){super((...n)=>new iu(e)(...n),{bind:e}),this.$=e}in(e){return new iu(this.$,e===void 0?void 0:this.$.parse(e))}at(e,n){return new iu(this.$).at(e,n)}case(e,n){return new iu(this.$).case(e,n)}}class iu extends Ko{$;in;key;branches=[];constructor(e,n){super(r=>this.caseEntries(Object.entries(r).map(([o,l])=>o==="default"?[o,l]:[this.$.parse(o),l]))),this.$=e,this.in=n}at(e,n){return this.key&&Z(sB),this.branches.length&&Z(rB),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 ${Jn(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:Rw});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:Rw},"self")),this.$.finalize(o)}}const Rw=t=>t.throw(),rB="A key matcher must be specified before the first case i.e. match.at('foo') or match.in<object>().at('bar')",sB="At most one key matcher may be specified per expression",GA=(t,e)=>{if(Ft(t)){if(t[1]==="=")return[e.$.parseOwnDefinitionFormat(t[0],e),"=",t[2]];if(t[1]==="?")return[e.$.parseOwnDefinitionFormat(t[0],e),"?"]}return eE(t,e)},oB="Only required keys may make their values optional, e.g. { [mySymbol]: ['number', '?'] }",aB="Only required keys may specify default values, e.g. { value: 'number = 0' }",lB=(t,e)=>{let n;const r={},o=Uu(t);for(const[u,f]of o){const h=fB(u);if(h.kind==="spread"){if(!Tl(r))return Z(uB);const S=e.$.parseOwnDefinitionFormat(f,e);if(S.equals(ve.object))continue;if(!S.hasKind("intersection")||!S.basis?.equals(ve.object))return Z(dB(S.expression));n=S.structure;continue}if(h.kind==="undeclared"){f!=="reject"&&f!=="delete"&&f!=="ignore"&&Z(cB(f)),r.undeclared=f;continue}const p=GA(f,e),y=h;if(h.kind==="required"){Ft(p)?cp(r,"optional",p[1]==="="?{key:h.normalized,value:p[0],default:p[2]}:{key:h.normalized,value:p[0]},e):cp(r,"required",{key:h.normalized,value:p},e);continue}if(Ft(p)&&(p[1]==="?"&&Z(oB),p[1]==="="&&Z(aB)),h.kind==="optional"){cp(r,"optional",{key:h.normalized,value:p},e);continue}const g=e.$.parseOwnDefinitionFormat(y.normalized,e),v=om(g,p,e.$);v.index&&(r.index=Ie(r.index,v.index)),v.required&&(r.required=Ie(r.required,v.required))}const l=e.$.node("structure",r);return e.$.parseSchema({domain:"object",structure:n?.merge(l)??l})},cp=(t,e,n,r)=>{t[e]=Ie(t[e],r.$.node(e,n))},cB=t=>`Value of '+' key must be 'reject', 'delete', or 'ignore' (was ${qe(t)})`,uB="Spread operator may only be used as the first key in an object",fB=t=>typeof t=="symbol"?{kind:"required",normalized:t}:t.at(-1)==="?"?t.at(-2)===Jp?{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]===Jp&&t[1]==="["&&t.at(-1)==="]"?{kind:"required",normalized:t.slice(1)}:t==="..."?{kind:"spread"}:t==="+"?{kind:"undeclared"}:{kind:"required",normalized:t==="\\..."?"...":t==="\\+"?"+":t},dB=t=>`Spread operand must resolve to an object literal type (was ${t})`,hB=(t,e)=>TB(t)?ZA[t[0]](t,e):wB(t)?JA[t[1]](t,e):null,pB=(t,e)=>e.$.parseOwnDefinitionFormat(t[1],e).keyof(),up=(t,e)=>{if(t[2]===void 0)return Z(IA(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]==="&"?Hi(n,r,e.$):im(n,r,e.$);return o instanceof ae?o.throw():o},mB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).array(),yB=(t,e)=>typeof t[2]!="function"?Z(YA("=>",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).pipe(t[2]),YA=(t,e)=>`${t===":"?"Narrow":"Morph"} expression requires a function following '${t}' (was ${typeof e})`,gB=(t,e)=>typeof t[2]!="function"?Z(YA(":",t[2])):e.$.parseOwnDefinitionFormat(t[0],e).constrain("predicate",t[2]),bB=(t,e)=>e.$.parseOwnDefinitionFormat(t[0],e).configureReferences(t[2],"shallow"),XA=t=>t,vB=XA({"[]":mB,"?":()=>Z(LA)}),SB=XA({"|":up,"&":up,":":gB,"=>":yB,"|>":up,"@":bB,"=":()=>Z(VA)}),JA={...vB,...SB},wB=t=>JA[t[1]]!==void 0,xB=t=>t,ZA=xB({keyof:pB,instanceof:(t,e)=>{if(typeof t[1]!="function")return Z(Ow(Xp(t[1])));const n=t.slice(1).map(r=>typeof r=="function"?e.$.node("proto",{proto:r}):Z(Ow(Xp(r))));return n.length===1?n[0]:e.$.node("union",{branches:n})},"===":(t,e)=>e.$.units(t.slice(1))}),TB=t=>ZA[t[0]]!==void 0,Ow=t=>`Expected a constructor following 'instanceof' operator (was ${t})`,AB=(t,e)=>{let n=[{}],r=0;for(;r<t.length;){let o=!1;t[r]==="..."&&r<t.length-1&&(o=!0,r++);const l=GA(t[r],e),[u,f,h]=Ft(l)?l:[l];if(r++,o){if(!u.extends(ie.intrinsic.Array))return Z(OB(u.expression));n=n.flatMap(p=>u.distribute(y=>RB(BT(p),y)))}else n=n.map(p=>f==="?"?QA(p,u):f==="="?EB(p,u,h):fm(p,u))}return e.$.parseSchema(n.map(o=>Tl(o)?{proto:Array,exactLength:0}:{proto:Array,sequence:o}))},fm=(t,e)=>t.defaultables||t.optionals?Z(t.variadic?bA:_B):(t.variadic?t.postfix=Ie(t.postfix,e):t.prefix=Ie(t.prefix,e),t),QA=(t,e)=>t.variadic?Z(WA):(t.optionals=Ie(t.optionals,e),t),EB=(t,e,n)=>t.variadic?Z(WA):t.optionals?Z(kB):(t.defaultables=Ie(t.defaultables,[[e,n]]),t),_w=(t,e)=>(t.postfix&&Z(kw),t.variadic?t.variadic.equals(e)||Z(kw):t.variadic=e.internal,t),RB=(t,e)=>{const n=e.select({method:"find",kind:"sequence"});if(!n)return _w(t,ie.intrinsic.unknown);if(n.prefix)for(const r of n.prefix)fm(t,r);if(n.optionals)for(const r of n.optionals)QA(t,r);if(n.variadic&&_w(t,n.variadic),n.postfix)for(const r of n.postfix)fm(t,r);return t},OB=t=>`Spread element must be an array (was ${t})`,kw="A tuple may have at most one variadic element",_B="A required element may not follow an optional element",WA="An optional element may not follow a variadic element",kB="A defaultable element may not follow an optional element without a default",MB={},eE=(t,e)=>{if(typeof t=="string"){if(e.args&&Object.keys(e.args).some(r=>t.includes(r)))return Aw(t,e);const n=MB[e.$.name]??={};return n[t]??=Aw(t,e)}return vs(t,"object")?CB(t,e):Z(dm(Jn(t)))},CB=(t,e)=>{const n=yy(t);switch(n){case void 0:return pe(t,"root")?t:lB(t,e);case"Array":return DB(t,e);case"RegExp":return e.$.node("intersection",{domain:"string",pattern:t},{prereduced:!0});case"Function":{const r=mf(t)?t():t;return pe(r,"root")?r:Z(dm("Function"))}default:return Z(dm(n??qe(t)))}},DB=(t,e)=>hB(t,e)??AB(t,e),dm=t=>`Type definitions must be strings or objects (was ${t})`;class NB extends Ko{constructor(e){const n=Object.assign({errors:Mr,hkt:gi,$: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),l=e.parseGenericParams(o,{});return new Hu(l,r[1],e,e,null)}return e.parse(r)},{bind:e,attach:n})}}const dl=ie;class Tf extends EA{get ambientAttachments(){if(dl.typeAttachments)return this.cacheGetter("ambientAttachments",He(dl.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}`,f=this.resolvedConfig.keywords?.[u];return f&&(n=[n,"@",f]),[e,n]}e.at(-1)!==">"&&Z("'>' must be the last character of a generic declaration in a scope");const o=e.slice(0,r),l=e.slice(r+1,-1);return[o,()=>{const u=this.parseGenericParams(l,{alias:o});return _2(u,n,this)}]}parseGenericParams(e,n){return um(new Bo(e),[],this.createParseContext({...n,def:e,prefix:"generic"}))}normalizeRootScopeValue(e){return mf(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=eE(e,n);if(Ft(o)){if(o[1]==="=")return Z(VA);if(o[1]==="?")return Z(LA)}return o}unit=e=>this.units([e]);valueOf=e=>this.units(TN(e));enumerated=(...e)=>this.units(e);instanceOf=e=>this.node("proto",{proto:e},{prereduced:!0});or=(...e)=>this.schema(e.map(n=>this.parse(n)));and=(...e)=>e.reduce((n,r)=>n.and(this.parse(r)),this.intrinsic.unknown);merge=(...e)=>e.reduce((n,r)=>n.merge(this.parse(r)),this.intrinsic.object);pipe=(...e)=>this.intrinsic.unknown.pipe(...e);match=new iB(this);declare=()=>({type:this.type});define(e){return e}type=new NB(this);static scope=((e,n={})=>new Tf(e,n));static module=((e,n={})=>this.scope(e,n).export())}const $B=Object.assign(Tf.scope,{define:t=>t}),je=Tf;class jB extends gi{description='merge an object\'s properties onto another like `Merge(User, { isAdmin: "true" })`'}const BB=Yi(["base",ve.object],["props",ve.object])(t=>t.base.merge(t.props),jB),LB=je.module({Key:ve.key,Merge:BB});class VB extends gi{}const UB=Yi("element")(t=>{const e=t.element.exclude(ve.Array),n=e.array();return e.rawOr(n).pipe(xl).distribute(r=>r.assertHasKind("morph").declareOut(n),Ye)},VB),zB=je.module({root:ve.Array,readonly:"root",index:ve.nonNegativeIntegerString,liftFrom:UB},{name:"Array"}),hm=Ye(["string",Al.FileConstructor]),KB=hm.rawOr(hm.array()),Mw=Ye({meta:"an object representing parsed form data",domain:"object",index:{signature:"string",value:KB}}),qB=je.module({root:["instanceof",FormData],value:hm,parsed:Mw,parse:Ye({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 Al.FileConstructor?e[n]=[o,r]:o.push(r)}else e[n]=r;return e},declaredOut:Mw})},{name:"FormData"}),PB=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"}),IB={Boolean:1,Number:1,String:1},HB=je.module({...He({...wT,...TT},(t,e)=>t in IB?[]:[t,["instanceof",e]]),Array:zB,TypedArray:PB,FormData:qB}),FB=Ye({domain:{domain:"number",meta:"a number representing a Unix timestamp"},divisor:{rule:1,meta:"an integer representing a Unix timestamp"},min:{rule:-864e13,meta:"a Unix timestamp after -8640000000000000"},max:{rule:864e13,meta:"a Unix timestamp before 8640000000000000"},meta:"an integer representing a safe Unix timestamp"}),GB=Ye({domain:"number",divisor:1}),tE=je.module({root:ve.number,integer:GB,epoch:FB,safe:Ye({domain:{domain:"number",numberAllowsNaN:!1},min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER}),NaN:["===",Number.NaN],Infinity:["===",Number.POSITIVE_INFINITY],NegativeInfinity:["===",Number.NEGATIVE_INFINITY]},{name:"number"}),Xe=(t,e,n)=>{const r={domain:"string",pattern:{rule:t.source,flags:t.flags,meta:e}};return n&&(r.meta={format:n}),My("intersection",r)},Cw=Xe(zu,"a well-formed integer string"),nE=je.module({root:Cw,parse:Ye({in:Cw,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"}),YB=Xe(/^[\dA-Fa-f]+$/,"hex characters only"),XB=je.module({root:Xe(/^(?:[\d+/A-Za-z]{4})*(?:[\d+/A-Za-z]{2}==|[\d+/A-Za-z]{3}=)?$/,"base64-encoded"),url:Xe(/^(?:[\w-]{4})*(?:[\w-]{2}(?:==|%3D%3D)?|[\w-]{3}(?:=|%3D)?)?$/,"base64url-encoded")},{name:"string.base64"}),Dw=Xe(/^[A-Z].*$/,"capitalized"),JB=je.module({root:Ye({in:"string",morphs:t=>t.charAt(0).toUpperCase()+t.slice(1),declaredOut:Dw}),preformatted:Dw},{name:"string.capitalize"}),ZB=t=>{const e=t.replaceAll(/[ -]+/g,"");let n=0,r,o,l=!1;for(let u=e.length-1;u>=0;u--)r=e.substring(u,u+1),o=Number.parseInt(r,10),l?(o*=2,n+=o>=10?o%10+1:o):n+=o,l=!l;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}))$/,WB=Ye({domain:"string",pattern:{meta:"a credit card number",rule:QB.source},predicate:{meta:"a credit card number",predicate:ZB}}),e3=/^([+-]?\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)?)?)?)?$/,t3=t=>!Number.isNaN(new Date(t).valueOf()),Nw=Ye({domain:"string",predicate:{meta:"a parsable date",predicate:t3}}).assertHasKind("intersection"),$w=nE.root.internal.narrow((t,e)=>{const n=Number.parseInt(t),r=tE.epoch(n);return r instanceof Mr?(e.errors.merge(r),!1):!0}).configure({description:"an integer string representing a safe Unix timestamp"},"self").assertHasKind("intersection"),n3=je.module({root:$w,parse:Ye({in:$w,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.epoch"}),jw=Xe(e3,"an ISO 8601 (YYYY-MM-DDTHH:mm:ss.sssZ) date").internal.assertHasKind("intersection"),i3=je.module({root:jw,parse:Ye({in:jw,morphs:t=>new Date(t),declaredOut:ve.Date})},{name:"string.date.iso"}),r3=je.module({root:Nw,parse:Ye({declaredIn:Nw,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:i3,epoch:n3},{name:"string.date"}),s3=Xe(/^[\w%+.-]+@[\d.A-Za-z-]+\.[A-Za-z]{2,}$/,"an email address","email"),Bw="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",Sr=`(${Bw}[.]){3}${Bw}`,o3=new RegExp(`^${Sr}$`),bt="(?:[0-9a-fA-F]{1,4})",a3=new RegExp(`^((?:${bt}:){7}(?:${bt}|:)|(?:${bt}:){6}(?:${Sr}|:${bt}|:)|(?:${bt}:){5}(?::${Sr}|(:${bt}){1,2}|:)|(?:${bt}:){4}(?:(:${bt}){0,1}:${Sr}|(:${bt}){1,3}|:)|(?:${bt}:){3}(?:(:${bt}){0,2}:${Sr}|(:${bt}){1,4}|:)|(?:${bt}:){2}(?:(:${bt}){0,3}:${Sr}|(:${bt}){1,5}|:)|(?:${bt}:){1}(?:(:${bt}){0,4}:${Sr}|(:${bt}){1,6}|:)|(?::((?::${bt}){0,5}:${Sr}|(?::${bt}){1,7}|:)))(%[0-9a-zA-Z.]{1,})?$`),l3=je.module({root:["v4 | v6","@","an IP address"],v4:Xe(o3,"an IPv4 address","ipv4"),v6:Xe(a3,"an IPv6 address","ipv6")},{name:"string.ip"}),Eo="a JSON string",iE=t=>{if(!(t instanceof SyntaxError))throw t;return`must be ${Eo} (${t})`},c3=Ye({meta:Eo,domain:"string",predicate:{meta:Eo,predicate:(t,e)=>{try{return JSON.parse(t),!0}catch(n){return e.reject({code:"predicate",expected:Eo,problem:iE(n)})}}}}),u3=(t,e)=>{if(t.length===0)return e.error({code:"predicate",expected:Eo,actual:"empty"});try{return JSON.parse(t)}catch(n){return e.error({code:"predicate",expected:Eo,problem:iE(n)})}},f3=je.module({root:c3,parse:Ye({meta:"safe JSON string parser",in:"string",morphs:u3,declaredOut:ve.jsonObject})},{name:"string.json"}),Lw=Xe(/^[a-z]*$/,"only lowercase letters"),d3=je.module({root:Ye({in:"string",morphs:t=>t.toLowerCase(),declaredOut:Lw}),preformatted:Lw},{name:"string.lower"}),rE=["NFC","NFD","NFKC","NFKD"],Cl=He(rE,(t,e)=>[e,Ye({domain:"string",predicate:n=>n.normalize(e)===n,meta:`${e}-normalized unicode`})]),Af=He(rE,(t,e)=>[e,Ye({in:"string",morphs:n=>n.normalize(e),declaredOut:Cl[e]})]),h3=je.module({root:Af.NFC,preformatted:Cl.NFC},{name:"string.normalize.NFC"}),p3=je.module({root:Af.NFD,preformatted:Cl.NFD},{name:"string.normalize.NFD"}),m3=je.module({root:Af.NFKC,preformatted:Cl.NFKC},{name:"string.normalize.NFKC"}),y3=je.module({root:Af.NFKD,preformatted:Cl.NFKD},{name:"string.normalize.NFKD"}),g3=je.module({root:"NFC",NFC:h3,NFD:p3,NFKC:m3,NFKD:y3},{name:"string.normalize"}),Vw=Xe(Zp,"a well-formed numeric string"),b3=je.module({root:Vw,parse:Ye({in:Vw,morphs:t=>Number.parseFloat(t),declaredOut:ve.number})},{name:"string.numeric"}),Uw="a regex pattern",v3=Ye({domain:"string",predicate:{meta:Uw,predicate:(t,e)=>{try{return new RegExp(t),!0}catch(n){return e.reject({code:"predicate",expected:Uw,problem:String(n)})}}},meta:{format:"regex"}}),S3=/^(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-]+)*))?$/,w3=Xe(S3,"a semantic version (see https://semver.org/)"),zw=Xe(/^\S.*\S$|^\S?$/,"trimmed"),x3=je.module({root:Ye({in:"string",morphs:t=>t.trim(),declaredOut:zw}),preformatted:zw},{name:"string.trim"}),Kw=Xe(/^[A-Z]*$/,"only uppercase letters"),T3=je.module({root:Ye({in:"string",morphs:t=>t.toUpperCase(),declaredOut:Kw}),preformatted:Kw},{name:"string.upper"}),A3=t=>{if(URL.canParse)return URL.canParse(t);try{return new URL(t),!0}catch{return!1}},qw=Ye({domain:"string",predicate:{meta:"a URL string",predicate:A3},meta:{format:"uri"}}),E3=je.module({root:qw,parse:Ye({declaredIn:qw,in:"string",morphs:(t,e)=>{try{return new URL(t)}catch{return e.error("a URL string")}},declaredOut:Ye(URL)})},{name:"string.url"}),R3=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:Xe(/^[\da-f]{8}-[\da-f]{4}-1[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv1"),v2:Xe(/^[\da-f]{8}-[\da-f]{4}-2[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv2"),v3:Xe(/^[\da-f]{8}-[\da-f]{4}-3[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv3"),v4:Xe(/^[\da-f]{8}-[\da-f]{4}-4[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv4"),v5:Xe(/^[\da-f]{8}-[\da-f]{4}-5[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv5"),v6:Xe(/^[\da-f]{8}-[\da-f]{4}-6[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv6"),v7:Xe(/^[\da-f]{8}-[\da-f]{4}-7[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv7"),v8:Xe(/^[\da-f]{8}-[\da-f]{4}-8[\da-f]{3}-[89ab][\da-f]{3}-[\da-f]{12}$/i,"a UUIDv8")},{name:"string.uuid"}),O3=je.module({root:ve.string,alpha:Xe(/^[A-Za-z]*$/,"only letters"),alphanumeric:Xe(/^[\dA-Za-z]*$/,"only letters and digits 0-9"),hex:YB,base64:XB,capitalize:JB,creditCard:WB,date:r3,digits:Xe(/^\d*$/,"only digits 0-9"),email:s3,integer:nE,ip:l3,json:f3,lower:d3,normalize:g3,numeric:b3,regex:v3,semver:w3,trim:x3,upper:T3,url:E3,uuid:R3},{name:"string"}),_3=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}),k3=je.module({root:ve.unknown,any:ve.unknown},{name:"unknown"}),M3=je.module({root:ve.jsonObject,stringify:My("morph",{in:ve.jsonObject,morphs:t=>JSON.stringify(t),declaredOut:ve.string})},{name:"object.json"}),C3=je.module({root:ve.object,json:M3},{name:"object"});class D3 extends gi{description='instantiate an object from an index signature and corresponding value type like `Record("string", "number")`'}const N3=Yi(["K",ve.key],"V")(t=>({domain:"object",index:{signature:t.K,value:t.V}}),D3);class $3 extends gi{description='pick a set of properties from an object like `Pick(User, "name | age")`'}const j3=Yi(["T",ve.object],["K",ve.key])(t=>t.T.pick(t.K),$3);class B3 extends gi{description='omit a set of properties from an object like `Omit(User, "age")`'}const L3=Yi(["T",ve.object],["K",ve.key])(t=>t.T.omit(t.K),B3);class V3 extends gi{description="make all named properties of an object optional like `Partial(User)`"}const U3=Yi(["T",ve.object])(t=>t.T.partial(),V3);class z3 extends gi{description="make all named properties of an object required like `Required(User)`"}const K3=Yi(["T",ve.object])(t=>t.T.required(),z3);class q3 extends gi{description='exclude branches of a union like `Exclude("boolean", "true")`'}const P3=Yi("T","U")(t=>t.T.exclude(t.U),q3);class I3 extends gi{description='extract branches of a union like `Extract("0 | false | 1", "number")`'}const H3=Yi("T","U")(t=>t.T.extract(t.U),I3),F3=je.module({Exclude:P3,Extract:H3,Omit:L3,Partial:U3,Pick:j3,Record:N3,Required:K3}),Ss=$B({..._3,...F3,...HB,...LB,string:O3,number:tE,object:C3,unknown:k3},{prereducedAliases:!0,name:"ark"}),$t=Ss.export();Object.assign(dl.ambient,$t);dl.typeAttachments={string:$t.string.root,number:$t.number.root,bigint:$t.bigint,boolean:$t.boolean,symbol:$t.symbol,undefined:$t.undefined,null:$t.null,object:$t.object.root,unknown:$t.unknown.root,false:$t.false,true:$t.true,never:$t.never,arrayIndex:$t.Array.index,Key:$t.Key,Record:$t.Record,Array:$t.Array.root,Date:$t.Date};const wt=Object.assign(Ss.type,dl.typeAttachments);Ss.match;Ss.generic;Ss.schema;Ss.define;Ss.declare;const sE={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 G3(t){return Number.parseInt(t,10)}const Y3=wt(sE),X3=Y3.keyof().pipe(t=>G3(t));wt([X3,"string"]);function J3(t){return G.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 500 101",...t,children:[G.jsx("title",{children:"Tempest Games Logo"}),G.jsx("path",{d:"M155.76.93v59.89h-17.11V7.78h-13.69V.93h30.8Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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}}),G.jsx("path",{d:"M500,7.78h-13.69v53.04h-17.11V.93h30.8v6.84Z",style:{fill:"var(--logo-color)",strokeWidth:0}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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}}),G.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 oE(t){return G.jsx("a",{...t})}const Z3={class:"_class_1riwg_1"},fp=["⠋","⠙","⠸","⠴","⠦","⠇"];function Q3({input:t}){const e=V.useRef(null),[n,r]=V.useState(typeof t=="string"?t:null);return V.useEffect(()=>{let o=!0,l;if(typeof t=="string")r(t);else{let u=0;l=setInterval(()=>{e.current&&(e.current.textContent=fp[u],u=(u+1)%fp.length)},100),t.then(f=>{o&&(clearInterval(l),r(f))})}return()=>{o=!1,l&&clearInterval(l)}},[t]),G.jsx("span",{ref:e,children:n??fp[0]})}var W3=Object.create,aE=Object.defineProperty,eL=Object.getOwnPropertyDescriptor,lE=Object.getOwnPropertyNames,tL=Object.getPrototypeOf,nL=Object.prototype.hasOwnProperty,bi=(t,e)=>function(){return e||(0,t[lE(t)[0]])((e={exports:{}}).exports,e),e.exports},iL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=lE(e),l=0,u=o.length,f;l<u;l++)f=o[l],!nL.call(t,f)&&f!==n&&aE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=eL(e,f))||r.enumerable});return t},mt=(t,e,n)=>(n=t!=null?W3(tL(t)):{},iL(aE(n,"default",{value:t,enumerable:!0}),t)),cE=bi({"../../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}}),rL=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=cE().default;function r(o,l){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var f=u.call(o,l||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),sL=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=cE().default,r=rL();function o(l){var u=r(l,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),ws=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=sL();function r(o,l,u){return(l=n(l))in o?Object.defineProperty(o,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[l]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Zn=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=ws();function r(l,u){var f=Object.keys(l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(l,p).enumerable})),f.push.apply(f,h)}return f}function o(l){for(var u=1;u<arguments.length;u++){var f=arguments[u]!=null?arguments[u]:{};u%2?r(Object(f),!0).forEach(function(h){n(l,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(f,h))})}return l}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});function Ef(t){const e={subscribe(n){let r=null,o=!1,l=!1,u=!1;function f(){if(r===null){u=!0;return}l||(l=!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),f())},complete(){var h;o||(o=!0,(h=n.complete)===null||h===void 0||h.call(n),f())}}),u&&f(),{unsubscribe:f}},pipe(...n){return n.reduce(oL,e)}};return e}function oL(t,e){return e(t)}function aL(t){const e=new AbortController;return new Promise((r,o)=>{let l=!1;function u(){l||(l=!0,f.unsubscribe())}e.signal.addEventListener("abort",()=>{o(e.signal.reason)});const f=t.subscribe({next(h){l=!0,r(h),u()},error(h){o(h)},complete(){e.abort(),u()}})})}function lL(t){return e=>{let n=0,r=null;const o=[];function l(){r||(r=e.subscribe({next(f){for(const p of o){var h;(h=p.next)===null||h===void 0||h.call(p,f)}},error(f){for(const p of o){var h;(h=p.error)===null||h===void 0||h.call(p,f)}},complete(){for(const h of o){var f;(f=h.complete)===null||f===void 0||f.call(h)}}}))}function u(){if(n===0&&r){const f=r;r=null,f.unsubscribe()}}return Ef(f=>(n++,o.push(f),l(),{unsubscribe(){n--,u();const h=o.findIndex(p=>p===f);h>-1&&o.splice(h,1)}}))}}function cL(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)},l=Ef(u=>(r(u),()=>{o(u)}));return l.next=u=>{if(e!==u){e=u;for(const f of n)f.next(u)}},l.get=()=>e,l}function uL(t){return Ef(e=>{function n(o=0,l=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:l,next(h){return n(o+1,h)}})}return n().subscribe(e)})}function hl(t){return!!t&&!Array.isArray(t)&&typeof t=="object"}var fL=Object.create,uE=Object.defineProperty,dL=Object.getOwnPropertyDescriptor,fE=Object.getOwnPropertyNames,hL=Object.getPrototypeOf,pL=Object.prototype.hasOwnProperty,Dl=(t,e)=>function(){return e||(0,t[fE(t)[0]])((e={exports:{}}).exports,e),e.exports},mL=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(var o=fE(e),l=0,u=o.length,f;l<u;l++)f=o[l],!pL.call(t,f)&&f!==n&&uE(t,f,{get:(h=>e[h]).bind(null,f),enumerable:!(r=dL(e,f))||r.enumerable});return t},Rf=(t,e,n)=>(n=t!=null?fL(hL(t)):{},mL(uE(n,"default",{value:t,enumerable:!0}),t));const dE=()=>{},Pw=t=>{Object.freeze&&Object.freeze(t)};function hE(t,e,n){var r;const o=e.join(".");return(r=n[o])!==null&&r!==void 0||(n[o]=new Proxy(dE,{get(l,u){if(!(typeof u!="string"||u==="then"))return hE(t,[...e,u],n)},apply(l,u,f){const h=e[e.length-1];let p={args:f,path:e};return h==="call"?p={args:f.length>=2?[f[1]]:[],path:e.slice(0,-1)}:h==="apply"&&(p={args:f.length>=2?f[1]:[],path:e.slice(0,-1)}),Pw(p.args),Pw(p.path),t(p)}})),n[o]}const yL=t=>hE(t,[],Object.create(null)),gL=t=>new Proxy(dE,{get(e,n){if(n!=="then")return t(n)}});var pE=Dl({"../../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}}),bL=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPrimitive.js"(t,e){var n=pE().default;function r(o,l){if(n(o)!="object"||!o)return o;var u=o[Symbol.toPrimitive];if(u!==void 0){var f=u.call(o,l||"default");if(n(f)!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(o)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),vL=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/toPropertyKey.js"(t,e){var n=pE().default,r=bL();function o(l){var u=r(l,"string");return n(u)=="symbol"?u:u+""}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}}),mE=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/defineProperty.js"(t,e){var n=vL();function r(o,l,u){return(l=n(l))in o?Object.defineProperty(o,l,{value:u,enumerable:!0,configurable:!0,writable:!0}):o[l]=u,o}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),Ny=Dl({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/objectSpread2.js"(t,e){var n=mE();function r(l,u){var f=Object.keys(l);if(Object.getOwnPropertySymbols){var h=Object.getOwnPropertySymbols(l);u&&(h=h.filter(function(p){return Object.getOwnPropertyDescriptor(l,p).enumerable})),f.push.apply(f,h)}return f}function o(l){for(var u=1;u<arguments.length;u++){var f=arguments[u]!=null?arguments[u]:{};u%2?r(Object(f),!0).forEach(function(h){n(l,h,f[h])}):Object.getOwnPropertyDescriptors?Object.defineProperties(l,Object.getOwnPropertyDescriptors(f)):r(Object(f)).forEach(function(h){Object.defineProperty(l,h,Object.getOwnPropertyDescriptor(f,h))})}return l}e.exports=o,e.exports.__esModule=!0,e.exports.default=e.exports}});Rf(Ny());Rf(mE());var ru=Rf(Ny());function SL(t,e){if("error"in t){const r=e.deserialize(t.error);return{ok:!1,error:(0,ru.default)((0,ru.default)({},t),{},{error:r})}}return{ok:!0,result:(0,ru.default)((0,ru.default)({},t.result),(!t.result.type||t.result.type==="data")&&{type:"data",data:e.deserialize(t.result.data)})}}var dp=class extends Error{constructor(){super("Unable to transform response from server")}};function wL(t,e){let n;try{n=SL(t,e)}catch{throw new dp}if(!n.ok&&(!hl(n.error.error)||typeof n.error.error.code!="number"))throw new dp;if(n.ok&&!hl(n.result))throw new dp;return n}Rf(Ny());var su=mt(ws()),uo=mt(Zn());function xL(t){return t instanceof Lo}function TL(t){return hl(t)&&hl(t.error)&&typeof t.error.code=="number"&&typeof t.error.message=="string"}function AL(t,e){return typeof t=="string"?t:hl(t)&&typeof t.message=="string"?t.message:e}var Lo=class gu extends Error{constructor(e,n){var r,o;const l=n?.cause;super(e,{cause:l}),(0,su.default)(this,"cause",void 0),(0,su.default)(this,"shape",void 0),(0,su.default)(this,"data",void 0),(0,su.default)(this,"meta",void 0),this.meta=n?.meta,this.cause=l,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,gu.prototype)}static from(e,n={}){const r=e;return xL(r)?(n.meta&&(r.meta=(0,uo.default)((0,uo.default)({},r.meta),n.meta)),r):TL(r)?new gu(r.error.message,(0,uo.default)((0,uo.default)({},n),{},{result:r})):new gu(AL(r,"Unknown error"),(0,uo.default)((0,uo.default)({},n),{},{cause:r}))}};function EL(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 Iw=t=>typeof t=="function";function RL(t){if(t)return t;if(typeof window<"u"&&Iw(window.fetch))return window.fetch;if(typeof globalThis<"u"&&Iw(globalThis.fetch))return globalThis.fetch;throw new Error("No fetch implementation found")}var el=mt(Zn());function OL(t){return{url:t.url.toString(),fetch:t.fetch,transformer:EL(t.transformer),methodOverride:t.methodOverride}}function _L(t){const e={};for(let n=0;n<t.length;n++){const r=t[n];e[n]=r}return e}const kL={query:"GET",mutation:"POST",subscription:"PATCH"};function yE(t){return"input"in t?t.transformer.input.serialize(t.input):_L(t.inputs.map(e=>t.transformer.input.serialize(e)))}const gE=t=>{const e=t.url.split("?");let r=e[0].replace(/\/$/,"")+"/"+t.path;const o=[];if(e[1]&&o.push(e[1]),"inputs"in t&&o.push("batch=1"),t.type==="query"||t.type==="subscription"){const l=yE(t);l!==void 0&&t.methodOverride!=="POST"&&o.push(`input=${encodeURIComponent(JSON.stringify(l))}`)}return o.length&&(r+="?"+o.join("&")),r},ML=t=>{if(t.type==="query"&&t.methodOverride!=="POST")return;const e=yE(t);return e!==void 0?JSON.stringify(e):void 0},CL=t=>jL((0,el.default)((0,el.default)({},t),{},{contentTypeHeader:"application/json",getUrl:gE,getBody:ML}));var DL=class extends Error{constructor(){const t="AbortError";super(t),this.name=t,this.message=t}};const NL=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 DL};async function $L(t){var e;NL(t.signal);const n=t.getUrl(t),r=t.getBody(t),{type:o}=t,l=await(async()=>{const f=await t.headers();return Symbol.iterator in f?Object.fromEntries(f):f})(),u=(0,el.default)((0,el.default)((0,el.default)({},t.contentTypeHeader?{"content-type":t.contentTypeHeader}:{}),t.trpcAcceptHeader?{"trpc-accept":t.trpcAcceptHeader}:void 0),l);return RL(t.fetch)(n,{method:(e=t.methodOverride)!==null&&e!==void 0?e:kL[o],signal:t.signal,body:r,headers:u})}async function jL(t){const e={},n=await $L(t);e.response=n;const r=await n.json();return e.responseJSON=r,{json:r,meta:e}}mt(Zn());const Hw=()=>{throw new Error("Something went wrong. Please submit an issue at https://github.com/trpc/trpc/issues/new")};function Fw(t){let e=null,n=null;const r=()=>{clearTimeout(n),n=null,e=null};function o(f){const h=[[]];let p=0;for(;;){const v=f[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 l(){const f=o(e);r();for(const h of f){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,x)=>{const T=p.items[x];try{var D;const O=await Promise.resolve(S);(D=T.resolve)===null||D===void 0||D.call(T,O)}catch(O){var M;(M=T.reject)===null||M===void 0||M.call(T,O)}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(f){var h;const p={aborted:!1,key:f,batch:null,resolve:Hw,reject:Hw},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(l)),y}return{load:u}}function BL(...t){const e=new AbortController,n=t.length;let r=0;const o=()=>{++r===n&&e.abort()};for(const l of t)l?.aborted?o():l?.addEventListener("abort",o,{once:!0});return e.signal}var ou=mt(Zn());function LL(t){var e,n;const r=OL(t),o=(e=t.maxURLLength)!==null&&e!==void 0?e:1/0,l=(n=t.maxItems)!==null&&n!==void 0?n:1/0;return()=>{const u=y=>({validate(g){if(o===1/0&&l===1/0)return!0;if(g.length>l)return!1;const v=g.map(T=>T.path).join(","),S=g.map(T=>T.input);return gE((0,ou.default)((0,ou.default)({},r),{},{type:y,path:v,inputs:S,signal:null})).length<=o},async fetch(g){const v=g.map(O=>O.path).join(","),S=g.map(O=>O.input),x=BL(...g.map(O=>O.signal)),T=await CL((0,ou.default)((0,ou.default)({},r),{},{path:v,inputs:S,type:y,headers(){return t.headers?typeof t.headers=="function"?t.headers({opList:g}):t.headers:{}},signal:x}));return(Array.isArray(T.json)?T.json:g.map(()=>T.json)).map(O=>({meta:T.meta,json:O}))}}),f=Fw(u("query")),h=Fw(u("mutation")),p={query:f,mutation:h};return({op:y})=>Ef(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 x;return S.then(T=>{x=T;const D=wL(T.json,r.transformer.output);if(!D.ok){g.error(Lo.from(D.error,{meta:T.meta}));return}g.next({context:T.meta,result:D.result}),g.complete()}).catch(T=>{g.error(Lo.from(T,{meta:x?.meta}))}),()=>{}})}}mt(Zn());const bE=(t,...e)=>typeof t=="function"?t(...e):t;mt(ws());function VL(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}async function UL(t){const e=await bE(t.url);if(!t.connectionParams)return e;const r=`${e.includes("?")?"&":"?"}connectionParams=1`;return e+r}async function zL(t){const e={method:"connectionParams",data:await bE(t)};return JSON.stringify(e)}mt(ws());var rs=mt(ws());function KL(t){const{promise:e,resolve:n,reject:r}=VL();return t.addEventListener("open",()=>{t.removeEventListener("error",r),n()}),t.addEventListener("error",r),e}function qL(t,{intervalMs:e,pongTimeoutMs:n}){let r,o;function l(){r=setTimeout(()=>{t.send("PING"),o=setTimeout(()=>{t.close()},n)},e)}function u(){clearTimeout(r),l()}function f(){clearTimeout(o),u()}t.addEventListener("open",l),t.addEventListener("message",({data:h})=>{clearTimeout(r),l(),h==="PONG"&&f()}),t.addEventListener("close",()=>{clearTimeout(r),clearTimeout(o)})}var PL=class pm{constructor(e){var n;if((0,rs.default)(this,"id",++pm.connectCount),(0,rs.default)(this,"WebSocketPonyfill",void 0),(0,rs.default)(this,"urlOptions",void 0),(0,rs.default)(this,"keepAliveOpts",void 0),(0,rs.default)(this,"wsObservable",cL(null)),(0,rs.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=++pm.connectCount;const n=UL(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&&qL(r,e.keepAliveOpts),r.addEventListener("close",()=>{e.ws===r&&(e.ws=null)}),await KL(r),e.urlOptions.connectionParams&&r.send(await zL(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,rs.default)(PL,"connectCount",0);mt(ws());mt(Zn());var hp=mt(ws()),Gw=mt(Zn()),IL=class{constructor(t){(0,hp.default)(this,"links",void 0),(0,hp.default)(this,"runtime",void 0),(0,hp.default)(this,"requestId",void 0),this.requestId=0,this.runtime={},this.links=t.links.map(e=>e(this.runtime))}$request(t){var e;return uL({links:this.links,op:(0,Gw.default)((0,Gw.default)({},t),{},{context:(e=t.context)!==null&&e!==void 0?e:{},id:++this.requestId})}).pipe(lL())}async requestAsPromise(t){var e=this;try{const n=e.$request(t);return(await aL(n)).result.data}catch(n){throw Lo.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 l;(l=n.onConnectionStateChange)===null||l===void 0||l.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 f;(f=n.onStopped)===null||f===void 0||f.call(n);break}case"data":case void 0:{var h;(h=n.onData)===null||h===void 0||h.call(n,o.result.data);break}}},error(o){var l;(l=n.onError)===null||l===void 0||l.call(n,o)},complete(){var o;(o=n.onComplete)===null||o===void 0||o.call(n)}})}};const HL=Symbol.for("trpc_untypedClient"),FL={query:"query",mutate:"mutation",subscribe:"subscription"},GL=t=>FL[t];function YL(t){const e=yL(({path:n,args:r})=>{const o=[...n],l=GL(o.pop()),u=o.join(".");return t[l](u,...r)});return gL(n=>n===HL?t:e[n])}function XL(t){const e=new IL(t);return YL(e)}mt(Zn());mt(Zn());var JL=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/asyncIterator.js"(t,e){function n(o){var l,u,f,h=2;for(typeof Symbol<"u"&&(u=Symbol.asyncIterator,f=Symbol.iterator);h--;){if(u&&(l=o[u])!=null)return l.call(o);if(f&&(l=o[f])!=null)return new r(l.call(o));u="@@asyncIterator",f="@@iterator"}throw new TypeError("Object is not async iterable")}function r(o){function l(u){if(Object(u)!==u)return Promise.reject(new TypeError(u+" is not an object."));var f=u.done;return Promise.resolve(u.value).then(function(h){return{value:h,done:f}})}return r=function(f){this.s=f,this.n=f.next},r.prototype={s:null,n:null,next:function(){return l(this.n.apply(this.s,arguments))},return:function(f){var h=this.s.return;return h===void 0?Promise.resolve({value:f,done:!0}):l(h.apply(this.s,arguments))},throw:function(f){var h=this.s.return;return h===void 0?Promise.reject(f):l(h.apply(this.s,arguments))}},new r(o)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}});mt(JL());mt(Zn());var ZL=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(t,e){function n(){var r=typeof SuppressedError=="function"?SuppressedError:function(f,h){var p=Error();return p.name="SuppressedError",p.error=f,p.suppressed=h,p},o={},l=[];function u(f,h){if(h!=null){if(Object(h)!==h)throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");if(f)var p=h[Symbol.asyncDispose||Symbol.for("Symbol.asyncDispose")];if(p===void 0&&(p=h[Symbol.dispose||Symbol.for("Symbol.dispose")],f))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)}}),l.push({v:h,d:p,a:f})}else f&&l.push({d:h,a:f});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=l.pop();)try{if(!h.a&&y===1)return y=0,l.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(x){return v(x)}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}}),vE=bi({"../../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=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/awaitAsyncGenerator.js"(t,e){var n=vE();function r(o){return new n(o,0)}e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}}),WL=bi({"../../node_modules/.pnpm/@oxc-project+runtime@0.72.2/node_modules/@oxc-project/runtime/src/helpers/wrapAsyncGenerator.js"(t,e){var n=vE();function r(l){return function(){return new o(l.apply(this,arguments))}}function o(l){var u,f;function h(y,g){try{var v=l[y](g),S=v.value,x=S instanceof n;Promise.resolve(x?S.v:S).then(function(T){if(x){var D=y==="return"?"return":"next";if(!S.k||T.done)return h(D,T);T=l[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):f=null}this._invoke=function(y,g){return new Promise(function(v,S){var x={key:y,arg:g,resolve:v,reject:S,next:null};f?f=f.next=x:(u=f=x,h(y,g))})},typeof l.return!="function"&&(this.return=void 0)}o.prototype[typeof Symbol=="function"&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},o.prototype.next=function(l){return this._invoke("next",l)},o.prototype.throw=function(l){return this._invoke("throw",l)},o.prototype.return=function(l){return this._invoke("return",l)},e.exports=r,e.exports.__esModule=!0,e.exports.default=e.exports}});mt(ZL());mt(QL());mt(WL());mt(Zn());var eV={};function SE(t,e){if(t instanceof Promise)throw new Error(e)}function tV(t,e){const n={},r=[];for(const o in t){const l=t[o]["~standard"].validate(e[o]);if(SE(l,`Validation must be synchronous, but ${o} returned a Promise.`),l.issues){r.push(...l.issues.map(u=>({...u,message:u.message,path:[o,...u.path??[]]})));continue}n[o]=l.value}return r.length?{issues:r}:{value:n}}function nV(t){const e=t.runtimeEnvStrict??t.runtimeEnv??eV;if(t.emptyStringAsUndefined??!1)for(const[O,C]of Object.entries(e))C===""&&delete e[O];if(!!t.skipValidation)return e;const o=typeof t.client=="object"?t.client:{},l=typeof t.server=="object"?t.server:{},u=typeof t.shared=="object"?t.shared:{},f=t.isServer??(typeof window>"u"||"Deno"in window),h=f?{...l,...u,...o}:{...o,...u},p=t.createFinalSchema?.(h,f)["~standard"].validate(e)??tV(h,e);SE(p,"Validation must be synchronous");const y=t.onValidationError??(O=>{throw console.error("❌ Invalid environment variables:",O),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=O=>t.clientPrefix?!O.startsWith(t.clientPrefix)&&!(O in u):!0,S=O=>f||!v(O),x=O=>O==="__esModule"||O==="$$typeof",T=(t.extends??[]).reduce((O,C)=>Object.assign(O,C),{}),D=Object.assign(T,p.value);return new Proxy(D,{get(O,C){if(typeof C=="string"&&!x(C))return S(C)?Reflect.get(O,C):g(C)}})}const iV={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BACKEND_ORIGIN:"https://realtime.tempest.games"},rV="__vite_start_time"in globalThis,sV=typeof window<"u",ji=wt("string"),Yw=wt('"true" | "false" | undefined'),wE=nV({isServer:!rV&&!sV,server:{CI:wt("string | undefined").pipe(Boolean),POSTGRES_USER:ji,POSTGRES_PASSWORD:ji,POSTGRES_DATABASE:ji,POSTGRES_HOST:ji,POSTGRES_PORT:ji.pipe(t=>Number.parseInt(t,10)),BACKEND_PORT:ji.pipe(t=>Number.parseInt(t,10)),RUN_WORKERS_FROM_SOURCE:Yw.pipe(t=>t==="true"),FRONTEND_PORT:ji.pipe(t=>Number.parseInt(t,10)),FRONTEND_ORIGINS:ji.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:ji,VITE_DEV_FRONTEND_HOST:wt("string | undefined"),VITE_DEV_HTTPS:Yw.pipe(t=>t==="true")},runtimeEnv:iV,emptyStringAsUndefined:!0}),on=XL({links:[LL({url:wE.VITE_BACKEND_ORIGIN,fetch(t,e){return e?(Object.assign(e,{credentials:"include"}),fetch(t,e)):fetch(t)}})]}),oV=ct({key:"appVersionQuery",default:on.version.query});ct({key:"lastKnownVersion",default:null,effects:[K1(localStorage,JSON,"lastKnownVersion")]});const aV=pi({key:"appVersion",get:async({get:t})=>{const e=t(oV),{version:n}=await e;return n}});function pp(t){return["optional",t]}function lV(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 l=[],u=o[1],f=u[r];f!==void 0&&l.push(f);const h=Object.keys(u).find(p=>p.startsWith("$"));if(h){const p=u[h];p&&l.push(p)}return l})}for(const r of n)if(r===null||r[0]==="optional")return!0;return!1}const di=Object.create(null);di.open="0";di.close="1";di.ping="2";di.pong="3";di.message="4";di.upgrade="5";di.noop="6";const bu=Object.create(null);Object.keys(di).forEach(t=>{bu[di[t]]=t});const mm={type:"error",data:"parser error"},xE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",TE=typeof ArrayBuffer=="function",AE=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,$y=({type:t,data:e},n,r)=>xE&&e instanceof Blob?n?r(e):Xw(e,r):TE&&(e instanceof ArrayBuffer||AE(e))?n?r(e):Xw(new Blob([e]),r):r(di[t]+(e||"")),Xw=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function Jw(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let mp;function cV(t,e){if(xE&&t.data instanceof Blob)return t.data.arrayBuffer().then(Jw).then(e);if(TE&&(t.data instanceof ArrayBuffer||AE(t.data)))return e(Jw(t.data));$y(t,!1,n=>{mp||(mp=new TextEncoder),e(mp.encode(n))})}const Zw="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Za=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<Zw.length;t++)Za[Zw.charCodeAt(t)]=t;const uV=t=>{let e=t.length*.75,n=t.length,r,o=0,l,u,f,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)l=Za[t.charCodeAt(r)],u=Za[t.charCodeAt(r+1)],f=Za[t.charCodeAt(r+2)],h=Za[t.charCodeAt(r+3)],y[o++]=l<<2|u>>4,y[o++]=(u&15)<<4|f>>2,y[o++]=(f&3)<<6|h&63;return p},fV=typeof ArrayBuffer=="function",jy=(t,e)=>{if(typeof t!="string")return{type:"message",data:EE(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:dV(t.substring(1),e)}:bu[n]?t.length>1?{type:bu[n],data:t.substring(1)}:{type:bu[n]}:mm},dV=(t,e)=>{if(fV){const n=uV(t);return EE(n,e)}else return{base64:!0,data:t}},EE=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},RE="",hV=(t,e)=>{const n=t.length,r=new Array(n);let o=0;t.forEach((l,u)=>{$y(l,!1,f=>{r[u]=f,++o===n&&e(r.join(RE))})})},pV=(t,e)=>{const n=t.split(RE),r=[];for(let o=0;o<n.length;o++){const l=jy(n[o],e);if(r.push(l),l.type==="error")break}return r};function mV(){return new TransformStream({transform(t,e){cV(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 l=new DataView(o.buffer);l.setUint8(0,126),l.setUint16(1,r)}else{o=new Uint8Array(9);const l=new DataView(o.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(o[0]|=128),e.enqueue(o),e.enqueue(n)})}})}let yp;function au(t){return t.reduce((e,n)=>e+n.length,0)}function lu(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 yV(t,e){yp||(yp=new TextDecoder);const n=[];let r=0,o=-1,l=!1;return new TransformStream({transform(u,f){for(n.push(u);;){if(r===0){if(au(n)<1)break;const h=lu(n,1);l=(h[0]&128)===128,o=h[0]&127,o<126?r=3:o===126?r=1:r=2}else if(r===1){if(au(n)<2)break;const h=lu(n,2);o=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),r=3}else if(r===2){if(au(n)<8)break;const h=lu(n,8),p=new DataView(h.buffer,h.byteOffset,h.length),y=p.getUint32(0);if(y>Math.pow(2,21)-1){f.enqueue(mm);break}o=y*Math.pow(2,32)+p.getUint32(4),r=3}else{if(au(n)<o)break;const h=lu(n,o);f.enqueue(jy(l?h:yp.decode(h),e)),r=0}if(o===0||o>t){f.enqueue(mm);break}}}})}const OE=4;function xt(t){if(t)return gV(t)}function gV(t){for(var e in xt.prototype)t[e]=xt.prototype[e];return t}xt.prototype.on=xt.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};xt.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};xt.prototype.off=xt.prototype.removeListener=xt.prototype.removeAllListeners=xt.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};xt.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};xt.prototype.emitReserved=xt.prototype.emit;xt.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};xt.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Of=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")(),bV="arraybuffer";function _E(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const vV=Vn.setTimeout,SV=Vn.clearTimeout;function _f(t,e){e.useNativeTimers?(t.setTimeoutFn=vV.bind(Vn),t.clearTimeoutFn=SV.bind(Vn)):(t.setTimeoutFn=Vn.setTimeout.bind(Vn),t.clearTimeoutFn=Vn.clearTimeout.bind(Vn))}const wV=1.33;function xV(t){return typeof t=="string"?TV(t):Math.ceil((t.byteLength||t.size)*wV)}function TV(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 kE(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function AV(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function EV(t){let e={},n=t.split("&");for(let r=0,o=n.length;r<o;r++){let l=n[r].split("=");e[decodeURIComponent(l[0])]=decodeURIComponent(l[1])}return e}class RV extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class By extends xt{constructor(e){super(),this.writable=!1,_f(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 RV(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=jy(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=AV(e);return n.length?"?"+n:""}}class OV extends By{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)};pV(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,hV(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]=kE()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let ME=!1;try{ME=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const _V=ME;function kV(){}class MV extends OV{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,l)=>{this.onError("xhr post error",o,l)})}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 Ro=class vu extends xt{constructor(e,n,r){super(),this.createRequest=e,_f(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=_E(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=vu.requestsCount++,vu.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=kV,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete vu.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()}};Ro.requestsCount=0;Ro.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Qw);else if(typeof addEventListener=="function"){const t="onpagehide"in Vn?"pagehide":"unload";addEventListener(t,Qw,!1)}}function Qw(){for(let t in Ro.requests)Ro.requests.hasOwnProperty(t)&&Ro.requests[t].abort()}const CV=(function(){const t=CE({xdomain:!1});return t&&t.responseType!==null})();class DV extends MV{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=CV&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ro(CE,this.uri(),e)}}function CE(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||_V))return new XMLHttpRequest}catch{}if(!e)try{return new Vn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const DE=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class NV extends By{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=DE?{}:_E(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;$y(r,this.supportsBinary,l=>{try{this.doWrite(r,l)}catch{}o&&Of(()=>{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]=kE()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const gp=Vn.WebSocket||Vn.MozWebSocket;class $V extends NV{createSocket(e,n,r){return DE?new gp(e,n,r):n?new gp(e,n):new gp(e)}doWrite(e,n){this.ws.send(n)}}class jV extends By{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=yV(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),o=mV();o.readable.pipeTo(e.writable),this._writer=o.writable.getWriter();const l=()=>{r.read().then(({done:f,value:h})=>{f||(this.onPacket(h),l())}).catch(f=>{})};l();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&&Of(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const BV={websocket:$V,webtransport:jV,polling:DV},LV=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,VV=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function ym(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=LV.exec(t||""),l={},u=14;for(;u--;)l[VV[u]]=o[u]||"";return n!=-1&&r!=-1&&(l.source=e,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=UV(l,l.path),l.queryKey=zV(l,l.query),l}function UV(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 zV(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,o,l){o&&(n[o]=l)}),n}const gm=typeof addEventListener=="function"&&typeof removeEventListener=="function",Su=[];gm&&addEventListener("offline",()=>{Su.forEach(t=>t())},!1);class _r extends xt{constructor(e,n){if(super(),this.binaryType=bV,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=ym(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=ym(n.host).host);_f(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=EV(this.opts.query)),gm&&(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"})},Su.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=OE,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&&_r.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",_r.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+=xV(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,Of(()=>{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 l={type:e,data:n,options:r};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),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(_r.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(),gm&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Su.indexOf(this._offlineEventListener);r!==-1&&Su.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}_r.protocol=OE;class KV extends _r{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;_r.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;_r.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 l(){r||(r=!0,y(),n.close(),n=null)}const u=g=>{const v=new Error("probe error: "+g);v.transport=n.name,l(),this.emitReserved("upgradeError",v)};function f(){u("transport closed")}function h(){u("socket closed")}function p(g){n&&g.name!==n.name&&l()}const y=()=>{n.removeListener("open",o),n.removeListener("error",u),n.removeListener("close",f),this.off("close",h),this.off("upgrading",p)};n.once("open",o),n.once("error",u),n.once("close",f),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 qV=class extends KV{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=>BV[o]).filter(o=>!!o)),super(e,r)}};function PV(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=ym(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 l=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+l+":"+r.port+e,r.href=r.protocol+"://"+l+(n&&n.port===r.port?"":":"+r.port),r}const IV=typeof ArrayBuffer=="function",HV=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,NE=Object.prototype.toString,FV=typeof Blob=="function"||typeof Blob<"u"&&NE.call(Blob)==="[object BlobConstructor]",GV=typeof File=="function"||typeof File<"u"&&NE.call(File)==="[object FileConstructor]";function Ly(t){return IV&&(t instanceof ArrayBuffer||HV(t))||FV&&t instanceof Blob||GV&&t instanceof File}function wu(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(wu(t[n]))return!0;return!1}if(Ly(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return wu(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&wu(t[n]))return!0;return!1}function YV(t){const e=[],n=t.data,r=t;return r.data=bm(n,e),r.attachments=e.length,{packet:r,buffers:e}}function bm(t,e){if(!t)return t;if(Ly(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]=bm(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]=bm(t[r],e));return n}return t}function XV(t,e){return t.data=vm(t.data,e),delete t.attachments,t}function vm(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]=vm(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=vm(t[n],e));return t}const JV=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],ZV=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 QV{constructor(e){this.replacer=e}encode(e){return(e.type===ke.EVENT||e.type===ke.ACK)&&wu(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=YV(e),r=this.encodeAsString(n.packet),o=n.buffers;return o.unshift(r),o}}function Ww(t){return Object.prototype.toString.call(t)==="[object Object]"}class Vy extends xt{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 WV(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(Ly(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 l=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const u=e.substring(l,n);if(u!=Number(u)||e.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(u)}if(e.charAt(n+1)==="/"){const l=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(l,n)}else r.nsp="/";const o=e.charAt(n+1);if(o!==""&&Number(o)==o){const l=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(l,n+1))}if(e.charAt(++n)){const l=this.tryParse(e.substr(n));if(Vy.isPayloadValid(r.type,l))r.data=l;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 Ww(n);case ke.DISCONNECT:return n===void 0;case ke.CONNECT_ERROR:return typeof n=="string"||Ww(n);case ke.EVENT:case ke.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&JV.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 WV{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=XV(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const eU=Object.freeze(Object.defineProperty({__proto__:null,Decoder:Vy,Encoder:QV,get PacketType(){return ke},protocol:ZV},Symbol.toStringTag,{value:"Module"}));function Gn(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const tU=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class $E extends xt{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,l;if(tU.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 f=(o=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||o===void 0?void 0:o.writable,h=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!f||(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 l=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===e&&this.sendBuffer.splice(f,1);n.call(this,new Error("operation has timed out"))},o),u=(...f)=>{this.io.clearTimeoutFn(l),n.apply(this,f)};u.withError=!0,this.acks[e]=u}emitWithAck(e,...n){return new Promise((r,o)=>{const l=(u,f)=>u?o(u):r(f);l.withError=!0,n.push(l),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,...l)=>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,...l)),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 Io(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}Io.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};Io.prototype.reset=function(){this.attempts=0};Io.prototype.setMin=function(t){this.ms=t};Io.prototype.setMax=function(t){this.max=t};Io.prototype.setJitter=function(t){this.jitter=t};class Sm extends xt{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,_f(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 Io({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||eU;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 qV(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()}),l=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),e?e(f):this.maybeReconnectOnOpen()},u=Gn(n,"error",l);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{o(),l(new Error("timeout")),n.close()},f);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){Of(()=>{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 $E(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 Ga={};function xu(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=PV(t,e.path||"/socket.io"),r=n.source,o=n.id,l=n.path,u=Ga[o]&&l in Ga[o].nsps,f=e.forceNew||e["force new connection"]||e.multiplex===!1||u;let h;return f?h=new Sm(r,e):(Ga[o]||(Ga[o]=new Sm(r,e)),h=Ga[o]),n.query&&!e.query&&(e.query=n.queryKey),h.socket(n.path,e)}Object.assign(xu,{Manager:Sm,Socket:$E,io:xu,connect:xu});const nU=["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"],iU=3,rU=15,sU=/^[a-zA-Z0-9_-]+$/,oU=wt(sU).pipe(wt(`string > ${iU} & string < ${rU}`)).brand("username"),ex=20,tx={0:"o",1:"l",3:"e",4:"a",5:"s",7:"t","@":"a",$:"s","!":"i"};function aU(t){let e="";for(const n of t)n in tx?e+=tx[n]:e+=n;return e}function lU(t){const e=t.toLocaleLowerCase(),n=aU(e);for(const r of nU)if(n.includes(r)||e.includes(r))return!0;return!1}function cU(t){const e=new Set(t).size;return t.length*Math.log2(e)}function uU(t){let e=0;return lU(t)&&(e-=100),e+=cU(t)*.5,Math.max(e,0)}const fU=wt("string").narrow((t,e)=>{const n=uU(t);return n>=ex?!0:e.mustBe(`Of complexity ${ex} or more. Was ${n.toFixed(2)}.`)}).brand("password");wt({"+":"delete",email:"string",password:"string"});const dU=wt("string").brand("email");wt({"+":"delete",username:"string",password:"string",email:"string"});const hU=wt({email:"string",userId:"string",username:"string",password:"boolean",verification:"'unverified' | 'verified'"}),hi=xu(wE.VITE_BACKEND_ORIGIN,{auth:t=>{const e=Ze(at);e&&t(e)},withCredentials:!0,autoConnect:!1});hi.on("connect",()=>{console.log("connected")}).on("connect_error",()=>{console.log("connect_error"),De(at,null)}).on("usernameChanged",t=>{De(at,e=>e===null?null:{...e,username:t})});const at=ct({key:"auth",default:function(){const e=localStorage.getItem("auth");if(e)try{const n=Nr(e),r=hU(n);return r instanceof wt.errors?(console.error("failed to parse auth data",r),null):(r.verification==="verified"&&(console.log("connecting..."),hi.connect()),r)}catch(n){return console.error("failed to parse auth data",n),null}return null},effects:[function({onSet:e}){e(({newValue:n})=>{console.log("setting auth",n),n?(console.log("setting auth",n),De(Oo,n.username),localStorage.setItem("auth",Ge(n)),n.verification==="verified"?(console.log("connecting..."),hi.connect()):ys("/verify")):(console.log("clearing session..."),localStorage.removeItem("auth"))})}]}),Oo=ct({key:"username",default:Ze(at)?.username??""}),bp=ct({key:"usernameDebounce",default:!0}),pU=ct({key:"usernameDebounced100ms",default:window.localStorage.getItem("username")??"",effects:[({setSelf:t})=>{Yk(Oo,()=>{Ze(bp)&&(t(Ze(Oo)),De(bp,!1),setTimeout(()=>{De(bp,!0),t(Ze(Oo))},2e3))})}]}),mU=pi({key:"isUsernameTakenQuery",get:({get:t})=>{const e=t(pU);if(!e)return!1;const n=Ze(at);return e===n?.username?!1:on.isUsernameTaken.query({username:e})}}),jE=pi({key:"usernameIssues",get:({get:t})=>{const e=t(Oo),n=oU(e);return n instanceof wt.errors?n:null}}),ai=ct({key:"password0",default:""}),BE=pi({key:"password0Issues",get:({get:t})=>{const e=t(ai),n=fU(e);return n instanceof wt.errors?n:null}}),Vo=ct({key:"email",default:""}),LE=pi({key:"emailIssues",get:({get:t})=>{const e=t(Vo),n=dU(e);return n instanceof wt.errors?n:null}});pi({key:"signupReady",get:({get:t})=>{const e=t(jE),n=t(BE),r=t(LE);return!(e??n??r)}});const zi=ct({key:"oneTimeCode",default:""}),wm=ct({key:"oneTimeCodeNewEmail",default:""}),si=ct({key:"authTarget",default:null}),VE=pp({verify:pp({$token:null}),game:pp({clicker:null}),account:null,admin:null});function yU(t){return lV(VE,t)}const gU=[[]];function bU(t){return gU.some(e=>e.join("/")===t.join("/"))}function ys(t){history.pushState(null,"",t),De(UE,t)}const UE=ct({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 l=Ze(at);switch(console.log("/","auth",l),l?.verification){case"verified":n("/game");break;case"unverified":n("/verify");break}break}case"/verify":{Ze(at)?.verification==="verified"&&n("/game");break}case"/game":case"/game/clicker":{Ze(at)?.verification==="unverified"&&n("/verify");break}case"/admin":break;case"/account":{const l=Ze(at);if(!l){n("/");break}l.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)})}]}),vU=pi({key:"route",get:({get:t})=>{const n=t(UE).split("/").slice(1).filter(Boolean);return yU(n)?bU(n)||t(at)?n:401:404}}),nx=ct({key:"buttonBlockActive",default:!1}),jn=ct({key:"editing",default:[],effects:[({onSet:t})=>{t(({newValue:e})=>{switch(e[0]){case"email":{Ze(zE)?.focus();break}case"new-password":{Ze(KE)?.focus();break}case"username":{Ze(qE)?.focus();break}}})}]}),zE=ct({key:"emailInputElement",default:null}),KE=ct({key:"password0InputElement",default:null}),qE=ct({key:"usernameInputElement",default:null});function SU(t){const e=V.useRef(null);return V.useEffect(()=>{De(t,e.current)},[t]),e}const wU=pi({key:"otcLoginFieldLabel",get:({get:t})=>{const e=t(at);return e?`Code sent to ${e.email}`:""}}),xU=pi({key:"otcVerifyFieldLabel",get:({get:t})=>{const e=t(Vo);return e?`Code sent to ${e}`:""}});function vp({label:t,inputToken:e,issuesToken:n,inputElementToken:r,initialState:o,onSubmit:l,onOpen:u,onCancel:f,extraIssues:h}){const p=St(e),y=Yn(e),g=St(zi),v=Yn(zi),S=St(wm),x=Yn(wm),T=St(ai),D=Yn(ai),M=St(nx),O=Yn(nx),C=St(jn),j=Yn(jn),_=St(n),J=St(wU),Y=St(xU),F=SU(r),ee=C[0]===t,re=C.at(-1),[ue,...ge]=C;return G.jsxs("form",{onSubmit:async be=>{if(be.preventDefault(),M){O(!1);return}console.log(`submitted! changing ${t} to`,p);const Q=await l(p);Error.isError(Q)&&console.error(Q)},children:[ee?G.jsx("button",{type:"button",onClick:async()=>{await f?.(),j([])},children:"x"}):null,G.jsxs("main",{children:[G.jsxs("label",{htmlFor:t,children:[_||h?G.jsxs("aside",{children:[h,_?.map(be=>G.jsx("span",{children:be.message},be.path.join(".")))]}):null,G.jsx("span",{children:t==="new-password"?"Password":bn(t)}),G.jsx("input",{id:t,type:t==="new-password"?"password":"text",ref:F,value:p,onChange:be=>{y(be.target.value)},autoComplete:t,autoCapitalize:"none",disabled:re!==t})]}),ee?ge.map(be=>G.jsxs("label",{htmlFor:`${t}-${be}`,children:[G.jsx("span",{children:(()=>{switch(be){case"otcLogin":return J;case"otcVerify":return Y;case"passwordLogin":return"Password"}})()}),G.jsx("input",{id:`${t}-otc`,type:"text",ref:F,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"){x(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!==re})]},`${t}-${be}`)):null]}),C[0]===t?G.jsx("button",{type:"submit",children:"->"}):G.jsx("button",{type:"button",onMouseDown:async()=>{O(!0),await u?.(),j(o)},onMouseUp:()=>{O(!1)},children:"/"})]})}function TU(){const t=St(at),e=St(mU);return ku(()=>{t&&De(Vo,t.email),t?.password&&De(ai,"••••••••••••")}),t?G.jsxs("article",{"data-css":"editor",children:[G.jsx(vp,{label:"username",inputToken:Oo,issuesToken:jE,inputElementToken:qE,initialState:["username"],onSubmit:async n=>(await new Promise(r=>{hi.once("usernameChanged",r),hi.emit("changeUsername",n)}),De(jn,[]),n),extraIssues:e?G.jsx("span",{children:"This username is taken."}):null}),G.jsx(vp,{label:"email",inputToken:Vo,issuesToken:LE,inputElementToken:zE,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:l}=await on.offerNewEmail.mutate({emailOffered:n});switch(console.log({authTarget:o,nextStep:l}),l){case"otc_login":{De(si,o),De(jn,["email","otcLogin"]);break}case"password_login":{De(si,o),De(jn,["email","passwordLogin"]);break}case"otc_verify":{De(si,o),De(zi,"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(si);if(!o)return new Error("No auth target");const l=Ze(zi),u=await on.verifyAccountAction.mutate({oneTimeCode:l,userKey:o});return De(at,u),De(jn,["email","otcLogin","otcVerify"]),o}case"passwordLogin":return new Error("not implemented")}break;case 3:{const o=Ze(si);if(!o)return new Error("No auth target");const l=Ze(wm),u=await on.verifyAccountAction.mutate({oneTimeCode:l,userKey:o});return De(at,u),De(jn,[]),u.email}}}}),G.jsx(vp,{label:"new-password",inputToken:ai,issuesToken:BE,inputElementToken:KE,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 on.setPassword.mutate({password:n}),De(ai,"••••••••••••"),De(at,o=>o&&{...o,password:!0}),De(jn,[]),"done";case 2:{const o=Ze(si);return o?(await on.verifyAccountAction.mutate({oneTimeCode:Ze(zi),userKey:o}),De(at,l=>l&&{...l,password:!1}),De(ai,""),De(jn,["new-password"]),"done"):new Error("No userKey")}}},onCancel:()=>{t.password&&De(ai,"••••••••••••")},onOpen:async()=>{if(t.password){const n=Ze(si);if(!n)return new Error("No userKey");await on.startPasswordReset.mutate({userKey:n})}}})]}):G.jsx("p",{children:"You must be logged in to verify your account."})}function AU(){return G.jsx("article",{children:G.jsx("h1",{children:"admin"})})}var EU=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")}},RU=class xm{type="continuity";globals=[];actions=[];perspectives=[];key;constructor(e){this.key=e}static existing=new EU;static create(e,n){const r=new xm(e),{type:o,globals:l,actions:u,perspectives:f}=n(r),h={type:o,key:e,globals:l,actions:u,perspectives:f};return xm.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 OU(t){const{key:e,config:n}=t,r=RU.create(e,n),{actions:o}=r;for(const l of o)O1(Bt.STORE,e,l.key);return Xm(Bt.STORE,e,-1),r}p1({key:"usersInRoomIndex",class:Im});p1({key:"roomIndex",class:Im});const _U={enteredAtEpoch:0},kU=qk({key:"usersInRooms",between:["room","user"],cardinality:"1:n",isAType:t=>typeof t=="string",isBType:t=>typeof t=="string"},_U);Gk({key:"usersInMyRoomView",get:t=>({find:e})=>{const n=Pk(kU);return[e(n,t)]}});const Uy=ct({key:"count",default:0}),PE=Xk({key:"incrementTX",do:({set:t})=>{t(Uy,e=>e+1)}}),MU=OU({key:"countContinuity",config:t=>t.add(Uy).add(PE)});function CU({route:[,t]}){return G.jsx("article",{children:t?G.jsx(NU,{gameId:t}):G.jsx(DU,{})})}function DU(){return G.jsx("nav",{children:G.jsx(oE,{href:"/game/clicker",children:"Clicker"})})}Kk(VE[1].game[1]);function NU({gameId:t}){console.log(t);const e=St(Uy),n=Jk(PE);return JM(MU),G.jsxs("article",{children:[G.jsxs("button",{type:"button",onClick:()=>{n()},children:["count is ",e]}),G.jsx("p",{children:"Let's see how high we can count!"})]})}const IE=V.createContext({});function $U(t){const e=V.useRef(null);return e.current===null&&(e.current=t()),e.current}const zy=typeof window<"u",jU=zy?V.useLayoutEffect:V.useEffect,Ky=V.createContext(null);function qy(t,e){t.indexOf(e)===-1&&t.push(e)}function Py(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Fi=(t,e,n)=>n>e?e:n<t?t:n;let Iy=()=>{};const Gi={},HE=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function FE(t){return typeof t=="object"&&t!==null}const GE=t=>/^0[^.\s]+$/u.test(t);function Hy(t){let e;return()=>(e===void 0&&(e=t()),e)}const Un=t=>t,BU=(t,e)=>n=>e(t(n)),Nl=(...t)=>t.reduce(BU),pl=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class Fy{constructor(){this.subscriptions=[]}add(e){return qy(this.subscriptions,e),()=>Py(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 l=0;l<o;l++){const u=this.subscriptions[l];u&&u(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const ci=t=>t*1e3,ui=t=>t/1e3;function YE(t,e){return e?t*(1e3/e):0}const XE=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,LU=1e-7,VU=12;function UU(t,e,n,r,o){let l,u,f=0;do u=e+(n-e)/2,l=XE(u,r,o)-t,l>0?n=u:e=u;while(Math.abs(l)>LU&&++f<VU);return u}function $l(t,e,n,r){if(t===e&&n===r)return Un;const o=l=>UU(l,0,1,t,n);return l=>l===0||l===1?l:XE(o(l),e,r)}const JE=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,ZE=t=>e=>1-t(1-e),QE=$l(.33,1.53,.69,.99),Gy=ZE(QE),WE=JE(Gy),eR=t=>(t*=2)<1?.5*Gy(t):.5*(2-Math.pow(2,-10*(t-1))),Yy=t=>1-Math.sin(Math.acos(t)),tR=ZE(Yy),nR=JE(Yy),zU=$l(.42,0,1,1),KU=$l(0,0,.58,1),iR=$l(.42,0,.58,1),qU=t=>Array.isArray(t)&&typeof t[0]!="number",rR=t=>Array.isArray(t)&&typeof t[0]=="number",PU={linear:Un,easeIn:zU,easeInOut:iR,easeOut:KU,circIn:Yy,circInOut:nR,circOut:tR,backIn:Gy,backInOut:WE,backOut:QE,anticipate:eR},IU=t=>typeof t=="string",ix=t=>{if(rR(t)){Iy(t.length===4);const[e,n,r,o]=t;return $l(e,n,r,o)}else if(IU(t))return PU[t];return t},cu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function HU(t,e){let n=new Set,r=new Set,o=!1,l=!1;const u=new WeakSet;let f={delta:0,timestamp:0,isProcessing:!1};function h(y){u.has(y)&&(p.schedule(y),t()),y(f)}const p={schedule:(y,g=!1,v=!1)=>{const x=v&&o?n:r;return g&&u.add(y),x.has(y)||x.add(y),y},cancel:y=>{r.delete(y),u.delete(y)},process:y=>{if(f=y,o){l=!0;return}o=!0,[n,r]=[r,n],n.forEach(h),n.clear(),o=!1,l&&(l=!1,p.process(y))}};return p}const FU=40;function sR(t,e){let n=!1,r=!0;const o={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,u=cu.reduce((C,j)=>(C[j]=HU(l),C),{}),{setup:f,read:h,resolveKeyframes:p,preUpdate:y,update:g,preRender:v,render:S,postRender:x}=u,T=()=>{const C=Gi.useManualTiming?o.timestamp:performance.now();n=!1,Gi.useManualTiming||(o.delta=r?1e3/60:Math.max(Math.min(C-o.timestamp,FU),1)),o.timestamp=C,o.isProcessing=!0,f.process(o),h.process(o),p.process(o),y.process(o),g.process(o),v.process(o),S.process(o),x.process(o),o.isProcessing=!1,n&&e&&(r=!1,t(T))},D=()=>{n=!0,r=!0,o.isProcessing||t(T)};return{schedule:cu.reduce((C,j)=>{const _=u[j];return C[j]=(J,Y=!1,F=!1)=>(n||D(),_.schedule(J,Y,F)),C},{}),cancel:C=>{for(let j=0;j<cu.length;j++)u[cu[j]].cancel(C)},state:o,steps:u}}const{schedule:We,cancel:Cr,state:zt,steps:Sp}=sR(typeof requestAnimationFrame<"u"?requestAnimationFrame:Un,!0);let Tu;function GU(){Tu=void 0}const an={now:()=>(Tu===void 0&&an.set(zt.isProcessing||Gi.useManualTiming?zt.timestamp:performance.now()),Tu),set:t=>{Tu=t,queueMicrotask(GU)}},oR=t=>e=>typeof e=="string"&&e.startsWith(t),Xy=oR("--"),YU=oR("var(--"),Jy=t=>YU(t)?XU.test(t.split("/*")[0].trim()):!1,XU=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Ho={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},ml={...Ho,transform:t=>Fi(0,1,t)},uu={...Ho,default:1},tl=t=>Math.round(t*1e5)/1e5,Zy=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function JU(t){return t==null}const ZU=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Qy=(t,e)=>n=>!!(typeof n=="string"&&ZU.test(n)&&n.startsWith(t)||e&&!JU(n)&&Object.prototype.hasOwnProperty.call(n,e)),aR=(t,e,n)=>r=>{if(typeof r!="string")return r;const[o,l,u,f]=r.match(Zy);return{[t]:parseFloat(o),[e]:parseFloat(l),[n]:parseFloat(u),alpha:f!==void 0?parseFloat(f):1}},QU=t=>Fi(0,255,t),wp={...Ho,transform:t=>Math.round(QU(t))},as={test:Qy("rgb","red"),parse:aR("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+wp.transform(t)+", "+wp.transform(e)+", "+wp.transform(n)+", "+tl(ml.transform(r))+")"};function WU(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 Tm={test:Qy("#"),parse:WU,transform:as.transform},jl=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),wr=jl("deg"),fi=jl("%"),ye=jl("px"),e4=jl("vh"),t4=jl("vw"),rx={...fi,parse:t=>fi.parse(t)/100,transform:t=>fi.transform(t*100)},yo={test:Qy("hsl","hue"),parse:aR("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+fi.transform(tl(e))+", "+fi.transform(tl(n))+", "+tl(ml.transform(r))+")"},vt={test:t=>as.test(t)||Tm.test(t)||yo.test(t),parse:t=>as.test(t)?as.parse(t):yo.test(t)?yo.parse(t):Tm.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?as.transform(t):yo.transform(t),getAnimatableNone:t=>{const e=vt.parse(t);return e.alpha=0,vt.transform(e)}},n4=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function i4(t){return isNaN(t)&&typeof t=="string"&&(t.match(Zy)?.length||0)+(t.match(n4)?.length||0)>0}const lR="number",cR="color",r4="var",s4="var(",sx="${}",o4=/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 yl(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},o=[];let l=0;const f=e.replace(o4,h=>(vt.test(h)?(r.color.push(l),o.push(cR),n.push(vt.parse(h))):h.startsWith(s4)?(r.var.push(l),o.push(r4),n.push(h)):(r.number.push(l),o.push(lR),n.push(parseFloat(h))),++l,sx)).split(sx);return{values:n,split:f,indexes:r,types:o}}function uR(t){return yl(t).values}function fR(t){const{split:e,types:n}=yl(t),r=e.length;return o=>{let l="";for(let u=0;u<r;u++)if(l+=e[u],o[u]!==void 0){const f=n[u];f===lR?l+=tl(o[u]):f===cR?l+=vt.transform(o[u]):l+=o[u]}return l}}const a4=t=>typeof t=="number"?0:vt.test(t)?vt.getAnimatableNone(t):t;function l4(t){const e=uR(t);return fR(t)(e.map(a4))}const Dr={test:i4,parse:uR,createTransformer:fR,getAnimatableNone:l4};function xp(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 c4({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let o=0,l=0,u=0;if(!e)o=l=u=n;else{const f=n<.5?n*(1+e):n+e-n*e,h=2*n-f;o=xp(h,f,t+1/3),l=xp(h,f,t),u=xp(h,f,t-1/3)}return{red:Math.round(o*255),green:Math.round(l*255),blue:Math.round(u*255),alpha:r}}function Yu(t,e){return n=>n>0?e:t}const nt=(t,e,n)=>t+(e-t)*n,Tp=(t,e,n)=>{const r=t*t,o=n*(e*e-r)+r;return o<0?0:Math.sqrt(o)},u4=[Tm,as,yo],f4=t=>u4.find(e=>e.test(t));function ox(t){const e=f4(t);if(!e)return!1;let n=e.parse(t);return e===yo&&(n=c4(n)),n}const ax=(t,e)=>{const n=ox(t),r=ox(e);if(!n||!r)return Yu(t,e);const o={...n};return l=>(o.red=Tp(n.red,r.red,l),o.green=Tp(n.green,r.green,l),o.blue=Tp(n.blue,r.blue,l),o.alpha=nt(n.alpha,r.alpha,l),as.transform(o))},Am=new Set(["none","hidden"]);function d4(t,e){return Am.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function h4(t,e){return n=>nt(t,e,n)}function Wy(t){return typeof t=="number"?h4:typeof t=="string"?Jy(t)?Yu:vt.test(t)?ax:y4:Array.isArray(t)?dR:typeof t=="object"?vt.test(t)?ax:p4:Yu}function dR(t,e){const n=[...t],r=n.length,o=t.map((l,u)=>Wy(l)(l,e[u]));return l=>{for(let u=0;u<r;u++)n[u]=o[u](l);return n}}function p4(t,e){const n={...t,...e},r={};for(const o in n)t[o]!==void 0&&e[o]!==void 0&&(r[o]=Wy(t[o])(t[o],e[o]));return o=>{for(const l in r)n[l]=r[l](o);return n}}function m4(t,e){const n=[],r={color:0,var:0,number:0};for(let o=0;o<e.values.length;o++){const l=e.types[o],u=t.indexes[l][r[l]],f=t.values[u]??0;n[o]=f,r[l]++}return n}const y4=(t,e)=>{const n=Dr.createTransformer(e),r=yl(t),o=yl(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?Am.has(t)&&!o.values.length||Am.has(e)&&!r.values.length?d4(t,e):Nl(dR(m4(r,o),o.values),n):Yu(t,e)};function hR(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?nt(t,e,n):Wy(t)(t,e)}const g4=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>We.update(e,n),stop:()=>Cr(e),now:()=>zt.isProcessing?zt.timestamp:an.now()}},pR=(t,e,n=10)=>{let r="";const o=Math.max(Math.round(e/n),2);for(let l=0;l<o;l++)r+=Math.round(t(l/(o-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},Xu=2e4;function eg(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<Xu;)e+=n,r=t.next(e);return e>=Xu?1/0:e}function b4(t,e=100,n){const r=n({...t,keyframes:[0,e]}),o=Math.min(eg(r),Xu);return{type:"keyframes",ease:l=>r.next(o*l).value/e,duration:ui(o)}}const v4=5;function mR(t,e,n){const r=Math.max(e-v4,0);return YE(n-t(r),e-r)}const ot={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},Ap=.001;function S4({duration:t=ot.duration,bounce:e=ot.bounce,velocity:n=ot.velocity,mass:r=ot.mass}){let o,l,u=1-e;u=Fi(ot.minDamping,ot.maxDamping,u),t=Fi(ot.minDuration,ot.maxDuration,ui(t)),u<1?(o=p=>{const y=p*u,g=y*t,v=y-n,S=Em(p,u),x=Math.exp(-g);return Ap-v/S*x},l=p=>{const g=p*u*t,v=g*n+n,S=Math.pow(u,2)*Math.pow(p,2)*t,x=Math.exp(-g),T=Em(Math.pow(p,2),u);return(-o(p)+Ap>0?-1:1)*((v-S)*x)/T}):(o=p=>{const y=Math.exp(-p*t),g=(p-n)*t+1;return-Ap+y*g},l=p=>{const y=Math.exp(-p*t),g=(n-p)*(t*t);return y*g});const f=5/t,h=x4(o,l,f);if(t=ci(t),isNaN(h))return{stiffness:ot.stiffness,damping:ot.damping,duration:t};{const p=Math.pow(h,2)*r;return{stiffness:p,damping:u*2*Math.sqrt(r*p),duration:t}}}const w4=12;function x4(t,e,n){let r=n;for(let o=1;o<w4;o++)r=r-t(r)/e(r);return r}function Em(t,e){return t*Math.sqrt(1-e*e)}const T4=["duration","bounce"],A4=["stiffness","damping","mass"];function lx(t,e){return e.some(n=>t[n]!==void 0)}function E4(t){let e={velocity:ot.velocity,stiffness:ot.stiffness,damping:ot.damping,mass:ot.mass,isResolvedFromDuration:!1,...t};if(!lx(t,A4)&&lx(t,T4))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),o=r*r,l=2*Fi(.05,1,1-(t.bounce||0))*Math.sqrt(o);e={...e,mass:ot.mass,stiffness:o,damping:l}}else{const n=S4(t);e={...e,...n,mass:ot.mass},e.isResolvedFromDuration=!0}return e}function Ju(t=ot.visualDuration,e=ot.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:o}=n;const l=n.keyframes[0],u=n.keyframes[n.keyframes.length-1],f={done:!1,value:l},{stiffness:h,damping:p,mass:y,duration:g,velocity:v,isResolvedFromDuration:S}=E4({...n,velocity:-ui(n.velocity||0)}),x=v||0,T=p/(2*Math.sqrt(h*y)),D=u-l,M=ui(Math.sqrt(h/y)),O=Math.abs(D)<5;r||(r=O?ot.restSpeed.granular:ot.restSpeed.default),o||(o=O?ot.restDelta.granular:ot.restDelta.default);let C;if(T<1){const _=Em(M,T);C=J=>{const Y=Math.exp(-T*M*J);return u-Y*((x+T*M*D)/_*Math.sin(_*J)+D*Math.cos(_*J))}}else if(T===1)C=_=>u-Math.exp(-M*_)*(D+(x+M*D)*_);else{const _=M*Math.sqrt(T*T-1);C=J=>{const Y=Math.exp(-T*M*J),F=Math.min(_*J,300);return u-Y*((x+T*M*D)*Math.sinh(F)+_*D*Math.cosh(F))/_}}const j={calculatedDuration:S&&g||null,next:_=>{const J=C(_);if(S)f.done=_>=g;else{let Y=_===0?x:0;T<1&&(Y=_===0?ci(x):mR(C,_,J));const F=Math.abs(Y)<=r,ee=Math.abs(u-J)<=o;f.done=F&&ee}return f.value=f.done?u:J,f},toString:()=>{const _=Math.min(eg(j),Xu),J=pR(Y=>j.next(_*Y).value,_,30);return _+"ms "+J},toTransition:()=>{}};return j}Ju.applyToOptions=t=>{const e=b4(t,100,Ju);return t.ease=e.ease,t.duration=ci(e.duration),t.type="keyframes",t};function Rm({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:o=10,bounceStiffness:l=500,modifyTarget:u,min:f,max:h,restDelta:p=.5,restSpeed:y}){const g=t[0],v={done:!1,value:g},S=F=>f!==void 0&&F<f||h!==void 0&&F>h,x=F=>f===void 0?h:h===void 0||Math.abs(f-F)<Math.abs(h-F)?f:h;let T=n*e;const D=g+T,M=u===void 0?D:u(D);M!==D&&(T=M-g);const O=F=>-T*Math.exp(-F/r),C=F=>M+O(F),j=F=>{const ee=O(F),re=C(F);v.done=Math.abs(ee)<=p,v.value=v.done?M:re};let _,J;const Y=F=>{S(v.value)&&(_=F,J=Ju({keyframes:[v.value,x(v.value)],velocity:mR(C,F,v.value),damping:o,stiffness:l,restDelta:p,restSpeed:y}))};return Y(0),{calculatedDuration:null,next:F=>{let ee=!1;return!J&&_===void 0&&(ee=!0,j(F),Y(F)),_!==void 0&&F>=_?J.next(F-_):(!ee&&j(F),v)}}}function R4(t,e,n){const r=[],o=n||Gi.mix||hR,l=t.length-1;for(let u=0;u<l;u++){let f=o(t[u],t[u+1]);if(e){const h=Array.isArray(e)?e[u]||Un:e;f=Nl(h,f)}r.push(f)}return r}function O4(t,e,{clamp:n=!0,ease:r,mixer:o}={}){const l=t.length;if(Iy(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const u=t[0]===t[1];t[0]>t[l-1]&&(t=[...t].reverse(),e=[...e].reverse());const f=R4(e,r,o),h=f.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=pl(t[g],t[g+1],y);return f[g](v)};return n?y=>p(Fi(t[0],t[l-1],y)):p}function _4(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const o=pl(0,e,r);t.push(nt(n,1,o))}}function k4(t){const e=[0];return _4(e,t.length-1),e}function M4(t,e){return t.map(n=>n*e)}function C4(t,e){return t.map(()=>e||iR).splice(0,t.length-1)}function nl({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const o=qU(r)?r.map(ix):ix(r),l={done:!1,value:e[0]},u=M4(n&&n.length===e.length?n:k4(e),t),f=O4(u,e,{ease:Array.isArray(o)?o:C4(e,o)});return{calculatedDuration:t,next:h=>(l.value=f(h),l.done=h>=t,l)}}const D4=t=>t!==null;function tg(t,{repeat:e,repeatType:n="loop"},r,o=1){const l=t.filter(D4),f=o<0||e&&n!=="loop"&&e%2===1?0:l.length-1;return!f||r===void 0?l[f]:r}const N4={decay:Rm,inertia:Rm,tween:nl,keyframes:nl,spring:Ju};function yR(t){typeof t.type=="string"&&(t.type=N4[t.type])}class ng{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 $4=t=>t/100;class ig extends ng{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!==an.now()&&this.tick(an.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;yR(e);const{type:n=nl,repeat:r=0,repeatDelay:o=0,repeatType:l,velocity:u=0}=e;let{keyframes:f}=e;const h=n||nl;h!==nl&&typeof f[0]!="number"&&(this.mixKeyframes=Nl($4,hR(f[0],f[1])),f=[0,100]);const p=h({...e,keyframes:f});l==="mirror"&&(this.mirroredGenerator=h({...e,keyframes:[...f].reverse(),velocity:-u})),p.calculatedDuration===null&&(p.calculatedDuration=eg(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:l,mirroredGenerator:u,resolvedDuration:f,calculatedDuration:h}=this;if(this.startTime===null)return r.next(0);const{delay:p=0,keyframes:y,repeat:g,repeatType:v,repeatDelay:S,type:x,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 M=this.currentTime-p*(this.playbackSpeed>=0?1:-1),O=this.playbackSpeed>=0?M<0:M>o;this.currentTime=Math.max(M,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=o);let C=this.currentTime,j=r;if(g){const F=Math.min(this.currentTime,o)/f;let ee=Math.floor(F),re=F%1;!re&&F>=1&&(re=1),re===1&&ee--,ee=Math.min(ee,g+1),!!(ee%2)&&(v==="reverse"?(re=1-re,S&&(re-=S/f)):v==="mirror"&&(j=u)),C=Fi(0,1,re)*f}const _=O?{done:!1,value:y[0]}:j.next(C);l&&(_.value=l(_.value));let{done:J}=_;!O&&h!==null&&(J=this.playbackSpeed>=0?this.currentTime>=o:this.currentTime<=0);const Y=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&J);return Y&&x!==Rm&&(_.value=tg(y,this.options,D,this.speed)),T&&T(_.value),Y&&this.finish(),_}then(e,n){return this.finished.then(e,n)}get duration(){return ui(this.calculatedDuration)}get time(){return ui(this.currentTime)}set time(e){e=ci(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(an.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=ui(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=g4,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(an.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 j4(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const ls=t=>t*180/Math.PI,Om=t=>{const e=ls(Math.atan2(t[1],t[0]));return _m(e)},B4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Om,rotateZ:Om,skewX:t=>ls(Math.atan(t[1])),skewY:t=>ls(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},_m=t=>(t=t%360,t<0&&(t+=360),t),cx=Om,ux=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),fx=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),L4={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:ux,scaleY:fx,scale:t=>(ux(t)+fx(t))/2,rotateX:t=>_m(ls(Math.atan2(t[6],t[5]))),rotateY:t=>_m(ls(Math.atan2(-t[2],t[0]))),rotateZ:cx,rotate:cx,skewX:t=>ls(Math.atan(t[4])),skewY:t=>ls(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function km(t){return t.includes("scale")?1:0}function Mm(t,e){if(!t||t==="none")return km(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,o;if(n)r=L4,o=n;else{const f=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=B4,o=f}if(!o)return km(e);const l=r[e],u=o[1].split(",").map(U4);return typeof l=="function"?l(u):u[l]}const V4=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return Mm(n,e)};function U4(t){return parseFloat(t.trim())}const Fo=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Go=new Set(Fo),dx=t=>t===Ho||t===ye,z4=new Set(["x","y","z"]),K4=Fo.filter(t=>!z4.has(t));function q4(t){const e=[];return K4.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const fs={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})=>Mm(e,"x"),y:(t,{transform:e})=>Mm(e,"y")};fs.translateX=fs.x;fs.translateY=fs.y;const ds=new Set;let Cm=!1,Dm=!1,Nm=!1;function gR(){if(Dm){const t=Array.from(ds).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const o=q4(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(([l,u])=>{r.getValue(l)?.set(u)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Dm=!1,Cm=!1,ds.forEach(t=>t.complete(Nm)),ds.clear()}function bR(){ds.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Dm=!0)})}function P4(){Nm=!0,bR(),gR(),Nm=!1}class rg{constructor(e,n,r,o,l,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=l,this.isAsync=u}scheduleResolve(){this.state="scheduled",this.isAsync?(ds.add(this),Cm||(Cm=!0,We.read(bR),We.resolveKeyframes(gR))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:o}=this;if(e[0]===null){const l=o?.get(),u=e[e.length-1];if(l!==void 0)e[0]=l;else if(r&&n){const f=r.readValue(n,u);f!=null&&(e[0]=f)}e[0]===void 0&&(e[0]=u),o&&l===void 0&&o.set(e[0])}j4(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),ds.delete(this)}cancel(){this.state==="scheduled"&&(ds.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const I4=t=>t.startsWith("--");function H4(t,e,n){I4(e)?t.style.setProperty(e,n):t.style[e]=n}const F4=Hy(()=>window.ScrollTimeline!==void 0),G4={};function Y4(t,e){const n=Hy(t);return()=>G4[e]??n()}const vR=Y4(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Qa=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,hx={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Qa([0,.65,.55,1]),circOut:Qa([.55,0,1,.45]),backIn:Qa([.31,.01,.66,-.59]),backOut:Qa([.33,1.53,.69,.99])};function SR(t,e){if(t)return typeof t=="function"?vR()?pR(t,e):"ease-out":rR(t)?Qa(t):Array.isArray(t)?t.map(n=>SR(n,e)||hx.easeOut):hx[t]}function X4(t,e,n,{delay:r=0,duration:o=300,repeat:l=0,repeatType:u="loop",ease:f="easeOut",times:h}={},p=void 0){const y={[e]:n};h&&(y.offset=h);const g=SR(f,o);Array.isArray(g)&&(y.easing=g);const v={delay:r,duration:o,easing:Array.isArray(g)?"linear":g,fill:"both",iterations:l+1,direction:u==="reverse"?"alternate":"normal"};return p&&(v.pseudoElement=p),t.animate(y,v)}function wR(t){return typeof t=="function"&&"applyToOptions"in t}function J4({type:t,...e}){return wR(t)&&vR()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Z4 extends ng{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,!e)return;const{element:n,name:r,keyframes:o,pseudoElement:l,allowFlatten:u=!1,finalKeyframe:f,onComplete:h}=e;this.isPseudoElement=!!l,this.allowFlatten=u,this.options=e,Iy(typeof e.type!="string");const p=J4(e);this.animation=X4(n,r,o,p,l),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const y=tg(o,this.options,f,this.speed);this.updateMotionValue?this.updateMotionValue(y):H4(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 ui(Number(e))}get time(){return ui(Number(this.animation.currentTime)||0)}set time(e){this.finishedTime=null,this.animation.currentTime=ci(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&&F4()?(this.animation.timeline=e,Un):n(this)}}const xR={anticipate:eR,backInOut:WE,circInOut:nR};function Q4(t){return t in xR}function W4(t){typeof t.ease=="string"&&Q4(t.ease)&&(t.ease=xR[t.ease])}const px=10;class ez extends Z4{constructor(e){W4(e),yR(e),super(e),e.startTime&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:o,element:l,...u}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const f=new ig({...u,autoplay:!1}),h=ci(this.finishedTime??this.time);n.setWithVelocity(f.sample(h-px).value,f.sample(h).value,px),f.stop()}}const mx=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Dr.test(t)||t==="0")&&!t.startsWith("url("));function tz(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 nz(t,e,n,r){const o=t[0];if(o===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],u=mx(o,e),f=mx(l,e);return!u||!f?!1:tz(t)||(n==="spring"||wR(n))&&r}function $m(t){t.duration=0,t.type}const iz=new Set(["opacity","clipPath","filter","transform"]),rz=Hy(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function sz(t){const{motionValue:e,name:n,repeatDelay:r,repeatType:o,damping:l,type:u}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:h,transformTemplate:p}=e.owner.getProps();return rz()&&n&&iz.has(n)&&(n!=="transform"||!p)&&!h&&!r&&o!=="mirror"&&l!==0&&u!=="inertia"}const oz=40;class az extends ng{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:o=0,repeatDelay:l=0,repeatType:u="loop",keyframes:f,name:h,motionValue:p,element:y,...g}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=an.now();const v={autoplay:e,delay:n,type:r,repeat:o,repeatDelay:l,repeatType:u,name:h,motionValue:p,element:y,...g},S=y?.KeyframeResolver||rg;this.keyframeResolver=new S(f,(x,T,D)=>this.onKeyframesResolved(x,T,v,!D),h,p,y),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,r,o){this.keyframeResolver=void 0;const{name:l,type:u,velocity:f,delay:h,isHandoff:p,onUpdate:y}=r;this.resolvedAt=an.now(),nz(e,l,u,f)||((Gi.instantAnimations||!h)&&y?.(tg(e,r,n)),e[0]=e[e.length-1],$m(r),r.repeat=0);const v={startTime:o?this.resolvedAt?this.resolvedAt-this.createdAt>oz?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},S=!p&&sz(v)?new ez({...v,element:v.motionValue.owner.current}):new ig(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(),P4()),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 lz=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function cz(t){const e=lz.exec(t);if(!e)return[,];const[,n,r,o]=e;return[`--${n??r}`,o]}function TR(t,e,n=1){const[r,o]=cz(t);if(!r)return;const l=window.getComputedStyle(e).getPropertyValue(r);if(l){const u=l.trim();return HE(u)?parseFloat(u):u}return Jy(o)?TR(o,e,n+1):o}function sg(t,e){return t?.[e]??t?.default??t}const AR=new Set(["width","height","top","left","right","bottom",...Fo]),uz={test:t=>t==="auto",parse:t=>t},ER=t=>e=>e.test(t),RR=[Ho,ye,fi,wr,t4,e4,uz],yx=t=>RR.find(ER(t));function fz(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||GE(t):!0}const dz=new Set(["brightness","contrast","saturate","opacity"]);function hz(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(Zy)||[];if(!r)return t;const o=n.replace(r,"");let l=dz.has(e)?1:0;return r!==n&&(l*=100),e+"("+l+o+")"}const pz=/\b([a-z-]*)\(.*?\)/gu,jm={...Dr,getAnimatableNone:t=>{const e=t.match(pz);return e?e.map(hz).join(" "):t}},gx={...Ho,transform:Math.round},mz={rotate:wr,rotateX:wr,rotateY:wr,rotateZ:wr,scale:uu,scaleX:uu,scaleY:uu,scaleZ:uu,skew:wr,skewX:wr,skewY:wr,distance:ye,translateX:ye,translateY:ye,translateZ:ye,x:ye,y:ye,z:ye,perspective:ye,transformPerspective:ye,opacity:ml,originX:rx,originY:rx,originZ:ye},og={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,...mz,zIndex:gx,fillOpacity:ml,strokeOpacity:ml,numOctaves:gx},yz={...og,color:vt,backgroundColor:vt,outlineColor:vt,fill:vt,stroke:vt,borderColor:vt,borderTopColor:vt,borderRightColor:vt,borderBottomColor:vt,borderLeftColor:vt,filter:jm,WebkitFilter:jm},OR=t=>yz[t];function _R(t,e){let n=OR(t);return n!==jm&&(n=Dr),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const gz=new Set(["auto","none","0"]);function bz(t,e,n){let r=0,o;for(;r<t.length&&!o;){const l=t[r];typeof l=="string"&&!gz.has(l)&&yl(l).values.length&&(o=t[r]),r++}if(o&&n)for(const l of e)t[l]=_R(n,o)}class vz extends rg{constructor(e,n,r,o,l){super(e,n,r,o,l,!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(),Jy(p))){const y=TR(p,n.current);y!==void 0&&(e[h]=y),h===e.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!AR.has(r)||e.length!==2)return;const[o,l]=e,u=yx(o),f=yx(l);if(u!==f)if(dx(u)&&dx(f))for(let h=0;h<e.length;h++){const p=e[h];typeof p=="string"&&(e[h]=parseFloat(p))}else fs[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let o=0;o<e.length;o++)(e[o]===null||fz(e[o]))&&r.push(o);r.length&&bz(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=fs[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 l=r.length-1,u=r[l];r[l]=fs[n](e.measureViewportBox(),window.getComputedStyle(e.current)),u!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=u),this.removedTransforms?.length&&this.removedTransforms.forEach(([f,h])=>{e.getValue(f).set(h)}),this.resolveNoneKeyframes()}}function Sz(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 kR=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function wz(t){return FE(t)&&"offsetHeight"in t}const bx=30,xz=t=>!isNaN(parseFloat(t));class Tz{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{const o=an.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 l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=an.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=xz(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 Fy);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=an.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>bx)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,bx);return YE(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 Uo(t,e){return new Tz(t,e)}const{schedule:ag}=sR(queueMicrotask,!1),Fn={x:!1,y:!1};function MR(){return Fn.x||Fn.y}function Az(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 CR(t,e){const n=Sz(t),r=new AbortController,o={passive:!0,...e,signal:r.signal};return[n,o,()=>r.abort()]}function vx(t){return!(t.pointerType==="touch"||MR())}function Ez(t,e,n={}){const[r,o,l]=CR(t,n),u=f=>{if(!vx(f))return;const{target:h}=f,p=e(h,f);if(typeof p!="function"||!h)return;const y=g=>{vx(g)&&(p(g),h.removeEventListener("pointerleave",y))};h.addEventListener("pointerleave",y,o)};return r.forEach(f=>{f.addEventListener("pointerenter",u,o)}),l}const DR=(t,e)=>e?t===e?!0:DR(t,e.parentElement):!1,lg=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,Rz=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function Oz(t){return Rz.has(t.tagName)||t.tabIndex!==-1}const Au=new WeakSet;function Sx(t){return e=>{e.key==="Enter"&&t(e)}}function Ep(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const _z=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=Sx(()=>{if(Au.has(n))return;Ep(n,"down");const o=Sx(()=>{Ep(n,"up")}),l=()=>Ep(n,"cancel");n.addEventListener("keyup",o,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function wx(t){return lg(t)&&!MR()}function kz(t,e,n={}){const[r,o,l]=CR(t,n),u=f=>{const h=f.currentTarget;if(!wx(f))return;Au.add(h);const p=e(h,f),y=(S,x)=>{window.removeEventListener("pointerup",g),window.removeEventListener("pointercancel",v),Au.has(h)&&Au.delete(h),wx(S)&&typeof p=="function"&&p(S,{success:x})},g=S=>{y(S,h===window||h===document||n.useGlobalTarget||DR(h,S.target))},v=S=>{y(S,!1)};window.addEventListener("pointerup",g,o),window.addEventListener("pointercancel",v,o)};return r.forEach(f=>{(n.useGlobalTarget?window:f).addEventListener("pointerdown",u,o),wz(f)&&(f.addEventListener("focus",p=>_z(p,o)),!Oz(f)&&!f.hasAttribute("tabindex")&&(f.tabIndex=0))}),l}function NR(t){return FE(t)&&"ownerSVGElement"in t}function Mz(t){return NR(t)&&t.tagName==="svg"}const Ht=t=>!!(t&&t.getVelocity),Cz=[...RR,vt,Dr],Dz=t=>Cz.find(ER(t)),$R=V.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function Nz(t=!0){const e=V.useContext(Ky);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:o}=e,l=V.useId();V.useEffect(()=>{if(t)return o(l)},[t]);const u=V.useCallback(()=>t&&r&&r(l),[l,r,t]);return!n&&r?[!1,u]:[!0]}const jR=V.createContext({strict:!1}),xx={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"]},zo={};for(const t in xx)zo[t]={isEnabled:e=>xx[t].some(n=>!!e[n])};function $z(t){for(const e in t)zo[e]={...zo[e],...t[e]}}const jz=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 Zu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||jz.has(t)}let BR=t=>!Zu(t);function Bz(t){typeof t=="function"&&(BR=e=>e.startsWith("on")?!Zu(e):t(e))}try{Bz(require("@emotion/is-prop-valid").default)}catch{}function Lz(t,e,n){const r={};for(const o in t)o==="values"&&typeof t.values=="object"||(BR(o)||n===!0&&Zu(o)||!e&&!Zu(o)||t.draggable&&o.startsWith("onDrag"))&&(r[o]=t[o]);return r}const kf=V.createContext({});function Mf(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function gl(t){return typeof t=="string"||Array.isArray(t)}const cg=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],ug=["initial",...cg];function Cf(t){return Mf(t.animate)||ug.some(e=>gl(t[e]))}function LR(t){return!!(Cf(t)||t.variants)}function Vz(t,e){if(Cf(t)){const{initial:n,animate:r}=t;return{initial:n===!1||gl(n)?n:void 0,animate:gl(r)?r:void 0}}return t.inherit!==!1?e:{}}function Uz(t){const{initial:e,animate:n}=Vz(t,V.useContext(kf));return V.useMemo(()=>({initial:e,animate:n}),[Tx(e),Tx(n)])}function Tx(t){return Array.isArray(t)?t.join(" "):t}const bl={};function zz(t){for(const e in t)bl[e]=t[e],Xy(e)&&(bl[e].isCSSVariable=!0)}function VR(t,{layout:e,layoutId:n}){return Go.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!bl[t]||t==="opacity")}const Kz={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},qz=Fo.length;function Pz(t,e,n){let r="",o=!0;for(let l=0;l<qz;l++){const u=Fo[l],f=t[u];if(f===void 0)continue;let h=!0;if(typeof f=="number"?h=f===(u.startsWith("scale")?1:0):h=parseFloat(f)===0,!h||n){const p=kR(f,og[u]);if(!h){o=!1;const y=Kz[u]||u;r+=`${y}(${p}) `}n&&(e[u]=p)}}return r=r.trim(),n?r=n(e,o?"":r):o&&(r="none"),r}function fg(t,e,n){const{style:r,vars:o,transformOrigin:l}=t;let u=!1,f=!1;for(const h in e){const p=e[h];if(Go.has(h)){u=!0;continue}else if(Xy(h)){o[h]=p;continue}else{const y=kR(p,og[h]);h.startsWith("origin")?(f=!0,l[h]=y):r[h]=y}}if(e.transform||(u||n?r.transform=Pz(e,t.transform,n):r.transform&&(r.transform="none")),f){const{originX:h="50%",originY:p="50%",originZ:y=0}=l;r.transformOrigin=`${h} ${p} ${y}`}}const dg=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function UR(t,e,n){for(const r in e)!Ht(e[r])&&!VR(r,n)&&(t[r]=e[r])}function Iz({transformTemplate:t},e){return V.useMemo(()=>{const n=dg();return fg(n,e,t),Object.assign({},n.vars,n.style)},[e])}function Hz(t,e){const n=t.style||{},r={};return UR(r,n,t),Object.assign(r,Iz(t,e)),r}function Fz(t,e){const n={},r=Hz(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 Gz={offset:"stroke-dashoffset",array:"stroke-dasharray"},Yz={offset:"strokeDashoffset",array:"strokeDasharray"};function Xz(t,e,n=1,r=0,o=!0){t.pathLength=1;const l=o?Gz:Yz;t[l.offset]=ye.transform(-r);const u=ye.transform(e),f=ye.transform(n);t[l.array]=`${u} ${f}`}function zR(t,{attrX:e,attrY:n,attrScale:r,pathLength:o,pathSpacing:l=1,pathOffset:u=0,...f},h,p,y){if(fg(t,f,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&&Xz(g,o,l,u,!1)}const KR=()=>({...dg(),attrs:{}}),qR=t=>typeof t=="string"&&t.toLowerCase()==="svg";function Jz(t,e,n,r){const o=V.useMemo(()=>{const l=KR();return zR(l,e,qR(r),t.transformTemplate,t.style),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};UR(l,t.style,t),o.style={...l,...o.style}}return o}const Zz=["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 hg(t){return typeof t!="string"||t.includes("-")?!1:!!(Zz.indexOf(t)>-1||/[A-Z]/u.test(t))}function Qz(t,e,n,{latestValues:r},o,l=!1){const f=(hg(t)?Jz:Fz)(e,r,o,t),h=Lz(e,typeof t=="string",l),p=t!==V.Fragment?{...h,...f,ref:n}:{},{children:y}=e,g=V.useMemo(()=>Ht(y)?y.get():y,[y]);return V.createElement(t,{...p,children:g})}function Ax(t){const e=[{},{}];return t?.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function pg(t,e,n,r){if(typeof e=="function"){const[o,l]=Ax(r);e=e(n!==void 0?n:t.custom,o,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[o,l]=Ax(r);e=e(n!==void 0?n:t.custom,o,l)}return e}function Eu(t){return Ht(t)?t.get():t}function Wz({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,o){return{latestValues:eK(n,r,o,t),renderState:e()}}function eK(t,e,n,r){const o={},l=r(t,{});for(const v in l)o[v]=Eu(l[v]);let{initial:u,animate:f}=t;const h=Cf(t),p=LR(t);e&&p&&!h&&t.inherit!==!1&&(u===void 0&&(u=e.initial),f===void 0&&(f=e.animate));let y=n?n.initial===!1:!1;y=y||u===!1;const g=y?f:u;if(g&&typeof g!="boolean"&&!Mf(g)){const v=Array.isArray(g)?g:[g];for(let S=0;S<v.length;S++){const x=pg(t,v[S]);if(x){const{transitionEnd:T,transition:D,...M}=x;for(const O in M){let C=M[O];if(Array.isArray(C)){const j=y?C.length-1:0;C=C[j]}C!==null&&(o[O]=C)}for(const O in T)o[O]=T[O]}}}return o}const PR=t=>(e,n)=>{const r=V.useContext(kf),o=V.useContext(Ky),l=()=>Wz(t,e,r,o);return n?l():$U(l)};function mg(t,e,n){const{style:r}=t,o={};for(const l in r)(Ht(r[l])||e.style&&Ht(e.style[l])||VR(l,t)||n?.getValue(l)?.liveStyle!==void 0)&&(o[l]=r[l]);return o}const tK=PR({scrapeMotionValuesFromProps:mg,createRenderState:dg});function IR(t,e,n){const r=mg(t,e,n);for(const o in t)if(Ht(t[o])||Ht(e[o])){const l=Fo.indexOf(o)!==-1?"attr"+o.charAt(0).toUpperCase()+o.substring(1):o;r[l]=t[o]}return r}const nK=PR({scrapeMotionValuesFromProps:IR,createRenderState:KR}),iK=Symbol.for("motionComponentSymbol");function go(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function rK(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):go(n)&&(n.current=r))},[e])}const yg=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),sK="framerAppearId",HR="data-"+yg(sK),FR=V.createContext({});function oK(t,e,n,r,o){const{visualElement:l}=V.useContext(kf),u=V.useContext(jR),f=V.useContext(Ky),h=V.useContext($R).reducedMotion,p=V.useRef(null);r=r||u.renderer,!p.current&&r&&(p.current=r(t,{visualState:e,parent:l,props:n,presenceContext:f,blockInitialAnimation:f?f.initial===!1:!1,reducedMotionConfig:h}));const y=p.current,g=V.useContext(FR);y&&!y.projection&&o&&(y.type==="html"||y.type==="svg")&&aK(p.current,n,o,g);const v=V.useRef(!1);V.useInsertionEffect(()=>{y&&v.current&&y.update(n,f)});const S=n[HR],x=V.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return jU(()=>{y&&(v.current=!0,window.MotionIsMounted=!0,y.updateFeatures(),y.scheduleRenderMicrotask(),x.current&&y.animationState&&y.animationState.animateChanges())}),V.useEffect(()=>{y&&(!x.current&&y.animationState&&y.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),x.current=!1),y.enteringChildren=void 0)}),y}function aK(t,e,n,r){const{layoutId:o,layout:l,drag:u,dragConstraints:f,layoutScroll:h,layoutRoot:p,layoutCrossfade:y}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:GR(t.parent)),t.projection.setOptions({layoutId:o,layout:l,alwaysMeasureLayout:!!u||f&&go(f),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:r,crossfade:y,layoutScroll:h,layoutRoot:p})}function GR(t){if(t)return t.options.allowProjection!==!1?t.projection:GR(t.parent)}function Rp(t,{forwardMotionProps:e=!1}={},n,r){n&&$z(n);const o=hg(t)?nK:tK;function l(f,h){let p;const y={...V.useContext($R),...f,layoutId:lK(f)},{isStatic:g}=y,v=Uz(f),S=o(f,g);if(!g&&zy){cK();const x=uK(y);p=x.MeasureLayout,v.visualElement=oK(t,S,y,r,x.ProjectionNode)}return G.jsxs(kf.Provider,{value:v,children:[p&&v.visualElement?G.jsx(p,{visualElement:v.visualElement,...y}):null,Qz(t,f,rK(S,v.visualElement,h),S,g,e)]})}l.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const u=V.forwardRef(l);return u[iK]=t,u}function lK({layoutId:t}){const e=V.useContext(IE).id;return e&&t!==void 0?e+"-"+t:t}function cK(t,e){V.useContext(jR).strict}function uK(t){const{drag:e,layout:n}=zo;if(!e&&!n)return{};const r={...e,...n};return{MeasureLayout:e?.isEnabled(t)||n?.isEnabled(t)?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}function fK(t,e){if(typeof Proxy>"u")return Rp;const n=new Map,r=(l,u)=>Rp(l,u,t,e),o=(l,u)=>r(l,u);return new Proxy(o,{get:(l,u)=>u==="create"?r:(n.has(u)||n.set(u,Rp(u,void 0,t,e)),n.get(u))})}function YR({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function dK({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function hK(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Op(t){return t===void 0||t===1}function Bm({scale:t,scaleX:e,scaleY:n}){return!Op(t)||!Op(e)||!Op(n)}function ss(t){return Bm(t)||XR(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function XR(t){return Ex(t.x)||Ex(t.y)}function Ex(t){return t&&t!=="0%"}function Qu(t,e,n){const r=t-n,o=e*r;return n+o}function Rx(t,e,n,r,o){return o!==void 0&&(t=Qu(t,o,r)),Qu(t,n,r)+e}function Lm(t,e=0,n=1,r,o){t.min=Rx(t.min,e,n,r,o),t.max=Rx(t.max,e,n,r,o)}function JR(t,{x:e,y:n}){Lm(t.x,e.translate,e.scale,e.originPoint),Lm(t.y,n.translate,n.scale,n.originPoint)}const Ox=.999999999999,_x=1.0000000000001;function pK(t,e,n,r=!1){const o=n.length;if(!o)return;e.x=e.y=1;let l,u;for(let f=0;f<o;f++){l=n[f],u=l.projectionDelta;const{visualElement:h}=l.options;h&&h.props.style&&h.props.style.display==="contents"||(r&&l.options.layoutScroll&&l.scroll&&l!==l.root&&vo(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),u&&(e.x*=u.x.scale,e.y*=u.y.scale,JR(t,u)),r&&ss(l.latestValues)&&vo(t,l.latestValues))}e.x<_x&&e.x>Ox&&(e.x=1),e.y<_x&&e.y>Ox&&(e.y=1)}function bo(t,e){t.min=t.min+e,t.max=t.max+e}function kx(t,e,n,r,o=.5){const l=nt(t.min,t.max,o);Lm(t,e,n,l,r)}function vo(t,e){kx(t.x,e.x,e.scaleX,e.scale,e.originX),kx(t.y,e.y,e.scaleY,e.scale,e.originY)}function ZR(t,e){return YR(hK(t.getBoundingClientRect(),e))}function mK(t,e,n){const r=ZR(t,n),{scroll:o}=e;return o&&(bo(r.x,o.offset.x),bo(r.y,o.offset.y)),r}const Mx=()=>({translate:0,scale:1,origin:0,originPoint:0}),So=()=>({x:Mx(),y:Mx()}),Cx=()=>({min:0,max:0}),ht=()=>({x:Cx(),y:Cx()}),Vm={current:null},QR={current:!1};function yK(){if(QR.current=!0,!!zy)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vm.current=t.matches;t.addEventListener("change",e),e()}else Vm.current=!1}const gK=new WeakMap;function bK(t,e,n){for(const r in e){const o=e[r],l=n[r];if(Ht(o))t.addValue(r,o);else if(Ht(l))t.addValue(r,Uo(o,{owner:t}));else if(l!==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,Uo(u!==void 0?u:o,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const Dx=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class vK{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:o,blockInitialAnimation:l,visualState:u},f={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=rg,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=an.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=f,this.blockInitialAnimation=!!l,this.isControllingVariants=Cf(n),this.isVariantNode=LR(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&&Ht(S)&&S.set(h[v])}}mount(e){this.current=e,gK.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||yK(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Vm.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),Cr(this.notifyUpdate),Cr(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=Go.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 l;window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{o(),l&&l(),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 zo){const n=zo[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 l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ht()}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<Dx.length;r++){const o=Dx[r];this.propEventSubscriptions[o]&&(this.propEventSubscriptions[o](),delete this.propEventSubscriptions[o]);const l="on"+o,u=e[l];u&&(this.propEventSubscriptions[o]=this.on(o,u))}this.prevMotionValues=bK(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=Uo(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"&&(HE(r)||GE(r))?r=parseFloat(r):!Dz(r)&&Dr.test(n)&&(r=_R(e,n)),this.setBaseTarget(e,Ht(r)?r.get():r)),Ht(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 l=pg(this.props,n,this.presenceContext?.custom);l&&(r=l[e])}if(n&&r!==void 0)return r;const o=this.getBaseTargetFromProps(this.props,e);return o!==void 0&&!Ht(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 Fy),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){ag.render(this.render)}}class WR extends vK{constructor(){super(...arguments),this.KeyframeResolver=vz}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;Ht(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}function eO(t,{style:e,vars:n},r,o){const l=t.style;let u;for(u in e)l[u]=e[u];o?.applyProjectionStyles(l,r);for(u in n)l.setProperty(u,n[u])}function SK(t){return window.getComputedStyle(t)}class wK extends WR{constructor(){super(...arguments),this.type="html",this.renderInstance=eO}readValueFromInstance(e,n){if(Go.has(n))return this.projection?.isProjecting?km(n):V4(e,n);{const r=SK(e),o=(Xy(n)?r.getPropertyValue(n):r[n])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(e,{transformPagePoint:n}){return ZR(e,n)}build(e,n,r){fg(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return mg(e,n,r)}}const tO=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 xK(t,e,n,r){eO(t,e,void 0,r);for(const o in e.attrs)t.setAttribute(tO.has(o)?o:yg(o),e.attrs[o])}class TK extends WR{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ht}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Go.has(n)){const r=OR(n);return r&&r.default||0}return n=tO.has(n)?n:yg(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return IR(e,n,r)}build(e,n,r){zR(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,o){xK(e,n,r,o)}mount(e){this.isSVGTag=qR(e.tagName),super.mount(e)}}const AK=(t,e)=>hg(t)?new TK(e):new wK(e,{allowProjection:t!==V.Fragment});function _o(t,e,n){const r=t.getProps();return pg(r,e,n!==void 0?n:r.custom,t)}const Um=t=>Array.isArray(t);function EK(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Uo(n))}function RK(t){return Um(t)?t[t.length-1]||0:t}function OK(t,e){const n=_o(t,e);let{transitionEnd:r={},transition:o={},...l}=n||{};l={...l,...r};for(const u in l){const f=RK(l[u]);EK(t,u,f)}}function _K(t){return!!(Ht(t)&&t.add)}function zm(t,e){const n=t.getValue("willChange");if(_K(n))return n.add(e);if(!n&&Gi.WillChange){const r=new Gi.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function nO(t){return t.props[HR]}const kK=t=>t!==null;function MK(t,{repeat:e,repeatType:n="loop"},r){const o=t.filter(kK),l=e&&n!=="loop"&&e%2===1?0:o.length-1;return o[l]}const CK={type:"spring",stiffness:500,damping:25,restSpeed:10},DK=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),NK={type:"keyframes",duration:.8},$K={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},jK=(t,{keyframes:e})=>e.length>2?NK:Go.has(t)?t.startsWith("scale")?DK(e[1]):CK:$K;function BK({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:o,repeat:l,repeatType:u,repeatDelay:f,from:h,elapsed:p,...y}){return!!Object.keys(y).length}const gg=(t,e,n,r={},o,l)=>u=>{const f=sg(r,t)||{},h=f.delay||r.delay||0;let{elapsed:p=0}=r;p=p-ci(h);const y={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...f,delay:-p,onUpdate:v=>{e.set(v),f.onUpdate&&f.onUpdate(v)},onComplete:()=>{u(),f.onComplete&&f.onComplete()},name:t,motionValue:e,element:l?void 0:o};BK(f)||Object.assign(y,jK(t,y)),y.duration&&(y.duration=ci(y.duration)),y.repeatDelay&&(y.repeatDelay=ci(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)),(Gi.instantAnimations||Gi.skipAnimations)&&(g=!0,$m(y),y.delay=0),y.allowFlatten=!f.type&&!f.ease,g&&!l&&e.get()!==void 0){const v=MK(y.keyframes,f);if(v!==void 0){We.update(()=>{y.onUpdate(v),y.onComplete()});return}}return f.isSync?new ig(y):new az(y)};function LK({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function iO(t,e,{delay:n=0,transitionOverride:r,type:o}={}){let{transition:l=t.getDefaultTransition(),transitionEnd:u,...f}=e;r&&(l=r);const h=[],p=o&&t.animationState&&t.animationState.getState()[o];for(const y in f){const g=t.getValue(y,t.latestValues[y]??null),v=f[y];if(v===void 0||p&&LK(p,y))continue;const S={delay:n,...sg(l||{},y)},x=g.get();if(x!==void 0&&!g.isAnimating&&!Array.isArray(v)&&v===x&&!S.velocity)continue;let T=!1;if(window.MotionHandoffAnimation){const M=nO(t);if(M){const O=window.MotionHandoffAnimation(M,y,We);O!==null&&(S.startTime=O,T=!0)}}zm(t,y),g.start(gg(y,g,v,t.shouldReduceMotion&&AR.has(y)?{type:!1}:S,t,T));const D=g.animation;D&&h.push(D)}return u&&Promise.all(h).then(()=>{We.update(()=>{u&&OK(t,u)})}),h}function rO(t,e,n,r=0,o=1){const l=Array.from(t).sort((p,y)=>p.sortNodePosition(y)).indexOf(e),u=t.size,f=(u-1)*r;return typeof n=="function"?n(l,u):o===1?l*r:f-l*r}function Km(t,e,n={}){const r=_o(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:o=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(o=n.transitionOverride);const l=r?()=>Promise.all(iO(t,r,n)):()=>Promise.resolve(),u=t.variantChildren&&t.variantChildren.size?(h=0)=>{const{delayChildren:p=0,staggerChildren:y,staggerDirection:g}=o;return VK(t,e,h,p,y,g,n)}:()=>Promise.resolve(),{when:f}=o;if(f){const[h,p]=f==="beforeChildren"?[l,u]:[u,l];return h().then(()=>p())}else return Promise.all([l(),u(n.delay)])}function VK(t,e,n=0,r=0,o=0,l=1,u){const f=[];for(const h of t.variantChildren)h.notify("AnimationStart",e),f.push(Km(h,e,{...u,delay:n+(typeof r=="function"?0:r)+rO(t.variantChildren,h,r,o,l)}).then(()=>h.notify("AnimationComplete",e)));return Promise.all(f)}function UK(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const o=e.map(l=>Km(t,l,n));r=Promise.all(o)}else if(typeof e=="string")r=Km(t,e,n);else{const o=typeof e=="function"?_o(t,e,n.custom):e;r=Promise.all(iO(t,o,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}function sO(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 zK=ug.length;function oO(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?oO(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<zK;n++){const r=ug[n],o=t.props[r];(gl(o)||o===!1)&&(e[r]=o)}return e}const KK=[...cg].reverse(),qK=cg.length;function PK(t){return e=>Promise.all(e.map(({animation:n,options:r})=>UK(t,n,r)))}function IK(t){let e=PK(t),n=Nx(),r=!0;const o=h=>(p,y)=>{const g=_o(t,y,h==="exit"?t.presenceContext?.custom:void 0);if(g){const{transition:v,transitionEnd:S,...x}=g;p={...p,...x,...S}}return p};function l(h){e=h(t)}function u(h){const{props:p}=t,y=oO(t.parent)||{},g=[],v=new Set;let S={},x=1/0;for(let D=0;D<qK;D++){const M=KK[D],O=n[M],C=p[M]!==void 0?p[M]:y[M],j=gl(C),_=M===h?O.isActive:null;_===!1&&(x=D);let J=C===y[M]&&C!==p[M]&&j;if(J&&r&&t.manuallyAnimateOnMount&&(J=!1),O.protectedKeys={...S},!O.isActive&&_===null||!C&&!O.prevProp||Mf(C)||typeof C=="boolean")continue;const Y=HK(O.prevProp,C);let F=Y||M===h&&O.isActive&&!J&&j||D>x&&j,ee=!1;const re=Array.isArray(C)?C:[C];let ue=re.reduce(o(M),{});_===!1&&(ue={});const{prevResolvedValues:ge={}}=O,be={...ge,...ue},Q=q=>{F=!0,v.has(q)&&(ee=!0,v.delete(q)),O.needsAnimating[q]=!0;const z=t.getValue(q);z&&(z.liveStyle=!1)};for(const q in be){const z=ue[q],ne=ge[q];if(S.hasOwnProperty(q))continue;let A=!1;Um(z)&&Um(ne)?A=!sO(z,ne):A=z!==ne,A?z!=null?Q(q):v.add(q):z!==void 0&&v.has(q)?Q(q):O.protectedKeys[q]=!0}O.prevProp=C,O.prevResolvedValues=ue,O.isActive&&(S={...S,...ue}),r&&t.blockInitialAnimation&&(F=!1);const W=J&&Y;F&&(!W||ee)&&g.push(...re.map(q=>{const z={type:M};if(typeof q=="string"&&r&&!W&&t.manuallyAnimateOnMount&&t.parent){const{parent:ne}=t,A=_o(ne,q);if(ne.enteringChildren&&A){const{delayChildren:P}=A.transition||{};z.delay=rO(ne.enteringChildren,t,P)}}return{animation:q,options:z}}))}if(v.size){const D={};if(typeof p.initial!="boolean"){const M=_o(t,Array.isArray(p.initial)?p.initial[0]:p.initial);M&&M.transition&&(D.transition=M.transition)}v.forEach(M=>{const O=t.getBaseTarget(M),C=t.getValue(M);C&&(C.liveStyle=!0),D[M]=O??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 f(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:f,setAnimateFunction:l,getState:()=>n,reset:()=>{n=Nx(),r=!0}}}function HK(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!sO(e,t):!1}function ns(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Nx(){return{animate:ns(!0),whileInView:ns(),whileHover:ns(),whileTap:ns(),whileDrag:ns(),whileFocus:ns(),exit:ns()}}class Lr{constructor(e){this.isMounted=!1,this.node=e}update(){}}class FK extends Lr{constructor(e){super(e),e.animationState||(e.animationState=IK(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Mf(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 GK=0;class YK extends Lr{constructor(){super(...arguments),this.id=GK++}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 XK={animation:{Feature:FK},exit:{Feature:YK}};function vl(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}function Bl(t){return{point:{x:t.pageX,y:t.pageY}}}const JK=t=>e=>lg(e)&&t(e,Bl(e));function il(t,e,n,r){return vl(t,e,JK(n),r)}const aO=1e-4,ZK=1-aO,QK=1+aO,lO=.01,WK=0-lO,eq=0+lO;function Jt(t){return t.max-t.min}function tq(t,e,n){return Math.abs(t-e)<=n}function $x(t,e,n,r=.5){t.origin=r,t.originPoint=nt(e.min,e.max,t.origin),t.scale=Jt(n)/Jt(e),t.translate=nt(n.min,n.max,t.origin)-t.originPoint,(t.scale>=ZK&&t.scale<=QK||isNaN(t.scale))&&(t.scale=1),(t.translate>=WK&&t.translate<=eq||isNaN(t.translate))&&(t.translate=0)}function rl(t,e,n,r){$x(t.x,e.x,n.x,r?r.originX:void 0),$x(t.y,e.y,n.y,r?r.originY:void 0)}function jx(t,e,n){t.min=n.min+e.min,t.max=t.min+Jt(e)}function nq(t,e,n){jx(t.x,e.x,n.x),jx(t.y,e.y,n.y)}function Bx(t,e,n){t.min=e.min-n.min,t.max=t.min+Jt(e)}function sl(t,e,n){Bx(t.x,e.x,n.x),Bx(t.y,e.y,n.y)}function Bn(t){return[t("x"),t("y")]}const cO=({current:t})=>t?t.ownerDocument.defaultView:null,Lx=(t,e)=>Math.abs(t-e);function iq(t,e){const n=Lx(t.x,e.x),r=Lx(t.y,e.y);return Math.sqrt(n**2+r**2)}class uO{constructor(e,n,{transformPagePoint:r,contextWindow:o=window,dragSnapToOrigin:l=!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=kp(this.lastMoveEventInfo,this.history),S=this.startEvent!==null,x=iq(v.offset,{x:0,y:0})>=this.distanceThreshold;if(!S&&!x)return;const{point:T}=v,{timestamp:D}=zt;this.history.push({...T,timestamp:D});const{onStart:M,onMove:O}=this.handlers;S||(M&&M(this.lastMoveEvent,v),this.startEvent=this.lastMoveEvent),O&&O(this.lastMoveEvent,v)},this.handlePointerMove=(v,S)=>{this.lastMoveEvent=v,this.lastMoveEventInfo=_p(S,this.transformPagePoint),We.update(this.updatePoint,!0)},this.handlePointerUp=(v,S)=>{this.end();const{onEnd:x,onSessionEnd:T,resumeAnimation:D}=this.handlers;if(this.dragSnapToOrigin&&D&&D(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const M=kp(v.type==="pointercancel"?this.lastMoveEventInfo:_p(S,this.transformPagePoint),this.history);this.startEvent&&x&&x(v,M),T&&T(v,M)},!lg(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=u,this.contextWindow=o||window;const f=Bl(e),h=_p(f,this.transformPagePoint),{point:p}=h,{timestamp:y}=zt;this.history=[{...p,timestamp:y}];const{onSessionStart:g}=n;g&&g(e,kp(h,this.history)),this.removeListeners=Nl(il(this.contextWindow,"pointermove",this.handlePointerMove),il(this.contextWindow,"pointerup",this.handlePointerUp),il(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),Cr(this.updatePoint)}}function _p(t,e){return e?{point:e(t.point)}:t}function Vx(t,e){return{x:t.x-e.x,y:t.y-e.y}}function kp({point:t},e){return{point:t,delta:Vx(t,fO(e)),offset:Vx(t,rq(e)),velocity:sq(e,.1)}}function rq(t){return t[0]}function fO(t){return t[t.length-1]}function sq(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const o=fO(t);for(;n>=0&&(r=t[n],!(o.timestamp-r.timestamp>ci(e)));)n--;if(!r)return{x:0,y:0};const l=ui(o.timestamp-r.timestamp);if(l===0)return{x:0,y:0};const u={x:(o.x-r.x)/l,y:(o.y-r.y)/l};return u.x===1/0&&(u.x=0),u.y===1/0&&(u.y=0),u}function oq(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?nt(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?nt(n,t,r.max):Math.min(t,n)),t}function Ux(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function aq(t,{top:e,left:n,bottom:r,right:o}){return{x:Ux(t.x,n,o),y:Ux(t.y,e,r)}}function zx(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 lq(t,e){return{x:zx(t.x,e.x),y:zx(t.y,e.y)}}function cq(t,e){let n=.5;const r=Jt(t),o=Jt(e);return o>r?n=pl(e.min,e.max-r,t.min):r>o&&(n=pl(t.min,t.max-o,e.min)),Fi(0,1,n)}function uq(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 qm=.35;function fq(t=qm){return t===!1?t=0:t===!0&&(t=qm),{x:Kx(t,"left","right"),y:Kx(t,"top","bottom")}}function Kx(t,e,n){return{min:qx(t,e),max:qx(t,n)}}function qx(t,e){return typeof t=="number"?t:t[e]||0}const dq=new WeakMap;class hq{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ht(),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 l=g=>{const{dragSnapToOrigin:v}=this.getProps();v?this.pauseAnimation():this.stopAnimation(),n&&this.snapToCursor(Bl(g).point)},u=(g,v)=>{const{drag:S,dragPropagation:x,onDragStart:T}=this.getProps();if(S&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=Az(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(M=>{let O=this.getAxisMotionValue(M).get()||0;if(fi.test(O)){const{projection:C}=this.visualElement;if(C&&C.layout){const j=C.layout.layoutBox[M];j&&(O=Jt(j)*(parseFloat(O)/100))}}this.originPoint[M]=O}),T&&We.postRender(()=>T(g,v)),zm(this.visualElement,"transform");const{animationState:D}=this.visualElement;D&&D.setActive("whileDrag",!0)},f=(g,v)=>{this.latestPointerEvent=g,this.latestPanInfo=v;const{dragPropagation:S,dragDirectionLock:x,onDirectionLock:T,onDrag:D}=this.getProps();if(!S&&!this.openDragLock)return;const{offset:M}=v;if(x&&this.currentDirection===null){this.currentDirection=pq(M),this.currentDirection!==null&&T&&T(this.currentDirection);return}this.updateAxis("x",v.point,M),this.updateAxis("y",v.point,M),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 uO(e,{onSessionStart:l,onStart:u,onMove:f,onSessionEnd:h,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:y,distanceThreshold:r,contextWindow:cO(this.visualElement)})}stop(e,n){const r=e||this.latestPointerEvent,o=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!o||!r)return;const{velocity:u}=o;this.startAnimation(u);const{onDragEnd:f}=this.getProps();f&&We.postRender(()=>f(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||!fu(e,o,this.currentDirection))return;const l=this.getAxisMotionValue(e);let u=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(u=oq(u,this.constraints[e],this.elastic[e])),l.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&&go(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=aq(r.layoutBox,e):this.constraints=!1,this.elastic=fq(n),o!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&Bn(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=uq(r.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!go(e))return!1;const r=e.current,{projection:o}=this.visualElement;if(!o||!o.layout)return!1;const l=mK(r,o.root,this.visualElement.getTransformPagePoint());let u=lq(o.layout.layoutBox,l);if(n){const f=n(dK(u));this.hasMutatedConstraints=!!f,f&&(u=YR(f))}return u}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:o,dragTransition:l,dragSnapToOrigin:u,onDragTransitionEnd:f}=this.getProps(),h=this.constraints||{},p=Bn(y=>{if(!fu(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,x={type:"inertia",velocity:r?e[y]:0,bounceStiffness:v,bounceDamping:S,timeConstant:750,restDelta:1,restSpeed:10,...l,...g};return this.startAxisValueAnimation(y,x)});return Promise.all(p).then(f)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return zm(this.visualElement,e),r.start(gg(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(!fu(n,r,this.currentDirection))return;const{projection:o}=this.visualElement,l=this.getAxisMotionValue(n);if(o&&o.layout){const{min:u,max:f}=o.layout.layoutBox[n];l.set(e[n]-nt(u,f,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!go(n)||!r||!this.constraints)return;this.stopAnimation();const o={x:0,y:0};Bn(u=>{const f=this.getAxisMotionValue(u);if(f&&this.constraints!==!1){const h=f.get();o[u]=cq({min:h,max:h},this.constraints[u])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.resolveConstraints(),Bn(u=>{if(!fu(u,e,null))return;const f=this.getAxisMotionValue(u),{min:h,max:p}=this.constraints[u];f.set(nt(h,p,o[u]))})}addListeners(){if(!this.visualElement.current)return;dq.set(this.visualElement,this);const e=this.visualElement.current,n=il(e,"pointerdown",h=>{const{drag:p,dragListener:y=!0}=this.getProps();p&&y&&this.start(h)}),r=()=>{const{dragConstraints:h}=this.getProps();go(h)&&h.current&&(this.constraints=this.resolveRefConstraints())},{projection:o}=this.visualElement,l=o.addEventListener("measure",r);o&&!o.layout&&(o.root&&o.root.updateScroll(),o.updateLayout()),We.read(r);const u=vl(window,"resize",()=>this.scalePositionWithinConstraints()),f=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(),l(),f&&f()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:o=!1,dragConstraints:l=!1,dragElastic:u=qm,dragMomentum:f=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:o,dragConstraints:l,dragElastic:u,dragMomentum:f}}}function fu(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function pq(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class mq extends Lr{constructor(e){super(e),this.removeGroupControls=Un,this.removeListeners=Un,this.controls=new hq(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 Px=t=>(e,n)=>{t&&We.postRender(()=>t(e,n))};class yq extends Lr{constructor(){super(...arguments),this.removePointerDownListener=Un}onPointerDown(e){this.session=new uO(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:cO(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:o}=this.node.getProps();return{onSessionStart:Px(e),onStart:Px(n),onMove:r,onEnd:(l,u)=>{delete this.session,o&&We.postRender(()=>o(l,u))}}}mount(){this.removePointerDownListener=il(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 Ru={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function Ix(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Ya={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ye.test(t))t=parseFloat(t);else return t;const n=Ix(t,e.target.x),r=Ix(t,e.target.y);return`${n}% ${r}%`}},gq={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,o=Dr.parse(t);if(o.length>5)return r;const l=Dr.createTransformer(t),u=typeof o[0]!="number"?1:0,f=n.x.scale*e.x,h=n.y.scale*e.y;o[0+u]/=f,o[1+u]/=h;const p=nt(f,h,.5);return typeof o[2+u]=="number"&&(o[2+u]/=p),typeof o[3+u]=="number"&&(o[3+u]/=p),l(o)}};let Mp=!1;class bq extends V.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:o}=this.props,{projection:l}=e;zz(vq),l&&(n.group&&n.group.add(l),r&&r.register&&o&&r.register(l),Mp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,onExitComplete:()=>this.safeToRemove()})),Ru.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:o,isPresent:l}=this.props,{projection:u}=r;return u&&(u.isPresent=l,Mp=!0,o||e.layoutDependency!==n||n===void 0||e.isPresent!==l?u.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?u.promote():u.relegate()||We.postRender(()=>{const f=u.getStack();(!f||!f.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),ag.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:o}=e;Mp=!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 dO(t){const[e,n]=Nz(),r=V.useContext(IE);return G.jsx(bq,{...t,layoutGroup:r,switchLayoutGroup:V.useContext(FR),isPresent:e,safeToRemove:n})}const vq={borderRadius:{...Ya,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Ya,borderTopRightRadius:Ya,borderBottomLeftRadius:Ya,borderBottomRightRadius:Ya,boxShadow:gq};function Sq(t,e,n){const r=Ht(t)?t:Uo(t);return r.start(gg("",r,e,n)),r.animation}const wq=(t,e)=>t.depth-e.depth;class xq{constructor(){this.children=[],this.isDirty=!1}add(e){qy(this.children,e),this.isDirty=!0}remove(e){Py(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(wq),this.isDirty=!1,this.children.forEach(e)}}function Tq(t,e){const n=an.now(),r=({timestamp:o})=>{const l=o-n;l>=e&&(Cr(r),t(l-e))};return We.setup(r,!0),()=>Cr(r)}const hO=["TopLeft","TopRight","BottomLeft","BottomRight"],Aq=hO.length,Hx=t=>typeof t=="string"?parseFloat(t):t,Fx=t=>typeof t=="number"||ye.test(t);function Eq(t,e,n,r,o,l){o?(t.opacity=nt(0,n.opacity??1,Rq(r)),t.opacityExit=nt(e.opacity??1,0,Oq(r))):l&&(t.opacity=nt(e.opacity??1,n.opacity??1,r));for(let u=0;u<Aq;u++){const f=`border${hO[u]}Radius`;let h=Gx(e,f),p=Gx(n,f);if(h===void 0&&p===void 0)continue;h||(h=0),p||(p=0),h===0||p===0||Fx(h)===Fx(p)?(t[f]=Math.max(nt(Hx(h),Hx(p),r),0),(fi.test(p)||fi.test(h))&&(t[f]+="%")):t[f]=p}(e.rotate||n.rotate)&&(t.rotate=nt(e.rotate||0,n.rotate||0,r))}function Gx(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const Rq=pO(0,.5,tR),Oq=pO(.5,.95,Un);function pO(t,e,n){return r=>r<t?0:r>e?1:n(pl(t,e,r))}function Yx(t,e){t.min=e.min,t.max=e.max}function $n(t,e){Yx(t.x,e.x),Yx(t.y,e.y)}function Xx(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}function Jx(t,e,n,r,o){return t-=e,t=Qu(t,1/n,r),o!==void 0&&(t=Qu(t,1/o,r)),t}function _q(t,e=0,n=1,r=.5,o,l=t,u=t){if(fi.test(e)&&(e=parseFloat(e),e=nt(u.min,u.max,e/100)-u.min),typeof e!="number")return;let f=nt(l.min,l.max,r);t===l&&(f-=e),t.min=Jx(t.min,e,n,f,o),t.max=Jx(t.max,e,n,f,o)}function Zx(t,e,[n,r,o],l,u){_q(t,e[n],e[r],e[o],e.scale,l,u)}const kq=["x","scaleX","originX"],Mq=["y","scaleY","originY"];function Qx(t,e,n,r){Zx(t.x,e,kq,n?n.x:void 0,r?r.x:void 0),Zx(t.y,e,Mq,n?n.y:void 0,r?r.y:void 0)}function Wx(t){return t.translate===0&&t.scale===1}function mO(t){return Wx(t.x)&&Wx(t.y)}function e1(t,e){return t.min===e.min&&t.max===e.max}function Cq(t,e){return e1(t.x,e.x)&&e1(t.y,e.y)}function t1(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function yO(t,e){return t1(t.x,e.x)&&t1(t.y,e.y)}function n1(t){return Jt(t.x)/Jt(t.y)}function i1(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}class Dq{constructor(){this.members=[]}add(e){qy(this.members,e),e.scheduleRender()}remove(e){if(Py(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 l=this.members[o];if(l.isPresent!==!1){r=l;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 Nq(t,e,n){let r="";const o=t.x.translate/e.x,l=t.y.translate/e.y,u=n?.z||0;if((o||l||u)&&(r=`translate3d(${o}px, ${l}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:x}=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) `),x&&(r+=`skewY(${x}deg) `)}const f=t.x.scale*e.x,h=t.y.scale*e.y;return(f!==1||h!==1)&&(r+=`scale(${f}, ${h})`),r||"none"}const Cp=["","X","Y","Z"],$q=1e3;let jq=0;function Dp(t,e,n,r){const{latestValues:o}=e;o[t]&&(n[t]=o[t],e.setStaticValue(t,0),r&&(r[t]=0))}function gO(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=nO(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:o,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",We,!(o||l))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&gO(r)}function bO({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:o}){return class{constructor(u={},f=e?.()){this.id=jq++,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(Vq),this.nodes.forEach(qq),this.nodes.forEach(Pq),this.nodes.forEach(Uq)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=u,this.root=f?f.root||f:this,this.path=f?[...f.path,f]:[],this.parent=f,this.depth=f?f.depth+1:0;for(let h=0;h<this.path.length;h++)this.path[h].shouldResetTransform=!0;this.root===this&&(this.nodes=new xq)}addEventListener(u,f){return this.eventHandlers.has(u)||this.eventHandlers.set(u,new Fy),this.eventHandlers.get(u).add(f)}notifyListeners(u,...f){const h=this.eventHandlers.get(u);h&&h.notify(...f)}hasListeners(u){return this.eventHandlers.has(u)}mount(u){if(this.instance)return;this.isSVG=NR(u)&&!Mz(u),this.instance=u;const{layoutId:f,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||f)&&(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=Tq(v,250),Ru.hasAnimatedSinceResize&&(Ru.hasAnimatedSinceResize=!1,this.nodes.forEach(o1)))})}f&&this.root.registerSharedNode(f,this),this.options.animate!==!1&&p&&(f||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 x=this.options.transition||p.getDefaultTransition()||Yq,{onLayoutAnimationStart:T,onLayoutAnimationComplete:D}=p.getProps(),M=!this.targetLayout||!yO(this.targetLayout,S),O=!g&&v;if(this.options.layoutRoot||this.resumeFrom||O||g&&(M||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...sg(x,"layout"),onPlay:T,onComplete:D};(p.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(y,O)}else g||o1(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(),Cr(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(Iq),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&&gO(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let y=0;y<this.path.length;y++){const g=this.path[y];g.shouldResetTransform=!0,g.updateScroll("snapshot"),g.options.layoutRoot&&g.willUpdate(!1)}const{layoutId:f,layout:h}=this.options;if(f===void 0&&!h)return;const 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(r1);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(s1);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Kq),this.nodes.forEach(Bq),this.nodes.forEach(Lq)):this.nodes.forEach(s1),this.clearAllSnapshots();const f=an.now();zt.delta=Fi(0,1e3/60,f-zt.timestamp),zt.timestamp=f,zt.isProcessing=!0,Sp.update.process(zt),Sp.preRender.process(zt),Sp.render.process(zt),zt.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,ag.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(zq),this.sharedNodes.forEach(Hq)}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&&!Jt(this.snapshot.measuredBox.x)&&!Jt(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=ht(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:f}=this.options;f&&f.notify("LayoutMeasure",this.layout.layoutBox,u?u.layoutBox:void 0)}updateScroll(u="measure"){let f=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===u&&(f=!1),f&&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,f=this.projectionDelta&&!mO(this.projectionDelta),h=this.getTransformTemplate(),p=h?h(this.latestValues,""):void 0,y=p!==this.prevTransformTemplateValue;u&&this.instance&&(f||ss(this.latestValues)||y)&&(o(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(u=!0){const f=this.measurePageBox();let h=this.removeElementScroll(f);return u&&(h=this.removeTransform(h)),Xq(h),{animationId:this.root.animationId,measuredBox:f,layoutBox:h,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:u}=this.options;if(!u)return ht();const f=u.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(Jq))){const{scroll:p}=this.root;p&&(bo(f.x,p.offset.x),bo(f.y,p.offset.y))}return f}removeElementScroll(u){const f=ht();if($n(f,u),this.scroll?.wasRoot)return f;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(f,u),bo(f.x,y.offset.x),bo(f.y,y.offset.y))}return f}applyTransform(u,f=!1){const h=ht();$n(h,u);for(let p=0;p<this.path.length;p++){const y=this.path[p];!f&&y.options.layoutScroll&&y.scroll&&y!==y.root&&vo(h,{x:-y.scroll.offset.x,y:-y.scroll.offset.y}),ss(y.latestValues)&&vo(h,y.latestValues)}return ss(this.latestValues)&&vo(h,this.latestValues),h}removeTransform(u){const f=ht();$n(f,u);for(let h=0;h<this.path.length;h++){const p=this.path[h];if(!p.instance||!ss(p.latestValues))continue;Bm(p.latestValues)&&p.updateSnapshot();const y=ht(),g=p.measurePageBox();$n(y,g),Qx(f,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,y)}return ss(this.latestValues)&&Qx(f,this.latestValues),f}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!==zt.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(u=!1){const f=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=f.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=f.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=f.isSharedProjectionDirty);const h=!!this.resumingFrom||this!==f;if(!(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=zt.timestamp,!this.targetDelta&&!this.relativeTarget){const v=this.getClosestProjectingParent();v&&v.layout&&this.animationProgress!==1?(this.relativeParent=v,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ht(),this.relativeTargetOrigin=ht(),sl(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=ht(),this.targetWithTransforms=ht()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),nq(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):$n(this.target,this.layout.layoutBox),JR(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=ht(),this.relativeTargetOrigin=ht(),sl(this.relativeTargetOrigin,this.target,v.target),$n(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Bm(this.parent.latestValues)||XR(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(),f=!!this.resumingFrom||this!==u;let h=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(h=!1),f&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(h=!1),this.resolvedRelativeTargetAt===zt.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;pK(this.layoutCorrected,this.treeScale,this.path,f),u.layout&&!u.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(u.target=u.layout.layoutBox,u.targetWithTransforms=ht());const{target:S}=u;if(!S){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(Xx(this.prevProjectionDelta.x,this.projectionDelta.x),Xx(this.prevProjectionDelta.y,this.projectionDelta.y)),rl(this.projectionDelta,this.layoutCorrected,S,this.latestValues),(this.treeScale.x!==g||this.treeScale.y!==v||!i1(this.projectionDelta.x,this.prevProjectionDelta.x)||!i1(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 f=this.getStack();f&&f.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=So(),this.projectionDelta=So(),this.projectionDeltaWithTransform=So()}setAnimationOrigin(u,f=!1){const h=this.snapshot,p=h?h.latestValues:{},y={...this.latestValues},g=So();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!f;const v=ht(),S=h?h.source:void 0,x=this.layout?this.layout.source:void 0,T=S!==x,D=this.getStack(),M=!D||D.members.length<=1,O=!!(T&&!M&&this.options.crossfade===!0&&!this.path.some(Gq));this.animationProgress=0;let C;this.mixTargetDelta=j=>{const _=j/1e3;a1(g.x,u.x,_),a1(g.y,u.y,_),this.setTargetDelta(g),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(sl(v,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Fq(this.relativeTarget,this.relativeTargetOrigin,v,_),C&&Cq(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=ht()),$n(C,this.relativeTarget)),T&&(this.animationValues=y,Eq(y,p,this.latestValues,_,O,M)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=_},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(u){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Cr(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=We.update(()=>{Ru.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Uo(0)),this.currentAnimation=Sq(this.motionValue,[0,1e3],{...u,velocity:0,isSync:!0,onUpdate:f=>{this.mixTargetDelta(f),u.onUpdate&&u.onUpdate(f)},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($q),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const u=this.getLead();let{targetWithTransforms:f,target:h,layout:p,latestValues:y}=u;if(!(!f||!h||!p)){if(this!==u&&this.layout&&p&&vO(this.options.animationType,this.layout.layoutBox,p.layoutBox)){h=this.target||ht();const g=Jt(this.layout.layoutBox.x);h.x.min=u.target.x.min,h.x.max=h.x.min+g;const v=Jt(this.layout.layoutBox.y);h.y.min=u.target.y.min,h.y.max=h.y.min+v}$n(f,h),vo(f,y),rl(this.projectionDeltaWithTransform,this.layoutCorrected,f,y)}}registerSharedNode(u,f){this.sharedNodes.has(u)||this.sharedNodes.set(u,new Dq),this.sharedNodes.get(u).add(f);const p=f.options.initialPromotionConfig;f.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(f):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:f,preserveFollowOpacity:h}={}){const p=this.getStack();p&&p.promote(this,h),u&&(this.projectionDelta=void 0,this.needsReset=!0),f&&this.setOptions({transition:f})}relegate(){const u=this.getStack();return u?u.relegate(this):!1}resetSkewAndRotation(){const{visualElement:u}=this.options;if(!u)return;let f=!1;const{latestValues:h}=u;if((h.z||h.rotate||h.rotateX||h.rotateY||h.rotateZ||h.skewX||h.skewY)&&(f=!0),!f)return;const p={};h.z&&Dp("z",u,p,this.animationValues);for(let y=0;y<Cp.length;y++)Dp(`rotate${Cp[y]}`,u,p,this.animationValues),Dp(`skew${Cp[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,f){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=Eu(f?.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=Eu(f?.pointerEvents)||""),this.hasProjected&&!ss(this.latestValues)&&(u.transform=h?h({},""):"none",this.hasProjected=!1);return}u.visibility="";const y=p.animationValues||p.latestValues;this.applyTransformsToTarget();let g=Nq(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 x in bl){if(y[x]===void 0)continue;const{correct:T,applyTo:D,isCSSVariable:M}=bl[x],O=g==="none"?y[x]:T(y[x],p);if(D){const C=D.length;for(let j=0;j<C;j++)u[D[j]]=O}else M?this.options.visualElement.renderState.vars[x]=O:u[x]=O}this.options.layoutId&&(u.pointerEvents=p===this?Eu(f?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(u=>u.currentAnimation?.stop()),this.root.nodes.forEach(r1),this.root.sharedNodes.clear()}}}function Bq(t){t.updateLayout()}function Lq(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,l=e.source!==t.layout.source;o==="size"?Bn(y=>{const g=l?e.measuredBox[y]:e.layoutBox[y],v=Jt(g);g.min=n[y].min,g.max=g.min+v}):vO(o,e.layoutBox,n)&&Bn(y=>{const g=l?e.measuredBox[y]:e.layoutBox[y],v=Jt(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=So();rl(u,n,e.layoutBox);const f=So();l?rl(f,t.applyTransform(r,!0),e.measuredBox):rl(f,n,e.layoutBox);const h=!mO(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=ht();sl(S,e.layoutBox,g.layoutBox);const x=ht();sl(x,n,v.layoutBox),yO(S,x)||(p=!0),y.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=S,t.relativeParent=y)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:f,layoutDelta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:p})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function Vq(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 Uq(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function zq(t){t.clearSnapshot()}function r1(t){t.clearMeasurements()}function s1(t){t.isLayoutDirty=!1}function Kq(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function o1(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function qq(t){t.resolveTargetDelta()}function Pq(t){t.calcProjection()}function Iq(t){t.resetSkewAndRotation()}function Hq(t){t.removeLeadSnapshot()}function a1(t,e,n){t.translate=nt(e.translate,0,n),t.scale=nt(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function l1(t,e,n,r){t.min=nt(e.min,n.min,r),t.max=nt(e.max,n.max,r)}function Fq(t,e,n,r){l1(t.x,e.x,n.x,r),l1(t.y,e.y,n.y,r)}function Gq(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Yq={duration:.45,ease:[.4,0,.1,1]},c1=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),u1=c1("applewebkit/")&&!c1("chrome/")?Math.round:Un;function f1(t){t.min=u1(t.min),t.max=u1(t.max)}function Xq(t){f1(t.x),f1(t.y)}function vO(t,e,n){return t==="position"||t==="preserve-aspect"&&!tq(n1(e),n1(n),.2)}function Jq(t){return t!==t.root&&t.scroll?.wasRoot}const Zq=bO({attachResizeListener:(t,e)=>vl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),Np={current:void 0},SO=bO({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Np.current){const t=new Zq({});t.mount(window),t.setOptions({layoutScroll:!0}),Np.current=t}return Np.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Qq={pan:{Feature:yq},drag:{Feature:mq,ProjectionNode:SO,MeasureLayout:dO}};function d1(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const o="onHover"+n,l=r[o];l&&We.postRender(()=>l(e,Bl(e)))}class Wq extends Lr{mount(){const{current:e}=this.node;e&&(this.unmount=Ez(e,(n,r)=>(d1(this.node,r,"Start"),o=>d1(this.node,o,"End"))))}unmount(){}}class eP extends Lr{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=Nl(vl(this.node.current,"focus",()=>this.onFocus()),vl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function h1(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),l=r[o];l&&We.postRender(()=>l(e,Bl(e)))}class tP extends Lr{mount(){const{current:e}=this.node;e&&(this.unmount=kz(e,(n,r)=>(h1(this.node,r,"Start"),(o,{success:l})=>h1(this.node,o,l?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Pm=new WeakMap,$p=new WeakMap,nP=t=>{const e=Pm.get(t.target);e&&e(t)},iP=t=>{t.forEach(nP)};function rP({root:t,...e}){const n=t||document;$p.has(n)||$p.set(n,{});const r=$p.get(n),o=JSON.stringify(e);return r[o]||(r[o]=new IntersectionObserver(iP,{root:t,...e})),r[o]}function sP(t,e,n){const r=rP(e);return Pm.set(t,n),r.observe(t),()=>{Pm.delete(t),r.unobserve(t)}}const oP={some:0,all:1};class aP extends Lr{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:l}=e,u={root:n?n.current:void 0,rootMargin:r,threshold:typeof o=="number"?o:oP[o]},f=h=>{const{isIntersecting:p}=h;if(this.isInView===p||(this.isInView=p,l&&!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 sP(this.node.current,u,f)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(lP(e,n))&&this.startObserver()}unmount(){}}function lP({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const cP={inView:{Feature:aP},tap:{Feature:tP},focus:{Feature:eP},hover:{Feature:Wq}},uP={layout:{ProjectionNode:SO,MeasureLayout:dO}},fP={...XK,...cP,...Qq,...uP},dP=fK(fP,AK);function hP(){const t=Yn(Vo),e=Yn(ai),n=Yn(zi),r=St(Vo),o=St(ai),l=St(zi),u=`email-${V.useId()}`,f=`password-${V.useId()}`,h=`one-time-code-${V.useId()}`,[p,y]=V.useState(null),[g,v]=V.useState("email");return G.jsx("form",{onSubmit:async S=>{S.preventDefault();const x=Ze(si);try{switch(g){case"email":{const{nextStep:T,userKey:D}=await on.declareAuthTarget.query({email:r});switch(De(si,D),T){case"otc_login":case"otc_verify":{v("otc");break}case"password_login":{v("password");break}}break}case"otc":{if(!x){console.error("somehow userKey is null");return}const T=await on.verifyAccountAction.mutate({oneTimeCode:l,userKey:x});De(at,T),hi.once("connect",()=>{ys("/game"),t(""),n("")});break}case"password":{const T=await on.openSession.mutate({email:r,password:o});De(at,T),hi.once("connect",()=>{ys("/game"),t(""),e("")});break}}}catch(T){T instanceof Lo&&y(T.message)}},children:G.jsxs("main",{children:[p?G.jsx("aside",{children:p}):null,G.jsxs(dP.label,{htmlFor:u,children:[G.jsx("span",{children:"Email"}),G.jsx("input",{id:u,type:"text",value:r,onChange:S=>{t(S.target.value)},autoComplete:"email",autoCapitalize:"none",disabled:g!=="email"})]}),g==="password"?G.jsxs("label",{htmlFor:f,children:[G.jsx("span",{children:"Password"}),G.jsx("input",{id:f,type:"password",value:o,onChange:S=>{e(S.target.value)},autoComplete:"current-password",autoCapitalize:"none",autoFocus:g==="password"})]}):null,g==="otc"?G.jsxs("label",{htmlFor:h,children:[G.jsx("span",{children:"One-time Code"}),G.jsx("input",{id:h,type:"otc",value:l,onChange:S=>{n(S.target.value)},autoComplete:"one-time-code",autoCapitalize:"none",autoFocus:g==="otc"})]}):null,G.jsxs("footer",{children:[g==="password"?G.jsx("button",{type:"button",onClick:async()=>{const S=Ze(si);if(!S)return new Error("No userKey");await on.startPasswordReset.mutate({userKey:S}),v("otc")},children:"Forgot Password?"}):null,G.jsx("span",{}),G.jsx("button",{type:"submit",disabled:!r&&g==="email"||!o&&g==="password"||!l&&g==="otc",children:">>->"})]})]})})}function pP({route:[,t]}){const e=St(at),n=St(zi),r=Yn(zi);zp.useState(!1);const[o,l]=zp.useState(null),u=`code-${V.useId()}`;return ku(()=>{t&&r(t)}),e?(ku(()=>{n&&console.log("verifying token",n)}),G.jsx("form",{onSubmit:async f=>{f.preventDefault();try{const h=await on.verifyAccountAction.mutate({oneTimeCode:n,userKey:"CHANGEME"});De(at,h),h.action==="resetPassword"?ys("/account"):ys("/game")}catch(h){h instanceof Lo&&l(h.message)}},children:G.jsxs("main",{children:[G.jsx("p",{children:"Check your email for a verification code."}),G.jsxs("label",{htmlFor:u,children:[G.jsx("span",{children:"Verification code"}),G.jsx("input",{id:u,type:"text",value:n,onChange:f=>{r(f.target.value)},placeholder:"Verification code",autoComplete:"one-time-code",autoCapitalize:"none"})]})]})})):G.jsx("p",{children:"You must be logged in to verify your account."})}function mP(){const t=St(vU),e=St(at),[n,r]=V.useState(!1),{refs:o,floatingStyles:l,context:u}=oN({open:n,onOpenChange:r,placement:"bottom-end",middleware:[CD(5),ND(),DD()],whileElementsMounted:TD}),f=tN(u),h=rN(u),p=cN(u),{getReferenceProps:y,getFloatingProps:g}=aN([f,h,p]),v=St(aV);return G.jsxs("main",{className:Z3.class,children:[G.jsxs("header",{children:[G.jsxs("main",{children:[G.jsx(J3,{}),G.jsx("span",{children:G.jsx(Q3,{input:v})})]}),G.jsx("button",{"data-css":"profile",ref:o.setReference,...y(),children:e?.username?e.username.slice(0,2):""}),n&&e&&G.jsx(WD,{context:u,modal:!1,children:G.jsxs("div",{"data-css":"profile-actions",ref:o.setFloating,style:l,...g(),children:[G.jsx("span",{children:e.username}),G.jsx("button",{type:"button",onClick:()=>{ys("/account")},children:"Account"}),G.jsx("button",{type:"button",onClick:async()=>{e&&(await on.closeSession.mutate({username:e.username}),hi.once("disconnect",()=>{De(at,null),ys("/")}),hi.disconnect())},children:"Sign out"})]})})]}),G.jsx("main",{children:typeof t=="number"?G.jsxs("article",{children:[G.jsx("h1",{children:t}),G.jsx("h2",{children:JSON.parse(sE[t])}),G.jsx(oE,{href:"/",children:"Return to Home Page"})]}):(()=>{switch(t[0]){case void 0:return G.jsx(hP,{});case"admin":return G.jsx(AU,{});case"game":return G.jsx(CU,{route:t});case"verify":return G.jsx(pP,{route:t});case"account":return G.jsx(TU,{})}})()})]})}nC.createRoot(document.getElementById("root")).render(G.jsx(V.StrictMode,{children:G.jsx(YM,{socket:hi,children:G.jsx(mP,{})})}));
|