@but212/atom-effect-jquery 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,7 @@ npm install @but212/atom-effect-jquery jquery
20
20
  <!-- jquery -->
21
21
  <script src="https://code.jquery.com/jquery-4.0.0.min.js"></script>
22
22
  <!-- atom-effect-jquery -->
23
- <script src="https://cdn.jsdelivr.net/npm/@but212/atom-effect-jquery@0.25.0"></script>
23
+ <script src="https://cdn.jsdelivr.net/npm/@but212/atom-effect-jquery@0.26.0"></script>
24
24
  ```
25
25
 
26
26
  ### Usage
@@ -1,3 +1,3 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`jquery`)):typeof define==`function`&&define.amd?define([`exports`,`jquery`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.AtomEffectJQuery={},e.jQuery))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var l={IDLE:`idle`,PENDING:`pending`,RESOLVED:`resolved`,REJECTED:`rejected`},u={DISPOSED:1,EXECUTING:8},d={DISPOSED:1,IS_COMPUTED:2,DIRTY:8,IDLE:16,PENDING:32,RESOLVED:64,REJECTED:128,RECOMPUTING:256,HAS_ERROR:512,FORCE_COMPUTE:1024},f={DISPOSED:1,SYNC:8,NOTIFICATION_SCHEDULED:16},p={MAX_EXECUTIONS_PER_SECOND:1e3,MAX_EXECUTIONS_PER_EFFECT:100,MAX_EXECUTIONS_PER_FLUSH:1e4,MAX_FLUSH_ITERATIONS:1e3,MIN_FLUSH_ITERATIONS:10,BATCH_QUEUE_SHRINK_THRESHOLD:1e3},m={WARN_INFINITE_LOOP:!0,EFFECT_FREQUENCY_WINDOW:1e3},h={MAX_ASYNC_RETRIES:3,MAX_PROMISE_ID:2**53-1-1},g={UNINITIALIZED:-1,MIN:1},_=1073741823,v={VERSION_BITS:16};typeof process<`u`&&process.env;var y=Object.freeze([]),b=class{constructor(e,t,n=void 0){this.node=e,this.version=t,this.unsub=n}},x=class{constructor(e,t){this.fn=e,this.sub=t}notify(e,t){this.fn?this.fn(e,t):this.sub&&this.sub.execute()}},S=class extends Error{constructor(e,t=null,n=!0){super(e),this.cause=t,this.recoverable=n,this.name=`AtomError`}},C=class extends S{constructor(e,t=null){super(e,t,!0),this.name=`ComputedError`}},w=class extends S{constructor(e,t=null){super(e,t,!1),this.name=`EffectError`}},ee=class extends S{constructor(e,t=null){super(e,t,!1),this.name=`SchedulerError`}},T={COMPUTED_MUST_BE_FUNCTION:`Computed target must be a function`,COMPUTED_ASYNC_PENDING_NO_DEFAULT:`Async computation pending with no default value`,COMPUTED_COMPUTATION_FAILED:`Computation execution failed`,COMPUTED_ASYNC_COMPUTATION_FAILED:`Async computation execution failed`,COMPUTED_CIRCULAR_DEPENDENCY:`Circular dependency detected`,COMPUTED_DISPOSED:`Attempted to access disposed computed`,ATOM_SUBSCRIBER_MUST_BE_FUNCTION:`Subscriber must be a function or Subscriber object`,ATOM_INDIVIDUAL_SUBSCRIBER_FAILED:`Subscriber execution failed`,EFFECT_MUST_BE_FUNCTION:`Effect target must be a function`,EFFECT_EXECUTION_FAILED:`Effect execution failed`,EFFECT_CLEANUP_FAILED:`Effect cleanup failed`,EFFECT_DISPOSED:`Attempted to run disposed effect`,SCHEDULER_FLUSH_OVERFLOW:(e,t)=>`Maximum flush iterations (${e}) exceeded. ${t} jobs dropped. Possible infinite loop.`,CALLBACK_ERROR_IN_ERROR_HANDLER:`Exception encountered in onError handler`,EFFECT_FREQUENCY_LIMIT_EXCEEDED:`Effect executed too frequently within 1 second. Suspected infinite loop.`,SCHEDULER_CALLBACK_MUST_BE_FUNCTION:`Scheduler callback must be a function`,SCHEDULER_END_BATCH_WITHOUT_START:`endBatch() called without matching startBatch(). Ignoring.`,BATCH_CALLBACK_MUST_BE_FUNCTION:`Batch callback must be a function`},te=class{constructor(){this._s0=null,this._s1=null,this._s2=null,this._s3=null,this._count=0,this._overflow=null}get size(){return this._count}getAt(e){switch(e){case 0:return this._s0;case 1:return this._s1;case 2:return this._s2;case 3:return this._s3;default:{let t=this._overflow;if(t!==null&&e>=4){let n=e-4;if(n<t.length)return t[n]??null}return null}}}setAt(e,t){switch(e){case 0:this._s0=t;break;case 1:this._s1=t;break;case 2:this._s2=t;break;case 3:this._s3=t;break;default:{this._overflow??=[];let n=this._overflow;n[e-4]=t}}e>=this._count&&(this._count=e+1)}truncateFrom(e){let t=this._count;if(e>=t)return;if(e<=3)switch(e){case 0:{let e=this._s0;e!=null&&(this._onItemRemoved(e),this._s0=null)}case 1:{let e=this._s1;e!=null&&(this._onItemRemoved(e),this._s1=null)}case 2:{let e=this._s2;e!=null&&(this._onItemRemoved(e),this._s2=null)}case 3:{let e=this._s3;e!=null&&(this._onItemRemoved(e),this._s3=null)}}let n=this._overflow;if(n!==null&&t>4){let t=e>4?e-4:0,r=n.length;for(let e=t;e<r;e++){let t=n[e];t!=null&&(this._onItemRemoved(t),n[e]=null)}e<=4?(n.length=0,this._overflow=null):n.length=e-4}this._count=e}_onItemRemoved(e){}add(e){if(this._s0===null){this._s0=e,this._count++;return}if(this._s1===null){this._s1=e,this._count++;return}if(this._s2===null){this._s2=e,this._count++;return}if(this._s3===null){this._s3=e,this._count++;return}if(this._overflow===null)this._overflow=[e];else{let t=this._overflow;for(let n=0,r=t.length;n<r;n++)if(t[n]===null){t[n]=e,this._count++;return}t.push(e)}this._count++}remove(e){if(this._s0===e)return this._s0=null,this._count--,!0;if(this._s1===e)return this._s1=null,this._count--,!0;if(this._s2===e)return this._s2=null,this._count--,!0;if(this._s3===e)return this._s3=null,this._count--,!0;let t=this._overflow;if(t==null)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return t[n]=null,this._count--,!0;return!1}has(e){let t=this._count;if(t===0)return!1;if(this._s0===e||this._s1===e||this._s2===e||this._s3===e)return!0;if(t<=4)return!1;let n=this._overflow;if(n!=null){let r=0;this._s0!=null&&r++,this._s1!=null&&r++,this._s2!=null&&r++,this._s3!=null&&r++;for(let i=0,a=n.length;i<a;i++){let a=n[i];if(a!=null){if(a===e)return!0;if(++r===t)break}}}return!1}forEach(e){let t=this._count;if(t===0)return;let n=this._s0;n!=null&&e(n);let r=this._s1;r!=null&&e(r);let i=this._s2;i!=null&&e(i);let a=this._s3;if(a!=null&&e(a),t<=4)return;let o=this._overflow;if(o!=null){let s=0;n!=null&&s++,r!=null&&s++,i!=null&&s++,a!=null&&s++;for(let n=0,r=o.length;n<r;n++){let r=o[n];if(r!=null&&(e(r),++s===t))return}}}forEachIndexed(e){let t=this._count;if(t===0)return 0;let n=0,r=this._s0;r!=null&&(e(r),n++);let i=this._s1;i!=null&&(e(i),n++);let a=this._s2;a!=null&&(e(a),n++);let o=this._s3;if(o!=null&&(e(o),n++),t<=4||n===t)return n;let s=this._overflow;if(s!=null)for(let r=0,i=s.length;r<i;r++){let i=s[r];if(i!=null&&(e(i),++n===t))break}return n}compact(){let e=this._overflow;if(e===null||e.length===0)return;let t=0;for(;t<e.length;)if(e[t]===null){let n=e.pop();t<e.length&&n!=null&&(e[t]=n)}else t++;e.length===0&&(this._overflow=null)}clear(){this._s0=null,this._s1=null,this._s2=null,this._s3=null,this._count=0,this._overflow!==null&&(this._overflow.length=0,this._overflow=null)}dispose(){this.clear()}},ne=Symbol(`AtomEffect.DebugName`),re=Symbol(`AtomEffect.Type`),ie=Symbol(`AtomEffect.NoDefaultValue`),ae={enabled:!1,warnInfiniteLoop:m.WARN_INFINITE_LOOP,warn(e,t){},attachDebugInfo(e,t,n){},getDebugName:e=>e?.[ne],getDebugType:e=>e?.[re]},oe=1,se=()=>oe++;function E(e,t,n){if(e instanceof S)return e;let r=e instanceof Error,i=r?e.message:String(e),a=r?e:void 0;return new t(`${r?e.constructor.name:`Unexpected error`} (${n}): ${i}`,a)}var ce=class{constructor(){this.flags=0,this.version=0,this._lastSeenEpoch=g.UNINITIALIZED,this._notifying=0,this._hotIndex=-1,this._slots=null,this._deps=null,this.id=se()&_}subscribe(e){let t=typeof e==`function`;if(!t&&(!e||typeof e.execute!=`function`))throw E(TypeError(`Invalid subscriber`),S,T.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);let n=this._slots;n||(n=new te,this._slots=n);let r=!1;if(n.forEach(n=>{(t?n.fn===e:n.sub===e)&&(r=!0)}),r)return()=>{};let i=new x(t?e:void 0,t?void 0:e);return n.add(i),()=>this._unsubscribe(i)}_unsubscribe(e){if(this._slots){if(this._notifying>0){this._slots.remove(e);return}this._slots.remove(e),this._slots.compact()}}subscriberCount(){return this._slots?this._slots.size:0}_notifySubscribers(e,t){let n=this._slots;if(!(!n||n.size===0)){this._notifying++;try{n.forEach(n=>{try{n.notify(e,t)}catch(e){console.error(E(e,S,T.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED))}})}finally{this._notifying--,this._notifying===0&&n.compact()}}}_isDirty(){let e=this._deps;if(!e||e.size===0)return!1;if(this._hotIndex!==-1){let t=e.getAt(this._hotIndex);if(t!=null&&t.node.version!==t.version)return!0}return!e.hasComputeds&&!e.isDirtyFast()?!1:this._deepDirtyCheck()}},le=0,ue=()=>(le=le+1&1073741823||1,le),de=e=>e+1&_,fe=0,pe=!1,me=0,he=()=>me;function ge(){return pe?!1:(pe=!0,me=ue(),fe=0,!0)}var _e=()=>{pe=!1},ve=()=>pe?++fe:0,ye=(function(e){return e[e.IDLE=0]=`IDLE`,e[e.BATCHING=1]=`BATCHING`,e[e.FLUSHING=2]=`FLUSHING`,e})({}),D=new class{constructor(){this._queueBuffer=[[],[]],this._bufferIndex=0,this._size=0,this._epoch=0,this._isProcessing=!1,this._isBatching=!1,this._isFlushingSync=!1,this._batchDepth=0,this._batchQueue=[],this._batchQueueSize=0,this._maxFlushIterations=p.MAX_FLUSH_ITERATIONS,this.onOverflow=null,this._boundRunLoop=this._runLoop.bind(this)}get phase(){return this._isProcessing||this._isFlushingSync?ye.FLUSHING:this._isBatching?ye.BATCHING:ye.IDLE}get queueSize(){return this._size}get isBatching(){return this._isBatching}schedule(e){if(e._nextEpoch!==this._epoch){if(e._nextEpoch=this._epoch,this._isBatching||this._isFlushingSync){this._batchQueue[this._batchQueueSize++]=e;return}this._queueBuffer[this._bufferIndex][this._size++]=e,this._isProcessing||this._flush()}}_flush(){this._isProcessing||this._size===0||(this._isProcessing=!0,queueMicrotask(this._boundRunLoop))}_runLoop(){try{if(this._size===0)return;let e=ge();this._drainQueue(),e&&_e()}finally{this._isProcessing=!1,this._size>0&&!this._isBatching&&this._flush()}}_flushSync(){this._isFlushingSync=!0;let e=ge();try{this._mergeBatchQueue(),this._drainQueue()}finally{this._isFlushingSync=!1,e&&_e()}}_mergeBatchQueue(){if(this._batchQueueSize===0)return;let e=++this._epoch,t=this._batchQueue,n=this._queueBuffer[this._bufferIndex],r=this._size;for(let i=0;i<this._batchQueueSize;i++){let a=t[i];a._nextEpoch!==e&&(a._nextEpoch=e,n[r++]=a)}this._size=r,this._batchQueueSize=0,t.length=0}_drainQueue(){let e=0;for(;this._size>0;){if(++e>this._maxFlushIterations){this._handleFlushOverflow();return}this._processQueue(),this._mergeBatchQueue()}}_processQueue(){let e=this._bufferIndex,t=this._queueBuffer[e],n=this._size;this._bufferIndex=e^1,this._size=0,this._epoch++;for(let e=0;e<n;e++)try{let n=t[e];typeof n==`function`?n():n.execute()}catch(e){console.error(new ee(`Error occurred during scheduler execution`,e))}t.length=0}_handleFlushOverflow(){let e=this._size+this._batchQueueSize;if(console.error(new ee(T.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations,e))),this._size=0,this._queueBuffer[this._bufferIndex].length=0,this._batchQueueSize=0,this.onOverflow)try{this.onOverflow(e)}catch{}}startBatch(){this._batchDepth++,this._isBatching=!0}endBatch(){this._batchDepth!==0&&--this._batchDepth===0&&(this._flushSync(),this._isBatching=!1)}setMaxFlushIterations(e){if(e<p.MIN_FLUSH_ITERATIONS)throw new ee(`Max flush iterations must be at least ${p.MIN_FLUSH_ITERATIONS}`);this._maxFlushIterations=e}},be=Symbol.for(`atom-effect/atom`),xe=Symbol.for(`atom-effect/computed`),Se=Symbol.for(`atom-effect/effect`),Ce=Symbol.for(`atom-effect/writable`),O={current:null,run(e,t){let n=this.current;this.current=e;try{return t()}finally{this.current=n}}};function k(e){let t=O.current;if(t===null)return e();O.current=null;try{return e()}finally{O.current=t}}var we=class extends ce{constructor(e,t){super(),this[be]=!0,this[Ce]=!0,this._value=e,this._pendingOldValue=void 0,t&&(this.flags|=f.SYNC),ae.attachDebugInfo(this,`atom`,this.id)}get value(){return O.current?.addDependency(this),this._value}set value(e){let t=this._value;if(Object.is(t,e))return;this._value=e,this.version=de(this.version);let n=this._slots,r=this.flags;if(n==null||n.size===0||r&f.NOTIFICATION_SCHEDULED)return;this._pendingOldValue=t;let i=r|f.NOTIFICATION_SCHEDULED;if(this.flags=i,(i&f.SYNC)!==0&&!D.isBatching){this._flushNotifications();return}D.schedule(this)}execute(){this._flushNotifications()}_flushNotifications(){let e=this.flags;if(!(e&f.NOTIFICATION_SCHEDULED)||e&f.DISPOSED)return;let t=this._pendingOldValue;this._pendingOldValue=void 0,this.flags&=~f.NOTIFICATION_SCHEDULED,this._notifySubscribers(this._value,t)}peek(){return this._value}dispose(){this.flags&f.DISPOSED||(this._slots?.clear(),this.flags|=f.DISPOSED,this._value=void 0,this._pendingOldValue=void 0)}_deepDirtyCheck(){return!1}[Symbol.dispose](){this.dispose()}};function Te(e,t={}){return new we(e,t.sync??!1)}var Ee=class extends te{constructor(){super(),this._map=null,this._SCAN_THRESHOLD=32,this.hasComputeds=!1,this._depsHash=0,this._map=null,this.hasComputeds=!1,this._depsHash=0}prepareTracking(){this.hasComputeds=!1}_onItemRemoved(e){let t=e.unsub;t&&t()}claimExisting(e,t){let n=this._count;if(t>=n)return!1;let r=n-t;if(this._map!==null||r>this._SCAN_THRESHOLD)return this._claimViaMap(e,t);if(t<4)switch(t){case 0:{let t=this._s0;if(t&&t.node===e&&t.unsub)return t.version=e.version,!0}case 1:if(n>1){let n=this._s1;if(n&&n.node===e&&n.unsub)return n.version=e.version,t!==1&&(this._s1=this._s0,this._s0=n),!0}case 2:if(n>2){let n=this._s2;if(n&&n.node===e&&n.unsub){if(n.version=e.version,t!==2){let e=t===0?this._s0:this._s1;t===0?this._s0=n:this._s1=n,this._s2=e}return!0}}case 3:if(n>3){let n=this._s3;if(n&&n.node===e&&n.unsub){if(n.version=e.version,t!==3){let e;t===0?(e=this._s0,this._s0=n):t===1?(e=this._s1,this._s1=n):(e=this._s2,this._s2=n),this._s3=e}return!0}}}let i=t>4?t:4,a=this._overflow;if(a)for(let n=i-4,r=a.length;n<r;n++){let r=a[n];if(r&&r.node===e&&r.unsub)return r.version=e.version,this._swapGeneral(n+4,t,r),!0}return!1}_claimViaMap(e,t){if(this._map===null){this._map=new Map;let e=this._count;t<4&&(t<=0&&this._s0?.unsub&&this._map.set(this._s0.node,0),t<=1&&this._s1?.unsub&&this._map.set(this._s1.node,1),t<=2&&this._s2?.unsub&&this._map.set(this._s2.node,2),t<=3&&this._s3?.unsub&&this._map.set(this._s3.node,3));let n=this._overflow;if(n&&e>4){let e=t>4?t:4;for(let t=e-4,r=n.length;t<r;t++){let e=n[t];e?.unsub&&this._map.set(e.node,t+4)}}}let n=this._map.get(e);if(n===void 0||n<t)return!1;let r=this.getAt(n);if(r==null||!r.unsub)return!1;if(r.version=e.version,n!==t){let i=this.getAt(t);this.setAt(t,r),this.setAt(n,i),i?.unsub&&this._map.set(i.node,n),this._map.set(e,t)}return!0}_swapInline(e,t,n){let r=this.getAt(t);this.setAt(t,n),this.setAt(e,r)}_swapGeneral(e,t,n){if(e===t)return;let r=this.getAt(t);if(this.setAt(t,n),e===0)this._s0=r;else if(e===1)this._s1=r;else if(e===2)this._s2=r;else if(e===3)this._s3=r;else{let t=this._overflow;t[e-4]=r}}insertNew(e,t){let n=this._count;if(e<n){let t=this.getAt(e);t!=null&&(this.add(t),this._map!==null&&t.unsub&&this._map.set(t.node,this._count-1))}if(e===0)this._s0=t;else if(e===1)this._s1=t;else if(e===2)this._s2=t;else if(e===3)this._s3=t;else{let n=this._overflow;n||(n=[],this._overflow=n),n[e-4]=t}e>=n&&(this._count=e+1)}truncateFrom(e){e>=this._count||(super.truncateFrom(e),this._map!==null&&(this._map.clear(),this._map=null))}seal(){let e=this._count,t=v.VERSION_BITS,n=0;switch(e){case 0:this._depsHash=0;return;case 1:{let e=this._s0;n=n+(e.version<<t)+e.node.id|0;break}case 2:{let e=this._s0,r=this._s1;n=n+(e.version<<t)+e.node.id|0,n=n+(r.version<<t)+r.node.id|0;break}case 3:{let e=this._s0,r=this._s1,i=this._s2;n=n+(e.version<<t)+e.node.id|0,n=n+(r.version<<t)+r.node.id|0,n=n+(i.version<<t)+i.node.id|0;break}default:{let r=this._s0,i=this._s1,a=this._s2,o=this._s3;if(n=n+(r.version<<t)+r.node.id|0,n=n+(i.version<<t)+i.node.id|0,n=n+(a.version<<t)+a.node.id|0,n=n+(o.version<<t)+o.node.id|0,e>4){let e=this._overflow;for(let r=0,i=e.length;r<i;r++){let i=e[r];n=n+(i.version<<t)+i.node.id|0}}}}this._depsHash=n}isDirtyFast(){let e=this._count,t=v.VERSION_BITS,n=0;switch(e){case 0:return!1;case 1:{let e=this._s0.node;n=n+(e.version<<t)+e.id|0;break}case 2:{let e=this._s0.node,r=this._s1.node;n=n+(e.version<<t)+e.id|0,n=n+(r.version<<t)+r.id|0;break}case 3:{let e=this._s0.node,r=this._s1.node,i=this._s2.node;n=n+(e.version<<t)+e.id|0,n=n+(r.version<<t)+r.id|0,n=n+(i.version<<t)+i.id|0;break}default:{let r=this._s0.node,i=this._s1.node,a=this._s2.node,o=this._s3.node;if(n=n+(r.version<<t)+r.id|0,n=n+(i.version<<t)+i.id|0,n=n+(a.version<<t)+a.id|0,n=n+(o.version<<t)+o.id|0,e>4){let e=this._overflow;for(let r=0,i=e.length;r<i;r++){let i=e[r].node;n=n+(i.version<<t)+i.id|0}}}}return n!==this._depsHash}disposeAll(){this._count>0&&this.truncateFrom(0),this.hasComputeds=!1,this._map!==null&&(this._map.clear(),this._map=null)}remove(e){throw Error(`remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.`)}compact(){}};function De(e){return typeof e==`object`&&!!e&&be in e}function Oe(e){return typeof e==`object`&&!!e&&xe in e}function ke(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var{IDLE:A,DIRTY:j,PENDING:M,RESOLVED:N,REJECTED:P,HAS_ERROR:F,RECOMPUTING:I,DISPOSED:Ae,IS_COMPUTED:je,FORCE_COMPUTE:Me}=d,Ne=class extends ce{constructor(e,t={}){if(typeof e!=`function`)throw new C(T.COMPUTED_MUST_BE_FUNCTION);if(super(),this[be]=!0,this[xe]=!0,this._error=null,this._promiseId=0,this._deps=new Ee,this._asyncRetryCount=0,this._lastDriftEpoch=g.UNINITIALIZED,this._trackEpoch=g.UNINITIALIZED,this._trackCount=0,this._value=void 0,this.flags=je|j|A,this._equal=t.equal??Object.is,this._fn=e,this._defaultValue=`defaultValue`in t?t.defaultValue:ie,this._onError=t.onError??null,this._maxAsyncRetries=(t.maxAsyncRetries??h.MAX_ASYNC_RETRIES)&_,ae.attachDebugInfo(this,`computed`,this.id),t.lazy===!1)try{this._recompute()}catch{}}_track(){O.current?.addDependency(this)}get value(){this._track();let e=this.flags;if((e&(N|j|A))===N)return this._value;if(e&Ae)throw new C(T.COMPUTED_DISPOSED);if(e&I){if(this._defaultValue!==ie)return this._defaultValue;throw new C(T.COMPUTED_CIRCULAR_DEPENDENCY)}if(e&(j|A)&&((e&A)===0&&(e&Me)===0&&this._deps.size>0&&!this._isDirty()?this.flags&=~j:this._recompute(),this.flags&N))return this._value;let t=this._defaultValue,n=t!==ie;if(this.flags&M){if(n)return t;throw new C(T.COMPUTED_ASYNC_PENDING_NO_DEFAULT)}if(this.flags&P){if(n)return t;throw this._error}return this._value}peek(){return this._value}get state(){this._track();let e=this.flags;return e&N?l.RESOLVED:e&M?l.PENDING:e&P?l.REJECTED:l.IDLE}get hasError(){if(this._track(),this.flags&(P|F))return!0;let e=this._deps;if(!e.hasComputeds)return!1;let t=e.size;for(let n=0;n<t;n++){let t=e.getAt(n);if(t!=null&&t.node.flags&F)return!0}return!1}get isValid(){return!this.hasError}get errors(){this._track();let e=[];this._error&&e.push(this._error);let t=this._deps;if(!t.hasComputeds)return e.length===0?y:Object.freeze(e);let n=t.size;for(let r=0;r<n;r++){let n=t.getAt(r);if(n==null)continue;let i=n.node;i.flags&F&&this._collectErrorsFromDep(i,e)}return e.length===0?y:Object.freeze(e)}_collectErrorsFromDep(e,t){let n=e.errors,r=n.length;for(let e=0;e<r;e++){let r=n[e];r!=null&&!t.includes(r)&&t.push(r)}}get lastError(){return this._track(),this._error}get isPending(){return this._track(),(this.flags&M)!==0}get isResolved(){return this._track(),(this.flags&N)!==0}invalidate(){this.flags|=Me,this._markDirty()}dispose(){this.flags&Ae||(this._deps.disposeAll(),this._slots?.clear(),this.flags=Ae|j|A,this._error=null,this._value=void 0,this._hotIndex=-1)}[Symbol.dispose](){this.dispose()}addDependency(e){if(e._lastSeenEpoch===this._trackEpoch)return;e._lastSeenEpoch=this._trackEpoch;let t=this._trackCount,n=this._deps.getAt(t);if(n!=null&&n.node===e)n.version=e.version;else if(!this._deps.claimExisting(e,t)){let n=new b(e,e.version,e.subscribe(this));this._deps.insertNew(t,n)}e.flags&je&&(this._deps.hasComputeds=!0),this._trackCount=t+1}_recompute(){if(this.flags&I)return;this.flags=(this.flags|I)&~Me,this._trackEpoch=ue(),this._trackCount=0,this._deps.prepareTracking(),this._hotIndex=-1;let e=!1;try{let t=O.run(this,this._fn);this._deps.truncateFrom(this._trackCount),this._deps.seal(),e=!0,ke(t)?this._handleAsyncComputation(t):this._finalizeResolution(t)}catch(t){if(!e)try{this._deps.truncateFrom(this._trackCount)}catch{}this._handleError(t,T.COMPUTED_COMPUTATION_FAILED,!0)}finally{this._trackEpoch=g.UNINITIALIZED,this._trackCount=0,this.flags&=~I}}_handleAsyncComputation(e){this.flags=(this.flags|M)&~(A|j|N|P),this._notifySubscribers(void 0,void 0),this._asyncRetryCount=0,this._promiseId=(this._promiseId+1)%h.MAX_PROMISE_ID;let t=this._promiseId;e.then(e=>{if(t===this._promiseId){if(this._isDirty()){let e=he();return this._lastDriftEpoch!==e&&(this._lastDriftEpoch=e,this._asyncRetryCount=0),this._asyncRetryCount++<this._maxAsyncRetries?this._markDirty():this._handleError(new C(`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`),T.COMPUTED_ASYNC_COMPUTATION_FAILED)}this._finalizeResolution(e),this._notifySubscribers(e,void 0)}},e=>t===this._promiseId&&this._handleError(e,T.COMPUTED_ASYNC_COMPUTATION_FAILED))}_handleError(e,t,n=!1){let r=E(e,C,t);if(!n&&!(this.flags&P)&&(this.version=de(this.version)),this._error=r,this.flags=this.flags&~(A|j|M|N)|P|F,this._onError)try{this._onError(r)}catch(e){console.error(T.CALLBACK_ERROR_IN_ERROR_HANDLER,e)}if(n)throw r;this._notifySubscribers(void 0,void 0)}_finalizeResolution(e){(!(this.flags&N)||!this._equal(this._value,e))&&(this.version=de(this.version)),this._value=e,this._error=null,this.flags=(this.flags|N)&~(A|j|M|P|F)}execute(){this._markDirty()}_markDirty(){this.flags&(I|j)||(this.flags|=j,this._notifySubscribers(void 0,void 0))}_isDirty(){let e=this._deps;return e.hasComputeds?this._deepDirtyCheck():e.isDirtyFast()}_deepDirtyCheck(){let e=this._deps,t=O.current;O.current=null;try{let t=e.size;for(let n=0;n<t;n++){let t=e.getAt(n);if(t==null)continue;let r=t.node;if(r.flags&je)try{r.value}catch{}if(r.version!==t.version)return this._hotIndex=n,!0}return this._hotIndex=-1,!1}finally{O.current=t}}};function L(e,t={}){return new Ne(e,t)}var Pe=class extends ce{constructor(e,t={}){super(),this[Se]=!0,this._cleanup=null,this._deps=new Ee,this._currentEpoch=g.UNINITIALIZED,this._lastFlushEpoch=g.UNINITIALIZED,this._fn=e,this._onError=t.onError??null,this._sync=t.sync??!1,this._maxExecutions=t.maxExecutionsPerSecond??p.MAX_EXECUTIONS_PER_SECOND,this._maxExecutionsPerFlush=t.maxExecutionsPerFlush??p.MAX_EXECUTIONS_PER_EFFECT,this._cleanup=null,this._deps=new Ee,this._currentEpoch=g.UNINITIALIZED,this._lastFlushEpoch=g.UNINITIALIZED,this._executionsInEpoch=0,this._executionCount=0,this._windowStart=0,this._windowCount=0,this._execId=0,this._trackCount=0,this._sync?this._notifyCallback=()=>this.execute():this._notifyCallback=()=>D.schedule(this),ae.attachDebugInfo(this,`effect`,this.id)}run(){if(this.flags&u.DISPOSED)throw new w(T.EFFECT_DISPOSED);this.execute(!0)}dispose(){this.flags&u.DISPOSED||(this.flags|=u.DISPOSED,this._execCleanup(),this._deps?.disposeAll())}[Symbol.dispose](){this.dispose()}addDependency(e){if(!(this.flags&u.EXECUTING))return;let t=this._currentEpoch;if(e._lastSeenEpoch===t)return;e._lastSeenEpoch=t;let n=this._trackCount,r=this._deps,i;i=n===0?r._s0:n===1?r._s1:n===2?r._s2:n===3?r._s3:r.getAt(n),i!=null&&i.node===e?i.version=e.version:r.claimExisting(e,n)||this._insertNewDependency(e,n),e.flags&d.IS_COMPUTED&&(r.hasComputeds=!0),this._trackCount=n+1}_insertNewDependency(e,t){let n;try{let t=e.subscribe(this._notifyCallback);n=new b(e,e.version,t)}catch(t){let r=E(t,w,T.EFFECT_EXECUTION_FAILED);if(console.error(r),this._onError)try{this._onError(r)}catch{}n=new b(e,e.version,void 0)}this._deps.insertNew(t,n)}execute(e=!1){if(this.flags&(u.DISPOSED|u.EXECUTING))return;let t=this._deps;if(!e&&t.size>0&&!this._isDirty())return;this._checkInfiniteLoops(),this.flags|=u.EXECUTING,this._execCleanup(),this._currentEpoch=ue(),this._trackCount=0,t.prepareTracking(),this._hotIndex=-1;let n=!1;try{let e=O.run(this,this._fn);t.truncateFrom(this._trackCount),t.seal(),n=!0,ke(e)?this._handleAsyncResult(e):this._cleanup=typeof e==`function`?e:null}catch(e){if(!n)try{t.truncateFrom(this._trackCount)}catch{}this._handleExecutionError(e),this._cleanup=null}finally{this.flags&=~u.EXECUTING}}_isDirty(){let e=this._deps;return e.hasComputeds?this._deepDirtyCheck():e.isDirtyFast()}_handleAsyncResult(e){let t=++this._execId;e.then(e=>{if(t!==this._execId||this.flags&u.DISPOSED){if(typeof e==`function`)try{e()}catch(e){this._handleExecutionError(e,T.EFFECT_CLEANUP_FAILED)}return}typeof e==`function`&&(this._cleanup=e)},e=>t===this._execId&&this._handleExecutionError(e))}_deepDirtyCheck(){let e=O.current;O.current=null;let t=this._deps;try{let e=t.size;for(let n=0;n<e;n++){let e=t.getAt(n);if(e==null)continue;let r=e.node;if(r.flags&d.IS_COMPUTED&&this._tryPullComputed(r),r.version!==e.version)return this._hotIndex=n,!0}return!1}finally{O.current=e}}_tryPullComputed(e){try{e.value}catch{}}_execCleanup(){if(this._cleanup){try{this._cleanup()}catch(e){this._handleExecutionError(e,T.EFFECT_CLEANUP_FAILED)}this._cleanup=null}}_checkInfiniteLoops(){let e=he();this._lastFlushEpoch!==e&&(this._lastFlushEpoch=e,this._executionsInEpoch=0),++this._executionsInEpoch>this._maxExecutionsPerFlush&&this._throwInfiniteLoopError(`per-effect`),ve()>p.MAX_EXECUTIONS_PER_FLUSH&&this._throwInfiniteLoopError(`global`),this._executionCount++}_checkFrequencyLimit(){if(!Number.isFinite(this._maxExecutions))return;let e=Date.now();if(e-this._windowStart>=m.EFFECT_FREQUENCY_WINDOW){this._windowStart=e,this._windowCount=1;return}if(++this._windowCount>this._maxExecutions){let e=new w(T.EFFECT_FREQUENCY_LIMIT_EXCEEDED);throw this.dispose(),this._handleExecutionError(e),e}}get isDisposed(){return(this.flags&u.DISPOSED)!==0}get executionCount(){return this._executionCount}get isExecuting(){return(this.flags&u.EXECUTING)!==0}_throwInfiniteLoopError(e){let t=new w(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${fe}`);throw this.dispose(),console.error(t),t}_handleExecutionError(e,t=T.EFFECT_EXECUTION_FAILED){let n=E(e,w,t);if(console.error(n),this._onError)try{this._onError(n)}catch(e){console.error(E(e,w,T.CALLBACK_ERROR_IN_ERROR_HANDLER))}}};function R(e,t={}){if(typeof e!=`function`)throw new w(T.EFFECT_MUST_BE_FUNCTION);let n=new Pe(e,t);return n.execute(),n}function Fe(e){if(typeof e!=`function`)throw TypeError(T.BATCH_CALLBACK_MUST_BE_FUNCTION);D.startBatch();try{return e()}finally{D.endBatch()}}function z(e){return De(e)}function Ie(e){return!!e&&typeof e.then==`function`}function B(e){let t=e.tagName.toLowerCase();if(e.id)return`${t}#${e.id}`;let n=e.classList,r=n.length;if(r===0)return t;let i=t;for(let e=0;e<r;e++)i+=`.${n[e]}`;return i}var V=Object.prototype.hasOwnProperty;function Le(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=e,a=t;for(let e=0;e<n.length;e++){let t=n[e];if(!V.call(a,t)||i[t]!==a[t])return!1}return!0}var H={ROUTE:`[atom-route]`,BINDING:`[atom-binding]`,LIST:`[atom-list]`,MOUNT:`[atom-mount]`},U=Object.freeze({mode:`hash`,basePath:``,autoBindLinks:!1,activeClass:`active`}),Re={EVENT:`input`,DEBOUNCE:0},ze={HIGHLIGHT_DURATION_MS:500},Be=new Set([`input`,`select`,`textarea`]),Ve=new Set([`innerHTML`,`outerHTML`,`srcdoc`,`__proto__`,`constructor`,`prototype`]),W={ROUTE:{NOT_FOUND:e=>`Route "${e}" not found and no notFound route configured`,TEMPLATE_NOT_FOUND:e=>`Template "${e}" not found`,TARGET_NOT_FOUND:e=>`Target element "${e}" not found`,MALFORMED_URI:e=>`Malformed URI component: ${e}`},SECURITY:{UNSAFE_CONTENT:()=>`Unsafe content neutralized during sanitization.`,BLOCKED_CSS_VALUE:e=>`Blocked dangerous value in CSS style property "${e}".`,BLOCKED_EVENT_HANDLER:e=>`Blocked setting dangerous event handler attribute/property "${e}".`,BLOCKED_PROTOCOL:e=>`Blocked dangerous protocol in "${e}".`,BLOCKED_PROP:e=>`Blocked setting dangerous property "${e}". Use html binding for sanitized HTML.`},BINDING:{INVALID_INPUT_ELEMENT:e=>`Val binding used on non-input element <${e}>.`,MISSING_SOURCE:e=>`[${e}] source is required when prop/name is a string.`,MISSING_CONDITION:e=>`[${e}] condition is required when className is a string.`,UPDATER_ERROR:(e,t)=>`Updater threw in binding "${e}"${t?` (static)`:``}`,CLEANUP_ERROR:e=>`Binding cleanup error${e?`: ${e}`:``}`,PARSE_ERROR:e=>`parse() threw during DOM→Atom sync${e?`: ${e}`:``}`},LIST:{DUPLICATE_KEY:(e,t,n)=>`Duplicate key "${e}" at index ${t} in atomList <${n}>.`},MOUNT:{ERROR:e=>`Mount error${e?` in component <${e}>`:``}`,CLEANUP_ERROR:e=>`Cleanup error${e?` in component <${e}>`:``}`},CORE:{EFFECT_DISPOSE_ERROR:e=>`Effect dispose error${e?`: ${e}`:``}`}},He=`${ze.HIGHLIGHT_DURATION_MS/1e3}s`;function Ue(){if(typeof window<`u`){let e=window.__ATOM_DEBUG__;if(typeof e==`boolean`)return e}try{if(globalThis.process?.env?.VITE_ATOM_DEBUG===`true`)return!0}catch{}return!1}var We=Ue(),G={get enabled(){if(typeof window<`u`){let e=window.__ATOM_DEBUG__;if(typeof e==`boolean`)return e}return We},set enabled(e){We=e},log(e,...t){this.enabled&&console.log(`${e}`,...t)},atomChanged(e,t,n,r){this.enabled&&console.log(`${e} Atom "${t??`anonymous`}" changed:`,n,`→`,r)},domUpdated(e,t,n,r){if(!this.enabled)return;let i=t instanceof Element?t:t[0];i&&(console.log(`${e} DOM updated: ${B(i)}.${n} =`,r),Ze(i))},cleanup(e,t){this.enabled&&console.log(`${e} Cleanup: ${t}`)},warn(e,t,...n){console.warn(`${e} ${t}`,...n)},error(e,t,n){console.error(`${e} ${t}`,n)}},Ge=`atom-debug-highlight`,Ke=`data-atom-debug`,qe;function Je(){if((qe instanceof HTMLStyleElement?qe:qe?.deref())?.isConnected||document.querySelector(`style[${Ke}]`))return;let e=document.createElement(`style`);e.setAttribute(Ke,``),e.textContent=`.${Ge}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${He} ease-out}`,document.head.appendChild(e),qe=typeof WeakRef<`u`?new WeakRef(e):e}var Ye=new WeakMap,Xe=new WeakMap;function Ze(e){if(!G.enabled||!e.isConnected)return;Je();let t=Xe.get(e);t!==void 0&&cancelAnimationFrame(t);let n=Ye.get(e);n!==void 0&&clearTimeout(n);let r=requestAnimationFrame(()=>{Xe.delete(e),e.isConnected&&(e.classList.add(Ge),Ye.set(e,setTimeout(()=>{e.isConnected&&e.classList.remove(Ge),Ye.delete(e)},ze.HIGHLIGHT_DURATION_MS)))});Xe.set(e,r)}function Qe(e,t){return Te(e,t)}Object.defineProperty(Qe,`debug`,{enumerable:!0,configurable:!0,get(){return G.enabled},set(e){G.enabled=e}});function $e(){return new Promise(e=>setTimeout(e,0))}var et={atom:Qe,computed:L,effect:R,batch:Fe,untracked:k,isAtom:De,isComputed:Oe,isReactive:z,nextTick:$e};t.default.extend(et);var tt=class{constructor(e=50,t=256){this.limit=e,this.capacity=t,this.pool=[]}acquire(){return this.pool.pop()??[]}release(e){e.length>this.capacity||this.pool.length>=this.limit||Object.isFrozen(e)||(e.length=0,this.pool.push(e))}reset(){this.pool.length=0}},nt=class{constructor(e,t,n=64){this.factory=e,this.reset=t,this.limit=n,this.pool=[]}acquire(){return this.pool.pop()??this.factory()}release(e){this.pool.length>=this.limit||(this.reset(e),this.pool.push(e))}drain(){this.pool.length=0}get size(){return this.pool.length}},rt=new tt,it=new tt,at=new nt(()=>({effects:void 0,cleanups:void 0,componentCleanup:void 0}),e=>{e.effects=void 0,e.cleanups=void 0,e.componentCleanup=void 0},128),K=`_aes-bound`,q=new class{constructor(){this.records=new WeakMap,this.preservedNodes=new WeakSet,this.ignoredNodes=new WeakSet}keep(e){this.preservedNodes.add(e)}isKept(e){return this.preservedNodes.has(e)}markIgnored(e){this.ignoredNodes.add(e)}isIgnored(e){return this.ignoredNodes.has(e)}getOrCreateRecord(e){let t=this.records.get(e);return t||(t=at.acquire(),this.records.set(e,t),e.classList.add(K)),t}trackEffect(e,t){let n=this.getOrCreateRecord(e);n.effects??=rt.acquire(),n.effects.push(t)}trackCleanup(e,t){let n=this.getOrCreateRecord(e);n.cleanups??=it.acquire(),n.cleanups.push(t)}setComponentCleanup(e,t){let n=this.getOrCreateRecord(e);n.componentCleanup=t}hasBind(e){return this.records.has(e)}cleanup(e){let t=this.records.get(e);if(!t){e.nodeType===1&&e.classList.remove(K),this.preservedNodes.delete(e),this.ignoredNodes.delete(e);return}if(this.records.delete(e),this.preservedNodes.delete(e),this.ignoredNodes.delete(e),e.nodeType===1&&e.classList.remove(K),G.enabled){let t=e.nodeType===1?B(e):e.nodeName||`Node`;G.cleanup(H.BINDING,t)}if(t.componentCleanup)try{t.componentCleanup()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.MOUNT,W.MOUNT.CLEANUP_ERROR(n),t)}if(t.effects){let n=t.effects;for(let t=0,r=n.length;t<r;t++)try{n[t].dispose()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.BINDING,W.CORE.EFFECT_DISPOSE_ERROR(n),t)}rt.release(n),t.effects=void 0}if(t.cleanups){let n=t.cleanups;for(let t=0,r=n.length;t<r;t++)try{n[t]()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.BINDING,W.BINDING.CLEANUP_ERROR(n),t)}it.release(n),t.cleanups=void 0}at.release(t)}cleanupDescendants(e){let t=`getElementsByClassName`in e&&typeof e.getElementsByClassName==`function`?e.getElementsByClassName(K):e.querySelectorAll(`.${K}`);for(let e=t.length-1;e>=0;e--){let n=t[e];n&&(this.records.has(n)?this.cleanup(n):(n.classList.remove(K),G.enabled&&G.warn(H.BINDING,`${K} class found on unregistered element:`,n)))}}cleanupTree(e){(e.nodeType===1||e.nodeType===11)&&this.cleanupDescendants(e),this.cleanup(e)}},ot=new Map;function st(e){if(ot.has(e))return;let t=new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){let n=e[t].removedNodes;for(let e=0,t=n.length;e<t;e++){let t=n[e];t.nodeType===1&&(t.isConnected||q.isKept(t)||q.isIgnored(t)||q.cleanupTree(t))}}});t.observe(e,{childList:!0,subtree:!0}),ot.set(e,t)}function ct(){ot.forEach(e=>e.disconnect()),ot.clear()}var lt=Symbol(`atom-effect-internal`),ut=new WeakMap,J=null,dt=e=>{if(e[lt])return e;let t=ut.get(e);return t||(t=function(...t){return Fe(()=>e.apply(this,t))},t[lt]=!0,ut.set(e,t)),t};function ft(e){let t={},n=Object.entries(e);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r[0],a=r[1];a&&(t[i]=dt(a))}return t}function pt(e){let t={},n=Object.entries(e);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r[0],a=r[1];t[i]=a?ut.get(a)??a:void 0}return t}function mt(){if(J!==null)return;J={on:t.default.fn.on,off:t.default.fn.off,remove:t.default.fn.remove,empty:t.default.fn.empty,detach:t.default.fn.detach};let e=J;t.default.fn.remove=function(t){let n=t?this.filter(t):this;for(let e=0,t=n.length;e<t;e++){let t=n[e];t&&(q.markIgnored(t),q.cleanupTree(t))}let r=e.remove.call(this,t);return r===void 0?this:r},t.default.fn.empty=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t?.hasChildNodes()&&q.cleanupDescendants(t)}let t=e.empty.call(this);return t===void 0?this:t},t.default.fn.detach=function(t){let n=t?this.filter(t):this;for(let e=0,t=n.length;e<t;e++){let t=n[e];t&&q.keep(t)}let r=e.detach.call(this,t);return r===void 0?this:r},t.default.fn.on=function(...t){let n=t[0];if(n&&typeof n==`object`)t[0]=ft(n);else{let e=t.length-1;e>=0&&typeof t[e]==`function`&&(t[e]=dt(t[e]))}let r=e.on.apply(this,t);return r===void 0?this:r},t.default.fn.off=function(...t){let n=t[0];if(n&&typeof n==`object`)t[0]=pt(n);else{let e=t.length-1;if(e>=0&&typeof t[e]==`function`){let n=t[e];t[e]=ut.get(n)??n}}let r=e.off.apply(this,t);return r===void 0?this:r}}function ht(){J!==null&&(t.default.fn.on=J.on,t.default.fn.off=J.off,t.default.fn.remove=J.remove,t.default.fn.empty=J.empty,t.default.fn.detach=J.detach,J=null)}var Y=function(e){return e[e.None=0]=`None`,e[e.Focused=1]=`Focused`,e[e.Composing=2]=`Composing`,e[e.SyncingToAtom=4]=`SyncingToAtom`,e[e.SyncingToDom=8]=`SyncingToDom`,e[e.Busy=14]=`Busy`,e}({}),gt=0;function X(e){e[lt]=!0}var _t=class{constructor(e,t,n){this.flags=0,this.timeoutId=void 0,this.handleCompositionStart=()=>{this.flags|=Y.Composing},this.handleCompositionEnd=()=>{this.flags&=~Y.Composing,this.handleInput()},this.handleFocus=()=>{this.flags|=Y.Focused},this.handleBlur=()=>{this.flags&=~Y.Focused;let e=!!(this.flags&Y.Composing);this.flags&=~Y.Composing,this.flushPendingDebounce(),e&&this.timeoutId===void 0&&this.syncAtomFromDom(),this.normalizeDomValue()},this.syncDomFromAtom=()=>{let e=this.atom.value;k(()=>{let t=this.format(e),n;if(n=this.isMultipleSelect?this.$el.val()||[]:this.el.value,this.equal(n,e))return;let r=!!(this.flags&Y.Focused);if(r)try{let t=this.isMultipleSelect?n:this.parse(this.el.value);if(this.equal(t,e))return}catch{}this.flags|=Y.SyncingToDom;try{if(this.isMultipleSelect)this.$el.val(e);else if(r&&(this.el instanceof HTMLInputElement||this.el instanceof HTMLTextAreaElement))try{let e=this.el.selectionStart,n=this.el.selectionEnd;this.el.value=t;let r=t.length;e!==null&&n!==null&&this.el.setSelectionRange(e<r?e:r,n<r?n:r)}catch{this.el.value=t}else this.el.value=t;G.enabled&&G.domUpdated(H.BINDING,this.$el,`val`,t)}finally{this.flags&=~Y.SyncingToDom}})},this.cleanup=()=>{this.$el.off(this.ns),clearTimeout(this.timeoutId),this.timeoutId=void 0},this.$el=e,this.el=e[0],this.atom=t,this.isMultipleSelect=this.el.tagName===`SELECT`&&this.el.multiple,this.ns=`.atomBind-${++gt}`;let r=n.debounce??0,i=n.event??Re.EVENT;this.parse=n.parse??(e=>e),this.format=n.format??(e=>this.isMultipleSelect?(Array.isArray(e)?e:e?[String(e)]:[]).join(`,`):String(e??``));let a=n.equal??Object.is;this.equal=(e,t)=>a(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>Object.is(e,t[n])):!1,r>0?this.handleInput=()=>{this.flags&Y.Composing||(clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>this.syncAtomFromDom(),r))}:this.handleInput=()=>{this.flags&Y.Composing||this.syncAtomFromDom()},X(this.handleFocus),X(this.handleBlur),X(this.handleCompositionStart),X(this.handleCompositionEnd),X(this.handleInput),this.bindEvents(i)}flushPendingDebounce(){this.timeoutId!==void 0&&(clearTimeout(this.timeoutId),this.timeoutId=void 0,this.syncAtomFromDom())}normalizeDomValue(){let e=this.format(this.atom.peek());if(this.isMultipleSelect){let e=this.$el.val()||[],t=Array.isArray(this.atom.peek())?this.atom.peek():[];this.equal(e,t)||this.$el.val(t)}else this.el.value!==e&&(this.el.value=e)}syncAtomFromDom(){if(!(this.flags&Y.Busy)){this.flags|=Y.SyncingToAtom;try{let e;e=this.isMultipleSelect?this.$el.val()||[]:this.el.value;let t=this.parse(e);this.equal(this.atom.peek(),t)||(this.atom.value=t)}catch(e){G.warn(H.BINDING,W.BINDING.PARSE_ERROR(e instanceof Error?e.message:String(e)),e)}finally{this.flags&=~Y.SyncingToAtom}}}bindEvents(e){let t=this.ns,n=e.trim().split(/\s+/).map(e=>`${e}${t}`).join(` `);this.$el.on(`focus${t}`,this.handleFocus).on(`blur${t}`,this.handleBlur).on(`compositionstart${t}`,this.handleCompositionStart).on(`compositionend${t}`,this.handleCompositionEnd).on(n,this.handleInput)}};function vt(e,t,n){let r=new _t(e,t,n);return{fx:R(r.syncDomFromAtom),cleanup:r.cleanup}}function yt(e,t,n,r){let i=null,a=t=>{if(Ie(t)){let a=t;i=a,a.then(t=>{i===a&&k(()=>{try{n(t),G.enabled&&G.domUpdated(H.BINDING,e,`${r} (async)`,t)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)}})}).catch(e=>{i===a&&G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)})}else{i=null;try{n(t),G.enabled&&G.domUpdated(H.BINDING,e,r,t)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r,!0),e)}}};z(t)?q.trackEffect(e,R(()=>{let e=t.value;k(()=>a(e))},{name:r})):typeof t==`function`?q.trackEffect(e,R(()=>{let e=t();k(()=>a(e))},{name:r})):k(()=>a(t))}function bt(e,t,n,r){let i=Object.keys(t),a=[],o={};for(let e=0;e<i.length;e++){let n=i[e],r=t[n];z(r)||typeof r==`function`?a.push(n):o[n]=r}let s=0,c=t=>{let i=Object.keys(t),a=[],o={};for(let e=0;e<i.length;e++){let n=i[e],r=t[n];Ie(r)?a.push(r.then(e=>({key:n,val:e}))):o[n]=r}if(a.length>0){let t=++s;Promise.all(a).then(i=>{if(t===s){for(let e=0;e<i.length;e++){let{key:t,val:n}=i[e];o[t]=n}k(()=>{try{n(o),G.enabled&&G.domUpdated(H.BINDING,e,`${r} (async)`,o)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)}})}})}else{s++;try{n(o),G.enabled&&G.domUpdated(H.BINDING,e,r,o)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r,!0),e)}}};a.length>0?q.trackEffect(e,R(()=>{let e={...o};for(let n=0;n<a.length;n++){let r=a[n],i=t[r];e[r]=z(i)?i.value:i()}k(()=>c(e))},{name:r})):k(()=>c(o))}var xt=new Set([`href`,`src`,`action`,`formaction`,`xlink:href`,`data`,`poster`,`background`,`cite`,`longdesc`,`profile`,`usemap`,`classid`,`codebase`]),St=/^\s*(?:javascript|vbscript)\s*:/i,Ct=/(?:expression\s*\(|behavior\s*:|-moz-binding\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i,wt=/url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i,Tt=/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,Et=/&#x([0-9a-f]+);?|&#([0-9]+);?/gi,Dt={colon:`:`,Tab:` `,NewLine:`
2
- `},Ot=/&(colon|Tab|NewLine);/g,kt=/<\?[\s\S]*?\?>/g,At=/(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi,jt=/(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi,Mt=/data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi,Nt=/\bon\w+\s*=/gim,Pt=new RegExp(Ct.source,`gim`);function Z(e){let t=String(e??``);t=t.replace(Tt,``),t=t.replace(Et,(e,t,n)=>String.fromCodePoint(t?parseInt(t,16):parseInt(n,10))),t=t.replace(Ot,(e,t)=>Dt[t]??``),t=t.replace(kt,``);let n;do n=t,t=t.replace(At,``);while(t!==n);return t=t.replace(jt,`data-unsafe-protocol:`),t=t.replace(Mt,`data-unsafe-protocol:`),t=t.replace(Nt,`data-unsafe-attr=`),t=t.replace(Pt,`data-unsafe-css:`),t}function Ft(e){return e.toLowerCase().includes(`url(`)?wt.test(e):!1}var It=new Map;function Lt(e){let t=It.get(e);return t===void 0?(t=e.includes(`-`)?e.replace(/-./g,e=>e[1].toUpperCase()):e,It.set(e,t),t):t}var Rt=new WeakMap;function zt(e){let t=Rt.get(e);return t||(t=L(()=>{let t=e.value;return Ie(t)?t.then(e=>Z(e)):Z(t)}),Rt.set(e,t)),t}function Bt(e){return{el:e,trackCleanup:t=>q.trackCleanup(e,t)}}function Vt(e,t,n){let r=e.el;yt(r,t,e=>{let t=n?n(e):typeof e==`string`?e:String(e??``);r.textContent!==t&&(r.textContent=t)},`text`)}function Ht(e,t){let n=e.el,r=De(t)?zt(t):t;yt(n,r,e=>{let i=r===t?Z(e):e;n.innerHTML!==i&&(q.cleanupDescendants(n),n.innerHTML=i)},`html`)}function Ut(e,t){let n=e.el,r={};for(let e in t)V.call(t,e)&&(r[e]=e.trim().split(/\s+/).filter(Boolean));bt(n,t,e=>{for(let t in e){let i=e[t],a=r[t];i?n.classList.add(...a):n.classList.remove(...a)}},`class`)}function Wt(e,t){let n=e.el,r=n.style,i={},a={};for(let e in t)if(V.call(t,e)){let n=t[e],[r,o]=Array.isArray(n)?n:[n,``];i[e]=r,a[e]={camel:Lt(e),unit:o}}bt(n,i,e=>{for(let t in e){let n=e[t],{camel:i,unit:o}=a[t],s=o?String(n)+o:String(n);Ft(s)||r[i]!==s&&(r[i]=s)}},`css`)}function Gt(e,t){let n=e.el,r={},i={};for(let e in t)if(V.call(t,e)){let n=e.toLowerCase();if(n.startsWith(`on`)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_EVENT_HANDLER(e)}`);continue}r[e]=t[e],i[e]={isAria:n.startsWith(`aria-`),isUrl:xt.has(n)}}let a={};for(let e in r)a[e]=n.getAttribute(e);bt(n,r,e=>{for(let t in e){let r=e[t],o=i[t],s=o.isAria;if(r==null||r===!1&&!s){a[t]!==null&&(n.removeAttribute(t),a[t]=null);continue}let c=r===!0?s?`true`:t:String(r);if(o.isUrl&&St.test(c)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(t)}`);continue}a[t]!==c&&(n.setAttribute(t,c),a[t]=c)}},`attr`)}function Kt(e,t){let n=e.el,r={},i={};for(let e in t)if(V.call(t,e)){let n=e.toLowerCase();if(n.startsWith(`on`)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_EVENT_HANDLER(e)}`);continue}if(Ve.has(e)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROP(e)}`);continue}r[e]=t[e],i[e]={isUrl:xt.has(n)}}bt(e.el,r,e=>{for(let t in e){let r=e[t];if(i[t].isUrl&&typeof r==`string`&&St.test(r)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(t)}`);continue}n[t]!==r&&(n[t]=r)}},`prop`)}function qt(e,t,n){let r=e.el,i=n?`hide`:`show`,a=r.style.display,o=a===`none`?``:a;yt(r,t,e=>{let t=n===!!e?`none`:o;r.style.display!==t&&(r.style.display=t)},i)}function Jt(e,n,r={}){let i=e.el.tagName.toLowerCase();if(!Be.has(i)){console.warn(`${H.BINDING} ${W.BINDING.INVALID_INPUT_ELEMENT(i)}`);return}let{fx:a,cleanup:o}=vt((0,t.default)(e.el),n,r);q.trackEffect(e.el,a),e.trackCleanup(o)}function Yt(e,n){let r=e.el,i=(0,t.default)(r),a=r.type===`radio`,o=()=>{let e=r.checked;if(n.peek()!==e&&(n.value=e,a&&e&&r.name)){let e=r.name.replace(/"/g,`\\"`);(r.form?(0,t.default)(r.form):(0,t.default)(document)).find(`input[type="radio"][name="${e}"]`).not(r).trigger(`change.atomRadioSync`)}};o[lt]=!0,i.on(`change change.atomRadioSync`,o),e.trackCleanup(()=>i.off(`change change.atomRadioSync`,o));let s=R(()=>{let e=!!n.value;k(()=>{r.checked!==e&&(r.checked=e,G.enabled&&G.domUpdated(H.BINDING,r,`checked`,e))})});q.trackEffect(r,s)}function Xt(e,n){let r=(0,t.default)(e.el);r.on(n),e.trackCleanup(()=>r.off(n))}function Zt(e,n,r){let i=(0,t.default)(e.el);i.on(n,r),e.trackCleanup(()=>i.off(n,r))}function Qt(e){q.cleanupTree(e)}function $t(e,t,n,r){if(n===t.length)return r;let i=t[n],a=e&&typeof e==`object`?e:{},o=a[i],s=$t(o,t,n+1,r);return Object.is(o,s)?e:{...a,[i]:s}}function en(e,t){let n=Symbol.for(`atom-effect/atom`),r=Symbol.for(`atom-effect/writable`),i=t.includes(`.`)?t.split(`.`):[t],a=e=>{let t=e;for(let e=0,n=i.length;e<n&&t!=null;e++)t=t[i[e]];return t};return{get value(){return a(e.value)},set value(t){let n=e.peek(),r=$t(n,i,0,t);r!==n&&(e.value=r)},peek(){return a(e.peek())},subscribe(t){return e.subscribe(t)},subscriberCount(){return e.subscriberCount()},dispose(){},[Symbol.dispose](){},[n]:!0,[r]:!0}}function tn(e,t,n={}){let r=e.elements,i=e=>{if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return;let r=e.name;if(!r||q.hasBind(e))return;let i=en(t,r),a=Bt(e);e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`)?Yt(a,i):Jt(a,i,n)};for(let e=0,t=r.length;e<t;e++)i(r[e]);let a=new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.type===`childList`){let e=n.addedNodes;for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.nodeType===1){let e=n;i(e);let t=e.querySelectorAll(`input, select, textarea`);for(let e=0,n=t.length;e<n;e++)i(t[e])}}}else n.type===`attributes`&&n.attributeName===`name`&&i(n.target)}});a.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`name`]}),q.trackCleanup(e,()=>a.disconnect())}function Q(e,t){for(let n=0,r=e.length;n<r;n++){let r=e[n];r.nodeType===1?t(Bt(r),r):G.enabled&&G.log(H.BINDING,`Skipping non-Element node (nodeType=${r.nodeType})`)}return e}t.default.fn.atomText=function(e,t){return Q(this,n=>Vt(n,e,t))},t.default.fn.atomHtml=function(e){return Q(this,t=>Ht(t,e))},t.default.fn.atomClass=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_CONDITION(`atomClass`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>Ut(e,n))},t.default.fn.atomCss=function(e,t,n){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomCss`)}`),this;let r=typeof e==`string`?{[e]:n?[t,n]:t}:e;return Q(this,e=>Wt(e,r))},t.default.fn.atomAttr=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomAttr`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>Gt(e,n))},t.default.fn.atomProp=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomProp`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>Kt(e,n))},t.default.fn.atomShow=function(e){return Q(this,t=>qt(t,e,!1))},t.default.fn.atomHide=function(e){return Q(this,t=>qt(t,e,!0))},t.default.fn.atomVal=function(e,t={}){return Q(this,n=>Jt(n,e,t))},t.default.fn.atomChecked=function(e){return Q(this,t=>Yt(t,e))},t.default.fn.atomForm=function(e,t={}){return Q(this,(n,r)=>{r instanceof HTMLFormElement&&tn(r,e,t)})},t.default.fn.atomOn=function(e,t){return Q(this,n=>Zt(n,e,t))},t.default.fn.atomBind=function(e){let{text:t,html:n,class:r,css:i,attr:a,prop:o,show:s,hide:c,val:l,checked:u,form:d,on:f}=e,p=l===void 0?null:Array.isArray(l)?{atom:l[0],opts:l[1]}:{atom:l,opts:void 0};return Q(this,e=>{t!==void 0&&Vt(e,t),n!==void 0&&Ht(e,n),r!==void 0&&Ut(e,r),i!==void 0&&Wt(e,i),a!==void 0&&Gt(e,a),o!==void 0&&Kt(e,o),s!==void 0&&qt(e,s,!1),c!==void 0&&qt(e,c,!0),p!==null&&Jt(e,p.atom,p.opts),u!==void 0&&Yt(e,u),d!==void 0&&e.el instanceof HTMLFormElement&&tn(e.el,d),f!==void 0&&Xt(e,f)})},t.default.fn.atomUnbind=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t.nodeType===1&&Qt(t)}return this};var nn=new WeakMap,rn=0,an=new nt(()=>new Map,e=>e.clear()),on=new nt(()=>new Set,e=>e.clear()),$=new tt(100,1024);function sn(e,t,n){t?.isConnected?e.insertBefore(t):e.appendTo(n)}function cn(e){return e instanceof Element?(0,t.default)(e):e}var ln=class{constructor(e,t,n){this.$container=e,this.containerSelector=t,this.onRemove=n,this.oldKeys=[],this.oldItems=[],this.oldNodes=[],this.removingKeys=new Set,this.$emptyEl=null,this.keyToIndex=new Map,this.statesBuffer=new Uint8Array(256),this.indicesBuffer=new Int32Array(256)}scheduleRemoval(e,t){let n=()=>{this.fx?.isDisposed||(t.remove(),this.removingKeys.delete(e),G.log(H.LIST,`${this.containerSelector} removed item:`,e))};if(!this.onRemove){n();return}let r=this.onRemove(t);r instanceof Promise?r.then(n,n):n()}removeItem(e,t){for(let e=0;e<t.length;e++){let n=t[e];n instanceof Element&&n.removeAttribute(`data-atom-key`)}this.removingKeys.add(e),this.scheduleRemoval(e,t)}dispose(){this.removingKeys.clear(),this.oldKeys.length=0,this.oldItems.length=0,this.oldNodes.length=0,this.keyToIndex.clear(),this.$emptyEl?.remove(),this.$container.off(`.atomList`);let e=new Uint8Array,t=new Int32Array;this.statesBuffer=e,this.indicesBuffer=t}ensureBuffers(e){this.statesBuffer.length<e&&(this.statesBuffer=new Uint8Array(Math.max(e,this.statesBuffer.length*2))),this.indicesBuffer.length<e&&(this.indicesBuffer=new Int32Array(Math.max(e,this.indicesBuffer.length*2)))}};function un(e,n,r,i){if(e.$emptyEl&&n>0&&(e.$emptyEl.remove(),e.$emptyEl=null),n!==0)return;let{oldKeys:a,oldNodes:o,onRemove:s}=e;if(s)for(let t=0,n=a.length;t<n;t++){let n=a[t],r=o[t];r&&e.removeItem(n,cn(r))}else{for(let t=0,n=a.length;t<n;t++)e.removingKeys.delete(a[t]);r.empty()}i&&!e.$emptyEl&&(e.$emptyEl=(0,t.default)(typeof i==`string`?Z(i):i).appendTo(r)),$.release(e.oldKeys),$.release(e.oldItems),$.release(e.oldNodes),e.oldKeys=[],e.oldItems=[],e.oldNodes=[]}function dn(e,t,n,r,i,a){let{oldKeys:o,oldItems:s,oldNodes:c,removingKeys:l,keyToIndex:u}=e,d=o.length,f=0,p=d-1,m=n-1;for(;f<=p&&f<=m;){let e=t[f],n=r(e,f);if(o[f]!==n)break;let i=s[f];if(!(a?a(i,e):Le(i,e)))break;u.set(n,f),f++}for(;p>=f&&m>=f;){let e=t[m],n=r(e,m);if(o[p]!==n)break;let i=s[p];if(!(a?a(i,e):Le(i,e)))break;u.set(n,m),p--,m--}let h=an.acquire();for(let e=f;e<=p;e++)h.set(o[e],e);let g=$.acquire();g.length=n;let _=on.acquire();e.ensureBuffers(n);let v=$.acquire();v.length=n;let y=$.acquire();y.length=n;let b=e.statesBuffer,x=e.indicesBuffer,S=$.acquire(),C=$.acquire(),w=$.acquire();for(let e=0;e<f;e++)g[e]=o[e],v[e]=t[e],y[e]=c[e],b[e]=3,x[e]=e;for(let e=d-1,r=n-1;r>m;r--,e--)g[r]=o[e],v[r]=t[r],y[r]=c[e],b[r]=3,x[r]=e;for(let n=f;n<=m;n++){let o=t[n],d=r(o,n);if(g[n]=d,v[n]=o,u.set(d,n),_.has(d)){G.warn(H.LIST,W.LIST.DUPLICATE_KEY(d,n,e.containerSelector)),x[n]=-1;continue}_.add(d);let f=h.get(d);if(f===void 0){S.push(d),C.push(o),w.push(n),x[n]=-1,b[n]=1;continue}let p=s[f];y[n]=c[f];let m=a?a(p,o):Le(p,o);!i&&p!==o&&!m?(S.push(d),C.push(o),w.push(n),b[n]=2):b[n]=0,x[n]=l.has(d)?-1:f}return an.release(h),{newKeys:g,newKeySet:_,newItems:v,newNodes:y,newStates:b,newIndices:x,trKeys:S,trItems:C,trIdxs:w,startIndex:f,oldEndIndex:p,newEndIndex:m}}function fn(e,n,r){let{trKeys:i,trItems:a,trIdxs:o,newNodes:s,newStates:c}=e,l=i.length,u=n.render,d=Array(l),f=[],p=0;for(let e=0;e<l;e++){let t=u(a[e],o[e]);d[e]=t,typeof t==`string`&&(f.push(t),p++)}let m=null,h=f.length;if(h>0)if(h===1)m=[Z(f[0])];else{let e=`<template data-atom-sep="${(rn++).toString(36)}"></template>`;m=Z(f.join(e)).split(e)}if(r&&m&&p===l&&!n.bind&&!n.onAdd&&!n.onRemove&&!n.events)return m;let g=0;for(let e=0;e<l;e++){let n=d[e],r=typeof n==`string`?(0,t.default)(m[g++]):(0,t.default)(n),a=o[e],l=c[a],u=i[e],f=String(u);for(let e=0,t=r.length;e<t;e++){let t=r[e];t instanceof Element&&t.setAttribute(`data-atom-key`,f)}if(l===2){let e=s[a];if(e){let t=cn(e);for(let e=0,n=t.length;e<n;e++){let n=t[e];n&&q.cleanupTree(n)}t.replaceWith(r)}}s[a]=r.length===1?r[0]:r}return null}function pn(e,t){let{startIndex:n,oldEndIndex:r,newKeySet:i}=t,{oldKeys:a,oldNodes:o}=e;for(let t=n;t<=r;t++){let n=a[t];if(i.has(n))continue;let r=o[t];r&&e.removeItem(n,cn(r))}}function mn(e,n,r,i,a,o){let{bind:s,update:c,onAdd:l}=a,{newKeys:u,newItems:d,newNodes:f,newStates:p,newIndices:m}=n,h=u.length,g=e.oldKeys.length===0;if(o!==null){r.innerHTML=o.join(``);let n=r.firstElementChild;for(let r=0;r<h&&n;r++){let i=u[r];n.setAttribute(`data-atom-key`,String(i)),f[r]=n,p[r]=0,e.removingKeys.delete(i),G.enabled&&G.domUpdated(H.LIST,(0,t.default)(n),`list.add`,d[r]),n=n.nextElementSibling}return}if(g){let e=document.createDocumentFragment();for(let t=0;t<h;t++){let n=f[t];if(n instanceof Element)e.appendChild(n);else for(let t=0;t<n.length;t++)e.appendChild(n[t])}r.appendChild(e)}else{let e=null,t=2147483647;for(let n=h-1;n>=0;n--){let r=m[n],a=f[n];r!==-1&&r<t?t=r:sn(cn(a),e,i),e=a instanceof Element?a:a[0]??null}}for(let t=0;t<h;t++){let n=f[t],r=p[t];if(r!==3){let i=cn(n),a=d[t];if(r===0?c?.(i,a,t):s?.(i,a,t),r===1){l?.(i);let n=u[t];e.removingKeys.delete(n),G.enabled&&G.domUpdated(H.LIST,i,`list.add`,d[t])}}}}t.default.fn.atomList=function(e,n){let{key:r,bind:i,update:a,onAdd:o,onRemove:s,empty:c,events:l,isEqual:u}=n,d=typeof r==`function`?r:(e,t)=>e[r],f={bind:i,update:a,onAdd:o,onRemove:s,events:l};for(let r=0,i=this.length;r<i;r++){let i=this[r],o=(0,t.default)(i);o.off(`.atomList`);let p=nn.get(i);p&&(p.fx.dispose(),p.ctx.dispose());let m=B(i),h=new ln(o,m,s),g=R(()=>{let t=e.value,r=t.length;k(()=>{if(un(h,r,o,c),r===0)return;G.log(H.LIST,`${m} updating with ${r} items`);let e=dn(h,t,r,d,a,u),s=fn(e,n,h.oldKeys.length===0);if(pn(h,e),mn(h,e,i,o,f,s),l){let{startIndex:t,oldEndIndex:n,newKeySet:r}=e;for(let e=t;e<=n;e++){let t=h.oldKeys[e];r.has(t)||h.keyToIndex.delete(t)}}$.release(h.oldKeys),$.release(h.oldItems),$.release(h.oldNodes),h.oldKeys=e.newKeys,h.oldItems=e.newItems,h.oldNodes=e.newNodes,on.release(e.newKeySet),$.release(e.trKeys),$.release(e.trItems),$.release(e.trIdxs)})});if(h.fx=g,l)for(let e in l){if(!V.call(l,e))continue;let t=l[e],n=e.indexOf(` `),r=n===-1?e:e.slice(0,n),i=(n===-1?null:e.slice(n+1).trim())||`> *`;o.on(`${r}.atomList`,i,function(e){let n=e.target.closest?.(`[data-atom-key]`);if(!n)return;let r=n.getAttribute(`data-atom-key`);if(r===null)return;let i=r;if(!h.keyToIndex.has(r)){let e=Number(r);!Number.isNaN(e)&&h.keyToIndex.has(e)&&(i=e)}let a=h.keyToIndex.get(i);a!==void 0&&t.call(n,h.oldItems[a],a,e)})}q.trackEffect(i,g),nn.set(i,{fx:g,ctx:h}),q.trackCleanup(i,()=>{h.dispose(),nn.delete(i)})}return this};var hn=Object.freeze({});t.default.fn.atomMount=function(e,n){let r=n??hn;for(let n=0,i=this.length;n<i;n++){let i=this[n];if(!i)continue;q.cleanupTree(i);let a=(0,t.default)(i),o;try{o=k(()=>e(a,r))}catch(t){G.error(H.MOUNT,W.MOUNT.ERROR(e.name),t);continue}typeof o==`function`&&q.setComponentCleanup(i,o)}return this},t.default.fn.atomUnmount=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t&&Qt(t)}return this};function gn(e,t){try{return history.pushState(e,``,t),!0}catch(e){return G.warn(H.ROUTE,`PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.`,e),!1}}var _n=class{constructor(e){this.isDestroyed=!1,this.previousRoute=``,this.cleanups=[],this.templateCache=new Map,this.routeCleanups=[],this.lastRawQuery=``,this.cachedParams={},this.config={...e,mode:e.mode??U.mode,basePath:e.basePath??U.basePath,autoBindLinks:e.autoBindLinks??U.autoBindLinks,activeClass:e.activeClass??U.activeClass},this.isHistoryMode=this.config.mode===`history`,this.$target=(0,t.default)(this.config.target),this.normalizedBasePath=this.config.basePath?.replace(/\/$/,``)||``,this.activeClass=this.config.activeClass??U.activeClass,this.previousUrl=this.isHistoryMode?window.location.pathname+window.location.search:window.location.hash,this.currentRouteAtom=Te(this.getRouteName()),this.currentRoute=this.currentRouteAtom,this.queryParamsAtom=Te(this.getQueryParams()),this.queryParams=L(()=>this.queryParamsAtom.value),this.handleUrlChange=this.handleUrlChange.bind(this),this.destroy=this.destroy.bind(this),this.init()}init(){let e=this.isHistoryMode?`popstate`:`hashchange`;window.addEventListener(e,this.handleUrlChange),this.cleanups.push(()=>window.removeEventListener(e,this.handleUrlChange));let t=R(()=>{let e=this.currentRouteAtom.value;k(()=>{let e=this.routeCleanups;for(let t=0,n=e.length;t<n;t++)try{e[t]()}catch(e){G.warn(H.ROUTE,`Cleanup error during route transition:`,e)}e.length=0}),this.renderRoute(e)});this.cleanups.push(()=>t.dispose()),this.setupAutoBindLinks(),this.$target[0]&&q.trackCleanup(this.$target[0],this.destroy)}getRouteName(){let e=this.config.default;if(this.isHistoryMode){let t=window.location.pathname,n=0,r=this.normalizedBasePath;return r&&t.startsWith(r)&&(n=r.length),t.charCodeAt(n)===47&&n++,(n===0?t:t.substring(n))||e}let t=window.location.hash;if(t.length<=1)return e;let n=t.indexOf(`?`);return(n===-1?t.substring(1):t.substring(1,n))||e}getQueryParams(){let e=``;if(this.isHistoryMode)e=window.location.search.substring(1);else{let t=window.location.hash,n=t.indexOf(`?`);n!==-1&&(e=t.substring(n+1))}if(e===this.lastRawQuery)return this.cachedParams;let t={};e&&new URLSearchParams(e).forEach((e,n)=>{t[n]=e});let n=!1,r=this.cachedParams,i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)n=!0;else for(let e=0,i=a.length;e<i;e++){let i=a[e];if(r[i]!==t[i]){n=!0;break}}return n&&(this.cachedParams=t),this.lastRawQuery=e,e.includes(`%`),this.cachedParams}setUrl(e){if(this.isHistoryMode){let t=`${this.normalizedBasePath}/${e}`;gn(null,t),this.previousUrl=t}else{let t=`#${e}`;window.location.hash=t,this.previousUrl=t}}restoreUrl(){this.isHistoryMode?gn(null,this.previousUrl):window.location.hash=this.previousUrl}getCurrentUrl(){return this.isHistoryMode?window.location.pathname+window.location.search:window.location.hash}getRouteConfig(e){let{routes:t,notFound:n}=this.config,r=t[e];return!r&&n&&(r=t[n]),r||(G.warn(H.ROUTE,W.ROUTE.NOT_FOUND(e)),null)}renderTemplate(e){let t=this.templateCache.get(e);if(!t){let n=document.querySelector(e);if(!n||!(n instanceof HTMLTemplateElement))return G.warn(H.ROUTE,W.ROUTE.TEMPLATE_NOT_FOUND(e)),!1;t=n,this.templateCache.set(e,t)}let n=t.content.cloneNode(!0);return this.$target.append(n),!0}renderRoute(e){if(this.isDestroyed)return;let t=this.$target[0];if(!t){G.warn(H.ROUTE,W.ROUTE.TARGET_NOT_FOUND(this.config.target));return}let n=this.getRouteConfig(e);if(!n)return;let r=this.getQueryParams(),i=this.previousRoute,{beforeTransition:a,afterTransition:o}=this.config;a&&k(()=>a(i,e)),this.$target.empty();let s=r,{onEnter:c}=n;if(c){let e=k(()=>c(r,this));e!==void 0&&(s={...r,...e})}let l=e=>{this.routeCleanups.push(e)};n.render?n.render(t,e,s,l,this):n.template&&this.renderTemplate(n.template)&&n.onMount&&n.onMount(this.$target.children(),l,this),o&&k(()=>o(i,e)),this.previousRoute=e}handleUrlChange(){if(this.isDestroyed)return;let e=this.getCurrentUrl();if(e===this.previousUrl)return;let t=this.getRouteName(),n=this.currentRouteAtom.peek(),r=this.getQueryParams();if(n!==t){let e=this.config.routes[n];if(e?.onLeave&&k(()=>e.onLeave(this))===!1){this.restoreUrl();return}this.currentRouteAtom.value=t,this.queryParamsAtom.value=r}else this.queryParamsAtom.value=r;this.previousUrl=e}setupAutoBindLinks(){if(!this.config.autoBindLinks)return;let e=e=>{e.preventDefault();let t=e.currentTarget.dataset.route;t!=null&&this.navigate(t)};(0,t.default)(document).on(`click`,`[data-route]`,e),this.cleanups.push(()=>{(0,t.default)(document).off(`click`,`[data-route]`,e)});let n=this.activeClass,r=[],i=R(()=>{let e=this.currentRouteAtom.value;k(()=>{for(let e=0,t=r.length;e<t;e++){let t=r[e];t.classList.remove(n),t.removeAttribute(`aria-current`)}try{let t=e.replace(/"/g,`\\"`),i=document.querySelectorAll(`[data-route="${t}"]`),a=i.length,o=Array(a);for(let e=0;e<a;e++){let t=i[e];t.classList.add(n),t.setAttribute(`aria-current`,`page`),o[e]=t}r=o}catch{r=[]}})});this.cleanups.push(()=>i.dispose())}navigate(e){if(this.isDestroyed)return;let t=this.currentRouteAtom.peek(),n=this.config.routes[t];if(n?.onLeave&&n.onLeave(this)===!1)return;let r=e||this.config.default;if(!r){G.warn(H.ROUTE,`navigate() called with empty routeName and no default configured.`);return}this.setUrl(r),this.queryParamsAtom.value={},this.currentRouteAtom.value=r}destroy(){if(this.isDestroyed)return;this.isDestroyed=!0;let e=this.cleanups;this.cleanups=[];for(let t=0,n=e.length;t<n;t++)try{e[t]()}catch(e){G.warn(H.ROUTE,`Cleanup error during destroy:`,e)}this.templateCache.clear()}};function vn(e){return new _n(e)}t.default.extend({route:vn});var yn=class{constructor(e,t){this.abortController=null,this.isStaticUrl=typeof e==`string`,this.isStaticUrl?this.staticUrl=e:this.getUrl=e,typeof t.ajaxOptions==`function`?(this.ajaxOptionsFn=t.ajaxOptions,this.staticOptions={}):this.staticOptions={...t.ajaxOptions},t.method!==void 0&&(this.staticOptions.method=t.method),t.headers!==void 0&&(this.staticOptions.headers={...this.staticOptions.headers,...t.headers}),this.transformFn=t.transform,this.onErrorFn=t.onError,this.execute=this.execute.bind(this)}abort(){this.abortController?.abort()}async execute(){this.abortController?.abort(),this.abortController=new AbortController;let e=this.abortController.signal,n=this.ajaxOptionsFn?this.ajaxOptionsFn():{},r=t.default.extend(!0,{},this.staticOptions,n);r.success=void 0,r.error=void 0,r.complete=void 0,r.url=this.isStaticUrl?this.staticUrl:this.getUrl();let i=t.default.ajax(r);e.onabort=()=>i.abort(),e.aborted&&i.abort();let a;try{a=await i}catch(t){if(e.aborted){let e=Error(`AbortError`);throw e.name=`AbortError`,e}let n;if(t&&t.readyState!==void 0){let e=t;n=Error(`Network Error: ${e.statusText||`Unknown`} (${e.status})`),n.jqXHR=e}else n=t instanceof Error?t:Error(String(t??`Unknown network error`));let r=this.onErrorFn;if(r)try{r(n)}catch{}throw n}finally{e.onabort=null,this.abortController?.signal===e&&(this.abortController=null)}let o=this.transformFn;if(o)try{return o(a)}catch(e){let t=this.onErrorFn;if(t)try{t(e)}catch{}throw e}return a}};t.default.extend({atomFetch(e,t){let n=new yn(e,t),r=!(t.eager??!0),i=L(n.execute,{defaultValue:t.defaultValue,lazy:r});return Object.assign(i,{abort:()=>n.abort()})}}),(0,t.default)(()=>{mt(),st(document.body)});var bn=t.default;e.atom=Te,e.batch=Fe,e.computed=L,e.default=bn,e.disableAutoCleanup=ct,e.disablejQueryOverrides=ht,e.effect=R,e.enableAutoCleanup=st,e.enablejQueryOverrides=mt,e.isAtom=De,e.isComputed=Oe,e.isReactive=z,e.nextTick=$e,e.registry=q,e.untracked=k});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`jquery`)):typeof define==`function`&&define.amd?define([`exports`,`jquery`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.AtomEffectJQuery={},e.jQuery))})(this,function(e,t){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var n=Object.create,r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty,c=(e,t,n,o)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=a(t),l=0,u=c.length,d;l<u;l++)d=c[l],!s.call(e,d)&&d!==n&&r(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(o=i(t,d))||o.enumerable});return e};t=((e,t,i)=>(i=e==null?{}:n(o(e)),c(t||!e||!e.__esModule?r(i,`default`,{value:e,enumerable:!0}):i,e)))(t);var l={IDLE:`idle`,PENDING:`pending`,RESOLVED:`resolved`,REJECTED:`rejected`},u={DISPOSED:1,EXECUTING:8},d={DISPOSED:1,IS_COMPUTED:2,DIRTY:8,IDLE:16,PENDING:32,RESOLVED:64,REJECTED:128,RECOMPUTING:256,HAS_ERROR:512,FORCE_COMPUTE:1024},f={DISPOSED:1,SYNC:8,NOTIFICATION_SCHEDULED:16},p={MAX_EXECUTIONS_PER_SECOND:1e3,MAX_EXECUTIONS_PER_EFFECT:100,MAX_EXECUTIONS_PER_FLUSH:1e4,MAX_FLUSH_ITERATIONS:1e3,MIN_FLUSH_ITERATIONS:10,BATCH_QUEUE_SHRINK_THRESHOLD:1e3},m={WARN_INFINITE_LOOP:!0,EFFECT_FREQUENCY_WINDOW:1e3},h={MAX_ASYNC_RETRIES:3,MAX_PROMISE_ID:2**53-1-1},g={UNINITIALIZED:-1,MIN:1},_=1073741823,v={VERSION_BITS:16};typeof process<`u`&&process.env;var y=Object.freeze([]),b=class{constructor(e,t,n=void 0){this.node=e,this.version=t,this.unsub=n}},x=class{constructor(e,t){this.fn=e,this.sub=t}notify(e,t){this.fn?this.fn(e,t):this.sub&&this.sub.execute()}},S=class extends Error{constructor(e,t=null,n=!0){super(e),this.cause=t,this.recoverable=n,this.name=`AtomError`}},C=class extends S{constructor(e,t=null){super(e,t,!0),this.name=`ComputedError`}},w=class extends S{constructor(e,t=null){super(e,t,!1),this.name=`EffectError`}},ee=class extends S{constructor(e,t=null){super(e,t,!1),this.name=`SchedulerError`}},T={COMPUTED_MUST_BE_FUNCTION:`Computed target must be a function`,COMPUTED_ASYNC_PENDING_NO_DEFAULT:`Async computation pending with no default value`,COMPUTED_COMPUTATION_FAILED:`Computation execution failed`,COMPUTED_ASYNC_COMPUTATION_FAILED:`Async computation execution failed`,COMPUTED_CIRCULAR_DEPENDENCY:`Circular dependency detected`,COMPUTED_DISPOSED:`Attempted to access disposed computed`,ATOM_SUBSCRIBER_MUST_BE_FUNCTION:`Subscriber must be a function or Subscriber object`,ATOM_INDIVIDUAL_SUBSCRIBER_FAILED:`Subscriber execution failed`,EFFECT_MUST_BE_FUNCTION:`Effect target must be a function`,EFFECT_EXECUTION_FAILED:`Effect execution failed`,EFFECT_CLEANUP_FAILED:`Effect cleanup failed`,EFFECT_DISPOSED:`Attempted to run disposed effect`,SCHEDULER_FLUSH_OVERFLOW:(e,t)=>`Maximum flush iterations (${e}) exceeded. ${t} jobs dropped. Possible infinite loop.`,CALLBACK_ERROR_IN_ERROR_HANDLER:`Exception encountered in onError handler`,EFFECT_FREQUENCY_LIMIT_EXCEEDED:`Effect executed too frequently within 1 second. Suspected infinite loop.`,SCHEDULER_CALLBACK_MUST_BE_FUNCTION:`Scheduler callback must be a function`,SCHEDULER_END_BATCH_WITHOUT_START:`endBatch() called without matching startBatch(). Ignoring.`,BATCH_CALLBACK_MUST_BE_FUNCTION:`Batch callback must be a function`},te=class{constructor(){this._s0=null,this._s1=null,this._s2=null,this._s3=null,this._count=0,this._overflow=null,this._freeIndices=null}get size(){return this._count}getAt(e){switch(e){case 0:return this._s0;case 1:return this._s1;case 2:return this._s2;case 3:return this._s3;default:{let t=this._overflow;if(t!==null&&e>=4){let n=e-4;if(n<t.length)return t[n]??null}return null}}}setAt(e,t){switch(e){case 0:this._s0=t;break;case 1:this._s1=t;break;case 2:this._s2=t;break;case 3:this._s3=t;break;default:{this._overflow??=[];let n=this._overflow;n[e-4]=t}}e>=this._count&&(this._count=e+1)}truncateFrom(e){let t=this._count;if(e>=t)return;if(e<=3)switch(e){case 0:{let e=this._s0;e!=null&&(this._onItemRemoved(e),this._s0=null)}case 1:{let e=this._s1;e!=null&&(this._onItemRemoved(e),this._s1=null)}case 2:{let e=this._s2;e!=null&&(this._onItemRemoved(e),this._s2=null)}case 3:{let e=this._s3;e!=null&&(this._onItemRemoved(e),this._s3=null)}}let n=this._overflow;if(n!==null&&t>4){let t=e>4?e-4:0,r=n.length;for(let e=t;e<r;e++){let t=n[e];t!=null&&(this._onItemRemoved(t),n[e]=null)}e<=4?(n.length=0,this._overflow=null):n.length=e-4}this._freeIndices!==null&&(this._freeIndices=null),this._count=e}_onItemRemoved(e){}add(e){if(this._s0===null){this._s0=e,this._count++;return}if(this._s1===null){this._s1=e,this._count++;return}if(this._s2===null){this._s2=e,this._count++;return}if(this._s3===null){this._s3=e,this._count++;return}this._addToOverflow(e)}_addToOverflow(e){if(this._overflow===null)this._overflow=[e];else{let t=this._freeIndices;t!==null&&t.length>0?this._overflow[t.pop()]=e:this._overflow.push(e)}this._count++}remove(e){if(this._s0===e)return this._s0=null,this._count--,!0;if(this._s1===e)return this._s1=null,this._count--,!0;if(this._s2===e)return this._s2=null,this._count--,!0;if(this._s3===e)return this._s3=null,this._count--,!0;let t=this._overflow;if(t==null)return!1;for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return t[n]=null,this._count--,this._freeIndices===null&&(this._freeIndices=[]),this._freeIndices.push(n),!0;return!1}has(e){if(this._count===0)return!1;if(this._s0===e||this._s1===e||this._s2===e||this._s3===e)return!0;let t=this._overflow;if(t!=null){for(let n=0,r=t.length;n<r;n++)if(t[n]===e)return!0}return!1}forEach(e){if(this._count===0)return;let t=this._s0;t!=null&&e(t);let n=this._s1;n!=null&&e(n);let r=this._s2;r!=null&&e(r);let i=this._s3;i!=null&&e(i);let a=this._overflow;if(a!=null)for(let t=0,n=a.length;t<n;t++){let n=a[t];n!=null&&e(n)}}forEachIndexed(e){let t=this._count;if(t===0)return 0;let n=0,r=this._s0;r!=null&&(e(r),n++);let i=this._s1;i!=null&&(e(i),n++);let a=this._s2;a!=null&&(e(a),n++);let o=this._s3;if(o!=null&&(e(o),n++),n===t)return n;let s=this._overflow;if(s!=null)for(let t=0,r=s.length;t<r;t++){let r=s[t];r!=null&&(e(r),n++)}return n}compact(){let e=this._overflow;if(e===null||e.length===0)return;let t=0;for(;t<e.length;)if(e[t]===null){for(;e.length>t&&e[e.length-1]===null;)e.pop();e.length>t&&(e[t]=e.pop(),t++)}else t++;this._freeIndices=null,e.length===0&&(this._overflow=null)}clear(){this._s0=null,this._s1=null,this._s2=null,this._s3=null,this._count=0,this._overflow!==null&&(this._overflow.length=0,this._overflow=null),this._freeIndices=null}dispose(){this.clear()}},ne=Symbol(`AtomEffect.DebugName`),re=Symbol(`AtomEffect.Type`),ie=Symbol(`AtomEffect.NoDefaultValue`),ae={enabled:!1,warnInfiniteLoop:m.WARN_INFINITE_LOOP,warn(e,t){},attachDebugInfo(e,t,n){},getDebugName:e=>e?.[ne],getDebugType:e=>e?.[re]},oe=1,se=()=>oe++;function E(e,t,n){if(e instanceof S)return e;let r=e instanceof Error,i=r?e.message:String(e),a=r?e:void 0;return new t(`${r?e.constructor.name:`Unexpected error`} (${n}): ${i}`,a)}var ce=class{constructor(){this.flags=0,this.version=0,this._lastSeenEpoch=g.UNINITIALIZED,this._notifying=0,this._hotIndex=-1,this._slots=null,this._deps=null,this.id=se()&_}subscribe(e){let t=typeof e==`function`;if(!t&&(!e||typeof e.execute!=`function`))throw E(TypeError(`Invalid subscriber`),S,T.ATOM_SUBSCRIBER_MUST_BE_FUNCTION);let n=this._slots;n||(n=new te,this._slots=n);let r=!1;if(n.forEach(n=>{(t?n.fn===e:n.sub===e)&&(r=!0)}),r)return()=>{};let i=new x(t?e:void 0,t?void 0:e);return n.add(i),()=>this._unsubscribe(i)}_unsubscribe(e){if(this._slots){if(this._notifying>0){this._slots.remove(e);return}this._slots.remove(e),this._slots.compact()}}subscriberCount(){return this._slots?this._slots.size:0}_notifySubscribers(e,t){let n=this._slots;if(!(!n||n.size===0)){this._notifying++;try{n.forEach(n=>{try{n.notify(e,t)}catch(e){console.error(E(e,S,T.ATOM_INDIVIDUAL_SUBSCRIBER_FAILED))}})}finally{this._notifying--,this._notifying===0&&n.compact()}}}_isDirty(){let e=this._deps;if(!e||e.size===0)return!1;if(this._hotIndex!==-1){let t=e.getAt(this._hotIndex);if(t!=null&&t.node.version!==t.version)return!0}return!e.hasComputeds&&!e.isDirtyFast()?!1:this._deepDirtyCheck()}},le=0,ue=()=>(le=le+1&1073741823||1,le),de=e=>e+1&1073741823||1,fe=0,pe=!1,me=0,he=()=>me;function ge(){return pe?!1:(pe=!0,me=ue(),fe=0,!0)}var _e=()=>{pe=!1},ve=()=>{if(!pe)return 0;let e=++fe;if(e>p.MAX_EXECUTIONS_PER_FLUSH)throw Error(`[atom-effect] Infinite loop detected: flush execution count exceeded ${p.MAX_EXECUTIONS_PER_FLUSH}`);return e},ye=(function(e){return e[e.IDLE=0]=`IDLE`,e[e.BATCHING=1]=`BATCHING`,e[e.FLUSHING=2]=`FLUSHING`,e})({}),D=new class{constructor(){this._queueBuffer=[[],[]],this._bufferIndex=0,this._size=0,this._epoch=0,this._isProcessing=!1,this._isBatching=!1,this._isFlushingSync=!1,this._batchDepth=0,this._batchQueue=[],this._batchQueueSize=0,this._maxFlushIterations=p.MAX_FLUSH_ITERATIONS,this.onOverflow=null,this._boundRunLoop=this._runLoop.bind(this)}get phase(){return this._isProcessing||this._isFlushingSync?ye.FLUSHING:this._isBatching?ye.BATCHING:ye.IDLE}get queueSize(){return this._size}get isBatching(){return this._isBatching}schedule(e){if(e._nextEpoch!==this._epoch){if(e._nextEpoch=this._epoch,this._isBatching||this._isFlushingSync){this._batchQueue[this._batchQueueSize++]=e;return}this._queueBuffer[this._bufferIndex][this._size++]=e,this._isProcessing||this._flush()}}_flush(){this._isProcessing||this._size===0||(this._isProcessing=!0,queueMicrotask(this._boundRunLoop))}_runLoop(){try{if(this._size===0)return;let e=ge();this._drainQueue(),e&&_e()}finally{this._isProcessing=!1,this._size>0&&!this._isBatching&&this._flush()}}_flushSync(){this._isFlushingSync=!0;let e=ge();try{this._mergeBatchQueue(),this._drainQueue()}finally{this._isFlushingSync=!1,e&&_e()}}_mergeBatchQueue(){if(this._batchQueueSize===0)return;let e=++this._epoch,t=this._batchQueue,n=this._queueBuffer[this._bufferIndex],r=this._size;for(let i=0;i<this._batchQueueSize;i++){let a=t[i];a._nextEpoch!==e&&(a._nextEpoch=e,n[r++]=a)}this._size=r,this._batchQueueSize=0,t.length=0}_drainQueue(){let e=0;for(;this._size>0;){if(++e>this._maxFlushIterations){this._handleFlushOverflow();return}this._processQueue(),this._mergeBatchQueue()}}_processQueue(){let e=this._bufferIndex,t=this._queueBuffer[e],n=this._size;this._bufferIndex=e^1,this._size=0,this._epoch++;for(let e=0;e<n;e++)try{let n=t[e];typeof n==`function`?n():n.execute()}catch(e){console.error(new ee(`Error occurred during scheduler execution`,e))}t.length=0}_handleFlushOverflow(){let e=this._size+this._batchQueueSize;if(console.error(new ee(T.SCHEDULER_FLUSH_OVERFLOW(this._maxFlushIterations,e))),this._size=0,this._queueBuffer[this._bufferIndex].length=0,this._batchQueueSize=0,this.onOverflow)try{this.onOverflow(e)}catch{}}startBatch(){this._batchDepth++,this._isBatching=!0}endBatch(){this._batchDepth!==0&&--this._batchDepth===0&&(this._flushSync(),this._isBatching=!1)}setMaxFlushIterations(e){if(e<p.MIN_FLUSH_ITERATIONS)throw new ee(`Max flush iterations must be at least ${p.MIN_FLUSH_ITERATIONS}`);this._maxFlushIterations=e}},be=Symbol.for(`atom-effect/atom`),xe=Symbol.for(`atom-effect/computed`),Se=Symbol.for(`atom-effect/effect`),Ce=Symbol.for(`atom-effect/writable`),O={current:null,run(e,t){let n=this.current;this.current=e;try{return t()}finally{this.current=n}}};function k(e){let t=O.current;if(t===null)return e();O.current=null;try{return e()}finally{O.current=t}}var we=class extends ce{constructor(e,t){super(),this[be]=!0,this[Ce]=!0,this._value=e,this._pendingOldValue=void 0,t&&(this.flags|=f.SYNC),ae.attachDebugInfo(this,`atom`,this.id)}get value(){return O.current?.addDependency(this),this._value}set value(e){let t=this._value;if(Object.is(t,e))return;this._value=e,this.version=de(this.version);let n=this._slots,r=this.flags;if(n==null||n.size===0||r&f.NOTIFICATION_SCHEDULED)return;this._pendingOldValue=t;let i=r|f.NOTIFICATION_SCHEDULED;if(this.flags=i,(i&f.SYNC)!==0&&!D.isBatching){this._flushNotifications();return}D.schedule(this)}execute(){this._flushNotifications()}_flushNotifications(){let e=this.flags;if(!(e&f.NOTIFICATION_SCHEDULED)||e&f.DISPOSED)return;let t=this._pendingOldValue;this._pendingOldValue=void 0,this.flags&=~f.NOTIFICATION_SCHEDULED,this._notifySubscribers(this._value,t)}peek(){return this._value}dispose(){this.flags&f.DISPOSED||(this._slots?.clear(),this.flags|=f.DISPOSED,this._value=void 0,this._pendingOldValue=void 0)}_deepDirtyCheck(){return!1}[Symbol.dispose](){this.dispose()}};function Te(e,t={}){return new we(e,t.sync??!1)}var Ee=class extends te{constructor(){super(),this._map=null,this._SCAN_THRESHOLD=32,this.hasComputeds=!1,this._depsHash=0,this._map=null,this.hasComputeds=!1,this._depsHash=0}prepareTracking(){this.hasComputeds=!1}_onItemRemoved(e){let t=e.unsub;t&&t()}claimExisting(e,t){let n=this._count;if(t>=n)return!1;let r=n-t;if(this._map!==null||r>this._SCAN_THRESHOLD)return this._claimViaMap(e,t);if(t<4)switch(t){case 0:{let t=this._s0;if(t&&t.node===e&&t.unsub)return t.version=e.version,!0}case 1:if(n>1){let n=this._s1;if(n&&n.node===e&&n.unsub)return n.version=e.version,t!==1&&(this._s1=this._s0,this._s0=n),!0}case 2:if(n>2){let n=this._s2;if(n&&n.node===e&&n.unsub){if(n.version=e.version,t!==2){let e=t===0?this._s0:this._s1;t===0?this._s0=n:this._s1=n,this._s2=e}return!0}}case 3:if(n>3){let n=this._s3;if(n&&n.node===e&&n.unsub){if(n.version=e.version,t!==3){let e;t===0?(e=this._s0,this._s0=n):t===1?(e=this._s1,this._s1=n):(e=this._s2,this._s2=n),this._s3=e}return!0}}}let i=t>4?t:4,a=this._overflow;if(a)for(let n=i-4,r=a.length;n<r;n++){let r=a[n];if(r&&r.node===e&&r.unsub)return r.version=e.version,this._swapGeneral(n+4,t,r),!0}return!1}_claimViaMap(e,t){if(this._map===null){this._map=new Map;let e=this._count;t<4&&(t<=0&&this._s0?.unsub&&this._map.set(this._s0.node,0),t<=1&&this._s1?.unsub&&this._map.set(this._s1.node,1),t<=2&&this._s2?.unsub&&this._map.set(this._s2.node,2),t<=3&&this._s3?.unsub&&this._map.set(this._s3.node,3));let n=this._overflow;if(n&&e>4){let e=t>4?t:4;for(let t=e-4,r=n.length;t<r;t++){let e=n[t];e?.unsub&&this._map.set(e.node,t+4)}}}let n=this._map.get(e);if(n===void 0||n<t)return!1;let r=this.getAt(n);if(r==null||!r.unsub)return!1;if(r.version=e.version,n!==t){let i=this.getAt(t);this.setAt(t,r),this.setAt(n,i),i?.unsub&&this._map.set(i.node,n),this._map.set(e,t)}return!0}_swapGeneral(e,t,n){if(e===t)return;let r=this.getAt(t);if(this.setAt(t,n),e===0)this._s0=r;else if(e===1)this._s1=r;else if(e===2)this._s2=r;else if(e===3)this._s3=r;else{let t=this._overflow;t[e-4]=r}}insertNew(e,t){let n=this._count;if(e<n){let t=this.getAt(e);t!=null&&(this._addToOverflow(t),this._map!==null&&t.unsub&&this._map.set(t.node,this._count-1))}if(e===0)this._s0=t;else if(e===1)this._s1=t;else if(e===2)this._s2=t;else if(e===3)this._s3=t;else{let n=this._overflow;n||(n=[],this._overflow=n),n[e-4]=t}e>=n&&(this._count=e+1)}truncateFrom(e){e>=this._count||(super.truncateFrom(e),this._map!==null&&(this._map.clear(),this._map=null))}seal(){let e=this._count;if(e===0){this._depsHash=0;return}let t=v.VERSION_BITS,n=0;if(e>=1){let e=this._s0;n=n+(e.version<<t)+e.node.id|0}if(e>=2){let e=this._s1;n=n+(e.version<<t)+e.node.id|0}if(e>=3){let e=this._s2;n=n+(e.version<<t)+e.node.id|0}if(e>=4){let e=this._s3;n=n+(e.version<<t)+e.node.id|0}if(e>4){let e=this._overflow;for(let r=0,i=e.length;r<i;r++){let i=e[r];n=n+(i.version<<t)+i.node.id|0}}this._depsHash=n}isDirtyFast(){let e=this._count;if(e===0)return!1;let t=v.VERSION_BITS,n=0;if(e>=1){let e=this._s0.node;n=n+(e.version<<t)+e.id|0}if(e>=2){let e=this._s1.node;n=n+(e.version<<t)+e.id|0}if(e>=3){let e=this._s2.node;n=n+(e.version<<t)+e.id|0}if(e>=4){let e=this._s3.node;n=n+(e.version<<t)+e.id|0}if(e>4){let e=this._overflow;for(let r=0,i=e.length;r<i;r++){let i=e[r].node;n=n+(i.version<<t)+i.id|0}}return n!==this._depsHash}disposeAll(){this._count>0&&this.truncateFrom(0),this.hasComputeds=!1,this._map!==null&&(this._map.clear(),this._map=null)}remove(e){throw Error(`remove() is strictly prohibited in DepSlotBuffer to preserve sequential cache paths.`)}compact(){}};function De(e){return typeof e==`object`&&!!e&&be in e}function Oe(e){return typeof e==`object`&&!!e&&xe in e}function ke(e){return typeof e==`object`&&!!e&&typeof e.then==`function`}var{IDLE:A,DIRTY:j,PENDING:M,RESOLVED:N,REJECTED:P,HAS_ERROR:F,RECOMPUTING:I,DISPOSED:Ae,IS_COMPUTED:je,FORCE_COMPUTE:Me}=d,Ne=class extends ce{constructor(e,t={}){if(typeof e!=`function`)throw new C(T.COMPUTED_MUST_BE_FUNCTION);if(super(),this[be]=!0,this[xe]=!0,this._error=null,this._promiseId=0,this._deps=new Ee,this._asyncRetryCount=0,this._lastDriftEpoch=g.UNINITIALIZED,this._trackEpoch=g.UNINITIALIZED,this._trackCount=0,this._value=void 0,this.flags=je|j|A,this._equal=t.equal??Object.is,this._fn=e,this._defaultValue=`defaultValue`in t?t.defaultValue:ie,this._onError=t.onError??null,this._maxAsyncRetries=(t.maxAsyncRetries??h.MAX_ASYNC_RETRIES)&_,ae.attachDebugInfo(this,`computed`,this.id),t.lazy===!1)try{this._recompute()}catch{}}_track(){O.current?.addDependency(this)}get value(){this._track();let e=this.flags;if((e&(N|j|A))===N)return this._value;if(e&Ae)throw new C(T.COMPUTED_DISPOSED);if(e&I){if(this._defaultValue!==ie)return this._defaultValue;throw new C(T.COMPUTED_CIRCULAR_DEPENDENCY)}if(e&(j|A)&&((e&A)===0&&(e&Me)===0&&this._deps.size>0&&!this._isDirty()?this.flags&=~j:this._recompute(),this.flags&N))return this._value;let t=this._defaultValue,n=t!==ie;if(this.flags&M){if(n)return t;throw new C(T.COMPUTED_ASYNC_PENDING_NO_DEFAULT)}if(this.flags&P){if(n)return t;throw this._error}return this._value}peek(){return this._value}get state(){this._track();let e=this.flags;return e&N?l.RESOLVED:e&M?l.PENDING:e&P?l.REJECTED:l.IDLE}get hasError(){if(this._track(),this.flags&(P|F))return!0;let e=this._deps;if(!e.hasComputeds)return!1;let t=e.size;for(let n=0;n<t;n++){let t=e.getAt(n);if(t!=null&&t.node.flags&F)return!0}return!1}get isValid(){return!this.hasError}get errors(){this._track();let e=[];this._error&&e.push(this._error);let t=this._deps;if(!t.hasComputeds)return e.length===0?y:Object.freeze(e);let n=t.size;for(let r=0;r<n;r++){let n=t.getAt(r);if(n==null)continue;let i=n.node;i.flags&F&&this._collectErrorsFromDep(i,e)}return e.length===0?y:Object.freeze(e)}_collectErrorsFromDep(e,t){let n=e.errors,r=n.length;for(let e=0;e<r;e++){let r=n[e];r!=null&&!t.includes(r)&&t.push(r)}}get lastError(){return this._track(),this._error}get isPending(){return this._track(),(this.flags&M)!==0}get isResolved(){return this._track(),(this.flags&N)!==0}invalidate(){this.flags|=Me,this._markDirty()}dispose(){this.flags&Ae||(this._deps.disposeAll(),this._slots?.clear(),this.flags=Ae|j|A,this._error=null,this._value=void 0,this._hotIndex=-1)}[Symbol.dispose](){this.dispose()}addDependency(e){if(e._lastSeenEpoch===this._trackEpoch)return;e._lastSeenEpoch=this._trackEpoch;let t=this._trackCount,n=this._deps.getAt(t);if(n!=null&&n.node===e)n.version=e.version;else if(!this._deps.claimExisting(e,t)){let n=new b(e,e.version,e.subscribe(this));this._deps.insertNew(t,n)}e.flags&je&&(this._deps.hasComputeds=!0),this._trackCount=t+1}_recompute(){if(this.flags&I)return;this.flags=(this.flags|I)&~Me,this._trackEpoch=ue(),this._trackCount=0,this._deps.prepareTracking(),this._hotIndex=-1;let e=!1;try{let t=O.run(this,this._fn);this._deps.truncateFrom(this._trackCount),this._deps.seal(),e=!0,ke(t)?this._handleAsyncComputation(t):this._finalizeResolution(t)}catch(t){if(!e)try{this._deps.truncateFrom(this._trackCount)}catch{}this._handleError(t,T.COMPUTED_COMPUTATION_FAILED,!0)}finally{this._trackEpoch=g.UNINITIALIZED,this._trackCount=0,this.flags&=~I}}_handleAsyncComputation(e){this.flags=(this.flags|M)&~(A|j|N|P),this._notifySubscribers(void 0,void 0),this._asyncRetryCount=0,this._promiseId=(this._promiseId+1)%h.MAX_PROMISE_ID;let t=this._promiseId;e.then(e=>{if(t===this._promiseId){if(this._isDirty()){let e=he();return this._lastDriftEpoch!==e&&(this._lastDriftEpoch=e,this._asyncRetryCount=0),this._asyncRetryCount++<this._maxAsyncRetries?this._markDirty():this._handleError(new C(`Async drift threshold exceeded after ${this._maxAsyncRetries} retries.`),T.COMPUTED_ASYNC_COMPUTATION_FAILED)}this._finalizeResolution(e),this._notifySubscribers(e,void 0)}},e=>t===this._promiseId&&this._handleError(e,T.COMPUTED_ASYNC_COMPUTATION_FAILED))}_handleError(e,t,n=!1){let r=E(e,C,t);if(!n&&!(this.flags&P)&&(this.version=de(this.version)),this._error=r,this.flags=this.flags&~(A|j|M|N)|P|F,this._onError)try{this._onError(r)}catch(e){console.error(T.CALLBACK_ERROR_IN_ERROR_HANDLER,e)}if(n)throw r;this._notifySubscribers(void 0,void 0)}_finalizeResolution(e){(!(this.flags&N)||!this._equal(this._value,e))&&(this.version=de(this.version)),this._value=e,this._error=null,this.flags=(this.flags|N)&~(A|j|M|P|F)}execute(){this._markDirty()}_markDirty(){this.flags&(I|j)||(this.flags|=j,this._notifySubscribers(void 0,void 0))}_isDirty(){let e=this._deps;return e.hasComputeds?this._deepDirtyCheck():e.isDirtyFast()}_deepDirtyCheck(){let e=this._deps,t=O.current;O.current=null;try{let t=e.size;for(let n=0;n<t;n++){let t=e.getAt(n);if(t==null)continue;let r=t.node;if(r.flags&je)try{r.value}catch{}if(r.version!==t.version)return this._hotIndex=n,!0}return this._hotIndex=-1,!1}finally{O.current=t}}};function L(e,t={}){return new Ne(e,t)}var Pe=class extends ce{constructor(e,t={}){super(),this[Se]=!0,this._cleanup=null,this._deps=new Ee,this._currentEpoch=g.UNINITIALIZED,this._lastFlushEpoch=g.UNINITIALIZED,this._fn=e,this._onError=t.onError??null,this._sync=t.sync??!1,this._maxExecutions=t.maxExecutionsPerSecond??p.MAX_EXECUTIONS_PER_SECOND,this._maxExecutionsPerFlush=t.maxExecutionsPerFlush??p.MAX_EXECUTIONS_PER_EFFECT,this._cleanup=null,this._deps=new Ee,this._currentEpoch=g.UNINITIALIZED,this._lastFlushEpoch=g.UNINITIALIZED,this._executionsInEpoch=0,this._executionCount=0,this._windowStart=0,this._windowCount=0,this._execId=0,this._trackCount=0,this._sync?this._notifyCallback=()=>this.execute():this._notifyCallback=()=>D.schedule(this),ae.attachDebugInfo(this,`effect`,this.id)}run(){if(this.flags&u.DISPOSED)throw new w(T.EFFECT_DISPOSED);this.execute(!0)}dispose(){this.flags&u.DISPOSED||(this.flags|=u.DISPOSED,this._execCleanup(),this._deps?.disposeAll())}[Symbol.dispose](){this.dispose()}addDependency(e){if(!(this.flags&u.EXECUTING))return;let t=this._currentEpoch;if(e._lastSeenEpoch===t)return;e._lastSeenEpoch=t;let n=this._trackCount,r=this._deps,i;i=n===0?r._s0:n===1?r._s1:n===2?r._s2:n===3?r._s3:r.getAt(n),i!=null&&i.node===e?i.version=e.version:r.claimExisting(e,n)||this._insertNewDependency(e,n),e.flags&d.IS_COMPUTED&&(r.hasComputeds=!0),this._trackCount=n+1}_insertNewDependency(e,t){let n;try{let t=e.subscribe(this._notifyCallback);n=new b(e,e.version,t)}catch(t){let r=E(t,w,T.EFFECT_EXECUTION_FAILED);if(console.error(r),this._onError)try{this._onError(r)}catch{}n=new b(e,e.version,void 0)}this._deps.insertNew(t,n)}execute(e=!1){if(this.flags&(u.DISPOSED|u.EXECUTING))return;let t=this._deps;if(!e&&t.size>0&&!this._isDirty())return;this._checkInfiniteLoops(),this.flags|=u.EXECUTING,this._execCleanup(),this._currentEpoch=ue(),this._trackCount=0,t.prepareTracking(),this._hotIndex=-1;let n=!1;try{let e=O.run(this,this._fn);t.truncateFrom(this._trackCount),t.seal(),n=!0,ke(e)?this._handleAsyncResult(e):this._cleanup=typeof e==`function`?e:null}catch(e){if(!n)try{t.truncateFrom(this._trackCount)}catch{}this._handleExecutionError(e),this._cleanup=null}finally{this.flags&=~u.EXECUTING}}_isDirty(){let e=this._deps;return e.hasComputeds?this._deepDirtyCheck():e.isDirtyFast()}_handleAsyncResult(e){let t=++this._execId;e.then(e=>{if(t!==this._execId||this.flags&u.DISPOSED){if(typeof e==`function`)try{e()}catch(e){this._handleExecutionError(e,T.EFFECT_CLEANUP_FAILED)}return}typeof e==`function`&&(this._cleanup=e)},e=>t===this._execId&&this._handleExecutionError(e))}_deepDirtyCheck(){let e=O.current;O.current=null;let t=this._deps;try{let e=t.size;for(let n=0;n<e;n++){let e=t.getAt(n);if(e==null)continue;let r=e.node;if(r.flags&d.IS_COMPUTED&&this._tryPullComputed(r),r.version!==e.version)return this._hotIndex=n,!0}return!1}finally{O.current=e}}_tryPullComputed(e){try{e.value}catch{}}_execCleanup(){if(this._cleanup){try{this._cleanup()}catch(e){this._handleExecutionError(e,T.EFFECT_CLEANUP_FAILED)}this._cleanup=null}}_checkInfiniteLoops(){let e=he();this._lastFlushEpoch!==e&&(this._lastFlushEpoch=e,this._executionsInEpoch=0),++this._executionsInEpoch>this._maxExecutionsPerFlush&&this._throwInfiniteLoopError(`per-effect`),ve()>p.MAX_EXECUTIONS_PER_FLUSH&&this._throwInfiniteLoopError(`global`),this._executionCount++}_checkFrequencyLimit(){if(!Number.isFinite(this._maxExecutions))return;let e=Date.now();if(e-this._windowStart>=m.EFFECT_FREQUENCY_WINDOW){this._windowStart=e,this._windowCount=1;return}if(++this._windowCount>this._maxExecutions){let e=new w(T.EFFECT_FREQUENCY_LIMIT_EXCEEDED);throw this.dispose(),this._handleExecutionError(e),e}}get isDisposed(){return(this.flags&u.DISPOSED)!==0}get executionCount(){return this._executionCount}get isExecuting(){return(this.flags&u.EXECUTING)!==0}_throwInfiniteLoopError(e){let t=new w(`Infinite loop detected (${e}): effect executed ${this._executionsInEpoch} times in current flush. Total executions in flush: ${fe}`);throw this.dispose(),console.error(t),t}_handleExecutionError(e,t=T.EFFECT_EXECUTION_FAILED){let n=E(e,w,t);if(console.error(n),this._onError)try{this._onError(n)}catch(e){console.error(E(e,w,T.CALLBACK_ERROR_IN_ERROR_HANDLER))}}};function R(e,t={}){if(typeof e!=`function`)throw new w(T.EFFECT_MUST_BE_FUNCTION);let n=new Pe(e,t);return n.execute(),n}function Fe(e){if(typeof e!=`function`)throw TypeError(T.BATCH_CALLBACK_MUST_BE_FUNCTION);D.startBatch();try{return e()}finally{D.endBatch()}}function z(e){return De(e)}function Ie(e){return!!e&&typeof e.then==`function`}function B(e){let t=e.tagName.toLowerCase();if(e.id)return`${t}#${e.id}`;let n=e.classList,r=n.length;if(r===0)return t;let i=t;for(let e=0;e<r;e++)i+=`.${n[e]}`;return i}var V=Object.prototype.hasOwnProperty;function Le(e,t){if(e===t)return!0;if(e===null||t===null||typeof e!=`object`||typeof t!=`object`)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;let i=e,a=t;for(let e=0;e<n.length;e++){let t=n[e];if(!V.call(a,t)||i[t]!==a[t])return!1}return!0}var H={ROUTE:`[atom-route]`,BINDING:`[atom-binding]`,LIST:`[atom-list]`,MOUNT:`[atom-mount]`},U=Object.freeze({mode:`hash`,basePath:``,autoBindLinks:!1,activeClass:`active`}),Re={EVENT:`input`,DEBOUNCE:0},ze={HIGHLIGHT_DURATION_MS:500},Be=new Set([`input`,`select`,`textarea`]),Ve=new Set([`innerHTML`,`outerHTML`,`srcdoc`,`__proto__`,`constructor`,`prototype`]),W={ROUTE:{NOT_FOUND:e=>`Route "${e}" not found and no notFound route configured`,TEMPLATE_NOT_FOUND:e=>`Template "${e}" not found`,TARGET_NOT_FOUND:e=>`Target element "${e}" not found`,MALFORMED_URI:e=>`Malformed URI component: ${e}`},SECURITY:{UNSAFE_CONTENT:()=>`Unsafe content neutralized during sanitization.`,BLOCKED_CSS_VALUE:e=>`Blocked dangerous value in CSS style property "${e}".`,BLOCKED_EVENT_HANDLER:e=>`Blocked setting dangerous event handler attribute/property "${e}".`,BLOCKED_PROTOCOL:e=>`Blocked dangerous protocol in "${e}".`,BLOCKED_PROP:e=>`Blocked setting dangerous property "${e}". Use html binding for sanitized HTML.`},BINDING:{INVALID_INPUT_ELEMENT:e=>`Val binding used on non-input element <${e}>.`,MISSING_SOURCE:e=>`[${e}] source is required when prop/name is a string.`,MISSING_CONDITION:e=>`[${e}] condition is required when className is a string.`,UPDATER_ERROR:(e,t)=>`Updater threw in binding "${e}"${t?` (static)`:``}`,CLEANUP_ERROR:e=>`Binding cleanup error${e?`: ${e}`:``}`,PARSE_ERROR:e=>`parse() threw during DOM→Atom sync${e?`: ${e}`:``}`},LIST:{DUPLICATE_KEY:(e,t,n)=>`Duplicate key "${e}" at index ${t} in atomList <${n}>.`},MOUNT:{ERROR:e=>`Mount error${e?` in component <${e}>`:``}`,CLEANUP_ERROR:e=>`Cleanup error${e?` in component <${e}>`:``}`},CORE:{EFFECT_DISPOSE_ERROR:e=>`Effect dispose error${e?`: ${e}`:``}`}},He=`${ze.HIGHLIGHT_DURATION_MS/1e3}s`;function Ue(){if(typeof window<`u`){let e=window.__ATOM_DEBUG__;if(typeof e==`boolean`)return e}try{if(globalThis.process?.env?.VITE_ATOM_DEBUG===`true`)return!0}catch{}return!1}var We=Ue(),G={get enabled(){if(typeof window<`u`){let e=window.__ATOM_DEBUG__;if(typeof e==`boolean`)return e}return We},set enabled(e){We=e},log(e,...t){this.enabled&&console.log(`${e}`,...t)},atomChanged(e,t,n,r){this.enabled&&console.log(`${e} Atom "${t??`anonymous`}" changed:`,n,`→`,r)},domUpdated(e,t,n,r){if(!this.enabled)return;let i=t instanceof Element?t:t[0];i&&(console.log(`${e} DOM updated: ${B(i)}.${n} =`,r),Ze(i))},cleanup(e,t){this.enabled&&console.log(`${e} Cleanup: ${t}`)},warn(e,t,...n){console.warn(`${e} ${t}`,...n)},error(e,t,n){console.error(`${e} ${t}`,n)}},Ge=`atom-debug-highlight`,Ke=`data-atom-debug`,qe;function Je(){if((qe instanceof HTMLStyleElement?qe:qe?.deref())?.isConnected||document.querySelector(`style[${Ke}]`))return;let e=document.createElement(`style`);e.setAttribute(Ke,``),e.textContent=`.${Ge}{outline:2px solid rgba(255,68,68,0.8);outline-offset:1px;transition:outline ${He} ease-out}`,document.head.appendChild(e),qe=typeof WeakRef<`u`?new WeakRef(e):e}var Ye=new WeakMap,Xe=new WeakMap;function Ze(e){if(!G.enabled||!e.isConnected)return;Je();let t=Xe.get(e);t!==void 0&&cancelAnimationFrame(t);let n=Ye.get(e);n!==void 0&&clearTimeout(n);let r=requestAnimationFrame(()=>{Xe.delete(e),e.isConnected&&(e.classList.add(Ge),Ye.set(e,setTimeout(()=>{e.isConnected&&e.classList.remove(Ge),Ye.delete(e)},ze.HIGHLIGHT_DURATION_MS)))});Xe.set(e,r)}var Qe=Symbol.for(`atom-effect/atom`),$e=Symbol.for(`atom-effect/writable`);function et(e,t,n,r){if(n===t.length)return r;let i=t[n],a=e&&typeof e==`object`?e:{},o=a[i],s=et(o,t,n+1,r);if(Object.is(o,s))return e;if(Array.isArray(a)){let e=[...a],t=Number.parseInt(i,10);return Number.isNaN(t)?e[i]=s:e[t]=s,e}return{...a,[i]:s}}function K(e,t){let n=e;for(let e=0,r=t.length;e<r&&n!=null;e++)n=n[t[e]];return n}function tt(e,t){let n=t.includes(`.`)?t.split(`.`):[t],r=new Set,i=()=>{for(let e of r)e();r.clear()};return{get value(){return K(e.value,n)},set value(t){let r=e.peek(),i=et(r,n,0,t);i!==r&&(e.value=i)},peek(){return K(e.peek(),n)},subscribe(t){let i=e.subscribe((e,r)=>{let i=K(e,n),a=K(r,n);Object.is(i,a)||t(i,a)});return r.add(i),()=>{i(),r.delete(i)}},subscriberCount(){return r.size},dispose:i,[Symbol.dispose]:i,[Qe]:!0,[$e]:!0}}function nt(e,t){return tt(e,t)}function rt(e){return t=>tt(e,t)}function it(e,t){return Te(e,t)}Object.defineProperty(it,`debug`,{enumerable:!0,configurable:!0,get(){return G.enabled},set(e){G.enabled=e}});function at(){return new Promise(e=>setTimeout(e,0))}var ot={atom:it,computed:L,effect:R,batch:Fe,untracked:k,isAtom:De,isComputed:Oe,isReactive:z,nextTick:at,atomLens:tt,composeLens:nt,lensFor:rt};t.default.extend(ot);var st=class{constructor(e=50,t=256){this.limit=e,this.capacity=t,this.pool=[]}acquire(){return this.pool.pop()??[]}release(e){e.length>this.capacity||this.pool.length>=this.limit||Object.isFrozen(e)||(e.length=0,this.pool.push(e))}reset(){this.pool.length=0}},ct=class{constructor(e,t,n=64){this.factory=e,this.reset=t,this.limit=n,this.pool=[]}acquire(){return this.pool.pop()??this.factory()}release(e){this.pool.length>=this.limit||(this.reset(e),this.pool.push(e))}drain(){this.pool.length=0}get size(){return this.pool.length}},lt=new st,ut=new st,dt=new ct(()=>({effects:void 0,cleanups:void 0,componentCleanup:void 0}),e=>{e.effects=void 0,e.cleanups=void 0,e.componentCleanup=void 0},128),q=`_aes-bound`,J=new class{constructor(){this.records=new WeakMap,this.preservedNodes=new WeakSet,this.ignoredNodes=new WeakSet}keep(e){this.preservedNodes.add(e)}isKept(e){return this.preservedNodes.has(e)}markIgnored(e){this.ignoredNodes.add(e)}isIgnored(e){return this.ignoredNodes.has(e)}getOrCreateRecord(e){let t=this.records.get(e);return t||(t=dt.acquire(),this.records.set(e,t),e.classList.add(q)),t}trackEffect(e,t){let n=this.getOrCreateRecord(e);n.effects??=lt.acquire(),n.effects.push(t)}trackCleanup(e,t){let n=this.getOrCreateRecord(e);n.cleanups??=ut.acquire(),n.cleanups.push(t)}setComponentCleanup(e,t){let n=this.getOrCreateRecord(e);n.componentCleanup=t}hasBind(e){return this.records.has(e)}cleanup(e){let t=this.records.get(e);if(!t){e.nodeType===1&&e.classList.remove(q),this.preservedNodes.delete(e),this.ignoredNodes.delete(e);return}if(this.records.delete(e),this.preservedNodes.delete(e),this.ignoredNodes.delete(e),e.nodeType===1&&e.classList.remove(q),G.enabled){let t=e.nodeType===1?B(e):e.nodeName||`Node`;G.cleanup(H.BINDING,t)}if(t.componentCleanup)try{t.componentCleanup()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.MOUNT,W.MOUNT.CLEANUP_ERROR(n),t)}if(t.effects){let n=t.effects;for(let t=0,r=n.length;t<r;t++)try{n[t].dispose()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.BINDING,W.CORE.EFFECT_DISPOSE_ERROR(n),t)}lt.release(n),t.effects=void 0}if(t.cleanups){let n=t.cleanups;for(let t=0,r=n.length;t<r;t++)try{n[t]()}catch(t){let n=e.nodeType===1?B(e):`Node`;G.error(H.BINDING,W.BINDING.CLEANUP_ERROR(n),t)}ut.release(n),t.cleanups=void 0}dt.release(t)}cleanupDescendants(e){let t=`getElementsByClassName`in e&&typeof e.getElementsByClassName==`function`?e.getElementsByClassName(q):e.querySelectorAll(`.${q}`);for(let e=t.length-1;e>=0;e--){let n=t[e];n&&(this.records.has(n)?this.cleanup(n):(n.classList.remove(q),G.enabled&&G.warn(H.BINDING,`${q} class found on unregistered element:`,n)))}}cleanupTree(e){(e.nodeType===1||e.nodeType===11)&&this.cleanupDescendants(e),this.cleanup(e)}},ft=new Map;function pt(e){if(ft.has(e))return;let t=new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){let n=e[t].removedNodes;for(let e=0,t=n.length;e<t;e++){let t=n[e];t.nodeType===1&&(t.isConnected||J.isKept(t)||J.isIgnored(t)||J.cleanupTree(t))}}});t.observe(e,{childList:!0,subtree:!0}),ft.set(e,t)}function mt(){ft.forEach(e=>e.disconnect()),ft.clear()}var ht=Symbol(`atom-effect-internal`),gt=new WeakMap,Y=null,_t=e=>{if(e[ht])return e;let t=gt.get(e);return t||(t=function(...t){return Fe(()=>e.apply(this,t))},t[ht]=!0,gt.set(e,t)),t};function vt(e){let t={},n=Object.entries(e);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r[0],a=r[1];a&&(t[i]=_t(a))}return t}function yt(e){let t={},n=Object.entries(e);for(let e=0,r=n.length;e<r;e++){let r=n[e],i=r[0],a=r[1];t[i]=a?gt.get(a)??a:void 0}return t}function bt(){if(Y!==null)return;Y={on:t.default.fn.on,off:t.default.fn.off,remove:t.default.fn.remove,empty:t.default.fn.empty,detach:t.default.fn.detach};let e=Y;t.default.fn.remove=function(t){let n=t?this.filter(t):this;for(let e=0,t=n.length;e<t;e++){let t=n[e];t&&(J.markIgnored(t),J.cleanupTree(t))}let r=e.remove.call(this,t);return r===void 0?this:r},t.default.fn.empty=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t?.hasChildNodes()&&J.cleanupDescendants(t)}let t=e.empty.call(this);return t===void 0?this:t},t.default.fn.detach=function(t){let n=t?this.filter(t):this;for(let e=0,t=n.length;e<t;e++){let t=n[e];t&&J.keep(t)}let r=e.detach.call(this,t);return r===void 0?this:r},t.default.fn.on=function(...t){let n=t[0];if(n&&typeof n==`object`)t[0]=vt(n);else{let e=t.length-1;e>=0&&typeof t[e]==`function`&&(t[e]=_t(t[e]))}let r=e.on.apply(this,t);return r===void 0?this:r},t.default.fn.off=function(...t){let n=t[0];if(n&&typeof n==`object`)t[0]=yt(n);else{let e=t.length-1;if(e>=0&&typeof t[e]==`function`){let n=t[e];t[e]=gt.get(n)??n}}let r=e.off.apply(this,t);return r===void 0?this:r}}function xt(){Y!==null&&(t.default.fn.on=Y.on,t.default.fn.off=Y.off,t.default.fn.remove=Y.remove,t.default.fn.empty=Y.empty,t.default.fn.detach=Y.detach,Y=null)}var X=function(e){return e[e.None=0]=`None`,e[e.Focused=1]=`Focused`,e[e.Composing=2]=`Composing`,e[e.SyncingToAtom=4]=`SyncingToAtom`,e[e.SyncingToDom=8]=`SyncingToDom`,e[e.Busy=14]=`Busy`,e}({}),St=0;function Ct(e){e[ht]=!0}var wt=class{constructor(e,t,n){this.flags=0,this.timeoutId=void 0,this.handleCompositionStart=()=>{this.flags|=X.Composing},this.handleCompositionEnd=()=>{this.flags&=~X.Composing,this.handleInput()},this.handleFocus=()=>{this.flags|=X.Focused},this.handleBlur=()=>{this.flags&=~X.Focused;let e=!!(this.flags&X.Composing);this.flags&=~X.Composing,this.flushPendingDebounce(),e&&this.timeoutId===void 0&&this.syncAtomFromDom(),this.normalizeDomValue()},this.syncDomFromAtom=()=>{let e=this.atom.value;k(()=>{let t=this.format(e),n;if(n=this.isMultipleSelect?this.$el.val()||[]:this.el.value,this.equal(n,e))return;let r=!!(this.flags&X.Focused);if(r)try{let t=this.isMultipleSelect?n:this.parse(this.el.value);if(this.equal(t,e))return}catch{}this.flags|=X.SyncingToDom;try{if(this.isMultipleSelect)this.$el.val(e);else if(r&&(this.el instanceof HTMLInputElement||this.el instanceof HTMLTextAreaElement))try{let e=this.el.selectionStart,n=this.el.selectionEnd;this.el.value=t;let r=t.length;e!==null&&n!==null&&this.el.setSelectionRange(e<r?e:r,n<r?n:r)}catch{this.el.value=t}else this.el.value=t;G.enabled&&G.domUpdated(H.BINDING,this.$el,`val`,t)}finally{this.flags&=~X.SyncingToDom}})},this.cleanup=()=>{this.$el.off(this.ns),clearTimeout(this.timeoutId),this.timeoutId=void 0},this.$el=e,this.el=e[0],this.atom=t,this.isMultipleSelect=this.el.tagName===`SELECT`&&this.el.multiple,this.ns=`.atomBind-${++St}`;let r=n.debounce??0,i=n.event??Re.EVENT;this.parse=n.parse??(e=>e),this.format=n.format??(e=>this.isMultipleSelect?(Array.isArray(e)?e:e?[String(e)]:[]).join(`,`):String(e??``));let a=n.equal??Object.is;this.equal=(e,t)=>a(e,t)?!0:Array.isArray(e)&&Array.isArray(t)?e.length===t.length&&e.every((e,n)=>Object.is(e,t[n])):!1,r>0?this.handleInput=()=>{this.flags&X.Composing||(clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>this.syncAtomFromDom(),r))}:this.handleInput=()=>{this.flags&X.Composing||this.syncAtomFromDom()},Ct(this.handleFocus),Ct(this.handleBlur),Ct(this.handleCompositionStart),Ct(this.handleCompositionEnd),Ct(this.handleInput),this.bindEvents(i)}flushPendingDebounce(){this.timeoutId!==void 0&&(clearTimeout(this.timeoutId),this.timeoutId=void 0,this.syncAtomFromDom())}normalizeDomValue(){let e=this.format(this.atom.peek());if(this.isMultipleSelect){let e=this.$el.val()||[],t=Array.isArray(this.atom.peek())?this.atom.peek():[];this.equal(e,t)||this.$el.val(t)}else this.el.value!==e&&(this.el.value=e)}syncAtomFromDom(){if(!(this.flags&X.Busy)){this.flags|=X.SyncingToAtom;try{let e;e=this.isMultipleSelect?this.$el.val()||[]:this.el.value;let t=this.parse(e);this.equal(this.atom.peek(),t)||(this.atom.value=t)}catch(e){G.warn(H.BINDING,W.BINDING.PARSE_ERROR(e instanceof Error?e.message:String(e)),e)}finally{this.flags&=~X.SyncingToAtom}}}bindEvents(e){let t=this.ns,n=e.trim().split(/\s+/).map(e=>`${e}${t}`).join(` `);this.$el.on(`focus${t}`,this.handleFocus).on(`blur${t}`,this.handleBlur).on(`compositionstart${t}`,this.handleCompositionStart).on(`compositionend${t}`,this.handleCompositionEnd).on(n,this.handleInput)}};function Tt(e,t,n){let r=new wt(e,t,n);return{fx:R(r.syncDomFromAtom),cleanup:r.cleanup}}function Et(e,t,n,r){let i=null,a=t=>{if(Ie(t)){let a=t;i=a,a.then(t=>{i===a&&k(()=>{try{n(t),G.enabled&&G.domUpdated(H.BINDING,e,`${r} (async)`,t)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)}})}).catch(e=>{i===a&&G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)})}else{i=null;try{n(t),G.enabled&&G.domUpdated(H.BINDING,e,r,t)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r,!0),e)}}};z(t)?J.trackEffect(e,R(()=>{let e=t.value;k(()=>a(e))},{name:r})):typeof t==`function`?J.trackEffect(e,R(()=>{let e=t();k(()=>a(e))},{name:r})):k(()=>a(t))}function Dt(e,t,n,r){let i=Object.keys(t),a=[],o={};for(let e=0;e<i.length;e++){let n=i[e],r=t[n];z(r)||typeof r==`function`?a.push(n):o[n]=r}let s=0,c=t=>{let i=Object.keys(t),a=[],o={};for(let e=0;e<i.length;e++){let n=i[e],r=t[n];Ie(r)?a.push(r.then(e=>({key:n,val:e}))):o[n]=r}if(a.length>0){let t=++s;Promise.all(a).then(i=>{if(t===s){for(let e=0;e<i.length;e++){let{key:t,val:n}=i[e];o[t]=n}k(()=>{try{n(o),G.enabled&&G.domUpdated(H.BINDING,e,`${r} (async)`,o)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r),e)}})}})}else{s++;try{n(o),G.enabled&&G.domUpdated(H.BINDING,e,r,o)}catch(e){G.error(H.BINDING,W.BINDING.UPDATER_ERROR(r,!0),e)}}};a.length>0?J.trackEffect(e,R(()=>{let e={...o};for(let n=0;n<a.length;n++){let r=a[n],i=t[r];e[r]=z(i)?i.value:i()}k(()=>c(e))},{name:r})):k(()=>c(o))}var Ot=new Set([`href`,`src`,`action`,`formaction`,`xlink:href`,`data`,`poster`,`background`,`cite`,`longdesc`,`profile`,`usemap`,`classid`,`codebase`]),kt=/^\s*(?:javascript|vbscript)\s*:/i,At=/(?:expression\s*\(|behavior\s*:|-moz-binding\s*:|(?:\\[0-9a-f]{1,6}\s*|[\s\x00-\x20/'"])*(?:j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t|d\s*a\s*t\s*a)\s*:(?!image\/))/i,jt=/url\s*\(\s*(?:["']?\s*)?(?:javascript|vbscript)\s*:/i,Mt=/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g,Nt=/&#x([0-9a-f]+);?|&#([0-9]+);?/gi,Pt={colon:`:`,Tab:` `,NewLine:`
2
+ `},Ft=/&(colon|Tab|NewLine);/g,It=/<\?[\s\S]*?\?>/g,Lt=/(<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*>([\s\S]*?)<\/\2>|<(script|iframe|object|embed|base|meta|applet|noscript|form|style|link)\b[^>]*\/?>)/gi,Rt=/(j\s*a\s*v\s*a\s*s\s*c\s*r\s*i\s*p\s*t|v\s*b\s*s\s*c\s*r\s*i\s*p\s*t)\s*:/gi,zt=/data\s*:\s*(?:text\/(?:html|javascript|vbscript|xml)|application\/(?:javascript|xhtml\+xml|xml|x-shockwave-flash)|image\/svg\+xml)/gi,Bt=/\bon\w+\s*=/gim,Vt=new RegExp(At.source,`gim`);function Z(e){let t=String(e??``);t=t.replace(Mt,``),t=t.replace(Nt,(e,t,n)=>String.fromCodePoint(t?parseInt(t,16):parseInt(n,10))),t=t.replace(Ft,(e,t)=>Pt[t]??``),t=t.replace(It,``);let n;do n=t,t=t.replace(Lt,``);while(t!==n);return t=t.replace(Rt,`data-unsafe-protocol:`),t=t.replace(zt,`data-unsafe-protocol:`),t=t.replace(Bt,`data-unsafe-attr=`),t=t.replace(Vt,`data-unsafe-css:`),t}function Ht(e){return e.toLowerCase().includes(`url(`)?jt.test(e):!1}var Ut=new Map;function Wt(e){let t=Ut.get(e);return t===void 0?(t=e.includes(`-`)?e.replace(/-./g,e=>e[1].toUpperCase()):e,Ut.set(e,t),t):t}var Gt=new WeakMap;function Kt(e){let t=Gt.get(e);return t||(t=L(()=>{let t=e.value;return Ie(t)?t.then(e=>Z(e)):Z(t)}),Gt.set(e,t)),t}function qt(e){return{el:e,trackCleanup:t=>J.trackCleanup(e,t)}}function Jt(e,t,n){let r=e.el;Et(r,t,e=>{let t=n?n(e):typeof e==`string`?e:String(e??``);r.textContent!==t&&(r.textContent=t)},`text`)}function Yt(e,t){let n=e.el,r=De(t)?Kt(t):t;Et(n,r,e=>{let i=r===t?Z(e):e;n.innerHTML!==i&&(J.cleanupDescendants(n),n.innerHTML=i)},`html`)}function Xt(e,t){let n=e.el,r={};for(let e in t)V.call(t,e)&&(r[e]=e.trim().split(/\s+/).filter(Boolean));Dt(n,t,e=>{for(let t in e){let i=e[t],a=r[t];i?n.classList.add(...a):n.classList.remove(...a)}},`class`)}function Zt(e,t){let n=e.el,r=n.style,i={},a={};for(let e in t)if(V.call(t,e)){let n=t[e],[r,o]=Array.isArray(n)?n:[n,``];i[e]=r,a[e]={camel:Wt(e),unit:o}}Dt(n,i,e=>{for(let t in e){let n=e[t],{camel:i,unit:o}=a[t],s=o?String(n)+o:String(n);Ht(s)||r[i]!==s&&(r[i]=s)}},`css`)}function Qt(e,t){let n=e.el,r={},i={};for(let e in t)if(V.call(t,e)){let n=e.toLowerCase();if(n.startsWith(`on`)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_EVENT_HANDLER(e)}`);continue}r[e]=t[e],i[e]={isAria:n.startsWith(`aria-`),isUrl:Ot.has(n)}}let a={};for(let e in r)a[e]=n.getAttribute(e);Dt(n,r,e=>{for(let t in e){let r=e[t],o=i[t],s=o.isAria;if(r==null||r===!1&&!s){a[t]!==null&&(n.removeAttribute(t),a[t]=null);continue}let c=r===!0?s?`true`:t:String(r);if(o.isUrl&&kt.test(c)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(t)}`);continue}a[t]!==c&&(n.setAttribute(t,c),a[t]=c)}},`attr`)}function $t(e,t){let n=e.el,r={},i={};for(let e in t)if(V.call(t,e)){let n=e.toLowerCase();if(n.startsWith(`on`)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_EVENT_HANDLER(e)}`);continue}if(Ve.has(e)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROP(e)}`);continue}r[e]=t[e],i[e]={isUrl:Ot.has(n)}}Dt(e.el,r,e=>{for(let t in e){let r=e[t];if(i[t].isUrl&&typeof r==`string`&&kt.test(r)){console.warn(`${H.BINDING} ${W.SECURITY.BLOCKED_PROTOCOL(t)}`);continue}n[t]!==r&&(n[t]=r)}},`prop`)}function en(e,t,n){let r=e.el,i=n?`hide`:`show`,a=r.style.display,o=a===`none`?``:a;Et(r,t,e=>{let t=n===!!e?`none`:o;r.style.display!==t&&(r.style.display=t)},i)}function tn(e,n,r={}){let i=e.el.tagName.toLowerCase();if(!Be.has(i)){console.warn(`${H.BINDING} ${W.BINDING.INVALID_INPUT_ELEMENT(i)}`);return}let{fx:a,cleanup:o}=Tt((0,t.default)(e.el),n,r);J.trackEffect(e.el,a),e.trackCleanup(o)}function nn(e,n){let r=e.el,i=(0,t.default)(r),a=r.type===`radio`,o=()=>{let e=r.checked;if(n.peek()!==e&&(n.value=e,a&&e&&r.name)){let e=r.name.replace(/"/g,`\\"`);(r.form?(0,t.default)(r.form):(0,t.default)(document)).find(`input[type="radio"][name="${e}"]`).not(r).trigger(`change.atomRadioSync`)}};o[ht]=!0,i.on(`change change.atomRadioSync`,o),e.trackCleanup(()=>i.off(`change change.atomRadioSync`,o));let s=R(()=>{let e=!!n.value;k(()=>{r.checked!==e&&(r.checked=e,G.enabled&&G.domUpdated(H.BINDING,r,`checked`,e))})});J.trackEffect(r,s)}function rn(e,n){let r=(0,t.default)(e.el);r.on(n),e.trackCleanup(()=>r.off(n))}function an(e,n,r){let i=(0,t.default)(e.el);i.on(n,r),e.trackCleanup(()=>i.off(n,r))}function on(e){J.cleanupTree(e)}function sn(e,t,n={}){let r=e.elements,i=new Map,a=new Map,o=R(()=>{let e=t.value;k(()=>{for(let[t,n]of i){let r=K(e,a.get(t));Object.is(n.peek(),r)||(n.value=r)}})});J.trackEffect(e,o);let s=n=>{let r=i.get(n);if(!r){let o=n.includes(`.`)?n.split(`.`):[n];a.set(n,o),r=Te(K(t.peek(),o));let s=R(()=>{let e=r.value,n=t.peek(),i=et(n,o,0,e);i!==n&&(t.value=i)});J.trackEffect(e,s),i.set(n,r)}return r},c=e=>{if(!(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement))return;let t=e.name;if(!t||J.hasBind(e))return;let r=s(t),i=qt(e);e instanceof HTMLInputElement&&(e.type===`checkbox`||e.type===`radio`)?nn(i,r):tn(i,r,n)};for(let e=0,t=r.length;e<t;e++)c(r[e]);let l=new MutationObserver(e=>{for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n.type===`childList`){let e=n.addedNodes;for(let t=0,n=e.length;t<n;t++)if(e[t].nodeType===1){let n=e[t];c(n);let r=n.querySelectorAll(`input, select, textarea`);for(let e=0,t=r.length;e<t;e++)c(r[e])}}else n.type===`attributes`&&n.attributeName===`name`&&c(n.target)}});l.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`name`]}),J.trackCleanup(e,()=>l.disconnect())}function Q(e,t){for(let n=0,r=e.length;n<r;n++){let r=e[n];r.nodeType===1?t(qt(r),r):G.enabled&&G.log(H.BINDING,`Skipping non-Element node (nodeType=${r.nodeType})`)}return e}t.default.fn.atomText=function(e,t){return Q(this,n=>Jt(n,e,t))},t.default.fn.atomHtml=function(e){return Q(this,t=>Yt(t,e))},t.default.fn.atomClass=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_CONDITION(`atomClass`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>Xt(e,n))},t.default.fn.atomCss=function(e,t,n){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomCss`)}`),this;let r=typeof e==`string`?{[e]:n?[t,n]:t}:e;return Q(this,e=>Zt(e,r))},t.default.fn.atomAttr=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomAttr`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>Qt(e,n))},t.default.fn.atomProp=function(e,t){if(typeof e==`string`&&t===void 0)return console.warn(`${H.BINDING} ${W.BINDING.MISSING_SOURCE(`atomProp`)}`),this;let n=typeof e==`string`?{[e]:t}:e;return Q(this,e=>$t(e,n))},t.default.fn.atomShow=function(e){return Q(this,t=>en(t,e,!1))},t.default.fn.atomHide=function(e){return Q(this,t=>en(t,e,!0))},t.default.fn.atomVal=function(e,t={}){return Q(this,n=>tn(n,e,t))},t.default.fn.atomChecked=function(e){return Q(this,t=>nn(t,e))},t.default.fn.atomForm=function(e,t={}){return Q(this,(n,r)=>{r instanceof HTMLFormElement&&sn(r,e,t)})},t.default.fn.atomOn=function(e,t){return Q(this,n=>an(n,e,t))},t.default.fn.atomBind=function(e){let{text:t,html:n,class:r,css:i,attr:a,prop:o,show:s,hide:c,val:l,checked:u,form:d,on:f}=e,p=l===void 0?null:Array.isArray(l)?{atom:l[0],opts:l[1]}:{atom:l,opts:void 0};return Q(this,e=>{t!==void 0&&Jt(e,t),n!==void 0&&Yt(e,n),r!==void 0&&Xt(e,r),i!==void 0&&Zt(e,i),a!==void 0&&Qt(e,a),o!==void 0&&$t(e,o),s!==void 0&&en(e,s,!1),c!==void 0&&en(e,c,!0),p!==null&&tn(e,p.atom,p.opts),u!==void 0&&nn(e,u),d!==void 0&&e.el instanceof HTMLFormElement&&sn(e.el,d),f!==void 0&&rn(e,f)})},t.default.fn.atomUnbind=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t.nodeType===1&&on(t)}return this};var cn=new WeakMap,ln=0,un=new ct(()=>new Map,e=>e.clear()),dn=new ct(()=>new Set,e=>e.clear()),$=new st(100,1024);function fn(e,t,n){t?.isConnected?e.insertBefore(t):e.appendTo(n)}function pn(e){return e instanceof Element?(0,t.default)(e):e}var mn=class{constructor(e,t,n){this.$container=e,this.containerSelector=t,this.onRemove=n,this.oldKeys=[],this.oldItems=[],this.oldNodes=[],this.removingKeys=new Set,this.$emptyEl=null,this.keyToIndex=new Map,this.statesBuffer=new Uint8Array(256),this.indicesBuffer=new Int32Array(256)}scheduleRemoval(e,t){let n=()=>{this.fx?.isDisposed||(t.remove(),this.removingKeys.delete(e),G.log(H.LIST,`${this.containerSelector} removed item:`,e))};if(!this.onRemove){n();return}let r=this.onRemove(t);r instanceof Promise?r.then(n,n):n()}removeItem(e,t){for(let e=0;e<t.length;e++){let n=t[e];n instanceof Element&&n.removeAttribute(`data-atom-key`)}this.removingKeys.add(e),this.scheduleRemoval(e,t)}dispose(){this.removingKeys.clear(),this.oldKeys.length=0,this.oldItems.length=0,this.oldNodes.length=0,this.keyToIndex.clear(),this.$emptyEl?.remove(),this.$container.off(`.atomList`);let e=new Uint8Array,t=new Int32Array;this.statesBuffer=e,this.indicesBuffer=t}ensureBuffers(e){this.statesBuffer.length<e&&(this.statesBuffer=new Uint8Array(Math.max(e,this.statesBuffer.length*2))),this.indicesBuffer.length<e&&(this.indicesBuffer=new Int32Array(Math.max(e,this.indicesBuffer.length*2)))}};function hn(e,n,r,i){if(e.$emptyEl&&n>0&&(e.$emptyEl.remove(),e.$emptyEl=null),n!==0)return;let{oldKeys:a,oldNodes:o,onRemove:s}=e;if(s)for(let t=0,n=a.length;t<n;t++){let n=a[t],r=o[t];r&&e.removeItem(n,pn(r))}else{for(let t=0,n=a.length;t<n;t++)e.removingKeys.delete(a[t]);r.empty()}i&&!e.$emptyEl&&(e.$emptyEl=(0,t.default)(typeof i==`string`?Z(i):i).appendTo(r)),$.release(e.oldKeys),$.release(e.oldItems),$.release(e.oldNodes),e.oldKeys=[],e.oldItems=[],e.oldNodes=[]}function gn(e,t,n,r,i,a){let{oldKeys:o,oldItems:s,oldNodes:c,removingKeys:l,keyToIndex:u}=e,d=o.length,f=0,p=d-1,m=n-1;for(;f<=p&&f<=m;){let e=t[f],n=r(e,f);if(o[f]!==n)break;let i=s[f];if(!(a?a(i,e):Le(i,e)))break;u.set(n,f),f++}for(;p>=f&&m>=f;){let e=t[m],n=r(e,m);if(o[p]!==n)break;let i=s[p];if(!(a?a(i,e):Le(i,e)))break;u.set(n,m),p--,m--}let h=un.acquire();for(let e=f;e<=p;e++)h.set(o[e],e);let g=$.acquire();g.length=n;let _=dn.acquire();e.ensureBuffers(n);let v=$.acquire();v.length=n;let y=$.acquire();y.length=n;let b=e.statesBuffer,x=e.indicesBuffer,S=$.acquire(),C=$.acquire(),w=$.acquire();for(let e=0;e<f;e++)g[e]=o[e],v[e]=t[e],y[e]=c[e],b[e]=3,x[e]=e;for(let e=d-1,r=n-1;r>m;r--,e--)g[r]=o[e],v[r]=t[r],y[r]=c[e],b[r]=3,x[r]=e;for(let n=f;n<=m;n++){let o=t[n],d=r(o,n);if(g[n]=d,v[n]=o,u.set(d,n),_.has(d)){G.warn(H.LIST,W.LIST.DUPLICATE_KEY(d,n,e.containerSelector)),x[n]=-1;continue}_.add(d);let f=h.get(d);if(f===void 0){S.push(d),C.push(o),w.push(n),x[n]=-1,b[n]=1;continue}let p=s[f];y[n]=c[f];let m=a?a(p,o):Le(p,o);!i&&p!==o&&!m?(S.push(d),C.push(o),w.push(n),b[n]=2):b[n]=0,x[n]=l.has(d)?-1:f}return un.release(h),{newKeys:g,newKeySet:_,newItems:v,newNodes:y,newStates:b,newIndices:x,trKeys:S,trItems:C,trIdxs:w,startIndex:f,oldEndIndex:p,newEndIndex:m}}function _n(e,n,r){let{trKeys:i,trItems:a,trIdxs:o,newNodes:s,newStates:c}=e,l=i.length,u=n.render,d=Array(l),f=[],p=0;for(let e=0;e<l;e++){let t=u(a[e],o[e]);d[e]=t,typeof t==`string`&&(f.push(t),p++)}let m=null,h=f.length;if(h>0)if(h===1)m=[Z(f[0])];else{let e=`<template data-atom-sep="${(ln++).toString(36)}"></template>`;m=Z(f.join(e)).split(e)}if(r&&m&&p===l&&!n.bind&&!n.onAdd&&!n.onRemove&&!n.events)return m;let g=0;for(let e=0;e<l;e++){let n=d[e],r=typeof n==`string`?(0,t.default)(m[g++]):(0,t.default)(n),a=o[e],l=c[a],u=i[e],f=String(u);for(let e=0,t=r.length;e<t;e++){let t=r[e];t instanceof Element&&t.setAttribute(`data-atom-key`,f)}if(l===2){let e=s[a];if(e){let t=pn(e);for(let e=0,n=t.length;e<n;e++){let n=t[e];n&&J.cleanupTree(n)}t.replaceWith(r)}}s[a]=r.length===1?r[0]:r}return null}function vn(e,t){let{startIndex:n,oldEndIndex:r,newKeySet:i}=t,{oldKeys:a,oldNodes:o}=e;for(let t=n;t<=r;t++){let n=a[t];if(i.has(n))continue;let r=o[t];r&&e.removeItem(n,pn(r))}}function yn(e,n,r,i,a,o){let{bind:s,update:c,onAdd:l}=a,{newKeys:u,newItems:d,newNodes:f,newStates:p,newIndices:m}=n,h=u.length,g=e.oldKeys.length===0;if(o!==null){r.innerHTML=o.join(``);let n=r.firstElementChild;for(let r=0;r<h&&n;r++){let i=u[r];n.setAttribute(`data-atom-key`,String(i)),f[r]=n,p[r]=0,e.removingKeys.delete(i),G.enabled&&G.domUpdated(H.LIST,(0,t.default)(n),`list.add`,d[r]),n=n.nextElementSibling}return}if(g){let e=document.createDocumentFragment();for(let t=0;t<h;t++){let n=f[t];if(n instanceof Element)e.appendChild(n);else for(let t=0;t<n.length;t++)e.appendChild(n[t])}r.appendChild(e)}else{let e=null,t=2147483647;for(let n=h-1;n>=0;n--){let r=m[n],a=f[n];r!==-1&&r<t?t=r:fn(pn(a),e,i),e=a instanceof Element?a:a[0]??null}}for(let t=0;t<h;t++){let n=f[t],r=p[t];if(r!==3){let i=pn(n),a=d[t];if(r===0?c?.(i,a,t):s?.(i,a,t),r===1){l?.(i);let n=u[t];e.removingKeys.delete(n),G.enabled&&G.domUpdated(H.LIST,i,`list.add`,d[t])}}}}t.default.fn.atomList=function(e,n){let{key:r,bind:i,update:a,onAdd:o,onRemove:s,empty:c,events:l,isEqual:u}=n,d=typeof r==`function`?r:(e,t)=>e[r],f={bind:i,update:a,onAdd:o,onRemove:s,events:l};for(let r=0,i=this.length;r<i;r++){let i=this[r],o=(0,t.default)(i);o.off(`.atomList`);let p=cn.get(i);p&&(p.fx.dispose(),p.ctx.dispose());let m=B(i),h=new mn(o,m,s),g=R(()=>{let t=e.value,r=t.length;k(()=>{if(hn(h,r,o,c),r===0)return;G.log(H.LIST,`${m} updating with ${r} items`);let e=gn(h,t,r,d,a,u),s=_n(e,n,h.oldKeys.length===0);if(vn(h,e),yn(h,e,i,o,f,s),l){let{startIndex:t,oldEndIndex:n,newKeySet:r}=e;for(let e=t;e<=n;e++){let t=h.oldKeys[e];r.has(t)||h.keyToIndex.delete(t)}}$.release(h.oldKeys),$.release(h.oldItems),$.release(h.oldNodes),h.oldKeys=e.newKeys,h.oldItems=e.newItems,h.oldNodes=e.newNodes,dn.release(e.newKeySet),$.release(e.trKeys),$.release(e.trItems),$.release(e.trIdxs)})});if(h.fx=g,l)for(let e in l){if(!V.call(l,e))continue;let t=l[e],n=e.indexOf(` `),r=n===-1?e:e.slice(0,n),i=(n===-1?null:e.slice(n+1).trim())||`> *`;o.on(`${r}.atomList`,i,function(e){let n=e.target.closest?.(`[data-atom-key]`);if(!n)return;let r=n.getAttribute(`data-atom-key`);if(r===null)return;let i=r;if(!h.keyToIndex.has(r)){let e=Number(r);!Number.isNaN(e)&&h.keyToIndex.has(e)&&(i=e)}let a=h.keyToIndex.get(i);a!==void 0&&t.call(n,h.oldItems[a],a,e)})}J.trackEffect(i,g),cn.set(i,{fx:g,ctx:h}),J.trackCleanup(i,()=>{h.dispose(),cn.delete(i)})}return this};var bn=Object.freeze({});t.default.fn.atomMount=function(e,n){let r=n??bn;for(let n=0,i=this.length;n<i;n++){let i=this[n];if(!i)continue;J.cleanupTree(i);let a=(0,t.default)(i),o;try{o=k(()=>e(a,r))}catch(t){G.error(H.MOUNT,W.MOUNT.ERROR(e.name),t);continue}typeof o==`function`&&J.setComponentCleanup(i,o)}return this},t.default.fn.atomUnmount=function(){for(let e=0,t=this.length;e<t;e++){let t=this[e];t&&on(t)}return this};function xn(e,t){try{return history.pushState(e,``,t),!0}catch(e){return G.warn(H.ROUTE,`PushState failed (likely file:// protocol or security restriction). UI will update, but URL will not.`,e),!1}}var Sn=class{constructor(e){this.isDestroyed=!1,this.previousRoute=``,this.cleanups=[],this.templateCache=new Map,this.routeCleanups=[],this.lastRawQuery=``,this.cachedParams={},this.config={...e,mode:e.mode??U.mode,basePath:e.basePath??U.basePath,autoBindLinks:e.autoBindLinks??U.autoBindLinks,activeClass:e.activeClass??U.activeClass},this.isHistoryMode=this.config.mode===`history`,this.$target=(0,t.default)(this.config.target),this.normalizedBasePath=this.config.basePath?.replace(/\/$/,``)||``,this.activeClass=this.config.activeClass??U.activeClass,this.previousUrl=this.isHistoryMode?window.location.pathname+window.location.search:window.location.hash,this.currentRouteAtom=Te(this.getRouteName()),this.currentRoute=this.currentRouteAtom,this.queryParamsAtom=Te(this.getQueryParams()),this.queryParams=L(()=>this.queryParamsAtom.value),this.handleUrlChange=this.handleUrlChange.bind(this),this.destroy=this.destroy.bind(this),this.init()}init(){let e=this.isHistoryMode?`popstate`:`hashchange`;window.addEventListener(e,this.handleUrlChange),this.cleanups.push(()=>window.removeEventListener(e,this.handleUrlChange));let t=R(()=>{let e=this.currentRouteAtom.value;k(()=>{let e=this.routeCleanups;for(let t=0,n=e.length;t<n;t++)try{e[t]()}catch(e){G.warn(H.ROUTE,`Cleanup error during route transition:`,e)}e.length=0}),this.renderRoute(e)});this.cleanups.push(()=>t.dispose()),this.setupAutoBindLinks(),this.$target[0]&&J.trackCleanup(this.$target[0],this.destroy)}getRouteName(){let e=this.config.default;if(this.isHistoryMode){let t=window.location.pathname,n=0,r=this.normalizedBasePath;return r&&t.startsWith(r)&&(n=r.length),t.charCodeAt(n)===47&&n++,(n===0?t:t.substring(n))||e}let t=window.location.hash;if(t.length<=1)return e;let n=t.indexOf(`?`);return(n===-1?t.substring(1):t.substring(1,n))||e}getQueryParams(){let e=``;if(this.isHistoryMode)e=window.location.search.substring(1);else{let t=window.location.hash,n=t.indexOf(`?`);n!==-1&&(e=t.substring(n+1))}if(e===this.lastRawQuery)return this.cachedParams;let t={};e&&new URLSearchParams(e).forEach((e,n)=>{t[n]=e});let n=!1,r=this.cachedParams,i=Object.keys(r),a=Object.keys(t);if(i.length!==a.length)n=!0;else for(let e=0,i=a.length;e<i;e++){let i=a[e];if(r[i]!==t[i]){n=!0;break}}return n&&(this.cachedParams=t),this.lastRawQuery=e,e.includes(`%`),this.cachedParams}setUrl(e){if(this.isHistoryMode){let t=`${this.normalizedBasePath}/${e}`;xn(null,t),this.previousUrl=t}else{let t=`#${e}`;window.location.hash=t,this.previousUrl=t}}restoreUrl(){this.isHistoryMode?xn(null,this.previousUrl):window.location.hash=this.previousUrl}getCurrentUrl(){return this.isHistoryMode?window.location.pathname+window.location.search:window.location.hash}getRouteConfig(e){let{routes:t,notFound:n}=this.config,r=t[e];return!r&&n&&(r=t[n]),r||(G.warn(H.ROUTE,W.ROUTE.NOT_FOUND(e)),null)}renderTemplate(e){let t=this.templateCache.get(e);if(!t){let n=document.querySelector(e);if(!n||!(n instanceof HTMLTemplateElement))return G.warn(H.ROUTE,W.ROUTE.TEMPLATE_NOT_FOUND(e)),!1;t=n,this.templateCache.set(e,t)}let n=t.content.cloneNode(!0);return this.$target.append(n),!0}renderRoute(e){if(this.isDestroyed)return;let t=this.$target[0];if(!t){G.warn(H.ROUTE,W.ROUTE.TARGET_NOT_FOUND(this.config.target));return}let n=this.getRouteConfig(e);if(!n)return;let r=this.getQueryParams(),i=this.previousRoute,{beforeTransition:a,afterTransition:o}=this.config;a&&k(()=>a(i,e)),this.$target.empty();let s=r,{onEnter:c}=n;if(c){let e=k(()=>c(r,this));e!==void 0&&(s={...r,...e})}let l=e=>{this.routeCleanups.push(e)};n.render?n.render(t,e,s,l,this):n.template&&this.renderTemplate(n.template)&&n.onMount&&n.onMount(this.$target.children(),l,this),o&&k(()=>o(i,e)),this.previousRoute=e}handleUrlChange(){if(this.isDestroyed)return;let e=this.getCurrentUrl();if(e===this.previousUrl)return;let t=this.getRouteName(),n=this.currentRouteAtom.peek(),r=this.getQueryParams();if(n!==t){let e=this.config.routes[n];if(e?.onLeave&&k(()=>e.onLeave(this))===!1){this.restoreUrl();return}this.currentRouteAtom.value=t,this.queryParamsAtom.value=r}else this.queryParamsAtom.value=r;this.previousUrl=e}setupAutoBindLinks(){if(!this.config.autoBindLinks)return;let e=e=>{e.preventDefault();let t=e.currentTarget.dataset.route;t!=null&&this.navigate(t)};(0,t.default)(document).on(`click`,`[data-route]`,e),this.cleanups.push(()=>{(0,t.default)(document).off(`click`,`[data-route]`,e)});let n=this.activeClass,r=[],i=R(()=>{let e=this.currentRouteAtom.value;k(()=>{for(let e=0,t=r.length;e<t;e++){let t=r[e];t.classList.remove(n),t.removeAttribute(`aria-current`)}try{let t=e.replace(/"/g,`\\"`),i=document.querySelectorAll(`[data-route="${t}"]`),a=i.length,o=Array(a);for(let e=0;e<a;e++){let t=i[e];t.classList.add(n),t.setAttribute(`aria-current`,`page`),o[e]=t}r=o}catch{r=[]}})});this.cleanups.push(()=>i.dispose())}navigate(e){if(this.isDestroyed)return;let t=this.currentRouteAtom.peek(),n=this.config.routes[t];if(n?.onLeave&&n.onLeave(this)===!1)return;let r=e||this.config.default;if(!r){G.warn(H.ROUTE,`navigate() called with empty routeName and no default configured.`);return}this.setUrl(r),this.queryParamsAtom.value={},this.currentRouteAtom.value=r}destroy(){if(this.isDestroyed)return;this.isDestroyed=!0;let e=this.cleanups;this.cleanups=[];for(let t=0,n=e.length;t<n;t++)try{e[t]()}catch(e){G.warn(H.ROUTE,`Cleanup error during destroy:`,e)}this.templateCache.clear()}};function Cn(e){return new Sn(e)}t.default.extend({route:Cn});var wn=class{constructor(e,t){this.abortController=null,this.isStaticUrl=typeof e==`string`,this.isStaticUrl?this.staticUrl=e:this.getUrl=e,typeof t.ajaxOptions==`function`?(this.ajaxOptionsFn=t.ajaxOptions,this.staticOptions={}):this.staticOptions={...t.ajaxOptions},t.method!==void 0&&(this.staticOptions.method=t.method),t.headers!==void 0&&(this.staticOptions.headers={...this.staticOptions.headers,...t.headers}),this.transformFn=t.transform,this.onErrorFn=t.onError,this.execute=this.execute.bind(this)}abort(){this.abortController?.abort()}async execute(){this.abortController?.abort(),this.abortController=new AbortController;let e=this.abortController.signal,n=this.ajaxOptionsFn?this.ajaxOptionsFn():{},r=t.default.extend(!0,{},this.staticOptions,n);r.success=void 0,r.error=void 0,r.complete=void 0,r.url=this.isStaticUrl?this.staticUrl:this.getUrl();let i=t.default.ajax(r);e.onabort=()=>i.abort(),e.aborted&&i.abort();let a;try{a=await i}catch(t){if(e.aborted){let e=Error(`AbortError`);throw e.name=`AbortError`,e}let n;if(t&&t.readyState!==void 0){let e=t;n=Error(`Network Error: ${e.statusText||`Unknown`} (${e.status})`),n.jqXHR=e}else n=t instanceof Error?t:Error(String(t??`Unknown network error`));let r=this.onErrorFn;if(r)try{r(n)}catch{}throw n}finally{e.onabort=null,this.abortController?.signal===e&&(this.abortController=null)}let o=this.transformFn;if(o)try{return o(a)}catch(e){let t=this.onErrorFn;if(t)try{t(e)}catch{}throw e}return a}};t.default.extend({atomFetch(e,t){let n=new wn(e,t),r=!(t.eager??!0),i=L(n.execute,{defaultValue:t.defaultValue,lazy:r});return Object.assign(i,{abort:()=>n.abort()})}}),(0,t.default)(()=>{bt(),pt(document.body)});var Tn=t.default;e.atom=Te,e.atomLens=tt,e.batch=Fe,e.composeLens=nt,e.computed=L,e.default=Tn,e.disableAutoCleanup=mt,e.disablejQueryOverrides=xt,e.effect=R,e.enableAutoCleanup=pt,e.enablejQueryOverrides=bt,e.isAtom=De,e.isComputed=Oe,e.isReactive=z,e.lensFor=rt,e.nextTick=at,e.registry=J,e.untracked=k});
3
3
  //# sourceMappingURL=atom-effect-jquery.min.js.map