@absolutejs/absolute 0.19.0-beta.851 → 0.19.0-beta.853

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 (45) hide show
  1. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  2. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  3. package/dist/angular/index.js +3 -1
  4. package/dist/angular/index.js.map +3 -3
  5. package/dist/angular/server.js +3 -1
  6. package/dist/angular/server.js.map +3 -3
  7. package/dist/build.js +1919 -284
  8. package/dist/build.js.map +17 -7
  9. package/dist/dev/client/handlers/angular.ts +17 -234
  10. package/dist/dev/client/handlers/angularHmrShim.ts +77 -0
  11. package/dist/dev/client/handlers/angularRuntime.ts +0 -476
  12. package/dist/dev/client/hmrClient.ts +21 -0
  13. package/dist/index.js +2006 -329
  14. package/dist/index.js.map +18 -8
  15. package/dist/react/browser.js.map +1 -1
  16. package/dist/react/index.js +3 -1
  17. package/dist/react/index.js.map +3 -3
  18. package/dist/react/server.js +3 -1
  19. package/dist/react/server.js.map +2 -2
  20. package/dist/src/core/prepare.d.ts +25 -0
  21. package/dist/src/dev/angular/fastHmrCompiler.d.ts +19 -0
  22. package/dist/src/dev/angular/hmrCompiler.d.ts +18 -0
  23. package/dist/src/dev/angular/hmrImportGenerator.d.ts +3 -0
  24. package/dist/src/dev/angular/hmrInjectionPlugin.d.ts +7 -0
  25. package/dist/src/dev/angular/resolveOwningComponents.d.ts +8 -0
  26. package/dist/src/dev/angular/vendor/translator/api/ast_factory.d.ts +363 -0
  27. package/dist/src/dev/angular/vendor/translator/api/import_generator.d.ts +49 -0
  28. package/dist/src/dev/angular/vendor/translator/context.d.ts +18 -0
  29. package/dist/src/dev/angular/vendor/translator/translator.d.ts +75 -0
  30. package/dist/src/dev/angular/vendor/translator/ts_util.d.ts +12 -0
  31. package/dist/src/dev/angular/vendor/translator/typescript_ast_factory.d.ts +66 -0
  32. package/dist/src/dev/angular/vendor/translator/typescript_translator.d.ts +13 -0
  33. package/dist/src/plugins/hmr.d.ts +25 -0
  34. package/dist/src/react/UniversalRouter.d.ts +3 -1
  35. package/dist/src/vue/components/Image.d.ts +1 -1
  36. package/dist/svelte/index.js +3 -1
  37. package/dist/svelte/index.js.map +2 -2
  38. package/dist/svelte/server.js +3 -1
  39. package/dist/svelte/server.js.map +2 -2
  40. package/dist/types/globals.d.ts +0 -12
  41. package/dist/vue/index.js +3 -1
  42. package/dist/vue/index.js.map +2 -2
  43. package/dist/vue/server.js +3 -1
  44. package/dist/vue/server.js.map +2 -2
  45. package/package.json +1 -1
@@ -8,7 +8,7 @@
8
8
  "import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { getIslandMarkerAttributes } from '../core/islandMarkupAttributes';\n\ntype PreservedIslandMarkup = {\n\tattributes: Record<string, string>;\n\tinnerHTML: string;\n};\n\ntype IslandMarkerElement = HTMLElement & {\n\tdataset: DOMStringMap & {\n\t\tcomponent?: string;\n\t\tframework?: string;\n\t\thydrate?: string;\n\t\tisland?: string;\n\t\tislandId?: string;\n\t\tprops?: string;\n\t};\n};\n\nconst getClaimMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_CLAIMED_ISLAND_MARKUP__ ??= new Map<string, number>();\n\n\treturn window.__ABS_CLAIMED_ISLAND_MARKUP__;\n};\n\nconst getSnapshotMap = () => {\n\tif (typeof window === 'undefined') {\n\t\treturn null;\n\t}\n\n\twindow.__ABS_SERVER_ISLAND_HTML__ ??= new Map<\n\t\tstring,\n\t\tPreservedIslandMarkup[]\n\t>();\n\n\treturn window.__ABS_SERVER_ISLAND_HTML__;\n};\n\nconst getIslandSignature = (props: RuntimeIslandRenderProps) => {\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn [\n\t\tattributes['data-component'],\n\t\tattributes['data-framework'],\n\t\tattributes['data-hydrate'],\n\t\tattributes['data-props']\n\t].join('::');\n};\n\nconst isMatchingIslandElement = (\n\telement: Element,\n\tprops: RuntimeIslandRenderProps\n): element is IslandMarkerElement => {\n\tif (!(element instanceof HTMLElement)) {\n\t\treturn false;\n\t}\n\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\treturn (\n\t\telement.dataset.island === 'true' &&\n\t\telement.dataset.component === attributes['data-component'] &&\n\t\telement.dataset.framework === attributes['data-framework'] &&\n\t\t(element.dataset.hydrate ?? 'load') === attributes['data-hydrate'] &&\n\t\t(element.dataset.props ?? '{}') === attributes['data-props']\n\t);\n};\n\nconst snapshotIslandElement = (\n\telement: HTMLElement,\n\tsnapshotMap: Map<string, PreservedIslandMarkup[]>\n) => {\n\tconst signature = [\n\t\telement.dataset.component,\n\t\telement.dataset.framework,\n\t\telement.dataset.hydrate ?? 'load',\n\t\telement.dataset.props ?? '{}'\n\t].join('::');\n\tconst existing = snapshotMap.get(signature) ?? [];\n\tconst attributes = Object.fromEntries(\n\t\telement\n\t\t\t.getAttributeNames()\n\t\t\t.map((name) => [name, element.getAttribute(name) ?? ''])\n\t);\n\texisting.push({\n\t\tattributes,\n\t\tinnerHTML: element.innerHTML\n\t});\n\tsnapshotMap.set(signature, existing);\n};\n\nexport const initializeIslandMarkupSnapshot = () => {\n\tif (typeof document === 'undefined') {\n\t\treturn;\n\t}\n\n\tconst snapshotMap = getSnapshotMap();\n\tif (!snapshotMap || snapshotMap.size > 0) {\n\t\treturn;\n\t}\n\n\tconst elements = Array.from(\n\t\tdocument.querySelectorAll<HTMLElement>('[data-island=\"true\"]')\n\t);\n\tfor (const element of elements) {\n\t\tsnapshotIslandElement(element, snapshotMap);\n\t}\n};\n\nexport const preserveIslandMarkup = (props: RuntimeIslandRenderProps) => {\n\tif (typeof document === 'undefined') {\n\t\treturn {\n\t\t\tattributes: getIslandMarkerAttributes(props),\n\t\t\tinnerHTML: ''\n\t\t};\n\t}\n\n\tconst claimMap = getClaimMap();\n\tconst snapshotMap = getSnapshotMap();\n\tconst signature = getIslandSignature(props);\n\tconst claimedCount = claimMap?.get(signature) ?? 0;\n\tconst snapshotCandidate = snapshotMap?.get(signature)?.[claimedCount];\n\tconst candidates = Array.from(\n\t\tdocument.querySelectorAll('[data-island=\"true\"]')\n\t).filter((element) => isMatchingIslandElement(element, props));\n\tconst candidate = candidates[claimedCount];\n\tif (claimMap) {\n\t\tclaimMap.set(signature, claimedCount + 1);\n\t}\n\n\treturn {\n\t\tattributes:\n\t\t\tsnapshotCandidate?.attributes ?? getIslandMarkerAttributes(props),\n\t\tinnerHTML: snapshotCandidate?.innerHTML ?? candidate?.innerHTML ?? ''\n\t};\n};\n",
9
9
  "import type { RuntimeIslandRenderProps } from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\n\nexport const Island = (props: RuntimeIslandRenderProps) => {\n\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\treturn (\n\t\t<div\n\t\t\t{...attributes}\n\t\t\tdangerouslySetInnerHTML={{ __html: innerHTML }}\n\t\t\tsuppressHydrationWarning\n\t\t/>\n\t);\n};\n",
10
10
  "import type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tTypedIslandRenderProps\n} from '../../types/island';\nimport { preserveIslandMarkup } from '../client/preserveIslandMarkup';\n\nexport const createTypedIsland = <T extends IslandRegistryInput>(\n\t_registry: IslandRegistry<T>\n) => {\n\tconst Island = (props: TypedIslandRenderProps<T>) => {\n\t\tconst { attributes, innerHTML } = preserveIslandMarkup(props);\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\t{...attributes}\n\t\t\t\tdangerouslySetInnerHTML={{ __html: innerHTML }}\n\t\t\t\tsuppressHydrationWarning\n\t\t\t/>\n\t\t);\n\t};\n\n\treturn Island;\n};\n",
11
- "import { createElement, type ReactNode } from 'react';\n\nexport type UniversalRouterProps = {\n\t/** The request URL to seed `<StaticRouter>` with on the server. Pages\n\t * typically forward `props.url` (auto-injected by handleReactPageRequest\n\t * from `request.url`). Ignored in the browser, where `<BrowserRouter>`\n\t * reads `window.location` directly. Defaults to '/'. */\n\turl?: string;\n\tchildren?: ReactNode;\n};\n\n/** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the\n * server and `<BrowserRouter>` in the browser. Without it, every SPA page\n * has to write its own `typeof window === 'undefined'` branch and import\n * both routers — boilerplate that's the same in every page.\n *\n * Usage:\n *\n * export const MySpa = ({ url }: { url?: string }) => (\n * <html>\n * <Head />\n * <body>\n * <UniversalRouter url={url}>\n * <Routes>\n * <Route path=\"/foo\" element={<Foo />} />\n * </Routes>\n * </UniversalRouter>\n * </body>\n * </html>\n * );\n *\n * Implementation note: `react-router` is required lazily via\n * `createRequire` so consumers who don't use `UniversalRouter` aren't\n * forced to install react-router just to import other things from\n * `@absolutejs/absolute/react` (the previous eager static import made\n * `dist/react/index.js` carry a `import \"react-router\"` that broke\n * every consumer's bundle who hadn't installed it). Bun resolves the\n * CJS interop synchronously, so render is still purely synchronous.\n *\n * `<BrowserRouter>` reads `window.history` at construction, so it\n * throws if instantiated on the server. The `typeof window` check has\n * to live at render time (not import time) because the module is\n * loaded in both environments. */\n\ntype ReactRouterModule = {\n\tBrowserRouter: (...args: unknown[]) => unknown;\n\tStaticRouter: (...args: unknown[]) => unknown;\n};\n\nlet cachedReactRouter: ReactRouterModule | null = null;\n\nconst loadReactRouter = (): ReactRouterModule => {\n\tif (cachedReactRouter) return cachedReactRouter;\n\n\t// Hide the bare specifier behind a Function-constructor so static\n\t// bundlers can't analyze it — they only see a `Function(string)`\n\t// call, not an `import \"react-router\"`. Resolution happens at\n\t// render time and only on the first call to `UniversalRouter`,\n\t// so consumers who never use it never pay the install cost.\n\t// `require` is available in Bun's CJS-interop context (server)\n\t// and in any bundle output that emitted a CJS-compatible runtime.\n\ttry {\n\t\tconst dynamicRequire = new Function('spec', 'return require(spec)') as (\n\t\t\tspec: string\n\t\t) => ReactRouterModule;\n\t\tcachedReactRouter = dynamicRequire('react-router');\n\n\t\treturn cachedReactRouter;\n\t} catch {\n\t\tconst fromWindow = (\n\t\t\tglobalThis as { ReactRouterDOM?: ReactRouterModule }\n\t\t).ReactRouterDOM;\n\t\tif (fromWindow) {\n\t\t\tcachedReactRouter = fromWindow;\n\n\t\t\treturn cachedReactRouter;\n\t\t}\n\t\tthrow new Error(\n\t\t\t'[UniversalRouter] react-router is not installed. Install it with `bun add react-router` to use UniversalRouter.'\n\t\t);\n\t}\n};\n\nexport const UniversalRouter = ({ url, children }: UniversalRouterProps) => {\n\tconst { BrowserRouter, StaticRouter } = loadReactRouter();\n\tif (typeof window === 'undefined') {\n\t\treturn createElement(StaticRouter, { location: url ?? '/' }, children);\n\t}\n\n\treturn createElement(BrowserRouter, null, children);\n};\n",
11
+ "import { createElement, type ComponentType, type ReactNode } from 'react';\n\nexport type UniversalRouterProps = {\n\t/** The request URL to seed `<StaticRouter>` with on the server. Pages\n\t * typically forward `props.url` (auto-injected by handleReactPageRequest\n\t * from `request.url`). Ignored in the browser, where `<BrowserRouter>`\n\t * reads `window.location` directly. Defaults to '/'. */\n\turl?: string;\n\tchildren?: ReactNode;\n};\n\n/** SSR-safe wrapper around react-router that picks `<StaticRouter>` on the\n * server and `<BrowserRouter>` in the browser. Without it, every SPA page\n * has to write its own `typeof window === 'undefined'` branch and import\n * both routers — boilerplate that's the same in every page.\n *\n * Usage:\n *\n * export const MySpa = ({ url }: { url?: string }) => (\n * <html>\n * <Head />\n * <body>\n * <UniversalRouter url={url}>\n * <Routes>\n * <Route path=\"/foo\" element={<Foo />} />\n * </Routes>\n * </UniversalRouter>\n * </body>\n * </html>\n * );\n *\n * Implementation note: `react-router` is required lazily via\n * `createRequire` so consumers who don't use `UniversalRouter` aren't\n * forced to install react-router just to import other things from\n * `@absolutejs/absolute/react` (the previous eager static import made\n * `dist/react/index.js` carry a `import \"react-router\"` that broke\n * every consumer's bundle who hadn't installed it). Bun resolves the\n * CJS interop synchronously, so render is still purely synchronous.\n *\n * `<BrowserRouter>` reads `window.history` at construction, so it\n * throws if instantiated on the server. The `typeof window` check has\n * to live at render time (not import time) because the module is\n * loaded in both environments. */\n\ntype ReactRouterModule = {\n\tBrowserRouter: ComponentType<{ children?: ReactNode }>;\n\tStaticRouter: ComponentType<{ location: string; children?: ReactNode }>;\n};\n\nlet cachedReactRouter: ReactRouterModule | null = null;\n\nconst loadReactRouter = (): ReactRouterModule => {\n\tif (cachedReactRouter) return cachedReactRouter;\n\n\t// Hide the bare specifier behind a Function-constructor so static\n\t// bundlers can't analyze it — they only see a `Function(string)`\n\t// call, not an `import \"react-router\"`. Resolution happens at\n\t// render time and only on the first call to `UniversalRouter`,\n\t// so consumers who never use it never pay the install cost.\n\t// `require` is available in Bun's CJS-interop context (server)\n\t// and in any bundle output that emitted a CJS-compatible runtime.\n\ttry {\n\t\tconst dynamicRequire = new Function('spec', 'return require(spec)') as (\n\t\t\tspec: string\n\t\t) => ReactRouterModule;\n\t\tcachedReactRouter = dynamicRequire('react-router');\n\n\t\treturn cachedReactRouter;\n\t} catch {\n\t\tconst fromWindow = (\n\t\t\tglobalThis as { ReactRouterDOM?: ReactRouterModule }\n\t\t).ReactRouterDOM;\n\t\tif (fromWindow) {\n\t\t\tcachedReactRouter = fromWindow;\n\n\t\t\treturn cachedReactRouter;\n\t\t}\n\t\tthrow new Error(\n\t\t\t'[UniversalRouter] react-router is not installed. Install it with `bun add react-router` to use UniversalRouter.'\n\t\t);\n\t}\n};\n\nexport const UniversalRouter = ({ url, children }: UniversalRouterProps) => {\n\tconst { BrowserRouter, StaticRouter } = loadReactRouter();\n\tif (typeof window === 'undefined') {\n\t\treturn createElement(StaticRouter, { location: url ?? '/' }, children);\n\t}\n\n\treturn createElement(BrowserRouter, null, children);\n};\n",
12
12
  "import { useSyncExternalStore } from 'react';\nimport type { StoreApi } from 'zustand/vanilla';\nimport {\n\tgetIslandStoreServerSnapshot,\n\treadIslandStore,\n\tsubscribeIslandStore,\n\ttype IslandStoreState\n} from '../../client/islandStore';\n\nexport const useIslandStore = <TState extends IslandStoreState, TSelected>(\n\tstore: StoreApi<TState>,\n\tselector: (state: TState) => TSelected\n) =>\n\tuseSyncExternalStore(\n\t\t(listener) =>\n\t\t\tsubscribeIslandStore(store, selector, () => {\n\t\t\t\tlistener();\n\t\t\t}),\n\t\t() => readIslandStore(store, selector),\n\t\t() => getIslandStoreServerSnapshot(store, selector)\n\t);\n",
13
13
  "const createStoreImpl = (createState) => {\n let state;\n const listeners = /* @__PURE__ */ new Set();\n const setState = (partial, replace) => {\n const nextState = typeof partial === \"function\" ? partial(state) : partial;\n if (!Object.is(nextState, state)) {\n const previousState = state;\n state = (replace != null ? replace : typeof nextState !== \"object\" || nextState === null) ? nextState : Object.assign({}, state, nextState);\n listeners.forEach((listener) => listener(state, previousState));\n }\n };\n const getState = () => state;\n const getInitialState = () => initialState;\n const subscribe = (listener) => {\n listeners.add(listener);\n return () => listeners.delete(listener);\n };\n const api = { setState, getState, getInitialState, subscribe };\n const initialState = state = createState(setState, getState, api);\n return api;\n};\nconst createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);\n\nexport { createStore };\n",
14
14
  "const reduxImpl = (reducer, initial) => (set, _get, api) => {\n api.dispatch = (action) => {\n set((state) => reducer(state, action), false, action);\n return action;\n };\n api.dispatchFromDevtools = true;\n return { dispatch: (...args) => api.dispatch(...args), ...initial };\n};\nconst redux = reduxImpl;\n\nconst shouldDispatchFromDevtools = (api) => !!api.dispatchFromDevtools && typeof api.dispatch === \"function\";\nconst trackedConnections = /* @__PURE__ */ new Map();\nconst getTrackedConnectionState = (name) => {\n const api = trackedConnections.get(name);\n if (!api) return {};\n return Object.fromEntries(\n Object.entries(api.stores).map(([key, api2]) => [key, api2.getState()])\n );\n};\nconst extractConnectionInformation = (store, extensionConnector, options) => {\n if (store === void 0) {\n return {\n type: \"untracked\",\n connection: extensionConnector.connect(options)\n };\n }\n const existingConnection = trackedConnections.get(options.name);\n if (existingConnection) {\n return { type: \"tracked\", store, ...existingConnection };\n }\n const newConnection = {\n connection: extensionConnector.connect(options),\n stores: {}\n };\n trackedConnections.set(options.name, newConnection);\n return { type: \"tracked\", store, ...newConnection };\n};\nconst removeStoreFromTrackedConnections = (name, store) => {\n if (store === void 0) return;\n const connectionInfo = trackedConnections.get(name);\n if (!connectionInfo) return;\n delete connectionInfo.stores[store];\n if (Object.keys(connectionInfo.stores).length === 0) {\n trackedConnections.delete(name);\n }\n};\nconst findCallerName = (stack) => {\n var _a, _b;\n if (!stack) return void 0;\n const traceLines = stack.split(\"\\n\");\n const apiSetStateLineIndex = traceLines.findIndex(\n (traceLine) => traceLine.includes(\"api.setState\")\n );\n if (apiSetStateLineIndex < 0) return void 0;\n const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || \"\";\n return (_b = /.+ (.+) .+/.exec(callerLine)) == null ? void 0 : _b[1];\n};\nconst devtoolsImpl = (fn, devtoolsOptions = {}) => (set, get, api) => {\n const { enabled, anonymousActionType, store, ...options } = devtoolsOptions;\n let extensionConnector;\n try {\n extensionConnector = (enabled != null ? enabled : (import.meta.env ? import.meta.env.MODE : void 0) !== \"production\") && window.__REDUX_DEVTOOLS_EXTENSION__;\n } catch (e) {\n }\n if (!extensionConnector) {\n return fn(set, get, api);\n }\n const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options);\n let isRecording = true;\n api.setState = ((state, replace, nameOrAction) => {\n const r = set(state, replace);\n if (!isRecording) return r;\n const action = nameOrAction === void 0 ? {\n type: anonymousActionType || findCallerName(new Error().stack) || \"anonymous\"\n } : typeof nameOrAction === \"string\" ? { type: nameOrAction } : nameOrAction;\n if (store === void 0) {\n connection == null ? void 0 : connection.send(action, get());\n return r;\n }\n connection == null ? void 0 : connection.send(\n {\n ...action,\n type: `${store}/${action.type}`\n },\n {\n ...getTrackedConnectionState(options.name),\n [store]: api.getState()\n }\n );\n return r;\n });\n api.devtools = {\n cleanup: () => {\n if (connection && typeof connection.unsubscribe === \"function\") {\n connection.unsubscribe();\n }\n removeStoreFromTrackedConnections(options.name, store);\n }\n };\n const setStateFromDevtools = (...a) => {\n const originalIsRecording = isRecording;\n isRecording = false;\n set(...a);\n isRecording = originalIsRecording;\n };\n const initialState = fn(api.setState, get, api);\n if (connectionInformation.type === \"untracked\") {\n connection == null ? void 0 : connection.init(initialState);\n } else {\n connectionInformation.stores[connectionInformation.store] = api;\n connection == null ? void 0 : connection.init(\n Object.fromEntries(\n Object.entries(connectionInformation.stores).map(([key, store2]) => [\n key,\n key === connectionInformation.store ? initialState : store2.getState()\n ])\n )\n );\n }\n if (shouldDispatchFromDevtools(api)) {\n let didWarnAboutReservedActionType = false;\n const originalDispatch = api.dispatch;\n api.dispatch = (...args) => {\n if ((import.meta.env ? import.meta.env.MODE : void 0) !== \"production\" && args[0].type === \"__setState\" && !didWarnAboutReservedActionType) {\n console.warn(\n '[zustand devtools middleware] \"__setState\" action type is reserved to set state from the devtools. Avoid using it.'\n );\n didWarnAboutReservedActionType = true;\n }\n originalDispatch(...args);\n };\n }\n connection.subscribe((message) => {\n var _a;\n switch (message.type) {\n case \"ACTION\":\n if (typeof message.payload !== \"string\") {\n console.error(\n \"[zustand devtools middleware] Unsupported action format\"\n );\n return;\n }\n return parseJsonThen(\n message.payload,\n (action) => {\n if (action.type === \"__setState\") {\n if (store === void 0) {\n setStateFromDevtools(action.state);\n return;\n }\n if (Object.keys(action.state).length !== 1) {\n console.error(\n `\n [zustand devtools middleware] Unsupported __setState action format.\n When using 'store' option in devtools(), the 'state' should have only one key, which is a value of 'store' that was passed in devtools(),\n and value of this only key should be a state object. Example: { \"type\": \"__setState\", \"state\": { \"abc123Store\": { \"foo\": \"bar\" } } }\n `\n );\n }\n const stateFromDevtools = action.state[store];\n if (stateFromDevtools === void 0 || stateFromDevtools === null) {\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) {\n setStateFromDevtools(stateFromDevtools);\n }\n return;\n }\n if (shouldDispatchFromDevtools(api)) {\n api.dispatch(action);\n }\n }\n );\n case \"DISPATCH\":\n switch (message.payload.type) {\n case \"RESET\":\n setStateFromDevtools(initialState);\n if (store === void 0) {\n return connection == null ? void 0 : connection.init(api.getState());\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"COMMIT\":\n if (store === void 0) {\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n case \"ROLLBACK\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n connection == null ? void 0 : connection.init(api.getState());\n return;\n }\n setStateFromDevtools(state[store]);\n connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name));\n });\n case \"JUMP_TO_STATE\":\n case \"JUMP_TO_ACTION\":\n return parseJsonThen(message.state, (state) => {\n if (store === void 0) {\n setStateFromDevtools(state);\n return;\n }\n if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) {\n setStateFromDevtools(state[store]);\n }\n });\n case \"IMPORT_STATE\": {\n const { nextLiftedState } = message.payload;\n const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state;\n if (!lastComputedState) return;\n if (store === void 0) {\n setStateFromDevtools(lastComputedState);\n } else {\n setStateFromDevtools(lastComputedState[store]);\n }\n connection == null ? void 0 : connection.send(\n null,\n // FIXME no-any\n nextLiftedState\n );\n return;\n }\n case \"PAUSE_RECORDING\":\n return isRecording = !isRecording;\n }\n return;\n }\n });\n return initialState;\n};\nconst devtools = devtoolsImpl;\nconst parseJsonThen = (stringified, fn) => {\n let parsed;\n try {\n parsed = JSON.parse(stringified);\n } catch (e) {\n console.error(\n \"[zustand devtools middleware] Could not parse the received json\",\n e\n );\n }\n if (parsed !== void 0) fn(parsed);\n};\n\nconst subscribeWithSelectorImpl = (fn) => (set, get, api) => {\n const origSubscribe = api.subscribe;\n api.subscribe = ((selector, optListener, options) => {\n let listener = selector;\n if (optListener) {\n const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is;\n let currentSlice = selector(api.getState());\n listener = (state) => {\n const nextSlice = selector(state);\n if (!equalityFn(currentSlice, nextSlice)) {\n const previousSlice = currentSlice;\n optListener(currentSlice = nextSlice, previousSlice);\n }\n };\n if (options == null ? void 0 : options.fireImmediately) {\n optListener(currentSlice, currentSlice);\n }\n }\n return origSubscribe(listener);\n });\n const initialState = fn(set, get, api);\n return initialState;\n};\nconst subscribeWithSelector = subscribeWithSelectorImpl;\n\nfunction combine(initialState, create) {\n return (...args) => Object.assign({}, initialState, create(...args));\n}\n\nfunction createJSONStorage(getStorage, options) {\n let storage;\n try {\n storage = getStorage();\n } catch (e) {\n return;\n }\n const persistStorage = {\n getItem: (name) => {\n var _a;\n const parse = (str2) => {\n if (str2 === null) {\n return null;\n }\n return JSON.parse(str2, options == null ? void 0 : options.reviver);\n };\n const str = (_a = storage.getItem(name)) != null ? _a : null;\n if (str instanceof Promise) {\n return str.then(parse);\n }\n return parse(str);\n },\n setItem: (name, newValue) => storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)),\n removeItem: (name) => storage.removeItem(name)\n };\n return persistStorage;\n}\nconst toThenable = (fn) => (input) => {\n try {\n const result = fn(input);\n if (result instanceof Promise) {\n return result;\n }\n return {\n then(onFulfilled) {\n return toThenable(onFulfilled)(result);\n },\n catch(_onRejected) {\n return this;\n }\n };\n } catch (e) {\n return {\n then(_onFulfilled) {\n return this;\n },\n catch(onRejected) {\n return toThenable(onRejected)(e);\n }\n };\n }\n};\nconst persistImpl = (config, baseOptions) => (set, get, api) => {\n let options = {\n storage: createJSONStorage(() => window.localStorage),\n partialize: (state) => state,\n version: 0,\n merge: (persistedState, currentState) => ({\n ...currentState,\n ...persistedState\n }),\n ...baseOptions\n };\n let hasHydrated = false;\n let hydrationVersion = 0;\n const hydrationListeners = /* @__PURE__ */ new Set();\n const finishHydrationListeners = /* @__PURE__ */ new Set();\n let storage = options.storage;\n if (!storage) {\n return config(\n (...args) => {\n console.warn(\n `[zustand persist middleware] Unable to update item '${options.name}', the given storage is currently unavailable.`\n );\n set(...args);\n },\n get,\n api\n );\n }\n const setItem = () => {\n const state = options.partialize({ ...get() });\n return storage.setItem(options.name, {\n state,\n version: options.version\n });\n };\n const savedSetState = api.setState;\n api.setState = (state, replace) => {\n savedSetState(state, replace);\n return setItem();\n };\n const configResult = config(\n (...args) => {\n set(...args);\n return setItem();\n },\n get,\n api\n );\n api.getInitialState = () => configResult;\n let stateFromStorage;\n const hydrate = () => {\n var _a, _b;\n if (!storage) return;\n const currentVersion = ++hydrationVersion;\n hasHydrated = false;\n hydrationListeners.forEach((cb) => {\n var _a2;\n return cb((_a2 = get()) != null ? _a2 : configResult);\n });\n const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0;\n return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue) => {\n if (deserializedStorageValue) {\n if (typeof deserializedStorageValue.version === \"number\" && deserializedStorageValue.version !== options.version) {\n if (options.migrate) {\n const migration = options.migrate(\n deserializedStorageValue.state,\n deserializedStorageValue.version\n );\n if (migration instanceof Promise) {\n return migration.then((result) => [true, result]);\n }\n return [true, migration];\n }\n console.error(\n `State loaded from storage couldn't be migrated since no migrate function was provided`\n );\n } else {\n return [false, deserializedStorageValue.state];\n }\n }\n return [false, void 0];\n }).then((migrationResult) => {\n var _a2;\n if (currentVersion !== hydrationVersion) {\n return;\n }\n const [migrated, migratedState] = migrationResult;\n stateFromStorage = options.merge(\n migratedState,\n (_a2 = get()) != null ? _a2 : configResult\n );\n set(stateFromStorage, true);\n if (migrated) {\n return setItem();\n }\n }).then(() => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0);\n stateFromStorage = get();\n hasHydrated = true;\n finishHydrationListeners.forEach((cb) => cb(stateFromStorage));\n }).catch((e) => {\n if (currentVersion !== hydrationVersion) {\n return;\n }\n postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e);\n });\n };\n api.persist = {\n setOptions: (newOptions) => {\n options = {\n ...options,\n ...newOptions\n };\n if (newOptions.storage) {\n storage = newOptions.storage;\n }\n },\n clearStorage: () => {\n storage == null ? void 0 : storage.removeItem(options.name);\n },\n getOptions: () => options,\n rehydrate: () => hydrate(),\n hasHydrated: () => hasHydrated,\n onHydrate: (cb) => {\n hydrationListeners.add(cb);\n return () => {\n hydrationListeners.delete(cb);\n };\n },\n onFinishHydration: (cb) => {\n finishHydrationListeners.add(cb);\n return () => {\n finishHydrationListeners.delete(cb);\n };\n }\n };\n if (!options.skipHydration) {\n hydrate();\n }\n return stateFromStorage || configResult;\n};\nconst persist = persistImpl;\n\nfunction ssrSafe(config, isSSR = typeof window === \"undefined\") {\n return (set, get, api) => {\n if (!isSSR) {\n return config(set, get, api);\n }\n const ssrSet = () => {\n throw new Error(\"Cannot set state of Zustand store in SSR\");\n };\n api.setState = ssrSet;\n return config(ssrSet, get, api);\n };\n}\n\nexport { combine, createJSONStorage, devtools, persist, redux, subscribeWithSelector, ssrSafe as unstable_ssrSafe };\n",
@@ -943,6 +943,8 @@ var colors2, frameworkColors, formatPath = (filePath) => {
943
943
  console.error(`${timestamp} ${tag} ${fullMessage}`);
944
944
  }, logHmrUpdate = (path, framework, duration) => {
945
945
  log("hmr update", { duration, framework, path });
946
+ }, logInfo = (message) => {
947
+ log(message);
946
948
  }, logScriptUpdate = (path, framework, duration) => {
947
949
  log("script update", { duration, framework, path });
948
950
  }, logServerReload = () => {
@@ -3763,5 +3765,5 @@ export {
3763
3765
  Island
3764
3766
  };
3765
3767
 
3766
- //# debugId=5A5A84D8A7AE7B9464756E2164756E21
3768
+ //# debugId=C6C390D5FD5B642D64756E2164756E21
3767
3769
  //# sourceMappingURL=index.js.map