state-jet 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("react"),t=Symbol.for("immer-nothing"),r=Symbol.for("immer-draftable"),n=Symbol.for("immer-state"),o="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function a(e,...t){if("production"!==process.env.NODE_ENV){const r=o[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var s=Object.getPrototypeOf;function i(e){return!!e&&!!e[n]}function c(e){return!!e&&(f(e)||Array.isArray(e)||!!e[r]||!!e.constructor?.[r]||y(e)||h(e))}var u=Object.prototype.constructor.toString();function f(e){if(!e||"object"!=typeof e)return!1;const t=s(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===u}function l(e,t){0===p(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function p(e){const t=e[n];return t?t.type_:Array.isArray(e)?1:y(e)?2:h(e)?3:0}function _(e,t){return 2===p(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function d(e,t,r){const n=p(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function y(e){return e instanceof Map}function h(e){return e instanceof Set}function b(e){return e.copy_||e.base_}function m(e,t){if(y(e))return new Map(e);if(h(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=f(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[n];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(s(e),t)}{const t=s(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function S(e,t=!1){return g(e)||i(e)||!c(e)||(p(e)>1&&(e.set=e.add=e.clear=e.delete=v),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>S(t,!0)))),e}function v(){a(2)}function g(e){return Object.isFrozen(e)}var O,w={};function E(e){const t=w[e];return t||a(0,e),t}function T(){return O}function D(e,t){t&&(E("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function A(e){P(e),e.drafts_.forEach(x),e.drafts_=null}function P(e){e===O&&(O=e.parent_)}function j(e){return O=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(O,e)}function x(e){const t=e[n];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function N(e,r){r.unfinalizedDrafts_=r.drafts_.length;const o=r.drafts_[0];return void 0!==e&&e!==o?(o[n].modified_&&(A(r),a(4)),c(e)&&(e=z(r,e),r.parent_||F(r,e)),r.patches_&&E("Patches").generateReplacementPatches_(o[n].base_,e,r.patches_,r.inversePatches_)):e=z(r,o,[]),A(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==t?e:void 0}function z(e,t,r){if(g(t))return t;const o=t[n];if(!o)return l(t,((n,a)=>L(e,o,t,n,a,r))),t;if(o.scope_!==e)return t;if(!o.modified_)return F(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let n=t,a=!1;3===o.type_&&(n=new Set(t),t.clear(),a=!0),l(n,((n,s)=>L(e,o,t,n,s,r,a))),F(e,t,!1),r&&e.patches_&&E("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function L(e,t,r,n,o,s,u){if("production"!==process.env.NODE_ENV&&o===r&&a(5),i(o)){const a=z(e,o,s&&t&&3!==t.type_&&!_(t.assigned_,n)?s.concat(n):void 0);if(d(r,n,a),!i(a))return;e.canAutoFreeze_=!1}else u&&r.add(o);if(c(o)&&!g(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;z(e,o),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&F(e,o)}}function F(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&S(t,r)}var I={get(e,t){if(t===n)return e;const r=b(e);if(!_(r,t))return function(e,t,r){const n=M(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const o=r[t];return e.finalized_||!c(o)?o:o===C(e.base_,t)?(K(e),e.copy_[t]=k(o,e)):o},has:(e,t)=>t in b(e),ownKeys:e=>Reflect.ownKeys(b(e)),set(e,t,r){const o=M(b(e),t);if(o?.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const o=C(b(e),t),a=o?.[n];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||_(e.base_,t)))return!0;K(e),R(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==C(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,K(e),R(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=b(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){a(11)},getPrototypeOf:e=>s(e.base_),setPrototypeOf(){a(12)}},V={};function C(e,t){const r=e[n];return(r?b(r):e)[t]}function M(e,t){if(!(t in e))return;let r=s(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=s(r)}}function R(e){e.modified_||(e.modified_=!0,e.parent_&&R(e.parent_))}function K(e){e.copy_||(e.copy_=m(e.base_,e.scope_.immer_.useStrictShallowCopy_))}l(I,((e,t)=>{V[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),V.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&a(13),V.set.call(this,e,t,void 0)},V.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&a(14),I.set.call(this,e[0],t,r,e[0])};function k(e,t){const r=y(e)?E("MapSet").proxyMap_(e,t):h(e)?E("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:T(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=I;r&&(o=[n],a=V);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}(e,t);return(t?t.scope_:T()).drafts_.push(r),r}function J(e){if(!c(e)||g(e))return e;const t=e[n];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=m(e,t.scope_.immer_.useStrictShallowCopy_)}else r=m(e,!0);return l(r,((e,t)=>{d(r,e,J(t))})),t&&(t.finalized_=!1),r}var G=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,r,n)=>{if("function"==typeof e&&"function"!=typeof r){const t=r;r=e;const n=this;return function(e=t,...o){return n.produce(e,(e=>r.call(this,e,...o)))}}let o;if("function"!=typeof r&&a(6),void 0!==n&&"function"!=typeof n&&a(7),c(e)){const t=j(this),a=k(e,void 0);let s=!0;try{o=r(a),s=!1}finally{s?A(t):P(t)}return D(t,n),N(o,t)}if(!e||"object"!=typeof e){if(o=r(e),void 0===o&&(o=e),o===t&&(o=void 0),this.autoFreeze_&&S(o,!0),n){const t=[],r=[];E("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}a(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){c(e)||a(8),i(e)&&(e=function(e){return i(e)||a(10,e),J(e)}(e));const t=j(this),r=k(e,void 0);return r[n].isManual_=!0,P(t),r}finishDraft(e,t){const r=e&&e[n];(!r||!r.isManual_)&&a(9);const{scope_:o}=r;return D(o,t),N(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=E("Patches").applyPatches_;return i(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},U=G.produce;G.produceWithPatches.bind(G),G.setAutoFreeze.bind(G),G.setUseStrictShallowCopy.bind(G),G.applyPatches.bind(G),G.createDraft.bind(G),G.finishDraft.bind(G);const $=(()=>{if("object"==typeof globalThis&&globalThis)return globalThis;if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;if(typeof global<"u"&&"object"==typeof global&&global)return global;throw new Error("Unable to locate global `this`")})(),B=(e,t)=>{typeof $<"u"&&$.localStorage.setItem(e,JSON.stringify(t))},H=(e,t)=>{if(typeof $<"u"){const r=$.localStorage.getItem(e);return r?JSON.parse(r):t}return t},q=(e,t)=>{typeof $<"u"&&$.localStorage.setItem(e,(e=>btoa(JSON.stringify(e)))(t))},W=(e,t)=>{if(typeof $<"u"){const r=$.localStorage.getItem(e);return r?(e=>JSON.parse(atob(e)))(r):t}return t};var X,Y={exports:{}},Q={};
1
+ "use strict";var e=require("react"),t=Symbol.for("immer-nothing"),r=Symbol.for("immer-draftable"),n=Symbol.for("immer-state"),o="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function a(e,...t){if("production"!==process.env.NODE_ENV){const r=o[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var s=Object.getPrototypeOf;function i(e){return!!e&&!!e[n]}function c(e){return!!e&&(f(e)||Array.isArray(e)||!!e[r]||!!e.constructor?.[r]||y(e)||h(e))}var u=Object.prototype.constructor.toString();function f(e){if(!e||"object"!=typeof e)return!1;const t=s(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===u}function l(e,t){0===p(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function p(e){const t=e[n];return t?t.type_:Array.isArray(e)?1:y(e)?2:h(e)?3:0}function _(e,t){return 2===p(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function d(e,t,r){const n=p(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function y(e){return e instanceof Map}function h(e){return e instanceof Set}function b(e){return e.copy_||e.base_}function m(e,t){if(y(e))return new Map(e);if(h(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=f(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[n];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(s(e),t)}{const t=s(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function S(e,t=!1){return v(e)||i(e)||!c(e)||(p(e)>1&&(e.set=e.add=e.clear=e.delete=g),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>S(t,!0)))),e}function g(){a(2)}function v(e){return Object.isFrozen(e)}var O,w={};function E(e){const t=w[e];return t||a(0,e),t}function P(){return O}function D(e,t){t&&(E("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function A(e){j(e),e.drafts_.forEach(T),e.drafts_=null}function j(e){e===O&&(O=e.parent_)}function x(e){return O=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(O,e)}function T(e){const t=e[n];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function N(e,r){r.unfinalizedDrafts_=r.drafts_.length;const o=r.drafts_[0];return void 0!==e&&e!==o?(o[n].modified_&&(A(r),a(4)),c(e)&&(e=z(r,e),r.parent_||F(r,e)),r.patches_&&E("Patches").generateReplacementPatches_(o[n].base_,e,r.patches_,r.inversePatches_)):e=z(r,o,[]),A(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==t?e:void 0}function z(e,t,r){if(v(t))return t;const o=t[n];if(!o)return l(t,((n,a)=>L(e,o,t,n,a,r))),t;if(o.scope_!==e)return t;if(!o.modified_)return F(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let n=t,a=!1;3===o.type_&&(n=new Set(t),t.clear(),a=!0),l(n,((n,s)=>L(e,o,t,n,s,r,a))),F(e,t,!1),r&&e.patches_&&E("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function L(e,t,r,n,o,s,u){if("production"!==process.env.NODE_ENV&&o===r&&a(5),i(o)){const a=z(e,o,s&&t&&3!==t.type_&&!_(t.assigned_,n)?s.concat(n):void 0);if(d(r,n,a),!i(a))return;e.canAutoFreeze_=!1}else u&&r.add(o);if(c(o)&&!v(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;z(e,o),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&F(e,o)}}function F(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&S(t,r)}var I={get(e,t){if(t===n)return e;const r=b(e);if(!_(r,t))return function(e,t,r){const n=M(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const o=r[t];return e.finalized_||!c(o)?o:o===V(e.base_,t)?(K(e),e.copy_[t]=k(o,e)):o},has:(e,t)=>t in b(e),ownKeys:e=>Reflect.ownKeys(b(e)),set(e,t,r){const o=M(b(e),t);if(o?.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const o=V(b(e),t),a=o?.[n];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||_(e.base_,t)))return!0;K(e),R(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==V(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,K(e),R(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=b(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){a(11)},getPrototypeOf:e=>s(e.base_),setPrototypeOf(){a(12)}},C={};function V(e,t){const r=e[n];return(r?b(r):e)[t]}function M(e,t){if(!(t in e))return;let r=s(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=s(r)}}function R(e){e.modified_||(e.modified_=!0,e.parent_&&R(e.parent_))}function K(e){e.copy_||(e.copy_=m(e.base_,e.scope_.immer_.useStrictShallowCopy_))}l(I,((e,t)=>{C[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),C.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&a(13),C.set.call(this,e,t,void 0)},C.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&a(14),I.set.call(this,e[0],t,r,e[0])};function k(e,t){const r=y(e)?E("MapSet").proxyMap_(e,t):h(e)?E("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:P(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=I;r&&(o=[n],a=C);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}(e,t);return(t?t.scope_:P()).drafts_.push(r),r}function G(e){if(!c(e)||v(e))return e;const t=e[n];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=m(e,t.scope_.immer_.useStrictShallowCopy_)}else r=m(e,!0);return l(r,((e,t)=>{d(r,e,G(t))})),t&&(t.finalized_=!1),r}var U=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,r,n)=>{if("function"==typeof e&&"function"!=typeof r){const t=r;r=e;const n=this;return function(e=t,...o){return n.produce(e,(e=>r.call(this,e,...o)))}}let o;if("function"!=typeof r&&a(6),void 0!==n&&"function"!=typeof n&&a(7),c(e)){const t=x(this),a=k(e,void 0);let s=!0;try{o=r(a),s=!1}finally{s?A(t):j(t)}return D(t,n),N(o,t)}if(!e||"object"!=typeof e){if(o=r(e),void 0===o&&(o=e),o===t&&(o=void 0),this.autoFreeze_&&S(o,!0),n){const t=[],r=[];E("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}a(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){c(e)||a(8),i(e)&&(e=function(e){return i(e)||a(10,e),G(e)}(e));const t=x(this),r=k(e,void 0);return r[n].isManual_=!0,j(t),r}finishDraft(e,t){const r=e&&e[n];(!r||!r.isManual_)&&a(9);const{scope_:o}=r;return D(o,t),N(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=E("Patches").applyPatches_;return i(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},$=U.produce;U.produceWithPatches.bind(U),U.setAutoFreeze.bind(U),U.setUseStrictShallowCopy.bind(U),U.applyPatches.bind(U),U.createDraft.bind(U),U.finishDraft.bind(U);const B=(()=>{if("object"==typeof globalThis&&globalThis)return globalThis;if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;if(typeof global<"u"&&"object"==typeof global&&global)return global;throw new Error("Unable to locate global `this`")})(),H=(e,t)=>{typeof B?.localStorage<"u"&&B.localStorage.setItem(e,JSON.stringify(t))},J=(e,t)=>{if(typeof B?.localStorage<"u"){const r=B.localStorage?.getItem(e);return r?JSON.parse(r):t}return t},q=(e,t)=>{typeof B?.localStorage<"u"&&B.localStorage.setItem(e,(e=>btoa(JSON.stringify(e)))(t))},W=(e,t)=>{if(typeof B?.localStorage<"u"){const r=B.localStorage?.getItem(e);return r?(e=>JSON.parse(atob(e)))(r):t}return t};var X,Y={exports:{}},Q={};
2
2
  /**
3
3
  * @license React
4
4
  * use-sync-external-store-shim.production.js
@@ -16,4 +16,4 @@
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */var re=(ee||(ee=1,"production"===process.env.NODE_ENV?Y.exports=function(){if(X)return Q;X=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),u=c[0].inst,f=c[1];return a((function(){u.value=r,u.getSnapshot=t,i(u)&&f({inst:u})}),[e,r,t]),o((function(){return i(u)&&f({inst:u}),e((function(){i(u)&&f({inst:u})}))}),[e]),s(r),r};return Q.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,Q}():Y.exports=(Z||(Z=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,a=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,f){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=f();if(!u){var p=f();n(l,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var _=(p=o({inst:{value:l,getSnapshot:f}}))[0].inst,d=p[1];return s((function(){_.value=l,_.getSnapshot=f,t(_)&&d({inst:_})}),[e,l,f]),a((function(){return t(_)&&d({inst:_}),e((function(){t(_)&&d({inst:_})}))}),[e]),i(l),l};te.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),te)),Y.exports);const ne={},oe={},ae={},se=typeof window<"u"&&window.__STATE_JET_DEVTOOLS__,ie=new Map,ce=new Map,ue={},fe=(e,t)=>({...e,...t,lastUpdated:Date.now()});exports.derivedState=(e,t)=>()=>{const r=e.map((e=>e.useStore()));return t(...r)},exports.mergeCRDT=fe,exports.optimisticUpdate=async(e,t,r,n)=>{const o=e.useStore(),a=t(o);e.set(a);try{await r()}catch(t){console.error("API request failed:",t),e.set(n?n(o):o)}},exports.restoreEncryptedState=W,exports.restoreState=H,exports.saveEncryptedState=q,exports.saveState=B,exports.syncCRDT=(e,t)=>{const r=t.useStore(),n=fe(r,e);t.set(n)},exports.useStateGlobal=(e,t,r)=>{ie.has(e)||(ie.set(e,{value:t,listeners:new Set}),r?.persist&&(r?.encrypt?W(e,t):H(e,t)));const n=ie.get(e),o=()=>{ce.forEach(((e,t)=>{let o=e;const a=n.value;ue[t]||(ue[t]={past:[],present:a,future:[]}),ue[t].past.push(a),ue[t].present=e,ue[t].future=[],r?.middleware?.forEach((e=>{const r=e(t,a,o);void 0!==r&&(o=r)})),"function"==typeof o?n.value=U(n.value,o):a!==o&&(n.value=o,n.listeners.forEach((e=>e())),((e,t)=>{ne[e]||(ne[e]=[]),void 0===oe[e]&&(oe[e]=-1),ne[e]=ne[e].slice(0,oe[e]+1),ne[e].push(t),oe[e]++,se&&window.__STATE_JET_DEVTOOLS__?.updateState&&window.__STATE_JET_DEVTOOLS__.updateState(e,t,ne[e])})(t,o),((e,t)=>{const r=performance.now();t();const n=performance.now()-r;ae[e]||(ae[e]=[]),ae[e].push(n),se&&window.__STATE_JET_DEVTOOLS__?.updatePerformance&&window.__STATE_JET_DEVTOOLS__.updatePerformance(e,n)})(t,(()=>{})),r?.persist&&(r?.encrypt?q(t,o):B(t,o)))})),ce.clear()};return{useStore:()=>re.useSyncExternalStore((e=>(n.listeners.add(e),()=>n.listeners.delete(e))),(()=>n.value)),set:t=>{ce.set(e,t),$?.requestAnimationFrame&&$.requestAnimationFrame(o)},undo:()=>{ue[e]?.past.length&&(ue[e].future.unshift(ue[e].present),ue[e].present=ue[e].past.pop(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]>0)oe[e]--,ne[e][oe[e]]})(e))},redo:()=>{ue[e]?.future.length&&(ue[e].past.push(ue[e].present),ue[e].present=ue[e].future.shift(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]<ne[e].length-1)oe[e]++,ne[e][oe[e]]})(e))}}};
19
+ */var re=(ee||(ee=1,"production"===process.env.NODE_ENV?Y.exports=function(){if(X)return Q;X=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),u=c[0].inst,f=c[1];return a((function(){u.value=r,u.getSnapshot=t,i(u)&&f({inst:u})}),[e,r,t]),o((function(){return i(u)&&f({inst:u}),e((function(){i(u)&&f({inst:u})}))}),[e]),s(r),r};return Q.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,Q}():Y.exports=(Z||(Z=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,a=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,f){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=f();if(!u){var p=f();n(l,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var _=(p=o({inst:{value:l,getSnapshot:f}}))[0].inst,d=p[1];return s((function(){_.value=l,_.getSnapshot=f,t(_)&&d({inst:_})}),[e,l,f]),a((function(){return t(_)&&d({inst:_}),e((function(){t(_)&&d({inst:_})}))}),[e]),i(l),l};te.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),te)),Y.exports);const ne={},oe={},ae={},se=B.__STATE_JET_DEVTOOLS__,ie=new Map,ce=new Map,ue={},fe=(e,t)=>({...e,...t,lastUpdated:Date.now()});exports.derivedState=(e,t)=>()=>{const r=e.map((e=>e.useStore()));return t(...r)},exports.mergeCRDT=fe,exports.optimisticUpdate=async(e,t,r,n)=>{const o=e.useStore(),a=t(o);e.set(a);try{await r()}catch(t){console.error("API request failed:",t),e.set(n?n(o):o)}},exports.restoreEncryptedState=W,exports.restoreState=J,exports.saveEncryptedState=q,exports.saveState=H,exports.syncCRDT=(e,t)=>{const r=t.useStore(),n=fe(r,e);t.set(n)},exports.useStateGlobal=(e,t,r)=>{ie.has(e)||(ie.set(e,{value:t,listeners:new Set}),r?.persist&&(r?.encrypt?W(e,t):J(e,t)));const n=ie.get(e),o=()=>{ce.forEach(((e,t)=>{let o=e;const a=n.value;ue[t]||(ue[t]={past:[],present:a,future:[]}),ue[t].past.push(a),ue[t].present=e,ue[t].future=[],r?.middleware?.forEach((e=>{const r=e(t,a,o);void 0!==r&&(o=r)})),"function"==typeof o?n.value=$(n.value,o):a!==o&&(n.value=o,n.listeners.forEach((e=>e())),((e,t)=>{ne[e]||(ne[e]=[]),void 0===oe[e]&&(oe[e]=-1),ne[e]=ne[e].slice(0,oe[e]+1),ne[e].push(t),oe[e]++,se?.updateState&&se.updateState(e,t,[...ne[e]])})(t,o),((e,t)=>{ae[e]||(ae[e]=[]);const r=performance.now();t();const n=performance.now()-r;ae[e].push(n),se?.updatePerformance&&se.updatePerformance(e,n)})(t,(()=>{})),r?.persist&&(r?.encrypt?q(t,o):H(t,o)))})),ce.clear()};return{useStore:()=>re.useSyncExternalStore((e=>(n.listeners.add(e),()=>n.listeners.delete(e))),(()=>n.value)),set:t=>{ce.set(e,t),B?.requestAnimationFrame&&B.requestAnimationFrame(o)},undo:()=>{ue[e]?.past.length&&(ue[e].future.unshift(ue[e].present),ue[e].present=ue[e].past.pop(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]>0)oe[e]--,ne[e][oe[e]]})(e))},redo:()=>{ue[e]?.future.length&&(ue[e].past.push(ue[e].present),ue[e].present=ue[e].future.shift(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]<ne[e]?.length-1)oe[e]++,ne[e][oe[e]]})(e))}}};
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import e from"react";var t=Symbol.for("immer-nothing"),r=Symbol.for("immer-draftable"),n=Symbol.for("immer-state"),o="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function a(e,...t){if("production"!==process.env.NODE_ENV){const r=o[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var s=Object.getPrototypeOf;function i(e){return!!e&&!!e[n]}function c(e){return!!e&&(f(e)||Array.isArray(e)||!!e[r]||!!e.constructor?.[r]||y(e)||h(e))}var u=Object.prototype.constructor.toString();function f(e){if(!e||"object"!=typeof e)return!1;const t=s(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===u}function l(e,t){0===p(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function p(e){const t=e[n];return t?t.type_:Array.isArray(e)?1:y(e)?2:h(e)?3:0}function _(e,t){return 2===p(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function d(e,t,r){const n=p(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function y(e){return e instanceof Map}function h(e){return e instanceof Set}function b(e){return e.copy_||e.base_}function m(e,t){if(y(e))return new Map(e);if(h(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=f(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[n];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(s(e),t)}{const t=s(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function S(e,t=!1){return g(e)||i(e)||!c(e)||(p(e)>1&&(e.set=e.add=e.clear=e.delete=v),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>S(t,!0)))),e}function v(){a(2)}function g(e){return Object.isFrozen(e)}var O,w={};function E(e){const t=w[e];return t||a(0,e),t}function T(){return O}function D(e,t){t&&(E("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function A(e){P(e),e.drafts_.forEach(N),e.drafts_=null}function P(e){e===O&&(O=e.parent_)}function j(e){return O=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(O,e)}function N(e){const t=e[n];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function z(e,r){r.unfinalizedDrafts_=r.drafts_.length;const o=r.drafts_[0];return void 0!==e&&e!==o?(o[n].modified_&&(A(r),a(4)),c(e)&&(e=L(r,e),r.parent_||F(r,e)),r.patches_&&E("Patches").generateReplacementPatches_(o[n].base_,e,r.patches_,r.inversePatches_)):e=L(r,o,[]),A(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==t?e:void 0}function L(e,t,r){if(g(t))return t;const o=t[n];if(!o)return l(t,((n,a)=>x(e,o,t,n,a,r))),t;if(o.scope_!==e)return t;if(!o.modified_)return F(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let n=t,a=!1;3===o.type_&&(n=new Set(t),t.clear(),a=!0),l(n,((n,s)=>x(e,o,t,n,s,r,a))),F(e,t,!1),r&&e.patches_&&E("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function x(e,t,r,n,o,s,u){if("production"!==process.env.NODE_ENV&&o===r&&a(5),i(o)){const a=L(e,o,s&&t&&3!==t.type_&&!_(t.assigned_,n)?s.concat(n):void 0);if(d(r,n,a),!i(a))return;e.canAutoFreeze_=!1}else u&&r.add(o);if(c(o)&&!g(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;L(e,o),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&F(e,o)}}function F(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&S(t,r)}var I={get(e,t){if(t===n)return e;const r=b(e);if(!_(r,t))return function(e,t,r){const n=M(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const o=r[t];return e.finalized_||!c(o)?o:o===C(e.base_,t)?(K(e),e.copy_[t]=k(o,e)):o},has:(e,t)=>t in b(e),ownKeys:e=>Reflect.ownKeys(b(e)),set(e,t,r){const o=M(b(e),t);if(o?.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const o=C(b(e),t),a=o?.[n];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||_(e.base_,t)))return!0;K(e),R(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==C(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,K(e),R(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=b(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){a(11)},getPrototypeOf:e=>s(e.base_),setPrototypeOf(){a(12)}},V={};function C(e,t){const r=e[n];return(r?b(r):e)[t]}function M(e,t){if(!(t in e))return;let r=s(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=s(r)}}function R(e){e.modified_||(e.modified_=!0,e.parent_&&R(e.parent_))}function K(e){e.copy_||(e.copy_=m(e.base_,e.scope_.immer_.useStrictShallowCopy_))}l(I,((e,t)=>{V[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),V.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&a(13),V.set.call(this,e,t,void 0)},V.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&a(14),I.set.call(this,e[0],t,r,e[0])};function k(e,t){const r=y(e)?E("MapSet").proxyMap_(e,t):h(e)?E("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:T(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=I;r&&(o=[n],a=V);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}(e,t);return(t?t.scope_:T()).drafts_.push(r),r}function J(e){if(!c(e)||g(e))return e;const t=e[n];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=m(e,t.scope_.immer_.useStrictShallowCopy_)}else r=m(e,!0);return l(r,((e,t)=>{d(r,e,J(t))})),t&&(t.finalized_=!1),r}var G=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,r,n)=>{if("function"==typeof e&&"function"!=typeof r){const t=r;r=e;const n=this;return function(e=t,...o){return n.produce(e,(e=>r.call(this,e,...o)))}}let o;if("function"!=typeof r&&a(6),void 0!==n&&"function"!=typeof n&&a(7),c(e)){const t=j(this),a=k(e,void 0);let s=!0;try{o=r(a),s=!1}finally{s?A(t):P(t)}return D(t,n),z(o,t)}if(!e||"object"!=typeof e){if(o=r(e),void 0===o&&(o=e),o===t&&(o=void 0),this.autoFreeze_&&S(o,!0),n){const t=[],r=[];E("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}a(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){c(e)||a(8),i(e)&&(e=function(e){return i(e)||a(10,e),J(e)}(e));const t=j(this),r=k(e,void 0);return r[n].isManual_=!0,P(t),r}finishDraft(e,t){const r=e&&e[n];(!r||!r.isManual_)&&a(9);const{scope_:o}=r;return D(o,t),z(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=E("Patches").applyPatches_;return i(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},U=G.produce;G.produceWithPatches.bind(G),G.setAutoFreeze.bind(G),G.setUseStrictShallowCopy.bind(G),G.applyPatches.bind(G),G.createDraft.bind(G),G.finishDraft.bind(G);const $=(()=>{if("object"==typeof globalThis&&globalThis)return globalThis;if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;if(typeof global<"u"&&"object"==typeof global&&global)return global;throw new Error("Unable to locate global `this`")})(),B=(e,t)=>{typeof $<"u"&&$.localStorage.setItem(e,JSON.stringify(t))},H=(e,t)=>{if(typeof $<"u"){const r=$.localStorage.getItem(e);return r?JSON.parse(r):t}return t},W=(e,t)=>{typeof $<"u"&&$.localStorage.setItem(e,(e=>btoa(JSON.stringify(e)))(t))},q=(e,t)=>{if(typeof $<"u"){const r=$.localStorage.getItem(e);return r?(e=>JSON.parse(atob(e)))(r):t}return t};var X,Y={exports:{}},Q={};
1
+ import e from"react";var t=Symbol.for("immer-nothing"),r=Symbol.for("immer-draftable"),n=Symbol.for("immer-state"),o="production"!==process.env.NODE_ENV?[function(e){return`The plugin for '${e}' has not been loaded into Immer. To enable the plugin, import and call \`enable${e}()\` when initializing your application.`},function(e){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${e}'`},"This object has been frozen and should not be mutated",function(e){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+e},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(e){return`'current' expects a draft, got: ${e}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(e){return`'original' expects a draft, got: ${e}`}]:[];function a(e,...t){if("production"!==process.env.NODE_ENV){const r=o[e],n="function"==typeof r?r.apply(null,t):r;throw new Error(`[Immer] ${n}`)}throw new Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var s=Object.getPrototypeOf;function i(e){return!!e&&!!e[n]}function c(e){return!!e&&(f(e)||Array.isArray(e)||!!e[r]||!!e.constructor?.[r]||y(e)||h(e))}var u=Object.prototype.constructor.toString();function f(e){if(!e||"object"!=typeof e)return!1;const t=s(e);if(null===t)return!0;const r=Object.hasOwnProperty.call(t,"constructor")&&t.constructor;return r===Object||"function"==typeof r&&Function.toString.call(r)===u}function l(e,t){0===p(e)?Reflect.ownKeys(e).forEach((r=>{t(r,e[r],e)})):e.forEach(((r,n)=>t(n,r,e)))}function p(e){const t=e[n];return t?t.type_:Array.isArray(e)?1:y(e)?2:h(e)?3:0}function _(e,t){return 2===p(e)?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function d(e,t,r){const n=p(e);2===n?e.set(t,r):3===n?e.add(r):e[t]=r}function y(e){return e instanceof Map}function h(e){return e instanceof Set}function b(e){return e.copy_||e.base_}function m(e,t){if(y(e))return new Map(e);if(h(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);const r=f(e);if(!0===t||"class_only"===t&&!r){const t=Object.getOwnPropertyDescriptors(e);delete t[n];let r=Reflect.ownKeys(t);for(let n=0;n<r.length;n++){const o=r[n],a=t[o];!1===a.writable&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[o]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[o]})}return Object.create(s(e),t)}{const t=s(e);if(null!==t&&r)return{...e};const n=Object.create(t);return Object.assign(n,e)}}function S(e,t=!1){return v(e)||i(e)||!c(e)||(p(e)>1&&(e.set=e.add=e.clear=e.delete=g),Object.freeze(e),t&&Object.entries(e).forEach((([e,t])=>S(t,!0)))),e}function g(){a(2)}function v(e){return Object.isFrozen(e)}var O,w={};function E(e){const t=w[e];return t||a(0,e),t}function P(){return O}function D(e,t){t&&(E("Patches"),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function A(e){j(e),e.drafts_.forEach(N),e.drafts_=null}function j(e){e===O&&(O=e.parent_)}function T(e){return O=function(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}(O,e)}function N(e){const t=e[n];0===t.type_||1===t.type_?t.revoke_():t.revoked_=!0}function z(e,r){r.unfinalizedDrafts_=r.drafts_.length;const o=r.drafts_[0];return void 0!==e&&e!==o?(o[n].modified_&&(A(r),a(4)),c(e)&&(e=L(r,e),r.parent_||F(r,e)),r.patches_&&E("Patches").generateReplacementPatches_(o[n].base_,e,r.patches_,r.inversePatches_)):e=L(r,o,[]),A(r),r.patches_&&r.patchListener_(r.patches_,r.inversePatches_),e!==t?e:void 0}function L(e,t,r){if(v(t))return t;const o=t[n];if(!o)return l(t,((n,a)=>x(e,o,t,n,a,r))),t;if(o.scope_!==e)return t;if(!o.modified_)return F(e,o.base_,!0),o.base_;if(!o.finalized_){o.finalized_=!0,o.scope_.unfinalizedDrafts_--;const t=o.copy_;let n=t,a=!1;3===o.type_&&(n=new Set(t),t.clear(),a=!0),l(n,((n,s)=>x(e,o,t,n,s,r,a))),F(e,t,!1),r&&e.patches_&&E("Patches").generatePatches_(o,r,e.patches_,e.inversePatches_)}return o.copy_}function x(e,t,r,n,o,s,u){if("production"!==process.env.NODE_ENV&&o===r&&a(5),i(o)){const a=L(e,o,s&&t&&3!==t.type_&&!_(t.assigned_,n)?s.concat(n):void 0);if(d(r,n,a),!i(a))return;e.canAutoFreeze_=!1}else u&&r.add(o);if(c(o)&&!v(o)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;L(e,o),(!t||!t.scope_.parent_)&&"symbol"!=typeof n&&Object.prototype.propertyIsEnumerable.call(r,n)&&F(e,o)}}function F(e,t,r=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&S(t,r)}var I={get(e,t){if(t===n)return e;const r=b(e);if(!_(r,t))return function(e,t,r){const n=M(t,r);return n?"value"in n?n.value:n.get?.call(e.draft_):void 0}(e,r,t);const o=r[t];return e.finalized_||!c(o)?o:o===V(e.base_,t)?(K(e),e.copy_[t]=k(o,e)):o},has:(e,t)=>t in b(e),ownKeys:e=>Reflect.ownKeys(b(e)),set(e,t,r){const o=M(b(e),t);if(o?.set)return o.set.call(e.draft_,r),!0;if(!e.modified_){const o=V(b(e),t),a=o?.[n];if(a&&a.base_===r)return e.copy_[t]=r,e.assigned_[t]=!1,!0;if(function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}(r,o)&&(void 0!==r||_(e.base_,t)))return!0;K(e),R(e)}return e.copy_[t]===r&&(void 0!==r||t in e.copy_)||Number.isNaN(r)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=r,e.assigned_[t]=!0),!0},deleteProperty:(e,t)=>(void 0!==V(e.base_,t)||t in e.base_?(e.assigned_[t]=!1,K(e),R(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0),getOwnPropertyDescriptor(e,t){const r=b(e),n=Reflect.getOwnPropertyDescriptor(r,t);return n&&{writable:!0,configurable:1!==e.type_||"length"!==t,enumerable:n.enumerable,value:r[t]}},defineProperty(){a(11)},getPrototypeOf:e=>s(e.base_),setPrototypeOf(){a(12)}},C={};function V(e,t){const r=e[n];return(r?b(r):e)[t]}function M(e,t){if(!(t in e))return;let r=s(e);for(;r;){const e=Object.getOwnPropertyDescriptor(r,t);if(e)return e;r=s(r)}}function R(e){e.modified_||(e.modified_=!0,e.parent_&&R(e.parent_))}function K(e){e.copy_||(e.copy_=m(e.base_,e.scope_.immer_.useStrictShallowCopy_))}l(I,((e,t)=>{C[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}})),C.deleteProperty=function(e,t){return"production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&a(13),C.set.call(this,e,t,void 0)},C.set=function(e,t,r){return"production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&a(14),I.set.call(this,e[0],t,r,e[0])};function k(e,t){const r=y(e)?E("MapSet").proxyMap_(e,t):h(e)?E("MapSet").proxySet_(e,t):function(e,t){const r=Array.isArray(e),n={type_:r?1:0,scope_:t?t.scope_:P(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1};let o=n,a=I;r&&(o=[n],a=C);const{revoke:s,proxy:i}=Proxy.revocable(o,a);return n.draft_=i,n.revoke_=s,i}(e,t);return(t?t.scope_:P()).drafts_.push(r),r}function G(e){if(!c(e)||v(e))return e;const t=e[n];let r;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,r=m(e,t.scope_.immer_.useStrictShallowCopy_)}else r=m(e,!0);return l(r,((e,t)=>{d(r,e,G(t))})),t&&(t.finalized_=!1),r}var U=new class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,r,n)=>{if("function"==typeof e&&"function"!=typeof r){const t=r;r=e;const n=this;return function(e=t,...o){return n.produce(e,(e=>r.call(this,e,...o)))}}let o;if("function"!=typeof r&&a(6),void 0!==n&&"function"!=typeof n&&a(7),c(e)){const t=T(this),a=k(e,void 0);let s=!0;try{o=r(a),s=!1}finally{s?A(t):j(t)}return D(t,n),z(o,t)}if(!e||"object"!=typeof e){if(o=r(e),void 0===o&&(o=e),o===t&&(o=void 0),this.autoFreeze_&&S(o,!0),n){const t=[],r=[];E("Patches").generateReplacementPatches_(e,o,t,r),n(t,r)}return o}a(1,e)},this.produceWithPatches=(e,t)=>{if("function"==typeof e)return(t,...r)=>this.produceWithPatches(t,(t=>e(t,...r)));let r,n;return[this.produce(e,t,((e,t)=>{r=e,n=t})),r,n]},"boolean"==typeof e?.autoFreeze&&this.setAutoFreeze(e.autoFreeze),"boolean"==typeof e?.useStrictShallowCopy&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){c(e)||a(8),i(e)&&(e=function(e){return i(e)||a(10,e),G(e)}(e));const t=T(this),r=k(e,void 0);return r[n].isManual_=!0,j(t),r}finishDraft(e,t){const r=e&&e[n];(!r||!r.isManual_)&&a(9);const{scope_:o}=r;return D(o,t),z(void 0,o)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let r;for(r=t.length-1;r>=0;r--){const n=t[r];if(0===n.path.length&&"replace"===n.op){e=n.value;break}}r>-1&&(t=t.slice(r+1));const n=E("Patches").applyPatches_;return i(e)?n(e,t):this.produce(e,(e=>n(e,t)))}},$=U.produce;U.produceWithPatches.bind(U),U.setAutoFreeze.bind(U),U.setUseStrictShallowCopy.bind(U),U.applyPatches.bind(U),U.createDraft.bind(U),U.finishDraft.bind(U);const B=(()=>{if("object"==typeof globalThis&&globalThis)return globalThis;if("object"==typeof self&&self)return self;if("object"==typeof window&&window)return window;if(typeof global<"u"&&"object"==typeof global&&global)return global;throw new Error("Unable to locate global `this`")})(),H=(e,t)=>{typeof B?.localStorage<"u"&&B.localStorage.setItem(e,JSON.stringify(t))},J=(e,t)=>{if(typeof B?.localStorage<"u"){const r=B.localStorage?.getItem(e);return r?JSON.parse(r):t}return t},W=(e,t)=>{typeof B?.localStorage<"u"&&B.localStorage.setItem(e,(e=>btoa(JSON.stringify(e)))(t))},q=(e,t)=>{if(typeof B?.localStorage<"u"){const r=B.localStorage?.getItem(e);return r?(e=>JSON.parse(atob(e)))(r):t}return t};var X,Y={exports:{}},Q={};
2
2
  /**
3
3
  * @license React
4
4
  * use-sync-external-store-shim.production.js
@@ -16,4 +16,4 @@ import e from"react";var t=Symbol.for("immer-nothing"),r=Symbol.for("immer-draft
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */var re=(ee||(ee=1,"production"===process.env.NODE_ENV?Y.exports=function(){if(X)return Q;X=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),u=c[0].inst,f=c[1];return a((function(){u.value=r,u.getSnapshot=t,i(u)&&f({inst:u})}),[e,r,t]),o((function(){return i(u)&&f({inst:u}),e((function(){i(u)&&f({inst:u})}))}),[e]),s(r),r};return Q.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,Q}():Y.exports=(Z||(Z=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,a=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,f){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=f();if(!u){var p=f();n(l,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var _=(p=o({inst:{value:l,getSnapshot:f}}))[0].inst,d=p[1];return s((function(){_.value=l,_.getSnapshot=f,t(_)&&d({inst:_})}),[e,l,f]),a((function(){return t(_)&&d({inst:_}),e((function(){t(_)&&d({inst:_})}))}),[e]),i(l),l};te.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),te)),Y.exports);const ne={},oe={},ae={},se=typeof window<"u"&&window.__STATE_JET_DEVTOOLS__,ie=new Map,ce=new Map,ue={},fe=(e,t,r)=>{ie.has(e)||(ie.set(e,{value:t,listeners:new Set}),r?.persist&&(r?.encrypt?q(e,t):H(e,t)));const n=ie.get(e),o=()=>{ce.forEach(((e,t)=>{let o=e;const a=n.value;ue[t]||(ue[t]={past:[],present:a,future:[]}),ue[t].past.push(a),ue[t].present=e,ue[t].future=[],r?.middleware?.forEach((e=>{const r=e(t,a,o);void 0!==r&&(o=r)})),"function"==typeof o?n.value=U(n.value,o):a!==o&&(n.value=o,n.listeners.forEach((e=>e())),((e,t)=>{ne[e]||(ne[e]=[]),void 0===oe[e]&&(oe[e]=-1),ne[e]=ne[e].slice(0,oe[e]+1),ne[e].push(t),oe[e]++,se&&window.__STATE_JET_DEVTOOLS__?.updateState&&window.__STATE_JET_DEVTOOLS__.updateState(e,t,ne[e])})(t,o),((e,t)=>{const r=performance.now();t();const n=performance.now()-r;ae[e]||(ae[e]=[]),ae[e].push(n),se&&window.__STATE_JET_DEVTOOLS__?.updatePerformance&&window.__STATE_JET_DEVTOOLS__.updatePerformance(e,n)})(t,(()=>{})),r?.persist&&(r?.encrypt?W(t,o):B(t,o)))})),ce.clear()};return{useStore:()=>re.useSyncExternalStore((e=>(n.listeners.add(e),()=>n.listeners.delete(e))),(()=>n.value)),set:t=>{ce.set(e,t),$?.requestAnimationFrame&&$.requestAnimationFrame(o)},undo:()=>{ue[e]?.past.length&&(ue[e].future.unshift(ue[e].present),ue[e].present=ue[e].past.pop(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]>0)oe[e]--,ne[e][oe[e]]})(e))},redo:()=>{ue[e]?.future.length&&(ue[e].past.push(ue[e].present),ue[e].present=ue[e].future.shift(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]<ne[e].length-1)oe[e]++,ne[e][oe[e]]})(e))}}},le=async(e,t,r,n)=>{const o=e.useStore(),a=t(o);e.set(a);try{await r()}catch(t){console.error("API request failed:",t),e.set(n?n(o):o)}},pe=(e,t)=>({...e,...t,lastUpdated:Date.now()}),_e=(e,t)=>{const r=t.useStore(),n=pe(r,e);t.set(n)},de=(e,t)=>()=>{const r=e.map((e=>e.useStore()));return t(...r)};export{de as derivedState,pe as mergeCRDT,le as optimisticUpdate,q as restoreEncryptedState,H as restoreState,W as saveEncryptedState,B as saveState,_e as syncCRDT,fe as useStateGlobal};
19
+ */var re=(ee||(ee=1,"production"===process.env.NODE_ENV?Y.exports=function(){if(X)return Q;X=1;var t=e,r="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=t.useState,o=t.useEffect,a=t.useLayoutEffect,s=t.useDebugValue;function i(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}var c=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,t){var r=t(),c=n({inst:{value:r,getSnapshot:t}}),u=c[0].inst,f=c[1];return a((function(){u.value=r,u.getSnapshot=t,i(u)&&f({inst:u})}),[e,r,t]),o((function(){return i(u)&&f({inst:u}),e((function(){i(u)&&f({inst:u})}))}),[e]),s(r),r};return Q.useSyncExternalStore=void 0!==t.useSyncExternalStore?t.useSyncExternalStore:c,Q}():Y.exports=(Z||(Z=1,"production"!==process.env.NODE_ENV&&function(){function t(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!n(e,r)}catch{return!0}}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var r=e,n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=r.useState,a=r.useEffect,s=r.useLayoutEffect,i=r.useDebugValue,c=!1,u=!1,f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?function(e,t){return t()}:function(e,f){c||void 0===r.startTransition||(c=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=f();if(!u){var p=f();n(l,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),u=!0)}var _=(p=o({inst:{value:l,getSnapshot:f}}))[0].inst,d=p[1];return s((function(){_.value=l,_.getSnapshot=f,t(_)&&d({inst:_})}),[e,l,f]),a((function(){return t(_)&&d({inst:_}),e((function(){t(_)&&d({inst:_})}))}),[e]),i(l),l};te.useSyncExternalStore=void 0!==r.useSyncExternalStore?r.useSyncExternalStore:f,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),te)),Y.exports);const ne={},oe={},ae={},se=B.__STATE_JET_DEVTOOLS__,ie=new Map,ce=new Map,ue={},fe=(e,t,r)=>{ie.has(e)||(ie.set(e,{value:t,listeners:new Set}),r?.persist&&(r?.encrypt?q(e,t):J(e,t)));const n=ie.get(e),o=()=>{ce.forEach(((e,t)=>{let o=e;const a=n.value;ue[t]||(ue[t]={past:[],present:a,future:[]}),ue[t].past.push(a),ue[t].present=e,ue[t].future=[],r?.middleware?.forEach((e=>{const r=e(t,a,o);void 0!==r&&(o=r)})),"function"==typeof o?n.value=$(n.value,o):a!==o&&(n.value=o,n.listeners.forEach((e=>e())),((e,t)=>{ne[e]||(ne[e]=[]),void 0===oe[e]&&(oe[e]=-1),ne[e]=ne[e].slice(0,oe[e]+1),ne[e].push(t),oe[e]++,se?.updateState&&se.updateState(e,t,[...ne[e]])})(t,o),((e,t)=>{ae[e]||(ae[e]=[]);const r=performance.now();t();const n=performance.now()-r;ae[e].push(n),se?.updatePerformance&&se.updatePerformance(e,n)})(t,(()=>{})),r?.persist&&(r?.encrypt?W(t,o):H(t,o)))})),ce.clear()};return{useStore:()=>re.useSyncExternalStore((e=>(n.listeners.add(e),()=>n.listeners.delete(e))),(()=>n.value)),set:t=>{ce.set(e,t),B?.requestAnimationFrame&&B.requestAnimationFrame(o)},undo:()=>{ue[e]?.past.length&&(ue[e].future.unshift(ue[e].present),ue[e].present=ue[e].past.pop(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]>0)oe[e]--,ne[e][oe[e]]})(e))},redo:()=>{ue[e]?.future.length&&(ue[e].past.push(ue[e].present),ue[e].present=ue[e].future.shift(),n.value=ue[e].present,n.listeners.forEach((e=>e())),(e=>{if(oe[e]<ne[e]?.length-1)oe[e]++,ne[e][oe[e]]})(e))}}},le=async(e,t,r,n)=>{const o=e.useStore(),a=t(o);e.set(a);try{await r()}catch(t){console.error("API request failed:",t),e.set(n?n(o):o)}},pe=(e,t)=>({...e,...t,lastUpdated:Date.now()}),_e=(e,t)=>{const r=t.useStore(),n=pe(r,e);t.set(n)},de=(e,t)=>()=>{const r=e.map((e=>e.useStore()));return t(...r)};export{de as derivedState,pe as mergeCRDT,le as optimisticUpdate,q as restoreEncryptedState,J as restoreState,W as saveEncryptedState,H as saveState,_e as syncCRDT,fe as useStateGlobal};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "state-jet",
3
- "version": "1.2.2",
3
+ "version": "1.2.4",
4
4
  "description": "Ultra-lightweight global state management for React",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -42,10 +42,12 @@
42
42
  "scripts": {
43
43
  "build": "rimraf dist && rollup -c",
44
44
  "test": "vitest",
45
+ "test:coverage": "vitest run --coverage",
45
46
  "clean": "rimraf dist",
46
47
  "publish:npm": "npm publish --access public",
47
48
  "lint": "eslint src --ext .ts,.tsx",
48
- "format": "prettier --write .",
49
+ "format": "prettier --write src",
50
+ "format:check": "prettier --check src",
49
51
  "release": "standard-version",
50
52
  "postrelease": "git push --follow-tags",
51
53
  "prepare": "npm run build",
@@ -62,43 +64,24 @@
62
64
  "prettier --write"
63
65
  ]
64
66
  },
65
- "standard-version": {
66
- "types": [
67
- {
68
- "type": "feat",
69
- "section": "Features"
70
- },
71
- {
72
- "type": "fix",
73
- "section": "Bug Fixes"
74
- },
75
- {
76
- "type": "chore",
77
- "section": "Chores"
78
- },
79
- {
80
- "type": "refactor",
81
- "section": "Refactors"
82
- },
83
- {
84
- "type": "docs",
85
- "section": "Documentation"
86
- },
87
- {
88
- "type": "test",
89
- "section": "Testing"
90
- }
67
+ "commitlint": {
68
+ "extends": [
69
+ "@commitlint/config-conventional"
91
70
  ]
92
71
  },
93
72
  "devDependencies": {
73
+ "@commitlint/cli": "^19.8.0",
74
+ "@commitlint/config-conventional": "^19.8.0",
94
75
  "@rollup/plugin-commonjs": "^28.0.2",
95
76
  "@rollup/plugin-node-resolve": "^15.0.2",
96
77
  "@rollup/plugin-terser": "^0.4.4",
78
+ "@rollup/rollup-linux-x64-gnu": "^4.35.0",
97
79
  "@types/react": "^19.0.10",
98
80
  "@types/react-dom": "^19.0.4",
99
81
  "@types/use-sync-external-store": "^0.0.6",
100
82
  "@typescript-eslint/eslint-plugin": "^8.26.0",
101
83
  "@typescript-eslint/parser": "^8.26.0",
84
+ "@vitest/coverage-v8": "^2.1.9",
102
85
  "eslint": "^8.57.1",
103
86
  "eslint-plugin-react": "^7.37.4",
104
87
  "eslint-plugin-react-hooks": "^5.2.0",