@helpwave/hightide 0.1.5 → 0.1.6
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.
- package/dist/coloring/shading.cjs.map +1 -1
- package/dist/coloring/shading.js.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.cjs +1 -3
- package/dist/components/icons-and-geometry/Avatar.cjs.map +1 -1
- package/dist/components/icons-and-geometry/Avatar.d.cts +1 -5
- package/dist/components/icons-and-geometry/Avatar.d.ts +1 -5
- package/dist/components/icons-and-geometry/Avatar.js +1 -3
- package/dist/components/icons-and-geometry/Avatar.js.map +1 -1
- package/dist/components/modals/LanguageModal.cjs.map +1 -1
- package/dist/components/modals/LanguageModal.js.map +1 -1
- package/dist/components/modals/ThemeModal.cjs.map +1 -1
- package/dist/components/modals/ThemeModal.js.map +1 -1
- package/dist/components/properties/SelectProperty.cjs.map +1 -1
- package/dist/components/properties/SelectProperty.js.map +1 -1
- package/dist/components/user-action/Select.cjs +1 -3
- package/dist/components/user-action/Select.cjs.map +1 -1
- package/dist/components/user-action/Select.d.cts +1 -6
- package/dist/components/user-action/Select.d.ts +1 -6
- package/dist/components/user-action/Select.js +1 -3
- package/dist/components/user-action/Select.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs","../../node_modules/next/src/shared/lib/router/utils/querystring.ts","../../node_modules/next/src/shared/lib/router/utils/format-url.ts","../../node_modules/next/src/shared/lib/router/utils/omit.ts","../../node_modules/next/src/shared/lib/utils.ts","../../node_modules/next/src/shared/lib/router/utils/remove-trailing-slash.ts","../../node_modules/next/src/shared/lib/router/utils/parse-path.ts","../../node_modules/next/src/client/normalize-trailing-slash.ts","../../node_modules/next/src/shared/lib/router/utils/path-has-prefix.ts","../../node_modules/next/src/client/has-base-path.ts","../../node_modules/next/src/shared/lib/router/utils/is-local-url.ts","../../node_modules/next/src/shared/lib/router/utils/sorted-routes.ts","../../node_modules/next/src/shared/lib/page-path/ensure-leading-slash.ts","../../node_modules/next/src/shared/lib/segment.ts","../../node_modules/next/src/shared/lib/router/utils/app-paths.ts","../../node_modules/next/src/shared/lib/router/utils/interception-routes.ts","../../node_modules/next/src/shared/lib/router/utils/is-dynamic.ts","../../node_modules/next/src/shared/lib/router/utils/index.ts","../../node_modules/next/src/shared/lib/router/utils/route-matcher.ts","../../node_modules/next/src/lib/constants.ts","../../node_modules/next/src/shared/lib/escape-regexp.ts","../../node_modules/next/src/shared/lib/router/utils/route-regex.ts","../../node_modules/next/src/shared/lib/router/utils/interpolate-as.ts","../../node_modules/next/src/client/resolve-href.ts","../../node_modules/next/src/shared/lib/router/utils/add-path-prefix.ts","../../node_modules/next/src/shared/lib/router/utils/add-locale.ts","../../node_modules/next/src/client/add-locale.ts","../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../../node_modules/next/src/shared/lib/router-context.shared-runtime.ts","../../node_modules/next/src/client/request-idle-callback.ts","../../node_modules/next/src/client/use-intersection.tsx","../../node_modules/next/src/shared/lib/i18n/normalize-locale-path.ts","../../node_modules/next/src/client/normalize-locale-path.ts","../../node_modules/next/src/shared/lib/i18n/detect-domain-locale.ts","../../node_modules/next/src/client/detect-domain-locale.ts","../../node_modules/next/src/client/get-domain-locale.ts","../../node_modules/next/src/client/add-base-path.ts","../../node_modules/next/src/client/use-merged-ref.ts","../../node_modules/next/src/shared/lib/utils/error-once.ts","../../node_modules/next/src/client/link.tsx","../../node_modules/next/link.js","../../src/coloring/shading.ts","../../src/coloring/types.ts","../../src/components/branding/HelpwaveBadge.tsx","../../src/components/layout-and-navigation/Tile.tsx","../../src/components/icons-and-geometry/Helpwave.tsx","../../src/components/date/DatePicker.tsx","../../src/localization/LanguageProvider.tsx","../../src/hooks/useLocalStorage.ts","../../src/localization/util.ts","../../src/util/noop.ts","../../src/components/user-action/Button.tsx","../../src/components/date/YearMonthPicker.tsx","../../src/components/layout-and-navigation/Expandable.tsx","../../src/components/date/DayPicker.tsx","../../src/components/date/TimeDisplay.tsx","../../src/components/date/TimePicker.tsx","../../src/components/dialogs/ConfirmDialog.tsx","../../src/components/layout-and-navigation/Overlay.tsx","../../src/hooks/useHoverState.ts","../../src/components/user-action/Tooltip.tsx","../../src/components/icons-and-geometry/Avatar.tsx","../../src/components/icons-and-geometry/Circle.tsx","../../src/components/icons-and-geometry/Ring.tsx","../../src/components/icons-and-geometry/Tag.tsx","../../src/components/layout-and-navigation/BreadCrumb.tsx","../../src/components/layout-and-navigation/Carousel.tsx","../../src/components/layout-and-navigation/Chip.tsx","../../src/components/layout-and-navigation/DividerInserter.tsx","../../src/components/layout-and-navigation/FAQSection.tsx","../../src/components/layout-and-navigation/MarkdownInterpreter.tsx","../../src/components/layout-and-navigation/Pagination.tsx","../../src/components/layout-and-navigation/SearchableList.tsx","../../src/components/user-action/Input.tsx","../../src/hooks/useSaveDelay.ts","../../src/components/user-action/Label.tsx","../../src/components/layout-and-navigation/StepperBar.tsx","../../src/components/layout-and-navigation/Table.tsx","../../src/components/user-action/Checkbox.tsx","../../src/components/layout-and-navigation/TextImage.tsx","../../src/components/layout-and-navigation/VerticalDivider.tsx","../../src/components/loading-states/ErrorComponent.tsx","../../src/components/loading-states/LoadingAndErrorComponent.tsx","../../src/components/loading-states/LoadingAnimation.tsx","../../src/components/loading-states/LoadingButton.tsx","../../src/components/loading-states/ProgressIndicator.tsx","../../src/components/modals/ConfirmModal.tsx","../../src/components/modals/DiscardChangesModal.tsx","../../src/components/modals/InputModal.tsx","../../src/components/user-action/Select.tsx","../../src/components/modals/LanguageModal.tsx","../../src/theming/useTheme.tsx","../../src/components/modals/ThemeModal.tsx","../../src/components/properties/CheckboxProperty.tsx","../../src/components/properties/PropertyBase.tsx","../../src/components/properties/DateProperty.tsx","../../src/components/properties/MultiSelectProperty.tsx","../../src/components/user-action/MultiSelect.tsx","../../src/components/user-action/Menu.tsx","../../src/hooks/useOutsideClick.ts","../../src/components/properties/NumberProperty.tsx","../../src/components/properties/SelectProperty.tsx","../../src/components/properties/TextProperty.tsx","../../src/components/user-action/Textarea.tsx","../../src/components/user-action/DateAndTimePicker.tsx","../../src/components/user-action/ScrollPicker.tsx","../../src/components/user-action/ToggleableInput.tsx","../../src/util/news.ts"],"sourcesContent":["\"use strict\";\n\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n\n return (_getRequireWildcardCache = function(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interop_require_wildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) return obj;\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") return { default: obj };\n\n var cache = _getRequireWildcardCache(nodeInterop);\n\n if (cache && cache.has(obj)) return cache.get(obj);\n\n var newObj = { __proto__: null };\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);\n else newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n\n if (cache) cache.set(obj, newObj);\n\n return newObj;\n}\nexports._ = _interop_require_wildcard;\n","import type { ParsedUrlQuery } from 'querystring'\n\nexport function searchParamsToUrlQuery(\n searchParams: URLSearchParams\n): ParsedUrlQuery {\n const query: ParsedUrlQuery = {}\n for (const [key, value] of searchParams.entries()) {\n const existing = query[key]\n if (typeof existing === 'undefined') {\n query[key] = value\n } else if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n query[key] = [existing, value]\n }\n }\n return query\n}\n\nfunction stringifyUrlQueryParam(param: unknown): string {\n if (typeof param === 'string') {\n return param\n }\n\n if (\n (typeof param === 'number' && !isNaN(param)) ||\n typeof param === 'boolean'\n ) {\n return String(param)\n } else {\n return ''\n }\n}\n\nexport function urlQueryToSearchParams(query: ParsedUrlQuery): URLSearchParams {\n const searchParams = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, stringifyUrlQueryParam(item))\n }\n } else {\n searchParams.set(key, stringifyUrlQueryParam(value))\n }\n }\n return searchParams\n}\n\nexport function assign(\n target: URLSearchParams,\n ...searchParamsList: URLSearchParams[]\n): URLSearchParams {\n for (const searchParams of searchParamsList) {\n for (const key of searchParams.keys()) {\n target.delete(key)\n }\n\n for (const [key, value] of searchParams.entries()) {\n target.append(key, value)\n }\n }\n\n return target\n}\n","// Format function modified from nodejs\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { UrlObject } from 'url'\nimport type { ParsedUrlQuery } from 'querystring'\nimport * as querystring from './querystring'\n\nconst slashedProtocols = /https?|ftp|gopher|file/\n\nexport function formatUrl(urlObj: UrlObject) {\n let { auth, hostname } = urlObj\n let protocol = urlObj.protocol || ''\n let pathname = urlObj.pathname || ''\n let hash = urlObj.hash || ''\n let query = urlObj.query || ''\n let host: string | false = false\n\n auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : ''\n\n if (urlObj.host) {\n host = auth + urlObj.host\n } else if (hostname) {\n host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname)\n if (urlObj.port) {\n host += ':' + urlObj.port\n }\n }\n\n if (query && typeof query === 'object') {\n query = String(querystring.urlQueryToSearchParams(query as ParsedUrlQuery))\n }\n\n let search = urlObj.search || (query && `?${query}`) || ''\n\n if (protocol && !protocol.endsWith(':')) protocol += ':'\n\n if (\n urlObj.slashes ||\n ((!protocol || slashedProtocols.test(protocol)) && host !== false)\n ) {\n host = '//' + (host || '')\n if (pathname && pathname[0] !== '/') pathname = '/' + pathname\n } else if (!host) {\n host = ''\n }\n\n if (hash && hash[0] !== '#') hash = '#' + hash\n if (search && search[0] !== '?') search = '?' + search\n\n pathname = pathname.replace(/[?#]/g, encodeURIComponent)\n search = search.replace('#', '%23')\n\n return `${protocol}${host}${pathname}${search}${hash}`\n}\n\nexport const urlObjectKeys = [\n 'auth',\n 'hash',\n 'host',\n 'hostname',\n 'href',\n 'path',\n 'pathname',\n 'port',\n 'protocol',\n 'query',\n 'search',\n 'slashes',\n]\n\nexport function formatWithValidation(url: UrlObject): string {\n if (process.env.NODE_ENV === 'development') {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach((key) => {\n if (!urlObjectKeys.includes(key)) {\n console.warn(\n `Unknown key passed via urlObject into url.format: ${key}`\n )\n }\n })\n }\n }\n\n return formatUrl(url)\n}\n","export function omit<T extends { [key: string]: unknown }, K extends keyof T>(\n object: T,\n keys: K[]\n): Omit<T, K> {\n const omitted: { [key: string]: unknown } = {}\n Object.keys(object).forEach((key) => {\n if (!keys.includes(key as K)) {\n omitted[key] = object[key]\n }\n })\n return omitted as Omit<T, K>\n}\n","import type { HtmlProps } from './html-context.shared-runtime'\nimport type { ComponentType, JSX } from 'react'\nimport type { DomainLocale } from '../../server/config'\nimport type { Env } from '@next/env'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextRouter } from './router/router'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { PreviewData } from '../../types'\nimport type { COMPILER_NAMES } from './constants'\nimport type fs from 'fs'\n\nexport type NextComponentType<\n Context extends BaseContext = NextPageContext,\n InitialProps = {},\n Props = {},\n> = ComponentType<Props> & {\n /**\n * Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.\n * Make sure to return plain `Object` without using `Date`, `Map`, `Set`.\n * @param context Context of `page`\n */\n getInitialProps?(context: Context): InitialProps | Promise<InitialProps>\n}\n\nexport type DocumentType = NextComponentType<\n DocumentContext,\n DocumentInitialProps,\n DocumentProps\n>\n\nexport type AppType<P = {}> = NextComponentType<\n AppContextType,\n P,\n AppPropsType<any, P>\n>\n\nexport type AppTreeType = ComponentType<\n AppInitialProps & { [name: string]: any }\n>\n\n/**\n * Web vitals provided to _app.reportWebVitals by Core Web Vitals plugin developed by Google Chrome team.\n * https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting\n */\nexport const WEB_VITALS = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'] as const\nexport type NextWebVitalsMetric = {\n id: string\n startTime: number\n value: number\n attribution?: { [key: string]: unknown }\n} & (\n | {\n label: 'web-vital'\n name: (typeof WEB_VITALS)[number]\n }\n | {\n label: 'custom'\n name:\n | 'Next.js-hydration'\n | 'Next.js-route-change-to-render'\n | 'Next.js-render'\n }\n)\n\nexport type Enhancer<C> = (Component: C) => C\n\nexport type ComponentsEnhancer =\n | {\n enhanceApp?: Enhancer<AppType>\n enhanceComponent?: Enhancer<NextComponentType>\n }\n | Enhancer<NextComponentType>\n\nexport type RenderPageResult = {\n html: string\n head?: Array<JSX.Element | null>\n}\n\nexport type RenderPage = (\n options?: ComponentsEnhancer\n) => DocumentInitialProps | Promise<DocumentInitialProps>\n\nexport type BaseContext = {\n res?: ServerResponse\n [k: string]: any\n}\n\nexport type NEXT_DATA = {\n props: Record<string, any>\n page: string\n query: ParsedUrlQuery\n buildId: string\n assetPrefix?: string\n runtimeConfig?: { [key: string]: any }\n nextExport?: boolean\n autoExport?: boolean\n isFallback?: boolean\n isExperimentalCompile?: boolean\n dynamicIds?: (string | number)[]\n err?: Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n }\n gsp?: boolean\n gssp?: boolean\n customServer?: boolean\n gip?: boolean\n appGip?: boolean\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n scriptLoader?: any[]\n isPreview?: boolean\n notFoundSrcPage?: string\n}\n\n/**\n * `Next` context\n */\nexport interface NextPageContext {\n /**\n * Error object if encountered during rendering\n */\n err?: (Error & { statusCode?: number }) | null\n /**\n * `HTTP` request object.\n */\n req?: IncomingMessage\n /**\n * `HTTP` response object.\n */\n res?: ServerResponse\n /**\n * Path section of `URL`.\n */\n pathname: string\n /**\n * Query string section of `URL` parsed as an object.\n */\n query: ParsedUrlQuery\n /**\n * `String` of the actual path including query.\n */\n asPath?: string\n /**\n * The currently active locale\n */\n locale?: string\n /**\n * All configured locales\n */\n locales?: readonly string[]\n /**\n * The configured default locale\n */\n defaultLocale?: string\n /**\n * `Component` the tree of the App to use if needing to render separately\n */\n AppTree: AppTreeType\n}\n\nexport type AppContextType<Router extends NextRouter = NextRouter> = {\n Component: NextComponentType<NextPageContext>\n AppTree: AppTreeType\n ctx: NextPageContext\n router: Router\n}\n\nexport type AppInitialProps<PageProps = any> = {\n pageProps: PageProps\n}\n\nexport type AppPropsType<\n Router extends NextRouter = NextRouter,\n PageProps = {},\n> = AppInitialProps<PageProps> & {\n Component: NextComponentType<NextPageContext, any, any>\n router: Router\n __N_SSG?: boolean\n __N_SSP?: boolean\n}\n\nexport type DocumentContext = NextPageContext & {\n renderPage: RenderPage\n defaultGetInitialProps(\n ctx: DocumentContext,\n options?: { nonce?: string }\n ): Promise<DocumentInitialProps>\n}\n\nexport type DocumentInitialProps = RenderPageResult & {\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | JSX.Element\n}\n\nexport type DocumentProps = DocumentInitialProps & HtmlProps\n\n/**\n * Next `API` route request\n */\nexport interface NextApiRequest extends IncomingMessage {\n /**\n * Object of `query` values from url\n */\n query: Partial<{\n [key: string]: string | string[]\n }>\n /**\n * Object of `cookies` from header\n */\n cookies: Partial<{\n [key: string]: string\n }>\n\n body: any\n\n env: Env\n\n draftMode?: boolean\n\n preview?: boolean\n /**\n * Preview data set on the request, if any\n * */\n previewData?: PreviewData\n}\n\n/**\n * Send body of response\n */\ntype Send<T> = (body: T) => void\n\n/**\n * Next `API` route response\n */\nexport type NextApiResponse<Data = any> = ServerResponse & {\n /**\n * Send data `any` data in response\n */\n send: Send<Data>\n /**\n * Send data `json` data in response\n */\n json: Send<Data>\n status: (statusCode: number) => NextApiResponse<Data>\n redirect(url: string): NextApiResponse<Data>\n redirect(status: number, url: string): NextApiResponse<Data>\n\n /**\n * Set draft mode\n */\n setDraftMode: (options: { enable: boolean }) => NextApiResponse<Data>\n\n /**\n * Set preview data for Next.js' prerender mode\n */\n setPreviewData: (\n data: object | string,\n options?: {\n /**\n * Specifies the number (in seconds) for the preview session to last for.\n * The given number will be converted to an integer by rounding down.\n * By default, no maximum age is set and the preview session finishes\n * when the client shuts down (browser is closed).\n */\n maxAge?: number\n /**\n * Specifies the path for the preview session to work under. By default,\n * the path is considered the \"default path\", i.e., any pages under \"/\".\n */\n path?: string\n }\n ) => NextApiResponse<Data>\n\n /**\n * Clear preview data for Next.js' prerender mode\n */\n clearPreviewData: (options?: { path?: string }) => NextApiResponse<Data>\n\n /**\n * Revalidate a specific page and regenerate it using On-Demand Incremental\n * Static Regeneration.\n * The path should be an actual path, not a rewritten path. E.g. for\n * \"/blog/[slug]\" this should be \"/blog/post-1\".\n * @link https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation-with-revalidatepath\n */\n revalidate: (\n urlPath: string,\n opts?: {\n unstable_onlyGenerated?: boolean\n }\n ) => Promise<void>\n}\n\n/**\n * Next `API` route handler\n */\nexport type NextApiHandler<T = any> = (\n req: NextApiRequest,\n res: NextApiResponse<T>\n) => unknown | Promise<unknown>\n\n/**\n * Utils\n */\nexport function execOnce<T extends (...args: any[]) => ReturnType<T>>(\n fn: T\n): T {\n let used = false\n let result: ReturnType<T>\n\n return ((...args: any[]) => {\n if (!used) {\n used = true\n result = fn(...args)\n }\n return result\n }) as T\n}\n\n// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nexport const isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url)\n\nexport function getLocationOrigin() {\n const { protocol, hostname, port } = window.location\n return `${protocol}//${hostname}${port ? ':' + port : ''}`\n}\n\nexport function getURL() {\n const { href } = window.location\n const origin = getLocationOrigin()\n return href.substring(origin.length)\n}\n\nexport function getDisplayName<P>(Component: ComponentType<P>) {\n return typeof Component === 'string'\n ? Component\n : Component.displayName || Component.name || 'Unknown'\n}\n\nexport function isResSent(res: ServerResponse) {\n return res.finished || res.headersSent\n}\n\nexport function normalizeRepeatedSlashes(url: string) {\n const urlParts = url.split('?')\n const urlNoQuery = urlParts[0]\n\n return (\n urlNoQuery\n // first we replace any non-encoded backslashes with forward\n // then normalize repeated forward slashes\n .replace(/\\\\/g, '/')\n .replace(/\\/\\/+/g, '/') +\n (urlParts[1] ? `?${urlParts.slice(1).join('?')}` : '')\n )\n}\n\nexport async function loadGetInitialProps<\n C extends BaseContext,\n IP = {},\n P = {},\n>(App: NextComponentType<C, IP, P>, ctx: C): Promise<IP> {\n if (process.env.NODE_ENV !== 'production') {\n if (App.prototype?.getInitialProps) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.`\n throw new Error(message)\n }\n }\n // when called from _app `ctx` is nested in `ctx`\n const res = ctx.res || (ctx.ctx && ctx.ctx.res)\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx),\n }\n }\n return {} as IP\n }\n\n const props = await App.getInitialProps(ctx)\n\n if (res && isResSent(res)) {\n return props\n }\n\n if (!props) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`\n throw new Error(message)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(\n `${getDisplayName(\n App\n )} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps`\n )\n }\n }\n\n return props\n}\n\nexport const SP = typeof performance !== 'undefined'\nexport const ST =\n SP &&\n (['mark', 'measure', 'getEntriesByName'] as const).every(\n (method) => typeof performance[method] === 'function'\n )\n\nexport class DecodeError extends Error {}\nexport class NormalizeError extends Error {}\nexport class PageNotFoundError extends Error {\n code: string\n\n constructor(page: string) {\n super()\n this.code = 'ENOENT'\n this.name = 'PageNotFoundError'\n this.message = `Cannot find module for page: ${page}`\n }\n}\n\nexport class MissingStaticPage extends Error {\n constructor(page: string, message: string) {\n super()\n this.message = `Failed to load static file for page: ${page} ${message}`\n }\n}\n\nexport class MiddlewareNotFoundError extends Error {\n code: string\n constructor() {\n super()\n this.code = 'ENOENT'\n this.message = `Cannot find the middleware module`\n }\n}\n\nexport interface CacheFs {\n existsSync: typeof fs.existsSync\n readFile: typeof fs.promises.readFile\n readFileSync: typeof fs.readFileSync\n writeFile(f: string, d: any): Promise<void>\n mkdir(dir: string): Promise<void | string>\n stat(f: string): Promise<{ mtime: Date }>\n}\n\nexport function stringifyError(error: Error) {\n return JSON.stringify({ message: error.message, stack: error.stack })\n}\n","/**\n * Removes the trailing slash for a given route or page path. Preserves the\n * root page. Examples:\n * - `/foo/bar/` -> `/foo/bar`\n * - `/foo/bar` -> `/foo/bar`\n * - `/` -> `/`\n */\nexport function removeTrailingSlash(route: string) {\n return route.replace(/\\/$/, '') || '/'\n}\n","/**\n * Given a path this function will find the pathname, query and hash and return\n * them. This is useful to parse full paths on the client side.\n * @param path A path to parse e.g. /foo/bar?id=1#hash\n */\nexport function parsePath(path: string) {\n const hashIndex = path.indexOf('#')\n const queryIndex = path.indexOf('?')\n const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex)\n\n if (hasQuery || hashIndex > -1) {\n return {\n pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),\n query: hasQuery\n ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined)\n : '',\n hash: hashIndex > -1 ? path.slice(hashIndex) : '',\n }\n }\n\n return { pathname: path, query: '', hash: '' }\n}\n","import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { parsePath } from '../shared/lib/router/utils/parse-path'\n\n/**\n * Normalizes the trailing slash of a path according to the `trailingSlash` option\n * in `next.config.js`.\n */\nexport const normalizePathTrailingSlash = (path: string) => {\n if (!path.startsWith('/') || process.env.__NEXT_MANUAL_TRAILING_SLASH) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n if (process.env.__NEXT_TRAILING_SLASH) {\n if (/\\.[^/]+\\/?$/.test(pathname)) {\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n } else if (pathname.endsWith('/')) {\n return `${pathname}${query}${hash}`\n } else {\n return `${pathname}/${query}${hash}`\n }\n }\n\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Checks if a given path starts with a given prefix. It ensures it matches\n * exactly without containing extra chars. e.g. prefix /docs should replace\n * for /docs, /docs/, /docs/a but not /docsss\n * @param path The path to check.\n * @param prefix The prefix to check against.\n */\nexport function pathHasPrefix(path: string, prefix: string) {\n if (typeof path !== 'string') {\n return false\n }\n\n const { pathname } = parsePath(path)\n return pathname === prefix || pathname.startsWith(prefix + '/')\n}\n","import { pathHasPrefix } from '../shared/lib/router/utils/path-has-prefix'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function hasBasePath(path: string): boolean {\n return pathHasPrefix(path, basePath)\n}\n","import { isAbsoluteUrl, getLocationOrigin } from '../../utils'\nimport { hasBasePath } from '../../../../client/has-base-path'\n\n/**\n * Detects whether a given url is routable by the Next.js router (browser only).\n */\nexport function isLocalURL(url: string): boolean {\n // prevent a hydration mismatch on href for url with anchor refs\n if (!isAbsoluteUrl(url)) return true\n try {\n // absolute urls can be local if they are on the same origin\n const locationOrigin = getLocationOrigin()\n const resolved = new URL(url, locationOrigin)\n return resolved.origin === locationOrigin && hasBasePath(resolved.pathname)\n } catch (_) {\n return false\n }\n}\n","class UrlNode {\n placeholder: boolean = true\n children: Map<string, UrlNode> = new Map()\n slugName: string | null = null\n restSlugName: string | null = null\n optionalRestSlugName: string | null = null\n\n insert(urlPath: string): void {\n this._insert(urlPath.split('/').filter(Boolean), [], false)\n }\n\n smoosh(): string[] {\n return this._smoosh()\n }\n\n private _smoosh(prefix: string = '/'): string[] {\n const childrenPaths = [...this.children.keys()].sort()\n if (this.slugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[]'), 1)\n }\n if (this.restSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[...]'), 1)\n }\n if (this.optionalRestSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1)\n }\n\n const routes = childrenPaths\n .map((c) => this.children.get(c)!._smoosh(`${prefix}${c}/`))\n .reduce((prev, curr) => [...prev, ...curr], [])\n\n if (this.slugName !== null) {\n routes.push(\n ...this.children.get('[]')!._smoosh(`${prefix}[${this.slugName}]/`)\n )\n }\n\n if (!this.placeholder) {\n const r = prefix === '/' ? '/' : prefix.slice(0, -1)\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot define a route with the same specificity as a optional catch-all route (\"${r}\" and \"${r}[[...${this.optionalRestSlugName}]]\").`\n )\n }\n\n routes.unshift(r)\n }\n\n if (this.restSlugName !== null) {\n routes.push(\n ...this.children\n .get('[...]')!\n ._smoosh(`${prefix}[...${this.restSlugName}]/`)\n )\n }\n\n if (this.optionalRestSlugName !== null) {\n routes.push(\n ...this.children\n .get('[[...]]')!\n ._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)\n )\n }\n\n return routes\n }\n\n private _insert(\n urlPaths: string[],\n slugNames: string[],\n isCatchAll: boolean\n ): void {\n if (urlPaths.length === 0) {\n this.placeholder = false\n return\n }\n\n if (isCatchAll) {\n throw new Error(`Catch-all must be the last part of the URL.`)\n }\n\n // The next segment in the urlPaths list\n let nextSegment = urlPaths[0]\n\n // Check if the segment matches `[something]`\n if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {\n // Strip `[` and `]`, leaving only `something`\n let segmentName = nextSegment.slice(1, -1)\n\n let isOptional = false\n if (segmentName.startsWith('[') && segmentName.endsWith(']')) {\n // Strip optional `[` and `]`, leaving only `something`\n segmentName = segmentName.slice(1, -1)\n isOptional = true\n }\n\n if (segmentName.startsWith('…')) {\n throw new Error(\n `Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`\n )\n }\n\n if (segmentName.startsWith('...')) {\n // Strip `...`, leaving only `something`\n segmentName = segmentName.substring(3)\n isCatchAll = true\n }\n\n if (segmentName.startsWith('[') || segmentName.endsWith(']')) {\n throw new Error(\n `Segment names may not start or end with extra brackets ('${segmentName}').`\n )\n }\n\n if (segmentName.startsWith('.')) {\n throw new Error(\n `Segment names may not start with erroneous periods ('${segmentName}').`\n )\n }\n\n function handleSlug(previousSlug: string | null, nextSlug: string) {\n if (previousSlug !== null) {\n // If the specific segment already has a slug but the slug is not `something`\n // This prevents collisions like:\n // pages/[post]/index.js\n // pages/[id]/index.js\n // Because currently multiple dynamic params on the same segment level are not supported\n if (previousSlug !== nextSlug) {\n // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n throw new Error(\n `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n )\n }\n }\n\n slugNames.forEach((slug) => {\n if (slug === nextSlug) {\n throw new Error(\n `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n )\n }\n\n if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n throw new Error(\n `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n )\n }\n })\n\n slugNames.push(nextSlug)\n }\n\n if (isCatchAll) {\n if (isOptional) {\n if (this.restSlugName != null) {\n throw new Error(\n `You cannot use both an required and optional catch-all route at the same level (\"[...${this.restSlugName}]\" and \"${urlPaths[0]}\" ).`\n )\n }\n\n handleSlug(this.optionalRestSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.optionalRestSlugName = segmentName\n // nextSegment is overwritten to [[...]] so that it can later be sorted specifically\n nextSegment = '[[...]]'\n } else {\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot use both an optional and required catch-all route at the same level (\"[[...${this.optionalRestSlugName}]]\" and \"${urlPaths[0]}\").`\n )\n }\n\n handleSlug(this.restSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.restSlugName = segmentName\n // nextSegment is overwritten to [...] so that it can later be sorted specifically\n nextSegment = '[...]'\n }\n } else {\n if (isOptional) {\n throw new Error(\n `Optional route parameters are not yet supported (\"${urlPaths[0]}\").`\n )\n }\n handleSlug(this.slugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.slugName = segmentName\n // nextSegment is overwritten to [] so that it can later be sorted specifically\n nextSegment = '[]'\n }\n }\n\n // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode\n if (!this.children.has(nextSegment)) {\n this.children.set(nextSegment, new UrlNode())\n }\n\n this.children\n .get(nextSegment)!\n ._insert(urlPaths.slice(1), slugNames, isCatchAll)\n }\n}\n\nexport function getSortedRoutes(\n normalizedPages: ReadonlyArray<string>\n): string[] {\n // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment\n // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js\n // Only 1 dynamic segment per nesting level\n\n // So in the case that is test/integration/dynamic-routing it'll be this:\n // pages/[post]/comments.js\n // pages/blog/[post]/comment/[id].js\n // Both are fine because `pages/[post]` and `pages/blog` are on the same level\n // So in this case `UrlNode` created here has `this.slugName === 'post'`\n // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities\n // Instead what has to be passed through is the upwards path's dynamic names\n const root = new UrlNode()\n\n // Here the `root` gets injected multiple paths, and insert will break them up into sublevels\n normalizedPages.forEach((pagePath) => root.insert(pagePath))\n // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority\n return root.smoosh()\n}\n\nexport function getSortedRouteObjects<T>(\n objects: T[],\n getter: (obj: T) => string\n): T[] {\n // We're assuming here that all the pathnames are unique, that way we can\n // sort the list and use the index as the key.\n const indexes: Record<string, number> = {}\n const pathnames: string[] = []\n for (let i = 0; i < objects.length; i++) {\n const pathname = getter(objects[i])\n indexes[pathname] = i\n pathnames[i] = pathname\n }\n\n // Sort the pathnames.\n const sorted = getSortedRoutes(pathnames)\n\n // Map the sorted pathnames back to the original objects using the new sorted\n // index.\n return sorted.map((pathname) => objects[indexes[pathname]])\n}\n","/**\n * For a given page path, this function ensures that there is a leading slash.\n * If there is not a leading slash, one is added, otherwise it is noop.\n */\nexport function ensureLeadingSlash(path: string) {\n return path.startsWith('/') ? path : `/${path}`\n}\n","import type { Segment } from '../../server/app-render/types'\n\nexport function isGroupSegment(segment: string) {\n // Use array[0] for performant purpose\n return segment[0] === '(' && segment.endsWith(')')\n}\n\nexport function isParallelRouteSegment(segment: string) {\n return segment.startsWith('@') && segment !== '@children'\n}\n\nexport function addSearchParamsIfPageSegment(\n segment: Segment,\n searchParams: Record<string, string | string[] | undefined>\n) {\n const isPageSegment = segment.includes(PAGE_SEGMENT_KEY)\n\n if (isPageSegment) {\n const stringifiedQuery = JSON.stringify(searchParams)\n return stringifiedQuery !== '{}'\n ? PAGE_SEGMENT_KEY + '?' + stringifiedQuery\n : PAGE_SEGMENT_KEY\n }\n\n return segment\n}\n\nexport const PAGE_SEGMENT_KEY = '__PAGE__'\nexport const DEFAULT_SEGMENT_KEY = '__DEFAULT__'\n","import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'\nimport { isGroupSegment } from '../../segment'\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport function normalizeAppPath(route: string) {\n return ensureLeadingSlash(\n route.split('/').reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname\n }\n\n // Parallel segments are ignored.\n if (segment[0] === '@') {\n return pathname\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === 'page' || segment === 'route') &&\n index === segments.length - 1\n ) {\n return pathname\n }\n\n return `${pathname}/${segment}`\n }, '')\n )\n}\n\n/**\n * Strips the `.rsc` extension if it's in the pathname.\n * Since this function is used on full urls it checks `?` for searchParams handling.\n */\nexport function normalizeRscURL(url: string) {\n return url.replace(\n /\\.rsc($|\\?)/,\n // $1 ensures `?` is preserved\n '$1'\n )\n}\n","import { normalizeAppPath } from './app-paths'\n\n// order matters here, the first match will be used\nexport const INTERCEPTION_ROUTE_MARKERS = [\n '(..)(..)',\n '(.)',\n '(..)',\n '(...)',\n] as const\n\nexport function isInterceptionRouteAppPath(path: string): boolean {\n // TODO-APP: add more serious validation\n return (\n path\n .split('/')\n .find((segment) =>\n INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n ) !== undefined\n )\n}\n\nexport function extractInterceptionRouteInformation(path: string) {\n let interceptingRoute: string | undefined,\n marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined,\n interceptedRoute: string | undefined\n\n for (const segment of path.split('/')) {\n marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n if (marker) {\n ;[interceptingRoute, interceptedRoute] = path.split(marker, 2)\n break\n }\n }\n\n if (!interceptingRoute || !marker || !interceptedRoute) {\n throw new Error(\n `Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`\n )\n }\n\n interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed\n\n switch (marker) {\n case '(.)':\n // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route\n if (interceptingRoute === '/') {\n interceptedRoute = `/${interceptedRoute}`\n } else {\n interceptedRoute = interceptingRoute + '/' + interceptedRoute\n }\n break\n case '(..)':\n // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route\n if (interceptingRoute === '/') {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`\n )\n }\n interceptedRoute = interceptingRoute\n .split('/')\n .slice(0, -1)\n .concat(interceptedRoute)\n .join('/')\n break\n case '(...)':\n // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route\n interceptedRoute = '/' + interceptedRoute\n break\n case '(..)(..)':\n // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route\n\n const splitInterceptingRoute = interceptingRoute.split('/')\n if (splitInterceptingRoute.length <= 2) {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`\n )\n }\n\n interceptedRoute = splitInterceptingRoute\n .slice(0, -2)\n .concat(interceptedRoute)\n .join('/')\n break\n default:\n throw new Error('Invariant: unexpected marker')\n }\n\n return { interceptingRoute, interceptedRoute }\n}\n","import {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from './interception-routes'\n\n// Identify /.*[param].*/ in route string\nconst TEST_ROUTE = /\\/[^/]*\\[[^/]+\\][^/]*(?=\\/|$)/\n\n// Identify /[param]/ in route string\nconst TEST_STRICT_ROUTE = /\\/\\[[^/]+\\](?=\\/|$)/\n\n/**\n * Check if a route is dynamic.\n *\n * @param route - The route to check.\n * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true).\n * @returns Whether the route is dynamic.\n */\nexport function isDynamicRoute(route: string, strict: boolean = true): boolean {\n if (isInterceptionRouteAppPath(route)) {\n route = extractInterceptionRouteInformation(route).interceptedRoute\n }\n\n if (strict) {\n return TEST_STRICT_ROUTE.test(route)\n }\n\n return TEST_ROUTE.test(route)\n}\n","export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'\nexport { isDynamicRoute } from './is-dynamic'\n","import type { Group } from './route-regex'\nimport { DecodeError } from '../../utils'\nimport type { Params } from '../../../../server/request/params'\n\nexport interface RouteMatchFn {\n (pathname: string): false | Params\n}\n\ntype RouteMatcherOptions = {\n // We only use the exec method of the RegExp object. This helps us avoid using\n // type assertions that the passed in properties are of the correct type.\n re: Pick<RegExp, 'exec'>\n groups: Record<string, Group>\n}\n\nexport function getRouteMatcher({\n re,\n groups,\n}: RouteMatcherOptions): RouteMatchFn {\n return (pathname: string) => {\n const routeMatch = re.exec(pathname)\n if (!routeMatch) return false\n\n const decode = (param: string) => {\n try {\n return decodeURIComponent(param)\n } catch {\n throw new DecodeError('failed to decode param')\n }\n }\n\n const params: Params = {}\n for (const [key, group] of Object.entries(groups)) {\n const match = routeMatch[group.pos]\n if (match !== undefined) {\n if (group.repeat) {\n params[key] = match.split('/').map((entry) => decode(entry))\n } else {\n params[key] = decode(match)\n }\n }\n }\n\n return params\n }\n}\n","import type { ServerRuntime } from '../types'\n\nexport const NEXT_QUERY_PARAM_PREFIX = 'nxtP'\nexport const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'\n\nexport const MATCHED_PATH_HEADER = 'x-matched-path'\nexport const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'\nexport const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =\n 'x-prerender-revalidate-if-generated'\n\nexport const RSC_PREFETCH_SUFFIX = '.prefetch.rsc'\nexport const RSC_SEGMENTS_DIR_SUFFIX = '.segments'\nexport const RSC_SEGMENT_SUFFIX = '.segment.rsc'\nexport const RSC_SUFFIX = '.rsc'\nexport const ACTION_SUFFIX = '.action'\nexport const NEXT_DATA_SUFFIX = '.json'\nexport const NEXT_META_SUFFIX = '.meta'\nexport const NEXT_BODY_SUFFIX = '.body'\n\nexport const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'\nexport const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'\nexport const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER =\n 'x-next-revalidate-tag-token'\n\nexport const NEXT_RESUME_HEADER = 'next-resume'\n\n// if these change make sure we update the related\n// documentation as well\nexport const NEXT_CACHE_TAG_MAX_ITEMS = 128\nexport const NEXT_CACHE_TAG_MAX_LENGTH = 256\nexport const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024\nexport const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'\n\n// in seconds\nexport const CACHE_ONE_YEAR = 31536000\n\n// in seconds, represents revalidate=false. I.e. never revaliate.\n// We use this value since it can be represented as a V8 SMI for optimal performance.\n// It can also be serialized as JSON if it ever leaks accidentally as an actual value.\nexport const INFINITE_CACHE = 0xfffffffe\n\n// Patterns to detect middleware files\nexport const MIDDLEWARE_FILENAME = 'middleware'\nexport const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`\n\n// Pattern to detect instrumentation hooks file\nexport const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'\n\n// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,\n// we have to use a private alias\nexport const PAGES_DIR_ALIAS = 'private-next-pages'\nexport const DOT_NEXT_ALIAS = 'private-dot-next'\nexport const ROOT_DIR_ALIAS = 'private-next-root-dir'\nexport const APP_DIR_ALIAS = 'private-next-app-dir'\nexport const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'\nexport const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'\nexport const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'\nexport const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'\nexport const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'\nexport const RSC_ACTION_CLIENT_WRAPPER_ALIAS =\n 'private-next-rsc-action-client-wrapper'\n\nexport const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`\n\nexport const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`\n\nexport const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`\n\nexport const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`\n\nexport const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`\n\nexport const SERVER_PROPS_EXPORT_ERROR = `pages with \\`getServerSideProps\\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`\n\nexport const GSP_NO_RETURNED_VALUE =\n 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'\nexport const GSSP_NO_RETURNED_VALUE =\n 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'\n\nexport const UNSTABLE_REVALIDATE_RENAME_ERROR =\n 'The `unstable_revalidate` property is available for general use.\\n' +\n 'Please use `revalidate` instead.'\n\nexport const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`\n\nexport const NON_STANDARD_NODE_ENV = `You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`\n\nexport const SSG_FALLBACK_EXPORT_ERROR = `Pages with \\`fallback\\` enabled in \\`getStaticPaths\\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`\n\nexport const ESLINT_DEFAULT_DIRS = ['app', 'pages', 'components', 'lib', 'src']\n\nexport const SERVER_RUNTIME: Record<string, ServerRuntime> = {\n edge: 'edge',\n experimentalEdge: 'experimental-edge',\n nodejs: 'nodejs',\n}\n\n/**\n * The names of the webpack layers. These layers are the primitives for the\n * webpack chunks.\n */\nconst WEBPACK_LAYERS_NAMES = {\n /**\n * The layer for the shared code between the client and server bundles.\n */\n shared: 'shared',\n /**\n * The layer for server-only runtime and picking up `react-server` export conditions.\n * Including app router RSC pages and app router custom routes and metadata routes.\n */\n reactServerComponents: 'rsc',\n /**\n * Server Side Rendering layer for app (ssr).\n */\n serverSideRendering: 'ssr',\n /**\n * The browser client bundle layer for actions.\n */\n actionBrowser: 'action-browser',\n /**\n * The Node.js bundle layer for the API routes.\n */\n apiNode: 'api-node',\n /**\n * The Edge Lite bundle layer for the API routes.\n */\n apiEdge: 'api-edge',\n /**\n * The layer for the middleware code.\n */\n middleware: 'middleware',\n /**\n * The layer for the instrumentation hooks.\n */\n instrument: 'instrument',\n /**\n * The layer for assets on the edge.\n */\n edgeAsset: 'edge-asset',\n /**\n * The browser client bundle layer for App directory.\n */\n appPagesBrowser: 'app-pages-browser',\n /**\n * The browser client bundle layer for Pages directory.\n */\n pagesDirBrowser: 'pages-dir-browser',\n /**\n * The Edge Lite bundle layer for Pages directory.\n */\n pagesDirEdge: 'pages-dir-edge',\n /**\n * The Node.js bundle layer for Pages directory.\n */\n pagesDirNode: 'pages-dir-node',\n} as const\n\nexport type WebpackLayerName =\n (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]\n\nconst WEBPACK_LAYERS = {\n ...WEBPACK_LAYERS_NAMES,\n GROUP: {\n builtinReact: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n serverOnly: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n neutralTarget: [\n // pages api\n WEBPACK_LAYERS_NAMES.apiNode,\n WEBPACK_LAYERS_NAMES.apiEdge,\n ],\n clientOnly: [\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n ],\n bundled: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.shared,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n appPages: [\n // app router pages and layouts\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n },\n}\n\nconst WEBPACK_RESOURCE_QUERIES = {\n edgeSSREntry: '__next_edge_ssr_entry__',\n metadata: '__next_metadata__',\n metadataRoute: '__next_metadata_route__',\n metadataImageMeta: '__next_metadata_image_meta__',\n}\n\nexport { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }\n","// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g\n\nexport function escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&')\n }\n return str\n}\n","import {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../../../lib/constants'\nimport { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'\nimport { escapeStringRegexp } from '../../escape-regexp'\nimport { removeTrailingSlash } from './remove-trailing-slash'\n\nexport interface Group {\n pos: number\n repeat: boolean\n optional: boolean\n}\n\nexport interface RouteRegex {\n groups: { [groupName: string]: Group }\n re: RegExp\n}\n\ntype GetNamedRouteRegexOptions = {\n /**\n * Whether to prefix the route keys with the NEXT_INTERCEPTION_MARKER_PREFIX\n * or NEXT_QUERY_PARAM_PREFIX. This is only relevant when creating the\n * routes-manifest during the build.\n */\n prefixRouteKeys: boolean\n\n /**\n * Whether to include the suffix in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n\n /**\n * Whether to backtrack duplicate keys. This is only relevant when creating\n * the routes-manifest during the build.\n */\n backreferenceDuplicateKeys?: boolean\n}\n\ntype GetRouteRegexOptions = {\n /**\n * Whether to include extra parts in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n * of adding this option.\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n}\n\n/**\n * Regular expression pattern used to match route parameters.\n * Matches both single parameters and parameter groups.\n * Examples:\n * - `[[...slug]]` matches parameter group with key 'slug', repeat: true, optional: true\n * - `[...slug]` matches parameter group with key 'slug', repeat: true, optional: false\n * - `[[foo]]` matches parameter with key 'foo', repeat: false, optional: true\n * - `[bar]` matches parameter with key 'bar', repeat: false, optional: false\n */\nconst PARAMETER_PATTERN = /^([^[]*)\\[((?:\\[[^\\]]*\\])|[^\\]]+)\\](.*)$/\n\n/**\n * Parses a given parameter from a route to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[[...slug]]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[[foo]]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `[bar]` -> `{ key: 'bar', repeat: false, optional: false }`\n * - `fizz` -> `{ key: 'fizz', repeat: false, optional: false }`\n * @param param - The parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nexport function parseParameter(param: string) {\n const match = param.match(PARAMETER_PATTERN)\n\n if (!match) {\n return parseMatchedParameter(param)\n }\n\n return parseMatchedParameter(match[2])\n}\n\n/**\n * Parses a matched parameter from the PARAMETER_PATTERN regex to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `...slug` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `bar` -> `{ key: 'bar', repeat: false, optional: false }`\n * @param param - The matched parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nfunction parseMatchedParameter(param: string) {\n const optional = param.startsWith('[') && param.endsWith(']')\n if (optional) {\n param = param.slice(1, -1)\n }\n const repeat = param.startsWith('...')\n if (repeat) {\n param = param.slice(3)\n }\n return { key: param, repeat, optional }\n}\n\nfunction getParametrizedRoute(\n route: string,\n includeSuffix: boolean,\n includePrefix: boolean\n) {\n const groups: { [groupName: string]: Group } = {}\n let groupIndex = 1\n\n const segments: string[] = []\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const markerMatch = INTERCEPTION_ROUTE_MARKERS.find((m) =>\n segment.startsWith(m)\n )\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n if (markerMatch && paramMatches && paramMatches[2]) {\n const { key, optional, repeat } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n segments.push(`/${escapeStringRegexp(markerMatch)}([^/]+?)`)\n } else if (paramMatches && paramMatches[2]) {\n const { key, repeat, optional } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n }\n\n let s = repeat ? (optional ? '(?:/(.+?))?' : '/(.+?)') : '/([^/]+?)'\n\n // Remove the leading slash if includePrefix already added it.\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n }\n }\n\n return {\n parameterizedRoute: segments.join(''),\n groups,\n }\n}\n\n/**\n * From a normalized route this function generates a regular expression and\n * a corresponding groups object intended to be used to store matching groups\n * from the regular expression.\n */\nexport function getRouteRegex(\n normalizedRoute: string,\n {\n includeSuffix = false,\n includePrefix = false,\n excludeOptionalTrailingSlash = false,\n }: GetRouteRegexOptions = {}\n): RouteRegex {\n const { parameterizedRoute, groups } = getParametrizedRoute(\n normalizedRoute,\n includeSuffix,\n includePrefix\n )\n\n let re = parameterizedRoute\n if (!excludeOptionalTrailingSlash) {\n re += '(?:/)?'\n }\n\n return {\n re: new RegExp(`^${re}$`),\n groups: groups,\n }\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let i = 0\n\n return () => {\n let routeKey = ''\n let j = ++i\n while (j > 0) {\n routeKey += String.fromCharCode(97 + ((j - 1) % 26))\n j = Math.floor((j - 1) / 26)\n }\n return routeKey\n }\n}\n\nfunction getSafeKeyFromSegment({\n interceptionMarker,\n getSafeRouteKey,\n segment,\n routeKeys,\n keyPrefix,\n backreferenceDuplicateKeys,\n}: {\n interceptionMarker?: string\n getSafeRouteKey: () => string\n segment: string\n routeKeys: Record<string, string>\n keyPrefix?: string\n backreferenceDuplicateKeys: boolean\n}) {\n const { key, optional, repeat } = parseMatchedParameter(segment)\n\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = key.replace(/\\W/g, '')\n\n if (keyPrefix) {\n cleanedKey = `${keyPrefix}${cleanedKey}`\n }\n let invalidKey = false\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) {\n invalidKey = true\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey()\n }\n\n const duplicateKey = cleanedKey in routeKeys\n\n if (keyPrefix) {\n routeKeys[cleanedKey] = `${keyPrefix}${key}`\n } else {\n routeKeys[cleanedKey] = key\n }\n\n // if the segment has an interception marker, make sure that's part of the regex pattern\n // this is to ensure that the route with the interception marker doesn't incorrectly match\n // the non-intercepted route (ie /app/(.)[username] should not match /app/[username])\n const interceptionPrefix = interceptionMarker\n ? escapeStringRegexp(interceptionMarker)\n : ''\n\n let pattern: string\n if (duplicateKey && backreferenceDuplicateKeys) {\n // Use a backreference to the key to ensure that the key is the same value\n // in each of the placeholders.\n pattern = `\\\\k<${cleanedKey}>`\n } else if (repeat) {\n pattern = `(?<${cleanedKey}>.+?)`\n } else {\n pattern = `(?<${cleanedKey}>[^/]+?)`\n }\n\n return optional\n ? `(?:/${interceptionPrefix}${pattern})?`\n : `/${interceptionPrefix}${pattern}`\n}\n\nfunction getNamedParametrizedRoute(\n route: string,\n prefixRouteKeys: boolean,\n includeSuffix: boolean,\n includePrefix: boolean,\n backreferenceDuplicateKeys: boolean\n) {\n const getSafeRouteKey = buildGetSafeRouteKey()\n const routeKeys: { [named: string]: string } = {}\n\n const segments: string[] = []\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const hasInterceptionMarker = INTERCEPTION_ROUTE_MARKERS.some((m) =>\n segment.startsWith(m)\n )\n\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n if (hasInterceptionMarker && paramMatches && paramMatches[2]) {\n // If there's an interception marker, add it to the segments.\n segments.push(\n getSafeKeyFromSegment({\n getSafeRouteKey,\n interceptionMarker: paramMatches[1],\n segment: paramMatches[2],\n routeKeys,\n keyPrefix: prefixRouteKeys\n ? NEXT_INTERCEPTION_MARKER_PREFIX\n : undefined,\n backreferenceDuplicateKeys,\n })\n )\n } else if (paramMatches && paramMatches[2]) {\n // If there's a prefix, add it to the segments if it's enabled.\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n }\n\n let s = getSafeKeyFromSegment({\n getSafeRouteKey,\n segment: paramMatches[2],\n routeKeys,\n keyPrefix: prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined,\n backreferenceDuplicateKeys,\n })\n\n // Remove the leading slash if includePrefix already added it.\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n }\n }\n\n return {\n namedParameterizedRoute: segments.join(''),\n routeKeys,\n }\n}\n\n/**\n * This function extends `getRouteRegex` generating also a named regexp where\n * each group is named along with a routeKeys object that indexes the assigned\n * named group with its corresponding key. When the routeKeys need to be\n * prefixed to uniquely identify internally the \"prefixRouteKey\" arg should\n * be \"true\" currently this is only the case when creating the routes-manifest\n * during the build\n */\nexport function getNamedRouteRegex(\n normalizedRoute: string,\n options: GetNamedRouteRegexOptions\n) {\n const result = getNamedParametrizedRoute(\n normalizedRoute,\n options.prefixRouteKeys,\n options.includeSuffix ?? false,\n options.includePrefix ?? false,\n options.backreferenceDuplicateKeys ?? false\n )\n\n let namedRegex = result.namedParameterizedRoute\n if (!options.excludeOptionalTrailingSlash) {\n namedRegex += '(?:/)?'\n }\n\n return {\n ...getRouteRegex(normalizedRoute, options),\n namedRegex: `^${namedRegex}$`,\n routeKeys: result.routeKeys,\n }\n}\n\n/**\n * Generates a named regexp.\n * This is intended to be using for build time only.\n */\nexport function getNamedMiddlewareRegex(\n normalizedRoute: string,\n options: {\n catchAll?: boolean\n }\n) {\n const { parameterizedRoute } = getParametrizedRoute(\n normalizedRoute,\n false,\n false\n )\n const { catchAll = true } = options\n if (parameterizedRoute === '/') {\n let catchAllRegex = catchAll ? '.*' : ''\n return {\n namedRegex: `^/${catchAllRegex}$`,\n }\n }\n\n const { namedParameterizedRoute } = getNamedParametrizedRoute(\n normalizedRoute,\n false,\n false,\n false,\n false\n )\n let catchAllGroupedRegex = catchAll ? '(?:(/.*)?)' : ''\n return {\n namedRegex: `^${namedParameterizedRoute}${catchAllGroupedRegex}$`,\n }\n}\n","import type { ParsedUrlQuery } from 'querystring'\n\nimport { getRouteMatcher } from './route-matcher'\nimport { getRouteRegex } from './route-regex'\n\nexport function interpolateAs(\n route: string,\n asPathname: string,\n query: ParsedUrlQuery\n) {\n let interpolatedRoute = ''\n\n const dynamicRegex = getRouteRegex(route)\n const dynamicGroups = dynamicRegex.groups\n const dynamicMatches =\n // Try to match the dynamic route against the asPath\n (asPathname !== route ? getRouteMatcher(dynamicRegex)(asPathname) : '') ||\n // Fall back to reading the values from the href\n // TODO: should this take priority; also need to change in the router.\n query\n\n interpolatedRoute = route\n const params = Object.keys(dynamicGroups)\n\n if (\n !params.every((param) => {\n let value = dynamicMatches[param] || ''\n const { repeat, optional } = dynamicGroups[param]\n\n // support single-level catch-all\n // TODO: more robust handling for user-error (passing `/`)\n let replaced = `[${repeat ? '...' : ''}${param}]`\n if (optional) {\n replaced = `${!value ? '/' : ''}[${replaced}]`\n }\n if (repeat && !Array.isArray(value)) value = [value]\n\n return (\n (optional || param in dynamicMatches) &&\n // Interpolate group into data URL if present\n (interpolatedRoute =\n interpolatedRoute!.replace(\n replaced,\n repeat\n ? (value as string[])\n .map(\n // these values should be fully encoded instead of just\n // path delimiter escaped since they are being inserted\n // into the URL and we expect URL encoded segments\n // when parsing dynamic route params\n (segment) => encodeURIComponent(segment)\n )\n .join('/')\n : encodeURIComponent(value as string)\n ) || '/')\n )\n })\n ) {\n interpolatedRoute = '' // did not satisfy all requirements\n\n // n.b. We ignore this error because we handle warning for this case in\n // development in the `<Link>` component directly.\n }\n return {\n params,\n result: interpolatedRoute,\n }\n}\n","import type { NextRouter, Url } from '../shared/lib/router/router'\n\nimport { searchParamsToUrlQuery } from '../shared/lib/router/utils/querystring'\nimport { formatWithValidation } from '../shared/lib/router/utils/format-url'\nimport { omit } from '../shared/lib/router/utils/omit'\nimport { normalizeRepeatedSlashes } from '../shared/lib/utils'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\nimport { isLocalURL } from '../shared/lib/router/utils/is-local-url'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { interpolateAs } from '../shared/lib/router/utils/interpolate-as'\n\n/**\n * Resolves a given hyperlink with a certain router state (basePath not included).\n * Preserves absolute urls.\n */\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs: true\n): [string, string] | [string]\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: false\n): string\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: boolean\n): [string, string] | [string] | string {\n // we use a dummy base url for relative urls\n let base: URL\n let urlAsString = typeof href === 'string' ? href : formatWithValidation(href)\n\n // repeated slashes and backslashes in the URL are considered\n // invalid and will never match a Next.js page/file\n const urlProtoMatch = urlAsString.match(/^[a-zA-Z]{1,}:\\/\\//)\n const urlAsStringNoProto = urlProtoMatch\n ? urlAsString.slice(urlProtoMatch[0].length)\n : urlAsString\n\n const urlParts = urlAsStringNoProto.split('?', 1)\n\n if ((urlParts[0] || '').match(/(\\/\\/|\\\\)/)) {\n console.error(\n `Invalid href '${urlAsString}' passed to next/router in page: '${router.pathname}'. Repeated forward-slashes (//) or backslashes \\\\ are not valid in the href.`\n )\n const normalizedUrl = normalizeRepeatedSlashes(urlAsStringNoProto)\n urlAsString = (urlProtoMatch ? urlProtoMatch[0] : '') + normalizedUrl\n }\n\n // Return because it cannot be routed by the Next.js router\n if (!isLocalURL(urlAsString)) {\n return (resolveAs ? [urlAsString] : urlAsString) as string\n }\n\n try {\n base = new URL(\n urlAsString.startsWith('#') ? router.asPath : router.pathname,\n 'http://n'\n )\n } catch (_) {\n // fallback to / for invalid asPath values e.g. //\n base = new URL('/', 'http://n')\n }\n\n try {\n const finalUrl = new URL(urlAsString, base)\n finalUrl.pathname = normalizePathTrailingSlash(finalUrl.pathname)\n let interpolatedAs = ''\n\n if (\n isDynamicRoute(finalUrl.pathname) &&\n finalUrl.searchParams &&\n resolveAs\n ) {\n const query = searchParamsToUrlQuery(finalUrl.searchParams)\n\n const { result, params } = interpolateAs(\n finalUrl.pathname,\n finalUrl.pathname,\n query\n )\n\n if (result) {\n interpolatedAs = formatWithValidation({\n pathname: result,\n hash: finalUrl.hash,\n query: omit(query, params),\n })\n }\n }\n\n // if the origin didn't change, it means we received a relative href\n const resolvedHref =\n finalUrl.origin === base.origin\n ? finalUrl.href.slice(finalUrl.origin.length)\n : finalUrl.href\n\n return resolveAs\n ? [resolvedHref, interpolatedAs || resolvedHref]\n : resolvedHref\n } catch (_) {\n return resolveAs ? [urlAsString] : urlAsString\n }\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Adds the provided prefix to the given path. It first ensures that the path\n * is indeed starting with a slash.\n */\nexport function addPathPrefix(path: string, prefix?: string) {\n if (!path.startsWith('/') || !prefix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${prefix}${pathname}${query}${hash}`\n}\n","import { addPathPrefix } from './add-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\n\n/**\n * For a given path and a locale, if the locale is given, it will prefix the\n * locale. The path shouldn't be an API path. If a default locale is given the\n * prefix will be omitted if the locale is already the default locale.\n */\nexport function addLocale(\n path: string,\n locale?: string | false,\n defaultLocale?: string,\n ignorePrefix?: boolean\n) {\n // If no locale was given or the locale is the default locale, we don't need\n // to prefix the path.\n if (!locale || locale === defaultLocale) return path\n\n const lower = path.toLowerCase()\n\n // If the path is an API path or the path already has the locale prefix, we\n // don't need to prefix the path.\n if (!ignorePrefix) {\n if (pathHasPrefix(lower, '/api')) return path\n if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path\n }\n\n // Add the locale prefix to the path.\n return addPathPrefix(path, `/${locale}`)\n}\n","import type { addLocale as Fn } from '../shared/lib/router/utils/add-locale'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nexport const addLocale: typeof Fn = (path, ...args) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return normalizePathTrailingSlash(\n require('../shared/lib/router/utils/add-locale').addLocale(path, ...args)\n )\n }\n return path\n}\n","\"use strict\";\n\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n}\nexports._ = _interop_require_default;\n","import React from 'react'\nimport type { NextRouter } from './router/router'\n\nexport const RouterContext = React.createContext<NextRouter | null>(null)\n\nif (process.env.NODE_ENV !== 'production') {\n RouterContext.displayName = 'RouterContext'\n}\n","export const requestIdleCallback =\n (typeof self !== 'undefined' &&\n self.requestIdleCallback &&\n self.requestIdleCallback.bind(window)) ||\n function (cb: IdleRequestCallback): number {\n let start = Date.now()\n return self.setTimeout(function () {\n cb({\n didTimeout: false,\n timeRemaining: function () {\n return Math.max(0, 50 - (Date.now() - start))\n },\n })\n }, 1)\n }\n\nexport const cancelIdleCallback =\n (typeof self !== 'undefined' &&\n self.cancelIdleCallback &&\n self.cancelIdleCallback.bind(window)) ||\n function (id: number) {\n return clearTimeout(id)\n }\n","import { useCallback, useEffect, useRef, useState } from 'react'\nimport {\n requestIdleCallback,\n cancelIdleCallback,\n} from './request-idle-callback'\n\ntype UseIntersectionObserverInit = Pick<\n IntersectionObserverInit,\n 'rootMargin' | 'root'\n>\n\ntype UseIntersection = { disabled?: boolean } & UseIntersectionObserverInit & {\n rootRef?: React.RefObject<HTMLElement | null> | null\n }\ntype ObserveCallback = (isVisible: boolean) => void\ntype Identifier = {\n root: Element | Document | null\n margin: string\n}\ntype Observer = {\n id: Identifier\n observer: IntersectionObserver\n elements: Map<Element, ObserveCallback>\n}\n\nconst hasIntersectionObserver = typeof IntersectionObserver === 'function'\n\nconst observers = new Map<Identifier, Observer>()\nconst idList: Identifier[] = []\n\nfunction createObserver(options: UseIntersectionObserverInit): Observer {\n const id = {\n root: options.root || null,\n margin: options.rootMargin || '',\n }\n const existing = idList.find(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n let instance: Observer | undefined\n\n if (existing) {\n instance = observers.get(existing)\n if (instance) {\n return instance\n }\n }\n\n const elements = new Map<Element, ObserveCallback>()\n const observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = elements.get(entry.target)\n const isVisible = entry.isIntersecting || entry.intersectionRatio > 0\n if (callback && isVisible) {\n callback(isVisible)\n }\n })\n }, options)\n instance = {\n id,\n observer,\n elements,\n }\n\n idList.push(id)\n observers.set(id, instance)\n return instance\n}\n\nfunction observe(\n element: Element,\n callback: ObserveCallback,\n options: UseIntersectionObserverInit\n): () => void {\n const { id, observer, elements } = createObserver(options)\n elements.set(element, callback)\n\n observer.observe(element)\n return function unobserve(): void {\n elements.delete(element)\n observer.unobserve(element)\n\n // Destroy observer when there's nothing left to watch:\n if (elements.size === 0) {\n observer.disconnect()\n observers.delete(id)\n const index = idList.findIndex(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n if (index > -1) {\n idList.splice(index, 1)\n }\n }\n }\n}\n\nexport function useIntersection<T extends Element>({\n rootRef,\n rootMargin,\n disabled,\n}: UseIntersection): [(element: T | null) => void, boolean, () => void] {\n const isDisabled: boolean = disabled || !hasIntersectionObserver\n\n const [visible, setVisible] = useState(false)\n const elementRef = useRef<T | null>(null)\n const setElement = useCallback((element: T | null) => {\n elementRef.current = element\n }, [])\n\n useEffect(() => {\n if (hasIntersectionObserver) {\n if (isDisabled || visible) return\n\n const element = elementRef.current\n if (element && element.tagName) {\n const unobserve = observe(\n element,\n (isVisible) => isVisible && setVisible(isVisible),\n { root: rootRef?.current, rootMargin }\n )\n\n return unobserve\n }\n } else {\n if (!visible) {\n const idleCallback = requestIdleCallback(() => setVisible(true))\n return () => cancelIdleCallback(idleCallback)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled, rootMargin, rootRef, visible, elementRef.current])\n\n const resetVisible = useCallback(() => {\n setVisible(false)\n }, [])\n\n return [setElement, visible, resetVisible]\n}\n","export interface PathLocale {\n detectedLocale?: string\n pathname: string\n}\n\n/**\n * A cache of lowercased locales for each list of locales. This is stored as a\n * WeakMap so if the locales are garbage collected, the cache entry will be\n * removed as well.\n */\nconst cache = new WeakMap<readonly string[], readonly string[]>()\n\n/**\n * For a pathname that may include a locale from a list of locales, it\n * removes the locale from the pathname returning it alongside with the\n * detected locale.\n *\n * @param pathname A pathname that may include a locale.\n * @param locales A list of locales.\n * @returns The detected locale and pathname without locale\n */\nexport function normalizeLocalePath(\n pathname: string,\n locales?: readonly string[]\n): PathLocale {\n // If locales is undefined, return the pathname as is.\n if (!locales) return { pathname }\n\n // Get the cached lowercased locales or create a new cache entry.\n let lowercasedLocales = cache.get(locales)\n if (!lowercasedLocales) {\n lowercasedLocales = locales.map((locale) => locale.toLowerCase())\n cache.set(locales, lowercasedLocales)\n }\n\n let detectedLocale: string | undefined\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n\n // If there's no second segment (ie, the pathname is just `/`), there's no\n // locale.\n if (!segments[1]) return { pathname }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = lowercasedLocales.indexOf(segment)\n if (index < 0) return { pathname }\n\n // Return the case-sensitive locale.\n detectedLocale = locales[index]\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return { pathname, detectedLocale }\n}\n","import type { normalizeLocalePath as Fn } from '../shared/lib/i18n/normalize-locale-path'\n\nexport const normalizeLocalePath: typeof Fn = (pathname, locales) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return require('../shared/lib/i18n/normalize-locale-path').normalizeLocalePath(\n pathname,\n locales\n )\n }\n return { pathname, detectedLocale: undefined }\n}\n","import type { DomainLocale } from '../../../server/config-shared'\n\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string\n) {\n if (!domainItems) return\n\n if (detectedLocale) {\n detectedLocale = detectedLocale.toLowerCase()\n }\n\n for (const item of domainItems) {\n // remove port if present\n const domainHostname = item.domain?.split(':', 1)[0].toLowerCase()\n if (\n hostname === domainHostname ||\n detectedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === detectedLocale)\n ) {\n return item\n }\n }\n}\n","import type { detectDomainLocale as Fn } from '../shared/lib/i18n/detect-domain-locale'\n\nexport const detectDomainLocale: typeof Fn = (...args) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return require('../shared/lib/i18n/detect-domain-locale').detectDomainLocale(\n ...args\n )\n }\n}\n","import type { DomainLocale } from '../server/config'\nimport type { normalizeLocalePath as NormalizeFn } from './normalize-locale-path'\nimport type { detectDomainLocale as DetectFn } from './detect-domain-locale'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function getDomainLocale(\n path: string,\n locale?: string | false,\n locales?: readonly string[],\n domainLocales?: readonly DomainLocale[]\n) {\n if (process.env.__NEXT_I18N_SUPPORT) {\n const normalizeLocalePath: typeof NormalizeFn =\n require('./normalize-locale-path').normalizeLocalePath\n const detectDomainLocale: typeof DetectFn =\n require('./detect-domain-locale').detectDomainLocale\n\n const target = locale || normalizeLocalePath(path, locales).detectedLocale\n const domain = detectDomainLocale(domainLocales, undefined, target)\n if (domain) {\n const proto = `http${domain.http ? '' : 's'}://`\n const finalLocale = target === domain.defaultLocale ? '' : `/${target}`\n return `${proto}${domain.domain}${normalizePathTrailingSlash(\n `${basePath}${finalLocale}${path}`\n )}`\n }\n return false\n } else {\n return false\n }\n}\n","import { addPathPrefix } from '../shared/lib/router/utils/add-path-prefix'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function addBasePath(path: string, required?: boolean): string {\n return normalizePathTrailingSlash(\n process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required\n ? path\n : addPathPrefix(path, basePath)\n )\n}\n","import { useCallback, useRef, type Ref } from 'react'\n\n// This is a compatibility hook to support React 18 and 19 refs.\n// In 19, a cleanup function from refs may be returned.\n// In 18, returning a cleanup function creates a warning.\n// Since we take userspace refs, we don't know ahead of time if a cleanup function will be returned.\n// This implements cleanup functions with the old behavior in 18.\n// We know refs are always called alternating with `null` and then `T`.\n// So a call with `null` means we need to call the previous cleanup functions.\nexport function useMergedRef<TElement>(\n refA: Ref<TElement>,\n refB: Ref<TElement>\n): Ref<TElement> {\n const cleanupA = useRef<(() => void) | null>(null)\n const cleanupB = useRef<(() => void) | null>(null)\n\n // NOTE: In theory, we could skip the wrapping if only one of the refs is non-null.\n // (this happens often if the user doesn't pass a ref to Link/Form/Image)\n // But this can cause us to leak a cleanup-ref into user code (e.g. via `<Link legacyBehavior>`),\n // and the user might pass that ref into ref-merging library that doesn't support cleanup refs\n // (because it hasn't been updated for React 19)\n // which can then cause things to blow up, because a cleanup-returning ref gets called with `null`.\n // So in practice, it's safer to be defensive and always wrap the ref, even on React 19.\n return useCallback(\n (current: TElement | null): void => {\n if (current === null) {\n const cleanupFnA = cleanupA.current\n if (cleanupFnA) {\n cleanupA.current = null\n cleanupFnA()\n }\n const cleanupFnB = cleanupB.current\n if (cleanupFnB) {\n cleanupB.current = null\n cleanupFnB()\n }\n } else {\n if (refA) {\n cleanupA.current = applyRef(refA, current)\n }\n if (refB) {\n cleanupB.current = applyRef(refB, current)\n }\n }\n },\n [refA, refB]\n )\n}\n\nfunction applyRef<TElement>(\n refA: NonNullable<Ref<TElement>>,\n current: TElement\n) {\n if (typeof refA === 'function') {\n const cleanup = refA(current)\n if (typeof cleanup === 'function') {\n return cleanup\n } else {\n return () => refA(null)\n }\n } else {\n refA.current = current\n return () => {\n refA.current = null\n }\n }\n}\n","let errorOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const errors = new Set<string>()\n errorOnce = (msg: string) => {\n if (!errors.has(msg)) {\n console.error(msg)\n }\n errors.add(msg)\n }\n}\n\nexport { errorOnce }\n","'use client'\n\nimport type {\n NextRouter,\n PrefetchOptions as RouterPrefetchOptions,\n} from '../shared/lib/router/router'\n\nimport React, { createContext, useContext } from 'react'\nimport type { UrlObject } from 'url'\nimport { resolveHref } from './resolve-href'\nimport { isLocalURL } from '../shared/lib/router/utils/is-local-url'\nimport { formatUrl } from '../shared/lib/router/utils/format-url'\nimport { isAbsoluteUrl } from '../shared/lib/utils'\nimport { addLocale } from './add-locale'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport type { AppRouterInstance } from '../shared/lib/app-router-context.shared-runtime'\nimport { useIntersection } from './use-intersection'\nimport { getDomainLocale } from './get-domain-locale'\nimport { addBasePath } from './add-base-path'\nimport { useMergedRef } from './use-merged-ref'\nimport { errorOnce } from '../shared/lib/utils/error-once'\n\ntype Url = string | UrlObject\ntype RequiredKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? never : K\n}[keyof T]\ntype OptionalKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? K : never\n}[keyof T]\n\ntype OnNavigateEventHandler = (event: { preventDefault: () => void }) => void\n\ntype InternalLinkProps = {\n /**\n * The path or URL to navigate to. It can also be an object.\n *\n * @example https://nextjs.org/docs/api-reference/next/link#with-url-object\n */\n href: Url\n /**\n * Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes).\n */\n as?: Url\n /**\n * Replace the current `history` state instead of adding a new url into the stack.\n *\n * @defaultValue `false`\n */\n replace?: boolean\n /**\n * Whether to override the default scroll behavior\n *\n * @example https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page\n *\n * @defaultValue `true`\n */\n scroll?: boolean\n /**\n * Update the path of the current page without rerunning [`getStaticProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props), [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props) or [`getInitialProps`](/docs/pages/api-reference/functions/get-initial-props).\n *\n * @defaultValue `false`\n */\n shallow?: boolean\n /**\n * Forces `Link` to send the `href` property to its child.\n *\n * @defaultValue `false`\n */\n passHref?: boolean\n /**\n * Prefetch the page in the background.\n * Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.\n *\n * In App Router:\n * - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.\n * - `true`: This will prefetch the full React Server Component data for all route segments, regardless of whether they contain a segment with `loading.js`.\n * - `false`: This will not prefetch any data, even on hover.\n *\n * In Pages Router:\n * - `true` (default): The full route & its data will be prefetched.\n * - `false`: Prefetching will not happen when entering the viewport, but will still happen on hover.\n * @defaultValue `true` (pages router) or `null` (app router)\n */\n prefetch?: boolean | null\n /**\n * The active locale is automatically prepended. `locale` allows for providing a different locale.\n * When `false` `href` has to include the locale as the default behavior is disabled.\n * Note: This is only available in the Pages Router.\n */\n locale?: string | false\n /**\n * Enable legacy link behavior.\n * @deprecated This will be removed in v16\n * @defaultValue `false`\n * @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7\n */\n legacyBehavior?: boolean\n /**\n * Optional event handler for when the mouse pointer is moved onto Link\n */\n onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when Link is touched.\n */\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when Link is clicked.\n */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when the `<Link>` is navigated.\n */\n onNavigate?: OnNavigateEventHandler\n}\n\n// TODO-APP: Include the full set of Anchor props\n// adding this to the publicly exported type currently breaks existing apps\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when the webpack plugin runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type LinkProps<RouteInferType = any> = InternalLinkProps\ntype LinkPropsRequired = RequiredKeys<LinkProps>\ntype LinkPropsOptional = OptionalKeys<InternalLinkProps>\n\nconst prefetched = new Set<string>()\n\ntype PrefetchOptions = RouterPrefetchOptions & {\n /**\n * bypassPrefetchedCheck will bypass the check to see if the `href` has\n * already been fetched.\n */\n bypassPrefetchedCheck?: boolean\n}\n\nfunction prefetch(\n router: NextRouter,\n href: string,\n as: string,\n options: PrefetchOptions\n): void {\n if (typeof window === 'undefined') {\n return\n }\n\n if (!isLocalURL(href)) {\n return\n }\n\n // We should only dedupe requests when experimental.optimisticClientCache is\n // disabled.\n if (!options.bypassPrefetchedCheck) {\n const locale =\n // Let the link's locale prop override the default router locale.\n typeof options.locale !== 'undefined'\n ? options.locale\n : // Otherwise fallback to the router's locale.\n 'locale' in router\n ? router.locale\n : undefined\n\n const prefetchedKey = href + '%' + as + '%' + locale\n\n // If we've already fetched the key, then don't prefetch it again!\n if (prefetched.has(prefetchedKey)) {\n return\n }\n\n // Mark this URL as prefetched.\n prefetched.add(prefetchedKey)\n }\n\n // Prefetch the JSON page if asked (only in the client)\n // We need to handle a prefetch error here since we may be\n // loading with priority which can reject but we don't\n // want to force navigation since this is only a prefetch\n router.prefetch(href, as, options).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n // rethrow to show invalid URL errors\n throw err\n }\n })\n}\n\nfunction isModifiedEvent(event: React.MouseEvent): boolean {\n const eventTarget = event.currentTarget as HTMLAnchorElement | SVGAElement\n const target = eventTarget.getAttribute('target')\n return (\n (target && target !== '_self') ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey || // triggers resource download\n (event.nativeEvent && event.nativeEvent.which === 2)\n )\n}\n\nfunction linkClicked(\n e: React.MouseEvent,\n router: NextRouter | AppRouterInstance,\n href: string,\n as: string,\n replace?: boolean,\n shallow?: boolean,\n scroll?: boolean,\n locale?: string | false,\n onNavigate?: OnNavigateEventHandler\n): void {\n const { nodeName } = e.currentTarget\n\n // anchors inside an svg have a lowercase nodeName\n const isAnchorNodeName = nodeName.toUpperCase() === 'A'\n\n if (\n (isAnchorNodeName && isModifiedEvent(e)) ||\n e.currentTarget.hasAttribute('download')\n ) {\n // ignore click for browser’s default behavior\n return\n }\n\n if (!isLocalURL(href)) {\n if (replace) {\n // browser default behavior does not replace the history state\n // so we need to do it manually\n e.preventDefault()\n location.replace(href)\n }\n\n // ignore click for browser’s default behavior\n return\n }\n\n e.preventDefault()\n\n const navigate = () => {\n if (onNavigate) {\n let isDefaultPrevented = false\n\n onNavigate({\n preventDefault: () => {\n isDefaultPrevented = true\n },\n })\n\n if (isDefaultPrevented) {\n return\n }\n }\n\n // If the router is an NextRouter instance it will have `beforePopState`\n const routerScroll = scroll ?? true\n if ('beforePopState' in router) {\n router[replace ? 'replace' : 'push'](href, as, {\n shallow,\n locale,\n scroll: routerScroll,\n })\n } else {\n router[replace ? 'replace' : 'push'](as || href, {\n scroll: routerScroll,\n })\n }\n }\n\n navigate()\n}\n\ntype LinkPropsReal = React.PropsWithChildren<\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> &\n LinkProps\n>\n\nfunction formatStringOrUrl(urlObjOrString: UrlObject | string): string {\n if (typeof urlObjOrString === 'string') {\n return urlObjOrString\n }\n\n return formatUrl(urlObjOrString)\n}\n\n/**\n * A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)\n * and client-side navigation between routes.\n *\n * It is the primary way to navigate between routes in Next.js.\n *\n * Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)\n */\nconst Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(\n function LinkComponent(props, forwardedRef) {\n let children: React.ReactNode\n\n const {\n href: hrefProp,\n as: asProp,\n children: childrenProp,\n prefetch: prefetchProp = null,\n passHref,\n replace,\n shallow,\n scroll,\n locale,\n onClick,\n onNavigate,\n onMouseEnter: onMouseEnterProp,\n onTouchStart: onTouchStartProp,\n legacyBehavior = false,\n ...restProps\n } = props\n\n children = childrenProp\n\n if (\n legacyBehavior &&\n (typeof children === 'string' || typeof children === 'number')\n ) {\n children = <a>{children}</a>\n }\n\n const router = React.useContext(RouterContext)\n\n const prefetchEnabled = prefetchProp !== false\n\n if (process.env.NODE_ENV !== 'production') {\n function createPropError(args: {\n key: string\n expected: string\n actual: string\n }) {\n return new Error(\n `Failed prop type: The prop \\`${args.key}\\` expects a ${args.expected} in \\`<Link>\\`, but got \\`${args.actual}\\` instead.` +\n (typeof window !== 'undefined'\n ? // TODO: Remove this addendum if Owner Stacks are available\n \"\\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n\n // TypeScript trick for type-guarding:\n const requiredPropsGuard: Record<LinkPropsRequired, true> = {\n href: true,\n } as const\n const requiredProps: LinkPropsRequired[] = Object.keys(\n requiredPropsGuard\n ) as LinkPropsRequired[]\n requiredProps.forEach((key: LinkPropsRequired) => {\n if (key === 'href') {\n if (\n props[key] == null ||\n (typeof props[key] !== 'string' && typeof props[key] !== 'object')\n ) {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: props[key] === null ? 'null' : typeof props[key],\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = key\n }\n })\n\n // TypeScript trick for type-guarding:\n const optionalPropsGuard: Record<LinkPropsOptional, true> = {\n as: true,\n replace: true,\n scroll: true,\n shallow: true,\n passHref: true,\n prefetch: true,\n locale: true,\n onClick: true,\n onMouseEnter: true,\n onTouchStart: true,\n legacyBehavior: true,\n onNavigate: true,\n } as const\n const optionalProps: LinkPropsOptional[] = Object.keys(\n optionalPropsGuard\n ) as LinkPropsOptional[]\n optionalProps.forEach((key: LinkPropsOptional) => {\n const valType = typeof props[key]\n\n if (key === 'as') {\n if (props[key] && valType !== 'string' && valType !== 'object') {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: valType,\n })\n }\n } else if (key === 'locale') {\n if (props[key] && valType !== 'string') {\n throw createPropError({\n key,\n expected: '`string`',\n actual: valType,\n })\n }\n } else if (\n key === 'onClick' ||\n key === 'onMouseEnter' ||\n key === 'onTouchStart' ||\n key === 'onNavigate'\n ) {\n if (props[key] && valType !== 'function') {\n throw createPropError({\n key,\n expected: '`function`',\n actual: valType,\n })\n }\n } else if (\n key === 'replace' ||\n key === 'scroll' ||\n key === 'shallow' ||\n key === 'passHref' ||\n key === 'prefetch' ||\n key === 'legacyBehavior'\n ) {\n if (props[key] != null && valType !== 'boolean') {\n throw createPropError({\n key,\n expected: '`boolean`',\n actual: valType,\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = key\n }\n })\n }\n\n const { href, as } = React.useMemo(() => {\n if (!router) {\n const resolvedHref = formatStringOrUrl(hrefProp)\n return {\n href: resolvedHref,\n as: asProp ? formatStringOrUrl(asProp) : resolvedHref,\n }\n }\n\n const [resolvedHref, resolvedAs] = resolveHref(router, hrefProp, true)\n\n return {\n href: resolvedHref,\n as: asProp ? resolveHref(router, asProp) : resolvedAs || resolvedHref,\n }\n }, [router, hrefProp, asProp])\n\n const previousHref = React.useRef<string>(href)\n const previousAs = React.useRef<string>(as)\n\n // This will return the first child, if multiple are provided it will throw an error\n let child: any\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n if (onClick) {\n console.warn(\n `\"onClick\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onClick be set on the child of next/link`\n )\n }\n if (onMouseEnterProp) {\n console.warn(\n `\"onMouseEnter\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onMouseEnter be set on the child of next/link`\n )\n }\n try {\n child = React.Children.only(children)\n } catch (err) {\n if (!children) {\n throw new Error(\n `No children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n )\n }\n throw new Error(\n `Multiple children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n (typeof window !== 'undefined'\n ? \" \\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n } else {\n child = React.Children.only(children)\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if ((children as any)?.type === 'a') {\n throw new Error(\n 'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n )\n }\n }\n }\n\n const childRef: any = legacyBehavior\n ? child && typeof child === 'object' && child.ref\n : forwardedRef\n\n const [setIntersectionRef, isVisible, resetVisible] = useIntersection({\n rootMargin: '200px',\n })\n\n const setIntersectionWithResetRef = React.useCallback(\n (el: Element | null) => {\n // Before the link getting observed, check if visible state need to be reset\n if (previousAs.current !== as || previousHref.current !== href) {\n resetVisible()\n previousAs.current = as\n previousHref.current = href\n }\n\n setIntersectionRef(el)\n },\n [as, href, resetVisible, setIntersectionRef]\n )\n\n const setRef = useMergedRef(setIntersectionWithResetRef, childRef)\n\n // Prefetch the URL if we haven't already and it's visible.\n React.useEffect(() => {\n // in dev, we only prefetch on hover to avoid wasting resources as the prefetch will trigger compiling the page.\n if (process.env.NODE_ENV !== 'production') {\n return\n }\n\n if (!router) {\n return\n }\n\n // If we don't need to prefetch the URL, don't do prefetch.\n if (!isVisible || !prefetchEnabled) {\n return\n }\n\n // Prefetch the URL.\n prefetch(router, href, as, { locale })\n }, [as, href, isVisible, locale, prefetchEnabled, router?.locale, router])\n\n const childProps: {\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>\n onClick: React.MouseEventHandler<HTMLAnchorElement>\n href?: string\n ref?: any\n } = {\n ref: setRef,\n onClick(e) {\n if (process.env.NODE_ENV !== 'production') {\n if (!e) {\n throw new Error(\n `Component rendered inside next/link has to pass click event to \"onClick\" prop.`\n )\n }\n }\n\n if (!legacyBehavior && typeof onClick === 'function') {\n onClick(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onClick === 'function'\n ) {\n child.props.onClick(e)\n }\n\n if (!router) {\n return\n }\n\n if (e.defaultPrevented) {\n return\n }\n\n linkClicked(\n e,\n router,\n href,\n as,\n replace,\n shallow,\n scroll,\n locale,\n onNavigate\n )\n },\n onMouseEnter(e) {\n if (!legacyBehavior && typeof onMouseEnterProp === 'function') {\n onMouseEnterProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onMouseEnter === 'function'\n ) {\n child.props.onMouseEnter(e)\n }\n\n if (!router) {\n return\n }\n\n prefetch(router, href, as, {\n locale,\n priority: true,\n // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}\n bypassPrefetchedCheck: true,\n })\n },\n onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START\n ? undefined\n : function onTouchStart(e) {\n if (!legacyBehavior && typeof onTouchStartProp === 'function') {\n onTouchStartProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onTouchStart === 'function'\n ) {\n child.props.onTouchStart(e)\n }\n\n if (!router) {\n return\n }\n\n prefetch(router, href, as, {\n locale,\n priority: true,\n // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}\n bypassPrefetchedCheck: true,\n })\n },\n }\n\n // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is\n // defined, we specify the current 'href', so that repetition is not needed by the user.\n // If the url is absolute, we can bypass the logic to prepend the domain and locale.\n if (isAbsoluteUrl(as)) {\n childProps.href = as\n } else if (\n !legacyBehavior ||\n passHref ||\n (child.type === 'a' && !('href' in child.props))\n ) {\n const curLocale = typeof locale !== 'undefined' ? locale : router?.locale\n\n // we only render domain locales if we are currently on a domain locale\n // so that locale links are still visitable in development/preview envs\n const localeDomain =\n router?.isLocaleDomain &&\n getDomainLocale(as, curLocale, router?.locales, router?.domainLocales)\n\n childProps.href =\n localeDomain ||\n addBasePath(addLocale(as, curLocale, router?.defaultLocale))\n }\n\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n errorOnce(\n '`legacyBehavior` is deprecated and will be removed in a future ' +\n 'release. A codemod is available to upgrade your components:\\n\\n' +\n 'npx @next/codemod@latest new-link .\\n\\n' +\n 'Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components'\n )\n }\n return React.cloneElement(child, childProps)\n }\n\n return (\n <a {...restProps} {...childProps}>\n {children}\n </a>\n )\n }\n)\n\nconst LinkStatusContext = createContext<{\n pending: boolean\n}>({\n // We do not support link status in the Pages Router, so we always return false\n pending: false,\n})\n\nexport const useLinkStatus = () => {\n // This behaviour is like React's useFormStatus. When the component is not under\n // a <form> tag, it will get the default value, instead of throwing an error.\n return useContext(LinkStatusContext)\n}\n\nexport default Link\n","module.exports = require('./dist/client/link')\n","import tinycolor from 'tinycolor2'\nimport type { ShadedColors } from '@/index'\nimport { shadingColorValues } from '@/index'\n\n// Function to generate a full shading of several colors\nexport const generateShadingColors = (partialShading: Omit<Partial<ShadedColors>, '0' | '1000'>): ShadedColors => {\n const shading: ShadedColors = {\n 0: '#FFFFFF',\n 1000: '#000000'\n } as ShadedColors\n\n let index = 1\n while (index < shadingColorValues.length - 1) {\n const previous = shadingColorValues[index - 1]!\n const current = shadingColorValues[index]!\n\n if (partialShading[current] !== undefined) {\n shading[current] = partialShading[current]\n index++\n continue\n }\n\n let j: number = index + 1\n while (j < shadingColorValues.length) {\n if (partialShading[shadingColorValues[j]!] !== undefined) {\n break\n }\n j++\n }\n if (j === shadingColorValues.length) {\n j = shadingColorValues.length - 1\n }\n\n const nextFound = shadingColorValues[j]!\n const interval = nextFound - previous\n for (let k = index; k < j; k++) {\n const current = shadingColorValues[k]!\n const previousValue = partialShading[previous] ?? shading[previous]\n const nextValue = partialShading[nextFound] ?? shading[nextFound]\n shading[current] = tinycolor.mix(tinycolor(previousValue), tinycolor(nextValue), (current - previous) / interval * 100).toHexString()\n }\n index = j\n }\n\n return shading\n}\n","export const shadingColorValues = [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000] as const\nexport type ColorShadingValue = typeof shadingColorValues[number]\nexport type ShadedColors = Record<ColorShadingValue, string>\n\nexport type ColoringStyle = 'background' | 'tonal' | 'tonal-opaque' | 'text' | 'text-border'\nexport type ColorMode = 'light' | 'dark'\n\nexport type Coloring = {\n color: '',\n style?: ColoringStyle,\n mode?: ColorMode,\n hover?: boolean,\n}\n","import clsx from 'clsx'\nimport { Tile } from '@/components/layout-and-navigation/Tile'\nimport { Helpwave } from '@/components/icons-and-geometry/Helpwave'\n\ntype Size = 'small' | 'large'\n\nexport type HelpwaveBadgeProps = {\n size?: Size,\n title?: string,\n className?: string,\n}\n\n/**\n * A Badge with the helpwave logo and the helpwave name\n */\nexport const HelpwaveBadge = ({\n size = 'small',\n title = 'helpwave',\n className = ''\n }: HelpwaveBadgeProps) => {\n const iconSize: number = size === 'small' ? 24 : 64\n\n return (\n <Tile\n prefix={(<Helpwave size={iconSize}/>)}\n title={{ value: title, className: size === 'small' ? 'textstyle-title-lg text-base' : 'textstyle-title-xl' }}\n className={clsx(\n {\n 'px-2 py-1 rounded-md': size === 'small',\n 'px-4 py-1 rounded-md': size === 'large',\n }, className\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type TileProps = {\n title: { value: string, className?: string },\n description?: { value: string, className?: string },\n prefix?: ReactNode,\n suffix?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for creating a tile similar to the flutter ListTile\n */\nexport const Tile = ({\n title,\n description,\n prefix,\n suffix,\n className\n }: TileProps) => {\n return (\n <div className={clsx('row gap-x-4 w-full items-center', className)}>\n {prefix}\n <div className=\"col gap-y-0 w-full\">\n <h4 className={clsx(title.className ?? 'textstyle-title-normal')}>{title.value}</h4>\n {!!description &&\n <span className={clsx(description.className ?? 'textstyle-description')}>{description.value}</span>}\n </div>\n {suffix}\n </div>\n )\n}\n\ntype ImageLocation = 'prefix' | 'suffix'\ntype ImageSize = {\n width: number,\n height: number,\n}\n\nexport type TileWithImageProps = Omit<TileProps, 'suffix' | 'prefix'> & {\n url: string,\n imageLocation?: ImageLocation,\n imageSize?: ImageSize,\n imageClassName?: string,\n}","import type { SVGProps } from 'react'\nimport { clsx } from 'clsx'\n\nexport type HelpwaveProps = SVGProps<SVGSVGElement> & {\n color?: string,\n animate?: 'none' | 'loading' | 'pulse' | 'bounce',\n size?: number,\n}\n\n/**\n * The helpwave loading spinner based on the svg logo.\n */\nexport const Helpwave = ({\n color = 'currentColor',\n animate = 'none',\n size = 64,\n ...props\n }: HelpwaveProps) => {\n const isLoadingAnimation = animate === 'loading'\n let svgAnimationKey = ''\n\n if (animate === 'pulse') {\n svgAnimationKey = 'animate-pulse'\n } else if (animate === 'bounce') {\n svgAnimationKey = 'animate-bounce'\n }\n\n if (size < 0) {\n console.error('size cannot be less than 0')\n size = 64\n }\n\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 888 888\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={48}\n {...props}\n >\n <g className={clsx(svgAnimationKey)}>\n <path className={clsx({ 'animate-wave-big-left-up': isLoadingAnimation })}\n d=\"M144 543.235C144 423.259 232.164 326 340.92 326\" stroke={color} strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-big-right-down': isLoadingAnimation })}\n d=\"M537.84 544.104C429.084 544.104 340.92 446.844 340.92 326.869\" stroke={color} strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-small-left-up': isLoadingAnimation })}\n d=\"M462.223 518.035C462.223 432.133 525.348 362.495 603.217 362.495\" stroke={color}\n strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-small-right-down': isLoadingAnimation })}\n d=\"M745.001 519.773C666.696 519.773 603.218 450.136 603.218 364.233\" stroke={color}\n strokeDasharray=\"1000\"/>\n </g>\n </svg>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { ArrowDown, ArrowUp, ChevronDown } from 'lucide-react'\nimport type { Language } from '@/localization/util'\nimport { useLocale } from '@/localization/LanguageProvider'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\nimport { addDuration, isInTimeSpan, subtractDuration } from '@/util/date'\nimport clsx from 'clsx'\nimport { SolidButton, TextButton } from '../user-action/Button'\nimport type { YearMonthPickerProps } from './YearMonthPicker'\nimport { YearMonthPicker } from './YearMonthPicker'\nimport type { DayPickerProps } from './DayPicker'\nimport { DayPicker } from './DayPicker'\n\ntype DatePickerTranslation = {\n today: string,\n}\n\nconst defaultDatePickerTranslation: Record<Language, DatePickerTranslation> = {\n en: {\n today: 'Today',\n },\n de: {\n today: 'Heute',\n }\n}\n\ntype DisplayMode = 'yearMonth' | 'day'\n\nexport type DatePickerProps = {\n value?: Date,\n start?: Date,\n end?: Date,\n initialDisplay?: DisplayMode,\n onChange?: (date: Date) => void,\n dayPickerProps?: Omit<DayPickerProps, 'displayedMonth' | 'onChange' | 'selected'>,\n yearMonthPickerProps?: Omit<YearMonthPickerProps, 'displayedYearMonth' | 'onChange' | 'start' | 'end'>,\n className?: string,\n}\n\n/**\n * A Component for picking a date\n */\nexport const DatePicker = ({\n overwriteTranslation,\n value = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n initialDisplay = 'day',\n onChange = noop,\n yearMonthPickerProps,\n dayPickerProps,\n className = ''\n }: PropsForTranslation<DatePickerTranslation, DatePickerProps>) => {\n const locale = useLocale()\n const translation = useTranslation(defaultDatePickerTranslation, overwriteTranslation)\n const [displayedMonth, setDisplayedMonth] = useState<Date>(value)\n const [displayMode, setDisplayMode] = useState<DisplayMode>(initialDisplay)\n\n useEffect(() => {\n setDisplayedMonth(value)\n }, [value])\n\n return (\n <div className={clsx('col gap-y-4', className)}>\n <div className=\"row items-center justify-between h-7\">\n <TextButton\n className={clsx('row gap-x-1 items-center cursor-pointer select-none', {\n 'text-disabled-text': displayMode !== 'day',\n })}\n onClick={() => setDisplayMode(displayMode === 'day' ? 'yearMonth' : 'day')}\n >\n {`${new Intl.DateTimeFormat(locale, { month: 'long' }).format(displayedMonth)} ${displayedMonth.getFullYear()}`}\n <ChevronDown size={16}/>\n </TextButton>\n {displayMode === 'day' && (\n <div className=\"row justify-end\">\n <SolidButton\n size=\"small\"\n color=\"primary\"\n disabled={!isInTimeSpan(subtractDuration(displayedMonth, { months: 1 }), start, end)}\n onClick={() => {\n setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }))\n }}\n >\n <ArrowUp size={20}/>\n </SolidButton>\n <SolidButton\n size=\"small\"\n color=\"primary\"\n disabled={!isInTimeSpan(addDuration(displayedMonth, { months: 1 }), start, end)}\n onClick={() => {\n setDisplayedMonth(addDuration(displayedMonth, { months: 1 }))\n }}\n >\n <ArrowDown size={20}/>\n </SolidButton>\n </div>\n )}\n </div>\n {displayMode === 'yearMonth' ? (\n <YearMonthPicker\n {...yearMonthPickerProps}\n displayedYearMonth={value}\n start={start}\n end={end}\n onChange={newDate => {\n setDisplayedMonth(newDate)\n setDisplayMode('day')\n }}\n />\n ) : (\n <div>\n <DayPicker\n {...dayPickerProps}\n displayedMonth={displayedMonth}\n start={start}\n end={end}\n selected={value}\n onChange={date => {\n onChange(date)\n }}\n />\n <div className=\"mt-2\">\n <TextButton\n onClick={() => {\n const newDate = new Date()\n newDate.setHours(value.getHours(), value.getMinutes())\n onChange(newDate)\n }}\n >\n {translation.today}\n </TextButton>\n </div>\n </div>\n )}\n </div>\n )\n}\n\n/**\n * Example for the Date Picker\n */\nexport const DatePickerUncontrolled = ({\n value = new Date(),\n onChange = noop,\n ...props\n }: DatePickerProps) => {\n const [date, setDate] = useState<Date>(value)\n\n useEffect(() => setDate(value), [value])\n\n return (\n <DatePicker\n {...props}\n value={date}\n onChange={date1 => {\n setDate(date1)\n onChange(date1)\n }}\n />\n )\n}\n","import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'\nimport { createContext, useContext, useEffect, useState } from 'react'\nimport { useLocalStorage } from '@/hooks/useLocalStorage'\nimport type { Language } from './util'\nimport { LanguageUtil } from './util'\n\nexport type LanguageContextValue = {\n language: Language,\n setLanguage: Dispatch<SetStateAction<Language>>,\n}\n\nexport const LanguageContext = createContext<LanguageContextValue>({\n language: LanguageUtil.DEFAULT_LANGUAGE,\n setLanguage: (v) => v\n})\n\nexport const useLanguage = () => useContext(LanguageContext)\n\nexport const useLocale = (overWriteLanguage?: Language) => {\n const { language } = useLanguage()\n const mapping: Record<Language, string> = {\n en: 'en-US',\n de: 'de-DE'\n }\n return mapping[overWriteLanguage ?? language]\n}\n\ntype LanguageProviderProps = {\n initialLanguage?: Language,\n}\n\nexport const LanguageProvider = ({ initialLanguage, children }: PropsWithChildren<LanguageProviderProps>) => {\n const [language, setLanguage] = useState<Language>(initialLanguage ?? LanguageUtil.DEFAULT_LANGUAGE)\n const [storedLanguage, setStoredLanguage] = useLocalStorage<Language>('language', initialLanguage ?? LanguageUtil.DEFAULT_LANGUAGE)\n\n useEffect(() => {\n if (language !== initialLanguage && initialLanguage) {\n console.warn('LanguageProvider initial state changed: Prefer using languageProvider\\'s setLanguage instead')\n setLanguage(initialLanguage)\n }\n }, [initialLanguage]) // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n // TODO set locale of html tag here as well\n setStoredLanguage(language)\n }, [language, setStoredLanguage])\n\n useEffect(() => {\n if (storedLanguage !== null) {\n setLanguage(storedLanguage)\n return\n }\n\n const LanguageToTestAgainst = Object.values(LanguageUtil.languages)\n\n const matchingBrowserLanguage = window.navigator.languages\n .map(language => LanguageToTestAgainst.find((test) => language === test || language.split('-')[0] === test))\n .filter(entry => entry !== undefined)\n\n if (matchingBrowserLanguage.length === 0) return\n\n const firstMatch = matchingBrowserLanguage[0] as Language\n setLanguage(firstMatch)\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <LanguageContext.Provider value={{\n language,\n setLanguage\n }}>\n {children}\n </LanguageContext.Provider>\n )\n}","import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(value => {\n const newValue = value instanceof Function ? value(storedValue) : value\n const storageService = new LocalStorageService()\n storageService.set(key, value)\n\n setStoredValue(newValue)\n }, [storedValue, setStoredValue, key])\n\n useEffect(() => {\n setStoredValue(get())\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return [storedValue, setValue]\n}","/**\n * The supported languages\n */\nconst languages = ['en', 'de'] as const\n\n/**\n * The supported languages\n */\nexport type Language = typeof languages[number]\n\n/**\n * The supported languages' names in their respective language\n */\nconst languagesLocalNames: Record<Language, string> = {\n en: 'English',\n de: 'Deutsch',\n}\n\n/**\n * The default language\n */\nconst DEFAULT_LANGUAGE: Language = 'en'\n\n/**\n * A constant definition for holding data regarding languages\n */\nexport const LanguageUtil = {\n languages,\n DEFAULT_LANGUAGE,\n languagesLocalNames,\n}","export const noop = () => undefined\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<ButtonSizes, string> = {\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n}\n\nexport type IconButtonProps = ButtonProps & {\n color?: SolidButtonColor,\n}\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: SolidButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-solid-primary-icon',\n secondary: 'text-button-solid-secondary-icon',\n tertiary: 'text-button-solid-tertiary-icon',\n positive: 'text-button-solid-positive-icon',\n warning: 'text-button-solid-warning-icon',\n negative: 'text-button-solid-negative-icon',\n neutral: 'text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text border-disabled-outline cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-80')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n disabled = false,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent text-button-text-primary-text',\n negative: 'bg-transparent text-button-text-negative-text',\n neutral: 'bg-transparent text-button-text-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-text-primary-icon',\n negative: 'text-button-text-negative-icon',\n neutral: 'text-button-text-neutral-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:bg-button-text-hover-background rounded-full')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n onClick,\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\n}\n\nexport { SolidButton, OutlineButton, TextButton, IconButton }\n","import { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '@/util/noop'\nimport { equalSizeGroups, range } from '@/util/array'\nimport clsx from 'clsx'\nimport { ExpandableUncontrolled } from '@/components/layout-and-navigation/Expandable'\nimport { addDuration, monthsList, subtractDuration } from '@/util/date'\nimport { useLocale } from '@/localization/LanguageProvider'\n\nexport type YearMonthPickerProps = {\n displayedYearMonth?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n className?: string,\n maxHeight?: number,\n showValueOpen?: boolean,\n}\n\n// TODO use a dynamically loading infinite list here\nexport const YearMonthPicker = ({\n displayedYearMonth = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n onChange = noop,\n className = '',\n maxHeight = 300,\n showValueOpen = true\n }: YearMonthPickerProps) => {\n const locale = useLocale()\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const scrollToItem = () => {\n if (ref.current) {\n ref.current.scrollIntoView({\n behavior: 'instant',\n block: 'center',\n })\n }\n }\n\n scrollToItem()\n }, [ref])\n\n if (end < start) {\n console.error(`startYear: (${start}) less than endYear: (${end})`)\n return null\n }\n\n const years = range(start.getFullYear(), end.getFullYear())\n\n return (\n <div className={clsx('col select-none', className)}>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 mr-3\">\n {years.map(year => {\n const selectedYear = displayedYearMonth.getFullYear() === year\n return (\n <ExpandableUncontrolled\n key={year}\n ref={(displayedYearMonth.getFullYear() ?? new Date().getFullYear()) === year ? ref : undefined}\n label={<span className={clsx({ 'text-primary font-bold': selectedYear })}>{year}</span>}\n isExpanded={showValueOpen && selectedYear}\n >\n <div className=\"col gap-y-1 px-2 pb-2\">\n {equalSizeGroups([...monthsList], 3).map((monthList, index) => (\n <div key={index} className=\"row\">\n {monthList.map(month => {\n const monthIndex = monthsList.indexOf(month)\n const newDate = new Date(year, monthIndex)\n\n const selectedMonth = selectedYear && monthIndex === displayedYearMonth.getMonth()\n const firstOfMonth = new Date(year, monthIndex, 1)\n const lastOfMonth = new Date(year, monthIndex, 1)\n const isAfterStart = start === undefined || start <= addDuration(subtractDuration(lastOfMonth, { days: 1 }), { months: 1 })\n const isBeforeEnd = end === undefined || firstOfMonth <= end\n const isValid = isAfterStart && isBeforeEnd\n return (\n <button\n key={month}\n disabled={!isValid}\n className={clsx(\n 'chip hover:brightness-95 flex-1',\n {\n 'bg-gray-50 text-black': !selectedMonth && isValid,\n 'bg-primary text-on-primary': selectedMonth && isValid,\n 'bg-disabled-background text-disabled-text': !isValid\n }\n )}\n onClick={() => {\n onChange(newDate)\n }}\n >\n {new Intl.DateTimeFormat(locale, { month: 'short' }).format(newDate)}\n </button>\n )\n })}\n </div>\n ))}\n </div>\n </ExpandableUncontrolled>\n )\n })}\n </div>\n </Scrollbars>\n </div>\n )\n}\n\nexport const YearMonthPickerUncontrolled = ({\n displayedYearMonth = new Date(),\n onChange = noop,\n ...props\n }: YearMonthPickerProps) => {\n const [yearMonth, setYearMonth] = useState<Date>(displayedYearMonth)\n\n useEffect(() => setYearMonth(displayedYearMonth), [displayedYearMonth])\n\n return (\n <YearMonthPicker\n displayedYearMonth={yearMonth}\n onChange={date => {\n setYearMonth(date)\n onChange(date)\n }}\n {...props}\n />\n )\n}\n","import type { PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef, useEffect, useState } from 'react'\nimport { ChevronDown, ChevronUp } from 'lucide-react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\n\ntype IconBuilder = (expanded: boolean) => ReactNode\n\nexport type ExpandableProps = PropsWithChildren<{\n label: ReactNode,\n icon?: IconBuilder,\n isExpanded?: boolean,\n onChange?: (isExpanded: boolean) => void,\n /**\n * Whether the expansion should only happen when the header is clicked or on the entire component\n */\n clickOnlyOnHeader?: boolean,\n disabled?: boolean,\n className?: string,\n headerClassName?: string,\n}>\n\nconst DefaultIcon: IconBuilder = (expanded) => expanded ?\n (<ChevronUp size={16} className=\"min-w-[16px]\"/>)\n : (<ChevronDown size={16} className=\"min-w-[16px]\"/>)\n\n\n/**\n * A Component for showing and hiding content\n */\nexport const Expandable = forwardRef<HTMLDivElement, ExpandableProps>(function Expandable({\n children,\n label,\n icon,\n isExpanded = false,\n onChange = noop,\n clickOnlyOnHeader = true,\n disabled = false,\n className = '',\n headerClassName = ''\n }, ref) {\n icon ??= DefaultIcon\n\n return (\n <div\n ref={ref}\n className={clsx('col gap-y-0 bg-surface text-on-surface group rounded-lg shadow-sm', { 'cursor-pointer': !clickOnlyOnHeader && !disabled }, className)}\n onClick={() => !clickOnlyOnHeader && !disabled && onChange(!isExpanded)}\n >\n <div\n className={clsx(\n 'row py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none',\n {\n 'group-hover:brightness-95': !isExpanded,\n 'hover:brightness-95': isExpanded && !disabled,\n 'cursor-pointer': clickOnlyOnHeader && !disabled,\n },\n headerClassName\n )}\n onClick={() => clickOnlyOnHeader && !disabled && onChange(!isExpanded)}\n >\n {label}\n {icon(isExpanded)}\n </div>\n {isExpanded && (\n <div className=\"col px-4 pb-2\">\n {children}\n </div>\n )}\n </div>\n )\n})\n\nexport const ExpandableUncontrolled = forwardRef<HTMLDivElement, ExpandableProps>(function ExpandableUncontrolled({\n isExpanded,\n onChange = noop,\n ...props\n },\n ref) {\n const [usedIsExpanded, setUsedIsExpanded] = useState(isExpanded)\n\n useEffect(() => {\n setUsedIsExpanded(isExpanded)\n }, [isExpanded])\n\n return (\n <Expandable\n {...props}\n ref={ref}\n isExpanded={usedIsExpanded}\n onChange={value => {\n onChange(value)\n setUsedIsExpanded(value)\n }}\n />\n )\n})\n","import type { WeekDay } from '@/util/date'\nimport { equalDate, getWeeksForCalenderMonth, isInTimeSpan } from '@/util/date'\nimport { noop } from '@/util/noop'\nimport clsx from 'clsx'\nimport { useLocale } from '@/localization/LanguageProvider'\nimport { useEffect, useState } from 'react'\n\nexport type DayPickerProps = {\n displayedMonth: Date,\n selected?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n weekStart?: WeekDay,\n markToday?: boolean,\n className?: string,\n}\n\n/**\n * A component for selecting a day of a month\n */\nexport const DayPicker = ({\n displayedMonth,\n selected,\n start,\n end,\n onChange = noop,\n weekStart = 'monday',\n markToday = true,\n className = ''\n }: DayPickerProps) => {\n const locale = useLocale()\n const month = displayedMonth.getMonth()\n const weeks = getWeeksForCalenderMonth(displayedMonth, weekStart)\n\n return (\n <div className={clsx('col gap-y-1 min-w-[220px] select-none', className)}>\n <div className=\"row text-center\">\n {weeks[0]!.map((weekDay, index) => (\n <div key={index} className=\"flex-1 font-semibold\">\n {new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(weekDay).substring(0, 2)}\n </div>\n ))}\n </div>\n {weeks.map((week, index) => (\n <div key={index} className=\"row text-center\">\n {week.map((date) => {\n const isSelected = !!selected && equalDate(selected, date)\n const isToday = equalDate(new Date(), date)\n const isSameMonth = date.getMonth() === month\n const isDayValid = isInTimeSpan(date, start, end)\n return (\n <button\n disabled={!isDayValid}\n key={date.getDate()}\n className={clsx(\n 'flex-1 rounded-full border-2 border-transparent shadow-sm',\n {\n 'text-gray-700 bg-gray-100': !isSameMonth && isDayValid,\n 'text-black bg-white': !isSelected && isSameMonth && isDayValid,\n 'text-on-primary bg-primary': isSelected,\n 'border-black': isToday && markToday,\n 'hover:brightness-90 hover:bg-primary hover:text-on-primary': isDayValid,\n 'text-disabled-text bg-disabled-background': !isDayValid\n }\n )}\n onClick={() => onChange(date)}\n >\n {date.getDate()}\n </button>\n )\n })}\n </div>\n ))}\n </div>\n )\n}\n\nexport const DayPickerUncontrolled = ({ displayedMonth, onChange = noop, ...restProps }: DayPickerProps) => {\n const [date, setDate] = useState(displayedMonth)\n\n useEffect(() => setDate(displayedMonth), [displayedMonth])\n\n return (\n <DayPicker\n displayedMonth={date}\n onChange={newDate => {\n setDate(newDate)\n onChange(newDate)\n }}\n {...restProps}\n />\n )\n}\n","import type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\n\ntype TimeDisplayTranslation = {\n today: string,\n yesterday: string,\n tomorrow: string,\n inDays: (days: number) => string,\n agoDays: (days: number) => string,\n january: string,\n february: string,\n march: string,\n april: string,\n may: string,\n june: string,\n july: string,\n august: string,\n september: string,\n october: string,\n november: string,\n december: string,\n}\n\nconst defaultTimeDisplayTranslations: Record<Language, TimeDisplayTranslation> = {\n en: {\n today: 'today',\n yesterday: 'yesterday',\n tomorrow: 'tomorrow',\n inDays: (days: number) => `in ${days} days`,\n agoDays: (days: number) => `${days} days ago`,\n january: 'January',\n february: 'February',\n march: 'March',\n april: 'April',\n may: 'May',\n june: 'June',\n july: 'July',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December'\n },\n de: {\n today: 'heute',\n yesterday: 'gestern',\n tomorrow: 'morgen',\n inDays: (days: number) => `in ${days} Tagen`,\n agoDays: (days: number) => `vor ${days} Tagen`,\n january: 'Januar',\n february: 'Februar',\n march: 'März',\n april: 'April',\n may: 'Mai',\n june: 'Juni',\n july: 'Juli',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December'\n }\n}\n\ntype TimeDisplayMode = 'daysFromToday' | 'date'\n\ntype TimeDisplayProps = {\n date: Date,\n mode?: TimeDisplayMode,\n}\n\n/**\n * A Component for displaying time and dates in a unified fashion\n */\nexport const TimeDisplay = ({\n overwriteTranslation,\n date,\n mode = 'daysFromToday'\n }: PropsForTranslation<TimeDisplayTranslation, TimeDisplayProps>) => {\n const translation = useTranslation(defaultTimeDisplayTranslations, overwriteTranslation)\n const difference = new Date().setHours(0, 0, 0, 0).valueOf() - new Date(date).setHours(0, 0, 0, 0).valueOf()\n const isBefore = difference > 0\n const differenceInDays = Math.floor(Math.abs(difference) / (1000 * 3600 * 24))\n\n let displayString\n if (differenceInDays === 0) {\n displayString = translation.today\n } else if (differenceInDays === 1) {\n displayString = isBefore ? translation.yesterday : translation.tomorrow\n } else {\n displayString = isBefore ? translation.agoDays(differenceInDays) : translation.inDays(differenceInDays)\n }\n const monthToTranslation: { [key: number]: string } = {\n 0: translation.january,\n 1: translation.february,\n 2: translation.march,\n 3: translation.april,\n 4: translation.may,\n 5: translation.june,\n 6: translation.july,\n 7: translation.august,\n 8: translation.september,\n 9: translation.october,\n 10: translation.november,\n 11: translation.december\n } as const\n\n let fullString\n if (mode === 'daysFromToday') {\n fullString = `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')} - ${displayString}`\n } else {\n fullString = `${date.getDate()}. ${monthToTranslation[date.getMonth()]} ${date.getFullYear()}`\n }\n\n return (\n <span>\n {fullString}\n </span>\n )\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '@/util/noop'\nimport { closestMatch, range } from '@/util/array'\nimport clsx from 'clsx'\n\ntype MinuteIncrement = '1min' | '5min' | '10min' | '15min' | '30min'\n\nexport type TimePickerProps = {\n time?: Date,\n onChange?: (time: Date) => void,\n is24HourFormat?: boolean,\n minuteIncrement?: MinuteIncrement,\n maxHeight?: number,\n className?: string,\n}\n\nexport const TimePicker = ({\n time = new Date(),\n onChange = noop,\n is24HourFormat = true,\n minuteIncrement = '5min',\n maxHeight = 300,\n className = ''\n }: TimePickerProps) => {\n const minuteRef = useRef<HTMLButtonElement>(null)\n const hourRef = useRef<HTMLButtonElement>(null)\n\n const isPM = time.getHours() >= 11\n const hours = is24HourFormat ? range(0, 23) : range(1, 12)\n let minutes = range(0, 59)\n\n useEffect(() => {\n const scrollToItem = () => {\n if (minuteRef.current) {\n const container = minuteRef.current.parentElement!\n\n const hasOverflow = container.scrollHeight > maxHeight\n if (hasOverflow) {\n minuteRef.current.scrollIntoView({\n behavior: 'instant',\n block: 'nearest',\n })\n }\n }\n }\n scrollToItem()\n }, [minuteRef, minuteRef.current]) // eslint-disable-line\n\n useEffect(() => {\n const scrollToItem = () => {\n if (hourRef.current) {\n const container = hourRef.current.parentElement!\n\n const hasOverflow = container.scrollHeight > maxHeight\n if (hasOverflow) {\n hourRef.current.scrollIntoView({\n behavior: 'instant',\n block: 'nearest',\n })\n }\n }\n }\n scrollToItem()\n }, [hourRef, hourRef.current]) // eslint-disable-line\n\n switch (minuteIncrement) {\n case '5min':\n minutes = minutes.filter(value => value % 5 === 0)\n break\n case '10min':\n minutes = minutes.filter(value => value % 10 === 0)\n break\n case '15min':\n minutes = minutes.filter(value => value % 15 === 0)\n break\n case '30min':\n minutes = minutes.filter(value => value % 30 === 0)\n break\n }\n\n const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - time.getMinutes()) < Math.abs(item2 - time.getMinutes()))\n\n const style = (selected: boolean) => clsx('chip-full hover:brightness-90 hover:bg-primary hover:text-on-primary rounded-md mr-3',\n { 'bg-primary text-on-primary': selected, 'bg-white text-black': !selected })\n\n const onChangeWrapper = (transformer: (newDate: Date) => void) => {\n const newDate = new Date(time)\n transformer(newDate)\n onChange(newDate)\n }\n\n return (\n <div className={clsx('row gap-x-2 w-fit min-w-[150px] select-none', className)}>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 h-full\">\n {hours.map(hour => {\n const currentHour = hour === time.getHours() - (!is24HourFormat && isPM ? 12 : 0)\n return (\n <button\n key={hour}\n ref={currentHour ? hourRef : undefined}\n className={style(currentHour)}\n onClick={() => onChangeWrapper(newDate => newDate.setHours(hour + (!is24HourFormat && isPM ? 12 : 0)))}\n >\n {hour.toString().padStart(2, '0')}\n </button>\n )\n })}\n </div>\n </Scrollbars>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 h-full\">\n {minutes.map(minute => {\n const currentMinute = minute === closestMinute\n return (\n <button\n key={minute + minuteIncrement} // minute increment so that scroll works\n ref={currentMinute ? minuteRef : undefined}\n className={style(currentMinute)}\n onClick={() => onChangeWrapper(newDate => newDate.setMinutes(minute))}\n >\n {minute.toString().padStart(2, '0')}\n </button>\n )\n })}\n </div>\n </Scrollbars>\n {!is24HourFormat && (\n <div className=\"col gap-y-1\">\n <button\n className={style(!isPM)}\n onClick={() => onChangeWrapper(newDate => isPM && newDate.setHours(newDate.getHours() - 12))}\n >\n AM\n </button>\n <button\n className={style(isPM)}\n onClick={() => onChangeWrapper(newDate => !isPM && newDate.setHours(newDate.getHours() + 12))}\n >\n PM\n </button>\n </div>\n )}\n </div>\n )\n}\n\nexport const TimePickerUncontrolled = ({\n time,\n onChange = noop,\n ...props\n }: TimePickerProps) => {\n const [value, setValue] = useState(time)\n useEffect(() => setValue(time), [time])\n\n return (\n <TimePicker\n {...props}\n time={value}\n onChange={time1 => {\n setValue(time1)\n onChange(time1)\n }}\n />\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { SolidButtonColor } from '../user-action/Button'\nimport { SolidButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport clsx from 'clsx'\nimport type { DialogProps } from '@/components/layout-and-navigation/Overlay'\nimport { Dialog } from '@/components/layout-and-navigation/Overlay'\n\ntype ConfirmDialogTranslation = {\n confirm: string,\n cancel: string,\n decline: string,\n}\n\nexport type ConfirmDialogType = 'positive' | 'negative' | 'neutral' | 'primary'\n\nconst defaultConfirmDialogTranslation = {\n en: {\n confirm: 'Confirm',\n decline: 'Decline'\n },\n de: {\n confirm: 'Bestätigen',\n decline: 'Ablehnen'\n }\n}\n\ntype ButtonOverwriteType = {\n text?: string,\n color?: SolidButtonColor,\n disabled?: boolean,\n}\n\nexport type ConfirmDialogProps = DialogProps & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onConfirm: () => void,\n onDecline?: () => void,\n confirmType?: ConfirmDialogType,\n /**\n * Order: Decline, Confirm\n */\n buttonOverwrites?: [ButtonOverwriteType, ButtonOverwriteType],\n}\n\n/**\n * A Dialog for demanding the user for confirmation\n *\n * To allow for background closing, prefer using a ConfirmModal\n */\nexport const ConfirmDialog = ({\n overwriteTranslation,\n children,\n onConfirm,\n onDecline,\n confirmType = 'positive',\n buttonOverwrites,\n className,\n ...restProps\n }: PropsForTranslation<ConfirmDialogTranslation, PropsWithChildren<ConfirmDialogProps>>) => {\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n const mapping: Record<ConfirmDialogType, SolidButtonColor> = {\n neutral: 'primary',\n negative: 'negative',\n positive: 'positive',\n primary: 'primary',\n }\n\n return (\n <Dialog {...restProps} className={clsx('justify-between', className)}>\n <div className=\"col grow\">\n {children}\n </div>\n <div className=\"row mt-3 gap-x-4 justify-end\">\n {onDecline && (\n <SolidButton\n color={buttonOverwrites?.[0].color ?? 'negative'}\n onClick={onDecline}\n\n disabled={buttonOverwrites?.[0].disabled ?? false}\n >\n {buttonOverwrites?.[0].text ?? translation.decline}\n </SolidButton>\n )}\n <SolidButton\n autoFocus\n color={buttonOverwrites?.[1].color ?? mapping[confirmType]}\n onClick={onConfirm}\n disabled={buttonOverwrites?.[1].disabled ?? false}\n >\n {buttonOverwrites?.[1].text ?? translation.confirm}\n </SolidButton>\n </div>\n </Dialog>\n )\n}\n","import type { PropsWithChildren, ReactNode } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport ReactDOM from 'react-dom'\nimport clsx from 'clsx'\nimport { Tooltip } from '@/components/user-action/Tooltip'\nimport { X } from 'lucide-react'\nimport { IconButton } from '@/components/user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { Language } from '@/localization/util'\n\nexport type OverlayProps = PropsWithChildren<{\n /**\n * Whether the overlay should be currently displayed\n */\n isOpen: boolean,\n /**\n * Callback when the background is clicked\n */\n onBackgroundClick?: () => void,\n /**\n * Styling for the background\n *\n * To remove the darkening, set bg-transparent\n */\n backgroundClassName?: string,\n}>\n\n/**\n * A generic overlay window which is managed by its parent\n */\nexport const Overlay = ({\n children,\n isOpen,\n onBackgroundClick,\n backgroundClassName,\n }: PropsWithChildren<OverlayProps>) => {\n // The element to which the overlay will be attached to\n const [root, setRoot] = useState<HTMLElement>()\n\n useEffect(() => {\n setRoot(document.body)\n }, [])\n\n if (!root || !isOpen) return null\n\n\n return ReactDOM.createPortal(\n <div className={clsx('fixed inset-0 z-[9999]')}>\n <div\n className={clsx('fixed inset-0 h-screen w-screen bg-black/30', backgroundClassName)}\n onClick={onBackgroundClick}\n />\n {children}\n </div>,\n root\n )\n}\n\n\nlet overlayStack: HTMLDivElement[] = []\n\n\n// --- Modal ---\n\ntype ModalHeaderTranslation = {\n close: string,\n}\n\nconst defaultModalHeaderTranslation: Record<Language, ModalHeaderTranslation> = {\n en: {\n close: 'Close'\n },\n de: {\n close: 'Schließen'\n }\n}\n\nexport type OverlayHeaderProps = {\n /**\n * Callback when the close button is clicked. If omitted or undefined, the button is hidden\n */\n onClose?: () => void,\n /** The title of the Modal. If you want to only set the text use `titleText` instead */\n title?: ReactNode,\n /** The title text of the Modal. If you want to set a custom title use `title` instead */\n titleText?: string,\n /** The description of the Modal. If you want to only set the text use `descriptionText` instead */\n description?: ReactNode,\n /** The description text of the Modal. If you want to set a custom description use `description` instead */\n descriptionText?: string,\n}\n\n/**\n * A header that should be in an Overlay\n */\nexport const OverlayHeader = ({\n overwriteTranslation,\n onClose,\n title,\n titleText = '',\n description,\n descriptionText = ''\n }: PropsForTranslation<ModalHeaderTranslation, OverlayHeaderProps>) => {\n const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation)\n const hasTitleRow = !!title || !!titleText || !!onClose\n const titleRow = (\n <div className=\"row justify-between items-start gap-x-8\">\n {title ?? (\n <h2\n className={clsx('textstyle-title-lg', {\n 'mb-1': description || descriptionText,\n })}\n >\n {titleText}\n </h2>\n )}\n {!!onClose && (\n <Tooltip tooltip={translation.close}>\n <IconButton color=\"neutral\" size=\"small\" onClick={onClose}>\n <X className=\"w-full h-full\"/>\n </IconButton>\n </Tooltip>\n )}\n </div>\n )\n\n return (\n <div className=\"col\">\n {hasTitleRow && (titleRow)}\n {description ?? (descriptionText && (<span className=\"textstyle-description\">{descriptionText}</span>))}\n </div>\n )\n}\n\nexport type ModalProps = {\n isOpen: boolean,\n onClose: () => void,\n className?: string,\n backgroundClassName?: string,\n headerProps?: Omit<OverlayHeaderProps, 'onClose'>,\n}\n\n/**\n * A Generic Modal Window\n */\nexport const Modal = ({\n children,\n isOpen,\n onClose,\n className,\n backgroundClassName,\n headerProps,\n }: PropsWithChildren<ModalProps>) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!isOpen) return\n\n const modal = ref.current\n\n if (!modal) {\n console.error('modal open, but no ref found')\n return\n }\n\n overlayStack.push(modal)\n\n const focusable = modal?.querySelectorAll(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const isTopmost = overlayStack[overlayStack.length - 1] === modal\n if (!isTopmost) return\n\n if (e.key === 'Escape') {\n e.stopPropagation()\n onClose()\n } else if (e.key === 'Tab') {\n if (focusable.length === 0) return\n\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n (last as HTMLElement).focus()\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n (first as HTMLElement).focus()\n }\n }\n }\n\n modal.focus()\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n overlayStack = overlayStack.filter(m => m !== modal)\n }\n }, [isOpen, onClose])\n\n return (\n <Overlay\n isOpen={isOpen}\n onBackgroundClick={onClose}\n backgroundClassName={backgroundClassName}\n >\n <div\n ref={ref}\n tabIndex={-1}\n className={clsx(\n 'fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl',\n className\n )}\n role=\"dialog\"\n aria-modal={true}\n >\n <OverlayHeader {...headerProps} onClose={onClose}/>\n {children}\n </div>\n </Overlay>\n )\n}\n\n// --- Dialog ---\n\nexport type DialogProps = Omit<OverlayProps, 'onBackgroundClick'> & {\n headerProps?: Omit<OverlayHeaderProps, 'onClose'>,\n className?: string,\n}\n\n/**\n * A Generic Dialog Window\n */\nexport const Dialog = ({\n children,\n isOpen,\n className,\n backgroundClassName,\n headerProps,\n }: PropsWithChildren<DialogProps>) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!isOpen) return\n\n const dialog = ref.current\n\n if (!dialog) {\n console.error('dialog open, but no ref found')\n return\n }\n\n overlayStack.push(dialog)\n\n const focusable = dialog?.querySelectorAll(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const isTopmost = overlayStack[overlayStack.length - 1] === dialog\n if (!isTopmost) return\n\n if (e.key === 'Escape') {\n e.stopPropagation()\n } else if (e.key === 'Tab') {\n if (focusable.length === 0) return\n\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n (last as HTMLElement).focus()\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n (first as HTMLElement).focus()\n }\n }\n }\n\n dialog.focus()\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n overlayStack = overlayStack.filter(m => m !== dialog)\n }\n }, [isOpen])\n\n return (\n <Overlay\n isOpen={isOpen}\n backgroundClassName={backgroundClassName}\n >\n <div\n ref={ref}\n tabIndex={-1}\n className={clsx(\n 'fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl',\n className\n )}\n role=\"dialog\"\n aria-modal={true}\n >\n {!!headerProps && (<OverlayHeader {...headerProps}/>)}\n {children}\n </div>\n </Overlay>\n )\n}","import type { Dispatch, SetStateAction } from 'react'\nimport { useEffect, useState } from 'react'\n\ntype UseHoverStateProps = {\n /**\n * The delay after which the menu is closed in milliseconds\n *\n * default: 200ms\n */\n closingDelay: number,\n /**\n * Whether the hover state management should be disabled\n *\n * default: false\n */\n isDisabled: boolean,\n}\n\ntype UseHoverStateReturnType = {\n /**\n * Whether the element is hovered\n */\n isHovered: boolean,\n /**\n * Function to change the current hover status\n */\n setIsHovered: Dispatch<SetStateAction<boolean>>,\n /**\n * Handlers to pass on to the component that should be hovered\n */\n handlers: {\n onMouseEnter: () => void,\n onMouseLeave: () => void,\n },\n}\n\nconst defaultUseHoverStateProps: UseHoverStateProps = {\n closingDelay: 200,\n isDisabled: false,\n}\n\n/**\n * @param props See UseHoverStateProps\n *\n * A react hook for managing the hover state of a component. The handlers provided should be\n * forwarded to the component which should be hovered over\n */\nexport const useHoverState = (props: Partial<UseHoverStateProps> | undefined = undefined): UseHoverStateReturnType => {\n const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props }\n\n const [isHovered, setIsHovered] = useState(false)\n const [timer, setTimer] = useState<NodeJS.Timeout>()\n\n const onMouseEnter = () => {\n if (isDisabled) {\n return\n }\n clearTimeout(timer)\n setIsHovered(true)\n }\n\n const onMouseLeave = () => {\n if (isDisabled) {\n return\n }\n setTimer(setTimeout(() => {\n setIsHovered(false)\n }, closingDelay))\n }\n\n useEffect(() => {\n if (timer) {\n return () => {\n clearTimeout(timer)\n }\n }\n })\n\n useEffect(() => {\n if (timer) {\n clearTimeout(timer)\n }\n }, [isDisabled]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n isHovered, setIsHovered, handlers: { onMouseEnter, onMouseLeave }\n }\n}\n","import type { CSSProperties, PropsWithChildren, ReactNode } from 'react'\nimport { useHoverState } from '@/hooks/useHoverState'\nimport { clsx } from 'clsx'\n\ntype Position = 'top' | 'bottom' | 'left' | 'right'\n\nexport type TooltipProps = PropsWithChildren<{\n tooltip: string | ReactNode,\n /**\n * Number of milliseconds until the tooltip appears\n *\n * defaults to 1000ms\n */\n animationDelay?: number,\n /**\n * Class names of additional styling properties for the tooltip\n */\n tooltipClassName?: string,\n /**\n * Class names of additional styling properties for the container from which the tooltip will be created\n */\n containerClassName?: string,\n position?: Position,\n zIndex?: number,\n}>\n\n/**\n * A Component for showing a tooltip when hovering over Content\n * @param tooltip The tooltip to show can be a text or any ReactNode\n * @param children The Content for which the tooltip should be created\n * @param animationDelay The delay before the tooltip appears\n * @param tooltipClassName Additional ClassNames for the Container of the tooltip\n * @param containerClassName Additional ClassNames for the Container holding the content\n * @param position The direction of the tooltip relative to the Container\n * @param zIndex The z Index of the tooltip (you may require this when stacking modal)\n * @constructor\n */\nexport const Tooltip = ({\n tooltip,\n children,\n animationDelay = 650,\n tooltipClassName = '',\n containerClassName = '',\n position = 'bottom',\n zIndex = 10,\n }: TooltipProps) => {\n const { isHovered, handlers } = useHoverState()\n\n const positionClasses = {\n top: `bottom-full left-1/2 -translate-x-1/2 mb-[6px]`,\n bottom: `top-full left-1/2 -translate-x-1/2 mt-[6px]`,\n left: `right-full top-1/2 -translate-y-1/2 mr-[6px]`,\n right: `left-full top-1/2 -translate-y-1/2 ml-[6px]`\n }\n\n const triangleSize = 6\n const triangleClasses = {\n top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,\n bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,\n left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,\n right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`\n }\n\n const triangleStyle: Record<Position, CSSProperties> = {\n top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },\n bottom: { borderWidth: `0 ${triangleSize}px ${triangleSize}px ${triangleSize}px` },\n left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },\n right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }\n }\n\n return (\n <div\n className={clsx('relative inline-block', containerClassName)}\n {...handlers}\n >\n {children}\n {isHovered && (\n <div\n className={clsx(\n `opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap\n animate-tooltip-fade-in shadow-lg bg-tooltip-background`,\n positionClasses[position], tooltipClassName\n )}\n style={{ zIndex, animationDelay: animationDelay + 'ms' }}\n >\n {tooltip}\n <div\n className={clsx(`absolute w-0 h-0`, triangleClasses[position])}\n style={{ ...triangleStyle[position], zIndex }}\n />\n </div>\n )}\n </div>\n )\n}\n","import clsx from 'clsx'\n\nexport const avtarSizeList = ['tiny', 'small', 'medium', 'large'] as const\nexport type AvatarSize = typeof avtarSizeList[number]\nexport const avatarSizeMapping: Record<AvatarSize, number> = {\n tiny: 24,\n small: 32,\n medium: 48,\n large: 64\n}\n\nexport type AvatarProps = {\n avatarUrl: string,\n alt: string,\n size?: AvatarSize,\n className?: string,\n}\n\n/**\n * A component for showing a profile picture\n */\nexport const Avatar = ({ avatarUrl, alt, size = 'medium', className = '' }: AvatarProps) => {\n // TODO remove later\n avatarUrl = 'https://cdn.helpwave.de/boringavatar.svg'\n\n const avtarSize = {\n tiny: 24,\n small: 32,\n medium: 48,\n large: 64,\n }[size]\n\n const style = {\n width: avtarSize + 'px',\n height: avtarSize + 'px',\n maxWidth: avtarSize + 'px',\n maxHeight: avtarSize + 'px',\n minWidth: avtarSize + 'px',\n minHeight: avtarSize + 'px',\n }\n\n return (\n // TODO transparent or white background later\n <div className={clsx(`rounded-full bg-primary`, className)} style={style}>\n <img\n className=\"rounded-full border border-gray-200\"\n style={style}\n src={avatarUrl}\n alt={alt}\n width={avtarSize}\n height={avtarSize}\n />\n </div>\n )\n}\n\nexport type AvatarGroupProps = {\n avatars: Omit<AvatarProps, 'size'>[],\n maxShownProfiles?: number,\n size?: AvatarSize,\n}\n\n/**\n * A component for showing a group of Avatar's\n */\nexport const AvatarGroup = ({\n avatars,\n maxShownProfiles = 5,\n size = 'tiny'\n }: AvatarGroupProps) => {\n const displayedProfiles = avatars.length < maxShownProfiles ? avatars : avatars.slice(0, maxShownProfiles)\n const diameter = avatarSizeMapping[size]\n const stackingOverlap = 0.5 // given as a percentage\n const notDisplayedProfiles = avatars.length - maxShownProfiles\n const avatarGroupWidth = diameter * (stackingOverlap * (displayedProfiles.length - 1) + 1)\n return (\n <div className=\"row relative\" style={{ height: diameter + 'px' }}>\n <div style={{ width: avatarGroupWidth + 'px' }}>\n {displayedProfiles.map((avatar, index) => (\n <div\n key={index}\n className=\"absolute\"\n style={{ left: (index * diameter * stackingOverlap) + 'px', zIndex: maxShownProfiles - index }}\n >\n <Avatar avatarUrl={avatar.avatarUrl} alt={avatar.alt} size={size}/>\n </div>\n ))}\n </div>\n {\n notDisplayedProfiles > 0 && (\n <div\n className=\"truncate row items-center\"\n style={{ fontSize: (diameter / 2) + 'px', marginLeft: (1 + diameter / 16) + 'px' }}\n >\n <span>+ {notDisplayedProfiles}</span>\n </div>\n )\n }\n </div>\n )\n}\n\nexport default { Avatar, AvatarGroup }\n","import type { HTMLAttributes } from 'react'\nimport clsx from 'clsx'\n\nexport type CircleProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'color'> & {\n radius: number,\n className?: string,\n}\n\nexport const Circle = ({\n radius = 20,\n className = 'bg-primary',\n style,\n ...restProps\n }: CircleProps) => {\n const size = radius * 2\n return (\n <div\n className={clsx(`rounded-full`, className)}\n style={{\n width: `${size}px`,\n height: `${size}px`,\n ...style,\n }}\n {...restProps}\n />\n )\n}\n","import type { CSSProperties } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { noop } from '../../util/noop'\nimport { Circle } from './Circle'\nimport clsx from 'clsx'\n\nexport type RingProps = {\n innerSize: number, // the size of the entire circle including the circleWidth\n width: number,\n className?: string,\n};\n\nexport const Ring = ({\n innerSize = 20,\n width = 7,\n className = 'outline-primary',\n }: RingProps) => {\n return (\n <div\n className={clsx(`bg-transparent rounded-full outline`, className)}\n style={{\n width: `${innerSize}px`,\n height: `${innerSize}px`,\n outlineWidth: `${width}px`,\n }}\n />\n )\n}\n\nexport type AnimatedRingProps = RingProps & {\n fillAnimationDuration?: number, // in seconds, 0 means no animation\n repeating?: boolean,\n onAnimationFinished?: () => void,\n style?: CSSProperties,\n};\n\nexport const AnimatedRing = ({\n innerSize,\n width,\n className,\n fillAnimationDuration = 3,\n repeating = false,\n onAnimationFinished = noop,\n style,\n }: AnimatedRingProps) => {\n const [currentWidth, setCurrentWidth] = useState(0)\n const milliseconds = 1000 * fillAnimationDuration\n\n const animate = useCallback((timestamp: number, startTime: number) => {\n const progress = Math.min((timestamp - startTime) / milliseconds, 1)\n const newWidth = Math.min(width * progress, width)\n\n setCurrentWidth(newWidth)\n\n if (progress < 1) {\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))\n } else {\n onAnimationFinished()\n if (repeating) {\n setCurrentWidth(0)\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))\n }\n }\n }, [milliseconds, onAnimationFinished, repeating, width])\n\n useEffect(() => {\n if (currentWidth < width) {\n requestAnimationFrame((timestamp) => animate(timestamp, timestamp))\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n className=\"row items-center justify-center\"\n style={{\n width: `${innerSize + 2 * width}px`,\n height: `${innerSize + 2 * width}px`,\n ...style,\n }}\n >\n <Ring\n innerSize={innerSize}\n width={currentWidth}\n className={className}\n />\n </div>\n )\n}\n\nexport type RingWaveProps = Omit<AnimatedRingProps, 'innerSize'> & {\n startInnerSize: number,\n endInnerSize: number,\n style?: CSSProperties,\n};\n\nexport const RingWave = ({\n startInnerSize = 20,\n endInnerSize = 30,\n width,\n className,\n fillAnimationDuration = 3,\n repeating = false,\n onAnimationFinished = noop,\n style\n }: RingWaveProps) => {\n const [currentInnerSize, setCurrentInnerSize] = useState(startInnerSize)\n const distance = endInnerSize - startInnerSize\n const milliseconds = 1000 * fillAnimationDuration\n\n const animate = useCallback((timestamp: number, startTime: number) => {\n const progress = Math.min((timestamp - startTime) / milliseconds, 1)\n const newInnerSize = Math.min(\n startInnerSize + distance * progress,\n endInnerSize\n )\n\n setCurrentInnerSize(newInnerSize)\n\n if (progress < 1) {\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))\n } else {\n onAnimationFinished()\n if (repeating) {\n setCurrentInnerSize(startInnerSize)\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))\n }\n }\n }, [distance, endInnerSize, milliseconds, onAnimationFinished, repeating, startInnerSize])\n\n useEffect(() => {\n if (currentInnerSize < endInnerSize) {\n requestAnimationFrame((timestamp) => animate(timestamp, timestamp))\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n className=\"row items-center justify-center\"\n style={{\n width: `${endInnerSize + 2 * width}px`,\n height: `${endInnerSize + 2 * width}px`,\n ...style\n }}\n >\n <Ring\n innerSize={currentInnerSize}\n width={width}\n className={className}\n />\n </div>\n )\n}\n\nexport type RadialRingsProps = {\n circle1ClassName?: string,\n circle2ClassName?: string,\n circle3ClassName?: string,\n waveWidth?: number,\n waveBaseColor?: string,\n sizeCircle1?: number,\n sizeCircle2?: number,\n sizeCircle3?: number,\n};\n\n// TODO use fixed colors here to avoid artifacts\nexport const RadialRings = ({\n circle1ClassName = 'bg-primary/90 outline-primary/90',\n circle2ClassName = 'bg-primary/60 outline-primary/60',\n circle3ClassName = 'bg-primary/40 outline-primary/40',\n waveWidth = 10,\n waveBaseColor = 'outline-white/20',\n sizeCircle1 = 100,\n sizeCircle2 = 200,\n sizeCircle3 = 300\n }: RadialRingsProps) => {\n const [currentRing, setCurrentRing] = useState(0)\n const size = sizeCircle3\n\n return (\n <div\n className=\"relative\"\n style={{\n width: `${sizeCircle3}px`,\n height: `${sizeCircle3}px`,\n }}\n >\n <Circle\n radius={sizeCircle1 / 2}\n className={clsx(circle1ClassName, `absolute z-[10] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n {currentRing === 0 ? (\n <AnimatedRing\n innerSize={sizeCircle1}\n width={(sizeCircle2 - sizeCircle1) / 2}\n onAnimationFinished={() =>\n currentRing === 0 ? setCurrentRing(1) : null\n }\n repeating={true}\n className={clsx(circle2ClassName,\n { 'opacity-5': currentRing !== 0 })}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 9\n }}\n />\n ) : null}\n {currentRing === 2 ? (\n <RingWave\n startInnerSize={sizeCircle1 - waveWidth}\n endInnerSize={sizeCircle2}\n width={waveWidth}\n repeating={true}\n className={clsx(waveBaseColor, `opacity-5`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 9,\n }}\n />\n ) : null}\n <Circle\n radius={sizeCircle2 / 2}\n className={clsx(circle2ClassName,\n { 'opacity-20': currentRing < 1 },\n `absolute z-[8] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n {currentRing === 1 ? (\n <AnimatedRing\n innerSize={sizeCircle2 - 1} // potentially harmful\n width={(sizeCircle3 - sizeCircle2) / 2}\n onAnimationFinished={() =>\n currentRing === 1 ? setCurrentRing(2) : null\n }\n repeating={true}\n className={clsx(circle3ClassName)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 7,\n }}\n />\n ) : null}\n {currentRing === 2 ? (\n <RingWave\n startInnerSize={sizeCircle2}\n endInnerSize={sizeCircle3 - waveWidth}\n width={waveWidth}\n repeating={true}\n className={clsx(waveBaseColor, `opacity-5`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 7,\n }}\n />\n ) : null}\n <Circle\n radius={sizeCircle3 / 2}\n className={clsx(circle3ClassName,\n { 'opacity-20': currentRing < 2 },\n `absolute z-[6] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n </div>\n )\n}\n","export type TagProps = {\n size?: number,\n className?: string,\n}\n\n/**\n * Tag icon from flaticon\n *\n * https://www.flaticon.com/free-icon/price-tag_721550?term=label&page=1&position=8&origin=tag&related_id=721550\n *\n * When using it make attribution\n */\nexport const TagIcon = ({\n className,\n size = 16,\n }: TagProps) => {\n return (\n <img\n style={{ width: `${size}px`, height: `${size}px`, minWidth: `${size}px`, minHeight: `${size}px` }}\n width={size}\n height={size}\n alt=\"\"\n src=\"https://cdn.helpwave.de/icons/label.png\"\n className={className}\n />\n )\n}\n","import Link from 'next/link'\nimport clsx from 'clsx'\n\nexport type Crumb = {\n display: string,\n link: string,\n}\n\ntype BreadCrumbProps = {\n crumbs: Crumb[],\n linkClassName?: string,\n containerClassName?: string,\n}\n\n/**\n * A component for showing a hierarchical link structure with an independent link on each element\n *\n * e.g. Organizations/Ward/<id>\n */\nexport const BreadCrumb = ({ crumbs, linkClassName, containerClassName }: BreadCrumbProps) => {\n const color = 'text-description'\n\n return (\n <div className={clsx('row gap-x-0', containerClassName)}>\n {crumbs.map((crumb, index) => (\n <div key={index}>\n <Link href={crumb.link}\n className={clsx(linkClassName, { [`${color} hover:brightness-60`]: index !== crumbs.length - 1 })}>\n {crumb.display}\n </Link>\n {index !== crumbs.length - 1 && <span className={clsx(`px-1`, color)}>/</span>}\n </div>\n ))}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\n\n\ntype CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-white',\n className = '',\n heightClassName = 'h-[24rem]',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"col items-center w-full gap-y-2\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <div\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoLeft() })}\n onClick={() => left()}\n >\n <ChevronLeft size={32}/>\n </div>\n <div\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoRight() })}\n onClick={() => right()}\n >\n <ChevronRight size={32}/>\n </div>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`relative row h-full`, heightClassName)}>\n <div className=\"relative row h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"row items-center justify-center w-full my-2\">\n {range(0, length - 1).map(index => (\n <button\n key={index}\n className={clsx('w-[2rem] min-w-[2rem] h-[0.75rem] min-h-[0.75rem] hover:bg-primary hover:brightness-90 first:rounded-l-md last:rounded-r-md', {\n 'bg-gray-200': currentIndex !== index,\n 'bg-primary': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","import type { HTMLProps, PropsWithChildren, ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type ChipColor = 'default' | 'dark' | 'red' | 'yellow' | 'green' | 'blue' | 'pink'\ntype ChipVariant = 'normal' | 'fullyRounded'\n\nexport type ChipProps = HTMLProps<HTMLDivElement> & PropsWithChildren<{\n color?: ChipColor,\n variant?: ChipVariant,\n trailingIcon?: ReactNode,\n}>\n\n/**\n * A component for displaying a single chip\n */\nexport const Chip = ({\n children,\n trailingIcon,\n color = 'default',\n variant = 'normal',\n className = '',\n ...restProps\n }: ChipProps) => {\n const colorMapping: string = {\n default: 'text-tag-default-text bg-tag-default-background',\n dark: 'text-tag-dark-text bg-tag-dark-background',\n red: 'text-tag-red-text bg-tag-red-background',\n yellow: 'text-tag-yellow-text bg-tag-yellow-background',\n green: 'text-tag-green-text bg-tag-green-background',\n blue: 'text-tag-blue-text bg-tag-blue-background',\n pink: 'text-tag-pink-text bg-tag-pink-background',\n }[color]\n\n const colorMappingIcon: string = {\n default: 'text-tag-default-icon',\n dark: 'text-tag-dark-icon',\n red: 'text-tag-red-icon',\n yellow: 'text-tag-yellow-icon',\n green: 'text-tag-green-icon',\n blue: 'text-tag-blue-icon',\n pink: 'text-tag-pink-icon',\n }[color]\n\n return (\n <div\n {...restProps}\n className={clsx(\n `row w-fit px-2 py-1`,\n colorMapping,\n {\n 'rounded-md': variant === 'normal',\n 'rounded-full': variant === 'fullyRounded',\n },\n className\n )}\n >\n {children}\n {trailingIcon && (<span className={colorMappingIcon}>{trailingIcon}</span>)}\n </div>\n )\n}\n\nexport type ChipListProps = {\n list: ChipProps[],\n className?: string,\n}\n\n/**\n * A component for displaying a list of chips\n */\nexport const ChipList = ({\n list,\n className = ''\n }: ChipListProps) => {\n return (\n <div className={clsx('flex flex-wrap gap-x-4 gap-y-2', className)}>\n {list.map((value, index) => (\n <Chip\n key={index}\n {...value}\n color={value.color ?? 'dark'}\n variant={value.variant ?? 'normal'}\n >\n {value.children}\n </Chip>\n ))}\n </div>\n )\n}\n","import type { HTMLAttributes, ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type DividerInserterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: ReactNode[],\n divider: (index: number) => ReactNode,\n}\n\n/**\n * A Component for inserting a divider in the middle of each child element\n *\n * undefined elements are removed\n */\nexport const DividerInserter = ({\n children,\n divider,\n className,\n ...restProps\n }: DividerInserterProps) => {\n const nodes: ReactNode[] = []\n\n for (let index = 0; index < children.length; index++) {\n const element = children[index]\n if (element !== undefined) {\n nodes.push(element)\n if (index < children.length - 1) {\n nodes.push(divider(index))\n }\n }\n }\n\n return (\n <div className={clsx(className)} {...restProps}>\n {nodes}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\nimport { ChevronDown, ChevronUp } from 'lucide-react'\nimport type { ExpandableProps } from './Expandable'\nimport { ExpandableUncontrolled } from './Expandable'\nimport { MarkdownInterpreter } from './MarkdownInterpreter'\n\ntype ContentType = {\n type: 'markdown',\n value: string,\n} | {\n type: 'custom',\n value: ReactNode,\n}\n\nexport type FAQItem = Pick<ExpandableProps, 'isExpanded' | 'className'> & {\n id: string,\n title: string,\n content: ContentType,\n}\n\nexport type FAQSectionProps = {\n entries: FAQItem[],\n expandableClassName?: string,\n}\n\n/**\n * Description\n */\nexport const FAQSection = ({\n entries,\n expandableClassName\n }: FAQSectionProps) => {\n const chevronSize = 28\n return (\n <div className=\"col gap-y-4\">\n {entries.map(({ id, title, content, ...restProps }) => (\n <ExpandableUncontrolled\n key={id}\n {...restProps}\n label={(<h3 id={id} className=\"textstyle-title-md\">{title}</h3>)}\n clickOnlyOnHeader={false}\n icon={(expanded) => expanded ?\n (<ChevronUp size={chevronSize} className=\"text-primary\" style={{ minWidth: `${chevronSize}px` }}/>) :\n (<ChevronDown size={chevronSize} className=\"text-primary\"/>)\n }\n className={clsx('rounded-xl', expandableClassName)}\n >\n <div className=\"mt-2\">\n {content.type === 'markdown' ? (<MarkdownInterpreter text={content.value}/>) : content.value}\n </div>\n </ExpandableUncontrolled>\n ))}\n </div>\n )\n}\n","type ASTNodeModifierType =\n 'none'\n | 'italic'\n | 'bold'\n | 'underline'\n | 'font-space'\n | 'primary'\n | 'secondary'\n | 'warn'\n | 'positive'\n | 'negative'\n\nconst astNodeInserterType = ['helpwave', 'newline'] as const\ntype ASTNodeInserterType = typeof astNodeInserterType[number]\ntype ASTNodeDefaultType = 'text'\n\ntype ASTNode = {\n type: ASTNodeModifierType,\n children: ASTNode[],\n} | {\n type: ASTNodeInserterType,\n} | {\n type: ASTNodeDefaultType,\n text: string,\n}\n\nexport type ASTNodeInterpreterProps = {\n node: ASTNode,\n isRoot?: boolean,\n className?: string,\n}\nexport const ASTNodeInterpreter = ({\n node,\n isRoot = false,\n className = '',\n }: ASTNodeInterpreterProps) => {\n switch (node.type) {\n case 'newline':\n return <br/>\n case 'text':\n return isRoot ? <span className={className}>{node.text}</span> : node.text\n case 'helpwave':\n return (<span className=\"font-bold font-space no-underline\">helpwave</span>)\n case 'none':\n return isRoot ? (\n <span className={className}>{node.children.map((value, index) => (\n <ASTNodeInterpreter key={index}\n node={value}/>\n ))}</span>\n ) :\n <>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</>\n case 'bold':\n return <b>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</b>\n case 'italic':\n return <i>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</i>\n case 'underline':\n return (<u>{node.children.map((value, index) => (<ASTNodeInterpreter key={index} node={value}/>))}</u>)\n case 'font-space':\n return (\n <span className=\"font-space\">{node.children.map((value, index) => (\n <ASTNodeInterpreter key={index}\n node={value}/>\n ))}</span>\n )\n case 'primary':\n return (\n <span className=\"text-primary\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'secondary':\n return (\n <span className=\"text-secondary\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'warn':\n return (\n <span className=\"text-warning\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'positive':\n return (\n <span className=\"text-positive\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'negative':\n return (\n <span className=\"text-negative\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n default:\n return null\n }\n}\n\nconst modifierIdentifierMapping = [\n { id: 'i', name: 'italic' },\n { id: 'b', name: 'bold' },\n { id: 'u', name: 'underline' },\n { id: 'space', name: 'font-space' },\n { id: 'primary', name: 'primary' },\n { id: 'secondary', name: 'secondary' },\n { id: 'warn', name: 'warn' },\n { id: 'positive', name: 'positive' },\n { id: 'negative', name: 'negative' },\n] as const\n\nconst inserterIdentifierMapping = [\n { id: 'helpwave', name: 'helpwave' },\n { id: 'newline', name: 'newline' }\n] as const\nconst parseMarkdown = (\n text: string,\n commandStart: string = '\\\\',\n open: string = '{',\n close: string = '}'\n): ASTNode => {\n let start = text.indexOf(commandStart)\n const children: ASTNode[] = []\n\n // parse the text step by step\n while (text !== '') {\n if (start === -1) {\n children.push({\n type: 'text',\n text\n })\n break\n }\n children.push(parseMarkdown(text.substring(0, start)))\n text = text.substring(start)\n if (text.length <= 1) {\n children.push({\n type: 'text',\n text\n })\n text = ''\n continue\n }\n const simpleReplace = [commandStart, open, close]\n if (simpleReplace.some(value => text[1] === value)) {\n children.push({\n type: 'text',\n text: simpleReplace.find(value => text[1] === value)!\n })\n text = text.substring(2)\n start = text.indexOf(commandStart)\n continue\n }\n const inserter = inserterIdentifierMapping.find(value => text.substring(1).startsWith(value.id))\n if (inserter) {\n children.push({\n type: inserter.name,\n })\n text = text.substring(inserter.id.length + 1)\n start = text.indexOf(commandStart)\n continue\n }\n const modifier = modifierIdentifierMapping.find(value => text.substring(1).startsWith(value.id))\n if (modifier) {\n // check brackets\n if (text[modifier.id.length + 1] !== open) {\n children.push({\n type: 'text',\n text: text.substring(0, modifier.id.length + 1)\n })\n text = text.substring(modifier.id.length + 2)\n start = text.indexOf(commandStart)\n continue\n }\n let closing = -1\n let index = modifier.id.length + 2\n let counter = 1\n let escaping = false\n while (index < text.length) {\n if (text[index] === open && !escaping) {\n counter++\n }\n if (text[index] === close && !escaping) {\n counter--\n if (counter === 0) {\n closing = index\n break\n }\n }\n escaping = text[index] === commandStart\n index++\n }\n\n if (closing !== -1) {\n children.push({\n type: modifier.name,\n children: [parseMarkdown(text.substring(modifier.id.length + 2, closing))]\n })\n text = text.substring(closing + 1)\n start = text.indexOf(commandStart)\n continue\n }\n }\n // nothing could be applied to command start\n children.push({\n type: 'text',\n text: text[0]!\n })\n text = text.substring(1)\n start = text.indexOf(commandStart)\n }\n\n return {\n type: 'none',\n children\n }\n}\n\nconst optimizeTree = (node: ASTNode) => {\n if (node.type === 'text') {\n return !node.text ? undefined : node\n }\n if (astNodeInserterType.some(value => value === node.type)) {\n return node\n }\n\n const currentNode = node as\n { type: ASTNodeModifierType, children: ASTNode[] }\n\n if (currentNode.children.length === 0) {\n return undefined\n }\n\n let children: ASTNode[] = []\n for (let i = 0; i < currentNode.children.length; i++) {\n const child = optimizeTree(currentNode.children[i]!)\n if (!child) {\n continue\n }\n if (child.type === 'none') {\n children.push(...child.children)\n } else {\n children.push(child)\n }\n }\n\n currentNode.children = children\n children = []\n\n for (let i = 0; i < currentNode.children.length; i++) {\n const child = currentNode.children[i]!\n if (child) {\n if (child.type === 'text' && children[children.length - 1]?.type === 'text') {\n (children[children.length - 1]! as { type: ASTNodeDefaultType, text: string }).text += child.text\n } else {\n children.push(child)\n }\n }\n }\n currentNode.children = children\n return currentNode\n}\n\nexport type MarkdownInterpreterProps = {\n text: string,\n className?: string,\n}\n\nexport const MarkdownInterpreter = ({ text, className }: MarkdownInterpreterProps) => {\n const tree = parseMarkdown(text)\n const optimizedTree = optimizeTree(tree)!\n return <ASTNodeInterpreter node={optimizedTree} isRoot={true} className={className}/>\n}\n","import { ChevronFirst, ChevronLast, ChevronLeft, ChevronRight } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { Language } from '../../localization/util'\n\ntype PaginationTranslation = {\n of: string,\n}\nconst defaultPaginationTranslations: Record<Language, PaginationTranslation> = {\n en: {\n of: 'of'\n },\n de: {\n of: 'von'\n }\n}\n\nexport type PaginationProps = {\n page: number, // starts with 0\n numberOfPages: number,\n onPageChanged: (page: number) => void,\n}\n\n/**\n * A Component showing the pagination allowing first, before, next and last page navigation\n */\nexport const Pagination = ({\n overwriteTranslation,\n page,\n numberOfPages,\n onPageChanged\n }: PropsForTranslation<PaginationTranslation, PaginationProps>) => {\n const translation = useTranslation(defaultPaginationTranslations, overwriteTranslation)\n\n const changePage = (page: number) => {\n onPageChanged(page)\n }\n\n const noPages = numberOfPages === 0\n const onFirstPage = page === 0 && !noPages\n const onLastPage = page === numberOfPages - 1\n\n return (\n <div className={clsx('row', { 'opacity-30': noPages })}>\n <button onClick={() => changePage(0)} disabled={onFirstPage}>\n <ChevronFirst className={clsx({ 'opacity-30': onFirstPage })}/>\n </button>\n <button onClick={() => changePage(page - 1)} disabled={onFirstPage}>\n <ChevronLeft className={clsx({ 'opacity-30': onFirstPage })}/>\n </button>\n <div className=\"min-w-[80px] justify-center mx-2\">\n <span className=\"select-none text-right flex-1\">{noPages ? 0 : page + 1}</span>\n <span className=\"select-none mx-2\">{translation.of}</span>\n <span className=\"select-none text-left flex-1\">{numberOfPages}</span>\n </div>\n <button onClick={() => changePage(page + 1)} disabled={onLastPage || noPages}>\n <ChevronRight className={clsx({ 'opacity-30': onLastPage })}/>\n </button>\n <button onClick={() => changePage(numberOfPages - 1)} disabled={onLastPage || noPages}>\n <ChevronLast className={clsx({ 'opacity-30': onLastPage })}/>\n </button>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { useEffect, useMemo, useState } from 'react'\nimport { Search } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport { Input } from '../user-action/Input'\n\ntype SearchableListTranslation = {\n search: string,\n nothingFound: string,\n}\n\nconst defaultSearchableListTranslation: Record<Language, SearchableListTranslation> = {\n en: {\n search: 'Search',\n nothingFound: 'Nothing found'\n },\n de: {\n search: 'Suche',\n nothingFound: 'Nichts gefunden'\n }\n}\n\nexport type SearchableListProps<T> = {\n list: T[],\n initialSearch?: string,\n searchMapping: (value: T) => string[],\n itemMapper: (value: T) => ReactNode,\n className?: string,\n}\n\n/**\n * A component for searching a list\n */\nexport const SearchableList = <T, >({\n overwriteTranslation,\n list,\n initialSearch = '',\n searchMapping,\n itemMapper,\n className\n }: PropsForTranslation<SearchableListTranslation, SearchableListProps<T>>) => {\n const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation)\n const [search, setSearch] = useState<string>(initialSearch)\n\n useEffect(() => setSearch(initialSearch), [initialSearch])\n\n const filteredEntries = useMemo(() => MultiSearchWithMapping(search, list, searchMapping), [search, list, searchMapping])\n\n return (\n <div className={clsx('col gap-y-2', className)}>\n <div className=\"row justify-between gap-x-2 items-center\">\n <div className=\"flex-1\">\n <Input value={search} onChangeText={setSearch} placeholder={translation.search}/>\n </div>\n <Search size={20}/>\n </div>\n {filteredEntries.length > 0 && (\n <div className=\"col gap-y-1\">\n {filteredEntries.map(itemMapper)}\n </div>\n )}\n {!filteredEntries.length && <div className=\"row justify-center\">{translation.nothingFound}</div>}\n </div>\n )\n}\n","import React, { forwardRef, type InputHTMLAttributes, useEffect, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type InputProps = {\n /**\n * used for the label's `for` attribute\n */\n label?: Omit<LabelProps, 'id'>,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n className?: string,\n onEditCompleted?: (text: string) => void,\n expanded?: boolean,\n containerClassName?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'label'>\n\n/**\n * A Component for inputting text or other information\n *\n * Its state is managed must be managed by the parent\n */\nconst Input = ({\n id,\n type = 'text',\n value,\n label,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted,\n className = '',\n expanded = true,\n autoFocus,\n onBlur,\n containerClassName,\n ...restProps\n }: InputProps) => {\n const {\n restartTimer,\n clearUpdateTimer\n } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n if(autoFocus) {\n ref.current?.focus()\n }\n }, [autoFocus])\n\n return (\n <div className={clsx({ 'w-full': expanded }, containerClassName)}>\n {label && <Label {...label} htmlFor={id} className={clsx('mb-1', label.className)}/>}\n <input\n ref={ref}\n value={value}\n id={id}\n type={type}\n className={className}\n onBlur={event => {\n if (onBlur) {\n onBlur(event)\n }\n if (onEditCompleted) {\n onEditCompleted(event.target.value)\n clearUpdateTimer()\n }\n }}\n onChange={e => {\n const value = e.target.value\n if (onEditCompleted) {\n restartTimer(() => {\n onEditCompleted(value)\n clearUpdateTimer()\n })\n }\n onChange(e)\n onChangeText(value)\n }}\n {...restProps}\n />\n </div>\n )\n}\n\ntype InputUncontrolledProps = Omit<InputProps, 'value'> & {\n /**\n * @default ''\n */\n defaultValue?: string,\n}\n\n/**\n * A Component for inputting text or other information\n *\n * Its state is managed by the component itself\n */\nconst InputUncontrolled = ({\n defaultValue = '',\n onChangeText = noop,\n ...props\n }: InputUncontrolledProps) => {\n const [value, setValue] = useState(defaultValue)\n\n return (\n <Input\n {...props}\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n />\n )\n}\n\nexport type FormInputProps = InputHTMLAttributes<HTMLInputElement> & {\n id: string,\n labelText?: string,\n errorText?: string,\n labelClassName?: string,\n errorClassName?: string,\n containerClassName?: string,\n}\n\nconst FormInput = forwardRef<HTMLInputElement, FormInputProps>(function FormInput({\n id,\n labelText,\n errorText,\n className,\n labelClassName,\n errorClassName,\n containerClassName,\n required,\n ...restProps\n }, ref) {\n const input = (\n <input\n ref={ref}\n id={id}\n {...restProps}\n className={clsx(\n {\n 'focus:border-primary focus:ring-primary': !errorText,\n 'focus:border-negative focus:ring-negative text-negative': !!errorText,\n },\n className\n )}\n />\n )\n\n return (\n <div className={clsx('flex flex-col gap-y-1', containerClassName)}>\n {labelText && (\n <label htmlFor={id} className={clsx('textstyle-label-md', labelClassName)}>\n {labelText}\n {required && <span className=\"text-primary font-bold\">*</span>}\n </label>\n )}\n {input}\n {errorText && <label htmlFor={id} className={clsx('text-negative', errorClassName)}>{errorText}</label>}\n </div>\n )\n})\n\nexport {\n InputUncontrolled,\n Input,\n FormInput\n}\n","import { useEffect, useState } from 'react'\n\nexport function useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}","import type { LabelHTMLAttributes } from 'react'\nimport clsx from 'clsx'\n\nexport type LabelType = 'labelSmall' | 'labelMedium' | 'labelBig'\n\nconst styleMapping: Record<LabelType, string> = {\n labelSmall: 'textstyle-label-sm',\n labelMedium: 'textstyle-label-md',\n labelBig: 'textstyle-label-lg',\n}\n\nexport type LabelProps = {\n /** The text for the label */\n name?: string,\n /** The styling for the label */\n labelType?: LabelType,\n} & LabelHTMLAttributes<HTMLLabelElement>\n\n/**\n * A Label component\n */\nexport const Label = ({\n children,\n name,\n labelType = 'labelSmall',\n className,\n ...props\n }: LabelProps) => {\n return (\n <label {...props} className={clsx(styleMapping[labelType], className)}>\n {children ? children : name}\n </label>\n )\n}\n","import { Check, ChevronLeft, ChevronRight } from 'lucide-react'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { range } from '@/util/array'\nimport { SolidButton } from '../user-action/Button'\nimport clsx from 'clsx'\nimport { useEffect, useState } from 'react'\n\ntype StepperBarTranslation = {\n back: string,\n next: string,\n confirm: string,\n}\n\nconst defaultStepperBarTranslation: Record<Language, StepperBarTranslation> = {\n en: {\n back: 'Back',\n next: 'Next Step',\n confirm: 'Create'\n },\n de: {\n back: 'Zurück',\n next: 'Nächster Schritt',\n confirm: 'Erstellen'\n }\n}\n\nexport type StepperState = {\n currentStep: number,\n seenSteps: Set<number>,\n}\n\nexport type StepperBarProps = {\n state?: StepperState,\n numberOfSteps: number,\n disabledSteps: Set<number>,\n onChange: (state: StepperState) => void,\n onFinish: () => void,\n finishText?: string,\n showDots?: boolean,\n className?: string,\n}\n\nconst defaultState: StepperState = {\n currentStep: 0,\n seenSteps: new Set([0])\n}\n\n/**\n * A Component for stepping\n */\nexport const StepperBar = ({\n overwriteTranslation,\n state,\n numberOfSteps,\n disabledSteps = new Set(),\n onChange,\n onFinish,\n finishText,\n showDots = true,\n className = '',\n }: PropsForTranslation<StepperBarTranslation, StepperBarProps>) => {\n const translation = useTranslation(defaultStepperBarTranslation, overwriteTranslation)\n const dots = range(0, numberOfSteps)\n const { currentStep, seenSteps } = state ?? defaultState\n\n const update = (newStep: number) => {\n seenSteps.add(newStep)\n onChange({ currentStep: newStep, seenSteps })\n }\n\n return (\n <div\n className={clsx('row justify-between',className)}\n >\n <div className=\"row flex-[2] justify-start\">\n <SolidButton\n disabled={currentStep === 0 || disabledSteps.has(currentStep)}\n onClick={() => {\n update(currentStep - 1)\n }}\n className=\"row gap-x-1 items-center justify-center\"\n >\n <ChevronLeft size={14}/>\n {translation.back}\n </SolidButton>\n </div>\n <div className=\"row flex-[5] gap-x-2 justify-center items-center\">\n {showDots && dots.map((value, index) => {\n const seen = seenSteps.has(index)\n return (\n <div\n key={index}\n onClick={() => seen && update(index)}\n className={clsx('rounded-full w-4 h-4', {\n 'bg-primary hover:brightness-75': index === currentStep && seen && !disabledSteps.has(currentStep),\n 'bg-primary/40 hover:bg-primary': index !== currentStep && seen && !disabledSteps.has(currentStep),\n 'bg-gray-200 outline-transparent': !seen || disabledSteps.has(currentStep),\n },\n {\n 'cursor-pointer': seen,\n 'cursor-not-allowed': !seen || disabledSteps.has(currentStep),\n })}\n />\n )\n })}\n </div>\n {currentStep !== numberOfSteps && (\n <div className=\"row flex-[2] justify-end\">\n <SolidButton\n onClick={() => update(currentStep + 1)}\n className=\"row gap-x-1 items-center justify-center\"\n disabled={disabledSteps.has(currentStep)}\n >\n {translation.next}\n <ChevronRight size={14}/>\n </SolidButton>\n </div>\n )}\n {currentStep === numberOfSteps && (\n <div className=\"row flex-[2] justify-end\">\n <SolidButton\n disabled={disabledSteps.has(currentStep)}\n onClick={onFinish}\n className=\"row gap-x-1 items-center justify-center\"\n >\n <Check size={14}/>\n {finishText ?? translation.confirm}\n </SolidButton>\n </div>\n )}\n </div>\n )\n}\n\nexport const StepperBarUncontrolled = ({ state, onChange, ...props }: StepperBarProps) => {\n const [usedState, setUsedState] = useState<StepperState>(state ?? defaultState)\n\n useEffect(() => {\n setUsedState(state ?? defaultState)\n }, [state])\n\n return (\n <StepperBar\n {...props}\n state={usedState}\n onChange={newState => {\n setUsedState(newState)\n onChange(newState)\n }}\n />\n )\n}","import type { ReactElement } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '../../util/noop'\nimport { Checkbox } from '../user-action/Checkbox'\nimport { Pagination } from './Pagination'\nimport clsx from 'clsx'\nimport type { TextButtonProps } from '../user-action/Button'\nimport { TextButton } from '../user-action/Button'\nimport { ChevronDown, ChevronsUpDown, ChevronUp } from 'lucide-react'\n\nexport type TableStatePagination = {\n currentPage: number,\n entriesPerPage: number,\n}\nexport const defaultTableStatePagination = {\n currentPage: 0,\n entriesPerPage: 5\n}\n\nexport type TableStateSelection<T> = {\n currentSelection: T[],\n hasSelectedAll: boolean,\n hasSelectedSome: boolean,\n hasSelectedNone: boolean,\n}\n\nexport const defaultTableStateSelection = {\n currentSelection: [],\n hasSelectedAll: false,\n hasSelectedSome: false,\n hasSelectedNone: true\n}\n\nexport type TableState = {\n pagination?: TableStatePagination,\n selection?: {\n /**\n * The mapped ids of the dataType\n */\n currentSelection: string[],\n hasSelectedAll: boolean,\n hasSelectedSome: boolean,\n hasSelectedNone: boolean,\n },\n}\n\ntype IdentifierMapping<T> = (dataObject: T) => string\n\nexport const isDataObjectSelected = <T, >(tableState: TableState, dataObject: T, identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return false\n }\n\n return !!tableState.selection.currentSelection.find(value => value.localeCompare(identifierMapping(dataObject)) === 0)\n}\n\nexport const pageForItem = <T, >(data: T[], item: T, entriesPerPage: number, identifierMapping: IdentifierMapping<T>) => {\n const index = data.findIndex(value => identifierMapping(value) === identifierMapping(item))\n if (index !== -1) {\n return Math.floor(index / entriesPerPage)\n }\n console.warn(\"item doesn't exist on data\", item, data)\n return 0\n}\n\nexport const updatePagination = (pagination: TableStatePagination, dataLength: number): TableStatePagination => ({\n ...pagination,\n currentPage: Math.min(Math.max(Math.ceil(dataLength / pagination.entriesPerPage) - 1, 0), pagination.currentPage)\n})\n\nexport const addElementToTable = <T, >(tableState: TableState, data: T[], dataObject: T, identifierMapping: IdentifierMapping<T>) => {\n return {\n ...tableState,\n pagination: tableState.pagination ? {\n ...tableState.pagination,\n currentPage: pageForItem(data, dataObject, tableState.pagination.entriesPerPage, identifierMapping)\n } : undefined,\n selection: tableState.selection ? {\n ...tableState.selection,\n hasSelectedAll: false,\n hasSelectedSome: tableState.selection.hasSelectedAll || tableState.selection.hasSelectedSome\n } : undefined\n }\n}\n\n/**\n * data length before delete\n */\nexport const removeFromTableSelection = <T, >(tableState: TableState, deletedObjects: T[], dataLength: number, identifierMapping: IdentifierMapping<T>): TableState => {\n if (!tableState.selection) {\n return tableState\n }\n\n const deletedObjectIds = deletedObjects.map(identifierMapping)\n const elementsBefore = tableState.selection.currentSelection.length\n const currentSelection = tableState.selection.currentSelection.filter((value) => !deletedObjectIds.includes(value))\n dataLength -= elementsBefore - currentSelection.length\n\n return {\n ...tableState,\n selection: {\n currentSelection,\n hasSelectedAll: currentSelection.length === dataLength && dataLength !== 0,\n hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,\n hasSelectedNone: currentSelection.length === 0,\n },\n pagination: tableState.pagination ? updatePagination(tableState.pagination, dataLength) : undefined\n }\n}\n\nexport const changeTableSelectionSingle = <T, >(tableState: TableState, dataObject: T, dataLength: number, identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return tableState\n }\n\n const hasSelectedObject = isDataObjectSelected(tableState, dataObject, identifierMapping)\n let currentSelection = [...tableState.selection.currentSelection, identifierMapping(dataObject)] // case !hasSelectedObject\n if (hasSelectedObject) {\n currentSelection = tableState.selection.currentSelection.filter(value => value.localeCompare(identifierMapping(dataObject)) !== 0)\n }\n\n return {\n ...tableState,\n selection: {\n currentSelection,\n hasSelectedAll: currentSelection.length === dataLength,\n hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,\n hasSelectedNone: currentSelection.length === 0,\n }\n }\n}\n\nconst changeTableSelectionAll = <T, >(tableState: TableState, data: T[], identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return tableState\n }\n\n if (data.length === 0) {\n return {\n ...tableState,\n selection: {\n currentSelection: [],\n hasSelectedAll: false,\n hasSelectedSome: false,\n hasSelectedNone: true\n }\n }\n }\n\n const hasSelectedAll = !(tableState.selection.hasSelectedSome || tableState.selection.hasSelectedAll)\n return {\n ...tableState,\n selection: {\n currentSelection: hasSelectedAll ? data.map(identifierMapping) : [],\n hasSelectedAll,\n hasSelectedSome: false,\n hasSelectedNone: !hasSelectedAll\n }\n }\n}\n\nexport type TableSortingType = 'ascending' | 'descending'\nexport type TableSortingFunctionType<T> = (t1: T, t2: T) => number\n\nexport type TableProps<T> = {\n data: T[],\n /**\n * When using selection or pagination\n */\n stateManagement?: [TableState, (tableState: TableState) => void],\n identifierMapping: IdentifierMapping<T>,\n /**\n * Only the cell itself no boilerplate <tr> or <th> required\n */\n header?: ReactElement[],\n /**\n * Only the cells of the row no boilerplate <tr> or <td> required\n */\n rowMappingToCells: (dataObject: T) => ReactElement[],\n sorting?: [TableSortingFunctionType<T>, TableSortingType],\n /**\n * Always go to the page of this element\n */\n focusElement?: T,\n className?: string,\n}\n\n/* Possible extension for better customization\n * Map each element to the displayed row\n * make sure to wrap it in the <tr> and <td> you require\n rowMappingToHTMLRow?: (dataObject: T) => ReactElement\n */\n\n/**\n * A Basic stateless reusable table\n * The state must be handled and saved with the updateTableState method\n */\nexport const Table = <T, >({\n data,\n stateManagement = [{}, noop],\n identifierMapping,\n header,\n rowMappingToCells,\n sorting,\n focusElement,\n className\n }: TableProps<T>) => {\n const sortedData = [...data]\n if (sorting) {\n const [sortingFunction, sortingType] = sorting\n sortedData.sort((a, b) => sortingFunction(a, b) * (sortingType === 'ascending' ? 1 : -1))\n }\n let currentPage = 0\n let pageCount = 1\n let entriesPerPage = 5\n const [tableState, updateTableState] = stateManagement\n\n let shownElements = sortedData\n\n if (tableState?.pagination) {\n if (tableState.pagination.entriesPerPage < 1) {\n console.error('tableState.pagination.entriesPerPage must be >= 1', tableState.pagination.entriesPerPage)\n }\n entriesPerPage = Math.max(1, tableState.pagination.entriesPerPage)\n pageCount = Math.ceil(sortedData.length / entriesPerPage)\n\n if (tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0)) {\n console.error('tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0) must be fullfilled',\n [`pageCount: ${pageCount}`, `tableState.pagination.currentPage: ${tableState.pagination.currentPage}`])\n } else {\n currentPage = tableState.pagination.currentPage\n }\n\n if (focusElement) {\n currentPage = pageForItem(sortedData, focusElement, entriesPerPage, identifierMapping)\n }\n\n shownElements = sortedData.slice(currentPage * entriesPerPage, Math.min(sortedData.length, (currentPage + 1) * entriesPerPage))\n } else {\n currentPage = 0\n }\n\n const headerRow = 'border-b-2 border-gray-300'\n const headerPaddingHead = 'pb-2'\n const headerPaddingBody = 'pt-2'\n const cellPadding = 'py-1 px-2'\n\n const [scrollbarsAutoHeightMin, setScrollbarsAutoHeightMin] = useState(0)\n const tableRef = useRef<HTMLTableElement>(null)\n\n const calculateHeight = () => {\n if (tableRef.current) {\n const tableHeight = tableRef.current.offsetHeight\n const offset = 25\n setScrollbarsAutoHeightMin(tableHeight + offset)\n }\n }\n\n useEffect(() => {\n calculateHeight()\n\n // New function to unbind properly\n const handleResize = () => {\n calculateHeight()\n }\n\n window.addEventListener('resize', handleResize)\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [data, currentPage])\n\n return (\n <div className={clsx('col gap-y-4 overflow-hidden', className)}>\n <div>\n <Scrollbars autoHeight autoHeightMin={scrollbarsAutoHeightMin}>\n <table ref={tableRef} className=\"w-full mb-[12px]\">\n <thead>\n <tr className={headerRow}>\n {header && tableState.selection && (\n <th className={headerPaddingHead}>\n <Checkbox\n checked={tableState.selection.hasSelectedSome ? 'indeterminate' : tableState.selection.hasSelectedAll}\n onChange={() => updateTableState(changeTableSelectionAll(tableState, data, identifierMapping))}\n />\n </th>\n )}\n {header && header.map((value, index) => (\n <th key={`tableHeader${index}`} className={headerPaddingHead}>\n <div className=\"row justify-start px-2\">\n {value}\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {shownElements.map((value, rowIndex) => (\n <tr key={identifierMapping(value)}>\n {tableState.selection && (\n <td className={clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 })}>\n <Checkbox\n checked={isDataObjectSelected(tableState, value, identifierMapping)}\n onChange={() => {\n updateTableState(changeTableSelectionSingle(tableState, value, data.length, identifierMapping))\n }}\n />\n </td>\n )}\n {rowMappingToCells(value).map((value1, index) => (\n <td key={index}\n className={clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 })}>\n {value1}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </Scrollbars>\n </div>\n <div className=\"row justify-center\">\n {tableState.pagination && (\n <Pagination page={currentPage} numberOfPages={pageCount} onPageChanged={page => updateTableState({\n ...tableState,\n pagination: { entriesPerPage, currentPage: page }\n })}/>\n )}\n </div>\n </div>\n )\n}\n\nexport type SortButtonProps = Omit<TextButtonProps, 'onClick'> & {\n ascending?: TableSortingType,\n onClick: (newTableSorting: TableSortingType) => void,\n}\n\n/**\n * A Extension of the normal button that displays the sorting state right of the content\n */\nexport const SortButton = ({\n children,\n ascending,\n color,\n onClick,\n ...buttonProps\n }: SortButtonProps) => {\n return (\n <TextButton\n color={color}\n onClick={() => onClick(ascending === 'descending' ? 'ascending' : 'descending')}\n {...buttonProps}\n >\n <div className=\"row gap-x-2\">\n {children}\n {ascending === 'ascending' ? <ChevronUp/> : (!ascending ? <ChevronsUpDown/> : <ChevronDown/>)}\n </div>\n </TextButton>\n )\n}\n\n","import { useState } from 'react'\nimport type { CheckedState } from '@radix-ui/react-checkbox'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport { Check, Minus } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\ntype CheckBoxSize = 'small' | 'medium' | 'large'\n\nconst checkboxSizeMapping: Record<CheckBoxSize, string> = {\n small: 'size-4',\n medium: 'size-6',\n large: 'size-8',\n}\n\nconst checkboxIconSizeMapping: Record<CheckBoxSize, string> = {\n small: 'size-3',\n medium: 'size-5',\n large: 'size-7',\n}\n\ntype CheckboxProps = {\n /** used for the label's `for` attribute */\n id?: string,\n label?: Omit<LabelProps, 'id'>,\n /**\n * @default false\n */\n checked: CheckedState,\n disabled?: boolean,\n onChange?: (checked: boolean) => void,\n onChangeTristate?: (checked: CheckedState) => void,\n size?: CheckBoxSize,\n className?: string,\n containerClassName?: string,\n}\n\n/**\n * A Tristate checkbox\n *\n * The state is managed by the parent\n */\nconst Checkbox = ({\n id,\n label,\n checked,\n disabled,\n onChange,\n onChangeTristate,\n size = 'medium',\n className = '',\n containerClassName\n }: CheckboxProps) => {\n const usedSizeClass = checkboxSizeMapping[size]\n const innerIconSize = checkboxIconSizeMapping[size]\n\n const propagateChange = (checked: CheckedState) => {\n if (onChangeTristate) {\n onChangeTristate(checked)\n }\n if (onChange) {\n onChange(checked === 'indeterminate' ? false : checked)\n }\n }\n\n const changeValue = () => {\n const newValue = checked === 'indeterminate' ? false : !checked\n propagateChange(newValue)\n }\n\n return (\n <div className={clsx('row justify-center items-center', containerClassName)}>\n <CheckboxPrimitive.Root\n onCheckedChange={propagateChange}\n checked={checked}\n disabled={disabled}\n id={id}\n className={clsx(usedSizeClass, `items-center border-2 rounded outline-none focus:border-primary`, {\n 'text-disabled-text border-disabled-text': disabled,\n 'border-on-background': !disabled,\n 'bg-primary/30 border-primary text-primary': checked === true || checked === 'indeterminate',\n 'hover:border-gray-400 focus:hover:border-primary': !checked\n }, className)}\n >\n <CheckboxPrimitive.Indicator>\n {checked === true && <Check className={innerIconSize}/>}\n {checked === 'indeterminate' && <Minus className={innerIconSize}/>}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n {label && (\n <Label {...label} className={clsx('cursor-pointer', label.className)} htmlFor={id}\n onClick={changeValue}/>\n )}\n </div>\n )\n}\n\ntype CheckboxUncontrolledProps = Omit<CheckboxProps, 'value' | 'checked'> & {\n /**\n * @default false\n */\n defaultValue?: CheckedState,\n}\n\n/**\n * A Tristate checkbox\n *\n * The state is managed by this component\n */\nconst CheckboxUncontrolled = ({\n onChange,\n onChangeTristate,\n defaultValue = false,\n ...props\n }: CheckboxUncontrolledProps) => {\n const [checked, setChecked] = useState(defaultValue)\n\n const handleChange = (checked: CheckedState) => {\n if (onChangeTristate) {\n onChangeTristate(checked)\n }\n if (onChange) {\n onChange(checked === 'indeterminate' ? false : checked)\n }\n setChecked(checked)\n }\n\n return (\n <Checkbox\n {...props}\n checked={checked}\n onChangeTristate={handleChange}\n />\n )\n}\n\nexport {\n CheckboxProps,\n CheckboxUncontrolled,\n Checkbox,\n}\n","import type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\n\ntype TextImageColor = 'primary' | 'secondary' | 'dark'\n\ntype TextImageTranslation = {\n showMore: string,\n}\n\nconst defaultTextImageTranslation: Record<Language, TextImageTranslation> = {\n de: {\n showMore: 'Mehr anzeigen'\n },\n en: {\n showMore: 'Show more'\n }\n}\n\nexport type TextImageProps = {\n title: string,\n description: string,\n imageUrl: string,\n onShowMoreClicked?: () => void,\n color?: TextImageColor,\n badge?: string,\n contentClassName?: string,\n className?: string,\n}\n\n/**\n * A Component for layering a Text upon a Image\n */\nexport const TextImage = ({\n overwriteTranslation,\n title,\n description,\n imageUrl,\n onShowMoreClicked,\n color = 'primary',\n badge,\n contentClassName = '',\n className = '',\n }: PropsForTranslation<TextImageTranslation, TextImageProps>) => {\n const translation = useTranslation(defaultTextImageTranslation, overwriteTranslation)\n\n const chipColorMapping: Record<TextImageColor, string> = {\n primary: 'text-text-image-primary-background bg-text-text-image-primary-text',\n secondary: 'text-text-image-secondary-background bg-text-text-image-secondary-text',\n dark: 'text-text-image-dark-background bg-text-text-image-dark-text',\n }\n\n const colorMapping: Record<TextImageColor, string> = {\n primary: 'text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55',\n secondary: 'text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55',\n dark: 'text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55',\n }\n\n return (\n <div\n className={clsx('rounded-2xl w-full', className)}\n style={{\n backgroundImage: `url(${imageUrl})`,\n backgroundSize: 'cover',\n }}>\n <div\n className={clsx(`col px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName)}>\n {badge && (\n <div className={clsx(`chip-full bg-white mb-2 py-2 px-4 w-fit`, chipColorMapping[color])}>\n <span className=\"text-lg font-bold\">{badge}</span>\n </div>\n )}\n <div className=\"col gap-y-1 text-white overflow-hidden\">\n <span className=\"textstyle-title-xl\">{title}</span>\n <span className=\"text-ellipsis overflow-hidden\">{description}</span>\n </div>\n {onShowMoreClicked && (\n <div className=\"row mt-2 text-white underline\">\n <button onClick={onShowMoreClicked}>{translation.showMore}</button>\n </div>\n )}\n </div>\n </div>\n )\n}\n","export type VerticalDividerProps = {\n width?: number,\n height?: number,\n strokeWidth?: number,\n dashGap?: number,\n dashLength?: number,\n}\n\n/**\n * A Component for creating a vertical Divider\n */\nexport const VerticalDivider = ({\n width = 1,\n height = 100,\n strokeWidth = 4,\n dashGap = 4,\n dashLength = 4,\n }: VerticalDividerProps) => {\n return (\n <div style={{ width: width + 'px', height: height + 'px' }}>\n <svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <line\n opacity=\"0.5\"\n x1={width / 2}\n y1={height}\n x2={width / 2}\n y2=\"0\"\n stroke=\"url(#paint_linear)\"\n strokeWidth={strokeWidth}\n strokeDasharray={`${dashLength} ${dashLength + dashGap}`}\n strokeLinecap=\"round\"\n />\n <defs>\n <linearGradient\n id=\"paint_linear\"\n x1={width / 2}\n y1=\"0\"\n x2={width / 2}\n y2={height}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopOpacity=\"0\" stopColor=\"currentColor\"/>\n <stop offset=\"0.5\" stopColor=\"currentColor\"/>\n <stop offset=\"1\" stopColor=\"currentColor\" stopOpacity=\"0\"/>\n </linearGradient>\n </defs>\n </svg>\n </div>\n )\n}\n","import { AlertOctagon } from 'lucide-react'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\n\ntype ErrorComponentTranslation = {\n errorOccurred: string,\n}\n\nconst defaultErrorComponentTranslation: Record<Language, ErrorComponentTranslation> = {\n en: {\n errorOccurred: 'An error occurred'\n },\n de: {\n errorOccurred: 'Ein Fehler ist aufgetreten'\n }\n}\n\nexport type ErrorComponentProps = {\n errorText?: string,\n classname?: string,\n}\n\n/**\n * The Component to show when an error occurred\n */\nexport const ErrorComponent = ({\n overwriteTranslation,\n errorText,\n classname\n }: PropsForTranslation<ErrorComponentTranslation, ErrorComponentProps>) => {\n const translation = useTranslation(defaultErrorComponentTranslation, overwriteTranslation)\n return (\n <div className={clsx('col items-center justify-center gap-y-4 w-full h-24', classname)}>\n <AlertOctagon size={64} className=\"text-warning\"/>\n {errorText ?? `${translation.errorOccurred} :(`}\n </div>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport { useState } from 'react'\nimport type { LoadingAnimationProps } from './LoadingAnimation'\nimport { LoadingAnimation } from './LoadingAnimation'\nimport type { ErrorComponentProps } from './ErrorComponent'\nimport { ErrorComponent } from './ErrorComponent'\n\nexport type LoadingAndErrorComponentProps = PropsWithChildren<{\n isLoading?: boolean,\n hasError?: boolean,\n loadingProps?: LoadingAnimationProps,\n errorProps?: ErrorComponentProps,\n /**\n * in milliseconds\n */\n minimumLoadingDuration?: number,\n}>\n\n/**\n * A Component that shows the Error and Loading animation, when appropriate and the children otherwise\n */\nexport const LoadingAndErrorComponent = ({\n children,\n isLoading = false,\n hasError = false,\n errorProps,\n loadingProps,\n minimumLoadingDuration\n }: LoadingAndErrorComponentProps) => {\n const [isInMinimumLoading, setIsInMinimumLoading] = useState(false)\n const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState(false)\n if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {\n setIsInMinimumLoading(true)\n setTimeout(() => {\n setIsInMinimumLoading(false)\n setHasUsedMinimumLoading(true)\n }, minimumLoadingDuration)\n }\n\n if (isLoading || (minimumLoadingDuration && isInMinimumLoading)) {\n return <LoadingAnimation {...loadingProps}/>\n }\n if (hasError) {\n return <ErrorComponent {...errorProps}/>\n }\n return children\n}\n","import type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\nimport { Helpwave } from '../icons-and-geometry/Helpwave'\n\ntype LoadingAnimationTranslation = {\n loading: string,\n}\n\nconst defaultLoadingAnimationTranslation: Record<Language, LoadingAnimationTranslation> = {\n en: {\n loading: 'Loading data'\n },\n de: {\n loading: 'Lade Daten'\n }\n}\n\nexport type LoadingAnimationProps = {\n loadingText?: string,\n classname?: string,\n}\n\n/**\n * A Component to show when loading data\n */\nexport const LoadingAnimation = ({\n overwriteTranslation,\n loadingText,\n classname\n }: PropsForTranslation<LoadingAnimationTranslation, LoadingAnimationProps>) => {\n const translation = useTranslation(defaultLoadingAnimationTranslation, overwriteTranslation)\n return (\n <div className={clsx('col items-center justify-center w-full h-24', classname)}>\n <Helpwave animate=\"loading\"/>\n {loadingText ?? `${translation.loading}...`}\n </div>\n )\n}\n","import clsx from 'clsx'\nimport type { SolidButtonProps } from '../user-action/Button'\nimport { ButtonUtil, SolidButton } from '../user-action/Button'\nimport { noop } from '@/util/noop'\nimport { Helpwave } from '../icons-and-geometry/Helpwave'\n\ntype LoadingButtonProps = {\n isLoading?: boolean,\n} & SolidButtonProps\n\nexport const LoadingButton = ({ isLoading = false, size = 'medium', onClick, ...rest }: LoadingButtonProps) => {\n const paddingClass = ButtonUtil.paddingMapping[size]\n\n return (\n <div className=\"inline-block relative\">\n {\n isLoading && (\n <div className={clsx('absolute inset-0 row items-center justify-center bg-white/40', paddingClass)}>\n <Helpwave animate=\"loading\" className=\"text-white\"/>\n </div>\n )\n }\n <SolidButton {...rest} disabled={rest.disabled} onClick={isLoading ? noop : onClick}/>\n </div>\n )\n}\n","export type ProgressIndicatorProps = {\n /*\n The amount of progress that has been made\n Value form 0 to 1\n */\n progress: number,\n strokeWidth?: number,\n size?: keyof typeof sizeMapping,\n direction?: 'clockwise' | 'counterclockwise',\n /*\n Rotation of the starting point of the indicator\n default start at 3 o'clock\n Given in degree\n */\n rotation?: number,\n}\n\nconst sizeMapping = { small: 16, medium: 24, big: 48 }\n\n/**\n * A progress indicator\n *\n * Start rotation is 3 o'clock and fills counterclockwise\n *\n * Progress is given from 0 to 1\n */\nexport const ProgressIndicator = ({\n progress,\n strokeWidth = 5,\n size = 'medium',\n direction = 'counterclockwise',\n rotation = 0\n }: ProgressIndicatorProps) => {\n const currentSize = sizeMapping[size]\n const center = currentSize / 2\n const radius = center - strokeWidth / 2\n const arcLength = 2 * Math.PI * radius\n const arcOffset = arcLength * progress\n if (direction === 'clockwise') {\n rotation += 360 * progress\n }\n return (\n <svg\n style={{\n height: `${currentSize}px`,\n width: `${currentSize}px`,\n transform: `rotate(${rotation}deg)`\n }}\n >\n <circle cx={center} cy={center} r={radius} fill=\"transparent\" strokeWidth={strokeWidth}\n className=\"stroke-primary\"\n />\n <circle cx={center} cy={center} r={radius} fill=\"transparent\" strokeWidth={strokeWidth}\n strokeDasharray={arcLength} strokeDashoffset={arcOffset} className=\"stroke-gray-300\"\n />\n </svg>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { SolidButtonColor } from '../user-action/Button'\nimport { SolidButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport clsx from 'clsx'\nimport type { ModalProps } from '@/components/layout-and-navigation/Overlay'\nimport { Modal } from '@/components/layout-and-navigation/Overlay'\n\ntype ConfirmModalTranslation = {\n confirm: string,\n cancel: string,\n decline: string,\n}\n\nexport type ConfirmModalType = 'positive' | 'negative' | 'neutral' | 'primary'\n\nconst defaultConfirmDialogTranslation = {\n en: {\n confirm: 'Confirm',\n cancel: 'Cancel',\n decline: 'Decline'\n },\n de: {\n confirm: 'Bestätigen',\n cancel: 'Abbrechen',\n decline: 'Ablehnen'\n }\n}\n\ntype ButtonOverwriteType = {\n text?: string,\n color?: SolidButtonColor,\n disabled?: boolean,\n}\n\nexport type ConfirmModalProps = Omit<ModalProps, 'onClose'> & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onCancel: () => void,\n onConfirm: () => void,\n onDecline?: () => void,\n confirmType?: ConfirmModalType,\n /**\n * Order: Cancel, Decline, Confirm\n */\n buttonOverwrites?: [ButtonOverwriteType, ButtonOverwriteType, ButtonOverwriteType],\n}\n\n/**\n * A Modal for asking the user for confirmation\n */\nexport const ConfirmModal = ({\n overwriteTranslation,\n children,\n onCancel,\n onConfirm,\n onDecline,\n confirmType = 'positive',\n buttonOverwrites,\n className,\n ...restProps\n }: PropsForTranslation<ConfirmModalTranslation, PropsWithChildren<ConfirmModalProps>>) => {\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n const mapping: Record<ConfirmModalType, SolidButtonColor> = {\n neutral: 'neutral',\n negative: 'negative',\n positive: 'positive',\n primary: 'primary',\n }\n\n return (\n <Modal {...restProps} onClose={onCancel} className={clsx('justify-between', className)}>\n <div className=\"col grow\">\n {children}\n </div>\n <div className=\"row mt-3 gap-x-4 justify-end\">\n {onCancel && (\n <SolidButton\n color={buttonOverwrites?.[0].color ?? 'neutral'}\n onClick={onCancel}\n disabled={buttonOverwrites?.[0].disabled ?? false}\n >\n {buttonOverwrites?.[0].text ?? translation.cancel}\n </SolidButton>\n )}\n {onDecline && (\n <SolidButton\n color={buttonOverwrites?.[1].color ?? 'negative'}\n onClick={onDecline}\n\n disabled={buttonOverwrites?.[1].disabled ?? false}\n >\n {buttonOverwrites?.[1].text ?? translation.decline}\n </SolidButton>\n )}\n <SolidButton\n autoFocus\n color={buttonOverwrites?.[2].color ?? mapping[confirmType]}\n onClick={onConfirm}\n disabled={buttonOverwrites?.[2].disabled ?? false}\n >\n {buttonOverwrites?.[2].text ?? translation.confirm}\n </SolidButton>\n </div>\n </Modal>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { ConfirmModalProps } from '@/components/modals/ConfirmModal'\nimport { ConfirmModal } from '@/components/modals/ConfirmModal'\n\ntype DiscardChangesModalTranslation = {\n save: string,\n cancel: string,\n dontSave: string,\n title: string,\n description: string,\n}\n\nconst defaultDiscardChangesModalTranslation = {\n en: {\n save: 'Save',\n cancel: 'Cancel',\n dontSave: 'Don\\'t save',\n title: 'Unsaved Changes',\n description: 'Do you want to save your changes?'\n },\n de: {\n save: 'Speichern',\n cancel: 'Abbrechen',\n dontSave: 'Nicht Speichern',\n title: 'Ungespeicherte Änderungen',\n description: 'Möchtest du die Änderungen speichern?'\n }\n}\n\ntype DiscardChangesModalProps = Omit<ConfirmModalProps, 'onDecline' | 'onConfirm' | 'buttonOverwrites'> & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onCancel: () => void,\n onSave: () => void,\n onDontSave: () => void,\n}\n\nexport const DiscardChangesModal = ({\n overwriteTranslation,\n children,\n onCancel,\n onSave,\n onDontSave,\n headerProps,\n ...modalProps\n }: PropsForTranslation<DiscardChangesModalTranslation, PropsWithChildren<DiscardChangesModalProps>>) => {\n const translation = useTranslation(defaultDiscardChangesModalTranslation, overwriteTranslation)\n return (\n <ConfirmModal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.description,\n }}\n onConfirm={onSave}\n onCancel={onCancel}\n onDecline={onDontSave}\n buttonOverwrites={[{ text: translation.cancel }, { text: translation.dontSave }, { text: translation.save }]}\n {...modalProps}\n >\n {children}\n </ConfirmModal>\n )\n}\n","import type { InputProps } from '../user-action/Input'\nimport { Input } from '../user-action/Input'\nimport type { ConfirmModalProps } from '@/components/modals/ConfirmModal'\nimport { ConfirmModal } from '@/components/modals/ConfirmModal'\n\nexport type InputModalProps = ConfirmModalProps & {\n inputs: InputProps[],\n}\n\n/**\n * A modal for receiving multiple inputs\n */\nexport const InputModal = ({\n inputs,\n buttonOverwrites,\n ...restProps\n }: InputModalProps) => {\n return (\n <ConfirmModal\n buttonOverwrites={buttonOverwrites}\n {...restProps}\n >\n {inputs.map((inputProps, index) => <Input key={`input ${index}`} {...inputProps}/>)}\n </ConfirmModal>\n )\n}\n","import { Menu } from '@headlessui/react'\nimport { ChevronDown, ChevronUp, Search } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport { useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport { Input } from '@/components/user-action/Input'\n\nexport type SelectOption<T> = {\n label: ReactNode,\n value: T,\n disabled?: boolean,\n className?: string,\n}\n\nexport type SelectProps<T> = {\n value?: T,\n label?: LabelProps,\n options: SelectOption<T>[],\n onChange: (value: T) => void,\n isHidingCurrentValue?: boolean,\n hintText?: string,\n showDisabledOptions?: boolean,\n className?: string,\n isDisabled?: boolean,\n textColor?: string,\n hoverColor?: string,\n /**\n * The items will be at the start of the select and aren't selectable\n */\n additionalItems?: ReactNode[],\n selectedDisplayOverwrite?: ReactNode,\n};\n\n/**\n * A Select Component for selecting form a list of options\n *\n * The State is managed by the parent\n */\nexport const Select = <T, >({\n value,\n label,\n options,\n onChange,\n isHidingCurrentValue = true,\n hintText = '',\n showDisabledOptions = true,\n isDisabled,\n className,\n textColor = 'text-menu-text',\n hoverColor = 'hover:brightness-90',\n additionalItems,\n selectedDisplayOverwrite,\n }: SelectProps<T>) => {\n // Notice: for more complex types this check here might need an additional compare method\n let filteredOptions = isHidingCurrentValue ? options.filter(option => option.value !== value) : options\n if (!showDisabledOptions) {\n filteredOptions = filteredOptions.filter(value => !value.disabled)\n }\n const selectedOption = options.find(option => option.value === value)\n if (value !== undefined && selectedOption === undefined && selectedDisplayOverwrite === undefined) {\n console.warn('The selected value is not found in the options list. This might be an error on your part or' +\n ' default behavior if it is complex data type on which === does not work. In case of the latter' +\n ' use selectedDisplayOverwrite to set your selected text or component')\n }\n\n const borderColor = 'border-menu-border'\n\n return (\n <div className={clsx(className)}>\n {label && (\n <Label {...label} labelType={label.labelType ?? 'labelBig'} className={clsx('mb-1', label.className)}/>\n )}\n <Menu as=\"div\" className=\"relative text-menu-text\">\n {({ open }) => (\n <>\n <Menu.Button\n className={clsx(\n 'inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text',\n textColor, borderColor,\n {\n 'rounded-b-lg': !open,\n [hoverColor]: !isDisabled,\n 'bg-disabled-background cursor-not-allowed text-disabled': isDisabled\n }\n )}\n disabled={isDisabled}\n >\n <span>{selectedDisplayOverwrite ?? selectedOption?.label ?? hintText}</span>\n {open ? <ChevronUp/> : <ChevronDown/>}\n </Menu.Button>\n <Menu.Items\n className=\"absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto\"\n >\n {(additionalItems ?? []).map((item, index) => (\n <div key={`additionalItems${index}`}\n className={clsx(borderColor, 'px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0', {\n 'border-b-0 rounded-b-lg': filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1,\n })}\n >\n {item}\n </div>\n ))}\n {filteredOptions.map((option, index) => (\n <Menu.Item key={`item${index}`}>\n {\n <div\n className={clsx('px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer',\n option.className, borderColor, {\n 'brightness-90': option.value === value,\n 'brightness-95': index % 2 === 1,\n 'text-disabled bg-disabled-background cursor-not-allowed': !!option.disabled,\n 'bg-menu-background text-menu-text hover:brightness-90 cursor-pointer': !option.disabled,\n 'rounded-b-lg': index === filteredOptions.length - 1,\n })}\n onClick={() => {\n if (!option.disabled) {\n onChange(option.value)\n }\n }}\n >\n {option.label}\n </div>\n }\n </Menu.Item>\n ))}\n </Menu.Items>\n </>\n )}\n </Menu>\n </div>\n )\n}\n\nexport const SelectUncontrolled = <T, >({\n options, onChange, value, hintText, ...props\n }: SelectProps<T>) => {\n const [selected, setSelected] = useState(value)\n\n useEffect(() => {\n if (options.find(options => options.value === value)) {\n setSelected(value)\n }\n }, [options, value])\n\n return (\n <Select\n value={selected}\n options={options}\n onChange={value => {\n setSelected(value)\n onChange(value)\n }}\n hintText={hintText}\n {...props}\n />\n )\n}\n\nexport type SearchableSelectProps<T> = SelectProps<T> & {\n searchMapping: (value: SelectOption<T>) => string[],\n}\n\n/**\n * A Select where items can be searched\n */\nexport const SearchableSelect = <T, >({\n value,\n options,\n searchMapping,\n ...selectProps\n }: SearchableSelectProps<T>) => {\n const [search, setSearch] = useState<string>('')\n const filteredOptions = MultiSearchWithMapping(search, options, searchMapping)\n\n return (\n <Select\n value={value}\n options={filteredOptions}\n additionalItems={[(\n <div key=\"selectSearch\" className=\"row gap-x-2 items-center\">\n <Input autoFocus={true} value={search} onChangeText={setSearch}/>\n <Search/>\n </div>\n )]}\n {...selectProps}\n />\n )\n}\n\nexport default { Select, SelectUncontrolled, SearchableSelect }","import { type PropsWithChildren } from 'react'\nimport type { PropsForTranslation, Translation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Select } from '../user-action/Select'\nimport type { Language } from '@/localization/util'\nimport { LanguageUtil } from '@/localization/util'\nimport { useLanguage } from '@/localization/LanguageProvider'\nimport { SolidButton } from '../user-action/Button'\nimport { Modal, type ModalProps } from '../layout-and-navigation/Overlay'\n\ntype LanguageModalTranslation = {\n title: string,\n message: string,\n done: string,\n} & Record<Language, string>\n\nconst defaultLanguageModalTranslation: Translation<LanguageModalTranslation> = {\n en: {\n title: 'Language',\n message: 'Choose your language',\n done: 'Done',\n ...LanguageUtil.languagesLocalNames\n },\n de: {\n title: 'Sprache',\n message: 'Wähle deine bevorzugte Sprache',\n done: 'Fertig',\n ...LanguageUtil.languagesLocalNames\n }\n}\n\ntype LanguageModalProps = ModalProps\n\n/**\n * A Modal for selecting the Language\n *\n * The State of open needs to be managed by the parent\n */\nexport const LanguageModal = ({\n overwriteTranslation,\n headerProps,\n onClose,\n ...modalProps\n }: PropsForTranslation<LanguageModalTranslation, PropsWithChildren<LanguageModalProps>>) => {\n const { language, setLanguage } = useLanguage()\n const translation = useTranslation(defaultLanguageModalTranslation, overwriteTranslation)\n\n return (\n <Modal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.message,\n }}\n onClose={onClose}\n {...modalProps}\n >\n <div className=\"w-64\">\n <Select\n className=\"mt-2\"\n value={language}\n options={LanguageUtil.languages.map((language) => ({ label: translation[language], value: language }))}\n onChange={(language: string) => setLanguage(language as Language)}\n />\n <div className=\"row mt-3 gap-x-4 justify-end\">\n <SolidButton autoFocus color=\"positive\" onClick={onClose}>\n {translation.done}\n </SolidButton>\n </div>\n </div>\n </Modal>\n )\n}\n","import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'\nimport { createContext, useContext, useEffect, useState } from 'react'\nimport type { Translation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\n\nconst themes = ['light', 'dark'] as const\n\nexport type ThemeType = typeof themes[number]\n\nexport type ThemeTypeTranslation = Record<ThemeType, string>\n\nconst defaultThemeTypeTranslation: Translation<ThemeTypeTranslation> = {\n en: {\n dark: 'Dark',\n light: 'Light'\n },\n de: {\n dark: 'Dunkel',\n light: 'Hell'\n }\n}\n\nexport const ThemeUtil = {\n themes,\n translation: defaultThemeTypeTranslation,\n}\n\ntype ThemeContextType = {\n theme: ThemeType,\n setTheme: Dispatch<SetStateAction<ThemeType>>,\n}\n\nexport const ThemeContext = createContext<ThemeContextType>({\n theme: 'light',\n setTheme: noop\n})\n\ntype ThemeProviderProps = {\n initialTheme?: ThemeType,\n}\n\nexport const ThemeProvider = ({ children, initialTheme = 'light' }: PropsWithChildren<ThemeProviderProps>) => {\n const [theme, setTheme] = useState<ThemeType>(initialTheme)\n\n useEffect(() => {\n if (theme !== initialTheme) {\n console.warn('ThemeProvider initial state changed: Prefer using useTheme\\'s setTheme instead')\n setTheme(initialTheme)\n }\n }, [initialTheme]) // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n document.documentElement.setAttribute('data-theme', theme)\n }, [theme])\n\n return (\n <ThemeContext.Provider value={{ theme, setTheme }}>\n {children}\n </ThemeContext.Provider>\n )\n}\n\n\nexport const useTheme = () => useContext(ThemeContext)\n","import { type PropsWithChildren } from 'react'\nimport type { PropsForTranslation, Translation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Select } from '../user-action/Select'\nimport { SolidButton } from '../user-action/Button'\nimport { Modal, type ModalProps } from '../layout-and-navigation/Overlay'\nimport type { ThemeType, ThemeTypeTranslation } from '@/theming/useTheme'\nimport { useTheme } from '@/theming/useTheme'\nimport { ThemeUtil } from '@/theming/useTheme'\n\ntype ThemeModalTranslation = {\n title: string,\n message: string,\n done: string,\n} & ThemeTypeTranslation\n\nconst defaultConfirmDialogTranslation: Translation<ThemeModalTranslation> = {\n en: {\n title: 'Theme',\n message: 'Choose your preferred theme',\n done: 'Done',\n ...ThemeUtil.translation.en\n },\n de: {\n title: 'Farbschema',\n message: 'Wähle dein bevorzugtes Farbschema',\n done: 'Fertig',\n ...ThemeUtil.translation.en\n }\n}\n\ntype ThemeModalProps = ModalProps\n\n/**\n * A Modal for selecting the Theme\n *\n * The State of open needs to be managed by the parent\n */\nexport const ThemeModal = ({\n overwriteTranslation,\n headerProps,\n onClose,\n ...modalProps\n }: PropsForTranslation<ThemeModalTranslation, PropsWithChildren<ThemeModalProps>>) => {\n const { theme, setTheme } = useTheme()\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n return (\n <Modal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.message,\n }}\n onClose={onClose}\n {...modalProps}\n >\n <div className=\"w-64\">\n <Select\n className=\"mt-2\"\n value={theme}\n options={ThemeUtil.themes.map((theme) => ({ label: translation[theme], value: theme }))}\n onChange={(theme: string) => setTheme(theme as ThemeType)}\n />\n <div className=\"row mt-3 gap-x-4 justify-end\">\n <SolidButton autoFocus color=\"positive\" onClick={onClose}>\n {translation.done}\n </SolidButton>\n </div>\n </div>\n </Modal>\n )\n}\n","import { Check } from 'lucide-react'\nimport { noop } from '../../util/noop'\nimport { Checkbox } from '../user-action/Checkbox'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype CheckboxPropertyTranslation = {\n yes: string,\n no: string,\n}\n\nconst defaultCheckboxPropertyTranslation: Record<Language, CheckboxPropertyTranslation> = {\n en: {\n yes: 'Yes',\n no: 'No'\n },\n de: {\n yes: 'Ja',\n no: 'Nein'\n }\n}\n\nexport type CheckboxPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'onRemove'> & {\n value?: boolean,\n onChange?: (value: boolean) => void,\n}\n\n/**\n * An Input for a boolen properties\n */\nexport const CheckboxProperty = ({\n overwriteTranslation,\n value,\n onChange = noop,\n readOnly,\n ...baseProps\n }: PropsForTranslation<CheckboxPropertyTranslation, CheckboxPropertyProps>) => {\n const translation = useTranslation(defaultCheckboxPropertyTranslation, overwriteTranslation)\n\n return (\n <PropertyBase\n {...baseProps}\n hasValue={true}\n readOnly={readOnly}\n icon={<Check size={16}/>}\n input={() => (\n <div className=\"row py-2 px-4 items-center\">\n <Checkbox\n // TODO make bigger as in #904\n checked={value ?? true}\n disabled={readOnly}\n onChange={onChange}\n label={{ name: `${translation.yes}/${translation.no}`, labelType: 'labelMedium' }}\n />\n </div>\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport { AlertTriangle } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '../../localization/util'\nimport { TextButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\n\ntype PropertyBaseTranslation = {\n remove: string,\n}\n\nconst defaultPropertyBaseTranslation: Record<Language, PropertyBaseTranslation> = {\n en: {\n remove: 'Remove'\n },\n de: {\n remove: 'Entfernen'\n }\n}\n\nexport type PropertyBaseProps = {\n name: string,\n input: (props: { softRequired: boolean, hasValue: boolean }) => ReactNode,\n onRemove?: () => void,\n hasValue: boolean,\n softRequired?: boolean,\n readOnly?: boolean,\n icon?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for showing a properties with uniform styling\n */\nexport const PropertyBase = ({\n overwriteTranslation,\n name,\n input,\n softRequired = false,\n hasValue,\n icon,\n readOnly,\n onRemove,\n className = '',\n }: PropsForTranslation<PropertyBaseTranslation, PropertyBaseProps>) => {\n const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation)\n const requiredAndNoValue = softRequired && !hasValue\n return (\n <div className={clsx('row gap-x-0 group', className)}>\n <div\n className={\n clsx('row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0', {\n 'bg-gray-100 text-black group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-warning text-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {icon}\n {name}\n </div>\n <div className={\n clsx('row grow justify-between items-center rounded-r-xl border-2 border-l-0', {\n 'bg-white group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {input({ softRequired, hasValue })}\n {requiredAndNoValue && (\n <div className=\"text-warning pr-4\"><AlertTriangle size={24}/></div>\n )}\n {onRemove && (\n <TextButton\n onClick={onRemove}\n color=\"negative\"\n className={clsx('pr-4 items-center', { '!text-transparent': !hasValue || readOnly })}\n disabled={!hasValue || readOnly}\n >\n {translation.remove}\n </TextButton>\n )}\n </div>\n </div>\n )\n}\n","import { CalendarDays } from 'lucide-react'\nimport clsx from 'clsx'\nimport { formatDate, formatDateTime } from '@/util/date'\nimport { noop } from '@/util/noop'\nimport { Input } from '../user-action/Input'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\nexport type DatePropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: Date,\n onChange?: (date: Date) => void,\n onEditComplete?: (value: Date) => void,\n type?: 'dateTime' | 'date',\n}\n\n/**\n * An Input for date properties\n */\nexport const DateProperty = ({\n value,\n onChange = noop,\n onEditComplete = noop,\n readOnly,\n type = 'dateTime',\n ...baseProps\n }: DatePropertyProps) => {\n const hasValue = !!value\n\n const dateText = value ? (type === 'dateTime' ? formatDateTime(value) : formatDate(value)) : ''\n return (\n <PropertyBase\n {...baseProps}\n hasValue={hasValue}\n icon={<CalendarDays size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Input\n className={clsx('!ring-0 !border-0 !outline-0 !p-0 !m-0 !shadow-none !w-fit !rounded-none', { 'bg-surface-warning': softRequired && !hasValue })}\n value={dateText}\n type={type === 'dateTime' ? 'datetime-local' : 'date'}\n readOnly={readOnly}\n onChange={(event) => {\n const value = event.target.value\n if (!value) {\n event.preventDefault()\n return\n }\n const dueDate = new Date(value)\n onChange(dueDate)\n }}\n onEditCompleted={(value) => onEditComplete(new Date(value))}\n />\n </div>\n )}\n />\n )\n}\n","import { List } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { MultiSelectProps } from '../user-action/MultiSelect'\nimport { MultiSelect } from '../user-action/MultiSelect'\nimport { ChipList } from '../layout-and-navigation/Chip'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype MultiSelectPropertyTranslation = {\n select: string,\n}\n\nconst defaultMultiSelectPropertyTranslation: Record<Language, MultiSelectPropertyTranslation> = {\n en: {\n select: 'Select'\n },\n de: {\n select: 'Auswählen'\n }\n}\n\nexport type MultiSelectPropertyProps<T> =\n Omit<PropertyBaseProps & MultiSelectProps<T>, 'icon' | 'input' | 'hasValue' | 'className' | 'disabled' | 'label' | 'triggerClassName'>\n\n/**\n * An Input for MultiSelect properties\n */\nexport const MultiSelectProperty = <T, >({\n overwriteTranslation,\n options,\n name,\n readOnly = false,\n softRequired,\n onRemove,\n ...multiSelectProps\n }: PropsForTranslation<MultiSelectPropertyTranslation, MultiSelectPropertyProps<T>>) => {\n const translation = useTranslation(defaultMultiSelectPropertyTranslation, overwriteTranslation)\n const hasValue = options.some(value => value.selected)\n let triggerClassName: string\n if (softRequired && !hasValue) {\n triggerClassName = 'border-warning hover:brightness-90'\n }\n\n return (\n <PropertyBase\n name={name}\n onRemove={onRemove}\n readOnly={readOnly}\n softRequired={softRequired}\n hasValue={hasValue}\n icon={<List size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <MultiSelect\n {...multiSelectProps}\n className={clsx('w-full', { 'bg-surface-warning': softRequired && !hasValue })}\n triggerClassName={triggerClassName}\n selectedDisplay={({ items }) => {\n const selected = items.filter(value => value.selected)\n if (selected.length === 0) {\n return (<span>Select</span>)\n }\n return (\n <ChipList list={selected.map(value => ({ children: value.label }))}/>\n )\n }}\n options={options}\n disabled={readOnly}\n hintText={`${translation.select}...`}\n />\n </div>\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport { useState } from 'react'\nimport { Search } from 'lucide-react'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { Language } from '@/localization/util'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport clsx from 'clsx'\nimport { Menu, MenuItem } from './Menu'\nimport { Input } from './Input'\nimport { Checkbox } from './Checkbox'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\ntype MultiSelectTranslation = {\n select: string,\n search: string,\n selected: string,\n}\n\nconst defaultMultiSelectTranslation: Record<Language, MultiSelectTranslation> = {\n en: {\n select: 'Select',\n search: 'Search',\n selected: 'selected'\n },\n de: {\n select: 'Auswählen',\n search: 'Suche',\n selected: 'ausgewählt'\n }\n}\n\n// TODO maybe add custom item builder here\nexport type MultiSelectOption<T> = {\n label: string,\n value: T,\n selected: boolean,\n disabled?: boolean,\n className?: string,\n}\n\nexport type SearchProps<T> = {\n initialSearch?: string,\n searchMapping: (value: MultiSelectOption<T>) => string[],\n}\n\nexport type MultiSelectProps<T> = {\n options: MultiSelectOption<T>[],\n onChange: (options: MultiSelectOption<T>[]) => void,\n search?: SearchProps<T>,\n disabled?: boolean,\n selectedDisplay?: (props: {\n items: MultiSelectOption<T>[],\n disabled: boolean,\n }) => ReactNode,\n label?: LabelProps,\n hintText?: string,\n showDisabledOptions?: boolean,\n className?: string,\n triggerClassName?: string,\n}\n\n/**\n * A Component for multi selection\n */\nexport const MultiSelect = <T, >({\n overwriteTranslation,\n options,\n onChange,\n search,\n disabled = false,\n selectedDisplay,\n label,\n hintText,\n showDisabledOptions = true,\n className = '',\n triggerClassName = '',\n }: PropsForTranslation<MultiSelectTranslation, MultiSelectProps<T>>) => {\n const translation = useTranslation(defaultMultiSelectTranslation, overwriteTranslation)\n const [searchText, setSearchText] = useState<string>(search?.initialSearch ?? '')\n let filteredOptions: MultiSelectOption<T>[] = options\n const enableSearch = !!search\n if (enableSearch && !!searchText) {\n filteredOptions = MultiSearchWithMapping<MultiSelectOption<T>>(\n searchText,\n filteredOptions,\n value => search.searchMapping(value)\n )\n }\n if (!showDisabledOptions) {\n filteredOptions = filteredOptions.filter(value => !value.disabled)\n }\n\n const selectedItems = options.filter(value => value.selected)\n const menuButtonText = selectedItems.length === 0 ?\n hintText ?? translation.select\n : <span>{`${selectedItems.length} ${translation.selected}`}</span>\n\n const borderColor = 'border-menu-border'\n\n return (\n <div className={clsx(className)}>\n {label && (\n <Label {...label} htmlFor={label.name} className={clsx(' mb-1', label.className)}\n labelType={label.labelType ?? 'labelBig'}/>\n )}\n <Menu<HTMLDivElement>\n alignment=\"t_\"\n trigger={(onClick, ref) => (\n <div ref={ref} onClick={disabled ? undefined : onClick}\n className={clsx(borderColor, 'bg-menu-background text-menu-text inline-w-full justify-between items-center rounded-lg border-2 px-4 py-2 font-medium',\n {\n 'hover:brightness-90 hover:border-primary cursor-pointer': !disabled,\n 'bg-disabled-background text-disabled cursor-not-allowed': disabled\n },\n triggerClassName)}\n >\n {selectedDisplay ? selectedDisplay({ items: options, disabled }) : menuButtonText}\n </div>\n )}\n menuClassName={clsx(\n '!rounded-lg !shadow-lg !max-h-[500px] !min-w-[400px] !max-w-[70vh] !overflow-y-auto !border !border-2', borderColor,\n { '!py-0': !enableSearch, '!pb-0': enableSearch }\n )}\n >\n {enableSearch && (\n <div key=\"selectSearch\" className=\"row gap-x-2 items-center px-2 py-2\">\n <Input autoFocus={true} className=\"w-full\" value={searchText} onChangeText={setSearchText}/>\n <Search/>\n </div>\n )}\n {filteredOptions.map((option, index) => (\n <MenuItem key={`item${index}`} className={clsx({\n 'cursor-not-allowed !bg-disabled-background !text-disabled-text hover:brightness-100': !!option.disabled,\n 'cursor-pointer': !option.disabled,\n })}\n >\n <div\n className={clsx('overflow-hidden whitespace-nowrap text-ellipsis row items-center gap-x-2', option.className)}\n onClick={() => {\n if (!option.disabled) {\n onChange(options.map(value => value.value === option.value ? ({\n ...option,\n selected: !value.selected\n }) : value))\n }\n }}\n >\n <Checkbox checked={option.selected} disabled={option.disabled} size=\"small\"/>\n {option.label}\n </div>\n </MenuItem>\n ))}\n </Menu>\n </div>\n )\n}\n","import { type PropsWithChildren, type ReactNode, type RefObject, useRef } from 'react'\nimport clsx from 'clsx'\nimport { useOutsideClick } from '@/hooks/useOutsideClick'\nimport { useHoverState } from '@/hooks/useHoverState'\n\ntype MenuProps<T> = PropsWithChildren<{\n trigger: (onClick: () => void, ref: RefObject<T>) => ReactNode,\n /**\n * @default 'tl'\n */\n alignment?: 'tl' | 'tr' | 'bl' | 'br' | '_l' | '_r' | 't_' | 'b_',\n showOnHover?: boolean,\n menuClassName?: string,\n}>\n\nexport type MenuItemProps = {\n onClick?: () => void,\n alignment?: 'left' | 'right',\n className?: string,\n}\nconst MenuItem = ({\n children,\n onClick,\n alignment = 'left',\n className\n }: PropsWithChildren<MenuItemProps>) => (\n <div\n className={clsx('block px-3 py-1 bg-menu-background text-menu-text hover:brightness-90', {\n 'text-right': alignment === 'right',\n 'text-left': alignment === 'left',\n }, className)}\n onClick={onClick}\n >\n {children}\n </div>\n)\n\n/**\n * A Menu Component to allow the user to see different functions\n */\nconst Menu = <T extends HTMLElement>({\n trigger,\n children,\n alignment = 'tl',\n showOnHover = false,\n menuClassName = '',\n }: MenuProps<T>) => {\n const { isHovered: isOpen, setIsHovered: setIsOpen, handlers } = useHoverState({ isDisabled: !showOnHover })\n const triggerRef = useRef<T>(null)\n const menuRef = useRef<HTMLDivElement>(null)\n useOutsideClick([triggerRef, menuRef], () => setIsOpen(false))\n\n return (\n <div\n className=\"relative\"\n {...handlers}\n >\n {trigger(() => setIsOpen(!isOpen), triggerRef)}\n {isOpen ? (\n <div ref={menuRef} onClick={e => e.stopPropagation()}\n className={clsx('absolute top-full mt-1 py-2 w-60 rounded-lg bg-menu-background text-menu-text ring-1 ring-slate-900/5 text-sm leading-6 font-semibold shadow-md z-[1]', {\n ' top-[8px]': alignment[0] === 't',\n ' bottom-[8px]': alignment[0] === 'b',\n ' left-[-8px]': alignment[1] === 'l',\n ' right-[-8px]': alignment[1] === 'r',\n }, menuClassName)}>\n {children}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport { Menu, MenuItem }\n","import type { RefObject } from 'react'\nimport { useEffect } from 'react'\n\nexport const useOutsideClick = <Ts extends RefObject<HTMLElement>[]>(refs: Ts, handler: () => void) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n // returning means not \"not clicking outside\"\n\n // if no target exists, return\n if (event.target === null) return\n // if the target is a ref's element or descendent thereof, return\n if (refs.some((ref) => !ref.current || ref.current.contains(event.target as Node))) {\n return\n }\n\n handler()\n }\n document.addEventListener('mousedown', listener)\n document.addEventListener('touchstart', listener)\n return () => {\n document.removeEventListener('mousedown', listener)\n document.removeEventListener('touchstart', listener)\n }\n }, [refs, handler])\n}\n","import { Binary } from 'lucide-react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\nimport { Input } from '../user-action/Input'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype NumberPropertyTranslation = {\n value: string,\n}\n\nconst defaultNumberPropertyTranslation: Record<Language, NumberPropertyTranslation> = {\n en: {\n value: 'Value'\n },\n de: {\n value: 'Wert'\n }\n}\n\nexport type NumberPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: number,\n suffix?: string,\n onChange?: (value: number) => void,\n onEditComplete?: (value: number) => void,\n}\n\n/**\n * An Input for number properties\n */\nexport const NumberProperty = ({\n overwriteTranslation,\n value,\n onChange = noop,\n onRemove = noop,\n onEditComplete = noop,\n readOnly,\n suffix,\n ...baseProps\n }: PropsForTranslation<NumberPropertyTranslation, NumberPropertyProps>) => {\n const translation = useTranslation(defaultNumberPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n {...baseProps}\n onRemove={onRemove}\n hasValue={hasValue}\n icon={<Binary size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Input\n expanded={false}\n className={clsx('!ring-0 !border-0 !outline-0 !p-0 !m-0 !w-fit !shadow-none !rounded-none', { 'bg-surface-warning placeholder-warning': softRequired && !hasValue })}\n value={value?.toString() ?? ''}\n type=\"number\"\n readOnly={readOnly}\n placeholder={`${translation.value}...`}\n onChangeText={(value) => {\n const numberValue = parseFloat(value)\n if (isNaN(numberValue)) {\n onRemove()\n } else {\n onChange(numberValue)\n }\n }}\n onEditCompleted={(value) => {\n const numberValue = parseFloat(value)\n if (isNaN(numberValue)) {\n onRemove()\n } else {\n onEditComplete(numberValue)\n }\n }}\n />\n {suffix && <span className={clsx('ml-1', { 'bg-surface-warning': softRequired && !hasValue })}>{suffix}</span>}\n </div>\n )}\n />\n )\n}\n","import { List } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { SearchableSelectProps } from '../user-action/Select'\nimport { SearchableSelect } from '../user-action/Select'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype SingleSelectPropertyTranslation = {\n select: string,\n}\n\nconst defaultSingleSelectPropertyTranslation: Record<Language, SingleSelectPropertyTranslation> = {\n en: {\n select: 'Select'\n },\n de: {\n select: 'Auswählen'\n }\n}\n\nexport type SingleSelectPropertyProps<T> =\n Omit<PropertyBaseProps & SearchableSelectProps<T>, 'icon' | 'input' | 'hasValue' | 'className' | 'disabled' | 'label' | 'labelClassName' | 'additionalItems'>\n\n/**\n * An Input for SingleSelect properties\n */\nexport const SingleSelectProperty = <T, >({\n overwriteTranslation,\n value,\n options,\n name,\n readOnly = false,\n softRequired,\n onRemove,\n ...multiSelectProps\n }: PropsForTranslation<SingleSelectPropertyTranslation, SingleSelectPropertyProps<T>>) => {\n const translation = useTranslation(defaultSingleSelectPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n name={name}\n onRemove={onRemove}\n readOnly={readOnly}\n softRequired={softRequired}\n hasValue={hasValue}\n icon={<List size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <SearchableSelect\n {...multiSelectProps}\n value={value}\n options={options}\n isDisabled={readOnly}\n className={clsx('w-full', { 'bg-surface-warning': softRequired && !hasValue })}\n hintText={`${translation.select}...`}\n />\n </div>\n )}\n />\n )\n}\n","import { Text } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Textarea } from '../user-action/Textarea'\nimport { noop } from '@/util/noop'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype TextPropertyTranslation = {\n value: string,\n}\n\nconst defaultTextPropertyTranslation: Record<Language, TextPropertyTranslation> = {\n en: {\n value: 'Text'\n },\n de: {\n value: 'Text'\n }\n}\n\nexport type TextPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: string,\n onChange?: (value: string) => void,\n onEditComplete?: (value: string) => void,\n}\n\n/**\n * An Input for Text properties\n */\nexport const TextProperty = ({\n overwriteTranslation,\n value,\n readOnly,\n onChange = noop,\n onRemove = noop,\n onEditComplete = noop,\n ...baseProps\n }: PropsForTranslation<TextPropertyTranslation, TextPropertyProps>) => {\n const translation = useTranslation(defaultTextPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n {...baseProps}\n onRemove={onRemove}\n hasValue={hasValue}\n icon={<Text size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow pt-2 pb-1 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Textarea\n className={clsx('ring-0 border-0 outline-0 p-0 m-0 shadow-none rounded-none', { 'bg-surface-warning placeholder-warning': softRequired && !hasValue })}\n rows={5}\n defaultStyle={false}\n value={value ?? ''}\n readOnly={readOnly}\n placeholder={`${translation.value}...`}\n onChangeText={(value) => {\n if (!value) {\n onRemove()\n } else {\n onChange(value)\n }\n }}\n onEditCompleted={(value) => {\n if (!value) {\n onRemove()\n } else {\n onEditComplete(value)\n }\n }}\n />\n </div>\n )}\n />\n )\n}\n","import type { TextareaHTMLAttributes } from 'react'\nimport { useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type TextareaProps = {\n /** Outside the area */\n label?: Omit<LabelProps, 'id'>,\n /** Inside the area */\n headline?: string,\n value?: string,\n resizable?: boolean,\n onChangeText?: (text: string) => void,\n disclaimer?: string,\n onEditCompleted?: (text: string) => void,\n defaultStyle?: boolean,\n} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'>\n\n/**\n * A Textarea component for inputting longer texts\n *\n * The State is managed by the parent\n */\nexport const Textarea = ({\n label,\n headline,\n id,\n resizable = false,\n onChange = noop,\n onChangeText = noop,\n disclaimer,\n onBlur = noop,\n onEditCompleted = noop,\n defaultStyle = true,\n className,\n ...props\n }: TextareaProps) => {\n const [hasFocus, setHasFocus] = useState(false)\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n return (\n <div className=\"w-full\">\n {label && (\n <Label {...label} htmlFor={id} className={clsx('mb-1', label.className)}\n labelType={label.labelType ?? 'labelSmall'}/>\n )}\n <div\n className={`${clsx(' bg-surface text-on-surface focus-within:border-primary relative', { 'shadow border-2 border-gray-300 hover:border-primary rounded-lg': defaultStyle })}`}>\n {headline && (\n <span className=\"mx-3 mt-3 block text-gray-700 font-bold\">\n {headline}\n </span>\n )}\n <textarea\n id={id}\n className={clsx('pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none', {\n 'resize-none': !resizable,\n 'h-32': defaultStyle,\n 'mt-3': !headline\n }, className)}\n onChange={(event) => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChange(event)\n onChangeText(value)\n }}\n onFocus={() => {\n setHasFocus(true)\n }}\n onBlur={(event) => {\n onBlur(event)\n onEditCompletedWrapper(event.target.value)\n setHasFocus(false)\n }}\n {...props}\n >\n </textarea>\n </div>\n {(hasFocus && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\n/**\n * A Textarea component that is not controlled by its parent\n */\nexport const TextareaUncontrolled = ({\n value = '',\n onChangeText = noop,\n ...props\n }: TextareaProps) => {\n const [text, setText] = useState<string>(value)\n\n useEffect(() => {\n setText(value)\n }, [value])\n\n return (\n <Textarea\n {...props}\n value={text}\n onChangeText={text => {\n setText(text)\n onChangeText(text)\n }}\n />\n )\n}","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\nimport { addDuration, subtractDuration } from '@/util/date'\nimport { SolidButton } from './Button'\nimport type { TimePickerProps } from '../date/TimePicker'\nimport { TimePicker } from '../date/TimePicker'\nimport type { DatePickerProps } from '../date/DatePicker'\nimport { DatePicker } from '../date/DatePicker'\n\ntype TimeTranslation = {\n clear: string,\n change: string,\n year: string,\n month: string,\n day: string,\n january: string,\n february: string,\n march: string,\n april: string,\n may: string,\n june: string,\n july: string,\n august: string,\n september: string,\n october: string,\n november: string,\n december: string,\n}\n\nconst defaultTimeTranslation: Record<Language, TimeTranslation> = {\n en: {\n clear: 'Clear',\n change: 'Change',\n year: 'Year',\n month: 'Month',\n day: 'Day',\n january: 'January',\n february: 'Febuary',\n march: 'March',\n april: 'April',\n may: 'May',\n june: 'June',\n july: 'July',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December',\n },\n de: {\n clear: 'Entfernen',\n change: 'Ändern',\n year: 'Jahr',\n month: 'Monat',\n day: 'Tag',\n january: 'Januar',\n february: 'Febuar',\n march: 'März',\n april: 'April',\n may: 'Mai',\n june: 'Juni',\n july: 'Juli',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December',\n }\n}\n\nexport type DateTimePickerMode = 'date' | 'time' | 'dateTime'\n\nexport type DateTimePickerProps = {\n mode?: DateTimePickerMode,\n value?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n onFinish?: (date: Date) => void,\n onRemove?: () => void,\n datePickerProps?: Omit<DatePickerProps, 'onChange' | 'value' | 'start' | 'end'>,\n timePickerProps?: Omit<TimePickerProps, 'onChange' | 'time' | 'maxHeight'>,\n}\n\n/**\n * A Component for picking a Date and Time\n */\nexport const DateTimePicker = ({\n overwriteTranslation,\n value = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n mode = 'dateTime',\n onFinish = noop,\n onChange = noop,\n onRemove = noop,\n timePickerProps,\n datePickerProps,\n }: PropsForTranslation<TimeTranslation, DateTimePickerProps>) => {\n const translation = useTranslation(defaultTimeTranslation, overwriteTranslation)\n\n const useDate = mode === 'dateTime' || mode === 'date'\n const useTime = mode === 'dateTime' || mode === 'time'\n\n let dateDisplay: ReactNode\n let timeDisplay: ReactNode\n\n if (useDate) {\n dateDisplay = (\n <DatePicker\n {...datePickerProps}\n className=\"min-w-[320px] min-h-[250px]\"\n yearMonthPickerProps={{ maxHeight: 218 }}\n value={value}\n start={start}\n end={end}\n onChange={onChange}\n />\n )\n }\n if (useTime) {\n timeDisplay = (\n <TimePicker\n {...timePickerProps}\n className={clsx('h-full', { 'justify-between w-full': mode === 'time' })}\n maxHeight={250}\n time={value}\n onChange={onChange}\n />\n )\n }\n\n return (\n <div className=\"col w-fit\">\n <div className=\"row gap-x-4\">\n {dateDisplay}\n {timeDisplay}\n </div>\n <div className=\"row justify-end\">\n <div className=\"row gap-x-2 mt-1\">\n <SolidButton size=\"medium\" color=\"negative\" onClick={onRemove}>{translation.clear}</SolidButton>\n <SolidButton\n size=\"medium\"\n onClick={() => onFinish(value)}\n >\n {translation.change}\n </SolidButton>\n </div>\n </div>\n </div>\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\nimport { getNeighbours, range } from '@/util/array'\nimport { clamp } from '@/util/math'\n\nexport type ScrollPickerProps<T> = {\n options: T[],\n mapping: (value: T) => string,\n selected?: T,\n onChange?: (value: T) => void,\n disabled?: boolean,\n}\n\ntype AnimationData<T> = {\n /** The index we scroll to */\n targetIndex: number,\n /** The index we are currently showing centered */\n currentIndex: number,\n items: T[],\n /** From -0.5 to 0.5 */\n transition: number,\n velocity: number,\n animationVelocity: number,\n lastTimeStamp?: number,\n lastScrollTimeStamp?: number,\n}\n\nconst up = 1\nconst down = -1\ntype Direction = 1 | -1\n\n/**\n * A component for picking an option by scrolling\n */\nexport const ScrollPicker = <T, >({\n options,\n mapping,\n selected,\n onChange = noop,\n disabled = false,\n }: ScrollPickerProps<T>) => {\n let selectedIndex = 0\n if (selected && options.indexOf(selected) !== -1) {\n selectedIndex = options.indexOf(selected)\n }\n const [{\n currentIndex,\n transition,\n items,\n lastTimeStamp\n }, setAnimation] = useState<AnimationData<T>>({\n targetIndex: selectedIndex,\n currentIndex: disabled ? selectedIndex : 0,\n velocity: 0,\n animationVelocity: Math.floor(options.length / 2),\n transition: 0,\n items: options,\n })\n\n const itemsShownCount = 5\n const shownItems = getNeighbours(range(0, items.length - 1), currentIndex).map(index => ({\n name: mapping(items[index]!), index\n }))\n\n const itemHeight = 40\n const distance = 8\n\n const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1)\n\n const getDirection = useCallback((targetIndex: number, currentIndex: number, transition: number, length: number): Direction => {\n if (targetIndex === currentIndex) {\n return transition > 0 ? up : down\n }\n let distanceForward = targetIndex - currentIndex\n if (distanceForward < 0) {\n distanceForward += length\n }\n return distanceForward >= length / 2 ? down : up\n }, [])\n\n const animate = useCallback((timestamp: number, startTime: number | undefined) => {\n setAnimation((prevState) => {\n const {\n targetIndex,\n currentIndex,\n transition,\n animationVelocity,\n velocity,\n items,\n lastScrollTimeStamp\n } = prevState\n if (disabled) {\n return { ...prevState, currentIndex: targetIndex, velocity: 0, lastTimeStamp: timestamp }\n }\n if ((targetIndex === currentIndex && velocity === 0 && transition === 0) || !startTime) {\n return { ...prevState, lastTimeStamp: timestamp }\n }\n const progress = (timestamp - startTime) / 1000 // to seconds\n const direction = getDirection(targetIndex, currentIndex, transition, items.length)\n\n let newVelocity = velocity\n let usedVelocity\n let newCurrentIndex = currentIndex\n const isAutoScrolling = velocity === 0 && (!lastScrollTimeStamp || timestamp - lastScrollTimeStamp > 300)\n\n const newLastScrollTimeStamp = velocity !== 0 ? timestamp : lastScrollTimeStamp\n\n // manual scrolling\n if (isAutoScrolling) {\n usedVelocity = direction * animationVelocity\n } else {\n usedVelocity = velocity\n newVelocity = velocity * 0.5 // drag loss\n if (Math.abs(newVelocity) <= 0.05) {\n newVelocity = 0\n }\n }\n\n let newTransition = transition + usedVelocity * progress\n const changeThreshold = 0.5\n\n while (newTransition >= changeThreshold) {\n if (newCurrentIndex === targetIndex && newTransition >= changeThreshold && isAutoScrolling) {\n newTransition = 0\n break\n }\n newCurrentIndex = (currentIndex + 1) % items.length\n newTransition -= 1\n }\n if (newTransition >= changeThreshold) {\n newTransition = 0\n }\n while (newTransition <= -changeThreshold) {\n if (newCurrentIndex === targetIndex && newTransition <= -changeThreshold && isAutoScrolling) {\n newTransition = 0\n break\n }\n newCurrentIndex = currentIndex === 0 ? items.length - 1 : currentIndex - 1\n newTransition += 1\n }\n let newTargetIndex = targetIndex\n if (!isAutoScrolling) {\n newTargetIndex = newCurrentIndex\n }\n\n if ((currentIndex !== newTargetIndex || newTargetIndex !== targetIndex) && newTargetIndex === newCurrentIndex) {\n onChange(items[newCurrentIndex]!)\n }\n return {\n targetIndex: newTargetIndex,\n currentIndex: newCurrentIndex,\n animationVelocity,\n transition: newTransition,\n velocity: newVelocity,\n items,\n lastTimeStamp: timestamp,\n lastScrollTimeStamp: newLastScrollTimeStamp\n }\n })\n }, [disabled, getDirection, onChange])\n\n useEffect(() => {\n // constant update\n requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp))\n })\n\n const opacity = (transition: number, index: number, itemsCount: number) => {\n const max = 100\n const min = 0\n const distance = max - min\n\n let opacityValue = min\n const unitTransition = clamp((transition) / 0.5)\n if (index === 1 || index === itemsCount - 2) {\n if (index === 1 && transition > 0) {\n opacityValue += Math.floor(unitTransition * distance)\n }\n if (index === itemsCount - 2 && transition < 0) {\n opacityValue += Math.floor(unitTransition * distance)\n }\n } else {\n opacityValue = max\n }\n\n // TODO this is not the right value for the bottom entry\n return clamp(1 - (opacityValue / max))\n }\n\n return (\n <div\n className=\"relative overflow-hidden\"\n style={{ height: containerHeight }}\n onWheel={event => {\n if (event.deltaY !== 0) {\n // TODO slower increase\n setAnimation(({ velocity, ...animationData }) =>\n ({ ...animationData, velocity: velocity + event.deltaY }))\n }\n }}\n >\n <div className=\"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 left-1/2\">\n <div\n className=\"absolute z-[1] top-1/2 -translate-y-1/2 -translate-x-1/2 left-1/2 w-full min-w-[40px] border border-y-2 border-x-0 border-[#00000033]\"\n style={{ height: `${itemHeight}px` }}\n />\n <div\n className=\"col select-none\"\n style={{\n transform: `translateY(${-transition * (distance + itemHeight)}px)`,\n columnGap: `${distance}px`,\n }}\n >\n {shownItems.map(({ name, index }, arrayIndex) => (\n <div\n key={index}\n className={clsx(\n `col items-center justify-center rounded-md`,\n {\n 'text-primary font-bold': currentIndex === index,\n 'text-on-background': currentIndex === index,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n }\n )}\n style={{\n opacity: currentIndex !== index ? opacity(transition, arrayIndex, shownItems.length) : undefined,\n height: `${itemHeight}px`,\n maxHeight: `${itemHeight}px`,\n }}\n onClick={() => !disabled && setAnimation(prevState => ({ ...prevState, targetIndex: index }))}\n >\n {name}\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n","import type { HTMLInputTypeAttribute, InputHTMLAttributes } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Pencil } from 'lucide-react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\n\ntype InputProps = {\n /**\n * The value\n */\n value: string,\n /**\n * @default 'text'\n */\n type?: HTMLInputTypeAttribute,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n onEditCompleted?: (text: string) => void,\n labelClassName?: string,\n initialState?: 'editing' | 'display',\n size?: number,\n disclaimer?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'label' | 'type' | 'crossOrigin'>\n\n/**\n * A Text input component for inputting text. It changes appearance upon entering the edit mode and switches\n * back to display mode on loss of focus or on enter\n *\n * The State is managed by the parent\n */\nexport const ToggleableInput = ({\n type = 'text',\n value,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted = noop,\n labelClassName = '',\n initialState = 'display',\n size = 16,\n disclaimer,\n onBlur,\n ...restProps\n }: InputProps) => {\n const [isEditing, setIsEditing] = useState(initialState !== 'display')\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n useEffect(() => {\n if (isEditing) {\n ref.current?.focus()\n }\n }, [isEditing])\n\n return (\n <div>\n <div\n className={clsx('row items-center w-full gap-x-2 overflow-hidden', { 'cursor-pointer': !isEditing })}\n onClick={() => !isEditing ? setIsEditing(!isEditing) : undefined}\n >\n <div className={clsx('row overflow-hidden', { 'flex-1': isEditing })}>\n {isEditing ? (\n <input\n ref={ref}\n {...restProps}\n value={value}\n type={type}\n onChange={event => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChangeText(value)\n onChange(event)\n }}\n onBlur={(event) => {\n if (onBlur) {\n onBlur(event)\n }\n onEditCompletedWrapper(value)\n setIsEditing(false)\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n setIsEditing(false)\n onEditCompletedWrapper(value)\n }\n }}\n className={clsx(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {\n underline: isEditing\n }, labelClassName)}\n onFocus={event => event.target.select()}\n />\n ) : (\n <span className={clsx('max-w-xs break-words overflow-hidden', labelClassName)}>\n {value}\n </span>\n )}\n </div>\n <Pencil\n className={clsx(`cursor-pointer`, { 'text-transparent': isEditing })}\n size={size}\n style={{ minWidth: `${size}px` }}\n />\n </div>\n {(isEditing && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\nexport const ToggleableInputUncontrolled = ({\n value: initialValue,\n onChangeText = noop,\n ...restProps\n }: InputProps) => {\n const [value, setValue] = useState(initialValue)\n\n useEffect(() => {\n setValue(initialValue)\n }, [initialValue])\n\n return (\n <ToggleableInput\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n {...restProps}\n />\n )\n}\n","import { z } from 'zod'\nimport type { Language } from '@/localization/util'\nimport { LanguageUtil } from '@/localization/util'\n\nexport type News = {\n title: string,\n date: Date,\n description: (string | URL)[],\n externalResource?: URL,\n keys: string[],\n}\n\nexport type LocalizedNews = Record<Language, News[]>\n\nexport const newsSchema = z.object({\n title: z.string(),\n description: z.string(),\n date: z.string(),\n image: z.string().url().optional(),\n externalResource: z.string().url().optional(),\n keys: z.array(z.string())\n}).transform<News>((obj) => {\n let description: (string | URL)[] = [obj.description]\n if (obj.image) {\n description = [new URL(obj.image), ...description]\n }\n\n return {\n title: obj.title,\n date: new Date(obj.date),\n description,\n externalResource: obj.externalResource ? new URL(obj.externalResource) : undefined,\n keys: obj.keys\n }\n})\n\nexport const newsListSchema = z.array(newsSchema)\n\nexport const localizedNewsSchema = z.record(z.enum(LanguageUtil.languages), newsListSchema)\n\nexport const filterNews = (localizedNews: News[], requiredKeys: string[]) => {\n return localizedNews.filter(news => requiredKeys.every(value => news.keys.includes(value)))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,aAAS,yBAAyB,aAAa;AAC3C,UAAI,OAAO,YAAY,WAAY,QAAO;AAE1C,UAAI,oBAAoB,oBAAI,QAAQ;AACpC,UAAI,mBAAmB,oBAAI,QAAQ;AAEnC,cAAQ,2BAA2B,SAASA,cAAa;AACrD,eAAOA,eAAc,mBAAmB;AAAA,MAC5C,GAAG,WAAW;AAAA,IAClB;AACA,aAAS,0BAA0B,KAAK,aAAa;AACjD,UAAI,CAAC,eAAe,OAAO,IAAI,WAAY,QAAO;AAClD,UAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAAY,QAAO,EAAE,SAAS,IAAI;AAEhG,UAAI,QAAQ,yBAAyB,WAAW;AAEhD,UAAI,SAAS,MAAM,IAAI,GAAG,EAAG,QAAO,MAAM,IAAI,GAAG;AAEjD,UAAI,SAAS,EAAE,WAAW,KAAK;AAC/B,UAAI,wBAAwB,OAAO,kBAAkB,OAAO;AAE5D,eAAS,OAAO,KAAK;AACjB,YAAI,QAAQ,aAAa,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG,GAAG;AACrE,cAAI,OAAO,wBAAwB,OAAO,yBAAyB,KAAK,GAAG,IAAI;AAC/E,cAAI,SAAS,KAA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,QAAQ;AACnC,UAAI,mBAAmB,SAAS;AAAA,IAClC;AAEA,UAAM,YAAY,mBAAmB,CAAC;AACtC,UAAM,WAAW,YAAY;AAC7B,aAAS,IAAI,OAAO,IAAI,GAAG,KAAK;AAC9B,YAAMC,WAAU,mBAAmB,CAAC;AACpC,YAAM,gBAAgB,eAAe,QAAQ,KAAK,QAAQ,QAAQ;AAClE,YAAM,YAAY,eAAe,SAAS,KAAK,QAAQ,SAAS;AAChE,cAAQA,QAAO,IAAI,UAAU,IAAI,UAAU,aAAa,GAAG,UAAU,SAAS,IAAIA,WAAU,YAAY,WAAW,GAAG,EAAE,YAAY;AAAA,IACtI;AACA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;","names":["nodeInterop","assign","searchParamsToUrlQuery","urlQueryToSearchParams","searchParams","query","key","value","entries","existing","Array","isArray","push","stringifyUrlQueryParam","param","isNaN","String","URLSearchParams","Object","item","append","set","target","searchParamsList","keys","delete","formatUrl","formatWithValidation","urlObjectKeys","slashedProtocols","urlObj","auth","hostname","protocol","pathname","hash","query","host","encodeURIComponent","replace","indexOf","port","String","querystring","urlQueryToSearchParams","search","endsWith","slashes","test","url","process","env","NODE_ENV","Object","keys","forEach","key","includes","console","warn","omit","object","keys","omitted","Object","forEach","key","includes","DecodeError","MiddlewareNotFoundError","MissingStaticPage","NormalizeError","PageNotFoundError","SP","ST","WEB_VITALS","execOnce","getDisplayName","getLocationOrigin","getURL","isAbsoluteUrl","isResSent","loadGetInitialProps","normalizeRepeatedSlashes","stringifyError","fn","used","result","args","ABSOLUTE_URL_REGEX","url","test","protocol","hostname","port","window","location","href","origin","substring","length","Component","displayName","name","res","finished","headersSent","urlParts","split","urlNoQuery","replace","slice","join","App","ctx","process","env","NODE_ENV","prototype","getInitialProps","message","Error","pageProps","props","Object","keys","console","warn","performance","every","method","constructor","page","code","error","JSON","stringify","stack","removeTrailingSlash","route","replace","parsePath","path","hashIndex","indexOf","queryIndex","hasQuery","pathname","substring","query","undefined","hash","slice","normalizePathTrailingSlash","path","startsWith","process","env","__NEXT_MANUAL_TRAILING_SLASH","pathname","query","hash","parsePath","__NEXT_TRAILING_SLASH","test","removeTrailingSlash","endsWith","pathHasPrefix","path","prefix","pathname","parsePath","startsWith","hasBasePath","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","pathHasPrefix","isLocalURL","url","isAbsoluteUrl","locationOrigin","getLocationOrigin","resolved","URL","origin","hasBasePath","pathname","_","getSortedRouteObjects","getSortedRoutes","UrlNode","insert","urlPath","_insert","split","filter","Boolean","smoosh","_smoosh","prefix","childrenPaths","children","keys","sort","slugName","splice","indexOf","restSlugName","optionalRestSlugName","routes","map","c","get","reduce","prev","curr","push","placeholder","r","slice","Error","unshift","urlPaths","slugNames","isCatchAll","length","nextSegment","startsWith","endsWith","handleSlug","previousSlug","nextSlug","forEach","slug","replace","segmentName","isOptional","substring","has","set","Map","normalizedPages","root","pagePath","objects","getter","indexes","pathnames","i","pathname","sorted","ensureLeadingSlash","path","startsWith","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","addSearchParamsIfPageSegment","isGroupSegment","isParallelRouteSegment","segment","endsWith","startsWith","searchParams","isPageSegment","includes","stringifiedQuery","JSON","stringify","normalizeAppPath","normalizeRscURL","route","ensureLeadingSlash","split","reduce","pathname","segment","index","segments","isGroupSegment","length","url","replace","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","path","split","find","segment","m","startsWith","undefined","interceptingRoute","marker","interceptedRoute","Error","normalizeAppPath","slice","concat","join","splitInterceptingRoute","length","isDynamicRoute","TEST_ROUTE","TEST_STRICT_ROUTE","route","strict","isInterceptionRouteAppPath","extractInterceptionRouteInformation","interceptedRoute","test","getSortedRouteObjects","getSortedRoutes","isDynamicRoute","getRouteMatcher","re","groups","pathname","routeMatch","exec","decode","param","decodeURIComponent","DecodeError","params","key","group","Object","entries","match","pos","undefined","repeat","split","map","entry","ACTION_SUFFIX","APP_DIR_ALIAS","CACHE_ONE_YEAR","DOT_NEXT_ALIAS","ESLINT_DEFAULT_DIRS","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","INFINITE_CACHE","INSTRUMENTATION_HOOK_FILENAME","MATCHED_PATH_HEADER","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","NEXT_BODY_SUFFIX","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_DATA_SUFFIX","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_META_SUFFIX","NEXT_QUERY_PARAM_PREFIX","NEXT_RESUME_HEADER","NON_STANDARD_NODE_ENV","PAGES_DIR_ALIAS","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","PUBLIC_DIR_MIDDLEWARE_CONFLICT","ROOT_DIR_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_CACHE_WRAPPER_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_PREFETCH_SUFFIX","RSC_SEGMENTS_DIR_SUFFIX","RSC_SEGMENT_SUFFIX","RSC_SUFFIX","SERVER_PROPS_EXPORT_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SERVER_RUNTIME","SSG_FALLBACK_EXPORT_ERROR","SSG_GET_INITIAL_PROPS_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","UNSTABLE_REVALIDATE_RENAME_ERROR","WEBPACK_LAYERS","WEBPACK_RESOURCE_QUERIES","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","apiNode","apiEdge","middleware","instrument","edgeAsset","appPagesBrowser","pagesDirBrowser","pagesDirEdge","pagesDirNode","GROUP","builtinReact","serverOnly","neutralTarget","clientOnly","bundled","appPages","edgeSSREntry","metadata","metadataRoute","metadataImageMeta","escapeStringRegexp","reHasRegExp","reReplaceRegExp","str","test","replace","getNamedMiddlewareRegex","getNamedRouteRegex","getRouteRegex","parseParameter","PARAMETER_PATTERN","param","match","parseMatchedParameter","optional","startsWith","endsWith","slice","repeat","key","getParametrizedRoute","route","includeSuffix","includePrefix","groups","groupIndex","segments","segment","removeTrailingSlash","split","markerMatch","INTERCEPTION_ROUTE_MARKERS","find","m","paramMatches","pos","push","escapeStringRegexp","s","substring","parameterizedRoute","join","normalizedRoute","excludeOptionalTrailingSlash","re","RegExp","buildGetSafeRouteKey","i","routeKey","j","String","fromCharCode","Math","floor","getSafeKeyFromSegment","interceptionMarker","getSafeRouteKey","routeKeys","keyPrefix","backreferenceDuplicateKeys","cleanedKey","replace","invalidKey","length","isNaN","parseInt","duplicateKey","interceptionPrefix","pattern","getNamedParametrizedRoute","prefixRouteKeys","hasInterceptionMarker","some","NEXT_INTERCEPTION_MARKER_PREFIX","undefined","NEXT_QUERY_PARAM_PREFIX","namedParameterizedRoute","options","result","namedRegex","catchAll","catchAllRegex","catchAllGroupedRegex","interpolateAs","route","asPathname","query","interpolatedRoute","dynamicRegex","getRouteRegex","dynamicGroups","groups","dynamicMatches","getRouteMatcher","params","Object","keys","every","param","value","repeat","optional","replaced","Array","isArray","replace","map","segment","encodeURIComponent","join","result","resolveHref","router","href","resolveAs","base","urlAsString","formatWithValidation","urlProtoMatch","match","urlAsStringNoProto","slice","length","urlParts","split","console","error","pathname","normalizedUrl","normalizeRepeatedSlashes","isLocalURL","URL","startsWith","asPath","_","finalUrl","normalizePathTrailingSlash","interpolatedAs","isDynamicRoute","searchParams","query","searchParamsToUrlQuery","result","params","interpolateAs","hash","omit","resolvedHref","origin","addPathPrefix","path","prefix","startsWith","pathname","query","hash","parsePath","addLocale","path","locale","defaultLocale","ignorePrefix","lower","toLowerCase","pathHasPrefix","addPathPrefix","addLocale","path","args","process","env","__NEXT_I18N_SUPPORT","normalizePathTrailingSlash","require","RouterContext","React","createContext","process","env","NODE_ENV","displayName","cancelIdleCallback","requestIdleCallback","self","bind","window","cb","start","Date","now","setTimeout","didTimeout","timeRemaining","Math","max","id","clearTimeout","useIntersection","hasIntersectionObserver","IntersectionObserver","observers","Map","idList","createObserver","options","id","root","margin","rootMargin","existing","find","obj","instance","get","elements","observer","entries","forEach","entry","callback","target","isVisible","isIntersecting","intersectionRatio","push","set","observe","element","unobserve","delete","size","disconnect","index","findIndex","splice","rootRef","disabled","isDisabled","visible","setVisible","useState","elementRef","useRef","setElement","useCallback","current","useEffect","tagName","idleCallback","requestIdleCallback","cancelIdleCallback","resetVisible","normalizeLocalePath","cache","WeakMap","pathname","locales","lowercasedLocales","get","map","locale","toLowerCase","set","detectedLocale","segments","split","segment","index","indexOf","slice","length","normalizeLocalePath","pathname","locales","process","env","__NEXT_I18N_SUPPORT","require","detectedLocale","undefined","detectDomainLocale","domainItems","hostname","detectedLocale","toLowerCase","item","domainHostname","domain","split","defaultLocale","locales","some","locale","detectDomainLocale","args","process","env","__NEXT_I18N_SUPPORT","require","getDomainLocale","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","locale","locales","domainLocales","__NEXT_I18N_SUPPORT","normalizeLocalePath","require","detectDomainLocale","target","detectedLocale","domain","undefined","proto","http","finalLocale","defaultLocale","normalizePathTrailingSlash","addBasePath","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","required","normalizePathTrailingSlash","__NEXT_MANUAL_CLIENT_BASE_PATH","addPathPrefix","useMergedRef","refA","refB","cleanupA","useRef","cleanupB","useCallback","current","cleanupFnA","cleanupFnB","applyRef","cleanup","errorOnce","_","process","env","NODE_ENV","errors","Set","msg","has","console","error","add","useLinkStatus","prefetched","Set","prefetch","router","href","as","options","window","isLocalURL","bypassPrefetchedCheck","locale","undefined","prefetchedKey","has","add","catch","err","process","env","NODE_ENV","isModifiedEvent","event","eventTarget","currentTarget","target","getAttribute","metaKey","ctrlKey","shiftKey","altKey","nativeEvent","which","linkClicked","e","replace","shallow","scroll","onNavigate","nodeName","isAnchorNodeName","toUpperCase","hasAttribute","preventDefault","location","navigate","isDefaultPrevented","routerScroll","formatStringOrUrl","urlObjOrString","formatUrl","Link","React","forwardRef","LinkComponent","props","forwardedRef","children","hrefProp","asProp","childrenProp","prefetchProp","passHref","onClick","onMouseEnter","onMouseEnterProp","onTouchStart","onTouchStartProp","legacyBehavior","restProps","a","useContext","RouterContext","prefetchEnabled","createPropError","args","Error","key","expected","actual","requiredPropsGuard","requiredProps","Object","keys","forEach","_","optionalPropsGuard","optionalProps","valType","useMemo","resolvedHref","resolvedAs","resolveHref","previousHref","useRef","previousAs","child","console","warn","Children","only","type","childRef","ref","setIntersectionRef","isVisible","resetVisible","useIntersection","rootMargin","setIntersectionWithResetRef","useCallback","el","current","setRef","useMergedRef","useEffect","childProps","defaultPrevented","priority","__NEXT_LINK_NO_TOUCH_START","isAbsoluteUrl","curLocale","localeDomain","isLocaleDomain","getDomainLocale","locales","domainLocales","addBasePath","addLocale","defaultLocale","errorOnce","cloneElement","LinkStatusContext","createContext","pending","require_link","clsx","clsx","jsx","jsxs","jsx","useEffect","useState","ChevronDown","useEffect","useState","jsx","clsx","clsx","jsx","jsxs","useEffect","useState","clsx","useEffect","useState","clsx","jsx","jsxs","Expandable","clsx","ExpandableUncontrolled","useState","useEffect","jsx","clsx","useEffect","useState","jsx","jsxs","jsx","jsxs","jsx","useEffect","useRef","useState","Scrollbars","clsx","jsx","jsxs","clsx","useEffect","useRef","useState","clsx","useEffect","useState","clsx","jsx","jsxs","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","useCallback","useEffect","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","useCallback","useEffect","useRef","useState","clsx","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","clsx","ChevronDown","ChevronUp","Fragment","jsx","jsx","ChevronLeft","ChevronRight","clsx","jsx","jsxs","useEffect","useMemo","useState","clsx","forwardRef","useEffect","useRef","useState","clsx","useEffect","useState","clsx","jsx","jsx","jsxs","forwardRef","FormInput","jsx","clsx","jsxs","jsx","jsxs","ChevronLeft","ChevronRight","clsx","useEffect","useState","jsx","jsxs","useEffect","useRef","useState","Scrollbars","useState","Check","clsx","jsx","jsxs","clsx","ChevronDown","ChevronUp","jsx","jsxs","clsx","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","jsx","jsx","ChevronDown","ChevronUp","Search","useEffect","useState","clsx","Fragment","jsx","jsxs","jsx","jsxs","createContext","useContext","useEffect","useState","jsx","createContext","jsx","jsxs","Check","clsx","jsx","jsxs","jsx","clsx","jsx","clsx","useState","Search","clsx","useRef","clsx","useEffect","jsx","jsxs","jsx","jsxs","jsx","clsx","jsx","jsxs","List","clsx","jsx","clsx","useEffect","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","useCallback","useEffect","useState","clsx","jsx","jsxs","useEffect","useRef","useState","clsx","jsx","jsxs","current"]}
|
|
1
|
+
{"version":3,"sources":["../../node_modules/@swc/helpers/cjs/_interop_require_wildcard.cjs","../../node_modules/next/src/shared/lib/router/utils/querystring.ts","../../node_modules/next/src/shared/lib/router/utils/format-url.ts","../../node_modules/next/src/shared/lib/router/utils/omit.ts","../../node_modules/next/src/shared/lib/utils.ts","../../node_modules/next/src/shared/lib/router/utils/remove-trailing-slash.ts","../../node_modules/next/src/shared/lib/router/utils/parse-path.ts","../../node_modules/next/src/client/normalize-trailing-slash.ts","../../node_modules/next/src/shared/lib/router/utils/path-has-prefix.ts","../../node_modules/next/src/client/has-base-path.ts","../../node_modules/next/src/shared/lib/router/utils/is-local-url.ts","../../node_modules/next/src/shared/lib/router/utils/sorted-routes.ts","../../node_modules/next/src/shared/lib/page-path/ensure-leading-slash.ts","../../node_modules/next/src/shared/lib/segment.ts","../../node_modules/next/src/shared/lib/router/utils/app-paths.ts","../../node_modules/next/src/shared/lib/router/utils/interception-routes.ts","../../node_modules/next/src/shared/lib/router/utils/is-dynamic.ts","../../node_modules/next/src/shared/lib/router/utils/index.ts","../../node_modules/next/src/shared/lib/router/utils/route-matcher.ts","../../node_modules/next/src/lib/constants.ts","../../node_modules/next/src/shared/lib/escape-regexp.ts","../../node_modules/next/src/shared/lib/router/utils/route-regex.ts","../../node_modules/next/src/shared/lib/router/utils/interpolate-as.ts","../../node_modules/next/src/client/resolve-href.ts","../../node_modules/next/src/shared/lib/router/utils/add-path-prefix.ts","../../node_modules/next/src/shared/lib/router/utils/add-locale.ts","../../node_modules/next/src/client/add-locale.ts","../../node_modules/@swc/helpers/cjs/_interop_require_default.cjs","../../node_modules/next/src/shared/lib/router-context.shared-runtime.ts","../../node_modules/next/src/client/request-idle-callback.ts","../../node_modules/next/src/client/use-intersection.tsx","../../node_modules/next/src/shared/lib/i18n/normalize-locale-path.ts","../../node_modules/next/src/client/normalize-locale-path.ts","../../node_modules/next/src/shared/lib/i18n/detect-domain-locale.ts","../../node_modules/next/src/client/detect-domain-locale.ts","../../node_modules/next/src/client/get-domain-locale.ts","../../node_modules/next/src/client/add-base-path.ts","../../node_modules/next/src/client/use-merged-ref.ts","../../node_modules/next/src/shared/lib/utils/error-once.ts","../../node_modules/next/src/client/link.tsx","../../node_modules/next/link.js","../../src/coloring/shading.ts","../../src/coloring/types.ts","../../src/components/branding/HelpwaveBadge.tsx","../../src/components/layout-and-navigation/Tile.tsx","../../src/components/icons-and-geometry/Helpwave.tsx","../../src/components/date/DatePicker.tsx","../../src/localization/LanguageProvider.tsx","../../src/hooks/useLocalStorage.ts","../../src/localization/util.ts","../../src/util/noop.ts","../../src/components/user-action/Button.tsx","../../src/components/date/YearMonthPicker.tsx","../../src/components/layout-and-navigation/Expandable.tsx","../../src/components/date/DayPicker.tsx","../../src/components/date/TimeDisplay.tsx","../../src/components/date/TimePicker.tsx","../../src/components/dialogs/ConfirmDialog.tsx","../../src/components/layout-and-navigation/Overlay.tsx","../../src/hooks/useHoverState.ts","../../src/components/user-action/Tooltip.tsx","../../src/components/icons-and-geometry/Avatar.tsx","../../src/components/icons-and-geometry/Circle.tsx","../../src/components/icons-and-geometry/Ring.tsx","../../src/components/icons-and-geometry/Tag.tsx","../../src/components/layout-and-navigation/BreadCrumb.tsx","../../src/components/layout-and-navigation/Carousel.tsx","../../src/components/layout-and-navigation/Chip.tsx","../../src/components/layout-and-navigation/DividerInserter.tsx","../../src/components/layout-and-navigation/FAQSection.tsx","../../src/components/layout-and-navigation/MarkdownInterpreter.tsx","../../src/components/layout-and-navigation/Pagination.tsx","../../src/components/layout-and-navigation/SearchableList.tsx","../../src/components/user-action/Input.tsx","../../src/hooks/useSaveDelay.ts","../../src/components/user-action/Label.tsx","../../src/components/layout-and-navigation/StepperBar.tsx","../../src/components/layout-and-navigation/Table.tsx","../../src/components/user-action/Checkbox.tsx","../../src/components/layout-and-navigation/TextImage.tsx","../../src/components/layout-and-navigation/VerticalDivider.tsx","../../src/components/loading-states/ErrorComponent.tsx","../../src/components/loading-states/LoadingAndErrorComponent.tsx","../../src/components/loading-states/LoadingAnimation.tsx","../../src/components/loading-states/LoadingButton.tsx","../../src/components/loading-states/ProgressIndicator.tsx","../../src/components/modals/ConfirmModal.tsx","../../src/components/modals/DiscardChangesModal.tsx","../../src/components/modals/InputModal.tsx","../../src/components/user-action/Select.tsx","../../src/components/modals/LanguageModal.tsx","../../src/theming/useTheme.tsx","../../src/components/modals/ThemeModal.tsx","../../src/components/properties/CheckboxProperty.tsx","../../src/components/properties/PropertyBase.tsx","../../src/components/properties/DateProperty.tsx","../../src/components/properties/MultiSelectProperty.tsx","../../src/components/user-action/MultiSelect.tsx","../../src/components/user-action/Menu.tsx","../../src/hooks/useOutsideClick.ts","../../src/components/properties/NumberProperty.tsx","../../src/components/properties/SelectProperty.tsx","../../src/components/properties/TextProperty.tsx","../../src/components/user-action/Textarea.tsx","../../src/components/user-action/DateAndTimePicker.tsx","../../src/components/user-action/ScrollPicker.tsx","../../src/components/user-action/ToggleableInput.tsx","../../src/util/news.ts"],"sourcesContent":["\"use strict\";\n\nfunction _getRequireWildcardCache(nodeInterop) {\n if (typeof WeakMap !== \"function\") return null;\n\n var cacheBabelInterop = new WeakMap();\n var cacheNodeInterop = new WeakMap();\n\n return (_getRequireWildcardCache = function(nodeInterop) {\n return nodeInterop ? cacheNodeInterop : cacheBabelInterop;\n })(nodeInterop);\n}\nfunction _interop_require_wildcard(obj, nodeInterop) {\n if (!nodeInterop && obj && obj.__esModule) return obj;\n if (obj === null || typeof obj !== \"object\" && typeof obj !== \"function\") return { default: obj };\n\n var cache = _getRequireWildcardCache(nodeInterop);\n\n if (cache && cache.has(obj)) return cache.get(obj);\n\n var newObj = { __proto__: null };\n var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;\n\n for (var key in obj) {\n if (key !== \"default\" && Object.prototype.hasOwnProperty.call(obj, key)) {\n var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;\n if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);\n else newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n\n if (cache) cache.set(obj, newObj);\n\n return newObj;\n}\nexports._ = _interop_require_wildcard;\n","import type { ParsedUrlQuery } from 'querystring'\n\nexport function searchParamsToUrlQuery(\n searchParams: URLSearchParams\n): ParsedUrlQuery {\n const query: ParsedUrlQuery = {}\n for (const [key, value] of searchParams.entries()) {\n const existing = query[key]\n if (typeof existing === 'undefined') {\n query[key] = value\n } else if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n query[key] = [existing, value]\n }\n }\n return query\n}\n\nfunction stringifyUrlQueryParam(param: unknown): string {\n if (typeof param === 'string') {\n return param\n }\n\n if (\n (typeof param === 'number' && !isNaN(param)) ||\n typeof param === 'boolean'\n ) {\n return String(param)\n } else {\n return ''\n }\n}\n\nexport function urlQueryToSearchParams(query: ParsedUrlQuery): URLSearchParams {\n const searchParams = new URLSearchParams()\n for (const [key, value] of Object.entries(query)) {\n if (Array.isArray(value)) {\n for (const item of value) {\n searchParams.append(key, stringifyUrlQueryParam(item))\n }\n } else {\n searchParams.set(key, stringifyUrlQueryParam(value))\n }\n }\n return searchParams\n}\n\nexport function assign(\n target: URLSearchParams,\n ...searchParamsList: URLSearchParams[]\n): URLSearchParams {\n for (const searchParams of searchParamsList) {\n for (const key of searchParams.keys()) {\n target.delete(key)\n }\n\n for (const [key, value] of searchParams.entries()) {\n target.append(key, value)\n }\n }\n\n return target\n}\n","// Format function modified from nodejs\n// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\nimport type { UrlObject } from 'url'\nimport type { ParsedUrlQuery } from 'querystring'\nimport * as querystring from './querystring'\n\nconst slashedProtocols = /https?|ftp|gopher|file/\n\nexport function formatUrl(urlObj: UrlObject) {\n let { auth, hostname } = urlObj\n let protocol = urlObj.protocol || ''\n let pathname = urlObj.pathname || ''\n let hash = urlObj.hash || ''\n let query = urlObj.query || ''\n let host: string | false = false\n\n auth = auth ? encodeURIComponent(auth).replace(/%3A/i, ':') + '@' : ''\n\n if (urlObj.host) {\n host = auth + urlObj.host\n } else if (hostname) {\n host = auth + (~hostname.indexOf(':') ? `[${hostname}]` : hostname)\n if (urlObj.port) {\n host += ':' + urlObj.port\n }\n }\n\n if (query && typeof query === 'object') {\n query = String(querystring.urlQueryToSearchParams(query as ParsedUrlQuery))\n }\n\n let search = urlObj.search || (query && `?${query}`) || ''\n\n if (protocol && !protocol.endsWith(':')) protocol += ':'\n\n if (\n urlObj.slashes ||\n ((!protocol || slashedProtocols.test(protocol)) && host !== false)\n ) {\n host = '//' + (host || '')\n if (pathname && pathname[0] !== '/') pathname = '/' + pathname\n } else if (!host) {\n host = ''\n }\n\n if (hash && hash[0] !== '#') hash = '#' + hash\n if (search && search[0] !== '?') search = '?' + search\n\n pathname = pathname.replace(/[?#]/g, encodeURIComponent)\n search = search.replace('#', '%23')\n\n return `${protocol}${host}${pathname}${search}${hash}`\n}\n\nexport const urlObjectKeys = [\n 'auth',\n 'hash',\n 'host',\n 'hostname',\n 'href',\n 'path',\n 'pathname',\n 'port',\n 'protocol',\n 'query',\n 'search',\n 'slashes',\n]\n\nexport function formatWithValidation(url: UrlObject): string {\n if (process.env.NODE_ENV === 'development') {\n if (url !== null && typeof url === 'object') {\n Object.keys(url).forEach((key) => {\n if (!urlObjectKeys.includes(key)) {\n console.warn(\n `Unknown key passed via urlObject into url.format: ${key}`\n )\n }\n })\n }\n }\n\n return formatUrl(url)\n}\n","export function omit<T extends { [key: string]: unknown }, K extends keyof T>(\n object: T,\n keys: K[]\n): Omit<T, K> {\n const omitted: { [key: string]: unknown } = {}\n Object.keys(object).forEach((key) => {\n if (!keys.includes(key as K)) {\n omitted[key] = object[key]\n }\n })\n return omitted as Omit<T, K>\n}\n","import type { HtmlProps } from './html-context.shared-runtime'\nimport type { ComponentType, JSX } from 'react'\nimport type { DomainLocale } from '../../server/config'\nimport type { Env } from '@next/env'\nimport type { IncomingMessage, ServerResponse } from 'http'\nimport type { NextRouter } from './router/router'\nimport type { ParsedUrlQuery } from 'querystring'\nimport type { PreviewData } from '../../types'\nimport type { COMPILER_NAMES } from './constants'\nimport type fs from 'fs'\n\nexport type NextComponentType<\n Context extends BaseContext = NextPageContext,\n InitialProps = {},\n Props = {},\n> = ComponentType<Props> & {\n /**\n * Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.\n * Make sure to return plain `Object` without using `Date`, `Map`, `Set`.\n * @param context Context of `page`\n */\n getInitialProps?(context: Context): InitialProps | Promise<InitialProps>\n}\n\nexport type DocumentType = NextComponentType<\n DocumentContext,\n DocumentInitialProps,\n DocumentProps\n>\n\nexport type AppType<P = {}> = NextComponentType<\n AppContextType,\n P,\n AppPropsType<any, P>\n>\n\nexport type AppTreeType = ComponentType<\n AppInitialProps & { [name: string]: any }\n>\n\n/**\n * Web vitals provided to _app.reportWebVitals by Core Web Vitals plugin developed by Google Chrome team.\n * https://nextjs.org/blog/next-9-4#integrated-web-vitals-reporting\n */\nexport const WEB_VITALS = ['CLS', 'FCP', 'FID', 'INP', 'LCP', 'TTFB'] as const\nexport type NextWebVitalsMetric = {\n id: string\n startTime: number\n value: number\n attribution?: { [key: string]: unknown }\n} & (\n | {\n label: 'web-vital'\n name: (typeof WEB_VITALS)[number]\n }\n | {\n label: 'custom'\n name:\n | 'Next.js-hydration'\n | 'Next.js-route-change-to-render'\n | 'Next.js-render'\n }\n)\n\nexport type Enhancer<C> = (Component: C) => C\n\nexport type ComponentsEnhancer =\n | {\n enhanceApp?: Enhancer<AppType>\n enhanceComponent?: Enhancer<NextComponentType>\n }\n | Enhancer<NextComponentType>\n\nexport type RenderPageResult = {\n html: string\n head?: Array<JSX.Element | null>\n}\n\nexport type RenderPage = (\n options?: ComponentsEnhancer\n) => DocumentInitialProps | Promise<DocumentInitialProps>\n\nexport type BaseContext = {\n res?: ServerResponse\n [k: string]: any\n}\n\nexport type NEXT_DATA = {\n props: Record<string, any>\n page: string\n query: ParsedUrlQuery\n buildId: string\n assetPrefix?: string\n runtimeConfig?: { [key: string]: any }\n nextExport?: boolean\n autoExport?: boolean\n isFallback?: boolean\n isExperimentalCompile?: boolean\n dynamicIds?: (string | number)[]\n err?: Error & {\n statusCode?: number\n source?: typeof COMPILER_NAMES.server | typeof COMPILER_NAMES.edgeServer\n }\n gsp?: boolean\n gssp?: boolean\n customServer?: boolean\n gip?: boolean\n appGip?: boolean\n locale?: string\n locales?: readonly string[]\n defaultLocale?: string\n domainLocales?: readonly DomainLocale[]\n scriptLoader?: any[]\n isPreview?: boolean\n notFoundSrcPage?: string\n}\n\n/**\n * `Next` context\n */\nexport interface NextPageContext {\n /**\n * Error object if encountered during rendering\n */\n err?: (Error & { statusCode?: number }) | null\n /**\n * `HTTP` request object.\n */\n req?: IncomingMessage\n /**\n * `HTTP` response object.\n */\n res?: ServerResponse\n /**\n * Path section of `URL`.\n */\n pathname: string\n /**\n * Query string section of `URL` parsed as an object.\n */\n query: ParsedUrlQuery\n /**\n * `String` of the actual path including query.\n */\n asPath?: string\n /**\n * The currently active locale\n */\n locale?: string\n /**\n * All configured locales\n */\n locales?: readonly string[]\n /**\n * The configured default locale\n */\n defaultLocale?: string\n /**\n * `Component` the tree of the App to use if needing to render separately\n */\n AppTree: AppTreeType\n}\n\nexport type AppContextType<Router extends NextRouter = NextRouter> = {\n Component: NextComponentType<NextPageContext>\n AppTree: AppTreeType\n ctx: NextPageContext\n router: Router\n}\n\nexport type AppInitialProps<PageProps = any> = {\n pageProps: PageProps\n}\n\nexport type AppPropsType<\n Router extends NextRouter = NextRouter,\n PageProps = {},\n> = AppInitialProps<PageProps> & {\n Component: NextComponentType<NextPageContext, any, any>\n router: Router\n __N_SSG?: boolean\n __N_SSP?: boolean\n}\n\nexport type DocumentContext = NextPageContext & {\n renderPage: RenderPage\n defaultGetInitialProps(\n ctx: DocumentContext,\n options?: { nonce?: string }\n ): Promise<DocumentInitialProps>\n}\n\nexport type DocumentInitialProps = RenderPageResult & {\n styles?: React.ReactElement[] | Iterable<React.ReactNode> | JSX.Element\n}\n\nexport type DocumentProps = DocumentInitialProps & HtmlProps\n\n/**\n * Next `API` route request\n */\nexport interface NextApiRequest extends IncomingMessage {\n /**\n * Object of `query` values from url\n */\n query: Partial<{\n [key: string]: string | string[]\n }>\n /**\n * Object of `cookies` from header\n */\n cookies: Partial<{\n [key: string]: string\n }>\n\n body: any\n\n env: Env\n\n draftMode?: boolean\n\n preview?: boolean\n /**\n * Preview data set on the request, if any\n * */\n previewData?: PreviewData\n}\n\n/**\n * Send body of response\n */\ntype Send<T> = (body: T) => void\n\n/**\n * Next `API` route response\n */\nexport type NextApiResponse<Data = any> = ServerResponse & {\n /**\n * Send data `any` data in response\n */\n send: Send<Data>\n /**\n * Send data `json` data in response\n */\n json: Send<Data>\n status: (statusCode: number) => NextApiResponse<Data>\n redirect(url: string): NextApiResponse<Data>\n redirect(status: number, url: string): NextApiResponse<Data>\n\n /**\n * Set draft mode\n */\n setDraftMode: (options: { enable: boolean }) => NextApiResponse<Data>\n\n /**\n * Set preview data for Next.js' prerender mode\n */\n setPreviewData: (\n data: object | string,\n options?: {\n /**\n * Specifies the number (in seconds) for the preview session to last for.\n * The given number will be converted to an integer by rounding down.\n * By default, no maximum age is set and the preview session finishes\n * when the client shuts down (browser is closed).\n */\n maxAge?: number\n /**\n * Specifies the path for the preview session to work under. By default,\n * the path is considered the \"default path\", i.e., any pages under \"/\".\n */\n path?: string\n }\n ) => NextApiResponse<Data>\n\n /**\n * Clear preview data for Next.js' prerender mode\n */\n clearPreviewData: (options?: { path?: string }) => NextApiResponse<Data>\n\n /**\n * Revalidate a specific page and regenerate it using On-Demand Incremental\n * Static Regeneration.\n * The path should be an actual path, not a rewritten path. E.g. for\n * \"/blog/[slug]\" this should be \"/blog/post-1\".\n * @link https://nextjs.org/docs/app/building-your-application/data-fetching/incremental-static-regeneration#on-demand-revalidation-with-revalidatepath\n */\n revalidate: (\n urlPath: string,\n opts?: {\n unstable_onlyGenerated?: boolean\n }\n ) => Promise<void>\n}\n\n/**\n * Next `API` route handler\n */\nexport type NextApiHandler<T = any> = (\n req: NextApiRequest,\n res: NextApiResponse<T>\n) => unknown | Promise<unknown>\n\n/**\n * Utils\n */\nexport function execOnce<T extends (...args: any[]) => ReturnType<T>>(\n fn: T\n): T {\n let used = false\n let result: ReturnType<T>\n\n return ((...args: any[]) => {\n if (!used) {\n used = true\n result = fn(...args)\n }\n return result\n }) as T\n}\n\n// Scheme: https://tools.ietf.org/html/rfc3986#section-3.1\n// Absolute URL: https://tools.ietf.org/html/rfc3986#section-4.3\nconst ABSOLUTE_URL_REGEX = /^[a-zA-Z][a-zA-Z\\d+\\-.]*?:/\nexport const isAbsoluteUrl = (url: string) => ABSOLUTE_URL_REGEX.test(url)\n\nexport function getLocationOrigin() {\n const { protocol, hostname, port } = window.location\n return `${protocol}//${hostname}${port ? ':' + port : ''}`\n}\n\nexport function getURL() {\n const { href } = window.location\n const origin = getLocationOrigin()\n return href.substring(origin.length)\n}\n\nexport function getDisplayName<P>(Component: ComponentType<P>) {\n return typeof Component === 'string'\n ? Component\n : Component.displayName || Component.name || 'Unknown'\n}\n\nexport function isResSent(res: ServerResponse) {\n return res.finished || res.headersSent\n}\n\nexport function normalizeRepeatedSlashes(url: string) {\n const urlParts = url.split('?')\n const urlNoQuery = urlParts[0]\n\n return (\n urlNoQuery\n // first we replace any non-encoded backslashes with forward\n // then normalize repeated forward slashes\n .replace(/\\\\/g, '/')\n .replace(/\\/\\/+/g, '/') +\n (urlParts[1] ? `?${urlParts.slice(1).join('?')}` : '')\n )\n}\n\nexport async function loadGetInitialProps<\n C extends BaseContext,\n IP = {},\n P = {},\n>(App: NextComponentType<C, IP, P>, ctx: C): Promise<IP> {\n if (process.env.NODE_ENV !== 'production') {\n if (App.prototype?.getInitialProps) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" is defined as an instance method - visit https://nextjs.org/docs/messages/get-initial-props-as-an-instance-method for more information.`\n throw new Error(message)\n }\n }\n // when called from _app `ctx` is nested in `ctx`\n const res = ctx.res || (ctx.ctx && ctx.ctx.res)\n\n if (!App.getInitialProps) {\n if (ctx.ctx && ctx.Component) {\n // @ts-ignore pageProps default\n return {\n pageProps: await loadGetInitialProps(ctx.Component, ctx.ctx),\n }\n }\n return {} as IP\n }\n\n const props = await App.getInitialProps(ctx)\n\n if (res && isResSent(res)) {\n return props\n }\n\n if (!props) {\n const message = `\"${getDisplayName(\n App\n )}.getInitialProps()\" should resolve to an object. But found \"${props}\" instead.`\n throw new Error(message)\n }\n\n if (process.env.NODE_ENV !== 'production') {\n if (Object.keys(props).length === 0 && !ctx.ctx) {\n console.warn(\n `${getDisplayName(\n App\n )} returned an empty object from \\`getInitialProps\\`. This de-optimizes and prevents automatic static optimization. https://nextjs.org/docs/messages/empty-object-getInitialProps`\n )\n }\n }\n\n return props\n}\n\nexport const SP = typeof performance !== 'undefined'\nexport const ST =\n SP &&\n (['mark', 'measure', 'getEntriesByName'] as const).every(\n (method) => typeof performance[method] === 'function'\n )\n\nexport class DecodeError extends Error {}\nexport class NormalizeError extends Error {}\nexport class PageNotFoundError extends Error {\n code: string\n\n constructor(page: string) {\n super()\n this.code = 'ENOENT'\n this.name = 'PageNotFoundError'\n this.message = `Cannot find module for page: ${page}`\n }\n}\n\nexport class MissingStaticPage extends Error {\n constructor(page: string, message: string) {\n super()\n this.message = `Failed to load static file for page: ${page} ${message}`\n }\n}\n\nexport class MiddlewareNotFoundError extends Error {\n code: string\n constructor() {\n super()\n this.code = 'ENOENT'\n this.message = `Cannot find the middleware module`\n }\n}\n\nexport interface CacheFs {\n existsSync: typeof fs.existsSync\n readFile: typeof fs.promises.readFile\n readFileSync: typeof fs.readFileSync\n writeFile(f: string, d: any): Promise<void>\n mkdir(dir: string): Promise<void | string>\n stat(f: string): Promise<{ mtime: Date }>\n}\n\nexport function stringifyError(error: Error) {\n return JSON.stringify({ message: error.message, stack: error.stack })\n}\n","/**\n * Removes the trailing slash for a given route or page path. Preserves the\n * root page. Examples:\n * - `/foo/bar/` -> `/foo/bar`\n * - `/foo/bar` -> `/foo/bar`\n * - `/` -> `/`\n */\nexport function removeTrailingSlash(route: string) {\n return route.replace(/\\/$/, '') || '/'\n}\n","/**\n * Given a path this function will find the pathname, query and hash and return\n * them. This is useful to parse full paths on the client side.\n * @param path A path to parse e.g. /foo/bar?id=1#hash\n */\nexport function parsePath(path: string) {\n const hashIndex = path.indexOf('#')\n const queryIndex = path.indexOf('?')\n const hasQuery = queryIndex > -1 && (hashIndex < 0 || queryIndex < hashIndex)\n\n if (hasQuery || hashIndex > -1) {\n return {\n pathname: path.substring(0, hasQuery ? queryIndex : hashIndex),\n query: hasQuery\n ? path.substring(queryIndex, hashIndex > -1 ? hashIndex : undefined)\n : '',\n hash: hashIndex > -1 ? path.slice(hashIndex) : '',\n }\n }\n\n return { pathname: path, query: '', hash: '' }\n}\n","import { removeTrailingSlash } from '../shared/lib/router/utils/remove-trailing-slash'\nimport { parsePath } from '../shared/lib/router/utils/parse-path'\n\n/**\n * Normalizes the trailing slash of a path according to the `trailingSlash` option\n * in `next.config.js`.\n */\nexport const normalizePathTrailingSlash = (path: string) => {\n if (!path.startsWith('/') || process.env.__NEXT_MANUAL_TRAILING_SLASH) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n if (process.env.__NEXT_TRAILING_SLASH) {\n if (/\\.[^/]+\\/?$/.test(pathname)) {\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n } else if (pathname.endsWith('/')) {\n return `${pathname}${query}${hash}`\n } else {\n return `${pathname}/${query}${hash}`\n }\n }\n\n return `${removeTrailingSlash(pathname)}${query}${hash}`\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Checks if a given path starts with a given prefix. It ensures it matches\n * exactly without containing extra chars. e.g. prefix /docs should replace\n * for /docs, /docs/, /docs/a but not /docsss\n * @param path The path to check.\n * @param prefix The prefix to check against.\n */\nexport function pathHasPrefix(path: string, prefix: string) {\n if (typeof path !== 'string') {\n return false\n }\n\n const { pathname } = parsePath(path)\n return pathname === prefix || pathname.startsWith(prefix + '/')\n}\n","import { pathHasPrefix } from '../shared/lib/router/utils/path-has-prefix'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function hasBasePath(path: string): boolean {\n return pathHasPrefix(path, basePath)\n}\n","import { isAbsoluteUrl, getLocationOrigin } from '../../utils'\nimport { hasBasePath } from '../../../../client/has-base-path'\n\n/**\n * Detects whether a given url is routable by the Next.js router (browser only).\n */\nexport function isLocalURL(url: string): boolean {\n // prevent a hydration mismatch on href for url with anchor refs\n if (!isAbsoluteUrl(url)) return true\n try {\n // absolute urls can be local if they are on the same origin\n const locationOrigin = getLocationOrigin()\n const resolved = new URL(url, locationOrigin)\n return resolved.origin === locationOrigin && hasBasePath(resolved.pathname)\n } catch (_) {\n return false\n }\n}\n","class UrlNode {\n placeholder: boolean = true\n children: Map<string, UrlNode> = new Map()\n slugName: string | null = null\n restSlugName: string | null = null\n optionalRestSlugName: string | null = null\n\n insert(urlPath: string): void {\n this._insert(urlPath.split('/').filter(Boolean), [], false)\n }\n\n smoosh(): string[] {\n return this._smoosh()\n }\n\n private _smoosh(prefix: string = '/'): string[] {\n const childrenPaths = [...this.children.keys()].sort()\n if (this.slugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[]'), 1)\n }\n if (this.restSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[...]'), 1)\n }\n if (this.optionalRestSlugName !== null) {\n childrenPaths.splice(childrenPaths.indexOf('[[...]]'), 1)\n }\n\n const routes = childrenPaths\n .map((c) => this.children.get(c)!._smoosh(`${prefix}${c}/`))\n .reduce((prev, curr) => [...prev, ...curr], [])\n\n if (this.slugName !== null) {\n routes.push(\n ...this.children.get('[]')!._smoosh(`${prefix}[${this.slugName}]/`)\n )\n }\n\n if (!this.placeholder) {\n const r = prefix === '/' ? '/' : prefix.slice(0, -1)\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot define a route with the same specificity as a optional catch-all route (\"${r}\" and \"${r}[[...${this.optionalRestSlugName}]]\").`\n )\n }\n\n routes.unshift(r)\n }\n\n if (this.restSlugName !== null) {\n routes.push(\n ...this.children\n .get('[...]')!\n ._smoosh(`${prefix}[...${this.restSlugName}]/`)\n )\n }\n\n if (this.optionalRestSlugName !== null) {\n routes.push(\n ...this.children\n .get('[[...]]')!\n ._smoosh(`${prefix}[[...${this.optionalRestSlugName}]]/`)\n )\n }\n\n return routes\n }\n\n private _insert(\n urlPaths: string[],\n slugNames: string[],\n isCatchAll: boolean\n ): void {\n if (urlPaths.length === 0) {\n this.placeholder = false\n return\n }\n\n if (isCatchAll) {\n throw new Error(`Catch-all must be the last part of the URL.`)\n }\n\n // The next segment in the urlPaths list\n let nextSegment = urlPaths[0]\n\n // Check if the segment matches `[something]`\n if (nextSegment.startsWith('[') && nextSegment.endsWith(']')) {\n // Strip `[` and `]`, leaving only `something`\n let segmentName = nextSegment.slice(1, -1)\n\n let isOptional = false\n if (segmentName.startsWith('[') && segmentName.endsWith(']')) {\n // Strip optional `[` and `]`, leaving only `something`\n segmentName = segmentName.slice(1, -1)\n isOptional = true\n }\n\n if (segmentName.startsWith('…')) {\n throw new Error(\n `Detected a three-dot character ('…') at ('${segmentName}'). Did you mean ('...')?`\n )\n }\n\n if (segmentName.startsWith('...')) {\n // Strip `...`, leaving only `something`\n segmentName = segmentName.substring(3)\n isCatchAll = true\n }\n\n if (segmentName.startsWith('[') || segmentName.endsWith(']')) {\n throw new Error(\n `Segment names may not start or end with extra brackets ('${segmentName}').`\n )\n }\n\n if (segmentName.startsWith('.')) {\n throw new Error(\n `Segment names may not start with erroneous periods ('${segmentName}').`\n )\n }\n\n function handleSlug(previousSlug: string | null, nextSlug: string) {\n if (previousSlug !== null) {\n // If the specific segment already has a slug but the slug is not `something`\n // This prevents collisions like:\n // pages/[post]/index.js\n // pages/[id]/index.js\n // Because currently multiple dynamic params on the same segment level are not supported\n if (previousSlug !== nextSlug) {\n // TODO: This error seems to be confusing for users, needs an error link, the description can be based on above comment.\n throw new Error(\n `You cannot use different slug names for the same dynamic path ('${previousSlug}' !== '${nextSlug}').`\n )\n }\n }\n\n slugNames.forEach((slug) => {\n if (slug === nextSlug) {\n throw new Error(\n `You cannot have the same slug name \"${nextSlug}\" repeat within a single dynamic path`\n )\n }\n\n if (slug.replace(/\\W/g, '') === nextSegment.replace(/\\W/g, '')) {\n throw new Error(\n `You cannot have the slug names \"${slug}\" and \"${nextSlug}\" differ only by non-word symbols within a single dynamic path`\n )\n }\n })\n\n slugNames.push(nextSlug)\n }\n\n if (isCatchAll) {\n if (isOptional) {\n if (this.restSlugName != null) {\n throw new Error(\n `You cannot use both an required and optional catch-all route at the same level (\"[...${this.restSlugName}]\" and \"${urlPaths[0]}\" ).`\n )\n }\n\n handleSlug(this.optionalRestSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.optionalRestSlugName = segmentName\n // nextSegment is overwritten to [[...]] so that it can later be sorted specifically\n nextSegment = '[[...]]'\n } else {\n if (this.optionalRestSlugName != null) {\n throw new Error(\n `You cannot use both an optional and required catch-all route at the same level (\"[[...${this.optionalRestSlugName}]]\" and \"${urlPaths[0]}\").`\n )\n }\n\n handleSlug(this.restSlugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.restSlugName = segmentName\n // nextSegment is overwritten to [...] so that it can later be sorted specifically\n nextSegment = '[...]'\n }\n } else {\n if (isOptional) {\n throw new Error(\n `Optional route parameters are not yet supported (\"${urlPaths[0]}\").`\n )\n }\n handleSlug(this.slugName, segmentName)\n // slugName is kept as it can only be one particular slugName\n this.slugName = segmentName\n // nextSegment is overwritten to [] so that it can later be sorted specifically\n nextSegment = '[]'\n }\n }\n\n // If this UrlNode doesn't have the nextSegment yet we create a new child UrlNode\n if (!this.children.has(nextSegment)) {\n this.children.set(nextSegment, new UrlNode())\n }\n\n this.children\n .get(nextSegment)!\n ._insert(urlPaths.slice(1), slugNames, isCatchAll)\n }\n}\n\nexport function getSortedRoutes(\n normalizedPages: ReadonlyArray<string>\n): string[] {\n // First the UrlNode is created, and every UrlNode can have only 1 dynamic segment\n // Eg you can't have pages/[post]/abc.js and pages/[hello]/something-else.js\n // Only 1 dynamic segment per nesting level\n\n // So in the case that is test/integration/dynamic-routing it'll be this:\n // pages/[post]/comments.js\n // pages/blog/[post]/comment/[id].js\n // Both are fine because `pages/[post]` and `pages/blog` are on the same level\n // So in this case `UrlNode` created here has `this.slugName === 'post'`\n // And since your PR passed through `slugName` as an array basically it'd including it in too many possibilities\n // Instead what has to be passed through is the upwards path's dynamic names\n const root = new UrlNode()\n\n // Here the `root` gets injected multiple paths, and insert will break them up into sublevels\n normalizedPages.forEach((pagePath) => root.insert(pagePath))\n // Smoosh will then sort those sublevels up to the point where you get the correct route definition priority\n return root.smoosh()\n}\n\nexport function getSortedRouteObjects<T>(\n objects: T[],\n getter: (obj: T) => string\n): T[] {\n // We're assuming here that all the pathnames are unique, that way we can\n // sort the list and use the index as the key.\n const indexes: Record<string, number> = {}\n const pathnames: string[] = []\n for (let i = 0; i < objects.length; i++) {\n const pathname = getter(objects[i])\n indexes[pathname] = i\n pathnames[i] = pathname\n }\n\n // Sort the pathnames.\n const sorted = getSortedRoutes(pathnames)\n\n // Map the sorted pathnames back to the original objects using the new sorted\n // index.\n return sorted.map((pathname) => objects[indexes[pathname]])\n}\n","/**\n * For a given page path, this function ensures that there is a leading slash.\n * If there is not a leading slash, one is added, otherwise it is noop.\n */\nexport function ensureLeadingSlash(path: string) {\n return path.startsWith('/') ? path : `/${path}`\n}\n","import type { Segment } from '../../server/app-render/types'\n\nexport function isGroupSegment(segment: string) {\n // Use array[0] for performant purpose\n return segment[0] === '(' && segment.endsWith(')')\n}\n\nexport function isParallelRouteSegment(segment: string) {\n return segment.startsWith('@') && segment !== '@children'\n}\n\nexport function addSearchParamsIfPageSegment(\n segment: Segment,\n searchParams: Record<string, string | string[] | undefined>\n) {\n const isPageSegment = segment.includes(PAGE_SEGMENT_KEY)\n\n if (isPageSegment) {\n const stringifiedQuery = JSON.stringify(searchParams)\n return stringifiedQuery !== '{}'\n ? PAGE_SEGMENT_KEY + '?' + stringifiedQuery\n : PAGE_SEGMENT_KEY\n }\n\n return segment\n}\n\nexport const PAGE_SEGMENT_KEY = '__PAGE__'\nexport const DEFAULT_SEGMENT_KEY = '__DEFAULT__'\n","import { ensureLeadingSlash } from '../../page-path/ensure-leading-slash'\nimport { isGroupSegment } from '../../segment'\n\n/**\n * Normalizes an app route so it represents the actual request path. Essentially\n * performing the following transformations:\n *\n * - `/(dashboard)/user/[id]/page` to `/user/[id]`\n * - `/(dashboard)/account/page` to `/account`\n * - `/user/[id]/page` to `/user/[id]`\n * - `/account/page` to `/account`\n * - `/page` to `/`\n * - `/(dashboard)/user/[id]/route` to `/user/[id]`\n * - `/(dashboard)/account/route` to `/account`\n * - `/user/[id]/route` to `/user/[id]`\n * - `/account/route` to `/account`\n * - `/route` to `/`\n * - `/` to `/`\n *\n * @param route the app route to normalize\n * @returns the normalized pathname\n */\nexport function normalizeAppPath(route: string) {\n return ensureLeadingSlash(\n route.split('/').reduce((pathname, segment, index, segments) => {\n // Empty segments are ignored.\n if (!segment) {\n return pathname\n }\n\n // Groups are ignored.\n if (isGroupSegment(segment)) {\n return pathname\n }\n\n // Parallel segments are ignored.\n if (segment[0] === '@') {\n return pathname\n }\n\n // The last segment (if it's a leaf) should be ignored.\n if (\n (segment === 'page' || segment === 'route') &&\n index === segments.length - 1\n ) {\n return pathname\n }\n\n return `${pathname}/${segment}`\n }, '')\n )\n}\n\n/**\n * Strips the `.rsc` extension if it's in the pathname.\n * Since this function is used on full urls it checks `?` for searchParams handling.\n */\nexport function normalizeRscURL(url: string) {\n return url.replace(\n /\\.rsc($|\\?)/,\n // $1 ensures `?` is preserved\n '$1'\n )\n}\n","import { normalizeAppPath } from './app-paths'\n\n// order matters here, the first match will be used\nexport const INTERCEPTION_ROUTE_MARKERS = [\n '(..)(..)',\n '(.)',\n '(..)',\n '(...)',\n] as const\n\nexport function isInterceptionRouteAppPath(path: string): boolean {\n // TODO-APP: add more serious validation\n return (\n path\n .split('/')\n .find((segment) =>\n INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n ) !== undefined\n )\n}\n\nexport function extractInterceptionRouteInformation(path: string) {\n let interceptingRoute: string | undefined,\n marker: (typeof INTERCEPTION_ROUTE_MARKERS)[number] | undefined,\n interceptedRoute: string | undefined\n\n for (const segment of path.split('/')) {\n marker = INTERCEPTION_ROUTE_MARKERS.find((m) => segment.startsWith(m))\n if (marker) {\n ;[interceptingRoute, interceptedRoute] = path.split(marker, 2)\n break\n }\n }\n\n if (!interceptingRoute || !marker || !interceptedRoute) {\n throw new Error(\n `Invalid interception route: ${path}. Must be in the format /<intercepting route>/(..|...|..)(..)/<intercepted route>`\n )\n }\n\n interceptingRoute = normalizeAppPath(interceptingRoute) // normalize the path, e.g. /(blog)/feed -> /feed\n\n switch (marker) {\n case '(.)':\n // (.) indicates that we should match with sibling routes, so we just need to append the intercepted route to the intercepting route\n if (interceptingRoute === '/') {\n interceptedRoute = `/${interceptedRoute}`\n } else {\n interceptedRoute = interceptingRoute + '/' + interceptedRoute\n }\n break\n case '(..)':\n // (..) indicates that we should match at one level up, so we need to remove the last segment of the intercepting route\n if (interceptingRoute === '/') {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..) marker at the root level, use (.) instead.`\n )\n }\n interceptedRoute = interceptingRoute\n .split('/')\n .slice(0, -1)\n .concat(interceptedRoute)\n .join('/')\n break\n case '(...)':\n // (...) will match the route segment in the root directory, so we need to use the root directory to prepend the intercepted route\n interceptedRoute = '/' + interceptedRoute\n break\n case '(..)(..)':\n // (..)(..) indicates that we should match at two levels up, so we need to remove the last two segments of the intercepting route\n\n const splitInterceptingRoute = interceptingRoute.split('/')\n if (splitInterceptingRoute.length <= 2) {\n throw new Error(\n `Invalid interception route: ${path}. Cannot use (..)(..) marker at the root level or one level up.`\n )\n }\n\n interceptedRoute = splitInterceptingRoute\n .slice(0, -2)\n .concat(interceptedRoute)\n .join('/')\n break\n default:\n throw new Error('Invariant: unexpected marker')\n }\n\n return { interceptingRoute, interceptedRoute }\n}\n","import {\n extractInterceptionRouteInformation,\n isInterceptionRouteAppPath,\n} from './interception-routes'\n\n// Identify /.*[param].*/ in route string\nconst TEST_ROUTE = /\\/[^/]*\\[[^/]+\\][^/]*(?=\\/|$)/\n\n// Identify /[param]/ in route string\nconst TEST_STRICT_ROUTE = /\\/\\[[^/]+\\](?=\\/|$)/\n\n/**\n * Check if a route is dynamic.\n *\n * @param route - The route to check.\n * @param strict - Whether to use strict mode which prohibits segments with prefixes/suffixes (default: true).\n * @returns Whether the route is dynamic.\n */\nexport function isDynamicRoute(route: string, strict: boolean = true): boolean {\n if (isInterceptionRouteAppPath(route)) {\n route = extractInterceptionRouteInformation(route).interceptedRoute\n }\n\n if (strict) {\n return TEST_STRICT_ROUTE.test(route)\n }\n\n return TEST_ROUTE.test(route)\n}\n","export { getSortedRoutes, getSortedRouteObjects } from './sorted-routes'\nexport { isDynamicRoute } from './is-dynamic'\n","import type { Group } from './route-regex'\nimport { DecodeError } from '../../utils'\nimport type { Params } from '../../../../server/request/params'\n\nexport interface RouteMatchFn {\n (pathname: string): false | Params\n}\n\ntype RouteMatcherOptions = {\n // We only use the exec method of the RegExp object. This helps us avoid using\n // type assertions that the passed in properties are of the correct type.\n re: Pick<RegExp, 'exec'>\n groups: Record<string, Group>\n}\n\nexport function getRouteMatcher({\n re,\n groups,\n}: RouteMatcherOptions): RouteMatchFn {\n return (pathname: string) => {\n const routeMatch = re.exec(pathname)\n if (!routeMatch) return false\n\n const decode = (param: string) => {\n try {\n return decodeURIComponent(param)\n } catch {\n throw new DecodeError('failed to decode param')\n }\n }\n\n const params: Params = {}\n for (const [key, group] of Object.entries(groups)) {\n const match = routeMatch[group.pos]\n if (match !== undefined) {\n if (group.repeat) {\n params[key] = match.split('/').map((entry) => decode(entry))\n } else {\n params[key] = decode(match)\n }\n }\n }\n\n return params\n }\n}\n","import type { ServerRuntime } from '../types'\n\nexport const NEXT_QUERY_PARAM_PREFIX = 'nxtP'\nexport const NEXT_INTERCEPTION_MARKER_PREFIX = 'nxtI'\n\nexport const MATCHED_PATH_HEADER = 'x-matched-path'\nexport const PRERENDER_REVALIDATE_HEADER = 'x-prerender-revalidate'\nexport const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =\n 'x-prerender-revalidate-if-generated'\n\nexport const RSC_PREFETCH_SUFFIX = '.prefetch.rsc'\nexport const RSC_SEGMENTS_DIR_SUFFIX = '.segments'\nexport const RSC_SEGMENT_SUFFIX = '.segment.rsc'\nexport const RSC_SUFFIX = '.rsc'\nexport const ACTION_SUFFIX = '.action'\nexport const NEXT_DATA_SUFFIX = '.json'\nexport const NEXT_META_SUFFIX = '.meta'\nexport const NEXT_BODY_SUFFIX = '.body'\n\nexport const NEXT_CACHE_TAGS_HEADER = 'x-next-cache-tags'\nexport const NEXT_CACHE_REVALIDATED_TAGS_HEADER = 'x-next-revalidated-tags'\nexport const NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER =\n 'x-next-revalidate-tag-token'\n\nexport const NEXT_RESUME_HEADER = 'next-resume'\n\n// if these change make sure we update the related\n// documentation as well\nexport const NEXT_CACHE_TAG_MAX_ITEMS = 128\nexport const NEXT_CACHE_TAG_MAX_LENGTH = 256\nexport const NEXT_CACHE_SOFT_TAG_MAX_LENGTH = 1024\nexport const NEXT_CACHE_IMPLICIT_TAG_ID = '_N_T_'\n\n// in seconds\nexport const CACHE_ONE_YEAR = 31536000\n\n// in seconds, represents revalidate=false. I.e. never revaliate.\n// We use this value since it can be represented as a V8 SMI for optimal performance.\n// It can also be serialized as JSON if it ever leaks accidentally as an actual value.\nexport const INFINITE_CACHE = 0xfffffffe\n\n// Patterns to detect middleware files\nexport const MIDDLEWARE_FILENAME = 'middleware'\nexport const MIDDLEWARE_LOCATION_REGEXP = `(?:src/)?${MIDDLEWARE_FILENAME}`\n\n// Pattern to detect instrumentation hooks file\nexport const INSTRUMENTATION_HOOK_FILENAME = 'instrumentation'\n\n// Because on Windows absolute paths in the generated code can break because of numbers, eg 1 in the path,\n// we have to use a private alias\nexport const PAGES_DIR_ALIAS = 'private-next-pages'\nexport const DOT_NEXT_ALIAS = 'private-dot-next'\nexport const ROOT_DIR_ALIAS = 'private-next-root-dir'\nexport const APP_DIR_ALIAS = 'private-next-app-dir'\nexport const RSC_MOD_REF_PROXY_ALIAS = 'private-next-rsc-mod-ref-proxy'\nexport const RSC_ACTION_VALIDATE_ALIAS = 'private-next-rsc-action-validate'\nexport const RSC_ACTION_PROXY_ALIAS = 'private-next-rsc-server-reference'\nexport const RSC_CACHE_WRAPPER_ALIAS = 'private-next-rsc-cache-wrapper'\nexport const RSC_ACTION_ENCRYPTION_ALIAS = 'private-next-rsc-action-encryption'\nexport const RSC_ACTION_CLIENT_WRAPPER_ALIAS =\n 'private-next-rsc-action-client-wrapper'\n\nexport const PUBLIC_DIR_MIDDLEWARE_CONFLICT = `You can not have a '_next' folder inside of your public folder. This conflicts with the internal '/_next' route. https://nextjs.org/docs/messages/public-next-folder-conflict`\n\nexport const SSG_GET_INITIAL_PROPS_CONFLICT = `You can not use getInitialProps with getStaticProps. To use SSG, please remove your getInitialProps`\n\nexport const SERVER_PROPS_GET_INIT_PROPS_CONFLICT = `You can not use getInitialProps with getServerSideProps. Please remove getInitialProps.`\n\nexport const SERVER_PROPS_SSG_CONFLICT = `You can not use getStaticProps or getStaticPaths with getServerSideProps. To use SSG, please remove getServerSideProps`\n\nexport const STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR = `can not have getInitialProps/getServerSideProps, https://nextjs.org/docs/messages/404-get-initial-props`\n\nexport const SERVER_PROPS_EXPORT_ERROR = `pages with \\`getServerSideProps\\` can not be exported. See more info here: https://nextjs.org/docs/messages/gssp-export`\n\nexport const GSP_NO_RETURNED_VALUE =\n 'Your `getStaticProps` function did not return an object. Did you forget to add a `return`?'\nexport const GSSP_NO_RETURNED_VALUE =\n 'Your `getServerSideProps` function did not return an object. Did you forget to add a `return`?'\n\nexport const UNSTABLE_REVALIDATE_RENAME_ERROR =\n 'The `unstable_revalidate` property is available for general use.\\n' +\n 'Please use `revalidate` instead.'\n\nexport const GSSP_COMPONENT_MEMBER_ERROR = `can not be attached to a page's component and must be exported from the page. See more info here: https://nextjs.org/docs/messages/gssp-component-member`\n\nexport const NON_STANDARD_NODE_ENV = `You are using a non-standard \"NODE_ENV\" value in your environment. This creates inconsistencies in the project and is strongly advised against. Read more: https://nextjs.org/docs/messages/non-standard-node-env`\n\nexport const SSG_FALLBACK_EXPORT_ERROR = `Pages with \\`fallback\\` enabled in \\`getStaticPaths\\` can not be exported. See more info here: https://nextjs.org/docs/messages/ssg-fallback-true-export`\n\nexport const ESLINT_DEFAULT_DIRS = ['app', 'pages', 'components', 'lib', 'src']\n\nexport const SERVER_RUNTIME: Record<string, ServerRuntime> = {\n edge: 'edge',\n experimentalEdge: 'experimental-edge',\n nodejs: 'nodejs',\n}\n\n/**\n * The names of the webpack layers. These layers are the primitives for the\n * webpack chunks.\n */\nconst WEBPACK_LAYERS_NAMES = {\n /**\n * The layer for the shared code between the client and server bundles.\n */\n shared: 'shared',\n /**\n * The layer for server-only runtime and picking up `react-server` export conditions.\n * Including app router RSC pages and app router custom routes and metadata routes.\n */\n reactServerComponents: 'rsc',\n /**\n * Server Side Rendering layer for app (ssr).\n */\n serverSideRendering: 'ssr',\n /**\n * The browser client bundle layer for actions.\n */\n actionBrowser: 'action-browser',\n /**\n * The Node.js bundle layer for the API routes.\n */\n apiNode: 'api-node',\n /**\n * The Edge Lite bundle layer for the API routes.\n */\n apiEdge: 'api-edge',\n /**\n * The layer for the middleware code.\n */\n middleware: 'middleware',\n /**\n * The layer for the instrumentation hooks.\n */\n instrument: 'instrument',\n /**\n * The layer for assets on the edge.\n */\n edgeAsset: 'edge-asset',\n /**\n * The browser client bundle layer for App directory.\n */\n appPagesBrowser: 'app-pages-browser',\n /**\n * The browser client bundle layer for Pages directory.\n */\n pagesDirBrowser: 'pages-dir-browser',\n /**\n * The Edge Lite bundle layer for Pages directory.\n */\n pagesDirEdge: 'pages-dir-edge',\n /**\n * The Node.js bundle layer for Pages directory.\n */\n pagesDirNode: 'pages-dir-node',\n} as const\n\nexport type WebpackLayerName =\n (typeof WEBPACK_LAYERS_NAMES)[keyof typeof WEBPACK_LAYERS_NAMES]\n\nconst WEBPACK_LAYERS = {\n ...WEBPACK_LAYERS_NAMES,\n GROUP: {\n builtinReact: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n serverOnly: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n neutralTarget: [\n // pages api\n WEBPACK_LAYERS_NAMES.apiNode,\n WEBPACK_LAYERS_NAMES.apiEdge,\n ],\n clientOnly: [\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n ],\n bundled: [\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.shared,\n WEBPACK_LAYERS_NAMES.instrument,\n WEBPACK_LAYERS_NAMES.middleware,\n ],\n appPages: [\n // app router pages and layouts\n WEBPACK_LAYERS_NAMES.reactServerComponents,\n WEBPACK_LAYERS_NAMES.serverSideRendering,\n WEBPACK_LAYERS_NAMES.appPagesBrowser,\n WEBPACK_LAYERS_NAMES.actionBrowser,\n ],\n },\n}\n\nconst WEBPACK_RESOURCE_QUERIES = {\n edgeSSREntry: '__next_edge_ssr_entry__',\n metadata: '__next_metadata__',\n metadataRoute: '__next_metadata_route__',\n metadataImageMeta: '__next_metadata_image_meta__',\n}\n\nexport { WEBPACK_LAYERS, WEBPACK_RESOURCE_QUERIES }\n","// regexp is based on https://github.com/sindresorhus/escape-string-regexp\nconst reHasRegExp = /[|\\\\{}()[\\]^$+*?.-]/\nconst reReplaceRegExp = /[|\\\\{}()[\\]^$+*?.-]/g\n\nexport function escapeStringRegexp(str: string) {\n // see also: https://github.com/lodash/lodash/blob/2da024c3b4f9947a48517639de7560457cd4ec6c/escapeRegExp.js#L23\n if (reHasRegExp.test(str)) {\n return str.replace(reReplaceRegExp, '\\\\$&')\n }\n return str\n}\n","import {\n NEXT_INTERCEPTION_MARKER_PREFIX,\n NEXT_QUERY_PARAM_PREFIX,\n} from '../../../../lib/constants'\nimport { INTERCEPTION_ROUTE_MARKERS } from './interception-routes'\nimport { escapeStringRegexp } from '../../escape-regexp'\nimport { removeTrailingSlash } from './remove-trailing-slash'\n\nexport interface Group {\n pos: number\n repeat: boolean\n optional: boolean\n}\n\nexport interface RouteRegex {\n groups: { [groupName: string]: Group }\n re: RegExp\n}\n\ntype GetNamedRouteRegexOptions = {\n /**\n * Whether to prefix the route keys with the NEXT_INTERCEPTION_MARKER_PREFIX\n * or NEXT_QUERY_PARAM_PREFIX. This is only relevant when creating the\n * routes-manifest during the build.\n */\n prefixRouteKeys: boolean\n\n /**\n * Whether to include the suffix in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n\n /**\n * Whether to backtrack duplicate keys. This is only relevant when creating\n * the routes-manifest during the build.\n */\n backreferenceDuplicateKeys?: boolean\n}\n\ntype GetRouteRegexOptions = {\n /**\n * Whether to include extra parts in the route regex. This means that when you\n * have something like `/[...slug].json` the `.json` part will be included\n * in the regex, yielding `/(.*).json` as the regex.\n */\n includeSuffix?: boolean\n\n /**\n * Whether to include the prefix in the route regex. This means that when you\n * have something like `/[...slug].json` the `/` part will be included\n * in the regex, yielding `^/(.*).json$` as the regex.\n *\n * Note that interception markers will already be included without the need\n * of adding this option.\n */\n includePrefix?: boolean\n\n /**\n * Whether to exclude the optional trailing slash from the route regex.\n */\n excludeOptionalTrailingSlash?: boolean\n}\n\n/**\n * Regular expression pattern used to match route parameters.\n * Matches both single parameters and parameter groups.\n * Examples:\n * - `[[...slug]]` matches parameter group with key 'slug', repeat: true, optional: true\n * - `[...slug]` matches parameter group with key 'slug', repeat: true, optional: false\n * - `[[foo]]` matches parameter with key 'foo', repeat: false, optional: true\n * - `[bar]` matches parameter with key 'bar', repeat: false, optional: false\n */\nconst PARAMETER_PATTERN = /^([^[]*)\\[((?:\\[[^\\]]*\\])|[^\\]]+)\\](.*)$/\n\n/**\n * Parses a given parameter from a route to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[[...slug]]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[[foo]]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `[bar]` -> `{ key: 'bar', repeat: false, optional: false }`\n * - `fizz` -> `{ key: 'fizz', repeat: false, optional: false }`\n * @param param - The parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nexport function parseParameter(param: string) {\n const match = param.match(PARAMETER_PATTERN)\n\n if (!match) {\n return parseMatchedParameter(param)\n }\n\n return parseMatchedParameter(match[2])\n}\n\n/**\n * Parses a matched parameter from the PARAMETER_PATTERN regex to a data structure that can be used\n * to generate the parametrized route.\n * Examples:\n * - `[...slug]` -> `{ key: 'slug', repeat: true, optional: true }`\n * - `...slug` -> `{ key: 'slug', repeat: true, optional: false }`\n * - `[foo]` -> `{ key: 'foo', repeat: false, optional: true }`\n * - `bar` -> `{ key: 'bar', repeat: false, optional: false }`\n * @param param - The matched parameter to parse.\n * @returns The parsed parameter as a data structure.\n */\nfunction parseMatchedParameter(param: string) {\n const optional = param.startsWith('[') && param.endsWith(']')\n if (optional) {\n param = param.slice(1, -1)\n }\n const repeat = param.startsWith('...')\n if (repeat) {\n param = param.slice(3)\n }\n return { key: param, repeat, optional }\n}\n\nfunction getParametrizedRoute(\n route: string,\n includeSuffix: boolean,\n includePrefix: boolean\n) {\n const groups: { [groupName: string]: Group } = {}\n let groupIndex = 1\n\n const segments: string[] = []\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const markerMatch = INTERCEPTION_ROUTE_MARKERS.find((m) =>\n segment.startsWith(m)\n )\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n if (markerMatch && paramMatches && paramMatches[2]) {\n const { key, optional, repeat } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n segments.push(`/${escapeStringRegexp(markerMatch)}([^/]+?)`)\n } else if (paramMatches && paramMatches[2]) {\n const { key, repeat, optional } = parseMatchedParameter(paramMatches[2])\n groups[key] = { pos: groupIndex++, repeat, optional }\n\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n }\n\n let s = repeat ? (optional ? '(?:/(.+?))?' : '/(.+?)') : '/([^/]+?)'\n\n // Remove the leading slash if includePrefix already added it.\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n }\n }\n\n return {\n parameterizedRoute: segments.join(''),\n groups,\n }\n}\n\n/**\n * From a normalized route this function generates a regular expression and\n * a corresponding groups object intended to be used to store matching groups\n * from the regular expression.\n */\nexport function getRouteRegex(\n normalizedRoute: string,\n {\n includeSuffix = false,\n includePrefix = false,\n excludeOptionalTrailingSlash = false,\n }: GetRouteRegexOptions = {}\n): RouteRegex {\n const { parameterizedRoute, groups } = getParametrizedRoute(\n normalizedRoute,\n includeSuffix,\n includePrefix\n )\n\n let re = parameterizedRoute\n if (!excludeOptionalTrailingSlash) {\n re += '(?:/)?'\n }\n\n return {\n re: new RegExp(`^${re}$`),\n groups: groups,\n }\n}\n\n/**\n * Builds a function to generate a minimal routeKey using only a-z and minimal\n * number of characters.\n */\nfunction buildGetSafeRouteKey() {\n let i = 0\n\n return () => {\n let routeKey = ''\n let j = ++i\n while (j > 0) {\n routeKey += String.fromCharCode(97 + ((j - 1) % 26))\n j = Math.floor((j - 1) / 26)\n }\n return routeKey\n }\n}\n\nfunction getSafeKeyFromSegment({\n interceptionMarker,\n getSafeRouteKey,\n segment,\n routeKeys,\n keyPrefix,\n backreferenceDuplicateKeys,\n}: {\n interceptionMarker?: string\n getSafeRouteKey: () => string\n segment: string\n routeKeys: Record<string, string>\n keyPrefix?: string\n backreferenceDuplicateKeys: boolean\n}) {\n const { key, optional, repeat } = parseMatchedParameter(segment)\n\n // replace any non-word characters since they can break\n // the named regex\n let cleanedKey = key.replace(/\\W/g, '')\n\n if (keyPrefix) {\n cleanedKey = `${keyPrefix}${cleanedKey}`\n }\n let invalidKey = false\n\n // check if the key is still invalid and fallback to using a known\n // safe key\n if (cleanedKey.length === 0 || cleanedKey.length > 30) {\n invalidKey = true\n }\n if (!isNaN(parseInt(cleanedKey.slice(0, 1)))) {\n invalidKey = true\n }\n\n if (invalidKey) {\n cleanedKey = getSafeRouteKey()\n }\n\n const duplicateKey = cleanedKey in routeKeys\n\n if (keyPrefix) {\n routeKeys[cleanedKey] = `${keyPrefix}${key}`\n } else {\n routeKeys[cleanedKey] = key\n }\n\n // if the segment has an interception marker, make sure that's part of the regex pattern\n // this is to ensure that the route with the interception marker doesn't incorrectly match\n // the non-intercepted route (ie /app/(.)[username] should not match /app/[username])\n const interceptionPrefix = interceptionMarker\n ? escapeStringRegexp(interceptionMarker)\n : ''\n\n let pattern: string\n if (duplicateKey && backreferenceDuplicateKeys) {\n // Use a backreference to the key to ensure that the key is the same value\n // in each of the placeholders.\n pattern = `\\\\k<${cleanedKey}>`\n } else if (repeat) {\n pattern = `(?<${cleanedKey}>.+?)`\n } else {\n pattern = `(?<${cleanedKey}>[^/]+?)`\n }\n\n return optional\n ? `(?:/${interceptionPrefix}${pattern})?`\n : `/${interceptionPrefix}${pattern}`\n}\n\nfunction getNamedParametrizedRoute(\n route: string,\n prefixRouteKeys: boolean,\n includeSuffix: boolean,\n includePrefix: boolean,\n backreferenceDuplicateKeys: boolean\n) {\n const getSafeRouteKey = buildGetSafeRouteKey()\n const routeKeys: { [named: string]: string } = {}\n\n const segments: string[] = []\n for (const segment of removeTrailingSlash(route).slice(1).split('/')) {\n const hasInterceptionMarker = INTERCEPTION_ROUTE_MARKERS.some((m) =>\n segment.startsWith(m)\n )\n\n const paramMatches = segment.match(PARAMETER_PATTERN) // Check for parameters\n\n if (hasInterceptionMarker && paramMatches && paramMatches[2]) {\n // If there's an interception marker, add it to the segments.\n segments.push(\n getSafeKeyFromSegment({\n getSafeRouteKey,\n interceptionMarker: paramMatches[1],\n segment: paramMatches[2],\n routeKeys,\n keyPrefix: prefixRouteKeys\n ? NEXT_INTERCEPTION_MARKER_PREFIX\n : undefined,\n backreferenceDuplicateKeys,\n })\n )\n } else if (paramMatches && paramMatches[2]) {\n // If there's a prefix, add it to the segments if it's enabled.\n if (includePrefix && paramMatches[1]) {\n segments.push(`/${escapeStringRegexp(paramMatches[1])}`)\n }\n\n let s = getSafeKeyFromSegment({\n getSafeRouteKey,\n segment: paramMatches[2],\n routeKeys,\n keyPrefix: prefixRouteKeys ? NEXT_QUERY_PARAM_PREFIX : undefined,\n backreferenceDuplicateKeys,\n })\n\n // Remove the leading slash if includePrefix already added it.\n if (includePrefix && paramMatches[1]) {\n s = s.substring(1)\n }\n\n segments.push(s)\n } else {\n segments.push(`/${escapeStringRegexp(segment)}`)\n }\n\n // If there's a suffix, add it to the segments if it's enabled.\n if (includeSuffix && paramMatches && paramMatches[3]) {\n segments.push(escapeStringRegexp(paramMatches[3]))\n }\n }\n\n return {\n namedParameterizedRoute: segments.join(''),\n routeKeys,\n }\n}\n\n/**\n * This function extends `getRouteRegex` generating also a named regexp where\n * each group is named along with a routeKeys object that indexes the assigned\n * named group with its corresponding key. When the routeKeys need to be\n * prefixed to uniquely identify internally the \"prefixRouteKey\" arg should\n * be \"true\" currently this is only the case when creating the routes-manifest\n * during the build\n */\nexport function getNamedRouteRegex(\n normalizedRoute: string,\n options: GetNamedRouteRegexOptions\n) {\n const result = getNamedParametrizedRoute(\n normalizedRoute,\n options.prefixRouteKeys,\n options.includeSuffix ?? false,\n options.includePrefix ?? false,\n options.backreferenceDuplicateKeys ?? false\n )\n\n let namedRegex = result.namedParameterizedRoute\n if (!options.excludeOptionalTrailingSlash) {\n namedRegex += '(?:/)?'\n }\n\n return {\n ...getRouteRegex(normalizedRoute, options),\n namedRegex: `^${namedRegex}$`,\n routeKeys: result.routeKeys,\n }\n}\n\n/**\n * Generates a named regexp.\n * This is intended to be using for build time only.\n */\nexport function getNamedMiddlewareRegex(\n normalizedRoute: string,\n options: {\n catchAll?: boolean\n }\n) {\n const { parameterizedRoute } = getParametrizedRoute(\n normalizedRoute,\n false,\n false\n )\n const { catchAll = true } = options\n if (parameterizedRoute === '/') {\n let catchAllRegex = catchAll ? '.*' : ''\n return {\n namedRegex: `^/${catchAllRegex}$`,\n }\n }\n\n const { namedParameterizedRoute } = getNamedParametrizedRoute(\n normalizedRoute,\n false,\n false,\n false,\n false\n )\n let catchAllGroupedRegex = catchAll ? '(?:(/.*)?)' : ''\n return {\n namedRegex: `^${namedParameterizedRoute}${catchAllGroupedRegex}$`,\n }\n}\n","import type { ParsedUrlQuery } from 'querystring'\n\nimport { getRouteMatcher } from './route-matcher'\nimport { getRouteRegex } from './route-regex'\n\nexport function interpolateAs(\n route: string,\n asPathname: string,\n query: ParsedUrlQuery\n) {\n let interpolatedRoute = ''\n\n const dynamicRegex = getRouteRegex(route)\n const dynamicGroups = dynamicRegex.groups\n const dynamicMatches =\n // Try to match the dynamic route against the asPath\n (asPathname !== route ? getRouteMatcher(dynamicRegex)(asPathname) : '') ||\n // Fall back to reading the values from the href\n // TODO: should this take priority; also need to change in the router.\n query\n\n interpolatedRoute = route\n const params = Object.keys(dynamicGroups)\n\n if (\n !params.every((param) => {\n let value = dynamicMatches[param] || ''\n const { repeat, optional } = dynamicGroups[param]\n\n // support single-level catch-all\n // TODO: more robust handling for user-error (passing `/`)\n let replaced = `[${repeat ? '...' : ''}${param}]`\n if (optional) {\n replaced = `${!value ? '/' : ''}[${replaced}]`\n }\n if (repeat && !Array.isArray(value)) value = [value]\n\n return (\n (optional || param in dynamicMatches) &&\n // Interpolate group into data URL if present\n (interpolatedRoute =\n interpolatedRoute!.replace(\n replaced,\n repeat\n ? (value as string[])\n .map(\n // these values should be fully encoded instead of just\n // path delimiter escaped since they are being inserted\n // into the URL and we expect URL encoded segments\n // when parsing dynamic route params\n (segment) => encodeURIComponent(segment)\n )\n .join('/')\n : encodeURIComponent(value as string)\n ) || '/')\n )\n })\n ) {\n interpolatedRoute = '' // did not satisfy all requirements\n\n // n.b. We ignore this error because we handle warning for this case in\n // development in the `<Link>` component directly.\n }\n return {\n params,\n result: interpolatedRoute,\n }\n}\n","import type { NextRouter, Url } from '../shared/lib/router/router'\n\nimport { searchParamsToUrlQuery } from '../shared/lib/router/utils/querystring'\nimport { formatWithValidation } from '../shared/lib/router/utils/format-url'\nimport { omit } from '../shared/lib/router/utils/omit'\nimport { normalizeRepeatedSlashes } from '../shared/lib/utils'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\nimport { isLocalURL } from '../shared/lib/router/utils/is-local-url'\nimport { isDynamicRoute } from '../shared/lib/router/utils'\nimport { interpolateAs } from '../shared/lib/router/utils/interpolate-as'\n\n/**\n * Resolves a given hyperlink with a certain router state (basePath not included).\n * Preserves absolute urls.\n */\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs: true\n): [string, string] | [string]\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: false\n): string\nexport function resolveHref(\n router: NextRouter,\n href: Url,\n resolveAs?: boolean\n): [string, string] | [string] | string {\n // we use a dummy base url for relative urls\n let base: URL\n let urlAsString = typeof href === 'string' ? href : formatWithValidation(href)\n\n // repeated slashes and backslashes in the URL are considered\n // invalid and will never match a Next.js page/file\n const urlProtoMatch = urlAsString.match(/^[a-zA-Z]{1,}:\\/\\//)\n const urlAsStringNoProto = urlProtoMatch\n ? urlAsString.slice(urlProtoMatch[0].length)\n : urlAsString\n\n const urlParts = urlAsStringNoProto.split('?', 1)\n\n if ((urlParts[0] || '').match(/(\\/\\/|\\\\)/)) {\n console.error(\n `Invalid href '${urlAsString}' passed to next/router in page: '${router.pathname}'. Repeated forward-slashes (//) or backslashes \\\\ are not valid in the href.`\n )\n const normalizedUrl = normalizeRepeatedSlashes(urlAsStringNoProto)\n urlAsString = (urlProtoMatch ? urlProtoMatch[0] : '') + normalizedUrl\n }\n\n // Return because it cannot be routed by the Next.js router\n if (!isLocalURL(urlAsString)) {\n return (resolveAs ? [urlAsString] : urlAsString) as string\n }\n\n try {\n base = new URL(\n urlAsString.startsWith('#') ? router.asPath : router.pathname,\n 'http://n'\n )\n } catch (_) {\n // fallback to / for invalid asPath values e.g. //\n base = new URL('/', 'http://n')\n }\n\n try {\n const finalUrl = new URL(urlAsString, base)\n finalUrl.pathname = normalizePathTrailingSlash(finalUrl.pathname)\n let interpolatedAs = ''\n\n if (\n isDynamicRoute(finalUrl.pathname) &&\n finalUrl.searchParams &&\n resolveAs\n ) {\n const query = searchParamsToUrlQuery(finalUrl.searchParams)\n\n const { result, params } = interpolateAs(\n finalUrl.pathname,\n finalUrl.pathname,\n query\n )\n\n if (result) {\n interpolatedAs = formatWithValidation({\n pathname: result,\n hash: finalUrl.hash,\n query: omit(query, params),\n })\n }\n }\n\n // if the origin didn't change, it means we received a relative href\n const resolvedHref =\n finalUrl.origin === base.origin\n ? finalUrl.href.slice(finalUrl.origin.length)\n : finalUrl.href\n\n return resolveAs\n ? [resolvedHref, interpolatedAs || resolvedHref]\n : resolvedHref\n } catch (_) {\n return resolveAs ? [urlAsString] : urlAsString\n }\n}\n","import { parsePath } from './parse-path'\n\n/**\n * Adds the provided prefix to the given path. It first ensures that the path\n * is indeed starting with a slash.\n */\nexport function addPathPrefix(path: string, prefix?: string) {\n if (!path.startsWith('/') || !prefix) {\n return path\n }\n\n const { pathname, query, hash } = parsePath(path)\n return `${prefix}${pathname}${query}${hash}`\n}\n","import { addPathPrefix } from './add-path-prefix'\nimport { pathHasPrefix } from './path-has-prefix'\n\n/**\n * For a given path and a locale, if the locale is given, it will prefix the\n * locale. The path shouldn't be an API path. If a default locale is given the\n * prefix will be omitted if the locale is already the default locale.\n */\nexport function addLocale(\n path: string,\n locale?: string | false,\n defaultLocale?: string,\n ignorePrefix?: boolean\n) {\n // If no locale was given or the locale is the default locale, we don't need\n // to prefix the path.\n if (!locale || locale === defaultLocale) return path\n\n const lower = path.toLowerCase()\n\n // If the path is an API path or the path already has the locale prefix, we\n // don't need to prefix the path.\n if (!ignorePrefix) {\n if (pathHasPrefix(lower, '/api')) return path\n if (pathHasPrefix(lower, `/${locale.toLowerCase()}`)) return path\n }\n\n // Add the locale prefix to the path.\n return addPathPrefix(path, `/${locale}`)\n}\n","import type { addLocale as Fn } from '../shared/lib/router/utils/add-locale'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nexport const addLocale: typeof Fn = (path, ...args) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return normalizePathTrailingSlash(\n require('../shared/lib/router/utils/add-locale').addLocale(path, ...args)\n )\n }\n return path\n}\n","\"use strict\";\n\nfunction _interop_require_default(obj) {\n return obj && obj.__esModule ? obj : { default: obj };\n}\nexports._ = _interop_require_default;\n","import React from 'react'\nimport type { NextRouter } from './router/router'\n\nexport const RouterContext = React.createContext<NextRouter | null>(null)\n\nif (process.env.NODE_ENV !== 'production') {\n RouterContext.displayName = 'RouterContext'\n}\n","export const requestIdleCallback =\n (typeof self !== 'undefined' &&\n self.requestIdleCallback &&\n self.requestIdleCallback.bind(window)) ||\n function (cb: IdleRequestCallback): number {\n let start = Date.now()\n return self.setTimeout(function () {\n cb({\n didTimeout: false,\n timeRemaining: function () {\n return Math.max(0, 50 - (Date.now() - start))\n },\n })\n }, 1)\n }\n\nexport const cancelIdleCallback =\n (typeof self !== 'undefined' &&\n self.cancelIdleCallback &&\n self.cancelIdleCallback.bind(window)) ||\n function (id: number) {\n return clearTimeout(id)\n }\n","import { useCallback, useEffect, useRef, useState } from 'react'\nimport {\n requestIdleCallback,\n cancelIdleCallback,\n} from './request-idle-callback'\n\ntype UseIntersectionObserverInit = Pick<\n IntersectionObserverInit,\n 'rootMargin' | 'root'\n>\n\ntype UseIntersection = { disabled?: boolean } & UseIntersectionObserverInit & {\n rootRef?: React.RefObject<HTMLElement | null> | null\n }\ntype ObserveCallback = (isVisible: boolean) => void\ntype Identifier = {\n root: Element | Document | null\n margin: string\n}\ntype Observer = {\n id: Identifier\n observer: IntersectionObserver\n elements: Map<Element, ObserveCallback>\n}\n\nconst hasIntersectionObserver = typeof IntersectionObserver === 'function'\n\nconst observers = new Map<Identifier, Observer>()\nconst idList: Identifier[] = []\n\nfunction createObserver(options: UseIntersectionObserverInit): Observer {\n const id = {\n root: options.root || null,\n margin: options.rootMargin || '',\n }\n const existing = idList.find(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n let instance: Observer | undefined\n\n if (existing) {\n instance = observers.get(existing)\n if (instance) {\n return instance\n }\n }\n\n const elements = new Map<Element, ObserveCallback>()\n const observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n const callback = elements.get(entry.target)\n const isVisible = entry.isIntersecting || entry.intersectionRatio > 0\n if (callback && isVisible) {\n callback(isVisible)\n }\n })\n }, options)\n instance = {\n id,\n observer,\n elements,\n }\n\n idList.push(id)\n observers.set(id, instance)\n return instance\n}\n\nfunction observe(\n element: Element,\n callback: ObserveCallback,\n options: UseIntersectionObserverInit\n): () => void {\n const { id, observer, elements } = createObserver(options)\n elements.set(element, callback)\n\n observer.observe(element)\n return function unobserve(): void {\n elements.delete(element)\n observer.unobserve(element)\n\n // Destroy observer when there's nothing left to watch:\n if (elements.size === 0) {\n observer.disconnect()\n observers.delete(id)\n const index = idList.findIndex(\n (obj) => obj.root === id.root && obj.margin === id.margin\n )\n if (index > -1) {\n idList.splice(index, 1)\n }\n }\n }\n}\n\nexport function useIntersection<T extends Element>({\n rootRef,\n rootMargin,\n disabled,\n}: UseIntersection): [(element: T | null) => void, boolean, () => void] {\n const isDisabled: boolean = disabled || !hasIntersectionObserver\n\n const [visible, setVisible] = useState(false)\n const elementRef = useRef<T | null>(null)\n const setElement = useCallback((element: T | null) => {\n elementRef.current = element\n }, [])\n\n useEffect(() => {\n if (hasIntersectionObserver) {\n if (isDisabled || visible) return\n\n const element = elementRef.current\n if (element && element.tagName) {\n const unobserve = observe(\n element,\n (isVisible) => isVisible && setVisible(isVisible),\n { root: rootRef?.current, rootMargin }\n )\n\n return unobserve\n }\n } else {\n if (!visible) {\n const idleCallback = requestIdleCallback(() => setVisible(true))\n return () => cancelIdleCallback(idleCallback)\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isDisabled, rootMargin, rootRef, visible, elementRef.current])\n\n const resetVisible = useCallback(() => {\n setVisible(false)\n }, [])\n\n return [setElement, visible, resetVisible]\n}\n","export interface PathLocale {\n detectedLocale?: string\n pathname: string\n}\n\n/**\n * A cache of lowercased locales for each list of locales. This is stored as a\n * WeakMap so if the locales are garbage collected, the cache entry will be\n * removed as well.\n */\nconst cache = new WeakMap<readonly string[], readonly string[]>()\n\n/**\n * For a pathname that may include a locale from a list of locales, it\n * removes the locale from the pathname returning it alongside with the\n * detected locale.\n *\n * @param pathname A pathname that may include a locale.\n * @param locales A list of locales.\n * @returns The detected locale and pathname without locale\n */\nexport function normalizeLocalePath(\n pathname: string,\n locales?: readonly string[]\n): PathLocale {\n // If locales is undefined, return the pathname as is.\n if (!locales) return { pathname }\n\n // Get the cached lowercased locales or create a new cache entry.\n let lowercasedLocales = cache.get(locales)\n if (!lowercasedLocales) {\n lowercasedLocales = locales.map((locale) => locale.toLowerCase())\n cache.set(locales, lowercasedLocales)\n }\n\n let detectedLocale: string | undefined\n\n // The first segment will be empty, because it has a leading `/`. If\n // there is no further segment, there is no locale (or it's the default).\n const segments = pathname.split('/', 2)\n\n // If there's no second segment (ie, the pathname is just `/`), there's no\n // locale.\n if (!segments[1]) return { pathname }\n\n // The second segment will contain the locale part if any.\n const segment = segments[1].toLowerCase()\n\n // See if the segment matches one of the locales. If it doesn't, there is\n // no locale (or it's the default).\n const index = lowercasedLocales.indexOf(segment)\n if (index < 0) return { pathname }\n\n // Return the case-sensitive locale.\n detectedLocale = locales[index]\n\n // Remove the `/${locale}` part of the pathname.\n pathname = pathname.slice(detectedLocale.length + 1) || '/'\n\n return { pathname, detectedLocale }\n}\n","import type { normalizeLocalePath as Fn } from '../shared/lib/i18n/normalize-locale-path'\n\nexport const normalizeLocalePath: typeof Fn = (pathname, locales) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return require('../shared/lib/i18n/normalize-locale-path').normalizeLocalePath(\n pathname,\n locales\n )\n }\n return { pathname, detectedLocale: undefined }\n}\n","import type { DomainLocale } from '../../../server/config-shared'\n\nexport function detectDomainLocale(\n domainItems?: readonly DomainLocale[],\n hostname?: string,\n detectedLocale?: string\n) {\n if (!domainItems) return\n\n if (detectedLocale) {\n detectedLocale = detectedLocale.toLowerCase()\n }\n\n for (const item of domainItems) {\n // remove port if present\n const domainHostname = item.domain?.split(':', 1)[0].toLowerCase()\n if (\n hostname === domainHostname ||\n detectedLocale === item.defaultLocale.toLowerCase() ||\n item.locales?.some((locale) => locale.toLowerCase() === detectedLocale)\n ) {\n return item\n }\n }\n}\n","import type { detectDomainLocale as Fn } from '../shared/lib/i18n/detect-domain-locale'\n\nexport const detectDomainLocale: typeof Fn = (...args) => {\n if (process.env.__NEXT_I18N_SUPPORT) {\n return require('../shared/lib/i18n/detect-domain-locale').detectDomainLocale(\n ...args\n )\n }\n}\n","import type { DomainLocale } from '../server/config'\nimport type { normalizeLocalePath as NormalizeFn } from './normalize-locale-path'\nimport type { detectDomainLocale as DetectFn } from './detect-domain-locale'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function getDomainLocale(\n path: string,\n locale?: string | false,\n locales?: readonly string[],\n domainLocales?: readonly DomainLocale[]\n) {\n if (process.env.__NEXT_I18N_SUPPORT) {\n const normalizeLocalePath: typeof NormalizeFn =\n require('./normalize-locale-path').normalizeLocalePath\n const detectDomainLocale: typeof DetectFn =\n require('./detect-domain-locale').detectDomainLocale\n\n const target = locale || normalizeLocalePath(path, locales).detectedLocale\n const domain = detectDomainLocale(domainLocales, undefined, target)\n if (domain) {\n const proto = `http${domain.http ? '' : 's'}://`\n const finalLocale = target === domain.defaultLocale ? '' : `/${target}`\n return `${proto}${domain.domain}${normalizePathTrailingSlash(\n `${basePath}${finalLocale}${path}`\n )}`\n }\n return false\n } else {\n return false\n }\n}\n","import { addPathPrefix } from '../shared/lib/router/utils/add-path-prefix'\nimport { normalizePathTrailingSlash } from './normalize-trailing-slash'\n\nconst basePath = (process.env.__NEXT_ROUTER_BASEPATH as string) || ''\n\nexport function addBasePath(path: string, required?: boolean): string {\n return normalizePathTrailingSlash(\n process.env.__NEXT_MANUAL_CLIENT_BASE_PATH && !required\n ? path\n : addPathPrefix(path, basePath)\n )\n}\n","import { useCallback, useRef, type Ref } from 'react'\n\n// This is a compatibility hook to support React 18 and 19 refs.\n// In 19, a cleanup function from refs may be returned.\n// In 18, returning a cleanup function creates a warning.\n// Since we take userspace refs, we don't know ahead of time if a cleanup function will be returned.\n// This implements cleanup functions with the old behavior in 18.\n// We know refs are always called alternating with `null` and then `T`.\n// So a call with `null` means we need to call the previous cleanup functions.\nexport function useMergedRef<TElement>(\n refA: Ref<TElement>,\n refB: Ref<TElement>\n): Ref<TElement> {\n const cleanupA = useRef<(() => void) | null>(null)\n const cleanupB = useRef<(() => void) | null>(null)\n\n // NOTE: In theory, we could skip the wrapping if only one of the refs is non-null.\n // (this happens often if the user doesn't pass a ref to Link/Form/Image)\n // But this can cause us to leak a cleanup-ref into user code (e.g. via `<Link legacyBehavior>`),\n // and the user might pass that ref into ref-merging library that doesn't support cleanup refs\n // (because it hasn't been updated for React 19)\n // which can then cause things to blow up, because a cleanup-returning ref gets called with `null`.\n // So in practice, it's safer to be defensive and always wrap the ref, even on React 19.\n return useCallback(\n (current: TElement | null): void => {\n if (current === null) {\n const cleanupFnA = cleanupA.current\n if (cleanupFnA) {\n cleanupA.current = null\n cleanupFnA()\n }\n const cleanupFnB = cleanupB.current\n if (cleanupFnB) {\n cleanupB.current = null\n cleanupFnB()\n }\n } else {\n if (refA) {\n cleanupA.current = applyRef(refA, current)\n }\n if (refB) {\n cleanupB.current = applyRef(refB, current)\n }\n }\n },\n [refA, refB]\n )\n}\n\nfunction applyRef<TElement>(\n refA: NonNullable<Ref<TElement>>,\n current: TElement\n) {\n if (typeof refA === 'function') {\n const cleanup = refA(current)\n if (typeof cleanup === 'function') {\n return cleanup\n } else {\n return () => refA(null)\n }\n } else {\n refA.current = current\n return () => {\n refA.current = null\n }\n }\n}\n","let errorOnce = (_: string) => {}\nif (process.env.NODE_ENV !== 'production') {\n const errors = new Set<string>()\n errorOnce = (msg: string) => {\n if (!errors.has(msg)) {\n console.error(msg)\n }\n errors.add(msg)\n }\n}\n\nexport { errorOnce }\n","'use client'\n\nimport type {\n NextRouter,\n PrefetchOptions as RouterPrefetchOptions,\n} from '../shared/lib/router/router'\n\nimport React, { createContext, useContext } from 'react'\nimport type { UrlObject } from 'url'\nimport { resolveHref } from './resolve-href'\nimport { isLocalURL } from '../shared/lib/router/utils/is-local-url'\nimport { formatUrl } from '../shared/lib/router/utils/format-url'\nimport { isAbsoluteUrl } from '../shared/lib/utils'\nimport { addLocale } from './add-locale'\nimport { RouterContext } from '../shared/lib/router-context.shared-runtime'\nimport type { AppRouterInstance } from '../shared/lib/app-router-context.shared-runtime'\nimport { useIntersection } from './use-intersection'\nimport { getDomainLocale } from './get-domain-locale'\nimport { addBasePath } from './add-base-path'\nimport { useMergedRef } from './use-merged-ref'\nimport { errorOnce } from '../shared/lib/utils/error-once'\n\ntype Url = string | UrlObject\ntype RequiredKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? never : K\n}[keyof T]\ntype OptionalKeys<T> = {\n [K in keyof T]-?: {} extends Pick<T, K> ? K : never\n}[keyof T]\n\ntype OnNavigateEventHandler = (event: { preventDefault: () => void }) => void\n\ntype InternalLinkProps = {\n /**\n * The path or URL to navigate to. It can also be an object.\n *\n * @example https://nextjs.org/docs/api-reference/next/link#with-url-object\n */\n href: Url\n /**\n * Optional decorator for the path that will be shown in the browser URL bar. Before Next.js 9.5.3 this was used for dynamic routes, check our [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes) to see how it worked. Note: when this path differs from the one provided in `href` the previous `href`/`as` behavior is used as shown in the [previous docs](https://github.com/vercel/next.js/blob/v9.5.2/docs/api-reference/next/link.md#dynamic-routes).\n */\n as?: Url\n /**\n * Replace the current `history` state instead of adding a new url into the stack.\n *\n * @defaultValue `false`\n */\n replace?: boolean\n /**\n * Whether to override the default scroll behavior\n *\n * @example https://nextjs.org/docs/api-reference/next/link#disable-scrolling-to-the-top-of-the-page\n *\n * @defaultValue `true`\n */\n scroll?: boolean\n /**\n * Update the path of the current page without rerunning [`getStaticProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-static-props), [`getServerSideProps`](https://nextjs.org/docs/pages/building-your-application/data-fetching/get-server-side-props) or [`getInitialProps`](/docs/pages/api-reference/functions/get-initial-props).\n *\n * @defaultValue `false`\n */\n shallow?: boolean\n /**\n * Forces `Link` to send the `href` property to its child.\n *\n * @defaultValue `false`\n */\n passHref?: boolean\n /**\n * Prefetch the page in the background.\n * Any `<Link />` that is in the viewport (initially or through scroll) will be prefetched.\n * Prefetch can be disabled by passing `prefetch={false}`. Prefetching is only enabled in production.\n *\n * In App Router:\n * - `null` (default): For statically generated pages, this will prefetch the full React Server Component data. For dynamic pages, this will prefetch up to the nearest route segment with a [`loading.js`](https://nextjs.org/docs/app/api-reference/file-conventions/loading) file. If there is no loading file, it will not fetch the full tree to avoid fetching too much data.\n * - `true`: This will prefetch the full React Server Component data for all route segments, regardless of whether they contain a segment with `loading.js`.\n * - `false`: This will not prefetch any data, even on hover.\n *\n * In Pages Router:\n * - `true` (default): The full route & its data will be prefetched.\n * - `false`: Prefetching will not happen when entering the viewport, but will still happen on hover.\n * @defaultValue `true` (pages router) or `null` (app router)\n */\n prefetch?: boolean | null\n /**\n * The active locale is automatically prepended. `locale` allows for providing a different locale.\n * When `false` `href` has to include the locale as the default behavior is disabled.\n * Note: This is only available in the Pages Router.\n */\n locale?: string | false\n /**\n * Enable legacy link behavior.\n * @deprecated This will be removed in v16\n * @defaultValue `false`\n * @see https://github.com/vercel/next.js/commit/489e65ed98544e69b0afd7e0cfc3f9f6c2b803b7\n */\n legacyBehavior?: boolean\n /**\n * Optional event handler for when the mouse pointer is moved onto Link\n */\n onMouseEnter?: React.MouseEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when Link is touched.\n */\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when Link is clicked.\n */\n onClick?: React.MouseEventHandler<HTMLAnchorElement>\n /**\n * Optional event handler for when the `<Link>` is navigated.\n */\n onNavigate?: OnNavigateEventHandler\n}\n\n// TODO-APP: Include the full set of Anchor props\n// adding this to the publicly exported type currently breaks existing apps\n\n// `RouteInferType` is a stub here to avoid breaking `typedRoutes` when the type\n// isn't generated yet. It will be replaced when the webpack plugin runs.\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport type LinkProps<RouteInferType = any> = InternalLinkProps\ntype LinkPropsRequired = RequiredKeys<LinkProps>\ntype LinkPropsOptional = OptionalKeys<InternalLinkProps>\n\nconst prefetched = new Set<string>()\n\ntype PrefetchOptions = RouterPrefetchOptions & {\n /**\n * bypassPrefetchedCheck will bypass the check to see if the `href` has\n * already been fetched.\n */\n bypassPrefetchedCheck?: boolean\n}\n\nfunction prefetch(\n router: NextRouter,\n href: string,\n as: string,\n options: PrefetchOptions\n): void {\n if (typeof window === 'undefined') {\n return\n }\n\n if (!isLocalURL(href)) {\n return\n }\n\n // We should only dedupe requests when experimental.optimisticClientCache is\n // disabled.\n if (!options.bypassPrefetchedCheck) {\n const locale =\n // Let the link's locale prop override the default router locale.\n typeof options.locale !== 'undefined'\n ? options.locale\n : // Otherwise fallback to the router's locale.\n 'locale' in router\n ? router.locale\n : undefined\n\n const prefetchedKey = href + '%' + as + '%' + locale\n\n // If we've already fetched the key, then don't prefetch it again!\n if (prefetched.has(prefetchedKey)) {\n return\n }\n\n // Mark this URL as prefetched.\n prefetched.add(prefetchedKey)\n }\n\n // Prefetch the JSON page if asked (only in the client)\n // We need to handle a prefetch error here since we may be\n // loading with priority which can reject but we don't\n // want to force navigation since this is only a prefetch\n router.prefetch(href, as, options).catch((err) => {\n if (process.env.NODE_ENV !== 'production') {\n // rethrow to show invalid URL errors\n throw err\n }\n })\n}\n\nfunction isModifiedEvent(event: React.MouseEvent): boolean {\n const eventTarget = event.currentTarget as HTMLAnchorElement | SVGAElement\n const target = eventTarget.getAttribute('target')\n return (\n (target && target !== '_self') ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey || // triggers resource download\n (event.nativeEvent && event.nativeEvent.which === 2)\n )\n}\n\nfunction linkClicked(\n e: React.MouseEvent,\n router: NextRouter | AppRouterInstance,\n href: string,\n as: string,\n replace?: boolean,\n shallow?: boolean,\n scroll?: boolean,\n locale?: string | false,\n onNavigate?: OnNavigateEventHandler\n): void {\n const { nodeName } = e.currentTarget\n\n // anchors inside an svg have a lowercase nodeName\n const isAnchorNodeName = nodeName.toUpperCase() === 'A'\n\n if (\n (isAnchorNodeName && isModifiedEvent(e)) ||\n e.currentTarget.hasAttribute('download')\n ) {\n // ignore click for browser’s default behavior\n return\n }\n\n if (!isLocalURL(href)) {\n if (replace) {\n // browser default behavior does not replace the history state\n // so we need to do it manually\n e.preventDefault()\n location.replace(href)\n }\n\n // ignore click for browser’s default behavior\n return\n }\n\n e.preventDefault()\n\n const navigate = () => {\n if (onNavigate) {\n let isDefaultPrevented = false\n\n onNavigate({\n preventDefault: () => {\n isDefaultPrevented = true\n },\n })\n\n if (isDefaultPrevented) {\n return\n }\n }\n\n // If the router is an NextRouter instance it will have `beforePopState`\n const routerScroll = scroll ?? true\n if ('beforePopState' in router) {\n router[replace ? 'replace' : 'push'](href, as, {\n shallow,\n locale,\n scroll: routerScroll,\n })\n } else {\n router[replace ? 'replace' : 'push'](as || href, {\n scroll: routerScroll,\n })\n }\n }\n\n navigate()\n}\n\ntype LinkPropsReal = React.PropsWithChildren<\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, keyof LinkProps> &\n LinkProps\n>\n\nfunction formatStringOrUrl(urlObjOrString: UrlObject | string): string {\n if (typeof urlObjOrString === 'string') {\n return urlObjOrString\n }\n\n return formatUrl(urlObjOrString)\n}\n\n/**\n * A React component that extends the HTML `<a>` element to provide [prefetching](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating#2-prefetching)\n * and client-side navigation between routes.\n *\n * It is the primary way to navigate between routes in Next.js.\n *\n * Read more: [Next.js docs: `<Link>`](https://nextjs.org/docs/app/api-reference/components/link)\n */\nconst Link = React.forwardRef<HTMLAnchorElement, LinkPropsReal>(\n function LinkComponent(props, forwardedRef) {\n let children: React.ReactNode\n\n const {\n href: hrefProp,\n as: asProp,\n children: childrenProp,\n prefetch: prefetchProp = null,\n passHref,\n replace,\n shallow,\n scroll,\n locale,\n onClick,\n onNavigate,\n onMouseEnter: onMouseEnterProp,\n onTouchStart: onTouchStartProp,\n legacyBehavior = false,\n ...restProps\n } = props\n\n children = childrenProp\n\n if (\n legacyBehavior &&\n (typeof children === 'string' || typeof children === 'number')\n ) {\n children = <a>{children}</a>\n }\n\n const router = React.useContext(RouterContext)\n\n const prefetchEnabled = prefetchProp !== false\n\n if (process.env.NODE_ENV !== 'production') {\n function createPropError(args: {\n key: string\n expected: string\n actual: string\n }) {\n return new Error(\n `Failed prop type: The prop \\`${args.key}\\` expects a ${args.expected} in \\`<Link>\\`, but got \\`${args.actual}\\` instead.` +\n (typeof window !== 'undefined'\n ? // TODO: Remove this addendum if Owner Stacks are available\n \"\\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n\n // TypeScript trick for type-guarding:\n const requiredPropsGuard: Record<LinkPropsRequired, true> = {\n href: true,\n } as const\n const requiredProps: LinkPropsRequired[] = Object.keys(\n requiredPropsGuard\n ) as LinkPropsRequired[]\n requiredProps.forEach((key: LinkPropsRequired) => {\n if (key === 'href') {\n if (\n props[key] == null ||\n (typeof props[key] !== 'string' && typeof props[key] !== 'object')\n ) {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: props[key] === null ? 'null' : typeof props[key],\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = key\n }\n })\n\n // TypeScript trick for type-guarding:\n const optionalPropsGuard: Record<LinkPropsOptional, true> = {\n as: true,\n replace: true,\n scroll: true,\n shallow: true,\n passHref: true,\n prefetch: true,\n locale: true,\n onClick: true,\n onMouseEnter: true,\n onTouchStart: true,\n legacyBehavior: true,\n onNavigate: true,\n } as const\n const optionalProps: LinkPropsOptional[] = Object.keys(\n optionalPropsGuard\n ) as LinkPropsOptional[]\n optionalProps.forEach((key: LinkPropsOptional) => {\n const valType = typeof props[key]\n\n if (key === 'as') {\n if (props[key] && valType !== 'string' && valType !== 'object') {\n throw createPropError({\n key,\n expected: '`string` or `object`',\n actual: valType,\n })\n }\n } else if (key === 'locale') {\n if (props[key] && valType !== 'string') {\n throw createPropError({\n key,\n expected: '`string`',\n actual: valType,\n })\n }\n } else if (\n key === 'onClick' ||\n key === 'onMouseEnter' ||\n key === 'onTouchStart' ||\n key === 'onNavigate'\n ) {\n if (props[key] && valType !== 'function') {\n throw createPropError({\n key,\n expected: '`function`',\n actual: valType,\n })\n }\n } else if (\n key === 'replace' ||\n key === 'scroll' ||\n key === 'shallow' ||\n key === 'passHref' ||\n key === 'prefetch' ||\n key === 'legacyBehavior'\n ) {\n if (props[key] != null && valType !== 'boolean') {\n throw createPropError({\n key,\n expected: '`boolean`',\n actual: valType,\n })\n }\n } else {\n // TypeScript trick for type-guarding:\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const _: never = key\n }\n })\n }\n\n const { href, as } = React.useMemo(() => {\n if (!router) {\n const resolvedHref = formatStringOrUrl(hrefProp)\n return {\n href: resolvedHref,\n as: asProp ? formatStringOrUrl(asProp) : resolvedHref,\n }\n }\n\n const [resolvedHref, resolvedAs] = resolveHref(router, hrefProp, true)\n\n return {\n href: resolvedHref,\n as: asProp ? resolveHref(router, asProp) : resolvedAs || resolvedHref,\n }\n }, [router, hrefProp, asProp])\n\n const previousHref = React.useRef<string>(href)\n const previousAs = React.useRef<string>(as)\n\n // This will return the first child, if multiple are provided it will throw an error\n let child: any\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n if (onClick) {\n console.warn(\n `\"onClick\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onClick be set on the child of next/link`\n )\n }\n if (onMouseEnterProp) {\n console.warn(\n `\"onMouseEnter\" was passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but \"legacyBehavior\" was set. The legacy behavior requires onMouseEnter be set on the child of next/link`\n )\n }\n try {\n child = React.Children.only(children)\n } catch (err) {\n if (!children) {\n throw new Error(\n `No children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n )\n }\n throw new Error(\n `Multiple children were passed to <Link> with \\`href\\` of \\`${hrefProp}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n (typeof window !== 'undefined'\n ? \" \\nOpen your browser's console to view the Component stack trace.\"\n : '')\n )\n }\n } else {\n child = React.Children.only(children)\n }\n } else {\n if (process.env.NODE_ENV === 'development') {\n if ((children as any)?.type === 'a') {\n throw new Error(\n 'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n )\n }\n }\n }\n\n const childRef: any = legacyBehavior\n ? child && typeof child === 'object' && child.ref\n : forwardedRef\n\n const [setIntersectionRef, isVisible, resetVisible] = useIntersection({\n rootMargin: '200px',\n })\n\n const setIntersectionWithResetRef = React.useCallback(\n (el: Element | null) => {\n // Before the link getting observed, check if visible state need to be reset\n if (previousAs.current !== as || previousHref.current !== href) {\n resetVisible()\n previousAs.current = as\n previousHref.current = href\n }\n\n setIntersectionRef(el)\n },\n [as, href, resetVisible, setIntersectionRef]\n )\n\n const setRef = useMergedRef(setIntersectionWithResetRef, childRef)\n\n // Prefetch the URL if we haven't already and it's visible.\n React.useEffect(() => {\n // in dev, we only prefetch on hover to avoid wasting resources as the prefetch will trigger compiling the page.\n if (process.env.NODE_ENV !== 'production') {\n return\n }\n\n if (!router) {\n return\n }\n\n // If we don't need to prefetch the URL, don't do prefetch.\n if (!isVisible || !prefetchEnabled) {\n return\n }\n\n // Prefetch the URL.\n prefetch(router, href, as, { locale })\n }, [as, href, isVisible, locale, prefetchEnabled, router?.locale, router])\n\n const childProps: {\n onTouchStart?: React.TouchEventHandler<HTMLAnchorElement>\n onMouseEnter: React.MouseEventHandler<HTMLAnchorElement>\n onClick: React.MouseEventHandler<HTMLAnchorElement>\n href?: string\n ref?: any\n } = {\n ref: setRef,\n onClick(e) {\n if (process.env.NODE_ENV !== 'production') {\n if (!e) {\n throw new Error(\n `Component rendered inside next/link has to pass click event to \"onClick\" prop.`\n )\n }\n }\n\n if (!legacyBehavior && typeof onClick === 'function') {\n onClick(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onClick === 'function'\n ) {\n child.props.onClick(e)\n }\n\n if (!router) {\n return\n }\n\n if (e.defaultPrevented) {\n return\n }\n\n linkClicked(\n e,\n router,\n href,\n as,\n replace,\n shallow,\n scroll,\n locale,\n onNavigate\n )\n },\n onMouseEnter(e) {\n if (!legacyBehavior && typeof onMouseEnterProp === 'function') {\n onMouseEnterProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onMouseEnter === 'function'\n ) {\n child.props.onMouseEnter(e)\n }\n\n if (!router) {\n return\n }\n\n prefetch(router, href, as, {\n locale,\n priority: true,\n // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}\n bypassPrefetchedCheck: true,\n })\n },\n onTouchStart: process.env.__NEXT_LINK_NO_TOUCH_START\n ? undefined\n : function onTouchStart(e) {\n if (!legacyBehavior && typeof onTouchStartProp === 'function') {\n onTouchStartProp(e)\n }\n\n if (\n legacyBehavior &&\n child.props &&\n typeof child.props.onTouchStart === 'function'\n ) {\n child.props.onTouchStart(e)\n }\n\n if (!router) {\n return\n }\n\n prefetch(router, href, as, {\n locale,\n priority: true,\n // @see {https://github.com/vercel/next.js/discussions/40268?sort=top#discussioncomment-3572642}\n bypassPrefetchedCheck: true,\n })\n },\n }\n\n // If child is an <a> tag and doesn't have a href attribute, or if the 'passHref' property is\n // defined, we specify the current 'href', so that repetition is not needed by the user.\n // If the url is absolute, we can bypass the logic to prepend the domain and locale.\n if (isAbsoluteUrl(as)) {\n childProps.href = as\n } else if (\n !legacyBehavior ||\n passHref ||\n (child.type === 'a' && !('href' in child.props))\n ) {\n const curLocale = typeof locale !== 'undefined' ? locale : router?.locale\n\n // we only render domain locales if we are currently on a domain locale\n // so that locale links are still visitable in development/preview envs\n const localeDomain =\n router?.isLocaleDomain &&\n getDomainLocale(as, curLocale, router?.locales, router?.domainLocales)\n\n childProps.href =\n localeDomain ||\n addBasePath(addLocale(as, curLocale, router?.defaultLocale))\n }\n\n if (legacyBehavior) {\n if (process.env.NODE_ENV === 'development') {\n errorOnce(\n '`legacyBehavior` is deprecated and will be removed in a future ' +\n 'release. A codemod is available to upgrade your components:\\n\\n' +\n 'npx @next/codemod@latest new-link .\\n\\n' +\n 'Learn more: https://nextjs.org/docs/app/building-your-application/upgrading/codemods#remove-a-tags-from-link-components'\n )\n }\n return React.cloneElement(child, childProps)\n }\n\n return (\n <a {...restProps} {...childProps}>\n {children}\n </a>\n )\n }\n)\n\nconst LinkStatusContext = createContext<{\n pending: boolean\n}>({\n // We do not support link status in the Pages Router, so we always return false\n pending: false,\n})\n\nexport const useLinkStatus = () => {\n // This behaviour is like React's useFormStatus. When the component is not under\n // a <form> tag, it will get the default value, instead of throwing an error.\n return useContext(LinkStatusContext)\n}\n\nexport default Link\n","module.exports = require('./dist/client/link')\n","import tinycolor from 'tinycolor2'\nimport type { ShadedColors } from '@/index'\nimport { shadingColorValues } from '@/index'\n\n// Function to generate a full shading of several colors\nexport const generateShadingColors = (partialShading: Omit<Partial<ShadedColors>, '0' | '1000'>): ShadedColors => {\n const shading: ShadedColors = {\n 0: '#FFFFFF',\n 1000: '#000000'\n } as ShadedColors\n\n let index = 1\n while (index < shadingColorValues.length - 1) {\n const previous = shadingColorValues[index - 1]!\n const current = shadingColorValues[index]!\n\n if (partialShading[current] !== undefined) {\n shading[current] = partialShading[current]\n index++\n continue\n }\n\n let j: number = index + 1\n while (j < shadingColorValues.length) {\n if (partialShading[shadingColorValues[j]!] !== undefined) {\n break\n }\n j++\n }\n if (j === shadingColorValues.length) {\n j = shadingColorValues.length - 1\n }\n\n const nextFound = shadingColorValues[j]!\n const interval = nextFound - previous\n for (let k = index; k < j; k++) {\n const current = shadingColorValues[k]!\n const previousValue = partialShading[previous] ?? shading[previous]\n const nextValue = partialShading[nextFound] ?? shading[nextFound]\n shading[current] = tinycolor.mix(tinycolor(previousValue), tinycolor(nextValue), (current - previous) / interval * 100).toHexString()\n }\n index = j\n }\n\n return shading\n}\n","export const shadingColorValues = [0, 50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950, 1000] as const\nexport type ColorShadingValue = typeof shadingColorValues[number]\nexport type ShadedColors = Record<ColorShadingValue, string>\n\nexport type ColoringStyle = 'background' | 'tonal' | 'tonal-opaque' | 'text' | 'text-border'\nexport type ColorMode = 'light' | 'dark'\n\nexport type Coloring = {\n color: '',\n style?: ColoringStyle,\n mode?: ColorMode,\n hover?: boolean,\n}\n","import clsx from 'clsx'\nimport { Tile } from '@/components/layout-and-navigation/Tile'\nimport { Helpwave } from '@/components/icons-and-geometry/Helpwave'\n\ntype Size = 'small' | 'large'\n\nexport type HelpwaveBadgeProps = {\n size?: Size,\n title?: string,\n className?: string,\n}\n\n/**\n * A Badge with the helpwave logo and the helpwave name\n */\nexport const HelpwaveBadge = ({\n size = 'small',\n title = 'helpwave',\n className = ''\n }: HelpwaveBadgeProps) => {\n const iconSize: number = size === 'small' ? 24 : 64\n\n return (\n <Tile\n prefix={(<Helpwave size={iconSize}/>)}\n title={{ value: title, className: size === 'small' ? 'textstyle-title-lg text-base' : 'textstyle-title-xl' }}\n className={clsx(\n {\n 'px-2 py-1 rounded-md': size === 'small',\n 'px-4 py-1 rounded-md': size === 'large',\n }, className\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type TileProps = {\n title: { value: string, className?: string },\n description?: { value: string, className?: string },\n prefix?: ReactNode,\n suffix?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for creating a tile similar to the flutter ListTile\n */\nexport const Tile = ({\n title,\n description,\n prefix,\n suffix,\n className\n }: TileProps) => {\n return (\n <div className={clsx('row gap-x-4 w-full items-center', className)}>\n {prefix}\n <div className=\"col gap-y-0 w-full\">\n <h4 className={clsx(title.className ?? 'textstyle-title-normal')}>{title.value}</h4>\n {!!description &&\n <span className={clsx(description.className ?? 'textstyle-description')}>{description.value}</span>}\n </div>\n {suffix}\n </div>\n )\n}\n\ntype ImageLocation = 'prefix' | 'suffix'\ntype ImageSize = {\n width: number,\n height: number,\n}\n\nexport type TileWithImageProps = Omit<TileProps, 'suffix' | 'prefix'> & {\n url: string,\n imageLocation?: ImageLocation,\n imageSize?: ImageSize,\n imageClassName?: string,\n}","import type { SVGProps } from 'react'\nimport { clsx } from 'clsx'\n\nexport type HelpwaveProps = SVGProps<SVGSVGElement> & {\n color?: string,\n animate?: 'none' | 'loading' | 'pulse' | 'bounce',\n size?: number,\n}\n\n/**\n * The helpwave loading spinner based on the svg logo.\n */\nexport const Helpwave = ({\n color = 'currentColor',\n animate = 'none',\n size = 64,\n ...props\n }: HelpwaveProps) => {\n const isLoadingAnimation = animate === 'loading'\n let svgAnimationKey = ''\n\n if (animate === 'pulse') {\n svgAnimationKey = 'animate-pulse'\n } else if (animate === 'bounce') {\n svgAnimationKey = 'animate-bounce'\n }\n\n if (size < 0) {\n console.error('size cannot be less than 0')\n size = 64\n }\n\n return (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 888 888\"\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeWidth={48}\n {...props}\n >\n <g className={clsx(svgAnimationKey)}>\n <path className={clsx({ 'animate-wave-big-left-up': isLoadingAnimation })}\n d=\"M144 543.235C144 423.259 232.164 326 340.92 326\" stroke={color} strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-big-right-down': isLoadingAnimation })}\n d=\"M537.84 544.104C429.084 544.104 340.92 446.844 340.92 326.869\" stroke={color} strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-small-left-up': isLoadingAnimation })}\n d=\"M462.223 518.035C462.223 432.133 525.348 362.495 603.217 362.495\" stroke={color}\n strokeDasharray=\"1000\"/>\n <path className={clsx({ 'animate-wave-small-right-down': isLoadingAnimation })}\n d=\"M745.001 519.773C666.696 519.773 603.218 450.136 603.218 364.233\" stroke={color}\n strokeDasharray=\"1000\"/>\n </g>\n </svg>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { ArrowDown, ArrowUp, ChevronDown } from 'lucide-react'\nimport type { Language } from '@/localization/util'\nimport { useLocale } from '@/localization/LanguageProvider'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\nimport { addDuration, isInTimeSpan, subtractDuration } from '@/util/date'\nimport clsx from 'clsx'\nimport { SolidButton, TextButton } from '../user-action/Button'\nimport type { YearMonthPickerProps } from './YearMonthPicker'\nimport { YearMonthPicker } from './YearMonthPicker'\nimport type { DayPickerProps } from './DayPicker'\nimport { DayPicker } from './DayPicker'\n\ntype DatePickerTranslation = {\n today: string,\n}\n\nconst defaultDatePickerTranslation: Record<Language, DatePickerTranslation> = {\n en: {\n today: 'Today',\n },\n de: {\n today: 'Heute',\n }\n}\n\ntype DisplayMode = 'yearMonth' | 'day'\n\nexport type DatePickerProps = {\n value?: Date,\n start?: Date,\n end?: Date,\n initialDisplay?: DisplayMode,\n onChange?: (date: Date) => void,\n dayPickerProps?: Omit<DayPickerProps, 'displayedMonth' | 'onChange' | 'selected'>,\n yearMonthPickerProps?: Omit<YearMonthPickerProps, 'displayedYearMonth' | 'onChange' | 'start' | 'end'>,\n className?: string,\n}\n\n/**\n * A Component for picking a date\n */\nexport const DatePicker = ({\n overwriteTranslation,\n value = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n initialDisplay = 'day',\n onChange = noop,\n yearMonthPickerProps,\n dayPickerProps,\n className = ''\n }: PropsForTranslation<DatePickerTranslation, DatePickerProps>) => {\n const locale = useLocale()\n const translation = useTranslation(defaultDatePickerTranslation, overwriteTranslation)\n const [displayedMonth, setDisplayedMonth] = useState<Date>(value)\n const [displayMode, setDisplayMode] = useState<DisplayMode>(initialDisplay)\n\n useEffect(() => {\n setDisplayedMonth(value)\n }, [value])\n\n return (\n <div className={clsx('col gap-y-4', className)}>\n <div className=\"row items-center justify-between h-7\">\n <TextButton\n className={clsx('row gap-x-1 items-center cursor-pointer select-none', {\n 'text-disabled-text': displayMode !== 'day',\n })}\n onClick={() => setDisplayMode(displayMode === 'day' ? 'yearMonth' : 'day')}\n >\n {`${new Intl.DateTimeFormat(locale, { month: 'long' }).format(displayedMonth)} ${displayedMonth.getFullYear()}`}\n <ChevronDown size={16}/>\n </TextButton>\n {displayMode === 'day' && (\n <div className=\"row justify-end\">\n <SolidButton\n size=\"small\"\n color=\"primary\"\n disabled={!isInTimeSpan(subtractDuration(displayedMonth, { months: 1 }), start, end)}\n onClick={() => {\n setDisplayedMonth(subtractDuration(displayedMonth, { months: 1 }))\n }}\n >\n <ArrowUp size={20}/>\n </SolidButton>\n <SolidButton\n size=\"small\"\n color=\"primary\"\n disabled={!isInTimeSpan(addDuration(displayedMonth, { months: 1 }), start, end)}\n onClick={() => {\n setDisplayedMonth(addDuration(displayedMonth, { months: 1 }))\n }}\n >\n <ArrowDown size={20}/>\n </SolidButton>\n </div>\n )}\n </div>\n {displayMode === 'yearMonth' ? (\n <YearMonthPicker\n {...yearMonthPickerProps}\n displayedYearMonth={value}\n start={start}\n end={end}\n onChange={newDate => {\n setDisplayedMonth(newDate)\n setDisplayMode('day')\n }}\n />\n ) : (\n <div>\n <DayPicker\n {...dayPickerProps}\n displayedMonth={displayedMonth}\n start={start}\n end={end}\n selected={value}\n onChange={date => {\n onChange(date)\n }}\n />\n <div className=\"mt-2\">\n <TextButton\n onClick={() => {\n const newDate = new Date()\n newDate.setHours(value.getHours(), value.getMinutes())\n onChange(newDate)\n }}\n >\n {translation.today}\n </TextButton>\n </div>\n </div>\n )}\n </div>\n )\n}\n\n/**\n * Example for the Date Picker\n */\nexport const DatePickerUncontrolled = ({\n value = new Date(),\n onChange = noop,\n ...props\n }: DatePickerProps) => {\n const [date, setDate] = useState<Date>(value)\n\n useEffect(() => setDate(value), [value])\n\n return (\n <DatePicker\n {...props}\n value={date}\n onChange={date1 => {\n setDate(date1)\n onChange(date1)\n }}\n />\n )\n}\n","import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'\nimport { createContext, useContext, useEffect, useState } from 'react'\nimport { useLocalStorage } from '@/hooks/useLocalStorage'\nimport type { Language } from './util'\nimport { LanguageUtil } from './util'\n\nexport type LanguageContextValue = {\n language: Language,\n setLanguage: Dispatch<SetStateAction<Language>>,\n}\n\nexport const LanguageContext = createContext<LanguageContextValue>({\n language: LanguageUtil.DEFAULT_LANGUAGE,\n setLanguage: (v) => v\n})\n\nexport const useLanguage = () => useContext(LanguageContext)\n\nexport const useLocale = (overWriteLanguage?: Language) => {\n const { language } = useLanguage()\n const mapping: Record<Language, string> = {\n en: 'en-US',\n de: 'de-DE'\n }\n return mapping[overWriteLanguage ?? language]\n}\n\ntype LanguageProviderProps = {\n initialLanguage?: Language,\n}\n\nexport const LanguageProvider = ({ initialLanguage, children }: PropsWithChildren<LanguageProviderProps>) => {\n const [language, setLanguage] = useState<Language>(initialLanguage ?? LanguageUtil.DEFAULT_LANGUAGE)\n const [storedLanguage, setStoredLanguage] = useLocalStorage<Language>('language', initialLanguage ?? LanguageUtil.DEFAULT_LANGUAGE)\n\n useEffect(() => {\n if (language !== initialLanguage && initialLanguage) {\n console.warn('LanguageProvider initial state changed: Prefer using languageProvider\\'s setLanguage instead')\n setLanguage(initialLanguage)\n }\n }, [initialLanguage]) // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n // TODO set locale of html tag here as well\n setStoredLanguage(language)\n }, [language, setStoredLanguage])\n\n useEffect(() => {\n if (storedLanguage !== null) {\n setLanguage(storedLanguage)\n return\n }\n\n const LanguageToTestAgainst = Object.values(LanguageUtil.languages)\n\n const matchingBrowserLanguage = window.navigator.languages\n .map(language => LanguageToTestAgainst.find((test) => language === test || language.split('-')[0] === test))\n .filter(entry => entry !== undefined)\n\n if (matchingBrowserLanguage.length === 0) return\n\n const firstMatch = matchingBrowserLanguage[0] as Language\n setLanguage(firstMatch)\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <LanguageContext.Provider value={{\n language,\n setLanguage\n }}>\n {children}\n </LanguageContext.Provider>\n )\n}","import type { Dispatch, SetStateAction } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { LocalStorageService } from '../util/storage'\n\ntype SetValue<T> = Dispatch<SetStateAction<T>>\nexport const useLocalStorage = <T>(key: string, initValue: T): [T, SetValue<T>] => {\n const get = useCallback((): T => {\n if (typeof window === 'undefined') {\n return initValue\n }\n const storageService = new LocalStorageService()\n const value = storageService.get<T>(key)\n return value || initValue\n }, [initValue, key])\n\n const [storedValue, setStoredValue] = useState<T>(get)\n\n const setValue: SetValue<T> = useCallback(value => {\n const newValue = value instanceof Function ? value(storedValue) : value\n const storageService = new LocalStorageService()\n storageService.set(key, value)\n\n setStoredValue(newValue)\n }, [storedValue, setStoredValue, key])\n\n useEffect(() => {\n setStoredValue(get())\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return [storedValue, setValue]\n}","/**\n * The supported languages\n */\nconst languages = ['en', 'de'] as const\n\n/**\n * The supported languages\n */\nexport type Language = typeof languages[number]\n\n/**\n * The supported languages' names in their respective language\n */\nconst languagesLocalNames: Record<Language, string> = {\n en: 'English',\n de: 'Deutsch',\n}\n\n/**\n * The default language\n */\nconst DEFAULT_LANGUAGE: Language = 'en'\n\n/**\n * A constant definition for holding data regarding languages\n */\nexport const LanguageUtil = {\n languages,\n DEFAULT_LANGUAGE,\n languagesLocalNames,\n}","export const noop = () => undefined\n","import type { ButtonHTMLAttributes, PropsWithChildren, ReactNode } from 'react'\nimport clsx from 'clsx'\n\n\nexport const ButtonColorUtil = {\n solid: ['primary', 'secondary', 'tertiary', 'positive', 'warning', 'negative', 'neutral'] as const,\n text: ['primary', 'negative', 'neutral'] as const,\n outline: ['primary'] as const,\n}\n\n\n/**\n * The allowed colors for the SolidButton and IconButton\n */\nexport type SolidButtonColor = typeof ButtonColorUtil.solid[number]\n/**\n * The allowed colors for the OutlineButton\n */\nexport type OutlineButtonColor = typeof ButtonColorUtil.outline[number]\n/**\n * The allowed colors for the TextButton\n */\nexport type TextButtonColor = typeof ButtonColorUtil.text[number]\n\n/**\n * The different sizes for a button\n */\ntype ButtonSizes = 'small' | 'medium' | 'large'\n\n/**\n * The shard properties between all button types\n */\nexport type ButtonProps = PropsWithChildren<{\n /**\n * @default 'medium'\n */\n size?: ButtonSizes,\n}> & ButtonHTMLAttributes<Element>\n\nconst paddingMapping: Record<ButtonSizes, string> = {\n small: 'btn-sm',\n medium: 'btn-md',\n large: 'btn-lg'\n}\n\nconst iconPaddingMapping: Record<ButtonSizes, string> = {\n small: 'icon-btn-sm',\n medium: 'icon-btn-md',\n large: 'icon-btn-lg'\n}\n\nexport const ButtonUtil = {\n paddingMapping,\n iconPaddingMapping\n}\n\ntype ButtonWithIconsProps = ButtonProps & {\n startIcon?: ReactNode,\n endIcon?: ReactNode,\n}\n\nexport type SolidButtonProps = ButtonWithIconsProps & {\n color?: SolidButtonColor,\n}\n\nexport type OutlineButtonProps = ButtonWithIconsProps & {\n color?: OutlineButtonColor,\n}\n\nexport type TextButtonProps = ButtonWithIconsProps & {\n color?: TextButtonColor,\n}\n\nexport type IconButtonProps = ButtonProps & {\n color?: SolidButtonColor,\n}\n\n/**\n * A button with a solid background and different sizes\n */\nconst SolidButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: SolidButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-solid-primary-icon',\n secondary: 'text-button-solid-secondary-icon',\n tertiary: 'text-button-solid-tertiary-icon',\n positive: 'text-button-solid-positive-icon',\n warning: 'text-button-solid-warning-icon',\n negative: 'text-button-solid-negative-icon',\n neutral: 'text-button-solid-neutral-icon',\n }[color]\n\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A button with an outline border and different sizes\n */\nconst OutlineButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: OutlineButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent border-2 border-button-outline-primary-text text-button-outline-primary-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-outline-primary-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text border-disabled-outline cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-80')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n/**\n * A text that is a button that can have different sizes\n */\nconst TextButton = ({\n children,\n disabled = false,\n color = 'neutral',\n size = 'medium',\n startIcon,\n endIcon,\n onClick,\n className,\n ...restProps\n }: TextButtonProps) => {\n const colorClasses = {\n primary: 'bg-transparent text-button-text-primary-text',\n negative: 'bg-transparent text-button-text-negative-text',\n neutral: 'bg-transparent text-button-text-neutral-text',\n }[color]\n\n const iconColorClasses = {\n primary: 'text-button-text-primary-icon',\n negative: 'text-button-text-negative-icon',\n neutral: 'text-button-text-neutral-icon',\n }[color]\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:bg-button-text-hover-background rounded-full')]: !disabled,\n },\n ButtonUtil.paddingMapping[size],\n className\n )}\n {...restProps}\n >\n {startIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n className={clsx({\n [iconColorClasses]: !disabled,\n [`text-disabled-icon`]: disabled\n })}\n >\n {endIcon}\n </span>\n )}\n </button>\n )\n}\n\n\n/**\n * A button for icons with a solid background and different sizes\n */\nconst IconButton = ({\n children,\n disabled = false,\n color = 'primary',\n size = 'medium',\n onClick,\n className,\n ...restProps\n }: IconButtonProps) => {\n const colorClasses = {\n primary: 'bg-button-solid-primary-background text-button-solid-primary-text',\n secondary: 'bg-button-solid-secondary-background text-button-solid-secondary-text',\n tertiary: 'bg-button-solid-tertiary-background text-button-solid-tertiary-text',\n positive: 'bg-button-solid-positive-background text-button-solid-positive-text',\n warning: 'bg-button-solid-warning-background text-button-solid-warning-text',\n negative: 'bg-button-solid-negative-background text-button-solid-negative-text',\n neutral: 'bg-button-solid-neutral-background text-button-solid-neutral-text',\n }[color]\n\n return (\n <button\n onClick={disabled ? undefined : onClick}\n disabled={disabled || onClick === undefined}\n className={clsx(\n {\n 'text-disabled-text bg-disabled-background cursor-not-allowed': disabled,\n [clsx(colorClasses, 'hover:brightness-90')]: !disabled\n },\n ButtonUtil.iconPaddingMapping[size],\n className\n )}\n {...restProps}\n >\n {children}\n </button>\n )\n}\n\nexport { SolidButton, OutlineButton, TextButton, IconButton }\n","import { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '@/util/noop'\nimport { equalSizeGroups, range } from '@/util/array'\nimport clsx from 'clsx'\nimport { ExpandableUncontrolled } from '@/components/layout-and-navigation/Expandable'\nimport { addDuration, monthsList, subtractDuration } from '@/util/date'\nimport { useLocale } from '@/localization/LanguageProvider'\n\nexport type YearMonthPickerProps = {\n displayedYearMonth?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n className?: string,\n maxHeight?: number,\n showValueOpen?: boolean,\n}\n\n// TODO use a dynamically loading infinite list here\nexport const YearMonthPicker = ({\n displayedYearMonth = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n onChange = noop,\n className = '',\n maxHeight = 300,\n showValueOpen = true\n }: YearMonthPickerProps) => {\n const locale = useLocale()\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n const scrollToItem = () => {\n if (ref.current) {\n ref.current.scrollIntoView({\n behavior: 'instant',\n block: 'center',\n })\n }\n }\n\n scrollToItem()\n }, [ref])\n\n if (end < start) {\n console.error(`startYear: (${start}) less than endYear: (${end})`)\n return null\n }\n\n const years = range(start.getFullYear(), end.getFullYear())\n\n return (\n <div className={clsx('col select-none', className)}>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 mr-3\">\n {years.map(year => {\n const selectedYear = displayedYearMonth.getFullYear() === year\n return (\n <ExpandableUncontrolled\n key={year}\n ref={(displayedYearMonth.getFullYear() ?? new Date().getFullYear()) === year ? ref : undefined}\n label={<span className={clsx({ 'text-primary font-bold': selectedYear })}>{year}</span>}\n isExpanded={showValueOpen && selectedYear}\n >\n <div className=\"col gap-y-1 px-2 pb-2\">\n {equalSizeGroups([...monthsList], 3).map((monthList, index) => (\n <div key={index} className=\"row\">\n {monthList.map(month => {\n const monthIndex = monthsList.indexOf(month)\n const newDate = new Date(year, monthIndex)\n\n const selectedMonth = selectedYear && monthIndex === displayedYearMonth.getMonth()\n const firstOfMonth = new Date(year, monthIndex, 1)\n const lastOfMonth = new Date(year, monthIndex, 1)\n const isAfterStart = start === undefined || start <= addDuration(subtractDuration(lastOfMonth, { days: 1 }), { months: 1 })\n const isBeforeEnd = end === undefined || firstOfMonth <= end\n const isValid = isAfterStart && isBeforeEnd\n return (\n <button\n key={month}\n disabled={!isValid}\n className={clsx(\n 'chip hover:brightness-95 flex-1',\n {\n 'bg-gray-50 text-black': !selectedMonth && isValid,\n 'bg-primary text-on-primary': selectedMonth && isValid,\n 'bg-disabled-background text-disabled-text': !isValid\n }\n )}\n onClick={() => {\n onChange(newDate)\n }}\n >\n {new Intl.DateTimeFormat(locale, { month: 'short' }).format(newDate)}\n </button>\n )\n })}\n </div>\n ))}\n </div>\n </ExpandableUncontrolled>\n )\n })}\n </div>\n </Scrollbars>\n </div>\n )\n}\n\nexport const YearMonthPickerUncontrolled = ({\n displayedYearMonth = new Date(),\n onChange = noop,\n ...props\n }: YearMonthPickerProps) => {\n const [yearMonth, setYearMonth] = useState<Date>(displayedYearMonth)\n\n useEffect(() => setYearMonth(displayedYearMonth), [displayedYearMonth])\n\n return (\n <YearMonthPicker\n displayedYearMonth={yearMonth}\n onChange={date => {\n setYearMonth(date)\n onChange(date)\n }}\n {...props}\n />\n )\n}\n","import type { PropsWithChildren, ReactNode } from 'react'\nimport { forwardRef, useEffect, useState } from 'react'\nimport { ChevronDown, ChevronUp } from 'lucide-react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\n\ntype IconBuilder = (expanded: boolean) => ReactNode\n\nexport type ExpandableProps = PropsWithChildren<{\n label: ReactNode,\n icon?: IconBuilder,\n isExpanded?: boolean,\n onChange?: (isExpanded: boolean) => void,\n /**\n * Whether the expansion should only happen when the header is clicked or on the entire component\n */\n clickOnlyOnHeader?: boolean,\n disabled?: boolean,\n className?: string,\n headerClassName?: string,\n}>\n\nconst DefaultIcon: IconBuilder = (expanded) => expanded ?\n (<ChevronUp size={16} className=\"min-w-[16px]\"/>)\n : (<ChevronDown size={16} className=\"min-w-[16px]\"/>)\n\n\n/**\n * A Component for showing and hiding content\n */\nexport const Expandable = forwardRef<HTMLDivElement, ExpandableProps>(function Expandable({\n children,\n label,\n icon,\n isExpanded = false,\n onChange = noop,\n clickOnlyOnHeader = true,\n disabled = false,\n className = '',\n headerClassName = ''\n }, ref) {\n icon ??= DefaultIcon\n\n return (\n <div\n ref={ref}\n className={clsx('col gap-y-0 bg-surface text-on-surface group rounded-lg shadow-sm', { 'cursor-pointer': !clickOnlyOnHeader && !disabled }, className)}\n onClick={() => !clickOnlyOnHeader && !disabled && onChange(!isExpanded)}\n >\n <div\n className={clsx(\n 'row py-2 px-4 rounded-lg justify-between items-center bg-surface text-on-surface select-none',\n {\n 'group-hover:brightness-95': !isExpanded,\n 'hover:brightness-95': isExpanded && !disabled,\n 'cursor-pointer': clickOnlyOnHeader && !disabled,\n },\n headerClassName\n )}\n onClick={() => clickOnlyOnHeader && !disabled && onChange(!isExpanded)}\n >\n {label}\n {icon(isExpanded)}\n </div>\n {isExpanded && (\n <div className=\"col px-4 pb-2\">\n {children}\n </div>\n )}\n </div>\n )\n})\n\nexport const ExpandableUncontrolled = forwardRef<HTMLDivElement, ExpandableProps>(function ExpandableUncontrolled({\n isExpanded,\n onChange = noop,\n ...props\n },\n ref) {\n const [usedIsExpanded, setUsedIsExpanded] = useState(isExpanded)\n\n useEffect(() => {\n setUsedIsExpanded(isExpanded)\n }, [isExpanded])\n\n return (\n <Expandable\n {...props}\n ref={ref}\n isExpanded={usedIsExpanded}\n onChange={value => {\n onChange(value)\n setUsedIsExpanded(value)\n }}\n />\n )\n})\n","import type { WeekDay } from '@/util/date'\nimport { equalDate, getWeeksForCalenderMonth, isInTimeSpan } from '@/util/date'\nimport { noop } from '@/util/noop'\nimport clsx from 'clsx'\nimport { useLocale } from '@/localization/LanguageProvider'\nimport { useEffect, useState } from 'react'\n\nexport type DayPickerProps = {\n displayedMonth: Date,\n selected?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n weekStart?: WeekDay,\n markToday?: boolean,\n className?: string,\n}\n\n/**\n * A component for selecting a day of a month\n */\nexport const DayPicker = ({\n displayedMonth,\n selected,\n start,\n end,\n onChange = noop,\n weekStart = 'monday',\n markToday = true,\n className = ''\n }: DayPickerProps) => {\n const locale = useLocale()\n const month = displayedMonth.getMonth()\n const weeks = getWeeksForCalenderMonth(displayedMonth, weekStart)\n\n return (\n <div className={clsx('col gap-y-1 min-w-[220px] select-none', className)}>\n <div className=\"row text-center\">\n {weeks[0]!.map((weekDay, index) => (\n <div key={index} className=\"flex-1 font-semibold\">\n {new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(weekDay).substring(0, 2)}\n </div>\n ))}\n </div>\n {weeks.map((week, index) => (\n <div key={index} className=\"row text-center\">\n {week.map((date) => {\n const isSelected = !!selected && equalDate(selected, date)\n const isToday = equalDate(new Date(), date)\n const isSameMonth = date.getMonth() === month\n const isDayValid = isInTimeSpan(date, start, end)\n return (\n <button\n disabled={!isDayValid}\n key={date.getDate()}\n className={clsx(\n 'flex-1 rounded-full border-2 border-transparent shadow-sm',\n {\n 'text-gray-700 bg-gray-100': !isSameMonth && isDayValid,\n 'text-black bg-white': !isSelected && isSameMonth && isDayValid,\n 'text-on-primary bg-primary': isSelected,\n 'border-black': isToday && markToday,\n 'hover:brightness-90 hover:bg-primary hover:text-on-primary': isDayValid,\n 'text-disabled-text bg-disabled-background': !isDayValid\n }\n )}\n onClick={() => onChange(date)}\n >\n {date.getDate()}\n </button>\n )\n })}\n </div>\n ))}\n </div>\n )\n}\n\nexport const DayPickerUncontrolled = ({ displayedMonth, onChange = noop, ...restProps }: DayPickerProps) => {\n const [date, setDate] = useState(displayedMonth)\n\n useEffect(() => setDate(displayedMonth), [displayedMonth])\n\n return (\n <DayPicker\n displayedMonth={date}\n onChange={newDate => {\n setDate(newDate)\n onChange(newDate)\n }}\n {...restProps}\n />\n )\n}\n","import type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\n\ntype TimeDisplayTranslation = {\n today: string,\n yesterday: string,\n tomorrow: string,\n inDays: (days: number) => string,\n agoDays: (days: number) => string,\n january: string,\n february: string,\n march: string,\n april: string,\n may: string,\n june: string,\n july: string,\n august: string,\n september: string,\n october: string,\n november: string,\n december: string,\n}\n\nconst defaultTimeDisplayTranslations: Record<Language, TimeDisplayTranslation> = {\n en: {\n today: 'today',\n yesterday: 'yesterday',\n tomorrow: 'tomorrow',\n inDays: (days: number) => `in ${days} days`,\n agoDays: (days: number) => `${days} days ago`,\n january: 'January',\n february: 'February',\n march: 'March',\n april: 'April',\n may: 'May',\n june: 'June',\n july: 'July',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December'\n },\n de: {\n today: 'heute',\n yesterday: 'gestern',\n tomorrow: 'morgen',\n inDays: (days: number) => `in ${days} Tagen`,\n agoDays: (days: number) => `vor ${days} Tagen`,\n january: 'Januar',\n february: 'Februar',\n march: 'März',\n april: 'April',\n may: 'Mai',\n june: 'Juni',\n july: 'Juli',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December'\n }\n}\n\ntype TimeDisplayMode = 'daysFromToday' | 'date'\n\ntype TimeDisplayProps = {\n date: Date,\n mode?: TimeDisplayMode,\n}\n\n/**\n * A Component for displaying time and dates in a unified fashion\n */\nexport const TimeDisplay = ({\n overwriteTranslation,\n date,\n mode = 'daysFromToday'\n }: PropsForTranslation<TimeDisplayTranslation, TimeDisplayProps>) => {\n const translation = useTranslation(defaultTimeDisplayTranslations, overwriteTranslation)\n const difference = new Date().setHours(0, 0, 0, 0).valueOf() - new Date(date).setHours(0, 0, 0, 0).valueOf()\n const isBefore = difference > 0\n const differenceInDays = Math.floor(Math.abs(difference) / (1000 * 3600 * 24))\n\n let displayString\n if (differenceInDays === 0) {\n displayString = translation.today\n } else if (differenceInDays === 1) {\n displayString = isBefore ? translation.yesterday : translation.tomorrow\n } else {\n displayString = isBefore ? translation.agoDays(differenceInDays) : translation.inDays(differenceInDays)\n }\n const monthToTranslation: { [key: number]: string } = {\n 0: translation.january,\n 1: translation.february,\n 2: translation.march,\n 3: translation.april,\n 4: translation.may,\n 5: translation.june,\n 6: translation.july,\n 7: translation.august,\n 8: translation.september,\n 9: translation.october,\n 10: translation.november,\n 11: translation.december\n } as const\n\n let fullString\n if (mode === 'daysFromToday') {\n fullString = `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')} - ${displayString}`\n } else {\n fullString = `${date.getDate()}. ${monthToTranslation[date.getMonth()]} ${date.getFullYear()}`\n }\n\n return (\n <span>\n {fullString}\n </span>\n )\n}\n","import { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '@/util/noop'\nimport { closestMatch, range } from '@/util/array'\nimport clsx from 'clsx'\n\ntype MinuteIncrement = '1min' | '5min' | '10min' | '15min' | '30min'\n\nexport type TimePickerProps = {\n time?: Date,\n onChange?: (time: Date) => void,\n is24HourFormat?: boolean,\n minuteIncrement?: MinuteIncrement,\n maxHeight?: number,\n className?: string,\n}\n\nexport const TimePicker = ({\n time = new Date(),\n onChange = noop,\n is24HourFormat = true,\n minuteIncrement = '5min',\n maxHeight = 300,\n className = ''\n }: TimePickerProps) => {\n const minuteRef = useRef<HTMLButtonElement>(null)\n const hourRef = useRef<HTMLButtonElement>(null)\n\n const isPM = time.getHours() >= 11\n const hours = is24HourFormat ? range(0, 23) : range(1, 12)\n let minutes = range(0, 59)\n\n useEffect(() => {\n const scrollToItem = () => {\n if (minuteRef.current) {\n const container = minuteRef.current.parentElement!\n\n const hasOverflow = container.scrollHeight > maxHeight\n if (hasOverflow) {\n minuteRef.current.scrollIntoView({\n behavior: 'instant',\n block: 'nearest',\n })\n }\n }\n }\n scrollToItem()\n }, [minuteRef, minuteRef.current]) // eslint-disable-line\n\n useEffect(() => {\n const scrollToItem = () => {\n if (hourRef.current) {\n const container = hourRef.current.parentElement!\n\n const hasOverflow = container.scrollHeight > maxHeight\n if (hasOverflow) {\n hourRef.current.scrollIntoView({\n behavior: 'instant',\n block: 'nearest',\n })\n }\n }\n }\n scrollToItem()\n }, [hourRef, hourRef.current]) // eslint-disable-line\n\n switch (minuteIncrement) {\n case '5min':\n minutes = minutes.filter(value => value % 5 === 0)\n break\n case '10min':\n minutes = minutes.filter(value => value % 10 === 0)\n break\n case '15min':\n minutes = minutes.filter(value => value % 15 === 0)\n break\n case '30min':\n minutes = minutes.filter(value => value % 30 === 0)\n break\n }\n\n const closestMinute = closestMatch(minutes, (item1, item2) => Math.abs(item1 - time.getMinutes()) < Math.abs(item2 - time.getMinutes()))\n\n const style = (selected: boolean) => clsx('chip-full hover:brightness-90 hover:bg-primary hover:text-on-primary rounded-md mr-3',\n { 'bg-primary text-on-primary': selected, 'bg-white text-black': !selected })\n\n const onChangeWrapper = (transformer: (newDate: Date) => void) => {\n const newDate = new Date(time)\n transformer(newDate)\n onChange(newDate)\n }\n\n return (\n <div className={clsx('row gap-x-2 w-fit min-w-[150px] select-none', className)}>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 h-full\">\n {hours.map(hour => {\n const currentHour = hour === time.getHours() - (!is24HourFormat && isPM ? 12 : 0)\n return (\n <button\n key={hour}\n ref={currentHour ? hourRef : undefined}\n className={style(currentHour)}\n onClick={() => onChangeWrapper(newDate => newDate.setHours(hour + (!is24HourFormat && isPM ? 12 : 0)))}\n >\n {hour.toString().padStart(2, '0')}\n </button>\n )\n })}\n </div>\n </Scrollbars>\n <Scrollbars autoHeight autoHeightMax={maxHeight} style={{ height: '100%' }}>\n <div className=\"col gap-y-1 h-full\">\n {minutes.map(minute => {\n const currentMinute = minute === closestMinute\n return (\n <button\n key={minute + minuteIncrement} // minute increment so that scroll works\n ref={currentMinute ? minuteRef : undefined}\n className={style(currentMinute)}\n onClick={() => onChangeWrapper(newDate => newDate.setMinutes(minute))}\n >\n {minute.toString().padStart(2, '0')}\n </button>\n )\n })}\n </div>\n </Scrollbars>\n {!is24HourFormat && (\n <div className=\"col gap-y-1\">\n <button\n className={style(!isPM)}\n onClick={() => onChangeWrapper(newDate => isPM && newDate.setHours(newDate.getHours() - 12))}\n >\n AM\n </button>\n <button\n className={style(isPM)}\n onClick={() => onChangeWrapper(newDate => !isPM && newDate.setHours(newDate.getHours() + 12))}\n >\n PM\n </button>\n </div>\n )}\n </div>\n )\n}\n\nexport const TimePickerUncontrolled = ({\n time,\n onChange = noop,\n ...props\n }: TimePickerProps) => {\n const [value, setValue] = useState(time)\n useEffect(() => setValue(time), [time])\n\n return (\n <TimePicker\n {...props}\n time={value}\n onChange={time1 => {\n setValue(time1)\n onChange(time1)\n }}\n />\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { SolidButtonColor } from '../user-action/Button'\nimport { SolidButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport clsx from 'clsx'\nimport type { DialogProps } from '@/components/layout-and-navigation/Overlay'\nimport { Dialog } from '@/components/layout-and-navigation/Overlay'\n\ntype ConfirmDialogTranslation = {\n confirm: string,\n cancel: string,\n decline: string,\n}\n\nexport type ConfirmDialogType = 'positive' | 'negative' | 'neutral' | 'primary'\n\nconst defaultConfirmDialogTranslation = {\n en: {\n confirm: 'Confirm',\n decline: 'Decline'\n },\n de: {\n confirm: 'Bestätigen',\n decline: 'Ablehnen'\n }\n}\n\ntype ButtonOverwriteType = {\n text?: string,\n color?: SolidButtonColor,\n disabled?: boolean,\n}\n\nexport type ConfirmDialogProps = DialogProps & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onConfirm: () => void,\n onDecline?: () => void,\n confirmType?: ConfirmDialogType,\n /**\n * Order: Decline, Confirm\n */\n buttonOverwrites?: [ButtonOverwriteType, ButtonOverwriteType],\n}\n\n/**\n * A Dialog for demanding the user for confirmation\n *\n * To allow for background closing, prefer using a ConfirmModal\n */\nexport const ConfirmDialog = ({\n overwriteTranslation,\n children,\n onConfirm,\n onDecline,\n confirmType = 'positive',\n buttonOverwrites,\n className,\n ...restProps\n }: PropsForTranslation<ConfirmDialogTranslation, PropsWithChildren<ConfirmDialogProps>>) => {\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n const mapping: Record<ConfirmDialogType, SolidButtonColor> = {\n neutral: 'primary',\n negative: 'negative',\n positive: 'positive',\n primary: 'primary',\n }\n\n return (\n <Dialog {...restProps} className={clsx('justify-between', className)}>\n <div className=\"col grow\">\n {children}\n </div>\n <div className=\"row mt-3 gap-x-4 justify-end\">\n {onDecline && (\n <SolidButton\n color={buttonOverwrites?.[0].color ?? 'negative'}\n onClick={onDecline}\n\n disabled={buttonOverwrites?.[0].disabled ?? false}\n >\n {buttonOverwrites?.[0].text ?? translation.decline}\n </SolidButton>\n )}\n <SolidButton\n autoFocus\n color={buttonOverwrites?.[1].color ?? mapping[confirmType]}\n onClick={onConfirm}\n disabled={buttonOverwrites?.[1].disabled ?? false}\n >\n {buttonOverwrites?.[1].text ?? translation.confirm}\n </SolidButton>\n </div>\n </Dialog>\n )\n}\n","import type { PropsWithChildren, ReactNode } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport ReactDOM from 'react-dom'\nimport clsx from 'clsx'\nimport { Tooltip } from '@/components/user-action/Tooltip'\nimport { X } from 'lucide-react'\nimport { IconButton } from '@/components/user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { Language } from '@/localization/util'\n\nexport type OverlayProps = PropsWithChildren<{\n /**\n * Whether the overlay should be currently displayed\n */\n isOpen: boolean,\n /**\n * Callback when the background is clicked\n */\n onBackgroundClick?: () => void,\n /**\n * Styling for the background\n *\n * To remove the darkening, set bg-transparent\n */\n backgroundClassName?: string,\n}>\n\n/**\n * A generic overlay window which is managed by its parent\n */\nexport const Overlay = ({\n children,\n isOpen,\n onBackgroundClick,\n backgroundClassName,\n }: PropsWithChildren<OverlayProps>) => {\n // The element to which the overlay will be attached to\n const [root, setRoot] = useState<HTMLElement>()\n\n useEffect(() => {\n setRoot(document.body)\n }, [])\n\n if (!root || !isOpen) return null\n\n\n return ReactDOM.createPortal(\n <div className={clsx('fixed inset-0 z-[9999]')}>\n <div\n className={clsx('fixed inset-0 h-screen w-screen bg-black/30', backgroundClassName)}\n onClick={onBackgroundClick}\n />\n {children}\n </div>,\n root\n )\n}\n\n\nlet overlayStack: HTMLDivElement[] = []\n\n\n// --- Modal ---\n\ntype ModalHeaderTranslation = {\n close: string,\n}\n\nconst defaultModalHeaderTranslation: Record<Language, ModalHeaderTranslation> = {\n en: {\n close: 'Close'\n },\n de: {\n close: 'Schließen'\n }\n}\n\nexport type OverlayHeaderProps = {\n /**\n * Callback when the close button is clicked. If omitted or undefined, the button is hidden\n */\n onClose?: () => void,\n /** The title of the Modal. If you want to only set the text use `titleText` instead */\n title?: ReactNode,\n /** The title text of the Modal. If you want to set a custom title use `title` instead */\n titleText?: string,\n /** The description of the Modal. If you want to only set the text use `descriptionText` instead */\n description?: ReactNode,\n /** The description text of the Modal. If you want to set a custom description use `description` instead */\n descriptionText?: string,\n}\n\n/**\n * A header that should be in an Overlay\n */\nexport const OverlayHeader = ({\n overwriteTranslation,\n onClose,\n title,\n titleText = '',\n description,\n descriptionText = ''\n }: PropsForTranslation<ModalHeaderTranslation, OverlayHeaderProps>) => {\n const translation = useTranslation(defaultModalHeaderTranslation, overwriteTranslation)\n const hasTitleRow = !!title || !!titleText || !!onClose\n const titleRow = (\n <div className=\"row justify-between items-start gap-x-8\">\n {title ?? (\n <h2\n className={clsx('textstyle-title-lg', {\n 'mb-1': description || descriptionText,\n })}\n >\n {titleText}\n </h2>\n )}\n {!!onClose && (\n <Tooltip tooltip={translation.close}>\n <IconButton color=\"neutral\" size=\"small\" onClick={onClose}>\n <X className=\"w-full h-full\"/>\n </IconButton>\n </Tooltip>\n )}\n </div>\n )\n\n return (\n <div className=\"col\">\n {hasTitleRow && (titleRow)}\n {description ?? (descriptionText && (<span className=\"textstyle-description\">{descriptionText}</span>))}\n </div>\n )\n}\n\nexport type ModalProps = {\n isOpen: boolean,\n onClose: () => void,\n className?: string,\n backgroundClassName?: string,\n headerProps?: Omit<OverlayHeaderProps, 'onClose'>,\n}\n\n/**\n * A Generic Modal Window\n */\nexport const Modal = ({\n children,\n isOpen,\n onClose,\n className,\n backgroundClassName,\n headerProps,\n }: PropsWithChildren<ModalProps>) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!isOpen) return\n\n const modal = ref.current\n\n if (!modal) {\n console.error('modal open, but no ref found')\n return\n }\n\n overlayStack.push(modal)\n\n const focusable = modal?.querySelectorAll(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const isTopmost = overlayStack[overlayStack.length - 1] === modal\n if (!isTopmost) return\n\n if (e.key === 'Escape') {\n e.stopPropagation()\n onClose()\n } else if (e.key === 'Tab') {\n if (focusable.length === 0) return\n\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n (last as HTMLElement).focus()\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n (first as HTMLElement).focus()\n }\n }\n }\n\n modal.focus()\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n overlayStack = overlayStack.filter(m => m !== modal)\n }\n }, [isOpen, onClose])\n\n return (\n <Overlay\n isOpen={isOpen}\n onBackgroundClick={onClose}\n backgroundClassName={backgroundClassName}\n >\n <div\n ref={ref}\n tabIndex={-1}\n className={clsx(\n 'fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl',\n className\n )}\n role=\"dialog\"\n aria-modal={true}\n >\n <OverlayHeader {...headerProps} onClose={onClose}/>\n {children}\n </div>\n </Overlay>\n )\n}\n\n// --- Dialog ---\n\nexport type DialogProps = Omit<OverlayProps, 'onBackgroundClick'> & {\n headerProps?: Omit<OverlayHeaderProps, 'onClose'>,\n className?: string,\n}\n\n/**\n * A Generic Dialog Window\n */\nexport const Dialog = ({\n children,\n isOpen,\n className,\n backgroundClassName,\n headerProps,\n }: PropsWithChildren<DialogProps>) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (!isOpen) return\n\n const dialog = ref.current\n\n if (!dialog) {\n console.error('dialog open, but no ref found')\n return\n }\n\n overlayStack.push(dialog)\n\n const focusable = dialog?.querySelectorAll(\n 'a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])'\n )\n const first = focusable[0]\n const last = focusable[focusable.length - 1]\n\n const handleKeyDown = (e: KeyboardEvent) => {\n const isTopmost = overlayStack[overlayStack.length - 1] === dialog\n if (!isTopmost) return\n\n if (e.key === 'Escape') {\n e.stopPropagation()\n } else if (e.key === 'Tab') {\n if (focusable.length === 0) return\n\n if (e.shiftKey && document.activeElement === first) {\n e.preventDefault();\n (last as HTMLElement).focus()\n } else if (!e.shiftKey && document.activeElement === last) {\n e.preventDefault();\n (first as HTMLElement).focus()\n }\n }\n }\n\n dialog.focus()\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n overlayStack = overlayStack.filter(m => m !== dialog)\n }\n }, [isOpen])\n\n return (\n <Overlay\n isOpen={isOpen}\n backgroundClassName={backgroundClassName}\n >\n <div\n ref={ref}\n tabIndex={-1}\n className={clsx(\n 'fixed left-1/2 top-1/2 -translate-y-1/2 -translate-x-1/2 col p-4 bg-overlay-background text-overlay-text rounded-xl shadow-xl',\n className\n )}\n role=\"dialog\"\n aria-modal={true}\n >\n {!!headerProps && (<OverlayHeader {...headerProps}/>)}\n {children}\n </div>\n </Overlay>\n )\n}","import type { Dispatch, SetStateAction } from 'react'\nimport { useEffect, useState } from 'react'\n\ntype UseHoverStateProps = {\n /**\n * The delay after which the menu is closed in milliseconds\n *\n * default: 200ms\n */\n closingDelay: number,\n /**\n * Whether the hover state management should be disabled\n *\n * default: false\n */\n isDisabled: boolean,\n}\n\ntype UseHoverStateReturnType = {\n /**\n * Whether the element is hovered\n */\n isHovered: boolean,\n /**\n * Function to change the current hover status\n */\n setIsHovered: Dispatch<SetStateAction<boolean>>,\n /**\n * Handlers to pass on to the component that should be hovered\n */\n handlers: {\n onMouseEnter: () => void,\n onMouseLeave: () => void,\n },\n}\n\nconst defaultUseHoverStateProps: UseHoverStateProps = {\n closingDelay: 200,\n isDisabled: false,\n}\n\n/**\n * @param props See UseHoverStateProps\n *\n * A react hook for managing the hover state of a component. The handlers provided should be\n * forwarded to the component which should be hovered over\n */\nexport const useHoverState = (props: Partial<UseHoverStateProps> | undefined = undefined): UseHoverStateReturnType => {\n const { closingDelay, isDisabled } = { ...defaultUseHoverStateProps, ...props }\n\n const [isHovered, setIsHovered] = useState(false)\n const [timer, setTimer] = useState<NodeJS.Timeout>()\n\n const onMouseEnter = () => {\n if (isDisabled) {\n return\n }\n clearTimeout(timer)\n setIsHovered(true)\n }\n\n const onMouseLeave = () => {\n if (isDisabled) {\n return\n }\n setTimer(setTimeout(() => {\n setIsHovered(false)\n }, closingDelay))\n }\n\n useEffect(() => {\n if (timer) {\n return () => {\n clearTimeout(timer)\n }\n }\n })\n\n useEffect(() => {\n if (timer) {\n clearTimeout(timer)\n }\n }, [isDisabled]) // eslint-disable-line react-hooks/exhaustive-deps\n\n return {\n isHovered, setIsHovered, handlers: { onMouseEnter, onMouseLeave }\n }\n}\n","import type { CSSProperties, PropsWithChildren, ReactNode } from 'react'\nimport { useHoverState } from '@/hooks/useHoverState'\nimport { clsx } from 'clsx'\n\ntype Position = 'top' | 'bottom' | 'left' | 'right'\n\nexport type TooltipProps = PropsWithChildren<{\n tooltip: string | ReactNode,\n /**\n * Number of milliseconds until the tooltip appears\n *\n * defaults to 1000ms\n */\n animationDelay?: number,\n /**\n * Class names of additional styling properties for the tooltip\n */\n tooltipClassName?: string,\n /**\n * Class names of additional styling properties for the container from which the tooltip will be created\n */\n containerClassName?: string,\n position?: Position,\n zIndex?: number,\n}>\n\n/**\n * A Component for showing a tooltip when hovering over Content\n * @param tooltip The tooltip to show can be a text or any ReactNode\n * @param children The Content for which the tooltip should be created\n * @param animationDelay The delay before the tooltip appears\n * @param tooltipClassName Additional ClassNames for the Container of the tooltip\n * @param containerClassName Additional ClassNames for the Container holding the content\n * @param position The direction of the tooltip relative to the Container\n * @param zIndex The z Index of the tooltip (you may require this when stacking modal)\n * @constructor\n */\nexport const Tooltip = ({\n tooltip,\n children,\n animationDelay = 650,\n tooltipClassName = '',\n containerClassName = '',\n position = 'bottom',\n zIndex = 10,\n }: TooltipProps) => {\n const { isHovered, handlers } = useHoverState()\n\n const positionClasses = {\n top: `bottom-full left-1/2 -translate-x-1/2 mb-[6px]`,\n bottom: `top-full left-1/2 -translate-x-1/2 mt-[6px]`,\n left: `right-full top-1/2 -translate-y-1/2 mr-[6px]`,\n right: `left-full top-1/2 -translate-y-1/2 ml-[6px]`\n }\n\n const triangleSize = 6\n const triangleClasses = {\n top: `top-full left-1/2 -translate-x-1/2 border-t-tooltip-background border-l-transparent border-r-transparent`,\n bottom: `bottom-full left-1/2 -translate-x-1/2 border-b-tooltip-background border-l-transparent border-r-transparent`,\n left: `left-full top-1/2 -translate-y-1/2 border-l-tooltip-background border-t-transparent border-b-transparent`,\n right: `right-full top-1/2 -translate-y-1/2 border-r-tooltip-background border-t-transparent border-b-transparent`\n }\n\n const triangleStyle: Record<Position, CSSProperties> = {\n top: { borderWidth: `${triangleSize}px ${triangleSize}px 0 ${triangleSize}px` },\n bottom: { borderWidth: `0 ${triangleSize}px ${triangleSize}px ${triangleSize}px` },\n left: { borderWidth: `${triangleSize}px 0 ${triangleSize}px ${triangleSize}px` },\n right: { borderWidth: `${triangleSize}px ${triangleSize}px ${triangleSize}px 0` }\n }\n\n return (\n <div\n className={clsx('relative inline-block', containerClassName)}\n {...handlers}\n >\n {children}\n {isHovered && (\n <div\n className={clsx(\n `opacity-0 absolute text-xs font-semibold text-tooltip-text px-2 py-1 rounded whitespace-nowrap\n animate-tooltip-fade-in shadow-lg bg-tooltip-background`,\n positionClasses[position], tooltipClassName\n )}\n style={{ zIndex, animationDelay: animationDelay + 'ms' }}\n >\n {tooltip}\n <div\n className={clsx(`absolute w-0 h-0`, triangleClasses[position])}\n style={{ ...triangleStyle[position], zIndex }}\n />\n </div>\n )}\n </div>\n )\n}\n","import clsx from 'clsx'\n\nexport const avtarSizeList = ['tiny', 'small', 'medium', 'large'] as const\nexport type AvatarSize = typeof avtarSizeList[number]\nexport const avatarSizeMapping: Record<AvatarSize, number> = {\n tiny: 24,\n small: 32,\n medium: 48,\n large: 64\n}\n\nexport type AvatarProps = {\n avatarUrl: string,\n alt: string,\n size?: AvatarSize,\n className?: string,\n}\n\n/**\n * A component for showing a profile picture\n */\nexport const Avatar = ({ avatarUrl, alt, size = 'medium', className = '' }: AvatarProps) => {\n // TODO remove later\n avatarUrl = 'https://cdn.helpwave.de/boringavatar.svg'\n\n const avtarSize = {\n tiny: 24,\n small: 32,\n medium: 48,\n large: 64,\n }[size]\n\n const style = {\n width: avtarSize + 'px',\n height: avtarSize + 'px',\n maxWidth: avtarSize + 'px',\n maxHeight: avtarSize + 'px',\n minWidth: avtarSize + 'px',\n minHeight: avtarSize + 'px',\n }\n\n return (\n // TODO transparent or white background later\n <div className={clsx(`rounded-full bg-primary`, className)} style={style}>\n <img\n className=\"rounded-full border border-gray-200\"\n style={style}\n src={avatarUrl}\n alt={alt}\n width={avtarSize}\n height={avtarSize}\n />\n </div>\n )\n}\n\nexport type AvatarGroupProps = {\n avatars: Omit<AvatarProps, 'size'>[],\n maxShownProfiles?: number,\n size?: AvatarSize,\n}\n\n/**\n * A component for showing a group of Avatar's\n */\nexport const AvatarGroup = ({\n avatars,\n maxShownProfiles = 5,\n size = 'tiny'\n }: AvatarGroupProps) => {\n const displayedProfiles = avatars.length < maxShownProfiles ? avatars : avatars.slice(0, maxShownProfiles)\n const diameter = avatarSizeMapping[size]\n const stackingOverlap = 0.5 // given as a percentage\n const notDisplayedProfiles = avatars.length - maxShownProfiles\n const avatarGroupWidth = diameter * (stackingOverlap * (displayedProfiles.length - 1) + 1)\n return (\n <div className=\"row relative\" style={{ height: diameter + 'px' }}>\n <div style={{ width: avatarGroupWidth + 'px' }}>\n {displayedProfiles.map((avatar, index) => (\n <div\n key={index}\n className=\"absolute\"\n style={{ left: (index * diameter * stackingOverlap) + 'px', zIndex: maxShownProfiles - index }}\n >\n <Avatar avatarUrl={avatar.avatarUrl} alt={avatar.alt} size={size}/>\n </div>\n ))}\n </div>\n {\n notDisplayedProfiles > 0 && (\n <div\n className=\"truncate row items-center\"\n style={{ fontSize: (diameter / 2) + 'px', marginLeft: (1 + diameter / 16) + 'px' }}\n >\n <span>+ {notDisplayedProfiles}</span>\n </div>\n )\n }\n </div>\n )\n}","import type { HTMLAttributes } from 'react'\nimport clsx from 'clsx'\n\nexport type CircleProps = Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'color'> & {\n radius: number,\n className?: string,\n}\n\nexport const Circle = ({\n radius = 20,\n className = 'bg-primary',\n style,\n ...restProps\n }: CircleProps) => {\n const size = radius * 2\n return (\n <div\n className={clsx(`rounded-full`, className)}\n style={{\n width: `${size}px`,\n height: `${size}px`,\n ...style,\n }}\n {...restProps}\n />\n )\n}\n","import type { CSSProperties } from 'react'\nimport { useCallback, useEffect, useState } from 'react'\nimport { noop } from '../../util/noop'\nimport { Circle } from './Circle'\nimport clsx from 'clsx'\n\nexport type RingProps = {\n innerSize: number, // the size of the entire circle including the circleWidth\n width: number,\n className?: string,\n};\n\nexport const Ring = ({\n innerSize = 20,\n width = 7,\n className = 'outline-primary',\n }: RingProps) => {\n return (\n <div\n className={clsx(`bg-transparent rounded-full outline`, className)}\n style={{\n width: `${innerSize}px`,\n height: `${innerSize}px`,\n outlineWidth: `${width}px`,\n }}\n />\n )\n}\n\nexport type AnimatedRingProps = RingProps & {\n fillAnimationDuration?: number, // in seconds, 0 means no animation\n repeating?: boolean,\n onAnimationFinished?: () => void,\n style?: CSSProperties,\n};\n\nexport const AnimatedRing = ({\n innerSize,\n width,\n className,\n fillAnimationDuration = 3,\n repeating = false,\n onAnimationFinished = noop,\n style,\n }: AnimatedRingProps) => {\n const [currentWidth, setCurrentWidth] = useState(0)\n const milliseconds = 1000 * fillAnimationDuration\n\n const animate = useCallback((timestamp: number, startTime: number) => {\n const progress = Math.min((timestamp - startTime) / milliseconds, 1)\n const newWidth = Math.min(width * progress, width)\n\n setCurrentWidth(newWidth)\n\n if (progress < 1) {\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))\n } else {\n onAnimationFinished()\n if (repeating) {\n setCurrentWidth(0)\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))\n }\n }\n }, [milliseconds, onAnimationFinished, repeating, width])\n\n useEffect(() => {\n if (currentWidth < width) {\n requestAnimationFrame((timestamp) => animate(timestamp, timestamp))\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n className=\"row items-center justify-center\"\n style={{\n width: `${innerSize + 2 * width}px`,\n height: `${innerSize + 2 * width}px`,\n ...style,\n }}\n >\n <Ring\n innerSize={innerSize}\n width={currentWidth}\n className={className}\n />\n </div>\n )\n}\n\nexport type RingWaveProps = Omit<AnimatedRingProps, 'innerSize'> & {\n startInnerSize: number,\n endInnerSize: number,\n style?: CSSProperties,\n};\n\nexport const RingWave = ({\n startInnerSize = 20,\n endInnerSize = 30,\n width,\n className,\n fillAnimationDuration = 3,\n repeating = false,\n onAnimationFinished = noop,\n style\n }: RingWaveProps) => {\n const [currentInnerSize, setCurrentInnerSize] = useState(startInnerSize)\n const distance = endInnerSize - startInnerSize\n const milliseconds = 1000 * fillAnimationDuration\n\n const animate = useCallback((timestamp: number, startTime: number) => {\n const progress = Math.min((timestamp - startTime) / milliseconds, 1)\n const newInnerSize = Math.min(\n startInnerSize + distance * progress,\n endInnerSize\n )\n\n setCurrentInnerSize(newInnerSize)\n\n if (progress < 1) {\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, startTime))\n } else {\n onAnimationFinished()\n if (repeating) {\n setCurrentInnerSize(startInnerSize)\n requestAnimationFrame((newTimestamp) => animate(newTimestamp, newTimestamp))\n }\n }\n }, [distance, endInnerSize, milliseconds, onAnimationFinished, repeating, startInnerSize])\n\n useEffect(() => {\n if (currentInnerSize < endInnerSize) {\n requestAnimationFrame((timestamp) => animate(timestamp, timestamp))\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return (\n <div\n className=\"row items-center justify-center\"\n style={{\n width: `${endInnerSize + 2 * width}px`,\n height: `${endInnerSize + 2 * width}px`,\n ...style\n }}\n >\n <Ring\n innerSize={currentInnerSize}\n width={width}\n className={className}\n />\n </div>\n )\n}\n\nexport type RadialRingsProps = {\n circle1ClassName?: string,\n circle2ClassName?: string,\n circle3ClassName?: string,\n waveWidth?: number,\n waveBaseColor?: string,\n sizeCircle1?: number,\n sizeCircle2?: number,\n sizeCircle3?: number,\n};\n\n// TODO use fixed colors here to avoid artifacts\nexport const RadialRings = ({\n circle1ClassName = 'bg-primary/90 outline-primary/90',\n circle2ClassName = 'bg-primary/60 outline-primary/60',\n circle3ClassName = 'bg-primary/40 outline-primary/40',\n waveWidth = 10,\n waveBaseColor = 'outline-white/20',\n sizeCircle1 = 100,\n sizeCircle2 = 200,\n sizeCircle3 = 300\n }: RadialRingsProps) => {\n const [currentRing, setCurrentRing] = useState(0)\n const size = sizeCircle3\n\n return (\n <div\n className=\"relative\"\n style={{\n width: `${sizeCircle3}px`,\n height: `${sizeCircle3}px`,\n }}\n >\n <Circle\n radius={sizeCircle1 / 2}\n className={clsx(circle1ClassName, `absolute z-[10] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n {currentRing === 0 ? (\n <AnimatedRing\n innerSize={sizeCircle1}\n width={(sizeCircle2 - sizeCircle1) / 2}\n onAnimationFinished={() =>\n currentRing === 0 ? setCurrentRing(1) : null\n }\n repeating={true}\n className={clsx(circle2ClassName,\n { 'opacity-5': currentRing !== 0 })}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 9\n }}\n />\n ) : null}\n {currentRing === 2 ? (\n <RingWave\n startInnerSize={sizeCircle1 - waveWidth}\n endInnerSize={sizeCircle2}\n width={waveWidth}\n repeating={true}\n className={clsx(waveBaseColor, `opacity-5`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 9,\n }}\n />\n ) : null}\n <Circle\n radius={sizeCircle2 / 2}\n className={clsx(circle2ClassName,\n { 'opacity-20': currentRing < 1 },\n `absolute z-[8] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n {currentRing === 1 ? (\n <AnimatedRing\n innerSize={sizeCircle2 - 1} // potentially harmful\n width={(sizeCircle3 - sizeCircle2) / 2}\n onAnimationFinished={() =>\n currentRing === 1 ? setCurrentRing(2) : null\n }\n repeating={true}\n className={clsx(circle3ClassName)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 7,\n }}\n />\n ) : null}\n {currentRing === 2 ? (\n <RingWave\n startInnerSize={sizeCircle2}\n endInnerSize={sizeCircle3 - waveWidth}\n width={waveWidth}\n repeating={true}\n className={clsx(waveBaseColor, `opacity-5`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`,\n position: 'absolute',\n translate: `-50% -50%`,\n zIndex: 7,\n }}\n />\n ) : null}\n <Circle\n radius={sizeCircle3 / 2}\n className={clsx(circle3ClassName,\n { 'opacity-20': currentRing < 2 },\n `absolute z-[6] -translate-y-1/2 -translate-x-1/2`)}\n style={{\n left: `${size / 2}px`,\n top: `${size / 2}px`\n }}\n />\n </div>\n )\n}\n","export type TagProps = {\n size?: number,\n className?: string,\n}\n\n/**\n * Tag icon from flaticon\n *\n * https://www.flaticon.com/free-icon/price-tag_721550?term=label&page=1&position=8&origin=tag&related_id=721550\n *\n * When using it make attribution\n */\nexport const TagIcon = ({\n className,\n size = 16,\n }: TagProps) => {\n return (\n <img\n style={{ width: `${size}px`, height: `${size}px`, minWidth: `${size}px`, minHeight: `${size}px` }}\n width={size}\n height={size}\n alt=\"\"\n src=\"https://cdn.helpwave.de/icons/label.png\"\n className={className}\n />\n )\n}\n","import Link from 'next/link'\nimport clsx from 'clsx'\n\nexport type Crumb = {\n display: string,\n link: string,\n}\n\ntype BreadCrumbProps = {\n crumbs: Crumb[],\n linkClassName?: string,\n containerClassName?: string,\n}\n\n/**\n * A component for showing a hierarchical link structure with an independent link on each element\n *\n * e.g. Organizations/Ward/<id>\n */\nexport const BreadCrumb = ({ crumbs, linkClassName, containerClassName }: BreadCrumbProps) => {\n const color = 'text-description'\n\n return (\n <div className={clsx('row gap-x-0', containerClassName)}>\n {crumbs.map((crumb, index) => (\n <div key={index}>\n <Link href={crumb.link}\n className={clsx(linkClassName, { [`${color} hover:brightness-60`]: index !== crumbs.length - 1 })}>\n {crumb.display}\n </Link>\n {index !== crumbs.length - 1 && <span className={clsx(`px-1`, color)}>/</span>}\n </div>\n ))}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { createLoopingListWithIndex, range } from '../../util/array'\nimport { clamp } from '../../util/math'\nimport { EaseFunctions } from '../../util/easeFunctions'\nimport type { Direction } from '../../util/loopingArray'\nimport { LoopingArrayCalculator } from '../../util/loopingArray'\n\n\ntype CarouselProps = {\n children: ReactNode[],\n animationTime?: number,\n isLooping?: boolean,\n isAutoLooping?: boolean,\n autoLoopingTimeOut?: number,\n autoLoopAnimationTime?: number,\n hintNext?: boolean,\n arrows?: boolean,\n dots?: boolean,\n /**\n * Percentage that is allowed to be scrolled further\n */\n overScrollThreshold?: number,\n blurColor?: string,\n className?: string,\n heightClassName?: string,\n widthClassName?: string,\n}\n\ntype ItemType = {\n item: ReactNode,\n index: number,\n}\n\ntype CarouselAnimationState = {\n targetPosition: number,\n /**\n * Value of either 1 or -1, 1 is forwards -1 is backwards\n */\n direction: Direction,\n startPosition: number,\n startTime?: number,\n lastUpdateTime?: number,\n isAutoLooping: boolean,\n}\n\ntype DragState = {\n startX: number,\n startTime: number,\n lastX: number,\n startIndex: number,\n}\n\ntype CarouselInformation = {\n currentPosition: number,\n dragState?: DragState,\n animationState?: CarouselAnimationState,\n}\n\nexport const Carousel = ({\n children,\n animationTime = 200,\n isLooping = false,\n isAutoLooping = false,\n autoLoopingTimeOut = 5000,\n autoLoopAnimationTime = 500,\n hintNext = false,\n arrows = false,\n dots = true,\n overScrollThreshold = 0.1,\n blurColor = 'from-white',\n className = '',\n heightClassName = 'h-[24rem]',\n widthClassName = 'w-[70%] desktop:w-1/2',\n }: CarouselProps) => {\n if (isAutoLooping && !isLooping) {\n console.error('When isAutoLooping is true, isLooping should also be true')\n isLooping = true\n }\n\n const [{\n currentPosition,\n dragState,\n animationState,\n }, setCarouselInformation] = useState<CarouselInformation>({\n currentPosition: 0,\n })\n const animationId = useRef<number | undefined>(undefined)\n const timeOut = useRef<NodeJS.Timeout | undefined>(undefined)\n autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut)\n\n const length = children.length\n const paddingItemCount = 3 // The number of items to append left and right of the list to allow for clean transition when looping\n\n const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold])\n const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition))\n animationTime = Math.max(200, animationTime) // in ms, must be > 0\n autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime)\n\n const getStyleOffset = (index: number) => {\n const baseOffset = -50 + (index - currentPosition) * 100\n return `${baseOffset}%`\n }\n\n const animation = useCallback((time: number) => {\n let keepAnimating: boolean = true\n\n // Other calculation in the setState call to avoid updating the useCallback to often\n setCarouselInformation((state) => {\n const {\n animationState,\n dragState\n } = state\n if (animationState === undefined || dragState !== undefined) {\n keepAnimating = false\n return state\n }\n if (!animationState.startTime || !animationState.lastUpdateTime) {\n return {\n ...state,\n animationState: {\n ...animationState,\n startTime: time,\n lastUpdateTime: time\n }\n }\n }\n const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime\n const progress = clamp((time - animationState.startTime) / useAnimationTime) // progress\n const easedProgress = EaseFunctions.easeInEaseOut(progress)\n const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction)\n const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition)\n\n if (animationState.targetPosition === newPosition || progress === 1) {\n keepAnimating = false\n return ({\n currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),\n animationState: undefined\n })\n }\n return ({\n currentPosition: newPosition,\n animationState: {\n ...animationState!,\n lastUpdateTime: time\n }\n })\n })\n if (keepAnimating) {\n animationId.current = requestAnimationFrame(time1 => animation(time1))\n }\n }, [animationTime, autoLoopAnimationTime, util])\n\n useEffect(() => {\n if (animationState) {\n animationId.current = requestAnimationFrame(animation)\n }\n return () => {\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = 0\n }\n }\n }, [animationState]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAutoLoop = () => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: prevState.dragState,\n animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {\n startPosition: currentPosition,\n targetPosition: (currentPosition + 1) % length,\n direction: 1, // always move forward\n isAutoLooping: true\n }\n }))\n\n useEffect(() => {\n if (!animationId.current && !animationState && !dragState && !timeOut.current) {\n if (autoLoopingTimeOut > 0) {\n timeOut.current = setTimeout(() => {\n startAutoLoop()\n timeOut.current = undefined\n }, autoLoopingTimeOut)\n } else {\n startAutoLoop()\n }\n }\n }, [animationState, dragState, animationId.current, timeOut.current]) // eslint-disable-line react-hooks/exhaustive-deps\n\n const startAnimation = (targetPosition?: number) => {\n if (targetPosition === undefined) {\n targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition)\n }\n if (targetPosition === currentPosition) {\n return // we are exactly where we want to be\n }\n\n // find target index and fastest path to it\n const direction = util.getBestDirection(currentPosition, targetPosition)\n clearTimeout(timeOut.current)\n timeOut.current = undefined\n if (animationId.current) {\n cancelAnimationFrame(animationId.current)\n animationId.current = undefined\n }\n\n setCarouselInformation(prevState => ({\n ...prevState,\n dragState: undefined,\n animationState: {\n targetPosition: targetPosition!,\n direction,\n startPosition: currentPosition,\n isAutoLooping: false\n },\n timeOut: undefined\n }))\n }\n\n const canGoLeft = () => {\n return isLooping || currentPosition !== 0\n }\n\n const canGoRight = () => {\n return isLooping || currentPosition !== length - 1\n }\n\n const left = () => {\n if (canGoLeft()) {\n startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1))\n }\n }\n\n const right = () => {\n if (canGoRight()) {\n startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length))\n }\n }\n\n let items: ItemType[] = children.map((item, index) => ({\n index,\n item\n }))\n\n if (isLooping) {\n const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({\n index,\n item\n }))\n const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({\n index,\n item\n }))\n items = [\n ...before,\n ...items,\n ...after\n ]\n }\n\n const onDragStart = (x: number) => setCarouselInformation(prevState => ({\n ...prevState,\n dragState: {\n lastX: x,\n startX: x,\n startTime: Date.now(),\n startIndex: currentPosition,\n },\n animationState: undefined // cancel animation\n }))\n\n const onDrag = (x: number, width: number) => {\n // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues\n if (!dragState || x === 0) {\n return\n }\n const offsetUpdate = (dragState.lastX - x) / width\n const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate)\n\n setCarouselInformation(prevState => ({\n ...prevState,\n currentPosition: newPosition,\n dragState: {\n ...dragState,\n lastX: x\n },\n }))\n }\n\n const onDragEnd = (x: number, width: number) => {\n if (!dragState) {\n return\n }\n const distance = dragState.startX - x\n const relativeDistance = distance / width\n const duration = (Date.now() - dragState.startTime) // in milliseconds\n const velocity = distance / (Date.now() - dragState.startTime)\n\n const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50))\n if (isSlide) {\n if (distance > 0 && canGoRight()) {\n right()\n return\n } else if (distance < 0 && canGoLeft()) {\n left()\n return\n }\n }\n startAnimation()\n }\n\n const dragHandlers = {\n draggable: true,\n onDragStart: (event: React.DragEvent<HTMLDivElement>) => {\n onDragStart(event.clientX)\n event.dataTransfer.setDragImage(document.createElement('div'), 0, 0)\n },\n onDrag: (event: React.DragEvent<HTMLDivElement>) => onDrag(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onDragEnd: (event: React.DragEvent<HTMLDivElement>) => onDragEnd(event.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchStart: (event: React.TouchEvent<HTMLDivElement>) => onDragStart(event.touches[0]!.clientX),\n onTouchMove: (event: React.TouchEvent<HTMLDivElement>) => onDrag(event.touches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchEnd: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n onTouchCancel: (event: React.TouchEvent<HTMLDivElement>) => onDragEnd(event.changedTouches[0]!.clientX, (event.target as HTMLDivElement).getBoundingClientRect().width),\n }\n\n return (\n <div className=\"col items-center w-full gap-y-2\">\n <div className={clsx(`relative w-full overflow-hidden`, heightClassName, className)}>\n {arrows && (\n <>\n <div\n className={clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoLeft() })}\n onClick={() => left()}\n >\n <ChevronLeft size={32}/>\n </div>\n <div\n className={clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoRight() })}\n onClick={() => right()}\n >\n <ChevronRight size={32}/>\n </div>\n </>\n )}\n {hintNext ? (\n <div className={clsx(`relative row h-full`, heightClassName)}>\n <div className=\"relative row h-full w-full px-2 overflow-hidden\">\n {items.map(({\n item,\n index\n }, listIndex) => (\n <div\n key={listIndex}\n className={clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState })}\n style={{ translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }}\n {...dragHandlers}\n onClick={() => startAnimation(index)}\n >\n {item}\n </div>\n ))}\n </div>\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)}\n />\n <div\n className={clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)}\n />\n </div>\n ) : (\n <div className={clsx('px-16 h-full', { '!cursor-grabbing': !!dragState })} {...dragHandlers}>\n {children[currentIndex]}\n </div>\n )}\n </div>\n {dots && (\n <div\n className=\"row items-center justify-center w-full my-2\">\n {range(0, length - 1).map(index => (\n <button\n key={index}\n className={clsx('w-[2rem] min-w-[2rem] h-[0.75rem] min-h-[0.75rem] hover:bg-primary hover:brightness-90 first:rounded-l-md last:rounded-r-md', {\n 'bg-gray-200': currentIndex !== index,\n 'bg-primary': currentIndex === index\n })}\n onClick={() => startAnimation(index)}\n />\n ))}\n </div>\n )}\n </div>\n )\n}\n","import type { HTMLProps, PropsWithChildren, ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type ChipColor = 'default' | 'dark' | 'red' | 'yellow' | 'green' | 'blue' | 'pink'\ntype ChipVariant = 'normal' | 'fullyRounded'\n\nexport type ChipProps = HTMLProps<HTMLDivElement> & PropsWithChildren<{\n color?: ChipColor,\n variant?: ChipVariant,\n trailingIcon?: ReactNode,\n}>\n\n/**\n * A component for displaying a single chip\n */\nexport const Chip = ({\n children,\n trailingIcon,\n color = 'default',\n variant = 'normal',\n className = '',\n ...restProps\n }: ChipProps) => {\n const colorMapping: string = {\n default: 'text-tag-default-text bg-tag-default-background',\n dark: 'text-tag-dark-text bg-tag-dark-background',\n red: 'text-tag-red-text bg-tag-red-background',\n yellow: 'text-tag-yellow-text bg-tag-yellow-background',\n green: 'text-tag-green-text bg-tag-green-background',\n blue: 'text-tag-blue-text bg-tag-blue-background',\n pink: 'text-tag-pink-text bg-tag-pink-background',\n }[color]\n\n const colorMappingIcon: string = {\n default: 'text-tag-default-icon',\n dark: 'text-tag-dark-icon',\n red: 'text-tag-red-icon',\n yellow: 'text-tag-yellow-icon',\n green: 'text-tag-green-icon',\n blue: 'text-tag-blue-icon',\n pink: 'text-tag-pink-icon',\n }[color]\n\n return (\n <div\n {...restProps}\n className={clsx(\n `row w-fit px-2 py-1`,\n colorMapping,\n {\n 'rounded-md': variant === 'normal',\n 'rounded-full': variant === 'fullyRounded',\n },\n className\n )}\n >\n {children}\n {trailingIcon && (<span className={colorMappingIcon}>{trailingIcon}</span>)}\n </div>\n )\n}\n\nexport type ChipListProps = {\n list: ChipProps[],\n className?: string,\n}\n\n/**\n * A component for displaying a list of chips\n */\nexport const ChipList = ({\n list,\n className = ''\n }: ChipListProps) => {\n return (\n <div className={clsx('flex flex-wrap gap-x-4 gap-y-2', className)}>\n {list.map((value, index) => (\n <Chip\n key={index}\n {...value}\n color={value.color ?? 'dark'}\n variant={value.variant ?? 'normal'}\n >\n {value.children}\n </Chip>\n ))}\n </div>\n )\n}\n","import type { HTMLAttributes, ReactNode } from 'react'\nimport clsx from 'clsx'\n\nexport type DividerInserterProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {\n children: ReactNode[],\n divider: (index: number) => ReactNode,\n}\n\n/**\n * A Component for inserting a divider in the middle of each child element\n *\n * undefined elements are removed\n */\nexport const DividerInserter = ({\n children,\n divider,\n className,\n ...restProps\n }: DividerInserterProps) => {\n const nodes: ReactNode[] = []\n\n for (let index = 0; index < children.length; index++) {\n const element = children[index]\n if (element !== undefined) {\n nodes.push(element)\n if (index < children.length - 1) {\n nodes.push(divider(index))\n }\n }\n }\n\n return (\n <div className={clsx(className)} {...restProps}>\n {nodes}\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\nimport { ChevronDown, ChevronUp } from 'lucide-react'\nimport type { ExpandableProps } from './Expandable'\nimport { ExpandableUncontrolled } from './Expandable'\nimport { MarkdownInterpreter } from './MarkdownInterpreter'\n\ntype ContentType = {\n type: 'markdown',\n value: string,\n} | {\n type: 'custom',\n value: ReactNode,\n}\n\nexport type FAQItem = Pick<ExpandableProps, 'isExpanded' | 'className'> & {\n id: string,\n title: string,\n content: ContentType,\n}\n\nexport type FAQSectionProps = {\n entries: FAQItem[],\n expandableClassName?: string,\n}\n\n/**\n * Description\n */\nexport const FAQSection = ({\n entries,\n expandableClassName\n }: FAQSectionProps) => {\n const chevronSize = 28\n return (\n <div className=\"col gap-y-4\">\n {entries.map(({ id, title, content, ...restProps }) => (\n <ExpandableUncontrolled\n key={id}\n {...restProps}\n label={(<h3 id={id} className=\"textstyle-title-md\">{title}</h3>)}\n clickOnlyOnHeader={false}\n icon={(expanded) => expanded ?\n (<ChevronUp size={chevronSize} className=\"text-primary\" style={{ minWidth: `${chevronSize}px` }}/>) :\n (<ChevronDown size={chevronSize} className=\"text-primary\"/>)\n }\n className={clsx('rounded-xl', expandableClassName)}\n >\n <div className=\"mt-2\">\n {content.type === 'markdown' ? (<MarkdownInterpreter text={content.value}/>) : content.value}\n </div>\n </ExpandableUncontrolled>\n ))}\n </div>\n )\n}\n","type ASTNodeModifierType =\n 'none'\n | 'italic'\n | 'bold'\n | 'underline'\n | 'font-space'\n | 'primary'\n | 'secondary'\n | 'warn'\n | 'positive'\n | 'negative'\n\nconst astNodeInserterType = ['helpwave', 'newline'] as const\ntype ASTNodeInserterType = typeof astNodeInserterType[number]\ntype ASTNodeDefaultType = 'text'\n\ntype ASTNode = {\n type: ASTNodeModifierType,\n children: ASTNode[],\n} | {\n type: ASTNodeInserterType,\n} | {\n type: ASTNodeDefaultType,\n text: string,\n}\n\nexport type ASTNodeInterpreterProps = {\n node: ASTNode,\n isRoot?: boolean,\n className?: string,\n}\nexport const ASTNodeInterpreter = ({\n node,\n isRoot = false,\n className = '',\n }: ASTNodeInterpreterProps) => {\n switch (node.type) {\n case 'newline':\n return <br/>\n case 'text':\n return isRoot ? <span className={className}>{node.text}</span> : node.text\n case 'helpwave':\n return (<span className=\"font-bold font-space no-underline\">helpwave</span>)\n case 'none':\n return isRoot ? (\n <span className={className}>{node.children.map((value, index) => (\n <ASTNodeInterpreter key={index}\n node={value}/>\n ))}</span>\n ) :\n <>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</>\n case 'bold':\n return <b>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</b>\n case 'italic':\n return <i>{node.children.map((value, index) => <ASTNodeInterpreter key={index} node={value}/>)}</i>\n case 'underline':\n return (<u>{node.children.map((value, index) => (<ASTNodeInterpreter key={index} node={value}/>))}</u>)\n case 'font-space':\n return (\n <span className=\"font-space\">{node.children.map((value, index) => (\n <ASTNodeInterpreter key={index}\n node={value}/>\n ))}</span>\n )\n case 'primary':\n return (\n <span className=\"text-primary\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'secondary':\n return (\n <span className=\"text-secondary\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'warn':\n return (\n <span className=\"text-warning\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'positive':\n return (\n <span className=\"text-positive\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n case 'negative':\n return (\n <span className=\"text-negative\">{node.children.map((value, index) => (\n <ASTNodeInterpreter\n key={index} node={value}/>\n ))}</span>\n )\n default:\n return null\n }\n}\n\nconst modifierIdentifierMapping = [\n { id: 'i', name: 'italic' },\n { id: 'b', name: 'bold' },\n { id: 'u', name: 'underline' },\n { id: 'space', name: 'font-space' },\n { id: 'primary', name: 'primary' },\n { id: 'secondary', name: 'secondary' },\n { id: 'warn', name: 'warn' },\n { id: 'positive', name: 'positive' },\n { id: 'negative', name: 'negative' },\n] as const\n\nconst inserterIdentifierMapping = [\n { id: 'helpwave', name: 'helpwave' },\n { id: 'newline', name: 'newline' }\n] as const\nconst parseMarkdown = (\n text: string,\n commandStart: string = '\\\\',\n open: string = '{',\n close: string = '}'\n): ASTNode => {\n let start = text.indexOf(commandStart)\n const children: ASTNode[] = []\n\n // parse the text step by step\n while (text !== '') {\n if (start === -1) {\n children.push({\n type: 'text',\n text\n })\n break\n }\n children.push(parseMarkdown(text.substring(0, start)))\n text = text.substring(start)\n if (text.length <= 1) {\n children.push({\n type: 'text',\n text\n })\n text = ''\n continue\n }\n const simpleReplace = [commandStart, open, close]\n if (simpleReplace.some(value => text[1] === value)) {\n children.push({\n type: 'text',\n text: simpleReplace.find(value => text[1] === value)!\n })\n text = text.substring(2)\n start = text.indexOf(commandStart)\n continue\n }\n const inserter = inserterIdentifierMapping.find(value => text.substring(1).startsWith(value.id))\n if (inserter) {\n children.push({\n type: inserter.name,\n })\n text = text.substring(inserter.id.length + 1)\n start = text.indexOf(commandStart)\n continue\n }\n const modifier = modifierIdentifierMapping.find(value => text.substring(1).startsWith(value.id))\n if (modifier) {\n // check brackets\n if (text[modifier.id.length + 1] !== open) {\n children.push({\n type: 'text',\n text: text.substring(0, modifier.id.length + 1)\n })\n text = text.substring(modifier.id.length + 2)\n start = text.indexOf(commandStart)\n continue\n }\n let closing = -1\n let index = modifier.id.length + 2\n let counter = 1\n let escaping = false\n while (index < text.length) {\n if (text[index] === open && !escaping) {\n counter++\n }\n if (text[index] === close && !escaping) {\n counter--\n if (counter === 0) {\n closing = index\n break\n }\n }\n escaping = text[index] === commandStart\n index++\n }\n\n if (closing !== -1) {\n children.push({\n type: modifier.name,\n children: [parseMarkdown(text.substring(modifier.id.length + 2, closing))]\n })\n text = text.substring(closing + 1)\n start = text.indexOf(commandStart)\n continue\n }\n }\n // nothing could be applied to command start\n children.push({\n type: 'text',\n text: text[0]!\n })\n text = text.substring(1)\n start = text.indexOf(commandStart)\n }\n\n return {\n type: 'none',\n children\n }\n}\n\nconst optimizeTree = (node: ASTNode) => {\n if (node.type === 'text') {\n return !node.text ? undefined : node\n }\n if (astNodeInserterType.some(value => value === node.type)) {\n return node\n }\n\n const currentNode = node as\n { type: ASTNodeModifierType, children: ASTNode[] }\n\n if (currentNode.children.length === 0) {\n return undefined\n }\n\n let children: ASTNode[] = []\n for (let i = 0; i < currentNode.children.length; i++) {\n const child = optimizeTree(currentNode.children[i]!)\n if (!child) {\n continue\n }\n if (child.type === 'none') {\n children.push(...child.children)\n } else {\n children.push(child)\n }\n }\n\n currentNode.children = children\n children = []\n\n for (let i = 0; i < currentNode.children.length; i++) {\n const child = currentNode.children[i]!\n if (child) {\n if (child.type === 'text' && children[children.length - 1]?.type === 'text') {\n (children[children.length - 1]! as { type: ASTNodeDefaultType, text: string }).text += child.text\n } else {\n children.push(child)\n }\n }\n }\n currentNode.children = children\n return currentNode\n}\n\nexport type MarkdownInterpreterProps = {\n text: string,\n className?: string,\n}\n\nexport const MarkdownInterpreter = ({ text, className }: MarkdownInterpreterProps) => {\n const tree = parseMarkdown(text)\n const optimizedTree = optimizeTree(tree)!\n return <ASTNodeInterpreter node={optimizedTree} isRoot={true} className={className}/>\n}\n","import { ChevronFirst, ChevronLast, ChevronLeft, ChevronRight } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { Language } from '../../localization/util'\n\ntype PaginationTranslation = {\n of: string,\n}\nconst defaultPaginationTranslations: Record<Language, PaginationTranslation> = {\n en: {\n of: 'of'\n },\n de: {\n of: 'von'\n }\n}\n\nexport type PaginationProps = {\n page: number, // starts with 0\n numberOfPages: number,\n onPageChanged: (page: number) => void,\n}\n\n/**\n * A Component showing the pagination allowing first, before, next and last page navigation\n */\nexport const Pagination = ({\n overwriteTranslation,\n page,\n numberOfPages,\n onPageChanged\n }: PropsForTranslation<PaginationTranslation, PaginationProps>) => {\n const translation = useTranslation(defaultPaginationTranslations, overwriteTranslation)\n\n const changePage = (page: number) => {\n onPageChanged(page)\n }\n\n const noPages = numberOfPages === 0\n const onFirstPage = page === 0 && !noPages\n const onLastPage = page === numberOfPages - 1\n\n return (\n <div className={clsx('row', { 'opacity-30': noPages })}>\n <button onClick={() => changePage(0)} disabled={onFirstPage}>\n <ChevronFirst className={clsx({ 'opacity-30': onFirstPage })}/>\n </button>\n <button onClick={() => changePage(page - 1)} disabled={onFirstPage}>\n <ChevronLeft className={clsx({ 'opacity-30': onFirstPage })}/>\n </button>\n <div className=\"min-w-[80px] justify-center mx-2\">\n <span className=\"select-none text-right flex-1\">{noPages ? 0 : page + 1}</span>\n <span className=\"select-none mx-2\">{translation.of}</span>\n <span className=\"select-none text-left flex-1\">{numberOfPages}</span>\n </div>\n <button onClick={() => changePage(page + 1)} disabled={onLastPage || noPages}>\n <ChevronRight className={clsx({ 'opacity-30': onLastPage })}/>\n </button>\n <button onClick={() => changePage(numberOfPages - 1)} disabled={onLastPage || noPages}>\n <ChevronLast className={clsx({ 'opacity-30': onLastPage })}/>\n </button>\n </div>\n )\n}\n","import type { ReactNode } from 'react'\nimport { useEffect, useMemo, useState } from 'react'\nimport { Search } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport { Input } from '../user-action/Input'\n\ntype SearchableListTranslation = {\n search: string,\n nothingFound: string,\n}\n\nconst defaultSearchableListTranslation: Record<Language, SearchableListTranslation> = {\n en: {\n search: 'Search',\n nothingFound: 'Nothing found'\n },\n de: {\n search: 'Suche',\n nothingFound: 'Nichts gefunden'\n }\n}\n\nexport type SearchableListProps<T> = {\n list: T[],\n initialSearch?: string,\n searchMapping: (value: T) => string[],\n itemMapper: (value: T) => ReactNode,\n className?: string,\n}\n\n/**\n * A component for searching a list\n */\nexport const SearchableList = <T, >({\n overwriteTranslation,\n list,\n initialSearch = '',\n searchMapping,\n itemMapper,\n className\n }: PropsForTranslation<SearchableListTranslation, SearchableListProps<T>>) => {\n const translation = useTranslation(defaultSearchableListTranslation, overwriteTranslation)\n const [search, setSearch] = useState<string>(initialSearch)\n\n useEffect(() => setSearch(initialSearch), [initialSearch])\n\n const filteredEntries = useMemo(() => MultiSearchWithMapping(search, list, searchMapping), [search, list, searchMapping])\n\n return (\n <div className={clsx('col gap-y-2', className)}>\n <div className=\"row justify-between gap-x-2 items-center\">\n <div className=\"flex-1\">\n <Input value={search} onChangeText={setSearch} placeholder={translation.search}/>\n </div>\n <Search size={20}/>\n </div>\n {filteredEntries.length > 0 && (\n <div className=\"col gap-y-1\">\n {filteredEntries.map(itemMapper)}\n </div>\n )}\n {!filteredEntries.length && <div className=\"row justify-center\">{translation.nothingFound}</div>}\n </div>\n )\n}\n","import React, { forwardRef, type InputHTMLAttributes, useEffect, useRef, useState } from 'react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type InputProps = {\n /**\n * used for the label's `for` attribute\n */\n label?: Omit<LabelProps, 'id'>,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n className?: string,\n onEditCompleted?: (text: string) => void,\n expanded?: boolean,\n containerClassName?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'label'>\n\n/**\n * A Component for inputting text or other information\n *\n * Its state is managed must be managed by the parent\n */\nconst Input = ({\n id,\n type = 'text',\n value,\n label,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted,\n className = '',\n expanded = true,\n autoFocus,\n onBlur,\n containerClassName,\n ...restProps\n }: InputProps) => {\n const {\n restartTimer,\n clearUpdateTimer\n } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n useEffect(() => {\n if(autoFocus) {\n ref.current?.focus()\n }\n }, [autoFocus])\n\n return (\n <div className={clsx({ 'w-full': expanded }, containerClassName)}>\n {label && <Label {...label} htmlFor={id} className={clsx('mb-1', label.className)}/>}\n <input\n ref={ref}\n value={value}\n id={id}\n type={type}\n className={className}\n onBlur={event => {\n if (onBlur) {\n onBlur(event)\n }\n if (onEditCompleted) {\n onEditCompleted(event.target.value)\n clearUpdateTimer()\n }\n }}\n onChange={e => {\n const value = e.target.value\n if (onEditCompleted) {\n restartTimer(() => {\n onEditCompleted(value)\n clearUpdateTimer()\n })\n }\n onChange(e)\n onChangeText(value)\n }}\n {...restProps}\n />\n </div>\n )\n}\n\ntype InputUncontrolledProps = Omit<InputProps, 'value'> & {\n /**\n * @default ''\n */\n defaultValue?: string,\n}\n\n/**\n * A Component for inputting text or other information\n *\n * Its state is managed by the component itself\n */\nconst InputUncontrolled = ({\n defaultValue = '',\n onChangeText = noop,\n ...props\n }: InputUncontrolledProps) => {\n const [value, setValue] = useState(defaultValue)\n\n return (\n <Input\n {...props}\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n />\n )\n}\n\nexport type FormInputProps = InputHTMLAttributes<HTMLInputElement> & {\n id: string,\n labelText?: string,\n errorText?: string,\n labelClassName?: string,\n errorClassName?: string,\n containerClassName?: string,\n}\n\nconst FormInput = forwardRef<HTMLInputElement, FormInputProps>(function FormInput({\n id,\n labelText,\n errorText,\n className,\n labelClassName,\n errorClassName,\n containerClassName,\n required,\n ...restProps\n }, ref) {\n const input = (\n <input\n ref={ref}\n id={id}\n {...restProps}\n className={clsx(\n {\n 'focus:border-primary focus:ring-primary': !errorText,\n 'focus:border-negative focus:ring-negative text-negative': !!errorText,\n },\n className\n )}\n />\n )\n\n return (\n <div className={clsx('flex flex-col gap-y-1', containerClassName)}>\n {labelText && (\n <label htmlFor={id} className={clsx('textstyle-label-md', labelClassName)}>\n {labelText}\n {required && <span className=\"text-primary font-bold\">*</span>}\n </label>\n )}\n {input}\n {errorText && <label htmlFor={id} className={clsx('text-negative', errorClassName)}>{errorText}</label>}\n </div>\n )\n})\n\nexport {\n InputUncontrolled,\n Input,\n FormInput\n}\n","import { useEffect, useState } from 'react'\n\nexport function useSaveDelay(setNotificationStatus: (isShowing: boolean) => void, delay: number) {\n const [updateTimer, setUpdateTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n const [notificationTimer, setNotificationTimer] = useState<NodeJS.Timeout | undefined>(undefined)\n\n const restartTimer = (onSave: () => void) => {\n clearTimeout(updateTimer)\n setUpdateTimer(setTimeout(() => {\n onSave()\n setNotificationStatus(true)\n // Show Saved Notification for fade animation duration\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n clearTimeout(updateTimer)\n }, delay))\n }\n\n const clearUpdateTimer = (hasSaved = true) => {\n clearTimeout(updateTimer)\n if (hasSaved) {\n setNotificationStatus(true)\n clearTimeout(notificationTimer)\n setNotificationTimer(setTimeout(() => {\n setNotificationStatus(false)\n clearTimeout(notificationTimer)\n }, delay))\n } else {\n setNotificationStatus(false)\n }\n }\n\n useEffect(() => {\n return () => {\n clearTimeout(updateTimer)\n clearTimeout(notificationTimer)\n }\n }, []) // eslint-disable-line react-hooks/exhaustive-deps\n\n return { restartTimer, clearUpdateTimer }\n}","import type { LabelHTMLAttributes } from 'react'\nimport clsx from 'clsx'\n\nexport type LabelType = 'labelSmall' | 'labelMedium' | 'labelBig'\n\nconst styleMapping: Record<LabelType, string> = {\n labelSmall: 'textstyle-label-sm',\n labelMedium: 'textstyle-label-md',\n labelBig: 'textstyle-label-lg',\n}\n\nexport type LabelProps = {\n /** The text for the label */\n name?: string,\n /** The styling for the label */\n labelType?: LabelType,\n} & LabelHTMLAttributes<HTMLLabelElement>\n\n/**\n * A Label component\n */\nexport const Label = ({\n children,\n name,\n labelType = 'labelSmall',\n className,\n ...props\n }: LabelProps) => {\n return (\n <label {...props} className={clsx(styleMapping[labelType], className)}>\n {children ? children : name}\n </label>\n )\n}\n","import { Check, ChevronLeft, ChevronRight } from 'lucide-react'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { range } from '@/util/array'\nimport { SolidButton } from '../user-action/Button'\nimport clsx from 'clsx'\nimport { useEffect, useState } from 'react'\n\ntype StepperBarTranslation = {\n back: string,\n next: string,\n confirm: string,\n}\n\nconst defaultStepperBarTranslation: Record<Language, StepperBarTranslation> = {\n en: {\n back: 'Back',\n next: 'Next Step',\n confirm: 'Create'\n },\n de: {\n back: 'Zurück',\n next: 'Nächster Schritt',\n confirm: 'Erstellen'\n }\n}\n\nexport type StepperState = {\n currentStep: number,\n seenSteps: Set<number>,\n}\n\nexport type StepperBarProps = {\n state?: StepperState,\n numberOfSteps: number,\n disabledSteps: Set<number>,\n onChange: (state: StepperState) => void,\n onFinish: () => void,\n finishText?: string,\n showDots?: boolean,\n className?: string,\n}\n\nconst defaultState: StepperState = {\n currentStep: 0,\n seenSteps: new Set([0])\n}\n\n/**\n * A Component for stepping\n */\nexport const StepperBar = ({\n overwriteTranslation,\n state,\n numberOfSteps,\n disabledSteps = new Set(),\n onChange,\n onFinish,\n finishText,\n showDots = true,\n className = '',\n }: PropsForTranslation<StepperBarTranslation, StepperBarProps>) => {\n const translation = useTranslation(defaultStepperBarTranslation, overwriteTranslation)\n const dots = range(0, numberOfSteps)\n const { currentStep, seenSteps } = state ?? defaultState\n\n const update = (newStep: number) => {\n seenSteps.add(newStep)\n onChange({ currentStep: newStep, seenSteps })\n }\n\n return (\n <div\n className={clsx('row justify-between',className)}\n >\n <div className=\"row flex-[2] justify-start\">\n <SolidButton\n disabled={currentStep === 0 || disabledSteps.has(currentStep)}\n onClick={() => {\n update(currentStep - 1)\n }}\n className=\"row gap-x-1 items-center justify-center\"\n >\n <ChevronLeft size={14}/>\n {translation.back}\n </SolidButton>\n </div>\n <div className=\"row flex-[5] gap-x-2 justify-center items-center\">\n {showDots && dots.map((value, index) => {\n const seen = seenSteps.has(index)\n return (\n <div\n key={index}\n onClick={() => seen && update(index)}\n className={clsx('rounded-full w-4 h-4', {\n 'bg-primary hover:brightness-75': index === currentStep && seen && !disabledSteps.has(currentStep),\n 'bg-primary/40 hover:bg-primary': index !== currentStep && seen && !disabledSteps.has(currentStep),\n 'bg-gray-200 outline-transparent': !seen || disabledSteps.has(currentStep),\n },\n {\n 'cursor-pointer': seen,\n 'cursor-not-allowed': !seen || disabledSteps.has(currentStep),\n })}\n />\n )\n })}\n </div>\n {currentStep !== numberOfSteps && (\n <div className=\"row flex-[2] justify-end\">\n <SolidButton\n onClick={() => update(currentStep + 1)}\n className=\"row gap-x-1 items-center justify-center\"\n disabled={disabledSteps.has(currentStep)}\n >\n {translation.next}\n <ChevronRight size={14}/>\n </SolidButton>\n </div>\n )}\n {currentStep === numberOfSteps && (\n <div className=\"row flex-[2] justify-end\">\n <SolidButton\n disabled={disabledSteps.has(currentStep)}\n onClick={onFinish}\n className=\"row gap-x-1 items-center justify-center\"\n >\n <Check size={14}/>\n {finishText ?? translation.confirm}\n </SolidButton>\n </div>\n )}\n </div>\n )\n}\n\nexport const StepperBarUncontrolled = ({ state, onChange, ...props }: StepperBarProps) => {\n const [usedState, setUsedState] = useState<StepperState>(state ?? defaultState)\n\n useEffect(() => {\n setUsedState(state ?? defaultState)\n }, [state])\n\n return (\n <StepperBar\n {...props}\n state={usedState}\n onChange={newState => {\n setUsedState(newState)\n onChange(newState)\n }}\n />\n )\n}","import type { ReactElement } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Scrollbars } from 'react-custom-scrollbars-2'\nimport { noop } from '../../util/noop'\nimport { Checkbox } from '../user-action/Checkbox'\nimport { Pagination } from './Pagination'\nimport clsx from 'clsx'\nimport type { TextButtonProps } from '../user-action/Button'\nimport { TextButton } from '../user-action/Button'\nimport { ChevronDown, ChevronsUpDown, ChevronUp } from 'lucide-react'\n\nexport type TableStatePagination = {\n currentPage: number,\n entriesPerPage: number,\n}\nexport const defaultTableStatePagination = {\n currentPage: 0,\n entriesPerPage: 5\n}\n\nexport type TableStateSelection<T> = {\n currentSelection: T[],\n hasSelectedAll: boolean,\n hasSelectedSome: boolean,\n hasSelectedNone: boolean,\n}\n\nexport const defaultTableStateSelection = {\n currentSelection: [],\n hasSelectedAll: false,\n hasSelectedSome: false,\n hasSelectedNone: true\n}\n\nexport type TableState = {\n pagination?: TableStatePagination,\n selection?: {\n /**\n * The mapped ids of the dataType\n */\n currentSelection: string[],\n hasSelectedAll: boolean,\n hasSelectedSome: boolean,\n hasSelectedNone: boolean,\n },\n}\n\ntype IdentifierMapping<T> = (dataObject: T) => string\n\nexport const isDataObjectSelected = <T, >(tableState: TableState, dataObject: T, identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return false\n }\n\n return !!tableState.selection.currentSelection.find(value => value.localeCompare(identifierMapping(dataObject)) === 0)\n}\n\nexport const pageForItem = <T, >(data: T[], item: T, entriesPerPage: number, identifierMapping: IdentifierMapping<T>) => {\n const index = data.findIndex(value => identifierMapping(value) === identifierMapping(item))\n if (index !== -1) {\n return Math.floor(index / entriesPerPage)\n }\n console.warn(\"item doesn't exist on data\", item, data)\n return 0\n}\n\nexport const updatePagination = (pagination: TableStatePagination, dataLength: number): TableStatePagination => ({\n ...pagination,\n currentPage: Math.min(Math.max(Math.ceil(dataLength / pagination.entriesPerPage) - 1, 0), pagination.currentPage)\n})\n\nexport const addElementToTable = <T, >(tableState: TableState, data: T[], dataObject: T, identifierMapping: IdentifierMapping<T>) => {\n return {\n ...tableState,\n pagination: tableState.pagination ? {\n ...tableState.pagination,\n currentPage: pageForItem(data, dataObject, tableState.pagination.entriesPerPage, identifierMapping)\n } : undefined,\n selection: tableState.selection ? {\n ...tableState.selection,\n hasSelectedAll: false,\n hasSelectedSome: tableState.selection.hasSelectedAll || tableState.selection.hasSelectedSome\n } : undefined\n }\n}\n\n/**\n * data length before delete\n */\nexport const removeFromTableSelection = <T, >(tableState: TableState, deletedObjects: T[], dataLength: number, identifierMapping: IdentifierMapping<T>): TableState => {\n if (!tableState.selection) {\n return tableState\n }\n\n const deletedObjectIds = deletedObjects.map(identifierMapping)\n const elementsBefore = tableState.selection.currentSelection.length\n const currentSelection = tableState.selection.currentSelection.filter((value) => !deletedObjectIds.includes(value))\n dataLength -= elementsBefore - currentSelection.length\n\n return {\n ...tableState,\n selection: {\n currentSelection,\n hasSelectedAll: currentSelection.length === dataLength && dataLength !== 0,\n hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,\n hasSelectedNone: currentSelection.length === 0,\n },\n pagination: tableState.pagination ? updatePagination(tableState.pagination, dataLength) : undefined\n }\n}\n\nexport const changeTableSelectionSingle = <T, >(tableState: TableState, dataObject: T, dataLength: number, identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return tableState\n }\n\n const hasSelectedObject = isDataObjectSelected(tableState, dataObject, identifierMapping)\n let currentSelection = [...tableState.selection.currentSelection, identifierMapping(dataObject)] // case !hasSelectedObject\n if (hasSelectedObject) {\n currentSelection = tableState.selection.currentSelection.filter(value => value.localeCompare(identifierMapping(dataObject)) !== 0)\n }\n\n return {\n ...tableState,\n selection: {\n currentSelection,\n hasSelectedAll: currentSelection.length === dataLength,\n hasSelectedSome: currentSelection.length > 0 && currentSelection.length !== dataLength,\n hasSelectedNone: currentSelection.length === 0,\n }\n }\n}\n\nconst changeTableSelectionAll = <T, >(tableState: TableState, data: T[], identifierMapping: IdentifierMapping<T>) => {\n if (!tableState.selection) {\n return tableState\n }\n\n if (data.length === 0) {\n return {\n ...tableState,\n selection: {\n currentSelection: [],\n hasSelectedAll: false,\n hasSelectedSome: false,\n hasSelectedNone: true\n }\n }\n }\n\n const hasSelectedAll = !(tableState.selection.hasSelectedSome || tableState.selection.hasSelectedAll)\n return {\n ...tableState,\n selection: {\n currentSelection: hasSelectedAll ? data.map(identifierMapping) : [],\n hasSelectedAll,\n hasSelectedSome: false,\n hasSelectedNone: !hasSelectedAll\n }\n }\n}\n\nexport type TableSortingType = 'ascending' | 'descending'\nexport type TableSortingFunctionType<T> = (t1: T, t2: T) => number\n\nexport type TableProps<T> = {\n data: T[],\n /**\n * When using selection or pagination\n */\n stateManagement?: [TableState, (tableState: TableState) => void],\n identifierMapping: IdentifierMapping<T>,\n /**\n * Only the cell itself no boilerplate <tr> or <th> required\n */\n header?: ReactElement[],\n /**\n * Only the cells of the row no boilerplate <tr> or <td> required\n */\n rowMappingToCells: (dataObject: T) => ReactElement[],\n sorting?: [TableSortingFunctionType<T>, TableSortingType],\n /**\n * Always go to the page of this element\n */\n focusElement?: T,\n className?: string,\n}\n\n/* Possible extension for better customization\n * Map each element to the displayed row\n * make sure to wrap it in the <tr> and <td> you require\n rowMappingToHTMLRow?: (dataObject: T) => ReactElement\n */\n\n/**\n * A Basic stateless reusable table\n * The state must be handled and saved with the updateTableState method\n */\nexport const Table = <T, >({\n data,\n stateManagement = [{}, noop],\n identifierMapping,\n header,\n rowMappingToCells,\n sorting,\n focusElement,\n className\n }: TableProps<T>) => {\n const sortedData = [...data]\n if (sorting) {\n const [sortingFunction, sortingType] = sorting\n sortedData.sort((a, b) => sortingFunction(a, b) * (sortingType === 'ascending' ? 1 : -1))\n }\n let currentPage = 0\n let pageCount = 1\n let entriesPerPage = 5\n const [tableState, updateTableState] = stateManagement\n\n let shownElements = sortedData\n\n if (tableState?.pagination) {\n if (tableState.pagination.entriesPerPage < 1) {\n console.error('tableState.pagination.entriesPerPage must be >= 1', tableState.pagination.entriesPerPage)\n }\n entriesPerPage = Math.max(1, tableState.pagination.entriesPerPage)\n pageCount = Math.ceil(sortedData.length / entriesPerPage)\n\n if (tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0)) {\n console.error('tableState.pagination.currentPage < 0 || (tableState.pagination.currentPage >= pageCount && pageCount !== 0) must be fullfilled',\n [`pageCount: ${pageCount}`, `tableState.pagination.currentPage: ${tableState.pagination.currentPage}`])\n } else {\n currentPage = tableState.pagination.currentPage\n }\n\n if (focusElement) {\n currentPage = pageForItem(sortedData, focusElement, entriesPerPage, identifierMapping)\n }\n\n shownElements = sortedData.slice(currentPage * entriesPerPage, Math.min(sortedData.length, (currentPage + 1) * entriesPerPage))\n } else {\n currentPage = 0\n }\n\n const headerRow = 'border-b-2 border-gray-300'\n const headerPaddingHead = 'pb-2'\n const headerPaddingBody = 'pt-2'\n const cellPadding = 'py-1 px-2'\n\n const [scrollbarsAutoHeightMin, setScrollbarsAutoHeightMin] = useState(0)\n const tableRef = useRef<HTMLTableElement>(null)\n\n const calculateHeight = () => {\n if (tableRef.current) {\n const tableHeight = tableRef.current.offsetHeight\n const offset = 25\n setScrollbarsAutoHeightMin(tableHeight + offset)\n }\n }\n\n useEffect(() => {\n calculateHeight()\n\n // New function to unbind properly\n const handleResize = () => {\n calculateHeight()\n }\n\n window.addEventListener('resize', handleResize)\n\n return () => {\n window.removeEventListener('resize', handleResize)\n }\n }, [data, currentPage])\n\n return (\n <div className={clsx('col gap-y-4 overflow-hidden', className)}>\n <div>\n <Scrollbars autoHeight autoHeightMin={scrollbarsAutoHeightMin}>\n <table ref={tableRef} className=\"w-full mb-[12px]\">\n <thead>\n <tr className={headerRow}>\n {header && tableState.selection && (\n <th className={headerPaddingHead}>\n <Checkbox\n checked={tableState.selection.hasSelectedSome ? 'indeterminate' : tableState.selection.hasSelectedAll}\n onChange={() => updateTableState(changeTableSelectionAll(tableState, data, identifierMapping))}\n />\n </th>\n )}\n {header && header.map((value, index) => (\n <th key={`tableHeader${index}`} className={headerPaddingHead}>\n <div className=\"row justify-start px-2\">\n {value}\n </div>\n </th>\n ))}\n </tr>\n </thead>\n <tbody>\n {shownElements.map((value, rowIndex) => (\n <tr key={identifierMapping(value)}>\n {tableState.selection && (\n <td className={clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 })}>\n <Checkbox\n checked={isDataObjectSelected(tableState, value, identifierMapping)}\n onChange={() => {\n updateTableState(changeTableSelectionSingle(tableState, value, data.length, identifierMapping))\n }}\n />\n </td>\n )}\n {rowMappingToCells(value).map((value1, index) => (\n <td key={index}\n className={clsx(cellPadding, { [headerPaddingBody]: rowIndex === 0 })}>\n {value1}\n </td>\n ))}\n </tr>\n ))}\n </tbody>\n </table>\n </Scrollbars>\n </div>\n <div className=\"row justify-center\">\n {tableState.pagination && (\n <Pagination page={currentPage} numberOfPages={pageCount} onPageChanged={page => updateTableState({\n ...tableState,\n pagination: { entriesPerPage, currentPage: page }\n })}/>\n )}\n </div>\n </div>\n )\n}\n\nexport type SortButtonProps = Omit<TextButtonProps, 'onClick'> & {\n ascending?: TableSortingType,\n onClick: (newTableSorting: TableSortingType) => void,\n}\n\n/**\n * A Extension of the normal button that displays the sorting state right of the content\n */\nexport const SortButton = ({\n children,\n ascending,\n color,\n onClick,\n ...buttonProps\n }: SortButtonProps) => {\n return (\n <TextButton\n color={color}\n onClick={() => onClick(ascending === 'descending' ? 'ascending' : 'descending')}\n {...buttonProps}\n >\n <div className=\"row gap-x-2\">\n {children}\n {ascending === 'ascending' ? <ChevronUp/> : (!ascending ? <ChevronsUpDown/> : <ChevronDown/>)}\n </div>\n </TextButton>\n )\n}\n\n","import { useState } from 'react'\nimport type { CheckedState } from '@radix-ui/react-checkbox'\nimport * as CheckboxPrimitive from '@radix-ui/react-checkbox'\nimport { Check, Minus } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\ntype CheckBoxSize = 'small' | 'medium' | 'large'\n\nconst checkboxSizeMapping: Record<CheckBoxSize, string> = {\n small: 'size-4',\n medium: 'size-6',\n large: 'size-8',\n}\n\nconst checkboxIconSizeMapping: Record<CheckBoxSize, string> = {\n small: 'size-3',\n medium: 'size-5',\n large: 'size-7',\n}\n\ntype CheckboxProps = {\n /** used for the label's `for` attribute */\n id?: string,\n label?: Omit<LabelProps, 'id'>,\n /**\n * @default false\n */\n checked: CheckedState,\n disabled?: boolean,\n onChange?: (checked: boolean) => void,\n onChangeTristate?: (checked: CheckedState) => void,\n size?: CheckBoxSize,\n className?: string,\n containerClassName?: string,\n}\n\n/**\n * A Tristate checkbox\n *\n * The state is managed by the parent\n */\nconst Checkbox = ({\n id,\n label,\n checked,\n disabled,\n onChange,\n onChangeTristate,\n size = 'medium',\n className = '',\n containerClassName\n }: CheckboxProps) => {\n const usedSizeClass = checkboxSizeMapping[size]\n const innerIconSize = checkboxIconSizeMapping[size]\n\n const propagateChange = (checked: CheckedState) => {\n if (onChangeTristate) {\n onChangeTristate(checked)\n }\n if (onChange) {\n onChange(checked === 'indeterminate' ? false : checked)\n }\n }\n\n const changeValue = () => {\n const newValue = checked === 'indeterminate' ? false : !checked\n propagateChange(newValue)\n }\n\n return (\n <div className={clsx('row justify-center items-center', containerClassName)}>\n <CheckboxPrimitive.Root\n onCheckedChange={propagateChange}\n checked={checked}\n disabled={disabled}\n id={id}\n className={clsx(usedSizeClass, `items-center border-2 rounded outline-none focus:border-primary`, {\n 'text-disabled-text border-disabled-text': disabled,\n 'border-on-background': !disabled,\n 'bg-primary/30 border-primary text-primary': checked === true || checked === 'indeterminate',\n 'hover:border-gray-400 focus:hover:border-primary': !checked\n }, className)}\n >\n <CheckboxPrimitive.Indicator>\n {checked === true && <Check className={innerIconSize}/>}\n {checked === 'indeterminate' && <Minus className={innerIconSize}/>}\n </CheckboxPrimitive.Indicator>\n </CheckboxPrimitive.Root>\n {label && (\n <Label {...label} className={clsx('cursor-pointer', label.className)} htmlFor={id}\n onClick={changeValue}/>\n )}\n </div>\n )\n}\n\ntype CheckboxUncontrolledProps = Omit<CheckboxProps, 'value' | 'checked'> & {\n /**\n * @default false\n */\n defaultValue?: CheckedState,\n}\n\n/**\n * A Tristate checkbox\n *\n * The state is managed by this component\n */\nconst CheckboxUncontrolled = ({\n onChange,\n onChangeTristate,\n defaultValue = false,\n ...props\n }: CheckboxUncontrolledProps) => {\n const [checked, setChecked] = useState(defaultValue)\n\n const handleChange = (checked: CheckedState) => {\n if (onChangeTristate) {\n onChangeTristate(checked)\n }\n if (onChange) {\n onChange(checked === 'indeterminate' ? false : checked)\n }\n setChecked(checked)\n }\n\n return (\n <Checkbox\n {...props}\n checked={checked}\n onChangeTristate={handleChange}\n />\n )\n}\n\nexport {\n CheckboxProps,\n CheckboxUncontrolled,\n Checkbox,\n}\n","import type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\n\ntype TextImageColor = 'primary' | 'secondary' | 'dark'\n\ntype TextImageTranslation = {\n showMore: string,\n}\n\nconst defaultTextImageTranslation: Record<Language, TextImageTranslation> = {\n de: {\n showMore: 'Mehr anzeigen'\n },\n en: {\n showMore: 'Show more'\n }\n}\n\nexport type TextImageProps = {\n title: string,\n description: string,\n imageUrl: string,\n onShowMoreClicked?: () => void,\n color?: TextImageColor,\n badge?: string,\n contentClassName?: string,\n className?: string,\n}\n\n/**\n * A Component for layering a Text upon a Image\n */\nexport const TextImage = ({\n overwriteTranslation,\n title,\n description,\n imageUrl,\n onShowMoreClicked,\n color = 'primary',\n badge,\n contentClassName = '',\n className = '',\n }: PropsForTranslation<TextImageTranslation, TextImageProps>) => {\n const translation = useTranslation(defaultTextImageTranslation, overwriteTranslation)\n\n const chipColorMapping: Record<TextImageColor, string> = {\n primary: 'text-text-image-primary-background bg-text-text-image-primary-text',\n secondary: 'text-text-image-secondary-background bg-text-text-image-secondary-text',\n dark: 'text-text-image-dark-background bg-text-text-image-dark-text',\n }\n\n const colorMapping: Record<TextImageColor, string> = {\n primary: 'text-text-image-primary-text bg-linear-to-r from-30% from-text-image-primary-background to-text-image-primary-background/55',\n secondary: 'text-text-image-secondary-text bg-linear-to-r from-30% from-text-image-secondary-background to-text-image-secondary-background/55',\n dark: 'text-text-image-dark-text bg-linear-to-r from-30% from-text-image-dark-background to-text-image-dark-background/55',\n }\n\n return (\n <div\n className={clsx('rounded-2xl w-full', className)}\n style={{\n backgroundImage: `url(${imageUrl})`,\n backgroundSize: 'cover',\n }}>\n <div\n className={clsx(`col px-6 py-12 rounded-2xl h-full`, colorMapping[color], contentClassName)}>\n {badge && (\n <div className={clsx(`chip-full bg-white mb-2 py-2 px-4 w-fit`, chipColorMapping[color])}>\n <span className=\"text-lg font-bold\">{badge}</span>\n </div>\n )}\n <div className=\"col gap-y-1 text-white overflow-hidden\">\n <span className=\"textstyle-title-xl\">{title}</span>\n <span className=\"text-ellipsis overflow-hidden\">{description}</span>\n </div>\n {onShowMoreClicked && (\n <div className=\"row mt-2 text-white underline\">\n <button onClick={onShowMoreClicked}>{translation.showMore}</button>\n </div>\n )}\n </div>\n </div>\n )\n}\n","export type VerticalDividerProps = {\n width?: number,\n height?: number,\n strokeWidth?: number,\n dashGap?: number,\n dashLength?: number,\n}\n\n/**\n * A Component for creating a vertical Divider\n */\nexport const VerticalDivider = ({\n width = 1,\n height = 100,\n strokeWidth = 4,\n dashGap = 4,\n dashLength = 4,\n }: VerticalDividerProps) => {\n return (\n <div style={{ width: width + 'px', height: height + 'px' }}>\n <svg width={width} height={height} viewBox={`0 0 ${width} ${height}`} fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <line\n opacity=\"0.5\"\n x1={width / 2}\n y1={height}\n x2={width / 2}\n y2=\"0\"\n stroke=\"url(#paint_linear)\"\n strokeWidth={strokeWidth}\n strokeDasharray={`${dashLength} ${dashLength + dashGap}`}\n strokeLinecap=\"round\"\n />\n <defs>\n <linearGradient\n id=\"paint_linear\"\n x1={width / 2}\n y1=\"0\"\n x2={width / 2}\n y2={height}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopOpacity=\"0\" stopColor=\"currentColor\"/>\n <stop offset=\"0.5\" stopColor=\"currentColor\"/>\n <stop offset=\"1\" stopColor=\"currentColor\" stopOpacity=\"0\"/>\n </linearGradient>\n </defs>\n </svg>\n </div>\n )\n}\n","import { AlertOctagon } from 'lucide-react'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\n\ntype ErrorComponentTranslation = {\n errorOccurred: string,\n}\n\nconst defaultErrorComponentTranslation: Record<Language, ErrorComponentTranslation> = {\n en: {\n errorOccurred: 'An error occurred'\n },\n de: {\n errorOccurred: 'Ein Fehler ist aufgetreten'\n }\n}\n\nexport type ErrorComponentProps = {\n errorText?: string,\n classname?: string,\n}\n\n/**\n * The Component to show when an error occurred\n */\nexport const ErrorComponent = ({\n overwriteTranslation,\n errorText,\n classname\n }: PropsForTranslation<ErrorComponentTranslation, ErrorComponentProps>) => {\n const translation = useTranslation(defaultErrorComponentTranslation, overwriteTranslation)\n return (\n <div className={clsx('col items-center justify-center gap-y-4 w-full h-24', classname)}>\n <AlertOctagon size={64} className=\"text-warning\"/>\n {errorText ?? `${translation.errorOccurred} :(`}\n </div>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport { useState } from 'react'\nimport type { LoadingAnimationProps } from './LoadingAnimation'\nimport { LoadingAnimation } from './LoadingAnimation'\nimport type { ErrorComponentProps } from './ErrorComponent'\nimport { ErrorComponent } from './ErrorComponent'\n\nexport type LoadingAndErrorComponentProps = PropsWithChildren<{\n isLoading?: boolean,\n hasError?: boolean,\n loadingProps?: LoadingAnimationProps,\n errorProps?: ErrorComponentProps,\n /**\n * in milliseconds\n */\n minimumLoadingDuration?: number,\n}>\n\n/**\n * A Component that shows the Error and Loading animation, when appropriate and the children otherwise\n */\nexport const LoadingAndErrorComponent = ({\n children,\n isLoading = false,\n hasError = false,\n errorProps,\n loadingProps,\n minimumLoadingDuration\n }: LoadingAndErrorComponentProps) => {\n const [isInMinimumLoading, setIsInMinimumLoading] = useState(false)\n const [hasUsedMinimumLoading, setHasUsedMinimumLoading] = useState(false)\n if (minimumLoadingDuration && !isInMinimumLoading && !hasUsedMinimumLoading) {\n setIsInMinimumLoading(true)\n setTimeout(() => {\n setIsInMinimumLoading(false)\n setHasUsedMinimumLoading(true)\n }, minimumLoadingDuration)\n }\n\n if (isLoading || (minimumLoadingDuration && isInMinimumLoading)) {\n return <LoadingAnimation {...loadingProps}/>\n }\n if (hasError) {\n return <ErrorComponent {...errorProps}/>\n }\n return children\n}\n","import type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport clsx from 'clsx'\nimport { Helpwave } from '../icons-and-geometry/Helpwave'\n\ntype LoadingAnimationTranslation = {\n loading: string,\n}\n\nconst defaultLoadingAnimationTranslation: Record<Language, LoadingAnimationTranslation> = {\n en: {\n loading: 'Loading data'\n },\n de: {\n loading: 'Lade Daten'\n }\n}\n\nexport type LoadingAnimationProps = {\n loadingText?: string,\n classname?: string,\n}\n\n/**\n * A Component to show when loading data\n */\nexport const LoadingAnimation = ({\n overwriteTranslation,\n loadingText,\n classname\n }: PropsForTranslation<LoadingAnimationTranslation, LoadingAnimationProps>) => {\n const translation = useTranslation(defaultLoadingAnimationTranslation, overwriteTranslation)\n return (\n <div className={clsx('col items-center justify-center w-full h-24', classname)}>\n <Helpwave animate=\"loading\"/>\n {loadingText ?? `${translation.loading}...`}\n </div>\n )\n}\n","import clsx from 'clsx'\nimport type { SolidButtonProps } from '../user-action/Button'\nimport { ButtonUtil, SolidButton } from '../user-action/Button'\nimport { noop } from '@/util/noop'\nimport { Helpwave } from '../icons-and-geometry/Helpwave'\n\ntype LoadingButtonProps = {\n isLoading?: boolean,\n} & SolidButtonProps\n\nexport const LoadingButton = ({ isLoading = false, size = 'medium', onClick, ...rest }: LoadingButtonProps) => {\n const paddingClass = ButtonUtil.paddingMapping[size]\n\n return (\n <div className=\"inline-block relative\">\n {\n isLoading && (\n <div className={clsx('absolute inset-0 row items-center justify-center bg-white/40', paddingClass)}>\n <Helpwave animate=\"loading\" className=\"text-white\"/>\n </div>\n )\n }\n <SolidButton {...rest} disabled={rest.disabled} onClick={isLoading ? noop : onClick}/>\n </div>\n )\n}\n","export type ProgressIndicatorProps = {\n /*\n The amount of progress that has been made\n Value form 0 to 1\n */\n progress: number,\n strokeWidth?: number,\n size?: keyof typeof sizeMapping,\n direction?: 'clockwise' | 'counterclockwise',\n /*\n Rotation of the starting point of the indicator\n default start at 3 o'clock\n Given in degree\n */\n rotation?: number,\n}\n\nconst sizeMapping = { small: 16, medium: 24, big: 48 }\n\n/**\n * A progress indicator\n *\n * Start rotation is 3 o'clock and fills counterclockwise\n *\n * Progress is given from 0 to 1\n */\nexport const ProgressIndicator = ({\n progress,\n strokeWidth = 5,\n size = 'medium',\n direction = 'counterclockwise',\n rotation = 0\n }: ProgressIndicatorProps) => {\n const currentSize = sizeMapping[size]\n const center = currentSize / 2\n const radius = center - strokeWidth / 2\n const arcLength = 2 * Math.PI * radius\n const arcOffset = arcLength * progress\n if (direction === 'clockwise') {\n rotation += 360 * progress\n }\n return (\n <svg\n style={{\n height: `${currentSize}px`,\n width: `${currentSize}px`,\n transform: `rotate(${rotation}deg)`\n }}\n >\n <circle cx={center} cy={center} r={radius} fill=\"transparent\" strokeWidth={strokeWidth}\n className=\"stroke-primary\"\n />\n <circle cx={center} cy={center} r={radius} fill=\"transparent\" strokeWidth={strokeWidth}\n strokeDasharray={arcLength} strokeDashoffset={arcOffset} className=\"stroke-gray-300\"\n />\n </svg>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { SolidButtonColor } from '../user-action/Button'\nimport { SolidButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport clsx from 'clsx'\nimport type { ModalProps } from '@/components/layout-and-navigation/Overlay'\nimport { Modal } from '@/components/layout-and-navigation/Overlay'\n\ntype ConfirmModalTranslation = {\n confirm: string,\n cancel: string,\n decline: string,\n}\n\nexport type ConfirmModalType = 'positive' | 'negative' | 'neutral' | 'primary'\n\nconst defaultConfirmDialogTranslation = {\n en: {\n confirm: 'Confirm',\n cancel: 'Cancel',\n decline: 'Decline'\n },\n de: {\n confirm: 'Bestätigen',\n cancel: 'Abbrechen',\n decline: 'Ablehnen'\n }\n}\n\ntype ButtonOverwriteType = {\n text?: string,\n color?: SolidButtonColor,\n disabled?: boolean,\n}\n\nexport type ConfirmModalProps = Omit<ModalProps, 'onClose'> & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onCancel: () => void,\n onConfirm: () => void,\n onDecline?: () => void,\n confirmType?: ConfirmModalType,\n /**\n * Order: Cancel, Decline, Confirm\n */\n buttonOverwrites?: [ButtonOverwriteType, ButtonOverwriteType, ButtonOverwriteType],\n}\n\n/**\n * A Modal for asking the user for confirmation\n */\nexport const ConfirmModal = ({\n overwriteTranslation,\n children,\n onCancel,\n onConfirm,\n onDecline,\n confirmType = 'positive',\n buttonOverwrites,\n className,\n ...restProps\n }: PropsForTranslation<ConfirmModalTranslation, PropsWithChildren<ConfirmModalProps>>) => {\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n const mapping: Record<ConfirmModalType, SolidButtonColor> = {\n neutral: 'neutral',\n negative: 'negative',\n positive: 'positive',\n primary: 'primary',\n }\n\n return (\n <Modal {...restProps} onClose={onCancel} className={clsx('justify-between', className)}>\n <div className=\"col grow\">\n {children}\n </div>\n <div className=\"row mt-3 gap-x-4 justify-end\">\n {onCancel && (\n <SolidButton\n color={buttonOverwrites?.[0].color ?? 'neutral'}\n onClick={onCancel}\n disabled={buttonOverwrites?.[0].disabled ?? false}\n >\n {buttonOverwrites?.[0].text ?? translation.cancel}\n </SolidButton>\n )}\n {onDecline && (\n <SolidButton\n color={buttonOverwrites?.[1].color ?? 'negative'}\n onClick={onDecline}\n\n disabled={buttonOverwrites?.[1].disabled ?? false}\n >\n {buttonOverwrites?.[1].text ?? translation.decline}\n </SolidButton>\n )}\n <SolidButton\n autoFocus\n color={buttonOverwrites?.[2].color ?? mapping[confirmType]}\n onClick={onConfirm}\n disabled={buttonOverwrites?.[2].disabled ?? false}\n >\n {buttonOverwrites?.[2].text ?? translation.confirm}\n </SolidButton>\n </div>\n </Modal>\n )\n}\n","import type { PropsWithChildren } from 'react'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { ConfirmModalProps } from '@/components/modals/ConfirmModal'\nimport { ConfirmModal } from '@/components/modals/ConfirmModal'\n\ntype DiscardChangesModalTranslation = {\n save: string,\n cancel: string,\n dontSave: string,\n title: string,\n description: string,\n}\n\nconst defaultDiscardChangesModalTranslation = {\n en: {\n save: 'Save',\n cancel: 'Cancel',\n dontSave: 'Don\\'t save',\n title: 'Unsaved Changes',\n description: 'Do you want to save your changes?'\n },\n de: {\n save: 'Speichern',\n cancel: 'Abbrechen',\n dontSave: 'Nicht Speichern',\n title: 'Ungespeicherte Änderungen',\n description: 'Möchtest du die Änderungen speichern?'\n }\n}\n\ntype DiscardChangesModalProps = Omit<ConfirmModalProps, 'onDecline' | 'onConfirm' | 'buttonOverwrites'> & {\n isShowingDecline?: boolean,\n requireAnswer?: boolean,\n onCancel: () => void,\n onSave: () => void,\n onDontSave: () => void,\n}\n\nexport const DiscardChangesModal = ({\n overwriteTranslation,\n children,\n onCancel,\n onSave,\n onDontSave,\n headerProps,\n ...modalProps\n }: PropsForTranslation<DiscardChangesModalTranslation, PropsWithChildren<DiscardChangesModalProps>>) => {\n const translation = useTranslation(defaultDiscardChangesModalTranslation, overwriteTranslation)\n return (\n <ConfirmModal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.description,\n }}\n onConfirm={onSave}\n onCancel={onCancel}\n onDecline={onDontSave}\n buttonOverwrites={[{ text: translation.cancel }, { text: translation.dontSave }, { text: translation.save }]}\n {...modalProps}\n >\n {children}\n </ConfirmModal>\n )\n}\n","import type { InputProps } from '../user-action/Input'\nimport { Input } from '../user-action/Input'\nimport type { ConfirmModalProps } from '@/components/modals/ConfirmModal'\nimport { ConfirmModal } from '@/components/modals/ConfirmModal'\n\nexport type InputModalProps = ConfirmModalProps & {\n inputs: InputProps[],\n}\n\n/**\n * A modal for receiving multiple inputs\n */\nexport const InputModal = ({\n inputs,\n buttonOverwrites,\n ...restProps\n }: InputModalProps) => {\n return (\n <ConfirmModal\n buttonOverwrites={buttonOverwrites}\n {...restProps}\n >\n {inputs.map((inputProps, index) => <Input key={`input ${index}`} {...inputProps}/>)}\n </ConfirmModal>\n )\n}\n","import { Menu } from '@headlessui/react'\nimport { ChevronDown, ChevronUp, Search } from 'lucide-react'\nimport type { ReactNode } from 'react'\nimport { useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport { Input } from '@/components/user-action/Input'\n\nexport type SelectOption<T> = {\n label: ReactNode,\n value: T,\n disabled?: boolean,\n className?: string,\n}\n\nexport type SelectProps<T> = {\n value?: T,\n label?: LabelProps,\n options: SelectOption<T>[],\n onChange: (value: T) => void,\n isHidingCurrentValue?: boolean,\n hintText?: string,\n showDisabledOptions?: boolean,\n className?: string,\n isDisabled?: boolean,\n textColor?: string,\n hoverColor?: string,\n /**\n * The items will be at the start of the select and aren't selectable\n */\n additionalItems?: ReactNode[],\n selectedDisplayOverwrite?: ReactNode,\n};\n\n/**\n * A Select Component for selecting form a list of options\n *\n * The State is managed by the parent\n */\nexport const Select = <T, >({\n value,\n label,\n options,\n onChange,\n isHidingCurrentValue = true,\n hintText = '',\n showDisabledOptions = true,\n isDisabled,\n className,\n textColor = 'text-menu-text',\n hoverColor = 'hover:brightness-90',\n additionalItems,\n selectedDisplayOverwrite,\n }: SelectProps<T>) => {\n // Notice: for more complex types this check here might need an additional compare method\n let filteredOptions = isHidingCurrentValue ? options.filter(option => option.value !== value) : options\n if (!showDisabledOptions) {\n filteredOptions = filteredOptions.filter(value => !value.disabled)\n }\n const selectedOption = options.find(option => option.value === value)\n if (value !== undefined && selectedOption === undefined && selectedDisplayOverwrite === undefined) {\n console.warn('The selected value is not found in the options list. This might be an error on your part or' +\n ' default behavior if it is complex data type on which === does not work. In case of the latter' +\n ' use selectedDisplayOverwrite to set your selected text or component')\n }\n\n const borderColor = 'border-menu-border'\n\n return (\n <div className={clsx(className)}>\n {label && (\n <Label {...label} labelType={label.labelType ?? 'labelBig'} className={clsx('mb-1', label.className)}/>\n )}\n <Menu as=\"div\" className=\"relative text-menu-text\">\n {({ open }) => (\n <>\n <Menu.Button\n className={clsx(\n 'inline-flex w-full justify-between items-center rounded-t-lg border-2 px-4 py-2 font-medium bg-menu-background text-menu-text',\n textColor, borderColor,\n {\n 'rounded-b-lg': !open,\n [hoverColor]: !isDisabled,\n 'bg-disabled-background cursor-not-allowed text-disabled': isDisabled\n }\n )}\n disabled={isDisabled}\n >\n <span>{selectedDisplayOverwrite ?? selectedOption?.label ?? hintText}</span>\n {open ? <ChevronUp/> : <ChevronDown/>}\n </Menu.Button>\n <Menu.Items\n className=\"absolute w-full z-10 rounded-b-lg bg-menu-background text-menu-text shadow-lg max-h-[500px] overflow-y-auto\"\n >\n {(additionalItems ?? []).map((item, index) => (\n <div key={`additionalItems${index}`}\n className={clsx(borderColor, 'px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0', {\n 'border-b-0 rounded-b-lg': filteredOptions.length === 0 && index === (additionalItems?.length ?? 1) - 1,\n })}\n >\n {item}\n </div>\n ))}\n {filteredOptions.map((option, index) => (\n <Menu.Item key={`item${index}`}>\n {\n <div\n className={clsx('px-4 py-2 overflow-hidden whitespace-nowrap text-ellipsis border-2 border-t-0 cursor-pointer',\n option.className, borderColor, {\n 'brightness-90': option.value === value,\n 'brightness-95': index % 2 === 1,\n 'text-disabled bg-disabled-background cursor-not-allowed': !!option.disabled,\n 'bg-menu-background text-menu-text hover:brightness-90 cursor-pointer': !option.disabled,\n 'rounded-b-lg': index === filteredOptions.length - 1,\n })}\n onClick={() => {\n if (!option.disabled) {\n onChange(option.value)\n }\n }}\n >\n {option.label}\n </div>\n }\n </Menu.Item>\n ))}\n </Menu.Items>\n </>\n )}\n </Menu>\n </div>\n )\n}\n\nexport const SelectUncontrolled = <T, >({\n options, onChange, value, hintText, ...props\n }: SelectProps<T>) => {\n const [selected, setSelected] = useState(value)\n\n useEffect(() => {\n if (options.find(options => options.value === value)) {\n setSelected(value)\n }\n }, [options, value])\n\n return (\n <Select\n value={selected}\n options={options}\n onChange={value => {\n setSelected(value)\n onChange(value)\n }}\n hintText={hintText}\n {...props}\n />\n )\n}\n\nexport type SearchableSelectProps<T> = SelectProps<T> & {\n searchMapping: (value: SelectOption<T>) => string[],\n}\n\n/**\n * A Select where items can be searched\n */\nexport const SearchableSelect = <T, >({\n value,\n options,\n searchMapping,\n ...selectProps\n }: SearchableSelectProps<T>) => {\n const [search, setSearch] = useState<string>('')\n const filteredOptions = MultiSearchWithMapping(search, options, searchMapping)\n\n return (\n <Select\n value={value}\n options={filteredOptions}\n additionalItems={[(\n <div key=\"selectSearch\" className=\"row gap-x-2 items-center\">\n <Input autoFocus={true} value={search} onChangeText={setSearch}/>\n <Search/>\n </div>\n )]}\n {...selectProps}\n />\n )\n}","import { type PropsWithChildren } from 'react'\nimport type { PropsForTranslation, Translation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Select } from '../user-action/Select'\nimport type { Language } from '@/localization/util'\nimport { LanguageUtil } from '@/localization/util'\nimport { useLanguage } from '@/localization/LanguageProvider'\nimport { SolidButton } from '../user-action/Button'\nimport { Modal, type ModalProps } from '../layout-and-navigation/Overlay'\n\ntype LanguageModalTranslation = {\n title: string,\n message: string,\n done: string,\n} & Record<Language, string>\n\nconst defaultLanguageModalTranslation: Translation<LanguageModalTranslation> = {\n en: {\n title: 'Language',\n message: 'Choose your language',\n done: 'Done',\n ...LanguageUtil.languagesLocalNames\n },\n de: {\n title: 'Sprache',\n message: 'Wähle deine bevorzugte Sprache',\n done: 'Fertig',\n ...LanguageUtil.languagesLocalNames\n }\n}\n\ntype LanguageModalProps = ModalProps\n\n/**\n * A Modal for selecting the Language\n *\n * The State of open needs to be managed by the parent\n */\nexport const LanguageModal = ({\n overwriteTranslation,\n headerProps,\n onClose,\n ...modalProps\n }: PropsForTranslation<LanguageModalTranslation, PropsWithChildren<LanguageModalProps>>) => {\n const { language, setLanguage } = useLanguage()\n const translation = useTranslation(defaultLanguageModalTranslation, overwriteTranslation)\n\n return (\n <Modal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.message,\n }}\n onClose={onClose}\n {...modalProps}\n >\n <div className=\"w-64\">\n <Select\n className=\"mt-2\"\n value={language}\n options={LanguageUtil.languages.map((language) => ({ label: translation[language], value: language }))}\n onChange={(language: string) => setLanguage(language as Language)}\n />\n <div className=\"row mt-3 gap-x-4 justify-end\">\n <SolidButton autoFocus color=\"positive\" onClick={onClose}>\n {translation.done}\n </SolidButton>\n </div>\n </div>\n </Modal>\n )\n}\n","import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'\nimport { createContext, useContext, useEffect, useState } from 'react'\nimport type { Translation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\n\nconst themes = ['light', 'dark'] as const\n\nexport type ThemeType = typeof themes[number]\n\nexport type ThemeTypeTranslation = Record<ThemeType, string>\n\nconst defaultThemeTypeTranslation: Translation<ThemeTypeTranslation> = {\n en: {\n dark: 'Dark',\n light: 'Light'\n },\n de: {\n dark: 'Dunkel',\n light: 'Hell'\n }\n}\n\nexport const ThemeUtil = {\n themes,\n translation: defaultThemeTypeTranslation,\n}\n\ntype ThemeContextType = {\n theme: ThemeType,\n setTheme: Dispatch<SetStateAction<ThemeType>>,\n}\n\nexport const ThemeContext = createContext<ThemeContextType>({\n theme: 'light',\n setTheme: noop\n})\n\ntype ThemeProviderProps = {\n initialTheme?: ThemeType,\n}\n\nexport const ThemeProvider = ({ children, initialTheme = 'light' }: PropsWithChildren<ThemeProviderProps>) => {\n const [theme, setTheme] = useState<ThemeType>(initialTheme)\n\n useEffect(() => {\n if (theme !== initialTheme) {\n console.warn('ThemeProvider initial state changed: Prefer using useTheme\\'s setTheme instead')\n setTheme(initialTheme)\n }\n }, [initialTheme]) // eslint-disable-line react-hooks/exhaustive-deps\n\n useEffect(() => {\n document.documentElement.setAttribute('data-theme', theme)\n }, [theme])\n\n return (\n <ThemeContext.Provider value={{ theme, setTheme }}>\n {children}\n </ThemeContext.Provider>\n )\n}\n\n\nexport const useTheme = () => useContext(ThemeContext)\n","import { type PropsWithChildren } from 'react'\nimport type { PropsForTranslation, Translation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Select } from '../user-action/Select'\nimport { SolidButton } from '../user-action/Button'\nimport { Modal, type ModalProps } from '../layout-and-navigation/Overlay'\nimport type { ThemeType, ThemeTypeTranslation } from '@/theming/useTheme'\nimport { useTheme } from '@/theming/useTheme'\nimport { ThemeUtil } from '@/theming/useTheme'\n\ntype ThemeModalTranslation = {\n title: string,\n message: string,\n done: string,\n} & ThemeTypeTranslation\n\nconst defaultConfirmDialogTranslation: Translation<ThemeModalTranslation> = {\n en: {\n title: 'Theme',\n message: 'Choose your preferred theme',\n done: 'Done',\n ...ThemeUtil.translation.en\n },\n de: {\n title: 'Farbschema',\n message: 'Wähle dein bevorzugtes Farbschema',\n done: 'Fertig',\n ...ThemeUtil.translation.en\n }\n}\n\ntype ThemeModalProps = ModalProps\n\n/**\n * A Modal for selecting the Theme\n *\n * The State of open needs to be managed by the parent\n */\nexport const ThemeModal = ({\n overwriteTranslation,\n headerProps,\n onClose,\n ...modalProps\n }: PropsForTranslation<ThemeModalTranslation, PropsWithChildren<ThemeModalProps>>) => {\n const { theme, setTheme } = useTheme()\n const translation = useTranslation(defaultConfirmDialogTranslation, overwriteTranslation)\n\n return (\n <Modal\n headerProps={{\n ...headerProps,\n titleText: headerProps?.titleText ?? translation.title,\n descriptionText: headerProps?.descriptionText ?? translation.message,\n }}\n onClose={onClose}\n {...modalProps}\n >\n <div className=\"w-64\">\n <Select\n className=\"mt-2\"\n value={theme}\n options={ThemeUtil.themes.map((theme) => ({ label: translation[theme], value: theme }))}\n onChange={(theme: string) => setTheme(theme as ThemeType)}\n />\n <div className=\"row mt-3 gap-x-4 justify-end\">\n <SolidButton autoFocus color=\"positive\" onClick={onClose}>\n {translation.done}\n </SolidButton>\n </div>\n </div>\n </Modal>\n )\n}\n","import { Check } from 'lucide-react'\nimport { noop } from '../../util/noop'\nimport { Checkbox } from '../user-action/Checkbox'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype CheckboxPropertyTranslation = {\n yes: string,\n no: string,\n}\n\nconst defaultCheckboxPropertyTranslation: Record<Language, CheckboxPropertyTranslation> = {\n en: {\n yes: 'Yes',\n no: 'No'\n },\n de: {\n yes: 'Ja',\n no: 'Nein'\n }\n}\n\nexport type CheckboxPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue' | 'onRemove'> & {\n value?: boolean,\n onChange?: (value: boolean) => void,\n}\n\n/**\n * An Input for a boolen properties\n */\nexport const CheckboxProperty = ({\n overwriteTranslation,\n value,\n onChange = noop,\n readOnly,\n ...baseProps\n }: PropsForTranslation<CheckboxPropertyTranslation, CheckboxPropertyProps>) => {\n const translation = useTranslation(defaultCheckboxPropertyTranslation, overwriteTranslation)\n\n return (\n <PropertyBase\n {...baseProps}\n hasValue={true}\n readOnly={readOnly}\n icon={<Check size={16}/>}\n input={() => (\n <div className=\"row py-2 px-4 items-center\">\n <Checkbox\n // TODO make bigger as in #904\n checked={value ?? true}\n disabled={readOnly}\n onChange={onChange}\n label={{ name: `${translation.yes}/${translation.no}`, labelType: 'labelMedium' }}\n />\n </div>\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport { AlertTriangle } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '../../localization/util'\nimport { TextButton } from '../user-action/Button'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\n\ntype PropertyBaseTranslation = {\n remove: string,\n}\n\nconst defaultPropertyBaseTranslation: Record<Language, PropertyBaseTranslation> = {\n en: {\n remove: 'Remove'\n },\n de: {\n remove: 'Entfernen'\n }\n}\n\nexport type PropertyBaseProps = {\n name: string,\n input: (props: { softRequired: boolean, hasValue: boolean }) => ReactNode,\n onRemove?: () => void,\n hasValue: boolean,\n softRequired?: boolean,\n readOnly?: boolean,\n icon?: ReactNode,\n className?: string,\n}\n\n/**\n * A component for showing a properties with uniform styling\n */\nexport const PropertyBase = ({\n overwriteTranslation,\n name,\n input,\n softRequired = false,\n hasValue,\n icon,\n readOnly,\n onRemove,\n className = '',\n }: PropsForTranslation<PropertyBaseTranslation, PropertyBaseProps>) => {\n const translation = useTranslation(defaultPropertyBaseTranslation, overwriteTranslation)\n const requiredAndNoValue = softRequired && !hasValue\n return (\n <div className={clsx('row gap-x-0 group', className)}>\n <div\n className={\n clsx('row gap-x-2 !w-[200px] px-4 py-2 items-center rounded-l-xl border-2 border-r-0', {\n 'bg-gray-100 text-black group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-warning text-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {icon}\n {name}\n </div>\n <div className={\n clsx('row grow justify-between items-center rounded-r-xl border-2 border-l-0', {\n 'bg-white group-hover:border-primary border-gray-400': !requiredAndNoValue,\n 'bg-surface-warning group-hover:border-warning border-warning/90': requiredAndNoValue,\n }, className)}\n >\n {input({ softRequired, hasValue })}\n {requiredAndNoValue && (\n <div className=\"text-warning pr-4\"><AlertTriangle size={24}/></div>\n )}\n {onRemove && (\n <TextButton\n onClick={onRemove}\n color=\"negative\"\n className={clsx('pr-4 items-center', { '!text-transparent': !hasValue || readOnly })}\n disabled={!hasValue || readOnly}\n >\n {translation.remove}\n </TextButton>\n )}\n </div>\n </div>\n )\n}\n","import { CalendarDays } from 'lucide-react'\nimport clsx from 'clsx'\nimport { formatDate, formatDateTime } from '@/util/date'\nimport { noop } from '@/util/noop'\nimport { Input } from '../user-action/Input'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\nexport type DatePropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: Date,\n onChange?: (date: Date) => void,\n onEditComplete?: (value: Date) => void,\n type?: 'dateTime' | 'date',\n}\n\n/**\n * An Input for date properties\n */\nexport const DateProperty = ({\n value,\n onChange = noop,\n onEditComplete = noop,\n readOnly,\n type = 'dateTime',\n ...baseProps\n }: DatePropertyProps) => {\n const hasValue = !!value\n\n const dateText = value ? (type === 'dateTime' ? formatDateTime(value) : formatDate(value)) : ''\n return (\n <PropertyBase\n {...baseProps}\n hasValue={hasValue}\n icon={<CalendarDays size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Input\n className={clsx('!ring-0 !border-0 !outline-0 !p-0 !m-0 !shadow-none !w-fit !rounded-none', { 'bg-surface-warning': softRequired && !hasValue })}\n value={dateText}\n type={type === 'dateTime' ? 'datetime-local' : 'date'}\n readOnly={readOnly}\n onChange={(event) => {\n const value = event.target.value\n if (!value) {\n event.preventDefault()\n return\n }\n const dueDate = new Date(value)\n onChange(dueDate)\n }}\n onEditCompleted={(value) => onEditComplete(new Date(value))}\n />\n </div>\n )}\n />\n )\n}\n","import { List } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '../../localization/util'\nimport type { PropsForTranslation } from '../../localization/useTranslation'\nimport { useTranslation } from '../../localization/useTranslation'\nimport type { MultiSelectProps } from '../user-action/MultiSelect'\nimport { MultiSelect } from '../user-action/MultiSelect'\nimport { ChipList } from '../layout-and-navigation/Chip'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype MultiSelectPropertyTranslation = {\n select: string,\n}\n\nconst defaultMultiSelectPropertyTranslation: Record<Language, MultiSelectPropertyTranslation> = {\n en: {\n select: 'Select'\n },\n de: {\n select: 'Auswählen'\n }\n}\n\nexport type MultiSelectPropertyProps<T> =\n Omit<PropertyBaseProps & MultiSelectProps<T>, 'icon' | 'input' | 'hasValue' | 'className' | 'disabled' | 'label' | 'triggerClassName'>\n\n/**\n * An Input for MultiSelect properties\n */\nexport const MultiSelectProperty = <T, >({\n overwriteTranslation,\n options,\n name,\n readOnly = false,\n softRequired,\n onRemove,\n ...multiSelectProps\n }: PropsForTranslation<MultiSelectPropertyTranslation, MultiSelectPropertyProps<T>>) => {\n const translation = useTranslation(defaultMultiSelectPropertyTranslation, overwriteTranslation)\n const hasValue = options.some(value => value.selected)\n let triggerClassName: string\n if (softRequired && !hasValue) {\n triggerClassName = 'border-warning hover:brightness-90'\n }\n\n return (\n <PropertyBase\n name={name}\n onRemove={onRemove}\n readOnly={readOnly}\n softRequired={softRequired}\n hasValue={hasValue}\n icon={<List size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <MultiSelect\n {...multiSelectProps}\n className={clsx('w-full', { 'bg-surface-warning': softRequired && !hasValue })}\n triggerClassName={triggerClassName}\n selectedDisplay={({ items }) => {\n const selected = items.filter(value => value.selected)\n if (selected.length === 0) {\n return (<span>Select</span>)\n }\n return (\n <ChipList list={selected.map(value => ({ children: value.label }))}/>\n )\n }}\n options={options}\n disabled={readOnly}\n hintText={`${translation.select}...`}\n />\n </div>\n )}\n />\n )\n}\n","import type { ReactNode } from 'react'\nimport { useState } from 'react'\nimport { Search } from 'lucide-react'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { Language } from '@/localization/util'\nimport { MultiSearchWithMapping } from '@/util/simpleSearch'\nimport clsx from 'clsx'\nimport { Menu, MenuItem } from './Menu'\nimport { Input } from './Input'\nimport { Checkbox } from './Checkbox'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\ntype MultiSelectTranslation = {\n select: string,\n search: string,\n selected: string,\n}\n\nconst defaultMultiSelectTranslation: Record<Language, MultiSelectTranslation> = {\n en: {\n select: 'Select',\n search: 'Search',\n selected: 'selected'\n },\n de: {\n select: 'Auswählen',\n search: 'Suche',\n selected: 'ausgewählt'\n }\n}\n\n// TODO maybe add custom item builder here\nexport type MultiSelectOption<T> = {\n label: string,\n value: T,\n selected: boolean,\n disabled?: boolean,\n className?: string,\n}\n\nexport type SearchProps<T> = {\n initialSearch?: string,\n searchMapping: (value: MultiSelectOption<T>) => string[],\n}\n\nexport type MultiSelectProps<T> = {\n options: MultiSelectOption<T>[],\n onChange: (options: MultiSelectOption<T>[]) => void,\n search?: SearchProps<T>,\n disabled?: boolean,\n selectedDisplay?: (props: {\n items: MultiSelectOption<T>[],\n disabled: boolean,\n }) => ReactNode,\n label?: LabelProps,\n hintText?: string,\n showDisabledOptions?: boolean,\n className?: string,\n triggerClassName?: string,\n}\n\n/**\n * A Component for multi selection\n */\nexport const MultiSelect = <T, >({\n overwriteTranslation,\n options,\n onChange,\n search,\n disabled = false,\n selectedDisplay,\n label,\n hintText,\n showDisabledOptions = true,\n className = '',\n triggerClassName = '',\n }: PropsForTranslation<MultiSelectTranslation, MultiSelectProps<T>>) => {\n const translation = useTranslation(defaultMultiSelectTranslation, overwriteTranslation)\n const [searchText, setSearchText] = useState<string>(search?.initialSearch ?? '')\n let filteredOptions: MultiSelectOption<T>[] = options\n const enableSearch = !!search\n if (enableSearch && !!searchText) {\n filteredOptions = MultiSearchWithMapping<MultiSelectOption<T>>(\n searchText,\n filteredOptions,\n value => search.searchMapping(value)\n )\n }\n if (!showDisabledOptions) {\n filteredOptions = filteredOptions.filter(value => !value.disabled)\n }\n\n const selectedItems = options.filter(value => value.selected)\n const menuButtonText = selectedItems.length === 0 ?\n hintText ?? translation.select\n : <span>{`${selectedItems.length} ${translation.selected}`}</span>\n\n const borderColor = 'border-menu-border'\n\n return (\n <div className={clsx(className)}>\n {label && (\n <Label {...label} htmlFor={label.name} className={clsx(' mb-1', label.className)}\n labelType={label.labelType ?? 'labelBig'}/>\n )}\n <Menu<HTMLDivElement>\n alignment=\"t_\"\n trigger={(onClick, ref) => (\n <div ref={ref} onClick={disabled ? undefined : onClick}\n className={clsx(borderColor, 'bg-menu-background text-menu-text inline-w-full justify-between items-center rounded-lg border-2 px-4 py-2 font-medium',\n {\n 'hover:brightness-90 hover:border-primary cursor-pointer': !disabled,\n 'bg-disabled-background text-disabled cursor-not-allowed': disabled\n },\n triggerClassName)}\n >\n {selectedDisplay ? selectedDisplay({ items: options, disabled }) : menuButtonText}\n </div>\n )}\n menuClassName={clsx(\n '!rounded-lg !shadow-lg !max-h-[500px] !min-w-[400px] !max-w-[70vh] !overflow-y-auto !border !border-2', borderColor,\n { '!py-0': !enableSearch, '!pb-0': enableSearch }\n )}\n >\n {enableSearch && (\n <div key=\"selectSearch\" className=\"row gap-x-2 items-center px-2 py-2\">\n <Input autoFocus={true} className=\"w-full\" value={searchText} onChangeText={setSearchText}/>\n <Search/>\n </div>\n )}\n {filteredOptions.map((option, index) => (\n <MenuItem key={`item${index}`} className={clsx({\n 'cursor-not-allowed !bg-disabled-background !text-disabled-text hover:brightness-100': !!option.disabled,\n 'cursor-pointer': !option.disabled,\n })}\n >\n <div\n className={clsx('overflow-hidden whitespace-nowrap text-ellipsis row items-center gap-x-2', option.className)}\n onClick={() => {\n if (!option.disabled) {\n onChange(options.map(value => value.value === option.value ? ({\n ...option,\n selected: !value.selected\n }) : value))\n }\n }}\n >\n <Checkbox checked={option.selected} disabled={option.disabled} size=\"small\"/>\n {option.label}\n </div>\n </MenuItem>\n ))}\n </Menu>\n </div>\n )\n}\n","import { type PropsWithChildren, type ReactNode, type RefObject, useRef } from 'react'\nimport clsx from 'clsx'\nimport { useOutsideClick } from '@/hooks/useOutsideClick'\nimport { useHoverState } from '@/hooks/useHoverState'\n\ntype MenuProps<T> = PropsWithChildren<{\n trigger: (onClick: () => void, ref: RefObject<T>) => ReactNode,\n /**\n * @default 'tl'\n */\n alignment?: 'tl' | 'tr' | 'bl' | 'br' | '_l' | '_r' | 't_' | 'b_',\n showOnHover?: boolean,\n menuClassName?: string,\n}>\n\nexport type MenuItemProps = {\n onClick?: () => void,\n alignment?: 'left' | 'right',\n className?: string,\n}\nconst MenuItem = ({\n children,\n onClick,\n alignment = 'left',\n className\n }: PropsWithChildren<MenuItemProps>) => (\n <div\n className={clsx('block px-3 py-1 bg-menu-background text-menu-text hover:brightness-90', {\n 'text-right': alignment === 'right',\n 'text-left': alignment === 'left',\n }, className)}\n onClick={onClick}\n >\n {children}\n </div>\n)\n\n/**\n * A Menu Component to allow the user to see different functions\n */\nconst Menu = <T extends HTMLElement>({\n trigger,\n children,\n alignment = 'tl',\n showOnHover = false,\n menuClassName = '',\n }: MenuProps<T>) => {\n const { isHovered: isOpen, setIsHovered: setIsOpen, handlers } = useHoverState({ isDisabled: !showOnHover })\n const triggerRef = useRef<T>(null)\n const menuRef = useRef<HTMLDivElement>(null)\n useOutsideClick([triggerRef, menuRef], () => setIsOpen(false))\n\n return (\n <div\n className=\"relative\"\n {...handlers}\n >\n {trigger(() => setIsOpen(!isOpen), triggerRef)}\n {isOpen ? (\n <div ref={menuRef} onClick={e => e.stopPropagation()}\n className={clsx('absolute top-full mt-1 py-2 w-60 rounded-lg bg-menu-background text-menu-text ring-1 ring-slate-900/5 text-sm leading-6 font-semibold shadow-md z-[1]', {\n ' top-[8px]': alignment[0] === 't',\n ' bottom-[8px]': alignment[0] === 'b',\n ' left-[-8px]': alignment[1] === 'l',\n ' right-[-8px]': alignment[1] === 'r',\n }, menuClassName)}>\n {children}\n </div>\n ) : null}\n </div>\n )\n}\n\nexport { Menu, MenuItem }\n","import type { RefObject } from 'react'\nimport { useEffect } from 'react'\n\nexport const useOutsideClick = <Ts extends RefObject<HTMLElement>[]>(refs: Ts, handler: () => void) => {\n useEffect(() => {\n const listener = (event: MouseEvent | TouchEvent) => {\n // returning means not \"not clicking outside\"\n\n // if no target exists, return\n if (event.target === null) return\n // if the target is a ref's element or descendent thereof, return\n if (refs.some((ref) => !ref.current || ref.current.contains(event.target as Node))) {\n return\n }\n\n handler()\n }\n document.addEventListener('mousedown', listener)\n document.addEventListener('touchstart', listener)\n return () => {\n document.removeEventListener('mousedown', listener)\n document.removeEventListener('touchstart', listener)\n }\n }, [refs, handler])\n}\n","import { Binary } from 'lucide-react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\nimport { Input } from '../user-action/Input'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype NumberPropertyTranslation = {\n value: string,\n}\n\nconst defaultNumberPropertyTranslation: Record<Language, NumberPropertyTranslation> = {\n en: {\n value: 'Value'\n },\n de: {\n value: 'Wert'\n }\n}\n\nexport type NumberPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: number,\n suffix?: string,\n onChange?: (value: number) => void,\n onEditComplete?: (value: number) => void,\n}\n\n/**\n * An Input for number properties\n */\nexport const NumberProperty = ({\n overwriteTranslation,\n value,\n onChange = noop,\n onRemove = noop,\n onEditComplete = noop,\n readOnly,\n suffix,\n ...baseProps\n }: PropsForTranslation<NumberPropertyTranslation, NumberPropertyProps>) => {\n const translation = useTranslation(defaultNumberPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n {...baseProps}\n onRemove={onRemove}\n hasValue={hasValue}\n icon={<Binary size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Input\n expanded={false}\n className={clsx('!ring-0 !border-0 !outline-0 !p-0 !m-0 !w-fit !shadow-none !rounded-none', { 'bg-surface-warning placeholder-warning': softRequired && !hasValue })}\n value={value?.toString() ?? ''}\n type=\"number\"\n readOnly={readOnly}\n placeholder={`${translation.value}...`}\n onChangeText={(value) => {\n const numberValue = parseFloat(value)\n if (isNaN(numberValue)) {\n onRemove()\n } else {\n onChange(numberValue)\n }\n }}\n onEditCompleted={(value) => {\n const numberValue = parseFloat(value)\n if (isNaN(numberValue)) {\n onRemove()\n } else {\n onEditComplete(numberValue)\n }\n }}\n />\n {suffix && <span className={clsx('ml-1', { 'bg-surface-warning': softRequired && !hasValue })}>{suffix}</span>}\n </div>\n )}\n />\n )\n}\n","import { List } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport type { SearchableSelectProps } from '../user-action/Select'\nimport { SearchableSelect } from '../user-action/Select'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype SingleSelectPropertyTranslation = {\n select: string,\n}\n\nconst defaultSingleSelectPropertyTranslation: Record<Language, SingleSelectPropertyTranslation> = {\n en: {\n select: 'Select'\n },\n de: {\n select: 'Auswählen'\n }\n}\n\nexport type SingleSelectPropertyProps<T> =\n Omit<PropertyBaseProps & SearchableSelectProps<T>, 'icon' | 'input' | 'hasValue' | 'className' | 'disabled' | 'label' | 'labelClassName' | 'additionalItems'>\n\n/**\n * An Input for SingleSelect properties\n */\nexport const SingleSelectProperty = <T, >({\n overwriteTranslation,\n value,\n options,\n name,\n readOnly = false,\n softRequired,\n onRemove,\n ...multiSelectProps\n }: PropsForTranslation<SingleSelectPropertyTranslation, SingleSelectPropertyProps<T>>) => {\n const translation = useTranslation(defaultSingleSelectPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n name={name}\n onRemove={onRemove}\n readOnly={readOnly}\n softRequired={softRequired}\n hasValue={hasValue}\n icon={<List size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow py-2 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <SearchableSelect\n {...multiSelectProps}\n value={value}\n options={options}\n isDisabled={readOnly}\n className={clsx('w-full', { 'bg-surface-warning': softRequired && !hasValue })}\n hintText={`${translation.select}...`}\n />\n </div>\n )}\n />\n )\n}\n","import { Text } from 'lucide-react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { Textarea } from '../user-action/Textarea'\nimport { noop } from '@/util/noop'\nimport type { PropertyBaseProps } from './PropertyBase'\nimport { PropertyBase } from './PropertyBase'\n\ntype TextPropertyTranslation = {\n value: string,\n}\n\nconst defaultTextPropertyTranslation: Record<Language, TextPropertyTranslation> = {\n en: {\n value: 'Text'\n },\n de: {\n value: 'Text'\n }\n}\n\nexport type TextPropertyProps = Omit<PropertyBaseProps, 'icon' | 'input' | 'hasValue'> & {\n value?: string,\n onChange?: (value: string) => void,\n onEditComplete?: (value: string) => void,\n}\n\n/**\n * An Input for Text properties\n */\nexport const TextProperty = ({\n overwriteTranslation,\n value,\n readOnly,\n onChange = noop,\n onRemove = noop,\n onEditComplete = noop,\n ...baseProps\n }: PropsForTranslation<TextPropertyTranslation, TextPropertyProps>) => {\n const translation = useTranslation(defaultTextPropertyTranslation, overwriteTranslation)\n const hasValue = value !== undefined\n\n return (\n <PropertyBase\n {...baseProps}\n onRemove={onRemove}\n hasValue={hasValue}\n icon={<Text size={16}/>}\n input={({ softRequired }) => (\n <div\n className={clsx('row grow pt-2 pb-1 px-4 cursor-pointer', { 'text-warning': softRequired && !hasValue })}\n >\n <Textarea\n className={clsx('ring-0 border-0 outline-0 p-0 m-0 shadow-none rounded-none', { 'bg-surface-warning placeholder-warning': softRequired && !hasValue })}\n rows={5}\n defaultStyle={false}\n value={value ?? ''}\n readOnly={readOnly}\n placeholder={`${translation.value}...`}\n onChangeText={(value) => {\n if (!value) {\n onRemove()\n } else {\n onChange(value)\n }\n }}\n onEditCompleted={(value) => {\n if (!value) {\n onRemove()\n } else {\n onEditComplete(value)\n }\n }}\n />\n </div>\n )}\n />\n )\n}\n","import type { TextareaHTMLAttributes } from 'react'\nimport { useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\nimport type { LabelProps } from './Label'\nimport { Label } from './Label'\n\nexport type TextareaProps = {\n /** Outside the area */\n label?: Omit<LabelProps, 'id'>,\n /** Inside the area */\n headline?: string,\n value?: string,\n resizable?: boolean,\n onChangeText?: (text: string) => void,\n disclaimer?: string,\n onEditCompleted?: (text: string) => void,\n defaultStyle?: boolean,\n} & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, 'value'>\n\n/**\n * A Textarea component for inputting longer texts\n *\n * The State is managed by the parent\n */\nexport const Textarea = ({\n label,\n headline,\n id,\n resizable = false,\n onChange = noop,\n onChangeText = noop,\n disclaimer,\n onBlur = noop,\n onEditCompleted = noop,\n defaultStyle = true,\n className,\n ...props\n }: TextareaProps) => {\n const [hasFocus, setHasFocus] = useState(false)\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n return (\n <div className=\"w-full\">\n {label && (\n <Label {...label} htmlFor={id} className={clsx('mb-1', label.className)}\n labelType={label.labelType ?? 'labelSmall'}/>\n )}\n <div\n className={`${clsx(' bg-surface text-on-surface focus-within:border-primary relative', { 'shadow border-2 border-gray-300 hover:border-primary rounded-lg': defaultStyle })}`}>\n {headline && (\n <span className=\"mx-3 mt-3 block text-gray-700 font-bold\">\n {headline}\n </span>\n )}\n <textarea\n id={id}\n className={clsx('pt-0 px-3 border-transparent focus:border-transparent focus:ring-0 appearance-none border w-full leading-tight focus:outline-none', {\n 'resize-none': !resizable,\n 'h-32': defaultStyle,\n 'mt-3': !headline\n }, className)}\n onChange={(event) => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChange(event)\n onChangeText(value)\n }}\n onFocus={() => {\n setHasFocus(true)\n }}\n onBlur={(event) => {\n onBlur(event)\n onEditCompletedWrapper(event.target.value)\n setHasFocus(false)\n }}\n {...props}\n >\n </textarea>\n </div>\n {(hasFocus && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\n/**\n * A Textarea component that is not controlled by its parent\n */\nexport const TextareaUncontrolled = ({\n value = '',\n onChangeText = noop,\n ...props\n }: TextareaProps) => {\n const [text, setText] = useState<string>(value)\n\n useEffect(() => {\n setText(value)\n }, [value])\n\n return (\n <Textarea\n {...props}\n value={text}\n onChangeText={text => {\n setText(text)\n onChangeText(text)\n }}\n />\n )\n}","import type { ReactNode } from 'react'\nimport clsx from 'clsx'\nimport type { Language } from '@/localization/util'\nimport type { PropsForTranslation } from '@/localization/useTranslation'\nimport { useTranslation } from '@/localization/useTranslation'\nimport { noop } from '@/util/noop'\nimport { addDuration, subtractDuration } from '@/util/date'\nimport { SolidButton } from './Button'\nimport type { TimePickerProps } from '../date/TimePicker'\nimport { TimePicker } from '../date/TimePicker'\nimport type { DatePickerProps } from '../date/DatePicker'\nimport { DatePicker } from '../date/DatePicker'\n\ntype TimeTranslation = {\n clear: string,\n change: string,\n year: string,\n month: string,\n day: string,\n january: string,\n february: string,\n march: string,\n april: string,\n may: string,\n june: string,\n july: string,\n august: string,\n september: string,\n october: string,\n november: string,\n december: string,\n}\n\nconst defaultTimeTranslation: Record<Language, TimeTranslation> = {\n en: {\n clear: 'Clear',\n change: 'Change',\n year: 'Year',\n month: 'Month',\n day: 'Day',\n january: 'January',\n february: 'Febuary',\n march: 'March',\n april: 'April',\n may: 'May',\n june: 'June',\n july: 'July',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December',\n },\n de: {\n clear: 'Entfernen',\n change: 'Ändern',\n year: 'Jahr',\n month: 'Monat',\n day: 'Tag',\n january: 'Januar',\n february: 'Febuar',\n march: 'März',\n april: 'April',\n may: 'Mai',\n june: 'Juni',\n july: 'Juli',\n august: 'August',\n september: 'September',\n october: 'October',\n november: 'November',\n december: 'December',\n }\n}\n\nexport type DateTimePickerMode = 'date' | 'time' | 'dateTime'\n\nexport type DateTimePickerProps = {\n mode?: DateTimePickerMode,\n value?: Date,\n start?: Date,\n end?: Date,\n onChange?: (date: Date) => void,\n onFinish?: (date: Date) => void,\n onRemove?: () => void,\n datePickerProps?: Omit<DatePickerProps, 'onChange' | 'value' | 'start' | 'end'>,\n timePickerProps?: Omit<TimePickerProps, 'onChange' | 'time' | 'maxHeight'>,\n}\n\n/**\n * A Component for picking a Date and Time\n */\nexport const DateTimePicker = ({\n overwriteTranslation,\n value = new Date(),\n start = subtractDuration(new Date(), { years: 50 }),\n end = addDuration(new Date(), { years: 50 }),\n mode = 'dateTime',\n onFinish = noop,\n onChange = noop,\n onRemove = noop,\n timePickerProps,\n datePickerProps,\n }: PropsForTranslation<TimeTranslation, DateTimePickerProps>) => {\n const translation = useTranslation(defaultTimeTranslation, overwriteTranslation)\n\n const useDate = mode === 'dateTime' || mode === 'date'\n const useTime = mode === 'dateTime' || mode === 'time'\n\n let dateDisplay: ReactNode\n let timeDisplay: ReactNode\n\n if (useDate) {\n dateDisplay = (\n <DatePicker\n {...datePickerProps}\n className=\"min-w-[320px] min-h-[250px]\"\n yearMonthPickerProps={{ maxHeight: 218 }}\n value={value}\n start={start}\n end={end}\n onChange={onChange}\n />\n )\n }\n if (useTime) {\n timeDisplay = (\n <TimePicker\n {...timePickerProps}\n className={clsx('h-full', { 'justify-between w-full': mode === 'time' })}\n maxHeight={250}\n time={value}\n onChange={onChange}\n />\n )\n }\n\n return (\n <div className=\"col w-fit\">\n <div className=\"row gap-x-4\">\n {dateDisplay}\n {timeDisplay}\n </div>\n <div className=\"row justify-end\">\n <div className=\"row gap-x-2 mt-1\">\n <SolidButton size=\"medium\" color=\"negative\" onClick={onRemove}>{translation.clear}</SolidButton>\n <SolidButton\n size=\"medium\"\n onClick={() => onFinish(value)}\n >\n {translation.change}\n </SolidButton>\n </div>\n </div>\n </div>\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport clsx from 'clsx'\nimport { noop } from '@/util/noop'\nimport { getNeighbours, range } from '@/util/array'\nimport { clamp } from '@/util/math'\n\nexport type ScrollPickerProps<T> = {\n options: T[],\n mapping: (value: T) => string,\n selected?: T,\n onChange?: (value: T) => void,\n disabled?: boolean,\n}\n\ntype AnimationData<T> = {\n /** The index we scroll to */\n targetIndex: number,\n /** The index we are currently showing centered */\n currentIndex: number,\n items: T[],\n /** From -0.5 to 0.5 */\n transition: number,\n velocity: number,\n animationVelocity: number,\n lastTimeStamp?: number,\n lastScrollTimeStamp?: number,\n}\n\nconst up = 1\nconst down = -1\ntype Direction = 1 | -1\n\n/**\n * A component for picking an option by scrolling\n */\nexport const ScrollPicker = <T, >({\n options,\n mapping,\n selected,\n onChange = noop,\n disabled = false,\n }: ScrollPickerProps<T>) => {\n let selectedIndex = 0\n if (selected && options.indexOf(selected) !== -1) {\n selectedIndex = options.indexOf(selected)\n }\n const [{\n currentIndex,\n transition,\n items,\n lastTimeStamp\n }, setAnimation] = useState<AnimationData<T>>({\n targetIndex: selectedIndex,\n currentIndex: disabled ? selectedIndex : 0,\n velocity: 0,\n animationVelocity: Math.floor(options.length / 2),\n transition: 0,\n items: options,\n })\n\n const itemsShownCount = 5\n const shownItems = getNeighbours(range(0, items.length - 1), currentIndex).map(index => ({\n name: mapping(items[index]!), index\n }))\n\n const itemHeight = 40\n const distance = 8\n\n const containerHeight = itemHeight * (itemsShownCount - 2) + distance * (itemsShownCount - 2 + 1)\n\n const getDirection = useCallback((targetIndex: number, currentIndex: number, transition: number, length: number): Direction => {\n if (targetIndex === currentIndex) {\n return transition > 0 ? up : down\n }\n let distanceForward = targetIndex - currentIndex\n if (distanceForward < 0) {\n distanceForward += length\n }\n return distanceForward >= length / 2 ? down : up\n }, [])\n\n const animate = useCallback((timestamp: number, startTime: number | undefined) => {\n setAnimation((prevState) => {\n const {\n targetIndex,\n currentIndex,\n transition,\n animationVelocity,\n velocity,\n items,\n lastScrollTimeStamp\n } = prevState\n if (disabled) {\n return { ...prevState, currentIndex: targetIndex, velocity: 0, lastTimeStamp: timestamp }\n }\n if ((targetIndex === currentIndex && velocity === 0 && transition === 0) || !startTime) {\n return { ...prevState, lastTimeStamp: timestamp }\n }\n const progress = (timestamp - startTime) / 1000 // to seconds\n const direction = getDirection(targetIndex, currentIndex, transition, items.length)\n\n let newVelocity = velocity\n let usedVelocity\n let newCurrentIndex = currentIndex\n const isAutoScrolling = velocity === 0 && (!lastScrollTimeStamp || timestamp - lastScrollTimeStamp > 300)\n\n const newLastScrollTimeStamp = velocity !== 0 ? timestamp : lastScrollTimeStamp\n\n // manual scrolling\n if (isAutoScrolling) {\n usedVelocity = direction * animationVelocity\n } else {\n usedVelocity = velocity\n newVelocity = velocity * 0.5 // drag loss\n if (Math.abs(newVelocity) <= 0.05) {\n newVelocity = 0\n }\n }\n\n let newTransition = transition + usedVelocity * progress\n const changeThreshold = 0.5\n\n while (newTransition >= changeThreshold) {\n if (newCurrentIndex === targetIndex && newTransition >= changeThreshold && isAutoScrolling) {\n newTransition = 0\n break\n }\n newCurrentIndex = (currentIndex + 1) % items.length\n newTransition -= 1\n }\n if (newTransition >= changeThreshold) {\n newTransition = 0\n }\n while (newTransition <= -changeThreshold) {\n if (newCurrentIndex === targetIndex && newTransition <= -changeThreshold && isAutoScrolling) {\n newTransition = 0\n break\n }\n newCurrentIndex = currentIndex === 0 ? items.length - 1 : currentIndex - 1\n newTransition += 1\n }\n let newTargetIndex = targetIndex\n if (!isAutoScrolling) {\n newTargetIndex = newCurrentIndex\n }\n\n if ((currentIndex !== newTargetIndex || newTargetIndex !== targetIndex) && newTargetIndex === newCurrentIndex) {\n onChange(items[newCurrentIndex]!)\n }\n return {\n targetIndex: newTargetIndex,\n currentIndex: newCurrentIndex,\n animationVelocity,\n transition: newTransition,\n velocity: newVelocity,\n items,\n lastTimeStamp: timestamp,\n lastScrollTimeStamp: newLastScrollTimeStamp\n }\n })\n }, [disabled, getDirection, onChange])\n\n useEffect(() => {\n // constant update\n requestAnimationFrame((timestamp) => animate(timestamp, lastTimeStamp))\n })\n\n const opacity = (transition: number, index: number, itemsCount: number) => {\n const max = 100\n const min = 0\n const distance = max - min\n\n let opacityValue = min\n const unitTransition = clamp((transition) / 0.5)\n if (index === 1 || index === itemsCount - 2) {\n if (index === 1 && transition > 0) {\n opacityValue += Math.floor(unitTransition * distance)\n }\n if (index === itemsCount - 2 && transition < 0) {\n opacityValue += Math.floor(unitTransition * distance)\n }\n } else {\n opacityValue = max\n }\n\n // TODO this is not the right value for the bottom entry\n return clamp(1 - (opacityValue / max))\n }\n\n return (\n <div\n className=\"relative overflow-hidden\"\n style={{ height: containerHeight }}\n onWheel={event => {\n if (event.deltaY !== 0) {\n // TODO slower increase\n setAnimation(({ velocity, ...animationData }) =>\n ({ ...animationData, velocity: velocity + event.deltaY }))\n }\n }}\n >\n <div className=\"absolute top-1/2 -translate-y-1/2 -translate-x-1/2 left-1/2\">\n <div\n className=\"absolute z-[1] top-1/2 -translate-y-1/2 -translate-x-1/2 left-1/2 w-full min-w-[40px] border border-y-2 border-x-0 border-[#00000033]\"\n style={{ height: `${itemHeight}px` }}\n />\n <div\n className=\"col select-none\"\n style={{\n transform: `translateY(${-transition * (distance + itemHeight)}px)`,\n columnGap: `${distance}px`,\n }}\n >\n {shownItems.map(({ name, index }, arrayIndex) => (\n <div\n key={index}\n className={clsx(\n `col items-center justify-center rounded-md`,\n {\n 'text-primary font-bold': currentIndex === index,\n 'text-on-background': currentIndex === index,\n 'cursor-pointer': !disabled,\n 'cursor-not-allowed': disabled,\n }\n )}\n style={{\n opacity: currentIndex !== index ? opacity(transition, arrayIndex, shownItems.length) : undefined,\n height: `${itemHeight}px`,\n maxHeight: `${itemHeight}px`,\n }}\n onClick={() => !disabled && setAnimation(prevState => ({ ...prevState, targetIndex: index }))}\n >\n {name}\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n","import type { HTMLInputTypeAttribute, InputHTMLAttributes } from 'react'\nimport { useEffect, useRef, useState } from 'react'\nimport { Pencil } from 'lucide-react'\nimport clsx from 'clsx'\nimport { useSaveDelay } from '@/hooks/useSaveDelay'\nimport { noop } from '@/util/noop'\n\ntype InputProps = {\n /**\n * The value\n */\n value: string,\n /**\n * @default 'text'\n */\n type?: HTMLInputTypeAttribute,\n /**\n * Callback for when the input's value changes\n * This is pretty much required but made optional for the rare cases where it actually isn't need such as when used with disabled\n * That could be enforced through a union type but that seems a bit overkill\n * @default noop\n */\n onChangeText?: (text: string) => void,\n onEditCompleted?: (text: string) => void,\n labelClassName?: string,\n initialState?: 'editing' | 'display',\n size?: number,\n disclaimer?: string,\n} & Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'label' | 'type' | 'crossOrigin'>\n\n/**\n * A Text input component for inputting text. It changes appearance upon entering the edit mode and switches\n * back to display mode on loss of focus or on enter\n *\n * The State is managed by the parent\n */\nexport const ToggleableInput = ({\n type = 'text',\n value,\n onChange = noop,\n onChangeText = noop,\n onEditCompleted = noop,\n labelClassName = '',\n initialState = 'display',\n size = 16,\n disclaimer,\n onBlur,\n ...restProps\n }: InputProps) => {\n const [isEditing, setIsEditing] = useState(initialState !== 'display')\n const { restartTimer, clearUpdateTimer } = useSaveDelay(() => undefined, 3000)\n const ref = useRef<HTMLInputElement>(null)\n\n const onEditCompletedWrapper = (text: string) => {\n onEditCompleted(text)\n clearUpdateTimer()\n }\n\n useEffect(() => {\n if (isEditing) {\n ref.current?.focus()\n }\n }, [isEditing])\n\n return (\n <div>\n <div\n className={clsx('row items-center w-full gap-x-2 overflow-hidden', { 'cursor-pointer': !isEditing })}\n onClick={() => !isEditing ? setIsEditing(!isEditing) : undefined}\n >\n <div className={clsx('row overflow-hidden', { 'flex-1': isEditing })}>\n {isEditing ? (\n <input\n ref={ref}\n {...restProps}\n value={value}\n type={type}\n onChange={event => {\n const value = event.target.value\n restartTimer(() => {\n onEditCompletedWrapper(value)\n })\n onChangeText(value)\n onChange(event)\n }}\n onBlur={(event) => {\n if (onBlur) {\n onBlur(event)\n }\n onEditCompletedWrapper(value)\n setIsEditing(false)\n }}\n onKeyDown={event => {\n if (event.key === 'Enter') {\n setIsEditing(false)\n onEditCompletedWrapper(value)\n }\n }}\n className={clsx(`w-full border-none rounded-none ring-0 outline-0 text-inherit bg-inherit shadow-transparent decoration-primary p-0 underline-offset-4`, {\n underline: isEditing\n }, labelClassName)}\n onFocus={event => event.target.select()}\n />\n ) : (\n <span className={clsx('max-w-xs break-words overflow-hidden', labelClassName)}>\n {value}\n </span>\n )}\n </div>\n <Pencil\n className={clsx(`cursor-pointer`, { 'text-transparent': isEditing })}\n size={size}\n style={{ minWidth: `${size}px` }}\n />\n </div>\n {(isEditing && disclaimer) && (\n <label className=\"text-negative\">\n {disclaimer}\n </label>\n )}\n </div>\n )\n}\n\nexport const ToggleableInputUncontrolled = ({\n value: initialValue,\n onChangeText = noop,\n ...restProps\n }: InputProps) => {\n const [value, setValue] = useState(initialValue)\n\n useEffect(() => {\n setValue(initialValue)\n }, [initialValue])\n\n return (\n <ToggleableInput\n value={value}\n onChangeText={text => {\n setValue(text)\n onChangeText(text)\n }}\n {...restProps}\n />\n )\n}\n","import { z } from 'zod'\nimport type { Language } from '@/localization/util'\nimport { LanguageUtil } from '@/localization/util'\n\nexport type News = {\n title: string,\n date: Date,\n description: (string | URL)[],\n externalResource?: URL,\n keys: string[],\n}\n\nexport type LocalizedNews = Record<Language, News[]>\n\nexport const newsSchema = z.object({\n title: z.string(),\n description: z.string(),\n date: z.string(),\n image: z.string().url().optional(),\n externalResource: z.string().url().optional(),\n keys: z.array(z.string())\n}).transform<News>((obj) => {\n let description: (string | URL)[] = [obj.description]\n if (obj.image) {\n description = [new URL(obj.image), ...description]\n }\n\n return {\n title: obj.title,\n date: new Date(obj.date),\n description,\n externalResource: obj.externalResource ? new URL(obj.externalResource) : undefined,\n keys: obj.keys\n }\n})\n\nexport const newsListSchema = z.array(newsSchema)\n\nexport const localizedNewsSchema = z.record(z.enum(LanguageUtil.languages), newsListSchema)\n\nexport const filterNews = (localizedNews: News[], requiredKeys: string[]) => {\n return localizedNews.filter(news => requiredKeys.every(value => news.keys.includes(value)))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,aAAS,yBAAyB,aAAa;AAC3C,UAAI,OAAO,YAAY,WAAY,QAAO;AAE1C,UAAI,oBAAoB,oBAAI,QAAQ;AACpC,UAAI,mBAAmB,oBAAI,QAAQ;AAEnC,cAAQ,2BAA2B,SAASA,cAAa;AACrD,eAAOA,eAAc,mBAAmB;AAAA,MAC5C,GAAG,WAAW;AAAA,IAClB;AACA,aAAS,0BAA0B,KAAK,aAAa;AACjD,UAAI,CAAC,eAAe,OAAO,IAAI,WAAY,QAAO;AAClD,UAAI,QAAQ,QAAQ,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAAY,QAAO,EAAE,SAAS,IAAI;AAEhG,UAAI,QAAQ,yBAAyB,WAAW;AAEhD,UAAI,SAAS,MAAM,IAAI,GAAG,EAAG,QAAO,MAAM,IAAI,GAAG;AAEjD,UAAI,SAAS,EAAE,WAAW,KAAK;AAC/B,UAAI,wBAAwB,OAAO,kBAAkB,OAAO;AAE5D,eAAS,OAAO,KAAK;AACjB,YAAI,QAAQ,aAAa,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG,GAAG;AACrE,cAAI,OAAO,wBAAwB,OAAO,yBAAyB,KAAK,GAAG,IAAI;AAC/E,cAAI,SAAS,KAAK,OAAO,KAAK,KAAM,QAAO,eAAe,QAAQ,KAAK,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;AAEA,UAAM,YAAY,mBAAmB,CAAC;AACtC,UAAM,WAAW,YAAY;AAC7B,aAAS,IAAI,OAAO,IAAI,GAAG,KAAK;AAC9B,YAAMC,WAAU,mBAAmB,CAAC;AACpC,YAAM,gBAAgB,eAAe,QAAQ,KAAK,QAAQ,QAAQ;AAClE,YAAM,YAAY,eAAe,SAAS,KAAK,QAAQ,SAAS;AAChE,cAAQA,QAAO,IAAI,UAAU,IAAI,UAAU,aAAa,GAAG,UAAU,SAAS,IAAIA,WAAU,YAAY,WAAW,GAAG,EAAE,YAAY;AAAA,IACtI;AACA,YAAQ;AAAA,EACV;AAEA,SAAO;AACT;","names":["nodeInterop","assign","searchParamsToUrlQuery","urlQueryToSearchParams","searchParams","query","key","value","entries","existing","Array","isArray","push","stringifyUrlQueryParam","param","isNaN","String","URLSearchParams","Object","item","append","set","target","searchParamsList","keys","delete","formatUrl","formatWithValidation","urlObjectKeys","slashedProtocols","urlObj","auth","hostname","protocol","pathname","hash","query","host","encodeURIComponent","replace","indexOf","port","String","querystring","urlQueryToSearchParams","search","endsWith","slashes","test","url","process","env","NODE_ENV","Object","keys","forEach","key","includes","console","warn","omit","object","keys","omitted","Object","forEach","key","includes","DecodeError","MiddlewareNotFoundError","MissingStaticPage","NormalizeError","PageNotFoundError","SP","ST","WEB_VITALS","execOnce","getDisplayName","getLocationOrigin","getURL","isAbsoluteUrl","isResSent","loadGetInitialProps","normalizeRepeatedSlashes","stringifyError","fn","used","result","args","ABSOLUTE_URL_REGEX","url","test","protocol","hostname","port","window","location","href","origin","substring","length","Component","displayName","name","res","finished","headersSent","urlParts","split","urlNoQuery","replace","slice","join","App","ctx","process","env","NODE_ENV","prototype","getInitialProps","message","Error","pageProps","props","Object","keys","console","warn","performance","every","method","constructor","page","code","error","JSON","stringify","stack","removeTrailingSlash","route","replace","parsePath","path","hashIndex","indexOf","queryIndex","hasQuery","pathname","substring","query","undefined","hash","slice","normalizePathTrailingSlash","path","startsWith","process","env","__NEXT_MANUAL_TRAILING_SLASH","pathname","query","hash","parsePath","__NEXT_TRAILING_SLASH","test","removeTrailingSlash","endsWith","pathHasPrefix","path","prefix","pathname","parsePath","startsWith","hasBasePath","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","pathHasPrefix","isLocalURL","url","isAbsoluteUrl","locationOrigin","getLocationOrigin","resolved","URL","origin","hasBasePath","pathname","_","getSortedRouteObjects","getSortedRoutes","UrlNode","insert","urlPath","_insert","split","filter","Boolean","smoosh","_smoosh","prefix","childrenPaths","children","keys","sort","slugName","splice","indexOf","restSlugName","optionalRestSlugName","routes","map","c","get","reduce","prev","curr","push","placeholder","r","slice","Error","unshift","urlPaths","slugNames","isCatchAll","length","nextSegment","startsWith","endsWith","handleSlug","previousSlug","nextSlug","forEach","slug","replace","segmentName","isOptional","substring","has","set","Map","normalizedPages","root","pagePath","objects","getter","indexes","pathnames","i","pathname","sorted","ensureLeadingSlash","path","startsWith","DEFAULT_SEGMENT_KEY","PAGE_SEGMENT_KEY","addSearchParamsIfPageSegment","isGroupSegment","isParallelRouteSegment","segment","endsWith","startsWith","searchParams","isPageSegment","includes","stringifiedQuery","JSON","stringify","normalizeAppPath","normalizeRscURL","route","ensureLeadingSlash","split","reduce","pathname","segment","index","segments","isGroupSegment","length","url","replace","INTERCEPTION_ROUTE_MARKERS","extractInterceptionRouteInformation","isInterceptionRouteAppPath","path","split","find","segment","m","startsWith","undefined","interceptingRoute","marker","interceptedRoute","Error","normalizeAppPath","slice","concat","join","splitInterceptingRoute","length","isDynamicRoute","TEST_ROUTE","TEST_STRICT_ROUTE","route","strict","isInterceptionRouteAppPath","extractInterceptionRouteInformation","interceptedRoute","test","getSortedRouteObjects","getSortedRoutes","isDynamicRoute","getRouteMatcher","re","groups","pathname","routeMatch","exec","decode","param","decodeURIComponent","DecodeError","params","key","group","Object","entries","match","pos","undefined","repeat","split","map","entry","ACTION_SUFFIX","APP_DIR_ALIAS","CACHE_ONE_YEAR","DOT_NEXT_ALIAS","ESLINT_DEFAULT_DIRS","GSP_NO_RETURNED_VALUE","GSSP_COMPONENT_MEMBER_ERROR","GSSP_NO_RETURNED_VALUE","INFINITE_CACHE","INSTRUMENTATION_HOOK_FILENAME","MATCHED_PATH_HEADER","MIDDLEWARE_FILENAME","MIDDLEWARE_LOCATION_REGEXP","NEXT_BODY_SUFFIX","NEXT_CACHE_IMPLICIT_TAG_ID","NEXT_CACHE_REVALIDATED_TAGS_HEADER","NEXT_CACHE_REVALIDATE_TAG_TOKEN_HEADER","NEXT_CACHE_SOFT_TAG_MAX_LENGTH","NEXT_CACHE_TAGS_HEADER","NEXT_CACHE_TAG_MAX_ITEMS","NEXT_CACHE_TAG_MAX_LENGTH","NEXT_DATA_SUFFIX","NEXT_INTERCEPTION_MARKER_PREFIX","NEXT_META_SUFFIX","NEXT_QUERY_PARAM_PREFIX","NEXT_RESUME_HEADER","NON_STANDARD_NODE_ENV","PAGES_DIR_ALIAS","PRERENDER_REVALIDATE_HEADER","PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER","PUBLIC_DIR_MIDDLEWARE_CONFLICT","ROOT_DIR_ALIAS","RSC_ACTION_CLIENT_WRAPPER_ALIAS","RSC_ACTION_ENCRYPTION_ALIAS","RSC_ACTION_PROXY_ALIAS","RSC_ACTION_VALIDATE_ALIAS","RSC_CACHE_WRAPPER_ALIAS","RSC_MOD_REF_PROXY_ALIAS","RSC_PREFETCH_SUFFIX","RSC_SEGMENTS_DIR_SUFFIX","RSC_SEGMENT_SUFFIX","RSC_SUFFIX","SERVER_PROPS_EXPORT_ERROR","SERVER_PROPS_GET_INIT_PROPS_CONFLICT","SERVER_PROPS_SSG_CONFLICT","SERVER_RUNTIME","SSG_FALLBACK_EXPORT_ERROR","SSG_GET_INITIAL_PROPS_CONFLICT","STATIC_STATUS_PAGE_GET_INITIAL_PROPS_ERROR","UNSTABLE_REVALIDATE_RENAME_ERROR","WEBPACK_LAYERS","WEBPACK_RESOURCE_QUERIES","edge","experimentalEdge","nodejs","WEBPACK_LAYERS_NAMES","shared","reactServerComponents","serverSideRendering","actionBrowser","apiNode","apiEdge","middleware","instrument","edgeAsset","appPagesBrowser","pagesDirBrowser","pagesDirEdge","pagesDirNode","GROUP","builtinReact","serverOnly","neutralTarget","clientOnly","bundled","appPages","edgeSSREntry","metadata","metadataRoute","metadataImageMeta","escapeStringRegexp","reHasRegExp","reReplaceRegExp","str","test","replace","getNamedMiddlewareRegex","getNamedRouteRegex","getRouteRegex","parseParameter","PARAMETER_PATTERN","param","match","parseMatchedParameter","optional","startsWith","endsWith","slice","repeat","key","getParametrizedRoute","route","includeSuffix","includePrefix","groups","groupIndex","segments","segment","removeTrailingSlash","split","markerMatch","INTERCEPTION_ROUTE_MARKERS","find","m","paramMatches","pos","push","escapeStringRegexp","s","substring","parameterizedRoute","join","normalizedRoute","excludeOptionalTrailingSlash","re","RegExp","buildGetSafeRouteKey","i","routeKey","j","String","fromCharCode","Math","floor","getSafeKeyFromSegment","interceptionMarker","getSafeRouteKey","routeKeys","keyPrefix","backreferenceDuplicateKeys","cleanedKey","replace","invalidKey","length","isNaN","parseInt","duplicateKey","interceptionPrefix","pattern","getNamedParametrizedRoute","prefixRouteKeys","hasInterceptionMarker","some","NEXT_INTERCEPTION_MARKER_PREFIX","undefined","NEXT_QUERY_PARAM_PREFIX","namedParameterizedRoute","options","result","namedRegex","catchAll","catchAllRegex","catchAllGroupedRegex","interpolateAs","route","asPathname","query","interpolatedRoute","dynamicRegex","getRouteRegex","dynamicGroups","groups","dynamicMatches","getRouteMatcher","params","Object","keys","every","param","value","repeat","optional","replaced","Array","isArray","replace","map","segment","encodeURIComponent","join","result","resolveHref","router","href","resolveAs","base","urlAsString","formatWithValidation","urlProtoMatch","match","urlAsStringNoProto","slice","length","urlParts","split","console","error","pathname","normalizedUrl","normalizeRepeatedSlashes","isLocalURL","URL","startsWith","asPath","_","finalUrl","normalizePathTrailingSlash","interpolatedAs","isDynamicRoute","searchParams","query","searchParamsToUrlQuery","result","params","interpolateAs","hash","omit","resolvedHref","origin","addPathPrefix","path","prefix","startsWith","pathname","query","hash","parsePath","addLocale","path","locale","defaultLocale","ignorePrefix","lower","toLowerCase","pathHasPrefix","addPathPrefix","addLocale","path","args","process","env","__NEXT_I18N_SUPPORT","normalizePathTrailingSlash","require","RouterContext","React","createContext","process","env","NODE_ENV","displayName","cancelIdleCallback","requestIdleCallback","self","bind","window","cb","start","Date","now","setTimeout","didTimeout","timeRemaining","Math","max","id","clearTimeout","useIntersection","hasIntersectionObserver","IntersectionObserver","observers","Map","idList","createObserver","options","id","root","margin","rootMargin","existing","find","obj","instance","get","elements","observer","entries","forEach","entry","callback","target","isVisible","isIntersecting","intersectionRatio","push","set","observe","element","unobserve","delete","size","disconnect","index","findIndex","splice","rootRef","disabled","isDisabled","visible","setVisible","useState","elementRef","useRef","setElement","useCallback","current","useEffect","tagName","idleCallback","requestIdleCallback","cancelIdleCallback","resetVisible","normalizeLocalePath","cache","WeakMap","pathname","locales","lowercasedLocales","get","map","locale","toLowerCase","set","detectedLocale","segments","split","segment","index","indexOf","slice","length","normalizeLocalePath","pathname","locales","process","env","__NEXT_I18N_SUPPORT","require","detectedLocale","undefined","detectDomainLocale","domainItems","hostname","detectedLocale","toLowerCase","item","domainHostname","domain","split","defaultLocale","locales","some","locale","detectDomainLocale","args","process","env","__NEXT_I18N_SUPPORT","require","getDomainLocale","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","locale","locales","domainLocales","__NEXT_I18N_SUPPORT","normalizeLocalePath","require","detectDomainLocale","target","detectedLocale","domain","undefined","proto","http","finalLocale","defaultLocale","normalizePathTrailingSlash","addBasePath","basePath","process","env","__NEXT_ROUTER_BASEPATH","path","required","normalizePathTrailingSlash","__NEXT_MANUAL_CLIENT_BASE_PATH","addPathPrefix","useMergedRef","refA","refB","cleanupA","useRef","cleanupB","useCallback","current","cleanupFnA","cleanupFnB","applyRef","cleanup","errorOnce","_","process","env","NODE_ENV","errors","Set","msg","has","console","error","add","useLinkStatus","prefetched","Set","prefetch","router","href","as","options","window","isLocalURL","bypassPrefetchedCheck","locale","undefined","prefetchedKey","has","add","catch","err","process","env","NODE_ENV","isModifiedEvent","event","eventTarget","currentTarget","target","getAttribute","metaKey","ctrlKey","shiftKey","altKey","nativeEvent","which","linkClicked","e","replace","shallow","scroll","onNavigate","nodeName","isAnchorNodeName","toUpperCase","hasAttribute","preventDefault","location","navigate","isDefaultPrevented","routerScroll","formatStringOrUrl","urlObjOrString","formatUrl","Link","React","forwardRef","LinkComponent","props","forwardedRef","children","hrefProp","asProp","childrenProp","prefetchProp","passHref","onClick","onMouseEnter","onMouseEnterProp","onTouchStart","onTouchStartProp","legacyBehavior","restProps","a","useContext","RouterContext","prefetchEnabled","createPropError","args","Error","key","expected","actual","requiredPropsGuard","requiredProps","Object","keys","forEach","_","optionalPropsGuard","optionalProps","valType","useMemo","resolvedHref","resolvedAs","resolveHref","previousHref","useRef","previousAs","child","console","warn","Children","only","type","childRef","ref","setIntersectionRef","isVisible","resetVisible","useIntersection","rootMargin","setIntersectionWithResetRef","useCallback","el","current","setRef","useMergedRef","useEffect","childProps","defaultPrevented","priority","__NEXT_LINK_NO_TOUCH_START","isAbsoluteUrl","curLocale","localeDomain","isLocaleDomain","getDomainLocale","locales","domainLocales","addBasePath","addLocale","defaultLocale","errorOnce","cloneElement","LinkStatusContext","createContext","pending","require_link","clsx","clsx","jsx","jsxs","jsx","useEffect","useState","ChevronDown","useEffect","useState","jsx","clsx","clsx","jsx","jsxs","useEffect","useState","clsx","useEffect","useState","clsx","jsx","jsxs","Expandable","clsx","ExpandableUncontrolled","useState","useEffect","jsx","clsx","useEffect","useState","jsx","jsxs","jsx","jsxs","jsx","useEffect","useRef","useState","Scrollbars","clsx","jsx","jsxs","clsx","useEffect","useRef","useState","clsx","useEffect","useState","clsx","jsx","jsxs","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","useCallback","useEffect","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","useCallback","useEffect","useRef","useState","clsx","jsx","jsxs","clsx","jsx","jsxs","clsx","jsx","clsx","ChevronDown","ChevronUp","Fragment","jsx","jsx","ChevronLeft","ChevronRight","clsx","jsx","jsxs","useEffect","useMemo","useState","clsx","forwardRef","useEffect","useRef","useState","clsx","useEffect","useState","clsx","jsx","jsx","jsxs","forwardRef","FormInput","jsx","clsx","jsxs","jsx","jsxs","ChevronLeft","ChevronRight","clsx","useEffect","useState","jsx","jsxs","useEffect","useRef","useState","Scrollbars","useState","Check","clsx","jsx","jsxs","clsx","ChevronDown","ChevronUp","jsx","jsxs","clsx","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","jsx","jsxs","clsx","jsx","jsxs","jsx","jsx","ChevronDown","ChevronUp","Search","useEffect","useState","clsx","Fragment","jsx","jsxs","jsx","jsxs","createContext","useContext","useEffect","useState","jsx","createContext","jsx","jsxs","Check","clsx","jsx","jsxs","jsx","clsx","jsx","clsx","useState","Search","clsx","useRef","clsx","useEffect","jsx","jsxs","jsx","jsxs","jsx","clsx","jsx","jsxs","List","clsx","jsx","clsx","useEffect","useState","clsx","jsx","jsxs","jsx","clsx","jsx","jsxs","useCallback","useEffect","useState","clsx","jsx","jsxs","useEffect","useRef","useState","clsx","jsx","jsxs","current"]}
|