AK-21/Graphite-Industrial-Intelligence
0
1'use strict';2 3var createStoreImpl = function createStoreImpl(createState) {4 var state;5 var listeners = new Set();6 var setState = function setState(partial, replace) {7 var nextState = typeof partial === 'function' ? partial(state) : partial;8 if (!Object.is(nextState, state)) {9 var _previousState = state;10 state = (replace != null ? replace : typeof nextState !== 'object' || nextState === null) ? nextState : Object.assign({}, state, nextState);11 listeners.forEach(function (listener) {12 return listener(state, _previousState);13 });14 }15 };16 var getState = function getState() {17 return state;18 };19 var getInitialState = function getInitialState() {20 return initialState;21 };22 var subscribe = function subscribe(listener) {23 listeners.add(listener);24 return function () {25 return listeners.delete(listener);26 };27 };28 var destroy = function destroy() {29 if (process.env.NODE_ENV !== 'production') {30 console.warn('[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected.');31 }32 listeners.clear();33 };34 var api = {35 setState: setState,36 getState: getState,37 getInitialState: getInitialState,38 subscribe: subscribe,39 destroy: destroy40 };41 var initialState = state = createState(setState, getState, api);42 return api;43};44var createStore = function createStore(createState) {45 return createState ? createStoreImpl(createState) : createStoreImpl;46};47var vanilla = (function (createState) {48 if (process.env.NODE_ENV !== 'production') {49 console.warn("[DEPRECATED] Default export is deprecated. Instead use import { createStore } from 'zustand/vanilla'.");50 }51 return createStore(createState);52});53 54exports.createStore = createStore;55exports.default = vanilla;56 57module.exports = vanilla;58module.exports.createStore = createStore;59exports.default = module.exports;60 