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BC5nBhS","sources":["webpack://_N_E/./node_modules/.pnpm/jotai@1.6.1_zrsyqg6kfmuxkmxyjtbkl6ldiu/node_modules/jotai/esm/utils.js","webpack://_N_E/./node_modules/.pnpm/bootstrap-icons@1.8.1/node_modules/bootstrap-icons/font/bootstrap-icons.css","webpack://_N_E/"],"sourcesContent":["import { atom, SECRET_INTERNAL_getScopeContext, useAtom, useSetAtom } from 'jotai';\nexport { useAtomValue, useSetAtom as useUpdateAtom } from 'jotai';\nimport { useContext, useCallback, useMemo } from 'react';\n\nconst RESET = Symbol();\n\nfunction atomWithReset(initialValue) {\n const anAtom = atom(initialValue, (get, set, update) => {\n if (update === RESET) {\n set(anAtom, initialValue);\n } else {\n set(anAtom, typeof update === \"function\" ? update(get(anAtom)) : update);\n }\n });\n return anAtom;\n}\n\nconst WRITE_ATOM = \"w\";\nconst RESTORE_ATOMS = \"h\";\n\nfunction useResetAtom(anAtom, scope) {\n const ScopeContext = SECRET_INTERNAL_getScopeContext(scope);\n const store = useContext(ScopeContext).s;\n const setAtom = useCallback(() => store[WRITE_ATOM](anAtom, RESET), [store, anAtom]);\n return setAtom;\n}\n\nfunction useReducerAtom(anAtom, reducer, scope) {\n const [state, setState] = useAtom(anAtom, scope);\n const dispatch = useCallback((action) => {\n setState((prev) => reducer(prev, action));\n }, [setState, reducer]);\n return [state, dispatch];\n}\n\nfunction atomWithReducer(initialValue, reducer) {\n const anAtom = atom(initialValue, (get, set, action) => set(anAtom, reducer(get(anAtom), action)));\n return anAtom;\n}\n\nfunction atomFamily(initializeAtom, areEqual) {\n let shouldRemove = null;\n const atoms = /* @__PURE__ */ new Map();\n const createAtom = (param) => {\n let item;\n if (areEqual === void 0) {\n item = atoms.get(param);\n } else {\n for (const [key, value] of atoms) {\n if (areEqual(key, param)) {\n item = value;\n break;\n }\n }\n }\n if (item !== void 0) {\n if (shouldRemove == null ? void 0 : shouldRemove(item[1], param)) {\n atoms.delete(param);\n } else {\n return item[0];\n }\n }\n const newAtom = initializeAtom(param);\n atoms.set(param, [newAtom, Date.now()]);\n return newAtom;\n };\n createAtom.remove = (param) => {\n if (areEqual === void 0) {\n atoms.delete(param);\n } else {\n for (const [key] of atoms) {\n if (areEqual(key, param)) {\n atoms.delete(key);\n break;\n }\n }\n }\n };\n createAtom.setShouldRemove = (fn) => {\n shouldRemove = fn;\n if (!shouldRemove)\n return;\n for (const [key, value] of atoms) {\n if (shouldRemove(value[1], key)) {\n atoms.delete(key);\n }\n }\n };\n return createAtom;\n}\n\nconst getWeakCacheItem = (cache, deps) => {\n do {\n const [dep, ...rest] = deps;\n const entry = cache.get(dep);\n if (!entry) {\n return;\n }\n if (!rest.length) {\n return entry[1];\n }\n cache = entry[0];\n deps = rest;\n } while (deps.length);\n};\nconst setWeakCacheItem = (cache, deps, item) => {\n do {\n const [dep, ...rest] = deps;\n let entry = cache.get(dep);\n if (!entry) {\n entry = [ new WeakMap()];\n cache.set(dep, entry);\n }\n if (!rest.length) {\n entry[1] = item;\n return;\n }\n cache = entry[0];\n deps = rest;\n } while (deps.length);\n};\nconst createMemoizeAtom = () => {\n const cache = /* @__PURE__ */ new WeakMap();\n const memoizeAtom = (createAtom, deps) => {\n const cachedAtom = getWeakCacheItem(cache, deps);\n if (cachedAtom) {\n return cachedAtom;\n }\n const createdAtom = createAtom();\n setWeakCacheItem(cache, deps, createdAtom);\n return createdAtom;\n };\n return memoizeAtom;\n};\n\nconst memoizeAtom$4 = createMemoizeAtom();\nfunction selectAtom(anAtom, selector, equalityFn = Object.is) {\n return memoizeAtom$4(() => {\n const refAtom = atom(() => ({}));\n const derivedAtom = atom((get) => {\n const slice = selector(get(anAtom));\n const ref = get(refAtom);\n if (\"prev\" in ref && equalityFn(ref.prev, slice)) {\n return ref.prev;\n }\n ref.prev = slice;\n return slice;\n });\n return derivedAtom;\n }, [anAtom, selector, equalityFn]);\n}\n\nfunction useAtomCallback(callback, scope) {\n const anAtom = useMemo(() => atom(null, (get, set, [arg, resolve, reject]) => {\n try {\n resolve(callback(get, set, arg));\n } catch (e) {\n reject(e);\n }\n }), [callback]);\n const invoke = useSetAtom(anAtom, scope);\n return useCallback((arg) => new Promise((resolve, reject) => {\n invoke([arg, resolve, reject]);\n }), [invoke]);\n}\n\nconst memoizeAtom$3 = createMemoizeAtom();\nconst deepFreeze = (obj) => {\n if (typeof obj !== \"object\" || obj === null)\n return;\n Object.freeze(obj);\n const propNames = Object.getOwnPropertyNames(obj);\n for (const name of propNames) {\n const value = obj[name];\n deepFreeze(value);\n }\n return obj;\n};\nfunction freezeAtom(anAtom) {\n return memoizeAtom$3(() => {\n const frozenAtom = atom((get) => deepFreeze(get(anAtom)), (_get, set, arg) => set(anAtom, arg));\n return frozenAtom;\n }, [anAtom]);\n}\nfunction freezeAtomCreator(createAtom) {\n return (...params) => {\n const anAtom = createAtom(...params);\n const origRead = anAtom.read;\n anAtom.read = (get) => deepFreeze(origRead(get));\n return anAtom;\n };\n}\n\nconst memoizeAtom$2 = createMemoizeAtom();\nconst isWritable = (atom2) => !!atom2.write;\nconst isFunction = (x) => typeof x === \"function\";\nfunction splitAtom(arrAtom, keyExtractor) {\n return memoizeAtom$2(() => {\n const mappingCache = /* @__PURE__ */ new WeakMap();\n const getMapping = (arr, prev) => {\n let mapping = mappingCache.get(arr);\n if (mapping) {\n return mapping;\n }\n const prevMapping = prev && mappingCache.get(prev);\n const atomList = [];\n const keyList = [];\n arr.forEach((item, index) => {\n const key = keyExtractor ? keyExtractor(item) : index;\n keyList[index] = key;\n const cachedAtom = prevMapping && prevMapping.atomList[prevMapping.keyList.indexOf(key)];\n if (cachedAtom) {\n atomList[index] = cachedAtom;\n return;\n }\n const itemRefAtom = atom(() => ({}));\n const read2 = (get) => {\n const itemRef = get(itemRefAtom);\n const ref = get(refAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, ref.prev);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n if (\"prev\" in itemRef) {\n return itemRef.prev;\n }\n throw new Error(\"splitAtom: index out of bounds for read\");\n }\n itemRef.prev = arr2[index2];\n return arr2[index2];\n };\n const write2 = (get, set, update) => {\n const ref = get(refAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, ref.prev);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n throw new Error(\"splitAtom: index out of bounds for write\");\n }\n const nextItem = isFunction(update) ? update(arr2[index2]) : update;\n set(arrAtom, [\n ...arr2.slice(0, index2),\n nextItem,\n ...arr2.slice(index2 + 1)\n ]);\n };\n atomList[index] = isWritable(arrAtom) ? atom(read2, write2) : atom(read2);\n });\n if (prevMapping && prevMapping.keyList.length === keyList.length && prevMapping.keyList.every((x, i) => x === keyList[i])) {\n mapping = prevMapping;\n } else {\n mapping = { atomList, keyList };\n }\n mappingCache.set(arr, mapping);\n return mapping;\n };\n const refAtom = atom(() => ({}));\n const read = (get) => {\n const ref = get(refAtom);\n const arr = get(arrAtom);\n const mapping = getMapping(arr, ref.prev);\n ref.prev = arr;\n return mapping.atomList;\n };\n const write = (get, set, atomToRemove) => {\n const index = get(splittedAtom).indexOf(atomToRemove);\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n ...arr.slice(index + 1)\n ]);\n }\n };\n const splittedAtom = isWritable(arrAtom) ? atom(read, write) : atom(read);\n return splittedAtom;\n }, keyExtractor ? [arrAtom, keyExtractor] : [arrAtom]);\n}\n\nfunction atomWithDefault(getDefault) {\n const EMPTY = Symbol();\n const overwrittenAtom = atom(EMPTY);\n const anAtom = atom((get) => {\n const overwritten = get(overwrittenAtom);\n if (overwritten !== EMPTY) {\n return overwritten;\n }\n return getDefault(get);\n }, (get, set, update) => {\n if (update === RESET) {\n return set(overwrittenAtom, EMPTY);\n }\n return set(overwrittenAtom, typeof update === \"function\" ? update(get(anAtom)) : update);\n });\n return anAtom;\n}\n\nvar __defProp$1 = Object.defineProperty;\nvar __defProps$1 = Object.defineProperties;\nvar __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;\nvar __hasOwnProp$1 = Object.prototype.hasOwnProperty;\nvar __propIsEnum$1 = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues$1 = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp$1.call(b, prop))\n __defNormalProp$1(a, prop, b[prop]);\n if (__getOwnPropSymbols$1)\n for (var prop of __getOwnPropSymbols$1(b)) {\n if (__propIsEnum$1.call(b, prop))\n __defNormalProp$1(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));\nconst memoizeAtom$1 = createMemoizeAtom();\nfunction waitForAll(atoms) {\n const createAtom = () => {\n const unwrappedAtoms = unwrapAtoms(atoms);\n const derivedAtom = atom((get) => {\n const promises = [];\n const values = unwrappedAtoms.map((anAtom, index) => {\n try {\n return get(anAtom);\n } catch (e) {\n if (e instanceof Promise) {\n promises[index] = e;\n } else {\n throw e;\n }\n }\n });\n if (promises.length) {\n throw Promise.all(promises);\n }\n return wrapResults(atoms, values);\n });\n return derivedAtom;\n };\n if (Array.isArray(atoms)) {\n return memoizeAtom$1(createAtom, atoms);\n }\n return createAtom();\n}\nconst unwrapAtoms = (atoms) => Array.isArray(atoms) ? atoms : Object.getOwnPropertyNames(atoms).map((key) => atoms[key]);\nconst wrapResults = (atoms, results) => Array.isArray(atoms) ? results : Object.getOwnPropertyNames(atoms).reduce((out, key, idx) => __spreadProps$1(__spreadValues$1({}, out), { [key]: results[idx] }), {});\n\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nfunction createJSONStorage(getStringStorage) {\n return {\n getItem: (key) => {\n const value = getStringStorage().getItem(key);\n if (value instanceof Promise) {\n return value.then((v) => JSON.parse(v || \"\"));\n }\n return JSON.parse(value || \"\");\n },\n setItem: (key, newValue) => getStringStorage().setItem(key, JSON.stringify(newValue)),\n removeItem: (key) => getStringStorage().removeItem(key)\n };\n}\nconst defaultStorage = createJSONStorage(() => localStorage);\ndefaultStorage.subscribe = (key, callback) => {\n const storageEventCallback = (e) => {\n if (e.key === key && e.newValue) {\n callback(JSON.parse(e.newValue));\n }\n };\n window.addEventListener(\"storage\", storageEventCallback);\n return () => {\n window.removeEventListener(\"storage\", storageEventCallback);\n };\n};\nfunction atomWithStorage(key, initialValue, storage = defaultStorage) {\n const getInitialValue = () => {\n try {\n const value = storage.getItem(key);\n if (value instanceof Promise) {\n return value.catch(() => initialValue);\n }\n return value;\n } catch {\n return initialValue;\n }\n };\n const baseAtom = atom(storage.delayInit ? initialValue : getInitialValue());\n baseAtom.onMount = (setAtom) => {\n let unsub;\n if (storage.subscribe) {\n unsub = storage.subscribe(key, setAtom);\n }\n if (storage.delayInit) {\n const value = getInitialValue();\n if (value instanceof Promise) {\n value.then(setAtom);\n } else {\n setAtom(value);\n }\n }\n return unsub;\n };\n const anAtom = atom((get) => get(baseAtom), (get, set, update) => {\n if (update === RESET) {\n set(baseAtom, initialValue);\n return storage.removeItem(key);\n }\n const newValue = typeof update === \"function\" ? update(get(baseAtom)) : update;\n set(baseAtom, newValue);\n return storage.setItem(key, newValue);\n });\n return anAtom;\n}\nfunction atomWithHash(key, initialValue, options) {\n const serialize = (options == null ? void 0 : options.serialize) || JSON.stringify;\n const deserialize = (options == null ? void 0 : options.deserialize) || JSON.parse;\n const subscribe = (options == null ? void 0 : options.subscribe) || ((callback) => {\n window.addEventListener(\"hashchange\", callback);\n return () => {\n window.removeEventListener(\"hashchange\", callback);\n };\n });\n const hashStorage = __spreadProps(__spreadValues({\n getItem: (key2) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n const storedValue = searchParams.get(key2);\n if (storedValue === null) {\n throw new Error(\"no value stored\");\n }\n return deserialize(storedValue);\n },\n setItem: (key2, newValue) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n searchParams.set(key2, serialize(newValue));\n if (options == null ? void 0 : options.replaceState) {\n history.replaceState(null, \"\", \"#\" + searchParams.toString());\n } else {\n location.hash = searchParams.toString();\n }\n },\n removeItem: (key2) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n searchParams.delete(key2);\n if (options == null ? void 0 : options.replaceState) {\n history.replaceState(null, \"\", \"#\" + searchParams.toString());\n } else {\n location.hash = searchParams.toString();\n }\n }\n }, (options == null ? void 0 : options.delayInit) && { delayInit: true }), {\n subscribe: (key2, setValue) => {\n const callback = () => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n const str = searchParams.get(key2);\n if (str !== null) {\n setValue(deserialize(str));\n } else {\n setValue(initialValue);\n }\n };\n return subscribe(callback);\n }\n });\n return atomWithStorage(key, initialValue, hashStorage);\n}\n\nfunction atomWithObservable(createObservable) {\n const observableResultAtom = atom((get) => {\n var _a;\n let settlePromise = null;\n let observable = createObservable(get);\n const itself = (_a = observable[Symbol.observable]) == null ? void 0 : _a.call(observable);\n if (itself) {\n observable = itself;\n }\n const dataAtom = atom(new Promise((resolve, reject) => {\n settlePromise = (data, err) => {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n };\n }));\n let setData = () => {\n throw new Error(\"setting data without mount\");\n };\n const dataListener = (data) => {\n if (settlePromise) {\n settlePromise(data);\n settlePromise = null;\n if (subscription && !setData) {\n subscription.unsubscribe();\n subscription = null;\n }\n } else {\n setData(data);\n }\n };\n const errorListener = (error) => {\n if (settlePromise) {\n settlePromise(null, error);\n settlePromise = null;\n if (subscription && !setData) {\n subscription.unsubscribe();\n subscription = null;\n }\n } else {\n setData(Promise.reject(error));\n }\n };\n let subscription = null;\n subscription = observable.subscribe(dataListener, errorListener);\n if (!settlePromise) {\n subscription.unsubscribe();\n subscription = null;\n }\n dataAtom.onMount = (update) => {\n setData = update;\n if (!subscription) {\n subscription = observable.subscribe(dataListener, errorListener);\n }\n return () => {\n subscription == null ? void 0 : subscription.unsubscribe();\n subscription = null;\n };\n };\n return { dataAtom, observable };\n });\n const observableAtom = atom((get) => {\n const { dataAtom } = get(observableResultAtom);\n return get(dataAtom);\n }, (get, _set, data) => {\n const { observable } = get(observableResultAtom);\n if (\"next\" in observable) {\n observable.next(data);\n } else {\n throw new Error(\"observable is not subject\");\n }\n });\n return observableAtom;\n}\n\nconst hydratedMap = /* @__PURE__ */ new WeakMap();\nfunction useHydrateAtoms(values, scope) {\n const ScopeContext = SECRET_INTERNAL_getScopeContext(scope);\n const scopeContainer = useContext(ScopeContext);\n const store = scopeContainer.s;\n const hydratedSet = getHydratedSet(scopeContainer);\n const tuplesToRestore = [];\n for (const tuple of values) {\n const atom = tuple[0];\n if (!hydratedSet.has(atom)) {\n hydratedSet.add(atom);\n tuplesToRestore.push(tuple);\n }\n }\n if (tuplesToRestore.length) {\n store[RESTORE_ATOMS](tuplesToRestore);\n }\n}\nfunction getHydratedSet(scopeContainer) {\n let hydratedSet = hydratedMap.get(scopeContainer);\n if (!hydratedSet) {\n hydratedSet = /* @__PURE__ */ new WeakSet();\n hydratedMap.set(scopeContainer, hydratedSet);\n }\n return hydratedSet;\n}\n\nconst memoizeAtom = createMemoizeAtom();\nconst LOADING = { state: \"loading\" };\nfunction loadable(anAtom) {\n return memoizeAtom(() => {\n const loadableAtomCache = /* @__PURE__ */ new WeakMap();\n const catchAtom = atom((get) => {\n let promise;\n try {\n const data = get(anAtom);\n const loadableAtom2 = atom({ state: \"hasData\", data });\n return loadableAtom2;\n } catch (error) {\n if (error instanceof Promise) {\n promise = error;\n } else {\n const loadableAtom2 = atom({\n state: \"hasError\",\n error\n });\n return loadableAtom2;\n }\n }\n const cached = loadableAtomCache.get(promise);\n if (cached) {\n return cached;\n }\n const loadableAtom = atom(LOADING, async (get2, set) => {\n try {\n const data = await get2(anAtom, { unstable_promise: true });\n set(loadableAtom, { state: \"hasData\", data });\n } catch (error) {\n set(loadableAtom, { state: \"hasError\", error });\n }\n });\n loadableAtom.onMount = (init) => {\n init();\n };\n loadableAtomCache.set(promise, loadableAtom);\n return loadableAtom;\n });\n const derivedAtom = atom((get) => {\n const loadableAtom = get(catchAtom);\n return get(loadableAtom);\n });\n return derivedAtom;\n }, [anAtom]);\n}\n\nexport { RESET, atomFamily, atomWithDefault, atomWithHash, atomWithObservable, atomWithReducer, atomWithReset, atomWithStorage, createJSONStorage, freezeAtom, freezeAtomCreator, loadable, selectAtom, splitAtom, useAtomCallback, useHydrateAtoms, useReducerAtom, useResetAtom, waitForAll };\n","// extracted by mini-css-extract-plugin","(self[\"webpackChunk_N_E\"] = self[\"webpackChunk_N_E\"] || []).push([[196],{\n\n/***/ 68125:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"rw\": function() { return /* binding */ atomWithReset; },\n/* harmony export */ \"oC\": function() { return /* binding */ useResetAtom; }\n/* harmony export */ });\n/* unused harmony exports RESET, atomFamily, atomWithDefault, atomWithHash, atomWithObservable, atomWithReducer, atomWithStorage, createJSONStorage, freezeAtom, freezeAtomCreator, loadable, selectAtom, splitAtom, useAtomCallback, useHydrateAtoms, useReducerAtom, waitForAll */\n/* harmony import */ var jotai__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7997);\n/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(59496);\n\n\n\n\nconst RESET = Symbol();\n\nfunction atomWithReset(initialValue) {\n const anAtom = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .atom */ .cn)(initialValue, (get, set, update) => {\n if (update === RESET) {\n set(anAtom, initialValue);\n } else {\n set(anAtom, typeof update === \"function\" ? update(get(anAtom)) : update);\n }\n });\n return anAtom;\n}\n\nconst WRITE_ATOM = \"w\";\nconst RESTORE_ATOMS = \"h\";\n\nfunction useResetAtom(anAtom, scope) {\n const ScopeContext = (0,jotai__WEBPACK_IMPORTED_MODULE_1__/* .SECRET_INTERNAL_getScopeContext */ .aQ)(scope);\n const store = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(ScopeContext).s;\n const setAtom = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(() => store[WRITE_ATOM](anAtom, RESET), [store, anAtom]);\n return setAtom;\n}\n\nfunction useReducerAtom(anAtom, reducer, scope) {\n const [state, setState] = useAtom(anAtom, scope);\n const dispatch = useCallback((action) => {\n setState((prev) => reducer(prev, action));\n }, [setState, reducer]);\n return [state, dispatch];\n}\n\nfunction atomWithReducer(initialValue, reducer) {\n const anAtom = atom(initialValue, (get, set, action) => set(anAtom, reducer(get(anAtom), action)));\n return anAtom;\n}\n\nfunction atomFamily(initializeAtom, areEqual) {\n let shouldRemove = null;\n const atoms = /* @__PURE__ */ new Map();\n const createAtom = (param) => {\n let item;\n if (areEqual === void 0) {\n item = atoms.get(param);\n } else {\n for (const [key, value] of atoms) {\n if (areEqual(key, param)) {\n item = value;\n break;\n }\n }\n }\n if (item !== void 0) {\n if (shouldRemove == null ? void 0 : shouldRemove(item[1], param)) {\n atoms.delete(param);\n } else {\n return item[0];\n }\n }\n const newAtom = initializeAtom(param);\n atoms.set(param, [newAtom, Date.now()]);\n return newAtom;\n };\n createAtom.remove = (param) => {\n if (areEqual === void 0) {\n atoms.delete(param);\n } else {\n for (const [key] of atoms) {\n if (areEqual(key, param)) {\n atoms.delete(key);\n break;\n }\n }\n }\n };\n createAtom.setShouldRemove = (fn) => {\n shouldRemove = fn;\n if (!shouldRemove)\n return;\n for (const [key, value] of atoms) {\n if (shouldRemove(value[1], key)) {\n atoms.delete(key);\n }\n }\n };\n return createAtom;\n}\n\nconst getWeakCacheItem = (cache, deps) => {\n do {\n const [dep, ...rest] = deps;\n const entry = cache.get(dep);\n if (!entry) {\n return;\n }\n if (!rest.length) {\n return entry[1];\n }\n cache = entry[0];\n deps = rest;\n } while (deps.length);\n};\nconst setWeakCacheItem = (cache, deps, item) => {\n do {\n const [dep, ...rest] = deps;\n let entry = cache.get(dep);\n if (!entry) {\n entry = [ new WeakMap()];\n cache.set(dep, entry);\n }\n if (!rest.length) {\n entry[1] = item;\n return;\n }\n cache = entry[0];\n deps = rest;\n } while (deps.length);\n};\nconst createMemoizeAtom = () => {\n const cache = /* @__PURE__ */ new WeakMap();\n const memoizeAtom = (createAtom, deps) => {\n const cachedAtom = getWeakCacheItem(cache, deps);\n if (cachedAtom) {\n return cachedAtom;\n }\n const createdAtom = createAtom();\n setWeakCacheItem(cache, deps, createdAtom);\n return createdAtom;\n };\n return memoizeAtom;\n};\n\nconst memoizeAtom$4 = createMemoizeAtom();\nfunction selectAtom(anAtom, selector, equalityFn = Object.is) {\n return memoizeAtom$4(() => {\n const refAtom = atom(() => ({}));\n const derivedAtom = atom((get) => {\n const slice = selector(get(anAtom));\n const ref = get(refAtom);\n if (\"prev\" in ref && equalityFn(ref.prev, slice)) {\n return ref.prev;\n }\n ref.prev = slice;\n return slice;\n });\n return derivedAtom;\n }, [anAtom, selector, equalityFn]);\n}\n\nfunction useAtomCallback(callback, scope) {\n const anAtom = useMemo(() => atom(null, (get, set, [arg, resolve, reject]) => {\n try {\n resolve(callback(get, set, arg));\n } catch (e) {\n reject(e);\n }\n }), [callback]);\n const invoke = useSetAtom(anAtom, scope);\n return useCallback((arg) => new Promise((resolve, reject) => {\n invoke([arg, resolve, reject]);\n }), [invoke]);\n}\n\nconst memoizeAtom$3 = createMemoizeAtom();\nconst deepFreeze = (obj) => {\n if (typeof obj !== \"object\" || obj === null)\n return;\n Object.freeze(obj);\n const propNames = Object.getOwnPropertyNames(obj);\n for (const name of propNames) {\n const value = obj[name];\n deepFreeze(value);\n }\n return obj;\n};\nfunction freezeAtom(anAtom) {\n return memoizeAtom$3(() => {\n const frozenAtom = atom((get) => deepFreeze(get(anAtom)), (_get, set, arg) => set(anAtom, arg));\n return frozenAtom;\n }, [anAtom]);\n}\nfunction freezeAtomCreator(createAtom) {\n return (...params) => {\n const anAtom = createAtom(...params);\n const origRead = anAtom.read;\n anAtom.read = (get) => deepFreeze(origRead(get));\n return anAtom;\n };\n}\n\nconst memoizeAtom$2 = createMemoizeAtom();\nconst isWritable = (atom2) => !!atom2.write;\nconst isFunction = (x) => typeof x === \"function\";\nfunction splitAtom(arrAtom, keyExtractor) {\n return memoizeAtom$2(() => {\n const mappingCache = /* @__PURE__ */ new WeakMap();\n const getMapping = (arr, prev) => {\n let mapping = mappingCache.get(arr);\n if (mapping) {\n return mapping;\n }\n const prevMapping = prev && mappingCache.get(prev);\n const atomList = [];\n const keyList = [];\n arr.forEach((item, index) => {\n const key = keyExtractor ? keyExtractor(item) : index;\n keyList[index] = key;\n const cachedAtom = prevMapping && prevMapping.atomList[prevMapping.keyList.indexOf(key)];\n if (cachedAtom) {\n atomList[index] = cachedAtom;\n return;\n }\n const itemRefAtom = atom(() => ({}));\n const read2 = (get) => {\n const itemRef = get(itemRefAtom);\n const ref = get(refAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, ref.prev);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n if (\"prev\" in itemRef) {\n return itemRef.prev;\n }\n throw new Error(\"splitAtom: index out of bounds for read\");\n }\n itemRef.prev = arr2[index2];\n return arr2[index2];\n };\n const write2 = (get, set, update) => {\n const ref = get(refAtom);\n const arr2 = get(arrAtom);\n const mapping2 = getMapping(arr2, ref.prev);\n const index2 = mapping2.keyList.indexOf(key);\n if (index2 < 0 || index2 >= arr2.length) {\n throw new Error(\"splitAtom: index out of bounds for write\");\n }\n const nextItem = isFunction(update) ? update(arr2[index2]) : update;\n set(arrAtom, [\n ...arr2.slice(0, index2),\n nextItem,\n ...arr2.slice(index2 + 1)\n ]);\n };\n atomList[index] = isWritable(arrAtom) ? atom(read2, write2) : atom(read2);\n });\n if (prevMapping && prevMapping.keyList.length === keyList.length && prevMapping.keyList.every((x, i) => x === keyList[i])) {\n mapping = prevMapping;\n } else {\n mapping = { atomList, keyList };\n }\n mappingCache.set(arr, mapping);\n return mapping;\n };\n const refAtom = atom(() => ({}));\n const read = (get) => {\n const ref = get(refAtom);\n const arr = get(arrAtom);\n const mapping = getMapping(arr, ref.prev);\n ref.prev = arr;\n return mapping.atomList;\n };\n const write = (get, set, atomToRemove) => {\n const index = get(splittedAtom).indexOf(atomToRemove);\n if (index >= 0) {\n const arr = get(arrAtom);\n set(arrAtom, [\n ...arr.slice(0, index),\n ...arr.slice(index + 1)\n ]);\n }\n };\n const splittedAtom = isWritable(arrAtom) ? atom(read, write) : atom(read);\n return splittedAtom;\n }, keyExtractor ? [arrAtom, keyExtractor] : [arrAtom]);\n}\n\nfunction atomWithDefault(getDefault) {\n const EMPTY = Symbol();\n const overwrittenAtom = atom(EMPTY);\n const anAtom = atom((get) => {\n const overwritten = get(overwrittenAtom);\n if (overwritten !== EMPTY) {\n return overwritten;\n }\n return getDefault(get);\n }, (get, set, update) => {\n if (update === RESET) {\n return set(overwrittenAtom, EMPTY);\n }\n return set(overwrittenAtom, typeof update === \"function\" ? update(get(anAtom)) : update);\n });\n return anAtom;\n}\n\nvar __defProp$1 = Object.defineProperty;\nvar __defProps$1 = Object.defineProperties;\nvar __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;\nvar __hasOwnProp$1 = Object.prototype.hasOwnProperty;\nvar __propIsEnum$1 = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues$1 = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp$1.call(b, prop))\n __defNormalProp$1(a, prop, b[prop]);\n if (__getOwnPropSymbols$1)\n for (var prop of __getOwnPropSymbols$1(b)) {\n if (__propIsEnum$1.call(b, prop))\n __defNormalProp$1(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));\nconst memoizeAtom$1 = createMemoizeAtom();\nfunction waitForAll(atoms) {\n const createAtom = () => {\n const unwrappedAtoms = unwrapAtoms(atoms);\n const derivedAtom = atom((get) => {\n const promises = [];\n const values = unwrappedAtoms.map((anAtom, index) => {\n try {\n return get(anAtom);\n } catch (e) {\n if (e instanceof Promise) {\n promises[index] = e;\n } else {\n throw e;\n }\n }\n });\n if (promises.length) {\n throw Promise.all(promises);\n }\n return wrapResults(atoms, values);\n });\n return derivedAtom;\n };\n if (Array.isArray(atoms)) {\n return memoizeAtom$1(createAtom, atoms);\n }\n return createAtom();\n}\nconst unwrapAtoms = (atoms) => Array.isArray(atoms) ? atoms : Object.getOwnPropertyNames(atoms).map((key) => atoms[key]);\nconst wrapResults = (atoms, results) => Array.isArray(atoms) ? results : Object.getOwnPropertyNames(atoms).reduce((out, key, idx) => __spreadProps$1(__spreadValues$1({}, out), { [key]: results[idx] }), {});\n\nvar __defProp = Object.defineProperty;\nvar __defProps = Object.defineProperties;\nvar __getOwnPropDescs = Object.getOwnPropertyDescriptors;\nvar __getOwnPropSymbols = Object.getOwnPropertySymbols;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __propIsEnum = Object.prototype.propertyIsEnumerable;\nvar __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;\nvar __spreadValues = (a, b) => {\n for (var prop in b || (b = {}))\n if (__hasOwnProp.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n if (__getOwnPropSymbols)\n for (var prop of __getOwnPropSymbols(b)) {\n if (__propIsEnum.call(b, prop))\n __defNormalProp(a, prop, b[prop]);\n }\n return a;\n};\nvar __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));\nfunction createJSONStorage(getStringStorage) {\n return {\n getItem: (key) => {\n const value = getStringStorage().getItem(key);\n if (value instanceof Promise) {\n return value.then((v) => JSON.parse(v || \"\"));\n }\n return JSON.parse(value || \"\");\n },\n setItem: (key, newValue) => getStringStorage().setItem(key, JSON.stringify(newValue)),\n removeItem: (key) => getStringStorage().removeItem(key)\n };\n}\nconst defaultStorage = createJSONStorage(() => localStorage);\ndefaultStorage.subscribe = (key, callback) => {\n const storageEventCallback = (e) => {\n if (e.key === key && e.newValue) {\n callback(JSON.parse(e.newValue));\n }\n };\n window.addEventListener(\"storage\", storageEventCallback);\n return () => {\n window.removeEventListener(\"storage\", storageEventCallback);\n };\n};\nfunction atomWithStorage(key, initialValue, storage = defaultStorage) {\n const getInitialValue = () => {\n try {\n const value = storage.getItem(key);\n if (value instanceof Promise) {\n return value.catch(() => initialValue);\n }\n return value;\n } catch {\n return initialValue;\n }\n };\n const baseAtom = atom(storage.delayInit ? initialValue : getInitialValue());\n baseAtom.onMount = (setAtom) => {\n let unsub;\n if (storage.subscribe) {\n unsub = storage.subscribe(key, setAtom);\n }\n if (storage.delayInit) {\n const value = getInitialValue();\n if (value instanceof Promise) {\n value.then(setAtom);\n } else {\n setAtom(value);\n }\n }\n return unsub;\n };\n const anAtom = atom((get) => get(baseAtom), (get, set, update) => {\n if (update === RESET) {\n set(baseAtom, initialValue);\n return storage.removeItem(key);\n }\n const newValue = typeof update === \"function\" ? update(get(baseAtom)) : update;\n set(baseAtom, newValue);\n return storage.setItem(key, newValue);\n });\n return anAtom;\n}\nfunction atomWithHash(key, initialValue, options) {\n const serialize = (options == null ? void 0 : options.serialize) || JSON.stringify;\n const deserialize = (options == null ? void 0 : options.deserialize) || JSON.parse;\n const subscribe = (options == null ? void 0 : options.subscribe) || ((callback) => {\n window.addEventListener(\"hashchange\", callback);\n return () => {\n window.removeEventListener(\"hashchange\", callback);\n };\n });\n const hashStorage = __spreadProps(__spreadValues({\n getItem: (key2) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n const storedValue = searchParams.get(key2);\n if (storedValue === null) {\n throw new Error(\"no value stored\");\n }\n return deserialize(storedValue);\n },\n setItem: (key2, newValue) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n searchParams.set(key2, serialize(newValue));\n if (options == null ? void 0 : options.replaceState) {\n history.replaceState(null, \"\", \"#\" + searchParams.toString());\n } else {\n location.hash = searchParams.toString();\n }\n },\n removeItem: (key2) => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n searchParams.delete(key2);\n if (options == null ? void 0 : options.replaceState) {\n history.replaceState(null, \"\", \"#\" + searchParams.toString());\n } else {\n location.hash = searchParams.toString();\n }\n }\n }, (options == null ? void 0 : options.delayInit) && { delayInit: true }), {\n subscribe: (key2, setValue) => {\n const callback = () => {\n const searchParams = new URLSearchParams(location.hash.slice(1));\n const str = searchParams.get(key2);\n if (str !== null) {\n setValue(deserialize(str));\n } else {\n setValue(initialValue);\n }\n };\n return subscribe(callback);\n }\n });\n return atomWithStorage(key, initialValue, hashStorage);\n}\n\nfunction atomWithObservable(createObservable) {\n const observableResultAtom = atom((get) => {\n var _a;\n let settlePromise = null;\n let observable = createObservable(get);\n const itself = (_a = observable[Symbol.observable]) == null ? void 0 : _a.call(observable);\n if (itself) {\n observable = itself;\n }\n const dataAtom = atom(new Promise((resolve, reject) => {\n settlePromise = (data, err) => {\n if (err) {\n reject(err);\n } else {\n resolve(data);\n }\n };\n }));\n let setData = () => {\n throw new Error(\"setting data without mount\");\n };\n const dataListener = (data) => {\n if (settlePromise) {\n settlePromise(data);\n settlePromise = null;\n if (subscription && !setData) {\n subscription.unsubscribe();\n subscription = null;\n }\n } else {\n setData(data);\n }\n };\n const errorListener = (error) => {\n if (settlePromise) {\n settlePromise(null, error);\n settlePromise = null;\n if (subscription && !setData) {\n subscription.unsubscribe();\n subscription = null;\n }\n } else {\n setData(Promise.reject(error));\n }\n };\n let subscription = null;\n subscription = observable.subscribe(dataListener, errorListener);\n if (!settlePromise) {\n subscription.unsubscribe();\n subscription = null;\n }\n dataAtom.onMount = (update) => {\n setData = update;\n if (!subscription) {\n subscription = observable.subscribe(dataListener, errorListener);\n }\n return () => {\n subscription == null ? void 0 : subscription.unsubscribe();\n subscription = null;\n };\n };\n return { dataAtom, observable };\n });\n const observableAtom = atom((get) => {\n const { dataAtom } = get(observableResultAtom);\n return get(dataAtom);\n }, (get, _set, data) => {\n const { observable } = get(observableResultAtom);\n if (\"next\" in observable) {\n observable.next(data);\n } else {\n throw new Error(\"observable is not subject\");\n }\n });\n return observableAtom;\n}\n\nconst hydratedMap = /* @__PURE__ */ new WeakMap();\nfunction useHydrateAtoms(values, scope) {\n const ScopeContext = SECRET_INTERNAL_getScopeContext(scope);\n const scopeContainer = useContext(ScopeContext);\n const store = scopeContainer.s;\n const hydratedSet = getHydratedSet(scopeContainer);\n const tuplesToRestore = [];\n for (const tuple of values) {\n const atom = tuple[0];\n if (!hydratedSet.has(atom)) {\n hydratedSet.add(atom);\n tuplesToRestore.push(tuple);\n }\n }\n if (tuplesToRestore.length) {\n store[RESTORE_ATOMS](tuplesToRestore);\n }\n}\nfunction getHydratedSet(scopeContainer) {\n let hydratedSet = hydratedMap.get(scopeContainer);\n if (!hydratedSet) {\n hydratedSet = /* @__PURE__ */ new WeakSet();\n hydratedMap.set(scopeContainer, hydratedSet);\n }\n return hydratedSet;\n}\n\nconst memoizeAtom = createMemoizeAtom();\nconst LOADING = { state: \"loading\" };\nfunction loadable(anAtom) {\n return memoizeAtom(() => {\n const loadableAtomCache = /* @__PURE__ */ new WeakMap();\n const catchAtom = atom((get) => {\n let promise;\n try {\n const data = get(anAtom);\n const loadableAtom2 = atom({ state: \"hasData\", data });\n return loadableAtom2;\n } catch (error) {\n if (error instanceof Promise) {\n promise = error;\n } else {\n const loadableAtom2 = atom({\n state: \"hasError\",\n error\n });\n return loadableAtom2;\n }\n }\n const cached = loadableAtomCache.get(promise);\n if (cached) {\n return cached;\n }\n const loadableAtom = atom(LOADING, async (get2, set) => {\n try {\n const data = await get2(anAtom, { unstable_promise: true });\n set(loadableAtom, { state: \"hasData\", data });\n } catch (error) {\n set(loadableAtom, { state: \"hasError\", error });\n }\n });\n loadableAtom.onMount = (init) => {\n init();\n };\n loadableAtomCache.set(promise, loadableAtom);\n return loadableAtom;\n });\n const derivedAtom = atom((get) => {\n const loadableAtom = get(catchAtom);\n return get(loadableAtom);\n });\n return derivedAtom;\n }, [anAtom]);\n}\n\n\n\n\n/***/ }),\n\n/***/ 26219:\n/***/ (function() {\n\n// extracted by mini-css-extract-plugin\n\n/***/ })\n\n}]);"],"names":["self","push","__unused_webpack_module","__webpack_exports__","__webpack_require__","d","atomWithReset","useResetAtom","jotai__WEBPACK_IMPORTED_MODULE_1__","react__WEBPACK_IMPORTED_MODULE_0__","RESET","Symbol","initialValue","anAtom","cn","get","set","update","scope","ScopeContext","aQ","store","useContext","s","setAtom","useCallback","getWeakCacheItem","cache","deps","dep","rest","entry","length","setWeakCacheItem","item","WeakMap","createMemoizeAtom","createAtom","cachedAtom","createdAtom","memoizeAtom$4","memoizeAtom$3","deepFreeze","obj","Object","freeze","propNames","getOwnPropertyNames","name","value","__defProp$1","defineProperty","__defProps$1","defineProperties","__getOwnPropDescs$1","getOwnPropertyDescriptors","__getOwnPropSymbols$1","getOwnPropertySymbols","__hasOwnProp$1","prototype","hasOwnProperty","__propIsEnum$1","propertyIsEnumerable","__defNormalProp$1","key","configurable","writable","__spreadValues$1","a","b","prop","call","__spreadProps$1","__defProps","__getOwnPropDescs","__defProp","__getOwnPropSymbols","__hasOwnProp","__propIsEnum","__defNormalProp","defaultStorage","getStringStorage","getItem","Promise","then","v","JSON","parse","setItem","newValue","stringify","removeItem","localStorage","subscribe","callback","storageEventCallback","e","window","addEventListener","removeEventListener"],"sourceRoot":""}