@mgdis/stencil-helpers 3.2.13 → 3.2.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","names":["#next","#top","#total","getStorybookUrl","dateRegExp","#getComponentData","#getPropControl"],"sources":["../../helpers/dist/utils/index.js","../../helpers/dist/stencil/index.js","../../helpers/dist/locale/index.js","../../helpers/dist/storybook/index.js","../../helpers/dist/tests/index.js"],"sourcesContent":["/**\n * Class to manage component classlist\n */\nclass ClassList {\n /**\n * Available classes\n */\n classes;\n constructor(classlist = []) {\n this.classes = classlist;\n }\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className) => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className) => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className) => {\n return this.classes.includes(className);\n };\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = () => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if a value is of object type.\n * @param object - The value to validate.\n * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.\n */\nconst isObject = (object) => typeof object === 'object' && !Array.isArray(object) && object !== null;\n/**\n * Get object value from key\n * @param object - object to query\n * @param path - path of the property to get. Nested keys are allowed with `.` separators (eg: 'key0.key1.key2' = object[key0][key1][key2])\n * @param defaultValue - The value returned for `undefined` resolved values\n * @returns object value\n */\nconst getObjectValueFromKey = (object, path, defaultValue) => {\n const separator = '.';\n if (!isObject(object) || typeof path !== 'string') {\n return defaultValue;\n }\n const [current, ...next] = path.split(separator);\n if (next.length) {\n return getObjectValueFromKey(object[current], next.join(separator), defaultValue);\n }\n else {\n return object[current] ?? defaultValue;\n }\n};\n\n/**\n * Typeguard function to check if all array items are strings.\n * @param items - items to check\n * @returns `true` if all items are strings\n */\nconst allItemsAreString = (items) => Array.isArray(items) && items.every(item => typeof item === 'string');\n/**\n * Validate string\n * @param value - value to check\n * @returns `true` if string is valid\n */\nconst isValidString = (value) => typeof value === 'string' && value.trim() !== '';\n/**\n * Stringify value\n * @param value - value to stringify\n * @returns stringified value\n */\nconst toString = (value) => (typeof value === 'object' ? JSON.stringify(value) : String(value));\n/**\n * Cleans string characters by removing special characters and converting to lowercase.\n * @param text - text to clean\n * @returns cleaned string\n * @example\n * ```ts\n * cleanString('âäàçéèêñù') // 'aaaceeenu'\n * cleanString('BATMAN') // 'batman'\n * ```\n */\nconst cleanString = (text) => typeof text === 'string'\n ? text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '')\n : text;\n\n/**\n * Convert a string to kebab-case.\n *\n * This function ensures:\n * - All characters are converted to lowercase. Based on : https://stackoverflow.com/questions/63116039/camelcase-to-kebab-case\n * - Non-alphabetic characters (except numbers and hyphens) are replaced with hyphens.\n * - Consecutive hyphens are replaced with a single hyphen.\n * - Leading and trailing hyphens are removed.\n *\n * @param str - The input string to convert.\n * @returns The kebab-case formatted string.\n *\n * @example\n * ```typescript\n * toKebabCase('XMLHttpRequest'); // 'xml-http-request'\n * ```\n */\nconst toKebabCase = (str) => str\n .replace(/[A-Z]+(?![a-z])|[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase())\n .replace(/[^a-z0-9-]+/g, '-') // Replace non a-z, 0-9, or hyphen characters with a hyphen\n .replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen\n .replace(/(?:^-)|(?:-$)/g, ''); // Remove leading hyphens or number or trailing hyphens\n\n/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nconst createID = (prefix = '', length = 10) => {\n const randomBytes = new Uint8Array(length);\n crypto.getRandomValues(randomBytes);\n const hexString = Array.from(randomBytes)\n .map(byte => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\n};\n/**\n * Validate html `id` format\n * @param newValue - id value to validate\n * @returns true if `id` is valid\n */\nconst isValideID = (newValue) => isValidString(newValue) && /^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.exec(newValue) !== null;\n/**\n * Format id from value\n * @param value - id to transforme\n * @returns valid id\n */\nconst formatID = (value) => {\n let id;\n if (typeof value === 'string') {\n id = value;\n }\n else if (Boolean(value) && typeof value === 'object' && (isObject(value) || Array.isArray(value))) {\n id = JSON.stringify(value);\n }\n else if (value !== null && value !== undefined && typeof value !== 'boolean' && typeof value !== 'object') {\n id = String(value);\n }\n return id ? toKebabCase(id) : id;\n};\n\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nconst nextTick = async (callback) => {\n if (callback)\n return callback();\n};\n/**\n * Cursor possible values\n */\nconst Cursor = {\n FIRST: 'first',\n NEXT: 'next',\n PREVIOUS: 'previous',\n LAST: 'last',\n};\nconst DEFAULT_TOP = 10;\n/**\n * Define a valid Page object and navigate throw page items with cursor.\n * Page object entries follow the REST API page practices.\n */\nclass Page {\n /**\n * Define items\n */\n items = [];\n /**\n * Define total\n */\n total;\n /**\n * Define top\n */\n top = DEFAULT_TOP;\n /**\n * Define next\n */\n next;\n /**\n * Define base index\n */\n baseIndex = 1;\n constructor(init) {\n if (!isObject(init)) {\n throw new Error('Page - init must match IPage type.');\n }\n else {\n if (Array.isArray(init.items))\n this.items = init.items;\n if (typeof init.top === 'number')\n this.top = init.top;\n this.total = typeof init.total === 'number' ? init.total : this.items.length;\n this.next = init.next;\n }\n }\n /**\n * Get index of items from cursor\n * @param cursor - cursor to find\n * @param oldItem - previous item\n * @returns item index\n */\n getIndexFromCursor = (cursor = 'first', oldItem) => {\n const startIndex = 0;\n if (!Array.isArray(this.items) || !this.items.length)\n return null;\n const lastIndex = this.items.length - this.baseIndex;\n let newIndex;\n let oldIndex = startIndex;\n if (['previous', 'next'].includes(cursor) && oldItem) {\n const findedIndex = this.items.findIndex(item => JSON.stringify(item) === JSON.stringify(oldItem));\n if (findedIndex === -1)\n return startIndex;\n oldIndex = findedIndex;\n }\n // Update index from cursor\n if (cursor === 'first') {\n newIndex = startIndex;\n }\n else if (cursor === 'last') {\n newIndex = lastIndex;\n }\n else if (cursor === 'previous') {\n newIndex = JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[startIndex]) ? lastIndex : oldIndex - this.baseIndex;\n }\n else if (cursor === 'next') {\n newIndex = JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[lastIndex]) ? startIndex : oldIndex + this.baseIndex;\n }\n else {\n newIndex = startIndex;\n }\n return newIndex;\n };\n}\n/**\n * Paginate an items array to navigate into with pages.\n * It follow REST standard and allow to navigate in items array with a similar format.\n */\nclass Paginate {\n /**\n * Define paginated items\n */\n items = [];\n /* Privates */\n #top = DEFAULT_TOP;\n #next;\n #total;\n constructor(items, options) {\n if (Array.isArray(items))\n this.items = items;\n if (options && (['string', 'function'].includes(typeof options.next) || (isObject(options.next) && URL.canParse(options.next))))\n this.#next = options.next;\n if (typeof options?.top === 'number')\n this.#top = options.top;\n if (typeof options?.total === 'number')\n this.#total = options.total;\n }\n /**\n * Get page\n * @param offset - pagiantion offset\n * @param filter - filter methode\n * @returns formated page\n */\n getPage = (offset = 0, filter) => {\n const items = typeof filter === 'function' ? this.items.filter(filter) : this.items;\n let next;\n if (this.#next)\n next = this.#next;\n else if (items.length > offset + this.#top)\n next = () => this.getPage(offset + this.#top, filter);\n return new Page({\n items: items.slice(offset, offset + this.#top),\n total: this.#total,\n top: this.#top,\n next,\n });\n };\n}\n\n/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n/**\n * Formats a date object to a string with the pattern 'YYYY-MM-DD'.\n * @param date - date to parse\n * @returns string date with pattern 'YYYY-MM-DD'\n * @example\n * ```ts\n * dateToString(new Date('2023-12-24')) // '2023-12-24'\n * ```\n */\nconst dateToString = (date) => date.toISOString().split('T')[0];\n\n/**\n * Check if element belongs to the given tagNames list\n * @param element - element to check\n * @param tagNames - allowed tag names list\n * @returns `true` if element tagName is in the tagNames list\n */\nconst isTagName = (element, tagNames) => tagNames.includes(element?.tagName.toLowerCase());\n/**\n * CSS selector to select focusable elements.\n * @example\n * ```ts\n * const allFocusableElements: HTMLElement[] = Array.from(this.element.querySelectorAll(focusableElements));\n * ```\n */\nconst focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier], mg-button';\n\n/**\n * Validate number\n * @param value - value to check\n * @returns `true` if number is valid\n */\nconst isValidNumber = (value) => typeof value === 'number' && !Number.isNaN(value);\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nconst getWindows = (localWindow) => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getParentWindows = (localWindow, windows = []) => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow = localWindow.parent;\n if (parentWindow) {\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n }\n else\n return windows;\n }\n catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow, windows = []) => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\nexport { ClassList, Cursor, Page, Paginate, allItemsAreString, cleanString, createID, dateRegExp, dateToString, focusableElements, formatID, getChildWindows, getObjectValueFromKey, getParentWindows, getWindows, isObject, isTagName, isValidNumber, isValidString, isValideID, nextTick, toKebabCase, toString };\n//# sourceMappingURL=index.js.map\n","/**\n * Retrieve Component Storybook URL from file path\n * @param storybookBaseUrl - Storybook Base URL\n * @param filePath - Component file path\n * @returns Component Storybook URL\n */\nconst getStorybookUrl = (storybookBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n const split = filePath.split('/');\n return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;\n};\n\n/**\n * Retrieve Component source URL from file path\n * @param sourcesBaseUrl - Source base URL\n * @param filePath - Component file path\n * @returns Component source URL\n */\nconst getSourcesUrl = (sourcesBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n return `${sourcesBaseUrl}${filePath}`;\n};\n/**\n * Get Component element description.\n *\n * Neither WebStorm nor VS Code render the structured `attributes` /\n * `js.properties` arrays in the tag-level quick-doc — they only show this\n * markdown description. So the attribute and property listings have to live\n * here, even though they're redundant with the structured arrays used by the\n * inline autocomplete.\n * @param component - Component\n * @returns Component element description\n */\nconst getElementDescription = (component) => {\n let description = component.overview ? `${component.overview}\\n\\n` : '';\n const attributes = component.props.filter(({ attr }) => attr !== undefined);\n if (attributes.length) {\n description += `Attributes:\\n`;\n description += attributes.map(({ attr, docs }) => `- \\`${attr}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n const properties = component.props.filter(({ attr }) => attr === undefined);\n if (properties.length) {\n description += `Properties:\\n`;\n description += properties.map(({ name, docs }) => `- \\`${name}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.methods.length) {\n description += `Methods:\\n`;\n description += component.methods.map(({ name, docs }) => `- \\`${name}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.events.length) {\n description += `Events:\\n`;\n description += component.events.map(({ event, docs }) => `- \\`${event}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.listeners.length) {\n description += `Listeners:\\n`;\n description += component.listeners.map(({ event }) => `- \\`${event}\\`\\n`).join('');\n description += '\\n';\n }\n if (component.slots.length) {\n description += `Slots:\\n`;\n description += component.slots\n .map(({ name, docs }) => {\n const label = name ? `\\`${name}\\`` : 'default';\n return `- ${label}: ${docs}\\n`;\n })\n .join('');\n description += '\\n';\n }\n return description;\n};\n/**\n * Get Props Description\n * @param prop - Component Property\n * @returns Props Description\n */\nconst getAttributeDescription = (prop) => {\n return `${prop.docs}\\n\\nType: \\`${prop.type}\\``;\n};\n/**\n * Generate Web Types metadata for IntelliJ's IDE\n * @param name - Library name\n * @param version - Library version\n * @param jsonDocs - Stencil JSON doc\n * @param storybookBaseUrl - Storybook Base Url\n * @returns Web Types metadata\n * @example\n * ```ts\n * const webTypesJson = webTypesGenerator('@mgdis/mg-components', '1.0.0', jsonDocs, 'https://storybook.example.com');\n * ```\n */\nconst webTypesGenerator = (name, version, jsonDocs, storybookBaseUrl) => ({\n '$schema': 'https://json.schemastore.org/web-types',\n name,\n version,\n 'description-markup': 'markdown',\n 'contributions': {\n html: {\n elements: jsonDocs.components.map(component => {\n const docUrl = getStorybookUrl(storybookBaseUrl, component.filePath);\n return {\n 'name': component.tag,\n 'description': getElementDescription(component),\n 'doc-url': docUrl,\n 'attributes': component.props\n .filter(prop => prop.attr)\n .map(prop => ({\n 'name': prop.attr,\n 'description': getAttributeDescription(prop),\n 'doc-url': docUrl,\n 'value': {\n type: prop.type,\n default: prop.default,\n required: prop.required,\n },\n })),\n 'js': {\n properties: component.props\n .filter(prop => prop.attr === undefined)\n .map(prop => ({\n 'name': prop.name,\n 'description': getAttributeDescription(prop),\n 'doc-url': docUrl,\n 'value': {\n type: prop.type,\n default: prop.default,\n required: prop.required,\n },\n })),\n events: component.events.map(event => ({\n name: event.event,\n description: event.docs,\n })),\n },\n 'css': {\n properties: component.styles.map(style => ({\n name: style.name,\n description: style.docs,\n })),\n },\n };\n }),\n },\n },\n});\n/**\n * Create Storybook Reference\n * @param storybookBaseUrl - Storybook Base Url\n * @param filePath - Component file path\n * @returns Storybook Reference\n */\nconst getReferences = (storybookBaseUrl, sourceBaseUrl, filePath) => {\n return [\n { name: 'Storybook', url: getStorybookUrl(storybookBaseUrl, filePath) },\n { name: 'Sources', url: getSourcesUrl(sourceBaseUrl, filePath) },\n ];\n};\n/**\n * Get Property possible values\n * @param prop - Component Property\n * @returns Property possible values\n */\nconst getValues = (prop) => {\n // Only values Array where all objects have a value seems to be usefull\n if (prop.values.some(({ value }) => value === undefined)) {\n return;\n }\n return prop.values.map(({ value }) => ({ name: value }));\n};\n/**\n * Generate custom HTML datasets for VS Code\n * @param jsonDocs - Stencil JSON doc\n * @param storybookBaseUrl - Storybook Base Url\n * @returns custom HTML datasets\n * @example\n * ```ts\n * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');\n * ```\n */\nconst vsCodeGenerator = (jsonDocs, storybookBaseUrl, sourceBaseUrl) => ({\n version: 1.1,\n tags: jsonDocs.components.map(component => {\n const references = getReferences(storybookBaseUrl, sourceBaseUrl, component.filePath);\n return {\n name: component.tag,\n description: getElementDescription(component),\n attributes: component.props\n .filter(prop => prop.attr !== undefined)\n .map(prop => ({\n name: prop.attr,\n description: getAttributeDescription(prop),\n values: getValues(prop),\n references,\n })),\n references,\n };\n }),\n globalAttributes: [],\n valueSets: [],\n});\n/**\n * Generate custom CSS datasets for VS Code\n * @param jsonDocs - Stencil JSON doc\n * @returns custom CSS datasets\n * @example\n * ```ts\n * const customDataJson = vsCodeCssGenerator(jsonDocs);\n * ```\n */\nconst vsCodeCssGenerator = (jsonDocs) => ({\n version: 1.1,\n properties: jsonDocs.components.flatMap(component => component.styles.map(style => ({\n name: style.name,\n description: style.docs,\n }))),\n});\n\n/**\n * Convert a Stencil component's JsonDocs into a CEM v2 module entry.\n * @param component - Stencil component doc\n * @returns CEM module\n */\nconst componentToModule = (component) => {\n const className = component.tag\n .split('-')\n .map(part => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n const attributes = component.props\n .filter(prop => prop.attr !== undefined)\n .map(prop => ({\n name: prop.attr,\n description: prop.docs,\n type: { text: prop.type },\n ...(prop.default !== undefined && { default: prop.default }),\n fieldName: prop.name,\n }));\n const fieldMembers = component.props.map(prop => ({\n kind: 'field',\n name: prop.name,\n description: prop.docs,\n type: { text: prop.type },\n ...(prop.default !== undefined && { default: prop.default }),\n ...(prop.attr !== undefined && { attribute: prop.attr }),\n }));\n const methodMembers = component.methods.map(method => ({\n kind: 'method',\n name: method.name,\n description: method.docs,\n }));\n return {\n kind: 'javascript-module',\n path: component.filePath ?? '',\n declarations: [\n {\n kind: 'class',\n name: className,\n tagName: component.tag,\n customElement: true,\n description: component.overview ?? '',\n attributes,\n members: [...fieldMembers, ...methodMembers],\n events: component.events.map(event => ({\n name: event.event,\n description: event.docs,\n type: { text: `CustomEvent<${event.detail}>` },\n })),\n slots: component.slots.map(slot => ({\n name: slot.name,\n description: slot.docs,\n })),\n cssProperties: component.styles.map(style => ({\n name: style.name,\n description: style.docs,\n })),\n cssParts: component.parts.map(part => ({\n name: part.name,\n description: part.docs,\n })),\n },\n ],\n exports: [\n {\n kind: 'custom-element-definition',\n name: component.tag,\n declaration: {\n name: className,\n module: component.filePath ?? '',\n },\n },\n ],\n };\n};\n/**\n * Generate a Custom Elements Manifest v2 from Stencil JSON docs.\n * @param jsonDocs - Stencil JSON doc\n * @returns CEM v2\n * @example\n * ```ts\n * const cem = cemGenerator(jsonDocs);\n * ```\n */\nconst cemGenerator = (jsonDocs) => ({\n schemaVersion: '2.0.0',\n readme: '',\n modules: jsonDocs.components.map(componentToModule),\n});\n\n/**\n * Per the HTML spec, a boolean attribute is `true` whenever it is present on the\n * element, regardless of its value (including `=\"false\"`). Stencil's default Prop\n * parser converts the string `\"false\"` to the boolean `false`, which breaks this\n * contract for consumers writing markup. Call this helper from `componentWillLoad`\n * to re-normalize every present attribute that maps to a boolean-typed Prop.\n *\n * Iterates the host element's attributes and, for each one whose camelCase name\n * matches a `typeof === 'boolean'` Prop on the instance, rewrites the attribute\n * to `''` — Stencil's parser then turns that into `true` via the standard\n * attribute → prop pipeline (no need for `mutable: true` on the Prop, since the\n * write goes through Stencil's internal setter, not through user code).\n *\n * Non-boolean Props and non-Prop attributes (`class`, `id`, ...) are skipped\n * naturally by the type check.\n *\n * @param target - the component instance (must expose `element` via `@Element()`)\n *\n * @example\n * ```typescript\n * @Component({ tag: 'my-input' })\n * export class MyInput {\n * @Element() element: HTMLMyInputElement;\n * @Prop() readonly = false;\n * @Prop() disabled = false;\n *\n * componentWillLoad() {\n * normalizeBooleanAttributes(this);\n * }\n * }\n * ```\n */\nconst normalizeBooleanAttributes = (target) => {\n for (const attr of Array.from(target.element.attributes)) {\n const propName = attr.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n if (typeof target[propName] === 'boolean') {\n target.element.setAttribute(attr.name, '');\n }\n }\n};\n\nexport { cemGenerator, normalizeBooleanAttributes, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };\n//# sourceMappingURL=index.js.map\n","/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Gets the date pattern based on the specified locale.\n * @param locale - the locale to refer to\n * @returns date pattern\n * @example\n * ```ts\n * localeDatePattern('fr') // 'dd/mm/yyyy'\n * ```\n */\nconst localeDatePattern = (locale) => {\n const year = { value: '2023', pattern: 'yyyy' };\n const month = { value: '12', pattern: 'mm' };\n const day = { value: '24', pattern: 'dd' };\n return localeDate([year.value, month.value, day.value].join('-'), locale, { timeZone: 'UTC' })\n .replace(year.value, year.pattern)\n .replace(month.value, month.pattern)\n .replace(day.value, day.pattern);\n};\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nconst localeMessages = (element, messages, defaultLocale) => {\n // Get local\n const closestLangAttribute = element.closest('[lang]');\n const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 && typeof closestLang[0] === 'string' ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // If messages is empty, return a default object\n if (Object.keys(messages).length === 0) {\n return {\n locale,\n messages: { lang: defaultLocale },\n };\n }\n // Return\n return {\n locale,\n messages: (messages[localeSubtag] ?? messages[defaultLocale] ?? { lang: defaultLocale }),\n };\n};\n/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n * @example\n * ```ts\n * localeCurrency(1234567890.12, 'fr', 'EUR') // '1 234 567 890,12\\xa0€'\n * ```\n */\nconst localeCurrency = (number, locale, currency) => new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted number\n * @example\n * ```ts\n * localeNumber(1234567890.12, 'fr') // 1 234 567 890,12\n * ```\n */\nconst localeNumber = (number, locale, decimalLength = 0) => new Intl.NumberFormat(locale, { minimumFractionDigits: decimalLength }).format(Number(number));\n/**\n * Convert bytes number to locale string representation\n * @param number - size in bytes\n * @param locale - locale to apply\n * @returns bytes in locale string format\n */\nconst localeByte = (number, locale) => {\n if (typeof number !== 'number' || Number.isNaN(number) || number < 0) {\n throw new Error('localeByte - size must be a positive number.');\n }\n const base = 1024;\n const units = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'];\n // find appropriate unit base on size and base power\n const unitIndex = units.findIndex((_, key) => number < Math.pow(base, key + 1));\n // convert number to string with unit\n return Intl.NumberFormat(locale, {\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n unit: units[unitIndex],\n unitDisplay: units[unitIndex] === 'byte' ? 'long' : 'short',\n style: 'unit',\n }).format(number / Math.pow(base, unitIndex));\n};\n/**\n * Format number as percentage based on locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted percentage\n * @example\n * ```ts\n * localePercent(0.42, 'fr', 2) // '42,00 %'\n * localePercent(0.42, 'en', 2) // '42.00%'\n * ```\n */\nconst localePercent = (number, locale, decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Format number with standardized unit based on locale using Intl unit formatting\n * @param number - number to format\n * @param locale - locale to apply\n * @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')\n * @param unitDisplay - how to display the unit ('short', 'long', 'narrow')\n * @param decimalLength - decimal length to apply\n * @returns formatted number with localized unit\n * @example\n * ```ts\n * localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'\n * localeUnit(23, 'fr', 'celsius') // '23 °C'\n * localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'\n * ```\n */\nconst localeUnit = (number, locale, unit, unitDisplay = 'short', decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay,\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @param config - DateTimeFormatOptions object to apply\n * @returns formatted date\n * @example\n * ```ts\n * localeDate('2022-06-02', 'fr') // '02/06/2022'\n * ```\n */\nconst localeDate = (date, locale, config) => typeof date !== 'string' || date === '' || !dateRegExp.test(date) ? '' : new Intl.DateTimeFormat(locale, config).format(new Date(date));\n/**\n * Get Intl object\n * @param messages - locales to render in object format. `ex: { en: { porp: \"test\" }, fr: { porp: \"test\" }}`.\n * @param defaultLocale - fallback locale to render. `ex: 'en'`.\n * @returns from the element passed in return function you will get the matching messages object\n * @example\n * ```ts\n * import en from './en/messages.json';\n * import fr from './fr/messages.json';\n * import { defineLocales } from '@mgdis/core-ui-helpers/dist/utils';\n *\n * const defaultLocale = 'en';\n * const messages = { en, fr };\n *\n * export const initLocales = defineLocales(messages, defaultLocale);\n * ```\n */\nconst defineLocales = (messages, defaultLocale) => (element) => localeMessages(element, messages, defaultLocale);\n\nexport { defineLocales, localeByte, localeCurrency, localeDate, localeDatePattern, localeNumber, localePercent, localeUnit };\n//# sourceMappingURL=index.js.map\n","// src/app-data/index.ts\nvar BUILD = {\n updatable: true,\n slotRelocation: true};\n\n/*\n Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com\n */\n\n\n// src/utils/constants.ts\nvar SVG_NS = \"http://www.w3.org/2000/svg\";\nvar HTML_NS = \"http://www.w3.org/1999/xhtml\";\n\n// src/client/client-host-ref.ts\nvar getHostRef = (ref) => {\n if (ref.__stencil__getHostRef) {\n return ref.__stencil__getHostRef();\n }\n return void 0;\n};\nvar isMemberInElement = (elm, memberName) => memberName in elm;\nvar XLINK_NS = \"http://www.w3.org/1999/xlink\";\nvar win = typeof window !== \"undefined\" ? window : {};\nvar plt = {\n $flags$: 0,\n $resourcesUrl$: \"\",\n jmp: (h2) => h2(),\n raf: (h2) => requestAnimationFrame(h2),\n ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),\n rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),\n ce: (eventName, opts) => new CustomEvent(eventName, opts)\n};\nvar updateFallbackSlotVisibility = (elm) => {\n const childNodes = internalCall(elm, \"childNodes\");\n if (elm.tagName && elm.tagName.includes(\"-\") && elm[\"s-cr\"] && elm.tagName !== \"SLOT-FB\") {\n getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {\n if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === \"SLOT-FB\") {\n if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {\n slotNode.hidden = true;\n } else {\n slotNode.hidden = false;\n }\n }\n });\n }\n let i2 = 0;\n for (i2 = 0; i2 < childNodes.length; i2++) {\n const childNode = childNodes[i2];\n if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, \"childNodes\").length) {\n updateFallbackSlotVisibility(childNode);\n }\n }\n};\nvar getSlottedChildNodes = (childNodes) => {\n const result = [];\n for (let i2 = 0; i2 < childNodes.length; i2++) {\n const slottedNode = childNodes[i2][\"s-nr\"] || void 0;\n if (slottedNode && slottedNode.isConnected) {\n result.push(slottedNode);\n }\n }\n return result;\n};\nfunction getHostSlotNodes(childNodes, hostName, slotName) {\n let i2 = 0;\n let slottedNodes = [];\n let childNode;\n for (; i2 < childNodes.length; i2++) {\n childNode = childNodes[i2];\n if (childNode[\"s-sr\"] && (!hostName || childNode[\"s-hn\"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {\n slottedNodes.push(childNode);\n if (typeof slotName !== \"undefined\") return slottedNodes;\n }\n slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];\n }\n return slottedNodes;\n}\nvar getSlotChildSiblings = (slot, slotName, includeSlot = true) => {\n const childNodes = [];\n if (includeSlot && slot[\"s-sr\"] || !slot[\"s-sr\"]) childNodes.push(slot);\n let node = slot;\n while (node = node.nextSibling) {\n if (getSlotName(node) === slotName && (includeSlot || !node[\"s-sr\"])) childNodes.push(node);\n }\n return childNodes;\n};\nvar isNodeLocatedInSlot = (nodeToRelocate, slotName) => {\n if (nodeToRelocate.nodeType === 1 /* ElementNode */) {\n if (nodeToRelocate.getAttribute(\"slot\") === null && slotName === \"\") {\n return true;\n }\n if (nodeToRelocate.getAttribute(\"slot\") === slotName) {\n return true;\n }\n return false;\n }\n if (nodeToRelocate[\"s-sn\"] === slotName) {\n return true;\n }\n return slotName === \"\";\n};\nvar getSlotName = (node) => typeof node[\"s-sn\"] === \"string\" ? node[\"s-sn\"] : node.nodeType === 1 && node.getAttribute(\"slot\") || void 0;\nfunction patchSlotNode(node) {\n if (node.assignedElements || node.assignedNodes || !node[\"s-sr\"]) return;\n const assignedFactory = (elementsOnly) => (function(opts) {\n const toReturn = [];\n const slotName = this[\"s-sn\"];\n if (opts == null ? void 0 : opts.flatten) {\n console.error(`\n Flattening is not supported for Stencil non-shadow slots.\n You can use \\`.childNodes\\` to nested slot fallback content.\n If you have a particular use case, please open an issue on the Stencil repo.\n `);\n }\n const parent = this[\"s-cr\"].parentElement;\n const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);\n slottedNodes.forEach((n) => {\n if (slotName === getSlotName(n)) {\n toReturn.push(n);\n }\n });\n if (elementsOnly) {\n return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);\n }\n return toReturn;\n }).bind(node);\n node.assignedElements = assignedFactory(true);\n node.assignedNodes = assignedFactory(false);\n}\nfunction dispatchSlotChangeEvent(elm) {\n elm.dispatchEvent(new CustomEvent(\"slotchange\", { bubbles: false, cancelable: false, composed: false }));\n}\nfunction findSlotFromSlottedNode(slottedNode, parentHost) {\n var _a;\n parentHost = parentHost || ((_a = slottedNode[\"s-ol\"]) == null ? void 0 : _a.parentElement);\n if (!parentHost) return { slotNode: null, slotName: \"\" };\n const slotName = slottedNode[\"s-sn\"] = getSlotName(slottedNode) || \"\";\n const childNodes = internalCall(parentHost, \"childNodes\");\n const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];\n return { slotNode, slotName };\n}\nfunction internalCall(node, method) {\n if (\"__\" + method in node) {\n const toReturn = node[\"__\" + method];\n if (typeof toReturn !== \"function\") return toReturn;\n return toReturn.bind(node);\n } else {\n if (typeof node[method] !== \"function\") return node[method];\n return node[method].bind(node);\n }\n}\n\n// src/utils/helpers.ts\nvar isDef = (v) => v != null && v !== void 0;\nvar isComplexType = (o) => {\n o = typeof o;\n return o === \"object\" || o === \"function\";\n};\n\n// src/runtime/vdom/h.ts\nvar h = (nodeName, vnodeData, ...children) => {\n let child = null;\n let key = null;\n let slotName = null;\n let simple = false;\n let lastSimple = false;\n const vNodeChildren = [];\n const walk = (c) => {\n for (let i2 = 0; i2 < c.length; i2++) {\n child = c[i2];\n if (Array.isArray(child)) {\n walk(child);\n } else if (child != null && typeof child !== \"boolean\") {\n if (simple = !isComplexType(child)) {\n child = String(child);\n }\n if (simple && lastSimple) {\n vNodeChildren[vNodeChildren.length - 1].$text$ += child;\n } else {\n vNodeChildren.push(simple ? newVNode(null, child) : child);\n }\n lastSimple = simple;\n }\n }\n };\n walk(children);\n const vnode = newVNode(nodeName, null);\n vnode.$attrs$ = vnodeData;\n if (vNodeChildren.length > 0) {\n vnode.$children$ = vNodeChildren;\n }\n {\n vnode.$key$ = key;\n }\n {\n vnode.$name$ = slotName;\n }\n return vnode;\n};\nvar newVNode = (tag, text) => {\n const vnode = {\n $flags$: 0,\n $tag$: tag,\n // Normalize undefined to null to prevent rendering \"undefined\" as text\n $text$: text != null ? text : null,\n $elm$: null,\n $children$: null\n };\n {\n vnode.$attrs$ = null;\n }\n {\n vnode.$key$ = null;\n }\n {\n vnode.$name$ = null;\n }\n return vnode;\n};\nvar Host = {};\nvar isHost = (node) => node && node.$tag$ === Host;\nvar setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {\n if (oldValue === newValue) {\n return;\n }\n let isProp = isMemberInElement(elm, memberName);\n let ln = memberName.toLowerCase();\n if (memberName === \"class\") {\n const classList = elm.classList;\n const oldClasses = parseClassList(oldValue);\n let newClasses = parseClassList(newValue);\n {\n classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));\n classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));\n }\n } else if (memberName === \"style\") {\n {\n for (const prop in oldValue) {\n if (!newValue || newValue[prop] == null) {\n if (prop.includes(\"-\")) {\n elm.style.removeProperty(prop);\n } else {\n elm.style[prop] = \"\";\n }\n }\n }\n }\n for (const prop in newValue) {\n if (!oldValue || newValue[prop] !== oldValue[prop]) {\n if (prop.includes(\"-\")) {\n elm.style.setProperty(prop, newValue[prop]);\n } else {\n elm.style[prop] = newValue[prop];\n }\n }\n }\n } else if (memberName === \"key\") ; else if (memberName === \"ref\") {\n if (newValue) {\n queueRefAttachment(newValue, elm);\n }\n } else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === \"o\" && memberName[1] === \"n\") {\n if (memberName[2] === \"-\") {\n memberName = memberName.slice(3);\n } else if (isMemberInElement(win, ln)) {\n memberName = ln.slice(2);\n } else {\n memberName = ln[2] + memberName.slice(3);\n }\n if (oldValue || newValue) {\n const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);\n memberName = memberName.replace(CAPTURE_EVENT_REGEX, \"\");\n if (oldValue) {\n plt.rel(elm, memberName, oldValue, capture);\n }\n if (newValue) {\n plt.ael(elm, memberName, newValue, capture);\n }\n }\n } else if (memberName[0] === \"a\" && memberName.startsWith(\"attr:\")) {\n const propName = memberName.slice(5);\n let attrName;\n {\n const hostRef = getHostRef(elm);\n if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {\n const memberMeta = hostRef.$cmpMeta$.$members$[propName];\n if (memberMeta && memberMeta[1]) {\n attrName = memberMeta[1];\n }\n }\n }\n if (!attrName) {\n attrName = propName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n }\n if (newValue == null || newValue === false) {\n if (newValue !== false || elm.getAttribute(attrName) === \"\") {\n elm.removeAttribute(attrName);\n }\n } else {\n elm.setAttribute(attrName, newValue === true ? \"\" : newValue);\n }\n return;\n } else if (memberName[0] === \"p\" && memberName.startsWith(\"prop:\")) {\n const propName = memberName.slice(5);\n try {\n elm[propName] = newValue;\n } catch (e) {\n }\n return;\n } else {\n const isComplex = isComplexType(newValue);\n if ((isProp || isComplex && newValue !== null) && !isSvg) {\n try {\n if (!elm.tagName.includes(\"-\")) {\n const n = newValue == null ? \"\" : newValue;\n if (memberName === \"list\") {\n isProp = false;\n } else if (oldValue == null || elm[memberName] !== n) {\n if (typeof elm.__lookupSetter__(memberName) === \"function\") {\n elm[memberName] = n;\n } else {\n elm.setAttribute(memberName, n);\n }\n }\n } else if (elm[memberName] !== newValue) {\n elm[memberName] = newValue;\n }\n } catch (e) {\n }\n }\n let xlink = false;\n {\n if (ln !== (ln = ln.replace(/^xlink\\:?/, \"\"))) {\n memberName = ln;\n xlink = true;\n }\n }\n if (newValue == null || newValue === false) {\n if (newValue !== false || elm.getAttribute(memberName) === \"\") {\n if (xlink) {\n elm.removeAttributeNS(XLINK_NS, memberName);\n } else {\n elm.removeAttribute(memberName);\n }\n }\n } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {\n newValue = newValue === true ? \"\" : newValue;\n if (xlink) {\n elm.setAttributeNS(XLINK_NS, memberName, newValue);\n } else {\n elm.setAttribute(memberName, newValue);\n }\n }\n }\n};\nvar parseClassListRegex = /\\s/;\nvar parseClassList = (value) => {\n if (typeof value === \"object\" && value && \"baseVal\" in value) {\n value = value.baseVal;\n }\n if (!value || typeof value !== \"string\") {\n return [];\n }\n return value.split(parseClassListRegex);\n};\nvar CAPTURE_EVENT_SUFFIX = \"Capture\";\nvar CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + \"$\");\n\n// src/runtime/vdom/update-element.ts\nvar updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {\n const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;\n const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};\n const newVnodeAttrs = newVnode.$attrs$ || {};\n {\n for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {\n if (!(memberName in newVnodeAttrs)) {\n setAccessor(\n elm,\n memberName,\n oldVnodeAttrs[memberName],\n void 0,\n isSvgMode2,\n newVnode.$flags$);\n }\n }\n }\n for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {\n setAccessor(\n elm,\n memberName,\n oldVnodeAttrs[memberName],\n newVnodeAttrs[memberName],\n isSvgMode2,\n newVnode.$flags$);\n }\n};\nfunction sortedAttrNames(attrNames) {\n return attrNames.includes(\"ref\") ? (\n // we need to sort these to ensure that `'ref'` is the last attr\n [...attrNames.filter((attr) => attr !== \"ref\"), \"ref\"]\n ) : (\n // no need to sort, return the original array\n attrNames\n );\n}\n\n// src/runtime/vdom/vdom-render.ts\nvar scopeId;\nvar contentRef;\nvar hostTagName;\nvar useNativeShadowDom = false;\nvar checkSlotFallbackVisibility = false;\nvar checkSlotRelocate = false;\nvar isSvgMode = false;\nvar refCallbacksToRemove = [];\nvar refCallbacksToAttach = [];\nvar createElm = (oldParentVNode, newParentVNode, childIndex) => {\n var _a;\n const newVNode2 = newParentVNode.$children$[childIndex];\n let i2 = 0;\n let elm;\n let childNode;\n let oldVNode;\n if (!useNativeShadowDom) {\n checkSlotRelocate = true;\n if (newVNode2.$tag$ === \"slot\") {\n newVNode2.$flags$ |= newVNode2.$children$ ? (\n // slot element has fallback content\n // still create an element that \"mocks\" the slot element\n 2 /* isSlotFallback */\n ) : (\n // slot element does not have fallback content\n // create an html comment we'll use to always reference\n // where actual slot content should sit next to\n 1 /* isSlotReference */\n );\n }\n }\n if (newVNode2.$text$ != null) {\n elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);\n } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {\n elm = newVNode2.$elm$ = win.document.createTextNode(\"\");\n {\n updateElement(null, newVNode2, isSvgMode);\n }\n } else {\n if (!isSvgMode) {\n isSvgMode = newVNode2.$tag$ === \"svg\";\n }\n if (!win.document) {\n throw new Error(\"You are trying to render a Stencil component in an environment that doesn't support the DOM.\");\n }\n elm = newVNode2.$elm$ = win.document.createElementNS(\n isSvgMode ? SVG_NS : HTML_NS,\n !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? \"slot-fb\" : newVNode2.$tag$\n ) ;\n if (isSvgMode && newVNode2.$tag$ === \"foreignObject\") {\n isSvgMode = false;\n }\n {\n updateElement(null, newVNode2, isSvgMode);\n }\n if (isDef(scopeId) && elm[\"s-si\"] !== scopeId) {\n elm.classList.add(elm[\"s-si\"] = scopeId);\n }\n if (newVNode2.$children$) {\n const appendTarget = newVNode2.$tag$ === \"template\" ? elm.content : elm;\n for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {\n childNode = createElm(oldParentVNode, newVNode2, i2);\n if (childNode) {\n appendTarget.appendChild(childNode);\n }\n }\n }\n {\n if (newVNode2.$tag$ === \"svg\") {\n isSvgMode = false;\n } else if (elm.tagName === \"foreignObject\") {\n isSvgMode = true;\n }\n }\n }\n elm[\"s-hn\"] = hostTagName;\n {\n if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {\n elm[\"s-sr\"] = true;\n elm[\"s-cr\"] = contentRef;\n elm[\"s-sn\"] = newVNode2.$name$ || \"\";\n elm[\"s-rf\"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;\n patchSlotNode(elm);\n oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];\n if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {\n relocateToHostRoot(oldParentVNode.$elm$);\n }\n {\n addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);\n }\n }\n }\n return elm;\n};\nvar relocateToHostRoot = (parentElm) => {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n const host = parentElm.closest(hostTagName.toLowerCase());\n if (host != null) {\n const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(\n (ref) => ref[\"s-cr\"]\n );\n const childNodeArray = Array.from(\n parentElm.__childNodes || parentElm.childNodes\n );\n for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {\n if (childNode[\"s-sh\"] != null) {\n insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);\n childNode[\"s-sh\"] = void 0;\n checkSlotRelocate = true;\n }\n }\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n};\nvar putBackInOriginalLocation = (parentElm, recursive) => {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);\n if (parentElm[\"s-sr\"]) {\n let node = parentElm;\n while (node = node.nextSibling) {\n if (node && node[\"s-sn\"] === parentElm[\"s-sn\"] && node[\"s-sh\"] === hostTagName) {\n oldSlotChildNodes.push(node);\n }\n }\n }\n for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {\n const childNode = oldSlotChildNodes[i2];\n if (childNode[\"s-hn\"] !== hostTagName && childNode[\"s-ol\"]) {\n insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));\n childNode[\"s-ol\"].remove();\n childNode[\"s-ol\"] = void 0;\n childNode[\"s-sh\"] = void 0;\n checkSlotRelocate = true;\n }\n if (recursive) {\n putBackInOriginalLocation(childNode, recursive);\n }\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n};\nvar addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {\n let containerElm = parentElm[\"s-cr\"] && parentElm[\"s-cr\"].parentNode || parentElm;\n let childNode;\n if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {\n containerElm = containerElm.shadowRoot;\n }\n if (parentVNode.$tag$ === \"template\") {\n containerElm = containerElm.content;\n }\n for (; startIdx <= endIdx; ++startIdx) {\n if (vnodes[startIdx]) {\n childNode = createElm(null, parentVNode, startIdx);\n if (childNode) {\n vnodes[startIdx].$elm$ = childNode;\n insertBefore(containerElm, childNode, referenceNode(before) );\n }\n }\n }\n};\nvar removeVnodes = (vnodes, startIdx, endIdx) => {\n for (let index = startIdx; index <= endIdx; ++index) {\n const vnode = vnodes[index];\n if (vnode) {\n const elm = vnode.$elm$;\n nullifyVNodeRefs(vnode);\n if (elm) {\n {\n checkSlotFallbackVisibility = true;\n if (elm[\"s-ol\"]) {\n elm[\"s-ol\"].remove();\n } else {\n putBackInOriginalLocation(elm, true);\n }\n }\n elm.remove();\n }\n }\n }\n};\nvar updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {\n let oldStartIdx = 0;\n let newStartIdx = 0;\n let idxInOld = 0;\n let i2 = 0;\n let oldEndIdx = oldCh.length - 1;\n let oldStartVnode = oldCh[0];\n let oldEndVnode = oldCh[oldEndIdx];\n let newEndIdx = newCh.length - 1;\n let newStartVnode = newCh[0];\n let newEndVnode = newCh[newEndIdx];\n let node;\n let elmToMove;\n const containerElm = newVNode2.$tag$ === \"template\" ? parentElm.content : parentElm;\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (oldStartVnode == null) {\n oldStartVnode = oldCh[++oldStartIdx];\n } else if (oldEndVnode == null) {\n oldEndVnode = oldCh[--oldEndIdx];\n } else if (newStartVnode == null) {\n newStartVnode = newCh[++newStartIdx];\n } else if (newEndVnode == null) {\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {\n patch(oldStartVnode, newStartVnode, isInitialRender);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {\n patch(oldEndVnode, newEndVnode, isInitialRender);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {\n if ((oldStartVnode.$tag$ === \"slot\" || newEndVnode.$tag$ === \"slot\")) {\n putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);\n }\n patch(oldStartVnode, newEndVnode, isInitialRender);\n insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {\n if ((oldStartVnode.$tag$ === \"slot\" || newEndVnode.$tag$ === \"slot\")) {\n putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);\n }\n patch(oldEndVnode, newStartVnode, isInitialRender);\n insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n } else {\n idxInOld = -1;\n {\n for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {\n if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {\n idxInOld = i2;\n break;\n }\n }\n }\n if (idxInOld >= 0) {\n elmToMove = oldCh[idxInOld];\n if (elmToMove.$tag$ !== newStartVnode.$tag$) {\n node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);\n } else {\n patch(elmToMove, newStartVnode, isInitialRender);\n oldCh[idxInOld] = void 0;\n node = elmToMove.$elm$;\n }\n newStartVnode = newCh[++newStartIdx];\n } else {\n node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);\n newStartVnode = newCh[++newStartIdx];\n }\n if (node) {\n {\n insertBefore(\n referenceNode(oldStartVnode.$elm$).parentNode,\n node,\n referenceNode(oldStartVnode.$elm$)\n );\n }\n }\n }\n }\n if (oldStartIdx > oldEndIdx) {\n addVnodes(\n parentElm,\n newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,\n newVNode2,\n newCh,\n newStartIdx,\n newEndIdx\n );\n } else if (newStartIdx > newEndIdx) {\n removeVnodes(oldCh, oldStartIdx, oldEndIdx);\n }\n};\nvar isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {\n if (leftVNode.$tag$ === rightVNode.$tag$) {\n if (leftVNode.$tag$ === \"slot\") {\n return leftVNode.$name$ === rightVNode.$name$;\n }\n if (!isInitialRender) {\n return leftVNode.$key$ === rightVNode.$key$;\n }\n if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {\n leftVNode.$key$ = rightVNode.$key$;\n }\n return true;\n }\n return false;\n};\nvar referenceNode = (node) => node && node[\"s-ol\"] || node;\nvar patch = (oldVNode, newVNode2, isInitialRender = false) => {\n const elm = newVNode2.$elm$ = oldVNode.$elm$;\n const oldChildren = oldVNode.$children$;\n const newChildren = newVNode2.$children$;\n const tag = newVNode2.$tag$;\n const text = newVNode2.$text$;\n let defaultHolder;\n if (text == null) {\n {\n isSvgMode = tag === \"svg\" ? true : tag === \"foreignObject\" ? false : isSvgMode;\n }\n {\n if (tag === \"slot\" && !useNativeShadowDom) {\n if (oldVNode.$name$ !== newVNode2.$name$) {\n newVNode2.$elm$[\"s-sn\"] = newVNode2.$name$ || \"\";\n relocateToHostRoot(newVNode2.$elm$.parentElement);\n }\n }\n updateElement(oldVNode, newVNode2, isSvgMode);\n }\n if (oldChildren !== null && newChildren !== null) {\n updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);\n } else if (newChildren !== null) {\n if (oldVNode.$text$ !== null) {\n elm.textContent = \"\";\n }\n addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);\n } else if (\n // don't do this on initial render as it can cause non-hydrated content to be removed\n !isInitialRender && BUILD.updatable && oldChildren !== null\n ) {\n removeVnodes(oldChildren, 0, oldChildren.length - 1);\n } else ;\n if (isSvgMode && tag === \"svg\") {\n isSvgMode = false;\n }\n } else if ((defaultHolder = elm[\"s-cr\"])) {\n defaultHolder.parentNode.textContent = text;\n } else if (oldVNode.$text$ !== text) {\n elm.data = text;\n }\n};\nvar relocateNodes = [];\nvar markSlotContentForRelocation = (elm) => {\n let node;\n let hostContentNodes;\n let j;\n const children = elm.__childNodes || elm.childNodes;\n for (const childNode of children) {\n if (childNode[\"s-sr\"] && (node = childNode[\"s-cr\"]) && node.parentNode) {\n hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;\n const slotName = childNode[\"s-sn\"];\n for (j = hostContentNodes.length - 1; j >= 0; j--) {\n node = hostContentNodes[j];\n if (!node[\"s-cn\"] && !node[\"s-nr\"] && node[\"s-hn\"] !== childNode[\"s-hn\"] && (!node[\"s-sh\"] || node[\"s-sh\"] !== childNode[\"s-hn\"])) {\n if (isNodeLocatedInSlot(node, slotName)) {\n let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);\n checkSlotFallbackVisibility = true;\n node[\"s-sn\"] = node[\"s-sn\"] || slotName;\n if (relocateNodeData) {\n relocateNodeData.$nodeToRelocate$[\"s-sh\"] = childNode[\"s-hn\"];\n relocateNodeData.$slotRefNode$ = childNode;\n } else {\n node[\"s-sh\"] = childNode[\"s-hn\"];\n relocateNodes.push({\n $slotRefNode$: childNode,\n $nodeToRelocate$: node\n });\n }\n if (node[\"s-sr\"]) {\n relocateNodes.map((relocateNode) => {\n if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node[\"s-sn\"])) {\n relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);\n if (relocateNodeData && !relocateNode.$slotRefNode$) {\n relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;\n }\n }\n });\n }\n } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {\n relocateNodes.push({\n $nodeToRelocate$: node\n });\n }\n }\n }\n }\n if (childNode.nodeType === 1 /* ElementNode */) {\n markSlotContentForRelocation(childNode);\n }\n }\n};\nvar nullifyVNodeRefs = (vNode) => {\n {\n if (vNode.$attrs$ && vNode.$attrs$.ref) {\n refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));\n }\n vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);\n }\n};\nvar queueRefAttachment = (refCallback, elm) => {\n {\n refCallbacksToAttach.push(() => refCallback(elm));\n }\n};\nvar flushQueuedRefCallbacks = () => {\n {\n refCallbacksToRemove.forEach((cb) => cb());\n refCallbacksToRemove.length = 0;\n refCallbacksToAttach.forEach((cb) => cb());\n refCallbacksToAttach.length = 0;\n }\n};\nvar insertBefore = (parent, newNode, reference, isInitialLoad) => {\n {\n if (typeof newNode[\"s-sn\"] === \"string\" && !!newNode[\"s-sr\"] && !!newNode[\"s-cr\"]) {\n addRemoveSlotScopedClass(newNode[\"s-cr\"], newNode, parent, newNode.parentElement);\n } else if (typeof newNode[\"s-sn\"] === \"string\") {\n parent.insertBefore(newNode, reference);\n const { slotNode } = findSlotFromSlottedNode(newNode);\n if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);\n return newNode;\n }\n }\n if (parent.__insertBefore) {\n return parent.__insertBefore(newNode, reference);\n } else {\n return parent == null ? void 0 : parent.insertBefore(newNode, reference);\n }\n};\nfunction addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {\n var _a, _b;\n let scopeId2;\n if (reference && typeof slotNode[\"s-sn\"] === \"string\" && !!slotNode[\"s-sr\"] && reference.parentNode && reference.parentNode[\"s-sc\"] && (scopeId2 = slotNode[\"s-si\"] || reference.parentNode[\"s-sc\"])) {\n const scopeName = slotNode[\"s-sn\"];\n const hostName = slotNode[\"s-hn\"];\n (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + \"-s\");\n if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + \"-s\"))) {\n let child = (oldParent.__childNodes || oldParent.childNodes)[0];\n let found = false;\n while (child) {\n if (child[\"s-sn\"] !== scopeName && child[\"s-hn\"] === hostName && !!child[\"s-sr\"]) {\n found = true;\n break;\n }\n child = child.nextSibling;\n }\n if (!found) oldParent.classList.remove(scopeId2 + \"-s\");\n }\n }\n}\nvar renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {\n var _a, _b, _c, _d, _e;\n const hostElm = hostRef.$hostElement$;\n const cmpMeta = hostRef.$cmpMeta$;\n const oldVNode = hostRef.$vnode$ || newVNode(null, null);\n const isHostElement = isHost(renderFnResults);\n const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);\n hostTagName = hostElm.tagName;\n if (cmpMeta.$attrsToReflect$) {\n rootVnode.$attrs$ = rootVnode.$attrs$ || {};\n cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {\n if (BUILD.serializer && hostRef.$serializerValues$.has(propName)) {\n rootVnode.$attrs$[attribute] = hostRef.$serializerValues$.get(propName);\n } else {\n rootVnode.$attrs$[attribute] = hostElm[propName];\n }\n });\n }\n if (isInitialLoad && rootVnode.$attrs$) {\n for (const key of Object.keys(rootVnode.$attrs$)) {\n if (hostElm.hasAttribute(key) && ![\"key\", \"ref\", \"style\", \"class\"].includes(key)) {\n rootVnode.$attrs$[key] = hostElm[key];\n }\n }\n }\n rootVnode.$tag$ = null;\n rootVnode.$flags$ |= 4 /* isHost */;\n hostRef.$vnode$ = rootVnode;\n rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;\n {\n scopeId = hostElm[\"s-sc\"];\n }\n useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);\n {\n contentRef = hostElm[\"s-cr\"];\n checkSlotFallbackVisibility = false;\n }\n patch(oldVNode, rootVnode, isInitialLoad);\n {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n if (checkSlotRelocate) {\n markSlotContentForRelocation(rootVnode.$elm$);\n for (const relocateData of relocateNodes) {\n const nodeToRelocate = relocateData.$nodeToRelocate$;\n if (!nodeToRelocate[\"s-ol\"] && win.document) {\n const orgLocationNode = win.document.createTextNode(\"\");\n orgLocationNode[\"s-nr\"] = nodeToRelocate;\n insertBefore(\n nodeToRelocate.parentNode,\n nodeToRelocate[\"s-ol\"] = orgLocationNode,\n nodeToRelocate,\n isInitialLoad\n );\n }\n }\n for (const relocateData of relocateNodes) {\n const nodeToRelocate = relocateData.$nodeToRelocate$;\n const slotRefNode = relocateData.$slotRefNode$;\n if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {\n nodeToRelocate[\"s-ih\"] = (_a = nodeToRelocate.hidden) != null ? _a : false;\n }\n if (slotRefNode) {\n const parentNodeRef = slotRefNode.parentNode;\n let insertBeforeNode = slotRefNode.nextSibling;\n if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {\n let orgLocationNode = (_b = nodeToRelocate[\"s-ol\"]) == null ? void 0 : _b.previousSibling;\n while (orgLocationNode) {\n let refNode = (_c = orgLocationNode[\"s-nr\"]) != null ? _c : null;\n if (refNode && refNode[\"s-sn\"] === nodeToRelocate[\"s-sn\"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {\n refNode = refNode.nextSibling;\n while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode[\"s-sr\"])) {\n refNode = refNode == null ? void 0 : refNode.nextSibling;\n }\n if (!refNode || !refNode[\"s-nr\"]) {\n insertBeforeNode = refNode;\n break;\n }\n }\n orgLocationNode = orgLocationNode.previousSibling;\n }\n }\n const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;\n const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;\n if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {\n if (nodeToRelocate !== insertBeforeNode) {\n insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);\n if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith(\"s-nt-\")) {\n const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, \"\"));\n textNode[\"s-hn\"] = nodeToRelocate[\"s-hn\"];\n textNode[\"s-sn\"] = nodeToRelocate[\"s-sn\"];\n textNode[\"s-sh\"] = nodeToRelocate[\"s-sh\"];\n textNode[\"s-sr\"] = nodeToRelocate[\"s-sr\"];\n textNode[\"s-ol\"] = nodeToRelocate[\"s-ol\"];\n textNode[\"s-ol\"][\"s-nr\"] = textNode;\n insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);\n nodeToRelocate.parentNode.removeChild(nodeToRelocate);\n }\n if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== \"SLOT-FB\") {\n nodeToRelocate.hidden = (_d = nodeToRelocate[\"s-ih\"]) != null ? _d : false;\n }\n }\n }\n nodeToRelocate && typeof slotRefNode[\"s-rf\"] === \"function\" && slotRefNode[\"s-rf\"](slotRefNode);\n } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {\n nodeToRelocate.hidden = true;\n }\n }\n }\n if (checkSlotFallbackVisibility) {\n updateFallbackSlotVisibility(rootVnode.$elm$);\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n relocateNodes.length = 0;\n }\n if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm[\"s-cr\"]) {\n const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;\n for (const childNode of children) {\n if (childNode[\"s-hn\"] !== hostTagName && !childNode[\"s-sh\"]) {\n if (isInitialLoad && childNode[\"s-ih\"] == null) {\n childNode[\"s-ih\"] = (_e = childNode.hidden) != null ? _e : false;\n }\n if (childNode.nodeType === 1 /* ElementNode */) {\n childNode.hidden = true;\n } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {\n const textCommentNode = win.document.createComment(\"s-nt-\" + childNode.nodeValue);\n textCommentNode[\"s-sn\"] = childNode[\"s-sn\"];\n insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);\n childNode.parentNode.removeChild(childNode);\n }\n }\n }\n }\n contentRef = void 0;\n flushQueuedRefCallbacks();\n};\n\n/**\n * @type {import('htmlfy').Config}\n */\nconst CONFIG = {\n content_wrap: 0,\n ignore: [],\n ignore_with: '!i-£___£%_',\n strict: false,\n tab_size: 2,\n tag_wrap: 0,\n trim: []\n};\n\nconst VOID_ELEMENTS = [\n 'area', 'base', 'br', 'col', 'embed', 'hr', \n 'img', 'input', 'link', 'meta',\n 'param', 'source', 'track', 'wbr'\n];\n\n/**\n * Defined by state.js and configuration.\n * \n * CONTENT_IGNORE_PLACEHOLDER\n * SELF_CLOSING_PLACEHOLDER\n * ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n\n/**\n * @typedef {object} Constants\n * @property {string} CONTENT_IGNORE_PLACEHOLDER\n * @property {string} SELF_CLOSING_PLACEHOLDER\n * @property {string} ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n/**\n * @typedef {object} State\n * @property {boolean} checked_html - If passed in HTML has been checked for HTML within it.\n * @property {import(\"htmlfy\").Config} config - Validated configuration.\n * @property {boolean} ignored\n * @property {Constants} constants - Constant strings, influenced by ignore_with.\n */\n\n/**\n * @type State\n * \n * `constants` prefixes and suffixes must be in sync with those in utils.js\n */\nconst state = {\n checked_html: false,\n config: { ...CONFIG },\n ignored: false,\n constants: {\n CONTENT_IGNORE_PLACEHOLDER: `${CONFIG.ignore_with}_`,\n SELF_CLOSING_PLACEHOLDER: `${CONFIG.ignore_with}/_>`,\n ATTRIBUTE_IGNORE_PLACEHOLDER: `${CONFIG.ignore_with}=_`\n }\n};\n\n/**\n * \n * @returns {State}\n */\nconst getState = () => state;\n\n/**\n * \n * @param {Partial<State>} new_state \n */\nconst setState = (new_state) => Object.assign(state, new_state);\n\n/**\n * Checks if content contains at least one HTML element or custom HTML element.\n * \n * The first regex matches void and self-closing elements.\n * The second regex matches normal HTML elements, plus they can have a namespace.\n * The third regex matches custom HTML elemtns, plus they can have a namespace.\n * \n * HTML elements should begin with a letter, and can end with a letter or number.\n * \n * Custom elements must begin with a letter, and can end with a letter, number,\n * hyphen, underscore, or period. However, all letters must be lowercase.\n * They must have at least one hyphen, and can only have periods and underscores if there is a hyphen.\n * \n * These regexes are based on\n * https://w3c.github.io/html-reference/syntax.html#tag-name\n * and\n * https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * respectively.\n * \n * @param {string} content Content to evaluate.\n * @returns {boolean} A boolean.\n */\nconst isHtml = (content) => {\n setState({ checked_html: true });\n\n return /<(?:[A-Za-z]+[A-Za-z0-9]*)(?:\\s+.*?)*?\\/{0,1}>/.test(content) ||\n /<(?<Element>(?:[A-Za-z]+[A-Za-z0-9]*:)?(?:[A-Za-z]+[A-Za-z0-9]*))(?:\\s+.*?)*?>(?:.|\\n)*?<\\/{1}\\k<Element>>/.test(content) || \n /<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\\s+.*?)*?>(?:.|\\n)*?<\\/{1}\\k<Element>>/.test(content)\n};\n\n/**\n * Generic utility which merges two objects.\n * \n * @param {any} current Original object.\n * @param {any} updates Object to merge with original.\n * @returns {any}\n */\nconst mergeObjects = (current, updates) => {\n if (!current || !updates)\n throw new Error(\"Both 'current' and 'updates' must be passed-in to mergeObjects()\")\n\n /**\n * @type {any}\n */\n let merged;\n \n if (Array.isArray(current)) {\n merged = structuredClone(current).concat(updates);\n } else if (typeof current === 'object') {\n merged = { ...current };\n for (let key of Object.keys(updates)) {\n if (typeof updates[key] !== 'object') {\n merged[key] = updates[key];\n } else {\n /* key is an object, run mergeObjects again. */\n merged[key] = mergeObjects(merged[key] || {}, updates[key]);\n }\n }\n }\n\n return merged\n};\n\n/**\n * Merge a user config with the default config.\n * \n * @param {import('htmlfy').Config} default_config The default config.\n * @param {import('htmlfy').UserConfig} config The user config.\n * @returns {import('htmlfy').Config}\n */\nconst mergeConfig = (default_config, config) => {\n const validated_config = mergeObjects(default_config, config);\n\n /* Below `constants` prefixes and suffixes must be in sync with those in state.js */\n setState({ \n config: validated_config,\n constants: {\n CONTENT_IGNORE_PLACEHOLDER: `${validated_config.ignore_with}_`,\n SELF_CLOSING_PLACEHOLDER: `${validated_config.ignore_with}/_>`,\n ATTRIBUTE_IGNORE_PLACEHOLDER: `${validated_config.ignore_with}=_`\n }\n });\n return validated_config\n};\n\n/**\n * \n * @param {string} html \n */\nconst protectAttributes = (html) => {\n const { constants } = getState();\n\n html = html.replace(/<[\\w:\\-]+([^>]*[^\\/])>/g, (/** @type {string} */match, /** @type {any} */capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(/\\n/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'ws!')\n })\n });\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst protectContent = (html) => {\n const { constants } = getState();\n\n return html\n .replace(/\\n/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'ws!')\n};\n\n/**\n * \n * @param {string} html \n */\nconst finalProtectContent = (html) => {\n const regex = /\\s*<([a-zA-Z0-9:-]+)[^>]*>\\n\\s*<\\/\\1>(?=\\n[ ]*[^\\n]*__!i-£___£%__[^\\n]*\\n)(\\n[ ]*\\S[^\\n]*\\n)|<([a-zA-Z0-9:-]+)[^>]*>(?=\\n[ ]*[^\\n]*__!i-£___£%__[^\\n]*\\n)(\\n[ ]*\\S[^\\n]*\\n\\s*)<\\/\\3>/g; \n const { constants } = getState();\n\n return html\n .replace(regex, (/** @type {string} */match, p1, p2, p3, p4) => {\n const text_to_protect = p2 || p4;\n\n if (!text_to_protect)\n return match\n\n const protected_text = text_to_protect\n .replace(/\\n/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.CONTENT_IGNORE_PLACEHOLDER + \"ws!\");\n\n return match.replace(text_to_protect, protected_text)\n })\n};\n\n/**\n * Replace html brackets with ignore string.\n * \n * @param {string} html \n * @returns {string}\n */\nconst setIgnoreAttribute = (html) => {\n const regex = /<([A-Za-z][A-Za-z0-9]*|[a-z][a-z0-9._]*-[a-z0-9._-]+)((?:\\s+[A-Za-z0-9_-]+=\"[^\"]*\"|\\s*[a-z]*)*)>/g; \n const { constants } = getState();\n\n html = html.replace(regex, (/** @type {string} */match, p1, p2) => {\n return match.replace(p2, (match) => {\n return match\n .replace(/</g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'lt!')\n .replace(/>/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'gt!')\n })\n });\n \n return html\n};\n\n/**\n * Trim leading and trailing whitespace characters.\n * \n * @param {string} html\n * @param {string[]} trim\n * @returns {string}\n */\nconst trimify = (html, trim) => {\n for (let e = 0; e < trim.length; e++) {\n /* Whitespace character must be escaped with '\\' or RegExp() won't include it. */\n const leading_whitespace = new RegExp(`(<${trim[e]}[^>]*>)\\\\s+`, \"g\");\n const trailing_whitespace = new RegExp(`\\\\s+(</${trim[e]}>)`, \"g\");\n\n html = html\n .replace(leading_whitespace, '$1')\n .replace(trailing_whitespace, '$1');\n }\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst unprotectAttributes = (html) => {\n const { constants } = getState();\n\n html = html.replace(/<[\\w:\\-]+([^>]*[^\\/])>/g, (/** @type {string} */match, /** @type {any} */capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'nl!', \"g\"), '\\n')\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'cr!', \"g\"), '\\r')\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'ws!', \"g\"), ' ')\n })\n });\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst unprotectContent = (html) => {\n const { constants } = getState();\n\n html = html.replace(new RegExp(`.*${constants.CONTENT_IGNORE_PLACEHOLDER}[a-z]{2}!.*`, \"g\"), (/** @type {string} */match) => {\n return match.replace(new RegExp(`${constants.CONTENT_IGNORE_PLACEHOLDER}[a-z]{2}!`, \"g\"), (match) => {\n return match\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!', \"g\"), '\\n')\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!', \"g\"), '\\r')\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'ws!', \"g\"), ' ')\n })\n });\n\n return html\n};\n\n/**\n * Replace ignore string with html brackets.\n * \n * @param {string} html \n * @returns {string}\n */\nconst unsetIgnoreAttribute = (html) => {\n /* Regex to find opening tags and capture their attributes. */\n const tagRegex = /<([\\w:\\-]+)([^>]*)>/g;\n const { constants } = getState();\n const escapedIgnoreString = constants.ATTRIBUTE_IGNORE_PLACEHOLDER.replace(\n /[-\\/\\\\^$*+?.()|[\\]{}]/g,\n \"\\\\$&\"\n );\n const ltPlaceholderRegex = new RegExp(escapedIgnoreString + \"lt!\", \"g\");\n const gtPlaceholderRegex = new RegExp(escapedIgnoreString + \"gt!\", \"g\");\n\n return html.replace(\n tagRegex,\n (\n /** @type {string} */ fullMatch,\n /** @type {string} */ tagName,\n /** @type {string} */ attributesCapture\n ) => {\n const processedAttributes = attributesCapture\n .replace(ltPlaceholderRegex, \"<\")\n .replace(gtPlaceholderRegex, \">\");\n\n /* Reconstruct the tag. */\n return `<${tagName}${processedAttributes}>`\n }\n )\n};\n\n/**\n * Validate any passed-in config options and merge with CONFIG.\n * \n * @param {import('htmlfy').UserConfig} config A user config.\n * @returns {import('htmlfy').Config} A validated config.\n */\nconst validateConfig = (config) => {\n if (typeof config !== 'object') throw new Error('Config must be an object.')\n \n const default_config = { ...CONFIG };\n\n const config_empty = !(\n Object.hasOwn(config, 'content_wrap') ||\n Object.hasOwn(config, 'ignore') || \n Object.hasOwn(config, 'ignore_with') || \n Object.hasOwn(config, 'strict') || \n Object.hasOwn(config, 'tab_size') || \n Object.hasOwn(config, 'tag_wrap') || \n Object.hasOwn(config, 'trim')\n );\n\n if (config_empty) {\n setState({ config: default_config });\n return default_config\n }\n\n let tab_size = config.tab_size;\n\n if (tab_size) {\n if (typeof tab_size !== 'number') throw new Error(`tab_size must be a number, not ${typeof config.tab_size}.`)\n\n const safe = Number.isSafeInteger(tab_size);\n if (!safe) throw new Error(`Tab size ${tab_size} is not safe. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger for more info.`)\n\n /** \n * Round down, just in case a safe floating point,\n * like 4.0, was passed.\n */\n tab_size = Math.floor(tab_size);\n if (tab_size < 1 || tab_size > 16) throw new Error('Tab size out of range. Expecting 1 to 16.')\n \n config.tab_size = tab_size;\n }\n\n if (Object.hasOwn(config, 'content_wrap') && typeof config.content_wrap !== 'number')\n throw new Error(`content_wrap config must be a number, not ${typeof config.content_wrap}.`)\n\n if (Object.hasOwn(config, 'ignore') && (!Array.isArray(config.ignore) || !config.ignore?.every((e) => typeof e === 'string')))\n throw new Error('Ignore config must be an array of strings.')\n\n if (Object.hasOwn(config, 'ignore_with')) {\n if (typeof config.ignore_with !== 'string')\n throw new Error(`ignore_with must be a string, not ${typeof config.ignore_with}.`)\n else if (config.ignore_with.startsWith('_'))\n /**\n * This negatively affects processing of preserved tag attributes,\n * because tag names can end with an underscore, so the regex\n * does not capture them.\n */\n throw new Error(`ignore_with cannot start with an underscore.`)\n }\n\n if (Object.hasOwn(config, 'strict') && typeof config.strict !== 'boolean')\n throw new Error(`Strict config must be a boolean, not ${typeof config.strict}.`)\n \n if (Object.hasOwn(config, 'tag_wrap') && typeof config.tag_wrap !== 'number')\n throw new Error(`tag_wrap config must be a number, not ${typeof config.tag_wrap}.`)\n\n if (Object.hasOwn(config, 'trim') && (!Array.isArray(config.trim) || !config.trim?.every((e) => typeof e === 'string')))\n throw new Error('Trim config must be an array of strings.')\n\n return mergeConfig(default_config, config)\n\n};\n\n/**\n * \n * @param {string} text \n * @param {number} width \n * @param {string} indent\n */\nconst wordWrap = (text, width, indent) => {\n const words = text.trim().split(/\\s+/);\n \n if (words.length === 0 || (words.length === 1 && words[0] === ''))\n return \"\"\n\n const lines = [];\n let current_line = \"\";\n const padding_string = indent;\n\n words.forEach((word) => {\n if (word === \"\") return\n\n if (word.length >= width) {\n /* If there's content on the current line, push it first with correct padding. */\n if (current_line !== \"\")\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n\n /* Push a long word on its own line with correct padding. */\n lines.push(lines.length === 0 ? indent + word : padding_string + word);\n current_line = \"\"; // Reset current line\n return // Move to the next word\n }\n\n /* Check if adding the next word exceeds the wrap width. */\n const test_line = current_line === \"\" ? word : current_line + \" \" + word;\n\n if (test_line.length <= width) {\n current_line = test_line;\n } else {\n /* Word doesn't fit, finish the current line and push it. */\n if (current_line !== \"\") {\n /* Add padding based on whether it's the first line added or not. */\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n }\n /* Start a new line with the current word. */\n current_line = word;\n }\n });\n\n /* Add the last remaining line with appropriate padding. */\n if (current_line !== \"\")\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n\n const result = lines.join(\"\\n\");\n\n return protectContent(result)\n};\n\n/**\n * Extract any HTML blocks to be ignored,\n * and replace them with a placeholder\n * for re-insertion later.\n * \n * @param {string} html \n * @returns {{ html_with_markers: string, extracted_map: Map<any,any> }}\n */\nfunction extractIgnoredBlocks(html) {\n setState({ ignored: true });\n const config = (getState()).config;\n let current_html = html;\n const extracted_blocks = new Map();\n let marker_id = 0;\n const MARKER_PREFIX = \"___HTMLFY_SPECIAL_IGNORE_MARKER_\";\n\n for (const tag of config.ignore) {\n /* Ensure tag is escaped if it can contain regex special chars. */\n const safe_tag_name = tag.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n\n const regex = new RegExp(\n `(<\\\\s*${safe_tag_name}[^>]*>)(.*?)(<\\\\s*\\/\\\\s*${safe_tag_name}\\\\s*>)`,\n \"gs\" // global and dotAll\n );\n\n /** @type RegExpExecArray | null */\n let match;\n\n /**\n * @type {{ start: number; end: number; marker: string }[]}\n */\n const replacements = [];\n\n while ((match = regex.exec(current_html)) !== null) {\n const marker = `${MARKER_PREFIX}${marker_id++}___`;\n\n /* Only store content, and minify tags later. */\n extracted_blocks.set(marker, match[2]);\n \n replacements.push({\n start: match.index + match[1].length, // start of content\n end: match.index + match[1].length + match[2].length, // end of content\n marker: marker,\n });\n }\n\n /* Apply replacements from the end to the beginning to keep indices valid. */\n for (let i = replacements.length - 1; i >= 0; i--) {\n const rep = replacements[i];\n current_html =\n current_html.substring(0, rep.start) +\n rep.marker +\n current_html.substring(rep.end);\n }\n }\n\n return { html_with_markers: current_html, extracted_map: extracted_blocks }\n}\n\n/**\n * Re-insert ignored HTML blocks.\n * \n * @param {string} html_with_markers \n * @param {Map<any,any>} extracted_map \n * @returns \n */\nfunction reinsertIgnoredBlocks(html_with_markers, extracted_map) {\n setState({ ignored: false });\n let final_html = html_with_markers;\n\n for (const [marker, original_block] of extracted_map) {\n final_html = final_html.split(marker).join(original_block);\n }\n return final_html\n}\n\nconst void_element_regex = new RegExp(`<(${VOID_ELEMENTS.join(\"|\")})(?:\\\\s(?:[^/>]|/(?!>))*)*>`, 'g');\n\n/**\n * Add a placeholder for void elements that are not self-closing.\n * This is for internal processing only.\n * \n * @param {string} html \n * @returns \n */\nfunction setSelfClosing(html) {\n const { constants } = getState();\n\n return html.replace(\n // match only void elements that are not self-closing\n void_element_regex,\n match => match.replace(/>$/, constants.SELF_CLOSING_PLACEHOLDER)\n )\n}\n\n/**\n * Remove internal placeholder for non-native self-closing void elements.\n * \n * @param {string} html \n * @returns \n */\nfunction unsetSelfClosing(html) {\n const { constants } = getState();\n\n return html.replace(constants.SELF_CLOSING_PLACEHOLDER, \">\")\n}\n\n/**\n * Enforce entity characters for textarea content.\n * To also minifiy tags, pass `minify` as `true`.\n * \n * @param {string} html The HTML string to evaluate.\n * @param {boolean} [minify] Minifies the textarea tags themselves. \n * Defaults to `false`. We recommend a value of `true` if you're running `entify()` \n * as a standalone function.\n * @returns {string}\n * @example <textarea>3 > 2</textarea> => <textarea>3&nbsp;&gt;&nbsp;2</textarea>\n * @example With minify.\n * <textarea >3 > 2</textarea> => <textarea>3&nbsp;&gt;&nbsp;2</textarea>\n */\nconst entify = (html, minify = false) => {\n /** \n * Use entities inside textarea content.\n */\n html = html.replace(/<\\s*textarea[^>]*>((.|\\n)*?)<s*\\/\\s*textarea\\s*>/g, (match, capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&apos;')\n .replace(/\\n/g, '&#10;')\n .replace(/\\r/g, '&#13;')\n .replace(/\\s/g, '&nbsp;')\n })\n });\n\n if (minify) {\n html = html.replace(/<\\s*textarea[^>]*>(.|\\n)*?<\\s*\\/\\s*textarea\\s*>/g, (match) => {\n /* This only affects the html tags, since everything else has been entified. */\n return match\n .replace(/\\s+/g, ' ')\n .replace(/\\s>/g, '>')\n .replace(/>\\s/g, '>')\n .replace(/\\s</g, '<')\n .replace(/<\\s/g, '<')\n .replace(/<\\/\\s/g, '<\\/')\n .replace(/class=[\"']\\s/g, (match) => match.replace(/\\s/g, ''))\n .replace(/(class=.*)\\s([\"'])/g, '$1'+'$2')\n });\n }\n\n return html\n};\n\n/**\n * Remove entity characters for textarea content.\n * Currently internal use only.\n * \n * @param {string} html The HTML string to evaluate.\n * @returns {string}\n * @example <textarea>3&nbsp;&gt;&nbsp;2</textarea> => <textarea>3 > 2</textarea>\n */\nconst dentify = (html) => {\n /** \n * Remove entities inside textarea content.\n */\n return html = html.replace(/<textarea[^>]*>((.|\\n)*?)<\\/textarea>/g, (match, capture) => {\n return match.replace(capture, (match) => {\n match = match\n .replace(/&lt;/g, '<')\n .replace(/&gt;/g, '>')\n .replace(/&quot;/g, '\"')\n .replace(/&apos;/g, \"'\")\n .replace(/&#10;/g, '\\n')\n .replace(/&#13;/g, '\\r')\n .replace(/&nbsp;/g, ' ')\n // Ensure we collapse consecutive spaces, or they'll be completely removed later.\n .replace(/\\s+/g, ' ');\n\n return match\n })\n })\n};\n\n/**\n * @type {Map<any,any>}\n */\nlet ignore_map$1;\n\n/**\n * Creates a single-line HTML string\n * by removing line returns, tabs, and relevant spaces.\n * \n * @param {string} html The HTML string to minify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A minified HTML string.\n */\nconst minify = (html, config) => {\n let reinsert_ignored = false;\n const { checked_html, ignored, constants } = getState();\n\n if (!checked_html && !isHtml(html)) return html\n\n const validated_config = (getState()).config;\n const ignore = validated_config.ignore.length > 0;\n\n /* Extract ignored elements. Skipped if prettify has already ignored blocks. */\n if (!ignored && ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html);\n html = html_with_markers;\n ignore_map$1 = extracted_map;\n reinsert_ignored = true;\n }\n\n /**\n * Ensure textarea content is protected\n * before general minification.\n */\n html = entify(html, true);\n\n /* All other minification. */\n // Remove ALL newlines and tabs explicitly.\n html = html.replace(/\\n|\\t/g, '');\n\n // Remove whitespace ONLY between tags.\n html = html.replace(/>\\s+</g, \"><\");\n\n // Collapse any remaining multiple spaces to single spaces.\n html = html.replace(/ {2,}/g, ' ');\n\n // Protect space between text content and an opening tag (e.g., \"text <a>\")\n html = html.replace(\n /(\\S) (<[a-zA-Z][a-zA-Z0-9_:-]*)/g,\n `$1___MINIFY-PROTECTED-SPACE___$2`\n );\n\n // Protect space between a closing tag and text content (e.g., \"</a> text\")\n html = html.replace(\n /(<\\/[a-zA-Z][a-zA-Z0-9_:-]*>) (\\S)/g,\n `$1___MINIFY-PROTECTED-SPACE___$2`\n );\n\n // Remove specific single spaces between tags and whitespace within tags.\n html = html.replace(/ >/g, \">\"); // <tag > -> <tag>\n html = html.replace(/ </g, \"<\"); // leading space before tag\n html = html.replace(/> /g, \">\"); // trailing space after tag\n html = html.replace(/< /g, \"<\"); // < tag> -> <tag>\n html = html.replace(/<\\s+\\//g, '</'); // < /tag> -> </tag>\n html = html.replace(/<\\/\\s+/g, '</'); // </ tag> -> </tag>\n\n // Unprotect space around inner tags\n html = html.replace(new RegExp('___MINIFY-PROTECTED-SPACE___', 'g'), ' ');\n\n // Trim spaces around equals signs in attributes (run before value trim)\n // This handles `attr = \"value\"` -> `attr=\"value\"`\n html = html.replace(/ = /g, \"=\");\n // Consider safer alternatives if needed (e.g., / = \"/g, '=\"')\n\n // Trim whitespace inside attribute values\n html = html.replace(\n /([a-zA-Z0-9_-]+)=(['\"])(.*?)\\2/g,\n (match, attr_name, quote, value) => {\n // value.trim() handles both leading/trailing spaces\n // and cases where the value is only whitespace (becomes empty string)\n const trimmed_value = value.trim();\n return `${attr_name}=${quote}${trimmed_value}${quote}`\n }\n );\n\n // Final trim for the whole string\n html = html.trim();\n\n /* Remove protective entities. */\n html = dentify(html);\n\n /* Re-insert ignored elements. Skipped unless minify did the ignore. */\n if (reinsert_ignored) {\n html = reinsertIgnoredBlocks(html, ignore_map$1);\n }\n\n return html\n};\n\n/**\n * @type {{ line: Record<string,string>[] }}\n */\nconst convert = {\n line: []\n};\n\n/**\n * @type {Map<any,any>}\n */\nlet ignore_map;\n\n/**\n * Isolate tags, content, and comments.\n * \n * @param {string} html The HTML string to evaluate.\n * @example <div>Hello World!</div> => \n * [#-# : 0 : <div> : #-#]\n * Hello World!\n * [#-# : 1 : </div> : #-#]\n */\nconst enqueue = (html) => {\n convert.line = [];\n let i = -1;\n /* Regex to find tags OR text content between tags. */\n const regex = /(<[^>]+>)|([^<]+)/g;\n\n html.replace(regex, (match, c1, c2) => {\n if (c1) {\n convert.line.push({ type: \"tag\", value: match });\n } else if (c2 && c2.trim().length > 0) {\n /* It's text content (and not just whitespace). */\n convert.line.push({ type: \"text\", value: match });\n }\n\n i++;\n return `\\n[#-# : ${i} : ${match} : #-#]\\n`\n });\n};\n\n/**\n * Process enqueued content.\n * \n * @returns {string}\n */\nconst process = () => {\n const { config, constants } = getState();\n const step = \" \".repeat(config.tab_size);\n const tag_wrap = config.tag_wrap;\n const content_wrap = config.content_wrap;\n const strict = config.strict;\n\n /* Track current number of indentations needed. */\n let indents = '';\n\n /** @type string[] */\n const output_lines = [];\n const tag_regex = /<[A-Za-z]+\\b[^>]*(?:.|\\n)*?\\/?>/g; /* Is opening tag or void element. */\n const attribute_regex = /\\s{1}[A-Za-z-]+(?:=\".*?\")?/g; /* Matches all tag/element attributes. */\n\n /* Process lines and indent. */\n convert.line.forEach((source, index) => {\n let current_line_value = source.value;\n\n const is_ignored_content =\n current_line_value.startsWith('___HTMLFY_SPECIAL_IGNORE_MARKER_');\n\n let subtrahend = 0;\n const prev_line_data = convert.line[index - 1];\n const prev_line_value = prev_line_data?.value ?? \"\"; // Use empty string if no prev line\n\n /**\n * Arbitratry character, to keep track of the string's length.\n */\n indents += '0';\n\n if (index === 0) subtrahend++;\n /* We're processing a closing tag. */\n if (current_line_value.trim().startsWith(\"</\")) subtrahend++;\n /* prevLine is a doctype declaration. */\n if (prev_line_value.trim().startsWith(\"<!doctype\")) subtrahend++;\n /* prevLine is a comment. */\n if (prev_line_value.trim().startsWith(\"<!--\")) subtrahend++;\n /* prevLine is a void element. */\n if (\n prev_line_value.trim().endsWith(\"/>\") // native self-closing\n ||\n prev_line_value.trim().endsWith(constants.SELF_CLOSING_PLACEHOLDER) // synthetic self-closing\n ) subtrahend++;\n /* prevLine is a closing tag. */\n if (prev_line_value.trim().startsWith(\"</\")) subtrahend++;\n /* prevLine is text. */\n if (prev_line_data?.type === \"text\") subtrahend++;\n\n /* Determine offset for line indentation. */\n const offset = Math.max(0, indents.length - subtrahend);\n /* Correct indent level for *this* line's content */\n const current_indent_level = offset; // Store the level for this line\n\n indents = indents.substring(0, current_indent_level); // Adjust for *next* round\n\n /**\n * Starts with a single punctuation character.\n * Add punctuation to end of previous line.\n */\n if (source.type === 'text' && /^[!,;\\.]/.test(current_line_value)) {\n if (current_line_value.length === 1) {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value;\n return\n } else {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value.charAt(0);\n current_line_value = current_line_value.slice(1).trim();\n\n /* If nothing left after extracting punctuation, skip this line. */\n if (current_line_value.length === 0) return\n }\n }\n\n const padding = step.repeat(current_indent_level);\n\n if (is_ignored_content) {\n /* Stop processing this line, as it's set to be ignored. */\n output_lines.push(current_line_value);\n } else {\n /* Remove comment. */\n if (strict && current_line_value.trim().startsWith(\"<!--\"))\n return\n\n let result = current_line_value;\n\n /* Remove self-closing placeholder, if needed. */\n result = unsetSelfClosing(result);\n\n if (\n source.type === 'text' && \n content_wrap > 0 && \n result.length >= content_wrap\n ) {\n result = wordWrap(result, content_wrap, padding);\n }\n /* Wrap the attributes of open tags and void elements. */\n else if (\n tag_wrap > 0 &&\n result.length > tag_wrap &&\n tag_regex.test(result)\n ) {\n tag_regex.lastIndex = 0; // Reset stateful regex\n attribute_regex.lastIndex = 0; // Reset stateful regex\n\n const tag_parts = result.split(attribute_regex).filter(Boolean);\n\n if (tag_parts.length >= 2) {\n const attributes = result.matchAll(attribute_regex);\n const inner_padding = padding + step;\n let wrapped_tag = padding + tag_parts[0] + \"\\n\";\n\n for (const a of attributes) {\n const attribute_string = a[0].trim();\n wrapped_tag += inner_padding + attribute_string + \"\\n\";\n }\n\n const tag_name_match = tag_parts[0].match(/<([A-Za-z_:-]+)/);\n const tag_name = tag_name_match ? tag_name_match[1] : \"\";\n const is_self_closing = tag_parts.at(-1)?.endsWith(\"/>\") && VOID_ELEMENTS.includes(tag_name);\n const closing_part = tag_parts[1].trim();\n const closing_padding = padding + (strict && is_self_closing ? \" \" : \"\");\n\n wrapped_tag += closing_padding + closing_part;\n\n result = wrapped_tag; // Assign the fully wrapped string\n } else {\n result = padding + result;\n }\n } else {\n /* Apply simple indentation (if no wrapping occurred) */\n result = padding + result;\n }\n\n /* Add the processed line (or lines if wordWrap creates them) to the output */\n output_lines.push(result);\n }\n });\n\n /* Join all processed lines into the final HTML string */\n let final_html = output_lines.join(\"\\n\");\n\n /* Preserve wrapped attributes. */\n if (tag_wrap > 0) final_html = protectAttributes(final_html);\n\n /* Extra preserve wrapped content. */\n if (content_wrap > 0 && new RegExp(`/\\\\n[ ]*[^\\\\n]*${constants.CONTENT_IGNORE_PLACEHOLDER}[^\\\\n]*\\\\n/`).test(final_html))\n final_html = finalProtectContent(final_html);\n\n /* Remove line returns, tabs, and consecutive spaces within html elements or their content. */\n final_html = final_html.replace(\n /<(?<Element>[^>\\s]+)[^>]*>[^<]*?[^><\\/\\s][^<]*?<\\/\\k<Element>>|<script[^>]*>[\\s]*<\\/script>|<([\\w:\\._-]+)([^>]*)><\\/\\2>|<([\\w:\\._-]+)([^>]*)>[\\s]+<\\/\\4>/g,\n match => {\n // Check if this contains placeholder\n if (match.includes(constants.SELF_CLOSING_PLACEHOLDER) || match.includes(constants.CONTENT_IGNORE_PLACEHOLDER)) {\n return match // Don't modify if it contains the placeholder\n }\n\n return match.replace(/\\n|\\t|\\s{2,}/g, '')\n }\n );\n\n /* Revert wrapped content. */\n if (content_wrap > 0) final_html = unprotectContent(final_html);\n\n /* Revert wrapped attributes. */\n if (tag_wrap > 0) final_html = unprotectAttributes(final_html);\n\n /* Remove self-closing nature of void elements. */\n if (strict) final_html = final_html.replace(/\\s\\/>|\\/>/g, '>');\n\n /* Trim leading and/or trailing line returns. */\n if (final_html.startsWith(\"\\n\")) final_html = final_html.substring(1);\n if (final_html.endsWith(\"\\n\")) final_html = final_html.substring(0, final_html.length - 1);\n\n return final_html\n};\n\n/**\n * Format HTML with line returns and indentations.\n * \n * @param {string} html The HTML string to prettify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A well-formed HTML string.\n */\nconst prettify = (html, config) => {\n let reinsert_ignored = false;\n const { checked_html, ignored } = getState();\n\n /* Return content as-is if it does not contain any HTML elements. */\n if (!checked_html && !isHtml(html)) return html\n\n /* Runs setState for config. */\n const validated_config = validateConfig(config || {});\n\n const ignore = validated_config.ignore.length > 0;\n\n /* Allows you to trimify before ignoring. */\n if (validated_config.trim.length > 0) html = trimify(html, validated_config.trim);\n\n /* Extract ignored elements. */\n if (!ignored && ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html);\n html = html_with_markers;\n ignore_map = extracted_map;\n reinsert_ignored = true;\n }\n\n /* Preserve html text within attribute values. */\n html = setIgnoreAttribute(html);\n\n /* Insert placeholder for void elements that aren't self-closing. */\n html = setSelfClosing(html);\n\n html = minify(html);\n enqueue(html);\n html = process();\n\n /* Revert html text within attribute values. */\n html = unsetIgnoreAttribute(html);\n\n /* Re-insert ignored elements. */\n if (reinsert_ignored) {\n html = reinsertIgnoredBlocks(html, ignore_map);\n }\n\n return html\n};\n\n/**\n * Render attribute on the given element\n * @param element - targeted to render attribute\n * @param name - of the attribute\n * @param value - of the attribute\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst renderAttribute = (element, name, value) => {\n if ([null, undefined, '', false].includes(value) || ['innerHTML', 'style', ''].includes(name)) {\n return;\n }\n element.setAttribute(name, !['object', 'function'].includes(typeof value) ? value : `⚠️ Property must be set through a script or a framework-specific syntax.`);\n};\n/**\n * Render new element in parent element\n * @param parentNode - HTML element\n * @param tagName - of the new element\n * @param attributes - of the new element\n * @param children - of the new element\n * @param text - of the new element\n */\nconst renderElement = (parentNode, tagName, attributes, children, text) => {\n // render HTML\n if (tagName && typeof tagName === 'string') {\n const element = document.createElement(tagName);\n Object.keys(attributes || {}).forEach(attr => {\n renderAttribute(element, attr, attributes[attr]);\n });\n children?.forEach(child => {\n renderElement(element, child.$tag$, child.$attrs$, child.$children$, child.$text$);\n });\n if (attributes?.innerHTML)\n element.innerHTML = attributes.innerHTML;\n parentNode.appendChild(element);\n }\n // render text\n if (text) {\n parentNode.innerHTML = text;\n }\n};\n/**\n * Filter default argument on component argument to prevent them to be rendered\n * @param args - all possible args with custom values\n * @param defaultValues - component default args values\n * @param slots - slots\n * @returns filtres args\n * @example\n * ```ts\n * import { filterArgs } from '@mgdis/core-ui-helpers/dist/storybook';\n * const Template = (args: MgBadgeType): HTMLElement => <mg-badge {...filterArgs(args, { variant: 'info' }, ['actions'])}></mg-badge>;\n * ```\n */\nconst filterArgs = (args, defaultValues, slots = []) => {\n const filteredArgs = {};\n if (typeof args !== 'object') {\n throw new Error(\"filterArgs - args isn't an object.\");\n }\n for (const k in args) {\n if (!slots.includes(k)) {\n const arg = args[k];\n // Change camelCase k to kebab-case\n const key = k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n if (!defaultValues || !Object.keys(defaultValues).includes(k) || defaultValues[k] !== arg) {\n filteredArgs[key] = arg;\n }\n }\n }\n return filteredArgs;\n};\n/**\n * Storybook stencil wrapper. Used to target element with `storybook-root` id and render virtual DOM inside.\n * @param storyFn - storybook render function\n * @param context - storybook context\n * @returns rendered element\n * @example\n * ```ts\n * // .storybook/preview.ts\n * import { stencilWrapper } from '@mgdis/core-ui-helpers/dist/storybook';\n * export const decorators: Preview['decorators'] = [stencilWrapper];\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst stencilWrapper = (storyFn, context) => {\n const host = document.getElementById('storybook-root');\n if (host === null)\n return;\n // update local switcher based on context variable\n document.querySelector('[lang]')?.setAttribute('lang', context.globals?.locale || 'en');\n renderVdom({\n $cmpMeta$: {\n $flags$: 0,\n $tagName$: host.tagName,\n },\n $hostElement$: host,\n }, storyFn(context));\n return host.children[host.children.length - 1];\n};\n/**\n * Get story HTML from virtual DOM.\n * Mainly used to render, component code exemple in stories.\n * @param vitualNode - story virtual DOM\n * @returns stringified rendered HTML\n * @example\n * ```ts\n * // .storybook/preview.ts\n * import { getStoryHTML } from '@mgdis/core-ui-helpers/dist/storybook';\n *\n * export const parameters: Preview['parameters'] = {\n * docs: {\n * source: {\n * transform: (_, ctx) => getStoryHTML(ctx.originalStoryFn(ctx.args)),\n * }\n * },\n * };\n * ```\n */\nconst getStoryHTML = ({ $tag$, $attrs$, $children$, $text$ }) => {\n const host = document.createElement('div');\n renderElement(host, $tag$, $attrs$, $children$, $text$);\n return prettify(host.innerHTML, {\n tag_wrap: 40,\n content_wrap: 120,\n }).replace(/=\"true\"/g, '');\n};\n/**\n * Retrieve Component Storybook URL from file path\n * @param storybookBaseUrl - Storybook Base URL\n * @param filePath - Component file path\n * @returns Component Storybook URL\n */\nconst getStorybookUrl = (storybookBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n const split = filePath.split('/');\n return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;\n};\nclass StorybookPreview {\n /**\n * JsonDocs\n */\n jsonDoc;\n constructor(jsonDoc) {\n this.jsonDoc = jsonDoc;\n }\n /**\n * Get component data from the jsonDoc\n * @param tagName - tag name we want to get the data from\n * @returns component data\n */\n #getComponentData = (tagName) => {\n return this.jsonDoc.components.find(component => component.tag === tagName);\n };\n /**\n * Get the control for the given prop\n * Based on https://storybook.js.org/docs/api/arg-types#controltype\n * @param prop - prop to get control for\n * @returns control type and options if applicable\n */\n #getPropControl = (prop) => {\n // Get types\n const types = prop.type\n .replace(/\"([^\"]+)\"/g, '$1') // Remove quotes\n .replace(/\\s/g, '') // Remove all whitespace for simplicity\n .replace(/\\(.*?\\)/g, match => match.replace(/\\|/g, ' OR ')) // Replace '|' inside parentheses\n .split('|')\n .map(type => type.trim().replace(/ OR /g, '|')); // Revert ' OR ' back to '|'\n // Return control and options\n if (prop.type === 'string') {\n return { control: { type: 'text' } };\n }\n else if (prop.type === 'number') {\n return { control: { type: 'number' } };\n }\n else if (prop.type === 'boolean') {\n return { control: { type: 'boolean' } };\n }\n else if (prop.type.startsWith('{') && prop.type.endsWith('}')) {\n return { control: { type: 'object' } };\n }\n else if (types.length > 1) {\n // Manage case when multiple types are possible\n if (types.includes('string')) {\n return { control: { type: 'text' } };\n }\n else if (types.every(type => type?.includes('[]'))) {\n return { control: { type: 'object' } };\n }\n else {\n // Add the posibility to set undefined\n types.unshift(undefined);\n return { control: { type: 'select' }, options: types };\n }\n }\n else\n return { control: { type: 'object' } };\n };\n /**\n * Extract component arg types from the component data\n * @param tagName - tag name we want to extract the arg types from\n * @returns component arg types\n */\n extractArgTypes = (tagName) => {\n const componentData = this.#getComponentData(tagName);\n // Extract props arg types\n const componentPropsArgTypes = componentData?.props.reduce((acc, prop) => {\n // Get Controls\n const { control, options } = this.#getPropControl(prop);\n // Set Component ArgTypes\n return {\n ...acc,\n [prop.name]: {\n name: prop.attr || prop.name,\n description: prop.docs,\n type: { required: prop.required },\n table: {\n category: 'props',\n type: { summary: prop.type },\n defaultValue: { summary: prop.default },\n },\n control,\n options,\n },\n };\n }, {});\n // Extract events arg types\n const componentEventsArgTypes = componentData?.events.reduce((acc, event) => ({\n ...acc,\n [event.event]: {\n name: event.event,\n description: event.docs,\n table: {\n category: 'events',\n type: { summary: event.detail },\n },\n },\n }), {});\n // Extracts Methods arg types\n const componentMethodsArgTypes = componentData?.methods.reduce((acc, method) => ({\n ...acc,\n [method.name]: {\n name: method.name,\n description: method.docs,\n table: {\n category: 'methods',\n type: { summary: method.signature },\n },\n },\n }), {});\n // Extracts Slots arg types\n const componentSlotsArgTypes = componentData?.slots.reduce((acc, slot) => ({\n ...acc,\n [slot.name]: {\n name: slot.name !== '' ? slot.name : 'default', // default slot are unnamed\n description: slot.docs,\n table: {\n category: 'slots',\n type: { summary: undefined },\n },\n },\n }), {});\n // Extracts CSS Properties arg types\n const componentCSSPropArgTypes = componentData?.styles.reduce((acc, style) => ({\n ...acc,\n [style.name]: {\n name: style.name,\n description: style.docs,\n table: {\n category: 'custom properties',\n type: { summary: undefined },\n },\n },\n }), {});\n // Extract component dependencies\n const componentDependencies = componentData?.dependencies.reduce((acc, dependency) => {\n const dependencyData = this.#getComponentData(dependency);\n if (!dependencyData)\n return acc; // Prevents from adding internal dependency\n return {\n ...acc,\n [dependency]: {\n name: dependency,\n description: `<a href=\"./?path=/docs/${getStorybookUrl('', dependencyData?.filePath)}\">View Component Documentation</a>`,\n table: {\n category: 'depends on',\n type: { summary: undefined },\n },\n },\n };\n }, {});\n // Extract dependents components\n const componentDependents = componentData?.dependents.reduce((acc, dependent) => {\n const dependentData = this.#getComponentData(dependent);\n if (!dependentData)\n return acc; // Prevents from adding internal dependent\n return {\n ...acc,\n [dependent]: {\n name: dependent,\n description: `<a href=\"./?path=/docs/${getStorybookUrl('', dependentData?.filePath)}\">View Component Documentation</a>`,\n table: {\n category: 'used by',\n type: { summary: undefined },\n },\n },\n };\n }, {});\n return {\n ...componentPropsArgTypes,\n ...componentEventsArgTypes,\n ...componentMethodsArgTypes,\n ...componentSlotsArgTypes,\n ...componentCSSPropArgTypes,\n ...componentDependencies,\n ...componentDependents,\n };\n };\n /**\n * Extract component description from the component data\n * @param tagName - tag name we want to extract the description from\n * @returns component description\n */\n extractComponentDescription = (tagName) => {\n const componentData = this.#getComponentData(tagName);\n return componentData?.readme || componentData?.docs;\n };\n}\n\nexport { StorybookPreview, filterArgs, getStoryHTML, getStorybookUrl, stencilWrapper };\n//# sourceMappingURL=index.js.map\n","/**\n * Utility function that mocks the `MutationObserver` API. Recommended to execute inside `beforeEach`.\n * @param mutationObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the mutation observer, but its methods.\n * You can manually fire an intersection entry:\n * @param mutationObserverMock - configuration object\n * @returns Mocked MutationObserver\n * @example\n * ```\n * let fireMo;\n * setupMutationObserverMock({\n * observe: function () {\n * fireMo = this.cb;\n * },\n * });\n * ...\n * fireMo([{ type: 'childList', addedNodes: [AMockElemenet, AnotherMockElemenet], target: yourMockElemenet }]);;\n * ```\n */\nconst setupMutationObserverMock = ({ disconnect, observe, takeRecords }) => {\n class MockMutationObserver {\n /**\n *\n */\n disconnect = disconnect;\n /**\n *\n */\n observe = observe;\n /**\n *\n */\n takeRecords = takeRecords;\n /**\n *\n */\n cb;\n constructor(fn) {\n this.cb = fn;\n }\n }\n [window, global].forEach(element => {\n Object.defineProperty(element, 'MutationObserver', {\n writable: true,\n configurable: true,\n value: MockMutationObserver,\n });\n });\n return MockMutationObserver;\n};\n/**\n * Utility function that mocks the `ResizeObserver` API. Recommended to execute inside `beforeEach`.\n * @param resizeObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the resize observer, but its methods.\n * You can manually fire an intersection entry:\n * @param resizeObserverMock - configuration object\n * @returns Mocked ResizeObserver\n * @example\n * ```\n * let fireRo;\n * setupResizeObserverMock({\n * observe: function () {\n * fireRo = this.cb;\n * },\n * });\n * ...\n * fireRo([{\n * borderBoxSize: ResizeObserverSize[],\n * contentBoxSize: ResizeObserverSize[],\n * contentRect: DOMRectReadOnly,\n * devicePixelContentBoxSize: ResizeObserverSize[],\n * target: yourMockElemenet\n * }]);;\n * ```\n */\nconst setupResizeObserverMock = ({ disconnect, observe }) => {\n class MockResizeObserver {\n /**\n *\n */\n disconnect = disconnect;\n /**\n *\n */\n observe = observe;\n /**\n *\n */\n unobserve;\n /**\n *\n */\n cb;\n constructor(fn) {\n this.cb = fn;\n }\n }\n [window, global].forEach(element => {\n Object.defineProperty(element, 'ResizeObserver', {\n writable: true,\n configurable: true,\n value: MockResizeObserver,\n });\n });\n return MockResizeObserver;\n};\nclass MockCustomEvent extends Event {\n /**\n *\n */\n detail; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.\n * @example\n * ```\n * setupSubmitEventMock();\n * ```\n * @returns custom event mock\n */\nconst setupSubmitEventMock = () => {\n class SubmitEvent extends MockCustomEvent {\n }\n [window, global].forEach(element => {\n Object.defineProperty(element, 'SubmitEvent', {\n writable: true,\n configurable: true,\n value: SubmitEvent,\n });\n });\n return SubmitEvent;\n};\n/**\n * Utility function that mocks the `requestAnimationFrame` API. Recommended to execute inside `test`.\n * @example\n * ```\n * setUpRequestAnimationFrameMock(jest.runOnlyPendingTimers);\n * ```\n * @param faketimer - recommended to use jest.runOnlyPendingTimers()\n * @returns custom setUpRequestAnimationFrameMock mock\n */\nconst setUpRequestAnimationFrameMock = (faketimer) => {\n const requestAnimationFrame = (callback) => {\n setTimeout(callback, 1);\n faketimer();\n return 0;\n };\n [window, global].forEach(element => {\n Object.defineProperty(element, 'requestAnimationFrame', {\n writable: true,\n configurable: true,\n value: requestAnimationFrame,\n });\n });\n return requestAnimationFrame;\n};\n/**\n * Convert string to given type\n * @param value - string value to format\n * @param type - new value output type\n * @returns string value converted to given type\n */\nconst convertString = (value, type) => {\n switch (type) {\n case 'date':\n return new Date(value);\n case 'number':\n return Number(value);\n default:\n return value;\n }\n};\n/**\n * Get range underflow value from input['min]\n * @param input - HTMLInputElement\n * @returns truthy iv value is underflow\n */\nconst getRangeUnderflow = (input) => {\n const value = convertString(input.value, input.type);\n if (['date', 'number'].includes(input.type) && input.hasAttribute('min') && input.value.length > 0) {\n const min = convertString(input.min, input.type);\n return value < min;\n }\n else {\n return false;\n }\n};\n/**\n * Get range overflow value from input['max]\n * @param input - HTMLInputElement\n * @returns truthy iv value is overflow\n */\nconst getRangeOverflow = (input) => {\n const value = convertString(input.value, input.type);\n if (['date', 'number'].includes(input.type) && input.hasAttribute('max') && input.value.length > 0) {\n const max = convertString(input.max, input.type);\n return value > max;\n }\n else {\n return false;\n }\n};\n/**\n * HTMLSelectElement type guard\n * @param input - HTMLElement to test\n * @returns truthy if element is HTMLSelectElement\n */\nconst isHTMLSelectElement = (input) => input.options !== undefined;\n/**\n * Is value missing from input\n * @param input - input to test\n * @returns truthy if value is required\n */\nconst isValueMissing = (input) => {\n if (input.hasAttribute('required') && input.required === true) {\n if (['checkbox', 'radio'].includes(input.type)) {\n return input.checked === false;\n }\n else if (isHTMLSelectElement(input)) {\n return input.options.item(input.options.selectedIndex)?.value === '';\n }\n else {\n return input.value.length === 0;\n }\n }\n else {\n return false;\n }\n};\n/**\n * Get input validity\n * @param input - input prototype\n * @returns input validity state\n */\nconst getValidity = (input) => {\n // required field without a value\n const valueMissing = isValueMissing(input);\n // value of a number field is not a number | value of a date field is not a date\n const badInput = ['number', 'date'].includes(input.type) && isNaN(input.type === 'date' ? Date.parse(input.value) : input.value);\n // value does not conform to the pattern\n const patternMismatch = input.hasAttribute('pattern') && new RegExp(input.pattern).test(input.value) === false;\n // value of a number|date field is higher than the max attribute\n const rangeOverflow = getRangeOverflow(input);\n // value of a number|date field is lower than the min attribute\n const rangeUnderflow = getRangeUnderflow(input);\n // value of a number field does not conform to the stepattribute\n const stepMismatch = input.type === 'number' && input.hasAttribute('step') && input.step !== 'any' && Number(input.value) % parseFloat(input.step) !== 0;\n // the user has edited a too-long value in a field with maxlength\n const tooLong = input.hasAttribute('maxLength') && input.value?.length > Number(input.maxLength);\n // the user has edited a too-short value in a field with minlength\n const tooShort = input.hasAttribute('minLength') && input.value?.length < Number(input.minLength);\n // value of a email or URL field is not an email address or URL\n const typeMismatch = input.type === 'url' && !URL.canParse(input.value);\n // value of validationMessage is not an empty string\n const customError = false;\n const valid = ![valueMissing, badInput, patternMismatch, rangeOverflow, rangeUnderflow, stepMismatch, tooLong, tooShort, typeMismatch, customError].some(invalid => invalid);\n return {\n badInput,\n customError,\n patternMismatch,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch,\n tooLong,\n tooShort,\n typeMismatch,\n valid,\n valueMissing,\n };\n};\n/**\n * Utility function that mocks the HTMLInputElement[`vality`] state API and the HTMLInputElement.checkvalidty() methode.\n * Recommended to execute inside `test`.\n * @example\n * ```\n * Array.from(document.querySelectorInputs('input')).forEach(setUpHTMLInputElementValidity);\n * ```\n */\nconst setUpHTMLInputElementValidity = (input) => {\n input.checkValidity = () => {\n const { valid } = getValidity(input);\n input.dispatchEvent(new CustomEvent('invalid', { detail: !valid }));\n return valid;\n };\n Object.defineProperty(input, 'validity', {\n get: () => getValidity(input),\n configurable: true,\n });\n};\n\nexport { setUpHTMLInputElementValidity, setUpRequestAnimationFrameMock, setupMutationObserverMock, setupResizeObserverMock, setupSubmitEventM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ChC,OAAO,eAAe,GAAS,kBAAkB;GAC7C,UAAU;GACV,cAAc;GACd,OAAO;EACX,CAAC;CACL,CAAC,GACM;AACX,GACM,KAAN,cAA8B,MAAM;CAIhC;AACJ,GASM,WAA6B;CAC/B,MAAM,UAAoB,GAAgB,CAC1C;CAQA,OAPA,CAAC,QAAQ,MAAM,EAAE,SAAQ,MAAW;EAChC,OAAO,eAAe,GAAS,eAAe;GAC1C,UAAU;GACV,cAAc;GACd,OAAO;EACX,CAAC;CACL,CAAC,GACM;AACX,GAUM,MAAkC,MAAc;CAClD,IAAM,KAAyB,OAC3B,WAAW,GAAU,CAAC,GACtB,EAAU,GACH;CASX,OAPA,CAAC,QAAQ,MAAM,EAAE,SAAQ,MAAW;EAChC,OAAO,eAAe,GAAS,yBAAyB;GACpD,UAAU;GACV,cAAc;GACd,OAAO;EACX,CAAC;CACL,CAAC,GACM;AACX"}
1
+ {"version":3,"file":"index.es.js","names":["#next","#top","#total","getStorybookUrl","dateRegExp","#getComponentData","#getPropControl"],"sources":["../../helpers/dist/utils/index.js","../../helpers/dist/stencil/index.js","../../helpers/dist/locale/index.js","../../helpers/dist/storybook/index.js","../../helpers/dist/tests/index.js"],"sourcesContent":["/**\n * Class to manage component classlist\n */\nclass ClassList {\n /**\n * Available classes\n */\n classes;\n constructor(classlist = []) {\n this.classes = classlist;\n }\n /**\n * Add class\n * @param className - class name to add\n */\n add = (className) => {\n if (!this.has(className)) {\n this.classes.push(className);\n }\n };\n /**\n * Delete class\n * @param className - class name to delete\n */\n delete = (className) => {\n const index = this.classes.indexOf(className);\n if (index > -1) {\n this.classes.splice(index, 1);\n }\n };\n /**\n * Check if class exist in list\n * @param className - class name to check\n * @returns class name is in the list\n */\n has = (className) => {\n return this.classes.includes(className);\n };\n /**\n * Join classes seperated by spaces\n * @returns joined values\n */\n join = () => {\n return this.classes.join(' ');\n };\n}\n\n/**\n * Check if a value is of object type.\n * @param object - The value to validate.\n * @returns `true` if the value is a valid object (non-null and not an array), otherwise `false`.\n */\nconst isObject = (object) => typeof object === 'object' && !Array.isArray(object) && object !== null;\n/**\n * Get object value from key\n * @param object - object to query\n * @param path - path of the property to get. Nested keys are allowed with `.` separators (eg: 'key0.key1.key2' = object[key0][key1][key2])\n * @param defaultValue - The value returned for `undefined` resolved values\n * @returns object value\n */\nconst getObjectValueFromKey = (object, path, defaultValue) => {\n const separator = '.';\n if (!isObject(object) || typeof path !== 'string') {\n return defaultValue;\n }\n const [current, ...next] = path.split(separator);\n if (next.length) {\n return getObjectValueFromKey(object[current], next.join(separator), defaultValue);\n }\n else {\n return object[current] ?? defaultValue;\n }\n};\n\n/**\n * Typeguard function to check if all array items are strings.\n * @param items - items to check\n * @returns `true` if all items are strings\n */\nconst allItemsAreString = (items) => Array.isArray(items) && items.every((item) => typeof item === 'string');\n/**\n * Validate string\n * @param value - value to check\n * @returns `true` if string is valid\n */\nconst isValidString = (value) => typeof value === 'string' && value.trim() !== '';\n/**\n * Stringify value\n * @param value - value to stringify\n * @returns stringified value\n */\nconst toString = (value) => (typeof value === 'object' ? JSON.stringify(value) : String(value));\n/**\n * Cleans string characters by removing special characters and converting to lowercase.\n * @param text - text to clean\n * @returns cleaned string\n * @example\n * ```ts\n * cleanString('âäàçéèêñù') // 'aaaceeenu'\n * cleanString('BATMAN') // 'batman'\n * ```\n */\nconst cleanString = (text) => typeof text === 'string'\n ? text\n .toLocaleLowerCase()\n .normalize('NFD')\n .replaceAll(/[\\u0300-\\u036f]/g, '')\n : text;\n\n/**\n * Convert a string to kebab-case.\n *\n * This function ensures:\n * - All characters are converted to lowercase. Based on : https://stackoverflow.com/questions/63116039/camelcase-to-kebab-case\n * - Non-alphabetic characters (except numbers and hyphens) are replaced with hyphens.\n * - Consecutive hyphens are replaced with a single hyphen.\n * - Leading and trailing hyphens are removed.\n *\n * @param str - The input string to convert.\n * @returns The kebab-case formatted string.\n *\n * @example\n * ```typescript\n * toKebabCase('XMLHttpRequest'); // 'xml-http-request'\n * ```\n */\nconst toKebabCase = (str) => str\n .replace(/[A-Z]+(?![a-z])|[A-Z]/g, (match, offset) => (offset > 0 ? '-' : '') + match.toLowerCase())\n .replace(/[^a-z0-9-]+/g, '-') // Replace non a-z, 0-9, or hyphen characters with a hyphen\n .replace(/--+/g, '-') // Replace multiple consecutive hyphens with a single hyphen\n .replace(/(?:^-)|(?:-$)/g, ''); // Remove leading hyphens or number or trailing hyphens\n\n/**\n * Create random ID\n * @param prefix - add prefix to created ID\n * @param length - ID length\n * @returns ID\n */\nconst createID = (prefix = '', length = 10) => {\n const randomBytes = new Uint8Array(length);\n crypto.getRandomValues(randomBytes);\n const hexString = Array.from(randomBytes)\n .map((byte) => byte.toString(16).padStart(2, '0'))\n .join('')\n .slice(0, length);\n return prefix !== '' ? `${prefix}-${hexString}` : hexString;\n};\n/**\n * Validate html `id` format\n * @param newValue - id value to validate\n * @returns true if `id` is valid\n */\nconst isValideID = (newValue) => isValidString(newValue) && /^([a-z][a-z0-9]*)(-[a-z0-9]+)*$/.exec(newValue) !== null;\n/**\n * Format id from value\n * @param value - id to transforme\n * @returns valid id\n */\nconst formatID = (value) => {\n let id;\n if (typeof value === 'string') {\n id = value;\n }\n else if (Boolean(value) && typeof value === 'object' && (isObject(value) || Array.isArray(value))) {\n id = JSON.stringify(value);\n }\n else if (value !== null && value !== undefined && typeof value !== 'boolean' && typeof value !== 'object') {\n id = String(value);\n }\n return id ? toKebabCase(id) : id;\n};\n\n/**\n * Use to process code next tick in the event loop\n * @param callback - code to excute on next tick\n * @returns differed code excution\n */\nconst nextTick = async (callback) => {\n if (callback)\n return callback();\n};\n/**\n * Cursor possible values\n */\nconst Cursor = {\n FIRST: 'first',\n NEXT: 'next',\n PREVIOUS: 'previous',\n LAST: 'last',\n};\nconst DEFAULT_TOP = 10;\n/**\n * Define a valid Page object and navigate throw page items with cursor.\n * Page object entries follow the REST API page practices.\n */\nclass Page {\n /**\n * Define items\n */\n items = [];\n /**\n * Define total\n */\n total;\n /**\n * Define top\n */\n top = DEFAULT_TOP;\n /**\n * Define next\n */\n next;\n /**\n * Define base index\n */\n baseIndex = 1;\n constructor(init) {\n if (!isObject(init)) {\n throw new Error('Page - init must match IPage type.');\n }\n else {\n if (Array.isArray(init.items))\n this.items = init.items;\n if (typeof init.top === 'number')\n this.top = init.top;\n this.total = typeof init.total === 'number' ? init.total : this.items.length;\n this.next = init.next;\n }\n }\n /**\n * Get index of items from cursor\n * @param cursor - cursor to find\n * @param oldItem - previous item\n * @returns item index\n */\n getIndexFromCursor = (cursor = 'first', oldItem) => {\n const startIndex = 0;\n if (!Array.isArray(this.items) || !this.items.length)\n return null;\n const lastIndex = this.items.length - this.baseIndex;\n let newIndex;\n let oldIndex = startIndex;\n if (['previous', 'next'].includes(cursor) && oldItem) {\n const findedIndex = this.items.findIndex((item) => JSON.stringify(item) === JSON.stringify(oldItem));\n if (findedIndex === -1)\n return startIndex;\n oldIndex = findedIndex;\n }\n // Update index from cursor\n if (cursor === 'first') {\n newIndex = startIndex;\n }\n else if (cursor === 'last') {\n newIndex = lastIndex;\n }\n else if (cursor === 'previous') {\n newIndex =\n JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[startIndex])\n ? lastIndex\n : oldIndex - this.baseIndex;\n }\n else if (cursor === 'next') {\n newIndex =\n JSON.stringify(this.items[oldIndex]) === JSON.stringify(this.items[lastIndex])\n ? startIndex\n : oldIndex + this.baseIndex;\n }\n else {\n newIndex = startIndex;\n }\n return newIndex;\n };\n}\n/**\n * Paginate an items array to navigate into with pages.\n * It follow REST standard and allow to navigate in items array with a similar format.\n */\nclass Paginate {\n /**\n * Define paginated items\n */\n items = [];\n /* Privates */\n #top = DEFAULT_TOP;\n #next;\n #total;\n constructor(items, options) {\n if (Array.isArray(items))\n this.items = items;\n if (options &&\n (['string', 'function'].includes(typeof options.next) ||\n (isObject(options.next) && URL.canParse(options.next))))\n this.#next = options.next;\n if (typeof options?.top === 'number')\n this.#top = options.top;\n if (typeof options?.total === 'number')\n this.#total = options.total;\n }\n /**\n * Get page\n * @param offset - pagiantion offset\n * @param filter - filter methode\n * @returns formated page\n */\n getPage = (offset = 0, filter) => {\n const items = typeof filter === 'function' ? this.items.filter(filter) : this.items;\n let next;\n if (this.#next)\n next = this.#next;\n else if (items.length > offset + this.#top)\n next = () => this.getPage(offset + this.#top, filter);\n return new Page({\n items: items.slice(offset, offset + this.#top),\n total: this.#total,\n top: this.#top,\n next,\n });\n };\n}\n\n/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n/**\n * Formats a date object to a string with the pattern 'YYYY-MM-DD'.\n * @param date - date to parse\n * @returns string date with pattern 'YYYY-MM-DD'\n * @example\n * ```ts\n * dateToString(new Date('2023-12-24')) // '2023-12-24'\n * ```\n */\nconst dateToString = (date) => date.toISOString().split('T')[0];\n\n/**\n * Check if element belongs to the given tagNames list\n * @param element - element to check\n * @param tagNames - allowed tag names list\n * @returns `true` if element tagName is in the tagNames list\n */\nconst isTagName = (element, tagNames) => tagNames.includes(element?.tagName.toLowerCase());\n/**\n * CSS selector to select focusable elements.\n * @example\n * ```ts\n * const allFocusableElements: HTMLElement[] = Array.from(this.element.querySelectorAll(focusableElements));\n * ```\n */\nconst focusableElements = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"]), [identifier], mg-button';\n\n/**\n * Validate number\n * @param value - value to check\n * @returns `true` if number is valid\n */\nconst isValidNumber = (value) => typeof value === 'number' && !Number.isNaN(value);\n\n/**\n * Get windows\n * @param localWindow - the window we are lookink for other windows\n * @returns The list of windows found\n */\nconst getWindows = (localWindow) => {\n const parentWindows = getParentWindows(localWindow);\n const childWindows = getChildWindows(localWindow);\n return [localWindow, ...parentWindows, ...childWindows];\n};\n/**\n * Get parent windows\n * @param localWindow - the window we are lookink for parents\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getParentWindows = (localWindow, windows = []) => {\n // Check if is in iframe\n if (localWindow.self !== localWindow.top) {\n // Check if we have permission to access parent\n try {\n const parentWindow = localWindow.parent;\n if (parentWindow) {\n windows.push(parentWindow);\n return getParentWindows(parentWindow, windows);\n }\n else\n return windows;\n }\n catch (err) {\n console.error('Different hosts between iframes:', err);\n return windows;\n }\n }\n return windows;\n};\n/**\n * Get child windows\n * @param localWindow - the window we are lookink for children\n * @param windows - The list of allready found windows\n * @returns The list of windows found\n */\nconst getChildWindows = (localWindow, windows = []) => {\n if (localWindow.frames.length > 0) {\n for (const childWindow of Array.from(localWindow.frames)) {\n windows.push(childWindow);\n getChildWindows(childWindow, windows);\n }\n }\n return windows;\n};\n\nexport { ClassList, Cursor, Page, Paginate, allItemsAreString, cleanString, createID, dateRegExp, dateToString, focusableElements, formatID, getChildWindows, getObjectValueFromKey, getParentWindows, getWindows, isObject, isTagName, isValidNumber, isValidString, isValideID, nextTick, toKebabCase, toString };\n//# sourceMappingURL=index.js.map\n","/**\n * Retrieve Component Storybook URL from file path\n * @param storybookBaseUrl - Storybook Base URL\n * @param filePath - Component file path\n * @returns Component Storybook URL\n */\nconst getStorybookUrl = (storybookBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n const split = filePath.split('/');\n return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;\n};\n\n/**\n * Retrieve Component source URL from file path\n * @param sourcesBaseUrl - Source base URL\n * @param filePath - Component file path\n * @returns Component source URL\n */\nconst getSourcesUrl = (sourcesBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n return `${sourcesBaseUrl}${filePath}`;\n};\n/**\n * Get Component element description.\n *\n * Neither WebStorm nor VS Code render the structured `attributes` /\n * `js.properties` arrays in the tag-level quick-doc — they only show this\n * markdown description. So the attribute and property listings have to live\n * here, even though they're redundant with the structured arrays used by the\n * inline autocomplete.\n * @param component - Component\n * @returns Component element description\n */\nconst getElementDescription = (component) => {\n let description = component.overview ? `${component.overview}\\n\\n` : '';\n const attributes = component.props.filter(({ attr }) => attr !== undefined);\n if (attributes.length) {\n description += `Attributes:\\n`;\n description += attributes.map(({ attr, docs }) => `- \\`${attr}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n const properties = component.props.filter(({ attr }) => attr === undefined);\n if (properties.length) {\n description += `Properties:\\n`;\n description += properties.map(({ name, docs }) => `- \\`${name}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.methods.length) {\n description += `Methods:\\n`;\n description += component.methods.map(({ name, docs }) => `- \\`${name}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.events.length) {\n description += `Events:\\n`;\n description += component.events.map(({ event, docs }) => `- \\`${event}\\`: ${docs}\\n`).join('');\n description += '\\n';\n }\n if (component.listeners.length) {\n description += `Listeners:\\n`;\n description += component.listeners.map(({ event }) => `- \\`${event}\\`\\n`).join('');\n description += '\\n';\n }\n if (component.slots.length) {\n description += `Slots:\\n`;\n description += component.slots\n .map(({ name, docs }) => {\n const label = name ? `\\`${name}\\`` : 'default';\n return `- ${label}: ${docs}\\n`;\n })\n .join('');\n description += '\\n';\n }\n return description;\n};\n/**\n * Get Props Description\n * @param prop - Component Property\n * @returns Props Description\n */\nconst getAttributeDescription = (prop) => {\n return `${prop.docs}\\n\\nType: \\`${prop.type}\\``;\n};\n/**\n * Generate Web Types metadata for IntelliJ's IDE\n * @param name - Library name\n * @param version - Library version\n * @param jsonDocs - Stencil JSON doc\n * @param storybookBaseUrl - Storybook Base Url\n * @returns Web Types metadata\n * @example\n * ```ts\n * const webTypesJson = webTypesGenerator('@mgdis/mg-components', '1.0.0', jsonDocs, 'https://storybook.example.com');\n * ```\n */\nconst webTypesGenerator = (name, version, jsonDocs, storybookBaseUrl) => ({\n $schema: 'https://json.schemastore.org/web-types',\n name,\n version,\n 'description-markup': 'markdown',\n contributions: {\n html: {\n elements: jsonDocs.components.map((component) => {\n const docUrl = getStorybookUrl(storybookBaseUrl, component.filePath);\n return {\n name: component.tag,\n description: getElementDescription(component),\n 'doc-url': docUrl,\n attributes: component.props\n .filter((prop) => prop.attr)\n .map((prop) => ({\n name: prop.attr,\n description: getAttributeDescription(prop),\n 'doc-url': docUrl,\n value: {\n type: prop.type,\n default: prop.default,\n required: prop.required,\n },\n })),\n js: {\n properties: component.props\n .filter((prop) => prop.attr === undefined)\n .map((prop) => ({\n name: prop.name,\n description: getAttributeDescription(prop),\n 'doc-url': docUrl,\n value: {\n type: prop.type,\n default: prop.default,\n required: prop.required,\n },\n })),\n events: component.events.map((event) => ({\n name: event.event,\n description: event.docs,\n })),\n },\n css: {\n properties: component.styles.map((style) => ({\n name: style.name,\n description: style.docs,\n })),\n },\n };\n }),\n },\n },\n});\n/**\n * Create Storybook Reference\n * @param storybookBaseUrl - Storybook Base Url\n * @param filePath - Component file path\n * @returns Storybook Reference\n */\nconst getReferences = (storybookBaseUrl, sourceBaseUrl, filePath) => {\n return [\n { name: 'Storybook', url: getStorybookUrl(storybookBaseUrl, filePath) },\n { name: 'Sources', url: getSourcesUrl(sourceBaseUrl, filePath) },\n ];\n};\n/**\n * Get Property possible values\n * @param prop - Component Property\n * @returns Property possible values\n */\nconst getValues = (prop) => {\n // Only values Array where all objects have a value seems to be usefull\n if (prop.values.some(({ value }) => value === undefined)) {\n return;\n }\n return prop.values.map(({ value }) => ({ name: value }));\n};\n/**\n * Generate custom HTML datasets for VS Code\n * @param jsonDocs - Stencil JSON doc\n * @param storybookBaseUrl - Storybook Base Url\n * @returns custom HTML datasets\n * @example\n * ```ts\n * const customDataJson = vsCodeGenerator(jsonDocs, 'https://storybook.example.com', 'https://sources.example.com');\n * ```\n */\nconst vsCodeGenerator = (jsonDocs, storybookBaseUrl, sourceBaseUrl) => ({\n version: 1.1,\n tags: jsonDocs.components.map((component) => {\n const references = getReferences(storybookBaseUrl, sourceBaseUrl, component.filePath);\n return {\n name: component.tag,\n description: getElementDescription(component),\n attributes: component.props\n .filter((prop) => prop.attr !== undefined)\n .map((prop) => ({\n name: prop.attr,\n description: getAttributeDescription(prop),\n values: getValues(prop),\n references,\n })),\n references,\n };\n }),\n globalAttributes: [],\n valueSets: [],\n});\n/**\n * Generate custom CSS datasets for VS Code\n * @param jsonDocs - Stencil JSON doc\n * @returns custom CSS datasets\n * @example\n * ```ts\n * const customDataJson = vsCodeCssGenerator(jsonDocs);\n * ```\n */\nconst vsCodeCssGenerator = (jsonDocs) => ({\n version: 1.1,\n properties: jsonDocs.components.flatMap((component) => component.styles.map((style) => ({\n name: style.name,\n description: style.docs,\n }))),\n});\n\n/**\n * Convert a Stencil component's JsonDocs into a CEM v2 module entry.\n * @param component - Stencil component doc\n * @returns CEM module\n */\nconst componentToModule = (component) => {\n const className = component.tag\n .split('-')\n .map((part) => part.charAt(0).toUpperCase() + part.slice(1))\n .join('');\n const attributes = component.props\n .filter((prop) => prop.attr !== undefined)\n .map((prop) => ({\n name: prop.attr,\n description: prop.docs,\n type: { text: prop.type },\n ...(prop.default !== undefined && { default: prop.default }),\n fieldName: prop.name,\n }));\n const fieldMembers = component.props.map((prop) => ({\n kind: 'field',\n name: prop.name,\n description: prop.docs,\n type: { text: prop.type },\n ...(prop.default !== undefined && { default: prop.default }),\n ...(prop.attr !== undefined && { attribute: prop.attr }),\n }));\n const methodMembers = component.methods.map((method) => ({\n kind: 'method',\n name: method.name,\n description: method.docs,\n }));\n return {\n kind: 'javascript-module',\n path: component.filePath ?? '',\n declarations: [\n {\n kind: 'class',\n name: className,\n tagName: component.tag,\n customElement: true,\n description: component.overview ?? '',\n attributes,\n members: [...fieldMembers, ...methodMembers],\n events: component.events.map((event) => ({\n name: event.event,\n description: event.docs,\n type: { text: `CustomEvent<${event.detail}>` },\n })),\n slots: component.slots.map((slot) => ({\n name: slot.name,\n description: slot.docs,\n })),\n cssProperties: component.styles.map((style) => ({\n name: style.name,\n description: style.docs,\n })),\n cssParts: component.parts.map((part) => ({\n name: part.name,\n description: part.docs,\n })),\n },\n ],\n exports: [\n {\n kind: 'custom-element-definition',\n name: component.tag,\n declaration: {\n name: className,\n module: component.filePath ?? '',\n },\n },\n ],\n };\n};\n/**\n * Generate a Custom Elements Manifest v2 from Stencil JSON docs.\n * @param jsonDocs - Stencil JSON doc\n * @returns CEM v2\n * @example\n * ```ts\n * const cem = cemGenerator(jsonDocs);\n * ```\n */\nconst cemGenerator = (jsonDocs) => ({\n schemaVersion: '2.0.0',\n readme: '',\n modules: jsonDocs.components.map(componentToModule),\n});\n\n/**\n * Per the HTML spec, a boolean attribute is `true` whenever it is present on the\n * element, regardless of its value (including `=\"false\"`). Stencil's default Prop\n * parser converts the string `\"false\"` to the boolean `false`, which breaks this\n * contract for consumers writing markup. Call this helper from `componentWillLoad`\n * to re-normalize every present attribute that maps to a boolean-typed Prop.\n *\n * Iterates the host element's attributes and, for each one whose camelCase name\n * matches a `typeof === 'boolean'` Prop on the instance, rewrites the attribute\n * to `''` — Stencil's parser then turns that into `true` via the standard\n * attribute → prop pipeline (no need for `mutable: true` on the Prop, since the\n * write goes through Stencil's internal setter, not through user code).\n *\n * Non-boolean Props and non-Prop attributes (`class`, `id`, ...) are skipped\n * naturally by the type check.\n *\n * @param target - the component instance (must expose `element` via `@Element()`)\n *\n * @example\n * ```typescript\n * @Component({ tag: 'my-input' })\n * export class MyInput {\n * @Element() element: HTMLMyInputElement;\n * @Prop() readonly = false;\n * @Prop() disabled = false;\n *\n * componentWillLoad() {\n * normalizeBooleanAttributes(this);\n * }\n * }\n * ```\n */\nconst normalizeBooleanAttributes = (target) => {\n for (const attr of Array.from(target.element.attributes)) {\n const propName = attr.name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());\n if (typeof target[propName] === 'boolean') {\n target.element.setAttribute(attr.name, '');\n }\n }\n};\n\nexport { cemGenerator, normalizeBooleanAttributes, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };\n//# sourceMappingURL=index.js.map\n","/**\n * Date RegExp, usefull to test if string is a follow the date pattern\n * @example\n * ```ts\n * dateRegExp.test('mystring') // false\n * dateRegExp.test('2020-12-31') // true\n * ```\n */\nconst dateRegExp = /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$/;\n\n/**\n * Gets the date pattern based on the specified locale.\n * @param locale - the locale to refer to\n * @returns date pattern\n * @example\n * ```ts\n * localeDatePattern('fr') // 'dd/mm/yyyy'\n * ```\n */\nconst localeDatePattern = (locale) => {\n const year = { value: '2023', pattern: 'yyyy' };\n const month = { value: '12', pattern: 'mm' };\n const day = { value: '24', pattern: 'dd' };\n return localeDate([year.value, month.value, day.value].join('-'), locale, { timeZone: 'UTC' })\n .replace(year.value, year.pattern)\n .replace(month.value, month.pattern)\n .replace(day.value, day.pattern);\n};\n/**\n * Get locale and messages\n * We load the defined locale but for now we only support the first subtag for messages\n * @param element - element we need to get the language\n * @param messages - messages to use\n * @param defaultLocale - default messages locale\n * @returns messages object\n */\nconst localeMessages = (element, messages, defaultLocale) => {\n // Get local\n const closestLangAttribute = element.closest('[lang]');\n const closestLang = Intl.NumberFormat.supportedLocalesOf(closestLangAttribute?.lang);\n const locale = closestLang.length > 0 && typeof closestLang[0] === 'string' ? closestLang[0] : navigator.language || defaultLocale;\n // Only keep first subtag\n const localeSubtag = locale.split('-').shift();\n // If messages is empty, return a default object\n if (Object.keys(messages).length === 0) {\n return {\n locale,\n messages: { lang: defaultLocale },\n };\n }\n // Return\n return {\n locale,\n messages: (messages[localeSubtag] ?? messages[defaultLocale] ?? { lang: defaultLocale }),\n };\n};\n/**\n * Format number to the locale currency\n * @param number - number to format\n * @param locale - locale to apply\n * @param currency - currency to apply\n * @returns formatted currency\n * @example\n * ```ts\n * localeCurrency(1234567890.12, 'fr', 'EUR') // '1 234 567 890,12\\xa0€'\n * ```\n */\nconst localeCurrency = (number, locale, currency) => new Intl.NumberFormat(locale, { style: 'currency', currency }).format(number);\n/**\n * Format number to locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted number\n * @example\n * ```ts\n * localeNumber(1234567890.12, 'fr') // 1 234 567 890,12\n * ```\n */\nconst localeNumber = (number, locale, decimalLength = 0) => new Intl.NumberFormat(locale, { minimumFractionDigits: decimalLength }).format(Number(number));\n/**\n * Convert bytes number to locale string representation\n * @param number - size in bytes\n * @param locale - locale to apply\n * @returns bytes in locale string format\n */\nconst localeByte = (number, locale) => {\n if (typeof number !== 'number' || Number.isNaN(number) || number < 0) {\n throw new Error('localeByte - size must be a positive number.');\n }\n const base = 1024;\n const units = ['byte', 'kilobyte', 'megabyte', 'gigabyte', 'terabyte'];\n // find appropriate unit base on size and base power\n const unitIndex = units.findIndex((_, key) => number < Math.pow(base, key + 1));\n // convert number to string with unit\n return Intl.NumberFormat(locale, {\n minimumFractionDigits: 0,\n maximumFractionDigits: 2,\n unit: units[unitIndex],\n unitDisplay: units[unitIndex] === 'byte' ? 'long' : 'short',\n style: 'unit',\n }).format(number / Math.pow(base, unitIndex));\n};\n/**\n * Format number as percentage based on locale\n * @param number - number to format\n * @param locale - locale to apply\n * @param decimalLength - decimal length to apply\n * @returns formatted percentage\n * @example\n * ```ts\n * localePercent(0.42, 'fr', 2) // '42,00 %'\n * localePercent(0.42, 'en', 2) // '42.00%'\n * ```\n */\nconst localePercent = (number, locale, decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'percent',\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Format number with standardized unit based on locale using Intl unit formatting\n * @param number - number to format\n * @param locale - locale to apply\n * @param unit - standardized unit (e.g., 'kilometer', 'kilogram', 'celsius')\n * @param unitDisplay - how to display the unit ('short', 'long', 'narrow')\n * @param decimalLength - decimal length to apply\n * @returns formatted number with localized unit\n * @example\n * ```ts\n * localeUnit(1234567890.12, 'fr', 'kilometer') // '1 234 567 890,12 km'\n * localeUnit(23, 'fr', 'celsius') // '23 °C'\n * localeUnit(10, 'fr', 'kilometer', 0, 'long') // '10 kilomètres'\n * ```\n */\nconst localeUnit = (number, locale, unit, unitDisplay = 'short', decimalLength = 0) => {\n return new Intl.NumberFormat(locale, {\n style: 'unit',\n unit,\n unitDisplay,\n minimumFractionDigits: decimalLength,\n maximumFractionDigits: decimalLength,\n }).format(number);\n};\n/**\n * Locale date format\n * @param date - date to format\n * @param locale - locale to apply\n * @param config - DateTimeFormatOptions object to apply\n * @returns formatted date\n * @example\n * ```ts\n * localeDate('2022-06-02', 'fr') // '02/06/2022'\n * ```\n */\nconst localeDate = (date, locale, config) => typeof date !== 'string' || date === '' || !dateRegExp.test(date)\n ? ''\n : new Intl.DateTimeFormat(locale, config).format(new Date(date));\n/**\n * Get Intl object\n * @param messages - locales to render in object format. `ex: { en: { porp: \"test\" }, fr: { porp: \"test\" }}`.\n * @param defaultLocale - fallback locale to render. `ex: 'en'`.\n * @returns from the element passed in return function you will get the matching messages object\n * @example\n * ```ts\n * import en from './en/messages.json';\n * import fr from './fr/messages.json';\n * import { defineLocales } from '@mgdis/core-ui-helpers/dist/utils';\n *\n * const defaultLocale = 'en';\n * const messages = { en, fr };\n *\n * export const initLocales = defineLocales(messages, defaultLocale);\n * ```\n */\nconst defineLocales = (messages, defaultLocale) => (element) => localeMessages(element, messages, defaultLocale);\n\nexport { defineLocales, localeByte, localeCurrency, localeDate, localeDatePattern, localeNumber, localePercent, localeUnit };\n//# sourceMappingURL=index.js.map\n","// src/app-data/index.ts\nvar BUILD = {\n updatable: true,\n slotRelocation: true};\n\n/*\n Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com\n */\n\n\n// src/utils/constants.ts\nvar SVG_NS = \"http://www.w3.org/2000/svg\";\nvar HTML_NS = \"http://www.w3.org/1999/xhtml\";\n\n// src/client/client-host-ref.ts\nvar getHostRef = (ref) => {\n if (ref.__stencil__getHostRef) {\n return ref.__stencil__getHostRef();\n }\n return void 0;\n};\nvar isMemberInElement = (elm, memberName) => memberName in elm;\nvar XLINK_NS = \"http://www.w3.org/1999/xlink\";\nvar win = typeof window !== \"undefined\" ? window : {};\nvar plt = {\n $flags$: 0,\n $resourcesUrl$: \"\",\n jmp: (h2) => h2(),\n raf: (h2) => requestAnimationFrame(h2),\n ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),\n rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),\n ce: (eventName, opts) => new CustomEvent(eventName, opts)\n};\nvar updateFallbackSlotVisibility = (elm) => {\n const childNodes = internalCall(elm, \"childNodes\");\n if (elm.tagName && elm.tagName.includes(\"-\") && elm[\"s-cr\"] && elm.tagName !== \"SLOT-FB\") {\n getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {\n if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === \"SLOT-FB\") {\n if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {\n slotNode.hidden = true;\n } else {\n slotNode.hidden = false;\n }\n }\n });\n }\n let i2 = 0;\n for (i2 = 0; i2 < childNodes.length; i2++) {\n const childNode = childNodes[i2];\n if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, \"childNodes\").length) {\n updateFallbackSlotVisibility(childNode);\n }\n }\n};\nvar getSlottedChildNodes = (childNodes) => {\n const result = [];\n for (let i2 = 0; i2 < childNodes.length; i2++) {\n const slottedNode = childNodes[i2][\"s-nr\"] || void 0;\n if (slottedNode && slottedNode.isConnected) {\n result.push(slottedNode);\n }\n }\n return result;\n};\nfunction getHostSlotNodes(childNodes, hostName, slotName) {\n let i2 = 0;\n let slottedNodes = [];\n let childNode;\n for (; i2 < childNodes.length; i2++) {\n childNode = childNodes[i2];\n if (childNode[\"s-sr\"] && (!hostName || childNode[\"s-hn\"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {\n slottedNodes.push(childNode);\n if (typeof slotName !== \"undefined\") return slottedNodes;\n }\n slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];\n }\n return slottedNodes;\n}\nvar getSlotChildSiblings = (slot, slotName, includeSlot = true) => {\n const childNodes = [];\n if (includeSlot && slot[\"s-sr\"] || !slot[\"s-sr\"]) childNodes.push(slot);\n let node = slot;\n while (node = node.nextSibling) {\n if (getSlotName(node) === slotName && (includeSlot || !node[\"s-sr\"])) childNodes.push(node);\n }\n return childNodes;\n};\nvar isNodeLocatedInSlot = (nodeToRelocate, slotName) => {\n if (nodeToRelocate.nodeType === 1 /* ElementNode */) {\n if (nodeToRelocate.getAttribute(\"slot\") === null && slotName === \"\") {\n return true;\n }\n if (nodeToRelocate.getAttribute(\"slot\") === slotName) {\n return true;\n }\n return false;\n }\n if (nodeToRelocate[\"s-sn\"] === slotName) {\n return true;\n }\n return slotName === \"\";\n};\nvar getSlotName = (node) => typeof node[\"s-sn\"] === \"string\" ? node[\"s-sn\"] : node.nodeType === 1 && node.getAttribute(\"slot\") || void 0;\nfunction patchSlotNode(node) {\n if (node.assignedElements || node.assignedNodes || !node[\"s-sr\"]) return;\n const assignedFactory = (elementsOnly) => (function(opts) {\n const toReturn = [];\n const slotName = this[\"s-sn\"];\n if (opts == null ? void 0 : opts.flatten) {\n console.error(`\n Flattening is not supported for Stencil non-shadow slots.\n You can use \\`.childNodes\\` to nested slot fallback content.\n If you have a particular use case, please open an issue on the Stencil repo.\n `);\n }\n const parent = this[\"s-cr\"].parentElement;\n const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);\n slottedNodes.forEach((n) => {\n if (slotName === getSlotName(n)) {\n toReturn.push(n);\n }\n });\n if (elementsOnly) {\n return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);\n }\n return toReturn;\n }).bind(node);\n node.assignedElements = assignedFactory(true);\n node.assignedNodes = assignedFactory(false);\n}\nfunction dispatchSlotChangeEvent(elm) {\n elm.dispatchEvent(new CustomEvent(\"slotchange\", { bubbles: false, cancelable: false, composed: false }));\n}\nfunction findSlotFromSlottedNode(slottedNode, parentHost) {\n var _a;\n parentHost = parentHost || ((_a = slottedNode[\"s-ol\"]) == null ? void 0 : _a.parentElement);\n if (!parentHost) return { slotNode: null, slotName: \"\" };\n const slotName = slottedNode[\"s-sn\"] = getSlotName(slottedNode) || \"\";\n const childNodes = internalCall(parentHost, \"childNodes\");\n const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];\n return { slotNode, slotName };\n}\nfunction internalCall(node, method) {\n if (\"__\" + method in node) {\n const toReturn = node[\"__\" + method];\n if (typeof toReturn !== \"function\") return toReturn;\n return toReturn.bind(node);\n } else {\n if (typeof node[method] !== \"function\") return node[method];\n return node[method].bind(node);\n }\n}\n\n// src/utils/helpers.ts\nvar isDef = (v) => v != null && v !== void 0;\nvar isComplexType = (o) => {\n o = typeof o;\n return o === \"object\" || o === \"function\";\n};\n\n// src/runtime/vdom/h.ts\nvar h = (nodeName, vnodeData, ...children) => {\n let child = null;\n let key = null;\n let slotName = null;\n let simple = false;\n let lastSimple = false;\n const vNodeChildren = [];\n const walk = (c) => {\n for (let i2 = 0; i2 < c.length; i2++) {\n child = c[i2];\n if (Array.isArray(child)) {\n walk(child);\n } else if (child != null && typeof child !== \"boolean\") {\n if (simple = !isComplexType(child)) {\n child = String(child);\n }\n if (simple && lastSimple) {\n vNodeChildren[vNodeChildren.length - 1].$text$ += child;\n } else {\n vNodeChildren.push(simple ? newVNode(null, child) : child);\n }\n lastSimple = simple;\n }\n }\n };\n walk(children);\n const vnode = newVNode(nodeName, null);\n vnode.$attrs$ = vnodeData;\n if (vNodeChildren.length > 0) {\n vnode.$children$ = vNodeChildren;\n }\n {\n vnode.$key$ = key;\n }\n {\n vnode.$name$ = slotName;\n }\n return vnode;\n};\nvar newVNode = (tag, text) => {\n const vnode = {\n $flags$: 0,\n $tag$: tag,\n // Normalize undefined to null to prevent rendering \"undefined\" as text\n $text$: text != null ? text : null,\n $elm$: null,\n $children$: null\n };\n {\n vnode.$attrs$ = null;\n }\n {\n vnode.$key$ = null;\n }\n {\n vnode.$name$ = null;\n }\n return vnode;\n};\nvar Host = {};\nvar isHost = (node) => node && node.$tag$ === Host;\nvar setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {\n if (oldValue === newValue) {\n return;\n }\n let isProp = isMemberInElement(elm, memberName);\n let ln = memberName.toLowerCase();\n if (memberName === \"class\") {\n const classList = elm.classList;\n const oldClasses = parseClassList(oldValue);\n let newClasses = parseClassList(newValue);\n {\n classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));\n classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));\n }\n } else if (memberName === \"style\") {\n {\n for (const prop in oldValue) {\n if (!newValue || newValue[prop] == null) {\n if (prop.includes(\"-\")) {\n elm.style.removeProperty(prop);\n } else {\n elm.style[prop] = \"\";\n }\n }\n }\n }\n for (const prop in newValue) {\n if (!oldValue || newValue[prop] !== oldValue[prop]) {\n if (prop.includes(\"-\")) {\n elm.style.setProperty(prop, newValue[prop]);\n } else {\n elm.style[prop] = newValue[prop];\n }\n }\n }\n } else if (memberName === \"key\") ; else if (memberName === \"ref\") {\n if (newValue) {\n queueRefAttachment(newValue, elm);\n }\n } else if ((!elm.__lookupSetter__(memberName)) && memberName[0] === \"o\" && memberName[1] === \"n\") {\n if (memberName[2] === \"-\") {\n memberName = memberName.slice(3);\n } else if (isMemberInElement(win, ln)) {\n memberName = ln.slice(2);\n } else {\n memberName = ln[2] + memberName.slice(3);\n }\n if (oldValue || newValue) {\n const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);\n memberName = memberName.replace(CAPTURE_EVENT_REGEX, \"\");\n if (oldValue) {\n plt.rel(elm, memberName, oldValue, capture);\n }\n if (newValue) {\n plt.ael(elm, memberName, newValue, capture);\n }\n }\n } else if (memberName[0] === \"a\" && memberName.startsWith(\"attr:\")) {\n const propName = memberName.slice(5);\n let attrName;\n {\n const hostRef = getHostRef(elm);\n if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {\n const memberMeta = hostRef.$cmpMeta$.$members$[propName];\n if (memberMeta && memberMeta[1]) {\n attrName = memberMeta[1];\n }\n }\n }\n if (!attrName) {\n attrName = propName.replace(/([a-z0-9])([A-Z])/g, \"$1-$2\").toLowerCase();\n }\n if (newValue == null || newValue === false) {\n if (newValue !== false || elm.getAttribute(attrName) === \"\") {\n elm.removeAttribute(attrName);\n }\n } else {\n elm.setAttribute(attrName, newValue === true ? \"\" : newValue);\n }\n return;\n } else if (memberName[0] === \"p\" && memberName.startsWith(\"prop:\")) {\n const propName = memberName.slice(5);\n try {\n elm[propName] = newValue;\n } catch (e) {\n }\n return;\n } else {\n const isComplex = isComplexType(newValue);\n if ((isProp || isComplex && newValue !== null) && !isSvg) {\n try {\n if (!elm.tagName.includes(\"-\")) {\n const n = newValue == null ? \"\" : newValue;\n if (memberName === \"list\") {\n isProp = false;\n } else if (oldValue == null || elm[memberName] !== n) {\n if (typeof elm.__lookupSetter__(memberName) === \"function\") {\n elm[memberName] = n;\n } else {\n elm.setAttribute(memberName, n);\n }\n }\n } else if (elm[memberName] !== newValue) {\n elm[memberName] = newValue;\n }\n } catch (e) {\n }\n }\n let xlink = false;\n {\n if (ln !== (ln = ln.replace(/^xlink\\:?/, \"\"))) {\n memberName = ln;\n xlink = true;\n }\n }\n if (newValue == null || newValue === false) {\n if (newValue !== false || elm.getAttribute(memberName) === \"\") {\n if (xlink) {\n elm.removeAttributeNS(XLINK_NS, memberName);\n } else {\n elm.removeAttribute(memberName);\n }\n }\n } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {\n newValue = newValue === true ? \"\" : newValue;\n if (xlink) {\n elm.setAttributeNS(XLINK_NS, memberName, newValue);\n } else {\n elm.setAttribute(memberName, newValue);\n }\n }\n }\n};\nvar parseClassListRegex = /\\s/;\nvar parseClassList = (value) => {\n if (typeof value === \"object\" && value && \"baseVal\" in value) {\n value = value.baseVal;\n }\n if (!value || typeof value !== \"string\") {\n return [];\n }\n return value.split(parseClassListRegex);\n};\nvar CAPTURE_EVENT_SUFFIX = \"Capture\";\nvar CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + \"$\");\n\n// src/runtime/vdom/update-element.ts\nvar updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {\n const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;\n const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};\n const newVnodeAttrs = newVnode.$attrs$ || {};\n {\n for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {\n if (!(memberName in newVnodeAttrs)) {\n setAccessor(\n elm,\n memberName,\n oldVnodeAttrs[memberName],\n void 0,\n isSvgMode2,\n newVnode.$flags$);\n }\n }\n }\n for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {\n setAccessor(\n elm,\n memberName,\n oldVnodeAttrs[memberName],\n newVnodeAttrs[memberName],\n isSvgMode2,\n newVnode.$flags$);\n }\n};\nfunction sortedAttrNames(attrNames) {\n return attrNames.includes(\"ref\") ? (\n // we need to sort these to ensure that `'ref'` is the last attr\n [...attrNames.filter((attr) => attr !== \"ref\"), \"ref\"]\n ) : (\n // no need to sort, return the original array\n attrNames\n );\n}\n\n// src/runtime/vdom/vdom-render.ts\nvar scopeId;\nvar contentRef;\nvar hostTagName;\nvar useNativeShadowDom = false;\nvar checkSlotFallbackVisibility = false;\nvar checkSlotRelocate = false;\nvar isSvgMode = false;\nvar refCallbacksToRemove = [];\nvar refCallbacksToAttach = [];\nvar createElm = (oldParentVNode, newParentVNode, childIndex) => {\n var _a;\n const newVNode2 = newParentVNode.$children$[childIndex];\n let i2 = 0;\n let elm;\n let childNode;\n let oldVNode;\n if (!useNativeShadowDom) {\n checkSlotRelocate = true;\n if (newVNode2.$tag$ === \"slot\") {\n newVNode2.$flags$ |= newVNode2.$children$ ? (\n // slot element has fallback content\n // still create an element that \"mocks\" the slot element\n 2 /* isSlotFallback */\n ) : (\n // slot element does not have fallback content\n // create an html comment we'll use to always reference\n // where actual slot content should sit next to\n 1 /* isSlotReference */\n );\n }\n }\n if (newVNode2.$text$ != null) {\n elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);\n } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {\n elm = newVNode2.$elm$ = win.document.createTextNode(\"\");\n {\n updateElement(null, newVNode2, isSvgMode);\n }\n } else {\n if (!isSvgMode) {\n isSvgMode = newVNode2.$tag$ === \"svg\";\n }\n if (!win.document) {\n throw new Error(\"You are trying to render a Stencil component in an environment that doesn't support the DOM.\");\n }\n elm = newVNode2.$elm$ = win.document.createElementNS(\n isSvgMode ? SVG_NS : HTML_NS,\n !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? \"slot-fb\" : newVNode2.$tag$\n ) ;\n if (isSvgMode && newVNode2.$tag$ === \"foreignObject\") {\n isSvgMode = false;\n }\n {\n updateElement(null, newVNode2, isSvgMode);\n }\n if (isDef(scopeId) && elm[\"s-si\"] !== scopeId) {\n elm.classList.add(elm[\"s-si\"] = scopeId);\n }\n if (newVNode2.$children$) {\n const appendTarget = newVNode2.$tag$ === \"template\" ? elm.content : elm;\n for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {\n childNode = createElm(oldParentVNode, newVNode2, i2);\n if (childNode) {\n appendTarget.appendChild(childNode);\n }\n }\n }\n {\n if (newVNode2.$tag$ === \"svg\") {\n isSvgMode = false;\n } else if (elm.tagName === \"foreignObject\") {\n isSvgMode = true;\n }\n }\n }\n elm[\"s-hn\"] = hostTagName;\n {\n if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {\n elm[\"s-sr\"] = true;\n elm[\"s-cr\"] = contentRef;\n elm[\"s-sn\"] = newVNode2.$name$ || \"\";\n elm[\"s-rf\"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;\n patchSlotNode(elm);\n oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];\n if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {\n relocateToHostRoot(oldParentVNode.$elm$);\n }\n {\n addRemoveSlotScopedClass(contentRef, elm, newParentVNode.$elm$, oldParentVNode == null ? void 0 : oldParentVNode.$elm$);\n }\n }\n }\n return elm;\n};\nvar relocateToHostRoot = (parentElm) => {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n const host = parentElm.closest(hostTagName.toLowerCase());\n if (host != null) {\n const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(\n (ref) => ref[\"s-cr\"]\n );\n const childNodeArray = Array.from(\n parentElm.__childNodes || parentElm.childNodes\n );\n for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {\n if (childNode[\"s-sh\"] != null) {\n insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);\n childNode[\"s-sh\"] = void 0;\n checkSlotRelocate = true;\n }\n }\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n};\nvar putBackInOriginalLocation = (parentElm, recursive) => {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);\n if (parentElm[\"s-sr\"]) {\n let node = parentElm;\n while (node = node.nextSibling) {\n if (node && node[\"s-sn\"] === parentElm[\"s-sn\"] && node[\"s-sh\"] === hostTagName) {\n oldSlotChildNodes.push(node);\n }\n }\n }\n for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {\n const childNode = oldSlotChildNodes[i2];\n if (childNode[\"s-hn\"] !== hostTagName && childNode[\"s-ol\"]) {\n insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));\n childNode[\"s-ol\"].remove();\n childNode[\"s-ol\"] = void 0;\n childNode[\"s-sh\"] = void 0;\n checkSlotRelocate = true;\n }\n if (recursive) {\n putBackInOriginalLocation(childNode, recursive);\n }\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n};\nvar addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {\n let containerElm = parentElm[\"s-cr\"] && parentElm[\"s-cr\"].parentNode || parentElm;\n let childNode;\n if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {\n containerElm = containerElm.shadowRoot;\n }\n if (parentVNode.$tag$ === \"template\") {\n containerElm = containerElm.content;\n }\n for (; startIdx <= endIdx; ++startIdx) {\n if (vnodes[startIdx]) {\n childNode = createElm(null, parentVNode, startIdx);\n if (childNode) {\n vnodes[startIdx].$elm$ = childNode;\n insertBefore(containerElm, childNode, referenceNode(before) );\n }\n }\n }\n};\nvar removeVnodes = (vnodes, startIdx, endIdx) => {\n for (let index = startIdx; index <= endIdx; ++index) {\n const vnode = vnodes[index];\n if (vnode) {\n const elm = vnode.$elm$;\n nullifyVNodeRefs(vnode);\n if (elm) {\n {\n checkSlotFallbackVisibility = true;\n if (elm[\"s-ol\"]) {\n elm[\"s-ol\"].remove();\n } else {\n putBackInOriginalLocation(elm, true);\n }\n }\n elm.remove();\n }\n }\n }\n};\nvar updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => {\n let oldStartIdx = 0;\n let newStartIdx = 0;\n let idxInOld = 0;\n let i2 = 0;\n let oldEndIdx = oldCh.length - 1;\n let oldStartVnode = oldCh[0];\n let oldEndVnode = oldCh[oldEndIdx];\n let newEndIdx = newCh.length - 1;\n let newStartVnode = newCh[0];\n let newEndVnode = newCh[newEndIdx];\n let node;\n let elmToMove;\n const containerElm = newVNode2.$tag$ === \"template\" ? parentElm.content : parentElm;\n while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {\n if (oldStartVnode == null) {\n oldStartVnode = oldCh[++oldStartIdx];\n } else if (oldEndVnode == null) {\n oldEndVnode = oldCh[--oldEndIdx];\n } else if (newStartVnode == null) {\n newStartVnode = newCh[++newStartIdx];\n } else if (newEndVnode == null) {\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {\n patch(oldStartVnode, newStartVnode, isInitialRender);\n oldStartVnode = oldCh[++oldStartIdx];\n newStartVnode = newCh[++newStartIdx];\n } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {\n patch(oldEndVnode, newEndVnode, isInitialRender);\n oldEndVnode = oldCh[--oldEndIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {\n if ((oldStartVnode.$tag$ === \"slot\" || newEndVnode.$tag$ === \"slot\")) {\n putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);\n }\n patch(oldStartVnode, newEndVnode, isInitialRender);\n insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);\n oldStartVnode = oldCh[++oldStartIdx];\n newEndVnode = newCh[--newEndIdx];\n } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {\n if ((oldStartVnode.$tag$ === \"slot\" || newEndVnode.$tag$ === \"slot\")) {\n putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);\n }\n patch(oldEndVnode, newStartVnode, isInitialRender);\n insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);\n oldEndVnode = oldCh[--oldEndIdx];\n newStartVnode = newCh[++newStartIdx];\n } else {\n idxInOld = -1;\n {\n for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {\n if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {\n idxInOld = i2;\n break;\n }\n }\n }\n if (idxInOld >= 0) {\n elmToMove = oldCh[idxInOld];\n if (elmToMove.$tag$ !== newStartVnode.$tag$) {\n node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);\n } else {\n patch(elmToMove, newStartVnode, isInitialRender);\n oldCh[idxInOld] = void 0;\n node = elmToMove.$elm$;\n }\n newStartVnode = newCh[++newStartIdx];\n } else {\n node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);\n newStartVnode = newCh[++newStartIdx];\n }\n if (node) {\n {\n insertBefore(\n referenceNode(oldStartVnode.$elm$).parentNode,\n node,\n referenceNode(oldStartVnode.$elm$)\n );\n }\n }\n }\n }\n if (oldStartIdx > oldEndIdx) {\n addVnodes(\n parentElm,\n newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$,\n newVNode2,\n newCh,\n newStartIdx,\n newEndIdx\n );\n } else if (newStartIdx > newEndIdx) {\n removeVnodes(oldCh, oldStartIdx, oldEndIdx);\n }\n};\nvar isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {\n if (leftVNode.$tag$ === rightVNode.$tag$) {\n if (leftVNode.$tag$ === \"slot\") {\n return leftVNode.$name$ === rightVNode.$name$;\n }\n if (!isInitialRender) {\n return leftVNode.$key$ === rightVNode.$key$;\n }\n if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {\n leftVNode.$key$ = rightVNode.$key$;\n }\n return true;\n }\n return false;\n};\nvar referenceNode = (node) => node && node[\"s-ol\"] || node;\nvar patch = (oldVNode, newVNode2, isInitialRender = false) => {\n const elm = newVNode2.$elm$ = oldVNode.$elm$;\n const oldChildren = oldVNode.$children$;\n const newChildren = newVNode2.$children$;\n const tag = newVNode2.$tag$;\n const text = newVNode2.$text$;\n let defaultHolder;\n if (text == null) {\n {\n isSvgMode = tag === \"svg\" ? true : tag === \"foreignObject\" ? false : isSvgMode;\n }\n {\n if (tag === \"slot\" && !useNativeShadowDom) {\n if (oldVNode.$name$ !== newVNode2.$name$) {\n newVNode2.$elm$[\"s-sn\"] = newVNode2.$name$ || \"\";\n relocateToHostRoot(newVNode2.$elm$.parentElement);\n }\n }\n updateElement(oldVNode, newVNode2, isSvgMode);\n }\n if (oldChildren !== null && newChildren !== null) {\n updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);\n } else if (newChildren !== null) {\n if (oldVNode.$text$ !== null) {\n elm.textContent = \"\";\n }\n addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);\n } else if (\n // don't do this on initial render as it can cause non-hydrated content to be removed\n !isInitialRender && BUILD.updatable && oldChildren !== null\n ) {\n removeVnodes(oldChildren, 0, oldChildren.length - 1);\n } else ;\n if (isSvgMode && tag === \"svg\") {\n isSvgMode = false;\n }\n } else if ((defaultHolder = elm[\"s-cr\"])) {\n defaultHolder.parentNode.textContent = text;\n } else if (oldVNode.$text$ !== text) {\n elm.data = text;\n }\n};\nvar relocateNodes = [];\nvar markSlotContentForRelocation = (elm) => {\n let node;\n let hostContentNodes;\n let j;\n const children = elm.__childNodes || elm.childNodes;\n for (const childNode of children) {\n if (childNode[\"s-sr\"] && (node = childNode[\"s-cr\"]) && node.parentNode) {\n hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;\n const slotName = childNode[\"s-sn\"];\n for (j = hostContentNodes.length - 1; j >= 0; j--) {\n node = hostContentNodes[j];\n if (!node[\"s-cn\"] && !node[\"s-nr\"] && node[\"s-hn\"] !== childNode[\"s-hn\"] && (!node[\"s-sh\"] || node[\"s-sh\"] !== childNode[\"s-hn\"])) {\n if (isNodeLocatedInSlot(node, slotName)) {\n let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);\n checkSlotFallbackVisibility = true;\n node[\"s-sn\"] = node[\"s-sn\"] || slotName;\n if (relocateNodeData) {\n relocateNodeData.$nodeToRelocate$[\"s-sh\"] = childNode[\"s-hn\"];\n relocateNodeData.$slotRefNode$ = childNode;\n } else {\n node[\"s-sh\"] = childNode[\"s-hn\"];\n relocateNodes.push({\n $slotRefNode$: childNode,\n $nodeToRelocate$: node\n });\n }\n if (node[\"s-sr\"]) {\n relocateNodes.map((relocateNode) => {\n if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node[\"s-sn\"])) {\n relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);\n if (relocateNodeData && !relocateNode.$slotRefNode$) {\n relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;\n }\n }\n });\n }\n } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {\n relocateNodes.push({\n $nodeToRelocate$: node\n });\n }\n }\n }\n }\n if (childNode.nodeType === 1 /* ElementNode */) {\n markSlotContentForRelocation(childNode);\n }\n }\n};\nvar nullifyVNodeRefs = (vNode) => {\n {\n if (vNode.$attrs$ && vNode.$attrs$.ref) {\n refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));\n }\n vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);\n }\n};\nvar queueRefAttachment = (refCallback, elm) => {\n {\n refCallbacksToAttach.push(() => refCallback(elm));\n }\n};\nvar flushQueuedRefCallbacks = () => {\n {\n refCallbacksToRemove.forEach((cb) => cb());\n refCallbacksToRemove.length = 0;\n refCallbacksToAttach.forEach((cb) => cb());\n refCallbacksToAttach.length = 0;\n }\n};\nvar insertBefore = (parent, newNode, reference, isInitialLoad) => {\n {\n if (typeof newNode[\"s-sn\"] === \"string\" && !!newNode[\"s-sr\"] && !!newNode[\"s-cr\"]) {\n addRemoveSlotScopedClass(newNode[\"s-cr\"], newNode, parent, newNode.parentElement);\n } else if (typeof newNode[\"s-sn\"] === \"string\") {\n parent.insertBefore(newNode, reference);\n const { slotNode } = findSlotFromSlottedNode(newNode);\n if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);\n return newNode;\n }\n }\n if (parent.__insertBefore) {\n return parent.__insertBefore(newNode, reference);\n } else {\n return parent == null ? void 0 : parent.insertBefore(newNode, reference);\n }\n};\nfunction addRemoveSlotScopedClass(reference, slotNode, newParent, oldParent) {\n var _a, _b;\n let scopeId2;\n if (reference && typeof slotNode[\"s-sn\"] === \"string\" && !!slotNode[\"s-sr\"] && reference.parentNode && reference.parentNode[\"s-sc\"] && (scopeId2 = slotNode[\"s-si\"] || reference.parentNode[\"s-sc\"])) {\n const scopeName = slotNode[\"s-sn\"];\n const hostName = slotNode[\"s-hn\"];\n (_a = newParent.classList) == null ? void 0 : _a.add(scopeId2 + \"-s\");\n if (oldParent && ((_b = oldParent.classList) == null ? void 0 : _b.contains(scopeId2 + \"-s\"))) {\n let child = (oldParent.__childNodes || oldParent.childNodes)[0];\n let found = false;\n while (child) {\n if (child[\"s-sn\"] !== scopeName && child[\"s-hn\"] === hostName && !!child[\"s-sr\"]) {\n found = true;\n break;\n }\n child = child.nextSibling;\n }\n if (!found) oldParent.classList.remove(scopeId2 + \"-s\");\n }\n }\n}\nvar renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {\n var _a, _b, _c, _d, _e;\n const hostElm = hostRef.$hostElement$;\n const cmpMeta = hostRef.$cmpMeta$;\n const oldVNode = hostRef.$vnode$ || newVNode(null, null);\n const isHostElement = isHost(renderFnResults);\n const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);\n hostTagName = hostElm.tagName;\n if (cmpMeta.$attrsToReflect$) {\n rootVnode.$attrs$ = rootVnode.$attrs$ || {};\n cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {\n if (BUILD.serializer && hostRef.$serializerValues$.has(propName)) {\n rootVnode.$attrs$[attribute] = hostRef.$serializerValues$.get(propName);\n } else {\n rootVnode.$attrs$[attribute] = hostElm[propName];\n }\n });\n }\n if (isInitialLoad && rootVnode.$attrs$) {\n for (const key of Object.keys(rootVnode.$attrs$)) {\n if (hostElm.hasAttribute(key) && ![\"key\", \"ref\", \"style\", \"class\"].includes(key)) {\n rootVnode.$attrs$[key] = hostElm[key];\n }\n }\n }\n rootVnode.$tag$ = null;\n rootVnode.$flags$ |= 4 /* isHost */;\n hostRef.$vnode$ = rootVnode;\n rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;\n {\n scopeId = hostElm[\"s-sc\"];\n }\n useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);\n {\n contentRef = hostElm[\"s-cr\"];\n checkSlotFallbackVisibility = false;\n }\n patch(oldVNode, rootVnode, isInitialLoad);\n {\n plt.$flags$ |= 1 /* isTmpDisconnected */;\n if (checkSlotRelocate) {\n markSlotContentForRelocation(rootVnode.$elm$);\n for (const relocateData of relocateNodes) {\n const nodeToRelocate = relocateData.$nodeToRelocate$;\n if (!nodeToRelocate[\"s-ol\"] && win.document) {\n const orgLocationNode = win.document.createTextNode(\"\");\n orgLocationNode[\"s-nr\"] = nodeToRelocate;\n insertBefore(\n nodeToRelocate.parentNode,\n nodeToRelocate[\"s-ol\"] = orgLocationNode,\n nodeToRelocate,\n isInitialLoad\n );\n }\n }\n for (const relocateData of relocateNodes) {\n const nodeToRelocate = relocateData.$nodeToRelocate$;\n const slotRefNode = relocateData.$slotRefNode$;\n if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {\n nodeToRelocate[\"s-ih\"] = (_a = nodeToRelocate.hidden) != null ? _a : false;\n }\n if (slotRefNode) {\n const parentNodeRef = slotRefNode.parentNode;\n let insertBeforeNode = slotRefNode.nextSibling;\n if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {\n let orgLocationNode = (_b = nodeToRelocate[\"s-ol\"]) == null ? void 0 : _b.previousSibling;\n while (orgLocationNode) {\n let refNode = (_c = orgLocationNode[\"s-nr\"]) != null ? _c : null;\n if (refNode && refNode[\"s-sn\"] === nodeToRelocate[\"s-sn\"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {\n refNode = refNode.nextSibling;\n while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode[\"s-sr\"])) {\n refNode = refNode == null ? void 0 : refNode.nextSibling;\n }\n if (!refNode || !refNode[\"s-nr\"]) {\n insertBeforeNode = refNode;\n break;\n }\n }\n orgLocationNode = orgLocationNode.previousSibling;\n }\n }\n const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;\n const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;\n if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {\n if (nodeToRelocate !== insertBeforeNode) {\n insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);\n if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith(\"s-nt-\")) {\n const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, \"\"));\n textNode[\"s-hn\"] = nodeToRelocate[\"s-hn\"];\n textNode[\"s-sn\"] = nodeToRelocate[\"s-sn\"];\n textNode[\"s-sh\"] = nodeToRelocate[\"s-sh\"];\n textNode[\"s-sr\"] = nodeToRelocate[\"s-sr\"];\n textNode[\"s-ol\"] = nodeToRelocate[\"s-ol\"];\n textNode[\"s-ol\"][\"s-nr\"] = textNode;\n insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);\n nodeToRelocate.parentNode.removeChild(nodeToRelocate);\n }\n if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== \"SLOT-FB\") {\n nodeToRelocate.hidden = (_d = nodeToRelocate[\"s-ih\"]) != null ? _d : false;\n }\n }\n }\n nodeToRelocate && typeof slotRefNode[\"s-rf\"] === \"function\" && slotRefNode[\"s-rf\"](slotRefNode);\n } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {\n nodeToRelocate.hidden = true;\n }\n }\n }\n if (checkSlotFallbackVisibility) {\n updateFallbackSlotVisibility(rootVnode.$elm$);\n }\n plt.$flags$ &= -2 /* isTmpDisconnected */;\n relocateNodes.length = 0;\n }\n if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm[\"s-cr\"]) {\n const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;\n for (const childNode of children) {\n if (childNode[\"s-hn\"] !== hostTagName && !childNode[\"s-sh\"]) {\n if (isInitialLoad && childNode[\"s-ih\"] == null) {\n childNode[\"s-ih\"] = (_e = childNode.hidden) != null ? _e : false;\n }\n if (childNode.nodeType === 1 /* ElementNode */) {\n childNode.hidden = true;\n } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {\n const textCommentNode = win.document.createComment(\"s-nt-\" + childNode.nodeValue);\n textCommentNode[\"s-sn\"] = childNode[\"s-sn\"];\n insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);\n childNode.parentNode.removeChild(childNode);\n }\n }\n }\n }\n contentRef = void 0;\n flushQueuedRefCallbacks();\n};\n\n/**\n * @type {import('htmlfy').Config}\n */\nconst CONFIG = {\n content_wrap: 0,\n ignore: [],\n ignore_with: '!i-£___£%_',\n strict: false,\n tab_size: 2,\n tag_wrap: 0,\n trim: []\n};\n\nconst VOID_ELEMENTS = [\n 'area', 'base', 'br', 'col', 'embed', 'hr', \n 'img', 'input', 'link', 'meta',\n 'param', 'source', 'track', 'wbr'\n];\n\n/**\n * Defined by state.js and configuration.\n * \n * CONTENT_IGNORE_PLACEHOLDER\n * SELF_CLOSING_PLACEHOLDER\n * ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n\n/**\n * @typedef {object} Constants\n * @property {string} CONTENT_IGNORE_PLACEHOLDER\n * @property {string} SELF_CLOSING_PLACEHOLDER\n * @property {string} ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n/**\n * @typedef {object} State\n * @property {boolean} checked_html - If passed in HTML has been checked for HTML within it.\n * @property {import(\"htmlfy\").Config} config - Validated configuration.\n * @property {boolean} ignored\n * @property {Constants} constants - Constant strings, influenced by ignore_with.\n */\n\n/**\n * @type State\n * \n * `constants` prefixes and suffixes must be in sync with those in utils.js\n */\nconst state = {\n checked_html: false,\n config: { ...CONFIG },\n ignored: false,\n constants: {\n CONTENT_IGNORE_PLACEHOLDER: `${CONFIG.ignore_with}_`,\n SELF_CLOSING_PLACEHOLDER: `${CONFIG.ignore_with}/_>`,\n ATTRIBUTE_IGNORE_PLACEHOLDER: `${CONFIG.ignore_with}=_`\n }\n};\n\n/**\n * \n * @returns {State}\n */\nconst getState = () => state;\n\n/**\n * \n * @param {Partial<State>} new_state \n */\nconst setState = (new_state) => Object.assign(state, new_state);\n\n/**\n * Checks if content contains at least one HTML element or custom HTML element.\n * \n * The first regex matches void and self-closing elements.\n * The second regex matches normal HTML elements, plus they can have a namespace.\n * The third regex matches custom HTML elemtns, plus they can have a namespace.\n * \n * HTML elements should begin with a letter, and can end with a letter or number.\n * \n * Custom elements must begin with a letter, and can end with a letter, number,\n * hyphen, underscore, or period. However, all letters must be lowercase.\n * They must have at least one hyphen, and can only have periods and underscores if there is a hyphen.\n * \n * These regexes are based on\n * https://w3c.github.io/html-reference/syntax.html#tag-name\n * and\n * https://html.spec.whatwg.org/multipage/custom-elements.html#valid-custom-element-name\n * respectively.\n * \n * @param {string} content Content to evaluate.\n * @returns {boolean} A boolean.\n */\nconst isHtml = (content) => {\n setState({ checked_html: true });\n\n return /<(?:[A-Za-z]+[A-Za-z0-9]*)(?:\\s+.*?)*?\\/{0,1}>/.test(content) ||\n /<(?<Element>(?:[A-Za-z]+[A-Za-z0-9]*:)?(?:[A-Za-z]+[A-Za-z0-9]*))(?:\\s+.*?)*?>(?:.|\\n)*?<\\/{1}\\k<Element>>/.test(content) || \n /<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\\s+.*?)*?>(?:.|\\n)*?<\\/{1}\\k<Element>>/.test(content)\n};\n\n/**\n * Generic utility which merges two objects.\n * \n * @param {any} current Original object.\n * @param {any} updates Object to merge with original.\n * @returns {any}\n */\nconst mergeObjects = (current, updates) => {\n if (!current || !updates)\n throw new Error(\"Both 'current' and 'updates' must be passed-in to mergeObjects()\")\n\n /**\n * @type {any}\n */\n let merged;\n \n if (Array.isArray(current)) {\n merged = structuredClone(current).concat(updates);\n } else if (typeof current === 'object') {\n merged = { ...current };\n for (let key of Object.keys(updates)) {\n if (typeof updates[key] !== 'object') {\n merged[key] = updates[key];\n } else {\n /* key is an object, run mergeObjects again. */\n merged[key] = mergeObjects(merged[key] || {}, updates[key]);\n }\n }\n }\n\n return merged\n};\n\n/**\n * Merge a user config with the default config.\n * \n * @param {import('htmlfy').Config} default_config The default config.\n * @param {import('htmlfy').UserConfig} config The user config.\n * @returns {import('htmlfy').Config}\n */\nconst mergeConfig = (default_config, config) => {\n const validated_config = mergeObjects(default_config, config);\n\n /* Below `constants` prefixes and suffixes must be in sync with those in state.js */\n setState({ \n config: validated_config,\n constants: {\n CONTENT_IGNORE_PLACEHOLDER: `${validated_config.ignore_with}_`,\n SELF_CLOSING_PLACEHOLDER: `${validated_config.ignore_with}/_>`,\n ATTRIBUTE_IGNORE_PLACEHOLDER: `${validated_config.ignore_with}=_`\n }\n });\n return validated_config\n};\n\n/**\n * \n * @param {string} html \n */\nconst protectAttributes = (html) => {\n const { constants } = getState();\n\n html = html.replace(/<[\\w:\\-]+([^>]*[^\\/])>/g, (/** @type {string} */match, /** @type {any} */capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(/\\n/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'ws!')\n })\n });\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst protectContent = (html) => {\n const { constants } = getState();\n\n return html\n .replace(/\\n/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'ws!')\n};\n\n/**\n * \n * @param {string} html \n */\nconst finalProtectContent = (html) => {\n const regex = /\\s*<([a-zA-Z0-9:-]+)[^>]*>\\n\\s*<\\/\\1>(?=\\n[ ]*[^\\n]*__!i-£___£%__[^\\n]*\\n)(\\n[ ]*\\S[^\\n]*\\n)|<([a-zA-Z0-9:-]+)[^>]*>(?=\\n[ ]*[^\\n]*__!i-£___£%__[^\\n]*\\n)(\\n[ ]*\\S[^\\n]*\\n\\s*)<\\/\\3>/g; \n const { constants } = getState();\n\n return html\n .replace(regex, (/** @type {string} */match, p1, p2, p3, p4) => {\n const text_to_protect = p2 || p4;\n\n if (!text_to_protect)\n return match\n\n const protected_text = text_to_protect\n .replace(/\\n/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!')\n .replace(/\\r/g, constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!')\n .replace(/\\s/g, constants.CONTENT_IGNORE_PLACEHOLDER + \"ws!\");\n\n return match.replace(text_to_protect, protected_text)\n })\n};\n\n/**\n * Replace html brackets with ignore string.\n * \n * @param {string} html \n * @returns {string}\n */\nconst setIgnoreAttribute = (html) => {\n const regex = /<([A-Za-z][A-Za-z0-9]*|[a-z][a-z0-9._]*-[a-z0-9._-]+)((?:\\s+[A-Za-z0-9_-]+=\"[^\"]*\"|\\s*[a-z]*)*)>/g; \n const { constants } = getState();\n\n html = html.replace(regex, (/** @type {string} */match, p1, p2) => {\n return match.replace(p2, (match) => {\n return match\n .replace(/</g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'lt!')\n .replace(/>/g, constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'gt!')\n })\n });\n \n return html\n};\n\n/**\n * Trim leading and trailing whitespace characters.\n * \n * @param {string} html\n * @param {string[]} trim\n * @returns {string}\n */\nconst trimify = (html, trim) => {\n for (let e = 0; e < trim.length; e++) {\n /* Whitespace character must be escaped with '\\' or RegExp() won't include it. */\n const leading_whitespace = new RegExp(`(<${trim[e]}[^>]*>)\\\\s+`, \"g\");\n const trailing_whitespace = new RegExp(`\\\\s+(</${trim[e]}>)`, \"g\");\n\n html = html\n .replace(leading_whitespace, '$1')\n .replace(trailing_whitespace, '$1');\n }\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst unprotectAttributes = (html) => {\n const { constants } = getState();\n\n html = html.replace(/<[\\w:\\-]+([^>]*[^\\/])>/g, (/** @type {string} */match, /** @type {any} */capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'nl!', \"g\"), '\\n')\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'cr!', \"g\"), '\\r')\n .replace(new RegExp(constants.ATTRIBUTE_IGNORE_PLACEHOLDER + 'ws!', \"g\"), ' ')\n })\n });\n\n return html\n};\n\n/**\n * \n * @param {string} html \n */\nconst unprotectContent = (html) => {\n const { constants } = getState();\n\n html = html.replace(new RegExp(`.*${constants.CONTENT_IGNORE_PLACEHOLDER}[a-z]{2}!.*`, \"g\"), (/** @type {string} */match) => {\n return match.replace(new RegExp(`${constants.CONTENT_IGNORE_PLACEHOLDER}[a-z]{2}!`, \"g\"), (match) => {\n return match\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'nl!', \"g\"), '\\n')\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'cr!', \"g\"), '\\r')\n .replace(new RegExp(constants.CONTENT_IGNORE_PLACEHOLDER + 'ws!', \"g\"), ' ')\n })\n });\n\n return html\n};\n\n/**\n * Replace ignore string with html brackets.\n * \n * @param {string} html \n * @returns {string}\n */\nconst unsetIgnoreAttribute = (html) => {\n /* Regex to find opening tags and capture their attributes. */\n const tagRegex = /<([\\w:\\-]+)([^>]*)>/g;\n const { constants } = getState();\n const escapedIgnoreString = constants.ATTRIBUTE_IGNORE_PLACEHOLDER.replace(\n /[-\\/\\\\^$*+?.()|[\\]{}]/g,\n \"\\\\$&\"\n );\n const ltPlaceholderRegex = new RegExp(escapedIgnoreString + \"lt!\", \"g\");\n const gtPlaceholderRegex = new RegExp(escapedIgnoreString + \"gt!\", \"g\");\n\n return html.replace(\n tagRegex,\n (\n /** @type {string} */ fullMatch,\n /** @type {string} */ tagName,\n /** @type {string} */ attributesCapture\n ) => {\n const processedAttributes = attributesCapture\n .replace(ltPlaceholderRegex, \"<\")\n .replace(gtPlaceholderRegex, \">\");\n\n /* Reconstruct the tag. */\n return `<${tagName}${processedAttributes}>`\n }\n )\n};\n\n/**\n * Validate any passed-in config options and merge with CONFIG.\n * \n * @param {import('htmlfy').UserConfig} config A user config.\n * @returns {import('htmlfy').Config} A validated config.\n */\nconst validateConfig = (config) => {\n if (typeof config !== 'object') throw new Error('Config must be an object.')\n \n const default_config = { ...CONFIG };\n\n const config_empty = !(\n Object.hasOwn(config, 'content_wrap') ||\n Object.hasOwn(config, 'ignore') || \n Object.hasOwn(config, 'ignore_with') || \n Object.hasOwn(config, 'strict') || \n Object.hasOwn(config, 'tab_size') || \n Object.hasOwn(config, 'tag_wrap') || \n Object.hasOwn(config, 'trim')\n );\n\n if (config_empty) {\n setState({ config: default_config });\n return default_config\n }\n\n let tab_size = config.tab_size;\n\n if (tab_size) {\n if (typeof tab_size !== 'number') throw new Error(`tab_size must be a number, not ${typeof config.tab_size}.`)\n\n const safe = Number.isSafeInteger(tab_size);\n if (!safe) throw new Error(`Tab size ${tab_size} is not safe. See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger for more info.`)\n\n /** \n * Round down, just in case a safe floating point,\n * like 4.0, was passed.\n */\n tab_size = Math.floor(tab_size);\n if (tab_size < 1 || tab_size > 16) throw new Error('Tab size out of range. Expecting 1 to 16.')\n \n config.tab_size = tab_size;\n }\n\n if (Object.hasOwn(config, 'content_wrap') && typeof config.content_wrap !== 'number')\n throw new Error(`content_wrap config must be a number, not ${typeof config.content_wrap}.`)\n\n if (Object.hasOwn(config, 'ignore') && (!Array.isArray(config.ignore) || !config.ignore?.every((e) => typeof e === 'string')))\n throw new Error('Ignore config must be an array of strings.')\n\n if (Object.hasOwn(config, 'ignore_with')) {\n if (typeof config.ignore_with !== 'string')\n throw new Error(`ignore_with must be a string, not ${typeof config.ignore_with}.`)\n else if (config.ignore_with.startsWith('_'))\n /**\n * This negatively affects processing of preserved tag attributes,\n * because tag names can end with an underscore, so the regex\n * does not capture them.\n */\n throw new Error(`ignore_with cannot start with an underscore.`)\n }\n\n if (Object.hasOwn(config, 'strict') && typeof config.strict !== 'boolean')\n throw new Error(`Strict config must be a boolean, not ${typeof config.strict}.`)\n \n if (Object.hasOwn(config, 'tag_wrap') && typeof config.tag_wrap !== 'number')\n throw new Error(`tag_wrap config must be a number, not ${typeof config.tag_wrap}.`)\n\n if (Object.hasOwn(config, 'trim') && (!Array.isArray(config.trim) || !config.trim?.every((e) => typeof e === 'string')))\n throw new Error('Trim config must be an array of strings.')\n\n return mergeConfig(default_config, config)\n\n};\n\n/**\n * \n * @param {string} text \n * @param {number} width \n * @param {string} indent\n */\nconst wordWrap = (text, width, indent) => {\n const words = text.trim().split(/\\s+/);\n \n if (words.length === 0 || (words.length === 1 && words[0] === ''))\n return \"\"\n\n const lines = [];\n let current_line = \"\";\n const padding_string = indent;\n\n words.forEach((word) => {\n if (word === \"\") return\n\n if (word.length >= width) {\n /* If there's content on the current line, push it first with correct padding. */\n if (current_line !== \"\")\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n\n /* Push a long word on its own line with correct padding. */\n lines.push(lines.length === 0 ? indent + word : padding_string + word);\n current_line = \"\"; // Reset current line\n return // Move to the next word\n }\n\n /* Check if adding the next word exceeds the wrap width. */\n const test_line = current_line === \"\" ? word : current_line + \" \" + word;\n\n if (test_line.length <= width) {\n current_line = test_line;\n } else {\n /* Word doesn't fit, finish the current line and push it. */\n if (current_line !== \"\") {\n /* Add padding based on whether it's the first line added or not. */\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n }\n /* Start a new line with the current word. */\n current_line = word;\n }\n });\n\n /* Add the last remaining line with appropriate padding. */\n if (current_line !== \"\")\n lines.push(lines.length === 0 ? indent + current_line : padding_string + current_line);\n\n const result = lines.join(\"\\n\");\n\n return protectContent(result)\n};\n\n/**\n * Extract any HTML blocks to be ignored,\n * and replace them with a placeholder\n * for re-insertion later.\n * \n * @param {string} html \n * @returns {{ html_with_markers: string, extracted_map: Map<any,any> }}\n */\nfunction extractIgnoredBlocks(html) {\n setState({ ignored: true });\n const config = (getState()).config;\n let current_html = html;\n const extracted_blocks = new Map();\n let marker_id = 0;\n const MARKER_PREFIX = \"___HTMLFY_SPECIAL_IGNORE_MARKER_\";\n\n for (const tag of config.ignore) {\n /* Ensure tag is escaped if it can contain regex special chars. */\n const safe_tag_name = tag.replace(/[-\\/\\\\^$*+?.()|[\\]{}]/g, \"\\\\$&\");\n\n const regex = new RegExp(\n `(<\\\\s*${safe_tag_name}[^>]*>)(.*?)(<\\\\s*\\/\\\\s*${safe_tag_name}\\\\s*>)`,\n \"gs\" // global and dotAll\n );\n\n /** @type RegExpExecArray | null */\n let match;\n\n /**\n * @type {{ start: number; end: number; marker: string }[]}\n */\n const replacements = [];\n\n while ((match = regex.exec(current_html)) !== null) {\n const marker = `${MARKER_PREFIX}${marker_id++}___`;\n\n /* Only store content, and minify tags later. */\n extracted_blocks.set(marker, match[2]);\n \n replacements.push({\n start: match.index + match[1].length, // start of content\n end: match.index + match[1].length + match[2].length, // end of content\n marker: marker,\n });\n }\n\n /* Apply replacements from the end to the beginning to keep indices valid. */\n for (let i = replacements.length - 1; i >= 0; i--) {\n const rep = replacements[i];\n current_html =\n current_html.substring(0, rep.start) +\n rep.marker +\n current_html.substring(rep.end);\n }\n }\n\n return { html_with_markers: current_html, extracted_map: extracted_blocks }\n}\n\n/**\n * Re-insert ignored HTML blocks.\n * \n * @param {string} html_with_markers \n * @param {Map<any,any>} extracted_map \n * @returns \n */\nfunction reinsertIgnoredBlocks(html_with_markers, extracted_map) {\n setState({ ignored: false });\n let final_html = html_with_markers;\n\n for (const [marker, original_block] of extracted_map) {\n final_html = final_html.split(marker).join(original_block);\n }\n return final_html\n}\n\nconst void_element_regex = new RegExp(`<(${VOID_ELEMENTS.join(\"|\")})(?:\\\\s(?:[^/>]|/(?!>))*)*>`, 'g');\n\n/**\n * Add a placeholder for void elements that are not self-closing.\n * This is for internal processing only.\n * \n * @param {string} html \n * @returns \n */\nfunction setSelfClosing(html) {\n const { constants } = getState();\n\n return html.replace(\n // match only void elements that are not self-closing\n void_element_regex,\n match => match.replace(/>$/, constants.SELF_CLOSING_PLACEHOLDER)\n )\n}\n\n/**\n * Remove internal placeholder for non-native self-closing void elements.\n * \n * @param {string} html \n * @returns \n */\nfunction unsetSelfClosing(html) {\n const { constants } = getState();\n\n return html.replace(constants.SELF_CLOSING_PLACEHOLDER, \">\")\n}\n\n/**\n * Enforce entity characters for textarea content.\n * To also minifiy tags, pass `minify` as `true`.\n * \n * @param {string} html The HTML string to evaluate.\n * @param {boolean} [minify] Minifies the textarea tags themselves. \n * Defaults to `false`. We recommend a value of `true` if you're running `entify()` \n * as a standalone function.\n * @returns {string}\n * @example <textarea>3 > 2</textarea> => <textarea>3&nbsp;&gt;&nbsp;2</textarea>\n * @example With minify.\n * <textarea >3 > 2</textarea> => <textarea>3&nbsp;&gt;&nbsp;2</textarea>\n */\nconst entify = (html, minify = false) => {\n /** \n * Use entities inside textarea content.\n */\n html = html.replace(/<\\s*textarea[^>]*>((.|\\n)*?)<s*\\/\\s*textarea\\s*>/g, (match, capture) => {\n return match.replace(capture, (match) => {\n return match\n .replace(/</g, '&lt;')\n .replace(/>/g, '&gt;')\n .replace(/\"/g, '&quot;')\n .replace(/'/g, '&apos;')\n .replace(/\\n/g, '&#10;')\n .replace(/\\r/g, '&#13;')\n .replace(/\\s/g, '&nbsp;')\n })\n });\n\n if (minify) {\n html = html.replace(/<\\s*textarea[^>]*>(.|\\n)*?<\\s*\\/\\s*textarea\\s*>/g, (match) => {\n /* This only affects the html tags, since everything else has been entified. */\n return match\n .replace(/\\s+/g, ' ')\n .replace(/\\s>/g, '>')\n .replace(/>\\s/g, '>')\n .replace(/\\s</g, '<')\n .replace(/<\\s/g, '<')\n .replace(/<\\/\\s/g, '<\\/')\n .replace(/class=[\"']\\s/g, (match) => match.replace(/\\s/g, ''))\n .replace(/(class=.*)\\s([\"'])/g, '$1'+'$2')\n });\n }\n\n return html\n};\n\n/**\n * Remove entity characters for textarea content.\n * Currently internal use only.\n * \n * @param {string} html The HTML string to evaluate.\n * @returns {string}\n * @example <textarea>3&nbsp;&gt;&nbsp;2</textarea> => <textarea>3 > 2</textarea>\n */\nconst dentify = (html) => {\n /** \n * Remove entities inside textarea content.\n */\n return html = html.replace(/<textarea[^>]*>((.|\\n)*?)<\\/textarea>/g, (match, capture) => {\n return match.replace(capture, (match) => {\n match = match\n .replace(/&lt;/g, '<')\n .replace(/&gt;/g, '>')\n .replace(/&quot;/g, '\"')\n .replace(/&apos;/g, \"'\")\n .replace(/&#10;/g, '\\n')\n .replace(/&#13;/g, '\\r')\n .replace(/&nbsp;/g, ' ')\n // Ensure we collapse consecutive spaces, or they'll be completely removed later.\n .replace(/\\s+/g, ' ');\n\n return match\n })\n })\n};\n\n/**\n * @type {Map<any,any>}\n */\nlet ignore_map$1;\n\n/**\n * Creates a single-line HTML string\n * by removing line returns, tabs, and relevant spaces.\n * \n * @param {string} html The HTML string to minify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A minified HTML string.\n */\nconst minify = (html, config) => {\n let reinsert_ignored = false;\n const { checked_html, ignored, constants } = getState();\n\n if (!checked_html && !isHtml(html)) return html\n\n const validated_config = (getState()).config;\n const ignore = validated_config.ignore.length > 0;\n\n /* Extract ignored elements. Skipped if prettify has already ignored blocks. */\n if (!ignored && ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html);\n html = html_with_markers;\n ignore_map$1 = extracted_map;\n reinsert_ignored = true;\n }\n\n /**\n * Ensure textarea content is protected\n * before general minification.\n */\n html = entify(html, true);\n\n /* All other minification. */\n // Remove ALL newlines and tabs explicitly.\n html = html.replace(/\\n|\\t/g, '');\n\n // Remove whitespace ONLY between tags.\n html = html.replace(/>\\s+</g, \"><\");\n\n // Collapse any remaining multiple spaces to single spaces.\n html = html.replace(/ {2,}/g, ' ');\n\n // Protect space between text content and an opening tag (e.g., \"text <a>\")\n html = html.replace(\n /(\\S) (<[a-zA-Z][a-zA-Z0-9_:-]*)/g,\n `$1___MINIFY-PROTECTED-SPACE___$2`\n );\n\n // Protect space between a closing tag and text content (e.g., \"</a> text\")\n html = html.replace(\n /(<\\/[a-zA-Z][a-zA-Z0-9_:-]*>) (\\S)/g,\n `$1___MINIFY-PROTECTED-SPACE___$2`\n );\n\n // Remove specific single spaces between tags and whitespace within tags.\n html = html.replace(/ >/g, \">\"); // <tag > -> <tag>\n html = html.replace(/ </g, \"<\"); // leading space before tag\n html = html.replace(/> /g, \">\"); // trailing space after tag\n html = html.replace(/< /g, \"<\"); // < tag> -> <tag>\n html = html.replace(/<\\s+\\//g, '</'); // < /tag> -> </tag>\n html = html.replace(/<\\/\\s+/g, '</'); // </ tag> -> </tag>\n\n // Unprotect space around inner tags\n html = html.replace(new RegExp('___MINIFY-PROTECTED-SPACE___', 'g'), ' ');\n\n // Trim spaces around equals signs in attributes (run before value trim)\n // This handles `attr = \"value\"` -> `attr=\"value\"`\n html = html.replace(/ = /g, \"=\");\n // Consider safer alternatives if needed (e.g., / = \"/g, '=\"')\n\n // Trim whitespace inside attribute values\n html = html.replace(\n /([a-zA-Z0-9_-]+)=(['\"])(.*?)\\2/g,\n (match, attr_name, quote, value) => {\n // value.trim() handles both leading/trailing spaces\n // and cases where the value is only whitespace (becomes empty string)\n const trimmed_value = value.trim();\n return `${attr_name}=${quote}${trimmed_value}${quote}`\n }\n );\n\n // Final trim for the whole string\n html = html.trim();\n\n /* Remove protective entities. */\n html = dentify(html);\n\n /* Re-insert ignored elements. Skipped unless minify did the ignore. */\n if (reinsert_ignored) {\n html = reinsertIgnoredBlocks(html, ignore_map$1);\n }\n\n return html\n};\n\n/**\n * @type {{ line: Record<string,string>[] }}\n */\nconst convert = {\n line: []\n};\n\n/**\n * @type {Map<any,any>}\n */\nlet ignore_map;\n\n/**\n * Isolate tags, content, and comments.\n * \n * @param {string} html The HTML string to evaluate.\n * @example <div>Hello World!</div> => \n * [#-# : 0 : <div> : #-#]\n * Hello World!\n * [#-# : 1 : </div> : #-#]\n */\nconst enqueue = (html) => {\n convert.line = [];\n let i = -1;\n /* Regex to find tags OR text content between tags. */\n const regex = /(<[^>]+>)|([^<]+)/g;\n\n html.replace(regex, (match, c1, c2) => {\n if (c1) {\n convert.line.push({ type: \"tag\", value: match });\n } else if (c2 && c2.trim().length > 0) {\n /* It's text content (and not just whitespace). */\n convert.line.push({ type: \"text\", value: match });\n }\n\n i++;\n return `\\n[#-# : ${i} : ${match} : #-#]\\n`\n });\n};\n\n/**\n * Process enqueued content.\n * \n * @returns {string}\n */\nconst process = () => {\n const { config, constants } = getState();\n const step = \" \".repeat(config.tab_size);\n const tag_wrap = config.tag_wrap;\n const content_wrap = config.content_wrap;\n const strict = config.strict;\n\n /* Track current number of indentations needed. */\n let indents = '';\n\n /** @type string[] */\n const output_lines = [];\n const tag_regex = /<[A-Za-z]+\\b[^>]*(?:.|\\n)*?\\/?>/g; /* Is opening tag or void element. */\n const attribute_regex = /\\s{1}[A-Za-z:@#*?$()\\[\\].-]+(?:=\".*?\")?/g; /* Matches all tag/element attributes. */\n\n /* Process lines and indent. */\n convert.line.forEach((source, index) => {\n let current_line_value = source.value;\n\n const is_ignored_content =\n current_line_value.startsWith('___HTMLFY_SPECIAL_IGNORE_MARKER_');\n\n let subtrahend = 0;\n const prev_line_data = convert.line[index - 1];\n const prev_line_value = prev_line_data?.value ?? \"\"; // Use empty string if no prev line\n\n /**\n * Arbitratry character, to keep track of the string's length.\n */\n indents += '0';\n\n if (index === 0) subtrahend++;\n /* We're processing a closing tag. */\n if (current_line_value.trim().startsWith(\"</\")) subtrahend++;\n /* prevLine is a doctype declaration. */\n if (prev_line_value.trim().startsWith(\"<!doctype\")) subtrahend++;\n /* prevLine is a comment. */\n if (prev_line_value.trim().startsWith(\"<!--\")) subtrahend++;\n /* prevLine is a void element. */\n if (\n prev_line_value.trim().endsWith(\"/>\") // native self-closing\n ||\n prev_line_value.trim().endsWith(constants.SELF_CLOSING_PLACEHOLDER) // synthetic self-closing\n ) subtrahend++;\n /* prevLine is a closing tag. */\n if (prev_line_value.trim().startsWith(\"</\")) subtrahend++;\n /* prevLine is text. */\n if (prev_line_data?.type === \"text\") subtrahend++;\n\n /* Determine offset for line indentation. */\n const offset = Math.max(0, indents.length - subtrahend);\n /* Correct indent level for *this* line's content */\n const current_indent_level = offset; // Store the level for this line\n\n indents = indents.substring(0, current_indent_level); // Adjust for *next* round\n\n /**\n * Starts with a single punctuation character.\n * Add punctuation to end of previous line.\n */\n if (source.type === 'text' && /^[!,;\\.]/.test(current_line_value)) {\n if (current_line_value.length === 1) {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value;\n return\n } else {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value.charAt(0);\n current_line_value = current_line_value.slice(1).trim();\n\n /* If nothing left after extracting punctuation, skip this line. */\n if (current_line_value.length === 0) return\n }\n }\n\n const padding = step.repeat(current_indent_level);\n\n if (is_ignored_content) {\n /* Stop processing this line, as it's set to be ignored. */\n output_lines.push(current_line_value);\n } else {\n /* Remove comment. */\n if (strict && current_line_value.trim().startsWith(\"<!--\"))\n return\n\n let result = current_line_value;\n\n /* Remove self-closing placeholder, if needed. */\n result = unsetSelfClosing(result);\n\n if (\n source.type === 'text' && \n content_wrap > 0 && \n result.length >= content_wrap\n ) {\n result = wordWrap(result, content_wrap, padding);\n }\n /* Wrap the attributes of open tags and void elements. */\n else if (\n tag_wrap > 0 &&\n result.length > tag_wrap &&\n tag_regex.test(result)\n ) {\n tag_regex.lastIndex = 0; // Reset stateful regex\n attribute_regex.lastIndex = 0; // Reset stateful regex\n\n const tag_parts = result.split(attribute_regex).filter(Boolean);\n\n if (tag_parts.length >= 2) {\n const attributes = result.matchAll(attribute_regex);\n const inner_padding = padding + step;\n let wrapped_tag = padding + tag_parts[0] + \"\\n\";\n\n for (const a of attributes) {\n const attribute_string = a[0].trim();\n wrapped_tag += inner_padding + attribute_string + \"\\n\";\n }\n\n const tag_name_match = tag_parts[0].match(/<([A-Za-z_:-]+)/);\n const tag_name = tag_name_match ? tag_name_match[1] : \"\";\n const is_self_closing = tag_parts.at(-1)?.endsWith(\"/>\") && VOID_ELEMENTS.includes(tag_name);\n const closing_part = tag_parts[1].trim();\n const closing_padding = padding + (strict && is_self_closing ? \" \" : \"\");\n\n wrapped_tag += closing_padding + closing_part;\n\n result = wrapped_tag; // Assign the fully wrapped string\n } else {\n result = padding + result;\n }\n } else {\n /* Apply simple indentation (if no wrapping occurred) */\n result = padding + result;\n }\n\n /* Add the processed line (or lines if wordWrap creates them) to the output */\n output_lines.push(result);\n }\n });\n\n /* Join all processed lines into the final HTML string */\n let final_html = output_lines.join(\"\\n\");\n\n /* Preserve wrapped attributes. */\n if (tag_wrap > 0) final_html = protectAttributes(final_html);\n\n /* Extra preserve wrapped content. */\n if (content_wrap > 0 && new RegExp(`/\\\\n[ ]*[^\\\\n]*${constants.CONTENT_IGNORE_PLACEHOLDER}[^\\\\n]*\\\\n/`).test(final_html))\n final_html = finalProtectContent(final_html);\n\n /* Remove line returns, tabs, and consecutive spaces within html elements or their content. */\n final_html = final_html.replace(\n /<(?<Element>[^>\\s]+)[^>]*>[^<]*?[^><\\/\\s][^<]*?<\\/\\k<Element>>|<script[^>]*>[\\s]*<\\/script>|<([\\w:\\._-]+)([^>]*)><\\/\\2>|<([\\w:\\._-]+)([^>]*)>[\\s]+<\\/\\4>/g,\n match => {\n // Check if this contains placeholder\n if (match.includes(constants.SELF_CLOSING_PLACEHOLDER) || match.includes(constants.CONTENT_IGNORE_PLACEHOLDER)) {\n return match // Don't modify if it contains the placeholder\n }\n\n return match.replace(/\\n|\\t|\\s{2,}/g, '')\n }\n );\n\n /* Revert wrapped content. */\n if (content_wrap > 0) final_html = unprotectContent(final_html);\n\n /* Revert wrapped attributes. */\n if (tag_wrap > 0) final_html = unprotectAttributes(final_html);\n\n /* Remove self-closing nature of void elements. */\n if (strict) final_html = final_html.replace(/\\s\\/>|\\/>/g, '>');\n\n /* Trim leading and/or trailing line returns. */\n if (final_html.startsWith(\"\\n\")) final_html = final_html.substring(1);\n if (final_html.endsWith(\"\\n\")) final_html = final_html.substring(0, final_html.length - 1);\n\n return final_html\n};\n\n/**\n * Format HTML with line returns and indentations.\n * \n * @param {string} html The HTML string to prettify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A well-formed HTML string.\n */\nconst prettify = (html, config) => {\n let reinsert_ignored = false;\n const { checked_html, ignored } = getState();\n\n /* Return content as-is if it does not contain any HTML elements. */\n if (!checked_html && !isHtml(html)) return html\n\n /* Runs setState for config. */\n const validated_config = validateConfig(config || {});\n\n const ignore = validated_config.ignore.length > 0;\n\n /* Allows you to trimify before ignoring. */\n if (validated_config.trim.length > 0) html = trimify(html, validated_config.trim);\n\n /* Extract ignored elements. */\n if (!ignored && ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html);\n html = html_with_markers;\n ignore_map = extracted_map;\n reinsert_ignored = true;\n }\n\n /* Preserve html text within attribute values. */\n html = setIgnoreAttribute(html);\n\n /* Insert placeholder for void elements that aren't self-closing. */\n html = setSelfClosing(html);\n\n html = minify(html);\n enqueue(html);\n html = process();\n\n /* Revert html text within attribute values. */\n html = unsetIgnoreAttribute(html);\n\n /* Re-insert ignored elements. */\n if (reinsert_ignored) {\n html = reinsertIgnoredBlocks(html, ignore_map);\n }\n\n return html\n};\n\n/**\n * Render attribute on the given element\n * @param element - targeted to render attribute\n * @param name - of the attribute\n * @param value - of the attribute\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst renderAttribute = (element, name, value) => {\n if ([null, undefined, '', false].includes(value) || ['innerHTML', 'style', ''].includes(name)) {\n return;\n }\n element.setAttribute(name, !['object', 'function'].includes(typeof value)\n ? value\n : `⚠️ Property must be set through a script or a framework-specific syntax.`);\n};\n/**\n * Render new element in parent element\n * @param parentNode - HTML element\n * @param tagName - of the new element\n * @param attributes - of the new element\n * @param children - of the new element\n * @param text - of the new element\n */\nconst renderElement = (parentNode, tagName, attributes, children, text) => {\n // render HTML\n if (tagName && typeof tagName === 'string') {\n const element = document.createElement(tagName);\n Object.keys(attributes || {}).forEach((attr) => {\n renderAttribute(element, attr, attributes[attr]);\n });\n children?.forEach((child) => {\n renderElement(element, child.$tag$, child.$attrs$, child.$children$, child.$text$);\n });\n if (attributes?.innerHTML)\n element.innerHTML = attributes.innerHTML;\n parentNode.appendChild(element);\n }\n // render text\n if (text) {\n parentNode.innerHTML = text;\n }\n};\n/**\n * Filter default argument on component argument to prevent them to be rendered\n * @param args - all possible args with custom values\n * @param defaultValues - component default args values\n * @param slots - slots\n * @returns filtres args\n * @example\n * ```ts\n * import { filterArgs } from '@mgdis/core-ui-helpers/dist/storybook';\n * const Template = (args: MgBadgeType): HTMLElement => <mg-badge {...filterArgs(args, { variant: 'info' }, ['actions'])}></mg-badge>;\n * ```\n */\nconst filterArgs = (args, defaultValues, slots = []) => {\n const filteredArgs = {};\n if (typeof args !== 'object') {\n throw new Error(\"filterArgs - args isn't an object.\");\n }\n for (const k in args) {\n if (!slots.includes(k)) {\n const arg = args[k];\n // Change camelCase k to kebab-case\n const key = k.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();\n if (!defaultValues || !Object.keys(defaultValues).includes(k) || defaultValues[k] !== arg) {\n filteredArgs[key] = arg;\n }\n }\n }\n return filteredArgs;\n};\n/**\n * Storybook stencil wrapper. Used to target element with `storybook-root` id and render virtual DOM inside.\n * @param storyFn - storybook render function\n * @param context - storybook context\n * @returns rendered element\n * @example\n * ```ts\n * // .storybook/preview.ts\n * import { stencilWrapper } from '@mgdis/core-ui-helpers/dist/storybook';\n * export const decorators: Preview['decorators'] = [stencilWrapper];\n * ```\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst stencilWrapper = (storyFn, context) => {\n const host = document.getElementById('storybook-root');\n if (host === null)\n return;\n // update local switcher based on context variable\n document.querySelector('[lang]')?.setAttribute('lang', context.globals?.locale || 'en');\n renderVdom({\n $cmpMeta$: {\n $flags$: 0,\n $tagName$: host.tagName,\n },\n $hostElement$: host,\n }, storyFn(context));\n return host.children[host.children.length - 1];\n};\n/**\n * Get story HTML from virtual DOM.\n * Mainly used to render, component code exemple in stories.\n * @param vitualNode - story virtual DOM\n * @returns stringified rendered HTML\n * @example\n * ```ts\n * // .storybook/preview.ts\n * import { getStoryHTML } from '@mgdis/core-ui-helpers/dist/storybook';\n *\n * export const parameters: Preview['parameters'] = {\n * docs: {\n * source: {\n * transform: (_, ctx) => getStoryHTML(ctx.originalStoryFn(ctx.args)),\n * }\n * },\n * };\n * ```\n */\nconst getStoryHTML = ({ $tag$, $attrs$, $children$, $text$ }) => {\n const host = document.createElement('div');\n renderElement(host, $tag$, $attrs$, $children$, $text$);\n return prettify(host.innerHTML, {\n tag_wrap: 40,\n content_wrap: 120,\n }).replace(/=\"true\"/g, '');\n};\n/**\n * Retrieve Component Storybook URL from file path\n * @param storybookBaseUrl - Storybook Base URL\n * @param filePath - Component file path\n * @returns Component Storybook URL\n */\nconst getStorybookUrl = (storybookBaseUrl, filePath) => {\n if (!filePath) {\n return;\n }\n const split = filePath.split('/');\n return `${storybookBaseUrl}${split.slice(2, split.length - 1).join('-')}--docs`;\n};\nclass StorybookPreview {\n /**\n * JsonDocs\n */\n jsonDoc;\n constructor(jsonDoc) {\n this.jsonDoc = jsonDoc;\n }\n /**\n * Get component data from the jsonDoc\n * @param tagName - tag name we want to get the data from\n * @returns component data\n */\n #getComponentData = (tagName) => {\n return this.jsonDoc.components.find((component) => component.tag === tagName);\n };\n /**\n * Get the control for the given prop\n * Based on https://storybook.js.org/docs/api/arg-types#controltype\n * @param prop - prop to get control for\n * @returns control type and options if applicable\n */\n #getPropControl = (prop) => {\n // Get types\n const types = prop.type\n .replace(/\"([^\"]+)\"/g, '$1') // Remove quotes\n .replace(/\\s/g, '') // Remove all whitespace for simplicity\n .replace(/\\(.*?\\)/g, (match) => match.replace(/\\|/g, ' OR ')) // Replace '|' inside parentheses\n .split('|')\n .map((type) => type.trim().replace(/ OR /g, '|')); // Revert ' OR ' back to '|'\n // Return control and options\n if (prop.type === 'string') {\n return { control: { type: 'text' } };\n }\n else if (prop.type === 'number') {\n return { control: { type: 'number' } };\n }\n else if (prop.type === 'boolean') {\n return { control: { type: 'boolean' } };\n }\n else if (prop.type.startsWith('{') && prop.type.endsWith('}')) {\n return { control: { type: 'object' } };\n }\n else if (types.length > 1) {\n // Manage case when multiple types are possible\n if (types.includes('string')) {\n return { control: { type: 'text' } };\n }\n else if (types.every((type) => type?.includes('[]'))) {\n return { control: { type: 'object' } };\n }\n else {\n // Add the posibility to set undefined\n types.unshift(undefined);\n return { control: { type: 'select' }, options: types };\n }\n }\n else\n return { control: { type: 'object' } };\n };\n /**\n * Extract component arg types from the component data\n * @param tagName - tag name we want to extract the arg types from\n * @returns component arg types\n */\n extractArgTypes = (tagName) => {\n const componentData = this.#getComponentData(tagName);\n // Extract props arg types\n const componentPropsArgTypes = componentData?.props.reduce((acc, prop) => {\n // Get Controls\n const { control, options } = this.#getPropControl(prop);\n // Set Component ArgTypes\n return {\n ...acc,\n [prop.name]: {\n name: prop.attr || prop.name,\n description: prop.docs,\n type: { required: prop.required },\n table: {\n category: 'props',\n type: { summary: prop.type },\n defaultValue: { summary: prop.default },\n },\n control,\n options,\n },\n };\n }, {});\n // Extract events arg types\n const componentEventsArgTypes = componentData?.events.reduce((acc, event) => ({\n ...acc,\n [event.event]: {\n name: event.event,\n description: event.docs,\n table: {\n category: 'events',\n type: { summary: event.detail },\n },\n },\n }), {});\n // Extracts Methods arg types\n const componentMethodsArgTypes = componentData?.methods.reduce((acc, method) => ({\n ...acc,\n [method.name]: {\n name: method.name,\n description: method.docs,\n table: {\n category: 'methods',\n type: { summary: method.signature },\n },\n },\n }), {});\n // Extracts Slots arg types\n const componentSlotsArgTypes = componentData?.slots.reduce((acc, slot) => ({\n ...acc,\n [slot.name]: {\n name: slot.name !== '' ? slot.name : 'default', // default slot are unnamed\n description: slot.docs,\n table: {\n category: 'slots',\n type: { summary: undefined },\n },\n },\n }), {});\n // Extracts CSS Properties arg types\n const componentCSSPropArgTypes = componentData?.styles.reduce((acc, style) => ({\n ...acc,\n [style.name]: {\n name: style.name,\n description: style.docs,\n table: {\n category: 'custom properties',\n type: { summary: undefined },\n },\n },\n }), {});\n // Extract component dependencies\n const componentDependencies = componentData?.dependencies.reduce((acc, dependency) => {\n const dependencyData = this.#getComponentData(dependency);\n if (!dependencyData)\n return acc; // Prevents from adding internal dependency\n return {\n ...acc,\n [dependency]: {\n name: dependency,\n description: `<a href=\"./?path=/docs/${getStorybookUrl('', dependencyData?.filePath)}\">View Component Documentation</a>`,\n table: {\n category: 'depends on',\n type: { summary: undefined },\n },\n },\n };\n }, {});\n // Extract dependents components\n const componentDependents = componentData?.dependents.reduce((acc, dependent) => {\n const dependentData = this.#getComponentData(dependent);\n if (!dependentData)\n return acc; // Prevents from adding internal dependent\n return {\n ...acc,\n [dependent]: {\n name: dependent,\n description: `<a href=\"./?path=/docs/${getStorybookUrl('', dependentData?.filePath)}\">View Component Documentation</a>`,\n table: {\n category: 'used by',\n type: { summary: undefined },\n },\n },\n };\n }, {});\n return {\n ...componentPropsArgTypes,\n ...componentEventsArgTypes,\n ...componentMethodsArgTypes,\n ...componentSlotsArgTypes,\n ...componentCSSPropArgTypes,\n ...componentDependencies,\n ...componentDependents,\n };\n };\n /**\n * Extract component description from the component data\n * @param tagName - tag name we want to extract the description from\n * @returns component description\n */\n extractComponentDescription = (tagName) => {\n const componentData = this.#getComponentData(tagName);\n return componentData?.readme || componentData?.docs;\n };\n}\n\nexport { StorybookPreview, filterArgs, getStoryHTML, getStorybookUrl, stencilWrapper };\n//# sourceMappingURL=index.js.map\n","/**\n * Utility function that mocks the `MutationObserver` API. Recommended to execute inside `beforeEach`.\n * @param mutationObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the mutation observer, but its methods.\n * You can manually fire an intersection entry:\n * @param mutationObserverMock - configuration object\n * @returns Mocked MutationObserver\n * @example\n * ```\n * let fireMo;\n * setupMutationObserverMock({\n * observe: function () {\n * fireMo = this.cb;\n * },\n * });\n * ...\n * fireMo([{ type: 'childList', addedNodes: [AMockElemenet, AnotherMockElemenet], target: yourMockElemenet }]);;\n * ```\n */\nconst setupMutationObserverMock = ({ disconnect, observe, takeRecords, }) => {\n class MockMutationObserver {\n /**\n *\n */\n disconnect = disconnect;\n /**\n *\n */\n observe = observe;\n /**\n *\n */\n takeRecords = takeRecords;\n /**\n *\n */\n cb;\n constructor(fn) {\n this.cb = fn;\n }\n }\n [window, global].forEach((element) => {\n Object.defineProperty(element, 'MutationObserver', {\n writable: true,\n configurable: true,\n value: MockMutationObserver,\n });\n });\n return MockMutationObserver;\n};\n/**\n * Utility function that mocks the `ResizeObserver` API. Recommended to execute inside `beforeEach`.\n * @param resizeObserverMock - Parameter that is sent to the `Object.defineProperty`\n * overwrite method. `jest.fn()` mock functions can be passed here if the goal is to not only\n * mock the resize observer, but its methods.\n * You can manually fire an intersection entry:\n * @param resizeObserverMock - configuration object\n * @returns Mocked ResizeObserver\n * @example\n * ```\n * let fireRo;\n * setupResizeObserverMock({\n * observe: function () {\n * fireRo = this.cb;\n * },\n * });\n * ...\n * fireRo([{\n * borderBoxSize: ResizeObserverSize[],\n * contentBoxSize: ResizeObserverSize[],\n * contentRect: DOMRectReadOnly,\n * devicePixelContentBoxSize: ResizeObserverSize[],\n * target: yourMockElemenet\n * }]);;\n * ```\n */\nconst setupResizeObserverMock = ({ disconnect, observe, }) => {\n class MockResizeObserver {\n /**\n *\n */\n disconnect = disconnect;\n /**\n *\n */\n observe = observe;\n /**\n *\n */\n unobserve;\n /**\n *\n */\n cb;\n constructor(fn) {\n this.cb = fn;\n }\n }\n [window, global].forEach((element) => {\n Object.defineProperty(element, 'ResizeObserver', {\n writable: true,\n configurable: true,\n value: MockResizeObserver,\n });\n });\n return MockResizeObserver;\n};\nclass MockCustomEvent extends Event {\n /**\n *\n */\n detail; // eslint-disable-line @typescript-eslint/no-explicit-any\n}\n/**\n * Utility function that mocks the `SubmitEvent` API. Recommended to execute inside `beforeEach`.\n * @example\n * ```\n * setupSubmitEventMock();\n * ```\n * @returns custom event mock\n */\nconst setupSubmitEventMock = () => {\n class SubmitEvent extends MockCustomEvent {\n }\n [window, global].forEach((element) => {\n Object.defineProperty(element, 'SubmitEvent', {\n writable: true,\n configurable: true,\n value: SubmitEvent,\n });\n });\n return SubmitEvent;\n};\n/**\n * Utility function that mocks the `requestAnimationFrame` API. Recommended to execute inside `test`.\n * @example\n * ```\n * setUpRequestAnimationFrameMock(jest.runOnlyPendingTimers);\n * ```\n * @param faketimer - recommended to use jest.runOnlyPendingTimers()\n * @returns custom setUpRequestAnimationFrameMock mock\n */\nconst setUpRequestAnimationFrameMock = (faketimer) => {\n const requestAnimationFrame = (callback) => {\n setTimeout(callback, 1);\n faketimer();\n return 0;\n };\n [window, global].forEach((element) => {\n Object.defineProperty(element, 'requestAnimationFrame', {\n writable: true,\n configurable: true,\n value: requestAnimationFrame,\n });\n });\n return requestAnimationFrame;\n};\n/**\n * Convert string to given type\n * @param value - string value to format\n * @param type - new value output type\n * @returns string value converted to given type\n */\nconst convertString = (value, type) => {\n switch (type) {\n case 'date':\n return new Date(value);\n case 'number':\n return Number(value);\n default:\n return value;\n }\n};\n/**\n * Get range underflow value from input['min]\n * @param input - HTMLInputElement\n * @returns truthy iv value is underflow\n */\nconst getRangeUnderflow = (input) => {\n const value = convertString(input.value, input.type);\n if (['date', 'number'].includes(input.type) && input.hasAttribute('min') && input.value.length > 0) {\n const min = convertString(input.min, input.type);\n return value < min;\n }\n else {\n return false;\n }\n};\n/**\n * Get range overflow value from input['max]\n * @param input - HTMLInputElement\n * @returns truthy iv value is overflow\n */\nconst getRangeOverflow = (input) => {\n const value = convertString(input.value, input.type);\n if (['date', 'number'].includes(input.type) && input.hasAttribute('max') && input.value.length > 0) {\n const max = convertString(input.max, input.type);\n return value > max;\n }\n else {\n return false;\n }\n};\n/**\n * HTMLSelectElement type guard\n * @param input - HTMLElement to test\n * @returns truthy if element is HTMLSelectElement\n */\nconst isHTMLSelectElement = (input) => input.options !== undefined;\n/**\n * Is value missing from input\n * @param input - input to test\n * @returns truthy if value is required\n */\nconst isValueMissing = (input) => {\n if (input.hasAttribute('required') && input.required === true) {\n if (['checkbox', 'radio'].includes(input.type)) {\n return input.checked === false;\n }\n else if (isHTMLSelectElement(input)) {\n return input.options.item(input.options.selectedIndex)?.value === '';\n }\n else {\n return input.value.length === 0;\n }\n }\n else {\n return false;\n }\n};\n/**\n * Get input validity\n * @param input - input prototype\n * @returns input validity state\n */\nconst getValidity = (input) => {\n // required field without a value\n const valueMissing = isValueMissing(input);\n // value of a number field is not a number | value of a date field is not a date\n const badInput = ['number', 'date'].includes(input.type) &&\n isNaN(input.type === 'date' ? Date.parse(input.value) : input.value);\n // value does not conform to the pattern\n const patternMismatch = input.hasAttribute('pattern') && new RegExp(input.pattern).test(input.value) === false;\n // value of a number|date field is higher than the max attribute\n const rangeOverflow = getRangeOverflow(input);\n // value of a number|date field is lower than the min attribute\n const rangeUnderflow = getRangeUnderflow(input);\n // value of a number field does not conform to the stepattribute\n const stepMismatch = input.type === 'number' &&\n input.hasAttribute('step') &&\n input.step !== 'any' &&\n Number(input.value) % parseFloat(input.step) !== 0;\n // the user has edited a too-long value in a field with maxlength\n const tooLong = input.hasAttribute('maxLength') && input.value?.length > Number(input.maxLength);\n // the user has edited a too-short value in a field with minlength\n const tooShort = input.hasAttribute('minLength') && input.value?.length < Number(input.minLength);\n // value of a email or URL field is not an email address or URL\n const typeMismatch = input.type === 'url' && !URL.canParse(input.value);\n // value of validationMessage is not an empty string\n const customError = false;\n const valid = ![\n valueMissing,\n badInput,\n patternMismatch,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch,\n tooLong,\n tooShort,\n typeMismatch,\n customError,\n ].some((invalid) => invalid);\n return {\n badInput,\n customError,\n patternMismatch,\n rangeOverflow,\n rangeUnderflow,\n stepMismatch,\n tooLong,\n tooShort,\n typeMismatch,\n valid,\n valueMissing,\n };\n};\n/**\n * Utility function that mocks the HTMLInputElement[`vality`] state API and the HTMLInputElement.checkvalidty() methode.\n * Recommended to execute inside `test`.\n * @example\n * ```\n * Array.from(document.querySelectorInputs('input')).forEach(setUpHTMLInputElementValidity);\n * ```\n */\nconst setUpHTMLInputElementValidity = (input) => {\n input.checkValidity = () => {\n const { valid } = getValidity(input);\n input.dispatchEvent(new CustomEvent('invalid', { detail: !valid }));\n return valid;\n };\n Object.defineProperty(input, 'validity', {\n get: () => getValidity(input),\n configurable: true,\n });\n};\n\nexport { setUpHTMLInputElementValidity, setUpRequestAnimationFrameMock, setupMutationObserverMock, setupResizeObserverMock, setupSubmitEventMock };\n//# sourceMappingURL=index.js.map\n"],"mappings":";AAGA,IAAM,IAAN,MAAgB;CAIZ;CACA,YAAY,IAAY,CAAC,GAAG;EACxB,KAAK,UAAU;CACnB;CAKA,OAAO,MAAc;EACjB,AAAK,KAAK,IAAI,CAAS,KACnB,KAAK,QAAQ,KAAK,CAAS;CAEnC;CAKA,UAAU,MAAc;EACpB,IAAM,IAAQ,KAAK,QAAQ,QAAQ,CAAS;EAC5C,AAAI,IAAQ,MACR,KAAK,QAAQ,OAAO,GAAO,CAAC;CAEpC;CAMA,OAAO,MACI,KAAK,QAAQ,SAAS,CAAS;CAM1C,aACW,KAAK,QAAQ,KAAK,GAAG;AAEpC,GAOM,KAAY,MAAW,OAAO,KAAW,YAAY,CAAC,MAAM,QAAQ,CAAM,KAAK,MAAW,MAQ1F,KAAyB,GAAQ,GAAM,MAAiB;CAE1D,IAAI,CAAC,EAAS,CAAM,KAAK,OAAO,KAAS,UACrC,OAAO;CAEX,IAAM,CAAC,GAAS,GAAG,KAAQ,EAAK,MAAM,GAAS;CAK3C,OAJA,EAAK,SACE,EAAsB,EAAO,IAAU,EAAK,KAA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