1 | System.register(["jotai","react"],function(P){"use strict";var m,k,W,x,R,E,M;return{setters:[function(b){m=b.atom,k=b.SECRET_INTERNAL_getScopeContext,W=b.useAtom,x=b.useSetAtom,P({useAtomValue:b.useAtomValue,useUpdateAtom:b.useSetAtom})},function(b){R=b.useContext,E=b.useCallback,M=b.useMemo}],execute:function(){P({atomFamily:X,atomWithDefault:ue,atomWithHash:je,atomWithObservable:Le,atomWithReducer:Q,atomWithReset:H,atomWithStorage:_,createJSONStorage:$,freezeAtom:oe,freezeAtomCreator:se,loadable:Ce,selectAtom:te,splitAtom:ie,useAtomCallback:re,useHydrateAtoms:xe,useReducerAtom:G,useResetAtom:B,waitForAll:ye});const b=P("RESET",Symbol());function H(e){const t=m(e,(r,n,o)=>{o===b?n(t,e):n(t,typeof o=="function"?o(r(t)):o)});return t}const K="w",q="h";function B(e,t){const r=k(t),n=R(r).s;return E(()=>n[K](e,b),[n,e])}function G(e,t,r){const[n,o]=W(e,r),s=E(a=>{o(c=>t(c,a))},[o,t]);return[n,s]}function Q(e,t){const r=m(e,(n,o,s)=>o(r,t(n(r),s)));return r}function X(e,t){let r=null;const n=new Map,o=s=>{let a;if(t===void 0)a=n.get(s);else for(const[i,l]of n)if(t(i,s)){a=l;break}if(a!==void 0)if(r!=null&&r(a[1],s))n.delete(s);else return a[0];const c=e(s);return n.set(s,[c,Date.now()]),c};return o.remove=s=>{if(t===void 0)n.delete(s);else for(const[a]of n)if(t(a,s)){n.delete(a);break}},o.setShouldRemove=s=>{if(r=s,!!r)for(const[a,c]of n)r(c[1],a)&&n.delete(a)},o}const Y=(e,t)=>{do{const[r,...n]=t,o=e.get(r);if(!o)return;if(!n.length)return o[1];e=o[0],t=n}while(t.length)},Z=(e,t,r)=>{do{const[n,...o]=t;let s=e.get(n);if(s||(s=[new WeakMap],e.set(n,s)),!o.length){s[1]=r;return}e=s[0],t=o}while(t.length)},w=()=>{const e=new WeakMap;return(t,r)=>{const n=Y(e,r);if(n)return n;const o=t();return Z(e,r,o),o}},ee=w();function te(e,t,r=Object.is){return ee(()=>{const n=m(()=>({}));return m(o=>{const s=t(o(e)),a=o(n);return"prev"in a&&r(a.prev,s)?a.prev:(a.prev=s,s)})},[e,t,r])}function re(e,t){const r=M(()=>m(null,(o,s,[a,c,i])=>{try{c(e(o,s,a))}catch(l){i(l)}}),[e]),n=x(r,t);return E(o=>{let s=!0,a={};const c=new Promise((i,l)=>{n([o,f=>{s?a={v:f}:i(f)},f=>{s?a={e:f}:l(f)}])});if(s=!1,"e"in a)throw a.e;return"v"in a?a.v:c},[n])}const ne=w(),j=e=>{if(typeof e!="object"||e===null)return;Object.freeze(e);const t=Object.getOwnPropertyNames(e);for(const r of t){const n=e[r];j(n)}return e};function oe(e){return ne(()=>m(t=>j(t(e)),(t,r,n)=>r(e,n)),[e])}function se(e){return(...t)=>{const r=e(...t),n=r.read;return r.read=o=>j(n(o)),r}}const ae=w(),N=e=>!!e.write,ce=e=>typeof e=="function";function ie(e,t){return ae(()=>{const r=new WeakMap,n=(i,l)=>{let f=r.get(i);if(f)return f;const u=l&&r.get(l),h=[],d=[];return i.forEach((L,y)=>{const g=t?t(L):y;d[y]=g;const F=u&&u.atomList[u.keyList.indexOf(g)];if(F){h[y]=F;return}const U=O=>{const I=O(o),v=O(e),S=n(v,I.prev).keyList.indexOf(g);if(S<0||S>=v.length){const p=i[n(i).keyList.indexOf(g)];if(p)return p;throw new Error("splitAtom: index out of bounds for read")}return v[S]},ze=(O,I,v)=>{const S=O(o),p=O(e),A=n(p,S.prev).keyList.indexOf(g);if(A<0||A>=p.length)throw new Error("splitAtom: index out of bounds for write");const De=ce(v)?v(p[A]):v;I(e,[...p.slice(0,A),De,...p.slice(A+1)])};h[y]=N(e)?m(U,ze):m(U)}),u&&u.keyList.length===d.length&&u.keyList.every((L,y)=>L===d[y])?f=u:f={atomList:h,keyList:d},r.set(i,f),f},o=m(()=>({})),s=i=>{const l=i(o),f=i(e),u=n(f,l.prev);return l.prev=f,u.atomList},a=(i,l,f)=>{switch("read"in f&&(console.warn("atomToRemove is deprecated. use action with type"),f={type:"remove",atom:f}),f.type){case"remove":{const u=i(c).indexOf(f.atom);if(u>=0){const h=i(e);l(e,[...h.slice(0,u),...h.slice(u+1)])}break}case"insert":{const u=f.before?i(c).indexOf(f.before):i(c).length;if(u>=0){const h=i(e);l(e,[...h.slice(0,u),f.value,...h.slice(u)])}break}case"move":{const u=i(c).indexOf(f.atom),h=f.before?i(c).indexOf(f.before):i(c).length;if(u>=0&&h>=0){const d=i(e);u<h?l(e,[...d.slice(0,u),...d.slice(u+1,h),d[u],...d.slice(h)]):l(e,[...d.slice(0,h),d[u],...d.slice(h,u),...d.slice(u+1)])}break}}},c=N(e)?m(s,a):m(s);return c},t?[e,t]:[e])}function ue(e){const t=Symbol(),r=m(t),n=m(o=>{const s=o(r);return s!==t?s:e(o)},(o,s,a)=>a===b?s(r,t):s(r,typeof a=="function"?a(o(n)):a));return n}var le=Object.defineProperty,fe=Object.defineProperties,me=Object.getOwnPropertyDescriptors,T=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,be=Object.prototype.propertyIsEnumerable,C=(e,t,r)=>t in e?le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,de=(e,t)=>{for(var r in t||(t={}))he.call(t,r)&&C(e,r,t[r]);if(T)for(var r of T(t))be.call(t,r)&&C(e,r,t[r]);return e},pe=(e,t)=>fe(e,me(t));const ve=w();function ye(e){const t=()=>{const r=we(e);return m(n=>{const o=[],s=r.map((a,c)=>{try{return n(a)}catch(i){if(i instanceof Promise)o[c]=i;else throw i}});if(o.length)throw Promise.all(o);return ge(e,s)})};return Array.isArray(e)?ve(t,e):t()}const we=e=>Array.isArray(e)?e:Object.getOwnPropertyNames(e).map(t=>e[t]),ge=(e,t)=>Array.isArray(e)?t:Object.getOwnPropertyNames(e).reduce((r,n,o)=>pe(de({},r),{[n]:t[o]}),{});var Oe=Object.defineProperty,Se=Object.defineProperties,Ae=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,D=(e,t,r)=>t in e?Oe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ke=(e,t)=>{for(var r in t||(t={}))Ee.call(t,r)&&D(e,r,t[r]);if(z)for(var r of z(t))Pe.call(t,r)&&D(e,r,t[r]);return e},Re=(e,t)=>Se(e,Ae(t));function $(e){let t,r;return{getItem:n=>{const o=a=>(a=a||"",t!==a&&(r=JSON.parse(a),t=a),r),s=e().getItem(n);return s instanceof Promise?s.then(o):o(s)},setItem:(n,o)=>e().setItem(n,JSON.stringify(o)),removeItem:n=>e().removeItem(n)}}const J=$(()=>localStorage);J.subscribe=(e,t)=>{const r=n=>{n.key===e&&n.newValue&&t(JSON.parse(n.newValue))};return window.addEventListener("storage",r),()=>{window.removeEventListener("storage",r)}};function _(e,t,r=J){const n=()=>{try{const s=r.getItem(e);return s instanceof Promise?s.catch(()=>t):s}catch{return t}},o=m(r.delayInit?t:n());return o.onMount=s=>{let a;if(r.subscribe&&(a=r.subscribe(e,s),s(n())),r.delayInit){const c=n();c instanceof Promise?c.then(s):s(c)}return a},m(s=>s(o),(s,a,c)=>{if(c===b)return a(o,t),r.removeItem(e);const i=typeof c=="function"?c(s(o)):c;return a(o,i),r.setItem(e,i)})}function je(e,t,r){const n=(r==null?void 0:r.serialize)||JSON.stringify,o=(r==null?void 0:r.deserialize)||JSON.parse,s=(r==null?void 0:r.subscribe)||(c=>(window.addEventListener("hashchange",c),()=>{window.removeEventListener("hashchange",c)})),a=Re(ke({getItem:c=>{const i=new URLSearchParams(location.hash.slice(1)).get(c);if(i===null)throw new Error("no value stored");return o(i)},setItem:(c,i)=>{const l=new URLSearchParams(location.hash.slice(1));l.set(c,n(i)),r!=null&&r.replaceState?history.replaceState(null,"","#"+l.toString()):location.hash=l.toString()},removeItem:c=>{const i=new URLSearchParams(location.hash.slice(1));i.delete(c),r!=null&&r.replaceState?history.replaceState(null,"","#"+i.toString()):location.hash=i.toString()}},(r==null?void 0:r.delayInit)&&{delayInit:!0}),{subscribe:(c,i)=>s(()=>{const l=new URLSearchParams(location.hash.slice(1)).get(c);i(l!==null?o(l):t)})});return _(e,t,a)}function Le(e,t){const r=m(n=>{var o;let s=e(n);const a=(o=s[Symbol.observable])==null?void 0:o.call(s);a&&(s=a);const c=m(t!=null&&t.initialValue?Ie(t):We(s));let i=()=>{throw new Error("setting data without mount")};const l=h=>{i(h)},f=h=>{i(Promise.reject(h))};let u=null;return c.onMount=h=>(i=h,u||(u=s.subscribe(l,f)),()=>{u==null||u.unsubscribe(),u=null}),{dataAtom:c,observable:s}});return m(n=>{const{dataAtom:o}=n(r);return n(o)},(n,o,s)=>{const{observable:a}=n(r);if("next"in a)a.next(s);else throw new Error("observable is not subject")})}function Ie(e){const t=e.initialValue;return t instanceof Function?t():t}function We(e){return new Promise((t,r)=>{let n=!1;const o=e.subscribe({next:s=>{t(s),n=!0,o&&o.unsubscribe()},error:r,complete:()=>{r()}});n&&o.unsubscribe()})}const V=new WeakMap;function xe(e,t){const r=k(t),n=R(r),o=n.s,s=Me(n),a=[];for(const c of e){const i=c[0];s.has(i)||(s.add(i),a.push(c))}a.length&&o[q](a)}function Me(e){let t=V.get(e);return t||(t=new WeakSet,V.set(e,t)),t}const Ne=w(),Te={state:"loading"};function Ce(e){return Ne(()=>{const t=new WeakMap,r=m(n=>{let o;try{const c=n(e);return m({state:"hasData",data:c})}catch(c){if(c instanceof Promise)o=c;else return m({state:"hasError",error:c})}const s=t.get(o);if(s)return s;const a=m(Te,async(c,i)=>{try{const l=await c(e,{unstable_promise:!0});i(a,{state:"hasData",data:l})}catch(l){i(a,{state:"hasError",error:l})}});return a.onMount=c=>{c()},t.set(o,a),a});return m(n=>{const o=n(r);return n(o)})},[e])}}}});
|