UNPKG

traitify-widgets

Version:
2 lines 1.81 MB
/*! For license information please see standalone.js.LICENSE.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("Traitify",[],e):"object"==typeof exports?exports.Traitify=e():t.Traitify=e()}(this,(function(){return function(){var t={42889:function(t,e,r){"use strict";r.d(e,{default:function(){return AE}});var i={};r.r(i),r.d(i,{get:function(){return Oc},path:function(){return jc}});var a={};r.r(a),r.d(a,{create:function(){return Pc},get:function(){return Nc},path:function(){return Mc},skip:function(){return zc},surveys:function(){return Tc},update:function(){return qc}});var n={};r.r(n),r.d(n,{get:function(){return Rc},path:function(){return Ic},skip:function(){return Lc},version:function(){return Vc}});var o={};r.r(o),r.d(o,{get:function(){return Hc},path:function(){return Uc}});var s={};r.r(s),r.d(s,{get:function(){return Kc},path:function(){return Wc}});var l={};function c(t,e){if(null==t)return{};var r,i,a=function(t,e){if(null==t)return{};var r={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(-1!==e.indexOf(i))continue;r[i]=t[i]}return r}(t,e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);for(i=0;i<n.length;i++)r=n[i],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(a[r]=t[r])}return a}r.r(l),r.d(l,{feedbackSurvey:function(){return Gc},path:function(){return Qc},recommendation:function(){return $c},skipRecommendation:function(){return Yc}});var u=r(62688),f=r.n(u),p=r(63696),d=r(78325),m=function(t){const e=new Error(t);if(void 0===e.stack)try{throw e}catch(t){}return e},y=function(t){return!!t&&"function"==typeof t.then},v=function(t,e){if(null!=t)return t;throw m(null!=e?e:"Got unexpected null or undefined")};function h(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}class g{getValue(){throw m("BaseLoadable")}toPromise(){throw m("BaseLoadable")}valueMaybe(){throw m("BaseLoadable")}valueOrThrow(){throw m(`Loadable expected value, but in "${this.state}" state`)}promiseMaybe(){throw m("BaseLoadable")}promiseOrThrow(){throw m(`Loadable expected promise, but in "${this.state}" state`)}errorMaybe(){throw m("BaseLoadable")}errorOrThrow(){throw m(`Loadable expected error, but in "${this.state}" state`)}is(t){return t.state===this.state&&t.contents===this.contents}map(t){throw m("BaseLoadable")}}class b extends g{constructor(t){super(),h(this,"state","hasValue"),h(this,"contents",void 0),this.contents=t}getValue(){return this.contents}toPromise(){return Promise.resolve(this.contents)}valueMaybe(){return this.contents}valueOrThrow(){return this.contents}promiseMaybe(){}errorMaybe(){}map(t){try{const e=t(this.contents);return y(e)?F(e):D(e)?e:x(e)}catch(e){return y(e)?F(e.next((()=>this.map(t)))):w(e)}}}class k extends g{constructor(t){super(),h(this,"state","hasError"),h(this,"contents",void 0),this.contents=t}getValue(){throw this.contents}toPromise(){return Promise.reject(this.contents)}valueMaybe(){}promiseMaybe(){}errorMaybe(){return this.contents}errorOrThrow(){return this.contents}map(t){return this}}class _ extends g{constructor(t){super(),h(this,"state","loading"),h(this,"contents",void 0),this.contents=t}getValue(){throw this.contents}toPromise(){return this.contents}valueMaybe(){}promiseMaybe(){return this.contents}promiseOrThrow(){return this.contents}errorMaybe(){}map(t){return F(this.contents.then((e=>{const r=t(e);if(D(r)){const t=r;switch(t.state){case"hasValue":case"loading":return t.contents;case"hasError":throw t.contents}}return r})).catch((e=>{if(y(e))return e.then((()=>this.map(t).contents));throw e})))}}function x(t){return Object.freeze(new b(t))}function w(t){return Object.freeze(new k(t))}function F(t){return Object.freeze(new _(t))}function E(){return Object.freeze(new _(new Promise((()=>{}))))}function A(t){const e=(Array.isArray(t)?t:Object.getOwnPropertyNames(t).map((e=>t[e]))).map((t=>D(t)?t:y(t)?F(t):x(t))),r=function(t){return t.every((t=>"hasValue"===t.state))?x(t.map((t=>t.contents))):t.some((t=>"hasError"===t.state))?w(v(t.find((t=>"hasError"===t.state)),"Invalid loadable passed to loadableAll").contents):F(Promise.all(t.map((t=>t.contents))))}(e);return Array.isArray(t)?r:r.map((e=>Object.getOwnPropertyNames(t).reduce(((t,r,i)=>({...t,[r]:e[i]})),{})))}function D(t){return t instanceof g}const C={of:t=>y(t)?F(t):D(t)?t:x(t),error:t=>w(t),loading:()=>E(),all:A,isLoadable:D};var S={loadableWithValue:x,loadableWithError:w,loadableWithPromise:F,loadableLoading:E,loadableAll:A,isLoadable:D,RecoilLoadable:C},B=S.loadableWithValue,O=S.loadableWithError,j=S.loadableWithPromise,P=S.loadableLoading,N=S.loadableAll,z=S.isLoadable,T=S.RecoilLoadable,q=Object.freeze({__proto__:null,loadableWithValue:B,loadableWithError:O,loadableWithPromise:j,loadableLoading:P,loadableAll:N,isLoadable:z,RecoilLoadable:T});const M={RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED:!0,RECOIL_GKS_ENABLED:new Set(["recoil_hamt_2020","recoil_sync_external_store","recoil_suppress_rerender_in_callback","recoil_memory_managament_2020"])};var R;"undefined"!=typeof process&&null!=(null===(R=process)||void 0===R?void 0:R.env)&&(function(t,e){var r,i;const a=null===(r=process.env[t])||void 0===r||null===(i=r.toLowerCase())||void 0===i?void 0:i.trim();if(null!=a&&""!==a){if(!["true","false"].includes(a))throw m(`process.env.${t} value must be 'true', 'false', or empty: ${a}`);n="true"===a,M.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED=n}var n}("RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED"),function(t,e){var r;const i=null===(r=process.env.RECOIL_GKS_ENABLED)||void 0===r?void 0:r.trim();null!=i&&""!==i&&i.split(/\s*,\s*|\s+/).forEach((t=>{M.RECOIL_GKS_ENABLED.add(t)}))}());var L=M;function I(t){return L.RECOIL_GKS_ENABLED.has(t)}I.setPass=t=>{L.RECOIL_GKS_ENABLED.add(t)},I.setFail=t=>{L.RECOIL_GKS_ENABLED.delete(t)},I.clear=()=>{L.RECOIL_GKS_ENABLED.clear()};var V,H,U,K=I,W=function(t,e,{error:r}={}){return null};const G=null!==(V=p.createMutableSource)&&void 0!==V?V:p.unstable_createMutableSource,$=null!==(H=p.useMutableSource)&&void 0!==H?H:p.unstable_useMutableSource,Y=null!==(U=p.useSyncExternalStore)&&void 0!==U?U:p.unstable_useSyncExternalStore;let Q=!1;var J={createMutableSource:G,useMutableSource:$,useSyncExternalStore:Y,currentRendererSupportsUseSyncExternalStore:function(){var t;const{ReactCurrentDispatcher:e,ReactCurrentOwner:r}=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,i=null!=(null!==(t=null==e?void 0:e.current)&&void 0!==t?t:r.currentDispatcher).useSyncExternalStore;return!Y||i||Q||(Q=!0,W("A React renderer without React 18+ API support is being used with React 18+.")),i},reactMode:function(){return K("recoil_transition_support")?{mode:"TRANSITION_SUPPORT",early:!0,concurrent:!0}:K("recoil_sync_external_store")&&null!=Y?{mode:"SYNC_EXTERNAL_STORE",early:!0,concurrent:!1}:K("recoil_mutable_source")&&null!=$&&"undefined"!=typeof window&&!window.$disableRecoilValueMutableSource_TEMP_HACK_DO_NOT_USE?K("recoil_suppress_rerender_in_callback")?{mode:"MUTABLE_SOURCE",early:!0,concurrent:!0}:{mode:"MUTABLE_SOURCE",early:!1,concurrent:!1}:K("recoil_suppress_rerender_in_callback")?{mode:"LEGACY",early:!0,concurrent:!1}:{mode:"LEGACY",early:!1,concurrent:!1}},isFastRefreshEnabled:function(){return!1}};class Z{constructor(t){h(this,"key",void 0),this.key=t}toJSON(){return{key:this.key}}}class X extends Z{}class tt extends Z{}var et={AbstractRecoilValue:Z,RecoilState:X,RecoilValueReadOnly:tt,isRecoilValue:function(t){return t instanceof X||t instanceof tt}},rt=et.AbstractRecoilValue,it=et.RecoilState,at=et.RecoilValueReadOnly,nt=et.isRecoilValue,ot=Object.freeze({__proto__:null,AbstractRecoilValue:rt,RecoilState:it,RecoilValueReadOnly:at,isRecoilValue:nt}),st=function(t,...e){},lt=function(t,e){return function*(){let r=0;for(const i of t)yield e(i,r++)}()};const{isFastRefreshEnabled:ct}=J;class ut{}const ft=new ut,pt=new Map,dt=new Map;class mt extends Error{}const yt=new Map;function vt(t){return yt.get(t)}var ht={nodes:pt,recoilValues:dt,registerNode:function(t){L.RECOIL_DUPLICATE_ATOM_KEY_CHECKING_ENABLED&&function(t){if(pt.has(t)){const e=`Duplicate atom key "${t}". This is a FATAL ERROR in\n production. But it is safe to ignore this warning if it occurred because of\n hot module replacement.`;console.warn(e)}}(t.key),pt.set(t.key,t);const e=null==t.set?new ot.RecoilValueReadOnly(t.key):new ot.RecoilState(t.key);return dt.set(t.key,e),e},getNode:function(t){const e=pt.get(t);if(null==e)throw new mt(`Missing definition for RecoilValue: "${t}""`);return e},getNodeMaybe:function(t){return pt.get(t)},deleteNodeConfigIfPossible:function(t){var e;if(!K("recoil_memory_managament_2020"))return;const r=pt.get(t);var i;null!=r&&null!==(e=r.shouldDeleteConfigOnRelease)&&void 0!==e&&e.call(r)&&(pt.delete(t),null===(i=vt(t))||void 0===i||i(),yt.delete(t))},setConfigDeletionHandler:function(t,e){K("recoil_memory_managament_2020")&&(void 0===e?yt.delete(t):yt.set(t,e))},getConfigDeletionHandler:vt,recoilValuesForKeys:function(t){return lt(t,(t=>v(dt.get(t))))},NodeMissingError:mt,DefaultValue:ut,DEFAULT_VALUE:ft},gt={enqueueExecution:function(t,e){e()}},bt=function(t,e){return function(t){var e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r={},i=Math.pow(2,5),a=i-1,n=i/2,o=i/4,s={},l=function(t){return function(){return t}},c=r.hash=function(t){var r=void 0===t?"undefined":e(t);if("number"===r)return t;"string"!==r&&(t+="");for(var i=0,a=0,n=t.length;a<n;++a)i=(i<<5)-i+t.charCodeAt(a)|0;return i},u=function(t,e){return e>>>t&a},f=function(t){return 1<<t},p=function(t,e){return function(t){return t=(t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135,127&(t+=t>>8)+(t>>16)}(t&e-1)},d=function(t,e,r,i){var a=i;if(!t){var n=i.length;a=new Array(n);for(var o=0;o<n;++o)a[o]=i[o]}return a[e]=r,a},m=function(t,e,r){var i=r.length-1,a=0,n=0,o=r;if(t)a=n=e;else for(o=new Array(i);a<e;)o[n++]=r[a++];for(++a;a<=i;)o[n++]=r[a++];return t&&(o.length=i),o},y={__hamt_isEmpty:!0},v=function(t){return t===y||t&&t.__hamt_isEmpty},h=function(t,e,r,i){return{type:1,edit:t,hash:e,key:r,value:i,_modify:w}},g=function(t,e,r){return{type:2,edit:t,hash:e,children:r,_modify:F}},b=function(t,e,r){return{type:3,edit:t,mask:e,children:r,_modify:E}},k=function(t,e,r){return{type:4,edit:t,size:e,children:r,_modify:A}},_=function t(e,r,i,a,n,o){if(i===n)return g(e,i,[o,a]);var s=u(r,i),l=u(r,n);return b(e,f(s)|f(l),s===l?[t(e,r+5,i,a,n,o)]:s<l?[a,o]:[o,a])},x=function(t,e){return t===e.edit},w=function(t,e,r,i,a,n,o){if(e(n,this.key)){var l=i(this.value);return l===this.value?this:l===s?(--o.value,y):x(t,this)?(this.value=l,this):h(t,a,n,l)}var c=i();return c===s?this:(++o.value,_(t,r,this.hash,this,a,h(t,a,n,c)))},F=function(t,e,r,i,a,n,o){if(a===this.hash){var l=function(t,e,r,i,a,n,o,l){for(var c=a.length,u=0;u<c;++u){var f=a[u];if(r(o,f.key)){var p=f.value,y=n(p);return y===p?a:y===s?(--l.value,m(t,u,a)):d(t,u,h(e,i,o,y),a)}}var v=n();return v===s?a:(++l.value,d(t,c,h(e,i,o,v),a))}(x(t,this),t,e,this.hash,this.children,i,n,o);return l===this.children?this:l.length>1?g(t,this.hash,l):l[0]}var c=i();return c===s?this:(++o.value,_(t,r,this.hash,this,a,h(t,a,n,c)))},E=function(t,e,r,i,a,o,s){var l=this.mask,c=this.children,h=u(r,a),g=f(h),_=p(l,g),w=l&g,F=w?c[_]:y,E=F._modify(t,e,r+5,i,a,o,s);if(F===E)return this;var A,D=x(t,this),C=l,S=void 0;if(w&&v(E)){if(!(C&=~g))return y;if(c.length<=2&&((A=c[1^_])===y||1===A.type||2===A.type))return c[1^_];S=m(D,_,c)}else if(w||v(E))S=d(D,_,E,c);else{if(c.length>=n)return function(t,e,r,i,a){for(var n=[],o=i,s=0,l=0;o;++l)1&o&&(n[l]=a[s++]),o>>>=1;return n[e]=r,k(t,s+1,n)}(t,h,E,l,c);C|=g,S=function(t,e,r,i){var a=i.length;if(t){for(var n=a;n>=e;)i[n--]=i[n];return i[e]=r,i}for(var o=0,s=0,l=new Array(a+1);o<e;)l[s++]=i[o++];for(l[e]=r;o<a;)l[++s]=i[o++];return l}(D,_,E,c)}return D?(this.mask=C,this.children=S,this):b(t,C,S)},A=function(t,e,r,i,a,n,s){var l=this.size,c=this.children,f=u(r,a),p=c[f],m=(p||y)._modify(t,e,r+5,i,a,n,s);if(p===m)return this;var h=x(t,this),g=void 0;if(v(p)&&!v(m))++l,g=d(h,f,m,c);else if(!v(p)&&v(m)){if(--l<=o)return function(t,e,r,i){for(var a=new Array(e-1),n=0,o=0,s=0,l=i.length;s<l;++s)if(s!==r){var c=i[s];c&&!v(c)&&(a[n++]=c,o|=1<<s)}return b(t,o,a)}(t,l,f,c);g=d(h,f,y,c)}else g=d(h,f,m,c);return h?(this.size=l,this.children=g,this):k(t,l,g)};function D(t,e,r,i,a){this._editable=t,this._edit=e,this._config=r,this._root=i,this._size=a}y._modify=function(t,e,r,i,a,n,o){var l=i();return l===s?y:(++o.value,h(t,a,n,l))},D.prototype.setTree=function(t,e){return this._editable?(this._root=t,this._size=e,this):t===this._root?this:new D(this._editable,this._edit,this._config,t,e)};var C=r.tryGetHash=function(t,e,r,i){for(var a=i._root,n=0,o=i._config.keyEq;;)switch(a.type){case 1:return o(r,a.key)?a.value:t;case 2:if(e===a.hash)for(var s=a.children,l=0,c=s.length;l<c;++l){var d=s[l];if(o(r,d.key))return d.value}return t;case 3:var m=u(n,e),y=f(m);if(a.mask&y){a=a.children[p(a.mask,y)],n+=5;break}return t;case 4:if(a=a.children[u(n,e)]){n+=5;break}return t;default:return t}};D.prototype.tryGetHash=function(t,e,r){return C(t,e,r,this)};var S=r.tryGet=function(t,e,r){return C(t,r._config.hash(e),e,r)};D.prototype.tryGet=function(t,e){return S(t,e,this)};var B=r.getHash=function(t,e,r){return C(void 0,t,e,r)};D.prototype.getHash=function(t,e){return B(t,e,this)},r.get=function(t,e){return C(void 0,e._config.hash(t),t,e)},D.prototype.get=function(t,e){return S(e,t,this)};var O=r.has=function(t,e,r){return C(s,t,e,r)!==s};D.prototype.hasHash=function(t,e){return O(t,e,this)};var j=r.has=function(t,e){return O(e._config.hash(t),t,e)};D.prototype.has=function(t){return j(t,this)};var P=function(t,e){return t===e};r.make=function(t){return new D(0,0,{keyEq:t&&t.keyEq||P,hash:t&&t.hash||c},y,0)},r.empty=r.make();var N=r.isEmpty=function(t){return t&&!!v(t._root)};D.prototype.isEmpty=function(){return N(this)};var z=r.modifyHash=function(t,e,r,i){var a={value:i._size},n=i._root._modify(i._editable?i._edit:NaN,i._config.keyEq,0,t,e,r,a);return i.setTree(n,a.value)};D.prototype.modifyHash=function(t,e,r){return z(r,t,e,this)};var T=r.modify=function(t,e,r){return z(t,r._config.hash(e),e,r)};D.prototype.modify=function(t,e){return T(e,t,this)};var q=r.setHash=function(t,e,r,i){return z(l(r),t,e,i)};D.prototype.setHash=function(t,e,r){return q(t,e,r,this)};var M=r.set=function(t,e,r){return q(r._config.hash(t),t,e,r)};D.prototype.set=function(t,e){return M(t,e,this)};var R=l(s),L=r.removeHash=function(t,e,r){return z(R,t,e,r)};D.prototype.removeHash=D.prototype.deleteHash=function(t,e){return L(t,e,this)};var I=r.remove=function(t,e){return L(e._config.hash(t),t,e)};D.prototype.remove=D.prototype.delete=function(t){return I(t,this)};var V=r.beginMutation=function(t){return new D(t._editable+1,t._edit+1,t._config,t._root,t._size)};D.prototype.beginMutation=function(){return V(this)};var H=r.endMutation=function(t){return t._editable=t._editable&&t._editable-1,t};D.prototype.endMutation=function(){return H(this)};var U=r.mutate=function(t,e){var r=V(e);return t(r),H(r)};D.prototype.mutate=function(t){return U(t,this)};var K=function(t){return t&&W(t[0],t[1],t[2],t[3],t[4])},W=function(t,e,r,i,a){for(;r<t;){var n=e[r++];if(n&&!v(n))return G(n,i,[t,e,r,i,a])}return K(a)},G=function(t,e,r){switch(t.type){case 1:return{value:e(t),rest:r};case 2:case 4:case 3:var i=t.children;return W(i.length,i,0,e,r);default:return K(r)}},$={done:!0};function Y(t){this.v=t}Y.prototype.next=function(){if(!this.v)return $;var t=this.v;return this.v=K(t.rest),t},Y.prototype[Symbol.iterator]=function(){return this};var Q=function(t,e){return new Y(G(t._root,e))},J=function(t){return[t.key,t.value]},Z=r.entries=function(t){return Q(t,J)};D.prototype.entries=D.prototype[Symbol.iterator]=function(){return Z(this)};var X=function(t){return t.key},tt=r.keys=function(t){return Q(t,X)};D.prototype.keys=function(){return tt(this)};var et=function(t){return t.value},rt=r.values=D.prototype.values=function(t){return Q(t,et)};D.prototype.values=function(){return rt(this)};var it=r.fold=function(t,e,r){var i=r._root;if(1===i.type)return t(e,i.value,i.key);for(var a=[i.children],n=void 0;n=a.pop();)for(var o=0,s=n.length;o<s;){var l=n[o++];l&&l.type&&(1===l.type?e=t(e,l.value,l.key):a.push(l.children))}return e};D.prototype.fold=function(t,e){return it(t,e,this)};var at=r.forEach=function(t,e){return it((function(r,i,a){return t(i,a,e)}),null,e)};D.prototype.forEach=function(t){return at(t,this)};var nt=r.count=function(t){return t._size};D.prototype.count=function(){return nt(this)},Object.defineProperty(D.prototype,"size",{get:D.prototype.count}),t.exports?t.exports=r:(void 0).hamt=r}(e={exports:{}}),e.exports}();class kt{constructor(t){h(this,"_map",void 0),this._map=new Map(null==t?void 0:t.entries())}keys(){return this._map.keys()}entries(){return this._map.entries()}get(t){return this._map.get(t)}has(t){return this._map.has(t)}set(t,e){return this._map.set(t,e),this}delete(t){return this._map.delete(t),this}clone(){return xt(this)}toMap(){return new Map(this._map)}}class _t{constructor(t){if(h(this,"_hamt",bt.empty.beginMutation()),t instanceof _t){const e=t._hamt.endMutation();t._hamt=e.beginMutation(),this._hamt=e.beginMutation()}else if(t)for(const[e,r]of t.entries())this._hamt.set(e,r)}keys(){return this._hamt.keys()}entries(){return this._hamt.entries()}get(t){return this._hamt.get(t)}has(t){return this._hamt.has(t)}set(t,e){return this._hamt.set(t,e),this}delete(t){return this._hamt.delete(t),this}clone(){return xt(this)}toMap(){return new Map(this._hamt)}}function xt(t){return K("recoil_hamt_2020")?new _t(t):new kt(t)}var wt=xt,Ft=Object.freeze({__proto__:null,persistentMap:wt}),Et=function(t,...e){const r=new Set;t:for(const i of t){for(const t of e)if(t.has(i))continue t;r.add(i)}return r},At=function(t,e){const r=new Map;return t.forEach(((t,i)=>{r.set(i,e(t,i))})),r};function Dt(t,e,r,i){const{nodeDeps:a,nodeToNodeSubscriptions:n}=r,o=a.get(t);if(o&&i&&o!==i.nodeDeps.get(t))return;a.set(t,e);const s=null==o?e:Et(e,o);for(const e of s)n.has(e)||n.set(e,new Set),v(n.get(e)).add(t);if(o){const r=Et(o,e);for(const e of r){if(!n.has(e))return;const r=v(n.get(e));r.delete(t),0===r.size&&n.delete(e)}}}var Ct={cloneGraph:function(t){return{nodeDeps:At(t.nodeDeps,(t=>new Set(t))),nodeToNodeSubscriptions:At(t.nodeToNodeSubscriptions,(t=>new Set(t)))}},graph:function(){return{nodeDeps:new Map,nodeToNodeSubscriptions:new Map}},saveDepsToStore:function(t,e,r,i){var a,n,o,s;const l=r.getState();i!==l.currentTree.version&&i!==(null===(a=l.nextTree)||void 0===a?void 0:a.version)&&i!==(null===(n=l.previousTree)||void 0===n?void 0:n.version)&&W("Tried to save dependencies to a discarded tree");const c=r.getGraph(i);if(Dt(t,e,c),i===(null===(o=l.previousTree)||void 0===o?void 0:o.version)&&Dt(t,e,r.getGraph(l.currentTree.version),c),i===(null===(s=l.previousTree)||void 0===s?void 0:s.version)||i===l.currentTree.version){var u;const i=null===(u=l.nextTree)||void 0===u?void 0:u.version;void 0!==i&&Dt(t,e,r.getGraph(i),c)}}};let St=0,Bt=0,Ot=0;var jt={getNextTreeStateVersion:()=>St++,getNextStoreID:()=>Bt++,getNextComponentID:()=>Ot++};const{persistentMap:Pt}=Ft,{graph:Nt}=Ct,{getNextTreeStateVersion:zt}=jt;function Tt(){const t=zt();return{version:t,stateID:t,transactionMetadata:{},dirtyAtoms:new Set,atomValues:Pt(),nonvalidatedAtoms:Pt()}}var qt={makeEmptyTreeState:Tt,makeEmptyStoreState:function(){const t=Tt();return{currentTree:t,nextTree:null,previousTree:null,commitDepth:0,knownAtoms:new Set,knownSelectors:new Set,transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(t.version,Nt()),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map}},getNextTreeStateVersion:zt};class Mt{}var Rt={RetentionZone:Mt,retentionZone:function(){return new Mt}},Lt={setByAddingToSet:function(t,e){const r=new Set(t);return r.add(e),r},setByDeletingFromSet:function(t,e){const r=new Set(t);return r.delete(e),r},mapBySettingInMap:function(t,e,r){const i=new Map(t);return i.set(e,r),i},mapByUpdatingInMap:function(t,e,r){const i=new Map(t);return i.set(e,r(i.get(e))),i},mapByDeletingFromMap:function(t,e){const r=new Map(t);return r.delete(e),r},mapByDeletingMultipleFromMap:function(t,e){const r=new Map(t);return e.forEach((t=>r.delete(t))),r}},It=function*(t,e){let r=0;for(const i of t)e(i,r++)&&(yield i)},Vt=function(t,e){return new Proxy(t,{get:(t,r)=>(!(r in t)&&r in e&&(t[r]=e[r]()),t[r]),ownKeys:t=>Object.keys(t)})};const{getNode:Ht,getNodeMaybe:Ut,recoilValuesForKeys:Kt}=ht,{RetentionZone:Wt}=Rt,{setByAddingToSet:Gt}=Lt,$t=Object.freeze(new Set);class Yt extends Error{}function Qt(t,e,r,i){const a=t.getState();if(a.nodeCleanupFunctions.has(r))return;const n=Ht(r),o=function(t,e,r){if(!K("recoil_memory_managament_2020"))return()=>{};const{nodesRetainedByZone:i}=t.getState().retention;function a(t){let r=i.get(t);r||i.set(t,r=new Set),r.add(e)}if(r instanceof Wt)a(r);else if(Array.isArray(r))for(const t of r)a(t);return()=>{if(!K("recoil_memory_managament_2020"))return;const{retention:i}=t.getState();function a(t){const r=i.nodesRetainedByZone.get(t);null==r||r.delete(e),r&&0===r.size&&i.nodesRetainedByZone.delete(t)}if(r instanceof Wt)a(r);else if(Array.isArray(r))for(const t of r)a(t)}}(t,r,n.retainedBy),s=n.init(t,e,i);a.nodeCleanupFunctions.set(r,(()=>{s(),o()}))}function Jt(t,e,r){return Ht(r).peek(t,e)}function Zt(t,e,r){const i=new Set,a=Array.from(r),n=t.getGraph(e.version);for(let t=a.pop();t;t=a.pop()){var o;i.add(t);const e=null!==(o=n.nodeToNodeSubscriptions.get(t))&&void 0!==o?o:$t;for(const t of e)i.has(t)||a.push(t)}return i}var Xt={getNodeLoadable:function(t,e,r){return Qt(t,e,r,"get"),Ht(r).get(t,e)},peekNodeLoadable:Jt,setNodeValue:function(t,e,r,i){const a=Ht(r);if(null==a.set)throw new Yt(`Attempt to set read-only RecoilValue: ${r}`);const n=a.set;return Qt(t,e,r,"set"),n(t,e,i)},initializeNode:function(t,e,r){Qt(t,t.getState().currentTree,e,r)},cleanUpNode:function(t,e){var r;const i=t.getState();null===(r=i.nodeCleanupFunctions.get(e))||void 0===r||r(),i.nodeCleanupFunctions.delete(e)},setUnvalidatedAtomValue_DEPRECATED:function(t,e,r){var i;const a=Ut(e);return null==a||null===(i=a.invalidate)||void 0===i||i.call(a,t),{...t,atomValues:t.atomValues.clone().delete(e),nonvalidatedAtoms:t.nonvalidatedAtoms.clone().set(e,r),dirtyAtoms:Gt(t.dirtyAtoms,e)}},peekNodeInfo:function(t,e,r){const i=t.getState(),a=t.getGraph(e.version),n=Ht(r).nodeType;return Vt({type:n},{loadable:()=>Jt(t,e,r),isActive:()=>i.knownAtoms.has(r)||i.knownSelectors.has(r),isSet:()=>"selector"!==n&&e.atomValues.has(r),isModified:()=>e.dirtyAtoms.has(r),deps:()=>{var t;return Kt(null!==(t=a.nodeDeps.get(r))&&void 0!==t?t:[])},subscribers:()=>{var a,n;return{nodes:Kt(It(Zt(t,e,new Set([r])),(t=>t!==r))),components:lt(null!==(a=null===(n=i.nodeToComponentSubscriptions.get(r))||void 0===n?void 0:n.values())&&void 0!==a?a:[],(([t])=>({name:t})))}}})},getDownstreamNodes:Zt};let te=null;var ee={setInvalidateMemoizedSnapshot:function(t){te=t},invalidateMemoizedSnapshot:function(){var t;null===(t=te)||void 0===t||t()}};const{getDownstreamNodes:re,getNodeLoadable:ie,setNodeValue:ae}=Xt,{getNextComponentID:ne}=jt,{getNode:oe,getNodeMaybe:se}=ht,{DefaultValue:le}=ht,{reactMode:ce}=J,{AbstractRecoilValue:ue,RecoilState:fe,RecoilValueReadOnly:pe,isRecoilValue:de}=ot,{invalidateMemoizedSnapshot:me}=ee;function ye(t,e,r){if("set"===r.type){const{recoilValue:i,valueOrUpdater:a}=r,n=function(t,e,{key:r},i){if("function"==typeof i){const a=ie(t,e,r);if("loading"===a.state){const t=`Tried to set atom or selector "${r}" using an updater function while the current state is pending, this is not currently supported.`;throw W(t),m(t)}if("hasError"===a.state)throw a.contents;return i(a.contents)}return i}(t,e,i,a),o=ae(t,e,i.key,n);for(const[t,r]of o.entries())ve(e,t,r)}else if("setLoadable"===r.type){const{recoilValue:{key:t},loadable:i}=r;ve(e,t,i)}else if("markModified"===r.type){const{recoilValue:{key:t}}=r;e.dirtyAtoms.add(t)}else if("setUnvalidated"===r.type){var i;const{recoilValue:{key:t},unvalidatedValue:a}=r,n=se(t);null==n||null===(i=n.invalidate)||void 0===i||i.call(n,e),e.atomValues.delete(t),e.nonvalidatedAtoms.set(t,a),e.dirtyAtoms.add(t)}else W(`Unknown action ${r.type}`)}function ve(t,e,r){"hasValue"===r.state&&r.contents instanceof le?t.atomValues.delete(e):t.atomValues.set(e,r),t.dirtyAtoms.add(e),t.nonvalidatedAtoms.delete(e)}function he(t,e){t.replaceState((r=>{const i=ke(r);for(const r of e)ye(t,i,r);return _e(t,i),me(),i}))}function ge(t,e){if(be.length){const r=be[be.length-1];let i=r.get(t);i||r.set(t,i=[]),i.push(e)}else he(t,[e])}const be=[];function ke(t){return{...t,atomValues:t.atomValues.clone(),nonvalidatedAtoms:t.nonvalidatedAtoms.clone(),dirtyAtoms:new Set(t.dirtyAtoms)}}function _e(t,e){const r=re(t,e,e.dirtyAtoms);for(const t of r){var i,a;null===(i=se(t))||void 0===i||null===(a=i.invalidate)||void 0===a||a.call(i,e)}}function xe(t,e,r){ge(t,{type:"set",recoilValue:e,valueOrUpdater:r})}var we={RecoilValueReadOnly:pe,AbstractRecoilValue:ue,RecoilState:fe,getRecoilValueAsLoadable:function(t,{key:e},r=t.getState().currentTree){var i,a;const n=t.getState();r.version!==n.currentTree.version&&r.version!==(null===(i=n.nextTree)||void 0===i?void 0:i.version)&&r.version!==(null===(a=n.previousTree)||void 0===a?void 0:a.version)&&W("Tried to read from a discarded tree");const o=ie(t,r,e);return"loading"===o.state&&o.contents.catch((()=>{})),o},setRecoilValue:xe,setRecoilValueLoadable:function(t,e,r){if(r instanceof le)return xe(t,e,r);ge(t,{type:"setLoadable",recoilValue:e,loadable:r})},markRecoilValueModified:function(t,e){ge(t,{type:"markModified",recoilValue:e})},setUnvalidatedRecoilValue:function(t,e,r){ge(t,{type:"setUnvalidated",recoilValue:e,unvalidatedValue:r})},subscribeToRecoilValue:function(t,{key:e},r,i=null){const a=ne(),n=t.getState();n.nodeToComponentSubscriptions.has(e)||n.nodeToComponentSubscriptions.set(e,new Map),v(n.nodeToComponentSubscriptions.get(e)).set(a,[null!=i?i:"<not captured>",r]);const o=ce();if(o.early&&("LEGACY"===o.mode||"MUTABLE_SOURCE"===o.mode)){const i=t.getState().nextTree;i&&i.dirtyAtoms.has(e)&&r(i)}return{release:()=>{const r=t.getState(),i=r.nodeToComponentSubscriptions.get(e);void 0!==i&&i.has(a)?(i.delete(a),0===i.size&&r.nodeToComponentSubscriptions.delete(e)):W(`Subscription missing at release time for atom ${e}. This is a bug in Recoil.`)}}},isRecoilValue:de,applyAtomValueWrites:function(t,e){const r=t.clone();return e.forEach(((t,e)=>{"hasValue"===t.state&&t.contents instanceof le?r.delete(e):r.set(e,t)})),r},batchStart:function(){const t=new Map;return be.push(t),()=>{for(const[e,r]of t)he(e,r);be.pop()!==t&&W("Incorrect order of batch popping")}},writeLoadableToTreeState:ve,invalidateDownstreams:_e,copyTreeState:ke,refreshRecoilValue:function(t,e){var r;const{currentTree:i}=t.getState(),a=oe(e.key);null===(r=a.clearCache)||void 0===r||r.call(a,t,i)}},Fe=function(t,e,r){const i=t.entries();let a=i.next();for(;!a.done;){const n=a.value;if(e.call(r,n[1],n[0],t))return!0;a=i.next()}return!1};const{cleanUpNode:Ee}=Xt,{deleteNodeConfigIfPossible:Ae,getNode:De}=ht,{RetentionZone:Ce}=Rt,Se=new Set;function Be(t,e){const r=t.getState(),i=r.currentTree;if(r.nextTree)return void W("releaseNodesNowOnCurrentTree should only be called at the end of a batch");const a=new Set;for(const t of e)if(t instanceof Ce)for(const e of je(r,t))a.add(e);else a.add(t);const n=function(t,e){const r=t.getState(),i=r.currentTree,a=t.getGraph(i.version),n=new Set,o=new Set;return function e(s){const l=new Set,c=function(t,e,r,i,a){const n=t.getGraph(e.version),o=[],s=new Set;for(;r.size>0;)l(v(r.values().next().value));return o;function l(t){if(i.has(t)||a.has(t))return void r.delete(t);if(s.has(t))return;const e=n.nodeToNodeSubscriptions.get(t);if(e)for(const t of e)l(t);s.add(t),r.delete(t),o.push(t)}}(t,i,s,n,o);for(const t of c){var u;if("recoilRoot"===De(t).retainedBy){o.add(t);continue}if((null!==(u=r.retention.referenceCounts.get(t))&&void 0!==u?u:0)>0){o.add(t);continue}if(Pe(t).some((t=>r.retention.referenceCounts.get(t)))){o.add(t);continue}const e=a.nodeToNodeSubscriptions.get(t);e&&Fe(e,(t=>o.has(t)))?o.add(t):(n.add(t),l.add(t))}const f=new Set;for(const t of l)for(const e of null!==(p=a.nodeDeps.get(t))&&void 0!==p?p:Se){var p;n.has(e)||f.add(e)}f.size&&e(f)}(e),n}(t,a);for(const e of n)Oe(t,i,e)}function Oe(t,e,r){if(!K("recoil_memory_managament_2020"))return;Ee(t,r);const i=t.getState();i.knownAtoms.delete(r),i.knownSelectors.delete(r),i.nodeTransactionSubscriptions.delete(r),i.retention.referenceCounts.delete(r);const a=Pe(r);for(const t of a){var n;null===(n=i.retention.nodesRetainedByZone.get(t))||void 0===n||n.delete(r)}e.atomValues.delete(r),e.dirtyAtoms.delete(r),e.nonvalidatedAtoms.delete(r);const o=i.graphsByVersion.get(e.version);if(o){const t=o.nodeDeps.get(r);if(void 0!==t){o.nodeDeps.delete(r);for(const e of t){var s;null===(s=o.nodeToNodeSubscriptions.get(e))||void 0===s||s.delete(r)}}o.nodeToNodeSubscriptions.delete(r)}Ae(r)}function je(t,e){var r;return null!==(r=t.retention.nodesRetainedByZone.get(e))&&void 0!==r?r:Se}function Pe(t){const e=De(t).retainedBy;return void 0===e||"components"===e||"recoilRoot"===e?[]:e instanceof Ce?[e]:e}function Ne(t,e){K("recoil_memory_managament_2020")&&(t.getState().retention.referenceCounts.delete(e),function(t,e){const r=t.getState();r.nextTree?r.retention.retainablesToCheckForRelease.add(e):Be(t,new Set([e]))}(t,e))}var ze={SUSPENSE_TIMEOUT_MS:12e4,updateRetainCount:function(t,e,r){var i;if(!K("recoil_memory_managament_2020"))return;const a=t.getState().retention.referenceCounts,n=(null!==(i=a.get(e))&&void 0!==i?i:0)+r;0===n?Ne(t,e):a.set(e,n)},updateRetainCountToZero:Ne,releaseScheduledRetainablesNow:function(t){if(!K("recoil_memory_managament_2020"))return;const e=t.getState();Be(t,e.retention.retainablesToCheckForRelease),e.retention.retainablesToCheckForRelease.clear()},retainedByOptionWithDefault:function(t){return void 0===t?"recoilRoot":t}};const{unstable_batchedUpdates:Te}=d;var qe={unstable_batchedUpdates:Te};const{unstable_batchedUpdates:Me}=qe;var Re={unstable_batchedUpdates:Me};const{batchStart:Le}=we,{unstable_batchedUpdates:Ie}=Re;let Ve=Ie||(t=>t());var He={getBatcher:()=>Ve,setBatcher:t=>{Ve=t},batchUpdates:t=>{Ve((()=>{let e=()=>{};try{e=Le(),t()}finally{e()}}))}},Ue=function*(t){for(const e of t)for(const t of e)yield t};const Ke="undefined"==typeof Window||"undefined"==typeof window,We="undefined"!=typeof navigator&&"ReactNative"===navigator.product;var Ge={isSSR:Ke,isReactNative:We,isWindow:t=>!Ke&&(t===window||t instanceof Window)},$e={memoizeWithArgsHash:function(t,e){let r;return(...i)=>{r||(r={});const a=e(...i);return Object.hasOwnProperty.call(r,a)||(r[a]=t(...i)),r[a]}},memoizeOneWithArgsHash:function(t,e){let r,i;return(...a)=>{const n=e(...a);return r===n||(r=n,i=t(...a)),i}},memoizeOneWithArgsHashAndInvalidation:function(t,e){let r,i;return[(...a)=>{const n=e(...a);return r===n||(r=n,i=t(...a)),i},()=>{r=null}]}};const{batchUpdates:Ye}=He,{initializeNode:Qe,peekNodeInfo:Je}=Xt,{graph:Ze}=Ct,{getNextStoreID:Xe}=jt,{DEFAULT_VALUE:tr,recoilValues:er,recoilValuesForKeys:rr}=ht,{AbstractRecoilValue:ir,getRecoilValueAsLoadable:ar,setRecoilValue:nr,setUnvalidatedRecoilValue:or}=we,{updateRetainCount:sr}=ze,{setInvalidateMemoizedSnapshot:lr}=ee,{getNextTreeStateVersion:cr,makeEmptyStoreState:ur}=qt,{isSSR:fr}=Ge,{memoizeOneWithArgsHashAndInvalidation:pr}=$e;class dr{constructor(t,e){h(this,"_store",void 0),h(this,"_refCount",1),h(this,"getLoadable",(t=>(this.checkRefCount_INTERNAL(),ar(this._store,t)))),h(this,"getPromise",(t=>(this.checkRefCount_INTERNAL(),this.getLoadable(t).toPromise()))),h(this,"getNodes_UNSTABLE",(t=>{if(this.checkRefCount_INTERNAL(),!0===(null==t?void 0:t.isModified)){if(!1===(null==t?void 0:t.isInitialized))return[];const e=this._store.getState().currentTree;return rr(e.dirtyAtoms)}const e=this._store.getState().knownAtoms,r=this._store.getState().knownSelectors;return null==(null==t?void 0:t.isInitialized)?er.values():!0===t.isInitialized?rr(Ue([e,r])):It(er.values(),(({key:t})=>!e.has(t)&&!r.has(t)))})),h(this,"getInfo_UNSTABLE",(({key:t})=>(this.checkRefCount_INTERNAL(),Je(this._store,this._store.getState().currentTree,t)))),h(this,"map",(t=>{this.checkRefCount_INTERNAL();const e=new hr(this,Ye);return t(e),e})),h(this,"asyncMap",(async t=>{this.checkRefCount_INTERNAL();const e=new hr(this,Ye);return e.retain(),await t(e),e.autoRelease_INTERNAL(),e})),this._store={storeID:Xe(),parentStoreID:e,getState:()=>t,replaceState:e=>{t.currentTree=e(t.currentTree)},getGraph:e=>{const r=t.graphsByVersion;if(r.has(e))return v(r.get(e));const i=Ze();return r.set(e,i),i},subscribeToTransactions:()=>({release:()=>{}}),addTransactionMetadata:()=>{throw m("Cannot subscribe to Snapshots")}};for(const t of this._store.getState().knownAtoms)Qe(this._store,t,"get"),sr(this._store,t,1);this.autoRelease_INTERNAL()}retain(){this._refCount<=0&&W("Attempt to retain() Snapshot that was already released."),this._refCount++;let t=!1;return()=>{t||(t=!0,this._release())}}autoRelease_INTERNAL(){fr||window.setTimeout((()=>this._release()),10)}_release(){if(this._refCount--,0===this._refCount){if(this._store.getState().nodeCleanupFunctions.forEach((t=>t())),this._store.getState().nodeCleanupFunctions.clear(),!K("recoil_memory_managament_2020"))return}else this._refCount}isRetained(){return this._refCount>0}checkRefCount_INTERNAL(){K("recoil_memory_managament_2020")&&this._refCount}getStore_INTERNAL(){return this.checkRefCount_INTERNAL(),this._store}getID(){return this.checkRefCount_INTERNAL(),this._store.getState().currentTree.stateID}getStoreID(){return this.checkRefCount_INTERNAL(),this._store.storeID}}function mr(t,e,r=!1){const i=t.getState(),a=r?cr():e.version;return{currentTree:{version:r?a:e.version,stateID:r?a:e.stateID,transactionMetadata:{...e.transactionMetadata},dirtyAtoms:new Set(e.dirtyAtoms),atomValues:e.atomValues.clone(),nonvalidatedAtoms:e.nonvalidatedAtoms.clone()},commitDepth:0,nextTree:null,previousTree:null,knownAtoms:new Set(i.knownAtoms),knownSelectors:new Set(i.knownSelectors),transactionSubscriptions:new Map,nodeTransactionSubscriptions:new Map,nodeToComponentSubscriptions:new Map,queuedComponentCallbacks_DEPRECATED:[],suspendedComponentResolvers:new Set,graphsByVersion:(new Map).set(a,t.getGraph(e.version)),retention:{referenceCounts:new Map,nodesRetainedByZone:new Map,retainablesToCheckForRelease:new Set},nodeCleanupFunctions:new Map(lt(i.nodeCleanupFunctions.entries(),(([t])=>[t,()=>{}])))}}const[yr,vr]=pr(((t,e)=>{var r;const i=t.getState(),a="latest"===e?null!==(r=i.nextTree)&&void 0!==r?r:i.currentTree:v(i.previousTree);return new dr(mr(t,a),t.storeID)}),((t,e)=>{var r,i;return String(e)+String(t.storeID)+String(null===(r=t.getState().nextTree)||void 0===r?void 0:r.version)+String(t.getState().currentTree.version)+String(null===(i=t.getState().previousTree)||void 0===i?void 0:i.version)}));lr(vr);class hr extends dr{constructor(t,e){super(mr(t.getStore_INTERNAL(),t.getStore_INTERNAL().getState().currentTree,!0),t.getStoreID()),h(this,"_batch",void 0),h(this,"set",((t,e)=>{this.checkRefCount_INTERNAL();const r=this.getStore_INTERNAL();this._batch((()=>{sr(r,t.key,1),nr(this.getStore_INTERNAL(),t,e)}))})),h(this,"reset",(t=>{this.checkRefCount_INTERNAL();const e=this.getStore_INTERNAL();this._batch((()=>{sr(e,t.key,1),nr(this.getStore_INTERNAL(),t,tr)}))})),h(this,"setUnvalidatedAtomValues_DEPRECATED",(t=>{this.checkRefCount_INTERNAL();const e=this.getStore_INTERNAL();Ye((()=>{for(const[r,i]of t.entries())sr(e,r,1),or(e,new ir(r),i)}))})),this._batch=e}}var gr={Snapshot:dr,MutableSnapshot:hr,freshSnapshot:function(t){const e=new dr(ur());return null!=t?e.map(t):e},cloneSnapshot:function(t,e="latest"){const r=yr(t,e);return r.isRetained()?r:(vr(),yr(t,e))}},br=gr.Snapshot,kr=gr.MutableSnapshot,_r=gr.freshSnapshot,xr=gr.cloneSnapshot,wr=Object.freeze({__proto__:null,Snapshot:br,MutableSnapshot:kr,freshSnapshot:_r,cloneSnapshot:xr}),Fr=function(...t){const e=new Set;for(const r of t)for(const t of r)e.add(t);return e};const{useRef:Er}=p;var Ar=function(t){const e=Er(t);return e.current===t&&"function"==typeof t&&(e.current=t()),e};const{getNextTreeStateVersion:Dr,makeEmptyStoreState:Cr}=qt,{cleanUpNode:Sr,getDownstreamNodes:Br,initializeNode:Or,setNodeValue:jr,setUnvalidatedAtomValue_DEPRECATED:Pr}=Xt,{graph:Nr}=Ct,{cloneGraph:zr}=Ct,{getNextStoreID:Tr}=jt,{createMutableSource:qr,reactMode:Mr}=J,{applyAtomValueWrites:Rr}=we,{releaseScheduledRetainablesNow:Lr}=ze,{freshSnapshot:Ir}=wr,{useCallback:Vr,useContext:Hr,useEffect:Ur,useMemo:Kr,useRef:Wr,useState:Gr}=p;function $r(){throw m("This component must be used inside a <RecoilRoot> component.")}const Yr=Object.freeze({storeID:Tr(),getState:$r,replaceState:$r,getGraph:$r,subscribeToTransactions:$r,addTransactionMetadata:$r});let Qr=!1;function Jr(t){if(Qr)throw m("An atom update was triggered within the execution of a state updater function. State updater functions provided to Recoil must be pure functions.");const e=t.getState();if(null===e.nextTree){K("recoil_memory_managament_2020")&&K("recoil_release_on_cascading_update_killswitch_2021")&&e.commitDepth>0&&Lr(t);const r=e.currentTree.version,i=Dr();e.nextTree={...e.currentTree,version:i,stateID:i,dirtyAtoms:new Set,transactionMetadata:{}},e.graphsByVersion.set(i,zr(v(e.graphsByVersion.get(r))))}}const Zr=p.createContext({current:Yr}),Xr=()=>Hr(Zr),ti=p.createContext(null);function ei(t,e,r){const i=Br(t,r,r.dirtyAtoms);for(const t of i){const i=e.nodeToComponentSubscriptions.get(t);if(i)for(const[t,[e,a]]of i)a(r)}}function ri(t){const e=t.getState(),r=e.currentTree,i=r.dirtyAtoms;if(i.size){for(const[r,a]of e.nodeTransactionSubscriptions)if(i.has(r))for(const[e,r]of a)r(t);for(const[r,i]of e.transactionSubscriptions)i(t);(!Mr().early||e.suspendedComponentResolvers.size>0)&&(ei(t,e,r),e.suspendedComponentResolvers.forEach((t=>t())),e.suspendedComponentResolvers.clear())}e.queuedComponentCallbacks_DEPRECATED.forEach((t=>t(r))),e.queuedComponentCallbacks_DEPRECATED.splice(0,e.queuedComponentCallbacks_DEPRECATED.length)}function ii({setNotifyBatcherOfChange:t}){const e=Xr(),[,r]=Gr([]);return t((()=>r({}))),Ur((()=>(t((()=>r({}))),()=>{t((()=>{}))})),[t]),Ur((()=>{gt.enqueueExecution("Batcher",(()=>{!function(t){const e=t.getState();e.commitDepth++;try{const{nextTree:r}=e;if(null==r)return;e.previousTree=e.currentTree,e.currentTree=r,e.nextTree=null,ri(t),null!=e.previousTree?e.graphsByVersion.delete(e.previousTree.version):W("Ended batch with no previous state, which is unexpected","recoil"),e.previousTree=null,K("recoil_memory_managament_2020")&&null==r&&Lr(t)}finally{e.commitDepth--}}(e.current)}))})),null}let ai=0;function ni({initializeState_DEPRECATED:t,initializeState:e,store_INTERNAL:r,children:i}){let a;const n=t=>{const e=a.current.graphsByVersion;if(e.has(t))return v(e.get(t));const r=Nr();return e.set(t,r),r},o=(t,e)=>{if(null==e){const{transactionSubscriptions:e}=f.current.getState(),r=ai++;return e.set(r,t),{release:()=>{e.delete(r)}}}{const{nodeTransactionSubscriptions:r}=f.current.getState();r.has(e)||r.set(e,new Map);const i=ai++;return v(r.get(e)).set(i,t),{release:()=>{const t=r.get(e);t&&(t.delete(i),0===t.size&&r.delete(e))}}}},s=t=>{Jr(f.current);for(const e of Object.keys(t))v(f.current.getState().nextTree).transactionMetadata[e]=t[e]},l=t=>{Jr(f.current);const e=v(a.current.nextTree);let r;try{Qr=!0,r=t(e)}finally{Qr=!1}r!==e&&(a.current.nextTree=r,Mr().early&&ei(f.current,a.current,r),v(c.current)())},c=Wr(null),u=Vr((t=>{c.current=t}),[c]),f=Ar((()=>null!=r?r:{storeID:Tr(),getState:()=>a.current,replaceState:l,getGraph:n,subscribeToTransactions:o,addTransactionMetadata:s}));null!=r&&(f.current=r),a=Ar((()=>null!=t?function(t,e){const r=Cr();return e({set:(e,i)=>{const a=r.currentTree,n=jr(t,a,e.key,i),o=new Set(n.keys()),s=a.nonvalidatedAtoms.clone();for(const t of o)s.delete(t);r.currentTree={...a,dirtyAtoms:Fr(a.dirtyAtoms,o),atomValues:Rr(a.atomValues,n),nonvalidatedAtoms:s}},setUnvalidatedAtomValues:t=>{t.forEach(((t,e)=>{r.currentTree=Pr(r.currentTree,e,t)}))}}),r}(f.current,t):null!=e?function(t){const e=Ir(t),r=e.getStore_INTERNAL().getState();return e.retain(),r.nodeCleanupFunctions.forEach((t=>t())),r.nodeCleanupFunctions.clear(),r}(e):Cr()));const d=Kr((()=>null==qr?void 0:qr(a,(()=>a.current.currentTree.version))),[a]);return Ur((()=>{const t=f.current;for(const e of new Set(t.getState().knownAtoms))Or(t,e,"get");return()=>{for(const e of t.getState().knownAtoms)Sr(t,e)}}),[f]),p.createElement(Zr.Provider,{value:f},p.createElement(ti.Provider,{value:d},p.createElement(ii,{setNotifyBatcherOfChange:u}),i))}var oi={RecoilRoot:function(t){const{override:e,...r}=t,i=Xr();return!1===e&&i.current!==Yr?t.children:p.createElement(ni,r)},useStoreRef:Xr,useRecoilMutableSource:function(){const t=Hr(ti);return null==t&&st("Attempted to use a Recoil hook outside of a <RecoilRoot>. <RecoilRoot> must be an ancestor of any component that uses Recoil hooks."),t},useRecoilStoreID:function(){return Xr().current.storeID},notifyComponents_FOR_TESTING:ei,sendEndOfBatchNotifications_FOR_TESTING:ri};const{useEffect:si,useRef:li}=p;var ci=function(t){const e=li();return si((()=>{e.current=t})),e.current};const{useStoreRef:ui}=oi,{SUSPENSE_TIMEOUT_MS:fi}=ze,{updateRetainCount:pi}=ze,{RetentionZone:di}=Rt,{useEffect:mi,useRef:yi}=p,{isSSR:vi}=Ge;var hi=function(t){if(K("recoil_memory_managament_2020"))return function(t){const e=(Array.isArray(t)?t:[t]).map((t=>t instanceof di?t:t.key)),r=ui();mi((()=>{if(!K("recoil_memory_managament_2020"))return;const t=r.current;if(i.current&&!vi)window.clearTimeout(i.current),i.current=null;else for(const r of e)pi(t,r,1);return()=>{for(const r of e)pi(t,r,-1)}}),[r,...e]);const i=yi(),a=ci(e);if(!(vi||void 0!==a&&function(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let r=0,i=t.length;r<i;r++)if(t[r]!==e[r])return!1;return!0}(a,e))){const t=r.current;for(const r of e)pi(t,r,1);if(a)for(const e of a)pi(t,e,-1);i.current&&window.clearTimeout(i.current),i.current=window.setTimeout((()=>{i.current=null;for(const r of e)pi(t,r,-1)}),fi)}}(t)},gi=function(){return"<component name not available>"};const{batchUpdates:bi}=He,{DEFAULT_VALUE:ki}=ht,{currentRendererSupportsUseSyncExternalStore:_i,reactMode:xi,useMutableSource:wi,useSyncExternalStore:Fi}=J,{useRecoilMutableSource:Ei,useStoreRef:Ai}=oi,{isRecoilValue:Di}=ot,{AbstractRecoilValue:Ci,getRecoilValueAsLoadable:Si,setRecoilValue:Bi,setUnvalidatedRecoilValue:Oi,subscribeToRecoilValue:ji}=we,{useCallback:Pi,useEffect:Ni,useMemo:zi,useRef:Ti,useState:qi}=p,{setByAddingToSet:Mi}=Lt,{isSSR:Ri}=Ge;function Li(t,e,r){if("hasValue"===t.state)return t.contents;if("loading"===t.state)throw new Promise((e=>{const i=r.current.getState().suspendedComponentResolvers;i.add(e),Ri&&y(t.contents)&&t.contents.finally((()=>{i.delete(e)}))}));throw"hasError"===t.state?t.contents:m(`Invalid value of loadable atom "${e.key}"`)}function Ii(t){const e=Ai(),r=gi(),i=Pi((()=>{var r;const i=e.current,a=i.getState(),n=xi().early&&null!==(r=a.nextTree)&&void 0!==r?r:a.currentTree;return{loadable:Si(i,t,n),key:t.key}}),[e,t]),a=Pi((t=>{let e;return()=>{var r,i;const a=t();return null!==(r=e)&&void 0!==r&&r.loadable.is(a.loadable)&&(null===(i=e)||void 0===i?void 0:i.key)===a.key?e:(e=a,a)}}),[]),n=zi((()=>a(i)),[i,a]),o=Pi((i=>{const a=e.current;return ji(a,t,i,r).release}),[e,t,r]);return Fi(o,n,n).loadable}function Vi(t){const e=Ai(),r=Pi((()=>{var r;const i=e.current,a=i.getState(),n=xi().early&&null!==(r=a.nextTree)&&void 0!==r?r:a.currentTree;return Si(i,t,n)}),[e,t]),i=Pi((()=>r()),[r]),a=gi(),n=Pi(((i,n)=>{const o=e.current;return ji(o,t,(()=>{if(!K("recoil_suppress_rerender_in_callback"))return n();const t=r();l.current.is(t)||n(),l.current=t}),a).release}),[e,t,a,r]),o=Ei();if(null==o)throw m("Recoil hooks must be used in components contained within a <RecoilRoot> component.");const s=wi(o,i,n),l=Ti(s);return Ni((()=>{l.current=s})),s}function Hi(t){const e=Ai(),r=gi(),i=Pi((()=>{var r;const i=e.current,a=i.getState(),n=xi().early&&null!==(r=a.nextTree)&&void 0!==r?r:a.currentTree;return Si(i,t,n)}),[e,t]),a=Pi((()=>({loadable:i(),key:t.key})),[i,t.key]),n=Pi((t=>{const e=a();return t.loadable.is(e.loadable)&&t.key===e.key?t:e}),[a]);Ni((()=>{const i=ji(e.current,t,(t=>{s(n)}),r);return s(n),i.release}),[r,t,e,n]);const[o,s]=qi(a);return o.key!==t.key?a().loadable:o.loadable}function Ui(t){const e=Ai(),[,r]=qi([]),i=gi(),a=Pi((()=>{var r;const i=e.current,a=i.getState(),n=xi().early&&null!==(r=a.nextTree)&&void 0!==r?r:a.currentTree;return Si(i,t,n)}),[e,t]),n=a(),o=Ti(n);return Ni((()=>{o.current=n})),Ni((()=>{const n=e.current,s=n.getState(),l=ji(n,t,(t=>{var e;if(!K("recoil_suppress_rerender_in_callback"))return r([]);const i=a();null!==(e=o.current)&&void 0!==e&&e.is(i)||r(i),o.current=i}),i);if(s.nextTree)n.getState().queuedComponentCallbacks_DEPRECATED.push((()=>{o.current=null,r([])}));else{var c;if(!K("recoil_suppress_rerender_in_callback"))return r([]);const t=a();null!==(c=o.current)&&void 0!==c&&c.is(t)||r(t),o.current=t}return l.release}),[i,a,t,e]),n}function Ki(t){return K("recoil_memory_managament_2020")&&hi(t),{TRANSITION_SUPPORT:Hi,SYNC_EXTERNAL_STORE:_i()?Ii:Hi,MUTABLE_SOURCE:Vi,LEGACY:Ui}[xi().mode](t)}function Wi(t){const e=Ai();return Li(Ki(t),t,e)}function Gi(t){const e=Ai();return Pi((r=>{Bi(e.current,t,r)}),[e,t])}function $i(t){return K("recoil_memory_managament_2020")&&hi(t),Hi(t)}function Yi(t){const e=Ai();return Li($i(t),t,e)}var Qi={recoilComponentGetRecoilValueCount_FOR_TESTING:{current:0},useRecoilInterface:function(){const t=gi(),e=Ai(),[,r]=qi([]),i=Ti(new Set);i.current=new Set;const a=Ti(new Set),n=Ti(new Map),o=Pi((t=>{const e=n.current.get(t);e&&(e.release(),n.current.delete(t))}),[n]),s=Pi(((t,e)=>{n.current.has(e)&&r([])}),[]);return Ni((()=>{const r=e.current;Et(i.current,a.current).forEach((e=>{if(n.current.has(e))return void st(`Double subscription to RecoilValue "${e}"`);const i=ji(r,new Ci(e),(t=>s(t,e)),t);n.current.set(e,i),r.getState().nextTree?r.getState().queuedComponentCallbacks_DEPRECATED.push((()=>{s(r.getState(),e)})):s(r.getState(),e)})),Et(a.current,i.current).forEach((t=>{o(t)})),a.current=i.current})),Ni((()=>{const r=n.current;return Et(i.current,new Set(r.keys())).forEach((i=>{const a=ji(e.current,new Ci(i),(t=>s(t,i)),t);r.set(i,a)})),()=>r.forEach(((t,e)=>o(e)))}),[t,e,o,s]),zi((()=>{function t(t){return r=>{Bi(e.current,t,r)}}function r(t){var r;i.current.has(t.key)||(i.current=Mi(i.current,t.key));const a=e.current.getState();return Si(e.current,t,xi().early&&null!==(r=a.nextTree)&&void 0!==r?r:a.currentTree)}function a(t){return Li(r(t),t,e)}return{getRecoilValue:a,getRecoilValueLoadable:r,getRecoilState:function(e){return[a(e),t(e)]},getRecoilStateLoadable:function(e){return[r(e),t(e)]},getSetRecoilState:t,getResetRecoilState:function(t){return()=>Bi(e.current,t,ki)}}}),[i,e])},useRecoilState:function(t){return[Wi(t),Gi(t)]},useRecoilStateLoadable:function(t){return[Ki(t),Gi(t)]},useRecoilValue:Wi,useRecoilValueLoadable:Ki,useResetRecoilState:function(t){const e=Ai();return Pi((()=>{Bi(e.current,t,ki)}),[e,t])},useSetRecoilState:Gi,useSetUnvalidatedAtomValues:function(){const t=Ai();return(e,r={})=>{bi((()=>{t.current.addTransactionMetadata(r),e.forEach(((e,r)=>Oi(t.current,new Ci(r),e)))}))}},useRecoilValueLoadable_TRANSITION_SUPPORT_UNSTABLE:$i,useRecoilValue_TRANSITION_SUPPORT_UNSTABLE:Yi,useRecoilState_TRANSITION_SUPPORT_UNSTABLE:function(t){return[Yi(t),Gi(t)]}};const{batchUpdates:Ji}=He,{DEFAULT_VALUE:Zi,getNode:Xi,nodes:ta}=ht,{useStoreRef:ea}=oi,{AbstractRecoilValue:ra,setRecoilValueLoadable:ia}=we,{SUSPENSE_TIMEOUT_MS:aa}=ze,{cloneSnapshot:na}=wr,{useCallback:oa,useEffect:sa,useRef:la,useState:ca}=p,{isSSR:ua}=Ge;function fa(t){const e=ea();sa((()=>e.current.subscribeToTransactions(t).release),[t,e])}function pa(t){const e=t.atomValues.toMap(),r=At(function(t,e){const r=new Map;for(const[i,a]of t)e(a,i)&&r.set(i,a);return r}(e,((t,e)=>{const r=Xi(e).persistence_UNSTABLE;return null!=r&&"none"!==r.type&&"hasValue"===t.state})),(t=>t.contents));return function(...t){const e=new Map;for(let r=0;r<t.length;r++){const i=t[r].keys();let a;for(;!(a=i.next()).done;)e.set(a.value,t[r].get(a.value))}return e}(t.nonvalidatedAtoms.toMap(),r)}function da(t,e){var r;const i=t.getState(),a=null!==(r=i.nextTree)&&void 0!==r?r:i.currentTree,n=e.getStore_INTERNAL().getState().currentTree;Ji((()=>{const r=new Set;for(const t of[a.atomValues.keys(),n.atomValues.keys()])for(const e of t){var i,o;(null===(i=a.atomValues.get(e))||void 0===i?void 0:i.contents)!==(null===(o=n.atomValues.get(e))||void 0===o?void 0:o.contents)&&Xi(e).shouldRestoreFromSnapshots&&r.add(e)}r.forEach((e=>{ia(t,new ra(e),n.atomValues.has(e)?v(n.atomValues.get(e)):Zi)})),t.replaceState((t=>({...t,stateID:e.getID()})))}))}var ma={useRecoilSnapshot:function(){const t=ea(),[e,r]=ca((()=>na(t.current))),i=ci(e),a=la(),n=la();var o;(fa(oa((t=>r(na(t))),[])),sa((()=>{const t=e.retain();var r;return a.current&&!ua&&(window.clearTimeout(a.current),a.current=null,null===(r=n.current)||void 0===r||r.call(n),n.current=null),()=>{window.setTimeout(t,10)}}),[e]),i===e||ua)||(a.current&&(window.clearTimeout(a.current),a.current=null,null===(o=n.current)||void 0===o||o.call(n),n.current=nul