Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

recoil

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recoil - npm Package Compare versions

Comparing version 0.0.6 to 0.0.7

2

dist/recoil.js

@@ -1,1 +0,1 @@

"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),n=e(require("react-dom"));var o={setByAddingToSet:function(e,t){const n=new Set(e);return n.add(t),n},setByDeletingFromSet:function(e,t){const n=new Set(e);return n.delete(t),n},mapBySettingInMap:function(e,t,n){const o=new Map(e);return o.set(t,n),o},mapByUpdatingInMap:function(e,t,n){const o=new Map(e);return o.set(t,n(o.get(t))),o},mapByDeletingFromMap:function(e,t){const n=new Map(e);return n.delete(t),n}};var r=function(e){var t,n;const o=null!==(n=(null!=e?null!==(t=e.ownerDocument)&&void 0!==t?t:e:document).defaultView)&&void 0!==n?n:window;return!(null==e||!("function"==typeof o.Node?e instanceof o.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))};var a=function(e){return!!e&&"function"==typeof e.then};var s=function e(t){if("object"==typeof t&&!function(e){if(null===e||"object"!=typeof e)return!0;switch(typeof e.$$typeof){case"symbol":case"number":return!0}return null!=e["@@__IMMUTABLE_ITERABLE__@@"]||null!=e["@@__IMMUTABLE_KEYED__@@"]||null!=e["@@__IMMUTABLE_INDEXED__@@"]||null!=e["@@__IMMUTABLE_ORDERED__@@"]||null!=e["@@__IMMUTABLE_RECORD__@@"]||(!!r(e)||!!a(e))}(t)){Object.freeze(t);for(const n in t)t.hasOwnProperty(n)&&e(t[n]);Object.seal(t)}};var u=function(e,t){if(null!=e)return e;throw new Error(null!=t?t:"Got unexpected null or undefined")};const c={getValue(){if("hasValue"!==this.state)throw this.contents;return this.contents},toPromise(){return"hasValue"===this.state?Promise.resolve(this.contents):"hasError"===this.state?Promise.reject(this.contents):this.contents},valueMaybe(){return"hasValue"===this.state?this.contents:void 0},valueOrThrow(){if("hasValue"!==this.state)throw new Error(`Loadable expected value, but in "${this.state}" state`);return this.contents},errorMaybe(){return"hasError"===this.state?this.contents:void 0},errorOrThrow(){if("hasError"!==this.state)throw new Error(`Loadable expected error, but in "${this.state}" state`);return this.contents},promiseMaybe(){return"loading"===this.state?this.contents:void 0},promiseOrThrow(){if("loading"!==this.state)throw new Error(`Loadable expected promise, but in "${this.state}" state`);return this.contents},map(e){if("hasError"===this.state)return this;if("hasValue"===this.state)try{const t=e(this.contents);return a(t)?d(t):i(t)}catch(t){return a(t)?d(t.next(()=>e(this.contents))):l(t)}if("loading"===this.state)return d(this.contents.then(e).catch(t=>{if(a(t))return t.then(()=>e(this.contents));throw t}));throw new Error("Invalid Loadable state")}};function i(e){return Object.freeze({state:"hasValue",contents:e,...c})}function l(e){return Object.freeze({state:"hasError",contents:e,...c})}function d(e){return Object.freeze({state:"loading",contents:e,...c})}var f={loadableWithValue:i,loadableWithError:l,loadableWithPromise:d,loadableLoading:function(){return d(new Promise(()=>{}))},loadableAll:function(e){return e.every(e=>"hasValue"===e.state)?i(e.map(e=>e.contents)):e.some(e=>"hasError"===e.state)?l(u(e.find(e=>"hasError"===e.state),"Invalid loadable passed to loadableAll").contents):d(Promise.all(e.map(e=>e.contents)))}};class p{constructor(e){var t,n,o;o=void 0,(n="key")in(t=this)?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,this.key=e}}var S={AbstractRecoilValue:p,RecoilState:class extends p{},RecoilValueReadOnly:class extends p{}},b=S.AbstractRecoilValue,h=S.RecoilState,m=S.RecoilValueReadOnly,R=Object.freeze({__proto__:null,AbstractRecoilValue:b,RecoilState:h,RecoilValueReadOnly:m});class v{}const g=new v;class y extends Error{constructor(e){super(`Tried to set the value of Recoil selector ${e} using an updater function, but it is an async selector in a pending or error state; this is not supported.`)}}const w=new Map;class V extends Error{}var T={nodes:w,registerNode:function(e){if(w.has(e.key)){e.key}return w.set(e.key,e),null==e.set?new R.RecoilValueReadOnly(e.key):new R.RecoilState(e.key)},getNode:function(e){const t=w.get(e);if(null==t)throw new V(`Missing definition for RecoilValue: "${e}""`);return t},NodeMissingError:V,DefaultValue:v,DEFAULT_VALUE:g,RecoilValueNotReady:y};var A={trace:function(e,t,n){return n()},wrap:function(e){return e}};const{mapByDeletingFromMap:E,mapBySettingInMap:N,mapByUpdatingInMap:M,setByAddingToSet:_}=o,{getNode:L}=T,k=Object.freeze(new Map),U=Object.freeze(new Set);class B extends Error{}function x(e,t,n){return L(n).get(e,t)}let C=0;var O={getNodeLoadable:x,peekNodeLoadable:function(e,t,n){return x(e,t,n)[1]},setNodeValue:function(e,t,n,o){const r=L(n);if(null==r.set)throw new B("Attempt to set read-only RecoilValue: "+n);const[a,s]=r.set(e,t,o);return[a,s]},setUnvalidatedAtomValue:function(e,t,n){return{...e,atomValues:E(e.atomValues,t),nonvalidatedAtoms:N(e.nonvalidatedAtoms,t,n),dirtyAtoms:_(e.dirtyAtoms,t)}},subscribeComponentToNode:function(e,t,n){const o=C++;return[{...e,nodeToComponentSubscriptions:M(e.nodeToComponentSubscriptions,t,e=>N(null!=e?e:k,o,["TODO debug name",n]))},function(e){return{...e,nodeToComponentSubscriptions:M(e.nodeToComponentSubscriptions,t,e=>E(null!=e?e:k,o))}}]},fireNodeSubscriptions:function(e,t,n){var o;const r="enqueue"===n&&null!==(o=e.getState().nextTree)&&void 0!==o?o:e.getState().currentTree,a=function(e,t){const n=new Set,o=new Set,r=Array.from(t);for(let t=r.pop();t;t=r.pop()){var a;n.add(t),o.add(t);const s=null!==(a=e.nodeToNodeSubscriptions.get(t))&&void 0!==a?a:U;for(const e of s)o.has(e)||r.push(e)}return n}(r,t);for(const t of a){var s;(null!==(s=r.nodeToComponentSubscriptions.get(t))&&void 0!==s?s:[]).forEach(([t,o])=>{"enqueue"===n?e.getState().queuedComponentCallbacks.push(o):o(r)})}A.trace("value became available, waking components",Array.from(t).join(", "),()=>{const t=e.getState().suspendedComponentResolvers;t.forEach(e=>e()),t.clear()})},detectCircularDependencies:function e(t,n){if(!n.length)return;const o=n[n.length-1],r=t.nodeToNodeSubscriptions.get(o);if(!(null==r?void 0:r.size))return;const a=n[0];if(r.has(a))throw new Error("Recoil selector has circular dependencies: "+[...n,a].reverse().join(" → "));for(const o of r)e(t,[...n,o])}};const{getNodeLoadable:D,peekNodeLoadable:j,setNodeValue:I,setUnvalidatedAtomValue:z,subscribeComponentToNode:P}=O,{RecoilValue:q,AbstractRecoilValue:F,RecoilValueReadOnly:W,RecoilState:$}=R;var G={AbstractRecoilValue:F,RecoilState:$,peekRecoilValueAsLoadable:function(e,{key:t}){const n=e.getState().currentTree;return j(e,n,t)},getRecoilValueAsLoadable:function(e,{key:t}){let n;return A.trace("get RecoilValue",t,()=>e.replaceState(A.wrap(o=>{const[r,a]=D(e,o,t);return n=a,r}))),n},setRecoilValue:function(e,{key:t},n){A.trace("set RecoilValue",t,()=>e.replaceState(A.wrap(o=>{const[r,a]=I(e,o,t,n);return e.fireNodeSubscriptions(a,"enqueue"),r})))},setUnvalidatedRecoilValue:function(e,{key:t},n){A.trace("set unvalidated persisted atom",t,()=>e.replaceState(A.wrap(o=>{const r=z(o,t,n);return e.fireNodeSubscriptions(new Set([t]),"enqueue"),r})))},subscribeToRecoilValue:function(e,{key:t},n){let o,r;return A.trace("subscribe component to RecoilValue",t,()=>e.replaceState(A.wrap(e=>([o,r]=P(e,t,n),o)))),{release:e=>e.replaceState(r)}},isRecoilValue:function(e){return e instanceof $||e instanceof W}};const{mapByDeletingFromMap:K,mapBySettingInMap:X,setByAddingToSet:Y}=o,{loadableWithValue:H}=f,{DEFAULT_VALUE:J,DefaultValue:Q,registerNode:Z}=T,{isRecoilValue:ee}=G;function te(e){const{default:t,...n}=e;return ee(t)||a(t)?function(e){const t=te({...e,default:J,persistence_UNSTABLE:void 0===e.persistence_UNSTABLE?void 0:{...e.persistence_UNSTABLE,validator:t=>t instanceof Q?t:u(e.persistence_UNSTABLE).validator(t,J)}});return selector({key:e.key+"__withFallback",get:({get:n})=>{const o=n(t);return o instanceof Q?e.default:o},set:({set:e},n)=>e(t,n),dangerouslyAllowMutability:e.dangerouslyAllowMutability})}({...n,default:t}):function(e){const{key:t,persistence_UNSTABLE:n}=e;return Z({key:t,options:e,get:(o,r)=>{if(r.atomValues.has(t))return[r,u(r.atomValues.get(t))];if(r.nonvalidatedAtoms.has(t)){if(null==n)return[r,H(e.default)];const o=r.nonvalidatedAtoms.get(t),a=n.validator(o,J);return a instanceof Q?[{...r,nonvalidatedAtoms:K(r.nonvalidatedAtoms,t)},H(e.default)]:[{...r,atomValues:X(r.atomValues,t,H(a)),nonvalidatedAtoms:K(r.nonvalidatedAtoms,t)},H(a)]}return[r,H(e.default)]},set:(n,o,r)=>(!0!==e.dangerouslyAllowMutability&&s(r),[{...o,dirtyAtoms:Y(o.dirtyAtoms,t),atomValues:r instanceof Q?K(o.atomValues,t):X(o.atomValues,t,H(r)),nonvalidatedAtoms:K(o.nonvalidatedAtoms,t)},new Set([t])])})}({...n,default:t})}var ne=te;var oe={enqueueExecution:function(e,t){t()}};const{useContext:re,useEffect:ae,useRef:se,useState:ue}=t,{fireNodeSubscriptions:ce,setNodeValue:ie,setUnvalidatedAtomValue:le}=O;function de(){throw new Error("This component must be used inside a <RecoilRoot> component.")}const fe=Object.freeze({getState:de,replaceState:de,subscribeToTransactions:de,addTransactionMetadata:de,fireNodeSubscriptions:de});function pe(e){null===e.nextTree&&(e.nextTree={...e.currentTree,dirtyAtoms:new Set,transactionMetadata:{}})}const Se=t.createContext({current:fe}),be=()=>re(Se);function he(e){const t=be(),[n,o]=ue([]);return e.setNotifyBatcherOfChange(()=>o({})),ae(()=>{oe.enqueueExecution("Batcher",()=>{const e=t.current.getState(),{currentTree:n,nextTree:o}=e;null!==o&&(o.dirtyAtoms.size&&e.transactionSubscriptions.forEach(e=>e(t.current,n)),e.queuedComponentCallbacks.forEach(e=>e(o)),e.queuedComponentCallbacks.splice(0,e.queuedComponentCallbacks.length),e.currentTree=o,e.nextTree=null)})}),null}function me(e,t){const n={currentTree:{isSnapshot:!1,transactionMetadata:{},atomValues:new Map,nonvalidatedAtoms:new Map,dirtyAtoms:new Set,nodeDeps:new Map,nodeToNodeSubscriptions:new Map,nodeToComponentSubscriptions:new Map},nextTree:null,transactionSubscriptions:new Map,queuedComponentCallbacks:[],suspendedComponentResolvers:new Set};return t&&t({set:(t,o)=>{n.currentTree=ie(e,n.currentTree,t.key,o)[0]},setUnvalidatedAtomValues:e=>{e.forEach((e,t)=>{n.currentTree=le(n.currentTree,t,e)})}}),n}let Re=0;var ve={useStoreRef:be,RecoilRoot:function({initializeState:e,children:n}){let o;const r=se(null),a={getState:()=>o.current,replaceState:e=>{const t=s.current.getState();pe(t);const n=u(t.nextTree),o=e(n);o!==n&&(t.nextTree=o,u(r.current)())},subscribeToTransactions:e=>{const t=Re++;return s.current.getState().transactionSubscriptions.set(t,e),{release:()=>{s.current.getState().transactionSubscriptions.delete(t)}}},addTransactionMetadata:e=>{pe(s.current.getState());for(const t of Object.keys(e))u(s.current.getState().nextTree).transactionMetadata[t]=e[t]},fireNodeSubscriptions:function(e,t){ce(s.current,e,t)}},s=se(a);return o=se(me(a,e)),t.createElement(Se.Provider,{value:s},t.createElement(he,{setNotifyBatcherOfChange:function(e){r.current=e}}),n)}};var ge=function(e,...t){const n=new Set;e:for(const o of e){for(const e of t)if(e.has(o))continue e;n.add(o)}return n};var ye=function(e,t){const n=new Map;for(const[o,r]of e)t(r,o)&&n.set(o,r);return n};var we=function(e,...t){const n=new Set;e:for(const o of e){for(const e of t)if(!e.has(o))continue e;n.add(o)}return n};var Ve=function(e,t){if(!e)throw new Error(t)};var Te=function(e,t){const n=new Map;return e.forEach((e,o)=>{n.set(o,t(e,o))}),n};var Ae=function(...e){const t=new Map;for(let n=0;n<e.length;n++){const o=e[n].keys();let r;for(;!(r=o.next()).done;)t.set(r.value,e[n].get(r.value))}return t};const{useCallback:Ee,useEffect:Ne,useMemo:Me,useRef:_e,useState:Le}=t,{setByAddingToSet:ke}=o,{getNodeLoadable:Ue,peekNodeLoadable:Be,setNodeValue:xe}=O,{DEFAULT_VALUE:Ce,RecoilValueNotReady:Oe,getNode:De,nodes:je}=T,{useStoreRef:Ie}=ve,{AbstractRecoilValue:ze,getRecoilValueAsLoadable:Pe,setRecoilValue:qe,setUnvalidatedRecoilValue:Fe,subscribeToRecoilValue:We}=G;function $e(e,t){return{isSnapshot:t.isSnapshot,transactionMetadata:{...e.transactionMetadata},atomValues:new Map(e.atomValues),nonvalidatedAtoms:new Map(e.nonvalidatedAtoms),dirtyAtoms:new Set(e.dirtyAtoms),nodeDeps:new Map(e.nodeDeps),nodeToNodeSubscriptions:Te(e.nodeToNodeSubscriptions,e=>new Set(e)),nodeToComponentSubscriptions:Te(e.nodeToComponentSubscriptions,e=>new Map(e))}}function Ge(e,t,n,o){if("function"==typeof o){const r=Be(e,t,n.key);if("loading"===r.state)throw new Oe(n.key);if("hasError"===r.state)throw r.contents;return o(r.contents)}return o}function Ke(){const e=Ie(),[t,n]=Le([]),o=_e(new Set);o.current=new Set;const r=_e(new Set),a=_e(new Map),s=Ee(t=>{const n=a.current.get(t);n&&(n.release(e.current),a.current.delete(t))},[e,a]);return Ne(()=>{const t=e.current;function u(e,t){a.current.has(t)&&n([])}ge(o.current,r.current).forEach(e=>{if(a.current.has(e))return;const n=We(t,new ze(e),t=>{A.trace("RecoilValue subscription fired",e,()=>{u(0,e)})});a.current.set(e,n),A.trace("initial update on subscribing",e,()=>{u(t.getState(),e)})}),ge(r.current,o.current).forEach(e=>{s(e)}),r.current=o.current}),Ne(()=>{const e=a.current;return()=>e.forEach((e,t)=>s(t))},[s]),Me(()=>{function t(t){return n=>{var o;const r=e.current.getState(),a=Ge(e.current,null!==(o=r.nextTree)&&void 0!==o?o:r.currentTree,t,n);qe(e.current,t,a)}}function n(t){return o.current.has(t.key)||(o.current=ke(o.current,t.key)),Pe(e.current,t)}function r(t){return function(e,t,n){if("hasValue"===e.state)return e.contents;if("loading"===e.state){throw new Promise(e=>{n.current.getState().suspendedComponentResolvers.add(e)})}throw"hasError"===e.state?e.contents:new Error(`Invalid value of loadable atom "${t.key}"`)}(n(t),t,e)}return{getRecoilValue:r,getRecoilValueLoadable:n,getRecoilState:function(e){return[r(e),t(e)]},getRecoilStateLoadable:function(e){return[n(e),t(e)]},getSetRecoilState:t,getResetRecoilState:function(t){return()=>qe(e.current,t,Ce)}}},[o,e])}function Xe(e){const t=Ie();Ne(()=>t.current.subscribeToTransactions(e).release,[e,t])}function Ye(e){const t=e.atomValues,n=Te(ye(t,(e,t)=>{var n;const o=null===(n=De(t).options)||void 0===n?void 0:n.persistence_UNSTABLE;return null!=o&&"none"!==o.type&&"hasValue"===e.state}),e=>e.contents);return Ae(e.nonvalidatedAtoms,n)}class He{}const Je=new He;var Qe={useRecoilCallback:function(e,t){const o=Ie();return Ee((...t)=>{let r=$e(o.current.getState().currentTree,{isSnapshot:!0});function a(e){let t;return[r,t]=Ue(o.current,r,e.key),t}function s(e){return a(e).toPromise()}function u(e,t){const n=Ge(o.current,r,e,t);qe(o.current,e,n)}function c(e){qe(o.current,e,Ce)}let i=Je;return n.unstable_batchedUpdates(()=>{i=e({getPromise:s,getLoadable:a,set:u,reset:c},...t)}),Ve(!(i instanceof He),"unstable_batchedUpdates should return immediately"),i},null!=t?[...t,o]:void 0)},useRecoilValue:function(e){return Ke().getRecoilValue(e)},useRecoilValueLoadable:function(e){return Ke().getRecoilValueLoadable(e)},useRecoilState:function(e){const t=Ke(),[n]=t.getRecoilState(e);return[n,Ee(t.getSetRecoilState(e),[e])]},useRecoilStateLoadable:function(e){const t=Ke(),[n]=t.getRecoilStateLoadable(e);return[n,Ee(t.getSetRecoilState(e),[e])]},useSetRecoilState:function(e){return Ee(Ke().getSetRecoilState(e),[e])},useResetRecoilState:function(e){return Ee(Ke().getResetRecoilState(e),[e])},useRecoilInterface:Ke,useTransactionSubscription:Xe,useSnapshotWithStateChange:function(e){const t=Ie();let n=function(){const[e,t]=Le(0);return Xe(Ee(()=>t(e=>e+1),[])),$e(Ie().current.getState().currentTree,{isSnapshot:!0})}();e(({key:e},o)=>{[n]=xe(t.current,n,e,Be(t.current,n,e).map(o))});const o=Te(n.atomValues,e=>e.contents),r=we(n.dirtyAtoms,new Set(o.keys()));return{atomValues:o,updatedAtoms:r}},useTransactionObservation:function(e){Xe(Ee((t,n)=>{let o=t.getState().nextTree;o||(o=t.getState().currentTree);const r=Ye(o),a=Ye(n),s=Te(je,e=>{var t,n,o,r,a,s;return{persistence_UNSTABLE:{type:null!==(t=null===(n=e.options)||void 0===n||null===(o=n.persistence_UNSTABLE)||void 0===o?void 0:o.type)&&void 0!==t?t:"none",backButton:null!==(r=null===(a=e.options)||void 0===a||null===(s=a.persistence_UNSTABLE)||void 0===s?void 0:s.backButton)&&void 0!==r&&r}}}),u=new Set(o.dirtyAtoms);e({atomValues:r,previousAtomValues:a,atomInfo:s,modifiedAtoms:u,transactionMetadata:{...o.transactionMetadata}})},[e]))},useGoToSnapshot:function(){const e=Ie();return t=>{n.unstable_batchedUpdates(()=>{t.updatedAtoms.forEach(n=>{qe(e.current,new ze(n),t.atomValues.get(n))})})}},useSetUnvalidatedAtomValues:function(){const e=Ie();return(t,o={})=>{n.unstable_batchedUpdates(()=>{e.current.addTransactionMetadata(o),t.forEach((t,n)=>Fe(e.current,new ze(n),t))})}}},Ze=Object.freeze({__proto__:null});var et=function(){return new Ze};var tt={startPerfBlock:function(e){return()=>{}}};var nt=function(e,t,n){const o=e.entries();let r=o.next();for(;!r.done;){const a=r.value;if(!t.call(n,a[1],a[0],e))return!1;r=o.next()}return!0};var ot=function(e,t){return e.size===t.size&&nt(e,e=>t.has(e))};Object.freeze(new Set);const{mapBySettingInMap:rt,mapByUpdatingInMap:at,setByAddingToSet:st,setByDeletingFromSet:ut}=o,{detectCircularDependencies:ct,getNodeLoadable:it,setNodeValue:lt}=O,{loadableWithError:dt,loadableWithPromise:ft,loadableWithValue:pt}=f,{DEFAULT_VALUE:St,RecoilValueNotReady:bt,registerNode:ht}=T,{startPerfBlock:mt}=tt,{isRecoilValue:Rt}=G,vt=Object.freeze(new Set);function gt(e){const t=[];for(const n of Array.from(e.keys()).sort()){const o=u(e.get(n));t.push(n),t.push(o.contents)}return t}var yt=function(e){const{key:t,get:n,cacheImplementation_UNSTABLE:o}=e,r=null!=e.set?e.set:void 0;let u=null!=o?o:et();function c(o,r){var i;let l=r;const d=null!==(i=r.nodeDeps.get(t))&&void 0!==i?i:vt,f=gt(new Map(Array.from(d).sort().map(e=>{const[t,n]=it(o,l,e);return l=t,[e,n]}))),p=u.get(f);if(null!=p)return[l,p];const[S,b,h]=function(e,o){var r;const[s,u,i]=function(e,o){const r=mt(t);let s=o;const u=new Map;function i({key:t}){let n;if([s,n]=it(e,o,t),u.set(t,n),"hasValue"===n.state)return n.contents;throw n.contents}try{const e=n({get:i}),t=Rt(e)?i(e):e,o=a(t)?ft(t.finally(r)):(r(),pt(t));return[s,o,u]}catch(t){const n=a(t)?ft(t.then(()=>{let t=dt(new Error("Internal Recoil Selector Error"));if(e.replaceState(n=>{let o;return[o,t]=c(e,n),o}),"hasError"===t.state)throw t.contents;return t.contents}).finally(r)):(r(),dt(t));return[s,n,u]}}(e,o);let l=s;const d=null!==(r=o.nodeDeps.get(t))&&void 0!==r?r:vt,f=new Set(i.keys());l=ot(d,f)?l:{...l,nodeDeps:rt(l.nodeDeps,t,f)};const p=ge(f,d),S=ge(d,f);for(const e of p)l={...l,nodeToNodeSubscriptions:at(l.nodeToNodeSubscriptions,e,e=>st(null!=e?e:vt,t))};for(const e of S)l={...l,nodeToNodeSubscriptions:at(l.nodeToNodeSubscriptions,e,e=>ut(null!=e?e:vt,t))};return[l,u,i]}(o,l);l=S;const m=gt(h);return function(n,o,r){"loading"!==r.state?!0==!e.dangerouslyAllowMutability&&s(r.contents):r.contents.then(r=>(!0==!e.dangerouslyAllowMutability&&s(r),u=u.set(o,pt(r)),n.fireNodeSubscriptions(new Set([t]),"now"),r)).catch(r=>(a(r)||(!0==!e.dangerouslyAllowMutability&&s(r),u=u.set(o,dt(r)),n.fireNodeSubscriptions(new Set([t]),"now")),r)),u=u.set(o,r)}(o,m,b),[l,b]}function i(e,t){return c(e,t)}if(null!=r){return ht({key:t,options:e,get:i,set:function(e,t,n){let o=t;const a=new Set;function s({key:t}){const[n,r]=it(e,o,t);if(o=n,"hasValue"===r.state)return r.contents;throw"loading"===r.state?new bt(t):r.contents}function u(t,n){const r="function"==typeof n?n(s(t)):n;let u;[o,u]=lt(e,o,t.key,r),u.forEach(e=>a.add(e))}return r({set:u,get:s,reset:function(e){u(e,St)}},n),[o,a]}})}return ht({key:t,options:e,get:i})};const{useRecoilCallback:wt,useRecoilState:Vt,useRecoilStateLoadable:Tt,useRecoilValue:At,useRecoilValueLoadable:Et,useResetRecoilState:Nt,useSetRecoilState:Mt,useSetUnvalidatedAtomValues:_t,useTransactionObservation:Lt,useTransactionSubscription:kt}=Qe,{DefaultValue:Ut}=T,{RecoilRoot:Bt}=ve,{isRecoilValue:xt}=G;var Ct={DefaultValue:Ut,RecoilRoot:Bt,atom:ne,selector:yt,useRecoilValue:At,useRecoilValueLoadable:Et,useRecoilState:Vt,useRecoilStateLoadable:Tt,useSetRecoilState:Mt,useResetRecoilState:Nt,useRecoilCallback:wt,useTransactionObservation_UNSTABLE:Lt,useTransactionSubscription_UNSTABLE:kt,useSetUnvalidatedAtomValues_UNSTABLE:_t,isRecoilValue:xt},Ot=Ct.DefaultValue,Dt=Ct.RecoilRoot,jt=Ct.atom,It=Ct.selector,zt=Ct.useRecoilValue,Pt=Ct.useRecoilValueLoadable,qt=Ct.useRecoilState,Ft=Ct.useRecoilStateLoadable,Wt=Ct.useSetRecoilState,$t=Ct.useResetRecoilState,Gt=Ct.useRecoilCallback,Kt=Ct.useTransactionObservation_UNSTABLE,Xt=Ct.useTransactionSubscription_UNSTABLE,Yt=Ct.useSetUnvalidatedAtomValues_UNSTABLE,Ht=Ct.isRecoilValue;exports.DefaultValue=Ot,exports.RecoilRoot=Dt,exports.atom=jt,exports.default=Ct,exports.isRecoilValue=Ht,exports.selector=It,exports.useRecoilCallback=Gt,exports.useRecoilState=qt,exports.useRecoilStateLoadable=Ft,exports.useRecoilValue=zt,exports.useRecoilValueLoadable=Pt,exports.useResetRecoilState=$t,exports.useSetRecoilState=Wt,exports.useSetUnvalidatedAtomValues_UNSTABLE=Yt,exports.useTransactionObservation_UNSTABLE=Kt,exports.useTransactionSubscription_UNSTABLE=Xt;
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("react")),n=e(require("react-dom"));var o={setByAddingToSet:function(e,t){const n=new Set(e);return n.add(t),n},setByDeletingFromSet:function(e,t){const n=new Set(e);return n.delete(t),n},mapBySettingInMap:function(e,t,n){const o=new Map(e);return o.set(t,n),o},mapByUpdatingInMap:function(e,t,n){const o=new Map(e);return o.set(t,n(o.get(t))),o},mapByDeletingFromMap:function(e,t){const n=new Map(e);return n.delete(t),n}};var r=function(e){var t,n;const o=null!==(n=(null!=e?null!==(t=e.ownerDocument)&&void 0!==t?t:e:document).defaultView)&&void 0!==n?n:window;return!(null==e||!("function"==typeof o.Node?e instanceof o.Node:"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName))};var a=function(e){return!!e&&"function"==typeof e.then};var s=function e(t){if("object"==typeof t&&!function(e){if(null===e||"object"!=typeof e)return!0;switch(typeof e.$$typeof){case"symbol":case"number":return!0}return null!=e["@@__IMMUTABLE_ITERABLE__@@"]||null!=e["@@__IMMUTABLE_KEYED__@@"]||null!=e["@@__IMMUTABLE_INDEXED__@@"]||null!=e["@@__IMMUTABLE_ORDERED__@@"]||null!=e["@@__IMMUTABLE_RECORD__@@"]||(!!r(e)||!!a(e))}(t)){Object.freeze(t);for(const n in t)t.hasOwnProperty(n)&&e(t[n]);Object.seal(t)}};var u=function(e,t){if(null!=e)return e;throw new Error(null!=t?t:"Got unexpected null or undefined")};const i={getValue(){if("hasValue"!==this.state)throw this.contents;return this.contents},toPromise(){return"hasValue"===this.state?Promise.resolve(this.contents):"hasError"===this.state?Promise.reject(this.contents):this.contents},valueMaybe(){return"hasValue"===this.state?this.contents:void 0},valueOrThrow(){if("hasValue"!==this.state)throw new Error(`Loadable expected value, but in "${this.state}" state`);return this.contents},errorMaybe(){return"hasError"===this.state?this.contents:void 0},errorOrThrow(){if("hasError"!==this.state)throw new Error(`Loadable expected error, but in "${this.state}" state`);return this.contents},promiseMaybe(){return"loading"===this.state?this.contents:void 0},promiseOrThrow(){if("loading"!==this.state)throw new Error(`Loadable expected promise, but in "${this.state}" state`);return this.contents},map(e){if("hasError"===this.state)return this;if("hasValue"===this.state)try{const t=e(this.contents);return a(t)?d(t):c(t)}catch(t){return a(t)?d(t.next(()=>e(this.contents))):l(t)}if("loading"===this.state)return d(this.contents.then(e).catch(t=>{if(a(t))return t.then(()=>e(this.contents));throw t}));throw new Error("Invalid Loadable state")}};function c(e){return Object.freeze({state:"hasValue",contents:e,...i})}function l(e){return Object.freeze({state:"hasError",contents:e,...i})}function d(e){return Object.freeze({state:"loading",contents:e,...i})}var f={loadableWithValue:c,loadableWithError:l,loadableWithPromise:d,loadableLoading:function(){return d(new Promise(()=>{}))},loadableAll:function(e){return e.every(e=>"hasValue"===e.state)?c(e.map(e=>e.contents)):e.some(e=>"hasError"===e.state)?l(u(e.find(e=>"hasError"===e.state),"Invalid loadable passed to loadableAll").contents):d(Promise.all(e.map(e=>e.contents)))}};class p{constructor(e){var t,n,o;o=void 0,(n="key")in(t=this)?Object.defineProperty(t,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[n]=o,this.key=e}}var S={AbstractRecoilValue:p,RecoilState:class extends p{},RecoilValueReadOnly:class extends p{}},b=S.AbstractRecoilValue,h=S.RecoilState,m=S.RecoilValueReadOnly,R=Object.freeze({__proto__:null,AbstractRecoilValue:b,RecoilState:h,RecoilValueReadOnly:m});class v{}const y=new v;class g extends Error{constructor(e){super(`Tried to set the value of Recoil selector ${e} using an updater function, but it is an async selector in a pending or error state; this is not supported.`)}}const w=new Map;class V extends Error{}var T={nodes:w,registerNode:function(e){if(w.has(e.key)){e.key}return w.set(e.key,e),null==e.set?new R.RecoilValueReadOnly(e.key):new R.RecoilState(e.key)},getNode:function(e){const t=w.get(e);if(null==t)throw new V(`Missing definition for RecoilValue: "${e}""`);return t},NodeMissingError:V,DefaultValue:v,DEFAULT_VALUE:y,RecoilValueNotReady:g};var A={trace:function(e,t,n){return n()},wrap:function(e){return e}};const{mapByDeletingFromMap:E,mapBySettingInMap:M,mapByUpdatingInMap:N,setByAddingToSet:_}=o,{getNode:L}=T,k=Object.freeze(new Map),B=Object.freeze(new Set);class U extends Error{}function x(e,t,n){return L(n).get(e,t)}let C=0;var O={getNodeLoadable:x,peekNodeLoadable:function(e,t,n){return x(e,t,n)[1]},setNodeValue:function(e,t,n,o){const r=L(n);if(null==r.set)throw new U("Attempt to set read-only RecoilValue: "+n);const[a,s]=r.set(e,t,o);return[a,s]},setUnvalidatedAtomValue:function(e,t,n){return{...e,atomValues:E(e.atomValues,t),nonvalidatedAtoms:M(e.nonvalidatedAtoms,t,n),dirtyAtoms:_(e.dirtyAtoms,t)}},subscribeComponentToNode:function(e,t,n){const o=C++;return[{...e,nodeToComponentSubscriptions:N(e.nodeToComponentSubscriptions,t,e=>M(null!=e?e:k,o,["TODO debug name",n]))},function(e){return{...e,nodeToComponentSubscriptions:N(e.nodeToComponentSubscriptions,t,e=>E(null!=e?e:k,o))}}]},fireNodeSubscriptions:function(e,t,n){var o;const r="enqueue"===n&&null!==(o=e.getState().nextTree)&&void 0!==o?o:e.getState().currentTree,a=function(e,t){const n=new Set,o=new Set,r=Array.from(t);for(let t=r.pop();t;t=r.pop()){var a;n.add(t),o.add(t);const s=null!==(a=e.nodeToNodeSubscriptions.get(t))&&void 0!==a?a:B;for(const e of s)o.has(e)||r.push(e)}return n}(r,t);for(const t of a){var s;(null!==(s=r.nodeToComponentSubscriptions.get(t))&&void 0!==s?s:[]).forEach(([t,o])=>{"enqueue"===n?e.getState().queuedComponentCallbacks.push(o):o(r)})}A.trace("value became available, waking components",Array.from(t).join(", "),()=>{const t=e.getState().suspendedComponentResolvers;t.forEach(e=>e()),t.clear()})},detectCircularDependencies:function e(t,n){if(!n.length)return;const o=n[n.length-1],r=t.nodeToNodeSubscriptions.get(o);if(!(null==r?void 0:r.size))return;const a=n[0];if(r.has(a))throw new Error("Recoil selector has circular dependencies: "+[...n,a].reverse().join(" → "));for(const o of r)e(t,[...n,o])}};const{getNodeLoadable:D,peekNodeLoadable:I,setNodeValue:j,setUnvalidatedAtomValue:P,subscribeComponentToNode:z}=O,{RecoilValue:q,AbstractRecoilValue:F,RecoilValueReadOnly:W,RecoilState:$}=R;var G={AbstractRecoilValue:F,RecoilState:$,peekRecoilValueAsLoadable:function(e,{key:t}){const n=e.getState().currentTree;return I(e,n,t)},getRecoilValueAsLoadable:function(e,{key:t}){let n;return A.trace("get RecoilValue",t,()=>e.replaceState(A.wrap(o=>{const[r,a]=D(e,o,t);return n=a,r}))),n},setRecoilValue:function(e,{key:t},n){A.trace("set RecoilValue",t,()=>e.replaceState(A.wrap(o=>{const[r,a]=j(e,o,t,n);return e.fireNodeSubscriptions(a,"enqueue"),r})))},setUnvalidatedRecoilValue:function(e,{key:t},n){A.trace("set unvalidated persisted atom",t,()=>e.replaceState(A.wrap(o=>{const r=P(o,t,n);return e.fireNodeSubscriptions(new Set([t]),"enqueue"),r})))},subscribeToRecoilValue:function(e,{key:t},n){let o,r;return A.trace("subscribe component to RecoilValue",t,()=>e.replaceState(A.wrap(e=>([o,r]=z(e,t,n),o)))),{release:e=>e.replaceState(r)}},isRecoilValue:function(e){return e instanceof $||e instanceof W}};const{mapByDeletingFromMap:K,mapBySettingInMap:X,setByAddingToSet:Y}=o,{loadableWithValue:H}=f,{DEFAULT_VALUE:J,DefaultValue:Q,registerNode:Z}=T,{isRecoilValue:ee}=G;function te(e){const{default:t,...n}=e;return ee(t)||a(t)?function(e){const t=te({...e,default:J,persistence_UNSTABLE:void 0===e.persistence_UNSTABLE?void 0:{...e.persistence_UNSTABLE,validator:t=>t instanceof Q?t:u(e.persistence_UNSTABLE).validator(t,J)}});return selector({key:e.key+"__withFallback",get:({get:n})=>{const o=n(t);return o instanceof Q?e.default:o},set:({set:e},n)=>e(t,n),dangerouslyAllowMutability:e.dangerouslyAllowMutability})}({...n,default:t}):function(e){const{key:t,persistence_UNSTABLE:n}=e;return Z({key:t,options:e,get:(o,r)=>{if(r.atomValues.has(t))return[r,u(r.atomValues.get(t))];if(r.nonvalidatedAtoms.has(t)){if(null==n)return[r,H(e.default)];const o=r.nonvalidatedAtoms.get(t),a=n.validator(o,J);return a instanceof Q?[{...r,nonvalidatedAtoms:K(r.nonvalidatedAtoms,t)},H(e.default)]:[{...r,atomValues:X(r.atomValues,t,H(a)),nonvalidatedAtoms:K(r.nonvalidatedAtoms,t)},H(a)]}return[r,H(e.default)]},set:(n,o,r)=>(!0!==e.dangerouslyAllowMutability&&s(r),[{...o,dirtyAtoms:Y(o.dirtyAtoms,t),atomValues:r instanceof Q?K(o.atomValues,t):X(o.atomValues,t,H(r)),nonvalidatedAtoms:K(o.nonvalidatedAtoms,t)},new Set([t])])})}({...n,default:t})}var ne=te;var oe={enqueueExecution:function(e,t){t()}};const{useContext:re,useEffect:ae,useRef:se,useState:ue}=t,{fireNodeSubscriptions:ie,setNodeValue:ce,setUnvalidatedAtomValue:le}=O;function de(){throw new Error("This component must be used inside a <RecoilRoot> component.")}const fe=Object.freeze({getState:de,replaceState:de,subscribeToTransactions:de,addTransactionMetadata:de,fireNodeSubscriptions:de});function pe(e){null===e.nextTree&&(e.nextTree={...e.currentTree,dirtyAtoms:new Set,transactionMetadata:{}})}const Se=t.createContext({current:fe}),be=()=>re(Se);function he(e){const t=be(),[n,o]=ue([]);return e.setNotifyBatcherOfChange(()=>o({})),ae(()=>{oe.enqueueExecution("Batcher",()=>{const e=t.current.getState(),{currentTree:n,nextTree:o}=e;null!==o&&(o.dirtyAtoms.size&&e.transactionSubscriptions.forEach(e=>e(t.current,n)),e.queuedComponentCallbacks.forEach(e=>e(o)),e.queuedComponentCallbacks.splice(0,e.queuedComponentCallbacks.length),e.currentTree=o,e.nextTree=null)})}),null}function me(e,t){const n={currentTree:{isSnapshot:!1,transactionMetadata:{},atomValues:new Map,nonvalidatedAtoms:new Map,dirtyAtoms:new Set,nodeDeps:new Map,nodeToNodeSubscriptions:new Map,nodeToComponentSubscriptions:new Map},nextTree:null,transactionSubscriptions:new Map,queuedComponentCallbacks:[],suspendedComponentResolvers:new Set};return t&&t({set:(t,o)=>{n.currentTree=ce(e,n.currentTree,t.key,o)[0]},setUnvalidatedAtomValues:e=>{e.forEach((e,t)=>{n.currentTree=le(n.currentTree,t,e)})}}),n}let Re=0;var ve={useStoreRef:be,RecoilRoot:function({initializeState:e,children:n}){let o;const r=se(null),a={getState:()=>o.current,replaceState:e=>{const t=s.current.getState();pe(t);const n=u(t.nextTree),o=e(n);o!==n&&(t.nextTree=o,u(r.current)())},subscribeToTransactions:e=>{const t=Re++;return s.current.getState().transactionSubscriptions.set(t,e),{release:()=>{s.current.getState().transactionSubscriptions.delete(t)}}},addTransactionMetadata:e=>{pe(s.current.getState());for(const t of Object.keys(e))u(s.current.getState().nextTree).transactionMetadata[t]=e[t]},fireNodeSubscriptions:function(e,t){ie(s.current,e,t)}},s=se(a);return o=se(me(a,e)),t.createElement(Se.Provider,{value:s},t.createElement(he,{setNotifyBatcherOfChange:function(e){r.current=e}}),n)}};var ye=function(e,...t){const n=new Set;e:for(const o of e){for(const e of t)if(e.has(o))continue e;n.add(o)}return n};var ge=function(e,t){const n=new Map;for(const[o,r]of e)t(r,o)&&n.set(o,r);return n};var we=function(e,...t){const n=new Set;e:for(const o of e){for(const e of t)if(!e.has(o))continue e;n.add(o)}return n};var Ve=function(e,t){if(!e)throw new Error(t)};var Te=function(e,t){const n=new Map;return e.forEach((e,o)=>{n.set(o,t(e,o))}),n};var Ae=function(...e){const t=new Map;for(let n=0;n<e.length;n++){const o=e[n].keys();let r;for(;!(r=o.next()).done;)t.set(r.value,e[n].get(r.value))}return t};const{useCallback:Ee,useEffect:Me,useMemo:Ne,useRef:_e,useState:Le}=t,{setByAddingToSet:ke}=o,{getNodeLoadable:Be,peekNodeLoadable:Ue,setNodeValue:xe}=O,{DEFAULT_VALUE:Ce,RecoilValueNotReady:Oe,getNode:De,nodes:Ie}=T,{useStoreRef:je}=ve,{AbstractRecoilValue:Pe,getRecoilValueAsLoadable:ze,setRecoilValue:qe,setUnvalidatedRecoilValue:Fe,subscribeToRecoilValue:We}=G;function $e(e,t){return{isSnapshot:t.isSnapshot,transactionMetadata:{...e.transactionMetadata},atomValues:new Map(e.atomValues),nonvalidatedAtoms:new Map(e.nonvalidatedAtoms),dirtyAtoms:new Set(e.dirtyAtoms),nodeDeps:new Map(e.nodeDeps),nodeToNodeSubscriptions:Te(e.nodeToNodeSubscriptions,e=>new Set(e)),nodeToComponentSubscriptions:Te(e.nodeToComponentSubscriptions,e=>new Map(e))}}function Ge(e,t,n,o){if("function"==typeof o){const r=Ue(e,t,n.key);if("loading"===r.state)throw new Oe(n.key);if("hasError"===r.state)throw r.contents;return o(r.contents)}return o}function Ke(){const e=je(),[t,n]=Le([]),o=_e(new Set);o.current=new Set;const r=_e(new Set),a=_e(new Map),s=Ee(t=>{const n=a.current.get(t);n&&(n.release(e.current),a.current.delete(t))},[e,a]);return Me(()=>{const t=e.current;function u(e,t){a.current.has(t)&&n([])}ye(o.current,r.current).forEach(e=>{if(a.current.has(e))return;const n=We(t,new Pe(e),t=>{A.trace("RecoilValue subscription fired",e,()=>{u(0,e)})});a.current.set(e,n),A.trace("initial update on subscribing",e,()=>{u(t.getState(),e)})}),ye(r.current,o.current).forEach(e=>{s(e)}),r.current=o.current}),Me(()=>{const e=a.current;return()=>e.forEach((e,t)=>s(t))},[s]),Ne(()=>{function t(t){return n=>{var o;const r=e.current.getState(),a=Ge(e.current,null!==(o=r.nextTree)&&void 0!==o?o:r.currentTree,t,n);qe(e.current,t,a)}}function n(t){return o.current.has(t.key)||(o.current=ke(o.current,t.key)),ze(e.current,t)}function r(t){return function(e,t,n){if("hasValue"===e.state)return e.contents;if("loading"===e.state){throw new Promise(e=>{n.current.getState().suspendedComponentResolvers.add(e)})}throw"hasError"===e.state?e.contents:new Error(`Invalid value of loadable atom "${t.key}"`)}(n(t),t,e)}return{getRecoilValue:r,getRecoilValueLoadable:n,getRecoilState:function(e){return[r(e),t(e)]},getRecoilStateLoadable:function(e){return[n(e),t(e)]},getSetRecoilState:t,getResetRecoilState:function(t){return()=>qe(e.current,t,Ce)}}},[o,e])}function Xe(e){const t=je();Me(()=>t.current.subscribeToTransactions(e).release,[e,t])}function Ye(e){const t=e.atomValues,n=Te(ge(t,(e,t)=>{var n;const o=null===(n=De(t).options)||void 0===n?void 0:n.persistence_UNSTABLE;return null!=o&&"none"!==o.type&&"hasValue"===e.state}),e=>e.contents);return Ae(e.nonvalidatedAtoms,n)}class He{}const Je=new He;var Qe={useRecoilCallback:function(e,t){const o=je();return Ee((...t)=>{let r=$e(o.current.getState().currentTree,{isSnapshot:!0});function a(e){let t;return[r,t]=Be(o.current,r,e.key),t}function s(e){return a(e).toPromise()}function u(e,t){const n=Ge(o.current,r,e,t);qe(o.current,e,n)}function i(e){qe(o.current,e,Ce)}let c=Je;return n.unstable_batchedUpdates(()=>{c=e({getPromise:s,getLoadable:a,set:u,reset:i},...t)}),Ve(!(c instanceof He),"unstable_batchedUpdates should return immediately"),c},null!=t?[...t,o]:void 0)},useRecoilValue:function(e){return Ke().getRecoilValue(e)},useRecoilValueLoadable:function(e){return Ke().getRecoilValueLoadable(e)},useRecoilState:function(e){const t=Ke(),[n]=t.getRecoilState(e);return[n,Ee(t.getSetRecoilState(e),[e])]},useRecoilStateLoadable:function(e){const t=Ke(),[n]=t.getRecoilStateLoadable(e);return[n,Ee(t.getSetRecoilState(e),[e])]},useSetRecoilState:function(e){return Ee(Ke().getSetRecoilState(e),[e])},useResetRecoilState:function(e){return Ee(Ke().getResetRecoilState(e),[e])},useRecoilInterface:Ke,useTransactionSubscription:Xe,useSnapshotWithStateChange:function(e){const t=je();let n=function(){const[e,t]=Le(0);return Xe(Ee(()=>t(e=>e+1),[])),$e(je().current.getState().currentTree,{isSnapshot:!0})}();e(({key:e},o)=>{[n]=xe(t.current,n,e,Ue(t.current,n,e).map(o))});const o=Te(n.atomValues,e=>e.contents),r=we(n.dirtyAtoms,new Set(o.keys()));return{atomValues:o,updatedAtoms:r}},useTransactionObservation:function(e){Xe(Ee((t,n)=>{let o=t.getState().nextTree;o||(o=t.getState().currentTree);const r=Ye(o),a=Ye(n),s=Te(Ie,e=>{var t,n,o,r,a,s;return{persistence_UNSTABLE:{type:null!==(t=null===(n=e.options)||void 0===n||null===(o=n.persistence_UNSTABLE)||void 0===o?void 0:o.type)&&void 0!==t?t:"none",backButton:null!==(r=null===(a=e.options)||void 0===a||null===(s=a.persistence_UNSTABLE)||void 0===s?void 0:s.backButton)&&void 0!==r&&r}}}),u=new Set(o.dirtyAtoms);e({atomValues:r,previousAtomValues:a,atomInfo:s,modifiedAtoms:u,transactionMetadata:{...o.transactionMetadata}})},[e]))},useGoToSnapshot:function(){const e=je();return t=>{n.unstable_batchedUpdates(()=>{t.updatedAtoms.forEach(n=>{qe(e.current,new Pe(n),t.atomValues.get(n))})})}},useSetUnvalidatedAtomValues:function(){const e=je();return(t,o={})=>{n.unstable_batchedUpdates(()=>{e.current.addTransactionMetadata(o),t.forEach((t,n)=>Fe(e.current,new Pe(n),t))})}}};const Ze=Symbol("ArrayKeyedMap"),et=new Map;class tt{constructor(e){if(this._base=new Map,e instanceof tt)for(const[t,n]of e.entries())this.set(t,n);else if(e)for(const[t,n]of e)this.set(t,n);return this}get(e){const t=Array.isArray(e)?e:[e];let n=this._base;return t.forEach(e=>{var t;n=null!==(t=n.get(e))&&void 0!==t?t:et}),void 0===n?void 0:n.get(Ze)}set(e,t){const n=Array.isArray(e)?e:[e];let o=this._base,r=o;return n.forEach(e=>{r=o.get(e),r||(r=new Map,o.set(e,r)),o=r}),r.set(Ze,t),this}delete(e){const t=Array.isArray(e)?e:[e];let n=this._base,o=n;return t.forEach(e=>{o=n.get(e),o||(o=new Map,n.set(e,o)),n=o}),o.delete(Ze),this}entries(){const e=[];return function t(n,o){n.forEach((n,r)=>{r===Ze?e.push([o,n]):t(n,o.concat(r))})}(this._base,[]),e.values()}toBuiltInMap(){return new Map(this.entries())}}var nt=tt;var ot=function(){return new nt};var rt={startPerfBlock:function(e){return()=>{}}};var at=function(e,t,n){const o=e.entries();let r=o.next();for(;!r.done;){const a=r.value;if(!t.call(n,a[1],a[0],e))return!1;r=o.next()}return!0};var st=function(e,t){return e.size===t.size&&at(e,e=>t.has(e))};Object.freeze(new Set);const{mapBySettingInMap:ut,mapByUpdatingInMap:it,setByAddingToSet:ct,setByDeletingFromSet:lt}=o,{detectCircularDependencies:dt,getNodeLoadable:ft,setNodeValue:pt}=O,{loadableWithError:St,loadableWithPromise:bt,loadableWithValue:ht}=f,{DEFAULT_VALUE:mt,RecoilValueNotReady:Rt,registerNode:vt}=T,{startPerfBlock:yt}=rt,{isRecoilValue:gt}=G,wt=Object.freeze(new Set);function Vt(e){const t=[];for(const n of Array.from(e.keys()).sort()){const o=u(e.get(n));t.push(n),t.push(o.contents)}return t}var Tt=function(e){const{key:t,get:n,cacheImplementation_UNSTABLE:o}=e,r=null!=e.set?e.set:void 0;let u=null!=o?o:ot();function i(o,r){var c;let l=r;const d=null!==(c=r.nodeDeps.get(t))&&void 0!==c?c:wt,f=Vt(new Map(Array.from(d).sort().map(e=>{const[t,n]=ft(o,l,e);return l=t,[e,n]}))),p=u.get(f);if(null!=p)return[l,p];const[S,b,h]=function(e,o){var r;const[s,u,c]=function(e,o){const r=yt(t);let s=o;const u=new Map;function c({key:t}){let n;if([s,n]=ft(e,o,t),u.set(t,n),"hasValue"===n.state)return n.contents;throw n.contents}try{const e=n({get:c}),t=gt(e)?c(e):e,o=a(t)?bt(t.finally(r)):(r(),ht(t));return[s,o,u]}catch(t){const n=a(t)?bt(t.then(()=>{let t=St(new Error("Internal Recoil Selector Error"));if(e.replaceState(n=>{let o;return[o,t]=i(e,n),o}),"hasError"===t.state)throw t.contents;return t.contents}).finally(r)):(r(),St(t));return[s,n,u]}}(e,o);let l=s;const d=null!==(r=o.nodeDeps.get(t))&&void 0!==r?r:wt,f=new Set(c.keys());l=st(d,f)?l:{...l,nodeDeps:ut(l.nodeDeps,t,f)};const p=ye(f,d),S=ye(d,f);for(const e of p)l={...l,nodeToNodeSubscriptions:it(l.nodeToNodeSubscriptions,e,e=>ct(null!=e?e:wt,t))};for(const e of S)l={...l,nodeToNodeSubscriptions:it(l.nodeToNodeSubscriptions,e,e=>lt(null!=e?e:wt,t))};return[l,u,c]}(o,l);l=S;const m=Vt(h);return function(n,o,r){"loading"!==r.state?!0==!e.dangerouslyAllowMutability&&s(r.contents):r.contents.then(r=>(!0==!e.dangerouslyAllowMutability&&s(r),u=u.set(o,ht(r)),n.fireNodeSubscriptions(new Set([t]),"now"),r)).catch(r=>(a(r)||(!0==!e.dangerouslyAllowMutability&&s(r),u=u.set(o,St(r)),n.fireNodeSubscriptions(new Set([t]),"now")),r)),u=u.set(o,r)}(o,m,b),[l,b]}function c(e,t){return i(e,t)}if(null!=r){return vt({key:t,options:e,get:c,set:function(e,t,n){let o=t;const a=new Set;function s({key:t}){const[n,r]=ft(e,o,t);if(o=n,"hasValue"===r.state)return r.contents;throw"loading"===r.state?new Rt(t):r.contents}function u(t,n){const r="function"==typeof n?n(s(t)):n;let u;[o,u]=pt(e,o,t.key,r),u.forEach(e=>a.add(e))}return r({set:u,get:s,reset:function(e){u(e,mt)}},n),[o,a]}})}return vt({key:t,options:e,get:c})};const{useRecoilCallback:At,useRecoilState:Et,useRecoilStateLoadable:Mt,useRecoilValue:Nt,useRecoilValueLoadable:_t,useResetRecoilState:Lt,useSetRecoilState:kt,useSetUnvalidatedAtomValues:Bt,useTransactionObservation:Ut,useTransactionSubscription:xt}=Qe,{DefaultValue:Ct}=T,{RecoilRoot:Ot}=ve,{isRecoilValue:Dt}=G;var It={DefaultValue:Ct,RecoilRoot:Ot,atom:ne,selector:Tt,useRecoilValue:Nt,useRecoilValueLoadable:_t,useRecoilState:Et,useRecoilStateLoadable:Mt,useSetRecoilState:kt,useResetRecoilState:Lt,useRecoilCallback:At,useTransactionObservation_UNSTABLE:Ut,useTransactionSubscription_UNSTABLE:xt,useSetUnvalidatedAtomValues_UNSTABLE:Bt,isRecoilValue:Dt},jt=It.DefaultValue,Pt=It.RecoilRoot,zt=It.atom,qt=It.selector,Ft=It.useRecoilValue,Wt=It.useRecoilValueLoadable,$t=It.useRecoilState,Gt=It.useRecoilStateLoadable,Kt=It.useSetRecoilState,Xt=It.useResetRecoilState,Yt=It.useRecoilCallback,Ht=It.useTransactionObservation_UNSTABLE,Jt=It.useTransactionSubscription_UNSTABLE,Qt=It.useSetUnvalidatedAtomValues_UNSTABLE,Zt=It.isRecoilValue;exports.DefaultValue=jt,exports.RecoilRoot=Pt,exports.atom=zt,exports.default=It,exports.isRecoilValue=Zt,exports.selector=qt,exports.useRecoilCallback=Yt,exports.useRecoilState=$t,exports.useRecoilStateLoadable=Gt,exports.useRecoilValue=Ft,exports.useRecoilValueLoadable=Wt,exports.useResetRecoilState=Xt,exports.useSetRecoilState=Kt,exports.useSetUnvalidatedAtomValues_UNSTABLE=Qt,exports.useTransactionObservation_UNSTABLE=Ht,exports.useTransactionSubscription_UNSTABLE=Jt;
{
"name": "recoil",
"version": "0.0.6",
"version": "0.0.7",
"description": "Recoil - A React state management library for complex UIs",

@@ -5,0 +5,0 @@ "main": "dist/recoil.js",

@@ -1,5 +0,6 @@

#Recoil
Recoil
======
Recoil is an experimental set of utilities for state manegement with React.
Recoil is an experimental set of utilities for state manegement with React. Please see the website: http://recoiljs.org
TODO add link to website once domain is sorted
Please see the LICENSE file for the MIT license under which Recoil is provided.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc