frosty 0.0.86 → 0.0.87

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/misc/animate.ts","../../src/core/hooks/debounce.ts","../../src/core/hooks/rendererStorage.ts","../../src/core/hooks/misc/resource/error.tsx","../../src/core/hooks/misc/resource/index.ts","../../src/core/hooks/misc/interval.ts","../../src/core/hooks/misc/store.ts","../../src/core/hooks/awaited.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts"],"sourcesContent":["//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// animate.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useRef } from '../ref';\nimport { useState } from '../state';\nimport { useCallback } from '../callback';\n\n/**\n * Options for configuring the animation.\n * \n * @property fromValue - The starting value of the animation. Defaults to the current value.\n * @property toValue - The target value of the animation.\n * @property duration - The duration of the animation in milliseconds.\n * @property easing - An optional easing function to control the animation's progress. Defaults to a linear function.\n * @property delay - An optional delay (in milliseconds) before the animation starts. Defaults to `0`.\n * @property onCompleted - An optional callback function invoked when the animation completes or is stopped.\n */\ntype AnimateOptions = {\n fromValue?: number;\n toValue: number;\n duration: number;\n easing?: (value: number) => number;\n delay?: number;\n onCompleted?: (result: {\n value: number;\n finished: boolean;\n }) => void;\n};\n\n/**\n * Options for interpolating a value.\n * \n * @property inputRange - A tuple specifying the input range for interpolation.\n * @property outputRange - A tuple specifying the output range for interpolation.\n */\ntype InterpolateOptions = {\n inputRange: [number, number];\n outputRange: [number, number];\n};\n\n/**\n * Represents an interpolated value and provides a method to further interpolate it.\n * \n * @property value - The interpolated value.\n * @property interpolate - A function to interpolate the current value based on new input and output ranges.\n */\ntype AnimatedInterpolation = {\n value: number;\n interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;\n};\n\nconst interpolate = (value: number) => ({ inputRange, outputRange }: InterpolateOptions): AnimatedInterpolation => {\n const [inputMin, inputMax] = inputRange;\n const [outputMin, outputMax] = outputRange;\n\n // Safeguard against division by zero\n if (inputMax === inputMin) {\n throw new Error('Input range must have distinct values.');\n }\n\n const t = (value - inputMin) / (inputMax - inputMin);\n const interpolatedValue = outputMin + t * (outputMax - outputMin);\n return {\n value: interpolatedValue,\n interpolate: interpolate(interpolatedValue),\n };\n};\n\n/**\n * A hook to manage animations with support for starting, stopping, and interpolating values.\n * \n * @param initialValue - The initial value of the animation.\n * \n * @returns An object containing:\n * - `value`: The current animated value.\n * - `stop`: A function to stop the animation.\n * - `start`: A function to start the animation with specified options.\n * - `interpolate`: A function to interpolate the current value based on input and output ranges.\n */\nexport const useAnimate = (initialValue: number) => {\n const [value, setValue] = useState(initialValue);\n const ref = useRef<{\n interval: ReturnType<typeof setInterval>;\n callback?: AnimateOptions['onCompleted'];\n }>();\n const _stop = () => {\n const { interval, callback } = ref.current ?? {};\n ref.current = undefined;\n if (interval) clearInterval(interval);\n return callback;\n };\n const stop = useCallback(() => {\n const callback = _stop();\n if (_.isFunction(callback)) callback({ value, finished: false });\n });\n const start = useCallback(({\n fromValue = value,\n toValue,\n duration,\n easing = (x) => x,\n delay = 0,\n onCompleted,\n }: AnimateOptions) => {\n _stop();\n const start = Date.now();\n if (duration > 0) {\n ref.current = {\n interval: setInterval(() => {\n const t = (Date.now() - start) / duration - delay;\n if (t >= 1) {\n clearInterval(ref.current?.interval);\n ref.current = undefined;\n setValue(toValue);\n if (_.isFunction(onCompleted)) onCompleted({ value: toValue, finished: true });\n } else if (t >= 0) {\n setValue((toValue - fromValue) * easing(_.clamp(t, 0, 1)) + fromValue);\n }\n }, 16),\n callback: onCompleted,\n }\n }\n });\n return {\n value,\n stop,\n start,\n interpolate: interpolate(value),\n };\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// rendererStorage.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\nimport { useRendererStorage } from '../../rendererStorage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\n};\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * const errors = useResourceErrors();\n * \n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useErrorContext().errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { useErrorContext } from './error';\nimport { uniqueId } from '../../../../core/utils';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useErrorContext();\n useEffect(() => {\n const { type, abort, token = uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, []);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (!equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// awaited.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * This hook ensures the promise settles before rendering completes. If the promise is still pending,\n * it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.\n * If rejected, it throws the error.\n *\n * #### Usage\n * ```typescript\n * const data = useAwaited(() => fetchData(id), [id]);\n * ```\n *\n * #### Parameters\n * - `factory`: `() => PromiseLike<T>` \n * A function that returns a promise to resolve.\n * - `deps` (optional): `any` \n * Dependency array for memoization. The promise is recreated when dependencies change.\n *\n * #### Returns\n * - `T | undefined` \n * The resolved value, once available. Returns `undefined` while the promise is pending.\n * - Throws the rejection error if the promise fails.\n *\n * #### Throws\n * - Error if used outside a render function.\n * - The rejection error if the promise fails.\n *\n * @template T Type of the resolved value.\n */\nexport const useAwaited = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n): T | undefined => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAwaited must be used within a render function.');\n const promise = _useMemo('useAwaited', () => factory(), deps);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\n })());\n}","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MA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AACzC,IAAA,IAAI,CAAC,KAAK;AAAE,QAAA,MAAM,KAAK,CAAC,iDAAiD,CAAC;AAC1E,IAAA,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC;AAC9C;;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgCM,SAAU,UAAU,CACxB,OAA8C,EAC9C,YAAkB,EAAA;AAElB,IAAA,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,KAAI;AAC9D,QAAA,MAAM,KAAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;YACnB,CAAC;SACF;AACD,QAAA,OAAO,KAAK;IACd,CAAC,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../src/core/hooks/ref.ts","../../src/core/hooks/state.ts","../../src/core/hooks/misc/animate.ts","../../src/core/hooks/debounce.ts","../../src/core/hooks/storage.ts","../../src/core/hooks/misc/resource/error.tsx","../../src/core/hooks/misc/resource/index.ts","../../src/core/hooks/misc/interval.ts","../../src/core/hooks/misc/store.ts","../../src/core/hooks/awaited.ts","../../src/core/hooks/stack.ts","../../src/core/hooks/reducer.ts"],"sourcesContent":["//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useEffect, _useMemo } from '../reconciler/hooks';\nimport { Ref, RefObject } from '../types/common';\n\n/**\n * Creates a mutable reference object that persists across function calls.\n * \n * @template T The type of the value stored in the reference.\n * @param initialValue The initial value to store in the reference.\n * @returns An object with a `current` property that holds the value.\n */\nexport function useRef<T>(initialValue: T): RefObject<T>;\nexport function useRef<T = undefined>(): RefObject<T | undefined>;\n\nexport function useRef(initialValue?: any) {\n return _useMemo('useRef', () => ({ current: initialValue }), null);\n}\n\n/**\n * Associates a reference with a value created by an initializer function.\n * \n * @template T The type of the reference.\n * @template R The type of the value created by the initializer function.\n * @param ref A reference object or a callback function to receive the value.\n * @param init A function that initializes and returns the value to associate with the reference.\n * @param deps An optional dependency array. The initializer function is re-executed when the dependencies change.\n */\nexport const useRefHandle = <T, R extends T>(\n ref: Ref<T> | undefined,\n init: () => R,\n deps?: any\n) => _useEffect('useRefHandle', () => {\n try {\n if (ref) {\n const _ref = init();\n if (typeof ref === 'function') ref(_ref);\n else if (typeof ref === 'object') ref.current = _ref;\n }\n return () => void 0;\n } catch (e) {\n console.error(e);\n return () => void 0;\n }\n}, deps);","//\n// memo.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\nimport { SetStateAction } from '../types/common';\n\n/**\n * A hook function for managing state within a custom framework or library.\n *\n * @template T - The type of the state value.\n * @param - The initial state value or a function that returns the initial state.\n * @returns - A tuple containing the current state value and a function to update the state.\n *\n * The `useState` function provides a way to manage stateful values. It returns the current state\n * and a setter function that can update the state. The setter function accepts either a new value\n * or a function that receives the current state and returns the updated state.\n *\n * Example:\n * ```typescript\n * const [count, setCount] = useState(0);\n * setCount(5); // Updates the state to 5\n * setCount(prev => prev + 1); // Updates the state to the previous value + 1\n * ```\n */\nexport function useState<T>(initialState: T | (() => T)): [T, (dispatch: SetStateAction<T>) => void];\nexport function useState<T = undefined>(): [T | undefined, (dispatch: SetStateAction<T | undefined>) => void];\n\nexport function useState(initialState?: any) {\n const { value, setValue } = _useMemo('useState', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n setValue: (dispatch: SetStateAction<any>) => {\n state.value = _.isFunction(dispatch) ? dispatch(state.value) : dispatch;\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, setValue];\n}\n","//\n// animate.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { useRef } from '../ref';\nimport { useState } from '../state';\nimport { useCallback } from '../callback';\n\n/**\n * Options for configuring the animation.\n * \n * @property fromValue - The starting value of the animation. Defaults to the current value.\n * @property toValue - The target value of the animation.\n * @property duration - The duration of the animation in milliseconds.\n * @property easing - An optional easing function to control the animation's progress. Defaults to a linear function.\n * @property delay - An optional delay (in milliseconds) before the animation starts. Defaults to `0`.\n * @property onCompleted - An optional callback function invoked when the animation completes or is stopped.\n */\ntype AnimateOptions = {\n fromValue?: number;\n toValue: number;\n duration: number;\n easing?: (value: number) => number;\n delay?: number;\n onCompleted?: (result: {\n value: number;\n finished: boolean;\n }) => void;\n};\n\n/**\n * Options for interpolating a value.\n * \n * @property inputRange - A tuple specifying the input range for interpolation.\n * @property outputRange - A tuple specifying the output range for interpolation.\n */\ntype InterpolateOptions = {\n inputRange: [number, number];\n outputRange: [number, number];\n};\n\n/**\n * Represents an interpolated value and provides a method to further interpolate it.\n * \n * @property value - The interpolated value.\n * @property interpolate - A function to interpolate the current value based on new input and output ranges.\n */\ntype AnimatedInterpolation = {\n value: number;\n interpolate: ({ inputRange, outputRange }: InterpolateOptions) => AnimatedInterpolation;\n};\n\nconst interpolate = (value: number) => ({ inputRange, outputRange }: InterpolateOptions): AnimatedInterpolation => {\n const [inputMin, inputMax] = inputRange;\n const [outputMin, outputMax] = outputRange;\n\n // Safeguard against division by zero\n if (inputMax === inputMin) {\n throw new Error('Input range must have distinct values.');\n }\n\n const t = (value - inputMin) / (inputMax - inputMin);\n const interpolatedValue = outputMin + t * (outputMax - outputMin);\n return {\n value: interpolatedValue,\n interpolate: interpolate(interpolatedValue),\n };\n};\n\n/**\n * A hook to manage animations with support for starting, stopping, and interpolating values.\n * \n * @param initialValue - The initial value of the animation.\n * \n * @returns An object containing:\n * - `value`: The current animated value.\n * - `stop`: A function to stop the animation.\n * - `start`: A function to start the animation with specified options.\n * - `interpolate`: A function to interpolate the current value based on input and output ranges.\n */\nexport const useAnimate = (initialValue: number) => {\n const [value, setValue] = useState(initialValue);\n const ref = useRef<{\n interval: ReturnType<typeof setInterval>;\n callback?: AnimateOptions['onCompleted'];\n }>();\n const _stop = () => {\n const { interval, callback } = ref.current ?? {};\n ref.current = undefined;\n if (interval) clearInterval(interval);\n return callback;\n };\n const stop = useCallback(() => {\n const callback = _stop();\n if (_.isFunction(callback)) callback({ value, finished: false });\n });\n const start = useCallback(({\n fromValue = value,\n toValue,\n duration,\n easing = (x) => x,\n delay = 0,\n onCompleted,\n }: AnimateOptions) => {\n _stop();\n const start = Date.now();\n if (duration > 0) {\n ref.current = {\n interval: setInterval(() => {\n const t = (Date.now() - start) / duration - delay;\n if (t >= 1) {\n clearInterval(ref.current?.interval);\n ref.current = undefined;\n setValue(toValue);\n if (_.isFunction(onCompleted)) onCompleted({ value: toValue, finished: true });\n } else if (t >= 0) {\n setValue((toValue - fromValue) * easing(_.clamp(t, 0, 1)) + fromValue);\n }\n }, 16),\n callback: onCompleted,\n }\n }\n });\n return {\n value,\n stop,\n start,\n interpolate: interpolate(value),\n };\n}","//\n// debounce.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst debounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const { wait, ...options } = settings;\n return _.debounce(callback, wait, {\n ...options,\n leading: 'leading' in options ? !!options.leading : true,\n trailing: 'trailing' in options ? !!options.trailing : true,\n });\n}\n\nconst asyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n func: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n\n type R = T extends (...args: any) => PromiseLike<infer R> ? R : never;\n let preflight: Promise<R>;\n\n const debounced = debounce(async function (\n this: any,\n resolve?: (value: PromiseLike<R>) => void,\n ...args: Parameters<T>\n ) {\n const result = func.call(this, ...args as any) as PromiseLike<R>;\n if (_.isFunction(resolve)) resolve(result);\n return result;\n }, settings);\n\n return function (this: any, ...args: Parameters<T>) {\n if (_.isNil(preflight)) {\n preflight = new Promise<R>(r => debounced.call(this, r, ...args));\n return preflight;\n }\n return debounced.call(this, undefined, ...args) ?? preflight;\n };\n};\n\n/**\n * A hook that creates a debounced version of a function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is useful for optimizing performance in scenarios where frequent\n * function calls (e.g., during user input or window resizing) can be expensive.\n * \n * @template T The type of the callback function.\n * @param callback The function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the callback function.\n */\nexport const useDebounce = <T extends (...args: any) => any>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useDebounce', () => {\n const store = {\n current: callback,\n stable: debounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n\n/**\n * A hook that creates a debounced version of an asynchronous function.\n * The debounced function delays invoking the callback until after\n * the specified wait time has elapsed since the last time it was called.\n * \n * This is particularly useful for scenarios where frequent API calls\n * or other asynchronous operations need to be throttled to improve performance.\n * \n * @template T The type of the asynchronous callback function.\n * @param callback The asynchronous function to debounce.\n * @param settings Configuration options for debouncing, including:\n * - `wait` (number): The number of milliseconds to delay.\n * - Other lodash debounce options such as `leading` and `trailing`.\n * @returns A debounced version of the asynchronous callback function.\n */\nexport const useAsyncDebounce = <T extends (...args: any) => PromiseLike<any>>(\n callback: T,\n settings: _.DebounceSettings & { wait?: number; },\n) => {\n const store = _useMemo('useAsyncDebounce', () => {\n const store = {\n current: callback,\n stable: asyncDebounce((function (this: any, ...args) {\n return store.current.call(this, ...args);\n }) as T, settings),\n };\n return store;\n }, null);\n store.current = callback;\n return store.stable;\n}\n","//\n// storage.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\nconst storage = new WeakMap<any, Map<any, any>>();\n\n/**\n * Returns a persistent storage Map associated with the current renderer instance.\n * This hook allows components to store and retrieve values that persist across renders,\n * scoped to the renderer. Must be called within a render function.\n *\n * @throws Error if called outside of a render function.\n * @returns {Map<any, any>} The storage map for the current renderer.\n */\nexport const useRendererStorage = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useRendererStorage must be used within a render function.');\n const found = storage.get(state.renderer);\n const store = found ?? new Map<any, any>();\n if (!found) storage.set(state.renderer, store);\n return store;\n};\n","//\n// error.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { Awaitable } from '@o2ter/utils-js';\nimport { ComponentType, PropsWithChildren, SetStateAction } from '../../../types/common';\nimport { createContext } from '../../context';\nimport { useContext } from '../../context';\nimport { useState } from '../../state';\nimport { useMemo } from '../../memo';\nimport { useRendererStorage } from '../../storage';\n\ntype Errors = {\n token: string;\n error: any;\n refresh: () => Awaitable<void>;\n refreshing: boolean;\n loading: boolean;\n}[];\n\ntype ContextValue = {\n errors: Errors;\n setErrors: (values: SetStateAction<Errors>) => void;\n};\n\nconst defaultStorageKey = Symbol();\nconst Context = createContext<ContextValue>();\n\n/**\n * A context provider component for managing asynchronous resource errors.\n * \n * This component provides a shared context for tracking errors encountered during\n * asynchronous operations. It allows child components to access and manage these errors\n * using the `useResourceErrors` hook.\n * \n * ### Usage:\n * Wrap your application or specific parts of it with this component to enable error tracking:\n * \n * ```tsx\n * <ResourceErrors>\n * <YourComponent />\n * </ResourceErrors>\n * ```\n * \n * @param children - The child components that will have access to the error context.\n * \n * @returns A context provider that wraps the provided children.\n */\nexport const ResourceErrors: ComponentType<PropsWithChildren<{}>> = ({\n children\n}) => {\n const [errors, setErrors] = useState<Errors>([]);\n const value = useMemo(() => ({ errors, setErrors }), [errors, setErrors]);\n return (\n <Context value={value}>{children}</Context>\n );\n}\n\nexport const useErrorContext = () => {\n const value = useContext(Context);\n if (value) return value;\n const storage = useRendererStorage();\n const found = storage.get(defaultStorageKey);\n if (found) return found as ContextValue;\n const store: ContextValue = {\n errors: [],\n setErrors: (values: SetStateAction<Errors>) => {\n store.errors = _.isFunction(values) ? values(store.errors) : values;\n },\n };\n storage.set(defaultStorageKey, store);\n return store;\n};\n\n/**\n * A hook to access the list of asynchronous resource errors.\n * \n * This hook allows components to retrieve the current list of errors being tracked\n * in the `ResourceErrors` context. It must be used within a component that is\n * a descendant of the `ResourceErrors` provider.\n * \n * ### Usage:\n * ```tsx\n * const errors = useResourceErrors();\n * \n * errors.forEach(({ token, error, refresh }) => {\n * console.error(`Error [${token}]:`, error);\n * // Optionally call refresh() to retry the operation\n * });\n * ```\n * \n * @returns The list of errors currently being tracked in the context. Each error includes:\n * - `token`: A unique identifier for the error.\n * - `error`: The error object or message.\n * - `refresh`: A function to retry the operation that caused the error.\n */\nexport const useResourceErrors = () => useErrorContext().errors;\n","//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../../types/common';\nimport { Config, Fetch, FetchWithIterable } from './types';\nimport { useState } from '../../state';\nimport { useEffect } from '../../effect';\nimport { useCallback } from '../../callback';\nimport { useAsyncDebounce } from '../../debounce';\nimport { useErrorContext } from './error';\nimport { uniqueId } from '../../../../core/utils';\nexport { ResourceErrors, useResourceErrors } from './error';\n\n/**\n * A hook to manage asynchronous resources with support for debouncing, error handling, and state management.\n * \n * @template T - The type of the resource being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing:\n * - `count`: The number of times the resource has been fetched.\n * - `refreshing`: A boolean indicating if the resource is currently being refreshed.\n * - `loading`: A boolean indicating if the resource is currently being loaded.\n * - `resource`: The fetched resource.\n * - `error`: Any error encountered during the fetch.\n * - `cancel`: A function to cancel the current fetch operation.\n * - `refresh`: A function to refresh the resource.\n * - `next`: A function to fetch the next set of data (for paginated resources).\n * - `setResource`: A function to manually update the resource state.\n */\nexport const useResource = <T, P = any>(\n config: Fetch<T, P> | Config<Fetch<T, P>>,\n deps?: any,\n) => {\n\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n\n const [state, setState] = useState<{\n type?: 'refresh' | 'next';\n count?: number;\n flag?: boolean;\n resource?: T;\n error?: any;\n token?: string;\n abort?: AbortController;\n }>({});\n\n const _dispatch = (\n token: string,\n next: SetStateAction<typeof state>,\n ) => setState(state => state.token === token ? ({\n ...(_.isFunction(next) ? next(state.flag ? state : _.omit(state, 'resource', 'error')) : next),\n count: state.flag ? state.count : (state.count ?? 0) + 1,\n flag: true,\n }) : state);\n\n const _fetch = useAsyncDebounce(async (\n type: 'refresh' | 'next',\n abort: AbortController,\n reset: boolean,\n param?: P,\n prevState?: T,\n ) => {\n\n const token = uniqueId();\n setState(state => ({ ...state, type, token, abort, flag: !reset }));\n\n try {\n\n const resource = await fetch({\n param,\n prevState,\n abortSignal: abort.signal,\n dispatch: (next) => {\n _dispatch(token, state => ({\n ...state,\n resource: _.isFunction(next) ? next(state.resource) : next,\n }));\n },\n });\n\n _dispatch(token, state => ({ resource: resource ?? state.resource }));\n\n } catch (error) {\n\n _dispatch(token, state => ({\n resource: state.resource,\n error,\n }));\n }\n\n }, debounce ?? {});\n\n useEffect(() => {\n const controller = new AbortController();\n void _fetch('refresh', controller, true);\n return () => controller.abort();\n }, deps ?? []);\n\n const _cancelRef = useCallback((reason?: any) => { state.abort?.abort(reason) });\n const _refreshRef = useCallback((param?: P) => _fetch('refresh', new AbortController(), true, param));\n const _nextRef = useCallback((param?: P) => _fetch('next', new AbortController(), false, param, state.resource));\n const _setResRef = useCallback((resource: T | ((prevState?: T) => T)) => setState(state => ({\n ..._.omit(state, 'resource', 'error'),\n resource: _.isFunction(resource) ? resource(state.resource) : resource,\n })));\n\n const { setErrors } = useErrorContext();\n useEffect(() => {\n const { type, abort, token = uniqueId(), error } = state;\n if (!error) return;\n setErrors(v => [...v, {\n token,\n error,\n refresh: _refreshRef,\n refreshing: !_.isNil(abort) && type === 'refresh',\n loading: !_.isNil(abort),\n }]);\n return () => setErrors(v => _.filter(v, x => x.token !== token));\n }, [state]);\n\n return {\n count: state.count ?? 0,\n refreshing: !_.isNil(state.abort) && state.type === 'refresh',\n loading: !_.isNil(state.abort),\n resource: state.resource,\n error: state.error,\n cancel: _cancelRef,\n refresh: _refreshRef,\n next: _nextRef,\n setResource: _setResRef,\n };\n}\n\n/**\n * A hook to manage asynchronous iterable resources, such as streams or paginated data.\n * \n * @template T - The type of the resource items being fetched.\n * @template P - The type of the parameters passed to the fetch function.\n * \n * @param config - The fetch function or a configuration object containing the fetch function and optional debounce settings.\n * @param deps - An optional dependency array to control when the resource is refreshed.\n * \n * @returns An object containing the same properties as `useResource`, but optimized for iterable resources.\n */\nexport const useIterableResource = <T, P = any>(\n config: FetchWithIterable<T, P> | Config<FetchWithIterable<T, P>>,\n deps?: any,\n) => {\n const fetch = _.isFunction(config) ? config : config.fetch;\n const debounce = _.isFunction(config) ? {} : config.debounce;\n const { next, ...result } = useResource<T[]>({\n fetch: async ({ dispatch, abortSignal, param }) => {\n const resource = await fetch({ abortSignal, param });\n for await (const item of resource) {\n dispatch(items => items ? [...items, item] : [item]);\n }\n },\n debounce,\n }, deps);\n return result;\n}\n","//\n// interval.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport { useEffect } from '../effect';\n\n/**\n * A hook that repeatedly calls the provided callback function at the specified interval.\n * \n * @param callback - The function to be executed at each interval.\n * @param ms - The delay in milliseconds between each call to the callback. If not provided, the interval will not be set.\n * @returns void\n * \n * @example\n * useInterval(() => {\n * // Code to run every 1000ms\n * }, 1000);\n */\nexport const useInterval = (\n callback: () => void,\n ms?: number,\n) => useEffect(() => {\n const interval = setInterval(() => {\n callback();\n }, ms);\n return () => clearInterval(interval);\n}, []);\n","//\n// store.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { SetStateAction } from '../../types/common';\nimport { useSyncExternalStore } from '../sync';\n\n/**\n * A class representing a store that holds a value and allows for subscription\n * to changes in that value.\n *\n * @template T - The type of the value stored in the store.\n *\n * @example\n * const store = createStore(0);\n * store.setValue(1);\n * store.subscribe((oldVal, newVal) => {\n * console.log(`Value changed from ${oldVal} to ${newVal}`);\n * });\n */\nclass Store<T> {\n\n #listeners = new Set<(oldVal: T, newVal: T) => void>();\n #value: T;\n\n /** @internal */\n constructor(initialValue: T) {\n this.#value = initialValue;\n }\n\n /**\n * Gets the current value of the store.\n * \n * @returns The current value of the store.\n */\n get value() {\n return this.#value;\n }\n\n /**\n * Sets the value of the store and notifies all subscribers.\n * \n * @param dispatch - The new value or a function that returns the new value.\n */\n setValue(dispatch: SetStateAction<T>) {\n const oldVal = this.#value;\n this.#value = _.isFunction(dispatch) ? dispatch(this.#value) : dispatch;\n this.#listeners.forEach(listener => void listener(oldVal, this.#value));\n }\n\n /**\n * Subscribes to changes in the store's value.\n * \n * @param callback - The function to call when the value changes.\n * @returns A function to unsubscribe from the store.\n */\n subscribe(callback: (oldVal: T, newVal: T) => void) {\n this.#listeners.add(callback);\n return () => { this.#listeners.delete(callback); };\n }\n}\n\n/**\n * Creates a new store with the given initial value.\n * \n * @param initialValue - The initial value to be stored.\n * @returns {Store<T>} A new store instance.\n *\n * @example\n * const counterStore = createStore(0);\n */\nexport const createStore = <T extends unknown = any>(initialValue: T) => new Store(initialValue);\n\n/**\n * A hook to subscribe to a store and select a slice of its state.\n * The component will re-render when the selected state changes.\n * \n * @param store - The store instance to subscribe to.\n * @param selector - A function to select a part of the store's state. Defaults to the entire state.\n * @param equal - A function to compare selected values for equality. Defaults to deep equality.\n * @returns The selected slice of the store's state.\n *\n * @example\n * const count = useStore(counterStore);\n *\n * @example\n * // Using a selector\n * const userName = useStore(userStore, user => user.name);\n */\nexport const useStore = <T extends unknown = any, S = T>(\n store: Store<T>,\n selector: (state: T) => S = v => v as any,\n equal: (value: S, other: S) => boolean = _.isEqual,\n): S => useSyncExternalStore(\n (onStoreChange) => store.subscribe((oldVal, newVal) => {\n if (!equal(selector(oldVal), selector(newVal))) onStoreChange();\n }),\n () => selector(store.value)\n);\n","//\n// awaited.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\nimport { _useMemo } from '../reconciler/hooks';\n\nconst resolved = new WeakMap<PromiseLike<any>, { result?: any; error?: any; }>();\n\n/**\n * Eagerly resolves a promise returned by the factory function and caches its result or error.\n *\n * This hook ensures the promise settles before rendering completes. If the promise is still pending,\n * it returns `undefined` and schedules an immediate rerender of the current component. Once resolved, it returns the value.\n * If rejected, it throws the error.\n *\n * #### Usage\n * ```typescript\n * const data = useAwaited(() => fetchData(id), [id]);\n * ```\n *\n * #### Parameters\n * - `factory`: `() => PromiseLike<T>` \n * A function that returns a promise to resolve.\n * - `deps` (optional): `any` \n * Dependency array for memoization. The promise is recreated when dependencies change.\n *\n * #### Returns\n * - `T | undefined` \n * The resolved value, once available. Returns `undefined` while the promise is pending.\n * - Throws the rejection error if the promise fails.\n *\n * #### Throws\n * - Error if used outside a render function.\n * - The rejection error if the promise fails.\n *\n * @template T Type of the resolved value.\n */\nexport const useAwaited = <T>(\n factory: () => PromiseLike<T>,\n deps?: any,\n): T | undefined => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useAwaited must be used within a render function.');\n const promise = _useMemo('useAwaited', () => factory(), deps);\n if (resolved.has(promise)) {\n const { result, error } = resolved.get(promise) ?? {};\n if (error) throw error;\n return result;\n }\n state.tasks.push((async () => {\n try {\n const result = await promise;\n resolved.set(promise, { result });\n } catch (error) {\n resolved.set(promise, { error });\n }\n })());\n}","//\n// stack.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { reconciler } from '../reconciler/state';\n\n/**\n * Retrieves the stack of parent components from the current hook state.\n *\n * This function accesses the current hook state and extracts the stack of \n * parent components. It throws an error if called outside of a valid render \n * context.\n *\n * @returns An array of parent components from the current hook state.\n * @throws Will throw an error if the function is called outside of a valid render context.\n */\nexport const useStack = () => {\n const state = reconciler.currentHookState;\n if (!state) throw Error('useStack must be used within a render function.');\n return _.map(state.stack, x => x._component);\n}\n","//\n// reducer.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { _useMemo } from '../reconciler/hooks';\n\n/**\n * A utility function that manages state using a reducer pattern.\n * \n * @template T The type of the state.\n * @template A The type of the action object (optional).\n * @param reducer A function that takes the current state and an action, and returns the new state.\n * @param initialState The initial state value or a function that returns the initial state.\n * @returns A tuple containing the current state and a dispatch function to update the state.\n */\nexport function useReducer<T>(\n reducer: (prevState: T) => T,\n initialState: T | (() => T),\n): [T, (dispatch: () => void) => void];\n\nexport function useReducer<T, A = any>(\n reducer: (prevState: T, action: A) => T,\n initialState: T | (() => T),\n): [T, (dispatch: (action: A) => void) => void];\n\nexport function useReducer<T = undefined>(\n reducer: (prevState: T | undefined) => T | undefined\n): [T | undefined, (dispatch: () => void) => void];\n\nexport function useReducer<T = undefined, A = any>(\n reducer: (prevState: T | undefined, action: A) => T | undefined\n): [T | undefined, (dispatch: (action: A) => void) => void];\n\nexport function useReducer(\n reducer: (prevState: any, action?: any) => any,\n initialState?: any,\n) {\n const { value, dispatch } = _useMemo('useReducer', ({ node }) => {\n const state = {\n value: _.isFunction(initialState) ? initialState() : initialState,\n dispatch: (action?: any) => {\n state.value = reducer(state.value, action);\n node?._setDirty();\n },\n };\n return state;\n }, null);\n return [value, dispatch];\n}\n"],"names":["_jsx"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAgBM,SAAU,MAAM,CAAC,YAAkB,EAAA;AACvC,IAAA,OAAO,QAAQ,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC;AACpE;AAEA;;;;;;;;AAQG;AACI,MAAM,YAAY,GAAG,CAC1B,GAAuB,EACvB,IAAa,EACb,IAAU,KACP,UAAU,CAAC,cAAc,EAAE,MAAK;AACnC,IAAA,IAAI;QACF,IAAI,GAAG,EAAE;AACP,YAAA,MAAM,IAAI,GAAG,IAAI,EAAE;YACnB,IAAI,OAAO,GAAG,KAAK,UAAU;gBAAE,GAAG,CAAC,IAAI,CAAC;iBACnC,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,gBAAA,GAAG,CAAC,OAAO,GAAG,IAAI;QACtD;AAC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AAK,GAAG;AACZ,YAAA,KAAK,EAAE,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,GAAG,YAAY,EAAE,GAAG,YAAY;AACjE,YAAA,QAAQ,EAAE,CAAC,MAAY,KAAI;gBACzB,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC;gBAC1C,IAAI,EAAE,SAAS,EAAE;YACnB,CAAC;SACF;AACD,QAAA,OAAO,KAAK;IACd,CAAC,EAAE,IAAI,CAAC;AACR,IAAA,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC;AAC1B;;;;"}
@@ -3843,6 +3843,94 @@ class StyleBuilder {
3843
3843
  }
3844
3844
  }
3845
3845
 
3846
+ //
3847
+ // compress.js
3848
+ //
3849
+ // The MIT License
3850
+ // Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.
3851
+ //
3852
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
3853
+ // of this software and associated documentation files (the "Software"), to deal
3854
+ // in the Software without restriction, including without limitation the rights
3855
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
3856
+ // copies of the Software, and to permit persons to whom the Software is
3857
+ // furnished to do so, subject to the following conditions:
3858
+ //
3859
+ // The above copyright notice and this permission notice shall be included in
3860
+ // all copies or substantial portions of the Software.
3861
+ //
3862
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
3863
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
3864
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
3865
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
3866
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
3867
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
3868
+ // THE SOFTWARE.
3869
+ //
3870
+ // @ts-nocheck
3871
+ function _compress(r, e, o) {
3872
+ if (null == r)
3873
+ return "";
3874
+ var t, a, h, f = {}, p = {}, c = "", s = "", n = "", u = 2, l = 3, i = 2, A = [], d = 0, C = 0;
3875
+ for (h = 0; h < r.length; h += 1)
3876
+ if (c = r.charAt(h), Object.prototype.hasOwnProperty.call(f, c) || (f[c] = l++, p[c] = true), s = n + c, Object.prototype.hasOwnProperty.call(f, s))
3877
+ n = s;
3878
+ else {
3879
+ if (Object.prototype.hasOwnProperty.call(p, n)) {
3880
+ if (n.charCodeAt(0) < 256) {
3881
+ for (t = 0; t < i; t++)
3882
+ d <<= 1, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++;
3883
+ for (a = n.charCodeAt(0), t = 0; t < 8; t++)
3884
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3885
+ }
3886
+ else {
3887
+ for (a = 1, t = 0; t < i; t++)
3888
+ d = d << 1 | a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a = 0;
3889
+ for (a = n.charCodeAt(0), t = 0; t < 16; t++)
3890
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3891
+ }
3892
+ 0 == --u && (u = Math.pow(2, i), i++), delete p[n];
3893
+ }
3894
+ else
3895
+ for (a = f[n], t = 0; t < i; t++)
3896
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3897
+ 0 == --u && (u = Math.pow(2, i), i++), f[s] = l++, n = String(c);
3898
+ }
3899
+ if ("" !== n) {
3900
+ if (Object.prototype.hasOwnProperty.call(p, n)) {
3901
+ if (n.charCodeAt(0) < 256) {
3902
+ for (t = 0; t < i; t++)
3903
+ d <<= 1, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++;
3904
+ for (a = n.charCodeAt(0), t = 0; t < 8; t++)
3905
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3906
+ }
3907
+ else {
3908
+ for (a = 1, t = 0; t < i; t++)
3909
+ d = d << 1 | a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a = 0;
3910
+ for (a = n.charCodeAt(0), t = 0; t < 16; t++)
3911
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3912
+ }
3913
+ 0 == --u && (u = Math.pow(2, i), i++), delete p[n];
3914
+ }
3915
+ else
3916
+ for (a = f[n], t = 0; t < i; t++)
3917
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3918
+ 0 == --u && (u = Math.pow(2, i), i++);
3919
+ }
3920
+ for (a = 2, t = 0; t < i; t++)
3921
+ d = d << 1 | 1 & a, C == e - 1 ? (C = 0, A.push(o(d)), d = 0) : C++, a >>= 1;
3922
+ for (;;) {
3923
+ if (d <<= 1, C == e - 1) {
3924
+ A.push(o(d));
3925
+ break;
3926
+ }
3927
+ C++;
3928
+ }
3929
+ return A.join("");
3930
+ }
3931
+ const altAlpha = ":;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz";
3932
+ const compress = (r) => _compress(r, 6, r => altAlpha.charAt(r));
3933
+
3846
3934
  //
3847
3935
  // common.ts
3848
3936
  //
@@ -3897,6 +3985,8 @@ class _DOMRenderer extends renderer._Renderer {
3897
3985
  _namespace_map = new WeakMap();
3898
3986
  _tracked_head_children = [];
3899
3987
  _tracked_style = new StyleBuilder();
3988
+ /** @internal */
3989
+ _tracked_server_resource = new Map();
3900
3990
  _tracked_elements = new Map();
3901
3991
  constructor(window) {
3902
3992
  super();
@@ -3912,28 +4002,28 @@ class _DOMRenderer extends renderer._Renderer {
3912
4002
  _beforeUpdate() {
3913
4003
  if (this._server) {
3914
4004
  this._tracked_head_children = [];
4005
+ this._tracked_server_resource = new Map();
3915
4006
  }
3916
4007
  }
3917
4008
  /** @internal */
3918
4009
  _afterUpdate() {
3919
4010
  this._tracked_style.select([...this._tracked_elements.values().flatMap(({ className }) => className)]);
3920
4011
  const head = this.document.head ?? this.document.createElementNS(HTML_NS, 'head');
3921
- if (this._tracked_style.isEmpty) {
3922
- if (this._server) {
3923
- this.__replaceChildren(head, this._tracked_head_children);
4012
+ const styleElem = this.document.querySelector('style[data-frosty-style]') ?? this.document.createElementNS(HTML_NS, 'style');
4013
+ styleElem.setAttribute('data-frosty-style', '');
4014
+ if (styleElem.textContent !== this._tracked_style.css)
4015
+ styleElem.textContent = this._tracked_style.css;
4016
+ if (this._server) {
4017
+ const ssrData = this._tracked_server_resource.size ? this.document.createElementNS(HTML_NS, 'script') : undefined;
4018
+ if (ssrData) {
4019
+ ssrData.setAttribute('data-frosty-ssr-data', '');
4020
+ ssrData.setAttribute('type', 'text/plain');
4021
+ ssrData.innerHTML = compress(JSON.stringify(Object.fromEntries(this._tracked_server_resource)));
3924
4022
  }
4023
+ this.__replaceChildren(head, _.compact([...this._tracked_head_children, styleElem, ssrData]));
3925
4024
  }
3926
- else {
3927
- const styleElem = this.document.querySelector('style[data-frosty-style]') ?? this.document.createElementNS(HTML_NS, 'style');
3928
- styleElem.setAttribute('data-frosty-style', '');
3929
- if (styleElem.textContent !== this._tracked_style.css)
3930
- styleElem.textContent = this._tracked_style.css;
3931
- if (this._server) {
3932
- this.__replaceChildren(head, [...this._tracked_head_children, styleElem]);
3933
- }
3934
- else if (styleElem.parentNode !== head) {
3935
- head.appendChild(styleElem);
3936
- }
4025
+ else if (styleElem.parentNode !== head) {
4026
+ head.appendChild(styleElem);
3937
4027
  }
3938
4028
  if (!this.document.head) {
3939
4029
  this.document.documentElement.insertBefore(head, this.document.body);
@@ -4168,4 +4258,4 @@ class _DOMRenderer extends renderer._Renderer {
4168
4258
 
4169
4259
  exports.DOMNativeNode = DOMNativeNode;
4170
4260
  exports._DOMRenderer = _DOMRenderer;
4171
- //# sourceMappingURL=common--Kl7OPwM.js.map
4261
+ //# sourceMappingURL=common-CnL8ftw8.js.map