@kky42/pievo-server 2.3.0 → 2.4.2

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.
Files changed (199) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/MachinesModal-CSbnrUER.js +1 -0
  3. package/.output/public/assets/SignIn-0Tjqs-Ma.js +1 -0
  4. package/.output/public/assets/actionUi-DpwGIGpw.js +1 -0
  5. package/.output/public/assets/app-CaZpuwOS.css +2 -0
  6. package/.output/public/assets/index-CaS_SmDq.js +10 -0
  7. package/.output/public/assets/invite._token-Btg_0aLp.js +1 -0
  8. package/.output/public/assets/invite._token-KMD2JAgE.js +1 -0
  9. package/.output/public/assets/lifecycleUi-C7dwHtbw.js +1 -0
  10. package/.output/public/assets/loops._loopId-D5usF3DO.js +67 -0
  11. package/.output/public/assets/loops._loopId_.runs._runId-DRCgXaCq.js +3 -0
  12. package/.output/public/assets/preload-helper-DsxECZIS.js +5 -0
  13. package/.output/public/assets/routes-CtFgwdgW.js +1 -0
  14. package/.output/public/assets/routes-LDbnnQ3f.js +1 -0
  15. package/.output/public/assets/t._teamId-D41xcbsF.js +1 -0
  16. package/.output/public/assets/t._teamId-DUena1pV.js +1 -0
  17. package/.output/public/assets/ui-Do4gqMyP.js +1 -0
  18. package/.output/server/_libs/@base-ui/react+[...].mjs +4130 -4130
  19. package/.output/server/_libs/@tanstack/react-router+[...].mjs +1 -1
  20. package/.output/server/_libs/drizzle-orm+postgres.mjs +28 -1
  21. package/.output/server/_ssr/DashboardView-C2LdV6J0.mjs +914 -0
  22. package/.output/server/_ssr/{notifyFns-DuPR1zd7.mjs → MachinesModal-BjkcVjjx.mjs} +55 -35
  23. package/.output/server/_ssr/{SignIn-RmpWm9uy.mjs → SignIn-DEGrvJvb.mjs} +10 -24
  24. package/.output/server/_ssr/SocialLinks-Cm4H8pUJ.mjs +1044 -0
  25. package/.output/server/_ssr/{actionUi-BN55TNYE.mjs → actionUi-DJBWuNwr.mjs} +3 -3
  26. package/.output/server/_ssr/{artifactFiles-BCaIIrrT.mjs → artifactFiles-DtpRidFZ.mjs} +7 -8
  27. package/.output/server/_ssr/{artifactKind-BW0isV8L.mjs → artifactKind-FBYbgSuf.mjs} +27 -2
  28. package/.output/server/_ssr/artifacts-BR3jj0NC.mjs +2 -0
  29. package/.output/server/_ssr/{auth-30Z4lV1w.mjs → auth-C0zoZCGe.mjs} +16 -19
  30. package/.output/server/_ssr/boot-CdOO4xOo.mjs +2 -0
  31. package/.output/server/_ssr/{boot-3BNKujyp.mjs → boot-sNlIkoLe.mjs} +1331 -3927
  32. package/.output/server/_ssr/{bun-sqlite-dialect-BW9W1_Ps-_7tfuNRi.mjs → bun-sqlite-dialect-BW9W1_Ps-DmlZWqO7.mjs} +2 -2
  33. package/.output/server/_ssr/{d1-sqlite-dialect-BLC8LXE6-ucDUbeBk.mjs → d1-sqlite-dialect-BLC8LXE6-CCNzqZwZ.mjs} +2 -2
  34. package/.output/server/_ssr/db-CwLD-5w1.mjs +2 -0
  35. package/.output/server/_ssr/{dist-Cd6nlLlO.mjs → dist-B3SxDOpW.mjs} +2 -2
  36. package/.output/server/_ssr/{factory-CWWwV7XZ.mjs → factory-Dv3Zopis.mjs} +2 -2
  37. package/.output/server/_ssr/invite._token-CJ6-H-s3.mjs +20 -0
  38. package/.output/server/_ssr/{invite._token-SdWXemIc.mjs → invite._token-dLKDJKVs.mjs} +9 -17
  39. package/.output/server/_ssr/{invite._token-BKlz0R2f.mjs → invite._token-l1SjouDz.mjs} +6 -15
  40. package/.output/server/_ssr/{kysely-adapter-C8iS51DB.mjs → kysely-adapter-nL7WKSgw.mjs} +1 -1
  41. package/.output/server/_ssr/{lifecycleUi-DgBQAYzp.mjs → lifecycleUi-Dad3hvhm.mjs} +11 -11
  42. package/.output/server/_ssr/logger-B8m8F1Qu.mjs +2 -0
  43. package/.output/server/_ssr/loopApi-BKyFB4KM.mjs +342 -0
  44. package/.output/server/_ssr/{adapters-BoLkOf1T.mjs → loopProjection-B8a829ij.mjs} +25 -55
  45. package/.output/server/_ssr/loops._loopId-DS16Phmq.mjs +1271 -0
  46. package/.output/server/_ssr/{loops._loopId_.runs._runId-PUGBrD5q.mjs → loops._loopId_.runs._runId-BEJI6iK5.mjs} +23 -74
  47. package/.output/server/_ssr/{loops._loopId_.runs._runId-Ymy4lwee.mjs → loops._loopId_.runs._runId-CduETLqH.mjs} +4 -5
  48. package/.output/server/_ssr/{machineFns-BZ9puxDt.mjs → machineFns-ByMsgG12.mjs} +3 -5
  49. package/.output/server/_ssr/{node-sqlite-dialect-D_3JmkMo.mjs → node-sqlite-dialect-CjNineno.mjs} +2 -2
  50. package/.output/server/_ssr/router-CXyrnvx-.mjs +565 -0
  51. package/.output/server/_ssr/{routes-ClZEdsnB.mjs → routes-BulNEUEE.mjs} +6 -10
  52. package/.output/server/_ssr/{routes-ComqHvCL.mjs → routes-DD94baie.mjs} +3 -3
  53. package/.output/server/_ssr/{routes-D5jJJ-30.mjs → routes-Wjexi35W.mjs} +6 -6
  54. package/.output/server/_ssr/runDiff-Ba8Lg1vg.mjs +2 -0
  55. package/.output/server/_ssr/ssr.mjs +60 -100
  56. package/.output/server/_ssr/store-Cujtg2QE.mjs +2 -0
  57. package/.output/server/_ssr/{t._teamId-BgHV_KFP.mjs → t._teamId-1CreIlPV.mjs} +7 -11
  58. package/.output/server/_ssr/{t._teamId-DDERNgfn.mjs → t._teamId-Bd6-zZsy.mjs} +4 -4
  59. package/.output/server/_ssr/{t._teamId-DRJvKHZn.mjs → t._teamId-COuMKQ4r.mjs} +7 -7
  60. package/.output/server/_ssr/{teamFns-Bp81UO-x.mjs → teamFns-H438WnZC.mjs} +12 -30
  61. package/.output/server/_ssr/{teamFns-bm82twd5.mjs → teamFns-j2JKjorZ.mjs} +2 -2
  62. package/.output/server/_ssr/tokens-DgG_Syq3.mjs +2 -0
  63. package/.output/server/_ssr/{ui-Ww2tTM2u.mjs → ui-D5KWstlb.mjs} +26 -48
  64. package/.output/server/{_tanstack-start-manifest_v-DwKENYCN.mjs → _tanstack-start-manifest_v-3H7yBKLz.mjs} +25 -35
  65. package/{drizzle/0000_round_marauders.sql → .output/server/drizzle/0000_baseline.sql} +102 -44
  66. package/.output/server/drizzle/meta/_journal.json +3 -115
  67. package/.output/server/index.mjs +83 -132
  68. package/{.output/server/drizzle/0000_round_marauders.sql → drizzle/0000_baseline.sql} +102 -44
  69. package/drizzle/meta/_journal.json +3 -115
  70. package/package.json +2 -11
  71. package/scripts/pievo-server.mjs +3 -1
  72. package/scripts/server-cli-lib.mjs +23 -16
  73. package/.output/public/assets/CodeField-dOzyFQNH.js +0 -34
  74. package/.output/public/assets/LoopView-DjVHUyrR.js +0 -59
  75. package/.output/public/assets/Modal-CCRvx959.js +0 -1
  76. package/.output/public/assets/SignIn-Qxw5zDFq.js +0 -1
  77. package/.output/public/assets/actionUi-CXxhzYe2.js +0 -1
  78. package/.output/public/assets/app-D1cij_NJ.css +0 -2
  79. package/.output/public/assets/artifactView-Cd5wWPil.js +0 -66
  80. package/.output/public/assets/index-BRN_CQ8U.js +0 -12
  81. package/.output/public/assets/invite._token-BIxr8DlP.js +0 -1
  82. package/.output/public/assets/invite._token-j2BTCeG1.js +0 -1
  83. package/.output/public/assets/jsx-runtime-BseJUIpC.js +0 -1
  84. package/.output/public/assets/lifecycleUi-Qy_8beQK.js +0 -1
  85. package/.output/public/assets/loopApi-CT1mMhlb.js +0 -3
  86. package/.output/public/assets/loops._loopId-BRBQzioy.js +0 -4
  87. package/.output/public/assets/loops._loopId_.runs._runId-CMnOJkem.js +0 -3
  88. package/.output/public/assets/notifyFns-DYD4EKaG.js +0 -1
  89. package/.output/public/assets/preload-helper-DFkkpP6W.js +0 -3
  90. package/.output/public/assets/routes-3nuEJGdo.js +0 -1
  91. package/.output/public/assets/routes-DORLim-C.js +0 -1
  92. package/.output/public/assets/t._teamId-F5f4K8kd.js +0 -1
  93. package/.output/public/assets/t._teamId-XfE_S1Fo.js +0 -1
  94. package/.output/public/assets/ui-Dhsx6SW0.js +0 -1
  95. package/.output/public/assets/useRouter-DsjH8G0p.js +0 -1
  96. package/.output/server/_libs/@codemirror/autocomplete+[...].mjs +0 -19713
  97. package/.output/server/_libs/@codemirror/lang-css+[...].mjs +0 -2636
  98. package/.output/server/_libs/@codemirror/lang-html+[...].mjs +0 -2247
  99. package/.output/server/_libs/@codemirror/lang-json+[...].mjs +0 -79
  100. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +0 -1736
  101. package/.output/server/_libs/@uiw/codemirror-extensions-basic-setup+[...].mjs +0 -76
  102. package/.output/server/_libs/babel__runtime.mjs +0 -30
  103. package/.output/server/_libs/clsx.mjs +0 -16
  104. package/.output/server/_libs/codemirror__commands.mjs +0 -1725
  105. package/.output/server/_libs/codemirror__lint.mjs +0 -565
  106. package/.output/server/_libs/codemirror__search.mjs +0 -1138
  107. package/.output/server/_libs/codemirror__theme-one-dark.mjs +0 -161
  108. package/.output/server/_libs/d3-array.mjs +0 -231
  109. package/.output/server/_libs/d3-color.mjs +0 -330
  110. package/.output/server/_libs/d3-format.mjs +0 -252
  111. package/.output/server/_libs/d3-interpolate.mjs +0 -163
  112. package/.output/server/_libs/d3-path.mjs +0 -77
  113. package/.output/server/_libs/d3-scale+[...].mjs +0 -1907
  114. package/.output/server/_libs/d3-shape.mjs +0 -818
  115. package/.output/server/_libs/decimal.js-light.mjs +0 -884
  116. package/.output/server/_libs/dom-serializer+[...].mjs +0 -708
  117. package/.output/server/_libs/domhandler.mjs +0 -461
  118. package/.output/server/_libs/domutils.mjs +0 -868
  119. package/.output/server/_libs/es-toolkit.mjs +0 -1737
  120. package/.output/server/_libs/eventemitter3.mjs +0 -236
  121. package/.output/server/_libs/html-dom-parser+htmlparser2.mjs +0 -1560
  122. package/.output/server/_libs/html-react-parser+[...].mjs +0 -1360
  123. package/.output/server/_libs/react-is.mjs +0 -48
  124. package/.output/server/_libs/react-redux+[...].mjs +0 -205
  125. package/.output/server/_libs/recharts+victory-vendor.mjs +0 -17303
  126. package/.output/server/_libs/uiw__codemirror-themes.mjs +0 -32
  127. package/.output/server/_libs/uiw__react-codemirror.mjs +0 -354
  128. package/.output/server/_ssr/CodeField-B7oOmmwH.mjs +0 -143
  129. package/.output/server/_ssr/DashboardView-BF7PciP7.mjs +0 -2736
  130. package/.output/server/_ssr/LoopPlaybook-DC7QVvPY.mjs +0 -2105
  131. package/.output/server/_ssr/LoopView-DwSrm9Ja.mjs +0 -1300
  132. package/.output/server/_ssr/Modal-MaCG52Pv.mjs +0 -49
  133. package/.output/server/_ssr/artifactView-iuPsp5aa.mjs +0 -304
  134. package/.output/server/_ssr/artifacts-jQ-bfdhI.mjs +0 -2
  135. package/.output/server/_ssr/boot-CsEFT53K.mjs +0 -2
  136. package/.output/server/_ssr/db-CXownd1H.mjs +0 -2
  137. package/.output/server/_ssr/invite._token-CWl6kipD.mjs +0 -28
  138. package/.output/server/_ssr/logger-Gy-47z3k.mjs +0 -2
  139. package/.output/server/_ssr/loopApi-8_KgBapr.mjs +0 -109
  140. package/.output/server/_ssr/loopApi-ABi9SgWS.mjs +0 -564
  141. package/.output/server/_ssr/loops._loopId-SON_t43g.mjs +0 -30
  142. package/.output/server/_ssr/loops._loopId-p1KWsvMM.mjs +0 -1477
  143. package/.output/server/_ssr/notifyFns-BUCePuF3.mjs +0 -118
  144. package/.output/server/_ssr/router-Czxvra6l.mjs +0 -685
  145. package/.output/server/_ssr/runDiff--qLtU4FI.mjs +0 -2
  146. package/.output/server/_ssr/store-40eVzW1S.mjs +0 -2
  147. package/.output/server/_ssr/tokens-CbfoRC_s.mjs +0 -2
  148. package/.output/server/drizzle/0001_naive_silver_fox.sql +0 -25
  149. package/.output/server/drizzle/0002_funny_sage.sql +0 -12
  150. package/.output/server/drizzle/0003_optimal_slapstick.sql +0 -102
  151. package/.output/server/drizzle/0004_remove_grok_agent.sql +0 -5
  152. package/.output/server/drizzle/0005_heavy_gauntlet.sql +0 -8
  153. package/.output/server/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  154. package/.output/server/drizzle/0007_faulty_starbolt.sql +0 -30
  155. package/.output/server/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  156. package/.output/server/drizzle/0009_ordinary_electro.sql +0 -1
  157. package/.output/server/drizzle/0010_workable_rage.sql +0 -14
  158. package/.output/server/drizzle/0011_steep_marvel_zombies.sql +0 -3
  159. package/.output/server/drizzle/0012_blocked_run_status.sql +0 -12
  160. package/.output/server/drizzle/0013_drop_run_outcome.sql +0 -2
  161. package/.output/server/drizzle/0014_luxuriant_scrambler.sql +0 -5
  162. package/.output/server/drizzle/0015_run_history_foundation.sql +0 -43
  163. package/.output/server/drizzle/0016_plural_machine_runs.sql +0 -4
  164. package/.output/server/drizzle/meta/0000_snapshot.json +0 -1333
  165. package/.output/server/drizzle/meta/0001_snapshot.json +0 -1498
  166. package/.output/server/drizzle/meta/0002_snapshot.json +0 -1576
  167. package/.output/server/drizzle/meta/0003_snapshot.json +0 -1666
  168. package/.output/server/drizzle/meta/0005_snapshot.json +0 -1666
  169. package/.output/server/drizzle/meta/0006_snapshot.json +0 -1672
  170. package/.output/server/drizzle/meta/0007_snapshot.json +0 -1787
  171. package/.output/server/drizzle/meta/0009_snapshot.json +0 -1793
  172. package/.output/server/drizzle/meta/0010_snapshot.json +0 -1891
  173. package/.output/server/drizzle/meta/0011_snapshot.json +0 -1872
  174. package/drizzle/0001_naive_silver_fox.sql +0 -25
  175. package/drizzle/0002_funny_sage.sql +0 -12
  176. package/drizzle/0003_optimal_slapstick.sql +0 -102
  177. package/drizzle/0004_remove_grok_agent.sql +0 -5
  178. package/drizzle/0005_heavy_gauntlet.sql +0 -8
  179. package/drizzle/0006_tranquil_sharon_carter.sql +0 -1
  180. package/drizzle/0007_faulty_starbolt.sql +0 -30
  181. package/drizzle/0008_durable_lifecycle_evidence.sql +0 -15
  182. package/drizzle/0009_ordinary_electro.sql +0 -1
  183. package/drizzle/0010_workable_rage.sql +0 -14
  184. package/drizzle/0011_steep_marvel_zombies.sql +0 -3
  185. package/drizzle/0012_blocked_run_status.sql +0 -12
  186. package/drizzle/0013_drop_run_outcome.sql +0 -2
  187. package/drizzle/0014_luxuriant_scrambler.sql +0 -5
  188. package/drizzle/0015_run_history_foundation.sql +0 -43
  189. package/drizzle/0016_plural_machine_runs.sql +0 -4
  190. package/drizzle/meta/0000_snapshot.json +0 -1333
  191. package/drizzle/meta/0001_snapshot.json +0 -1498
  192. package/drizzle/meta/0002_snapshot.json +0 -1576
  193. package/drizzle/meta/0003_snapshot.json +0 -1666
  194. package/drizzle/meta/0005_snapshot.json +0 -1666
  195. package/drizzle/meta/0006_snapshot.json +0 -1672
  196. package/drizzle/meta/0007_snapshot.json +0 -1787
  197. package/drizzle/meta/0009_snapshot.json +0 -1793
  198. package/drizzle/meta/0010_snapshot.json +0 -1891
  199. package/drizzle/meta/0011_snapshot.json +0 -1872
@@ -1,1736 +0,0 @@
1
- //#region ../../node_modules/.pnpm/reselect@5.2.0/node_modules/reselect/dist/reselect.mjs
2
- function assertIsFunction(func, errorMessage = `expected a function, instead received ${typeof func}`) {
3
- if (typeof func !== "function") throw new TypeError(errorMessage);
4
- }
5
- function assertIsArrayOfFunctions(array, errorMessage = `expected all items to be functions, instead received the following types: `) {
6
- if (!array.every((item) => typeof item === "function")) {
7
- const itemTypes = array.map((item) => typeof item === "function" ? `function ${item.name || "unnamed"}()` : typeof item).join(", ");
8
- throw new TypeError(`${errorMessage}[${itemTypes}]`);
9
- }
10
- }
11
- var ensureIsArray = (item) => {
12
- return Array.isArray(item) ? item : [item];
13
- };
14
- function getDependencies(createSelectorArgs) {
15
- const dependencies = Array.isArray(createSelectorArgs[0]) ? createSelectorArgs[0] : createSelectorArgs;
16
- assertIsArrayOfFunctions(dependencies, `createSelector expects all input-selectors to be functions, but received the following types: `);
17
- return dependencies;
18
- }
19
- function collectInputSelectorResults(dependencies, inputSelectorArgs) {
20
- const inputSelectorResults = [];
21
- const { length } = dependencies;
22
- for (let i = 0; i < length; i++) inputSelectorResults.push(dependencies[i].apply(null, inputSelectorArgs));
23
- return inputSelectorResults;
24
- }
25
- var StrongRef = class {
26
- constructor(value) {
27
- this.value = value;
28
- }
29
- deref() {
30
- return this.value;
31
- }
32
- };
33
- var getWeakRef = () => typeof WeakRef === "undefined" ? StrongRef : WeakRef;
34
- var Ref = /* @__PURE__ */ getWeakRef();
35
- var UNTERMINATED = 0;
36
- var TERMINATED = 1;
37
- function createCacheNode() {
38
- return {
39
- s: UNTERMINATED,
40
- v: void 0,
41
- o: null,
42
- p: null
43
- };
44
- }
45
- function maybeDeref(r) {
46
- if (r instanceof Ref) return r.deref();
47
- return r;
48
- }
49
- function weakMapMemoize(func, options = {}) {
50
- let fnNode = createCacheNode();
51
- const { resultEqualityCheck } = options;
52
- let lastResult;
53
- let resultsCount = 0;
54
- function memoized() {
55
- let cacheNode = fnNode;
56
- const { length } = arguments;
57
- for (let i = 0, l = length; i < l; i++) {
58
- const arg = arguments[i];
59
- if (typeof arg === "function" || typeof arg === "object" && arg !== null) {
60
- let objectCache = cacheNode.o;
61
- if (objectCache === null) cacheNode.o = objectCache = /* @__PURE__ */ new WeakMap();
62
- const objectNode = objectCache.get(arg);
63
- if (objectNode === void 0) {
64
- cacheNode = createCacheNode();
65
- objectCache.set(arg, cacheNode);
66
- } else cacheNode = objectNode;
67
- } else {
68
- let primitiveCache = cacheNode.p;
69
- if (primitiveCache === null) cacheNode.p = primitiveCache = /* @__PURE__ */ new Map();
70
- const primitiveNode = primitiveCache.get(arg);
71
- if (primitiveNode === void 0) {
72
- cacheNode = createCacheNode();
73
- primitiveCache.set(arg, cacheNode);
74
- } else cacheNode = primitiveNode;
75
- }
76
- }
77
- const terminatedNode = cacheNode;
78
- let result;
79
- if (cacheNode.s === TERMINATED) result = cacheNode.v;
80
- else {
81
- result = func.apply(null, arguments);
82
- resultsCount++;
83
- if (resultEqualityCheck) {
84
- const lastResultValue = maybeDeref(lastResult);
85
- if (lastResultValue != null && resultEqualityCheck(lastResultValue, result)) {
86
- result = lastResultValue;
87
- resultsCount !== 0 && resultsCount--;
88
- }
89
- lastResult = typeof result === "object" && result !== null || typeof result === "function" ? /* @__PURE__ */ new Ref(result) : result;
90
- }
91
- }
92
- terminatedNode.s = TERMINATED;
93
- terminatedNode.v = result;
94
- return result;
95
- }
96
- memoized.clearCache = () => {
97
- fnNode = createCacheNode();
98
- memoized.resetResultsCount();
99
- };
100
- memoized.resultsCount = () => resultsCount;
101
- memoized.resetResultsCount = () => {
102
- resultsCount = 0;
103
- };
104
- return memoized;
105
- }
106
- function createSelectorCreator(memoizeOrOptions, ...memoizeOptionsFromArgs) {
107
- const createSelectorCreatorOptions = typeof memoizeOrOptions === "function" ? {
108
- memoize: memoizeOrOptions,
109
- memoizeOptions: memoizeOptionsFromArgs
110
- } : memoizeOrOptions;
111
- const createSelector2 = (...createSelectorArgs) => {
112
- let recomputations = 0;
113
- let dependencyRecomputations = 0;
114
- let lastResult;
115
- let directlyPassedOptions = {};
116
- let resultFunc = createSelectorArgs.pop();
117
- if (typeof resultFunc === "object") {
118
- directlyPassedOptions = resultFunc;
119
- resultFunc = createSelectorArgs.pop();
120
- }
121
- assertIsFunction(resultFunc, `createSelector expects an output function after the inputs, but received: [${typeof resultFunc}]`);
122
- const { memoize, memoizeOptions = [], argsMemoize = weakMapMemoize, argsMemoizeOptions = [] } = {
123
- ...createSelectorCreatorOptions,
124
- ...directlyPassedOptions
125
- };
126
- const finalMemoizeOptions = ensureIsArray(memoizeOptions);
127
- const finalArgsMemoizeOptions = ensureIsArray(argsMemoizeOptions);
128
- const dependencies = getDependencies(createSelectorArgs);
129
- const memoizedResultFunc = memoize(function recomputationWrapper() {
130
- recomputations++;
131
- return resultFunc.apply(null, arguments);
132
- }, ...finalMemoizeOptions);
133
- const selector = argsMemoize(function dependenciesChecker() {
134
- dependencyRecomputations++;
135
- const inputSelectorResults = collectInputSelectorResults(dependencies, arguments);
136
- lastResult = memoizedResultFunc.apply(null, inputSelectorResults);
137
- return lastResult;
138
- }, ...finalArgsMemoizeOptions);
139
- return Object.assign(selector, {
140
- resultFunc,
141
- memoizedResultFunc,
142
- dependencies,
143
- dependencyRecomputations: () => dependencyRecomputations,
144
- resetDependencyRecomputations: () => {
145
- dependencyRecomputations = 0;
146
- },
147
- lastResult: () => lastResult,
148
- recomputations: () => recomputations,
149
- resetRecomputations: () => {
150
- recomputations = 0;
151
- },
152
- memoize,
153
- argsMemoize
154
- });
155
- };
156
- Object.assign(createSelector2, { withTypes: () => createSelector2 });
157
- return createSelector2;
158
- }
159
- var createSelector = /* @__PURE__ */ createSelectorCreator(weakMapMemoize);
160
- //#endregion
161
- //#region ../../node_modules/.pnpm/redux@5.0.1/node_modules/redux/dist/redux.mjs
162
- function formatProdErrorMessage$1(code) {
163
- return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
164
- }
165
- var symbol_observable_default = /* @__PURE__ */ (() => typeof Symbol === "function" && Symbol.observable || "@@observable")();
166
- var randomString = () => Math.random().toString(36).substring(7).split("").join(".");
167
- var actionTypes_default = {
168
- INIT: `@@redux/INIT${/* @__PURE__ */ randomString()}`,
169
- REPLACE: `@@redux/REPLACE${/* @__PURE__ */ randomString()}`,
170
- PROBE_UNKNOWN_ACTION: () => `@@redux/PROBE_UNKNOWN_ACTION${randomString()}`
171
- };
172
- function isPlainObject$1(obj) {
173
- if (typeof obj !== "object" || obj === null) return false;
174
- let proto = obj;
175
- while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
176
- return Object.getPrototypeOf(obj) === proto || Object.getPrototypeOf(obj) === null;
177
- }
178
- function createStore(reducer, preloadedState, enhancer) {
179
- if (typeof reducer !== "function") throw new Error(formatProdErrorMessage$1(2));
180
- if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") throw new Error(formatProdErrorMessage$1(0));
181
- if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
182
- enhancer = preloadedState;
183
- preloadedState = void 0;
184
- }
185
- if (typeof enhancer !== "undefined") {
186
- if (typeof enhancer !== "function") throw new Error(formatProdErrorMessage$1(1));
187
- return enhancer(createStore)(reducer, preloadedState);
188
- }
189
- let currentReducer = reducer;
190
- let currentState = preloadedState;
191
- let currentListeners = /* @__PURE__ */ new Map();
192
- let nextListeners = currentListeners;
193
- let listenerIdCounter = 0;
194
- let isDispatching = false;
195
- function ensureCanMutateNextListeners() {
196
- if (nextListeners === currentListeners) {
197
- nextListeners = /* @__PURE__ */ new Map();
198
- currentListeners.forEach((listener, key) => {
199
- nextListeners.set(key, listener);
200
- });
201
- }
202
- }
203
- function getState() {
204
- if (isDispatching) throw new Error(formatProdErrorMessage$1(3));
205
- return currentState;
206
- }
207
- function subscribe(listener) {
208
- if (typeof listener !== "function") throw new Error(formatProdErrorMessage$1(4));
209
- if (isDispatching) throw new Error(formatProdErrorMessage$1(5));
210
- let isSubscribed = true;
211
- ensureCanMutateNextListeners();
212
- const listenerId = listenerIdCounter++;
213
- nextListeners.set(listenerId, listener);
214
- return function unsubscribe() {
215
- if (!isSubscribed) return;
216
- if (isDispatching) throw new Error(formatProdErrorMessage$1(6));
217
- isSubscribed = false;
218
- ensureCanMutateNextListeners();
219
- nextListeners.delete(listenerId);
220
- currentListeners = null;
221
- };
222
- }
223
- function dispatch(action) {
224
- if (!isPlainObject$1(action)) throw new Error(formatProdErrorMessage$1(7));
225
- if (typeof action.type === "undefined") throw new Error(formatProdErrorMessage$1(8));
226
- if (typeof action.type !== "string") throw new Error(formatProdErrorMessage$1(17));
227
- if (isDispatching) throw new Error(formatProdErrorMessage$1(9));
228
- try {
229
- isDispatching = true;
230
- currentState = currentReducer(currentState, action);
231
- } finally {
232
- isDispatching = false;
233
- }
234
- (currentListeners = nextListeners).forEach((listener) => {
235
- listener();
236
- });
237
- return action;
238
- }
239
- function replaceReducer(nextReducer) {
240
- if (typeof nextReducer !== "function") throw new Error(formatProdErrorMessage$1(10));
241
- currentReducer = nextReducer;
242
- dispatch({ type: actionTypes_default.REPLACE });
243
- }
244
- function observable() {
245
- const outerSubscribe = subscribe;
246
- return {
247
- /**
248
- * The minimal observable subscription method.
249
- * @param observer Any object that can be used as an observer.
250
- * The observer object should have a `next` method.
251
- * @returns An object with an `unsubscribe` method that can
252
- * be used to unsubscribe the observable from the store, and prevent further
253
- * emission of values from the observable.
254
- */
255
- subscribe(observer) {
256
- if (typeof observer !== "object" || observer === null) throw new Error(formatProdErrorMessage$1(11));
257
- function observeState() {
258
- const observerAsObserver = observer;
259
- if (observerAsObserver.next) observerAsObserver.next(getState());
260
- }
261
- observeState();
262
- return { unsubscribe: outerSubscribe(observeState) };
263
- },
264
- [symbol_observable_default]() {
265
- return this;
266
- }
267
- };
268
- }
269
- dispatch({ type: actionTypes_default.INIT });
270
- return {
271
- dispatch,
272
- subscribe,
273
- getState,
274
- replaceReducer,
275
- [symbol_observable_default]: observable
276
- };
277
- }
278
- function assertReducerShape(reducers) {
279
- Object.keys(reducers).forEach((key) => {
280
- const reducer = reducers[key];
281
- if (typeof reducer(void 0, { type: actionTypes_default.INIT }) === "undefined") throw new Error(formatProdErrorMessage$1(12));
282
- if (typeof reducer(void 0, { type: actionTypes_default.PROBE_UNKNOWN_ACTION() }) === "undefined") throw new Error(formatProdErrorMessage$1(13));
283
- });
284
- }
285
- function combineReducers(reducers) {
286
- const reducerKeys = Object.keys(reducers);
287
- const finalReducers = {};
288
- for (let i = 0; i < reducerKeys.length; i++) {
289
- const key = reducerKeys[i];
290
- if (typeof reducers[key] === "function") finalReducers[key] = reducers[key];
291
- }
292
- const finalReducerKeys = Object.keys(finalReducers);
293
- let shapeAssertionError;
294
- try {
295
- assertReducerShape(finalReducers);
296
- } catch (e) {
297
- shapeAssertionError = e;
298
- }
299
- return function combination(state = {}, action) {
300
- if (shapeAssertionError) throw shapeAssertionError;
301
- let hasChanged = false;
302
- const nextState = {};
303
- for (let i = 0; i < finalReducerKeys.length; i++) {
304
- const key = finalReducerKeys[i];
305
- const reducer = finalReducers[key];
306
- const previousStateForKey = state[key];
307
- const nextStateForKey = reducer(previousStateForKey, action);
308
- if (typeof nextStateForKey === "undefined") {
309
- action && action.type;
310
- throw new Error(formatProdErrorMessage$1(14));
311
- }
312
- nextState[key] = nextStateForKey;
313
- hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
314
- }
315
- hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
316
- return hasChanged ? nextState : state;
317
- };
318
- }
319
- function compose(...funcs) {
320
- if (funcs.length === 0) return (arg) => arg;
321
- if (funcs.length === 1) return funcs[0];
322
- return funcs.reduce((a, b) => (...args) => a(b(...args)));
323
- }
324
- function applyMiddleware(...middlewares) {
325
- return (createStore2) => (reducer, preloadedState) => {
326
- const store = createStore2(reducer, preloadedState);
327
- let dispatch = () => {
328
- throw new Error(formatProdErrorMessage$1(15));
329
- };
330
- const middlewareAPI = {
331
- getState: store.getState,
332
- dispatch: (action, ...args) => dispatch(action, ...args)
333
- };
334
- dispatch = compose(...middlewares.map((middleware) => middleware(middlewareAPI)))(store.dispatch);
335
- return {
336
- ...store,
337
- dispatch
338
- };
339
- };
340
- }
341
- function isAction(action) {
342
- return isPlainObject$1(action) && "type" in action && typeof action.type === "string";
343
- }
344
- //#endregion
345
- //#region ../../node_modules/.pnpm/immer@11.1.9/node_modules/immer/dist/immer.mjs
346
- var NOTHING = Symbol.for("immer-nothing");
347
- var DRAFTABLE = Symbol.for("immer-draftable");
348
- var DRAFT_STATE = Symbol.for("immer-state");
349
- function die(error, ...args) {
350
- throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
351
- }
352
- var O = Object;
353
- var getPrototypeOf = O.getPrototypeOf;
354
- var CONSTRUCTOR = "constructor";
355
- var PROTOTYPE = "prototype";
356
- var CONFIGURABLE = "configurable";
357
- var ENUMERABLE = "enumerable";
358
- var WRITABLE = "writable";
359
- var VALUE = "value";
360
- var isDraft = (value) => !!value && !!value[DRAFT_STATE];
361
- function isDraftable(value) {
362
- if (!value) return false;
363
- return isPlainObject(value) || isArray(value) || !!value[DRAFTABLE] || !!value[CONSTRUCTOR]?.[DRAFTABLE] || isMap(value) || isSet(value);
364
- }
365
- var objectCtorString = O[PROTOTYPE][CONSTRUCTOR].toString();
366
- var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
367
- function isPlainObject(value) {
368
- if (!value || !isObjectish(value)) return false;
369
- const proto = getPrototypeOf(value);
370
- if (proto === null || proto === O[PROTOTYPE]) return true;
371
- const Ctor = O.hasOwnProperty.call(proto, CONSTRUCTOR) && proto[CONSTRUCTOR];
372
- if (Ctor === Object) return true;
373
- if (!isFunction(Ctor)) return false;
374
- let ctorString = cachedCtorStrings.get(Ctor);
375
- if (ctorString === void 0) {
376
- ctorString = Function.toString.call(Ctor);
377
- cachedCtorStrings.set(Ctor, ctorString);
378
- }
379
- return ctorString === objectCtorString;
380
- }
381
- function each(obj, iter, strict = true) {
382
- if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : O.keys(obj)).forEach((key) => {
383
- iter(key, obj[key], obj);
384
- });
385
- else obj.forEach((entry, index) => iter(index, entry, obj));
386
- }
387
- function getArchtype(thing) {
388
- const state = thing[DRAFT_STATE];
389
- return state ? state.type_ : isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
390
- }
391
- var has = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.has(prop) : O[PROTOTYPE].hasOwnProperty.call(thing, prop);
392
- var get = (thing, prop, type = getArchtype(thing)) => type === 2 ? thing.get(prop) : thing[prop];
393
- var set = (thing, propOrOldValue, value, type = getArchtype(thing)) => {
394
- if (type === 2) thing.set(propOrOldValue, value);
395
- else if (type === 3) thing.add(value);
396
- else thing[propOrOldValue] = value;
397
- };
398
- function is(x, y) {
399
- if (x === y) return x !== 0 || 1 / x === 1 / y;
400
- else return x !== x && y !== y;
401
- }
402
- var isArray = Array.isArray;
403
- var isMap = (target) => target instanceof Map;
404
- var isSet = (target) => target instanceof Set;
405
- var isObjectish = (target) => typeof target === "object";
406
- var isFunction = (target) => typeof target === "function";
407
- var isBoolean$1 = (target) => typeof target === "boolean";
408
- function isArrayIndex(value) {
409
- const n = +value;
410
- return Number.isInteger(n) && String(n) === value;
411
- }
412
- var latest = (state) => state.copy_ || state.base_;
413
- var getFinalValue = (state) => state.modified_ ? state.copy_ : state.base_;
414
- function shallowCopy(base, strict) {
415
- if (isMap(base)) return new Map(base);
416
- if (isSet(base)) return new Set(base);
417
- if (isArray(base)) return Array[PROTOTYPE].slice.call(base);
418
- const isPlain = isPlainObject(base);
419
- if (strict === true || strict === "class_only" && !isPlain) {
420
- const descriptors = O.getOwnPropertyDescriptors(base);
421
- delete descriptors[DRAFT_STATE];
422
- let keys = Reflect.ownKeys(descriptors);
423
- for (let i = 0; i < keys.length; i++) {
424
- const key = keys[i];
425
- const desc = descriptors[key];
426
- if (desc[WRITABLE] === false) {
427
- desc[WRITABLE] = true;
428
- desc[CONFIGURABLE] = true;
429
- }
430
- if (desc.get || desc.set) descriptors[key] = {
431
- [CONFIGURABLE]: true,
432
- [WRITABLE]: true,
433
- [ENUMERABLE]: desc[ENUMERABLE],
434
- [VALUE]: base[key]
435
- };
436
- }
437
- return O.create(getPrototypeOf(base), descriptors);
438
- } else {
439
- const proto = getPrototypeOf(base);
440
- if (proto !== null && isPlain) return { ...base };
441
- const obj = O.create(proto);
442
- return O.assign(obj, base);
443
- }
444
- }
445
- function freeze(obj, deep = false) {
446
- if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
447
- if (getArchtype(obj) > 1) O.defineProperties(obj, {
448
- set: dontMutateMethodOverride,
449
- add: dontMutateMethodOverride,
450
- clear: dontMutateMethodOverride,
451
- delete: dontMutateMethodOverride
452
- });
453
- O.freeze(obj);
454
- if (deep) each(obj, (_key, value) => {
455
- freeze(value, true);
456
- }, false);
457
- return obj;
458
- }
459
- function dontMutateFrozenCollections() {
460
- die(2);
461
- }
462
- var dontMutateMethodOverride = { [VALUE]: dontMutateFrozenCollections };
463
- function isFrozen(obj) {
464
- if (obj === null || !isObjectish(obj)) return true;
465
- return O.isFrozen(obj);
466
- }
467
- var PluginMapSet = "MapSet";
468
- var PluginPatches = "Patches";
469
- var PluginArrayMethods = "ArrayMethods";
470
- var plugins = {};
471
- function getPlugin(pluginKey) {
472
- const plugin = plugins[pluginKey];
473
- if (!plugin) die(0, pluginKey);
474
- return plugin;
475
- }
476
- var isPluginLoaded = (pluginKey) => !!plugins[pluginKey];
477
- var currentScope;
478
- var getCurrentScope = () => currentScope;
479
- var createScope = (parent_, immer_) => ({
480
- drafts_: [],
481
- parent_,
482
- immer_,
483
- canAutoFreeze_: true,
484
- unfinalizedDrafts_: 0,
485
- handledSet_: /* @__PURE__ */ new Set(),
486
- processedForPatches_: /* @__PURE__ */ new Set(),
487
- mapSetPlugin_: isPluginLoaded(PluginMapSet) ? getPlugin(PluginMapSet) : void 0,
488
- arrayMethodsPlugin_: isPluginLoaded(PluginArrayMethods) ? getPlugin(PluginArrayMethods) : void 0
489
- });
490
- function usePatchesInScope(scope, patchListener) {
491
- if (patchListener) {
492
- scope.patchPlugin_ = getPlugin(PluginPatches);
493
- scope.patches_ = [];
494
- scope.inversePatches_ = [];
495
- scope.patchListener_ = patchListener;
496
- }
497
- }
498
- function revokeScope(scope) {
499
- leaveScope(scope);
500
- scope.drafts_.forEach(revokeDraft);
501
- scope.drafts_ = null;
502
- }
503
- function leaveScope(scope) {
504
- if (scope === currentScope) currentScope = scope.parent_;
505
- }
506
- var enterScope = (immer2) => currentScope = createScope(currentScope, immer2);
507
- function revokeDraft(draft) {
508
- const state = draft[DRAFT_STATE];
509
- if (state.type_ === 0 || state.type_ === 1) state.revoke_();
510
- else state.revoked_ = true;
511
- }
512
- function processResult(result, scope) {
513
- scope.unfinalizedDrafts_ = scope.drafts_.length;
514
- const baseDraft = scope.drafts_[0];
515
- if (result !== void 0 && result !== baseDraft) {
516
- if (baseDraft[DRAFT_STATE].modified_) {
517
- revokeScope(scope);
518
- die(4);
519
- }
520
- if (isDraftable(result)) result = finalize(scope, result);
521
- const { patchPlugin_ } = scope;
522
- if (patchPlugin_) patchPlugin_.generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope);
523
- } else result = finalize(scope, baseDraft);
524
- maybeFreeze(scope, result, true);
525
- revokeScope(scope);
526
- if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
527
- return result !== NOTHING ? result : void 0;
528
- }
529
- function finalize(rootScope, value) {
530
- if (isFrozen(value)) return value;
531
- const state = value[DRAFT_STATE];
532
- if (!state) return handleValue(value, rootScope.handledSet_, rootScope);
533
- if (!isSameScope(state, rootScope)) return value;
534
- if (!state.modified_) return state.base_;
535
- if (!state.finalized_) {
536
- const { callbacks_ } = state;
537
- if (callbacks_) while (callbacks_.length > 0) callbacks_.pop()(rootScope);
538
- generatePatchesAndFinalize(state, rootScope);
539
- }
540
- return state.copy_;
541
- }
542
- function maybeFreeze(scope, value, deep = false) {
543
- if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
544
- }
545
- function markStateFinalized(state) {
546
- state.finalized_ = true;
547
- state.scope_.unfinalizedDrafts_--;
548
- }
549
- var isSameScope = (state, rootScope) => state.scope_ === rootScope;
550
- var EMPTY_LOCATIONS_RESULT = [];
551
- function updateDraftInParent(parent, draftValue, finalizedValue, originalKey) {
552
- const parentCopy = latest(parent);
553
- const parentType = parent.type_;
554
- if (originalKey !== void 0) {
555
- if (get(parentCopy, originalKey, parentType) === draftValue) {
556
- set(parentCopy, originalKey, finalizedValue, parentType);
557
- return;
558
- }
559
- }
560
- if (!parent.draftLocations_) {
561
- const draftLocations = parent.draftLocations_ = /* @__PURE__ */ new Map();
562
- each(parentCopy, (key, value) => {
563
- if (isDraft(value)) {
564
- const keys = draftLocations.get(value) || [];
565
- keys.push(key);
566
- draftLocations.set(value, keys);
567
- }
568
- });
569
- }
570
- const locations = parent.draftLocations_.get(draftValue) ?? EMPTY_LOCATIONS_RESULT;
571
- for (const location of locations) set(parentCopy, location, finalizedValue, parentType);
572
- }
573
- function registerChildFinalizationCallback(parent, child, key) {
574
- parent.callbacks_.push(function childCleanup(rootScope) {
575
- const state = child;
576
- if (!state || !isSameScope(state, rootScope)) return;
577
- rootScope.mapSetPlugin_?.fixSetContents(state);
578
- const finalizedValue = getFinalValue(state);
579
- updateDraftInParent(parent, state.draft_ ?? state, finalizedValue, key);
580
- generatePatchesAndFinalize(state, rootScope);
581
- });
582
- }
583
- function generatePatchesAndFinalize(state, rootScope) {
584
- if (state.modified_ && !state.finalized_ && (state.type_ === 3 || state.type_ === 1 && state.allIndicesReassigned_ || (state.assigned_?.size ?? 0) > 0)) {
585
- const { patchPlugin_ } = rootScope;
586
- if (patchPlugin_) {
587
- const basePath = patchPlugin_.getPath(state);
588
- if (basePath) patchPlugin_.generatePatches_(state, basePath, rootScope);
589
- }
590
- markStateFinalized(state);
591
- }
592
- }
593
- function handleCrossReference(target, key, value) {
594
- const { scope_ } = target;
595
- if (isDraft(value)) {
596
- const state = value[DRAFT_STATE];
597
- if (isSameScope(state, scope_)) state.callbacks_.push(function crossReferenceCleanup() {
598
- prepareCopy(target);
599
- updateDraftInParent(target, value, getFinalValue(state), key);
600
- });
601
- } else if (isDraftable(value)) target.callbacks_.push(function nestedDraftCleanup() {
602
- const targetCopy = latest(target);
603
- if (target.type_ === 3) {
604
- if (targetCopy.has(value)) handleValue(value, scope_.handledSet_, scope_);
605
- } else if (get(targetCopy, key, target.type_) === value) {
606
- if (scope_.drafts_.length > 1 && (target.assigned_.get(key) ?? false) === true && target.copy_) handleValue(get(target.copy_, key, target.type_), scope_.handledSet_, scope_);
607
- }
608
- });
609
- }
610
- function handleValue(target, handledSet, rootScope) {
611
- if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return target;
612
- if (isDraft(target) || handledSet.has(target) || !isDraftable(target) || isFrozen(target)) return target;
613
- handledSet.add(target);
614
- each(target, (key, value) => {
615
- if (isDraft(value)) {
616
- const state = value[DRAFT_STATE];
617
- if (isSameScope(state, rootScope)) {
618
- set(target, key, getFinalValue(state), target.type_);
619
- markStateFinalized(state);
620
- }
621
- } else if (isDraftable(value)) handleValue(value, handledSet, rootScope);
622
- });
623
- return target;
624
- }
625
- function createProxyProxy(base, parent) {
626
- const baseIsArray = isArray(base);
627
- const state = {
628
- type_: baseIsArray ? 1 : 0,
629
- scope_: parent ? parent.scope_ : getCurrentScope(),
630
- modified_: false,
631
- finalized_: false,
632
- assigned_: void 0,
633
- parent_: parent,
634
- base_: base,
635
- draft_: null,
636
- copy_: null,
637
- revoke_: null,
638
- isManual_: false,
639
- callbacks_: void 0
640
- };
641
- let target = state;
642
- let traps = objectTraps;
643
- if (baseIsArray) {
644
- target = [state];
645
- traps = arrayTraps;
646
- }
647
- const { revoke, proxy } = Proxy.revocable(target, traps);
648
- state.draft_ = proxy;
649
- state.revoke_ = revoke;
650
- return [proxy, state];
651
- }
652
- var objectTraps = {
653
- get(state, prop) {
654
- if (prop === DRAFT_STATE) return state;
655
- if (prop === "constructor" || prop === "__proto__") {
656
- const value2 = latest(state)[prop];
657
- return new Proxy(value2 || {}, {
658
- get: (target, key) => {
659
- if (key === "__proto__" || key === "prototype") return Object.freeze(/* @__PURE__ */ Object.create(null));
660
- return Reflect.get(target, key);
661
- },
662
- set: () => {
663
- return true;
664
- },
665
- apply: (target, thisArg, args) => {
666
- return Reflect.apply(target, thisArg, args);
667
- }
668
- });
669
- }
670
- let arrayPlugin = state.scope_.arrayMethodsPlugin_;
671
- const isArrayWithStringProp = state.type_ === 1 && typeof prop === "string";
672
- if (isArrayWithStringProp) {
673
- if (arrayPlugin?.isArrayOperationMethod(prop)) return arrayPlugin.createMethodInterceptor(state, prop);
674
- }
675
- const source = latest(state);
676
- if (!has(source, prop, state.type_)) return readPropFromProto(state, source, prop);
677
- const value = source[prop];
678
- if (state.finalized_ || !isDraftable(value)) return value;
679
- if (isArrayWithStringProp && state.operationMethod && arrayPlugin?.isMutatingArrayMethod(state.operationMethod) && isArrayIndex(prop)) return value;
680
- if (value === peek(state.base_, prop)) {
681
- prepareCopy(state);
682
- const childKey = state.type_ === 1 ? +prop : prop;
683
- const childDraft = createProxy(state.scope_, value, state, childKey);
684
- return state.copy_[childKey] = childDraft;
685
- }
686
- return value;
687
- },
688
- has(state, prop) {
689
- if (prop === "constructor" || prop === "__proto__" || prop === "prototype") return false;
690
- return prop in latest(state);
691
- },
692
- ownKeys(state) {
693
- return Reflect.ownKeys(latest(state));
694
- },
695
- set(state, prop, value) {
696
- if (prop === "constructor" || prop === "__proto__" || prop === "prototype") return true;
697
- const desc = getDescriptorFromProto(latest(state), prop);
698
- if (desc?.set) {
699
- desc.set.call(state.draft_, value);
700
- return true;
701
- }
702
- if (!state.modified_) {
703
- const current2 = peek(latest(state), prop);
704
- const currentState = current2?.[DRAFT_STATE];
705
- if (currentState && currentState.base_ === value) {
706
- state.copy_[prop] = value;
707
- state.assigned_.set(prop, false);
708
- return true;
709
- }
710
- if (is(value, current2) && (value !== void 0 || has(state.base_, prop, state.type_))) return true;
711
- prepareCopy(state);
712
- markChanged(state);
713
- }
714
- if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
715
- state.copy_[prop] = value;
716
- state.assigned_.set(prop, true);
717
- handleCrossReference(state, prop, value);
718
- return true;
719
- },
720
- deleteProperty(state, prop) {
721
- prepareCopy(state);
722
- if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
723
- state.assigned_.set(prop, false);
724
- markChanged(state);
725
- } else state.assigned_.delete(prop);
726
- if (state.copy_) delete state.copy_[prop];
727
- return true;
728
- },
729
- getOwnPropertyDescriptor(state, prop) {
730
- const owner = latest(state);
731
- const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
732
- if (!desc) return desc;
733
- return {
734
- [WRITABLE]: true,
735
- [CONFIGURABLE]: state.type_ !== 1 || prop !== "length",
736
- [ENUMERABLE]: desc[ENUMERABLE],
737
- [VALUE]: owner[prop]
738
- };
739
- },
740
- defineProperty() {
741
- die(11);
742
- },
743
- getPrototypeOf(state) {
744
- return getPrototypeOf(state.base_);
745
- },
746
- setPrototypeOf() {
747
- die(12);
748
- }
749
- };
750
- var arrayTraps = {};
751
- for (let key in objectTraps) {
752
- let fn = objectTraps[key];
753
- arrayTraps[key] = function() {
754
- const args = arguments;
755
- args[0] = args[0][0];
756
- return fn.apply(this, args);
757
- };
758
- }
759
- arrayTraps.deleteProperty = function(state, prop) {
760
- return arrayTraps.set.call(this, state, prop, void 0);
761
- };
762
- arrayTraps.set = function(state, prop, value) {
763
- return objectTraps.set.call(this, state[0], prop, value, state[0]);
764
- };
765
- function peek(draft, prop) {
766
- const state = draft[DRAFT_STATE];
767
- return (state ? latest(state) : draft)[prop];
768
- }
769
- function readPropFromProto(state, source, prop) {
770
- const desc = getDescriptorFromProto(source, prop);
771
- return desc ? VALUE in desc ? desc[VALUE] : desc.get?.call(state.draft_) : void 0;
772
- }
773
- function getDescriptorFromProto(source, prop) {
774
- if (!(prop in source)) return void 0;
775
- let proto = getPrototypeOf(source);
776
- while (proto) {
777
- const desc = Object.getOwnPropertyDescriptor(proto, prop);
778
- if (desc) return desc;
779
- proto = getPrototypeOf(proto);
780
- }
781
- }
782
- function markChanged(state) {
783
- if (!state.modified_) {
784
- state.modified_ = true;
785
- if (state.parent_) markChanged(state.parent_);
786
- }
787
- }
788
- function prepareCopy(state) {
789
- if (!state.copy_) {
790
- state.assigned_ = /* @__PURE__ */ new Map();
791
- state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
792
- }
793
- }
794
- var Immer2 = class {
795
- constructor(config) {
796
- this.autoFreeze_ = true;
797
- this.useStrictShallowCopy_ = false;
798
- this.useStrictIteration_ = false;
799
- /**
800
- * The `produce` function takes a value and a "recipe function" (whose
801
- * return value often depends on the base state). The recipe function is
802
- * free to mutate its first argument however it wants. All mutations are
803
- * only ever applied to a __copy__ of the base state.
804
- *
805
- * Pass only a function to create a "curried producer" which relieves you
806
- * from passing the recipe function every time.
807
- *
808
- * Only plain objects and arrays are made mutable. All other objects are
809
- * considered uncopyable.
810
- *
811
- * Note: This function is __bound__ to its `Immer` instance.
812
- *
813
- * @param {any} base - the initial state
814
- * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
815
- * @param {Function} patchListener - optional function that will be called with all the patches produced here
816
- * @returns {any} a new state, or the initial state if nothing was modified
817
- */
818
- this.produce = (base, recipe, patchListener) => {
819
- if (isFunction(base) && !isFunction(recipe)) {
820
- const defaultBase = recipe;
821
- recipe = base;
822
- const self = this;
823
- return function curriedProduce(base2 = defaultBase, ...args) {
824
- return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
825
- };
826
- }
827
- if (!isFunction(recipe)) die(6);
828
- if (patchListener !== void 0 && !isFunction(patchListener)) die(7);
829
- let result;
830
- if (isDraftable(base)) {
831
- const scope = enterScope(this);
832
- const proxy = createProxy(scope, base, void 0);
833
- let hasError = true;
834
- try {
835
- result = recipe(proxy);
836
- hasError = false;
837
- } finally {
838
- if (hasError) revokeScope(scope);
839
- else leaveScope(scope);
840
- }
841
- usePatchesInScope(scope, patchListener);
842
- return processResult(result, scope);
843
- } else if (!base || !isObjectish(base)) {
844
- result = recipe(base);
845
- if (result === void 0) result = base;
846
- if (result === NOTHING) result = void 0;
847
- if (this.autoFreeze_) freeze(result, true);
848
- if (patchListener) {
849
- const p = [];
850
- const ip = [];
851
- getPlugin(PluginPatches).generateReplacementPatches_(base, result, {
852
- patches_: p,
853
- inversePatches_: ip
854
- });
855
- patchListener(p, ip);
856
- }
857
- return result;
858
- } else die(1, base);
859
- };
860
- this.produceWithPatches = (base, recipe) => {
861
- if (isFunction(base)) return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
862
- let patches, inversePatches;
863
- return [
864
- this.produce(base, recipe, (p, ip) => {
865
- patches = p;
866
- inversePatches = ip;
867
- }),
868
- patches,
869
- inversePatches
870
- ];
871
- };
872
- if (isBoolean$1(config?.autoFreeze)) this.setAutoFreeze(config.autoFreeze);
873
- if (isBoolean$1(config?.useStrictShallowCopy)) this.setUseStrictShallowCopy(config.useStrictShallowCopy);
874
- if (isBoolean$1(config?.useStrictIteration)) this.setUseStrictIteration(config.useStrictIteration);
875
- }
876
- createDraft(base) {
877
- if (!isDraftable(base)) die(8);
878
- if (isDraft(base)) base = current(base);
879
- const scope = enterScope(this);
880
- const proxy = createProxy(scope, base, void 0);
881
- proxy[DRAFT_STATE].isManual_ = true;
882
- leaveScope(scope);
883
- return proxy;
884
- }
885
- finishDraft(draft, patchListener) {
886
- const state = draft && draft[DRAFT_STATE];
887
- if (!state || !state.isManual_) die(9);
888
- const { scope_: scope } = state;
889
- usePatchesInScope(scope, patchListener);
890
- return processResult(void 0, scope);
891
- }
892
- /**
893
- * Pass true to automatically freeze all copies created by Immer.
894
- *
895
- * By default, auto-freezing is enabled.
896
- */
897
- setAutoFreeze(value) {
898
- this.autoFreeze_ = value;
899
- }
900
- /**
901
- * Pass true to enable strict shallow copy.
902
- *
903
- * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
904
- */
905
- setUseStrictShallowCopy(value) {
906
- this.useStrictShallowCopy_ = value;
907
- }
908
- /**
909
- * Pass false to use faster iteration that skips non-enumerable properties
910
- * but still handles symbols for compatibility.
911
- *
912
- * By default, strict iteration is enabled (includes all own properties).
913
- */
914
- setUseStrictIteration(value) {
915
- this.useStrictIteration_ = value;
916
- }
917
- shouldUseStrictIteration() {
918
- return this.useStrictIteration_;
919
- }
920
- applyPatches(base, patches) {
921
- let i;
922
- for (i = patches.length - 1; i >= 0; i--) {
923
- const patch = patches[i];
924
- if (patch.path.length === 0 && patch.op === "replace") {
925
- base = patch.value;
926
- break;
927
- }
928
- }
929
- if (i > -1) patches = patches.slice(i + 1);
930
- const applyPatchesImpl = getPlugin(PluginPatches).applyPatches_;
931
- if (isDraft(base)) return applyPatchesImpl(base, patches);
932
- return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
933
- }
934
- };
935
- function createProxy(rootScope, value, parent, key) {
936
- const [draft, state] = isMap(value) ? getPlugin(PluginMapSet).proxyMap_(value, parent) : isSet(value) ? getPlugin(PluginMapSet).proxySet_(value, parent) : createProxyProxy(value, parent);
937
- (parent?.scope_ ?? getCurrentScope()).drafts_.push(draft);
938
- state.callbacks_ = parent?.callbacks_ ?? [];
939
- state.key_ = key;
940
- if (parent && key !== void 0) registerChildFinalizationCallback(parent, state, key);
941
- else state.callbacks_.push(function rootDraftCleanup(rootScope2) {
942
- rootScope2.mapSetPlugin_?.fixSetContents(state);
943
- const { patchPlugin_ } = rootScope2;
944
- if (state.modified_ && patchPlugin_) patchPlugin_.generatePatches_(state, [], rootScope2);
945
- });
946
- return draft;
947
- }
948
- function current(value) {
949
- if (!isDraft(value)) die(10, value);
950
- return currentImpl(value);
951
- }
952
- function currentImpl(value) {
953
- if (!isDraftable(value) || isFrozen(value)) return value;
954
- const state = value[DRAFT_STATE];
955
- let copy;
956
- let strict = true;
957
- if (state) {
958
- if (!state.modified_) return state.base_;
959
- state.finalized_ = true;
960
- copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
961
- strict = state.scope_.immer_.shouldUseStrictIteration();
962
- } else copy = shallowCopy(value, true);
963
- each(copy, (key, childValue) => {
964
- set(copy, key, currentImpl(childValue));
965
- }, strict);
966
- if (state) state.finalized_ = false;
967
- return copy;
968
- }
969
- var produce = new Immer2().produce;
970
- var castDraft = (value) => value;
971
- //#endregion
972
- //#region ../../node_modules/.pnpm/redux-thunk@3.1.0_redux@5.0.1/node_modules/redux-thunk/dist/redux-thunk.mjs
973
- function createThunkMiddleware(extraArgument) {
974
- const middleware = ({ dispatch, getState }) => (next) => (action) => {
975
- if (typeof action === "function") return action(dispatch, getState, extraArgument);
976
- return next(action);
977
- };
978
- return middleware;
979
- }
980
- var thunk = createThunkMiddleware();
981
- var withExtraArgument = createThunkMiddleware;
982
- //#endregion
983
- //#region ../../node_modules/.pnpm/@reduxjs+toolkit@2.12.0_react-redux@9.3.0_react@19.2.7/node_modules/@reduxjs/toolkit/dist/redux-toolkit.modern.mjs
984
- var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
985
- if (arguments.length === 0) return void 0;
986
- if (typeof arguments[0] === "object") return compose;
987
- return compose.apply(null, arguments);
988
- };
989
- typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__;
990
- function createAction(type, prepareAction) {
991
- function actionCreator(...args) {
992
- if (prepareAction) {
993
- let prepared = prepareAction(...args);
994
- if (!prepared) throw new Error(formatProdErrorMessage(0));
995
- return {
996
- type,
997
- payload: prepared.payload,
998
- ..."meta" in prepared && { meta: prepared.meta },
999
- ..."error" in prepared && { error: prepared.error }
1000
- };
1001
- }
1002
- return {
1003
- type,
1004
- payload: args[0]
1005
- };
1006
- }
1007
- actionCreator.toString = () => `${type}`;
1008
- actionCreator.type = type;
1009
- actionCreator.match = (action) => isAction(action) && action.type === type;
1010
- return actionCreator;
1011
- }
1012
- var Tuple = class _Tuple extends Array {
1013
- constructor(...items) {
1014
- super(...items);
1015
- Object.setPrototypeOf(this, _Tuple.prototype);
1016
- }
1017
- static get [Symbol.species]() {
1018
- return _Tuple;
1019
- }
1020
- concat(...arr) {
1021
- return super.concat.apply(this, arr);
1022
- }
1023
- prepend(...arr) {
1024
- if (arr.length === 1 && Array.isArray(arr[0])) return new _Tuple(...arr[0].concat(this));
1025
- return new _Tuple(...arr.concat(this));
1026
- }
1027
- };
1028
- function freezeDraftable(val) {
1029
- return isDraftable(val) ? produce(val, () => {}) : val;
1030
- }
1031
- function getOrInsertComputed(map, key, compute) {
1032
- if (map.has(key)) return map.get(key);
1033
- return map.set(key, compute(key)).get(key);
1034
- }
1035
- function isBoolean(x) {
1036
- return typeof x === "boolean";
1037
- }
1038
- var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
1039
- const { thunk: thunk$1 = true, immutableCheck = true, serializableCheck = true, actionCreatorCheck = true } = options ?? {};
1040
- let middlewareArray = new Tuple();
1041
- if (thunk$1) if (isBoolean(thunk$1)) middlewareArray.push(thunk);
1042
- else middlewareArray.push(withExtraArgument(thunk$1.extraArgument));
1043
- return middlewareArray;
1044
- };
1045
- var SHOULD_AUTOBATCH = "RTK_autoBatch";
1046
- var prepareAutoBatched = () => (payload) => ({
1047
- payload,
1048
- meta: { [SHOULD_AUTOBATCH]: true }
1049
- });
1050
- var createQueueWithTimer = (timeout) => {
1051
- return (notify) => {
1052
- setTimeout(notify, timeout);
1053
- };
1054
- };
1055
- var createRafWithFallbackTimer = (raf, timeout) => {
1056
- return (notify) => {
1057
- let called = false;
1058
- const callback = () => {
1059
- if (called) return;
1060
- called = true;
1061
- cancelAnimationFrame(rafId);
1062
- clearTimeout(timerId);
1063
- notify();
1064
- };
1065
- const rafId = raf(callback);
1066
- const timerId = setTimeout(callback, timeout);
1067
- };
1068
- };
1069
- var autoBatchEnhancer = (options = { type: "raf" }) => (next) => (...args) => {
1070
- const store = next(...args);
1071
- let notifying = true;
1072
- let shouldNotifyAtEndOfTick = false;
1073
- let notificationQueued = false;
1074
- const listeners = /* @__PURE__ */ new Set();
1075
- const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? typeof window !== "undefined" && window.requestAnimationFrame ? createRafWithFallbackTimer(window.requestAnimationFrame, 100) : createQueueWithTimer(10) : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
1076
- const notifyListeners = () => {
1077
- notificationQueued = false;
1078
- if (shouldNotifyAtEndOfTick) {
1079
- shouldNotifyAtEndOfTick = false;
1080
- listeners.forEach((l) => l());
1081
- }
1082
- };
1083
- return Object.assign({}, store, {
1084
- subscribe(listener2) {
1085
- const wrappedListener = () => notifying && listener2();
1086
- const unsubscribe = store.subscribe(wrappedListener);
1087
- listeners.add(listener2);
1088
- return () => {
1089
- unsubscribe();
1090
- listeners.delete(listener2);
1091
- };
1092
- },
1093
- dispatch(action) {
1094
- try {
1095
- notifying = !action?.meta?.[SHOULD_AUTOBATCH];
1096
- shouldNotifyAtEndOfTick = !notifying;
1097
- if (shouldNotifyAtEndOfTick) {
1098
- if (!notificationQueued) {
1099
- notificationQueued = true;
1100
- queueCallback(notifyListeners);
1101
- }
1102
- }
1103
- return store.dispatch(action);
1104
- } finally {
1105
- notifying = true;
1106
- }
1107
- }
1108
- });
1109
- };
1110
- var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
1111
- const { autoBatch = true } = options ?? {};
1112
- let enhancerArray = new Tuple(middlewareEnhancer);
1113
- if (autoBatch) enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
1114
- return enhancerArray;
1115
- };
1116
- function configureStore(options) {
1117
- const getDefaultMiddleware = buildGetDefaultMiddleware();
1118
- const { reducer = void 0, middleware, devTools = true, duplicateMiddlewareCheck = true, preloadedState = void 0, enhancers = void 0 } = options || {};
1119
- let rootReducer;
1120
- if (typeof reducer === "function") rootReducer = reducer;
1121
- else if (isPlainObject$1(reducer)) rootReducer = combineReducers(reducer);
1122
- else throw new Error(formatProdErrorMessage(1));
1123
- let finalMiddleware;
1124
- if (typeof middleware === "function") finalMiddleware = middleware(getDefaultMiddleware);
1125
- else finalMiddleware = getDefaultMiddleware();
1126
- let finalCompose = compose;
1127
- if (devTools) finalCompose = composeWithDevTools({
1128
- trace: false,
1129
- ...typeof devTools === "object" && devTools
1130
- });
1131
- const getDefaultEnhancers = buildGetDefaultEnhancers(applyMiddleware(...finalMiddleware));
1132
- let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
1133
- const composedEnhancer = finalCompose(...storeEnhancers);
1134
- return createStore(rootReducer, preloadedState, composedEnhancer);
1135
- }
1136
- function executeReducerBuilderCallback(builderCallback) {
1137
- const actionsMap = {};
1138
- const actionMatchers = [];
1139
- let defaultCaseReducer;
1140
- const builder = {
1141
- addCase(typeOrActionCreator, reducer) {
1142
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1143
- if (!type) throw new Error(formatProdErrorMessage(28));
1144
- if (type in actionsMap) throw new Error(formatProdErrorMessage(29));
1145
- actionsMap[type] = reducer;
1146
- return builder;
1147
- },
1148
- addAsyncThunk(asyncThunk, reducers) {
1149
- if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
1150
- if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
1151
- if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
1152
- if (reducers.settled) actionMatchers.push({
1153
- matcher: asyncThunk.settled,
1154
- reducer: reducers.settled
1155
- });
1156
- return builder;
1157
- },
1158
- addMatcher(matcher, reducer) {
1159
- actionMatchers.push({
1160
- matcher,
1161
- reducer
1162
- });
1163
- return builder;
1164
- },
1165
- addDefaultCase(reducer) {
1166
- defaultCaseReducer = reducer;
1167
- return builder;
1168
- }
1169
- };
1170
- builderCallback(builder);
1171
- return [
1172
- actionsMap,
1173
- actionMatchers,
1174
- defaultCaseReducer
1175
- ];
1176
- }
1177
- function isStateFunction(x) {
1178
- return typeof x === "function";
1179
- }
1180
- function createReducer(initialState, mapOrBuilderCallback) {
1181
- let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
1182
- let getInitialState;
1183
- if (isStateFunction(initialState)) getInitialState = () => freezeDraftable(initialState());
1184
- else {
1185
- const frozenInitialState = freezeDraftable(initialState);
1186
- getInitialState = () => frozenInitialState;
1187
- }
1188
- function reducer(state = getInitialState(), action) {
1189
- let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({ matcher }) => matcher(action)).map(({ reducer: reducer2 }) => reducer2)];
1190
- if (caseReducers.filter((cr) => !!cr).length === 0) caseReducers = [finalDefaultCaseReducer];
1191
- return caseReducers.reduce((previousState, caseReducer) => {
1192
- if (caseReducer) if (isDraft(previousState)) {
1193
- const result = caseReducer(previousState, action);
1194
- if (result === void 0) return previousState;
1195
- return result;
1196
- } else if (!isDraftable(previousState)) {
1197
- const result = caseReducer(previousState, action);
1198
- if (result === void 0) {
1199
- if (previousState === null) return previousState;
1200
- throw Error("A case reducer on a non-draftable value must not return undefined");
1201
- }
1202
- return result;
1203
- } else return produce(previousState, (draft) => {
1204
- return caseReducer(draft, action);
1205
- });
1206
- return previousState;
1207
- }, state);
1208
- }
1209
- reducer.getInitialState = getInitialState;
1210
- return reducer;
1211
- }
1212
- var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
1213
- var nanoid = (size = 21) => {
1214
- let id = "";
1215
- let i = size;
1216
- while (i--) id += urlAlphabet[Math.random() * 64 | 0];
1217
- return id;
1218
- };
1219
- var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
1220
- function getType(slice, actionKey) {
1221
- return `${slice}/${actionKey}`;
1222
- }
1223
- function buildCreateSlice({ creators } = {}) {
1224
- const cAT = creators?.asyncThunk?.[asyncThunkSymbol];
1225
- return function createSlice2(options) {
1226
- const { name, reducerPath = name } = options;
1227
- if (!name) throw new Error(formatProdErrorMessage(11));
1228
- const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
1229
- const reducerNames = Object.keys(reducers);
1230
- const context = {
1231
- sliceCaseReducersByName: {},
1232
- sliceCaseReducersByType: {},
1233
- actionCreators: {},
1234
- sliceMatchers: []
1235
- };
1236
- const contextMethods = {
1237
- addCase(typeOrActionCreator, reducer2) {
1238
- const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
1239
- if (!type) throw new Error(formatProdErrorMessage(12));
1240
- if (type in context.sliceCaseReducersByType) throw new Error(formatProdErrorMessage(13));
1241
- context.sliceCaseReducersByType[type] = reducer2;
1242
- return contextMethods;
1243
- },
1244
- addMatcher(matcher, reducer2) {
1245
- context.sliceMatchers.push({
1246
- matcher,
1247
- reducer: reducer2
1248
- });
1249
- return contextMethods;
1250
- },
1251
- exposeAction(name2, actionCreator) {
1252
- context.actionCreators[name2] = actionCreator;
1253
- return contextMethods;
1254
- },
1255
- exposeCaseReducer(name2, reducer2) {
1256
- context.sliceCaseReducersByName[name2] = reducer2;
1257
- return contextMethods;
1258
- }
1259
- };
1260
- reducerNames.forEach((reducerName) => {
1261
- const reducerDefinition = reducers[reducerName];
1262
- const reducerDetails = {
1263
- reducerName,
1264
- type: getType(name, reducerName),
1265
- createNotation: typeof options.reducers === "function"
1266
- };
1267
- if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
1268
- else handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
1269
- });
1270
- function buildReducer() {
1271
- const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
1272
- const finalCaseReducers = {
1273
- ...extraReducers,
1274
- ...context.sliceCaseReducersByType
1275
- };
1276
- return createReducer(options.initialState, (builder) => {
1277
- for (let key in finalCaseReducers) builder.addCase(key, finalCaseReducers[key]);
1278
- for (let sM of context.sliceMatchers) builder.addMatcher(sM.matcher, sM.reducer);
1279
- for (let m of actionMatchers) builder.addMatcher(m.matcher, m.reducer);
1280
- if (defaultCaseReducer) builder.addDefaultCase(defaultCaseReducer);
1281
- });
1282
- }
1283
- const selectSelf = (state) => state;
1284
- const injectedSelectorCache = /* @__PURE__ */ new Map();
1285
- const injectedStateCache = /* @__PURE__ */ new WeakMap();
1286
- let _reducer;
1287
- function reducer(state, action) {
1288
- if (!_reducer) _reducer = buildReducer();
1289
- return _reducer(state, action);
1290
- }
1291
- function getInitialState() {
1292
- if (!_reducer) _reducer = buildReducer();
1293
- return _reducer.getInitialState();
1294
- }
1295
- function makeSelectorProps(reducerPath2, injected = false) {
1296
- function selectSlice(state) {
1297
- let sliceState = state[reducerPath2];
1298
- if (typeof sliceState === "undefined") {
1299
- if (injected) sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
1300
- }
1301
- return sliceState;
1302
- }
1303
- function getSelectors(selectState = selectSelf) {
1304
- return getOrInsertComputed(getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap()), selectState, () => {
1305
- const map = {};
1306
- for (const [name2, selector] of Object.entries(options.selectors ?? {})) map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
1307
- return map;
1308
- });
1309
- }
1310
- return {
1311
- reducerPath: reducerPath2,
1312
- getSelectors,
1313
- get selectors() {
1314
- return getSelectors(selectSlice);
1315
- },
1316
- selectSlice
1317
- };
1318
- }
1319
- const slice = {
1320
- name,
1321
- reducer,
1322
- actions: context.actionCreators,
1323
- caseReducers: context.sliceCaseReducersByName,
1324
- getInitialState,
1325
- ...makeSelectorProps(reducerPath),
1326
- injectInto(injectable, { reducerPath: pathOpt, ...config } = {}) {
1327
- const newReducerPath = pathOpt ?? reducerPath;
1328
- injectable.inject({
1329
- reducerPath: newReducerPath,
1330
- reducer
1331
- }, config);
1332
- return {
1333
- ...slice,
1334
- ...makeSelectorProps(newReducerPath, true)
1335
- };
1336
- }
1337
- };
1338
- return slice;
1339
- };
1340
- }
1341
- function wrapSelector(selector, selectState, getInitialState, injected) {
1342
- function wrapper(rootState, ...args) {
1343
- let sliceState = selectState(rootState);
1344
- if (typeof sliceState === "undefined") {
1345
- if (injected) sliceState = getInitialState();
1346
- }
1347
- return selector(sliceState, ...args);
1348
- }
1349
- wrapper.unwrapped = selector;
1350
- return wrapper;
1351
- }
1352
- var createSlice = /* @__PURE__ */ buildCreateSlice();
1353
- function buildReducerCreators() {
1354
- function asyncThunk(payloadCreator, config) {
1355
- return {
1356
- _reducerDefinitionType: "asyncThunk",
1357
- payloadCreator,
1358
- ...config
1359
- };
1360
- }
1361
- asyncThunk.withTypes = () => asyncThunk;
1362
- return {
1363
- reducer(caseReducer) {
1364
- return Object.assign({ [caseReducer.name](...args) {
1365
- return caseReducer(...args);
1366
- } }[caseReducer.name], { _reducerDefinitionType: "reducer" });
1367
- },
1368
- preparedReducer(prepare, reducer) {
1369
- return {
1370
- _reducerDefinitionType: "reducerWithPrepare",
1371
- prepare,
1372
- reducer
1373
- };
1374
- },
1375
- asyncThunk
1376
- };
1377
- }
1378
- function handleNormalReducerDefinition({ type, reducerName, createNotation }, maybeReducerWithPrepare, context) {
1379
- let caseReducer;
1380
- let prepareCallback;
1381
- if ("reducer" in maybeReducerWithPrepare) {
1382
- if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) throw new Error(formatProdErrorMessage(17));
1383
- caseReducer = maybeReducerWithPrepare.reducer;
1384
- prepareCallback = maybeReducerWithPrepare.prepare;
1385
- } else caseReducer = maybeReducerWithPrepare;
1386
- context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
1387
- }
1388
- function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
1389
- return reducerDefinition._reducerDefinitionType === "asyncThunk";
1390
- }
1391
- function isCaseReducerWithPrepareDefinition(reducerDefinition) {
1392
- return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
1393
- }
1394
- function handleThunkCaseReducerDefinition({ type, reducerName }, reducerDefinition, context, cAT) {
1395
- if (!cAT) throw new Error(formatProdErrorMessage(18));
1396
- const { payloadCreator, fulfilled, pending, rejected, settled, options } = reducerDefinition;
1397
- const thunk = cAT(type, payloadCreator, options);
1398
- context.exposeAction(reducerName, thunk);
1399
- if (fulfilled) context.addCase(thunk.fulfilled, fulfilled);
1400
- if (pending) context.addCase(thunk.pending, pending);
1401
- if (rejected) context.addCase(thunk.rejected, rejected);
1402
- if (settled) context.addMatcher(thunk.settled, settled);
1403
- context.exposeCaseReducer(reducerName, {
1404
- fulfilled: fulfilled || noop,
1405
- pending: pending || noop,
1406
- rejected: rejected || noop,
1407
- settled: settled || noop
1408
- });
1409
- }
1410
- function noop() {}
1411
- var task = "task";
1412
- var listener = "listener";
1413
- var completed = "completed";
1414
- var cancelled = "cancelled";
1415
- var taskCancelled = `task-${cancelled}`;
1416
- var taskCompleted = `task-${completed}`;
1417
- var listenerCancelled = `${listener}-${cancelled}`;
1418
- var listenerCompleted = `${listener}-${completed}`;
1419
- var TaskAbortError = class {
1420
- constructor(code) {
1421
- this.code = code;
1422
- this.message = `${task} ${cancelled} (reason: ${code})`;
1423
- }
1424
- code;
1425
- name = "TaskAbortError";
1426
- message;
1427
- };
1428
- var assertFunction = (func, expected) => {
1429
- if (typeof func !== "function") throw new TypeError(formatProdErrorMessage(32));
1430
- };
1431
- var noop2 = () => {};
1432
- var catchRejection = (promise, onError = noop2) => {
1433
- promise.catch(onError);
1434
- return promise;
1435
- };
1436
- var addAbortSignalListener = (abortSignal, callback) => {
1437
- abortSignal.addEventListener("abort", callback, { once: true });
1438
- return () => abortSignal.removeEventListener("abort", callback);
1439
- };
1440
- var validateActive = (signal) => {
1441
- if (signal.aborted) throw new TaskAbortError(signal.reason);
1442
- };
1443
- function raceWithSignal(signal, promise) {
1444
- let cleanup = noop2;
1445
- return new Promise((resolve, reject) => {
1446
- const notifyRejection = () => reject(new TaskAbortError(signal.reason));
1447
- if (signal.aborted) {
1448
- notifyRejection();
1449
- return;
1450
- }
1451
- cleanup = addAbortSignalListener(signal, notifyRejection);
1452
- promise.finally(() => cleanup()).then(resolve, reject);
1453
- }).finally(() => {
1454
- cleanup = noop2;
1455
- });
1456
- }
1457
- var runTask = async (task2, cleanUp) => {
1458
- try {
1459
- await Promise.resolve();
1460
- return {
1461
- status: "ok",
1462
- value: await task2()
1463
- };
1464
- } catch (error) {
1465
- return {
1466
- status: error instanceof TaskAbortError ? "cancelled" : "rejected",
1467
- error
1468
- };
1469
- } finally {
1470
- cleanUp?.();
1471
- }
1472
- };
1473
- var createPause = (signal) => {
1474
- return (promise) => {
1475
- return catchRejection(raceWithSignal(signal, promise).then((output) => {
1476
- validateActive(signal);
1477
- return output;
1478
- }));
1479
- };
1480
- };
1481
- var createDelay = (signal) => {
1482
- const pause = createPause(signal);
1483
- return (timeoutMs) => {
1484
- return pause(new Promise((resolve) => setTimeout(resolve, timeoutMs)));
1485
- };
1486
- };
1487
- var { assign } = Object;
1488
- var INTERNAL_NIL_TOKEN = {};
1489
- var alm = "listenerMiddleware";
1490
- var createFork = (parentAbortSignal, parentBlockingPromises) => {
1491
- const linkControllers = (controller) => addAbortSignalListener(parentAbortSignal, () => controller.abort(parentAbortSignal.reason));
1492
- return (taskExecutor, opts) => {
1493
- assertFunction(taskExecutor, "taskExecutor");
1494
- const childAbortController = new AbortController();
1495
- linkControllers(childAbortController);
1496
- const result = runTask(async () => {
1497
- validateActive(parentAbortSignal);
1498
- validateActive(childAbortController.signal);
1499
- const result2 = await taskExecutor({
1500
- pause: createPause(childAbortController.signal),
1501
- delay: createDelay(childAbortController.signal),
1502
- signal: childAbortController.signal
1503
- });
1504
- validateActive(childAbortController.signal);
1505
- return result2;
1506
- }, () => childAbortController.abort(taskCompleted));
1507
- if (opts?.autoJoin) parentBlockingPromises.push(result.catch(noop2));
1508
- return {
1509
- result: createPause(parentAbortSignal)(result),
1510
- cancel() {
1511
- childAbortController.abort(taskCancelled);
1512
- }
1513
- };
1514
- };
1515
- };
1516
- var createTakePattern = (startListening, signal) => {
1517
- const take = async (predicate, timeout) => {
1518
- validateActive(signal);
1519
- let unsubscribe = () => {};
1520
- const promises = [new Promise((resolve, reject) => {
1521
- let stopListening = startListening({
1522
- predicate,
1523
- effect: (action, listenerApi) => {
1524
- listenerApi.unsubscribe();
1525
- resolve([
1526
- action,
1527
- listenerApi.getState(),
1528
- listenerApi.getOriginalState()
1529
- ]);
1530
- }
1531
- });
1532
- unsubscribe = () => {
1533
- stopListening();
1534
- reject();
1535
- };
1536
- })];
1537
- if (timeout != null) promises.push(new Promise((resolve) => setTimeout(resolve, timeout, null)));
1538
- try {
1539
- const output = await raceWithSignal(signal, Promise.race(promises));
1540
- validateActive(signal);
1541
- return output;
1542
- } finally {
1543
- unsubscribe();
1544
- }
1545
- };
1546
- return ((predicate, timeout) => catchRejection(take(predicate, timeout)));
1547
- };
1548
- var getListenerEntryPropsFrom = (options) => {
1549
- let { type, actionCreator, matcher, predicate, effect } = options;
1550
- if (type) predicate = createAction(type).match;
1551
- else if (actionCreator) {
1552
- type = actionCreator.type;
1553
- predicate = actionCreator.match;
1554
- } else if (matcher) predicate = matcher;
1555
- else if (predicate) {} else throw new Error(formatProdErrorMessage(21));
1556
- assertFunction(effect, "options.listener");
1557
- return {
1558
- predicate,
1559
- type,
1560
- effect
1561
- };
1562
- };
1563
- var createListenerEntry = /* @__PURE__ */ assign((options) => {
1564
- const { type, predicate, effect } = getListenerEntryPropsFrom(options);
1565
- return {
1566
- id: nanoid(),
1567
- effect,
1568
- type,
1569
- predicate,
1570
- pending: /* @__PURE__ */ new Set(),
1571
- unsubscribe: () => {
1572
- throw new Error(formatProdErrorMessage(22));
1573
- }
1574
- };
1575
- }, { withTypes: () => createListenerEntry });
1576
- var findListenerEntry = (listenerMap, options) => {
1577
- const { type, effect, predicate } = getListenerEntryPropsFrom(options);
1578
- return Array.from(listenerMap.values()).find((entry) => {
1579
- return (typeof type === "string" ? entry.type === type : entry.predicate === predicate) && entry.effect === effect;
1580
- });
1581
- };
1582
- var cancelActiveListeners = (entry) => {
1583
- entry.pending.forEach((controller) => {
1584
- controller.abort(listenerCancelled);
1585
- });
1586
- };
1587
- var createClearListenerMiddleware = (listenerMap, executingListeners) => {
1588
- return () => {
1589
- for (const listener2 of executingListeners.keys()) cancelActiveListeners(listener2);
1590
- listenerMap.clear();
1591
- };
1592
- };
1593
- var safelyNotifyError = (errorHandler, errorToNotify, errorInfo) => {
1594
- try {
1595
- errorHandler(errorToNotify, errorInfo);
1596
- } catch (errorHandlerError) {
1597
- setTimeout(() => {
1598
- throw errorHandlerError;
1599
- }, 0);
1600
- }
1601
- };
1602
- var addListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/add`), { withTypes: () => addListener });
1603
- var clearAllListeners = /* @__PURE__ */ createAction(`${alm}/removeAll`);
1604
- var removeListener = /* @__PURE__ */ assign(/* @__PURE__ */ createAction(`${alm}/remove`), { withTypes: () => removeListener });
1605
- var defaultErrorHandler = (...args) => {
1606
- console.error(`${alm}/error`, ...args);
1607
- };
1608
- var createListenerMiddleware = (middlewareOptions = {}) => {
1609
- const listenerMap = /* @__PURE__ */ new Map();
1610
- const executingListeners = /* @__PURE__ */ new Map();
1611
- const trackExecutingListener = (entry) => {
1612
- const count = executingListeners.get(entry) ?? 0;
1613
- executingListeners.set(entry, count + 1);
1614
- };
1615
- const untrackExecutingListener = (entry) => {
1616
- const count = executingListeners.get(entry) ?? 1;
1617
- if (count === 1) executingListeners.delete(entry);
1618
- else executingListeners.set(entry, count - 1);
1619
- };
1620
- const { extra, onError = defaultErrorHandler } = middlewareOptions;
1621
- assertFunction(onError, "onError");
1622
- const insertEntry = (entry) => {
1623
- entry.unsubscribe = () => listenerMap.delete(entry.id);
1624
- listenerMap.set(entry.id, entry);
1625
- return (cancelOptions) => {
1626
- entry.unsubscribe();
1627
- if (cancelOptions?.cancelActive) cancelActiveListeners(entry);
1628
- };
1629
- };
1630
- const startListening = ((options) => {
1631
- return insertEntry(findListenerEntry(listenerMap, options) ?? createListenerEntry(options));
1632
- });
1633
- assign(startListening, { withTypes: () => startListening });
1634
- const stopListening = (options) => {
1635
- const entry = findListenerEntry(listenerMap, options);
1636
- if (entry) {
1637
- entry.unsubscribe();
1638
- if (options.cancelActive) cancelActiveListeners(entry);
1639
- }
1640
- return !!entry;
1641
- };
1642
- assign(stopListening, { withTypes: () => stopListening });
1643
- const notifyListener = async (entry, action, api, getOriginalState) => {
1644
- const internalTaskController = new AbortController();
1645
- const take = createTakePattern(startListening, internalTaskController.signal);
1646
- const autoJoinPromises = [];
1647
- try {
1648
- entry.pending.add(internalTaskController);
1649
- trackExecutingListener(entry);
1650
- await Promise.resolve(entry.effect(action, assign({}, api, {
1651
- getOriginalState,
1652
- condition: (predicate, timeout) => take(predicate, timeout).then(Boolean),
1653
- take,
1654
- delay: createDelay(internalTaskController.signal),
1655
- pause: createPause(internalTaskController.signal),
1656
- extra,
1657
- signal: internalTaskController.signal,
1658
- fork: createFork(internalTaskController.signal, autoJoinPromises),
1659
- unsubscribe: entry.unsubscribe,
1660
- subscribe: () => {
1661
- listenerMap.set(entry.id, entry);
1662
- },
1663
- cancelActiveListeners: () => {
1664
- entry.pending.forEach((controller, _, set) => {
1665
- if (controller !== internalTaskController) {
1666
- controller.abort(listenerCancelled);
1667
- set.delete(controller);
1668
- }
1669
- });
1670
- },
1671
- cancel: () => {
1672
- internalTaskController.abort(listenerCancelled);
1673
- entry.pending.delete(internalTaskController);
1674
- },
1675
- throwIfCancelled: () => {
1676
- validateActive(internalTaskController.signal);
1677
- }
1678
- })));
1679
- } catch (listenerError) {
1680
- if (!(listenerError instanceof TaskAbortError)) safelyNotifyError(onError, listenerError, { raisedBy: "effect" });
1681
- } finally {
1682
- await Promise.all(autoJoinPromises);
1683
- internalTaskController.abort(listenerCompleted);
1684
- untrackExecutingListener(entry);
1685
- entry.pending.delete(internalTaskController);
1686
- }
1687
- };
1688
- const clearListenerMiddleware = createClearListenerMiddleware(listenerMap, executingListeners);
1689
- const middleware = (api) => (next) => (action) => {
1690
- if (!isAction(action)) return next(action);
1691
- if (addListener.match(action)) return startListening(action.payload);
1692
- if (clearAllListeners.match(action)) {
1693
- clearListenerMiddleware();
1694
- return;
1695
- }
1696
- if (removeListener.match(action)) return stopListening(action.payload);
1697
- let originalState = api.getState();
1698
- const getOriginalState = () => {
1699
- if (originalState === INTERNAL_NIL_TOKEN) throw new Error(formatProdErrorMessage(23));
1700
- return originalState;
1701
- };
1702
- let result;
1703
- try {
1704
- result = next(action);
1705
- if (listenerMap.size > 0) {
1706
- const currentState = api.getState();
1707
- const listenerEntries = Array.from(listenerMap.values());
1708
- for (const entry of listenerEntries) {
1709
- let runListener = false;
1710
- try {
1711
- runListener = entry.predicate(action, currentState, originalState);
1712
- } catch (predicateError) {
1713
- runListener = false;
1714
- safelyNotifyError(onError, predicateError, { raisedBy: "predicate" });
1715
- }
1716
- if (!runListener) continue;
1717
- notifyListener(entry, action, api, getOriginalState);
1718
- }
1719
- }
1720
- } finally {
1721
- originalState = INTERNAL_NIL_TOKEN;
1722
- }
1723
- return result;
1724
- };
1725
- return {
1726
- middleware,
1727
- startListening,
1728
- stopListening,
1729
- clearListeners: clearListenerMiddleware
1730
- };
1731
- };
1732
- function formatProdErrorMessage(code) {
1733
- return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
1734
- }
1735
- //#endregion
1736
- export { createSlice as a, current as c, createListenerMiddleware as i, combineReducers as l, configureStore as n, prepareAutoBatched as o, createAction as r, castDraft as s, autoBatchEnhancer as t, createSelector as u };