@hot-updater/console 0.36.7 → 1.0.0-rc.1

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 (262) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/BundleIdDisplay-D4ErdU5_.js +1 -0
  3. package/.output/public/assets/InsightsCapabilityContext-B42VqvP6.js +1 -0
  4. package/.output/public/assets/api-keys-api-DGVTTvTJ.js +1 -0
  5. package/.output/public/assets/api-keys-z16OZIP4.js +1 -0
  6. package/.output/public/assets/badge-Br_KDO0J.js +1 -0
  7. package/.output/public/assets/card-DzuEXvyJ.js +1 -0
  8. package/.output/public/assets/chart-no-axes-combined-FaYMGmQS.js +1 -0
  9. package/.output/public/assets/createServerFn-gM2-LFBy.js +3 -0
  10. package/.output/public/assets/dialog-BeAENgez.js +1 -0
  11. package/.output/public/assets/dist-Bssh_cv0.js +1 -0
  12. package/.output/public/assets/field-Buq148-A.js +1 -0
  13. package/.output/public/assets/index-uOpQAIC4.js +10 -0
  14. package/.output/public/assets/input-group-B3p5UpyW.js +1 -0
  15. package/.output/public/assets/insights-DJTr7Ozn.js +1 -0
  16. package/.output/public/assets/insights-api-DVMOoRMS.js +1 -0
  17. package/.output/public/assets/installations-BY64iIAK.js +2 -0
  18. package/.output/public/assets/installations-D5v9i3AL.js +1 -0
  19. package/.output/public/assets/lazyRouteComponent-DKYu5cZJ.js +1 -0
  20. package/.output/public/assets/preload-helper-CQ36nxok.js +1 -0
  21. package/.output/public/assets/refresh-cw-BkbfZ62O.js +1 -0
  22. package/.output/public/assets/routes-BuoI5-Cr.js +2 -0
  23. package/.output/public/assets/routes-C8fvgETO.js +1 -0
  24. package/.output/public/assets/search-qsIDvS2I.js +1 -0
  25. package/.output/public/assets/shield-check-DE_hVuHu.js +1 -0
  26. package/.output/public/assets/signing-mJD88Y4C.js +1 -0
  27. package/.output/public/assets/styles-BZIG7t42.css +2 -0
  28. package/.output/public/assets/table-RamFEclP.js +1 -0
  29. package/.output/public/assets/useCompositeListItem-ChzDqdpc.js +42 -0
  30. package/.output/public/assets/useMutation-JsGVjQMY.js +1 -0
  31. package/.output/public/assets/useOpenInteractionType-Dwfy-SpA.js +1 -0
  32. package/.output/server/__23tanstack-start-server-fn-resolver-Dftxlm2E.mjs +146 -0
  33. package/.output/server/_libs/@base-ui/react+[...].mjs +16124 -0
  34. package/.output/server/_libs/@reduxjs/toolkit+[...].mjs +1554 -0
  35. package/.output/server/_libs/@tanstack/react-router+[...].mjs +41 -10
  36. package/.output/server/_libs/@tanstack/react-router-ssr-query+[...].mjs +132 -0
  37. package/.output/server/_libs/d3-array.mjs +231 -0
  38. package/.output/server/_libs/d3-color.mjs +330 -0
  39. package/.output/server/_libs/d3-format.mjs +252 -0
  40. package/.output/server/_libs/d3-interpolate.mjs +207 -0
  41. package/.output/server/_libs/d3-path.mjs +77 -0
  42. package/.output/server/_libs/d3-scale+[...].mjs +1907 -0
  43. package/.output/server/_libs/d3-shape.mjs +818 -0
  44. package/.output/server/_libs/decimal.js-light.mjs +884 -0
  45. package/.output/server/_libs/es-toolkit.mjs +1134 -0
  46. package/.output/server/_libs/eventemitter3.mjs +236 -0
  47. package/.output/server/_libs/immer.mjs +532 -0
  48. package/.output/server/_libs/lucide-react.mjs +141 -13
  49. package/.output/server/_libs/next-themes.mjs +2 -2
  50. package/.output/server/_libs/react-redux+[...].mjs +205 -0
  51. package/.output/server/_libs/recharts+[...].mjs +14117 -0
  52. package/.output/server/_libs/sonner.mjs +2 -2
  53. package/.output/server/_libs/tanstack__query-core.mjs +114 -1
  54. package/.output/server/_libs/tanstack__react-query.mjs +3 -4
  55. package/.output/server/_runtime.mjs +10 -1
  56. package/.output/server/_ssr/BundleActivityChart-CWcdPuUn.mjs +288 -0
  57. package/.output/server/_ssr/BundleIdDisplay-BEvB3MvA.mjs +13 -0
  58. package/.output/server/_ssr/InsightsCapabilityContext-Cx8fjm2s.mjs +15 -0
  59. package/.output/server/_ssr/api-keys-CpBqHpuC.mjs +300 -0
  60. package/.output/server/_ssr/api-keys-api-Czkp57UV.mjs +60 -0
  61. package/.output/server/_ssr/api-keys-rpc-BTtMDSoR.mjs +136 -0
  62. package/.output/server/_ssr/api-rpc-BEX8ISai.mjs +1468 -0
  63. package/.output/server/_ssr/auth-BF8mbAgF.mjs +21 -0
  64. package/.output/server/_ssr/auth-rpc-BFMEC-TT.mjs +24 -0
  65. package/.output/server/_ssr/auth.server-DW71WzsD.mjs +47 -0
  66. package/.output/server/_ssr/badge-CpWXQwyF.mjs +26 -0
  67. package/.output/server/_ssr/bundle-signing-rpc-BbCFUQSu.mjs +16 -0
  68. package/.output/server/_ssr/bundle-signing.server-C4NW5mWx.mjs +12 -0
  69. package/.output/server/_ssr/card-Bsc8mRis.mjs +86 -0
  70. package/.output/server/_ssr/config-Dv8qLDZ0.mjs +13 -0
  71. package/.output/server/_ssr/config.server-DQYEr_5X.mjs +361 -0
  72. package/.output/server/_ssr/{createServerFn-DzU0k62V.mjs → createServerFn-B2hcXoPM.mjs} +1 -1
  73. package/.output/server/_ssr/createServerRpc-DB29C_5p.mjs +12 -0
  74. package/.output/server/_ssr/{sidebar-Cv_H0_Jv.mjs → createSsrRpc-DhfrxEjg.mjs} +68 -50
  75. package/.output/server/_ssr/databaseRows-QlCYLi0H.mjs +166 -0
  76. package/.output/server/_ssr/deleteBundle-Cu_XOMt0.mjs +66 -0
  77. package/.output/server/_ssr/dialog-C0vKUp8R.mjs +170 -0
  78. package/.output/server/_ssr/dist-BVSLTpoP.mjs +250 -0
  79. package/.output/server/_ssr/downloadBundle-CNnYxYO2.mjs +24 -0
  80. package/.output/server/_ssr/{empty-plugin-adapters-B4HCzgmM.mjs → empty-plugin-adapters-B5QvGpEl.mjs} +1 -1
  81. package/.output/server/_ssr/field-DASCh-5d.mjs +74 -0
  82. package/.output/server/_ssr/{getBundleChildren-CVtSiH5t.mjs → getBundleChildren-BcRMFoDF.mjs} +10 -18
  83. package/.output/server/_ssr/input-group-etIsBUqv.mjs +288 -0
  84. package/.output/server/_ssr/insights-api-C1F7UreR.mjs +71 -0
  85. package/.output/server/_ssr/insights-input-9fEJF-ZG.mjs +96 -0
  86. package/.output/server/_ssr/insights-rpc-C-8R6kED.mjs +155 -0
  87. package/.output/server/_ssr/insights-ygT_aIfo.mjs +858 -0
  88. package/.output/server/_ssr/installations-DqRT1QTd.mjs +535 -0
  89. package/.output/server/_ssr/installations-K8TCYTYh.mjs +19 -0
  90. package/.output/server/_ssr/router-BxBEvtF1.mjs +513 -0
  91. package/.output/server/_ssr/routes-BC7rn-tf.mjs +37 -0
  92. package/.output/server/_ssr/routes-CM5KAwpB.mjs +2285 -0
  93. package/.output/server/_ssr/runtime.server-la7TRAH_.mjs +527 -0
  94. package/.output/server/_ssr/server-CpzW--lT.mjs +7468 -0
  95. package/.output/server/_ssr/signing-jk4HANnl.mjs +134 -0
  96. package/.output/server/_ssr/ssr.mjs +4 -5740
  97. package/.output/server/_ssr/start-DpViQGnt.mjs +4 -0
  98. package/.output/server/_ssr/table-CU58HeI7.mjs +53 -0
  99. package/.output/server/_ssr/uuidv7-CaKuKXrV.mjs +31 -0
  100. package/.output/server/_tanstack-start-manifest_v-Mz9MmSlD.mjs +103 -0
  101. package/.output/server/index.mjs +229 -47
  102. package/README.md +29 -8
  103. package/lib/index.d.mts +35 -0
  104. package/lib/index.mjs +4 -0
  105. package/lib/vite-internal.mjs +127 -0
  106. package/lib/vite.d.mts +10 -0
  107. package/lib/vite.mjs +5 -0
  108. package/package.json +51 -29
  109. package/public/apple-touch-icon.png +0 -0
  110. package/public/favicon-16x16.png +0 -0
  111. package/public/favicon-32x32.png +0 -0
  112. package/public/favicon.ico +0 -0
  113. package/public/logo.svg +1 -0
  114. package/public/manifest.json +30 -0
  115. package/public/robots.txt +3 -0
  116. package/src/components/AppSidebar.tsx +159 -0
  117. package/src/components/BundleIdDisplay.tsx +18 -0
  118. package/src/components/ChannelBadge.tsx +31 -0
  119. package/src/components/ConsoleAccessPage.tsx +122 -0
  120. package/src/components/EnabledStatusIcon.tsx +54 -0
  121. package/src/components/HashValueDisplay.tsx +85 -0
  122. package/src/components/HotUpdaterLogo.tsx +30 -0
  123. package/src/components/NotFoundPage.tsx +33 -0
  124. package/src/components/PlatformIcon.tsx +39 -0
  125. package/src/components/RolloutPercentageBadge.tsx +28 -0
  126. package/src/components/ThemeProvider.tsx +116 -0
  127. package/src/components/TimestampDisplay.tsx +41 -0
  128. package/src/components/features/api-keys/ApiKeysPage.tsx +377 -0
  129. package/src/components/features/bundles/BundleActivityChart.tsx +193 -0
  130. package/src/components/features/bundles/BundleChildrenPanel.tsx +201 -0
  131. package/src/components/features/bundles/BundleInsightsSummary.tsx +123 -0
  132. package/src/components/features/bundles/BundleMetadata.tsx +136 -0
  133. package/src/components/features/bundles/RolloutCohortsDialog.tsx +201 -0
  134. package/src/components/features/channels/ChannelManagementDialog.tsx +228 -0
  135. package/src/components/features/insights/ActivityChart.tsx +150 -0
  136. package/src/components/features/insights/BundleDistribution.tsx +133 -0
  137. package/src/components/features/insights/BundleSelector.tsx +114 -0
  138. package/src/components/features/insights/InsightsCapabilityContext.tsx +24 -0
  139. package/src/components/features/insights/InsightsControls.tsx +115 -0
  140. package/src/components/features/insights/InsightsErrorAlert.tsx +21 -0
  141. package/src/components/features/insights/InsightsOverview.tsx +208 -0
  142. package/src/components/features/insights/InstallationHistoryCard.tsx +248 -0
  143. package/src/components/features/insights/InstallationMatchesCard.tsx +132 -0
  144. package/src/components/features/insights/InstallationPageHeader.tsx +138 -0
  145. package/src/components/features/insights/InstallationPagination.tsx +48 -0
  146. package/src/components/features/insights/InstallationSearch.tsx +230 -0
  147. package/src/components/features/insights/UpdateOutcomes.tsx +147 -0
  148. package/src/components/features/releases/ReleaseEditorSheet.tsx +879 -0
  149. package/src/components/features/releases/ReleaseStateBadge.tsx +20 -0
  150. package/src/components/features/signing/BundleSigningPage.tsx +139 -0
  151. package/src/components/ui/alert-dialog.tsx +185 -0
  152. package/src/components/ui/alert.tsx +76 -0
  153. package/src/components/ui/badge.tsx +49 -0
  154. package/src/components/ui/button.tsx +58 -0
  155. package/src/components/ui/card.tsx +89 -0
  156. package/src/components/ui/chart.tsx +371 -0
  157. package/src/components/ui/combobox.tsx +303 -0
  158. package/src/components/ui/dialog.tsx +156 -0
  159. package/src/components/ui/dropdown-menu.tsx +270 -0
  160. package/src/components/ui/field.tsx +235 -0
  161. package/src/components/ui/input-group.tsx +147 -0
  162. package/src/components/ui/input.tsx +19 -0
  163. package/src/components/ui/label.tsx +25 -0
  164. package/src/components/ui/progress.tsx +84 -0
  165. package/src/components/ui/select.tsx +205 -0
  166. package/src/components/ui/separator.tsx +23 -0
  167. package/src/components/ui/sheet.tsx +132 -0
  168. package/src/components/ui/sidebar.tsx +779 -0
  169. package/src/components/ui/skeleton.tsx +13 -0
  170. package/src/components/ui/slider.tsx +56 -0
  171. package/src/components/ui/sonner.tsx +45 -0
  172. package/src/components/ui/switch.tsx +25 -0
  173. package/src/components/ui/table.tsx +114 -0
  174. package/src/components/ui/textarea.tsx +18 -0
  175. package/src/components/ui/toggle-group.tsx +89 -0
  176. package/src/components/ui/toggle.tsx +43 -0
  177. package/src/components/ui/tooltip.tsx +66 -0
  178. package/src/hooks/use-mobile.ts +30 -0
  179. package/src/index.ts +47 -0
  180. package/src/lib/api-keys-api.ts +69 -0
  181. package/src/lib/api-keys-rpc.ts +87 -0
  182. package/src/lib/api-rpc.ts +478 -0
  183. package/src/lib/api.ts +444 -0
  184. package/src/lib/auth-rpc.ts +16 -0
  185. package/src/lib/bundle-signing-api.ts +14 -0
  186. package/src/lib/bundle-signing-rpc.ts +16 -0
  187. package/src/lib/constants.ts +1 -0
  188. package/src/lib/git.ts +51 -0
  189. package/src/lib/insights-api.ts +144 -0
  190. package/src/lib/insights-error.ts +19 -0
  191. package/src/lib/insights-input.ts +187 -0
  192. package/src/lib/insights-overview.ts +170 -0
  193. package/src/lib/insights-rpc.ts +218 -0
  194. package/src/lib/server/auth.server.ts +43 -0
  195. package/src/lib/server/bundle-signing.server.ts +23 -0
  196. package/src/lib/server/config.server.ts +109 -0
  197. package/src/lib/server/console-runtime.server.ts +61 -0
  198. package/src/lib/server/deleteBundle.ts +145 -0
  199. package/src/lib/server/downloadBundle.ts +46 -0
  200. package/src/lib/server/getBundleChildren.ts +130 -0
  201. package/src/lib/server/listReleases.ts +61 -0
  202. package/src/lib/server/releaseActivity.ts +27 -0
  203. package/src/lib/server/releaseReachability.ts +95 -0
  204. package/src/lib/server/runtime.server.ts +172 -0
  205. package/src/lib/utils.ts +9 -0
  206. package/src/logo.svg +1 -0
  207. package/src/routeTree.gen.ts +199 -0
  208. package/src/router.tsx +21 -0
  209. package/src/routes/-installations-search.ts +19 -0
  210. package/src/routes/-releases-search.ts +74 -0
  211. package/src/routes/__root.tsx +174 -0
  212. package/src/routes/api/auth/$.ts +19 -0
  213. package/src/routes/api/bundles/$bundleId/download.ts +17 -0
  214. package/src/routes/api-keys.tsx +37 -0
  215. package/src/routes/index.tsx +982 -0
  216. package/src/routes/insights.tsx +139 -0
  217. package/src/routes/installations.tsx +194 -0
  218. package/src/routes/signing.tsx +37 -0
  219. package/src/styles.css +152 -0
  220. package/src/virtual-modules.d.ts +21 -0
  221. package/src/vite-env.d.ts +1 -0
  222. package/src/vite-internal.ts +195 -0
  223. package/src/vite.ts +12 -0
  224. package/.output/public/assets/dist-DJX53faP.js +0 -3
  225. package/.output/public/assets/index-Iylis5kY.js +0 -10
  226. package/.output/public/assets/routes-HT21hs0C.js +0 -54
  227. package/.output/public/assets/styles-C0Re4quB.css +0 -2
  228. package/.output/server/__23tanstack-start-server-fn-resolver-CgwgZ0-i.mjs +0 -66
  229. package/.output/server/_libs/@floating-ui/core+[...].mjs +0 -698
  230. package/.output/server/_libs/@floating-ui/dom+[...].mjs +0 -644
  231. package/.output/server/_libs/@floating-ui/react-dom+[...].mjs +0 -839
  232. package/.output/server/_libs/@radix-ui/react-alert-dialog+[...].mjs +0 -2138
  233. package/.output/server/_libs/@radix-ui/react-popper+[...].mjs +0 -308
  234. package/.output/server/_libs/@radix-ui/react-select+[...].mjs +0 -1038
  235. package/.output/server/_libs/@tanstack/devtools-event-client+[...].mjs +0 -196
  236. package/.output/server/_libs/@tanstack/form-core+[...].mjs +0 -3228
  237. package/.output/server/_libs/@tanstack/react-form+[...].mjs +0 -430
  238. package/.output/server/_libs/@tanstack/react-table+[...].mjs +0 -2382
  239. package/.output/server/_libs/radix-ui__number.mjs +0 -6
  240. package/.output/server/_libs/radix-ui__primitive.mjs +0 -9
  241. package/.output/server/_libs/radix-ui__react-arrow.mjs +0 -23
  242. package/.output/server/_libs/radix-ui__react-collection.mjs +0 -78
  243. package/.output/server/_libs/radix-ui__react-direction.mjs +0 -13
  244. package/.output/server/_libs/radix-ui__react-label.mjs +0 -22
  245. package/.output/server/_libs/radix-ui__react-separator.mjs +0 -30
  246. package/.output/server/_libs/radix-ui__react-slider.mjs +0 -510
  247. package/.output/server/_libs/radix-ui__react-switch.mjs +0 -157
  248. package/.output/server/_libs/radix-ui__react-tooltip.mjs +0 -493
  249. package/.output/server/_ssr/api-rpc-BIbDUKSz.mjs +0 -292
  250. package/.output/server/_ssr/config.server-BSS366KT.mjs +0 -41
  251. package/.output/server/_ssr/deleteBundle-BgbZTtpW.mjs +0 -141
  252. package/.output/server/_ssr/dist-KboydRVk.mjs +0 -120
  253. package/.output/server/_ssr/router-C3hqEy3k.mjs +0 -307
  254. package/.output/server/_ssr/routes-B0lQvvlC.mjs +0 -3048
  255. package/.output/server/_ssr/start-02sLteYG.mjs +0 -4
  256. package/.output/server/_ssr/storageProfile-FVkjPoGb.mjs +0 -9
  257. package/.output/server/_tanstack-start-manifest_v-Bpx52WOU.mjs +0 -20
  258. package/.output/server/node_modules/tslib/modules/index.js +0 -70
  259. package/.output/server/node_modules/tslib/modules/package.json +0 -3
  260. package/.output/server/node_modules/tslib/package.json +0 -47
  261. package/.output/server/node_modules/tslib/tslib.js +0 -484
  262. package/.output/server/package.json +0 -9
@@ -0,0 +1,532 @@
1
+ //#region ../../node_modules/.pnpm/immer@10.2.0/node_modules/immer/dist/immer.mjs
2
+ var NOTHING = Symbol.for("immer-nothing");
3
+ var DRAFTABLE = Symbol.for("immer-draftable");
4
+ var DRAFT_STATE = Symbol.for("immer-state");
5
+ function die(error, ...args) {
6
+ throw new Error(`[Immer] minified error nr: ${error}. Full error at: https://bit.ly/3cXEKWf`);
7
+ }
8
+ var getPrototypeOf = Object.getPrototypeOf;
9
+ function isDraft(value) {
10
+ return !!value && !!value[DRAFT_STATE];
11
+ }
12
+ function isDraftable(value) {
13
+ if (!value) return false;
14
+ return isPlainObject(value) || Array.isArray(value) || !!value[DRAFTABLE] || !!value.constructor?.[DRAFTABLE] || isMap(value) || isSet(value);
15
+ }
16
+ var objectCtorString = Object.prototype.constructor.toString();
17
+ var cachedCtorStrings = /* @__PURE__ */ new WeakMap();
18
+ function isPlainObject(value) {
19
+ if (!value || typeof value !== "object") return false;
20
+ const proto = Object.getPrototypeOf(value);
21
+ if (proto === null || proto === Object.prototype) return true;
22
+ const Ctor = Object.hasOwnProperty.call(proto, "constructor") && proto.constructor;
23
+ if (Ctor === Object) return true;
24
+ if (typeof Ctor !== "function") return false;
25
+ let ctorString = cachedCtorStrings.get(Ctor);
26
+ if (ctorString === void 0) {
27
+ ctorString = Function.toString.call(Ctor);
28
+ cachedCtorStrings.set(Ctor, ctorString);
29
+ }
30
+ return ctorString === objectCtorString;
31
+ }
32
+ function each(obj, iter, strict = true) {
33
+ if (getArchtype(obj) === 0) (strict ? Reflect.ownKeys(obj) : Object.keys(obj)).forEach((key) => {
34
+ iter(key, obj[key], obj);
35
+ });
36
+ else obj.forEach((entry, index) => iter(index, entry, obj));
37
+ }
38
+ function getArchtype(thing) {
39
+ const state = thing[DRAFT_STATE];
40
+ return state ? state.type_ : Array.isArray(thing) ? 1 : isMap(thing) ? 2 : isSet(thing) ? 3 : 0;
41
+ }
42
+ function has(thing, prop) {
43
+ return getArchtype(thing) === 2 ? thing.has(prop) : Object.prototype.hasOwnProperty.call(thing, prop);
44
+ }
45
+ function set(thing, propOrOldValue, value) {
46
+ const t = getArchtype(thing);
47
+ if (t === 2) thing.set(propOrOldValue, value);
48
+ else if (t === 3) thing.add(value);
49
+ else thing[propOrOldValue] = value;
50
+ }
51
+ function is(x, y) {
52
+ if (x === y) return x !== 0 || 1 / x === 1 / y;
53
+ else return x !== x && y !== y;
54
+ }
55
+ function isMap(target) {
56
+ return target instanceof Map;
57
+ }
58
+ function isSet(target) {
59
+ return target instanceof Set;
60
+ }
61
+ function latest(state) {
62
+ return state.copy_ || state.base_;
63
+ }
64
+ function shallowCopy(base, strict) {
65
+ if (isMap(base)) return new Map(base);
66
+ if (isSet(base)) return new Set(base);
67
+ if (Array.isArray(base)) return Array.prototype.slice.call(base);
68
+ const isPlain = isPlainObject(base);
69
+ if (strict === true || strict === "class_only" && !isPlain) {
70
+ const descriptors = Object.getOwnPropertyDescriptors(base);
71
+ delete descriptors[DRAFT_STATE];
72
+ let keys = Reflect.ownKeys(descriptors);
73
+ for (let i = 0; i < keys.length; i++) {
74
+ const key = keys[i];
75
+ const desc = descriptors[key];
76
+ if (desc.writable === false) {
77
+ desc.writable = true;
78
+ desc.configurable = true;
79
+ }
80
+ if (desc.get || desc.set) descriptors[key] = {
81
+ configurable: true,
82
+ writable: true,
83
+ enumerable: desc.enumerable,
84
+ value: base[key]
85
+ };
86
+ }
87
+ return Object.create(getPrototypeOf(base), descriptors);
88
+ } else {
89
+ const proto = getPrototypeOf(base);
90
+ if (proto !== null && isPlain) return { ...base };
91
+ return Object.assign(Object.create(proto), base);
92
+ }
93
+ }
94
+ function freeze(obj, deep = false) {
95
+ if (isFrozen(obj) || isDraft(obj) || !isDraftable(obj)) return obj;
96
+ if (getArchtype(obj) > 1) Object.defineProperties(obj, {
97
+ set: dontMutateMethodOverride,
98
+ add: dontMutateMethodOverride,
99
+ clear: dontMutateMethodOverride,
100
+ delete: dontMutateMethodOverride
101
+ });
102
+ Object.freeze(obj);
103
+ if (deep) Object.values(obj).forEach((value) => freeze(value, true));
104
+ return obj;
105
+ }
106
+ function dontMutateFrozenCollections() {
107
+ die(2);
108
+ }
109
+ var dontMutateMethodOverride = { value: dontMutateFrozenCollections };
110
+ function isFrozen(obj) {
111
+ if (obj === null || typeof obj !== "object") return true;
112
+ return Object.isFrozen(obj);
113
+ }
114
+ var plugins = {};
115
+ function getPlugin(pluginKey) {
116
+ const plugin = plugins[pluginKey];
117
+ if (!plugin) die(0, pluginKey);
118
+ return plugin;
119
+ }
120
+ var currentScope;
121
+ function getCurrentScope() {
122
+ return currentScope;
123
+ }
124
+ function createScope(parent_, immer_) {
125
+ return {
126
+ drafts_: [],
127
+ parent_,
128
+ immer_,
129
+ canAutoFreeze_: true,
130
+ unfinalizedDrafts_: 0
131
+ };
132
+ }
133
+ function usePatchesInScope(scope, patchListener) {
134
+ if (patchListener) {
135
+ getPlugin("Patches");
136
+ scope.patches_ = [];
137
+ scope.inversePatches_ = [];
138
+ scope.patchListener_ = patchListener;
139
+ }
140
+ }
141
+ function revokeScope(scope) {
142
+ leaveScope(scope);
143
+ scope.drafts_.forEach(revokeDraft);
144
+ scope.drafts_ = null;
145
+ }
146
+ function leaveScope(scope) {
147
+ if (scope === currentScope) currentScope = scope.parent_;
148
+ }
149
+ function enterScope(immer2) {
150
+ return currentScope = createScope(currentScope, immer2);
151
+ }
152
+ function revokeDraft(draft) {
153
+ const state = draft[DRAFT_STATE];
154
+ if (state.type_ === 0 || state.type_ === 1) state.revoke_();
155
+ else state.revoked_ = true;
156
+ }
157
+ function processResult(result, scope) {
158
+ scope.unfinalizedDrafts_ = scope.drafts_.length;
159
+ const baseDraft = scope.drafts_[0];
160
+ if (result !== void 0 && result !== baseDraft) {
161
+ if (baseDraft[DRAFT_STATE].modified_) {
162
+ revokeScope(scope);
163
+ die(4);
164
+ }
165
+ if (isDraftable(result)) {
166
+ result = finalize(scope, result);
167
+ if (!scope.parent_) maybeFreeze(scope, result);
168
+ }
169
+ if (scope.patches_) getPlugin("Patches").generateReplacementPatches_(baseDraft[DRAFT_STATE].base_, result, scope.patches_, scope.inversePatches_);
170
+ } else result = finalize(scope, baseDraft, []);
171
+ revokeScope(scope);
172
+ if (scope.patches_) scope.patchListener_(scope.patches_, scope.inversePatches_);
173
+ return result !== NOTHING ? result : void 0;
174
+ }
175
+ function finalize(rootScope, value, path) {
176
+ if (isFrozen(value)) return value;
177
+ const useStrictIteration = rootScope.immer_.shouldUseStrictIteration();
178
+ const state = value[DRAFT_STATE];
179
+ if (!state) {
180
+ each(value, (key, childValue) => finalizeProperty(rootScope, state, value, key, childValue, path), useStrictIteration);
181
+ return value;
182
+ }
183
+ if (state.scope_ !== rootScope) return value;
184
+ if (!state.modified_) {
185
+ maybeFreeze(rootScope, state.base_, true);
186
+ return state.base_;
187
+ }
188
+ if (!state.finalized_) {
189
+ state.finalized_ = true;
190
+ state.scope_.unfinalizedDrafts_--;
191
+ const result = state.copy_;
192
+ let resultEach = result;
193
+ let isSet2 = false;
194
+ if (state.type_ === 3) {
195
+ resultEach = new Set(result);
196
+ result.clear();
197
+ isSet2 = true;
198
+ }
199
+ each(resultEach, (key, childValue) => finalizeProperty(rootScope, state, result, key, childValue, path, isSet2), useStrictIteration);
200
+ maybeFreeze(rootScope, result, false);
201
+ if (path && rootScope.patches_) getPlugin("Patches").generatePatches_(state, path, rootScope.patches_, rootScope.inversePatches_);
202
+ }
203
+ return state.copy_;
204
+ }
205
+ function finalizeProperty(rootScope, parentState, targetObject, prop, childValue, rootPath, targetIsSet) {
206
+ if (childValue == null) return;
207
+ if (typeof childValue !== "object" && !targetIsSet) return;
208
+ const childIsFrozen = isFrozen(childValue);
209
+ if (childIsFrozen && !targetIsSet) return;
210
+ if (isDraft(childValue)) {
211
+ const res = finalize(rootScope, childValue, rootPath && parentState && parentState.type_ !== 3 && !has(parentState.assigned_, prop) ? rootPath.concat(prop) : void 0);
212
+ set(targetObject, prop, res);
213
+ if (isDraft(res)) rootScope.canAutoFreeze_ = false;
214
+ else return;
215
+ } else if (targetIsSet) targetObject.add(childValue);
216
+ if (isDraftable(childValue) && !childIsFrozen) {
217
+ if (!rootScope.immer_.autoFreeze_ && rootScope.unfinalizedDrafts_ < 1) return;
218
+ if (parentState && parentState.base_ && parentState.base_[prop] === childValue && childIsFrozen) return;
219
+ finalize(rootScope, childValue);
220
+ if ((!parentState || !parentState.scope_.parent_) && typeof prop !== "symbol" && (isMap(targetObject) ? targetObject.has(prop) : Object.prototype.propertyIsEnumerable.call(targetObject, prop))) maybeFreeze(rootScope, childValue);
221
+ }
222
+ }
223
+ function maybeFreeze(scope, value, deep = false) {
224
+ if (!scope.parent_ && scope.immer_.autoFreeze_ && scope.canAutoFreeze_) freeze(value, deep);
225
+ }
226
+ function createProxyProxy(base, parent) {
227
+ const isArray = Array.isArray(base);
228
+ const state = {
229
+ type_: isArray ? 1 : 0,
230
+ scope_: parent ? parent.scope_ : getCurrentScope(),
231
+ modified_: false,
232
+ finalized_: false,
233
+ assigned_: {},
234
+ parent_: parent,
235
+ base_: base,
236
+ draft_: null,
237
+ copy_: null,
238
+ revoke_: null,
239
+ isManual_: false
240
+ };
241
+ let target = state;
242
+ let traps = objectTraps;
243
+ if (isArray) {
244
+ target = [state];
245
+ traps = arrayTraps;
246
+ }
247
+ const { revoke, proxy } = Proxy.revocable(target, traps);
248
+ state.draft_ = proxy;
249
+ state.revoke_ = revoke;
250
+ return proxy;
251
+ }
252
+ var objectTraps = {
253
+ get(state, prop) {
254
+ if (prop === DRAFT_STATE) return state;
255
+ const source = latest(state);
256
+ if (!has(source, prop)) return readPropFromProto(state, source, prop);
257
+ const value = source[prop];
258
+ if (state.finalized_ || !isDraftable(value)) return value;
259
+ if (value === peek(state.base_, prop)) {
260
+ prepareCopy(state);
261
+ return state.copy_[prop] = createProxy(value, state);
262
+ }
263
+ return value;
264
+ },
265
+ has(state, prop) {
266
+ return prop in latest(state);
267
+ },
268
+ ownKeys(state) {
269
+ return Reflect.ownKeys(latest(state));
270
+ },
271
+ set(state, prop, value) {
272
+ const desc = getDescriptorFromProto(latest(state), prop);
273
+ if (desc?.set) {
274
+ desc.set.call(state.draft_, value);
275
+ return true;
276
+ }
277
+ if (!state.modified_) {
278
+ const current2 = peek(latest(state), prop);
279
+ const currentState = current2?.[DRAFT_STATE];
280
+ if (currentState && currentState.base_ === value) {
281
+ state.copy_[prop] = value;
282
+ state.assigned_[prop] = false;
283
+ return true;
284
+ }
285
+ if (is(value, current2) && (value !== void 0 || has(state.base_, prop))) return true;
286
+ prepareCopy(state);
287
+ markChanged(state);
288
+ }
289
+ if (state.copy_[prop] === value && (value !== void 0 || prop in state.copy_) || Number.isNaN(value) && Number.isNaN(state.copy_[prop])) return true;
290
+ state.copy_[prop] = value;
291
+ state.assigned_[prop] = true;
292
+ return true;
293
+ },
294
+ deleteProperty(state, prop) {
295
+ if (peek(state.base_, prop) !== void 0 || prop in state.base_) {
296
+ state.assigned_[prop] = false;
297
+ prepareCopy(state);
298
+ markChanged(state);
299
+ } else delete state.assigned_[prop];
300
+ if (state.copy_) delete state.copy_[prop];
301
+ return true;
302
+ },
303
+ getOwnPropertyDescriptor(state, prop) {
304
+ const owner = latest(state);
305
+ const desc = Reflect.getOwnPropertyDescriptor(owner, prop);
306
+ if (!desc) return desc;
307
+ return {
308
+ writable: true,
309
+ configurable: state.type_ !== 1 || prop !== "length",
310
+ enumerable: desc.enumerable,
311
+ value: owner[prop]
312
+ };
313
+ },
314
+ defineProperty() {
315
+ die(11);
316
+ },
317
+ getPrototypeOf(state) {
318
+ return getPrototypeOf(state.base_);
319
+ },
320
+ setPrototypeOf() {
321
+ die(12);
322
+ }
323
+ };
324
+ var arrayTraps = {};
325
+ each(objectTraps, (key, fn) => {
326
+ arrayTraps[key] = function() {
327
+ arguments[0] = arguments[0][0];
328
+ return fn.apply(this, arguments);
329
+ };
330
+ });
331
+ arrayTraps.deleteProperty = function(state, prop) {
332
+ return arrayTraps.set.call(this, state, prop, void 0);
333
+ };
334
+ arrayTraps.set = function(state, prop, value) {
335
+ return objectTraps.set.call(this, state[0], prop, value, state[0]);
336
+ };
337
+ function peek(draft, prop) {
338
+ const state = draft[DRAFT_STATE];
339
+ return (state ? latest(state) : draft)[prop];
340
+ }
341
+ function readPropFromProto(state, source, prop) {
342
+ const desc = getDescriptorFromProto(source, prop);
343
+ return desc ? `value` in desc ? desc.value : desc.get?.call(state.draft_) : void 0;
344
+ }
345
+ function getDescriptorFromProto(source, prop) {
346
+ if (!(prop in source)) return void 0;
347
+ let proto = getPrototypeOf(source);
348
+ while (proto) {
349
+ const desc = Object.getOwnPropertyDescriptor(proto, prop);
350
+ if (desc) return desc;
351
+ proto = getPrototypeOf(proto);
352
+ }
353
+ }
354
+ function markChanged(state) {
355
+ if (!state.modified_) {
356
+ state.modified_ = true;
357
+ if (state.parent_) markChanged(state.parent_);
358
+ }
359
+ }
360
+ function prepareCopy(state) {
361
+ if (!state.copy_) state.copy_ = shallowCopy(state.base_, state.scope_.immer_.useStrictShallowCopy_);
362
+ }
363
+ var Immer2 = class {
364
+ constructor(config) {
365
+ this.autoFreeze_ = true;
366
+ this.useStrictShallowCopy_ = false;
367
+ this.useStrictIteration_ = true;
368
+ /**
369
+ * The `produce` function takes a value and a "recipe function" (whose
370
+ * return value often depends on the base state). The recipe function is
371
+ * free to mutate its first argument however it wants. All mutations are
372
+ * only ever applied to a __copy__ of the base state.
373
+ *
374
+ * Pass only a function to create a "curried producer" which relieves you
375
+ * from passing the recipe function every time.
376
+ *
377
+ * Only plain objects and arrays are made mutable. All other objects are
378
+ * considered uncopyable.
379
+ *
380
+ * Note: This function is __bound__ to its `Immer` instance.
381
+ *
382
+ * @param {any} base - the initial state
383
+ * @param {Function} recipe - function that receives a proxy of the base state as first argument and which can be freely modified
384
+ * @param {Function} patchListener - optional function that will be called with all the patches produced here
385
+ * @returns {any} a new state, or the initial state if nothing was modified
386
+ */
387
+ this.produce = (base, recipe, patchListener) => {
388
+ if (typeof base === "function" && typeof recipe !== "function") {
389
+ const defaultBase = recipe;
390
+ recipe = base;
391
+ const self = this;
392
+ return function curriedProduce(base2 = defaultBase, ...args) {
393
+ return self.produce(base2, (draft) => recipe.call(this, draft, ...args));
394
+ };
395
+ }
396
+ if (typeof recipe !== "function") die(6);
397
+ if (patchListener !== void 0 && typeof patchListener !== "function") die(7);
398
+ let result;
399
+ if (isDraftable(base)) {
400
+ const scope = enterScope(this);
401
+ const proxy = createProxy(base, void 0);
402
+ let hasError = true;
403
+ try {
404
+ result = recipe(proxy);
405
+ hasError = false;
406
+ } finally {
407
+ if (hasError) revokeScope(scope);
408
+ else leaveScope(scope);
409
+ }
410
+ usePatchesInScope(scope, patchListener);
411
+ return processResult(result, scope);
412
+ } else if (!base || typeof base !== "object") {
413
+ result = recipe(base);
414
+ if (result === void 0) result = base;
415
+ if (result === NOTHING) result = void 0;
416
+ if (this.autoFreeze_) freeze(result, true);
417
+ if (patchListener) {
418
+ const p = [];
419
+ const ip = [];
420
+ getPlugin("Patches").generateReplacementPatches_(base, result, p, ip);
421
+ patchListener(p, ip);
422
+ }
423
+ return result;
424
+ } else die(1, base);
425
+ };
426
+ this.produceWithPatches = (base, recipe) => {
427
+ if (typeof base === "function") return (state, ...args) => this.produceWithPatches(state, (draft) => base(draft, ...args));
428
+ let patches, inversePatches;
429
+ return [
430
+ this.produce(base, recipe, (p, ip) => {
431
+ patches = p;
432
+ inversePatches = ip;
433
+ }),
434
+ patches,
435
+ inversePatches
436
+ ];
437
+ };
438
+ if (typeof config?.autoFreeze === "boolean") this.setAutoFreeze(config.autoFreeze);
439
+ if (typeof config?.useStrictShallowCopy === "boolean") this.setUseStrictShallowCopy(config.useStrictShallowCopy);
440
+ if (typeof config?.useStrictIteration === "boolean") this.setUseStrictIteration(config.useStrictIteration);
441
+ }
442
+ createDraft(base) {
443
+ if (!isDraftable(base)) die(8);
444
+ if (isDraft(base)) base = current(base);
445
+ const scope = enterScope(this);
446
+ const proxy = createProxy(base, void 0);
447
+ proxy[DRAFT_STATE].isManual_ = true;
448
+ leaveScope(scope);
449
+ return proxy;
450
+ }
451
+ finishDraft(draft, patchListener) {
452
+ const state = draft && draft[DRAFT_STATE];
453
+ if (!state || !state.isManual_) die(9);
454
+ const { scope_: scope } = state;
455
+ usePatchesInScope(scope, patchListener);
456
+ return processResult(void 0, scope);
457
+ }
458
+ /**
459
+ * Pass true to automatically freeze all copies created by Immer.
460
+ *
461
+ * By default, auto-freezing is enabled.
462
+ */
463
+ setAutoFreeze(value) {
464
+ this.autoFreeze_ = value;
465
+ }
466
+ /**
467
+ * Pass true to enable strict shallow copy.
468
+ *
469
+ * By default, immer does not copy the object descriptors such as getter, setter and non-enumrable properties.
470
+ */
471
+ setUseStrictShallowCopy(value) {
472
+ this.useStrictShallowCopy_ = value;
473
+ }
474
+ /**
475
+ * Pass false to use faster iteration that skips non-enumerable properties
476
+ * but still handles symbols for compatibility.
477
+ *
478
+ * By default, strict iteration is enabled (includes all own properties).
479
+ */
480
+ setUseStrictIteration(value) {
481
+ this.useStrictIteration_ = value;
482
+ }
483
+ shouldUseStrictIteration() {
484
+ return this.useStrictIteration_;
485
+ }
486
+ applyPatches(base, patches) {
487
+ let i;
488
+ for (i = patches.length - 1; i >= 0; i--) {
489
+ const patch = patches[i];
490
+ if (patch.path.length === 0 && patch.op === "replace") {
491
+ base = patch.value;
492
+ break;
493
+ }
494
+ }
495
+ if (i > -1) patches = patches.slice(i + 1);
496
+ const applyPatchesImpl = getPlugin("Patches").applyPatches_;
497
+ if (isDraft(base)) return applyPatchesImpl(base, patches);
498
+ return this.produce(base, (draft) => applyPatchesImpl(draft, patches));
499
+ }
500
+ };
501
+ function createProxy(value, parent) {
502
+ const draft = isMap(value) ? getPlugin("MapSet").proxyMap_(value, parent) : isSet(value) ? getPlugin("MapSet").proxySet_(value, parent) : createProxyProxy(value, parent);
503
+ (parent ? parent.scope_ : getCurrentScope()).drafts_.push(draft);
504
+ return draft;
505
+ }
506
+ function current(value) {
507
+ if (!isDraft(value)) die(10, value);
508
+ return currentImpl(value);
509
+ }
510
+ function currentImpl(value) {
511
+ if (!isDraftable(value) || isFrozen(value)) return value;
512
+ const state = value[DRAFT_STATE];
513
+ let copy;
514
+ let strict = true;
515
+ if (state) {
516
+ if (!state.modified_) return state.base_;
517
+ state.finalized_ = true;
518
+ copy = shallowCopy(value, state.scope_.immer_.useStrictShallowCopy_);
519
+ strict = state.scope_.immer_.shouldUseStrictIteration();
520
+ } else copy = shallowCopy(value, true);
521
+ each(copy, (key, childValue) => {
522
+ set(copy, key, currentImpl(childValue));
523
+ }, strict);
524
+ if (state) state.finalized_ = false;
525
+ return copy;
526
+ }
527
+ new Immer2().produce;
528
+ function castDraft(value) {
529
+ return value;
530
+ }
531
+ //#endregion
532
+ export { castDraft as t };