@digdir/designsystemet-web 1.12.1 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -4
- package/dist/cjs/field/field.cjs +1 -1
- package/dist/cjs/field/field.cjs.map +1 -1
- package/dist/cjs/popover/popover.cjs +1 -1
- package/dist/cjs/popover/popover.cjs.map +1 -1
- package/dist/cjs/toggle-group/toggle-group.cjs +1 -1
- package/dist/cjs/toggle-group/toggle-group.cjs.map +1 -1
- package/dist/cjs/tooltip/tooltip.cjs +1 -1
- package/dist/cjs/tooltip/tooltip.cjs.map +1 -1
- package/dist/cjs/utils/utils.cjs +1 -1
- package/dist/cjs/utils/utils.cjs.map +1 -1
- package/dist/esm/field/field.js +1 -1
- package/dist/esm/field/field.js.map +1 -1
- package/dist/esm/popover/popover.js +1 -1
- package/dist/esm/popover/popover.js.map +1 -1
- package/dist/esm/toggle-group/toggle-group.js +1 -1
- package/dist/esm/toggle-group/toggle-group.js.map +1 -1
- package/dist/esm/tooltip/tooltip.js +1 -1
- package/dist/esm/tooltip/tooltip.js.map +1 -1
- package/dist/esm/utils/utils.js +1 -1
- package/dist/esm/utils/utils.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +49 -15
- package/dist/umd/index.js +4 -4
- package/dist/umd/index.js.map +1 -1
- package/dist/web.manifest.json +31 -3
- package/package.json +67 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["export const QUICK_EVENT = { passive: true, capture: true };\n\n// Using function instead of constant to support evnironments where DOM can be unloaded (like Vitest with jsdom)\nexport const isBrowser = () =>\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nexport const isWindows = () =>\n isBrowser() &&\n // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474\n /^Win/i.test(navigator.userAgentData?.platform || navigator.platform);\n\n// Make sure we have a HTMLElement to extend (for server side rendering)\nexport const DSElement =\n typeof HTMLElement === 'undefined'\n ? (class {} as typeof HTMLElement)\n : HTMLElement;\n\nexport function debounce<T extends unknown[]>(\n callback: (...args: T) => void,\n delay: number,\n) {\n let timer: ReturnType<typeof setTimeout>;\n\n return function (this: unknown, ...args: T) {\n clearTimeout(timer);\n timer = setTimeout(() => callback.apply(this, args), delay);\n };\n}\n\n/**\n * warn\n * @description Utility to console.warn, but can be silenced in production with window.dsWarnings = false;\n */\ndeclare global {\n interface Window {\n dsWarnings?: boolean;\n }\n}\nexport const warn = (\n message: string,\n ...args: Parameters<typeof console.warn>\n) =>\n typeof window === 'undefined' ||\n window.dsWarnings === false ||\n console.warn(`Designsystemet: ${message}`, ...args);\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to read/write attributes from\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport const attr = (\n el: Element,\n name: string,\n value?: string | null,\n): string | null => {\n if (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n if (value === null) el.removeAttribute(name);\n else if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n return null;\n};\n\n/**\n * attrOrCSS\n * @description Retrieves and updates attribute based on attribute or CSS property value\n * @param el The Element to read attributes/CSS from\n * @param name Attribute or CSS property to get\n * @return string attribute or CSS property value\n */\nconst STRIP_SURROUNDING_QUOTES = /^[\"']|[\"']$/g; // Matches surrounding single or double quotes\nexport const attrOrCSS = (el: Element, name: string) => {\n let value = attr(el, name);\n if (!value) {\n const prop = getComputedStyle(el).getPropertyValue(`--_ds-${name}`);\n value = prop.replace(STRIP_SURROUNDING_QUOTES, '').trim() || null;\n }\n if (!value) warn(`Missing ${name} on:`, el);\n return value;\n};\n\n/**\n * on\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.addEventListener>\n): (() => void) => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.addEventListener(type, ...options);\n return () => off(el, ...rest);\n};\n\n/**\n * off\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.removeEventListener(type, ...options);\n};\n\n// Used to store cleanup functions for hot-reloading\ndeclare global {\n interface Window {\n _dsHotReloadCleanup?: Map<string, Array<() => void>>;\n }\n}\n\n/**\n * onHotReload\n * @description Runs a callback when window is loaded in browser, and ensures cleanup when hot-reloading\n * @param key The key to identify setup and corresponding cleanup\n * @param callback The callback to run when the page is ready\n */\nexport const onHotReload = (key: string, setup: () => Array<() => void>) => {\n if (!isBrowser()) return; // Skip if not in modern browser environment, but on each call as Vitest might have unloaded jsdom between tests\n if (!window._dsHotReloadCleanup) window._dsHotReloadCleanup = new Map(); // Hot reload cleanup support supporting all build tools\n\n window._dsHotReloadCleanup?.get(key)?.map((cleanup) => cleanup()); // Run previous cleanup\n window._dsHotReloadCleanup?.set(key, setup()); // Store new cleanup\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nlet SKIP_MUTATIONS = false;\nexport const onMutation = (\n el: Node,\n callback: (observer: MutationObserver) => void,\n options: MutationObserverInit,\n) => {\n let queue = 0;\n const onFrame = () => {\n if (!el.isConnected) return cleanup(); // Stop observing if element is removed from DOM\n callback(observer);\n observer.takeRecords(); // Clear records in case mutations happened during callback\n queue = 0;\n };\n const cleanup = () => observer?.disconnect?.();\n const observer = new MutationObserver(() => {\n if (!SKIP_MUTATIONS && !queue) queue = requestAnimationFrame(onFrame); // requestAnimationFrame only runs when page is visible\n });\n\n observer.observe(el, options);\n requestAnimationFrame(onFrame); // Initial run when page is visible and children has mounted\n return cleanup;\n};\n\n/**\n * Many mutation observers need to watch childNodes, thus running on all `textContent` changes\n * This utility allows skipping mutation observers while updating textContent\n */\nexport const setTextWithoutMutation = (el: Element, text: string | null) => {\n SKIP_MUTATIONS = true;\n el.textContent = text;\n requestAnimationFrame(enableMutations); // Let all mutationobservers run before enabling again\n};\nconst enableMutations = () => {\n SKIP_MUTATIONS = false;\n};\n\n/**\n * tag\n * @description creates element and assigns properties\n * @param tagName The tagname of element to create\n * @param attrs Optional attributes to add to the element\n * @param text Optional text content to add to the element\n * @return HTMLElement with props\n */\nexport const tag = <TagName extends keyof HTMLElementTagNameMap>(\n tagName: TagName,\n attrs?: Record<string, string | null> | null,\n): HTMLElementTagNameMap[TagName] => {\n const el = document.createElement(tagName);\n if (attrs) for (const [key, val] of Object.entries(attrs)) attr(el, key, val);\n return el;\n};\n\n/**\n * customElements.define\n * @description Defines a customElement if running in browser and if not already registered\n * Scoped/named \"customElements.define\" so @custom-elements-manifest/analyzer can find tag names\n */\nexport const customElements = {\n define: (name: string, instance: CustomElementConstructor) =>\n !isBrowser() ||\n window.customElements.get(name) ||\n window.customElements.define(name, instance),\n};\n\n/**\n * useId\n * @return A generated unique ID\n */\nlet id = 0;\nconst hash = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;\nexport function useId(el?: Element | null) {\n if (el && !el.id) el.id = `${hash}${++id}`;\n return el?.id || '';\n}\n"],"mappings":"AAAA,MAAa,EAAc,CAAE,QAAS,GAAM,QAAS,GAAM,CAG9C,MACX,OAAO,OAAW,KAAe,OAAO,SAAa,IAE1C,MACX,GAAW,EAEX,QAAQ,KAAK,UAAU,eAAe,UAAY,UAAU,SAAS,CAG1D,EACX,OAAO,YAAgB,IAClB,KAAM,GACP,YAEN,SAAgB,EACd,EACA,EACA,CACA,IAAI,EAEJ,OAAO,SAAyB,GAAG,EAAS,CAC1C,aAAa,EAAM,CACnB,EAAQ,eAAiB,EAAS,MAAM,KAAM,EAAK,CAAE,EAAM,EAa/D,MAAa,GACX,EACA,GAAG,IAEH,OAAO,OAAW,KAClB,OAAO,aAAe,IACtB,QAAQ,KAAK,mBAAmB,IAAW,GAAG,EAAK,CASxC,GACX,EACA,EACA,IAEI,IAAU,IAAA,GAAkB,EAAG,aAAa,EAAK,EAAI,MACrD,IAAU,KAAM,EAAG,gBAAgB,EAAK,CACnC,EAAG,aAAa,EAAK,GAAK,GAAO,EAAG,aAAa,EAAM,EAAM,CAC/D,MAUH,EAA2B,eACpB,GAAa,EAAa,IAAiB,CACtD,IAAI,EAAQ,EAAK,EAAI,EAAK,CAM1B,MALA,CAEE,IADa,iBAAiB,EAAG,CAAC,iBAAiB,SAAS,IAAO,CACtD,QAAQ,EAA0B,GAAG,CAAC,MAAM,EAAI,KAE1D,GAAO,EAAK,WAAW,EAAK,MAAO,EAAG,CACpC,GASI,GACX,EACA,GAAG,IACc,CACjB,GAAM,CAAC,EAAO,GAAG,GAAW,EAC5B,IAAK,IAAM,KAAQ,EAAM,MAAM,IAAI,CAAE,EAAG,iBAAiB,EAAM,GAAG,EAAQ,CAC1E,UAAa,EAAI,EAAI,GAAG,EAAK,EASlB,GACX,EACA,GAAG,IACM,CACT,GAAM,CAAC,EAAO,GAAG,GAAW,EAC5B,IAAK,IAAM,KAAQ,EAAM,MAAM,IAAI,CAAE,EAAG,oBAAoB,EAAM,GAAG,EAAQ,EAgBlE,GAAe,EAAa,IAAmC,CACrE,GAAW,GACX,OAAO,sBAAqB,OAAO,oBAAsB,IAAI,KAElE,OAAO,qBAAqB,IAAI,EAAI,EAAE,IAAK,GAAY,GAAS,CAAC,CACjE,OAAO,qBAAqB,IAAI,EAAK,GAAO,CAAC,GAO/C,IAAI,EAAiB,GACrB,MAAa,GACX,EACA,EACA,IACG,CACH,IAAI,EAAQ,EACN,MAAgB,CACpB,GAAI,CAAC,EAAG,YAAa,OAAO,GAAS,CACrC,EAAS,EAAS,CAClB,EAAS,aAAa,CACtB,EAAQ,GAEJ,MAAgB,GAAU,cAAc,CACxC,EAAW,IAAI,qBAAuB,CACtC,CAAC,GAAkB,CAAC,IAAO,EAAQ,sBAAsB,EAAQ,GACrE,CAIF,OAFA,EAAS,QAAQ,EAAI,EAAQ,CAC7B,sBAAsB,EAAQ,CACvB,GAOI,GAA0B,EAAa,IAAwB,CAC1E,EAAiB,GACjB,EAAG,YAAc,EACjB,sBAAsB,EAAgB,EAElC,MAAwB,CAC5B,EAAiB,IAWN,GACX,EACA,IACmC,CACnC,IAAM,EAAK,SAAS,cAAc,EAAQ,CAC1C,GAAI,EAAO,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,EAAM,CAAE,EAAK,EAAI,EAAK,EAAI,CAC7E,OAAO,GAQI,EAAiB,CAC5B,QAAS,EAAc,IACrB,CAAC,GAAW,EACZ,OAAO,eAAe,IAAI,EAAK,EAC/B,OAAO,eAAe,OAAO,EAAM,EAAS,CAC/C,CAMD,IAAI,EAAK,EACT,MAAM,EAAO,GAAG,KAAK,KAAK,CAAC,SAAS,GAAG,GAAG,KAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,MAAM,EAAG,EAAE,GAChF,SAAgB,EAAM,EAAqB,CAEzC,OADI,GAAM,CAAC,EAAG,KAAI,EAAG,GAAK,GAAG,IAAO,EAAE,KAC/B,GAAI,IAAM"}
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../../../src/utils/utils.ts"],"sourcesContent":["export const QUICK_EVENT = { passive: true, capture: true };\n\n// Using function instead of constant to support evnironments where DOM can be unloaded (like Vitest with jsdom)\nexport const isBrowser = () =>\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\nexport const isWindows = () =>\n isBrowser() &&\n // @ts-expect-error Typescript has not implemented userAgentData yet https://stackoverflow.com/a/71392474\n /^Win/i.test(navigator.userAgentData?.platform || navigator.platform);\n\n// Make sure we have a HTMLElement to extend (for server side rendering)\nexport const DSElement =\n typeof HTMLElement === 'undefined'\n ? (class {} as typeof HTMLElement)\n : HTMLElement;\n\nexport function debounce<T extends unknown[]>(\n callback: (...args: T) => void,\n delay: number,\n) {\n let timer: ReturnType<typeof setTimeout>;\n\n return function (this: unknown, ...args: T) {\n clearTimeout(timer);\n timer = setTimeout(() => callback.apply(this, args), delay);\n };\n}\n\n/**\n * warn\n * @description Utility to console.warn, but can be silenced in production with window.dsWarnings = false;\n */\ndeclare global {\n interface Window {\n dsWarnings?: boolean;\n }\n}\nexport const warn = (\n message: string,\n ...args: Parameters<typeof console.warn>\n) =>\n !isBrowser() ||\n window.dsWarnings === false ||\n console.warn(`Designsystemet: ${message}`, ...args);\n\n/**\n * attr\n * @description Utility to quickly get, set and remove attributes\n * @param el The Element to read/write attributes from\n * @param name The attribute name to get, set or remove, or a object to set multiple attributes\n * @param value A valid attribute value or null to remove attribute\n */\nexport const attr = (\n el: Element,\n name: string,\n value?: string | null,\n): string | null => {\n if (value === undefined) return el.getAttribute(name) ?? null; // Fallback to null only if el is undefined\n if (value === null) el.removeAttribute(name);\n else if (el.getAttribute(name) !== value) el.setAttribute(name, value);\n return null;\n};\n\nconst STRIP_SURROUNDING_QUOTES = /^[\"']|[\"']$/g; // Matches surrounding single or double quotes\n/**\n * attrOrCSS\n * @description Retrieves and updates attribute based on attribute or CSS property value\n * @param el The Element to read attributes/CSS from\n * @param name Attribute or CSS property to get\n * @return string attribute or CSS property value\n */\nexport const attrOrCSS = (el: Element, name: string) => {\n let value = attr(el, name);\n if (!value) {\n const prop = getComputedStyle(el).getPropertyValue(`--_ds-${name}`);\n value = prop.replace(STRIP_SURROUNDING_QUOTES, '').trim() || null;\n }\n if (!value) warn(`Missing ${name} on:`, el);\n return value;\n};\n\n/**\n * on\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const on = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.addEventListener>\n): (() => void) => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.addEventListener(type, ...options);\n return () => off(el, ...rest);\n};\n\n/**\n * off\n * @param el The Element to use as EventTarget\n * @param types A space separated string of event types\n * @param listener An event listener function or listener object\n */\nexport const off = (\n el: Node | Window | ShadowRoot,\n ...rest: Parameters<typeof Element.prototype.removeEventListener>\n): void => {\n const [types, ...options] = rest;\n for (const type of types.split(' ')) el.removeEventListener(type, ...options);\n};\n\n// Used to store cleanup functions for hot-reloading\ndeclare global {\n interface Window {\n _dsHotReloadCleanup?: Map<string, Array<() => void>>;\n }\n}\n\n/**\n * onHotReload\n * @description Runs a callback when window is loaded in browser, and ensures cleanup when hot-reloading\n * @param key The key to identify setup and corresponding cleanup\n * @param callback The callback to run when the page is ready\n */\nexport const onHotReload = (key: string, setup: () => Array<() => void>) => {\n if (!isBrowser()) return; // Skip if not in modern browser environment, but on each call as Vitest might have unloaded jsdom between tests\n if (!window._dsHotReloadCleanup) window._dsHotReloadCleanup = new Map(); // Hot reload cleanup support supporting all build tools\n\n window._dsHotReloadCleanup?.get(key)?.map((cleanup) => cleanup()); // Run previous cleanup\n window._dsHotReloadCleanup?.set(key, setup()); // Store new cleanup\n};\n\n/**\n * Speed up MutationObserver by debouncing and only running when page is visible\n * @return new MutaionObserver\n */\nlet SKIP_MUTATIONS = false;\nexport const onMutation = (\n el: Node,\n callback: (observer: MutationObserver) => void,\n options: MutationObserverInit,\n) => {\n let queue = 0;\n const onFrame = () => {\n if (!el.isConnected) return cleanup(); // Stop observing if element is removed from DOM\n callback(observer);\n observer.takeRecords(); // Clear records in case mutations happened during callback\n queue = 0;\n };\n const cleanup = () => observer?.disconnect?.();\n const observer = new MutationObserver(() => {\n if (!SKIP_MUTATIONS && !queue) queue = requestAnimationFrame(onFrame); // requestAnimationFrame only runs when page is visible\n });\n\n observer.observe(el, options);\n requestAnimationFrame(onFrame); // Initial run when page is visible and children has mounted\n return cleanup;\n};\n\n/**\n * Many mutation observers need to watch childNodes, thus running on all `textContent` changes\n * This utility allows skipping mutation observers while updating textContent\n */\nexport const setTextWithoutMutation = (el: Element, text: string | null) => {\n SKIP_MUTATIONS = true;\n el.textContent = text;\n requestAnimationFrame(enableMutations); // Let all mutationobservers run before enabling again\n};\nconst enableMutations = () => {\n SKIP_MUTATIONS = false;\n};\n\n/**\n * tag\n * @description creates element and assigns properties\n * @param tagName The tagname of element to create\n * @param attrs Optional attributes to add to the element\n * @param text Optional text content to add to the element\n * @return HTMLElement with props\n */\nexport const tag = <TagName extends keyof HTMLElementTagNameMap>(\n tagName: TagName,\n attrs?: Record<string, string | null> | null,\n): HTMLElementTagNameMap[TagName] => {\n const el = document.createElement(tagName);\n if (attrs) for (const [key, val] of Object.entries(attrs)) attr(el, key, val);\n return el;\n};\n\n/**\n * customElements.define\n * @description Defines a customElement if running in browser and if not already registered\n * Scoped/named \"customElements.define\" so @custom-elements-manifest/analyzer can find tag names\n */\nexport const customElements = {\n define: (name: string, instance: CustomElementConstructor) =>\n !isBrowser() ||\n window.customElements.get(name) ||\n window.customElements.define(name, instance),\n};\n\n/**\n * useId\n * @return A generated unique ID\n */\ndeclare global {\n interface Window {\n dsUseId?: number; // Use a global counter to ensure this works even when loading designsystemet multiple times\n }\n}\nlet id = 0;\nexport function useId(el?: Element | null) {\n if (!isBrowser()) return `:ds:${++id}`; // Emulate browser environment if window not available\n if (!window.dsUseId) window.dsUseId = 0; // Make sure we have a global to support multiple instances of designsystemet in same page\n if (el && !el.id) el.id = `:ds:${++window.dsUseId}`;\n return el?.id || '';\n}\n\n/**\n * @description Based off speak function from [U-elements](https://github.com/u-elements/u-elements/blob/main/packages/utils.ts#L210)\n * @param text The text to announce\n */\nlet LIVE_EL: HTMLElement | undefined;\nlet LIVE_FIX = 0;\nlet LIVE_CLEAR: ReturnType<typeof setTimeout> | number = 0;\nexport const announce = (text: string) => {\n clearTimeout(LIVE_CLEAR);\n if (LIVE_EL)\n setTextWithoutMutation(LIVE_EL, `${text}${LIVE_FIX++ % 2 ? '\\u00A0' : ''}`); // Non-breaking space to ensure screen reader announces\n if (text) LIVE_CLEAR = setTimeout(announce, 2000, ''); // Clear prevent old announcements being found by screen readers, with 2 seconds brace period to avoid cutting of Android Talkback\n};\n\n// Mount live region on first focus so its ready to be used\nconst announceMount = () => {\n if (document.readyState !== 'complete') return; // Ensure page is loaded trying to avoid issues with React hydration\n if (!LIVE_EL) {\n LIVE_EL = tag('div', { 'aria-live': 'assertive' });\n LIVE_EL.style.overflow = 'hidden'; // Settings styles individually to prevent issues with CSP\n LIVE_EL.style.position = 'fixed';\n LIVE_EL.style.whiteSpace = 'nowrap';\n LIVE_EL.style.width = '1px';\n }\n if (!LIVE_EL.isConnected) document.body.appendChild(LIVE_EL);\n};\nonHotReload('announce', () => [\n on(document, 'focus mouseover', announceMount, QUICK_EVENT),\n]);\n"],"mappings":"AAAA,MAAa,EAAc,CAAE,QAAS,GAAM,QAAS,GAAM,CAG9C,MACX,OAAO,OAAW,KAAe,OAAO,SAAa,IAE1C,MACX,GAAW,EAEX,QAAQ,KAAK,UAAU,eAAe,UAAY,UAAU,SAAS,CAG1D,EACX,OAAO,YAAgB,IAClB,KAAM,GACP,YAEN,SAAgB,EACd,EACA,EACA,CACA,IAAI,EAEJ,OAAO,SAAyB,GAAG,EAAS,CAC1C,aAAa,EAAM,CACnB,EAAQ,eAAiB,EAAS,MAAM,KAAM,EAAK,CAAE,EAAM,EAa/D,MAAa,GACX,EACA,GAAG,IAEH,CAAC,GAAW,EACZ,OAAO,aAAe,IACtB,QAAQ,KAAK,mBAAmB,IAAW,GAAG,EAAK,CASxC,GACX,EACA,EACA,IAEI,IAAU,IAAA,GAAkB,EAAG,aAAa,EAAK,EAAI,MACrD,IAAU,KAAM,EAAG,gBAAgB,EAAK,CACnC,EAAG,aAAa,EAAK,GAAK,GAAO,EAAG,aAAa,EAAM,EAAM,CAC/D,MAGH,EAA2B,eAQpB,GAAa,EAAa,IAAiB,CACtD,IAAI,EAAQ,EAAK,EAAI,EAAK,CAM1B,MALA,CAEE,IADa,iBAAiB,EAAG,CAAC,iBAAiB,SAAS,IAAO,CACtD,QAAQ,EAA0B,GAAG,CAAC,MAAM,EAAI,KAE1D,GAAO,EAAK,WAAW,EAAK,MAAO,EAAG,CACpC,GASI,GACX,EACA,GAAG,IACc,CACjB,GAAM,CAAC,EAAO,GAAG,GAAW,EAC5B,IAAK,IAAM,KAAQ,EAAM,MAAM,IAAI,CAAE,EAAG,iBAAiB,EAAM,GAAG,EAAQ,CAC1E,UAAa,EAAI,EAAI,GAAG,EAAK,EASlB,GACX,EACA,GAAG,IACM,CACT,GAAM,CAAC,EAAO,GAAG,GAAW,EAC5B,IAAK,IAAM,KAAQ,EAAM,MAAM,IAAI,CAAE,EAAG,oBAAoB,EAAM,GAAG,EAAQ,EAgBlE,GAAe,EAAa,IAAmC,CACrE,GAAW,GACX,OAAO,sBAAqB,OAAO,oBAAsB,IAAI,KAElE,OAAO,qBAAqB,IAAI,EAAI,EAAE,IAAK,GAAY,GAAS,CAAC,CACjE,OAAO,qBAAqB,IAAI,EAAK,GAAO,CAAC,GAO/C,IAAI,EAAiB,GACrB,MAAa,GACX,EACA,EACA,IACG,CACH,IAAI,EAAQ,EACN,MAAgB,CACpB,GAAI,CAAC,EAAG,YAAa,OAAO,GAAS,CACrC,EAAS,EAAS,CAClB,EAAS,aAAa,CACtB,EAAQ,GAEJ,MAAgB,GAAU,cAAc,CACxC,EAAW,IAAI,qBAAuB,CACtC,CAAC,GAAkB,CAAC,IAAO,EAAQ,sBAAsB,EAAQ,GACrE,CAIF,OAFA,EAAS,QAAQ,EAAI,EAAQ,CAC7B,sBAAsB,EAAQ,CACvB,GAOI,GAA0B,EAAa,IAAwB,CAC1E,EAAiB,GACjB,EAAG,YAAc,EACjB,sBAAsB,EAAgB,EAElC,MAAwB,CAC5B,EAAiB,IAWN,GACX,EACA,IACmC,CACnC,IAAM,EAAK,SAAS,cAAc,EAAQ,CAC1C,GAAI,EAAO,IAAK,GAAM,CAAC,EAAK,KAAQ,OAAO,QAAQ,EAAM,CAAE,EAAK,EAAI,EAAK,EAAI,CAC7E,OAAO,GAQI,EAAiB,CAC5B,QAAS,EAAc,IACrB,CAAC,GAAW,EACZ,OAAO,eAAe,IAAI,EAAK,EAC/B,OAAO,eAAe,OAAO,EAAM,EAAS,CAC/C,CAWD,IAAI,EAAK,EACT,SAAgB,EAAM,EAAqB,CAIzC,OAHK,GAAW,EACX,OAAO,UAAS,OAAO,QAAU,GAClC,GAAM,CAAC,EAAG,KAAI,EAAG,GAAK,OAAO,EAAE,OAAO,WACnC,GAAI,IAAM,IAHQ,OAAO,EAAE,IAUpC,IAAI,EACA,EAAW,EACX,EAAqD,EACzD,MAAa,EAAY,GAAiB,CACxC,aAAa,EAAW,CACpB,GACF,EAAuB,EAAS,GAAG,IAAO,IAAa,EAAI,OAAW,KAAK,CACzE,IAAM,EAAa,WAAW,EAAU,IAAM,GAAG,GAIjD,MAAsB,CACtB,SAAS,aAAe,aACvB,IACH,EAAU,EAAI,MAAO,CAAE,YAAa,YAAa,CAAC,CAClD,EAAQ,MAAM,SAAW,SACzB,EAAQ,MAAM,SAAW,QACzB,EAAQ,MAAM,WAAa,SAC3B,EAAQ,MAAM,MAAQ,OAEnB,EAAQ,aAAa,SAAS,KAAK,YAAY,EAAQ,GAE9D,EAAY,eAAkB,CAC5B,EAAG,SAAU,kBAAmB,EAAe,EAAY,CAC5D,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,15 @@ declare global {
|
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
declare const onMutation: (el: Node, callback: (observer: MutationObserver) => void, options: MutationObserverInit) => () => void;
|
|
37
|
+
/**
|
|
38
|
+
* useId
|
|
39
|
+
* @return A generated unique ID
|
|
40
|
+
*/
|
|
41
|
+
declare global {
|
|
42
|
+
interface Window {
|
|
43
|
+
dsUseId?: number;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
37
46
|
|
|
38
47
|
declare global {
|
|
39
48
|
interface HTMLElementTagNameMap {
|
package/dist/index.js
CHANGED
|
@@ -15,7 +15,7 @@ function debounce(callback, delay) {
|
|
|
15
15
|
timer = setTimeout(() => callback.apply(this, args), delay);
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
var warn = (message, ...args) =>
|
|
18
|
+
var warn = (message, ...args) => !isBrowser() || window.dsWarnings === false || console.warn(`Designsystemet: ${message}`, ...args);
|
|
19
19
|
var attr = (el, name, value) => {
|
|
20
20
|
if (value === void 0) return el.getAttribute(name) ?? null;
|
|
21
21
|
if (value === null) el.removeAttribute(name);
|
|
@@ -81,11 +81,35 @@ var customElements = {
|
|
|
81
81
|
define: (name, instance) => !isBrowser() || window.customElements.get(name) || window.customElements.define(name, instance)
|
|
82
82
|
};
|
|
83
83
|
var id = 0;
|
|
84
|
-
var hash = `${Date.now().toString(36)}${Math.random().toString(36).slice(2, 5)}`;
|
|
85
84
|
function useId(el) {
|
|
86
|
-
if (
|
|
85
|
+
if (!isBrowser()) return `:ds:${++id}`;
|
|
86
|
+
if (!window.dsUseId) window.dsUseId = 0;
|
|
87
|
+
if (el && !el.id) el.id = `:ds:${++window.dsUseId}`;
|
|
87
88
|
return el?.id || "";
|
|
88
89
|
}
|
|
90
|
+
var LIVE_EL;
|
|
91
|
+
var LIVE_FIX = 0;
|
|
92
|
+
var LIVE_CLEAR = 0;
|
|
93
|
+
var announce = (text) => {
|
|
94
|
+
clearTimeout(LIVE_CLEAR);
|
|
95
|
+
if (LIVE_EL)
|
|
96
|
+
setTextWithoutMutation(LIVE_EL, `${text}${LIVE_FIX++ % 2 ? "\xA0" : ""}`);
|
|
97
|
+
if (text) LIVE_CLEAR = setTimeout(announce, 2e3, "");
|
|
98
|
+
};
|
|
99
|
+
var announceMount = () => {
|
|
100
|
+
if (document.readyState !== "complete") return;
|
|
101
|
+
if (!LIVE_EL) {
|
|
102
|
+
LIVE_EL = tag("div", { "aria-live": "assertive" });
|
|
103
|
+
LIVE_EL.style.overflow = "hidden";
|
|
104
|
+
LIVE_EL.style.position = "fixed";
|
|
105
|
+
LIVE_EL.style.whiteSpace = "nowrap";
|
|
106
|
+
LIVE_EL.style.width = "1px";
|
|
107
|
+
}
|
|
108
|
+
if (!LIVE_EL.isConnected) document.body.appendChild(LIVE_EL);
|
|
109
|
+
};
|
|
110
|
+
onHotReload("announce", () => [
|
|
111
|
+
on(document, "focus mouseover", announceMount, QUICK_EVENT)
|
|
112
|
+
]);
|
|
89
113
|
|
|
90
114
|
// src/index.ts
|
|
91
115
|
import "@u-elements/u-details/polyfill";
|
|
@@ -177,7 +201,8 @@ var ATTR_AUTO = "data-autoplacement";
|
|
|
177
201
|
var POPOVERS = /* @__PURE__ */ new Map();
|
|
178
202
|
function handleToggle(event) {
|
|
179
203
|
let { newState, oldState, target: el, source = event.detail } = event;
|
|
180
|
-
const
|
|
204
|
+
const isPopover = el instanceof HTMLElement && attr(el, "popover") !== null;
|
|
205
|
+
const float = isPopover && getCSSProp(el, "--_ds-floating");
|
|
181
206
|
if (!float) return;
|
|
182
207
|
if (newState === "closed") return POPOVERS.get(el)?.();
|
|
183
208
|
if (!source) {
|
|
@@ -297,10 +322,17 @@ var handleKeydown = (event) => {
|
|
|
297
322
|
if (event.key === "Enter") event.target.click();
|
|
298
323
|
if (event.key?.startsWith("Arrow")) {
|
|
299
324
|
event.preventDefault?.();
|
|
300
|
-
const inputs = group.getElementsByTagName("input");
|
|
301
|
-
const index =
|
|
325
|
+
const inputs = [...group.getElementsByTagName("input")];
|
|
326
|
+
const index = inputs.indexOf(event.target);
|
|
302
327
|
const move = event.key.match(/Arrow(Right|Down)/) ? 1 : -1;
|
|
303
|
-
|
|
328
|
+
let nextIndex = index;
|
|
329
|
+
for (let i = 0; i < inputs.length; i++) {
|
|
330
|
+
nextIndex = (inputs.length + nextIndex + move) % inputs.length;
|
|
331
|
+
if (!inputs[nextIndex]?.disabled) {
|
|
332
|
+
inputs[nextIndex]?.focus();
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
304
336
|
}
|
|
305
337
|
};
|
|
306
338
|
onHotReload("toggle-group", () => [
|
|
@@ -318,6 +350,7 @@ var TIP;
|
|
|
318
350
|
var SOURCE;
|
|
319
351
|
var HOVER_TIMER = 0;
|
|
320
352
|
var SKIP_TIMER = 0;
|
|
353
|
+
var IS_IOS = isBrowser() && /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
321
354
|
var ATTR_TOOLTIP = "data-tooltip";
|
|
322
355
|
var ATTR_COLOR = "data-color";
|
|
323
356
|
var ARIA_LABEL = "aria-label";
|
|
@@ -346,12 +379,18 @@ var handleAriaAttributes3 = debounce(() => {
|
|
|
346
379
|
if (!el.matches(SELECTOR_INTERACTIVE))
|
|
347
380
|
warn('Missing tabindex="0" attribute on: ', el);
|
|
348
381
|
}
|
|
382
|
+
const isCurrent = el === SOURCE && TIP?.matches(":popover-open");
|
|
383
|
+
const isChanged = isCurrent && text && TIP?.textContent !== text;
|
|
384
|
+
if (isCurrent && isChanged) {
|
|
385
|
+
if (TIP) setTextWithoutMutation(TIP, text);
|
|
386
|
+
if (document.activeElement === el) announce(text);
|
|
387
|
+
}
|
|
349
388
|
}
|
|
350
389
|
}, 0);
|
|
351
390
|
var handleInterest = ({ type, target }) => {
|
|
352
391
|
clearTimeout(HOVER_TIMER);
|
|
353
392
|
if (target === TIP) return;
|
|
354
|
-
if (type === "mouseover" && !SOURCE) {
|
|
393
|
+
if (type === "mouseover" && !SOURCE && !IS_IOS) {
|
|
355
394
|
HOVER_TIMER = setTimeout(handleInterest, DELAY_HOVER, { target });
|
|
356
395
|
return;
|
|
357
396
|
}
|
|
@@ -519,8 +558,6 @@ var handleMutations = debounce(() => {
|
|
|
519
558
|
}
|
|
520
559
|
}
|
|
521
560
|
}, 0);
|
|
522
|
-
var SR_ONLY = "position:fixed;white-space:nowrap;clip:rect(0 0 0 0)";
|
|
523
|
-
var SR_LIVE = isBrowser() ? tag("div", { "aria-live": "polite", style: SR_ONLY }) : null;
|
|
524
561
|
var updateField = (e) => {
|
|
525
562
|
const input = e.target || e;
|
|
526
563
|
const counter = COUNTS.get(input);
|
|
@@ -535,10 +572,8 @@ var updateField = (e) => {
|
|
|
535
572
|
attr(counter, "data-label", label);
|
|
536
573
|
attr(counter, "data-state", state);
|
|
537
574
|
attr(counter, "data-color", count < 0 ? "danger" : null);
|
|
538
|
-
if (e.type === "input" &&
|
|
539
|
-
if (!SR_LIVE?.isConnected) document.body.appendChild(SR_LIVE);
|
|
575
|
+
if (e.type === "input" && label)
|
|
540
576
|
debouncedCounterLiveRegion(input, label);
|
|
541
|
-
}
|
|
542
577
|
}
|
|
543
578
|
if (!HAS_FIELD_SIZING && input instanceof HTMLTextAreaElement) {
|
|
544
579
|
input.style.setProperty("--_ds-field-sizing", "auto");
|
|
@@ -546,8 +581,7 @@ var updateField = (e) => {
|
|
|
546
581
|
}
|
|
547
582
|
};
|
|
548
583
|
var debouncedCounterLiveRegion = debounce((input, text) => {
|
|
549
|
-
|
|
550
|
-
if (SR_LIVE?.isConnected && hasFocus) setTextWithoutMutation(SR_LIVE, text);
|
|
584
|
+
if (document.activeElement === input) announce(text);
|
|
551
585
|
}, COUNTER_DEBOUNCE);
|
|
552
586
|
var isInvalid = (el) => el.getAttribute("data-color") !== "success";
|
|
553
587
|
var isInputLike = (el) => el instanceof HTMLElement && "validity" in el && // Adds support for custom elements implemeted with attachInternals()
|
package/dist/umd/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Designsystemet={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function n(){document.addEventListener(`invoke`,e=>{e.type==`invoke`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener(`command`,e=>{e.type==`command`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function e(e,t,n=!0){Object.defineProperty(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:n})}function t(e){return e&&typeof e.getRootNode==`function`?e.getRootNode():e&&e.parentNode?t(e.parentNode):e}let n=new WeakMap,r=new WeakMap;class i extends Event{constructor(e,t={}){super(e,t);let{source:i,command:a}=t;if(i!=null&&!(i instanceof Element))throw TypeError(`source must be an element`);n.set(this,i||null),r.set(this,a===void 0?``:String(a))}get[Symbol.toStringTag](){return`CommandEvent`}get source(){if(!n.has(this))throw TypeError(`illegal invocation`);let e=n.get(this);if(!(e instanceof Element))return null;let r=t(e);return r===t(this.target||document)?e:r.host}get command(){if(!r.has(this))throw TypeError(`illegal invocation`);return r.get(this)}get action(){throw Error(`CommandEvent#action was renamed to CommandEvent#command`)}get invoker(){throw Error(`CommandEvent#invoker was renamed to CommandEvent#source`)}}e(i.prototype,`source`),e(i.prototype,`command`);class a extends Event{constructor(e,t={}){throw super(e,t),Error("InvokeEvent has been deprecated, it has been renamed to `CommandEvent`")}}let o=new WeakMap;function s(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(e){if(this.hasAttribute(`invokeaction`))throw TypeError("Element has deprecated `invokeaction` attribute, replace with `command`");if(this.hasAttribute(`invoketarget`))throw TypeError("Element has deprecated `invoketarget` attribute, replace with `commandfor`");if(e===null)this.removeAttribute(`commandfor`),o.delete(this);else if(e instanceof Element){this.setAttribute(`commandfor`,``);let n=t(e);t(this)===n||n===this.ownerDocument?o.set(this,e):o.delete(this)}else throw TypeError(`commandForElement must be an element or null`)},get(){if(this.localName!==`button`)return null;if(this.hasAttribute(`invokeaction`)||this.hasAttribute(`invoketarget`))return console.warn("Element has deprecated `invoketarget` or `invokeaction` attribute, use `commandfor` and `command` instead"),null;if(this.disabled)return null;if(this.form&&this.getAttribute(`type`)!==`button`)return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let e=o.get(this);if(e)return e.isConnected?e:(o.delete(this),null);let n=t(this),r=this.getAttribute(`commandfor`);return(n instanceof Document||n instanceof ShadowRoot)&&r&&n.getElementById(r)||null}},command:{enumerable:!0,configurable:!0,get(){let e=this.getAttribute(`command`)||``;if(e.startsWith(`--`))return e;let t=e.toLowerCase();switch(t){case`show-modal`:case`request-close`:case`close`:case`toggle-popover`:case`hide-popover`:case`show-popover`:return t}return``},set(e){this.setAttribute(`command`,e)}},invokeAction:{enumerable:!1,configurable:!0,get(){throw Error(`invokeAction is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeAction is deprecated. It has been renamed to command`)}},invokeTargetElement:{enumerable:!1,configurable:!0,get(){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)}}})}let c=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return u.takeRecords(),c.get(this)||null},set(e){let t=c.get(this)||null;t&&this.removeEventListener(`command`,t),c.set(this,typeof e==`object`||typeof e==`function`?e:null),typeof e==`function`&&this.addEventListener(`command`,e)}}});function l(e){for(let t of e)t.oncommand=Function(`event`,t.getAttribute(`oncommand`))}let u=new MutationObserver(e=>{for(let t of e){let{target:e}=t;t.type===`childList`?l(e.querySelectorAll(`[oncommand]`)):l([e])}});u.observe(document,{subtree:!0,childList:!0,attributeFilter:[`oncommand`]}),l(document.querySelectorAll(`[oncommand]`));let d=new WeakSet;function f(e){if(d.has(e)||(d.add(e),e.defaultPrevented)||e.type!==`click`)return;let t=e.target.closest(`button[invoketarget], button[invokeaction], input[invoketarget], input[invokeaction]`);if(t&&(console.warn("Elements with `invoketarget` or `invokeaction` are deprecated and should be renamed to use `commandfor` and `command` respectively"),t.matches(`input`)))throw Error("Input elements no longer support `commandfor`");let n=e.target.closest(`button[commandfor], button[command]`);if(!n)return;if(n.form&&n.getAttribute(`type`)!==`button`)throw e.preventDefault(),Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(n.hasAttribute(`command`)!==n.hasAttribute(`commandfor`)){let e=n.hasAttribute(`command`)?`command`:`commandfor`,t=n.hasAttribute(`command`)?`commandfor`:`command`;throw Error(`Element with ${e} attribute must also have a ${t} attribute to function.`)}if(n.command!==`show-popover`&&n.command!==`hide-popover`&&n.command!==`toggle-popover`&&n.command!==`show-modal`&&n.command!==`request-close`&&n.command!==`close`&&!n.command.startsWith(`--`)){console.warn(`"${n.command}" is not a valid command value. Custom commands must begin with --`);return}let r=n.commandForElement;if(!r)return;let a=new i(`command`,{command:n.command,source:n,cancelable:!0});if(r.dispatchEvent(a),a.defaultPrevented)return;let o=a.command.toLowerCase();if(r.popover){let e=!r.matches(`:popover-open`);e&&(o===`toggle-popover`||o===`show-popover`)?r.showPopover({source:n}):!e&&o===`hide-popover`&&r.hidePopover()}else if(r.localName===`dialog`){let e=!r.hasAttribute(`open`);e&&o==`show-modal`?r.showModal():!e&&o==`close`?r.close(n.value?n.value:void 0):!e&&o==`request-close`&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let e=new Event(`cancel`,{cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||this.close()}),r.requestClose(n.value?n.value:void 0))}}function p(e){e.addEventListener(`click`,f,!0)}function m(e,t){let n=e.prototype.attachShadow;e.prototype.attachShadow=function(e){let r=n.call(this,e);return t(r),r};let r=e.prototype.attachInternals;e.prototype.attachInternals=function(){let e=r.call(this);return e.shadowRoot&&t(e.shadowRoot),e}}s(HTMLButtonElement),m(HTMLElement,e=>{p(e),u.observe(e,{attributeFilter:[`oncommand`]}),l(e.querySelectorAll(`[oncommand]`))}),p(document),Object.assign(globalThis,{CommandEvent:i,InvokeEvent:a})}let r={passive:!0,capture:!0},i=()=>typeof window<`u`&&typeof document<`u`,a=()=>i()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),o=typeof HTMLElement>`u`?class{}:HTMLElement;function s(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let c=(e,...t)=>typeof window>`u`||window.dsWarnings===!1||console.warn(`Designsystemet: ${e}`,...t),l=(e,t,n)=>n===void 0?e.getAttribute(t)??null:(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),u=/^["']|["']$/g,d=(e,t)=>{let n=l(e,t);return n||=getComputedStyle(e).getPropertyValue(`--_ds-${t}`).replace(u,``).trim()||null,n||c(`Missing ${t} on:`,e),n},f=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>p(e,...t)},p=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},m=(e,t)=>{i()&&(window._dsHotReloadCleanup||(window._dsHotReloadCleanup=new Map),window._dsHotReloadCleanup?.get(e)?.map(e=>e()),window._dsHotReloadCleanup?.set(e,t()))},h=!1,g=(e,t,n)=>{let r=0,i=()=>{if(!e.isConnected)return a();t(o),o.takeRecords(),r=0},a=()=>o?.disconnect?.(),o=new MutationObserver(()=>{!h&&!r&&(r=requestAnimationFrame(i))});return o.observe(e,n),requestAnimationFrame(i),a},_=(e,t)=>{h=!0,e.textContent=t,requestAnimationFrame(v)},v=()=>{h=!1},y=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))l(n,e,r);return n},b={define:(e,t)=>!i()||window.customElements.get(e)||window.customElements.define(e,t)},ee=0,te=`${Date.now().toString(36)}${Math.random().toString(36).slice(2,5)}`;function x(e){return e&&!e.id&&(e.id=`${te}${++ee}`),e?.id||``}var S=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,C=S&&/android/i.test(navigator.userAgent),ne=S&&/firefox/i.test(navigator.userAgent);S&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);function re(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var ie=`__uDetailsPolyfillSummarys`;if(S&&C&&ne&&!window[ie]){window[ie]=document.getElementsByTagName(`summary`);let e=()=>{if(window[ie])for(let e of window[ie]){let t=e.parentElement;re(e,`role`,`button`),re(e,`aria-expanded`,`${!!t&&!!t.open}`)}};requestAnimationFrame(e),new MutationObserver(e).observe(document,{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let ae=`:click-delegate-hover`,oe=`data-clickdelegatefor`,se=`[${oe}]`,ce=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=e.isTrusted&&e.button<2&&de(e);if(!(!n||n.contains(e.target))){if(t&&n instanceof HTMLAnchorElement)return window.open(n.href,void 0,n.rel);e.stopImmediatePropagation(),n.click()}},le,ue=e=>{let t=de(e);le!==t&&(le&&le.classList.remove(ae),t&&t.classList.add(ae),le=t)},de=({target:e})=>{let t=(e instanceof Element?e.closest(se):null)?.getAttribute(oe),n=t&&document.getElementById(t)||void 0,r=n&&e.closest(`a,button,label,input,select,textarea,details,dialog,[role="button"],[popover],[contenteditable]`);return(!r||r===n)&&!n?.disabled?n:void 0};m(`clickdelegatefor`,()=>[f(window,`click auxclick`,ce,!0),f(document,`mouseover`,ue,r)]);let fe=!1,pe=({type:e,target:t,clientX:n=0,clientY:r=0})=>{if(e===`pointerdown`){let e=t?.closest?.(`dialog`)?.getBoundingClientRect();fe=!!(e&&e.top<=r&&r<=e.bottom&&e.left<=n&&n<=e.right)}else{let e=t instanceof HTMLDialogElement&&!fe&&l(t,`closedby`)===`any`;fe=!1,e&&requestAnimationFrame(()=>t.open&&t.close())}},me=()=>{for(let e of document.querySelectorAll(`button[command="show-modal"]`))l(e,`aria-haspopup`,`dialog`)},he=({command:e,target:t})=>e===`--show-non-modal`&&t instanceof HTMLDialogElement&&t.show();m(`dialog`,()=>[f(document,`command`,he,r),f(document,`pointerdown pointerup`,pe,r),g(document,me,{attributeFilter:[`command`],attributes:!0,childList:!0,subtree:!0})]);let w=Math.min,T=Math.max,ge=Math.round,_e=Math.floor,E=e=>({x:e,y:e}),ve={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ye={start:`end`,end:`start`};function be(e,t,n){return T(e,w(t,n))}function D(e,t){return typeof e==`function`?e(t):e}function O(e){return e.split(`-`)[0]}function xe(e){return e.split(`-`)[1]}function Se(e){return e===`x`?`y`:`x`}function Ce(e){return e===`y`?`height`:`width`}let we=new Set([`top`,`bottom`]);function k(e){return we.has(O(e))?`y`:`x`}function Te(e){return Se(k(e))}function Ee(e,t,n){n===void 0&&(n=!1);let r=xe(e),i=Te(e),a=Ce(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fe(o)),[o,Fe(o)]}function De(e){let t=Fe(e);return[Oe(e),t,Oe(t)]}function Oe(e){return e.replace(/start|end/g,e=>ye[e])}let ke=[`left`,`right`],Ae=[`right`,`left`],je=[`top`,`bottom`],Me=[`bottom`,`top`];function Ne(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ae:ke:t?ke:Ae;case`left`:case`right`:return t?je:Me;default:return[]}}function Pe(e,t,n,r){let i=xe(e),a=Ne(O(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oe)))),a}function Fe(e){return e.replace(/left|right|bottom|top/g,e=>ve[e])}function Ie(e){return{top:0,right:0,bottom:0,left:0,...e}}function Le(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ie(e)}function Re(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ze(e,t,n){let{reference:r,floating:i}=e,a=k(t),o=Te(t),s=Ce(o),c=O(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(xe(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Be(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=D(t,e),p=Le(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Re(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Re(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Ve=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ze(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??Be},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=ze(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},He=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=D(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=O(r),_=k(o),v=O(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fe(o)]:De(o)),ee=p!==`none`;!d&&ee&&b.push(...Pe(o,m,p,y));let te=[o,...b],x=await s.detectOverflow(t,h),S=[],C=i.flip?.overflows||[];if(l&&S.push(x[g]),u){let e=Ee(r,a,y);S.push(x[e[0]],x[e[1]])}if(C=[...C,{placement:r,overflows:S}],!S.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=te[e];if(t&&(!(u===`alignment`&&_!==k(t))||C.every(e=>k(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:C},reset:{placement:t}};let n=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=C.filter(e=>{if(ee){let t=k(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},Ue=new Set([`left`,`top`]);async function We(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=O(n),s=xe(n),c=k(n)===`y`,l=Ue.has(o)?-1:1,u=a&&c?-1:1,d=D(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await We(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=D(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=k(O(i)),p=Se(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=be(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=be(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},qe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=D(e,t),u={x:n,y:r},d=k(i),f=Se(d),p=u[f],m=u[d],h=D(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ue.has(O(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=D(e,t),u=await o.detectOverflow(t,l),d=O(i),f=xe(i),p=k(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=w(h-u[g],v),ee=w(m-u[_],y),te=!t.middlewareData.shift,x=b,S=ee;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(S=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(x=v),te&&!f){let e=T(u.left,0),t=T(u.right,0),n=T(u.top,0),r=T(u.bottom,0);p?S=m-2*(e!==0||t!==0?e+t:T(u.left,u.right)):x=h-2*(n!==0||r!==0?n+r:T(u.top,u.bottom))}await c({...t,availableWidth:S,availableHeight:x});let C=await o.getDimensions(s.floating);return m!==C.width||h!==C.height?{reset:{rects:!0}}:{}}}};function Ye(){return typeof window<`u`}function A(e){return Xe(e)?(e.nodeName||``).toLowerCase():`#document`}function j(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function M(e){return((Xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xe(e){return Ye()?e instanceof Node||e instanceof j(e).Node:!1}function N(e){return Ye()?e instanceof Element||e instanceof j(e).Element:!1}function P(e){return Ye()?e instanceof HTMLElement||e instanceof j(e).HTMLElement:!1}function Ze(e){return!Ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof j(e).ShadowRoot}let Qe=new Set([`inline`,`contents`]);function F(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=L(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Qe.has(i)}let $e=new Set([`table`,`td`,`th`]);function et(e){return $e.has(A(e))}let tt=[`:popover-open`,`:modal`];function nt(e){return tt.some(t=>{try{return e.matches(t)}catch{return!1}})}let rt=[`transform`,`translate`,`scale`,`rotate`,`perspective`],it=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],at=[`paint`,`layout`,`strict`,`content`];function ot(e){let t=ct(),n=N(e)?L(e):e;return rt.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||it.some(e=>(n.willChange||``).includes(e))||at.some(e=>(n.contain||``).includes(e))}function st(e){let t=R(e);for(;P(t)&&!I(t);){if(ot(t))return t;if(nt(t))return null;t=R(t)}return null}function ct(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let lt=new Set([`html`,`body`,`#document`]);function I(e){return lt.has(A(e))}function L(e){return j(e).getComputedStyle(e)}function ut(e){return N(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function R(e){if(A(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ze(e)&&e.host||M(e);return Ze(t)?t.host:t}function dt(e){let t=R(e);return I(t)?e.ownerDocument?e.ownerDocument.body:e.body:P(t)&&F(t)?t:dt(t)}function z(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=dt(e),i=r===e.ownerDocument?.body,a=j(r);if(i){let e=ft(a);return t.concat(a,a.visualViewport||[],F(r)?r:[],e&&n?z(e):[])}return t.concat(r,z(r,[],n))}function ft(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pt(e){let t=L(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=P(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ge(n)!==a||ge(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function mt(e){return N(e)?e:e.contextElement}function B(e){let t=mt(e);if(!P(t))return E(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=pt(t),o=(a?ge(n.width):n.width)/r,s=(a?ge(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let ht=E(0);function gt(e){let t=j(e);return!ct()||!t.visualViewport?ht:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function _t(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==j(e)?!1:t}function V(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=mt(e),o=E(1);t&&(r?N(r)&&(o=B(r)):o=B(e));let s=_t(a,n,r)?gt(a):E(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=j(a),t=r&&N(r)?j(r):r,n=e,i=ft(n);for(;i&&r&&t!==n;){let e=B(i),t=i.getBoundingClientRect(),r=L(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=j(i),i=ft(n)}}return Re({width:u,height:d,x:c,y:l})}function vt(e,t){let n=ut(e).scrollLeft;return t?t.left+n:V(M(e)).left+n}function yt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vt(e,n),y:n.top+t.scrollTop}}function bt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=M(r),s=t?nt(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=E(1),u=E(0),d=P(r);if((d||!d&&!a)&&((A(r)!==`body`||F(o))&&(c=ut(r)),P(r))){let e=V(r);l=B(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yt(o,c):E(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function xt(e){return Array.from(e.getClientRects())}function St(e){let t=M(e),n=ut(e),r=e.ownerDocument.body,i=T(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=T(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+vt(e),s=-n.scrollTop;return L(r).direction===`rtl`&&(o+=T(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Ct(e,t){let n=j(e),r=M(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ct();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=vt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}let wt=new Set([`absolute`,`fixed`]);function Tt(e,t){let n=V(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=P(e)?B(e):E(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Et(e,t,n){let r;if(t===`viewport`)r=Ct(e,n);else if(t===`document`)r=St(M(e));else if(N(t))r=Tt(t,n);else{let n=gt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Re(r)}function Dt(e,t){let n=R(e);return n===t||!N(n)||I(n)?!1:L(n).position===`fixed`||Dt(n,t)}function Ot(e,t){let n=t.get(e);if(n)return n;let r=z(e,[],!1).filter(e=>N(e)&&A(e)!==`body`),i=null,a=L(e).position===`fixed`,o=a?R(e):e;for(;N(o)&&!I(o);){let t=L(o),n=ot(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&wt.has(i.position)||F(o)&&!n&&Dt(e,o))?r=r.filter(e=>e!==o):i=t,o=R(o)}return t.set(e,r),r}function kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?nt(t)?[]:Ot(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Et(t,n,i);return e.top=T(r.top,e.top),e.right=w(r.right,e.right),e.bottom=w(r.bottom,e.bottom),e.left=T(r.left,e.left),e},Et(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function At(e){let{width:t,height:n}=pt(e);return{width:t,height:n}}function jt(e,t,n){let r=P(t),i=M(t),a=n===`fixed`,o=V(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=E(0);function l(){c.x=vt(i)}if(r||!r&&!a)if((A(t)!==`body`||F(i))&&(s=ut(t)),r){let e=V(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?yt(i,s):E(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Mt(e){return L(e).position===`static`}function Nt(e,t){if(!P(e)||L(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return M(e)===n&&(n=n.ownerDocument.body),n}function Pt(e,t){let n=j(e);if(nt(e))return n;if(!P(e)){let t=R(e);for(;t&&!I(t);){if(N(t)&&!Mt(t))return t;t=R(t)}return n}let r=Nt(e,t);for(;r&&et(r)&&Mt(r);)r=Nt(r,t);return r&&I(r)&&Mt(r)&&!ot(r)?n:r||st(e)||n}let Ft=async function(e){let t=this.getOffsetParent||Pt,n=this.getDimensions,r=await n(e.floating);return{reference:jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function It(e){return L(e).direction===`rtl`}let Lt={convertOffsetParentRelativeRectToViewportRelativeRect:bt,getDocumentElement:M,getClippingRect:kt,getOffsetParent:Pt,getElementRects:Ft,getClientRects:xt,getDimensions:At,getScale:B,isElement:N,isRTL:It};function Rt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zt(e,t){let n=null,r,i=M(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=_e(d),h=_e(i.clientWidth-(u+f)),g=_e(i.clientHeight-(d+p)),_=_e(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:T(0,w(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Rt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Bt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=mt(e),u=i||a?[...l?z(l):[],...z(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?V(e):null;c&&g();function g(){let t=V(e);h&&!Rt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Vt=Ge,Ht=Ke,Ut=He,Wt=Je,Gt=qe,Kt=(e,t,n)=>{let r=new Map,i={platform:Lt,...n},a={...i.platform,_c:r};return Ve(e,t,{...i,platform:a})},qt=`data-placement`,Jt=`data-autoplacement`,H=new Map;function Yt(e){let{newState:t,oldState:n,target:r,source:i=e.detail}=e,a=r instanceof HTMLElement&&Qt(r,`--_ds-floating`);if(!a)return;if(t===`closed`)return H.get(r)?.();if(!i){let e=r.getRootNode(),t=`[popovertarget="${r.id}"],[commandfor="${r.id}"]`;i=r.id&&e?.querySelector?.(t)||void 0}if(!i||i===r||n&&n===t)return;let o=Qt(r,`--_ds-floating-overscroll`),s=l(r,qt)||l(i,qt)||a,c=l(r,Jt)||l(i,Jt),u=parseFloat(getComputedStyle(r,`::before`).height)||0,d=s.match(/left|right/gi)?`Height`:`Width`,f=i[`offset${d}`]/2+u;if(s===`none`)return;let p={strategy:`absolute`,placement:s,middleware:[Vt(u||0),Ht({padding:10,limiter:Gt({offset:{mainAxis:f}})}),$t(),...c===`false`?[]:[Ut({padding:10,crossAxis:!1})],...o?[Wt({apply({availableHeight:e}){o===`fit`&&(r.style.width=`${i.clientWidth}px`),r.style.maxHeight=`${Math.max(50,e-20)}px`}})]:[]]},m=Bt(i,r,async()=>{if(!i?.isConnected)return H.get(r)?.();let{x:e,y:t}=await Kt(i,r,p);r.style.translate=`${e}px ${t}px`});H.set(r,()=>H.delete(r)&&m())}let Xt,Zt=({type:e})=>{if(e===`mousedown`&&(Xt=!1),e===`scroll`&&Xt===!1&&(Xt=!0),e===`mouseup`&&Xt)for(let[e]of H)e.showPopover()};m(`popover`,()=>[f(document,`mousedown scroll mouseup`,Zt,!0),f(document,`toggle ds-toggle-source`,Yt,r)]);let Qt=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),$t=()=>({name:`arrowPseudo`,fn(e){let t=e.elements.floating,n=e.rects.reference,r=`${Math.round(n.width/2+n.x-e.x)}px`,i=`${Math.round(n.height/2+n.y-e.y)}px`;return t.style.setProperty(`--_ds-floating-arrow-x`,r),t.style.setProperty(`--_ds-floating-arrow-y`,i),l(t,`data-floating`,e.placement),e}}),en=e=>(e instanceof HTMLSelectElement||e instanceof HTMLInputElement)&&(e.hasAttribute(`readonly`)||l(e,`aria-readonly`)===`true`),tn=e=>{if(e.key!==`Tab`&&en(e.target)&&(e.preventDefault(),e.key?.startsWith(`Arrow`)&&l(e.target,`type`)===`radio`)){let t=document.querySelectorAll(`input[name="${e.target.name}"]`),n=e.key?.match(/Arrow(Right|Down)/)?1:-1;t[(t.length+[...t].indexOf(e.target)+n)%t.length]?.focus()}},nn=e=>{let t=e.target?.closest?.(`label`)?.control||e.target;en(t)&&(e.preventDefault(),t.focus())},rn=e=>{e.target instanceof HTMLSelectElement&&en(e.target)&&e.preventDefault()};m(`readonly`,()=>[f(document,`keydown`,tn),f(document,`click`,nn),f(document,`mousedown`,rn)]);let an=`data-toggle-group`,on=`[${an}]`,sn=s(()=>{for(let e of document.querySelectorAll(on))l(e,`aria-label`,d(e,an))},0),cn=e=>{let t=e.target instanceof HTMLInputElement&&e.target.closest(on);if(t&&(e.key===`Enter`&&e.target.click(),e.key?.startsWith(`Arrow`))){e.preventDefault?.();let n=t.getElementsByTagName(`input`),r=[...n].indexOf(e.target),i=e.key.match(/Arrow(Right|Down)/)?1:-1;n[(n.length+r+i)%n.length]?.focus()}};m(`toggle-group`,()=>[f(document,`keydown`,cn),g(document,sn,{attributeFilter:[an],attributes:!0,childList:!0,subtree:!0})]);let U,ln,un=0,dn=0,W=`data-tooltip`,fn=`data-color`,pn=`aria-label`,mn=`aria-description`,hn=`[${fn}]`,gn=`[${W}]`,_n=`data-color-scheme`,vn=`[${_n}]`,yn=e=>{e&&!(e instanceof HTMLElement)&&c(`setTooltipElement expects an HTMLElement, got: `,e),U=e||void 0},bn=s(()=>{for(let e of document.querySelectorAll(gn)){let t=e.getAttribute(pn)||e.getAttribute(mn),n=e.getAttribute(W)||d(e,W);if(t!==n){let t=l(e,`role`)!==`img`&&e.textContent?.trim();l(e,W,n),l(e,pn,t?null:n),l(e,mn,t?n:null),e.matches(`a,button,input,label,select,textarea,[tabindex]`)||c(`Missing tabindex="0" attribute on: `,e)}}},0),xn=({type:e,target:t})=>{if(clearTimeout(un),t===U)return;if(e===`mouseover`&&!ln){un=setTimeout(xn,300,{target:t});return}let n=t?.closest?.(`[${W}]`);if(n===ln)return;if(!n)return Sn();U||=y(`div`,{class:`ds-tooltip`}),U.isConnected||document.body.appendChild(U);let r=n.closest(hn),i=n.closest(vn),a=r!==i&&r?.contains(i);clearTimeout(dn),l(U,`popover`,`manual`),l(U,_n,i?.getAttribute(_n)||null),l(U,fn,a&&r?.getAttribute(fn)||null),_(U,l(n,W)),U.showPopover(),U.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n})),ln=n},Sn=()=>U?.isConnected&&U.popover&&U.hidePopover(),Cn=e=>{if(e?.type===`keydown`)return e?.key===`Escape`&&Sn();e?e.target===U&&e.newState===`closed`&&(dn=setTimeout(Cn,300)):ln=void 0};m(`tooltip`,()=>[f(document,`blur focus mouseover`,xn,r),f(document,`toggle keydown`,Cn,r),g(document,bn,{attributeFilter:[W],attributes:!0,childList:!0,subtree:!0})]);var wn=Object.defineProperty,Tn=Object.getOwnPropertySymbols,En=Object.prototype.hasOwnProperty,Dn=Object.prototype.propertyIsEnumerable,On=(e,t,n)=>t in e?wn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kn=(e,t)=>{for(var n in t||={})En.call(t,n)&&On(e,n,t[n]);if(Tn)for(var n of Tn(t))Dn.call(t,n)&&On(e,n,t[n]);return e},An=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,jn=An&&/android/i.test(navigator.userAgent),Mn=An&&/iPad|iPhone|iPod/.test(navigator.userAgent);An&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Nn=`${jn?`data`:`aria`}-labelledby`,Pn=`:host(:not([hidden])) { display: block }`,Fn=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,In=typeof HTMLElement>`u`?class{}:HTMLElement;function G(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var Ln=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},Rn=(e,...t)=>Ln(`add`,e,t),zn=(e,...t)=>Ln(`remove`,e,t),Bn=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(Kn(`slot`),Kn(`style`,t)),Vn=new WeakMap,Hn=(e,t)=>{if(t===void 0)return Vn.get(e);try{Vn.get(e).disconnect(),Vn.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),Vn.set(e,n)}},Un=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},Wn=0,Gn=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++Wn).toString(32)}`,e.id):``,Kn=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},qn={define:(e,t)=>!An||window.customElements.get(e)||window.customElements.define(e,t)},K,Jn=0,Yn=e=>{K||(K=Kn(`div`),K.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,G(K,`aria-live`,`assertive`)),K.isConnected||document.body.append(K),e&&(K.textContent=`${e}${Jn++%2?`\xA0`:``}`)},Xn=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},Zn=!1,Qn=e=>(e?.type===`mouseup`&&(Zn=!1),e?.type===`mousedown`&&(Zn=!0,Rn(document,`mouseup`,Qn,{once:!0})),Zn),$n=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,er=`disabled`,tr=`selected`,nr=class extends In{static get observedAttributes(){return[er,tr]}connectedCallback(){Mn||(this.tabIndex=-1),this.hasAttribute(`role`)||G(this,`role`,`option`),this.attributeChangedCallback()}attributeChangedCallback(){G(this,`aria-disabled`,`${this.disabled}`),G(this,`aria-selected`,`${this.selected}`)}get defaultSelected(){return this[tr]}set defaultSelected(e){this[tr]=e}get disabled(){return G(this,er)!==null}set disabled(e){G(this,er,e?``:null)}get form(){return this.closest(`form`)}get index(){return[...this.parentElement?.options||[this]].indexOf(this)}get label(){return G(this,`label`)??this.text}set label(e){G(this,`label`,e)}get selected(){return G(this,tr)!==null}set selected(e){G(this,tr,e?``:null)}get text(){return this.textContent?.trim()||``}set text(e){this.textContent=e}get value(){return G(this,`value`)??this.text}set value(e){G(this,`value`,e)}};qn.define(`u-option`,nr);var rr=`${Pn}
|
|
1
|
+
(function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Designsystemet={}))})(this,function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function t(){return typeof HTMLButtonElement<`u`&&`command`in HTMLButtonElement.prototype&&`source`in((globalThis.CommandEvent||{}).prototype||{})}function n(){document.addEventListener(`invoke`,e=>{e.type==`invoke`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0),document.addEventListener(`command`,e=>{e.type==`command`&&e.isTrusted&&(e.stopImmediatePropagation(),e.preventDefault())},!0);function e(e,t,n=!0){Object.defineProperty(e,t,{...Object.getOwnPropertyDescriptor(e,t),enumerable:n})}function t(e){return e&&typeof e.getRootNode==`function`?e.getRootNode():e&&e.parentNode?t(e.parentNode):e}let n=new WeakMap,r=new WeakMap;class i extends Event{constructor(e,t={}){super(e,t);let{source:i,command:a}=t;if(i!=null&&!(i instanceof Element))throw TypeError(`source must be an element`);n.set(this,i||null),r.set(this,a===void 0?``:String(a))}get[Symbol.toStringTag](){return`CommandEvent`}get source(){if(!n.has(this))throw TypeError(`illegal invocation`);let e=n.get(this);if(!(e instanceof Element))return null;let r=t(e);return r===t(this.target||document)?e:r.host}get command(){if(!r.has(this))throw TypeError(`illegal invocation`);return r.get(this)}get action(){throw Error(`CommandEvent#action was renamed to CommandEvent#command`)}get invoker(){throw Error(`CommandEvent#invoker was renamed to CommandEvent#source`)}}e(i.prototype,`source`),e(i.prototype,`command`);class a extends Event{constructor(e,t={}){throw super(e,t),Error("InvokeEvent has been deprecated, it has been renamed to `CommandEvent`")}}let o=new WeakMap;function s(e){Object.defineProperties(e.prototype,{commandForElement:{enumerable:!0,configurable:!0,set(e){if(this.hasAttribute(`invokeaction`))throw TypeError("Element has deprecated `invokeaction` attribute, replace with `command`");if(this.hasAttribute(`invoketarget`))throw TypeError("Element has deprecated `invoketarget` attribute, replace with `commandfor`");if(e===null)this.removeAttribute(`commandfor`),o.delete(this);else if(e instanceof Element){this.setAttribute(`commandfor`,``);let n=t(e);t(this)===n||n===this.ownerDocument?o.set(this,e):o.delete(this)}else throw TypeError(`commandForElement must be an element or null`)},get(){if(this.localName!==`button`)return null;if(this.hasAttribute(`invokeaction`)||this.hasAttribute(`invoketarget`))return console.warn("Element has deprecated `invoketarget` or `invokeaction` attribute, use `commandfor` and `command` instead"),null;if(this.disabled)return null;if(this.form&&this.getAttribute(`type`)!==`button`)return console.warn("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work"),null;let e=o.get(this);if(e)return e.isConnected?e:(o.delete(this),null);let n=t(this),r=this.getAttribute(`commandfor`);return(n instanceof Document||n instanceof ShadowRoot)&&r&&n.getElementById(r)||null}},command:{enumerable:!0,configurable:!0,get(){let e=this.getAttribute(`command`)||``;if(e.startsWith(`--`))return e;let t=e.toLowerCase();switch(t){case`show-modal`:case`request-close`:case`close`:case`toggle-popover`:case`hide-popover`:case`show-popover`:return t}return``},set(e){this.setAttribute(`command`,e)}},invokeAction:{enumerable:!1,configurable:!0,get(){throw Error(`invokeAction is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeAction is deprecated. It has been renamed to command`)}},invokeTargetElement:{enumerable:!1,configurable:!0,get(){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)},set(e){throw Error(`invokeTargetElement is deprecated. It has been renamed to command`)}}})}let c=new WeakMap;Object.defineProperties(HTMLElement.prototype,{oncommand:{enumerable:!0,configurable:!0,get(){return u.takeRecords(),c.get(this)||null},set(e){let t=c.get(this)||null;t&&this.removeEventListener(`command`,t),c.set(this,typeof e==`object`||typeof e==`function`?e:null),typeof e==`function`&&this.addEventListener(`command`,e)}}});function l(e){for(let t of e)t.oncommand=Function(`event`,t.getAttribute(`oncommand`))}let u=new MutationObserver(e=>{for(let t of e){let{target:e}=t;t.type===`childList`?l(e.querySelectorAll(`[oncommand]`)):l([e])}});u.observe(document,{subtree:!0,childList:!0,attributeFilter:[`oncommand`]}),l(document.querySelectorAll(`[oncommand]`));let d=new WeakSet;function f(e){if(d.has(e)||(d.add(e),e.defaultPrevented)||e.type!==`click`)return;let t=e.target.closest(`button[invoketarget], button[invokeaction], input[invoketarget], input[invokeaction]`);if(t&&(console.warn("Elements with `invoketarget` or `invokeaction` are deprecated and should be renamed to use `commandfor` and `command` respectively"),t.matches(`input`)))throw Error("Input elements no longer support `commandfor`");let n=e.target.closest(`button[commandfor], button[command]`);if(!n)return;if(n.form&&n.getAttribute(`type`)!==`button`)throw e.preventDefault(),Error("Element with `commandFor` is a form participant. It should explicitly set `type=button` in order for `commandFor` to work. In order for it to act as a Submit button, it must not have command or commandfor attributes");if(n.hasAttribute(`command`)!==n.hasAttribute(`commandfor`)){let e=n.hasAttribute(`command`)?`command`:`commandfor`,t=n.hasAttribute(`command`)?`commandfor`:`command`;throw Error(`Element with ${e} attribute must also have a ${t} attribute to function.`)}if(n.command!==`show-popover`&&n.command!==`hide-popover`&&n.command!==`toggle-popover`&&n.command!==`show-modal`&&n.command!==`request-close`&&n.command!==`close`&&!n.command.startsWith(`--`)){console.warn(`"${n.command}" is not a valid command value. Custom commands must begin with --`);return}let r=n.commandForElement;if(!r)return;let a=new i(`command`,{command:n.command,source:n,cancelable:!0});if(r.dispatchEvent(a),a.defaultPrevented)return;let o=a.command.toLowerCase();if(r.popover){let e=!r.matches(`:popover-open`);e&&(o===`toggle-popover`||o===`show-popover`)?r.showPopover({source:n}):!e&&o===`hide-popover`&&r.hidePopover()}else if(r.localName===`dialog`){let e=!r.hasAttribute(`open`);e&&o==`show-modal`?r.showModal():!e&&o==`close`?r.close(n.value?n.value:void 0):!e&&o==`request-close`&&(HTMLDialogElement.prototype.requestClose||(HTMLDialogElement.prototype.requestClose=function(){let e=new Event(`cancel`,{cancelable:!0});this.dispatchEvent(e),e.defaultPrevented||this.close()}),r.requestClose(n.value?n.value:void 0))}}function p(e){e.addEventListener(`click`,f,!0)}function m(e,t){let n=e.prototype.attachShadow;e.prototype.attachShadow=function(e){let r=n.call(this,e);return t(r),r};let r=e.prototype.attachInternals;e.prototype.attachInternals=function(){let e=r.call(this);return e.shadowRoot&&t(e.shadowRoot),e}}s(HTMLButtonElement),m(HTMLElement,e=>{p(e),u.observe(e,{attributeFilter:[`oncommand`]}),l(e.querySelectorAll(`[oncommand]`))}),p(document),Object.assign(globalThis,{CommandEvent:i,InvokeEvent:a})}let r={passive:!0,capture:!0},i=()=>typeof window<`u`&&typeof document<`u`,a=()=>i()&&/^Win/i.test(navigator.userAgentData?.platform||navigator.platform),o=typeof HTMLElement>`u`?class{}:HTMLElement;function s(e,t){let n;return function(...r){clearTimeout(n),n=setTimeout(()=>e.apply(this,r),t)}}let c=(e,...t)=>!i()||window.dsWarnings===!1||console.warn(`Designsystemet: ${e}`,...t),l=(e,t,n)=>n===void 0?e.getAttribute(t)??null:(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null),u=/^["']|["']$/g,d=(e,t)=>{let n=l(e,t);return n||=getComputedStyle(e).getPropertyValue(`--_ds-${t}`).replace(u,``).trim()||null,n||c(`Missing ${t} on:`,e),n},f=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.addEventListener(t,...r);return()=>p(e,...t)},p=(e,...t)=>{let[n,...r]=t;for(let t of n.split(` `))e.removeEventListener(t,...r)},m=(e,t)=>{i()&&(window._dsHotReloadCleanup||(window._dsHotReloadCleanup=new Map),window._dsHotReloadCleanup?.get(e)?.map(e=>e()),window._dsHotReloadCleanup?.set(e,t()))},h=!1,g=(e,t,n)=>{let r=0,i=()=>{if(!e.isConnected)return a();t(o),o.takeRecords(),r=0},a=()=>o?.disconnect?.(),o=new MutationObserver(()=>{!h&&!r&&(r=requestAnimationFrame(i))});return o.observe(e,n),requestAnimationFrame(i),a},_=(e,t)=>{h=!0,e.textContent=t,requestAnimationFrame(v)},v=()=>{h=!1},y=(e,t)=>{let n=document.createElement(e);if(t)for(let[e,r]of Object.entries(t))l(n,e,r);return n},b={define:(e,t)=>!i()||window.customElements.get(e)||window.customElements.define(e,t)},x=0;function S(e){return i()?(window.dsUseId||(window.dsUseId=0),e&&!e.id&&(e.id=`:ds:${++window.dsUseId}`),e?.id||``):`:ds:${++x}`}let C,w=0,T=0,ee=e=>{clearTimeout(T),C&&_(C,`${e}${w++%2?`\xA0`:``}`),e&&(T=setTimeout(ee,2e3,``))},te=()=>{document.readyState===`complete`&&(C||(C=y(`div`,{"aria-live":`assertive`}),C.style.overflow=`hidden`,C.style.position=`fixed`,C.style.whiteSpace=`nowrap`,C.style.width=`1px`),C.isConnected||document.body.appendChild(C))};m(`announce`,()=>[f(document,`focus mouseover`,te,r)]);var ne=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,re=ne&&/android/i.test(navigator.userAgent),ie=ne&&/firefox/i.test(navigator.userAgent);ne&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);function ae(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var oe=`__uDetailsPolyfillSummarys`;if(ne&&re&&ie&&!window[oe]){window[oe]=document.getElementsByTagName(`summary`);let e=()=>{if(window[oe])for(let e of window[oe]){let t=e.parentElement;ae(e,`role`,`button`),ae(e,`aria-expanded`,`${!!t&&!!t.open}`)}};requestAnimationFrame(e),new MutationObserver(e).observe(document,{attributeFilter:[`open`],attributes:!0,childList:!0,subtree:!0})}let se=`:click-delegate-hover`,ce=`data-clickdelegatefor`,le=`[${ce}]`,ue=e=>{let t=e.button===1||e.metaKey||e.ctrlKey,n=e.isTrusted&&e.button<2&&pe(e);if(!(!n||n.contains(e.target))){if(t&&n instanceof HTMLAnchorElement)return window.open(n.href,void 0,n.rel);e.stopImmediatePropagation(),n.click()}},de,fe=e=>{let t=pe(e);de!==t&&(de&&de.classList.remove(se),t&&t.classList.add(se),de=t)},pe=({target:e})=>{let t=(e instanceof Element?e.closest(le):null)?.getAttribute(ce),n=t&&document.getElementById(t)||void 0,r=n&&e.closest(`a,button,label,input,select,textarea,details,dialog,[role="button"],[popover],[contenteditable]`);return(!r||r===n)&&!n?.disabled?n:void 0};m(`clickdelegatefor`,()=>[f(window,`click auxclick`,ue,!0),f(document,`mouseover`,fe,r)]);let me=!1,he=({type:e,target:t,clientX:n=0,clientY:r=0})=>{if(e===`pointerdown`){let e=t?.closest?.(`dialog`)?.getBoundingClientRect();me=!!(e&&e.top<=r&&r<=e.bottom&&e.left<=n&&n<=e.right)}else{let e=t instanceof HTMLDialogElement&&!me&&l(t,`closedby`)===`any`;me=!1,e&&requestAnimationFrame(()=>t.open&&t.close())}},ge=()=>{for(let e of document.querySelectorAll(`button[command="show-modal"]`))l(e,`aria-haspopup`,`dialog`)},_e=({command:e,target:t})=>e===`--show-non-modal`&&t instanceof HTMLDialogElement&&t.show();m(`dialog`,()=>[f(document,`command`,_e,r),f(document,`pointerdown pointerup`,he,r),g(document,ge,{attributeFilter:[`command`],attributes:!0,childList:!0,subtree:!0})]);let E=Math.min,D=Math.max,ve=Math.round,ye=Math.floor,O=e=>({x:e,y:e}),be={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function xe(e,t,n){return D(e,E(t,n))}function k(e,t){return typeof e==`function`?e(t):e}function A(e){return e.split(`-`)[0]}function Se(e){return e.split(`-`)[1]}function Ce(e){return e===`x`?`y`:`x`}function we(e){return e===`y`?`height`:`width`}function j(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Te(e){return Ce(j(e))}function Ee(e,t,n){n===void 0&&(n=!1);let r=Se(e),i=Te(e),a=we(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Fe(o)),[o,Fe(o)]}function De(e){let t=Fe(e);return[Oe(e),t,Oe(t)]}function Oe(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}let ke=[`left`,`right`],Ae=[`right`,`left`],je=[`top`,`bottom`],Me=[`bottom`,`top`];function Ne(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ae:ke:t?ke:Ae;case`left`:case`right`:return t?je:Me;default:return[]}}function Pe(e,t,n,r){let i=Se(e),a=Ne(A(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Oe)))),a}function Fe(e){let t=A(e);return be[t]+e.slice(t.length)}function Ie(e){return{top:0,right:0,bottom:0,left:0,...e}}function Le(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ie(e)}function Re(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function ze(e,t,n){let{reference:r,floating:i}=e,a=j(t),o=Te(t),s=we(o),c=A(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Se(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Be(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=k(t,e),p=Le(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Re(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Re(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}let Ve=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Be},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=ze(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<50&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=ze(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},He=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=k(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=A(r),_=j(o),v=A(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Fe(o)]:De(o)),x=p!==`none`;!d&&x&&b.push(...Pe(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ee(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==j(t))||T.every(e=>j(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=j(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},Ue=new Set([`left`,`top`]);async function We(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=A(n),s=Se(n),c=j(n)===`y`,l=Ue.has(o)?-1:1,u=a&&c?-1:1,d=k(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let Ge=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await We(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ke=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=k(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=j(A(i)),p=Ce(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=xe(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=xe(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},qe=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=k(e,t),u={x:n,y:r},d=j(i),f=Ce(d),p=u[f],m=u[d],h=k(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ue.has(A(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Je=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=k(e,t),u=await o.detectOverflow(t,l),d=A(i),f=Se(i),p=j(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=E(h-u[g],v),x=E(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=D(u.left,0),t=D(u.right,0),n=D(u.top,0),r=D(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:D(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:D(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Ye(){return typeof window<`u`}function M(e){return Xe(e)?(e.nodeName||``).toLowerCase():`#document`}function N(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function P(e){return((Xe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Xe(e){return Ye()?e instanceof Node||e instanceof N(e).Node:!1}function F(e){return Ye()?e instanceof Element||e instanceof N(e).Element:!1}function I(e){return Ye()?e instanceof HTMLElement||e instanceof N(e).HTMLElement:!1}function Ze(e){return!Ye()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof N(e).ShadowRoot}function Qe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function $e(e){return/^(table|td|th)$/.test(M(e))}function et(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}let tt=/transform|translate|scale|rotate|perspective|filter/,nt=/paint|layout|strict|content/,L=e=>!!e&&e!==`none`,rt;function it(e){let t=F(e)?z(e):e;return L(t.transform)||L(t.translate)||L(t.scale)||L(t.rotate)||L(t.perspective)||!ot()&&(L(t.backdropFilter)||L(t.filter))||tt.test(t.willChange||``)||nt.test(t.contain||``)}function at(e){let t=B(e);for(;I(t)&&!R(t);){if(it(t))return t;if(et(t))return null;t=B(t)}return null}function ot(){return rt??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),rt}function R(e){return/^(html|body|#document)$/.test(M(e))}function z(e){return N(e).getComputedStyle(e)}function st(e){return F(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function B(e){if(M(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ze(e)&&e.host||P(e);return Ze(t)?t.host:t}function ct(e){let t=B(e);return R(t)?e.ownerDocument?e.ownerDocument.body:e.body:I(t)&&Qe(t)?t:ct(t)}function lt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ct(e),i=r===e.ownerDocument?.body,a=N(r);if(i){let e=ut(a);return t.concat(a,a.visualViewport||[],Qe(r)?r:[],e&&n?lt(e):[])}else return t.concat(r,lt(r,[],n))}function ut(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dt(e){let t=z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=I(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ve(n)!==a||ve(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ft(e){return F(e)?e:e.contextElement}function V(e){let t=ft(e);if(!I(t))return O(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dt(t),o=(a?ve(n.width):n.width)/r,s=(a?ve(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let pt=O(0);function mt(e){let t=N(e);return!ot()||!t.visualViewport?pt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ht(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==N(e)?!1:t}function H(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ft(e),o=O(1);t&&(r?F(r)&&(o=V(r)):o=V(e));let s=ht(a,n,r)?mt(a):O(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=N(a),t=r&&F(r)?N(r):r,n=e,i=ut(n);for(;i&&r&&t!==n;){let e=V(i),t=i.getBoundingClientRect(),r=z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=N(i),i=ut(n)}}return Re({width:u,height:d,x:c,y:l})}function gt(e,t){let n=st(e).scrollLeft;return t?t.left+n:H(P(e)).left+n}function _t(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-gt(e,n),y:n.top+t.scrollTop}}function vt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=P(r),s=t?et(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=O(1),u=O(0),d=I(r);if((d||!d&&!a)&&((M(r)!==`body`||Qe(o))&&(c=st(r)),d)){let e=H(r);l=V(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?_t(o,c):O(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function yt(e){return Array.from(e.getClientRects())}function bt(e){let t=P(e),n=st(e),r=e.ownerDocument.body,i=D(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=D(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+gt(e),s=-n.scrollTop;return z(r).direction===`rtl`&&(o+=D(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function xt(e,t){let n=N(e),r=P(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=ot();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=gt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=25&&(a-=o)}else l<=25&&(a+=l);return{width:a,height:o,x:s,y:c}}function St(e,t){let n=H(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=I(e)?V(e):O(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ct(e,t,n){let r;if(t===`viewport`)r=xt(e,n);else if(t===`document`)r=bt(P(e));else if(F(t))r=St(t,n);else{let n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Re(r)}function wt(e,t){let n=B(e);return n===t||!F(n)||R(n)?!1:z(n).position===`fixed`||wt(n,t)}function Tt(e,t){let n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(e=>F(e)&&M(e)!==`body`),i=null,a=z(e).position===`fixed`,o=a?B(e):e;for(;F(o)&&!R(o);){let t=z(o),n=it(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Qe(o)&&!n&&wt(e,o))?r=r.filter(e=>e!==o):i=t,o=B(o)}return t.set(e,r),r}function Et(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?et(t)?[]:Tt(t,this._c):[].concat(n),r],o=Ct(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Ct(t,a[e],i);s=D(n.top,s),c=E(n.right,c),l=E(n.bottom,l),u=D(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Dt(e){let{width:t,height:n}=dt(e);return{width:t,height:n}}function Ot(e,t,n){let r=I(t),i=P(t),a=n===`fixed`,o=H(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=O(0);function l(){c.x=gt(i)}if(r||!r&&!a)if((M(t)!==`body`||Qe(i))&&(s=st(t)),r){let e=H(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?_t(i,s):O(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function kt(e){return z(e).position===`static`}function At(e,t){if(!I(e)||z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return P(e)===n&&(n=n.ownerDocument.body),n}function jt(e,t){let n=N(e);if(et(e))return n;if(!I(e)){let t=B(e);for(;t&&!R(t);){if(F(t)&&!kt(t))return t;t=B(t)}return n}let r=At(e,t);for(;r&&$e(r)&&kt(r);)r=At(r,t);return r&&R(r)&&kt(r)&&!it(r)?n:r||at(e)||n}let Mt=async function(e){let t=this.getOffsetParent||jt,n=this.getDimensions,r=await n(e.floating);return{reference:Ot(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Nt(e){return z(e).direction===`rtl`}let Pt={convertOffsetParentRelativeRectToViewportRelativeRect:vt,getDocumentElement:P,getClippingRect:Et,getOffsetParent:jt,getElementRects:Mt,getClientRects:yt,getDimensions:Dt,getScale:V,isElement:F,isRTL:Nt};function Ft(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function It(e,t){let n=null,r,i=P(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=ye(d),h=ye(i.clientWidth-(u+f)),g=ye(i.clientHeight-(d+p)),_=ye(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:D(0,E(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Ft(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Lt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=ft(e),u=i||a?[...l?lt(l):[],...t?lt(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?It(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?H(e):null;c&&g();function g(){let t=H(e);h&&!Ft(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Rt=Ge,zt=Ke,Bt=He,Vt=Je,Ht=qe,Ut=(e,t,n)=>{let r=new Map,i={platform:Pt,...n},a={...i.platform,_c:r};return Ve(e,t,{...i,platform:a})},Wt=`data-placement`,Gt=`data-autoplacement`,Kt=new Map;function qt(e){let{newState:t,oldState:n,target:r,source:i=e.detail}=e,a=r instanceof HTMLElement&&l(r,`popover`)!==null&&Xt(r,`--_ds-floating`);if(!a)return;if(t===`closed`)return Kt.get(r)?.();if(!i){let e=r.getRootNode(),t=`[popovertarget="${r.id}"],[commandfor="${r.id}"]`;i=r.id&&e?.querySelector?.(t)||void 0}if(!i||i===r||n&&n===t)return;let o=Xt(r,`--_ds-floating-overscroll`),s=l(r,Wt)||l(i,Wt)||a,c=l(r,Gt)||l(i,Gt),u=parseFloat(getComputedStyle(r,`::before`).height)||0,d=s.match(/left|right/gi)?`Height`:`Width`,f=i[`offset${d}`]/2+u;if(s===`none`)return;let p={strategy:`absolute`,placement:s,middleware:[Rt(u||0),zt({padding:10,limiter:Ht({offset:{mainAxis:f}})}),Zt(),...c===`false`?[]:[Bt({padding:10,crossAxis:!1})],...o?[Vt({apply({availableHeight:e}){o===`fit`&&(r.style.width=`${i.clientWidth}px`),r.style.maxHeight=`${Math.max(50,e-20)}px`}})]:[]]},m=Lt(i,r,async()=>{if(!i?.isConnected)return Kt.get(r)?.();let{x:e,y:t}=await Ut(i,r,p);r.style.translate=`${e}px ${t}px`});Kt.set(r,()=>Kt.delete(r)&&m())}let Jt,Yt=({type:e})=>{if(e===`mousedown`&&(Jt=!1),e===`scroll`&&Jt===!1&&(Jt=!0),e===`mouseup`&&Jt)for(let[e]of Kt)e.showPopover()};m(`popover`,()=>[f(document,`mousedown scroll mouseup`,Yt,!0),f(document,`toggle ds-toggle-source`,qt,r)]);let Xt=(e,t)=>getComputedStyle(e).getPropertyValue(t).trim(),Zt=()=>({name:`arrowPseudo`,fn(e){let t=e.elements.floating,n=e.rects.reference,r=`${Math.round(n.width/2+n.x-e.x)}px`,i=`${Math.round(n.height/2+n.y-e.y)}px`;return t.style.setProperty(`--_ds-floating-arrow-x`,r),t.style.setProperty(`--_ds-floating-arrow-y`,i),l(t,`data-floating`,e.placement),e}}),Qt=e=>(e instanceof HTMLSelectElement||e instanceof HTMLInputElement)&&(e.hasAttribute(`readonly`)||l(e,`aria-readonly`)===`true`),$t=e=>{if(e.key!==`Tab`&&Qt(e.target)&&(e.preventDefault(),e.key?.startsWith(`Arrow`)&&l(e.target,`type`)===`radio`)){let t=document.querySelectorAll(`input[name="${e.target.name}"]`),n=e.key?.match(/Arrow(Right|Down)/)?1:-1;t[(t.length+[...t].indexOf(e.target)+n)%t.length]?.focus()}},en=e=>{let t=e.target?.closest?.(`label`)?.control||e.target;Qt(t)&&(e.preventDefault(),t.focus())},tn=e=>{e.target instanceof HTMLSelectElement&&Qt(e.target)&&e.preventDefault()};m(`readonly`,()=>[f(document,`keydown`,$t),f(document,`click`,en),f(document,`mousedown`,tn)]);let nn=`data-toggle-group`,rn=`[${nn}]`,an=s(()=>{for(let e of document.querySelectorAll(rn))l(e,`aria-label`,d(e,nn))},0),on=e=>{let t=e.target instanceof HTMLInputElement&&e.target.closest(rn);if(t&&(e.key===`Enter`&&e.target.click(),e.key?.startsWith(`Arrow`))){e.preventDefault?.();let n=[...t.getElementsByTagName(`input`)],r=n.indexOf(e.target),i=e.key.match(/Arrow(Right|Down)/)?1:-1,a=r;for(let e=0;e<n.length;e++)if(a=(n.length+a+i)%n.length,!n[a]?.disabled){n[a]?.focus();break}}};m(`toggle-group`,()=>[f(document,`keydown`,on),g(document,an,{attributeFilter:[nn],attributes:!0,childList:!0,subtree:!0})]);let U,sn,cn=0,ln=0,un=i()&&/iPad|iPhone|iPod/.test(navigator.userAgent),W=`data-tooltip`,dn=`data-color`,fn=`aria-label`,pn=`aria-description`,mn=`[${dn}]`,hn=`[${W}]`,gn=`data-color-scheme`,_n=`[${gn}]`,vn=e=>{e&&!(e instanceof HTMLElement)&&c(`setTooltipElement expects an HTMLElement, got: `,e),U=e||void 0},yn=s(()=>{for(let e of document.querySelectorAll(hn)){let t=e.getAttribute(fn)||e.getAttribute(pn),n=e.getAttribute(W)||d(e,W);if(t!==n){let t=l(e,`role`)!==`img`&&e.textContent?.trim();l(e,W,n),l(e,fn,t?null:n),l(e,pn,t?n:null),e.matches(`a,button,input,label,select,textarea,[tabindex]`)||c(`Missing tabindex="0" attribute on: `,e)}let r=e===sn&&U?.matches(`:popover-open`),i=r&&n&&U?.textContent!==n;r&&i&&(U&&_(U,n),document.activeElement===e&&ee(n))}},0),bn=({type:e,target:t})=>{if(clearTimeout(cn),t===U)return;if(e===`mouseover`&&!sn&&!un){cn=setTimeout(bn,300,{target:t});return}let n=t?.closest?.(`[${W}]`);if(n===sn)return;if(!n)return xn();U||=y(`div`,{class:`ds-tooltip`}),U.isConnected||document.body.appendChild(U);let r=n.closest(mn),i=n.closest(_n),a=r!==i&&r?.contains(i);clearTimeout(ln),l(U,`popover`,`manual`),l(U,gn,i?.getAttribute(gn)||null),l(U,dn,a&&r?.getAttribute(dn)||null),_(U,l(n,W)),U.showPopover(),U.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n})),sn=n},xn=()=>U?.isConnected&&U.popover&&U.hidePopover(),Sn=e=>{if(e?.type===`keydown`)return e?.key===`Escape`&&xn();e?e.target===U&&e.newState===`closed`&&(ln=setTimeout(Sn,300)):sn=void 0};m(`tooltip`,()=>[f(document,`blur focus mouseover`,bn,r),f(document,`toggle keydown`,Sn,r),g(document,yn,{attributeFilter:[W],attributes:!0,childList:!0,subtree:!0})]);var Cn=Object.defineProperty,wn=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Dn=(e,t,n)=>t in e?Cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,On=(e,t)=>{for(var n in t||={})Tn.call(t,n)&&Dn(e,n,t[n]);if(wn)for(var n of wn(t))En.call(t,n)&&Dn(e,n,t[n]);return e},kn=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,An=kn&&/android/i.test(navigator.userAgent),jn=kn&&/iPad|iPhone|iPod/.test(navigator.userAgent);kn&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Mn=`${An?`data`:`aria`}-labelledby`,Nn=`:host(:not([hidden])) { display: block }`,Pn=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,Fn=typeof HTMLElement>`u`?class{}:HTMLElement;function G(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var In=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},Ln=(e,...t)=>In(`add`,e,t),Rn=(e,...t)=>In(`remove`,e,t),zn=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(Gn(`slot`),Gn(`style`,t)),Bn=new WeakMap,Vn=(e,t)=>{if(t===void 0)return Bn.get(e);try{Bn.get(e).disconnect(),Bn.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),Bn.set(e,n)}},Hn=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},Un=0,Wn=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++Un).toString(32)}`,e.id):``,Gn=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},Kn={define:(e,t)=>!kn||window.customElements.get(e)||window.customElements.define(e,t)},K,qn=0,Jn=e=>{K||(K=Gn(`div`),K.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,G(K,`aria-live`,`assertive`)),K.isConnected||document.body.append(K),e&&(K.textContent=`${e}${qn++%2?`\xA0`:``}`)},Yn=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},Xn=!1,Zn=e=>(e?.type===`mouseup`&&(Xn=!1),e?.type===`mousedown`&&(Xn=!0,Ln(document,`mouseup`,Zn,{once:!0})),Xn),Qn=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,$n=`disabled`,er=`selected`,tr=class extends Fn{static get observedAttributes(){return[$n,er]}connectedCallback(){jn||(this.tabIndex=-1),this.hasAttribute(`role`)||G(this,`role`,`option`),this.attributeChangedCallback()}attributeChangedCallback(){G(this,`aria-disabled`,`${this.disabled}`),G(this,`aria-selected`,`${this.selected}`)}get defaultSelected(){return this[er]}set defaultSelected(e){this[er]=e}get disabled(){return G(this,$n)!==null}set disabled(e){G(this,$n,e?``:null)}get form(){return this.closest(`form`)}get index(){return[...this.parentElement?.options||[this]].indexOf(this)}get label(){return G(this,`label`)??this.text}set label(e){G(this,`label`,e)}get selected(){return G(this,er)!==null}set selected(e){G(this,er,e?``:null)}get text(){return this.textContent?.trim()||``}set text(e){this.textContent=e}get value(){return G(this,`value`)??this.text}set value(e){G(this,`value`,e)}};Kn.define(`u-option`,tr);var nr=`${Nn}
|
|
2
2
|
::slotted([role="option"]) { display: block; cursor: pointer }
|
|
3
|
-
::slotted([role="option"]:focus) { ${
|
|
3
|
+
::slotted([role="option"]:focus) { ${Pn} }
|
|
4
4
|
::slotted([role="option"][aria-hidden="true"]),
|
|
5
5
|
::slotted([role="option"][disabled]),
|
|
6
|
-
::slotted([role="option"][hidden]) { display: none !important }`,ir=$n(rr),ar,or=0,sr=Mn||jn,cr=`click,focusout,input,keydown,mousedown,mouseup`,lr=`focus,focusin,blur,focusout`,ur={singular:`%d hit`,plural:`%d hits`},dr=class extends In{constructor(){super(),this._texts=kn({},ur),this._value=``,this._of=`/`,Bn(this,rr)}static get observedAttributes(){return[`id`,...Object.keys(ur).map(e=>`data-sr-${e}`)]}connectedCallback(){this.hidden=!0,this._root=Un(this),G(this,`role`,`listbox`),G(this,`tabindex`,`-1`),Rn(this._root,`focusin`,this),Rn(this._root,`focus`,this,!0),Hn(this,{attributeFilter:[`disabled`,`hidden`,`label`,`value`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){zn(this._root||this,`focus`,this,!0),zn(this._root||this,`focusin`,this),Hn(this,!1),mr(this),this._root=void 0}attributeChangedCallback(e,t,n){let r=e?.split(`data-sr-`)[1],i=`input[list="${this.id}"]`;if(ur[r])this._texts[r]=n||ur[r];else if(this._root){this._input&&hr(this,this._input);for(let e of this._root.querySelectorAll(i))hr(this,e)}}handleEvent(e){let{target:t,type:n}=e;e.defaultPrevented||(n===`click`&&yr(this,e),(n===`focus`||n===`focusin`)&&gr(this,e),(n===`blur`||n===`focusout`)&&_r(this,e),n===`keydown`&&br(this,e),n===`mousedown`&&this.contains(t)&&Qn(e),(n===`mutation`||n===`input`)&&(clearTimeout(or),or=setTimeout(xr,0,this,e)))}get options(){if(!this._options){let e=this.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options||this.getElementsByTagName(`option`)}},fr=e=>e?.disabled||e?.readOnly||!1,pr=(e,t)=>{var n;if(e.hidden!==t)return;e.hidden=fr(e?._input)||!t,(n=Hn(e))==null||n.takeRecords();let r=e.isConnected&&e.popover&&e._input?.isConnected&&e._input?.popoverTargetElement===e;e._input&&hr(e,e._input,t),r&&G(e,`popover`,`manual`),r&&e.togglePopover(t),t&&xr(e)},mr=e=>{e._input&&=(zn(e._input||e,lr,e),zn(e._root||e,cr,e),pr(e,!1),void 0)},hr=(e,t,n=!1)=>{e.popover&&G(t,`popovertarget`,Gn(e)),Rn(t,lr,e,!0),G(t,`aria-autocomplete`,`list`),G(t,`aria-controls`,Gn(e)),G(t,`aria-expanded`,`${!sr||n}`),G(t,`autocomplete`,`off`),G(t,`role`,fr(t)?null:`combobox`)},gr=(e,t)=>{let n=t.target instanceof HTMLInputElement;n&&t.isTrusted&&t.stopImmediatePropagation(),e._input!==t.target&&n&&t.target.list===e&&(e._input&&mr(e),e._input=t.target,e._input.dispatchEvent(new FocusEvent(`focus`)),e._input.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0})),G(e,Nn,Gn(e._input.labels?.[0])),Rn(e._root||e,cr,e),pr(e,G(e._input,`inputmode`)!==`none`),Yn())},_r=(e,t)=>{!jn&&!Qn()&&e._input&&setTimeout(vr,0,e),t.target===e._input&&t.isTrusted&&t.stopImmediatePropagation()},vr=e=>{let t=e._root?.activeElement||null,n=e._input;n&&n!==t&&!e.contains(t)&&(n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t})),mr(e))},yr=(e,{target:t})=>{var n;if(!e._input||e._input===t)return pr(e,!0);for(let r of e.options)if(r.contains(t))return G(e,`aria-multiselectable`)!==`true`&&((n=e._input)==null||n.focus(),pr(e,!1)),Xn(e._input,r.value);jn&&vr(e)},br=(e,t)=>{var n;let{key:r,target:i,altKey:a,ctrlKey:o,shiftKey:s,metaKey:c}=t,l=r===`Escape`||r===`Esc`;if(a||o||c||s||r===`Tab`)return;l&&!e.hidden&&t?.preventDefault(),pr(e,!l);let u=[...e.options].filter(e=>G(e,`aria-hidden`)!==`true`&&e.offsetHeight),d=u.indexOf(i),f=-1;if(r===`ArrowDown`&&(f=(d+1)%u.length),r===`ArrowUp`&&(f=(~d?d:u.length)-1),~d&&((r===`Home`||r===`PageUp`)&&(f=0),(r===`End`||r===`PageDown`)&&(f=u.length-1),r===`Enter`))return u[d].click(),t.preventDefault();if(u[f])for(let e of u)e.tabIndex=-1;u[f]&&t.preventDefault(),(n=u[f]||e._input)==null||n.focus(),!u[f]&&r===`ArrowUp`&&setTimeout(()=>e._input?.setSelectionRange(999,999))},xr=(e,t)=>{let{_texts:n,_root:r,_input:i,options:a}=e,o=i?.value.toLowerCase().trim()||``,s=!e.hasAttribute(`data-nofilter`),c=[],l=[];for(let e of a)(e.disabled||e.hidden||s&&!e.label.toLowerCase().includes(o)?c:l).push(e);for(let e of c)G(e,`aria-hidden`,`true`);for(let e of l)G(e,`aria-hidden`,`false`);let u=l.length;clearTimeout(ar),t?.type===`input`&&o!==e._value&&(ar=setTimeout(()=>{let t=`${!u&&e.innerText.trim()||`${n[u===1?`singular`:`plural`]}`.replace(`%d`,`${u}`)}`;!e.hidden&&r?.activeElement===i&&Yn(t),e._value=o},1e3));let d=0;if(Mn)for(let t of l)G(t,`title`,`${++d} ${e._of} ${u}`)};An&&Object.defineProperty(HTMLInputElement.prototype,`list`,{configurable:!0,enumerable:!0,get(){return Un(this).getElementById(G(this,`list`)||``)}}),qn.define(`u-datalist`,dr);let Sr=`aria-label`;var Cr=class extends o{_items;_label=null;_render;_unresize;_unmutate;static get observedAttributes(){return[Sr]}connectedCallback(){this._label=d(this,Sr),this._items=this.getElementsByTagName(`a`),this._render=s(()=>wr(this),100),this._unresize=f(window,`resize`,this._render),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,n){n&&(this._label=n),this._render?.()}disconnectedCallback(){this._unresize?.(),this._unmutate?.(),this._unresize=this._unmutate=this._render=this._items=void 0}};let wr=e=>{let t=e._items?.[e._items.length-1],n=t?.parentElement===e?null:t,r=!n?.offsetHeight;l(e,`role`,r?null:`navigation`),l(e,Sr,r?null:e._label);for(let t of e._items||[])l(t,`aria-current`,t===n?`page`:null)};b.define(`ds-breadcrumbs`,Cr);var Tr=class extends o{connectedCallback(){f(this,`animationend`,this,r),requestAnimationFrame(()=>this.handleEvent({target:this}))}handleEvent({target:e}){if(e!==this)return;let t=this.querySelector(`h2,h3,h4,h5,h6`);t&&l(this,`aria-labelledby`,x(t)),l(this,`tabindex`,`-1`),this.focus()}disconnectedCallback(){p(this,`animationend`,this,r)}};b.define(`ds-error-summary`,Tr);let Er=`data-indeterminate`,Dr=new Set,Or=new WeakMap,kr=i()?document.getElementsByTagName(`fieldset`):[],Ar=i()&&CSS.supports(`field-sizing`,`content`),jr=a()?800:200,Mr=new WeakSet,Nr=s(()=>{for(let e of kr)l(e,`aria-labelledby`,`${x(e.querySelector(`legend`))} ${x(e.querySelector(`:scope > :is([data-field="description"],legend + p)`))}`.trim()||null);for(let e of Dr){let t=[],n=[],r,i,a=!1,o=!1;for(let s of e.getElementsByTagName(`*`))if(s instanceof HTMLLabelElement&&n.push(s),!s.hidden)if(Rr(s))r?c(`Fields should only have one input element. Use <fieldset> to group multiple fields:`,e):r=s;else{let e=s.getAttribute(`data-field`);e===`counter`&&(i=s),e===`validation`?(t.unshift(s),a=!0,o||=Lr(s)):e&&t.push(s)}if(!r)c(`Field is missing input element:`,e);else{i&&Or.set(r,i);for(let e of n)l(e,`for`,x(r));let s=r.type===`radio`||r.type===`checkbox`,c=e.closest(`fieldset`)?.querySelector(`:scope > [data-field="validation"]`);c&&!c?.hidden&&(a=!0,o||=Lr(c),t.unshift(c));let u=l(r,Er);u&&(r.indeterminate=u===`true`),l(e,`data-clickdelegatefor`,s?x(r):null),l(r,`aria-describedby`,t.map(x).join(` `)||null),(a||Mr.has(r))&&(Mr[a?`add`:`delete`](r),l(r,`aria-invalid`,`${o}`)),Fr(r)}}},0),Pr=i()?y(`div`,{"aria-live":`polite`,style:`position:fixed;white-space:nowrap;clip:rect(0 0 0 0)`}):null,Fr=e=>{let t=e.target||e,n=Or.get(t);if(n?.isConnected){let r=(Number(l(n,`data-limit`))||0)-t.value.length,i=r<0?`over`:`under`,a=d(n,`data-${i}`)?.replace(`%d`,`${Math.abs(r)}`);l(n,`data-label`,a),l(n,`data-state`,i),l(n,`data-color`,r<0?`danger`:null),e.type===`input`&&Pr&&a&&(Pr?.isConnected||document.body.appendChild(Pr),Ir(t,a))}!Ar&&t instanceof HTMLTextAreaElement&&(t.style.setProperty(`--_ds-field-sizing`,`auto`),t.style.setProperty(`--_ds-field-sizing`,`${t.scrollHeight}px`))},Ir=s((e,t)=>{let n=document.activeElement===e;Pr?.isConnected&&n&&_(Pr,t)},jr),Lr=e=>e.getAttribute(`data-color`)!==`success`,Rr=e=>e instanceof HTMLElement&&`validity`in e&&!(e instanceof HTMLButtonElement)&&e.type!==`hidden`;var zr=class extends o{connectedCallback(){Dr.add(this),Nr()}disconnectedCallback(){Dr.delete(this)}};b.define(`ds-field`,zr),m(`field`,()=>[f(document,`input`,Fr,r),g(document,Nr,{attributeFilter:[`data-field`,`data-limit`,`hidden`,`value`,Er],attributes:!0,childList:!0,subtree:!0})]);let Br=`aria-label`,Vr=`data-current`,Hr=`data-total`,Ur=`data-href`,Wr=({current:e=1,total:t=10,show:n=7})=>({prev:e>1?e-1:0,next:e<t?e+1:0,pages:qr(e,t,n).map((t,n)=>({current:t===e&&`page`,key:`key-${t}-${n}`,page:t}))});var Gr=class extends o{_unmutate;_render;static get observedAttributes(){return[Br,Vr,Hr,Ur]}connectedCallback(){let e=l(this,Hr),t=l(this,Vr);t&&!e&&c(`Missing ${Hr} attribute on:`,this),e&&!t&&c(`Missing ${Vr} attribute on:`,this),l(this,Br,d(this,Br)),l(this,`role`,`navigation`),this._render=s(()=>Kr(this),0),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(){this._render?.()}disconnectedCallback(){this._unmutate?.(),this._unmutate=this._render=void 0}};let Kr=e=>{let t=Number(l(e,Vr)),n=Number(l(e,Hr));if(t&&n){let r=e.querySelectorAll(`button,a`),i=r.length-2,a=l(e,Ur),{next:o,prev:s,pages:c}=Wr({current:t,total:n,show:i});r.forEach((e,t)=>{let n=t?r[t+1]?c[t-1]?.page:o:s;l(e,`aria-current`,c[t-1]?.current?`true`:null),l(e,`aria-label`,`${n??`hidden`}`),l(e,`role`,n?null:`none`),l(e,`tabindex`,n?null:`-1`),e instanceof HTMLButtonElement&&l(e,`value`,`${n}`),a&&e instanceof HTMLAnchorElement&&l(e,`href`,a.replace(`%d`,`${n}`))})}},qr=(e,t,n=1/0)=>{let r=(n-1)/2,i=Math.max(Math.min(e-Math.floor(r),t-n+1),1),a=Math.min(Math.max(e+Math.ceil(r),n),t),o=Array.from({length:a+1-i},(e,t)=>t+i);return n>4&&i>1&&o.splice(0,2,1,0),n>3&&a<t&&o.splice(-2,2,0,t),o};b.define(`ds-pagination`,Gr);var Jr=Object.defineProperty,Yr=Object.getOwnPropertySymbols,Xr=Object.prototype.hasOwnProperty,Zr=Object.prototype.propertyIsEnumerable,Qr=(e,t,n)=>t in e?Jr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$r=(e,t)=>{for(var n in t||={})Xr.call(t,n)&&Qr(e,n,t[n]);if(Yr)for(var n of Yr(t))Zr.call(t,n)&&Qr(e,n,t[n]);return e},ei=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,ti=ei&&/android/i.test(navigator.userAgent),ni=ei&&/iPad|iPhone|iPod/.test(navigator.userAgent);ei&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ri=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,ii=typeof HTMLElement>`u`?class{}:HTMLElement;function q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var ai=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},oi=(e,...t)=>ai(`add`,e,t),si=(e,...t)=>ai(`remove`,e,t),ci=new WeakMap,li=(e,t)=>{if(t===void 0)return ci.get(e);try{ci.get(e).disconnect(),ci.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),ci.set(e,n)}},ui=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},di=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},fi=0,pi=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++fi).toString(32)}`,e.id):``,J=(e,t,n)=>{let r=document.createElement(e);if(t&&(r[e===`style`?`textContent`:`innerHTML`]=t),n)for(let[e,t]of Object.entries(n))q(r,e,t);return r},mi={define:(e,t)=>!ei||window.customElements.get(e)||window.customElements.define(e,t)},hi=e=>{let t=q(e,`aria-label`)||``;return[...(q(e,`aria-labelledby`)?.trim().split(/\s+/)||[]).map(e=>document.getElementById(e)),...Array.from(e.labels||[])].reduce((e,t)=>e||(t?.innerText)?.trim()||``,t)},Y,gi=0,_i=e=>{Y||(Y=J(`div`),Y.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,q(Y,`aria-live`,`assertive`)),Y.isConnected||document.body.append(Y),e&&(Y.textContent=`${e}${gi++%2?`\xA0`:``}`)},vi=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},yi=!1,bi=e=>(e?.type===`mouseup`&&(yi=!1),e?.type===`mousedown`&&(yi=!0,oi(document,`mouseup`,bi,{once:!0})),yi),xi=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,Si=`:host(:not([hidden])) { display: block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
|
|
6
|
+
::slotted([role="option"][hidden]) { display: none !important }`,rr=Qn(nr),ir,ar=0,or=jn||An,sr=`click,focusout,input,keydown,mousedown,mouseup`,cr=`focus,focusin,blur,focusout`,lr={singular:`%d hit`,plural:`%d hits`},ur=class extends Fn{constructor(){super(),this._texts=On({},lr),this._value=``,this._of=`/`,zn(this,nr)}static get observedAttributes(){return[`id`,...Object.keys(lr).map(e=>`data-sr-${e}`)]}connectedCallback(){this.hidden=!0,this._root=Hn(this),G(this,`role`,`listbox`),G(this,`tabindex`,`-1`),Ln(this._root,`focusin`,this),Ln(this._root,`focus`,this,!0),Vn(this,{attributeFilter:[`disabled`,`hidden`,`label`,`value`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(()=>this.attributeChangedCallback())}disconnectedCallback(){Rn(this._root||this,`focus`,this,!0),Rn(this._root||this,`focusin`,this),Vn(this,!1),pr(this),this._root=void 0}attributeChangedCallback(e,t,n){let r=e?.split(`data-sr-`)[1],i=`input[list="${this.id}"]`;if(lr[r])this._texts[r]=n||lr[r];else if(this._root){this._input&&mr(this,this._input);for(let e of this._root.querySelectorAll(i))mr(this,e)}}handleEvent(e){let{target:t,type:n}=e;e.defaultPrevented||(n===`click`&&vr(this,e),(n===`focus`||n===`focusin`)&&hr(this,e),(n===`blur`||n===`focusout`)&&gr(this,e),n===`keydown`&&yr(this,e),n===`mousedown`&&this.contains(t)&&Zn(e),(n===`mutation`||n===`input`)&&(clearTimeout(ar),ar=setTimeout(br,0,this,e)))}get options(){if(!this._options){let e=this.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options||this.getElementsByTagName(`option`)}},dr=e=>e?.disabled||e?.readOnly||!1,fr=(e,t)=>{var n;if(e.hidden!==t)return;e.hidden=dr(e?._input)||!t,(n=Vn(e))==null||n.takeRecords();let r=e.isConnected&&e.popover&&e._input?.isConnected&&e._input?.popoverTargetElement===e;e._input&&mr(e,e._input,t),r&&G(e,`popover`,`manual`),r&&e.togglePopover(t),t&&br(e)},pr=e=>{e._input&&=(Rn(e._input||e,cr,e),Rn(e._root||e,sr,e),fr(e,!1),void 0)},mr=(e,t,n=!1)=>{e.popover&&G(t,`popovertarget`,Wn(e)),Ln(t,cr,e,!0),G(t,`aria-autocomplete`,`list`),G(t,`aria-controls`,Wn(e)),G(t,`aria-expanded`,`${!or||n}`),G(t,`autocomplete`,`off`),G(t,`role`,dr(t)?null:`combobox`)},hr=(e,t)=>{let n=t.target instanceof HTMLInputElement;n&&t.isTrusted&&t.stopImmediatePropagation(),e._input!==t.target&&n&&t.target.list===e&&(e._input&&pr(e),e._input=t.target,e._input.dispatchEvent(new FocusEvent(`focus`)),e._input.dispatchEvent(new FocusEvent(`focusin`,{bubbles:!0})),G(e,Mn,Wn(e._input.labels?.[0])),Ln(e._root||e,sr,e),fr(e,G(e._input,`inputmode`)!==`none`),Jn())},gr=(e,t)=>{!An&&!Zn()&&e._input&&setTimeout(_r,0,e),t.target===e._input&&t.isTrusted&&t.stopImmediatePropagation()},_r=e=>{let t=e._root?.activeElement||null,n=e._input;n&&n!==t&&!e.contains(t)&&(n.dispatchEvent(new FocusEvent(`blur`,{relatedTarget:t})),n.dispatchEvent(new FocusEvent(`focusout`,{bubbles:!0,relatedTarget:t})),pr(e))},vr=(e,{target:t})=>{var n;if(!e._input||e._input===t)return fr(e,!0);for(let r of e.options)if(r.contains(t))return G(e,`aria-multiselectable`)!==`true`&&((n=e._input)==null||n.focus(),fr(e,!1)),Yn(e._input,r.value);An&&_r(e)},yr=(e,t)=>{var n;let{key:r,target:i,altKey:a,ctrlKey:o,shiftKey:s,metaKey:c}=t,l=r===`Escape`||r===`Esc`;if(a||o||c||s||r===`Tab`)return;l&&!e.hidden&&t?.preventDefault(),fr(e,!l);let u=[...e.options].filter(e=>G(e,`aria-hidden`)!==`true`&&e.offsetHeight),d=u.indexOf(i),f=-1;if(r===`ArrowDown`&&(f=(d+1)%u.length),r===`ArrowUp`&&(f=(~d?d:u.length)-1),~d&&((r===`Home`||r===`PageUp`)&&(f=0),(r===`End`||r===`PageDown`)&&(f=u.length-1),r===`Enter`))return u[d].click(),t.preventDefault();if(u[f])for(let e of u)e.tabIndex=-1;u[f]&&t.preventDefault(),(n=u[f]||e._input)==null||n.focus(),!u[f]&&r===`ArrowUp`&&setTimeout(()=>e._input?.setSelectionRange(999,999))},br=(e,t)=>{let{_texts:n,_root:r,_input:i,options:a}=e,o=i?.value.toLowerCase().trim()||``,s=!e.hasAttribute(`data-nofilter`),c=[],l=[];for(let e of a)(e.disabled||e.hidden||s&&!e.label.toLowerCase().includes(o)?c:l).push(e);for(let e of c)G(e,`aria-hidden`,`true`);for(let e of l)G(e,`aria-hidden`,`false`);let u=l.length;clearTimeout(ir),t?.type===`input`&&o!==e._value&&(ir=setTimeout(()=>{let t=`${!u&&e.innerText.trim()||`${n[u===1?`singular`:`plural`]}`.replace(`%d`,`${u}`)}`;!e.hidden&&r?.activeElement===i&&Jn(t),e._value=o},1e3));let d=0;if(jn)for(let t of l)G(t,`title`,`${++d} ${e._of} ${u}`)};kn&&Object.defineProperty(HTMLInputElement.prototype,`list`,{configurable:!0,enumerable:!0,get(){return Hn(this).getElementById(G(this,`list`)||``)}}),Kn.define(`u-datalist`,ur);let xr=`aria-label`;var Sr=class extends o{_items;_label=null;_render;_unresize;_unmutate;static get observedAttributes(){return[xr]}connectedCallback(){this._label=d(this,xr),this._items=this.getElementsByTagName(`a`),this._render=s(()=>Cr(this),100),this._unresize=f(window,`resize`,this._render),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(e,t,n){n&&(this._label=n),this._render?.()}disconnectedCallback(){this._unresize?.(),this._unmutate?.(),this._unresize=this._unmutate=this._render=this._items=void 0}};let Cr=e=>{let t=e._items?.[e._items.length-1],n=t?.parentElement===e?null:t,r=!n?.offsetHeight;l(e,`role`,r?null:`navigation`),l(e,xr,r?null:e._label);for(let t of e._items||[])l(t,`aria-current`,t===n?`page`:null)};b.define(`ds-breadcrumbs`,Sr);var wr=class extends o{connectedCallback(){f(this,`animationend`,this,r),requestAnimationFrame(()=>this.handleEvent({target:this}))}handleEvent({target:e}){if(e!==this)return;let t=this.querySelector(`h2,h3,h4,h5,h6`);t&&l(this,`aria-labelledby`,S(t)),l(this,`tabindex`,`-1`),this.focus()}disconnectedCallback(){p(this,`animationend`,this,r)}};b.define(`ds-error-summary`,wr);let Tr=`data-indeterminate`,Er=new Set,Dr=new WeakMap,Or=i()?document.getElementsByTagName(`fieldset`):[],kr=i()&&CSS.supports(`field-sizing`,`content`),Ar=a()?800:200,jr=new WeakSet,Mr=s(()=>{for(let e of Or)l(e,`aria-labelledby`,`${S(e.querySelector(`legend`))} ${S(e.querySelector(`:scope > :is([data-field="description"],legend + p)`))}`.trim()||null);for(let e of Er){let t=[],n=[],r,i,a=!1,o=!1;for(let s of e.getElementsByTagName(`*`))if(s instanceof HTMLLabelElement&&n.push(s),!s.hidden)if(Ir(s))r?c(`Fields should only have one input element. Use <fieldset> to group multiple fields:`,e):r=s;else{let e=s.getAttribute(`data-field`);e===`counter`&&(i=s),e===`validation`?(t.unshift(s),a=!0,o||=Fr(s)):e&&t.push(s)}if(!r)c(`Field is missing input element:`,e);else{i&&Dr.set(r,i);for(let e of n)l(e,`for`,S(r));let s=r.type===`radio`||r.type===`checkbox`,c=e.closest(`fieldset`)?.querySelector(`:scope > [data-field="validation"]`);c&&!c?.hidden&&(a=!0,o||=Fr(c),t.unshift(c));let u=l(r,Tr);u&&(r.indeterminate=u===`true`),l(e,`data-clickdelegatefor`,s?S(r):null),l(r,`aria-describedby`,t.map(S).join(` `)||null),(a||jr.has(r))&&(jr[a?`add`:`delete`](r),l(r,`aria-invalid`,`${o}`)),Nr(r)}}},0),Nr=e=>{let t=e.target||e,n=Dr.get(t);if(n?.isConnected){let r=(Number(l(n,`data-limit`))||0)-t.value.length,i=r<0?`over`:`under`,a=d(n,`data-${i}`)?.replace(`%d`,`${Math.abs(r)}`);l(n,`data-label`,a),l(n,`data-state`,i),l(n,`data-color`,r<0?`danger`:null),e.type===`input`&&a&&Pr(t,a)}!kr&&t instanceof HTMLTextAreaElement&&(t.style.setProperty(`--_ds-field-sizing`,`auto`),t.style.setProperty(`--_ds-field-sizing`,`${t.scrollHeight}px`))},Pr=s((e,t)=>{document.activeElement===e&&ee(t)},Ar),Fr=e=>e.getAttribute(`data-color`)!==`success`,Ir=e=>e instanceof HTMLElement&&`validity`in e&&!(e instanceof HTMLButtonElement)&&e.type!==`hidden`;var Lr=class extends o{connectedCallback(){Er.add(this),Mr()}disconnectedCallback(){Er.delete(this)}};b.define(`ds-field`,Lr),m(`field`,()=>[f(document,`input`,Nr,r),g(document,Mr,{attributeFilter:[`data-field`,`data-limit`,`hidden`,`value`,Tr],attributes:!0,childList:!0,subtree:!0})]);let Rr=`aria-label`,zr=`data-current`,Br=`data-total`,Vr=`data-href`,Hr=({current:e=1,total:t=10,show:n=7})=>({prev:e>1?e-1:0,next:e<t?e+1:0,pages:Gr(e,t,n).map((t,n)=>({current:t===e&&`page`,key:`key-${t}-${n}`,page:t}))});var Ur=class extends o{_unmutate;_render;static get observedAttributes(){return[Rr,zr,Br,Vr]}connectedCallback(){let e=l(this,Br),t=l(this,zr);t&&!e&&c(`Missing ${Br} attribute on:`,this),e&&!t&&c(`Missing ${zr} attribute on:`,this),l(this,Rr,d(this,Rr)),l(this,`role`,`navigation`),this._render=s(()=>Wr(this),0),this._unmutate=g(this,this._render,{childList:!0,subtree:!0})}attributeChangedCallback(){this._render?.()}disconnectedCallback(){this._unmutate?.(),this._unmutate=this._render=void 0}};let Wr=e=>{let t=Number(l(e,zr)),n=Number(l(e,Br));if(t&&n){let r=e.querySelectorAll(`button,a`),i=r.length-2,a=l(e,Vr),{next:o,prev:s,pages:c}=Hr({current:t,total:n,show:i});r.forEach((e,t)=>{let n=t?r[t+1]?c[t-1]?.page:o:s;l(e,`aria-current`,c[t-1]?.current?`true`:null),l(e,`aria-label`,`${n??`hidden`}`),l(e,`role`,n?null:`none`),l(e,`tabindex`,n?null:`-1`),e instanceof HTMLButtonElement&&l(e,`value`,`${n}`),a&&e instanceof HTMLAnchorElement&&l(e,`href`,a.replace(`%d`,`${n}`))})}},Gr=(e,t,n=1/0)=>{let r=(n-1)/2,i=Math.max(Math.min(e-Math.floor(r),t-n+1),1),a=Math.min(Math.max(e+Math.ceil(r),n),t),o=Array.from({length:a+1-i},(e,t)=>t+i);return n>4&&i>1&&o.splice(0,2,1,0),n>3&&a<t&&o.splice(-2,2,0,t),o};b.define(`ds-pagination`,Ur);var Kr=Object.defineProperty,qr=Object.getOwnPropertySymbols,Jr=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable,Xr=(e,t,n)=>t in e?Kr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zr=(e,t)=>{for(var n in t||={})Jr.call(t,n)&&Xr(e,n,t[n]);if(qr)for(var n of qr(t))Yr.call(t,n)&&Xr(e,n,t[n]);return e},Qr=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,$r=Qr&&/android/i.test(navigator.userAgent),ei=Qr&&/iPad|iPhone|iPod/.test(navigator.userAgent);Qr&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var ti=`outline: 1px dotted; outline: 5px auto Highlight; outline: 5px auto -webkit-focus-ring-color`,ni=typeof HTMLElement>`u`?class{}:HTMLElement;function q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var ri=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},ii=(e,...t)=>ri(`add`,e,t),ai=(e,...t)=>ri(`remove`,e,t),oi=new WeakMap,si=(e,t)=>{if(t===void 0)return oi.get(e);try{oi.get(e).disconnect(),oi.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),oi.set(e,n)}},ci=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},li=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},ui=0,di=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++ui).toString(32)}`,e.id):``,J=(e,t,n)=>{let r=document.createElement(e);if(t&&(r[e===`style`?`textContent`:`innerHTML`]=t),n)for(let[e,t]of Object.entries(n))q(r,e,t);return r},fi={define:(e,t)=>!Qr||window.customElements.get(e)||window.customElements.define(e,t)},pi=e=>{let t=q(e,`aria-label`)||``;return[...(q(e,`aria-labelledby`)?.trim().split(/\s+/)||[]).map(e=>document.getElementById(e)),...Array.from(e.labels||[])].reduce((e,t)=>e||(t?.innerText)?.trim()||``,t)},Y,mi=0,hi=e=>{Y||(Y=J(`div`),Y.style.cssText=`position:fixed;overflow:hidden;width:1px;white-space:nowrap`,q(Y,`aria-live`,`assertive`)),Y.isConnected||document.body.append(Y),e&&(Y.textContent=`${e}${mi++%2?`\xA0`:``}`)},gi=(e,t,n=``)=>{var r;let i={bubbles:!0,composed:!0,data:t,inputType:n},a=HTMLInputElement.prototype;e.dispatchEvent(new InputEvent(`beforeinput`,i)),(r=Object.getOwnPropertyDescriptor(a,`value`)?.set)==null||r.call(e,t),e.dispatchEvent(new InputEvent(`input`,i)),e.dispatchEvent(new Event(`change`,{bubbles:!0}))},_i=!1,vi=e=>(e?.type===`mouseup`&&(_i=!1),e?.type===`mousedown`&&(_i=!0,ii(document,`mouseup`,vi,{once:!0})),_i),yi=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,bi=`:host(:not([hidden])) { display: block; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) } /* Must be display block in Safari to allow focus inside */
|
|
7
7
|
:host(:not([data-multiple])) ::slotted(data),
|
|
8
8
|
:host([data-multiple="false"]) ::slotted(data) { display: none } /* Hide data if not multiple */
|
|
9
9
|
[role="listbox"] { position: absolute } /* Avoid affecting CSS like flex on the <u-combobox> */
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
::slotted(del) { text-decoration: none }
|
|
12
12
|
::slotted(data:not([hidden])) { display: inline-block; pointer-events: none }
|
|
13
13
|
::slotted(data)::after { content: '\\00D7'; content: '\\00D7' / ''; padding-inline: .5ch; pointer-events: auto; cursor: pointer }
|
|
14
|
-
::slotted(data:focus) { ${ri} }`;xi(Si);var Ci=`beforeinput,blur,focus,click,input,keydown,mousedown`,wi={once:!0,capture:!0,passive:!0},Ti=`false`,Ei=ti||ni,Di=``.repeat(5),Oi=`deleteContentBackward`,ki=`insertText`,Ai=`\xA0`,ji={added:`Added`,empty:`No selected`,found:`Navigate left to find %d selected`,invalid:`Invalid value`,items:`Selected`,of:`of`,remove:`Press to remove`,removed:`Removed`},Mi=class extends ii{constructor(){super(),this._item=``,this._speak=``,this._texts=$r({},ji),this._value=``,this.shadowRoot||this.attachShadow({mode:`open`}).append(J(`slot`,null,{"aria-orientation":`horizontal`,tabindex:`-1`,role:`listbox`,name:`items`}),J(`slot`),J(`div`,`<div role="option" tabindex="-1"></div>`,{"aria-hidden":`true`,role:`listbox`}),J(`style`,Si))}static get observedAttributes(){return Object.keys(ji).map(e=>`data-sr-${e}`)}connectedCallback(){this._root=di(this),oi(this,Ci,this,!0),li(this,{attributeFilter:[`value`,`id`,`role`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(Fi,0,this),setTimeout(Ri,0,this)}attributeChangedCallback(e,t,n){let r=e.split(`data-sr-`)[1];ji[r]&&(this._texts[r]=n||ji[r])}disconnectedCallback(){li(this,!1),si(this,Ci,this,!0),this._items=this._clear=this._focus=this._control=void 0,this._list=this._options=this._root=this._form=void 0}handleEvent(e){let t=e.target;Pi(this)||(e.type===`beforeinput`&&(this._value=t?.value||``),e.type===`blur`&&Vi(this),e.type===`click`&&Ui(this,e),e.type===`focus`&&Bi(this,e),e.type===`input`&&Wi(this,e),e.type===`keydown`&&Gi(this,e),e.type===`mousedown`&&bi(e),e.type===`mutation`&&Fi(this,e))}get multiple(){return(q(this,`data-multiple`)??Ti)!==Ti}set multiple(e){q(this,`data-multiple`,e?``:null)}get creatable(){return(q(this,`data-creatable`)??Ti)!==Ti}set creatable(e){q(this,`data-creatable`,e?``:null)}get control(){return this._control?.isConnected||(this._control=this.querySelector(`input`)),this._control}get list(){return this._list?.isConnected||(this._list=this.querySelector(`datalist,[role="listbox"]`)),this._list}get clear(){return this._clear?.isConnected||(this._clear=this.querySelector(`del`)),this._clear}get items(){return this._items||=this.getElementsByTagName(`data`),this._items}get options(){if(!this._options){let e=this.list?.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options}get values(){return[...this.items].map(({value:e})=>e)}},X=e=>(e?.textContent)?.trim()||``,Ni=e=>e instanceof HTMLDataElement,Pi=({control:e})=>e?.disabled||e?.readOnly||!1,Fi=(e,t)=>{var n;let{_focus:r,_texts:i,items:a,control:o,list:s,multiple:c}=e;if(!o)return;let l=hi(o),u=l.endsWith(Di)?q(o,`data-label`):l;q(o,`data-label`,u);let d=`${u}${c?`, ${a.length?i.found.replace(`%d`,`${a.length}`):i.empty}`:``}`,f=[];for(let{addedNodes:e,removedNodes:n}of t?.detail||[]){for(let t of e)Ni(t)&&f.unshift(t);for(let e of n)Ni(e)&&f.push(e)}let p=c?f.length===1:f[0]===r;if(r&&p){let t=q(o,`aria-expanded`),n=q(o,`inputmode`),a=Ni(r)?o:r,s=!f[0].isConnected;e._speak=`${i[s?`removed`:`added`]} ${X(f[0])}, `,(Ei||r===o)&&_i(e._speak),o!==a&&(Ei&&q(o,`aria-expanded`,null),Ei&&q(o,`inputmode`,`none`),d=Ai,o.focus()),setTimeout(()=>{var r;q(o,`aria-expanded`,t),q(o,`inputmode`,s?`none`:n),(r=a?.focus)==null||r.call(a),q(o,`inputmode`,n),e._speak=``,Ei?setTimeout(Fi,100,e):oi(e,`blur`,()=>Fi(e),wi)},100)}let m=0,h=e.querySelector(`select`),g=Pi(e)?``:i.remove,_=e.shadowRoot?.firstElementChild;_&&q(_,`aria-label`,i.items);for(let t of a){let n=h?.options[m++],r=X(t),o=t.value||r;q(t,`aria-label`,`${e._speak}${r}, ${g}`),q(t,`aria-selected`,`true`),q(t,`role`,`option`),q(t,`slot`,`items`),q(t,`tabindex`,`-1`),q(t,`value`,o),n?Object.assign(n,{textContent:r,value:o}):h?.appendChild(new Option(r,o,!0,!0)),ni&&q(t,`title`,`${m} ${i.of} ${a.length}`)}h&&q(h,`multiple`,c?``:null);for(let e of[...h?.options||[]].slice(m))e.remove();!c&&m>1&&console.warn(e,` Multiple <data> found in single mode.`),s&&(q(s,`aria-multiselectable`,`${c}`),q(o,`list`,pi(s)),q(o,`aria-label`,`${e._speak}${d}${Di}`),s.hasAttribute(`popover`)&&(q(o,`popovertarget`,pi(s)),q(s,`popover`,`manual`)),s._of=i.of);let v=X(a[0]);v!==e._item&&Ri(e),e._item=v,Ii(e),Li(e),(n=li(e))==null||n.takeRecords()},Ii=e=>{e.clear&&q(e.clear,`role`,`button`),e.clear&&(e.clear.hidden=!e.control?.value||Pi(e))},Li=e=>{let{_speak:t,options:n=[],values:r}=e;for(let e of n){let n=q(e,`value`)??X(e);q(e,`aria-label`,t?`${t}${X(e)}`:null),q(e,`selected`,r.includes(n)?``:null)}},Ri=e=>{let{multiple:t,control:n,items:r}=e,i=X(r[0]);!t&&n&&i!==n.value&&vi(n,i,i?ki:Oi)},zi=(e,t=!0)=>{let{_texts:n,options:r=[],creatable:i,control:a,items:o,multiple:s}=e,c=(a?.value)?.trim()||``,l=c.toLowerCase()||null,u=[...r].find(e=>(q(e,`label`)||X(e)).trim().toLowerCase()===l),d={bubbles:!0,cancelable:!0,detail:u};if(e.dispatchEvent(new CustomEvent(`comboboxbeforematch`,d))||(u=[...r].find(e=>e.selected)),t)return Li(e),u?Z(e,u,!1):i&&c?Z(e,{value:c},!1):(!s&&!c&&o[0]?Z(e,o[0]):Ri(e),_i(n.invalid));for(let e of r)e.selected=e===u},Z=(e,t,n=!0)=>{var r;let{control:i,items:a,multiple:o}=e,s=J(`data`,t.label||t.value,{value:t.value}),c=[...a].find(e=>e.value===t.value),l={bubbles:!0,cancelable:!0,detail:c||s};if(c&&!n)return Ri(e);if(c===di(e)?.activeElement&&((r=e.shadowRoot?.querySelector(`[role="option"]`))==null||r.focus()),e.dispatchEvent(new CustomEvent(`comboboxbeforeselect`,l))){if(!o)for(let e of[...a])e.remove();c?c.remove():i?.insertAdjacentElement(`beforebegin`,s),e.dispatchEvent(new CustomEvent(`comboboxafterselect`,l))}},Bi=(e,{target:t})=>{let{_form:n,control:r,multiple:i}=e;t instanceof HTMLElement&&(e._focus=t),i&&n===void 0&&r&&t===r&&(e._form=q(r,`form`),q(r,`form`,`#`)),_i()},Vi=e=>bi()||setTimeout(Hi,0,e),Hi=e=>{let{_focus:t,_root:n,_form:r,multiple:i,control:a}=e;!t||e.contains(n?.activeElement)||(i||zi(e),r&&a&&q(a,`form`,r),e._focus=e._form=void 0)},Ui=(e,t)=>{let{clientX:n,clientY:r,target:i}=t,{clear:a,control:o,items:s}=e;if(a?.contains(i))return o&&vi(o,``,Oi),o?.focus();for(let t of s){let{top:a,right:o,bottom:s,left:c}=t.getBoundingClientRect();if(t.contains(i))return Z(e,t);if(r>=a&&r<=s&&n>=c&&n<=o)return t.focus()}i===e&&o?.focus()},Wi=(e,t)=>{let{options:n=[],control:r,multiple:i}=e,a=(r?.value)?.trim()||``;if(t instanceof InputEvent?!t.inputType||t.inputType===`insertReplacementText`:a){t.stopImmediatePropagation(),r&&(r.value=e._value);for(let t of n)if(t.value&&t.value===a)return Z(e,t,i)}else i||zi(e,!1);Ii(e)},Gi=(e,t)=>{var n;let{clear:r,control:i,items:a}=e,{key:o,repeat:s,target:c}=t,l=i&&i===c,u=l&&i.selectionEnd,d=t.ctrlKey||t.metaKey||t.shiftKey||t.key===`Alt`,f=l?a.length:[...a].indexOf(c);if(l&&o===`Tab`&&!t.shiftKey&&r&&!r.hidden&&(t.preventDefault(),r.tabIndex=0,r.focus(),oi(r,`blur`,()=>q(r,`tabindex`,null),wi)),!(!l&&ui(t)||f===-1||d)){if(o===`ArrowRight`&&!l)f+=1;else if(o===`ArrowLeft`&&!u)--f;else if(o===`Enter`&&l)return zi(e);else if(o===`Backspace`&&!u){if(t.preventDefault(),!s&&a[f])return Z(e,a[f]);l&&--f}else return l||i?.focus();t.preventDefault(),(n=a[Math.max(0,f)]||i)==null||n.focus()}};mi.define(`u-combobox`,Mi);var Ki=class extends Mi{_unmutate;_render;connectedCallback(){super.connectedCallback(),this._render=()=>qi(this),this._unmutate=g(this,this._render,{childList:!0}),f(this,`toggle`,Ji,r)}disconnectedCallback(){super.disconnectedCallback(),this._unmutate?.(),this._unmutate=this._render=void 0,p(this,`toggle`,Ji,r)}};let qi=({control:e,list:t})=>{e&&!e.placeholder&&l(e,`placeholder`,` `),e&&l(e,`popovertarget`,x(t)||null),t&&l(t,`popover`,`manual`)},Ji=e=>{let t=e.currentTarget,n=e.newState===`open`&&t.control;n&&t.list?.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n}))};b.define(`ds-suggestion`,Ki);var Yi=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,Xi=Yi&&/android/i.test(navigator.userAgent);Yi&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Zi=`${Xi?`data`:`aria`}-labelledby`,Qi=`:host(:not([hidden])) { display: block }`,$i=typeof HTMLElement>`u`?class{}:HTMLElement;function Q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var ea=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},ta=(e,...t)=>ea(`add`,e,t),na=(e,...t)=>ea(`remove`,e,t),ra=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(ua(`slot`),ua(`style`,t)),ia=new WeakMap,aa=(e,t)=>{if(t===void 0)return ia.get(e);try{ia.get(e).disconnect(),ia.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),ia.set(e,n)}},oa=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},sa=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},ca=0,la=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++ca).toString(32)}`,e.id):``,ua=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},da={define:(e,t)=>!Yi||window.customElements.get(e)||window.customElements.define(e,t)},fa=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,pa=Qi,ma=Qi,ha=Qi,ga=`:host(:not([hidden])) { display: inline-block; cursor: pointer }:host([aria-disabled="true"]) { cursor: default }`;fa(pa),fa(ma),fa(ga),fa(ha);var _a=`aria-controls`,$=`aria-selected`,va=`data-utabs`,ya=class extends $i{constructor(){super(),ra(this,pa)}connectedCallback(){Q(this,va,``)}get tabList(){return Ta(`tablist`,this)[0]||null}get selectedIndex(){return Da(this.tabs)}set selectedIndex(e){Aa(this.tabs[e])}get tabs(){return Ta(`tab`,this)}get panels(){return Ta(`tabpanel`,this)}},ba=class extends $i{constructor(){super(),ra(this,ma)}connectedCallback(){Q(this,`role`,`tablist`),ta(this,`click,keydown`,this),aa(this,{childList:!0}),requestAnimationFrame(()=>this.handleEvent())}disconnectedCallback(){na(this,`click,keydown`,this),aa(this,!1)}handleEvent(e){var t,n;if(!e||e.type===`mutation`)return this.tabs[Math.max(this.selectedIndex,0)]?.setAttribute($,`true`);let{key:r}=e,i=[...this.tabs],a=i.findIndex(t=>t.contains(e.target)),o=a;if(!(e.defaultPrevented||a===-1)&&(e.type===`click`&&Aa(i[a]),e.type===`keydown`&&!oa(e))){if(r===`ArrowDown`||r===`ArrowRight`)o=(a+1)%i.length;else if(r===`ArrowUp`||r===`ArrowLeft`)o=(a||i.length)-1;else if(r===`End`)o=i.length-1;else if(r===`Home`)o=0;else if(r===`Tab`)o=Da(i);else return;setTimeout(()=>{Q(i[a],`tabindex`,`-1`),Q(i[o],`tabindex`,`0`)}),r!==`Tab`&&(e.preventDefault(),(n=(t=i[o]).focus)==null||n.call(t))}}get tabsElement(){return Oa(this)}get tabs(){return ka(this)}get selectedIndex(){return Da(this.tabs)}set selectedIndex(e){Aa(this.tabs[e])}},xa=!1,Sa=class extends $i{static get observedAttributes(){return[`id`,$,_a]}constructor(){super(),ra(this,ga)}connectedCallback(){Q(this,`role`,`tab`),Q(this,`tabindex`,this.selected?`0`:`-1`)}attributeChangedCallback(){if(!xa&&this.selected&&this.tabList){xa=!0;let e=this.tabList?ka(this.tabList):[],t=Ta(`tabpanel`,this.tabsElement||this),n=Ea(this,t[[...e].indexOf(this)]);n&&Q(n,Zi,la(this));let r=0;for(let i of e){let e=Ea(i,t[r++]);Q(i,`tabindex`,i===this?`0`:`-1`),Q(i,$,`${i===this}`),e?.id&&Q(i,_a,e.id),e&&(e.hidden=e!==n)}xa=!1}}get tabsElement(){return Oa(this)}get tabList(){let e=this.parentElement;return e?.getAttribute(`role`)===`tablist`?e:null}get selected(){return Q(this,$)===`true`}set selected(e){Q(this,$,`${!!e}`)}get index(){let e=this.tabList;return e?[...ka(e)].indexOf(this):0}get panel(){return Ea(this)}},Ca=!1,wa=class extends $i{static get observedAttributes(){return[`id`,`hidden`]}constructor(){super(),ra(this,ha)}connectedCallback(){var e;Q(this,`role`,`tabpanel`),(e=this.tabsElement?.tabList)==null||e.handleEvent(),this.attributeChangedCallback()}attributeChangedCallback(){if(Ca)return;Ca=!0;let e=ja(this.firstChild);this.hidden=Da(this.tabs)===-1,Q(this,`aria-hidden`,`${this.hidden}`),Q(this,`tabindex`,this.hidden||e?null:`0`),Ca=!1}get tabsElement(){return Oa(this)}get tabs(){return sa(this).querySelectorAll(`[role="tab"][${_a}="${this.id}"]`)}},Ta=(e,t)=>t.querySelectorAll(`[role="${e}"]:not(:scope [role="tabpanel"] [role="${e}"])`),Ea=(e,t)=>sa(e).getElementById(Q(e,_a)||la(t)),Da=e=>[...e].findIndex(e=>Q(e,$)===`true`),Oa=e=>e.closest(`[${va}]`),ka=e=>e.querySelectorAll(`:scope > [role="tab"]`),Aa=e=>e&&Q(e,`aria-disabled`)!==`true`&&Q(e,`aria-selected`,`true`),ja=e=>e instanceof Element&&!e.matches(`:disabled,[tabindex^="-"]`)&&e.matches(`[contenteditable],[controls],[href],[tabindex],input:not([type="hidden"]),select,textarea,button,summary,iframe`);da.define(`u-tabs`,ya),da.define(`u-tablist`,ba),da.define(`u-tab`,Sa),da.define(`u-tabpanel`,wa);var Ma=class extends ya{},Na=class extends ba{},Pa=class extends Sa{},Fa=class extends wa{};b.define(`ds-tabs`,Ma),b.define(`ds-tablist`,Na),b.define(`ds-tab`,Pa),b.define(`ds-tabpanel`,Fa),i()&&!t()&&n(),e.DSBreadcrumbsElement=Cr,e.DSErrorSummaryElement=Tr,e.DSFieldElement=zr,e.DSPaginationElement=Gr,e.DSSuggestionElement=Ki,e.DSTabElement=Pa,e.DSTabListElement=Na,e.DSTabPanelElement=Fa,e.DSTabsElement=Ma,e.UHTMLDataListElement=dr,e.UHTMLDataListShadowRoot=ir,e.UHTMLDataListStyle=rr,e.pagination=Wr,e.setTooltipElement=yn});
|
|
14
|
+
::slotted(data:focus) { ${ti} }`;yi(bi);var xi=`beforeinput,blur,focus,click,input,keydown,mousedown`,Si={once:!0,capture:!0,passive:!0},Ci=`false`,wi=$r||ei,Ti=``.repeat(5),Ei=`deleteContentBackward`,Di=`insertText`,Oi=`\xA0`,ki={added:`Added`,empty:`No selected`,found:`Navigate left to find %d selected`,invalid:`Invalid value`,items:`Selected`,of:`of`,remove:`Press to remove`,removed:`Removed`},Ai=class extends ni{constructor(){super(),this._item=``,this._speak=``,this._texts=Zr({},ki),this._value=``,this.shadowRoot||this.attachShadow({mode:`open`}).append(J(`slot`,null,{"aria-orientation":`horizontal`,tabindex:`-1`,role:`listbox`,name:`items`}),J(`slot`),J(`div`,`<div role="option" tabindex="-1"></div>`,{"aria-hidden":`true`,role:`listbox`}),J(`style`,bi))}static get observedAttributes(){return Object.keys(ki).map(e=>`data-sr-${e}`)}connectedCallback(){this._root=li(this),ii(this,xi,this,!0),si(this,{attributeFilter:[`value`,`id`,`role`],attributes:!0,characterData:!0,childList:!0,subtree:!0}),setTimeout(Ni,0,this),setTimeout(Ii,0,this)}attributeChangedCallback(e,t,n){let r=e.split(`data-sr-`)[1];ki[r]&&(this._texts[r]=n||ki[r])}disconnectedCallback(){si(this,!1),ai(this,xi,this,!0),this._items=this._clear=this._focus=this._control=void 0,this._list=this._options=this._root=this._form=void 0}handleEvent(e){let t=e.target;Mi(this)||(e.type===`beforeinput`&&(this._value=t?.value||``),e.type===`blur`&&zi(this),e.type===`click`&&Vi(this,e),e.type===`focus`&&Ri(this,e),e.type===`input`&&Hi(this,e),e.type===`keydown`&&Ui(this,e),e.type===`mousedown`&&vi(e),e.type===`mutation`&&Ni(this,e))}get multiple(){return(q(this,`data-multiple`)??Ci)!==Ci}set multiple(e){q(this,`data-multiple`,e?``:null)}get creatable(){return(q(this,`data-creatable`)??Ci)!==Ci}set creatable(e){q(this,`data-creatable`,e?``:null)}get control(){return this._control?.isConnected||(this._control=this.querySelector(`input`)),this._control}get list(){return this._list?.isConnected||(this._list=this.querySelector(`datalist,[role="listbox"]`)),this._list}get clear(){return this._clear?.isConnected||(this._clear=this.querySelector(`del`)),this._clear}get items(){return this._items||=this.getElementsByTagName(`data`),this._items}get options(){if(!this._options){let e=this.list?.querySelector(`[role="option"],option`)?.nodeName;e&&(this._options=this.getElementsByTagName(e))}return this._options}get values(){return[...this.items].map(({value:e})=>e)}},X=e=>(e?.textContent)?.trim()||``,ji=e=>e instanceof HTMLDataElement,Mi=({control:e})=>e?.disabled||e?.readOnly||!1,Ni=(e,t)=>{var n;let{_focus:r,_texts:i,items:a,control:o,list:s,multiple:c}=e;if(!o)return;let l=pi(o),u=l.endsWith(Ti)?q(o,`data-label`):l;q(o,`data-label`,u);let d=`${u}${c?`, ${a.length?i.found.replace(`%d`,`${a.length}`):i.empty}`:``}`,f=[];for(let{addedNodes:e,removedNodes:n}of t?.detail||[]){for(let t of e)ji(t)&&f.unshift(t);for(let e of n)ji(e)&&f.push(e)}let p=c?f.length===1:f[0]===r;if(r&&p){let t=q(o,`aria-expanded`),n=q(o,`inputmode`),a=ji(r)?o:r,s=!f[0].isConnected;e._speak=`${i[s?`removed`:`added`]} ${X(f[0])}, `,(wi||r===o)&&hi(e._speak),o!==a&&(wi&&q(o,`aria-expanded`,null),wi&&q(o,`inputmode`,`none`),d=Oi,o.focus()),setTimeout(()=>{var r;q(o,`aria-expanded`,t),q(o,`inputmode`,s?`none`:n),(r=a?.focus)==null||r.call(a),q(o,`inputmode`,n),e._speak=``,wi?setTimeout(Ni,100,e):ii(e,`blur`,()=>Ni(e),Si)},100)}let m=0,h=e.querySelector(`select`),g=Mi(e)?``:i.remove,_=e.shadowRoot?.firstElementChild;_&&q(_,`aria-label`,i.items);for(let t of a){let n=h?.options[m++],r=X(t),o=t.value||r;q(t,`aria-label`,`${e._speak}${r}, ${g}`),q(t,`aria-selected`,`true`),q(t,`role`,`option`),q(t,`slot`,`items`),q(t,`tabindex`,`-1`),q(t,`value`,o),n?Object.assign(n,{textContent:r,value:o}):h?.appendChild(new Option(r,o,!0,!0)),ei&&q(t,`title`,`${m} ${i.of} ${a.length}`)}h&&q(h,`multiple`,c?``:null);for(let e of[...h?.options||[]].slice(m))e.remove();!c&&m>1&&console.warn(e,` Multiple <data> found in single mode.`),s&&(q(s,`aria-multiselectable`,`${c}`),q(o,`list`,di(s)),q(o,`aria-label`,`${e._speak}${d}${Ti}`),s.hasAttribute(`popover`)&&(q(o,`popovertarget`,di(s)),q(s,`popover`,`manual`)),s._of=i.of);let v=X(a[0]);v!==e._item&&Ii(e),e._item=v,Pi(e),Fi(e),(n=si(e))==null||n.takeRecords()},Pi=e=>{e.clear&&q(e.clear,`role`,`button`),e.clear&&(e.clear.hidden=!e.control?.value||Mi(e))},Fi=e=>{let{_speak:t,options:n=[],values:r}=e;for(let e of n){let n=q(e,`value`)??X(e);q(e,`aria-label`,t?`${t}${X(e)}`:null),q(e,`selected`,r.includes(n)?``:null)}},Ii=e=>{let{multiple:t,control:n,items:r}=e,i=X(r[0]);!t&&n&&i!==n.value&&gi(n,i,i?Di:Ei)},Li=(e,t=!0)=>{let{_texts:n,options:r=[],creatable:i,control:a,items:o,multiple:s}=e,c=(a?.value)?.trim()||``,l=c.toLowerCase()||null,u=[...r].find(e=>(q(e,`label`)||X(e)).trim().toLowerCase()===l),d={bubbles:!0,cancelable:!0,detail:u};if(e.dispatchEvent(new CustomEvent(`comboboxbeforematch`,d))||(u=[...r].find(e=>e.selected)),t)return Fi(e),u?Z(e,u,!1):i&&c?Z(e,{value:c},!1):(!s&&!c&&o[0]?Z(e,o[0]):Ii(e),hi(n.invalid));for(let e of r)e.selected=e===u},Z=(e,t,n=!0)=>{var r;let{control:i,items:a,multiple:o}=e,s=J(`data`,t.label||t.value,{value:t.value}),c=[...a].find(e=>e.value===t.value),l={bubbles:!0,cancelable:!0,detail:c||s};if(c&&!n)return Ii(e);if(c===li(e)?.activeElement&&((r=e.shadowRoot?.querySelector(`[role="option"]`))==null||r.focus()),e.dispatchEvent(new CustomEvent(`comboboxbeforeselect`,l))){if(!o)for(let e of[...a])e.remove();c?c.remove():i?.insertAdjacentElement(`beforebegin`,s),e.dispatchEvent(new CustomEvent(`comboboxafterselect`,l))}},Ri=(e,{target:t})=>{let{_form:n,control:r,multiple:i}=e;t instanceof HTMLElement&&(e._focus=t),i&&n===void 0&&r&&t===r&&(e._form=q(r,`form`),q(r,`form`,`#`)),hi()},zi=e=>vi()||setTimeout(Bi,0,e),Bi=e=>{let{_focus:t,_root:n,_form:r,multiple:i,control:a}=e;!t||e.contains(n?.activeElement)||(i||Li(e),r&&a&&q(a,`form`,r),e._focus=e._form=void 0)},Vi=(e,t)=>{let{clientX:n,clientY:r,target:i}=t,{clear:a,control:o,items:s}=e;if(a?.contains(i))return o&&gi(o,``,Ei),o?.focus();for(let t of s){let{top:a,right:o,bottom:s,left:c}=t.getBoundingClientRect();if(t.contains(i))return Z(e,t);if(r>=a&&r<=s&&n>=c&&n<=o)return t.focus()}i===e&&o?.focus()},Hi=(e,t)=>{let{options:n=[],control:r,multiple:i}=e,a=(r?.value)?.trim()||``;if(t instanceof InputEvent?!t.inputType||t.inputType===`insertReplacementText`:a){t.stopImmediatePropagation(),r&&(r.value=e._value);for(let t of n)if(t.value&&t.value===a)return Z(e,t,i)}else i||Li(e,!1);Pi(e)},Ui=(e,t)=>{var n;let{clear:r,control:i,items:a}=e,{key:o,repeat:s,target:c}=t,l=i&&i===c,u=l&&i.selectionEnd,d=t.ctrlKey||t.metaKey||t.shiftKey||t.key===`Alt`,f=l?a.length:[...a].indexOf(c);if(l&&o===`Tab`&&!t.shiftKey&&r&&!r.hidden&&(t.preventDefault(),r.tabIndex=0,r.focus(),ii(r,`blur`,()=>q(r,`tabindex`,null),Si)),!(!l&&ci(t)||f===-1||d)){if(o===`ArrowRight`&&!l)f+=1;else if(o===`ArrowLeft`&&!u)--f;else if(o===`Enter`&&l)return Li(e);else if(o===`Backspace`&&!u){if(t.preventDefault(),!s&&a[f])return Z(e,a[f]);l&&--f}else return l||i?.focus();t.preventDefault(),(n=a[Math.max(0,f)]||i)==null||n.focus()}};fi.define(`u-combobox`,Ai);var Wi=class extends Ai{_unmutate;_render;connectedCallback(){super.connectedCallback(),this._render=()=>Gi(this),this._unmutate=g(this,this._render,{childList:!0}),f(this,`toggle`,Ki,r)}disconnectedCallback(){super.disconnectedCallback(),this._unmutate?.(),this._unmutate=this._render=void 0,p(this,`toggle`,Ki,r)}};let Gi=({control:e,list:t})=>{e&&!e.placeholder&&l(e,`placeholder`,` `),e&&l(e,`popovertarget`,S(t)||null),t&&l(t,`popover`,`manual`)},Ki=e=>{let t=e.currentTarget,n=e.newState===`open`&&t.control;n&&t.list?.dispatchEvent(new CustomEvent(`ds-toggle-source`,{detail:n}))};b.define(`ds-suggestion`,Wi);var qi=typeof window<`u`&&window.document!==void 0&&window.navigator!==void 0,Ji=qi&&/android/i.test(navigator.userAgent);qi&&/^Mac/i.test(navigator.userAgentData?.platform||navigator.platform);var Yi=`${Ji?`data`:`aria`}-labelledby`,Xi=`:host(:not([hidden])) { display: block }`,Zi=typeof HTMLElement>`u`?class{}:HTMLElement;function Q(e,t,n){return n===void 0?e.getAttribute(t):(n===null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n),null)}var Qi=(e,t,n)=>{for(let r of n[0].split(`,`))n[0]=r,Element.prototype[`${e}EventListener`].apply(t,n)},$i=(e,...t)=>Qi(`add`,e,t),ea=(e,...t)=>Qi(`remove`,e,t),ta=(e,t)=>e.shadowRoot||e.attachShadow({mode:`open`}).append(ca(`slot`),ca(`style`,t)),na=new WeakMap,ra=(e,t)=>{if(t===void 0)return na.get(e);try{na.get(e).disconnect(),na.delete(e)}catch{}if(t){let n=new MutationObserver(t=>e.handleEvent({type:`mutation`,detail:t}));n.observe(e,t),na.set(e,n)}},ia=e=>{var t;let n=e.key===` `||e.key===`Enter`;return n&&((t=e.preventDefault)==null||t.call(e)),n&&e.target instanceof HTMLElement&&e.target.dispatchEvent(new MouseEvent(`click`,e)),n},aa=e=>{let t=e.getRootNode?.call(e)||e.ownerDocument;return t instanceof Document||t instanceof ShadowRoot?t:document},oa=0,sa=e=>e?(e.id||=`:${e.nodeName.toLowerCase()}${(++oa).toString(32)}`,e.id):``,ca=(e,t,n)=>{let r=document.createElement(e);return t&&(r[e===`style`?`textContent`:`innerHTML`]=t),r},la={define:(e,t)=>!qi||window.customElements.get(e)||window.customElements.define(e,t)},ua=(e,t=`<slot></slot>`)=>`<template shadowrootmode="open">${t}<style>${e}</style></template>`,da=Xi,fa=Xi,pa=Xi,ma=`:host(:not([hidden])) { display: inline-block; cursor: pointer }:host([aria-disabled="true"]) { cursor: default }`;ua(da),ua(fa),ua(ma),ua(pa);var ha=`aria-controls`,$=`aria-selected`,ga=`data-utabs`,_a=class extends Zi{constructor(){super(),ta(this,da)}connectedCallback(){Q(this,ga,``)}get tabList(){return Ca(`tablist`,this)[0]||null}get selectedIndex(){return Ta(this.tabs)}set selectedIndex(e){Oa(this.tabs[e])}get tabs(){return Ca(`tab`,this)}get panels(){return Ca(`tabpanel`,this)}},va=class extends Zi{constructor(){super(),ta(this,fa)}connectedCallback(){Q(this,`role`,`tablist`),$i(this,`click,keydown`,this),ra(this,{childList:!0}),requestAnimationFrame(()=>this.handleEvent())}disconnectedCallback(){ea(this,`click,keydown`,this),ra(this,!1)}handleEvent(e){var t,n;if(!e||e.type===`mutation`)return this.tabs[Math.max(this.selectedIndex,0)]?.setAttribute($,`true`);let{key:r}=e,i=[...this.tabs],a=i.findIndex(t=>t.contains(e.target)),o=a;if(!(e.defaultPrevented||a===-1)&&(e.type===`click`&&Oa(i[a]),e.type===`keydown`&&!ia(e))){if(r===`ArrowDown`||r===`ArrowRight`)o=(a+1)%i.length;else if(r===`ArrowUp`||r===`ArrowLeft`)o=(a||i.length)-1;else if(r===`End`)o=i.length-1;else if(r===`Home`)o=0;else if(r===`Tab`)o=Ta(i);else return;setTimeout(()=>{Q(i[a],`tabindex`,`-1`),Q(i[o],`tabindex`,`0`)}),r!==`Tab`&&(e.preventDefault(),(n=(t=i[o]).focus)==null||n.call(t))}}get tabsElement(){return Ea(this)}get tabs(){return Da(this)}get selectedIndex(){return Ta(this.tabs)}set selectedIndex(e){Oa(this.tabs[e])}},ya=!1,ba=class extends Zi{static get observedAttributes(){return[`id`,$,ha]}constructor(){super(),ta(this,ma)}connectedCallback(){Q(this,`role`,`tab`),Q(this,`tabindex`,this.selected?`0`:`-1`)}attributeChangedCallback(){if(!ya&&this.selected&&this.tabList){ya=!0;let e=this.tabList?Da(this.tabList):[],t=Ca(`tabpanel`,this.tabsElement||this),n=wa(this,t[[...e].indexOf(this)]);n&&Q(n,Yi,sa(this));let r=0;for(let i of e){let e=wa(i,t[r++]);Q(i,`tabindex`,i===this?`0`:`-1`),Q(i,$,`${i===this}`),e?.id&&Q(i,ha,e.id),e&&(e.hidden=e!==n)}ya=!1}}get tabsElement(){return Ea(this)}get tabList(){let e=this.parentElement;return e?.getAttribute(`role`)===`tablist`?e:null}get selected(){return Q(this,$)===`true`}set selected(e){Q(this,$,`${!!e}`)}get index(){let e=this.tabList;return e?[...Da(e)].indexOf(this):0}get panel(){return wa(this)}},xa=!1,Sa=class extends Zi{static get observedAttributes(){return[`id`,`hidden`]}constructor(){super(),ta(this,pa)}connectedCallback(){var e;Q(this,`role`,`tabpanel`),(e=this.tabsElement?.tabList)==null||e.handleEvent(),this.attributeChangedCallback()}attributeChangedCallback(){if(xa)return;xa=!0;let e=ka(this.firstChild);this.hidden=Ta(this.tabs)===-1,Q(this,`aria-hidden`,`${this.hidden}`),Q(this,`tabindex`,this.hidden||e?null:`0`),xa=!1}get tabsElement(){return Ea(this)}get tabs(){return aa(this).querySelectorAll(`[role="tab"][${ha}="${this.id}"]`)}},Ca=(e,t)=>t.querySelectorAll(`[role="${e}"]:not(:scope [role="tabpanel"] [role="${e}"])`),wa=(e,t)=>aa(e).getElementById(Q(e,ha)||sa(t)),Ta=e=>[...e].findIndex(e=>Q(e,$)===`true`),Ea=e=>e.closest(`[${ga}]`),Da=e=>e.querySelectorAll(`:scope > [role="tab"]`),Oa=e=>e&&Q(e,`aria-disabled`)!==`true`&&Q(e,`aria-selected`,`true`),ka=e=>e instanceof Element&&!e.matches(`:disabled,[tabindex^="-"]`)&&e.matches(`[contenteditable],[controls],[href],[tabindex],input:not([type="hidden"]),select,textarea,button,summary,iframe`);la.define(`u-tabs`,_a),la.define(`u-tablist`,va),la.define(`u-tab`,ba),la.define(`u-tabpanel`,Sa);var Aa=class extends _a{},ja=class extends va{},Ma=class extends ba{},Na=class extends Sa{};b.define(`ds-tabs`,Aa),b.define(`ds-tablist`,ja),b.define(`ds-tab`,Ma),b.define(`ds-tabpanel`,Na),i()&&!t()&&n(),e.DSBreadcrumbsElement=Sr,e.DSErrorSummaryElement=wr,e.DSFieldElement=Lr,e.DSPaginationElement=Ur,e.DSSuggestionElement=Wi,e.DSTabElement=Ma,e.DSTabListElement=ja,e.DSTabPanelElement=Na,e.DSTabsElement=Aa,e.UHTMLDataListElement=ur,e.UHTMLDataListShadowRoot=rr,e.UHTMLDataListStyle=nr,e.pagination=Hr,e.setTooltipElement=vn});
|
|
15
15
|
//# sourceMappingURL=index.js.map
|