gemi 0.46.0 → 0.47.0

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.js","names":["_options","C","#i","#t","#n","#e","#s","#o","#b","#f","#r","#h","#u","#d","#A","#T","#P","#C","#E","#g","#S","#x","#O","#y","#p","#w","#k","#c","#R","#l","#m","#a","URLPattern","l","y","d"],"sources":["../../utils/Subject.ts","../../client/QueryResource.ts","../../client/QueryManagerContext.tsx","../../utils/applyParams.ts","../../utils/omitNullishValues.ts","../../client/RouteStateContext.tsx","../../client/useParams.ts","../../client/useRouteData.ts","../../client/isPlainObject.ts","../../client/useQuery.ts","../../client/useMutation.ts","../../client/useMutate.ts","../../client/ServerDataProvider.tsx","../../client/Mutation.tsx","../../client/useLocation.ts","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/.bun/history@5.3.0/node_modules/history/index.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js","../../utils/sleep.ts","../../client/ProgressManager.ts","../../client/useRoute.ts","../../client/HttpReload.tsx","../../client/I18nContext.tsx","../../client/ClientRouterContext.tsx","../../client/useNavigate.ts","../../client/useSearchParams.ts","../../client/useIsNavigationPending.ts","../../client/useNavigationProgress.ts","../../client/useBreadcrumbs.ts","../../client/RouteTransitionProvider.tsx","../../client/Link.tsx","../../client/Redirect.tsx","../../client/helpers/flattenComponentTree.ts","../../client/ComponentContext.tsx","../../client/WebsocketContext.tsx","../../client/Head.tsx","../../client/ThemeProvider.tsx","../../utils/partialRender.ts","../../client/helpers/mergeCarriedSegments.ts","../../client/ClientRouter.tsx","../../../../node_modules/.bun/react-error-boundary@6.1.1+83d5fd7b249dbeef/node_modules/react-error-boundary/dist/react-error-boundary.js","../../client/init.tsx","../../client/createRoot.tsx","../../client/Image.tsx","../../client/auth/useForgotPassword.ts","../../client/auth/useSignIn.tsx","../../client/auth/useSignUp.ts","../../client/auth/useSignOut.ts","../../client/auth/useResetPassword.ts","../../client/auth/useUser.ts","../../utils/parseTranslation.tsx","../../client/useTranslator.ts","../../client/useLocale.ts","../../client/useSubscription.ts","../../client/useBroadcast.ts","../../client/OpenGraphImage.tsx","../../client/useAppIdMissmatch.ts"],"sourcesContent":["export class Subject<T> {\n subscribers = new Set<(value: T) => void>();\n value: T;\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n public subscribe(subscriber: (value: T) => void) {\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n }\n\n public next(value: T) {\n this.value = value;\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n public getValue() {\n return this.value;\n }\n}\n","import { Subject } from \"../utils/Subject\";\n\ntype State = {\n loading: boolean;\n data: any;\n error: any;\n version: number;\n};\n\nexport const DEFAULT_STALE_TIME = 5000;\n\nexport class QueryResource {\n store: Subject<Map<string, State>>;\n staleVariants = new Set<string>();\n lastFetchRecord = new Map<string, number>();\n key: string;\n\n constructor(key: string, initialState: Record<string, any>) {\n this.key = key;\n this.store = new Subject(new Map());\n this.hydrate(initialState);\n }\n\n /**\n * Adopt server-prefetched data into the cache.\n *\n * Called once from the constructor for the SSR payload, and again on every\n * client-side navigation with the `prefetchedData` the server just produced —\n * otherwise the resource cache (which is keyed by path for the lifetime of\n * the app) would keep serving the first payload and revalidate it over `/api`.\n */\n hydrate(initialState: Record<string, any> | null | undefined) {\n const store = this.store.getValue();\n const now = Date.now();\n let changed = false;\n\n for (const [variantKey, data] of Object.entries(initialState ?? {})) {\n if (!data) continue;\n const current = store.get(variantKey);\n // Never clobber an in-flight fetch — `resolveVariant` flips `loading`\n // before its first await, so this also covers an optimistic `mutate`\n // whose refetch hasn't landed yet.\n if (current?.loading) continue;\n // Idempotent re-hydration (e.g. StrictMode's double invoke).\n if (current && current.data === data) continue;\n\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: now,\n });\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, now);\n changed = true;\n }\n\n if (changed) {\n this.store.next(store);\n }\n }\n\n /**\n * The cached state for a variant, or `undefined` — a plain read that never\n * fetches and never revalidates.\n *\n * `getVariant` is the read that keeps the cache honest, and it starts a\n * request when it has to. That makes it the wrong thing to call while\n * rendering: React throws away a render whose subtree suspends and retries\n * it, so every discarded attempt would leak a request. Renders read with\n * this; effects, which only run for a render that committed, use\n * `getVariant`.\n */\n peek(variantKey: string) {\n return this.store.getValue().get(variantKey);\n }\n\n getVariant(variantKey: string, staleTime: number = DEFAULT_STALE_TIME) {\n const store = this.store.getValue();\n if (!store.has(variantKey)) {\n this.resolveVariant(variantKey);\n } else {\n const variant = store.get(variantKey);\n\n if (!variant.loading) {\n // Don't have data\n if (!variant.data) {\n this.resolveVariant(variantKey);\n return store.get(variantKey);\n }\n if (variant.data) {\n const stale = this.staleVariants.has(variantKey);\n const now = Date.now();\n // `>=` so `staleTime: 0` means \"always revalidate\" and\n // `staleTime: Infinity` means \"never\".\n const old =\n now - (this.lastFetchRecord.get(variantKey) ?? now) >= staleTime;\n if (stale || old) {\n this.lastFetchRecord.set(variantKey, now);\n this.resolveVariant(variantKey, true);\n return store.get(variantKey);\n }\n }\n }\n }\n return store.get(variantKey);\n }\n\n mutate(variantKey: string, fn: (data: any) => any = (data) => data) {\n const cacheKey = [\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : \"\",\n this.key,\n variantKey,\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n try {\n if (caches) {\n caches?.delete(cacheKey);\n }\n } catch (err) {}\n\n const store = this.store.getValue();\n const state = store.get(variantKey);\n if (!state || !state.data) {\n // Nothing is cached yet to update optimistically — e.g. a lazy query, or\n // one that hasn't resolved. Fall through to a refetch so `mutate(fn)` is\n // not a silent no-op (it still means \"go get the latest data\").\n this.resolveVariant(variantKey, false, false);\n return;\n }\n const data = fn(state.data);\n\n this.staleVariants.add(variantKey);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: state.version,\n }),\n );\n this.resolveVariant(variantKey, false, false);\n }\n\n refetch(variantKey: string) {\n this.resolveVariant(variantKey, false, false);\n }\n\n private async resolveVariant(\n variantKey: string,\n silent = false,\n cache = true,\n ) {\n if (typeof window === \"undefined\") {\n return;\n }\n const store = this.store.getValue();\n const previousState = store.get(variantKey);\n\n if (!silent) {\n store.set(variantKey, {\n loading: true,\n data: previousState?.data,\n error: previousState?.error,\n version: previousState?.version,\n });\n }\n\n let data = null;\n let response: Response | null = null;\n const fullUrl = [this.key, variantKey].filter((s) => s.length).join(\"?\");\n try {\n response = await fetch(`/api${fullUrl}`, {\n cache: cache ? \"default\" : \"reload\",\n });\n data = await response.json();\n } catch (error) {\n console.error(`Error fetching url /api${fullUrl}`, error);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error,\n version: previousState?.version,\n }),\n );\n return;\n }\n\n if (response!.ok) {\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: Date.now(),\n }),\n );\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, Date.now());\n } else {\n // this.lastFetchRecord.set(variantKey, 0);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error: data,\n version: previousState?.version,\n }),\n );\n }\n }\n}\n","import {\n createContext,\n type PropsWithChildren,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { QueryResource } from \"./QueryResource\";\n\nexport type PrefetchedData = Record<string, Record<string, any>>;\n\nexport interface QueryManagerContextValue {\n getResource: (\n key: string,\n initialState?: Record<string, any>,\n ) => QueryResource;\n hydrate: (prefetchedData?: PrefetchedData | null) => void;\n}\n\nexport const QueryManagerContext = createContext<QueryManagerContextValue>({\n getResource: (key: string, initialState: Record<string, any> = {}) => {\n return new QueryResource(key, initialState);\n },\n hydrate: () => {},\n});\n\nexport const QueryManagerProvider = ({ children }: PropsWithChildren<{}>) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n\n const getResource = useCallback(\n (key: string, initialState?: Record<string, any>) => {\n let resource = resourcesRef.current.get(key);\n if (!resource) {\n resource = new QueryResource(key, initialState ?? {});\n resourcesRef.current.set(key, resource);\n }\n return resource;\n },\n [],\n );\n\n // Resources are cached by path for the lifetime of the app, so `initialState`\n // above only ever applies to the first load. Every navigation ships a fresh\n // `prefetchedData` payload that has to be pushed into the existing resources,\n // otherwise the components mounting on the new surface refetch it over `/api`.\n const hydrate = useCallback((prefetchedData?: PrefetchedData | null) => {\n if (!prefetchedData) return;\n for (const [key, initialState] of Object.entries(prefetchedData)) {\n if (!initialState || typeof initialState !== \"object\") continue;\n const resource = resourcesRef.current.get(key);\n if (resource) {\n resource.hydrate(initialState);\n } else {\n resourcesRef.current.set(key, new QueryResource(key, initialState));\n }\n }\n }, []);\n\n const value = useMemo(\n () => ({ getResource, hydrate }),\n [getResource, hydrate],\n );\n\n return (\n <QueryManagerContext.Provider value={value}>\n {children}\n </QueryManagerContext.Provider>\n );\n};\n","export function applyParams<T extends string>(\n url: T,\n params: Record<string, string | number | undefined>,\n): string {\n return (\n url\n .replace(/:([^/]+[*?]?)/g, (_, key) => {\n const hasSuffix = key.endsWith(\"?\") || key.endsWith(\"*\");\n const paramName = hasSuffix ? key.slice(0, -1) : key;\n const value = params[paramName];\n\n if (value === undefined) {\n if (hasSuffix) {\n return \"\"; // Remove the optional segment if no value is provided\n }\n // @ts-ignore\n if (import.meta.env.DEV) {\n throw new Error(`Missing parameter: ${paramName}`);\n }\n console.error(`Missing parameter: ${paramName} in URL: ${url}`);\n }\n\n return String(value);\n })\n // remove double slashes\n .replace(/\\/\\//g, \"/\")\n // remove trailing slash\n .replace(/\\/$/, \"\")\n );\n}\n","export function omitNullishValues<T>(input: T) {\n return Object.fromEntries(\n Object.entries(input).filter(([, value]) => {\n return value !== null && value !== undefined;\n }),\n ) as T;\n}\n","import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n pathname: string;\n hash: string;\n action: Action | null;\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useRouteData() {\n const { data, i18n, prefetchedData, breadcrumbs } =\n useContext(RouteStateContext);\n\n return { data, i18n, prefetchedData, breadcrumbs };\n}\n","export function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n","import { useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { NestedPrettify } from \"../utils/type\";\n\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport { DEFAULT_STALE_TIME } from \"./QueryResource\";\nimport { applyParams } from \"../utils/applyParams\";\nimport type { UrlParser } from \"./types\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ninterface Config<T> {\n fallbackData?: T;\n keepPreviousData?: boolean;\n retryIntervalOnError?: number;\n refreshInterval?: number;\n /** How long cached data stays fresh before a read revalidates it, in ms. */\n staleTime?: number;\n debug?: boolean;\n lazy?: boolean;\n refetchUntil?: (data: T, duration: number) => number;\n}\n\ntype WithOptionalValues<T> = {\n [K in keyof T]: T[K] | null;\n};\n\nconst defaultConfig: Config<any> = {\n fallbackData: null,\n keepPreviousData: true,\n retryIntervalOnError: 10000,\n refreshInterval: 999999,\n staleTime: DEFAULT_STALE_TIME,\n debug: false,\n lazy: false,\n};\n\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<any, infer Data, any> ? UnwrapPromise<Data> : never;\n\ntype Input<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<infer I, any, any> ? I : never;\n\ntype QueryOptions<T extends keyof GetRPC> = {\n search?: Partial<WithOptionalValues<Input<T>>>;\n};\n\ntype Error = Record<string, unknown>;\n\nconst defaultOptions: QueryOptions<any> & { params?: Record<string, any> } = {\n params: {} as Record<string, string>,\n search: {} as Record<string, string>,\n};\n\nexport type QueryResult<T extends keyof GetRPC> = NestedPrettify<Data<T> & {}>;\n\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n ...args: [\n options?: {\n search?: Record<string, string | number | boolean | null>;\n params?: Partial<UrlParser<`${T & string}`>>;\n },\n config?: Config<Data<T>>,\n ]\n) {\n const _params = useParams();\n const [_options = defaultOptions, _config = defaultConfig] = args;\n const options = { ...defaultOptions, ..._options };\n const config = { ...defaultConfig, ..._config };\n const params = \"params\" in options ? { ..._params, ...options.params } : _params;\n const paramsKey = JSON.stringify(params);\n const paramsRef = useRef(paramsKey);\n const search = \"search\" in options ? (options.search ?? {}) : {};\n const { getResource } = useContext(QueryManagerContext);\n const normalPath = applyParams(url, params);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n const { prefetchedData } = useRouteData();\n const fallbackData = config.fallbackData ?? prefetchedData?.[normalPath] ?? null;\n const refreshInterval = config.refreshInterval;\n const lazy = config.lazy;\n const [resource, setResource] = useState(() => getResource(normalPath, fallbackData));\n\n const configRef = useRef(config);\n configRef.current = config;\n\n const refreshIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n const retryIntervalRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const retryingMap = useRef<Map<string, boolean>>(new Map());\n const fetchedRef = useRef(!lazy);\n const refetchUntilTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const refetchUntilDurationRef = useRef(0);\n const prefetchedRef = useRef(false);\n const [state, setState] = useState(() => {\n if (lazy) {\n return { loading: false, data: null, error: null, version: 0 };\n }\n // Seed from the cache without touching the network — the mount effect below\n // calls `getVariant`, which is what fetches and revalidates. Fetching here\n // instead would fire a request for renders React discards: a layout renders\n // once per suspending descendant, and each attempt gets fresh hook state,\n // including a fresh `QueryResource`, so the in-flight guard cannot dedupe\n // them.\n return (\n resource.peek(variantKey) ?? {\n loading: true,\n data: null,\n error: null,\n version: 0,\n }\n );\n });\n\n const retry = useCallback(\n (vk: string) => {\n if (!retryingMap.current.get(vk)) {\n if (configRef.current.debug) console.log(\"retrying\", vk);\n retryingMap.current.set(vk, true);\n retryIntervalRef.current = setTimeout(() => {\n resource.getVariant(vk, configRef.current.staleTime);\n retryingMap.current.set(vk, false);\n }, configRef.current.retryIntervalOnError);\n }\n },\n [resource],\n );\n\n useEffect(() => {\n if (paramsKey !== paramsRef.current) {\n // Pass `fallbackData` so a params change into a route the server already\n // prefetched is served from the payload instead of a fresh request, and\n // read the variant off the *next* resource — `resource` still points at\n // the previous params' resource until React applies `setResource`.\n const nextResource = getResource(normalPath, fallbackData);\n setResource(nextResource);\n if (fetchedRef.current) {\n setState(\n nextResource.getVariant(variantKey, configRef.current.staleTime),\n );\n }\n paramsRef.current = paramsKey;\n }\n }, [paramsKey, normalPath, variantKey, getResource, fallbackData]);\n\n const handleReload = useCallback(() => {\n if (configRef.current.debug) {\n console.log(\"Reloading query for\", variantKey);\n }\n const data = resource.getVariant(\n variantKey,\n configRef.current.staleTime,\n ).data;\n resource.mutate(variantKey, () => data);\n }, [variantKey, resource]);\n\n useEffect(() => {\n if (!fetchedRef.current) return;\n refreshIntervalRef.current = setInterval(() => {\n handleReload();\n }, refreshInterval);\n\n return () => {\n if (refreshIntervalRef.current) {\n clearInterval(refreshIntervalRef.current);\n }\n };\n }, [refreshInterval, handleReload]);\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n const handleStateUpdate = useCallback(\n (nextState: ReturnType<typeof resource.getVariant>) => {\n const cfg = configRef.current;\n if (cfg.debug) {\n console.log(\"state updating due to url update\", variantKey);\n console.log(nextState);\n }\n if (nextState.error) {\n retry(variantKey);\n }\n if (cfg.keepPreviousData) {\n if (nextState.loading) {\n setState((s) => ({ ...s, loading: true }));\n } else {\n setState(nextState);\n }\n } else {\n setState(nextState);\n }\n\n if (cfg.refetchUntil && !nextState.loading && nextState.data && !nextState.error) {\n const nextDuration = cfg.refetchUntil(nextState.data, refetchUntilDurationRef.current);\n if (nextDuration > 0) {\n refetchUntilDurationRef.current = nextDuration;\n refetchUntilTimerRef.current = setTimeout(() => {\n resource.refetch(variantKey);\n }, nextDuration);\n } else {\n refetchUntilDurationRef.current = 0;\n }\n }\n },\n [variantKey, retry, resource],\n );\n\n useEffect(() => {\n if (fetchedRef.current) {\n handleStateUpdate(\n resource.getVariant(variantKey, configRef.current.staleTime),\n );\n }\n const unsub = resource.store.subscribe((store) => {\n const variant = store.get(variantKey);\n if (variant) {\n handleStateUpdate(variant);\n }\n });\n return () => {\n unsub();\n clearTimeout(retryIntervalRef.current);\n if (refetchUntilTimerRef.current) {\n clearTimeout(refetchUntilTimerRef.current);\n }\n };\n }, [variantKey, resource, handleStateUpdate]);\n\n const trigger = useCallback(() => {\n fetchedRef.current = true;\n const store = resource.store.getValue();\n const variant = store.get(variantKey);\n if (!variant || (!variant.loading && !variant.data)) {\n resource.refetch(variantKey);\n }\n }, [resource, variantKey]);\n\n const prefetch = useCallback(() => {\n if (prefetchedRef.current) return;\n prefetchedRef.current = true;\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n const refetch = useCallback(() => {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n function mutate(fn?: NestedPrettify<Data<T>>): void;\n function mutate(fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>): void;\n function mutate(fn?: any) {\n if (!fn) {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n return;\n }\n return resource.mutate(variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches so a stray value can't corrupt the\n // cache; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\"Mutate function must return an array when the current data is an array.\");\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\"Mutate function must return the same type as the current data.\");\n }\n\n return updatedData;\n });\n }\n\n return {\n data: state?.data as NestedPrettify<Data<T>>,\n loading: state?.loading ?? true,\n error: state?.error as Error,\n mutate,\n trigger,\n prefetch,\n version: state?.version as number,\n };\n}\n","import { useContext, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\n\ntype Methods = {\n POST: {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: RPC[K];\n };\n PUT: {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: RPC[K];\n };\n PATCH: {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: RPC[K];\n };\n DELETE: {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: RPC[K];\n };\n};\n\nfunction applyParams(url: string, params: Record<string, any> = {}) {\n let out = url;\n\n for (const [key, value] of Object.entries(params)) {\n out = out.replace(`:${key}?`, value).replace(`:${key}`, value);\n }\n return out;\n}\n\ntype Config<T> = {\n autoInvalidate?: boolean;\n onSuccess: (data: T) => void;\n onError: (error: MutationError) => void;\n onCanceled?: () => void;\n};\n\nconst defaultOptions: Config<any> = {\n autoInvalidate: false,\n onSuccess: () => {},\n onError: (_: MutationError) => {},\n onCanceled: () => {},\n};\n\ntype Data<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<any, infer T, any>\n ? UnwrapPromise<T>\n : never;\n\ntype Body<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<infer T, any, any> ? T : never;\n\ntype MutationError =\n | {\n kind: \"validation_error\";\n messages: Record<string, any>;\n }\n | {\n kind: \"form_error\";\n message: string;\n }\n | {\n kind: \"server_error\";\n message: string;\n }\n | {\n kind: \"not_authorized\";\n message: string;\n }\n | {\n kind: \"insufficient_permissions\";\n message: string;\n };\n\ntype ParseParams<T> = UrlParser<`${T & string}`>;\n\ntype State<T> = {\n data: T | null;\n error: MutationError | null;\n loading: boolean;\n};\n\nexport function useMutation<\n M extends keyof Methods,\n K extends keyof Methods[M],\n T = Data<M, K>,\n U = Body<M, K>,\n>(\n method: M,\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>>, search?: Record<string, string> },\n config?: Partial<Config<T>>,\n ]\n) {\n const _params = useParams();\n const [state, setState] = useState<State<T>>({\n data: null,\n error: null,\n loading: false,\n });\n\n const [abortController, setAbortController] = useState(\n () => new AbortController(),\n );\n\n const formData = useRef(new FormData());\n\n async function trigger(input?: U): Promise<T> {\n setState({\n data: state.data,\n error: state.error,\n loading: true,\n });\n const [inputs = {}, options = defaultOptions] = args ?? [];\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const search = \"search\" in inputs ? inputs.search : {};\n const searchParams = new URLSearchParams(search);\n const finalUrl = [applyParams(String(url).replace(`${method}:`, \"\"), params), searchParams.toString()].filter(Boolean).join(\"?\");\n\n let body = null;\n\n const contentType =\n typeof input === \"undefined\" || input instanceof FormData\n ? {}\n : { \"Content-Type\": \"application/json\" };\n\n if (input instanceof FormData) {\n body = input;\n } else if (typeof input === \"undefined\") {\n body = formData.current;\n } else if (input) {\n body = JSON.stringify(input);\n }\n\n try {\n const response = await fetch(`/api${finalUrl}`, {\n method,\n headers: {\n ...contentType,\n },\n ...(body ? { body } : {}),\n signal: abortController.signal,\n });\n\n formData.current = new FormData();\n\n const data = await response.json();\n\n if (!response.ok) {\n setState({\n data: null,\n error: data.error,\n loading: false,\n });\n\n options?.onError?.(data);\n return;\n }\n\n options.onSuccess(data);\n\n setState({\n data,\n error: null,\n loading: false,\n });\n\n return data as any;\n } catch (error) {\n formData.current = new FormData();\n options?.onError?.(error);\n setState({\n data: null,\n error,\n loading: false,\n });\n }\n }\n\n trigger.formData = (formData: FormData) => {\n return trigger(formData as U);\n };\n\n return {\n data: state.data as T,\n error: state.error as any,\n loading: state.loading,\n formData: formData.current,\n cancel: () => {\n const [, options = defaultOptions] = args ?? [];\n abortController.abort();\n setAbortController(new AbortController());\n setState({\n data: state.data,\n error: state.error,\n loading: false,\n });\n\n formData.current = new FormData();\n options.onCanceled();\n },\n trigger,\n };\n}\n\nexport function usePost<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"POST\", url, ...(args as any));\n}\n\nexport function usePut<K extends keyof Methods[\"PUT\"], T = Data<\"PUT\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PUT\", url, ...(args as any));\n}\n\nexport function usePatch<\n K extends keyof Methods[\"PATCH\"],\n T = Data<\"PATCH\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PATCH\", url, ...(args as any));\n}\n\nexport function useDelete<\n K extends keyof Methods[\"DELETE\"],\n T = Data<\"DELETE\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"DELETE\", url, ...(args as any));\n}\n\nexport function useUpload<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n const [state, setState] = useState<\"idle\" | \"uploading\" | \"done\" | \"error\">(\n \"idle\",\n );\n const [progress, setProgress] = useState(0);\n const _params = useParams();\n const abortRef = useRef<VoidFunction | null>(null);\n\n const [inputs = {}, options = defaultOptions] = args ?? [];\n\n const cancel = () => {\n if (abortRef.current) {\n abortRef.current();\n options.onCanceled?.();\n setState(\"idle\");\n setProgress(0);\n }\n };\n\n const trigger = async (fileList: FileList | null | File): Promise<T> => {\n if (!fileList) {\n return;\n }\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const finalUrl = applyParams(String(url).replace(\"POST:\", \"\"), params);\n\n const method = \"POST\";\n const action = `/api${finalUrl}`;\n const data = new FormData();\n if (fileList instanceof FileList) {\n for (const file of Array.from(fileList)) {\n data.append(\"file\", file);\n }\n } else {\n data.append(\"file\", fileList);\n }\n const xhr = new XMLHttpRequest();\n abortRef.current = () => {\n xhr.abort();\n };\n\n try {\n const result = await new Promise<Response>((resolve, reject) => {\n xhr.responseType = \"blob\";\n xhr.onreadystatechange = async () => {\n if (xhr.readyState !== 4) {\n // done\n return;\n }\n\n const response = new Response(xhr.response, {\n status: xhr.status,\n statusText: xhr.statusText,\n });\n\n resolve(response);\n };\n\n xhr.addEventListener(\"error\", () => {\n reject(new TypeError(\"Failed to fetch\"));\n });\n\n xhr.upload.addEventListener(\"loadstart\", () => {\n setProgress(0);\n });\n xhr.upload.addEventListener(\"loadend\", () => {\n setProgress(1);\n });\n\n xhr.upload.addEventListener(\"progress\", (event) => {\n setProgress(event.loaded / event.total);\n });\n\n xhr.open(method, action, true);\n xhr.send(data);\n });\n setState(\"uploading\");\n if (!result.ok) {\n let error: MutationError = {\n kind: \"server_error\",\n message: result.statusText,\n };\n try {\n const data = await result.json();\n error = data.error;\n } catch (e) {\n // do nothing\n }\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n const json = await result.json();\n options?.onSuccess?.(json);\n return json;\n } catch (error) {\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n };\n\n return {\n state,\n progress,\n trigger,\n cancel,\n };\n}\n","import { useContext } from \"react\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { NestedPrettify, UnwrapPromise } from \"../utils/type\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nimport type { RPC } from \"./rpc\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport type { UrlParser } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> = GetRPC[T] extends ApiRouterHandler<\n any,\n infer Data,\n any\n>\n ? UnwrapPromise<Data>\n : never;\n\nexport function useMutate() {\n const { getResource } = useContext(QueryManagerContext);\n return function mutate<T extends keyof GetRPC>(\n options: {\n path: T;\n params?: UrlParser<`${T & string}`>;\n search?: Record<string, any>;\n },\n fn?:\n | ((data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>)\n | NestedPrettify<Data<T>>,\n ) {\n const { path, params = {}, search = {} } = options ?? {};\n const normalPath = applyParams(path, params);\n const resource = getResource(normalPath);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n return resource.mutate.call(resource, variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n if (!fn) {\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n };\n}\n","import { createContext, type PropsWithChildren } from \"react\";\nimport type { Translations } from \"./I18nContext\";\nimport type { ComponentTree } from \"./types\";\nimport type { User } from \"../auth/adapters/types\";\n\ntype Data = Record<string, any>;\n\nexport interface ServerDataContextValue {\n routeManifest: Record<string, string[]>;\n pageData: Record<string, Record<string, Data>>;\n breadcrumbs: Record<string, { label: string; href: string }>;\n prefetchedData: Record<string, Data>;\n router: {\n pathname: string;\n params: Record<string, any>;\n currentPath: string;\n is404: boolean;\n searchParams: string;\n urlLocaleSegment: string | null;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n defaultLocale: string;\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n __csrf: string;\n cssManifest: Record<string, string[]>;\n meta: any;\n appId: string;\n}\n\nexport const ServerDataContext = createContext({} as ServerDataContextValue);\n\ninterface ServerDataProviderProps {\n value?: ServerDataContextValue;\n}\n\nexport const ServerDataProvider = (\n props: PropsWithChildren<ServerDataProviderProps>,\n) => {\n let _value = props.value;\n // Server\n if (props.value) {\n _value = props.value;\n } else {\n // Client\n _value = (window as any).__GEMI_DATA__;\n }\n\n return (\n <ServerDataContext.Provider value={_value}>\n {props.children}\n </ServerDataContext.Provider>\n );\n};\n","import {\n createContext,\n useContext,\n type ComponentProps,\n type FormEvent,\n useRef,\n useEffect,\n useSyncExternalStore,\n useCallback,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport { useMutation } from \"./useMutation\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { Subject } from \"../utils/Subject\";\n\ntype Any = any;\n\ninterface MutationContextValue {\n isPending: boolean;\n result: null | Any;\n validationErrors: Record<string, string[]>;\n formError: null | string;\n formDataSubject: React.RefObject<Subject<FormData>>;\n}\n\nconst MutationContext = createContext({\n isPending: false,\n result: null,\n} as MutationContextValue);\n\ntype GetResult<T> =\n T extends ApiRouterHandler<Any, infer Result, Any>\n ? UnwrapPromise<Result>\n : never;\n\ntype PostRequests = {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PutRequests = {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: GetResult<RPC[K]>;\n};\n\ntype DeleteRequests = {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PatchRequests = {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype Methods = {\n POST: PostRequests;\n PUT: PutRequests;\n DELETE: DeleteRequests;\n PATCH: PatchRequests;\n};\n\ninterface FormProps<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> extends Omit<ComponentProps<\"form\">, \"action\" | \"onError\"> {\n method?: M;\n action: K;\n onSuccess?: (result: Methods[M][K], form: HTMLFormElement) => void;\n onError?: (error: Any, form: HTMLFormElement) => void;\n params?: Partial<UrlParser<`${K & string}`>>;\n search?: Record<string, string>;\n dynamicInputs?: (formData: FormData) => Record<string, any>;\n}\n\nexport function Form<\n K extends keyof Methods[T],\n T extends keyof Methods = \"POST\",\n>(props: FormProps<T, K>) {\n const _params = useParams();\n const {\n method = \"POST\",\n action,\n onSuccess = () => {},\n onError = () => {},\n params,\n search = {},\n className,\n dynamicInputs = () => ({}),\n ...formProps\n } = \"params\" in props\n ? { ...props, params: { ..._params, ...props.params } }\n : { ...props, params: _params };\n const formRef = useRef<HTMLFormElement>(null);\n const { __csrf } = useContext(ServerDataContext);\n const formDataSubject = useRef(new Subject(new FormData()));\n\n const updateFormData = useCallback(() => {\n formDataSubject.current.next(new FormData(formRef.current));\n }, []);\n\n useEffect(() => {\n if (!formRef.current) return;\n\n formRef.current.addEventListener(\"input\", updateFormData);\n\n const observer = new MutationObserver(() => {\n const formData = new FormData(formRef.current);\n formDataSubject.current.next(formData);\n });\n\n formRef.current.querySelectorAll(\"input\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"select\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"textarea\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n return () => {\n observer.disconnect();\n if (formRef.current) {\n formRef.current.removeEventListener(\"input\", updateFormData);\n }\n };\n }, [updateFormData]);\n\n const { trigger, data, error, loading } = useMutation(\n method,\n String(action) as Any,\n {\n params,\n search,\n } as Any,\n {\n onSuccess: (data) => onSuccess(data as Any, formRef.current),\n onError: (error) => onError(error, formRef.current),\n },\n );\n\n const handleSubmit = async (e: FormEvent) => {\n if (loading) {\n return;\n }\n e.preventDefault();\n if (!formRef.current) {\n return;\n }\n const formData = new FormData(formRef.current);\n for (const [key, value] of Object.entries(dynamicInputs(formData))) {\n formData.append(key, value as any);\n }\n trigger(formData as any);\n };\n\n const validationErrors =\n error?.kind === \"validation_error\" ? error.messages : {};\n\n const formError = error?.kind === \"form_error\" ? error.message : null;\n\n return (\n <MutationContext.Provider\n value={{\n isPending: loading,\n result: data,\n validationErrors,\n formError,\n formDataSubject,\n }}\n >\n <form\n className={[\"group\", className].filter(Boolean).join(\" \")}\n data-loading={loading}\n ref={formRef}\n onSubmit={handleSubmit}\n {...formProps}\n >\n <input type=\"hidden\" name=\"__csrf\" value={__csrf} />\n {props.children}\n </form>\n </MutationContext.Provider>\n );\n}\n\nexport function useMutationStatus() {\n const { isPending } = useContext(MutationContext);\n\n return { isPending };\n}\n\nexport function useFormStatus() {\n const { isPending, validationErrors, formError } =\n useContext(MutationContext);\n\n return { isPending, validationErrors, formError };\n}\n\nexport function useFormData() {\n const context = useContext(MutationContext);\n\n const { formDataSubject } = context;\n\n return useSyncExternalStore(\n formDataSubject.current.subscribe.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n );\n}\n\nexport const ValidationErrors = (props: {\n name: string;\n className?: string;\n render?: (props: ComponentProps<\"div\">) => React.JSX.Element;\n}) => {\n const {\n render = (props: ComponentProps<\"div\">) => <div {...props} />,\n name,\n } = props;\n const { validationErrors } = useContext(MutationContext);\n\n const Comp = render;\n\n if (validationErrors[name]?.length > 0) {\n return (\n <>\n {validationErrors[name].map((error) => {\n return (\n <Comp className={props.className} key={error}>\n {error}\n </Comp>\n );\n })}\n </>\n );\n }\n\n return null;\n};\n\nexport const FormFieldContainer = (\n props: ComponentProps<\"div\"> & { name: string },\n) => {\n const { name, children, ...rest } = props;\n const { validationErrors } = useContext(MutationContext);\n const errors = validationErrors[name] || [];\n return (\n <div data-has-error={errors.length > 0} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const FormError = (props: ComponentProps<\"div\">) => {\n const { formError } = useContext(MutationContext);\n\n if (formError) {\n return <div {...props}>{formError}</div>;\n }\n\n return null;\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useLocation() {\n const ctx = useContext(RouteStateContext);\n if (!ctx) {\n throw new Error(\"Router context not found\");\n }\n const { hash, pathname, search, state, locale } = ctx;\n return {\n hash,\n key: pathname,\n pathname,\n search,\n state,\n locale,\n };\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","var Pe=Object.defineProperty;var a=(e,t)=>Pe(e,\"name\",{value:t,configurable:!0});var P=class{type=3;name=\"\";prefix=\"\";value=\"\";suffix=\"\";modifier=3;constructor(t,r,n,c,l,f){this.type=t,this.name=r,this.prefix=n,this.value=c,this.suffix=l,this.modifier=f}hasCustomName(){return this.name!==\"\"&&typeof this.name!=\"number\"}};a(P,\"Part\");var Re=/[$_\\p{ID_Start}]/u,Ee=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,v=\".*\";function Oe(e,t){return(t?/^[\\x00-\\xFF]*$/:/^[\\x00-\\x7F]*$/).test(e)}a(Oe,\"isASCII\");function D(e,t=!1){let r=[],n=0;for(;n<e.length;){let c=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:\"INVALID_CHAR\",index:n,value:e[n++]})},\"ErrorOrInvalid\");if(c===\"*\"){r.push({type:\"ASTERISK\",index:n,value:e[n++]});continue}if(c===\"+\"||c===\"?\"){r.push({type:\"OTHER_MODIFIER\",index:n,value:e[n++]});continue}if(c===\"\\\\\"){r.push({type:\"ESCAPED_CHAR\",index:n++,value:e[n++]});continue}if(c===\"{\"){r.push({type:\"OPEN\",index:n,value:e[n++]});continue}if(c===\"}\"){r.push({type:\"CLOSE\",index:n,value:e[n++]});continue}if(c===\":\"){let f=\"\",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&Re.test(i)||s!==n+1&&Ee.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:\"NAME\",index:n,value:f}),n=s;continue}if(c===\"(\"){let f=1,s=\"\",i=n+1,o=!1;if(e[i]===\"?\"){l(`Pattern cannot start with \"?\" at ${i}`);continue}for(;i<e.length;){if(!Oe(e[i],!1)){l(`Invalid character '${e[i]}' at ${i}.`),o=!0;break}if(e[i]===\"\\\\\"){s+=e[i++]+e[i++];continue}if(e[i]===\")\"){if(f--,f===0){i++;break}}else if(e[i]===\"(\"&&(f++,e[i+1]!==\"?\")){l(`Capturing groups are not allowed at ${i}`),o=!0;break}s+=e[i++]}if(o)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:\"REGEX\",index:n,value:s}),n=i;continue}r.push({type:\"CHAR\",index:n,value:e[n++]})}return r.push({type:\"END\",index:n,value:\"\"}),r}a(D,\"lexer\");function F(e,t={}){let r=D(e);t.delimiter??=\"/#?\",t.prefixes??=\"./\";let n=`[^${x(t.delimiter)}]+?`,c=[],l=0,f=0,s=\"\",i=new Set,o=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},\"tryConsume\"),h=a(()=>o(\"OTHER_MODIFIER\")??o(\"ASTERISK\"),\"tryConsumeModifier\"),p=a(u=>{let d=o(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},\"mustConsume\"),A=a(()=>{let u=\"\",d;for(;d=o(\"CHAR\")??o(\"ESCAPED_CHAR\");)u+=d;return u},\"consumeText\"),xe=a(u=>u,\"DefaultEncodePart\"),N=t.encodePart||xe,H=\"\",$=a(u=>{H+=u},\"appendToPendingFixedValue\"),M=a(()=>{H.length&&(c.push(new P(3,\"\",\"\",N(H),\"\",3)),H=\"\")},\"maybeAddPartFromPendingFixedValue\"),X=a((u,d,g,y,Z)=>{let m=3;switch(Z){case\"?\":m=1;break;case\"*\":m=0;break;case\"+\":m=2;break}if(!d&&!g&&m===3){$(u);return}if(M(),!d&&!g){if(!u)return;c.push(new P(3,\"\",\"\",N(u),\"\",m));return}let S;g?g===\"*\"?S=v:S=g:S=n;let k=2;S===n?(k=1,S=\"\"):S===v&&(k=0,S=\"\");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),c.push(new P(k,E,N(u),S,N(y),m))},\"addPart\");for(;f<r.length;){let u=o(\"CHAR\"),d=o(\"NAME\"),g=o(\"REGEX\");if(!d&&!g&&(g=o(\"ASTERISK\")),d||g){let m=u??\"\";t.prefixes.indexOf(m)===-1&&($(m),m=\"\"),M();let S=h();X(m,d,g,\"\",S);continue}let y=u??o(\"ESCAPED_CHAR\");if(y){$(y);continue}if(o(\"OPEN\")){let m=A(),S=o(\"NAME\"),k=o(\"REGEX\");!S&&!k&&(k=o(\"ASTERISK\"));let E=A();p(\"CLOSE\");let be=h();X(m,S,k,E,be);continue}M(),p(\"END\")}return c}a(F,\"parse\");function x(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(x,\"escapeString\");function B(e){return e&&e.ignoreCase?\"ui\":\"u\"}a(B,\"flags\");function q(e,t,r){return W(F(e,r),t,r)}a(q,\"stringToRegexp\");function T(e){switch(e){case 0:return\"*\";case 1:return\"?\";case 2:return\"+\";case 3:return\"\"}}a(T,\"modifierToString\");function W(e,t,r={}){r.delimiter??=\"/#?\",r.prefixes??=\"./\",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith=\"\";let n=r.start?\"^\":\"\";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,o=s.value;if(s.type===1?o=i:s.type===0&&(o=v),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${o})${T(s.modifier)}`:n+=`((?:${o})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${o})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${o})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${o}))*)${x(s.suffix)})`,s.modifier===0&&(n+=\"?\")}let c=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${c})`:n+=\"$\",new RegExp(n,B(r));r.strict||(n+=`(?:${l}(?=${c}))?`);let f=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1)}return f||(n+=`(?=${l}|${c})`),new RegExp(n,B(r))}a(W,\"partsToRegexp\");var b={delimiter:\"\",prefixes:\"\",sensitive:!0,strict:!0},J={delimiter:\".\",prefixes:\"\",sensitive:!0,strict:!0},Q={delimiter:\"/\",prefixes:\"/\",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]===\"/\"?!0:!t||e.length<2?!1:(e[0]==\"\\\\\"||e[0]==\"{\")&&e[1]==\"/\":!1}a(ee,\"isAbsolutePathname\");function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(te,\"maybeStripPrefix\");function ke(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(ke,\"maybeStripSuffix\");function _(e){return!e||e.length<2?!1:e[0]===\"[\"||(e[0]===\"\\\\\"||e[0]===\"{\")&&e[1]===\"[\"}a(_,\"treatAsIPv6Hostname\");var re=[\"ftp\",\"file\",\"http\",\"https\",\"ws\",\"wss\"];function U(e){if(!e)return!0;for(let t of re)if(e.test(t))return!0;return!1}a(U,\"isSpecialScheme\");function ne(e,t){if(e=te(e,\"#\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):\"\"}a(ne,\"canonicalizeHash\");function se(e,t){if(e=te(e,\"?\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.search=e,r.search?r.search.substring(1,r.search.length):\"\"}a(se,\"canonicalizeSearch\");function ie(e,t){return t||e===\"\"?e:_(e)?K(e):j(e)}a(ie,\"canonicalizeHostname\");function ae(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.password=e,r.password}a(ae,\"canonicalizePassword\");function oe(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.username=e,r.username}a(oe,\"canonicalizeUsername\");function ce(e,t,r){if(r||e===\"\")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]==\"/\";return e=new URL(n?e:\"/-\"+e,\"https://example.com\").pathname,n||(e=e.substring(2,e.length)),e}a(ce,\"canonicalizePathname\");function le(e,t,r){return z(t)===e&&(e=\"\"),r||e===\"\"?e:G(e)}a(le,\"canonicalizePort\");function fe(e,t){return e=ke(e,\":\"),t||e===\"\"?e:w(e)}a(fe,\"canonicalizeProtocol\");function z(e){switch(e){case\"ws\":case\"http\":return\"80\";case\"wws\":case\"https\":return\"443\";case\"ftp\":return\"21\";default:return\"\"}}a(z,\"defaultPortForProtocol\");function w(e){if(e===\"\")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,\"protocolEncodeCallback\");function he(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.username=e,t.username}a(he,\"usernameEncodeCallback\");function ue(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.password=e,t.password}a(ue,\"passwordEncodeCallback\");function j(e){if(e===\"\")return e;if(/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL(\"https://example.com\");return t.hostname=e,t.hostname}a(j,\"hostnameEncodeCallback\");function K(e){if(e===\"\")return e;if(/[^0-9a-fA-F[\\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(K,\"ipv6HostnameEncodeCallback\");function G(e){if(e===\"\"||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(G,\"portEncodeCallback\");function de(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.pathname=e[0]!==\"/\"?\"/-\"+e:e,e[0]!==\"/\"?t.pathname.substring(2,t.pathname.length):t.pathname}a(de,\"standardURLPathnameEncodeCallback\");function pe(e){return e===\"\"?e:new URL(`data:${e}`).pathname}a(pe,\"pathURLPathnameEncodeCallback\");function ge(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.search=e,t.search.substring(1,t.search.length)}a(ge,\"searchEncodeCallback\");function me(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.hash=e,t.hash.substring(1,t.hash.length)}a(me,\"hashEncodeCallback\");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type===\"END\"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r)}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port=\"\")}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;case 10:break}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=\"\"),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?\"/\":\"\"),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??=\"\")),this.#R(t,r)}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0}#b(){this.#e=this.#l,this.#s=0}#u(t){this.#b(),this.#o=t}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type===\"CHAR\"||n.type===\"ESCAPED_CHAR\"||n.type===\"INVALID_CHAR\")}#P(){return this.#a(this.#e,\":\")}#E(){return this.#a(this.#e+1,\"/\")&&this.#a(this.#e+2,\"/\")}#S(){return this.#a(this.#e,\"@\")}#O(){return this.#a(this.#e,\":\")}#k(){return this.#a(this.#e,\":\")}#x(){return this.#a(this.#e,\"/\")}#h(){if(this.#a(this.#e,\"?\"))return!0;if(this.#n[this.#e].value!==\"?\")return!1;let t=this.#m(this.#e-1);return t.type!==\"NAME\"&&t.type!==\"REGEX\"&&t.type!==\"CLOSE\"&&t.type!==\"ASTERISK\"}#f(){return this.#a(this.#e,\"#\")}#T(){return this.#n[this.#e].type==\"OPEN\"}#A(){return this.#n[this.#e].type==\"CLOSE\"}#y(){return this.#a(this.#e,\"[\")}#w(){return this.#a(this.#e,\"]\")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=q(this.#c(),void 0,t);this.#g=U(r)}};a(C,\"Parser\");var V=[\"protocol\",\"username\",\"password\",\"hostname\",\"port\",\"pathname\",\"search\",\"hash\"],O=\"*\";function Se(e,t){if(typeof e!=\"string\")throw new TypeError(\"parameter 1 is not of type 'string'.\");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==\"\"?r.search.substring(1,r.search.length):void 0,hash:r.hash!==\"\"?r.hash.substring(1,r.hash.length):void 0}}a(Se,\"extractValues\");function R(e,t){return t?I(e):e}a(R,\"processBaseURLString\");function L(e,t,r){let n;if(typeof t.baseURL==\"string\")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==\"string\"&&(e.protocol=fe(t.protocol,r)),typeof t.username==\"string\"&&(e.username=oe(t.username,r)),typeof t.password==\"string\"&&(e.password=ae(t.password,r)),typeof t.hostname==\"string\"&&(e.hostname=ie(t.hostname,r)),typeof t.port==\"string\"&&(e.port=le(t.port,e.protocol,r)),typeof t.pathname==\"string\"){if(e.pathname=t.pathname,n&&!ee(e.pathname,r)){let c=n.pathname.lastIndexOf(\"/\");c>=0&&(e.pathname=R(n.pathname.substring(0,c+1),r)+e.pathname)}e.pathname=ce(e.pathname,e.protocol,r)}return typeof t.search==\"string\"&&(e.search=se(t.search,r)),typeof t.hash==\"string\"&&(e.hash=ne(t.hash,r)),e}a(L,\"applyInit\");function I(e){return e.replace(/([+*?:{}()\\\\])/g,\"\\\\$1\")}a(I,\"escapePatternString\");function Te(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(Te,\"escapeRegexpString\");function Ae(e,t){t.delimiter??=\"/#?\",t.prefixes??=\"./\",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=\"\";let r=\".*\",n=`[^${Te(t.delimiter)}]+?`,c=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,l=\"\";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),o=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!o&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:\"\";o=c.test(A)}else o=!p.hasCustomName();if(!o&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];o=t.prefixes.includes(A)}o&&(l+=\"{\"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||o||s.prefix!==\"\")?l+=\"*\":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&c.test(s.suffix[0])&&(l+=\"\\\\\"),l+=I(s.suffix),o&&(l+=\"}\"),s.modifier!==3&&(l+=T(s.modifier))}return l}a(Ae,\"partsToPattern\");var Y=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let c;if(typeof r==\"string\"?c=r:n=r,typeof t==\"string\"){let i=new C(t);if(i.parse(),t=i.result,c===void 0&&typeof t.protocol!=\"string\")throw new TypeError(\"A base URL must be provided for a relative constructor string.\");t.baseURL=c}else{if(!t||typeof t!=\"object\")throw new TypeError(\"parameter 1 is not of type 'string' and cannot convert to dictionary.\");if(c)throw new TypeError(\"parameter 1 is not of type 'string'.\")}typeof n>\"u\"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port=\"\");let s;for(s of V){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case\"protocol\":Object.assign(i,b),i.encodePart=w;break;case\"username\":Object.assign(i,b),i.encodePart=he;break;case\"password\":Object.assign(i,b),i.encodePart=ue;break;case\"hostname\":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case\"port\":Object.assign(i,b),i.encodePart=G;break;case\"pathname\":U(this.#n.protocol)?(Object.assign(i,Q,l),i.encodePart=de):(Object.assign(i,b,l),i.encodePart=pe);break;case\"search\":Object.assign(i,b,l),i.encodePart=ge;break;case\"hash\":Object.assign(i,b,l),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ae(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2)}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(c){throw new TypeError(`Failed to construct 'URLPattern': ${c.message}`)}}get[Symbol.toStringTag](){return\"URLPattern\"}test(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return!1;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return!1}let c;for(c of V)if(!this.#n[c].exec(n[c]))return!1;return!0}exec(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return null}let c={};r?c.inputs=[t,r]:c.inputs=[t];let l;for(l of V){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,o]of this.#t[l].entries())if(typeof o==\"string\"||typeof o==\"number\"){let h=f[i+1];s[o]=h}c[l]={input:n[l]??\"\",groups:s}}return c}static compareComponent(t,r,n){let c=a((i,o)=>{for(let h of[\"type\",\"modifier\",\"prefix\",\"value\",\"suffix\"]){if(i[h]<o[h])return-1;if(i[h]===o[h])continue;return 1}return 0},\"comparePart\"),l=new P(3,\"\",\"\",\"\",\"\",3),f=new P(0,\"\",\"\",\"\",\"\",3),s=a((i,o)=>{let h=0;for(;h<Math.min(i.length,o.length);++h){let p=c(i[h],o[h]);if(p)return p}return i.length===o.length?0:c(i[h]??l,o[h]??l)},\"comparePartList\");return!r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(Y,\"URLPattern\");export{Y as URLPattern};\n","import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n","export function sleep(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n","import { Subject } from \"../utils/Subject\";\nimport { sleep } from \"../utils/sleep\";\n\nexport class ProgressManager {\n state = new Subject(100);\n unsubscribe: ReturnType<InstanceType<typeof Subject>[\"subscribe\"]>;\n timer: ReturnType<typeof setInterval>;\n tick = 0;\n isTicking = false;\n\n constructor(subject: Subject<boolean>) {\n this.unsubscribe = subject.subscribe((state) => {\n if (state) {\n this.start();\n } else {\n this.end();\n }\n });\n }\n\n getNextIncrement() {\n const current = this.state.getValue();\n if (current === 100) {\n return Math.ceil(Math.random() * 10);\n }\n\n if (current <= 20) {\n if (Math.ceil(Math.random() * 100) > 80) {\n return current;\n }\n return current + Math.ceil(Math.random() * 5) + 1;\n }\n\n if (current <= 50) {\n if (Math.ceil(Math.random() * 100) > 50) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 10), 70);\n }\n\n if (current <= 70) {\n if (Math.ceil(Math.random() * 100) > 60) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 3), 80);\n }\n\n if (current <= 80) {\n return Math.min(current + Math.ceil(Math.random() * 1), 90);\n }\n\n if (current <= 90) {\n const x = Math.ceil(Math.random() * 100) > 50 ? 0 : 1;\n return Math.min(current + x, 94);\n }\n\n if (current <= 94) {\n const x = Math.ceil(Math.random() * 100) > 20 ? 0 : 1;\n return Math.min(current + x, 99);\n }\n }\n\n getNextInterval() {\n if (this.tick === 0) {\n this.tick = 1;\n return 200;\n }\n const current = this.state.getValue();\n\n if (current >= 88) {\n return 400;\n }\n if (current >= 94) {\n return 1000;\n }\n if (current >= 98) {\n return 2000;\n }\n return 100;\n }\n\n async nextTick() {\n if (!this.isTicking) {\n return;\n }\n await sleep(this.getNextInterval());\n\n if (!this.isTicking) {\n return;\n }\n\n const increment = this.getNextIncrement();\n this.state.next(Math.min(increment, 96));\n\n await this.nextTick();\n }\n\n start() {\n this.isTicking = true;\n this.nextTick();\n }\n\n end() {\n this.state.next(99);\n this.isTicking = false;\n this.tick = 0;\n setTimeout(() => {\n this.state.next(100);\n }, 200);\n }\n\n destroy() {\n this.end();\n this.unsubscribe();\n }\n}\n","import { useContext } from \"react\";\nimport type { ViewPaths } from \"./types\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\ntype Pathname = ViewPaths;\n\nexport function useRoute() {\n const { pathname: _pathname } = useContext(RouteStateContext);\n return {\n pathname: _pathname,\n startsWith: (pathname: Pathname) => {\n return _pathname.startsWith(pathname);\n },\n };\n}\n","import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useSearchParams } from \"./useSearchParams\";\nimport { useRoute } from \"./useRoute\";\nimport { useParams } from \"./useParams\";\nimport { createPortal } from \"react-dom\";\n\nexport const HttpReload = () => {\n const { replace } = useNavigate();\n const searchParams = useSearchParams();\n const { pathname } = useRoute();\n const params = useParams();\n const [reloading, setReloading] = useState(false);\n\n const handleReload = () => {\n // The server recovered, so dismiss any Vite error overlay left on the page\n // (each element exposes a `close()` that also tears down its listeners).\n if (typeof document !== \"undefined\") {\n document.querySelectorAll(\"vite-error-overlay\").forEach((el: any) => {\n if (typeof el.close === \"function\") el.close();\n else el.remove();\n });\n }\n setReloading(true);\n // replace(pathname, {\n // params: params,\n // search: searchParams.toJSON(),\n // } as any)\n // .catch(console.log)\n // .finally(() => {\n // setReloading(false);\n // });\n };\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n if (!reloading || typeof document === \"undefined\") {\n return null;\n }\n return createPortal(\n <div className=\"fixed z-[1000] bottom-0 right-0 p-2\">\n <div className=\"p-2 bg-white text-black rounded-md shadow-md\">...</div>\n </div>,\n document.body,\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\ntype TranslationScope = Record<string, string>;\ntype TranslationScopes = Record<string, TranslationScope>;\nexport type Translations = Record<string, TranslationScopes>;\n\ninterface I18nContextValue {\n locale: string;\n changeLocale: (locale: string) => void;\n updateDictionary: (\n translations: Record<string, Record<string, Record<string, string>>>,\n locale?: string,\n ) => void;\n fetchTranslations: (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => Promise<void>;\n getComponentTranslations: (key: string) => Record<string, string>;\n supportedLocales: string[];\n defaultLocale: string;\n}\n\nexport type CreateI18nDictionary<T> = {\n [K in keyof T]: T[K];\n};\n\nexport const I18nContext = createContext({} as I18nContextValue);\n\nexport type Dictionary = Map<string, Map<string, Record<string, string>>>;\n\nexport const I18nProvider = (props: PropsWithChildren) => {\n const { i18n } = useContext(ServerDataContext);\n\n const [currentLocale, setCurrentLocale] = useState(i18n.currentLocale);\n\n const dictionary = useRef<Dictionary>(\n (() => {\n const dictionary = new Map();\n for (const [locale, value] of Object.entries(i18n?.dictionary ?? {})) {\n const components = new Map();\n for (const [component, translations] of Object.entries(value)) {\n components.set(component, translations);\n }\n dictionary.set(locale, components);\n }\n return dictionary;\n })(),\n );\n\n function updateDictionary(\n translations: Record<string, Record<string, Record<string, string>>> = {},\n locale?: string,\n ) {\n for (const [locale, value] of Object.entries(translations)) {\n if (!dictionary.current.has(locale)) {\n dictionary.current.set(locale, new Map());\n }\n const scopes = dictionary.current.get(locale);\n for (const [scope, translations] of Object.entries(value)) {\n if (!scopes.has(scope)) {\n scopes.set(scope, {});\n }\n scopes.set(scope, translations);\n }\n }\n changeLocale(locale);\n }\n\n const changeLocale = (locale: string) => {\n if (dictionary.current.has(locale)) {\n setCurrentLocale(locale);\n }\n };\n\n const getTranslations = (locale: string) => {\n return (component: string) => {\n return dictionary.current.get(locale).get(component);\n };\n };\n\n const fetchTranslations = async (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => {\n if (Object.keys(i18n).length === 0) {\n return;\n }\n const response = await fetch(\n `/api/__gemi__/services/i18n/translations/${\n locale || currentLocale\n }${pathname === \"/\" ? \"\" : pathname}`,\n {\n signal,\n },\n );\n const translations = await response.json();\n updateDictionary(translations);\n };\n\n return (\n <I18nContext.Provider\n value={{\n getComponentTranslations: getTranslations(currentLocale),\n locale: currentLocale,\n changeLocale,\n updateDictionary,\n fetchTranslations,\n supportedLocales: i18n.supportedLocales,\n defaultLocale: i18n.defaultLocale,\n }}\n >\n {props.children}\n </I18nContext.Provider>\n );\n};\n","import { type Action, type History, createBrowserHistory } from \"history\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n} from \"react\";\nimport { Subject } from \"../utils/Subject\";\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { ProgressManager } from \"./ProgressManager\";\nimport { HttpReload } from \"./HttpReload\";\nimport type { Breadcrumb } from \"./useBreadcrumbs\";\nimport type { RouteState } from \"./RouteStateContext\";\nimport { I18nContext } from \"./I18nContext\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n }\n}\n\ninterface ClientRouterContextValue {\n viewEntriesSubject: Subject<string[]>;\n history: History | null;\n updatePageData: (\n pageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => void;\n getPageData: (key: string, pathname: string) => Record<string, unknown>;\n getScrollPosition: (path: string) => number;\n getViewPathsFromPathname: (pathname: string) => string[];\n getRoutePathnameFromHref: (href: string) => string | null;\n isNavigatingSubject: Subject<boolean>;\n setNavigationAbortController: (controller: AbortController) => void;\n progressManager: ProgressManager;\n fetchRouteCSS: (routePath: string) => Promise<void>;\n breadcrumbsCache: Map<string, Breadcrumb>;\n routerSubject: Subject<RouteState>;\n urlLocaleSegment: string | null;\n}\n\nexport const ClientRouterContext = createContext(\n {} as ClientRouterContextValue,\n);\n\ninterface ClientRouterProviderProps {\n pathname: string;\n routeManifest: Record<string, string[]>;\n cssManifest: Record<string, string[]>;\n pageData: Record<string, unknown>;\n currentPath: string;\n urlLocaleSegment: string | null;\n params: Record<string, string>;\n searchParams: string;\n is404: boolean;\n is500: boolean;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\nexport const ClientRouterProvider = (\n props: PropsWithChildren<ClientRouterProviderProps>,\n) => {\n const {\n children,\n pathname,\n currentPath,\n is404,\n is500,\n routeManifest,\n cssManifest,\n pageData,\n params,\n searchParams,\n breadcrumbs,\n urlLocaleSegment,\n } = props;\n const navigationAbortControllerRef = useRef(new AbortController());\n const [isNavigatingSubject] = useState(() => {\n return new Subject<boolean>(false);\n });\n\n const { supportedLocales = [], locale } = useContext(I18nContext);\n\n const [progressManager] = useState(new ProgressManager(isNavigatingSubject));\n const pageDataRef = useRef(structuredClone(pageData));\n const scrollHistoryRef = useRef<Map<string, number>>(new Map());\n const breadcrumbsCache = useRef<Map<string, Breadcrumb>>(\n new Map(Object.entries(breadcrumbs)),\n );\n\n const initalViewEntries = is404\n ? [\"404\"]\n : is500\n ? [\"500\"]\n : (routeManifest[pathname] ?? [\"404\"]);\n const viewEntriesSubject = useRef(new Subject<string[]>(initalViewEntries));\n\n const [routerSubject] = useState(() => {\n return new Subject<RouteState>({\n views: initalViewEntries,\n params,\n search: searchParams,\n state: {},\n pathname,\n hash: \"\",\n action: null as Action | null,\n routePath: currentPath,\n locale,\n });\n });\n\n const [history] = useState<History | null>(() => {\n let history: History | null = null;\n\n if (typeof window !== \"undefined\") {\n history = createBrowserHistory();\n }\n return history;\n });\n\n const findMatchingRouteFromParams = useMemo(\n () => (pathname: string) => {\n let routePath = pathname.replace(\"/en-US\", \"\").replace(\"/tr-TR\", \"\");\n routePath = routePath === \"\" ? \"/\" : routePath;\n const candidates: string[] = [];\n for (const route of Object.keys(routeManifest)) {\n const urlPattern = new URLPattern({ pathname: route });\n if (urlPattern.test({ pathname: routePath })) {\n candidates.push(route);\n }\n }\n const sortedCandidates = candidates.sort((a, b) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n });\n\n return (sortedCandidates ?? [])[0];\n },\n [routeManifest],\n );\n\n const getViewPathsFromPathname = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n return routeManifest[route] ?? [];\n },\n [findMatchingRouteFromParams, routeManifest],\n );\n\n const getRoutePathnameFromHref = useMemo(\n () => (href: string) => {\n const route = findMatchingRouteFromParams(href);\n return route;\n },\n [findMatchingRouteFromParams],\n );\n\n const getParams = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n const urlPattern = new URLPattern({ pathname: route });\n return urlPattern.exec({ pathname })?.pathname.groups ?? {};\n },\n [findMatchingRouteFromParams],\n );\n\n useEffect(() => {\n history?.listen(({ location, action }) => {\n if (!window.scrollHistory) {\n window.scrollHistory = new Map();\n }\n const { hash, pathname, search } = routerSubject.getValue();\n const key = [pathname, search, hash].join(\"\");\n window.scrollHistory.set(key, window.scrollY);\n let _pathname = location.pathname;\n let _locale = null;\n for (const locale of supportedLocales) {\n if (_pathname.startsWith(`/${locale}`)) {\n _locale = locale;\n _pathname = _pathname.replace(`/${locale}`, \"\");\n break;\n }\n }\n _pathname = _pathname === \"\" ? \"/\" : _pathname;\n const routePath = getRoutePathnameFromHref(_pathname);\n routerSubject.next({\n views: getViewPathsFromPathname(_pathname),\n params: getParams(_pathname),\n search: location.search,\n state: location.state as Record<string, unknown>,\n pathname: _pathname,\n action,\n routePath,\n hash: location.hash,\n locale: _locale,\n });\n });\n }, [\n supportedLocales,\n history,\n routerSubject,\n getParams,\n getRoutePathnameFromHref,\n getViewPathsFromPathname,\n ]);\n\n const updatePageData = (\n newPageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => {\n const [key, value] = Object.entries(newPageData)[0];\n if (!pageDataRef.current?.[key]) {\n pageDataRef.current[key] = {};\n }\n for (const b in breadcrumbs) {\n breadcrumbsCache.current.set(b, breadcrumbs[b]);\n }\n\n pageDataRef.current[key] = value;\n };\n\n const getPageData = (key: string, pathname: string) => {\n return pageDataRef.current[pathname]?.[key];\n };\n\n const setNavigationAbortController = (controller: AbortController) => {\n navigationAbortControllerRef.current.abort();\n navigationAbortControllerRef.current = controller;\n };\n\n const fetchRouteCSS = async (routePath: string) => {\n const views = routeManifest[routePath];\n if (!views) {\n return;\n }\n const cssFiles = views\n .flatMap((view) => {\n return cssManifest?.[view];\n })\n .filter(Boolean)\n .filter((file) => !document.getElementById(file));\n\n if (cssFiles.length === 0) {\n return;\n }\n\n async function fetchCSS(path: string) {\n const response = await fetch(`/${path}`);\n const content = response.text();\n return {\n content,\n id: path,\n };\n }\n const result = await Promise.all(cssFiles?.map((file) => fetchCSS(file)));\n for (const { content, id } of result) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = await content;\n document.head.appendChild(style);\n }\n };\n\n return (\n <ClientRouterContext.Provider\n value={{\n isNavigatingSubject,\n getViewPathsFromPathname,\n history,\n getScrollPosition: (path: string) => {\n return scrollHistoryRef.current.get(path) || 0;\n },\n viewEntriesSubject: viewEntriesSubject.current,\n updatePageData,\n getPageData,\n getRoutePathnameFromHref,\n setNavigationAbortController,\n progressManager,\n fetchRouteCSS,\n breadcrumbsCache: breadcrumbsCache.current,\n routerSubject,\n urlLocaleSegment,\n }}\n >\n {children}\n {/* @ts-ignore */}\n {import.meta.hot && <HttpReload />}\n </ClientRouterContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport type { UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport { I18nContext } from \"./I18nContext\";\n\ntype Options<T extends ViewPaths> = UrlParser<T> extends Record<string, never>\n ? {\n search?: Record<string, string | number | boolean | undefined | null>;\n shallow?: boolean;\n hash?: string;\n locale?: string;\n }\n : {\n search?: Record<string, string | number | boolean | undefined | null>;\n params: UrlParser<T>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n };\n\nexport function useNavigate() {\n const { history, setNavigationAbortController } =\n useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n function action(pushOrReplace: \"push\" | \"replace\") {\n return async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n const navigationAbortController = new AbortController();\n if (setNavigationAbortController) {\n setNavigationAbortController(navigationAbortController);\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n shallow,\n locale,\n hash,\n } = {\n params: {},\n shallow: false,\n locale: null,\n hash: \"\",\n ...options,\n };\n\n const urlSearchParams = new URLSearchParams(search);\n let localeSegment = location.locale;\n if (locale) {\n localeSegment = locale;\n }\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const routePath = applyParams(path, params);\n const navigationPath = [\n `${localeSegment ? `/${localeSegment}` : \"\"}${routePath === \"/\" ? \"\" : routePath}`,\n urlSearchParams.toString(),\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n\n const finalPath = [navigationPath, hash].filter(Boolean).join(\"\");\n\n if (shallow) {\n history?.[pushOrReplace](finalPath, { shallow });\n return;\n }\n\n history?.[pushOrReplace](finalPath === '' ? '/' : finalPath);\n };\n }\n\n return {\n push: action(\"push\"),\n replace: action(\"replace\"),\n };\n}\n","import { useContext } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { RouteStateContext } from \"./RouteStateContext\";\nimport { useParams } from \"./useParams\";\n\ntype SearchParamsCallback = (\n search: Record<string, any>,\n shallow: boolean,\n) => void;\n\nclass SearchParams {\n constructor(\n private searchParams: URLSearchParams,\n private callback: SearchParamsCallback,\n ) {}\n\n get(key: string) {\n return this.searchParams.get(key);\n }\n\n set(key: Record<string, string | ((state: string) => string)>): SearchParams;\n set(key: string, value: string | ((state: string) => string)): SearchParams;\n set(key: any, value?: any) {\n let entries: Record<string, any> = {};\n if (typeof key === \"string\") {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n entries[key] = _value;\n } else {\n entries = (key as any) ?? {};\n }\n for (const [key, value] of Object.entries(entries)) {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n this.searchParams.set(key, _value);\n }\n return this;\n }\n\n append(key: string, value: string) {\n this.searchParams.append(key, value);\n return this;\n }\n\n sort() {\n this.searchParams.sort();\n return this;\n }\n\n clear() {\n this.searchParams = new URLSearchParams();\n return this;\n }\n\n delete(key: string | string[]) {\n const keys = Array.isArray(key) ? key : [key];\n for (const key of keys) {\n this.searchParams.delete(key);\n }\n return this;\n }\n\n toJSON() {\n const map = new Map<string, string | string[]>();\n // @ts-ignore\n for (const [key, value] of this.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n\n return Object.fromEntries(map.entries());\n }\n\n toString() {\n return this.searchParams.toString();\n }\n\n push(mode: \"soft\" | \"hard\" = \"soft\") {\n this.callback(this.toJSON(), mode === \"soft\");\n }\n}\n\nexport function useSearchParams() {\n const { push } = useNavigate();\n const { search, pathname } = useContext(RouteStateContext);\n const params = useParams();\n\n const callback = (search: Record<string, never>, shallow: boolean) => {\n push(\n pathname as never,\n {\n params,\n search,\n shallow,\n } as any,\n );\n };\n\n const searchParams = new SearchParams(new URLSearchParams(search), callback);\n\n return searchParams;\n}\n","import { useContext, useSyncExternalStore } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useIsNavigationPending() {\n const { isNavigatingSubject } = useContext(ClientRouterContext);\n const isNavigating = useSyncExternalStore(\n isNavigatingSubject.subscribe,\n isNavigatingSubject.getValue,\n isNavigatingSubject.getValue,\n );\n\n return isNavigating;\n}\n","import { useContext, useEffect, useState } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useNavigationProgress() {\n const { progressManager } = useContext(ClientRouterContext);\n const [progress, setProgress] = useState(progressManager.state.getValue());\n\n useEffect(() => {\n const unsub = progressManager.state.subscribe((p) => setProgress(p));\n return () => {\n unsub();\n };\n }, [progressManager.state]);\n\n return progress;\n}\n","import { useContext } from \"react\";\nimport { useRoute } from \"./useRoute\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport type Breadcrumb = {\n label: string;\n href: string;\n};\n\nexport function useBreadcrumbs() {\n const { pathname } = useRoute();\n const { getViewPathsFromPathname, breadcrumbsCache } =\n useContext(ClientRouterContext);\n\n let breadcrumbs: Breadcrumb[] = [];\n const viewPaths = getViewPathsFromPathname(pathname);\n for (const viewPath of viewPaths) {\n if (breadcrumbsCache.has(`${viewPath}:${pathname}`)) {\n breadcrumbs.push(breadcrumbsCache.get(`${viewPath}:${pathname}`));\n }\n }\n\n return breadcrumbs.filter((breadcrumb) => breadcrumb?.label.length > 0);\n}\n","import { createContext, useContext, type PropsWithChildren } from \"react\";\n\nconst RouteTransitionContext = createContext<{\n isTransitioning: boolean;\n targetPath: string;\n currentPath: string;\n}>({\n isTransitioning: false,\n targetPath: \"\",\n currentPath: \"\",\n});\n\ninterface RouteTransitionProviderProps {\n isPending: boolean;\n isFetching: boolean;\n transitionPath: [string, string];\n}\n\nexport const RouteTransitionProvider = (\n props: PropsWithChildren<RouteTransitionProviderProps>,\n) => {\n const { isPending, isFetching, transitionPath } = props;\n\n return (\n <RouteTransitionContext.Provider\n value={{\n isTransitioning: isPending || isFetching,\n targetPath: transitionPath[1],\n currentPath: transitionPath[0] || \"\",\n }}\n >\n {props.children}\n </RouteTransitionContext.Provider>\n );\n};\n\nexport function useRouteTransition() {\n const context = useContext(RouteTransitionContext);\n if (!context) {\n throw new Error(\n \"useRouteTransition must be used within a RouteTransitionProvider\",\n );\n }\n return context;\n}\n","import { useContext, memo, type ComponentProps } from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewResult } from \"./types\";\nimport { useNavigate } from \"./useNavigate\";\nimport type { ViewRPC } from \"./rpc\";\nimport type { Prettify } from \"../utils/type\";\nimport { useParams } from \"./useParams\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useRouteTransition } from \"./RouteTransitionProvider\";\n\ntype Views = {\n [K in keyof ViewRPC as K extends `view:${infer P}`\n ? P\n : never]: ViewResult<K>;\n};\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\ntype LinkBaseProps<T extends keyof Views> = Omit<\n ComponentProps<\"a\">,\n \"href\"\n> & {\n active?: boolean;\n href: T;\n hash?: string;\n params: UrlParser<T>;\n search?: T extends keyof Views\n ? Views[T][\"input\"] extends Record<string, never>\n ? Search\n : Prettify<Partial<Views[T][\"input\"]> & Search>\n : Search;\n};\n\ntype LinkProps<T extends keyof Views, U = UrlParser<T>> = U extends Record<\n string,\n never\n>\n ? Omit<LinkBaseProps<T>, \"params\">\n : LinkBaseProps<T>;\n\nfunction normalizeSearch(search: Search): Record<string, string> {\n return Object.fromEntries(\n Object.entries(search)\n .filter(([_k, v]) => v !== undefined && v !== null)\n .map(([k, v]) => [k, String(v)]),\n ) as Record<string, string>;\n}\n\nexport const Link = memo(<T extends keyof Views>(props: LinkProps<T>) => {\n const _params = useParams();\n const { isTransitioning, targetPath } = useRouteTransition();\n const {\n href,\n onClick,\n hash = \"\",\n active = false,\n params = {},\n search = {},\n ...rest\n } = { params: _params, search: {}, ...props };\n const { defaultLocale } = useContext(I18nContext);\n const { push } = useNavigate();\n const location = useLocation();\n const searchParams = new URLSearchParams(normalizeSearch(search));\n\n const path = applyParams(href, params);\n let urlLocaleSegment = location.locale;\n if (urlLocaleSegment === defaultLocale) {\n urlLocaleSegment = \"\";\n }\n\n const localeSegment = urlLocaleSegment ? `/${urlLocaleSegment}` : \"\";\n\n const targetHref = [\n [`${localeSegment}${path}`, searchParams.toString()]\n .filter((s) => s.length > 0)\n .join(\"?\"),\n hash,\n ].join(\"\");\n\n const currentHref = [location.pathname, location.search, location.hash]\n .filter((item) => !!item)\n .join(\"\");\n\n return (\n <a\n data-active={active || currentHref === targetHref}\n data-pending={href === targetPath && isTransitioning}\n href={targetHref === '' ? '/' : targetHref}\n onClick={(e) => {\n if (typeof window !== \"undefined\") {\n if (currentHref === targetHref) {\n e.preventDefault();\n return;\n }\n }\n let currentPath = window.location.pathname.replace(localeSegment, \"\");\n currentPath = currentPath === \"\" ? \"/\" : currentPath;\n onClick?.(e);\n\n if (hash === \"\") {\n e.preventDefault();\n }\n onClick?.(e);\n push(href, {\n hash,\n search,\n params,\n shallow: path === currentPath,\n } as unknown as never);\n }}\n {...rest}\n />\n );\n});\n","import { type ComponentProps, useEffect } from \"react\";\nimport type { Link } from \"./Link\";\n\nimport { useNavigate } from \"./useNavigate\";\n\nexport const Redirect = (\n props: ComponentProps<typeof Link> & { action: \"push\" | \"replace\" },\n) => {\n const { href, params = {}, search = {}, action = \"replace\" } = props;\n const { push, replace } = useNavigate();\n\n useEffect(() => {\n if (action === \"replace\") {\n replace(href, { params, search } as any);\n } else {\n push(href, { params, search } as any);\n }\n }, [replace, action, push, params, search, href]);\n\n return <></>;\n};\n","import type { ComponentTree } from \"../types\";\n\nexport function flattenComponentTree(componentTree: ComponentTree): string[] {\n let out: string[] = [];\n for (const [root, branches] of componentTree) {\n out.push(root, ...flattenComponentTree(branches).flat());\n }\n return Array.from(new Set(out));\n}\n","import { createContext, lazy, type PropsWithChildren } from \"react\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\nimport type { ServerDataContextValue } from \"./ServerDataProvider\";\n\ndeclare const window: {\n __GEMI_DATA__: ServerDataContextValue;\n loaders: Record<\n string,\n () => Promise<{\n default: React.ComponentType<unknown>;\n }>\n >;\n} & Window;\n\nlet viewImportMap: Record<string, ReturnType<typeof lazy>> | null = null;\nif (typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\") {\n viewImportMap = {};\n const { componentTree = [] } = window.__GEMI_DATA__ ?? {};\n\n for (const viewName of flattenComponentTree(componentTree)) {\n viewImportMap[viewName] = lazy(window.loaders[viewName]);\n }\n}\n\nexport const ComponentsContext = createContext({ viewImportMap });\n\nexport const ComponentsProvider = (\n props: PropsWithChildren<{ viewImportMap: typeof viewImportMap }>,\n) => {\n return (\n <ComponentsContext.Provider\n value={{ viewImportMap: props.viewImportMap ?? viewImportMap }}\n >\n {props.children}\n </ComponentsContext.Provider>\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from \"react\";\n\ntype Subscribe = (\n topic: string,\n handler: (event: any) => void,\n) => Promise<void>;\n\nexport const WebSocketContext = createContext(\n {} as {\n broadcast: (topic: string, payload: Record<string, any>) => void;\n subscribe: Subscribe;\n unsubscribe: (\n topic: string,\n handler: (event: any) => void,\n ) => Promise<void>;\n },\n);\n\nexport const WebSocketContextProvider = (props: PropsWithChildren) => {\n const wsRef = useRef<WebSocket>(null);\n\n function getWS() {\n return new Promise<WebSocket>((resolve) => {\n if (wsRef.current) {\n resolve(wsRef.current);\n } else {\n const ws = new WebSocket(\"ws://localhost:5173/\");\n ws.onopen = () => {\n wsRef.current = ws;\n console.log(\"ws opened\");\n ws.addEventListener(\"close\", () => {\n console.log(\"ws closed\");\n wsRef.current = null;\n });\n resolve(ws);\n };\n }\n });\n }\n\n const subscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"subscribe\", topic }));\n ws.addEventListener(\"message\", handler);\n };\n\n const unsubscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"unsubscribe\", topic }));\n ws.removeEventListener(\"message\", handler);\n };\n\n const broadcast = async (topic: string, payload = {}) => {\n const ws = await getWS();\n ws.send(\n JSON.stringify({\n type: \"broadcast\",\n topic,\n payload,\n }),\n );\n };\n\n useEffect(() => {\n return () => {\n if (wsRef.current) {\n wsRef.current.close();\n wsRef.current = null;\n }\n };\n }, []);\n\n return (\n <WebSocketContext.Provider value={{ subscribe, unsubscribe, broadcast }}>\n {props.children}\n </WebSocketContext.Provider>\n );\n};\n","import { type ReactNode, useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\nexport function updateMeta(meta: any) {\n // A partially rendered response whose segments set no metadata sends none —\n // what is on the page belongs to the segments that were skipped.\n if (!meta) {\n return;\n }\n const { title, description } = meta;\n if (title) {\n document.title = title;\n }\n if (description) {\n const desc = document.querySelector(\"meta[name='description']\");\n if (desc) {\n desc.setAttribute(\"content\", description);\n } else {\n const newDesc = document.createElement(\"meta\");\n newDesc.setAttribute(\"name\", \"description\");\n newDesc.setAttribute(\"content\", description);\n document.head.appendChild(newDesc);\n }\n }\n}\n\nconst OpenGraph = (props: {\n title: string;\n type: string;\n url: string;\n image: string;\n description?: string;\n imageAlt?: string;\n imageWidth?: number;\n imageHeight?: number;\n twitterImage?: string;\n twitterImageAlt?: string;\n twitterImageWidth?: number;\n twitterImageHeight?: number;\n}) => {\n const {\n title,\n description,\n type,\n url,\n image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage,\n twitterImageAlt,\n twitterImageWidth,\n twitterImageHeight,\n } = props;\n\n return (\n <>\n <meta property=\"og:title\" content={title} />\n <meta property=\"og:type\" content={type} />\n <meta property=\"og:url\" content={url} />\n <meta property=\"og:image\" content={image} />\n {description && <meta property=\"og:description\" content={description} />}\n {imageAlt && <meta property=\"og:image:alt\" content={imageAlt} />}\n {imageWidth && (\n <meta property=\"og:image:width\" content={String(imageWidth)} />\n )}\n {imageHeight && (\n <meta property=\"og:image:height\" content={String(imageHeight)} />\n )}\n {twitterImage && (\n <>\n <meta name=\"twitter:image\" content={twitterImage} />\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n </>\n )}\n {twitterImageAlt && (\n <meta name=\"twitter:image:alt\" content={twitterImageAlt} />\n )}\n {twitterImageWidth && (\n <meta name=\"twitter:image:width\" content={String(twitterImageWidth)} />\n )}\n {twitterImageHeight && (\n <meta\n name=\"twitter:image:height\"\n content={String(twitterImageHeight)}\n />\n )}\n </>\n );\n};\n\nexport const Head = ({\n children = null,\n charSet = \"utf-8\",\n}: { children?: ReactNode; charSet?: string }) => {\n const { meta } = useContext(ServerDataContext);\n return (\n <head>\n <meta charSet={charSet} />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {/*\n Disable browser auto-translation (Chrome/Google Translate). Gemi apps do\n their own i18n, and a translator that rewrites text nodes *before* React\n hydrates mutates the SSR DOM — which React rejects as a hydration\n mismatch (Minified React error #418) and then regenerates the tree,\n dropping the server-injected <style> and leaving the page unstyled.\n Pair this with `translate=\"no\"` on the <html> element in RootLayout.\n */}\n <meta name=\"google\" content=\"notranslate\" />\n <title>{meta?.title}</title>\n {meta?.description && (\n <meta name=\"description\" content={meta.description} />\n )}\n {meta?.openGraph && <OpenGraph {...meta.openGraph} />}\n {children}\n </head>\n );\n};\n","import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\n\nconst ThemeContext = createContext({\n theme: \"light\" as Theme,\n setTheme: (theme: Theme) => {}, // Function to set the theme\n});\n\nfunction storeTheme(theme: string) {\n try {\n localStorage.setItem(\"theme\", theme);\n } catch (error) {\n console.error(\"Failed to store theme in localStorage:\", error);\n }\n}\n\nexport const ThemeProvider = (props: { children: ReactNode }) => {\n const [theme, setTheme] = useState(() => {\n if (typeof window === \"undefined\") {\n return \"light\"; // Default theme for server-side rendering\n }\n return localStorage.getItem(\"theme\") || \"light\";\n });\n\n useEffect(() => {\n if (theme === \"system\") {\n window\n .matchMedia(\"(prefers-color-scheme: dark)\")\n .addEventListener(\"change\", ({ matches }) => {\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(matches ? \"dark\" : \"light\");\n });\n }\n }, [theme]);\n\n return (\n <ThemeContext.Provider\n value={{\n theme: theme as Theme,\n setTheme: (newTheme: Theme) => {\n setTheme(newTheme);\n storeTheme(newTheme);\n\n let documentTheme = newTheme as Theme;\n if (newTheme === \"system\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n documentTheme = media.matches ? \"dark\" : \"light\";\n }\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(documentTheme);\n },\n }}\n >\n {props.children}\n </ThemeContext.Provider>\n );\n};\n\nexport function useTheme() {\n const context = useContext(ThemeContext);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n","import { applyParams } from \"./applyParams\";\n\n/**\n * Route the client is currently rendering, sent on `.json` navigations so the\n * server can skip the handlers of the segments that route already has mounted.\n * Value is a locale-less pathname plus search, e.g. `/app/A/chat?tab=2`.\n */\nexport const PARTIAL_RENDER_HEADER = \"x-gemi-from\";\n\n/** What the server reports back about the skip it performed, if any. */\nexport interface PartialRenderInfo {\n /** The `x-gemi-from` value the plan was computed against. */\n from: string;\n /** View paths of the skipped segments, in order. Their data is carried forward. */\n carriedViews: string[];\n}\n\n/**\n * The `x-gemi-from` value for the route the client starts on.\n *\n * On the first render the router's `pathname` is still the route *pattern* the\n * server matched — it only becomes a resolved path once the history listener\n * has run — so this has to apply the params. Sending `/app/:orgId/chat` names\n * no route the server can resolve, and the first navigation after every full\n * page load would skip nothing.\n */\nexport function initialRenderedRoute(route: {\n pathname?: string;\n params?: Record<string, string>;\n search?: string;\n}) {\n // `applyParams` strips the trailing slash, so the root route resolves to the\n // empty string — which the server reads as \"no header\" and renders in full.\n const pathname = applyParams(route.pathname ?? \"/\", route.params ?? {}) || \"/\";\n return `${pathname}${route.search ?? \"\"}`;\n}\n","import type { Breadcrumb } from \"../useBreadcrumbs\";\n\ninterface RouteSnapshot {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Route pattern the data was produced for — part of every breadcrumb key. */\n routePath: string;\n data: Record<string, any>;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\n/**\n * A partially rendered response only carries the segments the server actually\n * ran. Everything is keyed by the *new* pathname, so a carried layout would\n * render with empty props unless the data it already had is copied across.\n *\n * Data the server sent always wins: a carried view is only filled in where the\n * response has nothing for it.\n */\nexport function mergeCarriedSegments(\n previous: RouteSnapshot,\n next: RouteSnapshot,\n carriedViews: string[],\n) {\n if (carriedViews.length === 0) {\n return { data: next.data, breadcrumbs: next.breadcrumbs };\n }\n\n // Page data is keyed by the pathname it was fetched for, and a shallow\n // navigation moves the pathname on without fetching — so fall back to the key\n // the data is actually under. The server sends exactly one.\n const previousData = previous.data ?? {};\n const previousViewData =\n previousData[previous.pathname] ?? previousData[Object.keys(previousData)[0]] ?? {};\n const previousBreadcrumbs = previous.breadcrumbs ?? {};\n\n const carriedViewData: Record<string, unknown> = {};\n const carriedBreadcrumbs: Record<string, Breadcrumb> = {};\n\n for (const viewPath of carriedViews) {\n if (viewPath in previousViewData) {\n carriedViewData[viewPath] = previousViewData[viewPath];\n }\n // Breadcrumbs are keyed by route pattern, and that changed even though the\n // segment did not, so they have to be re-keyed rather than copied.\n const previousKey = `${viewPath}:${previous.routePath}`;\n if (previousKey in previousBreadcrumbs) {\n carriedBreadcrumbs[`${viewPath}:${next.routePath}`] = previousBreadcrumbs[previousKey];\n }\n }\n\n // The server sends page data under exactly one key. Take it from the payload\n // rather than recomputing it, so the two never disagree on spelling.\n const [nextKey = next.pathname] = Object.keys(next.data ?? {});\n\n return {\n data: {\n ...next.data,\n [nextKey]: { ...carriedViewData, ...next.data?.[nextKey] },\n },\n breadcrumbs: { ...carriedBreadcrumbs, ...next.breadcrumbs },\n };\n}\n","import {\n useContext,\n useEffect,\n useRef,\n useState,\n StrictMode,\n memo,\n useTransition,\n} from \"react\";\n\nimport type { PropsWithChildren, ReactNode, ComponentType, lazy } from \"react\";\n\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n ClientRouterContext,\n ClientRouterProvider,\n} from \"./ClientRouterContext\";\nimport type { ComponentTree } from \"./types\";\nimport { ComponentsContext, ComponentsProvider } from \"./ComponentContext\";\nimport {\n QueryManagerContext,\n QueryManagerProvider,\n} from \"./QueryManagerContext\";\nimport { I18nProvider } from \"./I18nContext\";\nimport { WebSocketContextProvider } from \"./WebsocketContext\";\nimport { useNavigate } from \"./useNavigate\";\nimport {\n type PageData,\n type RouteState,\n RouteStateProvider,\n} from \"./RouteStateContext\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { Action } from \"history\";\nimport { useRouteData } from \"./useRouteData\";\nimport { updateMeta } from \"./Head\";\nimport { RouteTransitionProvider } from \"./RouteTransitionProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport {\n PARTIAL_RENDER_HEADER,\n initialRenderedRoute,\n type PartialRenderInfo,\n} from \"../utils/partialRender\";\nimport { mergeCarriedSegments } from \"./helpers/mergeCarriedSegments\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n loaders: Record<string, () => void>;\n }\n}\n\nfunction restoreScroll(action: Action | null = null, _pathname = \"no path\") {\n if (action === null) {\n return;\n }\n\n const { pathname, search, hash } = window.location;\n\n const key = [pathname, search, hash].join(\"\");\n const sh = window.scrollHistory;\n\n const scrollPosition = sh?.get(key);\n\n if (action !== Action.Pop) {\n window.scrollTo(0, 0);\n } else {\n // In dev mode the effect runs scroll restoration\n // will be called twice, this if statement prevents\n // scroll to top\n if (!scrollPosition) {\n return;\n }\n window.scrollTo(0, scrollPosition ?? 0);\n }\n\n sh?.delete(key);\n}\n\ninterface RouteProps {\n componentPath: string;\n pathname: string;\n action: Action | null;\n}\n\nconst Route = memo((props: PropsWithChildren<RouteProps>) => {\n const { componentPath, pathname, action, children } = props;\n const { viewImportMap } = useContext(ComponentsContext);\n const { data } = useRouteData();\n\n const componentData = data?.[pathname]?.[componentPath] ?? {};\n const Component = viewImportMap[componentPath];\n\n useEffect(() => {\n if (!children) {\n restoreScroll(action, componentPath);\n }\n }, [action, children, componentPath]);\n\n if (Component) {\n return <Component {...componentData}>{props.children}</Component>;\n }\n\n const NotFound = viewImportMap[\"404\"];\n return <NotFound />;\n});\n\nconst Tree = memo(\n (props: {\n action: Action;\n tree: ComponentTree;\n entries: string[];\n pathname: string;\n }) => {\n const { entries, tree, pathname, action } = props;\n\n return (\n <>\n {tree.map((node) => {\n const [path, subtree] = node;\n if (!entries.includes(path)) return null;\n if (subtree.length > 0) {\n return (\n <Route\n action={action}\n key={path}\n componentPath={path}\n pathname={pathname}\n >\n <Tree\n action={action}\n tree={subtree}\n entries={entries}\n pathname={pathname}\n />\n </Route>\n );\n }\n return (\n <Route\n action={action}\n key={path}\n componentPath={path}\n pathname={pathname}\n />\n );\n })}\n </>\n );\n },\n);\n\nconst Routes = (props: { componentTree: ComponentTree }) => {\n const { componentTree } = props;\n const [isPending, startTransition] = useTransition();\n const [isFetching, setIsFetching] = useState(false);\n const { routerSubject, fetchRouteCSS } = useContext(ClientRouterContext);\n const { hydrate } = useContext(QueryManagerContext);\n\n const [transitionPath, setTransitionPath] = useState<[string, string]>([\n null,\n routerSubject?.getValue().pathname,\n ]);\n\n const {\n breadcrumbs,\n pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n } = useContext(ServerDataContext);\n\n const [routeState, setRouteState] = useState<RouteState & PageData>({\n params: routerSubject?.getValue().params,\n search: routerSubject?.getValue().search,\n pathname: routerSubject?.getValue().pathname,\n views: routerSubject?.getValue().views,\n action: null,\n hash: routerSubject?.getValue().hash,\n state: routerSubject?.getValue().state,\n routePath: routerSubject?.getValue().routePath,\n locale: routerSubject?.getValue().locale,\n breadcrumbs,\n data: pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n });\n\n const { replace } = useNavigate();\n\n // Adopt what the document was rendered with. Without this the initial payload\n // only ever reaches a component that mounts on the first render, and one that\n // mounts on a later navigation — into a route whose layout has since been\n // carried forward rather than re-run — would fetch it over `/api` instead.\n useEffect(() => {\n hydrate(prefetchedData);\n }, [hydrate, prefetchedData]);\n\n // The route currently on screen, in `x-gemi-from` form. Updated when a\n // response is committed, never when one is merely requested — a navigation\n // that fails must leave the base the server carries segments from intact.\n const renderedRouteRef = useRef(initialRenderedRoute(routeState));\n\n useEffect(() => {\n return routerSubject?.subscribe(async (routerState) => {\n const { pathname, search, state, views } = routerState;\n setTransitionPath((current) => {\n const [, prevTarget] = current;\n return [prevTarget, pathname];\n });\n if (routerState.views.length === 0) {\n setRouteState((routerState) => ({\n ...routerState,\n views: [\"404\"],\n }));\n return;\n }\n\n if (state?.shallow) {\n setRouteState((state) => ({\n ...state,\n ...routerState,\n }));\n return;\n }\n\n const localeSegment = routerState.locale ? `/${routerState.locale}` : \"\";\n\n const _pathname =\n localeSegment.length > 0 && pathname === \"/\" ? \"\" : pathname;\n\n const pathnameWithLocaleSegment = `${localeSegment}${_pathname}`;\n\n const url = `${pathnameWithLocaleSegment}.json${search}`;\n const from = renderedRouteRef.current;\n setIsFetching(true);\n let res = { ok: false, json: async () => ({}) } as Response;\n try {\n const result = await Promise.all([\n fetch(url, { headers: { [PARTIAL_RENDER_HEADER]: from } }),\n fetchRouteCSS(pathname),\n ...views.map((component) => {\n if (!window?.loaders) return Promise.resolve();\n const loader = window?.loaders?.[component] ?? (() => ({}));\n loader();\n }),\n ]);\n res = result[0];\n } catch (e) {\n console.error(e);\n }\n\n if (res.ok) {\n let payload = await res.json();\n\n // Another navigation committed while this one was in flight, so the\n // segments the server carried forward were computed against a route\n // that is no longer on screen. Nothing sound to merge onto — ask for\n // the whole tree instead.\n const claimed: PartialRenderInfo | null = payload.partial ?? null;\n if (claimed && claimed.from !== renderedRouteRef.current) {\n try {\n const full = await fetch(url);\n if (full.ok) {\n payload = await full.json();\n }\n } catch (e) {\n console.error(e);\n }\n }\n\n const {\n data,\n i18n,\n prefetchedData,\n breadcrumbs,\n meta,\n directive = {},\n is404 = false,\n appId,\n } = payload;\n updateMeta(meta);\n if (directive?.kind === \"Redirect\") {\n if (directive?.path) {\n replace(directive.path, { params: {} } as unknown);\n }\n\n return;\n }\n\n if (is404) {\n startTransition(() => {\n setRouteState((state) => ({\n ...state,\n appId,\n views: [\"404\"],\n }));\n });\n }\n\n const carriedViews: string[] = payload.partial?.carriedViews ?? [];\n renderedRouteRef.current = `${pathname}${search}`;\n\n // Adopt what the server just prefetched before the new surface mounts\n // and its queries read the cache, otherwise they refetch it over /api.\n // Safe here: this callback is async, so we are past the render phase.\n hydrate(prefetchedData);\n\n startTransition(() => {\n setRouteState((state) => ({\n ...routerState,\n appId,\n i18n,\n prefetchedData,\n ...mergeCarriedSegments(\n state,\n { pathname, routePath: routerState.routePath, data, breadcrumbs },\n carriedViews,\n ),\n }));\n });\n }\n setIsFetching(false);\n });\n }, [routerSubject, fetchRouteCSS, replace, hydrate]);\n\n return (\n <RouteTransitionProvider\n isPending={isPending}\n isFetching={isFetching}\n transitionPath={transitionPath}\n >\n <RouteStateProvider state={routeState}>\n <Tree\n action={routeState.action}\n pathname={applyParams(routeState.pathname ?? \"/\", routeState.params)}\n tree={componentTree}\n entries={routeState.pathname ? routeState.views : [\"404\"]}\n />\n </RouteStateProvider>\n </RouteTransitionProvider>\n );\n};\n\nexport const ClientRouter = (props: {\n viewImportMap?: Record<string, ReturnType<typeof lazy>>;\n RootLayout: ComponentType<{ children: ReactNode; locale: string }>;\n}) => {\n const { RootLayout } = props;\n const {\n routeManifest,\n router,\n componentTree,\n pageData,\n cssManifest,\n breadcrumbs,\n i18n,\n } = useContext(ServerDataContext);\n\n return (\n <ThemeProvider>\n <I18nProvider>\n <WebSocketContextProvider>\n <QueryManagerProvider>\n <ComponentsProvider viewImportMap={props.viewImportMap}>\n <ClientRouterProvider\n cssManifest={cssManifest}\n searchParams={router.searchParams}\n params={router.params}\n pageData={pageData}\n is404={router.is404}\n is500={false}\n pathname={router.pathname}\n currentPath={router.currentPath}\n routeManifest={routeManifest}\n breadcrumbs={breadcrumbs}\n urlLocaleSegment={router.urlLocaleSegment}\n >\n <StrictMode>\n <RootLayout locale={i18n.currentLocale}>\n <Routes componentTree={componentTree} />\n </RootLayout>\n </StrictMode>\n </ClientRouterProvider>\n </ComponentsProvider>\n </QueryManagerProvider>\n </WebSocketContextProvider>\n </I18nProvider>\n </ThemeProvider>\n );\n};\n","\"use client\";\nimport { createContext as l, Component as y, createElement as d, useContext as f, useState as p, useMemo as E, forwardRef as B } from \"react\";\nconst h = l(null), c = {\n didCatch: !1,\n error: null\n};\nclass m extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = c;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { error: t } = this.state;\n t !== null && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(c));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: s } = this.props;\n o && t.error !== null && C(e.resetKeys, s) && (this.props.onReset?.({\n next: s,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(c));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: s } = this.props, { didCatch: n, error: a } = this.state;\n let i = e;\n if (n) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n i = t(u);\n else if (o)\n i = d(o, u);\n else if (s !== void 0)\n i = s;\n else\n throw a;\n }\n return d(\n h.Provider,\n {\n value: {\n didCatch: n,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n }\n },\n i\n );\n }\n}\nfunction C(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction g(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction x(r) {\n if (!g(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction k() {\n const r = f(h);\n x(r);\n const { error: e, resetErrorBoundary: t } = r, [o, s] = p({\n error: null,\n hasError: !1\n }), n = E(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), s({ error: null, hasError: !1 });\n },\n showBoundary: (a) => s({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return n;\n}\nfunction S(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction w(r, e) {\n const t = B(\n (s, n) => d(\n m,\n e,\n d(r, { ...s, ref: n })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n m as ErrorBoundary,\n h as ErrorBoundaryContext,\n S as getErrorMessage,\n k as useErrorBoundary,\n w as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import { useEffect, type ComponentType } from \"react\";\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nconst StackTrace = () => {\n useEffect(() => {\n window.addEventListener(\"load\", () => {\n const container = document.getElementById(\"overlay\");\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (window as any).error,\n stack: (window as any).stack_trace || \"\",\n });\n container.appendChild(overlay);\n }\n });\n }, []);\n\n return <div id=\"overlay\" />;\n};\n\nexport function init(RootLayout: ComponentType<any>) {\n if (typeof window !== \"undefined\" && (window as any).render_error) {\n createRoot(document.body).render(<StackTrace />);\n } else {\n hydrateRoot(\n document,\n <>\n <></>\n <></>\n <ErrorBoundary fallback={<div />}>\n <ServerDataProvider>\n <ClientRouter RootLayout={RootLayout} />\n </ServerDataProvider>\n </ErrorBoundary>\n </>,\n {\n onCaughtError: (error) => {\n console.error(error);\n // @ts-ignore\n if (import.meta.env.DEV) {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (error as any).message,\n stack: (error as any).stack || \"\",\n });\n document.body.appendChild(overlay);\n }\n }\n },\n },\n );\n }\n}\n\nexport function create(\n RootLayout: ComponentType<any>,\n { componentTree, loaders, routeManifest, router, i18n, auth, prefetchedData, viewImportMap }: any,\n) {\n (window as any).__GEMI_DATA__ = {\n componentTree,\n loaders,\n routeManifest,\n router,\n i18n,\n auth,\n prefetchedData,\n pageData: {},\n };\n createRoot(document.getElementById(\"root\")).render(\n <ServerDataProvider>\n <ClientRouter viewImportMap={viewImportMap} RootLayout={RootLayout} />\n </ServerDataProvider>,\n );\n}\n","import type { ComponentType } from \"react\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\n\nexport function createRoot(\n RootLayout: ComponentType<{ children: React.ReactNode; locale: string }>,\n) {\n return (props: any) => (\n <ServerDataProvider value={props.data}>\n <ClientRouter\n RootLayout={RootLayout}\n viewImportMap={props.viewImportMap}\n />\n </ServerDataProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nconst defaultScreen = [390, 768, 1024];\nconst defaultContainer = [100, 100, 100, 100];\n\nfunction generateImageProps(\n src: string,\n width: number,\n container = defaultContainer,\n screen = defaultScreen,\n quality = 80,\n) {\n const baseUrl = src;\n\n const widths = [...container.map((c, i) => (screen[i] * c) / 100), width * 2];\n\n return {\n srcSet: [\n ...screen.map((size, i) => {\n return `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${widths[i]} ${size}${isNaN(Number(size)) ? \"\" : \"w\"}`;\n }),\n `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${width * 2} 2x`,\n ].join(\", \"),\n sources: [\n ...container.map((c, i) => {\n if (!screen[i]) {\n return `${c}vw`;\n }\n return `(max-width: ${screen[i]}px) ${c}vw`;\n }),\n ].join(\", \"),\n };\n}\n\nfunction fillRestWithLast<T>(arr: T[], length: number): T[] {\n return [\n ...arr,\n ...Array.from({ length: length - arr.length }).fill(arr[arr.length - 1]),\n ] as T[];\n}\n\ninterface ImageProps {\n src: string;\n width: number;\n container?: number[];\n screen?: number[];\n quality?: number;\n}\n\nexport const Image = (props: ComponentProps<\"img\"> & ImageProps) => {\n const {\n screen = defaultScreen,\n container = defaultContainer,\n src,\n width,\n quality = 80,\n srcSet: __,\n ...rest\n } = props;\n\n if (!src) {\n return null;\n }\n\n const srcProps = generateImageProps(\n src,\n width,\n fillRestWithLast(container, 4),\n screen,\n quality,\n );\n\n return <img {...srcProps} width={width} {...rest} />;\n};\n","import { usePost } from \"../useMutation\";\n\ninterface UseForgotPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseForgotPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useForgotPassword(args: UseForgotPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/forgot-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\nimport { useQuery } from \"../useQuery\";\n\ninterface UseSignInArgs {\n onSuccess?: (data: any) => void;\n}\n\nconst defaultArgs: UseSignInArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignIn(args: UseSignInArgs = defaultArgs) {\n const { mutate } = useQuery(\"/auth/me\");\n return usePost(\n \"/auth/sign-in\",\n {},\n {\n onSuccess: (user) => {\n args.onSuccess(user);\n mutate(user as any);\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\nexport function useSignUp() {\n return usePost(\"/auth/sign-up\");\n}\n","import { useMutate } from \"../useMutate\";\nimport { usePost } from \"../useMutation\";\n\ninterface UseSignOutArgs {\n onSuccess?: () => void;\n}\n\nconst defaultArgs: UseSignOutArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignOut(args: UseSignOutArgs = defaultArgs) {\n const mutator = useMutate();\n return usePost(\n \"/auth/sign-out\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n mutator({ path: \"/auth/me\" });\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\ninterface UseResetPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseResetPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useResetPassword(args: UseResetPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/reset-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"../ServerDataProvider\";\nimport { useQuery } from \"../useQuery\";\n\nexport function useUser() {\n const { auth } = useContext(ServerDataContext);\n const {\n data: user,\n loading,\n error,\n } = useQuery(\n \"/auth/me\",\n {},\n {\n fallbackData: auth?.user ? auth.user : null,\n },\n );\n\n if (loading && !user) {\n return { user: null, loading, error };\n }\n\n return { user: user, loading, error };\n}\n","import { createElement, Fragment, isValidElement, type JSX } from \"react\";\n\ntype TemplateParams = Record<\n string,\n string | ((p: unknown) => string | JSX.Element)\n>;\n\nexport function parseTranslation(template: string, params: TemplateParams) {\n // Check if we have any JSX in our parameters\n const hasJSX = Object.values(params).some(\n (value) =>\n typeof value === \"function\" &&\n isValidElement((value as (p: unknown) => unknown)(\"\")),\n );\n\n // Regular expression to match template variables:\n // {{name}} - simple variable\n // {{name:type}} - variable with type casting\n // {{name:[content]}} - variable with interpolated content\n const regex = /{{([^{}]+?)(?::([^{}\\[\\]]+?))?(?:\\[(.*?)\\])?}}/g;\n\n if (!hasJSX) {\n // Simple string replacement\n const result = template.replace(regex, (match, name, type, content) => {\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n const value = params[cleanName];\n if (value === undefined) {\n return match; // Return original match if no parameter found\n }\n\n if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n // Check if function returned JSX - this shouldn't happen in the string branch\n if (isValidElement(functionResult)) {\n throw new Error(\"JSX returned in string context\");\n }\n return String(functionResult);\n }\n\n // Handle type casting if specified\n if (type) {\n switch (type.toLowerCase()) {\n case \"number\":\n return Number(value).toString();\n case \"string\":\n return String(value);\n case \"boolean\":\n return Boolean(value).toString();\n default:\n return String(value);\n }\n }\n return String(value);\n });\n return result as any;\n } else {\n // JSX replacement - we'll split the template into parts\n const parts: Array<string | JSX.Element> = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null = null;\n\n while ((match = regex.exec(template)) !== null) {\n const [fullMatch, name, type, content] = match;\n const matchIndex = match.index;\n\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n // Add text before the match\n if (matchIndex > lastIndex) {\n parts.push(template.substring(lastIndex, matchIndex));\n }\n\n const value = params[cleanName];\n if (value === undefined) {\n // Keep original template variable if no parameter found\n parts.push(fullMatch);\n } else if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n parts.push(functionResult);\n } else if (type) {\n // Handle type casting if specified\n switch (type.toLowerCase()) {\n case \"number\":\n parts.push(Number(value).toString());\n break;\n case \"string\":\n parts.push(String(value));\n break;\n case \"boolean\":\n parts.push(Boolean(value).toString());\n break;\n default:\n parts.push(String(value));\n }\n } else {\n parts.push(String(value));\n }\n\n lastIndex = matchIndex + fullMatch.length;\n }\n\n // Add any remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Convert the parts array to JSX\n return createElement(Fragment, {}, ...parts) as any;\n }\n}\n","import type { I18nDictionary } from \"./rpc\";\nimport type { ParseTranslationParams, Prettify } from \"../utils/type\";\nimport type { JSX } from \"react\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport { useRouteData } from \"./useRouteData\";\n\ntype Parser<T extends Record<string, string>> = Prettify<\n {\n [K in keyof T]: ParseTranslationParams<T[K]>;\n }[keyof T]\n>;\n\ntype ParamsOrNever<T> = T extends Record<string, never>\n ? [params?: never]\n : [params: T];\n\nexport function useTranslator<T extends keyof I18nDictionary>(component: T) {\n const { i18n } = useRouteData();\n\n function parse<\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(key: K, ...args: ParamsOrNever<Parser<U>>) {\n try {\n const translations = i18n.dictionary[i18n.currentLocale][component];\n const [params = {}] = args;\n return parseTranslation(translations[key as any], params);\n } catch (err) {\n console.error(\n `Unresolved translation Component:${component} key:${String(key)}`,\n );\n return String(key);\n }\n }\n\n parse.jsx = <\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(\n key: K,\n ...args: ParamsOrNever<Parser<U>>\n ) => {\n return parse(key, ...(args as any)) as unknown as JSX.Element;\n };\n\n return parse;\n}\n","import { useLocation } from \"./useLocation\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\n\nconst setCookie = async (locale: string) => {\n try {\n return await globalThis.cookieStore.set(\"i18n-locale\", locale);\n } catch (err) {\n return await fetch(`/api/__gemi__/services/i18n/set-locale/${locale}`);\n // TODO: show unsuported browser error\n // console.log(err);\n }\n};\n\nexport function useLocale() {\n const { i18n } = useRouteData();\n const { pathname, search } = useLocation();\n const { replace } = useNavigate();\n const params = useParams();\n\n const setLocale = async (locale: string) => {\n const urlSearchParams = new URLSearchParams(search);\n setCookie(locale).then(() => {\n replace(pathname, {\n locale,\n // TODO: fix: this conversion is wrong, because there can be multiple\n // search params with the same name\n search: Object.fromEntries(urlSearchParams.entries()),\n params,\n } as any);\n });\n };\n\n return [i18n.currentLocale, setLocale] as const;\n}\n","import { useCallback, useContext, useEffect, useMemo } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useSubscription(\n route: string,\n options: { params: {}; cb: (data: any) => void },\n) {\n const { cb, params } = options;\n const { subscribe, unsubscribe } = useContext(WebSocketContext);\n\n const topic = useMemo(\n () => applyParams(route, options.params),\n [route, params],\n );\n\n const handler = (event: MessageEvent<any>) => {\n const message = JSON.parse(event.data);\n if (topic === message.topic) {\n cb(message.data);\n }\n };\n\n useEffect(() => {\n subscribe(topic, handler);\n\n return () => {\n unsubscribe(topic, handler);\n };\n }, [topic]);\n}\n","import { useContext } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useBroadcast(\n path: string,\n options: { params: Record<string, string | number> },\n) {\n const { params = {} } = options;\n const { broadcast } = useContext(WebSocketContext);\n\n const topic = applyParams(path, params);\n\n return (payload: Record<string, any>) => broadcast(topic, payload);\n}\n","import { createElement, Fragment, type ReactNode } from \"react\";\nimport type { SatoriOptions } from \"satori\";\n\ntype Font = Omit<SatoriOptions[\"fonts\"][number], \"data\">;\ntype Options = Omit<SatoriOptions, \"fonts\"> & {\n fonts: Font[];\n} & { width: number; height: number };\n\nexport const OpenGraphImage = ({\n children,\n ...satoriOptions\n}: Options & { children: ReactNode }) => {\n return (\n <>\n {(() => {\n throw {\n jsx: createElement(Fragment, { children }),\n satoriOptions,\n };\n })()}\n </>\n );\n};\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useAppIdMissmatch() {\n const { appId: next } = useContext(RouteStateContext);\n const { appId: current } = useContext(ServerDataContext);\n\n return current !== next;\n}\n"],"x_google_ignoreList":[15,16,17,18,41],"mappings":";;;;;AAAA,IAAa,UAAb,MAAwB;CACtB,8BAAc,IAAI,IAAwB;CAC1C;CAEA,YAAY,cAAiB;EAC3B,KAAK,QAAQ;CACf;CAEA,UAAiB,YAAgC;EAC/C,KAAK,YAAY,IAAI,UAAU;EAC/B,aAAa;GACX,KAAK,YAAY,OAAO,UAAU;EACpC;CACF;CAEA,KAAY,OAAU;EACpB,KAAK,QAAQ;EACb,KAAK,YAAY,SAAS,eAAe,WAAW,KAAK,CAAC;CAC5D;CAEA,WAAkB;EAChB,OAAO,KAAK;CACd;AACF;;;ACdA,IAAa,qBAAqB;AAElC,IAAa,gBAAb,MAA2B;CACzB;CACA,gCAAgB,IAAI,IAAY;CAChC,kCAAkB,IAAI,IAAoB;CAC1C;CAEA,YAAY,KAAa,cAAmC;EAC1D,KAAK,MAAM;EACX,KAAK,QAAQ,IAAI,wBAAQ,IAAI,IAAI,CAAC;EAClC,KAAK,QAAQ,YAAY;CAC3B;;;;;;;;;CAUA,QAAQ,cAAsD;EAC5D,MAAM,QAAQ,KAAK,MAAM,SAAS;EAClC,MAAM,MAAM,KAAK,IAAI;EACrB,IAAI,UAAU;EAEd,KAAK,MAAM,CAAC,YAAY,SAAS,OAAO,QAAQ,gBAAgB,CAAC,CAAC,GAAG;GACnE,IAAI,CAAC,MAAM;GACX,MAAM,UAAU,MAAM,IAAI,UAAU;GAIpC,IAAI,SAAS,SAAS;GAEtB,IAAI,WAAW,QAAQ,SAAS,MAAM;GAEtC,MAAM,IAAI,YAAY;IACpB,SAAS;IACT;IACA,OAAO;IACP,SAAS;GACX,CAAC;GACD,KAAK,cA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B;CAClC,MAAM,EAAE,OAAO,SAAS,WAAW,iBAAiB;CACpD,MAAM,EAAE,OAAO,YAAY,WAAW,iBAAiB;CAEvD,OAAO,YAAY;AACrB"}
1
+ {"version":3,"file":"index.js","names":["_options","C","#i","#t","#n","#e","#s","#o","#b","#f","#r","#h","#u","#d","#A","#T","#P","#C","#E","#g","#S","#x","#O","#y","#p","#w","#k","#c","#R","#l","#m","#a","URLPattern","l","y","d"],"sources":["../../utils/Subject.ts","../../client/QueryResource.ts","../../client/QueryManagerContext.tsx","../../utils/applyParams.ts","../../utils/omitNullishValues.ts","../../client/RouteStateContext.tsx","../../client/useParams.ts","../../client/useRouteData.ts","../../client/isPlainObject.ts","../../client/useQuery.ts","../../client/useMutation.ts","../../client/useMutate.ts","../../client/ServerDataProvider.tsx","../../client/Mutation.tsx","../../client/useLocation.ts","../../../../node_modules/.bun/@babel+runtime@7.29.2/node_modules/@babel/runtime/helpers/esm/extends.js","../../../../node_modules/.bun/history@5.3.0/node_modules/history/index.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/dist/urlpattern.js","../../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js","../../utils/sleep.ts","../../client/ProgressManager.ts","../../client/useRoute.ts","../../client/HttpReload.tsx","../../client/I18nContext.tsx","../../client/ClientRouterContext.tsx","../../client/useNavigate.ts","../../client/useSearchParams.ts","../../client/useIsNavigationPending.ts","../../client/useNavigationProgress.ts","../../client/useBreadcrumbs.ts","../../client/RouteTransitionProvider.tsx","../../client/Link.tsx","../../client/Redirect.tsx","../../client/helpers/flattenComponentTree.ts","../../client/ComponentContext.tsx","../../client/WebsocketContext.tsx","../../client/Head.tsx","../../client/ThemeProvider.tsx","../../utils/partialRender.ts","../../client/helpers/mergeCarriedSegments.ts","../../client/ClientRouter.tsx","../../../../node_modules/.bun/react-error-boundary@6.1.1+83d5fd7b249dbeef/node_modules/react-error-boundary/dist/react-error-boundary.js","../../client/init.tsx","../../client/createRoot.tsx","../../client/Image.tsx","../../client/auth/useForgotPassword.ts","../../client/auth/useSignIn.tsx","../../client/auth/useSignUp.ts","../../client/auth/useSignOut.ts","../../client/auth/useResetPassword.ts","../../client/auth/useUser.ts","../../utils/parseTranslation.tsx","../../client/useTranslator.ts","../../client/useLocale.ts","../../client/useSubscription.ts","../../client/useBroadcast.ts","../../client/OpenGraphImage.tsx","../../client/useAppIdMissmatch.ts"],"sourcesContent":["export class Subject<T> {\n subscribers = new Set<(value: T) => void>();\n value: T;\n\n constructor(initialValue: T) {\n this.value = initialValue;\n }\n\n public subscribe(subscriber: (value: T) => void) {\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n }\n\n public next(value: T) {\n this.value = value;\n this.subscribers.forEach((subscriber) => subscriber(value));\n }\n\n public getValue() {\n return this.value;\n }\n}\n","import { Subject } from \"../utils/Subject\";\n\ntype State = {\n loading: boolean;\n data: any;\n error: any;\n version: number;\n};\n\nexport const DEFAULT_STALE_TIME = 5000;\n\nexport class QueryResource {\n store: Subject<Map<string, State>>;\n staleVariants = new Set<string>();\n lastFetchRecord = new Map<string, number>();\n key: string;\n\n constructor(key: string, initialState: Record<string, any>) {\n this.key = key;\n this.store = new Subject(new Map());\n this.hydrate(initialState);\n }\n\n /**\n * Adopt server-prefetched data into the cache.\n *\n * Called once from the constructor for the SSR payload, and again on every\n * client-side navigation with the `prefetchedData` the server just produced —\n * otherwise the resource cache (which is keyed by path for the lifetime of\n * the app) would keep serving the first payload and revalidate it over `/api`.\n */\n hydrate(initialState: Record<string, any> | null | undefined) {\n const store = this.store.getValue();\n const now = Date.now();\n let changed = false;\n\n for (const [variantKey, data] of Object.entries(initialState ?? {})) {\n if (!data) continue;\n const current = store.get(variantKey);\n // Never clobber an in-flight fetch — `resolveVariant` flips `loading`\n // before its first await, so this also covers an optimistic `mutate`\n // whose refetch hasn't landed yet.\n if (current?.loading) continue;\n // Idempotent re-hydration (e.g. StrictMode's double invoke).\n if (current && current.data === data) continue;\n\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: now,\n });\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, now);\n changed = true;\n }\n\n if (changed) {\n this.store.next(store);\n }\n }\n\n /**\n * The cached state for a variant, or `undefined` — a plain read that never\n * fetches and never revalidates.\n *\n * `getVariant` is the read that keeps the cache honest, and it starts a\n * request when it has to. That makes it the wrong thing to call while\n * rendering: React throws away a render whose subtree suspends and retries\n * it, so every discarded attempt would leak a request. Renders read with\n * this; effects, which only run for a render that committed, use\n * `getVariant`.\n */\n peek(variantKey: string) {\n return this.store.getValue().get(variantKey);\n }\n\n getVariant(variantKey: string, staleTime: number = DEFAULT_STALE_TIME) {\n const store = this.store.getValue();\n if (!store.has(variantKey)) {\n this.resolveVariant(variantKey);\n } else {\n const variant = store.get(variantKey);\n\n if (!variant.loading) {\n // Don't have data\n if (!variant.data) {\n this.resolveVariant(variantKey);\n return store.get(variantKey);\n }\n if (variant.data) {\n const stale = this.staleVariants.has(variantKey);\n const now = Date.now();\n // `>=` so `staleTime: 0` means \"always revalidate\" and\n // `staleTime: Infinity` means \"never\".\n const old =\n now - (this.lastFetchRecord.get(variantKey) ?? now) >= staleTime;\n if (stale || old) {\n this.lastFetchRecord.set(variantKey, now);\n this.resolveVariant(variantKey, true);\n return store.get(variantKey);\n }\n }\n }\n }\n return store.get(variantKey);\n }\n\n mutate(variantKey: string, fn: (data: any) => any = (data) => data) {\n const cacheKey = [\n typeof window !== \"undefined\" && window.location?.origin\n ? window.location.origin\n : \"\",\n this.key,\n variantKey,\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n try {\n if (caches) {\n caches?.delete(cacheKey);\n }\n } catch (err) {}\n\n const store = this.store.getValue();\n const state = store.get(variantKey);\n if (!state || !state.data) {\n // Nothing is cached yet to update optimistically — e.g. a lazy query, or\n // one that hasn't resolved. Fall through to a refetch so `mutate(fn)` is\n // not a silent no-op (it still means \"go get the latest data\").\n this.resolveVariant(variantKey, false, false);\n return;\n }\n const data = fn(state.data);\n\n this.staleVariants.add(variantKey);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: state.version,\n }),\n );\n this.resolveVariant(variantKey, false, false);\n }\n\n refetch(variantKey: string) {\n this.resolveVariant(variantKey, false, false);\n }\n\n private async resolveVariant(\n variantKey: string,\n silent = false,\n cache = true,\n ) {\n if (typeof window === \"undefined\") {\n return;\n }\n const store = this.store.getValue();\n const previousState = store.get(variantKey);\n\n if (!silent) {\n store.set(variantKey, {\n loading: true,\n data: previousState?.data,\n error: previousState?.error,\n version: previousState?.version,\n });\n }\n\n let data = null;\n let response: Response | null = null;\n const fullUrl = [this.key, variantKey].filter((s) => s.length).join(\"?\");\n try {\n response = await fetch(`/api${fullUrl}`, {\n cache: cache ? \"default\" : \"reload\",\n });\n data = await response.json();\n } catch (error) {\n console.error(`Error fetching url /api${fullUrl}`, error);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error,\n version: previousState?.version,\n }),\n );\n return;\n }\n\n if (response!.ok) {\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data,\n error: null,\n version: Date.now(),\n }),\n );\n this.staleVariants.delete(variantKey);\n this.lastFetchRecord.set(variantKey, Date.now());\n } else {\n // this.lastFetchRecord.set(variantKey, 0);\n this.store.next(\n store.set(variantKey, {\n loading: false,\n data: previousState?.data,\n error: data,\n version: previousState?.version,\n }),\n );\n }\n }\n}\n","import {\n createContext,\n type PropsWithChildren,\n useCallback,\n useMemo,\n useRef,\n} from \"react\";\nimport { QueryResource } from \"./QueryResource\";\n\nexport type PrefetchedData = Record<string, Record<string, any>>;\n\nexport interface QueryManagerContextValue {\n getResource: (\n key: string,\n initialState?: Record<string, any>,\n ) => QueryResource;\n hydrate: (prefetchedData?: PrefetchedData | null) => void;\n}\n\nexport const QueryManagerContext = createContext<QueryManagerContextValue>({\n getResource: (key: string, initialState: Record<string, any> = {}) => {\n return new QueryResource(key, initialState);\n },\n hydrate: () => {},\n});\n\nexport const QueryManagerProvider = ({ children }: PropsWithChildren<{}>) => {\n const resourcesRef = useRef<Map<string, QueryResource>>(new Map());\n\n const getResource = useCallback(\n (key: string, initialState?: Record<string, any>) => {\n let resource = resourcesRef.current.get(key);\n if (!resource) {\n resource = new QueryResource(key, initialState ?? {});\n resourcesRef.current.set(key, resource);\n }\n return resource;\n },\n [],\n );\n\n // Resources are cached by path for the lifetime of the app, so `initialState`\n // above only ever applies to the first load. Every navigation ships a fresh\n // `prefetchedData` payload that has to be pushed into the existing resources,\n // otherwise the components mounting on the new surface refetch it over `/api`.\n const hydrate = useCallback((prefetchedData?: PrefetchedData | null) => {\n if (!prefetchedData) return;\n for (const [key, initialState] of Object.entries(prefetchedData)) {\n if (!initialState || typeof initialState !== \"object\") continue;\n const resource = resourcesRef.current.get(key);\n if (resource) {\n resource.hydrate(initialState);\n } else {\n resourcesRef.current.set(key, new QueryResource(key, initialState));\n }\n }\n }, []);\n\n const value = useMemo(\n () => ({ getResource, hydrate }),\n [getResource, hydrate],\n );\n\n return (\n <QueryManagerContext.Provider value={value}>\n {children}\n </QueryManagerContext.Provider>\n );\n};\n","export function applyParams<T extends string>(\n url: T,\n params: Record<string, string | number | undefined>,\n): string {\n return (\n url\n .replace(/:([^/]+[*?]?)/g, (_, key) => {\n const hasSuffix = key.endsWith(\"?\") || key.endsWith(\"*\");\n const paramName = hasSuffix ? key.slice(0, -1) : key;\n const value = params[paramName];\n\n if (value === undefined) {\n if (hasSuffix) {\n return \"\"; // Remove the optional segment if no value is provided\n }\n // @ts-ignore\n if (import.meta.env.DEV) {\n throw new Error(`Missing parameter: ${paramName}`);\n }\n console.error(`Missing parameter: ${paramName} in URL: ${url}`);\n }\n\n return String(value);\n })\n // remove double slashes\n .replace(/\\/\\//g, \"/\")\n // remove trailing slash\n .replace(/\\/$/, \"\")\n );\n}\n","export function omitNullishValues<T>(input: T) {\n return Object.fromEntries(\n Object.entries(input).filter(([, value]) => {\n return value !== null && value !== undefined;\n }),\n ) as T;\n}\n","import type { Action } from \"history\";\nimport { createContext, type PropsWithChildren } from \"react\";\n\nexport interface RouteState {\n views: string[];\n params: Record<string, string>;\n search: string;\n state: Record<string, unknown>;\n pathname: string;\n hash: string;\n action: Action | null;\n routePath: string;\n locale: string | null;\n}\n\nexport type PageData = {\n data: Record<string, unknown>;\n i18n: {\n currentLocale: string;\n dictionary: Record<string, Record<string, unknown>>;\n supportedLocales: string[];\n };\n prefetchedData: Record<string, unknown>;\n breadcrumbs: any;\n appId: string;\n};\n\nexport const RouteStateContext = createContext({} as RouteState & PageData);\n\nexport const RouteStateProvider = (\n props: PropsWithChildren<{\n state: RouteState & PageData;\n }>,\n) => {\n return (\n <RouteStateContext.Provider value={props.state}>\n {props.children}\n </RouteStateContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useParams() {\n const { params = {} } = useContext(RouteStateContext);\n return params;\n}\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useRouteData() {\n const { data, i18n, prefetchedData, breadcrumbs } =\n useContext(RouteStateContext);\n\n return { data, i18n, prefetchedData, breadcrumbs };\n}\n","export function isPlainObject(\n value: unknown,\n): value is Record<string, unknown> {\n return (\n value !== null &&\n typeof value === \"object\" &&\n !Array.isArray(value) &&\n Object.getPrototypeOf(value) === Object.prototype\n );\n}\n","import { useCallback, useContext, useEffect, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { NestedPrettify } from \"../utils/type\";\n\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport { DEFAULT_STALE_TIME } from \"./QueryResource\";\nimport { applyParams } from \"../utils/applyParams\";\nimport type { UrlParser } from \"./types\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\nimport { isPlainObject } from \"./isPlainObject\";\n\ninterface Config<T> {\n fallbackData?: T;\n keepPreviousData?: boolean;\n retryIntervalOnError?: number;\n refreshInterval?: number;\n /** How long cached data stays fresh before a read revalidates it, in ms. */\n staleTime?: number;\n debug?: boolean;\n lazy?: boolean;\n refetchUntil?: (data: T, duration: number) => number;\n}\n\ntype WithOptionalValues<T> = {\n [K in keyof T]: T[K] | null;\n};\n\nconst defaultConfig: Config<any> = {\n fallbackData: null,\n keepPreviousData: true,\n retryIntervalOnError: 10000,\n refreshInterval: 999999,\n staleTime: DEFAULT_STALE_TIME,\n debug: false,\n lazy: false,\n};\n\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<any, infer Data, any> ? UnwrapPromise<Data> : never;\n\ntype Input<T extends keyof GetRPC> =\n GetRPC[T] extends ApiRouterHandler<infer I, any, any> ? I : never;\n\ntype QueryOptions<T extends keyof GetRPC> = {\n search?: Partial<WithOptionalValues<Input<T>>>;\n};\n\ntype Error = Record<string, unknown>;\n\nconst defaultOptions: QueryOptions<any> & { params?: Record<string, any> } = {\n params: {} as Record<string, string>,\n search: {} as Record<string, string>,\n};\n\nexport type QueryResult<T extends keyof GetRPC> = NestedPrettify<Data<T> & {}>;\n\nexport function useQuery<T extends keyof GetRPC>(\n url: T,\n ...args: [\n options?: {\n search?: Record<string, string | number | boolean | null>;\n params?: Partial<UrlParser<`${T & string}`>>;\n },\n config?: Config<Data<T>>,\n ]\n) {\n const _params = useParams();\n const [_options = defaultOptions, _config = defaultConfig] = args;\n const options = { ...defaultOptions, ..._options };\n const config = { ...defaultConfig, ..._config };\n const params = \"params\" in options ? { ..._params, ...options.params } : _params;\n const paramsKey = JSON.stringify(params);\n const paramsRef = useRef(paramsKey);\n const search = \"search\" in options ? (options.search ?? {}) : {};\n const { getResource } = useContext(QueryManagerContext);\n const normalPath = applyParams(url, params);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n const { prefetchedData } = useRouteData();\n const fallbackData = config.fallbackData ?? prefetchedData?.[normalPath] ?? null;\n const refreshInterval = config.refreshInterval;\n const lazy = config.lazy;\n const [resource, setResource] = useState(() => getResource(normalPath, fallbackData));\n\n const configRef = useRef(config);\n configRef.current = config;\n\n const refreshIntervalRef = useRef<ReturnType<typeof setInterval> | null>(null);\n const retryIntervalRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const retryingMap = useRef<Map<string, boolean>>(new Map());\n const fetchedRef = useRef(!lazy);\n const refetchUntilTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const refetchUntilDurationRef = useRef(0);\n const prefetchedRef = useRef(false);\n const [state, setState] = useState(() => {\n if (lazy) {\n return { loading: false, data: null, error: null, version: 0 };\n }\n // Seed from the cache without touching the network — the mount effect below\n // calls `getVariant`, which is what fetches and revalidates. Fetching here\n // instead would fire a request for renders React discards: a layout renders\n // once per suspending descendant, and each attempt gets fresh hook state,\n // including a fresh `QueryResource`, so the in-flight guard cannot dedupe\n // them.\n //\n // An uncached variant seeds `undefined`, not a `{ data: null }` sentinel:\n // the returned `data` has to stay `undefined` so destructuring defaults\n // (`const { data: items = [] } = useQuery(...)`) still fire. The return\n // block below already reads through with `state?.` and defaults `loading`\n // to `true`.\n return resource.peek(variantKey);\n });\n\n const retry = useCallback(\n (vk: string) => {\n if (!retryingMap.current.get(vk)) {\n if (configRef.current.debug) console.log(\"retrying\", vk);\n retryingMap.current.set(vk, true);\n retryIntervalRef.current = setTimeout(() => {\n resource.getVariant(vk, configRef.current.staleTime);\n retryingMap.current.set(vk, false);\n }, configRef.current.retryIntervalOnError);\n }\n },\n [resource],\n );\n\n useEffect(() => {\n if (paramsKey !== paramsRef.current) {\n // Pass `fallbackData` so a params change into a route the server already\n // prefetched is served from the payload instead of a fresh request, and\n // read the variant off the *next* resource — `resource` still points at\n // the previous params' resource until React applies `setResource`.\n const nextResource = getResource(normalPath, fallbackData);\n setResource(nextResource);\n if (fetchedRef.current) {\n setState(\n nextResource.getVariant(variantKey, configRef.current.staleTime),\n );\n }\n paramsRef.current = paramsKey;\n }\n }, [paramsKey, normalPath, variantKey, getResource, fallbackData]);\n\n const handleReload = useCallback(() => {\n if (configRef.current.debug) {\n console.log(\"Reloading query for\", variantKey);\n }\n const data = resource.getVariant(\n variantKey,\n configRef.current.staleTime,\n ).data;\n resource.mutate(variantKey, () => data);\n }, [variantKey, resource]);\n\n useEffect(() => {\n if (!fetchedRef.current) return;\n refreshIntervalRef.current = setInterval(() => {\n handleReload();\n }, refreshInterval);\n\n return () => {\n if (refreshIntervalRef.current) {\n clearInterval(refreshIntervalRef.current);\n }\n };\n }, [refreshInterval, handleReload]);\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n const handleStateUpdate = useCallback(\n (nextState: ReturnType<typeof resource.getVariant>) => {\n const cfg = configRef.current;\n if (cfg.debug) {\n console.log(\"state updating due to url update\", variantKey);\n console.log(nextState);\n }\n if (nextState.error) {\n retry(variantKey);\n }\n if (cfg.keepPreviousData) {\n if (nextState.loading) {\n setState((s) => ({ ...s, loading: true }));\n } else {\n setState(nextState);\n }\n } else {\n setState(nextState);\n }\n\n if (cfg.refetchUntil && !nextState.loading && nextState.data && !nextState.error) {\n const nextDuration = cfg.refetchUntil(nextState.data, refetchUntilDurationRef.current);\n if (nextDuration > 0) {\n refetchUntilDurationRef.current = nextDuration;\n refetchUntilTimerRef.current = setTimeout(() => {\n resource.refetch(variantKey);\n }, nextDuration);\n } else {\n refetchUntilDurationRef.current = 0;\n }\n }\n },\n [variantKey, retry, resource],\n );\n\n useEffect(() => {\n if (fetchedRef.current) {\n handleStateUpdate(\n resource.getVariant(variantKey, configRef.current.staleTime),\n );\n }\n const unsub = resource.store.subscribe((store) => {\n const variant = store.get(variantKey);\n if (variant) {\n handleStateUpdate(variant);\n }\n });\n return () => {\n unsub();\n clearTimeout(retryIntervalRef.current);\n if (refetchUntilTimerRef.current) {\n clearTimeout(refetchUntilTimerRef.current);\n }\n };\n }, [variantKey, resource, handleStateUpdate]);\n\n const trigger = useCallback(() => {\n fetchedRef.current = true;\n const store = resource.store.getValue();\n const variant = store.get(variantKey);\n if (!variant || (!variant.loading && !variant.data)) {\n resource.refetch(variantKey);\n }\n }, [resource, variantKey]);\n\n const prefetch = useCallback(() => {\n if (prefetchedRef.current) return;\n prefetchedRef.current = true;\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n const refetch = useCallback(() => {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n }, [resource, variantKey]);\n\n function mutate(fn?: NestedPrettify<Data<T>>): void;\n function mutate(fn?: (data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>): void;\n function mutate(fn?: any) {\n if (!fn) {\n fetchedRef.current = true;\n resource.refetch(variantKey);\n return;\n }\n return resource.mutate(variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches so a stray value can't corrupt the\n // cache; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\"Mutate function must return an array when the current data is an array.\");\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\"Mutate function must return the same type as the current data.\");\n }\n\n return updatedData;\n });\n }\n\n return {\n data: state?.data as NestedPrettify<Data<T>>,\n loading: state?.loading ?? true,\n error: state?.error as Error,\n mutate,\n trigger,\n prefetch,\n version: state?.version as number,\n };\n}\n","import { useContext, useRef, useState } from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\n\ntype Methods = {\n POST: {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: RPC[K];\n };\n PUT: {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: RPC[K];\n };\n PATCH: {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: RPC[K];\n };\n DELETE: {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: RPC[K];\n };\n};\n\nfunction applyParams(url: string, params: Record<string, any> = {}) {\n let out = url;\n\n for (const [key, value] of Object.entries(params)) {\n out = out.replace(`:${key}?`, value).replace(`:${key}`, value);\n }\n return out;\n}\n\ntype Config<T> = {\n autoInvalidate?: boolean;\n onSuccess: (data: T) => void;\n onError: (error: MutationError) => void;\n onCanceled?: () => void;\n};\n\nconst defaultOptions: Config<any> = {\n autoInvalidate: false,\n onSuccess: () => {},\n onError: (_: MutationError) => {},\n onCanceled: () => {},\n};\n\ntype Data<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<any, infer T, any>\n ? UnwrapPromise<T>\n : never;\n\ntype Body<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> = Methods[M][K] extends ApiRouterHandler<infer T, any, any> ? T : never;\n\ntype MutationError =\n | {\n kind: \"validation_error\";\n messages: Record<string, any>;\n }\n | {\n kind: \"form_error\";\n message: string;\n }\n | {\n kind: \"server_error\";\n message: string;\n }\n | {\n kind: \"not_authorized\";\n message: string;\n }\n | {\n kind: \"insufficient_permissions\";\n message: string;\n };\n\ntype ParseParams<T> = UrlParser<`${T & string}`>;\n\ntype State<T> = {\n data: T | null;\n error: MutationError | null;\n loading: boolean;\n};\n\nexport function useMutation<\n M extends keyof Methods,\n K extends keyof Methods[M],\n T = Data<M, K>,\n U = Body<M, K>,\n>(\n method: M,\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>>, search?: Record<string, string> },\n config?: Partial<Config<T>>,\n ]\n) {\n const _params = useParams();\n const [state, setState] = useState<State<T>>({\n data: null,\n error: null,\n loading: false,\n });\n\n const [abortController, setAbortController] = useState(\n () => new AbortController(),\n );\n\n const formData = useRef(new FormData());\n\n async function trigger(input?: U): Promise<T> {\n setState({\n data: state.data,\n error: state.error,\n loading: true,\n });\n const [inputs = {}, options = defaultOptions] = args ?? [];\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const search = \"search\" in inputs ? inputs.search : {};\n const searchParams = new URLSearchParams(search);\n const finalUrl = [applyParams(String(url).replace(`${method}:`, \"\"), params), searchParams.toString()].filter(Boolean).join(\"?\");\n\n let body = null;\n\n const contentType =\n typeof input === \"undefined\" || input instanceof FormData\n ? {}\n : { \"Content-Type\": \"application/json\" };\n\n if (input instanceof FormData) {\n body = input;\n } else if (typeof input === \"undefined\") {\n body = formData.current;\n } else if (input) {\n body = JSON.stringify(input);\n }\n\n try {\n const response = await fetch(`/api${finalUrl}`, {\n method,\n headers: {\n ...contentType,\n },\n ...(body ? { body } : {}),\n signal: abortController.signal,\n });\n\n formData.current = new FormData();\n\n const data = await response.json();\n\n if (!response.ok) {\n setState({\n data: null,\n error: data.error,\n loading: false,\n });\n\n options?.onError?.(data);\n return;\n }\n\n options.onSuccess(data);\n\n setState({\n data,\n error: null,\n loading: false,\n });\n\n return data as any;\n } catch (error) {\n formData.current = new FormData();\n options?.onError?.(error);\n setState({\n data: null,\n error,\n loading: false,\n });\n }\n }\n\n trigger.formData = (formData: FormData) => {\n return trigger(formData as U);\n };\n\n return {\n data: state.data as T,\n error: state.error as any,\n loading: state.loading,\n formData: formData.current,\n cancel: () => {\n const [, options = defaultOptions] = args ?? [];\n abortController.abort();\n setAbortController(new AbortController());\n setState({\n data: state.data,\n error: state.error,\n loading: false,\n });\n\n formData.current = new FormData();\n options.onCanceled();\n },\n trigger,\n };\n}\n\nexport function usePost<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"POST\", url, ...(args as any));\n}\n\nexport function usePut<K extends keyof Methods[\"PUT\"], T = Data<\"PUT\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PUT\", url, ...(args as any));\n}\n\nexport function usePatch<\n K extends keyof Methods[\"PATCH\"],\n T = Data<\"PATCH\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"PATCH\", url, ...(args as any));\n}\n\nexport function useDelete<\n K extends keyof Methods[\"DELETE\"],\n T = Data<\"DELETE\", K>,\n>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n return useMutation(\"DELETE\", url, ...(args as any));\n}\n\nexport function useUpload<K extends keyof Methods[\"POST\"], T = Data<\"POST\", K>>(\n url: K,\n ...args: [\n options?: { params?: Partial<ParseParams<K>> },\n config?: Partial<Config<T>>,\n ]\n) {\n const [state, setState] = useState<\"idle\" | \"uploading\" | \"done\" | \"error\">(\n \"idle\",\n );\n const [progress, setProgress] = useState(0);\n const _params = useParams();\n const abortRef = useRef<VoidFunction | null>(null);\n\n const [inputs = {}, options = defaultOptions] = args ?? [];\n\n const cancel = () => {\n if (abortRef.current) {\n abortRef.current();\n options.onCanceled?.();\n setState(\"idle\");\n setProgress(0);\n }\n };\n\n const trigger = async (fileList: FileList | null | File): Promise<T> => {\n if (!fileList) {\n return;\n }\n const params =\n \"params\" in inputs ? { ..._params, ...inputs.params } : _params;\n const finalUrl = applyParams(String(url).replace(\"POST:\", \"\"), params);\n\n const method = \"POST\";\n const action = `/api${finalUrl}`;\n const data = new FormData();\n if (fileList instanceof FileList) {\n for (const file of Array.from(fileList)) {\n data.append(\"file\", file);\n }\n } else {\n data.append(\"file\", fileList);\n }\n const xhr = new XMLHttpRequest();\n abortRef.current = () => {\n xhr.abort();\n };\n\n try {\n const result = await new Promise<Response>((resolve, reject) => {\n xhr.responseType = \"blob\";\n xhr.onreadystatechange = async () => {\n if (xhr.readyState !== 4) {\n // done\n return;\n }\n\n const response = new Response(xhr.response, {\n status: xhr.status,\n statusText: xhr.statusText,\n });\n\n resolve(response);\n };\n\n xhr.addEventListener(\"error\", () => {\n reject(new TypeError(\"Failed to fetch\"));\n });\n\n xhr.upload.addEventListener(\"loadstart\", () => {\n setProgress(0);\n });\n xhr.upload.addEventListener(\"loadend\", () => {\n setProgress(1);\n });\n\n xhr.upload.addEventListener(\"progress\", (event) => {\n setProgress(event.loaded / event.total);\n });\n\n xhr.open(method, action, true);\n xhr.send(data);\n });\n setState(\"uploading\");\n if (!result.ok) {\n let error: MutationError = {\n kind: \"server_error\",\n message: result.statusText,\n };\n try {\n const data = await result.json();\n error = data.error;\n } catch (e) {\n // do nothing\n }\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n const json = await result.json();\n options?.onSuccess?.(json);\n return json;\n } catch (error) {\n setState(\"error\");\n options?.onError?.(error);\n return;\n }\n };\n\n return {\n state,\n progress,\n trigger,\n cancel,\n };\n}\n","import { useContext } from \"react\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport type { NestedPrettify, UnwrapPromise } from \"../utils/type\";\nimport { isPlainObject } from \"./isPlainObject\";\n\nimport type { RPC } from \"./rpc\";\nimport { QueryManagerContext } from \"./QueryManagerContext\";\nimport type { UrlParser } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { omitNullishValues } from \"../utils/omitNullishValues\";\ntype GetRPC = {\n [K in keyof RPC as K extends `GET:${infer P}` ? P : never]: RPC[K];\n};\n\ntype Data<T extends keyof GetRPC> = GetRPC[T] extends ApiRouterHandler<\n any,\n infer Data,\n any\n>\n ? UnwrapPromise<Data>\n : never;\n\nexport function useMutate() {\n const { getResource } = useContext(QueryManagerContext);\n return function mutate<T extends keyof GetRPC>(\n options: {\n path: T;\n params?: UrlParser<`${T & string}`>;\n search?: Record<string, any>;\n },\n fn?:\n | ((data: NestedPrettify<Data<T>>) => NestedPrettify<Data<T>>)\n | NestedPrettify<Data<T>>,\n ) {\n const { path, params = {}, search = {} } = options ?? {};\n const normalPath = applyParams(path, params);\n const resource = getResource(normalPath);\n const searchParams = new URLSearchParams(omitNullishValues(search));\n searchParams.sort();\n const variantKey = searchParams.toString();\n return resource.mutate.call(resource, variantKey, (data: any) => {\n if (data === undefined || data === null) {\n console.warn(\"Mutate function called before the query.\");\n return data;\n }\n\n if (!fn) {\n return data;\n }\n\n // The callback's return value *replaces* the cached data. The type checks\n // below only ensure the shape matches; they do not merge or append.\n const updatedData = typeof fn === \"function\" ? fn(data) : fn;\n\n if (isPlainObject(data)) {\n if (isPlainObject(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an object when the current data is an object.\",\n );\n }\n\n if (Array.isArray(data)) {\n if (Array.isArray(updatedData)) {\n return updatedData;\n }\n throw new Error(\n \"Mutate function must return an array when the current data is an array.\",\n );\n }\n\n if (typeof data !== typeof updatedData) {\n throw new Error(\n \"Mutate function must return the same type as the current data.\",\n );\n }\n\n return updatedData;\n });\n };\n}\n","import { createContext, type PropsWithChildren } from \"react\";\nimport type { Translations } from \"./I18nContext\";\nimport type { ComponentTree } from \"./types\";\nimport type { User } from \"../auth/adapters/types\";\n\ntype Data = Record<string, any>;\n\nexport interface ServerDataContextValue {\n routeManifest: Record<string, string[]>;\n pageData: Record<string, Record<string, Data>>;\n breadcrumbs: Record<string, { label: string; href: string }>;\n prefetchedData: Record<string, Data>;\n router: {\n pathname: string;\n params: Record<string, any>;\n currentPath: string;\n is404: boolean;\n searchParams: string;\n urlLocaleSegment: string | null;\n };\n i18n: {\n dictionary: Translations;\n currentLocale: string;\n supportedLocales: string[];\n defaultLocale: string;\n };\n componentTree: ComponentTree;\n auth: {\n user: User;\n };\n __csrf: string;\n cssManifest: Record<string, string[]>;\n meta: any;\n appId: string;\n}\n\nexport const ServerDataContext = createContext({} as ServerDataContextValue);\n\ninterface ServerDataProviderProps {\n value?: ServerDataContextValue;\n}\n\nexport const ServerDataProvider = (\n props: PropsWithChildren<ServerDataProviderProps>,\n) => {\n let _value = props.value;\n // Server\n if (props.value) {\n _value = props.value;\n } else {\n // Client\n _value = (window as any).__GEMI_DATA__;\n }\n\n return (\n <ServerDataContext.Provider value={_value}>\n {props.children}\n </ServerDataContext.Provider>\n );\n};\n","import {\n createContext,\n useContext,\n type ComponentProps,\n type FormEvent,\n useRef,\n useEffect,\n useSyncExternalStore,\n useCallback,\n} from \"react\";\nimport type { RPC } from \"./rpc\";\nimport type { ApiRouterHandler } from \"../http/ApiRouter\";\nimport { useMutation } from \"./useMutation\";\nimport type { UnwrapPromise } from \"../utils/type\";\nimport type { UrlParser } from \"./types\";\nimport { useParams } from \"./useParams\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { Subject } from \"../utils/Subject\";\n\ntype Any = any;\n\ninterface MutationContextValue {\n isPending: boolean;\n result: null | Any;\n validationErrors: Record<string, string[]>;\n formError: null | string;\n formDataSubject: React.RefObject<Subject<FormData>>;\n}\n\nconst MutationContext = createContext({\n isPending: false,\n result: null,\n} as MutationContextValue);\n\ntype GetResult<T> =\n T extends ApiRouterHandler<Any, infer Result, Any>\n ? UnwrapPromise<Result>\n : never;\n\ntype PostRequests = {\n [K in keyof RPC as K extends `POST:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PutRequests = {\n [K in keyof RPC as K extends `PUT:${infer P}` ? P : never]: GetResult<RPC[K]>;\n};\n\ntype DeleteRequests = {\n [K in keyof RPC as K extends `DELETE:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype PatchRequests = {\n [K in keyof RPC as K extends `PATCH:${infer P}` ? P : never]: GetResult<\n RPC[K]\n >;\n};\n\ntype Methods = {\n POST: PostRequests;\n PUT: PutRequests;\n DELETE: DeleteRequests;\n PATCH: PatchRequests;\n};\n\ninterface FormProps<\n M extends keyof Methods,\n K extends keyof Methods[M],\n> extends Omit<ComponentProps<\"form\">, \"action\" | \"onError\"> {\n method?: M;\n action: K;\n onSuccess?: (result: Methods[M][K], form: HTMLFormElement) => void;\n onError?: (error: Any, form: HTMLFormElement) => void;\n params?: Partial<UrlParser<`${K & string}`>>;\n search?: Record<string, string>;\n dynamicInputs?: (formData: FormData) => Record<string, any>;\n}\n\nexport function Form<\n K extends keyof Methods[T],\n T extends keyof Methods = \"POST\",\n>(props: FormProps<T, K>) {\n const _params = useParams();\n const {\n method = \"POST\",\n action,\n onSuccess = () => {},\n onError = () => {},\n params,\n search = {},\n className,\n dynamicInputs = () => ({}),\n ...formProps\n } = \"params\" in props\n ? { ...props, params: { ..._params, ...props.params } }\n : { ...props, params: _params };\n const formRef = useRef<HTMLFormElement>(null);\n const { __csrf } = useContext(ServerDataContext);\n const formDataSubject = useRef(new Subject(new FormData()));\n\n const updateFormData = useCallback(() => {\n formDataSubject.current.next(new FormData(formRef.current));\n }, []);\n\n useEffect(() => {\n if (!formRef.current) return;\n\n formRef.current.addEventListener(\"input\", updateFormData);\n\n const observer = new MutationObserver(() => {\n const formData = new FormData(formRef.current);\n formDataSubject.current.next(formData);\n });\n\n formRef.current.querySelectorAll(\"input\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"select\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n formRef.current.querySelectorAll(\"textarea\").forEach((input) =>\n observer.observe(input, {\n attributes: true,\n attributeFilter: [\"value\"],\n }),\n );\n\n return () => {\n observer.disconnect();\n if (formRef.current) {\n formRef.current.removeEventListener(\"input\", updateFormData);\n }\n };\n }, [updateFormData]);\n\n const { trigger, data, error, loading } = useMutation(\n method,\n String(action) as Any,\n {\n params,\n search,\n } as Any,\n {\n onSuccess: (data) => onSuccess(data as Any, formRef.current),\n onError: (error) => onError(error, formRef.current),\n },\n );\n\n const handleSubmit = async (e: FormEvent) => {\n if (loading) {\n return;\n }\n e.preventDefault();\n if (!formRef.current) {\n return;\n }\n const formData = new FormData(formRef.current);\n for (const [key, value] of Object.entries(dynamicInputs(formData))) {\n formData.append(key, value as any);\n }\n trigger(formData as any);\n };\n\n const validationErrors =\n error?.kind === \"validation_error\" ? error.messages : {};\n\n const formError = error?.kind === \"form_error\" ? error.message : null;\n\n return (\n <MutationContext.Provider\n value={{\n isPending: loading,\n result: data,\n validationErrors,\n formError,\n formDataSubject,\n }}\n >\n <form\n className={[\"group\", className].filter(Boolean).join(\" \")}\n data-loading={loading}\n ref={formRef}\n onSubmit={handleSubmit}\n {...formProps}\n >\n <input type=\"hidden\" name=\"__csrf\" value={__csrf} />\n {props.children}\n </form>\n </MutationContext.Provider>\n );\n}\n\nexport function useMutationStatus() {\n const { isPending } = useContext(MutationContext);\n\n return { isPending };\n}\n\nexport function useFormStatus() {\n const { isPending, validationErrors, formError } =\n useContext(MutationContext);\n\n return { isPending, validationErrors, formError };\n}\n\nexport function useFormData() {\n const context = useContext(MutationContext);\n\n const { formDataSubject } = context;\n\n return useSyncExternalStore(\n formDataSubject.current.subscribe.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n formDataSubject.current.getValue.bind(formDataSubject.current),\n );\n}\n\nexport const ValidationErrors = (props: {\n name: string;\n className?: string;\n render?: (props: ComponentProps<\"div\">) => React.JSX.Element;\n}) => {\n const {\n render = (props: ComponentProps<\"div\">) => <div {...props} />,\n name,\n } = props;\n const { validationErrors } = useContext(MutationContext);\n\n const Comp = render;\n\n if (validationErrors[name]?.length > 0) {\n return (\n <>\n {validationErrors[name].map((error) => {\n return (\n <Comp className={props.className} key={error}>\n {error}\n </Comp>\n );\n })}\n </>\n );\n }\n\n return null;\n};\n\nexport const FormFieldContainer = (\n props: ComponentProps<\"div\"> & { name: string },\n) => {\n const { name, children, ...rest } = props;\n const { validationErrors } = useContext(MutationContext);\n const errors = validationErrors[name] || [];\n return (\n <div data-has-error={errors.length > 0} {...rest}>\n {children}\n </div>\n );\n};\n\nexport const FormError = (props: ComponentProps<\"div\">) => {\n const { formError } = useContext(MutationContext);\n\n if (formError) {\n return <div {...props}>{formError}</div>;\n }\n\n return null;\n};\n","import { useContext } from \"react\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useLocation() {\n const ctx = useContext(RouteStateContext);\n if (!ctx) {\n throw new Error(\"Router context not found\");\n }\n const { hash, pathname, search, state, locale } = ctx;\n return {\n hash,\n key: pathname,\n pathname,\n search,\n state,\n locale,\n };\n}\n","function _extends() {\n return _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, _extends.apply(null, arguments);\n}\nexport { _extends as default };","import _extends from '@babel/runtime/helpers/esm/extends';\n\n/**\r\n * Actions represent the type of change to a location value.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#action\r\n */\nvar Action;\n\n(function (Action) {\n /**\r\n * A POP indicates a change to an arbitrary index in the history stack, such\r\n * as a back or forward navigation. It does not describe the direction of the\r\n * navigation, only that the current index changed.\r\n *\r\n * Note: This is the default action for newly created history objects.\r\n */\n Action[\"Pop\"] = \"POP\";\n /**\r\n * A PUSH indicates a new entry being added to the history stack, such as when\r\n * a link is clicked and a new page loads. When this happens, all subsequent\r\n * entries in the stack are lost.\r\n */\n\n Action[\"Push\"] = \"PUSH\";\n /**\r\n * A REPLACE indicates the entry at the current index in the history stack\r\n * being replaced by a new one.\r\n */\n\n Action[\"Replace\"] = \"REPLACE\";\n})(Action || (Action = {}));\n\nvar readOnly = process.env.NODE_ENV !== \"production\" ? function (obj) {\n return Object.freeze(obj);\n} : function (obj) {\n return obj;\n};\n\nfunction warning(cond, message) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== 'undefined') console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message); // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nvar BeforeUnloadEventType = 'beforeunload';\nvar HashChangeEventType = 'hashchange';\nvar PopStateEventType = 'popstate';\n/**\r\n * Browser history stores the location in regular URLs. This is the standard for\r\n * most web apps, but it requires some configuration on the server to ensure you\r\n * serve the same app at multiple URLs.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\r\n */\n\nfunction createBrowserHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$window = _options.window,\n window = _options$window === void 0 ? document.defaultView : _options$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _window$location = window.location,\n pathname = _window$location.pathname,\n search = _window$location.search,\n hash = _window$location.hash;\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation[0],\n nextLocation = _getIndexAndLocation[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better what\n // is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop);\n var action = Action.Pop;\n\n var _getIndexAndLocation2 = getIndexAndLocation(),\n index = _getIndexAndLocation2[0],\n location = _getIndexAndLocation2[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n } // state defaults to `null` because `window.history.state` does\n\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation3 = getIndexAndLocation();\n\n index = _getIndexAndLocation3[0];\n location = _getIndexAndLocation3[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr[0],\n url = _getHistoryStateAndUr[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr2 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr2[0],\n url = _getHistoryStateAndUr2[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Hash history stores the location in window.location.hash. This makes it ideal\r\n * for situations where you don't want to send the location to the server for\r\n * some reason, either because you do cannot configure it or the URL space is\r\n * reserved for something else.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\r\n */\n\nfunction createHashHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options2 = options,\n _options2$window = _options2.window,\n window = _options2$window === void 0 ? document.defaultView : _options2$window;\n var globalHistory = window.history;\n\n function getIndexAndLocation() {\n var _parsePath = parsePath(window.location.hash.substr(1)),\n _parsePath$pathname = _parsePath.pathname,\n pathname = _parsePath$pathname === void 0 ? '/' : _parsePath$pathname,\n _parsePath$search = _parsePath.search,\n search = _parsePath$search === void 0 ? '' : _parsePath$search,\n _parsePath$hash = _parsePath.hash,\n hash = _parsePath$hash === void 0 ? '' : _parsePath$hash;\n\n var state = globalHistory.state || {};\n return [state.idx, readOnly({\n pathname: pathname,\n search: search,\n hash: hash,\n state: state.usr || null,\n key: state.key || 'default'\n })];\n }\n\n var blockedPopTx = null;\n\n function handlePop() {\n if (blockedPopTx) {\n blockers.call(blockedPopTx);\n blockedPopTx = null;\n } else {\n var nextAction = Action.Pop;\n\n var _getIndexAndLocation4 = getIndexAndLocation(),\n nextIndex = _getIndexAndLocation4[0],\n nextLocation = _getIndexAndLocation4[1];\n\n if (blockers.length) {\n if (nextIndex != null) {\n var delta = index - nextIndex;\n\n if (delta) {\n // Revert the POP\n blockedPopTx = {\n action: nextAction,\n location: nextLocation,\n retry: function retry() {\n go(delta * -1);\n }\n };\n go(delta);\n }\n } else {\n // Trying to POP to a location with no index. We did not create\n // this location, so we can't effectively block the navigation.\n process.env.NODE_ENV !== \"production\" ? warning(false, // TODO: Write up a doc that explains our blocking strategy in\n // detail and link to it here so people can understand better\n // what is going on and how to avoid it.\n \"You are trying to block a POP navigation to a location that was not \" + \"created by the history library. The block will fail silently in \" + \"production, but in general you should do all navigation with the \" + \"history library (instead of using window.history.pushState directly) \" + \"to avoid this situation.\") : void 0;\n }\n } else {\n applyTx(nextAction);\n }\n }\n }\n\n window.addEventListener(PopStateEventType, handlePop); // popstate does not fire on hashchange in IE 11 and old (trident) Edge\n // https://developer.mozilla.org/de/docs/Web/API/Window/popstate_event\n\n window.addEventListener(HashChangeEventType, function () {\n var _getIndexAndLocation5 = getIndexAndLocation(),\n nextLocation = _getIndexAndLocation5[1]; // Ignore extraneous hashchange events.\n\n\n if (createPath(nextLocation) !== createPath(location)) {\n handlePop();\n }\n });\n var action = Action.Pop;\n\n var _getIndexAndLocation6 = getIndexAndLocation(),\n index = _getIndexAndLocation6[0],\n location = _getIndexAndLocation6[1];\n\n var listeners = createEvents();\n var blockers = createEvents();\n\n if (index == null) {\n index = 0;\n globalHistory.replaceState(_extends({}, globalHistory.state, {\n idx: index\n }), '');\n }\n\n function getBaseHref() {\n var base = document.querySelector('base');\n var href = '';\n\n if (base && base.getAttribute('href')) {\n var url = window.location.href;\n var hashIndex = url.indexOf('#');\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href;\n }\n\n function createHref(to) {\n return getBaseHref() + '#' + (typeof to === 'string' ? to : createPath(to));\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n hash: '',\n search: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function getHistoryStateAndUrl(nextLocation, index) {\n return [{\n usr: nextLocation.state,\n key: nextLocation.key,\n idx: index\n }, createHref(nextLocation)];\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction) {\n action = nextAction;\n\n var _getIndexAndLocation7 = getIndexAndLocation();\n\n index = _getIndexAndLocation7[0];\n location = _getIndexAndLocation7[1];\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr3 = getHistoryStateAndUrl(nextLocation, index + 1),\n historyState = _getHistoryStateAndUr3[0],\n url = _getHistoryStateAndUr3[1]; // TODO: Support forced reloading\n // try...catch because iOS limits us to 100 pushState calls :/\n\n\n try {\n globalHistory.pushState(historyState, '', url);\n } catch (error) {\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n applyTx(nextAction);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(nextLocation.pathname.charAt(0) === '/', \"Relative pathnames are not supported in hash history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n var _getHistoryStateAndUr4 = getHistoryStateAndUrl(nextLocation, index),\n historyState = _getHistoryStateAndUr4[0],\n url = _getHistoryStateAndUr4[1]; // TODO: Support forced reloading\n\n\n globalHistory.replaceState(historyState, '', url);\n applyTx(nextAction);\n }\n }\n\n function go(delta) {\n globalHistory.go(delta);\n }\n\n var history = {\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n var unblock = blockers.push(blocker);\n\n if (blockers.length === 1) {\n window.addEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n\n return function () {\n unblock(); // Remove the beforeunload listener so the document may\n // still be salvageable in the pagehide event.\n // See https://html.spec.whatwg.org/#unloading-documents\n\n if (!blockers.length) {\n window.removeEventListener(BeforeUnloadEventType, promptBeforeUnload);\n }\n };\n }\n };\n return history;\n}\n/**\r\n * Memory history stores the current location in memory. It is designed for use\r\n * in stateful non-browser environments like tests and React Native.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#creatememoryhistory\r\n */\n\nfunction createMemoryHistory(options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options3 = options,\n _options3$initialEntr = _options3.initialEntries,\n initialEntries = _options3$initialEntr === void 0 ? ['/'] : _options3$initialEntr,\n initialIndex = _options3.initialIndex;\n var entries = initialEntries.map(function (entry) {\n var location = readOnly(_extends({\n pathname: '/',\n search: '',\n hash: '',\n state: null,\n key: createKey()\n }, typeof entry === 'string' ? parsePath(entry) : entry));\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in createMemoryHistory({ initialEntries }) (invalid entry: \" + JSON.stringify(entry) + \")\") : void 0;\n return location;\n });\n var index = clamp(initialIndex == null ? entries.length - 1 : initialIndex, 0, entries.length - 1);\n var action = Action.Pop;\n var location = entries[index];\n var listeners = createEvents();\n var blockers = createEvents();\n\n function createHref(to) {\n return typeof to === 'string' ? to : createPath(to);\n }\n\n function getNextLocation(to, state) {\n if (state === void 0) {\n state = null;\n }\n\n return readOnly(_extends({\n pathname: location.pathname,\n search: '',\n hash: ''\n }, typeof to === 'string' ? parsePath(to) : to, {\n state: state,\n key: createKey()\n }));\n }\n\n function allowTx(action, location, retry) {\n return !blockers.length || (blockers.call({\n action: action,\n location: location,\n retry: retry\n }), false);\n }\n\n function applyTx(nextAction, nextLocation) {\n action = nextAction;\n location = nextLocation;\n listeners.call({\n action: action,\n location: location\n });\n }\n\n function push(to, state) {\n var nextAction = Action.Push;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n push(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.push(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n applyTx(nextAction, nextLocation);\n }\n }\n\n function replace(to, state) {\n var nextAction = Action.Replace;\n var nextLocation = getNextLocation(to, state);\n\n function retry() {\n replace(to, state);\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(location.pathname.charAt(0) === '/', \"Relative pathnames are not supported in memory history.replace(\" + JSON.stringify(to) + \")\") : void 0;\n\n if (allowTx(nextAction, nextLocation, retry)) {\n entries[index] = nextLocation;\n applyTx(nextAction, nextLocation);\n }\n }\n\n function go(delta) {\n var nextIndex = clamp(index + delta, 0, entries.length - 1);\n var nextAction = Action.Pop;\n var nextLocation = entries[nextIndex];\n\n function retry() {\n go(delta);\n }\n\n if (allowTx(nextAction, nextLocation, retry)) {\n index = nextIndex;\n applyTx(nextAction, nextLocation);\n }\n }\n\n var history = {\n get index() {\n return index;\n },\n\n get action() {\n return action;\n },\n\n get location() {\n return location;\n },\n\n createHref: createHref,\n push: push,\n replace: replace,\n go: go,\n back: function back() {\n go(-1);\n },\n forward: function forward() {\n go(1);\n },\n listen: function listen(listener) {\n return listeners.push(listener);\n },\n block: function block(blocker) {\n return blockers.push(blocker);\n }\n };\n return history;\n} ////////////////////////////////////////////////////////////////////////////////\n// UTILS\n////////////////////////////////////////////////////////////////////////////////\n\nfunction clamp(n, lowerBound, upperBound) {\n return Math.min(Math.max(n, lowerBound), upperBound);\n}\n\nfunction promptBeforeUnload(event) {\n // Cancel the event.\n event.preventDefault(); // Chrome (and legacy IE) requires returnValue to be set.\n\n event.returnValue = '';\n}\n\nfunction createEvents() {\n var handlers = [];\n return {\n get length() {\n return handlers.length;\n },\n\n push: function push(fn) {\n handlers.push(fn);\n return function () {\n handlers = handlers.filter(function (handler) {\n return handler !== fn;\n });\n };\n },\n call: function call(arg) {\n handlers.forEach(function (fn) {\n return fn && fn(arg);\n });\n }\n };\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n/**\r\n * Creates a string URL path from the given pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createpath\r\n */\n\n\nfunction createPath(_ref) {\n var _ref$pathname = _ref.pathname,\n pathname = _ref$pathname === void 0 ? '/' : _ref$pathname,\n _ref$search = _ref.search,\n search = _ref$search === void 0 ? '' : _ref$search,\n _ref$hash = _ref.hash,\n hash = _ref$hash === void 0 ? '' : _ref$hash;\n if (search && search !== '?') pathname += search.charAt(0) === '?' ? search : '?' + search;\n if (hash && hash !== '#') pathname += hash.charAt(0) === '#' ? hash : '#' + hash;\n return pathname;\n}\n/**\r\n * Parses a string URL path into its separate pathname, search, and hash components.\r\n *\r\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#parsepath\r\n */\n\nfunction parsePath(path) {\n var parsedPath = {};\n\n if (path) {\n var hashIndex = path.indexOf('#');\n\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n var searchIndex = path.indexOf('?');\n\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport { Action, createBrowserHistory, createHashHistory, createMemoryHistory, createPath, parsePath };\n//# sourceMappingURL=index.js.map\n","var Pe=Object.defineProperty;var a=(e,t)=>Pe(e,\"name\",{value:t,configurable:!0});var P=class{type=3;name=\"\";prefix=\"\";value=\"\";suffix=\"\";modifier=3;constructor(t,r,n,c,l,f){this.type=t,this.name=r,this.prefix=n,this.value=c,this.suffix=l,this.modifier=f}hasCustomName(){return this.name!==\"\"&&typeof this.name!=\"number\"}};a(P,\"Part\");var Re=/[$_\\p{ID_Start}]/u,Ee=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,v=\".*\";function Oe(e,t){return(t?/^[\\x00-\\xFF]*$/:/^[\\x00-\\x7F]*$/).test(e)}a(Oe,\"isASCII\");function D(e,t=!1){let r=[],n=0;for(;n<e.length;){let c=e[n],l=a(function(f){if(!t)throw new TypeError(f);r.push({type:\"INVALID_CHAR\",index:n,value:e[n++]})},\"ErrorOrInvalid\");if(c===\"*\"){r.push({type:\"ASTERISK\",index:n,value:e[n++]});continue}if(c===\"+\"||c===\"?\"){r.push({type:\"OTHER_MODIFIER\",index:n,value:e[n++]});continue}if(c===\"\\\\\"){r.push({type:\"ESCAPED_CHAR\",index:n++,value:e[n++]});continue}if(c===\"{\"){r.push({type:\"OPEN\",index:n,value:e[n++]});continue}if(c===\"}\"){r.push({type:\"CLOSE\",index:n,value:e[n++]});continue}if(c===\":\"){let f=\"\",s=n+1;for(;s<e.length;){let i=e.substr(s,1);if(s===n+1&&Re.test(i)||s!==n+1&&Ee.test(i)){f+=e[s++];continue}break}if(!f){l(`Missing parameter name at ${n}`);continue}r.push({type:\"NAME\",index:n,value:f}),n=s;continue}if(c===\"(\"){let f=1,s=\"\",i=n+1,o=!1;if(e[i]===\"?\"){l(`Pattern cannot start with \"?\" at ${i}`);continue}for(;i<e.length;){if(!Oe(e[i],!1)){l(`Invalid character '${e[i]}' at ${i}.`),o=!0;break}if(e[i]===\"\\\\\"){s+=e[i++]+e[i++];continue}if(e[i]===\")\"){if(f--,f===0){i++;break}}else if(e[i]===\"(\"&&(f++,e[i+1]!==\"?\")){l(`Capturing groups are not allowed at ${i}`),o=!0;break}s+=e[i++]}if(o)continue;if(f){l(`Unbalanced pattern at ${n}`);continue}if(!s){l(`Missing pattern at ${n}`);continue}r.push({type:\"REGEX\",index:n,value:s}),n=i;continue}r.push({type:\"CHAR\",index:n,value:e[n++]})}return r.push({type:\"END\",index:n,value:\"\"}),r}a(D,\"lexer\");function F(e,t={}){let r=D(e);t.delimiter??=\"/#?\",t.prefixes??=\"./\";let n=`[^${x(t.delimiter)}]+?`,c=[],l=0,f=0,s=\"\",i=new Set,o=a(u=>{if(f<r.length&&r[f].type===u)return r[f++].value},\"tryConsume\"),h=a(()=>o(\"OTHER_MODIFIER\")??o(\"ASTERISK\"),\"tryConsumeModifier\"),p=a(u=>{let d=o(u);if(d!==void 0)return d;let{type:g,index:y}=r[f];throw new TypeError(`Unexpected ${g} at ${y}, expected ${u}`)},\"mustConsume\"),A=a(()=>{let u=\"\",d;for(;d=o(\"CHAR\")??o(\"ESCAPED_CHAR\");)u+=d;return u},\"consumeText\"),xe=a(u=>u,\"DefaultEncodePart\"),N=t.encodePart||xe,H=\"\",$=a(u=>{H+=u},\"appendToPendingFixedValue\"),M=a(()=>{H.length&&(c.push(new P(3,\"\",\"\",N(H),\"\",3)),H=\"\")},\"maybeAddPartFromPendingFixedValue\"),X=a((u,d,g,y,Z)=>{let m=3;switch(Z){case\"?\":m=1;break;case\"*\":m=0;break;case\"+\":m=2;break}if(!d&&!g&&m===3){$(u);return}if(M(),!d&&!g){if(!u)return;c.push(new P(3,\"\",\"\",N(u),\"\",m));return}let S;g?g===\"*\"?S=v:S=g:S=n;let k=2;S===n?(k=1,S=\"\"):S===v&&(k=0,S=\"\");let E;if(d?E=d:g&&(E=l++),i.has(E))throw new TypeError(`Duplicate name '${E}'.`);i.add(E),c.push(new P(k,E,N(u),S,N(y),m))},\"addPart\");for(;f<r.length;){let u=o(\"CHAR\"),d=o(\"NAME\"),g=o(\"REGEX\");if(!d&&!g&&(g=o(\"ASTERISK\")),d||g){let m=u??\"\";t.prefixes.indexOf(m)===-1&&($(m),m=\"\"),M();let S=h();X(m,d,g,\"\",S);continue}let y=u??o(\"ESCAPED_CHAR\");if(y){$(y);continue}if(o(\"OPEN\")){let m=A(),S=o(\"NAME\"),k=o(\"REGEX\");!S&&!k&&(k=o(\"ASTERISK\"));let E=A();p(\"CLOSE\");let be=h();X(m,S,k,E,be);continue}M(),p(\"END\")}return c}a(F,\"parse\");function x(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(x,\"escapeString\");function B(e){return e&&e.ignoreCase?\"ui\":\"u\"}a(B,\"flags\");function q(e,t,r){return W(F(e,r),t,r)}a(q,\"stringToRegexp\");function T(e){switch(e){case 0:return\"*\";case 1:return\"?\";case 2:return\"+\";case 3:return\"\"}}a(T,\"modifierToString\");function W(e,t,r={}){r.delimiter??=\"/#?\",r.prefixes??=\"./\",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith=\"\";let n=r.start?\"^\":\"\";for(let s of e){if(s.type===3){s.modifier===3?n+=x(s.value):n+=`(?:${x(s.value)})${T(s.modifier)}`;continue}t&&t.push(s.name);let i=`[^${x(r.delimiter)}]+?`,o=s.value;if(s.type===1?o=i:s.type===0&&(o=v),!s.prefix.length&&!s.suffix.length){s.modifier===3||s.modifier===1?n+=`(${o})${T(s.modifier)}`:n+=`((?:${o})${T(s.modifier)})`;continue}if(s.modifier===3||s.modifier===1){n+=`(?:${x(s.prefix)}(${o})${x(s.suffix)})`,n+=T(s.modifier);continue}n+=`(?:${x(s.prefix)}`,n+=`((?:${o})(?:`,n+=x(s.suffix),n+=x(s.prefix),n+=`(?:${o}))*)${x(s.suffix)})`,s.modifier===0&&(n+=\"?\")}let c=`[${x(r.endsWith)}]|$`,l=`[${x(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${l}?`),r.endsWith.length?n+=`(?=${c})`:n+=\"$\",new RegExp(n,B(r));r.strict||(n+=`(?:${l}(?=${c}))?`);let f=!1;if(e.length){let s=e[e.length-1];s.type===3&&s.modifier===3&&(f=r.delimiter.indexOf(s)>-1)}return f||(n+=`(?=${l}|${c})`),new RegExp(n,B(r))}a(W,\"partsToRegexp\");var b={delimiter:\"\",prefixes:\"\",sensitive:!0,strict:!0},J={delimiter:\".\",prefixes:\"\",sensitive:!0,strict:!0},Q={delimiter:\"/\",prefixes:\"/\",sensitive:!0,strict:!0};function ee(e,t){return e.length?e[0]===\"/\"?!0:!t||e.length<2?!1:(e[0]==\"\\\\\"||e[0]==\"{\")&&e[1]==\"/\":!1}a(ee,\"isAbsolutePathname\");function te(e,t){return e.startsWith(t)?e.substring(t.length,e.length):e}a(te,\"maybeStripPrefix\");function ke(e,t){return e.endsWith(t)?e.substr(0,e.length-t.length):e}a(ke,\"maybeStripSuffix\");function _(e){return!e||e.length<2?!1:e[0]===\"[\"||(e[0]===\"\\\\\"||e[0]===\"{\")&&e[1]===\"[\"}a(_,\"treatAsIPv6Hostname\");var re=[\"ftp\",\"file\",\"http\",\"https\",\"ws\",\"wss\"];function U(e){if(!e)return!0;for(let t of re)if(e.test(t))return!0;return!1}a(U,\"isSpecialScheme\");function ne(e,t){if(e=te(e,\"#\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.hash=e,r.hash?r.hash.substring(1,r.hash.length):\"\"}a(ne,\"canonicalizeHash\");function se(e,t){if(e=te(e,\"?\"),t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.search=e,r.search?r.search.substring(1,r.search.length):\"\"}a(se,\"canonicalizeSearch\");function ie(e,t){return t||e===\"\"?e:_(e)?K(e):j(e)}a(ie,\"canonicalizeHostname\");function ae(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.password=e,r.password}a(ae,\"canonicalizePassword\");function oe(e,t){if(t||e===\"\")return e;let r=new URL(\"https://example.com\");return r.username=e,r.username}a(oe,\"canonicalizeUsername\");function ce(e,t,r){if(r||e===\"\")return e;if(t&&!re.includes(t))return new URL(`${t}:${e}`).pathname;let n=e[0]==\"/\";return e=new URL(n?e:\"/-\"+e,\"https://example.com\").pathname,n||(e=e.substring(2,e.length)),e}a(ce,\"canonicalizePathname\");function le(e,t,r){return z(t)===e&&(e=\"\"),r||e===\"\"?e:G(e)}a(le,\"canonicalizePort\");function fe(e,t){return e=ke(e,\":\"),t||e===\"\"?e:w(e)}a(fe,\"canonicalizeProtocol\");function z(e){switch(e){case\"ws\":case\"http\":return\"80\";case\"wws\":case\"https\":return\"443\";case\"ftp\":return\"21\";default:return\"\"}}a(z,\"defaultPortForProtocol\");function w(e){if(e===\"\")return e;if(/^[-+.A-Za-z0-9]*$/.test(e))return e.toLowerCase();throw new TypeError(`Invalid protocol '${e}'.`)}a(w,\"protocolEncodeCallback\");function he(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.username=e,t.username}a(he,\"usernameEncodeCallback\");function ue(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.password=e,t.password}a(ue,\"passwordEncodeCallback\");function j(e){if(e===\"\")return e;if(/[\\t\\n\\r #%/:<>?@[\\]^\\\\|]/g.test(e))throw new TypeError(`Invalid hostname '${e}'`);let t=new URL(\"https://example.com\");return t.hostname=e,t.hostname}a(j,\"hostnameEncodeCallback\");function K(e){if(e===\"\")return e;if(/[^0-9a-fA-F[\\]:]/g.test(e))throw new TypeError(`Invalid IPv6 hostname '${e}'`);return e.toLowerCase()}a(K,\"ipv6HostnameEncodeCallback\");function G(e){if(e===\"\"||/^[0-9]*$/.test(e)&&parseInt(e)<=65535)return e;throw new TypeError(`Invalid port '${e}'.`)}a(G,\"portEncodeCallback\");function de(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.pathname=e[0]!==\"/\"?\"/-\"+e:e,e[0]!==\"/\"?t.pathname.substring(2,t.pathname.length):t.pathname}a(de,\"standardURLPathnameEncodeCallback\");function pe(e){return e===\"\"?e:new URL(`data:${e}`).pathname}a(pe,\"pathURLPathnameEncodeCallback\");function ge(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.search=e,t.search.substring(1,t.search.length)}a(ge,\"searchEncodeCallback\");function me(e){if(e===\"\")return e;let t=new URL(\"https://example.com\");return t.hash=e,t.hash.substring(1,t.hash.length)}a(me,\"hashEncodeCallback\");var C=class{#i;#n=[];#t={};#e=0;#s=1;#l=0;#o=0;#d=0;#p=0;#g=!1;constructor(t){this.#i=t}get result(){return this.#t}parse(){for(this.#n=D(this.#i,!0);this.#e<this.#n.length;this.#e+=this.#s){if(this.#s=1,this.#n[this.#e].type===\"END\"){if(this.#o===0){this.#b(),this.#f()?this.#r(9,1):this.#h()?this.#r(8,1):this.#r(7,0);continue}else if(this.#o===2){this.#u(5);continue}this.#r(10,0);break}if(this.#d>0)if(this.#A())this.#d-=1;else continue;if(this.#T()){this.#d+=1;continue}switch(this.#o){case 0:this.#P()&&this.#u(1);break;case 1:if(this.#P()){this.#C();let t=7,r=1;this.#E()?(t=2,r=3):this.#g&&(t=2),this.#r(t,r)}break;case 2:this.#S()?this.#u(3):(this.#x()||this.#h()||this.#f())&&this.#u(5);break;case 3:this.#O()?this.#r(4,1):this.#S()&&this.#r(5,1);break;case 4:this.#S()&&this.#r(5,1);break;case 5:this.#y()?this.#p+=1:this.#w()&&(this.#p-=1),this.#k()&&!this.#p?this.#r(6,1):this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 6:this.#x()?this.#r(7,0):this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 7:this.#h()?this.#r(8,1):this.#f()&&this.#r(9,1);break;case 8:this.#f()&&this.#r(9,1);break;case 9:break;case 10:break}}this.#t.hostname!==void 0&&this.#t.port===void 0&&(this.#t.port=\"\")}#r(t,r){switch(this.#o){case 0:break;case 1:this.#t.protocol=this.#c();break;case 2:break;case 3:this.#t.username=this.#c();break;case 4:this.#t.password=this.#c();break;case 5:this.#t.hostname=this.#c();break;case 6:this.#t.port=this.#c();break;case 7:this.#t.pathname=this.#c();break;case 8:this.#t.search=this.#c();break;case 9:this.#t.hash=this.#c();break;case 10:break}this.#o!==0&&t!==10&&([1,2,3,4].includes(this.#o)&&[6,7,8,9].includes(t)&&(this.#t.hostname??=\"\"),[1,2,3,4,5,6].includes(this.#o)&&[8,9].includes(t)&&(this.#t.pathname??=this.#g?\"/\":\"\"),[1,2,3,4,5,6,7].includes(this.#o)&&t===9&&(this.#t.search??=\"\")),this.#R(t,r)}#R(t,r){this.#o=t,this.#l=this.#e+r,this.#e+=r,this.#s=0}#b(){this.#e=this.#l,this.#s=0}#u(t){this.#b(),this.#o=t}#m(t){return t<0&&(t=this.#n.length-t),t<this.#n.length?this.#n[t]:this.#n[this.#n.length-1]}#a(t,r){let n=this.#m(t);return n.value===r&&(n.type===\"CHAR\"||n.type===\"ESCAPED_CHAR\"||n.type===\"INVALID_CHAR\")}#P(){return this.#a(this.#e,\":\")}#E(){return this.#a(this.#e+1,\"/\")&&this.#a(this.#e+2,\"/\")}#S(){return this.#a(this.#e,\"@\")}#O(){return this.#a(this.#e,\":\")}#k(){return this.#a(this.#e,\":\")}#x(){return this.#a(this.#e,\"/\")}#h(){if(this.#a(this.#e,\"?\"))return!0;if(this.#n[this.#e].value!==\"?\")return!1;let t=this.#m(this.#e-1);return t.type!==\"NAME\"&&t.type!==\"REGEX\"&&t.type!==\"CLOSE\"&&t.type!==\"ASTERISK\"}#f(){return this.#a(this.#e,\"#\")}#T(){return this.#n[this.#e].type==\"OPEN\"}#A(){return this.#n[this.#e].type==\"CLOSE\"}#y(){return this.#a(this.#e,\"[\")}#w(){return this.#a(this.#e,\"]\")}#c(){let t=this.#n[this.#e],r=this.#m(this.#l).index;return this.#i.substring(r,t.index)}#C(){let t={};Object.assign(t,b),t.encodePart=w;let r=q(this.#c(),void 0,t);this.#g=U(r)}};a(C,\"Parser\");var V=[\"protocol\",\"username\",\"password\",\"hostname\",\"port\",\"pathname\",\"search\",\"hash\"],O=\"*\";function Se(e,t){if(typeof e!=\"string\")throw new TypeError(\"parameter 1 is not of type 'string'.\");let r=new URL(e,t);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==\"\"?r.search.substring(1,r.search.length):void 0,hash:r.hash!==\"\"?r.hash.substring(1,r.hash.length):void 0}}a(Se,\"extractValues\");function R(e,t){return t?I(e):e}a(R,\"processBaseURLString\");function L(e,t,r){let n;if(typeof t.baseURL==\"string\")try{n=new URL(t.baseURL),t.protocol===void 0&&(e.protocol=R(n.protocol.substring(0,n.protocol.length-1),r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&(e.username=R(n.username,r)),!r&&t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.username===void 0&&t.password===void 0&&(e.password=R(n.password,r)),t.protocol===void 0&&t.hostname===void 0&&(e.hostname=R(n.hostname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&(e.port=R(n.port,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&(e.pathname=R(n.pathname,r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&(e.search=R(n.search.substring(1,n.search.length),r)),t.protocol===void 0&&t.hostname===void 0&&t.port===void 0&&t.pathname===void 0&&t.search===void 0&&t.hash===void 0&&(e.hash=R(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${t.baseURL}'.`)}if(typeof t.protocol==\"string\"&&(e.protocol=fe(t.protocol,r)),typeof t.username==\"string\"&&(e.username=oe(t.username,r)),typeof t.password==\"string\"&&(e.password=ae(t.password,r)),typeof t.hostname==\"string\"&&(e.hostname=ie(t.hostname,r)),typeof t.port==\"string\"&&(e.port=le(t.port,e.protocol,r)),typeof t.pathname==\"string\"){if(e.pathname=t.pathname,n&&!ee(e.pathname,r)){let c=n.pathname.lastIndexOf(\"/\");c>=0&&(e.pathname=R(n.pathname.substring(0,c+1),r)+e.pathname)}e.pathname=ce(e.pathname,e.protocol,r)}return typeof t.search==\"string\"&&(e.search=se(t.search,r)),typeof t.hash==\"string\"&&(e.hash=ne(t.hash,r)),e}a(L,\"applyInit\");function I(e){return e.replace(/([+*?:{}()\\\\])/g,\"\\\\$1\")}a(I,\"escapePatternString\");function Te(e){return e.replace(/([.+*?^${}()[\\]|/\\\\])/g,\"\\\\$1\")}a(Te,\"escapeRegexpString\");function Ae(e,t){t.delimiter??=\"/#?\",t.prefixes??=\"./\",t.sensitive??=!1,t.strict??=!1,t.end??=!0,t.start??=!0,t.endsWith=\"\";let r=\".*\",n=`[^${Te(t.delimiter)}]+?`,c=/[$_\\u200C\\u200D\\p{ID_Continue}]/u,l=\"\";for(let f=0;f<e.length;++f){let s=e[f];if(s.type===3){if(s.modifier===3){l+=I(s.value);continue}l+=`{${I(s.value)}}${T(s.modifier)}`;continue}let i=s.hasCustomName(),o=!!s.suffix.length||!!s.prefix.length&&(s.prefix.length!==1||!t.prefixes.includes(s.prefix)),h=f>0?e[f-1]:null,p=f<e.length-1?e[f+1]:null;if(!o&&i&&s.type===1&&s.modifier===3&&p&&!p.prefix.length&&!p.suffix.length)if(p.type===3){let A=p.value.length>0?p.value[0]:\"\";o=c.test(A)}else o=!p.hasCustomName();if(!o&&!s.prefix.length&&h&&h.type===3){let A=h.value[h.value.length-1];o=t.prefixes.includes(A)}o&&(l+=\"{\"),l+=I(s.prefix),i&&(l+=`:${s.name}`),s.type===2?l+=`(${s.value})`:s.type===1?i||(l+=`(${n})`):s.type===0&&(!i&&(!h||h.type===3||h.modifier!==3||o||s.prefix!==\"\")?l+=\"*\":l+=`(${r})`),s.type===1&&i&&s.suffix.length&&c.test(s.suffix[0])&&(l+=\"\\\\\"),l+=I(s.suffix),o&&(l+=\"}\"),s.modifier!==3&&(l+=T(s.modifier))}return l}a(Ae,\"partsToPattern\");var Y=class{#i;#n={};#t={};#e={};#s={};#l=!1;constructor(t={},r,n){try{let c;if(typeof r==\"string\"?c=r:n=r,typeof t==\"string\"){let i=new C(t);if(i.parse(),t=i.result,c===void 0&&typeof t.protocol!=\"string\")throw new TypeError(\"A base URL must be provided for a relative constructor string.\");t.baseURL=c}else{if(!t||typeof t!=\"object\")throw new TypeError(\"parameter 1 is not of type 'string' and cannot convert to dictionary.\");if(c)throw new TypeError(\"parameter 1 is not of type 'string'.\")}typeof n>\"u\"&&(n={ignoreCase:!1});let l={ignoreCase:n.ignoreCase===!0},f={pathname:O,protocol:O,username:O,password:O,hostname:O,port:O,search:O,hash:O};this.#i=L(f,t,!0),z(this.#i.protocol)===this.#i.port&&(this.#i.port=\"\");let s;for(s of V){if(!(s in this.#i))continue;let i={},o=this.#i[s];switch(this.#t[s]=[],s){case\"protocol\":Object.assign(i,b),i.encodePart=w;break;case\"username\":Object.assign(i,b),i.encodePart=he;break;case\"password\":Object.assign(i,b),i.encodePart=ue;break;case\"hostname\":Object.assign(i,J),_(o)?i.encodePart=K:i.encodePart=j;break;case\"port\":Object.assign(i,b),i.encodePart=G;break;case\"pathname\":U(this.#n.protocol)?(Object.assign(i,Q,l),i.encodePart=de):(Object.assign(i,b,l),i.encodePart=pe);break;case\"search\":Object.assign(i,b,l),i.encodePart=ge;break;case\"hash\":Object.assign(i,b,l),i.encodePart=me;break}try{this.#s[s]=F(o,i),this.#n[s]=W(this.#s[s],this.#t[s],i),this.#e[s]=Ae(this.#s[s],i),this.#l=this.#l||this.#s[s].some(h=>h.type===2)}catch{throw new TypeError(`invalid ${s} pattern '${this.#i[s]}'.`)}}}catch(c){throw new TypeError(`Failed to construct 'URLPattern': ${c.message}`)}}get[Symbol.toStringTag](){return\"URLPattern\"}test(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return!1;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return!1}let c;for(c of V)if(!this.#n[c].exec(n[c]))return!1;return!0}exec(t={},r){let n={pathname:\"\",protocol:\"\",username:\"\",password:\"\",hostname:\"\",port:\"\",search:\"\",hash:\"\"};if(typeof t!=\"string\"&&r)throw new TypeError(\"parameter 1 is not of type 'string'.\");if(typeof t>\"u\")return;try{typeof t==\"object\"?n=L(n,t,!1):n=L(n,Se(t,r),!1)}catch{return null}let c={};r?c.inputs=[t,r]:c.inputs=[t];let l;for(l of V){let f=this.#n[l].exec(n[l]);if(!f)return null;let s={};for(let[i,o]of this.#t[l].entries())if(typeof o==\"string\"||typeof o==\"number\"){let h=f[i+1];s[o]=h}c[l]={input:n[l]??\"\",groups:s}}return c}static compareComponent(t,r,n){let c=a((i,o)=>{for(let h of[\"type\",\"modifier\",\"prefix\",\"value\",\"suffix\"]){if(i[h]<o[h])return-1;if(i[h]===o[h])continue;return 1}return 0},\"comparePart\"),l=new P(3,\"\",\"\",\"\",\"\",3),f=new P(0,\"\",\"\",\"\",\"\",3),s=a((i,o)=>{let h=0;for(;h<Math.min(i.length,o.length);++h){let p=c(i[h],o[h]);if(p)return p}return i.length===o.length?0:c(i[h]??l,o[h]??l)},\"comparePartList\");return!r.#e[t]&&!n.#e[t]?0:r.#e[t]&&!n.#e[t]?s(r.#s[t],[f]):!r.#e[t]&&n.#e[t]?s([f],n.#s[t]):s(r.#s[t],n.#s[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#l}};a(Y,\"URLPattern\");export{Y as URLPattern};\n","import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n","export function sleep(time: number) {\n return new Promise((resolve) => setTimeout(resolve, time));\n}\n","import { Subject } from \"../utils/Subject\";\nimport { sleep } from \"../utils/sleep\";\n\nexport class ProgressManager {\n state = new Subject(100);\n unsubscribe: ReturnType<InstanceType<typeof Subject>[\"subscribe\"]>;\n timer: ReturnType<typeof setInterval>;\n tick = 0;\n isTicking = false;\n\n constructor(subject: Subject<boolean>) {\n this.unsubscribe = subject.subscribe((state) => {\n if (state) {\n this.start();\n } else {\n this.end();\n }\n });\n }\n\n getNextIncrement() {\n const current = this.state.getValue();\n if (current === 100) {\n return Math.ceil(Math.random() * 10);\n }\n\n if (current <= 20) {\n if (Math.ceil(Math.random() * 100) > 80) {\n return current;\n }\n return current + Math.ceil(Math.random() * 5) + 1;\n }\n\n if (current <= 50) {\n if (Math.ceil(Math.random() * 100) > 50) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 10), 70);\n }\n\n if (current <= 70) {\n if (Math.ceil(Math.random() * 100) > 60) {\n return current;\n }\n return Math.min(current + Math.ceil(Math.random() * 3), 80);\n }\n\n if (current <= 80) {\n return Math.min(current + Math.ceil(Math.random() * 1), 90);\n }\n\n if (current <= 90) {\n const x = Math.ceil(Math.random() * 100) > 50 ? 0 : 1;\n return Math.min(current + x, 94);\n }\n\n if (current <= 94) {\n const x = Math.ceil(Math.random() * 100) > 20 ? 0 : 1;\n return Math.min(current + x, 99);\n }\n }\n\n getNextInterval() {\n if (this.tick === 0) {\n this.tick = 1;\n return 200;\n }\n const current = this.state.getValue();\n\n if (current >= 88) {\n return 400;\n }\n if (current >= 94) {\n return 1000;\n }\n if (current >= 98) {\n return 2000;\n }\n return 100;\n }\n\n async nextTick() {\n if (!this.isTicking) {\n return;\n }\n await sleep(this.getNextInterval());\n\n if (!this.isTicking) {\n return;\n }\n\n const increment = this.getNextIncrement();\n this.state.next(Math.min(increment, 96));\n\n await this.nextTick();\n }\n\n start() {\n this.isTicking = true;\n this.nextTick();\n }\n\n end() {\n this.state.next(99);\n this.isTicking = false;\n this.tick = 0;\n setTimeout(() => {\n this.state.next(100);\n }, 200);\n }\n\n destroy() {\n this.end();\n this.unsubscribe();\n }\n}\n","import { useContext } from \"react\";\nimport type { ViewPaths } from \"./types\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\ntype Pathname = ViewPaths;\n\nexport function useRoute() {\n const { pathname: _pathname } = useContext(RouteStateContext);\n return {\n pathname: _pathname,\n startsWith: (pathname: Pathname) => {\n return _pathname.startsWith(pathname);\n },\n };\n}\n","import { useEffect, useState } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useSearchParams } from \"./useSearchParams\";\nimport { useRoute } from \"./useRoute\";\nimport { useParams } from \"./useParams\";\nimport { createPortal } from \"react-dom\";\n\nexport const HttpReload = () => {\n const { replace } = useNavigate();\n const searchParams = useSearchParams();\n const { pathname } = useRoute();\n const params = useParams();\n const [reloading, setReloading] = useState(false);\n\n const handleReload = () => {\n // The server recovered, so dismiss any Vite error overlay left on the page\n // (each element exposes a `close()` that also tears down its listeners).\n if (typeof document !== \"undefined\") {\n document.querySelectorAll(\"vite-error-overlay\").forEach((el: any) => {\n if (typeof el.close === \"function\") el.close();\n else el.remove();\n });\n }\n setReloading(true);\n // replace(pathname, {\n // params: params,\n // search: searchParams.toJSON(),\n // } as any)\n // .catch(console.log)\n // .finally(() => {\n // setReloading(false);\n // });\n };\n\n useEffect(() => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.on(\"http-reload\", handleReload);\n }\n return () => {\n // @ts-ignore\n if (import.meta.hot) {\n // @ts-ignore\n import.meta.hot.off(\"http-reload\", handleReload);\n }\n };\n }, [handleReload]);\n\n if (!reloading || typeof document === \"undefined\") {\n return null;\n }\n return createPortal(\n <div className=\"fixed z-[1000] bottom-0 right-0 p-2\">\n <div className=\"p-2 bg-white text-black rounded-md shadow-md\">...</div>\n </div>,\n document.body,\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useContext,\n useRef,\n useState,\n} from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\ntype TranslationScope = Record<string, string>;\ntype TranslationScopes = Record<string, TranslationScope>;\nexport type Translations = Record<string, TranslationScopes>;\n\ninterface I18nContextValue {\n locale: string;\n changeLocale: (locale: string) => void;\n updateDictionary: (\n translations: Record<string, Record<string, Record<string, string>>>,\n locale?: string,\n ) => void;\n fetchTranslations: (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => Promise<void>;\n getComponentTranslations: (key: string) => Record<string, string>;\n supportedLocales: string[];\n defaultLocale: string;\n}\n\nexport type CreateI18nDictionary<T> = {\n [K in keyof T]: T[K];\n};\n\nexport const I18nContext = createContext({} as I18nContextValue);\n\nexport type Dictionary = Map<string, Map<string, Record<string, string>>>;\n\nexport const I18nProvider = (props: PropsWithChildren) => {\n const { i18n } = useContext(ServerDataContext);\n\n const [currentLocale, setCurrentLocale] = useState(i18n.currentLocale);\n\n const dictionary = useRef<Dictionary>(\n (() => {\n const dictionary = new Map();\n for (const [locale, value] of Object.entries(i18n?.dictionary ?? {})) {\n const components = new Map();\n for (const [component, translations] of Object.entries(value)) {\n components.set(component, translations);\n }\n dictionary.set(locale, components);\n }\n return dictionary;\n })(),\n );\n\n function updateDictionary(\n translations: Record<string, Record<string, Record<string, string>>> = {},\n locale?: string,\n ) {\n for (const [locale, value] of Object.entries(translations)) {\n if (!dictionary.current.has(locale)) {\n dictionary.current.set(locale, new Map());\n }\n const scopes = dictionary.current.get(locale);\n for (const [scope, translations] of Object.entries(value)) {\n if (!scopes.has(scope)) {\n scopes.set(scope, {});\n }\n scopes.set(scope, translations);\n }\n }\n changeLocale(locale);\n }\n\n const changeLocale = (locale: string) => {\n if (dictionary.current.has(locale)) {\n setCurrentLocale(locale);\n }\n };\n\n const getTranslations = (locale: string) => {\n return (component: string) => {\n return dictionary.current.get(locale).get(component);\n };\n };\n\n const fetchTranslations = async (\n pathname: string,\n locale?: string,\n signal?: AbortSignal,\n ) => {\n if (Object.keys(i18n).length === 0) {\n return;\n }\n const response = await fetch(\n `/api/__gemi__/services/i18n/translations/${\n locale || currentLocale\n }${pathname === \"/\" ? \"\" : pathname}`,\n {\n signal,\n },\n );\n const translations = await response.json();\n updateDictionary(translations);\n };\n\n return (\n <I18nContext.Provider\n value={{\n getComponentTranslations: getTranslations(currentLocale),\n locale: currentLocale,\n changeLocale,\n updateDictionary,\n fetchTranslations,\n supportedLocales: i18n.supportedLocales,\n defaultLocale: i18n.defaultLocale,\n }}\n >\n {props.children}\n </I18nContext.Provider>\n );\n};\n","import { type Action, type History, createBrowserHistory } from \"history\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type PropsWithChildren,\n} from \"react\";\nimport { Subject } from \"../utils/Subject\";\n// @ts-ignore\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { ProgressManager } from \"./ProgressManager\";\nimport { HttpReload } from \"./HttpReload\";\nimport type { Breadcrumb } from \"./useBreadcrumbs\";\nimport type { RouteState } from \"./RouteStateContext\";\nimport { I18nContext } from \"./I18nContext\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n }\n}\n\ninterface ClientRouterContextValue {\n viewEntriesSubject: Subject<string[]>;\n history: History | null;\n updatePageData: (\n pageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => void;\n getPageData: (key: string, pathname: string) => Record<string, unknown>;\n getScrollPosition: (path: string) => number;\n getViewPathsFromPathname: (pathname: string) => string[];\n getRoutePathnameFromHref: (href: string) => string | null;\n isNavigatingSubject: Subject<boolean>;\n setNavigationAbortController: (controller: AbortController) => void;\n progressManager: ProgressManager;\n fetchRouteCSS: (routePath: string) => Promise<void>;\n breadcrumbsCache: Map<string, Breadcrumb>;\n routerSubject: Subject<RouteState>;\n urlLocaleSegment: string | null;\n}\n\nexport const ClientRouterContext = createContext(\n {} as ClientRouterContextValue,\n);\n\ninterface ClientRouterProviderProps {\n pathname: string;\n routeManifest: Record<string, string[]>;\n cssManifest: Record<string, string[]>;\n pageData: Record<string, unknown>;\n currentPath: string;\n urlLocaleSegment: string | null;\n params: Record<string, string>;\n searchParams: string;\n is404: boolean;\n is500: boolean;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\nexport const ClientRouterProvider = (\n props: PropsWithChildren<ClientRouterProviderProps>,\n) => {\n const {\n children,\n pathname,\n currentPath,\n is404,\n is500,\n routeManifest,\n cssManifest,\n pageData,\n params,\n searchParams,\n breadcrumbs,\n urlLocaleSegment,\n } = props;\n const navigationAbortControllerRef = useRef(new AbortController());\n const [isNavigatingSubject] = useState(() => {\n return new Subject<boolean>(false);\n });\n\n const { supportedLocales = [], locale } = useContext(I18nContext);\n\n const [progressManager] = useState(new ProgressManager(isNavigatingSubject));\n const pageDataRef = useRef(structuredClone(pageData));\n const scrollHistoryRef = useRef<Map<string, number>>(new Map());\n const breadcrumbsCache = useRef<Map<string, Breadcrumb>>(\n new Map(Object.entries(breadcrumbs)),\n );\n\n const initalViewEntries = is404\n ? [\"404\"]\n : is500\n ? [\"500\"]\n : (routeManifest[pathname] ?? [\"404\"]);\n const viewEntriesSubject = useRef(new Subject<string[]>(initalViewEntries));\n\n const [routerSubject] = useState(() => {\n return new Subject<RouteState>({\n views: initalViewEntries,\n params,\n search: searchParams,\n state: {},\n pathname,\n hash: \"\",\n action: null as Action | null,\n routePath: currentPath,\n locale,\n });\n });\n\n const [history] = useState<History | null>(() => {\n let history: History | null = null;\n\n if (typeof window !== \"undefined\") {\n history = createBrowserHistory();\n }\n return history;\n });\n\n const findMatchingRouteFromParams = useMemo(\n () => (pathname: string) => {\n let routePath = pathname.replace(\"/en-US\", \"\").replace(\"/tr-TR\", \"\");\n routePath = routePath === \"\" ? \"/\" : routePath;\n const candidates: string[] = [];\n for (const route of Object.keys(routeManifest)) {\n const urlPattern = new URLPattern({ pathname: route });\n if (urlPattern.test({ pathname: routePath })) {\n candidates.push(route);\n }\n }\n const sortedCandidates = candidates.sort((a, b) => {\n const x = a.split(\"/\").length + a.split(\":\").length;\n const y = b.split(\"/\").length + b.split(\":\").length;\n return x - y;\n });\n\n return (sortedCandidates ?? [])[0];\n },\n [routeManifest],\n );\n\n const getViewPathsFromPathname = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n return routeManifest[route] ?? [];\n },\n [findMatchingRouteFromParams, routeManifest],\n );\n\n const getRoutePathnameFromHref = useMemo(\n () => (href: string) => {\n const route = findMatchingRouteFromParams(href);\n return route;\n },\n [findMatchingRouteFromParams],\n );\n\n const getParams = useMemo(\n () => (pathname: string) => {\n const route = findMatchingRouteFromParams(pathname);\n const urlPattern = new URLPattern({ pathname: route });\n return urlPattern.exec({ pathname })?.pathname.groups ?? {};\n },\n [findMatchingRouteFromParams],\n );\n\n useEffect(() => {\n history?.listen(({ location, action }) => {\n if (!window.scrollHistory) {\n window.scrollHistory = new Map();\n }\n const { hash, pathname, search } = routerSubject.getValue();\n const key = [pathname, search, hash].join(\"\");\n window.scrollHistory.set(key, window.scrollY);\n let _pathname = location.pathname;\n let _locale = null;\n for (const locale of supportedLocales) {\n if (_pathname.startsWith(`/${locale}`)) {\n _locale = locale;\n _pathname = _pathname.replace(`/${locale}`, \"\");\n break;\n }\n }\n _pathname = _pathname === \"\" ? \"/\" : _pathname;\n const routePath = getRoutePathnameFromHref(_pathname);\n routerSubject.next({\n views: getViewPathsFromPathname(_pathname),\n params: getParams(_pathname),\n search: location.search,\n state: location.state as Record<string, unknown>,\n pathname: _pathname,\n action,\n routePath,\n hash: location.hash,\n locale: _locale,\n });\n });\n }, [\n supportedLocales,\n history,\n routerSubject,\n getParams,\n getRoutePathnameFromHref,\n getViewPathsFromPathname,\n ]);\n\n const updatePageData = (\n newPageData: Record<string, unknown>,\n breadcrumbs: Record<string, Breadcrumb>,\n ) => {\n const [key, value] = Object.entries(newPageData)[0];\n if (!pageDataRef.current?.[key]) {\n pageDataRef.current[key] = {};\n }\n for (const b in breadcrumbs) {\n breadcrumbsCache.current.set(b, breadcrumbs[b]);\n }\n\n pageDataRef.current[key] = value;\n };\n\n const getPageData = (key: string, pathname: string) => {\n return pageDataRef.current[pathname]?.[key];\n };\n\n const setNavigationAbortController = (controller: AbortController) => {\n navigationAbortControllerRef.current.abort();\n navigationAbortControllerRef.current = controller;\n };\n\n const fetchRouteCSS = async (routePath: string) => {\n const views = routeManifest[routePath];\n if (!views) {\n return;\n }\n const cssFiles = views\n .flatMap((view) => {\n return cssManifest?.[view];\n })\n .filter(Boolean)\n .filter((file) => !document.getElementById(file));\n\n if (cssFiles.length === 0) {\n return;\n }\n\n async function fetchCSS(path: string) {\n const response = await fetch(`/${path}`);\n const content = response.text();\n return {\n content,\n id: path,\n };\n }\n const result = await Promise.all(cssFiles?.map((file) => fetchCSS(file)));\n for (const { content, id } of result) {\n const style = document.createElement(\"style\");\n style.id = id;\n style.textContent = await content;\n document.head.appendChild(style);\n }\n };\n\n return (\n <ClientRouterContext.Provider\n value={{\n isNavigatingSubject,\n getViewPathsFromPathname,\n history,\n getScrollPosition: (path: string) => {\n return scrollHistoryRef.current.get(path) || 0;\n },\n viewEntriesSubject: viewEntriesSubject.current,\n updatePageData,\n getPageData,\n getRoutePathnameFromHref,\n setNavigationAbortController,\n progressManager,\n fetchRouteCSS,\n breadcrumbsCache: breadcrumbsCache.current,\n routerSubject,\n urlLocaleSegment,\n }}\n >\n {children}\n {/* @ts-ignore */}\n {import.meta.hot && <HttpReload />}\n </ClientRouterContext.Provider>\n );\n};\n","import { useContext } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\nimport type { UrlParser, ViewPaths } from \"./types\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport { I18nContext } from \"./I18nContext\";\n\ntype Options<T extends ViewPaths> = UrlParser<T> extends Record<string, never>\n ? {\n search?: Record<string, string | number | boolean | undefined | null>;\n shallow?: boolean;\n hash?: string;\n locale?: string;\n }\n : {\n search?: Record<string, string | number | boolean | undefined | null>;\n params: UrlParser<T>;\n hash?: string;\n shallow?: boolean;\n locale?: string;\n };\n\nexport function useNavigate() {\n const { history, setNavigationAbortController } =\n useContext(ClientRouterContext);\n const { defaultLocale } = useContext(I18nContext);\n const location = useLocation();\n\n function action(pushOrReplace: \"push\" | \"replace\") {\n return async <T extends ViewPaths>(\n path: T | (string & {}),\n ...args: UrlParser<T> extends Record<string, never>\n ? [options?: Options<T>]\n : [options: Options<T>]\n ) => {\n const navigationAbortController = new AbortController();\n if (setNavigationAbortController) {\n setNavigationAbortController(navigationAbortController);\n }\n\n const [options = {}] = args;\n const {\n search = {},\n params = {},\n shallow,\n locale,\n hash,\n } = {\n params: {},\n shallow: false,\n locale: null,\n hash: \"\",\n ...options,\n };\n\n const urlSearchParams = new URLSearchParams(search);\n let localeSegment = location.locale;\n if (locale) {\n localeSegment = locale;\n }\n if (localeSegment === defaultLocale) {\n localeSegment = \"\";\n }\n\n const routePath = applyParams(path, params);\n const navigationPath = [\n `${localeSegment ? `/${localeSegment}` : \"\"}${routePath === \"/\" ? \"\" : routePath}`,\n urlSearchParams.toString(),\n ]\n .filter((s) => s.length > 0)\n .join(\"?\");\n\n const finalPath = [navigationPath, hash].filter(Boolean).join(\"\");\n\n if (shallow) {\n history?.[pushOrReplace](finalPath, { shallow });\n return;\n }\n\n history?.[pushOrReplace](finalPath === '' ? '/' : finalPath);\n };\n }\n\n return {\n push: action(\"push\"),\n replace: action(\"replace\"),\n };\n}\n","import { useContext } from \"react\";\nimport { useNavigate } from \"./useNavigate\";\nimport { RouteStateContext } from \"./RouteStateContext\";\nimport { useParams } from \"./useParams\";\n\ntype SearchParamsCallback = (\n search: Record<string, any>,\n shallow: boolean,\n) => void;\n\nclass SearchParams {\n constructor(\n private searchParams: URLSearchParams,\n private callback: SearchParamsCallback,\n ) {}\n\n get(key: string) {\n return this.searchParams.get(key);\n }\n\n set(key: Record<string, string | ((state: string) => string)>): SearchParams;\n set(key: string, value: string | ((state: string) => string)): SearchParams;\n set(key: any, value?: any) {\n let entries: Record<string, any> = {};\n if (typeof key === \"string\") {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n entries[key] = _value;\n } else {\n entries = (key as any) ?? {};\n }\n for (const [key, value] of Object.entries(entries)) {\n let _value: string = value;\n if (typeof value === \"function\") {\n _value = value(this.get(key) ?? \"\");\n }\n this.searchParams.set(key, _value);\n }\n return this;\n }\n\n append(key: string, value: string) {\n this.searchParams.append(key, value);\n return this;\n }\n\n sort() {\n this.searchParams.sort();\n return this;\n }\n\n clear() {\n this.searchParams = new URLSearchParams();\n return this;\n }\n\n delete(key: string | string[]) {\n const keys = Array.isArray(key) ? key : [key];\n for (const key of keys) {\n this.searchParams.delete(key);\n }\n return this;\n }\n\n toJSON() {\n const map = new Map<string, string | string[]>();\n // @ts-ignore\n for (const [key, value] of this.searchParams) {\n if (map.has(key)) {\n const currentValue = map.get(key);\n if (Array.isArray(currentValue)) {\n currentValue.push(value);\n map.set(key, currentValue);\n } else {\n map.set(key, [currentValue, value]);\n }\n } else {\n map.set(key, value);\n }\n }\n\n return Object.fromEntries(map.entries());\n }\n\n toString() {\n return this.searchParams.toString();\n }\n\n push(mode: \"soft\" | \"hard\" = \"soft\") {\n this.callback(this.toJSON(), mode === \"soft\");\n }\n}\n\nexport function useSearchParams() {\n const { push } = useNavigate();\n const { search, pathname } = useContext(RouteStateContext);\n const params = useParams();\n\n const callback = (search: Record<string, never>, shallow: boolean) => {\n push(\n pathname as never,\n {\n params,\n search,\n shallow,\n } as any,\n );\n };\n\n const searchParams = new SearchParams(new URLSearchParams(search), callback);\n\n return searchParams;\n}\n","import { useContext, useSyncExternalStore } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useIsNavigationPending() {\n const { isNavigatingSubject } = useContext(ClientRouterContext);\n const isNavigating = useSyncExternalStore(\n isNavigatingSubject.subscribe,\n isNavigatingSubject.getValue,\n isNavigatingSubject.getValue,\n );\n\n return isNavigating;\n}\n","import { useContext, useEffect, useState } from \"react\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport function useNavigationProgress() {\n const { progressManager } = useContext(ClientRouterContext);\n const [progress, setProgress] = useState(progressManager.state.getValue());\n\n useEffect(() => {\n const unsub = progressManager.state.subscribe((p) => setProgress(p));\n return () => {\n unsub();\n };\n }, [progressManager.state]);\n\n return progress;\n}\n","import { useContext } from \"react\";\nimport { useRoute } from \"./useRoute\";\nimport { ClientRouterContext } from \"./ClientRouterContext\";\n\nexport type Breadcrumb = {\n label: string;\n href: string;\n};\n\nexport function useBreadcrumbs() {\n const { pathname } = useRoute();\n const { getViewPathsFromPathname, breadcrumbsCache } =\n useContext(ClientRouterContext);\n\n let breadcrumbs: Breadcrumb[] = [];\n const viewPaths = getViewPathsFromPathname(pathname);\n for (const viewPath of viewPaths) {\n if (breadcrumbsCache.has(`${viewPath}:${pathname}`)) {\n breadcrumbs.push(breadcrumbsCache.get(`${viewPath}:${pathname}`));\n }\n }\n\n return breadcrumbs.filter((breadcrumb) => breadcrumb?.label.length > 0);\n}\n","import { createContext, useContext, type PropsWithChildren } from \"react\";\n\nconst RouteTransitionContext = createContext<{\n isTransitioning: boolean;\n targetPath: string;\n currentPath: string;\n}>({\n isTransitioning: false,\n targetPath: \"\",\n currentPath: \"\",\n});\n\ninterface RouteTransitionProviderProps {\n isPending: boolean;\n isFetching: boolean;\n transitionPath: [string, string];\n}\n\nexport const RouteTransitionProvider = (\n props: PropsWithChildren<RouteTransitionProviderProps>,\n) => {\n const { isPending, isFetching, transitionPath } = props;\n\n return (\n <RouteTransitionContext.Provider\n value={{\n isTransitioning: isPending || isFetching,\n targetPath: transitionPath[1],\n currentPath: transitionPath[0] || \"\",\n }}\n >\n {props.children}\n </RouteTransitionContext.Provider>\n );\n};\n\nexport function useRouteTransition() {\n const context = useContext(RouteTransitionContext);\n if (!context) {\n throw new Error(\n \"useRouteTransition must be used within a RouteTransitionProvider\",\n );\n }\n return context;\n}\n","import { useContext, memo, type ComponentProps } from \"react\";\n\nimport { applyParams } from \"../utils/applyParams\";\nimport { useLocation } from \"./useLocation\";\nimport type { UrlParser, ViewResult } from \"./types\";\nimport { useNavigate } from \"./useNavigate\";\nimport type { ViewRPC } from \"./rpc\";\nimport type { Prettify } from \"../utils/type\";\nimport { useParams } from \"./useParams\";\nimport { I18nContext } from \"./I18nContext\";\nimport { useRouteTransition } from \"./RouteTransitionProvider\";\n\ntype Views = {\n [K in keyof ViewRPC as K extends `view:${infer P}`\n ? P\n : never]: ViewResult<K>;\n};\n\ntype Search = Record<string, string | number | boolean | undefined | null>;\n\ntype LinkBaseProps<T extends keyof Views> = Omit<\n ComponentProps<\"a\">,\n \"href\"\n> & {\n active?: boolean;\n href: T;\n hash?: string;\n params: UrlParser<T>;\n search?: T extends keyof Views\n ? Views[T][\"input\"] extends Record<string, never>\n ? Search\n : Prettify<Partial<Views[T][\"input\"]> & Search>\n : Search;\n};\n\ntype LinkProps<T extends keyof Views, U = UrlParser<T>> = U extends Record<\n string,\n never\n>\n ? Omit<LinkBaseProps<T>, \"params\">\n : LinkBaseProps<T>;\n\nfunction normalizeSearch(search: Search): Record<string, string> {\n return Object.fromEntries(\n Object.entries(search)\n .filter(([_k, v]) => v !== undefined && v !== null)\n .map(([k, v]) => [k, String(v)]),\n ) as Record<string, string>;\n}\n\nexport const Link = memo(<T extends keyof Views>(props: LinkProps<T>) => {\n const _params = useParams();\n const { isTransitioning, targetPath } = useRouteTransition();\n const {\n href,\n onClick,\n hash = \"\",\n active = false,\n params = {},\n search = {},\n ...rest\n } = { params: _params, search: {}, ...props };\n const { defaultLocale } = useContext(I18nContext);\n const { push } = useNavigate();\n const location = useLocation();\n const searchParams = new URLSearchParams(normalizeSearch(search));\n\n const path = applyParams(href, params);\n let urlLocaleSegment = location.locale;\n if (urlLocaleSegment === defaultLocale) {\n urlLocaleSegment = \"\";\n }\n\n const localeSegment = urlLocaleSegment ? `/${urlLocaleSegment}` : \"\";\n\n const targetHref = [\n [`${localeSegment}${path}`, searchParams.toString()]\n .filter((s) => s.length > 0)\n .join(\"?\"),\n hash,\n ].join(\"\");\n\n const currentHref = [location.pathname, location.search, location.hash]\n .filter((item) => !!item)\n .join(\"\");\n\n return (\n <a\n data-active={active || currentHref === targetHref}\n data-pending={href === targetPath && isTransitioning}\n href={targetHref === '' ? '/' : targetHref}\n onClick={(e) => {\n if (typeof window !== \"undefined\") {\n if (currentHref === targetHref) {\n e.preventDefault();\n return;\n }\n }\n let currentPath = window.location.pathname.replace(localeSegment, \"\");\n currentPath = currentPath === \"\" ? \"/\" : currentPath;\n onClick?.(e);\n\n if (hash === \"\") {\n e.preventDefault();\n }\n onClick?.(e);\n push(href, {\n hash,\n search,\n params,\n shallow: path === currentPath,\n } as unknown as never);\n }}\n {...rest}\n />\n );\n});\n","import { type ComponentProps, useEffect } from \"react\";\nimport type { Link } from \"./Link\";\n\nimport { useNavigate } from \"./useNavigate\";\n\nexport const Redirect = (\n props: ComponentProps<typeof Link> & { action: \"push\" | \"replace\" },\n) => {\n const { href, params = {}, search = {}, action = \"replace\" } = props;\n const { push, replace } = useNavigate();\n\n useEffect(() => {\n if (action === \"replace\") {\n replace(href, { params, search } as any);\n } else {\n push(href, { params, search } as any);\n }\n }, [replace, action, push, params, search, href]);\n\n return <></>;\n};\n","import type { ComponentTree } from \"../types\";\n\nexport function flattenComponentTree(componentTree: ComponentTree): string[] {\n let out: string[] = [];\n for (const [root, branches] of componentTree) {\n out.push(root, ...flattenComponentTree(branches).flat());\n }\n return Array.from(new Set(out));\n}\n","import { createContext, lazy, type PropsWithChildren } from \"react\";\nimport { flattenComponentTree } from \"./helpers/flattenComponentTree\";\nimport type { ServerDataContextValue } from \"./ServerDataProvider\";\n\ndeclare const window: {\n __GEMI_DATA__: ServerDataContextValue;\n loaders: Record<\n string,\n () => Promise<{\n default: React.ComponentType<unknown>;\n }>\n >;\n} & Window;\n\nlet viewImportMap: Record<string, ReturnType<typeof lazy>> | null = null;\nif (typeof window !== \"undefined\" && process.env.NODE_ENV !== \"test\") {\n viewImportMap = {};\n const { componentTree = [] } = window.__GEMI_DATA__ ?? {};\n\n for (const viewName of flattenComponentTree(componentTree)) {\n viewImportMap[viewName] = lazy(window.loaders[viewName]);\n }\n}\n\nexport const ComponentsContext = createContext({ viewImportMap });\n\nexport const ComponentsProvider = (\n props: PropsWithChildren<{ viewImportMap: typeof viewImportMap }>,\n) => {\n return (\n <ComponentsContext.Provider\n value={{ viewImportMap: props.viewImportMap ?? viewImportMap }}\n >\n {props.children}\n </ComponentsContext.Provider>\n );\n};\n","import {\n createContext,\n type PropsWithChildren,\n useEffect,\n useRef,\n} from \"react\";\n\ntype Subscribe = (\n topic: string,\n handler: (event: any) => void,\n) => Promise<void>;\n\nexport const WebSocketContext = createContext(\n {} as {\n broadcast: (topic: string, payload: Record<string, any>) => void;\n subscribe: Subscribe;\n unsubscribe: (\n topic: string,\n handler: (event: any) => void,\n ) => Promise<void>;\n },\n);\n\nexport const WebSocketContextProvider = (props: PropsWithChildren) => {\n const wsRef = useRef<WebSocket>(null);\n\n function getWS() {\n return new Promise<WebSocket>((resolve) => {\n if (wsRef.current) {\n resolve(wsRef.current);\n } else {\n const ws = new WebSocket(\"ws://localhost:5173/\");\n ws.onopen = () => {\n wsRef.current = ws;\n console.log(\"ws opened\");\n ws.addEventListener(\"close\", () => {\n console.log(\"ws closed\");\n wsRef.current = null;\n });\n resolve(ws);\n };\n }\n });\n }\n\n const subscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"subscribe\", topic }));\n ws.addEventListener(\"message\", handler);\n };\n\n const unsubscribe = async (\n topic: string,\n handler: (event: MessageEvent<any>) => void,\n ) => {\n const ws = await getWS();\n ws.send(JSON.stringify({ type: \"unsubscribe\", topic }));\n ws.removeEventListener(\"message\", handler);\n };\n\n const broadcast = async (topic: string, payload = {}) => {\n const ws = await getWS();\n ws.send(\n JSON.stringify({\n type: \"broadcast\",\n topic,\n payload,\n }),\n );\n };\n\n useEffect(() => {\n return () => {\n if (wsRef.current) {\n wsRef.current.close();\n wsRef.current = null;\n }\n };\n }, []);\n\n return (\n <WebSocketContext.Provider value={{ subscribe, unsubscribe, broadcast }}>\n {props.children}\n </WebSocketContext.Provider>\n );\n};\n","import { type ReactNode, useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\n\nexport function updateMeta(meta: any) {\n // A partially rendered response whose segments set no metadata sends none —\n // what is on the page belongs to the segments that were skipped.\n if (!meta) {\n return;\n }\n const { title, description } = meta;\n if (title) {\n document.title = title;\n }\n if (description) {\n const desc = document.querySelector(\"meta[name='description']\");\n if (desc) {\n desc.setAttribute(\"content\", description);\n } else {\n const newDesc = document.createElement(\"meta\");\n newDesc.setAttribute(\"name\", \"description\");\n newDesc.setAttribute(\"content\", description);\n document.head.appendChild(newDesc);\n }\n }\n}\n\nconst OpenGraph = (props: {\n title: string;\n type: string;\n url: string;\n image: string;\n description?: string;\n imageAlt?: string;\n imageWidth?: number;\n imageHeight?: number;\n twitterImage?: string;\n twitterImageAlt?: string;\n twitterImageWidth?: number;\n twitterImageHeight?: number;\n}) => {\n const {\n title,\n description,\n type,\n url,\n image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage,\n twitterImageAlt,\n twitterImageWidth,\n twitterImageHeight,\n } = props;\n\n return (\n <>\n <meta property=\"og:title\" content={title} />\n <meta property=\"og:type\" content={type} />\n <meta property=\"og:url\" content={url} />\n <meta property=\"og:image\" content={image} />\n {description && <meta property=\"og:description\" content={description} />}\n {imageAlt && <meta property=\"og:image:alt\" content={imageAlt} />}\n {imageWidth && (\n <meta property=\"og:image:width\" content={String(imageWidth)} />\n )}\n {imageHeight && (\n <meta property=\"og:image:height\" content={String(imageHeight)} />\n )}\n {twitterImage && (\n <>\n <meta name=\"twitter:image\" content={twitterImage} />\n <meta name=\"twitter:card\" content=\"summary_large_image\" />\n </>\n )}\n {twitterImageAlt && (\n <meta name=\"twitter:image:alt\" content={twitterImageAlt} />\n )}\n {twitterImageWidth && (\n <meta name=\"twitter:image:width\" content={String(twitterImageWidth)} />\n )}\n {twitterImageHeight && (\n <meta\n name=\"twitter:image:height\"\n content={String(twitterImageHeight)}\n />\n )}\n </>\n );\n};\n\nexport const Head = ({\n children = null,\n charSet = \"utf-8\",\n}: { children?: ReactNode; charSet?: string }) => {\n const { meta } = useContext(ServerDataContext);\n return (\n <head>\n <meta charSet={charSet} />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n {/*\n Disable browser auto-translation (Chrome/Google Translate). Gemi apps do\n their own i18n, and a translator that rewrites text nodes *before* React\n hydrates mutates the SSR DOM — which React rejects as a hydration\n mismatch (Minified React error #418) and then regenerates the tree,\n dropping the server-injected <style> and leaving the page unstyled.\n Pair this with `translate=\"no\"` on the <html> element in RootLayout.\n */}\n <meta name=\"google\" content=\"notranslate\" />\n <title>{meta?.title}</title>\n {meta?.description && (\n <meta name=\"description\" content={meta.description} />\n )}\n {meta?.openGraph && <OpenGraph {...meta.openGraph} />}\n {children}\n </head>\n );\n};\n","import {\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useState,\n} from \"react\";\n\ntype Theme = \"light\" | \"dark\" | \"system\";\n\nconst ThemeContext = createContext({\n theme: \"light\" as Theme,\n setTheme: (theme: Theme) => {}, // Function to set the theme\n});\n\nfunction storeTheme(theme: string) {\n try {\n localStorage.setItem(\"theme\", theme);\n } catch (error) {\n console.error(\"Failed to store theme in localStorage:\", error);\n }\n}\n\nexport const ThemeProvider = (props: { children: ReactNode }) => {\n const [theme, setTheme] = useState(() => {\n if (typeof window === \"undefined\") {\n return \"light\"; // Default theme for server-side rendering\n }\n return localStorage.getItem(\"theme\") || \"light\";\n });\n\n useEffect(() => {\n if (theme === \"system\") {\n window\n .matchMedia(\"(prefers-color-scheme: dark)\")\n .addEventListener(\"change\", ({ matches }) => {\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(matches ? \"dark\" : \"light\");\n });\n }\n }, [theme]);\n\n return (\n <ThemeContext.Provider\n value={{\n theme: theme as Theme,\n setTheme: (newTheme: Theme) => {\n setTheme(newTheme);\n storeTheme(newTheme);\n\n let documentTheme = newTheme as Theme;\n if (newTheme === \"system\") {\n const media = window.matchMedia(\"(prefers-color-scheme: dark)\");\n documentTheme = media.matches ? \"dark\" : \"light\";\n }\n document.documentElement.classList.remove(\"light\", \"dark\");\n document.documentElement.classList.add(documentTheme);\n },\n }}\n >\n {props.children}\n </ThemeContext.Provider>\n );\n};\n\nexport function useTheme() {\n const context = useContext(ThemeContext);\n if (!context) {\n throw new Error(\"useTheme must be used within a ThemeProvider\");\n }\n\n return context;\n}\n","import { applyParams } from \"./applyParams\";\n\n/**\n * Route the client is currently rendering, sent on `.json` navigations so the\n * server can skip the handlers of the segments that route already has mounted.\n * Value is a locale-less pathname plus search, e.g. `/app/A/chat?tab=2`.\n */\nexport const PARTIAL_RENDER_HEADER = \"x-gemi-from\";\n\n/** What the server reports back about the skip it performed, if any. */\nexport interface PartialRenderInfo {\n /** The `x-gemi-from` value the plan was computed against. */\n from: string;\n /** View paths of the skipped segments, in order. Their data is carried forward. */\n carriedViews: string[];\n}\n\n/**\n * The `x-gemi-from` value for the route the client starts on.\n *\n * On the first render the router's `pathname` is still the route *pattern* the\n * server matched — it only becomes a resolved path once the history listener\n * has run — so this has to apply the params. Sending `/app/:orgId/chat` names\n * no route the server can resolve, and the first navigation after every full\n * page load would skip nothing.\n */\nexport function initialRenderedRoute(route: {\n pathname?: string;\n params?: Record<string, string>;\n search?: string;\n}) {\n // `applyParams` strips the trailing slash, so the root route resolves to the\n // empty string — which the server reads as \"no header\" and renders in full.\n const pathname = applyParams(route.pathname ?? \"/\", route.params ?? {}) || \"/\";\n return `${pathname}${route.search ?? \"\"}`;\n}\n","import type { Breadcrumb } from \"../useBreadcrumbs\";\n\ninterface RouteSnapshot {\n /** Concrete pathname, without the locale segment. */\n pathname: string;\n /** Route pattern the data was produced for — part of every breadcrumb key. */\n routePath: string;\n data: Record<string, any>;\n breadcrumbs: Record<string, Breadcrumb>;\n}\n\n/**\n * A partially rendered response only carries the segments the server actually\n * ran. Everything is keyed by the *new* pathname, so a carried layout would\n * render with empty props unless the data it already had is copied across.\n *\n * Data the server sent always wins: a carried view is only filled in where the\n * response has nothing for it.\n */\nexport function mergeCarriedSegments(\n previous: RouteSnapshot,\n next: RouteSnapshot,\n carriedViews: string[],\n) {\n if (carriedViews.length === 0) {\n return { data: next.data, breadcrumbs: next.breadcrumbs };\n }\n\n // Page data is keyed by the pathname it was fetched for, and a shallow\n // navigation moves the pathname on without fetching — so fall back to the key\n // the data is actually under. The server sends exactly one.\n const previousData = previous.data ?? {};\n const previousViewData =\n previousData[previous.pathname] ?? previousData[Object.keys(previousData)[0]] ?? {};\n const previousBreadcrumbs = previous.breadcrumbs ?? {};\n\n const carriedViewData: Record<string, unknown> = {};\n const carriedBreadcrumbs: Record<string, Breadcrumb> = {};\n\n for (const viewPath of carriedViews) {\n if (viewPath in previousViewData) {\n carriedViewData[viewPath] = previousViewData[viewPath];\n }\n // Breadcrumbs are keyed by route pattern, and that changed even though the\n // segment did not, so they have to be re-keyed rather than copied.\n const previousKey = `${viewPath}:${previous.routePath}`;\n if (previousKey in previousBreadcrumbs) {\n carriedBreadcrumbs[`${viewPath}:${next.routePath}`] = previousBreadcrumbs[previousKey];\n }\n }\n\n // The server sends page data under exactly one key. Take it from the payload\n // rather than recomputing it, so the two never disagree on spelling.\n const [nextKey = next.pathname] = Object.keys(next.data ?? {});\n\n return {\n data: {\n ...next.data,\n [nextKey]: { ...carriedViewData, ...next.data?.[nextKey] },\n },\n breadcrumbs: { ...carriedBreadcrumbs, ...next.breadcrumbs },\n };\n}\n","import {\n useContext,\n useEffect,\n useRef,\n useState,\n StrictMode,\n memo,\n useTransition,\n} from \"react\";\n\nimport type { PropsWithChildren, ReactNode, ComponentType, lazy } from \"react\";\n\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport {\n ClientRouterContext,\n ClientRouterProvider,\n} from \"./ClientRouterContext\";\nimport type { ComponentTree } from \"./types\";\nimport { ComponentsContext, ComponentsProvider } from \"./ComponentContext\";\nimport {\n QueryManagerContext,\n QueryManagerProvider,\n} from \"./QueryManagerContext\";\nimport { I18nProvider } from \"./I18nContext\";\nimport { WebSocketContextProvider } from \"./WebsocketContext\";\nimport { useNavigate } from \"./useNavigate\";\nimport {\n type PageData,\n type RouteState,\n RouteStateProvider,\n} from \"./RouteStateContext\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { Action } from \"history\";\nimport { useRouteData } from \"./useRouteData\";\nimport { updateMeta } from \"./Head\";\nimport { RouteTransitionProvider } from \"./RouteTransitionProvider\";\nimport { ThemeProvider } from \"./ThemeProvider\";\nimport {\n PARTIAL_RENDER_HEADER,\n initialRenderedRoute,\n type PartialRenderInfo,\n} from \"../utils/partialRender\";\nimport { mergeCarriedSegments } from \"./helpers/mergeCarriedSegments\";\n\ndeclare global {\n interface Window {\n scrollHistory: Map<string, number>;\n loaders: Record<string, () => void>;\n }\n}\n\nfunction restoreScroll(action: Action | null = null, _pathname = \"no path\") {\n if (action === null) {\n return;\n }\n\n const { pathname, search, hash } = window.location;\n\n const key = [pathname, search, hash].join(\"\");\n const sh = window.scrollHistory;\n\n const scrollPosition = sh?.get(key);\n\n if (action !== Action.Pop) {\n window.scrollTo(0, 0);\n } else {\n // In dev mode the effect runs scroll restoration\n // will be called twice, this if statement prevents\n // scroll to top\n if (!scrollPosition) {\n return;\n }\n window.scrollTo(0, scrollPosition ?? 0);\n }\n\n sh?.delete(key);\n}\n\ninterface RouteProps {\n componentPath: string;\n pathname: string;\n action: Action | null;\n}\n\nconst Route = memo((props: PropsWithChildren<RouteProps>) => {\n const { componentPath, pathname, action, children } = props;\n const { viewImportMap } = useContext(ComponentsContext);\n const { data } = useRouteData();\n\n const componentData = data?.[pathname]?.[componentPath] ?? {};\n const Component = viewImportMap[componentPath];\n\n useEffect(() => {\n if (!children) {\n restoreScroll(action, componentPath);\n }\n }, [action, children, componentPath]);\n\n if (Component) {\n return <Component {...componentData}>{props.children}</Component>;\n }\n\n const NotFound = viewImportMap[\"404\"];\n return <NotFound />;\n});\n\nconst Tree = memo(\n (props: {\n action: Action;\n tree: ComponentTree;\n entries: string[];\n pathname: string;\n }) => {\n const { entries, tree, pathname, action } = props;\n\n return (\n <>\n {tree.map((node) => {\n const [path, subtree] = node;\n if (!entries.includes(path)) return null;\n if (subtree.length > 0) {\n return (\n <Route\n action={action}\n key={path}\n componentPath={path}\n pathname={pathname}\n >\n <Tree\n action={action}\n tree={subtree}\n entries={entries}\n pathname={pathname}\n />\n </Route>\n );\n }\n return (\n <Route\n action={action}\n key={path}\n componentPath={path}\n pathname={pathname}\n />\n );\n })}\n </>\n );\n },\n);\n\nconst Routes = (props: { componentTree: ComponentTree }) => {\n const { componentTree } = props;\n const [isPending, startTransition] = useTransition();\n const [isFetching, setIsFetching] = useState(false);\n const { routerSubject, fetchRouteCSS } = useContext(ClientRouterContext);\n const { hydrate } = useContext(QueryManagerContext);\n\n const [transitionPath, setTransitionPath] = useState<[string, string]>([\n null,\n routerSubject?.getValue().pathname,\n ]);\n\n const {\n breadcrumbs,\n pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n } = useContext(ServerDataContext);\n\n const [routeState, setRouteState] = useState<RouteState & PageData>({\n params: routerSubject?.getValue().params,\n search: routerSubject?.getValue().search,\n pathname: routerSubject?.getValue().pathname,\n views: routerSubject?.getValue().views,\n action: null,\n hash: routerSubject?.getValue().hash,\n state: routerSubject?.getValue().state,\n routePath: routerSubject?.getValue().routePath,\n locale: routerSubject?.getValue().locale,\n breadcrumbs,\n data: pageData,\n i18n,\n prefetchedData,\n appId: currentAppId,\n });\n\n const { replace } = useNavigate();\n\n // Adopt what the document was rendered with. Without this the initial payload\n // only ever reaches a component that mounts on the first render, and one that\n // mounts on a later navigation — into a route whose layout has since been\n // carried forward rather than re-run — would fetch it over `/api` instead.\n useEffect(() => {\n hydrate(prefetchedData);\n }, [hydrate, prefetchedData]);\n\n // The route currently on screen, in `x-gemi-from` form. Updated when a\n // response is committed, never when one is merely requested — a navigation\n // that fails must leave the base the server carries segments from intact.\n const renderedRouteRef = useRef(initialRenderedRoute(routeState));\n\n useEffect(() => {\n return routerSubject?.subscribe(async (routerState) => {\n const { pathname, search, state, views } = routerState;\n setTransitionPath((current) => {\n const [, prevTarget] = current;\n return [prevTarget, pathname];\n });\n if (routerState.views.length === 0) {\n setRouteState((routerState) => ({\n ...routerState,\n views: [\"404\"],\n }));\n return;\n }\n\n if (state?.shallow) {\n setRouteState((state) => ({\n ...state,\n ...routerState,\n }));\n return;\n }\n\n const localeSegment = routerState.locale ? `/${routerState.locale}` : \"\";\n\n const _pathname =\n localeSegment.length > 0 && pathname === \"/\" ? \"\" : pathname;\n\n const pathnameWithLocaleSegment = `${localeSegment}${_pathname}`;\n\n const url = `${pathnameWithLocaleSegment}.json${search}`;\n const from = renderedRouteRef.current;\n setIsFetching(true);\n let res = { ok: false, json: async () => ({}) } as Response;\n try {\n const result = await Promise.all([\n fetch(url, { headers: { [PARTIAL_RENDER_HEADER]: from } }),\n fetchRouteCSS(pathname),\n ...views.map((component) => {\n if (!window?.loaders) return Promise.resolve();\n const loader = window?.loaders?.[component] ?? (() => ({}));\n loader();\n }),\n ]);\n res = result[0];\n } catch (e) {\n console.error(e);\n }\n\n if (res.ok) {\n let payload = await res.json();\n\n // Another navigation committed while this one was in flight, so the\n // segments the server carried forward were computed against a route\n // that is no longer on screen. Nothing sound to merge onto — ask for\n // the whole tree instead.\n const claimed: PartialRenderInfo | null = payload.partial ?? null;\n if (claimed && claimed.from !== renderedRouteRef.current) {\n try {\n const full = await fetch(url);\n if (full.ok) {\n payload = await full.json();\n }\n } catch (e) {\n console.error(e);\n }\n }\n\n const {\n data,\n i18n,\n prefetchedData,\n breadcrumbs,\n meta,\n directive = {},\n is404 = false,\n appId,\n } = payload;\n updateMeta(meta);\n if (directive?.kind === \"Redirect\") {\n if (directive?.path) {\n replace(directive.path, { params: {} } as unknown);\n }\n\n return;\n }\n\n if (is404) {\n startTransition(() => {\n setRouteState((state) => ({\n ...state,\n appId,\n views: [\"404\"],\n }));\n });\n }\n\n const carriedViews: string[] = payload.partial?.carriedViews ?? [];\n renderedRouteRef.current = `${pathname}${search}`;\n\n // Adopt what the server just prefetched before the new surface mounts\n // and its queries read the cache, otherwise they refetch it over /api.\n // Safe here: this callback is async, so we are past the render phase.\n hydrate(prefetchedData);\n\n startTransition(() => {\n setRouteState((state) => ({\n ...routerState,\n appId,\n i18n,\n prefetchedData,\n ...mergeCarriedSegments(\n state,\n { pathname, routePath: routerState.routePath, data, breadcrumbs },\n carriedViews,\n ),\n }));\n });\n }\n setIsFetching(false);\n });\n }, [routerSubject, fetchRouteCSS, replace, hydrate]);\n\n return (\n <RouteTransitionProvider\n isPending={isPending}\n isFetching={isFetching}\n transitionPath={transitionPath}\n >\n <RouteStateProvider state={routeState}>\n <Tree\n action={routeState.action}\n pathname={applyParams(routeState.pathname ?? \"/\", routeState.params)}\n tree={componentTree}\n entries={routeState.pathname ? routeState.views : [\"404\"]}\n />\n </RouteStateProvider>\n </RouteTransitionProvider>\n );\n};\n\nexport const ClientRouter = (props: {\n viewImportMap?: Record<string, ReturnType<typeof lazy>>;\n RootLayout: ComponentType<{ children: ReactNode; locale: string }>;\n}) => {\n const { RootLayout } = props;\n const {\n routeManifest,\n router,\n componentTree,\n pageData,\n cssManifest,\n breadcrumbs,\n i18n,\n } = useContext(ServerDataContext);\n\n return (\n <ThemeProvider>\n <I18nProvider>\n <WebSocketContextProvider>\n <QueryManagerProvider>\n <ComponentsProvider viewImportMap={props.viewImportMap}>\n <ClientRouterProvider\n cssManifest={cssManifest}\n searchParams={router.searchParams}\n params={router.params}\n pageData={pageData}\n is404={router.is404}\n is500={false}\n pathname={router.pathname}\n currentPath={router.currentPath}\n routeManifest={routeManifest}\n breadcrumbs={breadcrumbs}\n urlLocaleSegment={router.urlLocaleSegment}\n >\n <StrictMode>\n <RootLayout locale={i18n.currentLocale}>\n <Routes componentTree={componentTree} />\n </RootLayout>\n </StrictMode>\n </ClientRouterProvider>\n </ComponentsProvider>\n </QueryManagerProvider>\n </WebSocketContextProvider>\n </I18nProvider>\n </ThemeProvider>\n );\n};\n","\"use client\";\nimport { createContext as l, Component as y, createElement as d, useContext as f, useState as p, useMemo as E, forwardRef as B } from \"react\";\nconst h = l(null), c = {\n didCatch: !1,\n error: null\n};\nclass m extends y {\n constructor(e) {\n super(e), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = c;\n }\n static getDerivedStateFromError(e) {\n return { didCatch: !0, error: e };\n }\n resetErrorBoundary(...e) {\n const { error: t } = this.state;\n t !== null && (this.props.onReset?.({\n args: e,\n reason: \"imperative-api\"\n }), this.setState(c));\n }\n componentDidCatch(e, t) {\n this.props.onError?.(e, t);\n }\n componentDidUpdate(e, t) {\n const { didCatch: o } = this.state, { resetKeys: s } = this.props;\n o && t.error !== null && C(e.resetKeys, s) && (this.props.onReset?.({\n next: s,\n prev: e.resetKeys,\n reason: \"keys\"\n }), this.setState(c));\n }\n render() {\n const { children: e, fallbackRender: t, FallbackComponent: o, fallback: s } = this.props, { didCatch: n, error: a } = this.state;\n let i = e;\n if (n) {\n const u = {\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n };\n if (typeof t == \"function\")\n i = t(u);\n else if (o)\n i = d(o, u);\n else if (s !== void 0)\n i = s;\n else\n throw a;\n }\n return d(\n h.Provider,\n {\n value: {\n didCatch: n,\n error: a,\n resetErrorBoundary: this.resetErrorBoundary\n }\n },\n i\n );\n }\n}\nfunction C(r = [], e = []) {\n return r.length !== e.length || r.some((t, o) => !Object.is(t, e[o]));\n}\nfunction g(r) {\n return r !== null && typeof r == \"object\" && \"didCatch\" in r && typeof r.didCatch == \"boolean\" && \"error\" in r && \"resetErrorBoundary\" in r && typeof r.resetErrorBoundary == \"function\";\n}\nfunction x(r) {\n if (!g(r))\n throw new Error(\"ErrorBoundaryContext not found\");\n}\nfunction k() {\n const r = f(h);\n x(r);\n const { error: e, resetErrorBoundary: t } = r, [o, s] = p({\n error: null,\n hasError: !1\n }), n = E(\n () => ({\n error: e,\n resetBoundary: () => {\n t(), s({ error: null, hasError: !1 });\n },\n showBoundary: (a) => s({\n error: a,\n hasError: !0\n })\n }),\n [e, t]\n );\n if (o.hasError)\n throw o.error;\n return n;\n}\nfunction S(r) {\n switch (typeof r) {\n case \"object\": {\n if (r !== null && \"message\" in r && typeof r.message == \"string\")\n return r.message;\n break;\n }\n case \"string\":\n return r;\n }\n}\nfunction w(r, e) {\n const t = B(\n (s, n) => d(\n m,\n e,\n d(r, { ...s, ref: n })\n )\n ), o = r.displayName || r.name || \"Unknown\";\n return t.displayName = `withErrorBoundary(${o})`, t;\n}\nexport {\n m as ErrorBoundary,\n h as ErrorBoundaryContext,\n S as getErrorMessage,\n k as useErrorBoundary,\n w as withErrorBoundary\n};\n//# sourceMappingURL=react-error-boundary.js.map\n","import { useEffect, type ComponentType } from \"react\";\nimport { hydrateRoot, createRoot } from \"react-dom/client\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ErrorBoundary } from \"react-error-boundary\";\n\nconst StackTrace = () => {\n useEffect(() => {\n window.addEventListener(\"load\", () => {\n const container = document.getElementById(\"overlay\");\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (window as any).error,\n stack: (window as any).stack_trace || \"\",\n });\n container.appendChild(overlay);\n }\n });\n }, []);\n\n return <div id=\"overlay\" />;\n};\n\nexport function init(RootLayout: ComponentType<any>) {\n if (typeof window !== \"undefined\" && (window as any).render_error) {\n createRoot(document.body).render(<StackTrace />);\n } else {\n hydrateRoot(\n document,\n <>\n <></>\n <></>\n <ErrorBoundary fallback={<div />}>\n <ServerDataProvider>\n <ClientRouter RootLayout={RootLayout} />\n </ServerDataProvider>\n </ErrorBoundary>\n </>,\n {\n onCaughtError: (error) => {\n console.error(error);\n // @ts-ignore\n if (import.meta.env.DEV) {\n const ErrorOverlay = customElements.get(\"vite-error-overlay\");\n if (ErrorOverlay) {\n const overlay = new ErrorOverlay({\n message: (error as any).message,\n stack: (error as any).stack || \"\",\n });\n document.body.appendChild(overlay);\n }\n }\n },\n },\n );\n }\n}\n\nexport function create(\n RootLayout: ComponentType<any>,\n { componentTree, loaders, routeManifest, router, i18n, auth, prefetchedData, viewImportMap }: any,\n) {\n (window as any).__GEMI_DATA__ = {\n componentTree,\n loaders,\n routeManifest,\n router,\n i18n,\n auth,\n prefetchedData,\n pageData: {},\n };\n createRoot(document.getElementById(\"root\")).render(\n <ServerDataProvider>\n <ClientRouter viewImportMap={viewImportMap} RootLayout={RootLayout} />\n </ServerDataProvider>,\n );\n}\n","import type { ComponentType } from \"react\";\nimport { ClientRouter } from \"./ClientRouter\";\nimport { ServerDataProvider } from \"./ServerDataProvider\";\n\nexport function createRoot(\n RootLayout: ComponentType<{ children: React.ReactNode; locale: string }>,\n) {\n return (props: any) => (\n <ServerDataProvider value={props.data}>\n <ClientRouter\n RootLayout={RootLayout}\n viewImportMap={props.viewImportMap}\n />\n </ServerDataProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\n\nconst defaultScreen = [390, 768, 1024];\nconst defaultContainer = [100, 100, 100, 100];\n\nfunction generateImageProps(\n src: string,\n width: number,\n container = defaultContainer,\n screen = defaultScreen,\n quality = 80,\n) {\n const baseUrl = src;\n\n const widths = [...container.map((c, i) => (screen[i] * c) / 100), width * 2];\n\n return {\n srcSet: [\n ...screen.map((size, i) => {\n return `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${widths[i]} ${size}${isNaN(Number(size)) ? \"\" : \"w\"}`;\n }),\n `/api/__gemi__/services/image/resize?url=${baseUrl}&q=${quality}&w=${width * 2} 2x`,\n ].join(\", \"),\n sources: [\n ...container.map((c, i) => {\n if (!screen[i]) {\n return `${c}vw`;\n }\n return `(max-width: ${screen[i]}px) ${c}vw`;\n }),\n ].join(\", \"),\n };\n}\n\nfunction fillRestWithLast<T>(arr: T[], length: number): T[] {\n return [\n ...arr,\n ...Array.from({ length: length - arr.length }).fill(arr[arr.length - 1]),\n ] as T[];\n}\n\ninterface ImageProps {\n src: string;\n width: number;\n container?: number[];\n screen?: number[];\n quality?: number;\n}\n\nexport const Image = (props: ComponentProps<\"img\"> & ImageProps) => {\n const {\n screen = defaultScreen,\n container = defaultContainer,\n src,\n width,\n quality = 80,\n srcSet: __,\n ...rest\n } = props;\n\n if (!src) {\n return null;\n }\n\n const srcProps = generateImageProps(\n src,\n width,\n fillRestWithLast(container, 4),\n screen,\n quality,\n );\n\n return <img {...srcProps} width={width} {...rest} />;\n};\n","import { usePost } from \"../useMutation\";\n\ninterface UseForgotPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseForgotPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useForgotPassword(args: UseForgotPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/forgot-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\nimport { useQuery } from \"../useQuery\";\n\ninterface UseSignInArgs {\n onSuccess?: (data: any) => void;\n}\n\nconst defaultArgs: UseSignInArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignIn(args: UseSignInArgs = defaultArgs) {\n const { mutate } = useQuery(\"/auth/me\");\n return usePost(\n \"/auth/sign-in\",\n {},\n {\n onSuccess: (user) => {\n args.onSuccess(user);\n mutate(user as any);\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\nexport function useSignUp() {\n return usePost(\"/auth/sign-up\");\n}\n","import { useMutate } from \"../useMutate\";\nimport { usePost } from \"../useMutation\";\n\ninterface UseSignOutArgs {\n onSuccess?: () => void;\n}\n\nconst defaultArgs: UseSignOutArgs = {\n onSuccess: () => {},\n};\n\nexport function useSignOut(args: UseSignOutArgs = defaultArgs) {\n const mutator = useMutate();\n return usePost(\n \"/auth/sign-out\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n mutator({ path: \"/auth/me\" });\n },\n },\n );\n}\n","import { usePost } from \"../useMutation\";\n\ninterface UseResetPasswordArgs {\n onSuccess: () => void;\n}\n\nconst defaultArgs: UseResetPasswordArgs = {\n onSuccess: () => {},\n};\n\nexport function useResetPassword(args: UseResetPasswordArgs = defaultArgs) {\n return usePost(\n \"/auth/reset-password\",\n {},\n {\n onSuccess: () => {\n args.onSuccess();\n },\n },\n );\n}\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"../ServerDataProvider\";\nimport { useQuery } from \"../useQuery\";\n\nexport function useUser() {\n const { auth } = useContext(ServerDataContext);\n const {\n data: user,\n loading,\n error,\n } = useQuery(\n \"/auth/me\",\n {},\n {\n fallbackData: auth?.user ? auth.user : null,\n },\n );\n\n if (loading && !user) {\n return { user: null, loading, error };\n }\n\n return { user: user, loading, error };\n}\n","import { createElement, Fragment, isValidElement, type JSX } from \"react\";\n\ntype TemplateParams = Record<\n string,\n string | ((p: unknown) => string | JSX.Element)\n>;\n\nexport function parseTranslation(template: string, params: TemplateParams) {\n // Check if we have any JSX in our parameters\n const hasJSX = Object.values(params).some(\n (value) =>\n typeof value === \"function\" &&\n isValidElement((value as (p: unknown) => unknown)(\"\")),\n );\n\n // Regular expression to match template variables:\n // {{name}} - simple variable\n // {{name:type}} - variable with type casting\n // {{name:[content]}} - variable with interpolated content\n const regex = /{{([^{}]+?)(?::([^{}\\[\\]]+?))?(?:\\[(.*?)\\])?}}/g;\n\n if (!hasJSX) {\n // Simple string replacement\n const result = template.replace(regex, (match, name, type, content) => {\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n const value = params[cleanName];\n if (value === undefined) {\n return match; // Return original match if no parameter found\n }\n\n if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n // Check if function returned JSX - this shouldn't happen in the string branch\n if (isValidElement(functionResult)) {\n throw new Error(\"JSX returned in string context\");\n }\n return String(functionResult);\n }\n\n // Handle type casting if specified\n if (type) {\n switch (type.toLowerCase()) {\n case \"number\":\n return Number(value).toString();\n case \"string\":\n return String(value);\n case \"boolean\":\n return Boolean(value).toString();\n default:\n return String(value);\n }\n }\n return String(value);\n });\n return result as any;\n } else {\n // JSX replacement - we'll split the template into parts\n const parts: Array<string | JSX.Element> = [];\n let lastIndex = 0;\n let match: RegExpExecArray | null = null;\n\n while ((match = regex.exec(template)) !== null) {\n const [fullMatch, name, type, content] = match;\n const matchIndex = match.index;\n\n // Clean the name part by removing any colon if present\n const cleanName = name.includes(\":\") ? name.split(\":\")[0] : name;\n\n // Add text before the match\n if (matchIndex > lastIndex) {\n parts.push(template.substring(lastIndex, matchIndex));\n }\n\n const value = params[cleanName];\n if (value === undefined) {\n // Keep original template variable if no parameter found\n parts.push(fullMatch);\n } else if (typeof value === \"function\") {\n // If value is a function, call it with the content if available\n const functionParam = content !== undefined ? content : \"\";\n const functionResult = value(functionParam);\n parts.push(functionResult);\n } else if (type) {\n // Handle type casting if specified\n switch (type.toLowerCase()) {\n case \"number\":\n parts.push(Number(value).toString());\n break;\n case \"string\":\n parts.push(String(value));\n break;\n case \"boolean\":\n parts.push(Boolean(value).toString());\n break;\n default:\n parts.push(String(value));\n }\n } else {\n parts.push(String(value));\n }\n\n lastIndex = matchIndex + fullMatch.length;\n }\n\n // Add any remaining text\n if (lastIndex < template.length) {\n parts.push(template.substring(lastIndex));\n }\n\n // Convert the parts array to JSX\n return createElement(Fragment, {}, ...parts) as any;\n }\n}\n","import type { I18nDictionary } from \"./rpc\";\nimport type { ParseTranslationParams, Prettify } from \"../utils/type\";\nimport type { JSX } from \"react\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport { useRouteData } from \"./useRouteData\";\n\ntype Parser<T extends Record<string, string>> = Prettify<\n {\n [K in keyof T]: ParseTranslationParams<T[K]>;\n }[keyof T]\n>;\n\ntype ParamsOrNever<T> = T extends Record<string, never>\n ? [params?: never]\n : [params: T];\n\nexport function useTranslator<T extends keyof I18nDictionary>(component: T) {\n const { i18n } = useRouteData();\n\n function parse<\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(key: K, ...args: ParamsOrNever<Parser<U>>) {\n try {\n const translations = i18n.dictionary[i18n.currentLocale][component];\n const [params = {}] = args;\n return parseTranslation(translations[key as any], params);\n } catch (err) {\n console.error(\n `Unresolved translation Component:${component} key:${String(key)}`,\n );\n return String(key);\n }\n }\n\n parse.jsx = <\n K extends keyof I18nDictionary[T][\"dictionary\"],\n U extends Record<string, string> = I18nDictionary[T][\"dictionary\"][K],\n >(\n key: K,\n ...args: ParamsOrNever<Parser<U>>\n ) => {\n return parse(key, ...(args as any)) as unknown as JSX.Element;\n };\n\n return parse;\n}\n","import { useLocation } from \"./useLocation\";\nimport { useNavigate } from \"./useNavigate\";\nimport { useParams } from \"./useParams\";\nimport { useRouteData } from \"./useRouteData\";\n\nconst setCookie = async (locale: string) => {\n try {\n return await globalThis.cookieStore.set(\"i18n-locale\", locale);\n } catch (err) {\n return await fetch(`/api/__gemi__/services/i18n/set-locale/${locale}`);\n // TODO: show unsuported browser error\n // console.log(err);\n }\n};\n\nexport function useLocale() {\n const { i18n } = useRouteData();\n const { pathname, search } = useLocation();\n const { replace } = useNavigate();\n const params = useParams();\n\n const setLocale = async (locale: string) => {\n const urlSearchParams = new URLSearchParams(search);\n setCookie(locale).then(() => {\n replace(pathname, {\n locale,\n // TODO: fix: this conversion is wrong, because there can be multiple\n // search params with the same name\n search: Object.fromEntries(urlSearchParams.entries()),\n params,\n } as any);\n });\n };\n\n return [i18n.currentLocale, setLocale] as const;\n}\n","import { useCallback, useContext, useEffect, useMemo } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useSubscription(\n route: string,\n options: { params: {}; cb: (data: any) => void },\n) {\n const { cb, params } = options;\n const { subscribe, unsubscribe } = useContext(WebSocketContext);\n\n const topic = useMemo(\n () => applyParams(route, options.params),\n [route, params],\n );\n\n const handler = (event: MessageEvent<any>) => {\n const message = JSON.parse(event.data);\n if (topic === message.topic) {\n cb(message.data);\n }\n };\n\n useEffect(() => {\n subscribe(topic, handler);\n\n return () => {\n unsubscribe(topic, handler);\n };\n }, [topic]);\n}\n","import { useContext } from \"react\";\nimport { WebSocketContext } from \"./WebsocketContext\";\nimport { applyParams } from \"../utils/applyParams\";\n\nexport function useBroadcast(\n path: string,\n options: { params: Record<string, string | number> },\n) {\n const { params = {} } = options;\n const { broadcast } = useContext(WebSocketContext);\n\n const topic = applyParams(path, params);\n\n return (payload: Record<string, any>) => broadcast(topic, payload);\n}\n","import { createElement, Fragment, type ReactNode } from \"react\";\nimport type { SatoriOptions } from \"satori\";\n\ntype Font = Omit<SatoriOptions[\"fonts\"][number], \"data\">;\ntype Options = Omit<SatoriOptions, \"fonts\"> & {\n fonts: Font[];\n} & { width: number; height: number };\n\nexport const OpenGraphImage = ({\n children,\n ...satoriOptions\n}: Options & { children: ReactNode }) => {\n return (\n <>\n {(() => {\n throw {\n jsx: createElement(Fragment, { children }),\n satoriOptions,\n };\n })()}\n </>\n );\n};\n","import { useContext } from \"react\";\nimport { ServerDataContext } from \"./ServerDataProvider\";\nimport { RouteStateContext } from \"./RouteStateContext\";\n\nexport function useAppIdMissmatch() {\n const { appId: next } = useContext(RouteStateContext);\n const { appId: current } = useContext(ServerDataContext);\n\n return current !== next;\n}\n"],"x_google_ignoreList":[15,16,17,18,41],"mappings":";;;;;AAAA,IAAa,UAAb,MAAwB;CACtB,8BAAc,IAAI,IAAwB;CAC1C;CAEA,YAAY,cAAiB;EAC3B,KAAK,QAAQ;CACf;CAEA,UAAiB,YAAgC;EAC/C,KAAK,YAAY,IAAI,UAAU;EAC/B,aAAa;GACX,KAAK,YAAY,OAAO,UAAU;EACpC;CACF;CAEA,KAAY,OAAU;EACpB,KAAK,QAAQ;EACb,KAAK,YAAY,SAAS,eAAe,WAAW,KAAK,CAAC;CAC5D;CAEA,WAAkB;EAChB,OAAO,KAAK;CACd;AACF;;;ACdA,IAAa,qBAAqB;AAElC,IAAa,gBAAb,MAA2B;CACzB;CACA,gCAAgB,IAAI,IAAY;CAChC,kCAAkB,IAAI,IAAoB;CAC1C;CAEA,YAAY,KAAa,cAAmC;EAC1D,KAAK,MAAM;EACX,KAAK,QAAQ,IAAI,wBAAQ,IAAI,IAAI,CAAC;EAClC,KAAK,QAAQ,YAAY;CAC3B;;;;;;;;;CAUA,QAAQ,cAAsD;EAC5D,MAAM,QAAQ,KAAK,MAAM,SAAS;EAClC,MAAM,MAAM,KAAK,IAAI;EACrB,IAAI,UAAU;EAEd,KAAK,MAAM,CAAC,YAAY,SAAS,OAAO,QAAQ,gBAAgB,CAAC,CAAC,GAAG;GACnE,IAAI,CAAC,MAAM;GACX,MAAM,UAAU,MAAM,IAAI,UAAU;GAIpC,IAAI,SAAS,SAAS;GAEtB,IAAI,WAAW,QAAQ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