1 | System.register(["react","jotai/react"],function(h){"use strict";var S,y,g,_,E,m,O;return{setters:[function(p){S=p.useState,y=p.useEffect,g=p.useDebugValue,_=p.useRef,E=p.useCallback},function(p){m=p.useStore,O=p.useAtom}],execute:function(){h({useAtomDevtools:z,useAtomsDevtools:k,useAtomsSnapshot:D,useGotoAtomsSnapshot:I});const p=t=>t.debugLabel||t.toString(),$=([t,e])=>Object.fromEntries(e.flatMap(o=>{var n,r;const a=(n=t.dev_get_mounted)==null?void 0:n.call(t,o);if(!a)return[];const i=a.t,l=((r=t.dev_get_atom_state)==null?void 0:r.call(t,o))||{};return[[p(o),{..."e"in l&&{error:l.e},..."v"in l&&{value:l.v},dependents:Array.from(i).map(p)}]]})),H=h("useAtomsDebugValue",t=>{var e;const o=(e=t==null?void 0:t.enabled)!=null?e:!1,n=m(t),[r,a]=S([]);y(()=>{var i;if(!o)return;const l=()=>{var s;a(Array.from(((s=n.dev_get_mounted_atoms)==null?void 0:s.call(n))||[]))},c=(i=n.dev_subscribe_state)==null?void 0:i.call(n,l);return l(),c},[o,n]),g([n,r],$)});function z(t,e){const{enabled:o,name:n}=e||{};let r;try{r=(o!=null?o:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}const[a,i]=O(t),l=_(a),c=_(!1),s=_(),d=n||t.debugLabel||t.toString();y(()=>{if(!r)return;const v=u=>{if(typeof i=="function"){i(u);return}console.warn(`[Warn] you cannot do write operations (Time-travelling, etc) in read-only atoms
|
3 | `,A)}else u.type==="DISPATCH"&&u.state?(((f=u.payload)==null?void 0:f.type)==="JUMP_TO_ACTION"||((M=u.payload)==null?void 0:M.type)==="JUMP_TO_STATE")&&(c.current=!0,v(JSON.parse(u.state))):u.type==="DISPATCH"&&((C=u.payload)==null?void 0:C.type)==="COMMIT"?(N=s.current)==null||N.init(l.current):u.type==="DISPATCH"&&((P=u.payload)==null?void 0:P.type)==="IMPORT_STATE"&&(((L=u.payload.nextLiftedState)==null?void 0:L.computedStates)||[]).forEach(({state:A},V)=>{var R;V===0?(R=s.current)==null||R.init(A):v(A)})});return s.current.shouldInit=!0,b},[t,r,d,i]),y(()=>{!s.current||(l.current=a,s.current.shouldInit?(s.current.init(a),s.current.shouldInit=!1):c.current?c.current=!1:s.current.send(`${d} - ${new Date().toLocaleString()}`,a))},[t,r,d,a])}const J=(t,e)=>t.size===e.size&&Array.from(t).every(([o,n])=>Object.is(e.get(o),n)),U=(t,e)=>t.size===e.size&&Array.from(t).every(([o,n])=>{const r=e.get(o);return r&&n.size===r.size&&Array.from(n).every(a=>r.has(a))});function D(t){const e=m(t),[o,n]=S(()=>({values:new Map,dependents:new Map}));return y(()=>{if(!e.dev_subscribe_state)return;let r=new Map,a=new Map;const i=()=>{const c=new Map,s=new Map;for(const d of e.dev_get_mounted_atoms()||[]){const v=e.dev_get_atom_state(d);v&&"v"in v&&c.set(d,v.v);const b=e.dev_get_mounted(d);b&&s.set(d,b.t)}J(r,c)&&U(a,s)||(r=c,a=s,n({values:c,dependents:s}))},l=e.dev_subscribe_state(i);return i(),l},[e]),o}function I(t){const e=m(t);return E(o=>{e.dev_subscribe_state&&e.res(o.values)},[e])}const T=t=>t.debugLabel?`${t}:${t.debugLabel}`:`${t}`,w=t=>{const e={};t.values.forEach((n,r)=>{e[T(r)]=n});const o={};return t.dependents.forEach((n,r)=>{o[T(r)]=Array.from(n).map(T)}),{values:e,dependents:o}};function k(t,e){const{enabled:o}=e||{};let n;try{n=(o!=null?o:!1)&&window.__REDUX_DEVTOOLS_EXTENSION__}catch{}const r=D(),a=I(),i=_(!1),l=_(!0),c=_(),s=_([]);y(()=>{if(!n)return;const d=(u=s.current.length-1)=>{const f=s.current[u>=0?u:0];if(!f)throw new Error("snaphost index out of bounds");return f},v=n.connect({name:t}),b=v.subscribe(u=>{var f;switch(u.type){case"DISPATCH":switch((f=u.payload)==null?void 0:f.type){case"RESET":break;case"COMMIT":v.init(w(d())),s.current=[];break;case"JUMP_TO_ACTION":case"JUMP_TO_STATE":i.current=!0,a(d(u.payload.actionId-1));break;case"PAUSE_RECORDING":l.current=!l.current;break}}});return c.current=v,c.current.shouldInit=!0,()=>{n.disconnect(),b==null||b()}},[n,a,t]),y(()=>{if(c.current){if(c.current.shouldInit){c.current.init(void 0),c.current.shouldInit=!1;return}i.current?i.current=!1:l.current&&(s.current.push(r),c.current.send({type:`${s.current.length}`,updatedAt:new Date().toLocaleString()},w(r)))}},[r])}}}});
|