@aegis-framework/pandora 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/Util.ts", "../src/Component.ts", "../src/ShadowComponent.ts", "../src/Registry.ts", "../src/browser.ts"],
3
+ "sources": ["../node_modules/lit-html/development/lit-html.js", "../src/Util.ts", "../src/Component.ts", "../src/ShadowComponent.ts", "../src/Registry.ts", "../src/Decorators.ts", "../src/browser.ts"],
4
4
  "sourcesContent": [
5
- "import { CSSObject } from './Types';\n\n/**\n * Calls a function asynchronously and returns a Promise with its result\n * @param callable - The function to call\n * @param context - The context (this) to use when calling the function\n * @param args - Additional arguments to pass to the function\n */\nexport function callAsync<T>(callable: (...args: any[]) => T, context: any, ...args: any[]): Promise<T> {\n try {\n const result = callable.apply(context, args);\n return result instanceof Promise ? result : Promise.resolve(result);\n } catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Converts a CSS object to a CSS string\n * @param object - The CSS object to convert\n * @param encapsulation - Optional selector to encapsulate the CSS\n * @param level - Current nesting level for indentation\n */\nexport function deserializeCSS(object: CSSObject, encapsulation: string = '', level: number = 0): string {\n const keys = Object.keys(object);\n let css = '';\n\n for (const key of keys) {\n const value = object[key];\n\n if (typeof value === 'object' && value !== null) {\n if (encapsulation && !key.startsWith('@')) {\n if (key.startsWith('&')) {\n css += `${key.replace(/&/g, encapsulation)} {\\n`;\n } else {\n css += `${encapsulation} ${key} {\\n`;\n }\n } else {\n css += `${key} {\\n`;\n }\n\n const properties = Object.keys(value);\n for (const property of properties) {\n css += '\\t'.repeat(level);\n const propValue = value[property];\n\n if (typeof propValue === 'object' && propValue !== null) {\n const temp: CSSObject = {};\n temp[property] = propValue;\n css += deserializeCSS(temp, encapsulation, level + 1);\n } else {\n css += `\\t${property}: ${propValue};\\n`;\n }\n }\n css += '}\\n';\n } else {\n css += '\\t'.repeat(level);\n css += `\\t${key}: ${value};\\n`;\n }\n }\n\n return css;\n}",
6
- "import { callAsync, deserializeCSS } from './Util';\nimport { Properties, Style, ReadyCallback } from './Types';\n\n/**\n * A component represents a custom HTML element, and has all of its functionality\n * as well as its general structure and representation self contained on it.\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass Component<P extends Properties = Properties, S extends Properties = Properties> extends HTMLElement {\n public _children: string;\n public _state: S;\n public _props: P;\n public _ready: ReadyCallback[];\n public _connected: boolean;\n public _isReady: boolean;\n public _style: Style;\n public _styleElement: HTMLStyleElement | null;\n\n // This is the tag name for the component\n static _tag?: string;\n\n static _template?: string | ((context: any) => string);\n\n // List of attributes to observe for changes\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n static _observedAttributes: string[] = [];\n\n // Registry integration hooks. These are set by the Registry.\n static _onMount?: (component: Component, tag: string) => void;\n static _onUnmount?: (component: Component, tag: string) => void;\n static _onError?: (error: Error, component: Component, tag: string, lifecycle: string) => void;\n static _applyMiddleware?: (type: string, component: Component, value: any) => any;\n static _hasMiddleware?: (type: string) => boolean;\n\n /**\n * Returns the list of attributes to observe for changes.\n * Override this in subclasses to specify which attributes should trigger attributeChangedCallback.\n *\n * @returns {string[]} - Array of attribute names to observe\n */\n static get observedAttributes(): string[] {\n return this._observedAttributes;\n }\n\n /**\n * Sets the list of attributes to observe for changes.\n *\n * @param value - The new list of attributes to observe\n */\n static set observedAttributes(value: string[]) {\n this._observedAttributes = value;\n }\n\n static get tag(): string {\n if (typeof this._tag === 'undefined') {\n let tag = this.name;\n\n const matches = tag.match(/([A-Z])/g);\n\n if (matches !== null) {\n for (const match of matches) {\n tag = tag.replace(match, `-${match}`.toLowerCase());\n }\n }\n\n this._tag = tag.slice(1);\n }\n\n return this._tag;\n }\n\n static set tag(value: string) {\n this._tag = value;\n }\n\n static template(html: string | ((context: any) => string) | null = null, context: any = null): string | undefined | void {\n if (html !== null) {\n this._template = html;\n\n document.querySelectorAll(this.tag).forEach((instance) => {\n if (instance instanceof Component && instance._isReady) {\n instance.forceRender();\n }\n });\n } else {\n // Check if no parameters were set but the HTML is still a function to be called\n if (typeof this._template === 'function') {\n return this._template.call(context, context);\n }\n\n // If this is reached, the HTML was just a string\n return this._template;\n }\n }\n\n constructor() {\n super();\n\n this._children = this.innerHTML.trim();\n\n // State Object for the component\n this._state = {} as S;\n\n // Props Object for the component\n this._props = {} as P;\n\n // List of callbacks to run once the component has been mounted successfully\n this._ready = [];\n\n // Whether the component is connected to the DOM\n this._connected = false;\n this._isReady = false;\n\n // Style Object for the component\n this._style = {};\n this._styleElement = null;\n }\n\n // Determines the real (computed) width of the element\n get width(): number {\n return parseInt(getComputedStyle(this).width.replace('px', ''));\n }\n\n set width(value: number | string) {\n this.style.width = typeof value === 'number' ? `${value}px` : value;\n }\n\n // Determines the real (computed) height of the element\n get height(): number {\n return parseInt(getComputedStyle(this).height.replace('px', ''));\n }\n\n set height(value: number | string) {\n this.style.height = typeof value === 'number' ? `${value}px` : value;\n }\n\n get static(): typeof Component {\n return this.constructor as typeof Component;\n }\n\n set static(value: typeof Component) {\n throw new Error('Component static properties cannot be reassigned.');\n }\n\n get props(): P {\n return new Proxy(this._props, {\n get: (target, key: string) => {\n if (this.hasAttribute(key)) {\n let value: any = this.getAttribute(key);\n\n if (typeof value === 'string') {\n if (value === 'false') {\n value = false;\n } else if (value === 'true' || value === '') {\n value = true;\n } else if (!isNaN(Number(value))) {\n value = value.includes('.') ? parseFloat(value) : parseInt(value);\n }\n }\n\n return value;\n } else if (key in target) {\n return target[key as keyof P];\n }\n\n return null;\n },\n set: () => {\n throw new Error('Component props should be set using the `setProps` function.');\n }\n }) as P;\n }\n\n set props(value: P) {\n if (!this._connected) {\n this._props = { ...this._props, ...value };\n } else {\n throw new Error('Component props cannot be directly assigned. Use the `setProps` function instead.');\n }\n }\n\n get state(): S {\n return new Proxy(this._state, {\n get: (target, key: string) => target[key as keyof S],\n set: (target, key: string, value) => {\n if (!this._connected) {\n (target as any)[key] = value;\n return true;\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n }) as S;\n }\n\n set state(value: S) {\n if (!this._connected) {\n this._state = { ...this._state, ...value };\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n\n get dom(): HTMLElement {\n return this;\n }\n\n set dom(value: HTMLElement) {\n throw new Error('Component DOM can not be overwritten.');\n }\n\n /**\n * Returns whether the component is currently connected to the DOM.\n */\n get isConnected(): boolean {\n return this._connected;\n }\n\n /**\n * Returns whether the component has completed its initial mount cycle.\n */\n get isReady(): boolean {\n return this._isReady;\n }\n\n /**\n\t * register - Register the component as a custom HTML element\n\t * using the component's tag as the actual element tag.\n\t *\n\t * This action cannot be reverted nor the controller class for\n\t * the element can be changed.\n\t */\n static register(): void {\n window.customElements.define(this.tag, this);\n }\n\n /**\n\t * template - A simple function providing access to the basic HTML\n\t * structure of the component.\n\t *\n\t * @param {function|string} html - A string or function that renders the\n\t * component into a valid HTML structure.\n\t *\n\t * @returns {void|string} - Void or the HTML structure in a string\n\t */\n template(html: string | ((context: any) => string) | null = null): string | undefined | void {\n return (this.constructor as typeof Component).template(html, this);\n }\n\n public _createStyleElement(): void {\n // Check if there is a shared style element for the component\n const sharedStyle = document.body.querySelector(`style#${(this.constructor as typeof Component).tag}`);\n\n // If there is, use it\n if (sharedStyle instanceof HTMLStyleElement) {\n this._styleElement = sharedStyle;\n }\n\n if (this._styleElement instanceof HTMLStyleElement) {\n return;\n }\n\n // If there is no shared style element, create a new one\n this._styleElement = document.createElement('style');\n this._styleElement.id = (this.constructor as typeof Component).tag;\n\n // For normal components, the style element is added to the body\n document.body.prepend(this._styleElement);\n }\n\n setStyle(style: Style | string, reset: boolean = false): Style {\n this._createStyleElement();\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n this._styleElement!.innerHTML = deserializeCSS(this._style, (this.constructor as typeof Component).tag);\n } else if (typeof style === 'string') {\n if (!reset) {\n this._styleElement!.innerHTML += style;\n } else {\n this._styleElement!.innerHTML = style;\n }\n }\n\n return this._style;\n }\n\n setState(state: Partial<S>): void {\n // Apply middleware if available\n let processedState = state;\n\n if (Component._hasMiddleware?.('state') && Component._applyMiddleware) {\n processedState = Component._applyMiddleware('state', this, state);\n }\n\n const oldState = { ...this._state };\n this._state = { ...this._state, ...processedState };\n\n for (const key of Object.keys(processedState)) {\n this.updateCallback(key, oldState[key as keyof S], this._state[key as keyof S], 'state', oldState, this._state);\n }\n }\n\n setProps(props: Partial<P>): void {\n // Apply middleware if available\n let processedProps = props;\n\n if (Component._hasMiddleware?.('props') && Component._applyMiddleware) {\n processedProps = Component._applyMiddleware('props', this, props);\n }\n\n const oldProps = { ...this._props };\n this._props = { ...this._props, ...processedProps };\n\n for (const key of Object.keys(processedProps)) {\n this.updateCallback(key, oldProps[key as keyof P], this._props[key as keyof P], 'props', oldProps, this._props);\n }\n\n this._setPropAttributes(true);\n }\n\n public _setPropAttributes(update: boolean = false): void {\n for (const [key, value] of Object.entries(this._props)) {\n const valueType = typeof value;\n\n if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') {\n if (update) {\n this.setAttribute(key, String(value));\n } else {\n (this._props as Record<string, unknown>)[key] = this.props[key as keyof P];\n this.setAttribute(key, String(this.props[key as keyof P]));\n }\n }\n }\n }\n\n /*\n * =========================\n * Event Helpers\n * =========================\n */\n\n /**\n * Adds an event listener to the component.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n on<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n this.addEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Removes an event listener from the component.\n *\n * @param event - The event type to remove the listener for\n * @param callback - The callback function to remove\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n off<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this {\n this.removeEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Adds a one-time event listener that removes itself after the first trigger.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n once<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n const opts = typeof options === 'boolean' ? { capture: options, once: true } : { ...options, once: true };\n this.addEventListener(event, callback, opts);\n return this;\n }\n\n /**\n * Emits a custom event from the component.\n *\n * @param event - The event name to emit\n * @param detail - Optional data to include with the event\n * @param options - Optional CustomEvent init options (bubbles, cancelable, composed)\n * @returns Whether the event was not cancelled\n */\n emit<T = unknown>(event: string, detail?: T, options?: Omit<CustomEventInit<T>, 'detail'>): boolean {\n const customEvent = new CustomEvent(event, {\n detail,\n bubbles: true,\n cancelable: true,\n composed: true,\n ...options\n });\n return this.dispatchEvent(customEvent);\n }\n\n /*\n * =========================\n * Query Helpers\n * =========================\n */\n\n /**\n * Queries for a single element within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n query<E extends Element = Element>(selector: string): E | null {\n return this.dom.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this.dom.querySelectorAll<E>(selector);\n }\n\n /*\n * =========================\n * Update Cycle\n * =========================\n */\n\n /**\n * Called before the component updates due to state or props changes.\n * Override this method to perform actions before an update occurs.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the pre-update logic completes\n */\n public willUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component updates due to state or props changes.\n * Override this method to perform actions during an update.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the update logic completes\n */\n public update(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component updates due to state or props changes.\n * Override this method to perform actions after an update completes.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the post-update logic completes\n */\n public didUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's state updates.\n * Override this method to react specifically to state changes.\n *\n * @param property - The name of the state property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state object\n * @param newObject - The new state object\n * @returns A promise that resolves when the state update logic completes\n */\n public onStateUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's props update.\n * Override this method to react specifically to props changes.\n *\n * @param property - The name of the prop that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous props object\n * @param newObject - The new props object\n * @returns A promise that resolves when the props update logic completes\n */\n public onPropsUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Mount Cycle\n * =========================\n */\n\n /**\n * Called before the component is mounted to the DOM.\n * Override this method to perform setup before rendering.\n *\n * @returns A promise that resolves when the pre-mount logic completes\n */\n public willMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is mounted to the DOM.\n * Override this method to perform actions after the component is rendered.\n *\n * @returns A promise that resolves when the post-mount logic completes\n */\n public didMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Unmount Cycle\n * =========================\n */\n\n /**\n * Called before the component is removed from the DOM.\n * Override this method to perform cleanup before unmounting.\n *\n * @returns A promise that resolves when the pre-unmount logic completes\n */\n public willUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component is being removed from the DOM.\n * Override this method to perform cleanup during unmounting.\n *\n * @returns A promise that resolves when the unmount logic completes\n */\n public unmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is removed from the DOM.\n * Override this method to perform final cleanup after unmounting.\n *\n * @returns A promise that resolves when the post-unmount logic completes\n */\n public didUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Render Cycle\n * =========================\n */\n\n /**\n * Forces the component to be rendered again.\n *\n * @returns A promise that resolves with the rendered HTML string\n */\n forceRender(): string | Promise<string> {\n return this._render();\n }\n\n /**\n * Returns the HTML content for the component.\n * Override this method to define the component's template.\n *\n * @returns The HTML string to render\n */\n render(): string {\n return '';\n }\n\n public async _render(): Promise<string> {\n let render = this.render;\n\n if ((this.constructor as typeof Component)._template !== undefined) {\n render = this.template as () => string;\n }\n\n let html = await callAsync<string>(render, this);\n\n html = html.trim();\n\n // Apply render middleware if available\n if (Component._hasMiddleware?.('render') && Component._applyMiddleware) {\n html = Component._applyMiddleware('render', this, html);\n }\n\n if (html === '') {\n return '';\n }\n\n const slot = this.dom.querySelector('slot');\n\n if (slot !== null) {\n slot.replaceWith(html);\n } else {\n this.innerHTML = html;\n\n if (this._children !== '' && html.indexOf(this._children) === -1) {\n this.innerHTML += this._children;\n }\n }\n\n return html;\n }\n\n async connectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Set the state as connected\n this._connected = true;\n\n // Add a data property with the tag of the component\n this.dataset.component = tag;\n\n // Check if a template for this component was set. The contents on this\n // if block will only be run once.\n if (typeof this.static._template === 'undefined') {\n\n // Check if there is an HTML template for this component\n const template = document.querySelector(`template#${tag}`);\n\n if (template !== null) {\n // If there is, set is as the template for the component\n this.template(template.innerHTML);\n } else {\n // If not, set is as null\n this.static._template = undefined;\n }\n }\n\n // Set the initial prop attributes for the component using the given props\n this._setPropAttributes(false);\n\n // Run the Mount Cycle\n await this.willMount();\n await this._render();\n await this.didMount();\n\n // Set the component as ready\n this._isReady = true;\n\n // Execute and clear ready callbacks\n const callbacks = [...this._ready];\n this._ready = [];\n\n for (const callback of callbacks) {\n callback.call(this);\n }\n\n // Notify Registry of mount\n if (Component._onMount) {\n Component._onMount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'connectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n ready(callback: ReadyCallback): void {\n this._ready.push(callback);\n\n if (this._isReady) {\n callback.call(this);\n }\n }\n\n async disconnectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Run the Unmount Cycle\n await this.willUnmount();\n await this.unmount();\n await this.didUnmount();\n\n // Set the state as disconnected\n this._connected = false;\n\n // Notify Registry of unmount\n if (Component._onUnmount) {\n Component._onUnmount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'disconnectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n public async updateCallback(\n property: string,\n oldValue: unknown,\n newValue: unknown,\n origin: 'props' | 'state' | 'attribute' = 'props',\n oldObject: P | S = {} as P | S,\n newObject: P | S = {} as P | S\n ): Promise<void> {\n await this.willUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n await this.update(origin, property, oldValue, newValue, oldObject, newObject);\n\n if (origin === 'state') {\n await this.onStateUpdate(property, oldValue, newValue, oldObject, newObject);\n } else if (origin === 'props' || origin === 'attribute') {\n await this.onPropsUpdate(property, oldValue, newValue, oldObject, newObject);\n }\n\n await this.didUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n }\n\n /**\n * Called when an observed attribute changes.\n * This is a Web Components lifecycle callback.\n *\n * @param property - The name of the attribute that changed\n * @param oldValue - The previous value of the attribute\n * @param newValue - The new value of the attribute\n */\n attributeChangedCallback(property: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue !== newValue) {\n this.updateCallback(property, oldValue, newValue, 'attribute');\n }\n }\n}\n\nexport default Component;",
7
- "import Component from './Component';\nimport { callAsync, deserializeCSS } from './Util';\nimport { Properties, Style } from './Types';\n\n/**\n * A component that uses Shadow DOM for encapsulation\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass ShadowComponent<P extends Properties = Properties, S extends Properties = Properties> extends Component<P, S> {\n public _shadowDOM: ShadowRoot;\n\n constructor() {\n super();\n\n // Create the shadow DOM for the component\n this._shadowDOM = this.attachShadow({ mode: 'open' });\n }\n\n setStyle(style: Style | string, reset: boolean = false): Style {\n this._createStyleElement();\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n this._styleElement!.innerHTML = deserializeCSS(this._style);\n } else if (typeof style === 'string') {\n if (!reset) {\n this._styleElement!.innerHTML += style;\n } else {\n this._styleElement!.innerHTML = style;\n }\n }\n\n return this._style;\n }\n\n public override _createStyleElement(): void {\n if (this._styleElement instanceof HTMLStyleElement) {\n return;\n }\n\n this._styleElement = document.createElement('style');\n this._shadowDOM.prepend(this._styleElement);\n }\n\n public override async _render(): Promise<string> {\n let render = this.render;\n\n // Check if a template has been set to this component, and if that's the\n // case, use that instead of the render function to render the component's\n // HTML code.\n if ((this.constructor as typeof Component)._template !== undefined) {\n render = this.template as () => string;\n }\n\n // Call the render function asynchronously and set the HTML from it to the\n // component.\n const html = await callAsync(render, this);\n\n // Remove all children except the style element\n const children = Array.from(this._shadowDOM.childNodes);\n for (const child of children) {\n if (child !== this._styleElement) {\n child.remove();\n }\n }\n\n // Create a template to parse the HTML and append the content\n const template = document.createElement('template');\n template.innerHTML = html;\n\n this._shadowDOM.appendChild(template.content);\n\n return html;\n }\n\n get dom(): HTMLElement {\n throw new Error('ShadowComponent DOM can not be accessed. Use the `shadowRoot` property instead.');\n }\n\n set dom(value: HTMLElement) {\n throw new Error('ShadowComponent DOM can not be overwritten.');\n }\n\n get shadowRoot(): ShadowRoot {\n return this._shadowDOM;\n }\n\n set shadowRoot(value: ShadowRoot) {\n throw new Error('ShadowComponent shadowRoot can not be overwritten.');\n }\n\n /**\n * Queries for a single element within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n override query<E extends Element = Element>(selector: string): E | null {\n return this._shadowDOM.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n override queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this._shadowDOM.querySelectorAll<E>(selector);\n }\n}\n\nexport default ShadowComponent;",
8
- "import Component from './Component';\n\ntype ComponentClass = typeof Component & {\n tag: string;\n _registered?: boolean;\n};\n\ntype StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => void;\ntype LifecycleCallback = (component: Component, tag: string) => void;\ntype ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;\ntype MiddlewareType = 'props' | 'state' | 'render';\ntype Middleware = (component: Component, value: any) => any;\ntype ComponentLoader = () => Promise<ComponentClass | { default: ComponentClass }>;\n\ninterface ComponentStats {\n tag: string;\n instanceCount: number;\n isRegistered: boolean;\n isLazy: boolean;\n}\n\n/**\n * Registry for managing web components and global state\n */\nclass Registry {\n // We won't show logs by default\n private static _debug: boolean = false;\n\n private static components: Record<string, ComponentClass> = {};\n\n private static implementations: Record<string, ComponentClass> = {};\n\n private static state: Record<string, unknown> = {};\n private static subscribers: Record<string, Set<StateSubscriber>> = {};\n\n private static mountCallbacks: Set<LifecycleCallback> = new Set();\n private static unmountCallbacks: Set<LifecycleCallback> = new Set();\n private static errorCallbacks: Set<ErrorCallback> = new Set();\n private static aliases: Record<string, string> = {};\n private static lazyLoaders: Record<string, ComponentLoader> = {};\n\n private static middleware: Record<MiddlewareType, Set<Middleware>> = {\n props: new Set(),\n state: new Set(),\n render: new Set()\n };\n\n private static _initialized = false;\n\n /**\n * Initialize Registry hooks on the Component class. Called automatically on first use\n */\n private static _init(): void {\n if (this._initialized) return;\n this._initialized = true;\n\n // Set up Component hooks\n Component._onMount = (component, tag) => this._notifyMount(component, tag);\n Component._onUnmount = (component, tag) => this._notifyUnmount(component, tag);\n Component._onError = (error, component, tag, lifecycle) => this._notifyError(error, component, tag, lifecycle);\n Component._applyMiddleware = (type, component, value) => this._applyMiddleware(type as MiddlewareType, component, value);\n Component._hasMiddleware = (type) => this._hasMiddleware(type as MiddlewareType);\n }\n\n /**\n * Register a new component with a specific tag name\n *\n * @param tag - The tag name for the component\n * @param component - The component constructor\n */\n static register(tag: string, component: ComponentClass): void {\n this._init();\n\n if (typeof this.components[tag] === 'undefined') {\n this.components[tag] = component;\n this.implementations[tag] = component;\n component._tag = tag;\n\n window.customElements.define(tag, component);\n\n this.components[tag]._registered = true;\n this.log(`Registered: <${tag}>`);\n } else {\n throw new Error('A component with this tag has already been registered. Use the evolve() function to modify the component.');\n }\n }\n\n /**\n * Get the current implementation for a tag\n *\n * @internal\n */\n static getImplementation(tag: string): ComponentClass | undefined {\n return this.implementations[tag] || this.components[tag];\n }\n\n /**\n * Update an existing component with a new implementation\n *\n * @param tag - The tag name of the component to update\n * @param component - The new component constructor\n * @param rerender - Whether to re-render all existing instances (default: false)\n */\n static evolve(tag: string, component: ComponentClass, rerender: boolean = false): void {\n if (typeof this.components[tag] === 'undefined') {\n throw new Error('No component with this tag has been registered. Cannot Evolve.');\n }\n\n // Store the new implementation\n this.implementations[tag] = component;\n component._registered = true;\n\n this.log(`Evolved: <${tag}>`);\n\n // Update all existing instances with the new implementation\n if (rerender) {\n const proto = component.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n\n // Create a temporary instance to get default state/props. This avoids calling\n // the constructor's side effects\n const tempInstance = Object.create(proto);\n\n try {\n component.call(tempInstance);\n } catch {\n // Just skip state/props merging if the constructor fails\n }\n\n document.querySelectorAll(tag).forEach((instance) => {\n if (instance instanceof Component && (instance as Component).isReady) {\n const inst = instance as unknown as Record<string, unknown>;\n\n // Copy all prototype methods from the new component to the instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(instance);\n }\n }\n\n // Merge new default state properties\n if (tempInstance._state) {\n const existingState = inst._state as Record<string, unknown> || {};\n const newDefaults = tempInstance._state as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingState)) {\n existingState[key] = newDefaults[key];\n }\n }\n inst._state = existingState;\n }\n\n // Merge new default props properties\n if (tempInstance._props) {\n const existingProps = inst._props as Record<string, unknown> || {};\n const newDefaults = tempInstance._props as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingProps)) {\n existingProps[key] = newDefaults[key];\n }\n }\n inst._props = existingProps;\n }\n\n // _connected, _isReady, _ready are preserved as we do want to keep\n // the state of the component on those.\n\n (instance as Component).forceRender();\n }\n });\n }\n }\n\n /**\n * Get all instances of a component or execute a callback on them\n *\n * @param tag - The tag name of the component\n * @param callback - Optional callback to execute on each instance\n */\n static instances(tag: string, callback?: (instance: Element) => void): NodeListOf<Element> | void {\n if (typeof this.components[tag] !== 'undefined') {\n if (typeof callback === 'function') {\n document.querySelectorAll(tag).forEach(callback);\n } else {\n return document.querySelectorAll(tag);\n }\n } else {\n throw new Error('No component with the provided tag has been registered.');\n }\n }\n\n /**\n * Create a new instance of a component\n *\n * @param tag - The tag name of the component\n * @param props - Properties to set on the component\n * @returns The created component instance\n */\n static instantiate(tag: string, props: Record<string, any>): Component {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n if (!this.components[tag]._registered) {\n this.register(tag, this.components[tag]);\n }\n\n const element = document.createElement(this.components[tag].tag) as Component;\n\n element.setProps(props);\n\n return element;\n }\n\n /**\n * Check if a component is registered with the given tag\n *\n * @param tag - The tag name to check\n * @returns True if a component is registered with the tag\n */\n static has(tag: string): boolean {\n return typeof this.components[tag] !== 'undefined';\n }\n\n /**\n * Get the component class registered with the given tag\n *\n * @param tag - The tag name of the component\n * @returns The component class or undefined if not registered\n */\n static get(tag: string): ComponentClass | undefined {\n return this.components[tag];\n }\n\n /*\n * =========================\n * Global State Management\n * =========================\n */\n\n /**\n * Set a global state value\n *\n * @param key - The state key\n * @param value - The value to set\n */\n static setState<T>(key: string, value: T): void {\n const oldValue = this.state[key] as T | undefined;\n this.state[key] = value;\n\n // Notify subscribers\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(value, oldValue);\n });\n }\n }\n\n /**\n * Get a global state value\n *\n * @param key - The state key\n * @returns The state value or undefined if not set\n */\n static getState<T>(key: string): T | undefined {\n return this.state[key] as T | undefined;\n }\n\n /**\n * Check if a global state key exists\n *\n * @param key - The state key to check\n * @returns True if the state key exists\n */\n static hasState(key: string): boolean {\n return key in this.state;\n }\n\n /**\n * Delete a global state value\n *\n * @param key - The state key to delete\n * @returns True if the key existed and was deleted\n */\n static deleteState(key: string): boolean {\n if (key in this.state) {\n const oldValue = this.state[key];\n delete this.state[key];\n\n // Notify subscribers with undefined as new value\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(undefined, oldValue);\n });\n }\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Subscribe to changes on a global state key\n *\n * @param key - The state key to subscribe to\n * @param callback - Function called when the state changes\n * @returns An unsubscribe function\n */\n static subscribe<T>(key: string, callback: StateSubscriber<T>): () => void {\n if (!this.subscribers[key]) {\n this.subscribers[key] = new Set();\n }\n\n this.subscribers[key].add(callback as StateSubscriber);\n\n // Return unsubscribe function\n return () => {\n this.unsubscribe(key, callback);\n };\n }\n\n /**\n * Unsubscribe from changes on a global state key\n *\n * @param key - The state key to unsubscribe from\n * @param callback - The callback function to remove\n */\n static unsubscribe<T>(key: string, callback: StateSubscriber<T>): void {\n if (this.subscribers[key]) {\n this.subscribers[key].delete(callback as StateSubscriber);\n }\n }\n\n /**\n * Get all global state as an object\n *\n * @returns A copy of the global state object\n */\n static getAllState(): Record<string, unknown> {\n return { ...this.state };\n }\n\n /**\n * Clear all global state and notify subscribers\n */\n static clearState(): void {\n const keys = Object.keys(this.state);\n\n for (const key of keys) {\n this.deleteState(key);\n }\n }\n\n /*\n * =========================\n * Debugging Tools\n * =========================\n */\n\n /**\n * Enable or disable debug mode.\n * When enabled, lifecycle events are logged to the console.\n */\n static get debug(): boolean {\n return this._debug;\n }\n\n static set debug(value: boolean) {\n this._debug = value;\n }\n\n /**\n * Log a debug message if debug mode is enabled\n *\n * @param message - The message to log\n * @param data - Optional data to include\n */\n static log(message: string, data?: unknown): void {\n if (this._debug) {\n if (data !== undefined) {\n console.log(`[Pandora] ${message}`, data);\n } else {\n console.log(`[Pandora] ${message}`);\n }\n }\n }\n\n /**\n * List all registered component tags\n *\n * @returns Array of registered component tag names\n */\n static list(): string[] {\n return Object.keys(this.components);\n }\n\n /**\n * Get statistics for a specific component or all components\n *\n * @param tag - Optional tag to get stats for a specific component\n * @returns Component stats or array of all component stats\n */\n static stats(tag?: string): ComponentStats | ComponentStats[] {\n if (tag) {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n return {\n tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n };\n }\n\n return this.list().map((tag) => ({\n tag: tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n }));\n }\n\n /*\n * =========================\n * Global Lifecycle Hooks\n * =========================\n */\n\n /**\n * Register a callback to be called when any component mounts\n *\n * @param callback - Function called with (component, tag) when a component mounts\n * @returns Unsubscribe function\n */\n static onMount(callback: LifecycleCallback): () => void {\n this._init();\n this.mountCallbacks.add(callback);\n\n return () => this.mountCallbacks.delete(callback);\n }\n\n /**\n * Register a callback to be called when any component unmounts\n *\n * @param callback - Function called with (component, tag) when a component unmounts\n * @returns Unsubscribe function\n */\n static onUnmount(callback: LifecycleCallback): () => void {\n this._init();\n this.unmountCallbacks.add(callback);\n\n return () => this.unmountCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that a component has mounted\n * @internal\n */\n static _notifyMount(component: Component, tag: string): void {\n this.log(`Mounted: <${tag}>`);\n this.mountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onMount callback:', error);\n }\n });\n }\n\n /**\n * Notify Registry that a component has unmounted\n *\n * @internal\n */\n static _notifyUnmount(component: Component, tag: string): void {\n this.log(`Unmounted: <${tag}>`);\n this.unmountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onUnmount callback:', error);\n }\n });\n }\n\n /*\n * =========================\n * Error Boundaries\n * =========================\n */\n\n /**\n * Register a global error handler for component errors\n *\n * @param callback - Function called with (error, component, tag, lifecycle) when an error occurs\n * @returns Unsubscribe function\n */\n static onError(callback: ErrorCallback): () => void {\n this._init();\n this.errorCallbacks.add(callback);\n\n return () => this.errorCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that an error occurred in a component\n *\n * @internal\n */\n static _notifyError(error: Error, component: Component, tag: string, lifecycle: string): void {\n this.log(`Error in <${tag}> during ${lifecycle}:`, error);\n\n if (this.errorCallbacks.size === 0) {\n // No error handlers registered, re-throw\n throw error;\n }\n\n this.errorCallbacks.forEach((callback) => {\n try {\n callback(error, component, tag, lifecycle);\n } catch (callbackError) {\n console.error('[Pandora] Error in onError callback:', callbackError);\n }\n });\n }\n\n /*\n * =========================\n * Component Aliases\n * =========================\n */\n\n /**\n * Create an alias for an existing component tag\n *\n * @param aliasTag - The new tag name to use as an alias\n * @param originalTag - The original component tag name\n */\n static alias(aliasTag: string, originalTag: string): void {\n if (!this.has(originalTag)) {\n throw new Error(`Cannot create alias: no component with tag \"${originalTag}\" has been registered.`);\n }\n\n if (this.has(aliasTag)) {\n throw new Error(`Cannot create alias: a component with tag \"${aliasTag}\" already exists.`);\n }\n\n this.aliases[aliasTag] = originalTag;\n\n // Create a subclass that inherits from the original component\n const OriginalClass = this.components[originalTag];\n\n // Create a subclass with a different tag\n const AliasClass = class extends (OriginalClass as typeof Component) {\n static _tag = aliasTag;\n };\n\n this.components[aliasTag] = AliasClass as unknown as ComponentClass;\n window.customElements.define(aliasTag, AliasClass);\n\n this.log(`Created alias: <${aliasTag}> -> <${originalTag}>`);\n }\n\n /**\n * Get the original tag for an alias\n *\n * @param aliasTag - The alias tag name\n * @returns The original tag name or undefined if not an alias\n */\n static getOriginalTag(aliasTag: string): string | undefined {\n return this.aliases[aliasTag];\n }\n\n /**\n * Check if a tag is an alias\n *\n * @param tag - The tag name to check\n * @returns True if the tag is an alias\n */\n static isAlias(tag: string): boolean {\n return tag in this.aliases;\n }\n\n /*\n * =========================\n * Lazy Loading\n * =========================\n */\n\n /**\n * Register a component to be lazily loaded on first use\n *\n * @param tag - The tag name for the component\n * @param loader - Async function that returns the component class\n */\n static lazy(tag: string, loader: ComponentLoader): void {\n this._init();\n\n if (this.has(tag)) {\n throw new Error(`Cannot register lazy component: a component with tag \"${tag}\" already exists.`);\n }\n\n this.lazyLoaders[tag] = loader;\n\n // Store reference to Registry for use in the class\n const registry = Registry;\n\n // Create a placeholder class that will load and delegate to the real component\n class LazyComponent extends Component {\n static _tag = tag;\n private _lazyLoaded = false;\n\n async connectedCallback(): Promise<void> {\n // Load the real component on first mount\n await registry._loadLazyComponent(tag);\n\n // Get the loaded implementation\n const RealComponent = registry.getImplementation(tag);\n if (RealComponent && RealComponent !== LazyComponent) {\n const proto = RealComponent.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n const inst = this as unknown as Record<string, unknown>;\n\n // Copy prototype methods from the real component to this instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(this);\n }\n }\n\n // Get default state/props from the real component\n const tempInstance = Object.create(proto);\n\n try {\n RealComponent.call(tempInstance);\n } catch {\n // If constructor fails, skip state/props initialization\n }\n\n // Apply default state from real component\n if (tempInstance._state) {\n inst._state = { ...(tempInstance._state as object) };\n }\n\n // Apply default props from real component\n if (tempInstance._props) {\n inst._props = { ...(tempInstance._props as object) };\n }\n\n this._lazyLoaded = true;\n }\n\n // Now run the normal connected callback\n await super.connectedCallback();\n }\n }\n\n this.components[tag] = LazyComponent as unknown as ComponentClass;\n window.customElements.define(tag, LazyComponent);\n this.log(`Registered lazy component: <${tag}>`);\n }\n\n /**\n * Load a lazy component\n *\n * @internal\n */\n static async _loadLazyComponent(tag: string): Promise<void> {\n if (!(tag in this.lazyLoaders)) {\n return;\n }\n\n const loader = this.lazyLoaders[tag];\n this.log(`Loading lazy component: <${tag}>`);\n\n try {\n const result = await loader();\n const componentClass = 'default' in result ? result.default : result;\n\n // Remove from lazy loaders\n delete this.lazyLoaders[tag];\n\n // Store as the implementation\n this.implementations[tag] = componentClass;\n componentClass._registered = true;\n\n this.log(`Loaded lazy component: <${tag}>`);\n } catch (error) {\n console.error(`[Pandora] Failed to load lazy component <${tag}>:`, error);\n throw error;\n }\n }\n\n /**\n * Check if a component is lazy (not yet loaded)\n *\n * @param tag - The tag name to check\n * @returns True if the component is registered as lazy and not yet loaded\n */\n static isLazy(tag: string): boolean {\n return tag in this.lazyLoaders;\n }\n\n /**\n * Preload a lazy component without mounting it\n *\n * @param tag - The tag name of the lazy component to preload\n */\n static async preload(tag: string): Promise<void> {\n if (this.isLazy(tag)) {\n await this._loadLazyComponent(tag);\n }\n }\n\n /*\n * =========================\n * Middleware\n * =========================\n */\n\n /**\n * Register middleware to intercept props, state, or render operations\n *\n * @param type - The type of middleware: 'props', 'state', or 'render'\n * @param middleware - Function that receives (component, value) and returns the modified value\n * @returns Unsubscribe function\n */\n static use(type: MiddlewareType, middleware: Middleware): () => void {\n this._init();\n this.middleware[type].add(middleware);\n\n return () => this.middleware[type].delete(middleware);\n }\n\n /**\n * Apply middleware to a value\n *\n * @internal\n */\n static _applyMiddleware(type: MiddlewareType, component: Component, value: any): any {\n let result = value;\n\n this.middleware[type].forEach((middleware) => {\n try {\n result = middleware(component, result);\n } catch (error) {\n console.error(`[Pandora] Error in ${type} middleware:`, error);\n }\n });\n\n return result;\n }\n\n /**\n * Check if there are any middleware registered for a type\n *\n * @internal\n */\n static _hasMiddleware(type: MiddlewareType): boolean {\n return this.middleware[type].size > 0;\n }\n}\n\nexport default Registry;",
5
+ "/**\n * @license\n * Copyright 2017 Google LLC\n * SPDX-License-Identifier: BSD-3-Clause\n */\nconst DEV_MODE = true;\nconst ENABLE_EXTRA_SECURITY_HOOKS = true;\nconst ENABLE_SHADYDOM_NOPATCH = true;\nconst NODE_MODE = false;\n// Allows minifiers to rename references to globalThis\nconst global = globalThis;\n/**\n * Useful for visualizing and logging insights into what the Lit template system is doing.\n *\n * Compiled out of prod mode builds.\n */\nconst debugLogEvent = DEV_MODE\n ? (event) => {\n const shouldEmit = global\n .emitLitDebugLogEvents;\n if (!shouldEmit) {\n return;\n }\n global.dispatchEvent(new CustomEvent('lit-debug', {\n detail: event,\n }));\n }\n : undefined;\n// Used for connecting beginRender and endRender events when there are nested\n// renders when errors are thrown preventing an endRender event from being\n// called.\nlet debugLogRenderId = 0;\nlet issueWarning;\nif (DEV_MODE) {\n global.litIssuedWarnings ??= new Set();\n /**\n * Issue a warning if we haven't already, based either on `code` or `warning`.\n * Warnings are disabled automatically only by `warning`; disabling via `code`\n * can be done by users.\n */\n issueWarning = (code, warning) => {\n warning += code\n ? ` See https://lit.dev/msg/${code} for more information.`\n : '';\n if (!global.litIssuedWarnings.has(warning) &&\n !global.litIssuedWarnings.has(code)) {\n console.warn(warning);\n global.litIssuedWarnings.add(warning);\n }\n };\n queueMicrotask(() => {\n issueWarning('dev-mode', `Lit is in dev mode. Not recommended for production!`);\n });\n}\nconst wrap = ENABLE_SHADYDOM_NOPATCH &&\n global.ShadyDOM?.inUse &&\n global.ShadyDOM?.noPatch === true\n ? global.ShadyDOM.wrap\n : (node) => node;\nconst trustedTypes = global.trustedTypes;\n/**\n * Our TrustedTypePolicy for HTML which is declared using the html template\n * tag function.\n *\n * That HTML is a developer-authored constant, and is parsed with innerHTML\n * before any untrusted expressions have been mixed in. Therefor it is\n * considered safe by construction.\n */\nconst policy = trustedTypes\n ? trustedTypes.createPolicy('lit-html', {\n createHTML: (s) => s,\n })\n : undefined;\nconst identityFunction = (value) => value;\nconst noopSanitizer = (_node, _name, _type) => identityFunction;\n/** Sets the global sanitizer factory. */\nconst setSanitizer = (newSanitizer) => {\n if (!ENABLE_EXTRA_SECURITY_HOOKS) {\n return;\n }\n if (sanitizerFactoryInternal !== noopSanitizer) {\n throw new Error(`Attempted to overwrite existing lit-html security policy.` +\n ` setSanitizeDOMValueFactory should be called at most once.`);\n }\n sanitizerFactoryInternal = newSanitizer;\n};\n/**\n * Only used in internal tests, not a part of the public API.\n */\nconst _testOnlyClearSanitizerFactoryDoNotCallOrElse = () => {\n sanitizerFactoryInternal = noopSanitizer;\n};\nconst createSanitizer = (node, name, type) => {\n return sanitizerFactoryInternal(node, name, type);\n};\n// Added to an attribute name to mark the attribute as bound so we can find\n// it easily.\nconst boundAttributeSuffix = '$lit$';\n// This marker is used in many syntactic positions in HTML, so it must be\n// a valid element name and attribute name. We don't support dynamic names (yet)\n// but this at least ensures that the parse tree is closer to the template\n// intention.\nconst marker = `lit$${Math.random().toFixed(9).slice(2)}$`;\n// String used to tell if a comment is a marker comment\nconst markerMatch = '?' + marker;\n// Text used to insert a comment marker node. We use processing instruction\n// syntax because it's slightly smaller, but parses as a comment node.\nconst nodeMarker = `<${markerMatch}>`;\nconst d = NODE_MODE && global.document === undefined\n ? {\n createTreeWalker() {\n return {};\n },\n }\n : document;\n// Creates a dynamic marker. We never have to search for these in the DOM.\nconst createMarker = () => d.createComment('');\nconst isPrimitive = (value) => value === null || (typeof value != 'object' && typeof value != 'function');\nconst isArray = Array.isArray;\nconst isIterable = (value) => isArray(value) ||\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n typeof value?.[Symbol.iterator] === 'function';\nconst SPACE_CHAR = `[ \\t\\n\\f\\r]`;\nconst ATTR_VALUE_CHAR = `[^ \\t\\n\\f\\r\"'\\`<>=]`;\nconst NAME_CHAR = `[^\\\\s\"'>=/]`;\n// These regexes represent the five parsing states that we care about in the\n// Template's HTML scanner. They match the *end* of the state they're named\n// after.\n// Depending on the match, we transition to a new state. If there's no match,\n// we stay in the same state.\n// Note that the regexes are stateful. We utilize lastIndex and sync it\n// across the multiple regexes used. In addition to the five regexes below\n// we also dynamically create a regex to find the matching end tags for raw\n// text elements.\n/**\n * End of text is: `<` followed by:\n * (comment start) or (tag) or (dynamic tag binding)\n */\nconst textEndRegex = /<(?:(!--|\\/[^a-zA-Z])|(\\/?[a-zA-Z][^>\\s]*)|(\\/?$))/g;\nconst COMMENT_START = 1;\nconst TAG_NAME = 2;\nconst DYNAMIC_TAG_NAME = 3;\nconst commentEndRegex = /-->/g;\n/**\n * Comments not started with <!--, like </{, can be ended by a single `>`\n */\nconst comment2EndRegex = />/g;\n/**\n * The tagEnd regex matches the end of the \"inside an opening\" tag syntax\n * position. It either matches a `>`, an attribute-like sequence, or the end\n * of the string after a space (attribute-name position ending).\n *\n * See attributes in the HTML spec:\n * https://www.w3.org/TR/html5/syntax.html#elements-attributes\n *\n * \" \\t\\n\\f\\r\" are HTML space characters:\n * https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * So an attribute is:\n * * The name: any character except a whitespace character, (\"), ('), \">\",\n * \"=\", or \"/\". Note: this is different from the HTML spec which also excludes control characters.\n * * Followed by zero or more space characters\n * * Followed by \"=\"\n * * Followed by zero or more space characters\n * * Followed by:\n * * Any character except space, ('), (\"), \"<\", \">\", \"=\", (`), or\n * * (\") then any non-(\"), or\n * * (') then any non-(')\n */\nconst tagEndRegex = new RegExp(`>|${SPACE_CHAR}(?:(${NAME_CHAR}+)(${SPACE_CHAR}*=${SPACE_CHAR}*(?:${ATTR_VALUE_CHAR}|(\"|')|))|$)`, 'g');\nconst ENTIRE_MATCH = 0;\nconst ATTRIBUTE_NAME = 1;\nconst SPACES_AND_EQUALS = 2;\nconst QUOTE_CHAR = 3;\nconst singleQuoteAttrEndRegex = /'/g;\nconst doubleQuoteAttrEndRegex = /\"/g;\n/**\n * Matches the raw text elements.\n *\n * Comments are not parsed within raw text elements, so we need to search their\n * text content for marker strings.\n */\nconst rawTextElement = /^(?:script|style|textarea|title)$/i;\n/** TemplateResult types */\nconst HTML_RESULT = 1;\nconst SVG_RESULT = 2;\nconst MATHML_RESULT = 3;\n// TemplatePart types\n// IMPORTANT: these must match the values in PartType\nconst ATTRIBUTE_PART = 1;\nconst CHILD_PART = 2;\nconst PROPERTY_PART = 3;\nconst BOOLEAN_ATTRIBUTE_PART = 4;\nconst EVENT_PART = 5;\nconst ELEMENT_PART = 6;\nconst COMMENT_PART = 7;\n/**\n * Generates a template literal tag function that returns a TemplateResult with\n * the given result type.\n */\nconst tag = (type) => (strings, ...values) => {\n // Warn against templates octal escape sequences\n // We do this here rather than in render so that the warning is closer to the\n // template definition.\n if (DEV_MODE && strings.some((s) => s === undefined)) {\n console.warn('Some template strings are undefined.\\n' +\n 'This is probably caused by illegal octal escape sequences.');\n }\n if (DEV_MODE) {\n // Import static-html.js results in a circular dependency which g3 doesn't\n // handle. Instead we know that static values must have the field\n // `_$litStatic$`.\n if (values.some((val) => val?.['_$litStatic$'])) {\n issueWarning('', `Static values 'literal' or 'unsafeStatic' cannot be used as values to non-static templates.\\n` +\n `Please use the static 'html' tag function. See https://lit.dev/docs/templates/expressions/#static-expressions`);\n }\n }\n return {\n // This property needs to remain unminified.\n ['_$litType$']: type,\n strings,\n values,\n };\n};\n/**\n * Interprets a template literal as an HTML template that can efficiently\n * render to and update a container.\n *\n * ```ts\n * const header = (title: string) => html`<h1>${title}</h1>`;\n * ```\n *\n * The `html` tag returns a description of the DOM to render as a value. It is\n * lazy, meaning no work is done until the template is rendered. When rendering,\n * if a template comes from the same expression as a previously rendered result,\n * it's efficiently updated instead of replaced.\n */\nexport const html = tag(HTML_RESULT);\n/**\n * Interprets a template literal as an SVG fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const rect = svg`<rect width=\"10\" height=\"10\"></rect>`;\n *\n * const myImage = html`\n * <svg viewBox=\"0 0 10 10\" xmlns=\"http://www.w3.org/2000/svg\">\n * ${rect}\n * </svg>`;\n * ```\n *\n * The `svg` *tag function* should only be used for SVG fragments, or elements\n * that would be contained **inside** an `<svg>` HTML element. A common error is\n * placing an `<svg>` *element* in a template tagged with the `svg` tag\n * function. The `<svg>` element is an HTML element and should be used within a\n * template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an SVG fragment from the\n * `render()` method, as the SVG fragment will be contained within the element's\n * shadow root and thus not be properly contained within an `<svg>` HTML\n * element.\n */\nexport const svg = tag(SVG_RESULT);\n/**\n * Interprets a template literal as MathML fragment that can efficiently render\n * to and update a container.\n *\n * ```ts\n * const num = mathml`<mn>1</mn>`;\n *\n * const eq = html`\n * <math>\n * ${num}\n * </math>`;\n * ```\n *\n * The `mathml` *tag function* should only be used for MathML fragments, or\n * elements that would be contained **inside** a `<math>` HTML element. A common\n * error is placing a `<math>` *element* in a template tagged with the `mathml`\n * tag function. The `<math>` element is an HTML element and should be used\n * within a template tagged with the {@linkcode html} tag function.\n *\n * In LitElement usage, it's invalid to return an MathML fragment from the\n * `render()` method, as the MathML fragment will be contained within the\n * element's shadow root and thus not be properly contained within a `<math>`\n * HTML element.\n */\nexport const mathml = tag(MATHML_RESULT);\n/**\n * A sentinel value that signals that a value was handled by a directive and\n * should not be written to the DOM.\n */\nexport const noChange = Symbol.for('lit-noChange');\n/**\n * A sentinel value that signals a ChildPart to fully clear its content.\n *\n * ```ts\n * const button = html`${\n * user.isAdmin\n * ? html`<button>DELETE</button>`\n * : nothing\n * }`;\n * ```\n *\n * Prefer using `nothing` over other falsy values as it provides a consistent\n * behavior between various expression binding contexts.\n *\n * In child expressions, `undefined`, `null`, `''`, and `nothing` all behave the\n * same and render no nodes. In attribute expressions, `nothing` _removes_ the\n * attribute, while `undefined` and `null` will render an empty string. In\n * property expressions `nothing` becomes `undefined`.\n */\nexport const nothing = Symbol.for('lit-nothing');\n/**\n * The cache of prepared templates, keyed by the tagged TemplateStringsArray\n * and _not_ accounting for the specific template tag used. This means that\n * template tags cannot be dynamic - they must statically be one of html, svg,\n * or attr. This restriction simplifies the cache lookup, which is on the hot\n * path for rendering.\n */\nconst templateCache = new WeakMap();\nconst walker = d.createTreeWalker(d, 129 /* NodeFilter.SHOW_{ELEMENT|COMMENT} */);\nlet sanitizerFactoryInternal = noopSanitizer;\nfunction trustFromTemplateString(tsa, stringFromTSA) {\n // A security check to prevent spoofing of Lit template results.\n // In the future, we may be able to replace this with Array.isTemplateObject,\n // though we might need to make that check inside of the html and svg\n // functions, because precompiled templates don't come in as\n // TemplateStringArray objects.\n if (!isArray(tsa) || !tsa.hasOwnProperty('raw')) {\n let message = 'invalid template strings array';\n if (DEV_MODE) {\n message = `\n Internal Error: expected template strings to be an array\n with a 'raw' field. Faking a template strings array by\n calling html or svg like an ordinary function is effectively\n the same as calling unsafeHtml and can lead to major security\n issues, e.g. opening your code up to XSS attacks.\n If you're using the html or svg tagged template functions normally\n and still seeing this error, please file a bug at\n https://github.com/lit/lit/issues/new?template=bug_report.md\n and include information about your build tooling, if any.\n `\n .trim()\n .replace(/\\n */g, '\\n');\n }\n throw new Error(message);\n }\n return policy !== undefined\n ? policy.createHTML(stringFromTSA)\n : stringFromTSA;\n}\n/**\n * Returns an HTML string for the given TemplateStringsArray and result type\n * (HTML or SVG), along with the case-sensitive bound attribute names in\n * template order. The HTML contains comment markers denoting the `ChildPart`s\n * and suffixes on bound attributes denoting the `AttributeParts`.\n *\n * @param strings template strings array\n * @param type HTML or SVG\n * @return Array containing `[html, attrNames]` (array returned for terseness,\n * to avoid object fields since this code is shared with non-minified SSR\n * code)\n */\nconst getTemplateHtml = (strings, type) => {\n // Insert makers into the template HTML to represent the position of\n // bindings. The following code scans the template strings to determine the\n // syntactic position of the bindings. They can be in text position, where\n // we insert an HTML comment, attribute value position, where we insert a\n // sentinel string and re-write the attribute name, or inside a tag where\n // we insert the sentinel string.\n const l = strings.length - 1;\n // Stores the case-sensitive bound attribute names in the order of their\n // parts. ElementParts are also reflected in this array as undefined\n // rather than a string, to disambiguate from attribute bindings.\n const attrNames = [];\n let html = type === SVG_RESULT ? '<svg>' : type === MATHML_RESULT ? '<math>' : '';\n // When we're inside a raw text tag (not it's text content), the regex\n // will still be tagRegex so we can find attributes, but will switch to\n // this regex when the tag ends.\n let rawTextEndRegex;\n // The current parsing state, represented as a reference to one of the\n // regexes\n let regex = textEndRegex;\n for (let i = 0; i < l; i++) {\n const s = strings[i];\n // The index of the end of the last attribute name. When this is\n // positive at end of a string, it means we're in an attribute value\n // position and need to rewrite the attribute name.\n // We also use a special value of -2 to indicate that we encountered\n // the end of a string in attribute name position.\n let attrNameEndIndex = -1;\n let attrName;\n let lastIndex = 0;\n let match;\n // The conditions in this loop handle the current parse state, and the\n // assignments to the `regex` variable are the state transitions.\n while (lastIndex < s.length) {\n // Make sure we start searching from where we previously left off\n regex.lastIndex = lastIndex;\n match = regex.exec(s);\n if (match === null) {\n break;\n }\n lastIndex = regex.lastIndex;\n if (regex === textEndRegex) {\n if (match[COMMENT_START] === '!--') {\n regex = commentEndRegex;\n }\n else if (match[COMMENT_START] !== undefined) {\n // We started a weird comment, like </{\n regex = comment2EndRegex;\n }\n else if (match[TAG_NAME] !== undefined) {\n if (rawTextElement.test(match[TAG_NAME])) {\n // Record if we encounter a raw-text element. We'll switch to\n // this regex at the end of the tag.\n rawTextEndRegex = new RegExp(`</${match[TAG_NAME]}`, 'g');\n }\n regex = tagEndRegex;\n }\n else if (match[DYNAMIC_TAG_NAME] !== undefined) {\n if (DEV_MODE) {\n throw new Error('Bindings in tag names are not supported. Please use static templates instead. ' +\n 'See https://lit.dev/docs/templates/expressions/#static-expressions');\n }\n regex = tagEndRegex;\n }\n }\n else if (regex === tagEndRegex) {\n if (match[ENTIRE_MATCH] === '>') {\n // End of a tag. If we had started a raw-text element, use that\n // regex\n regex = rawTextEndRegex ?? textEndRegex;\n // We may be ending an unquoted attribute value, so make sure we\n // clear any pending attrNameEndIndex\n attrNameEndIndex = -1;\n }\n else if (match[ATTRIBUTE_NAME] === undefined) {\n // Attribute name position\n attrNameEndIndex = -2;\n }\n else {\n attrNameEndIndex = regex.lastIndex - match[SPACES_AND_EQUALS].length;\n attrName = match[ATTRIBUTE_NAME];\n regex =\n match[QUOTE_CHAR] === undefined\n ? tagEndRegex\n : match[QUOTE_CHAR] === '\"'\n ? doubleQuoteAttrEndRegex\n : singleQuoteAttrEndRegex;\n }\n }\n else if (regex === doubleQuoteAttrEndRegex ||\n regex === singleQuoteAttrEndRegex) {\n regex = tagEndRegex;\n }\n else if (regex === commentEndRegex || regex === comment2EndRegex) {\n regex = textEndRegex;\n }\n else {\n // Not one of the five state regexes, so it must be the dynamically\n // created raw text regex and we're at the close of that element.\n regex = tagEndRegex;\n rawTextEndRegex = undefined;\n }\n }\n if (DEV_MODE) {\n // If we have a attrNameEndIndex, which indicates that we should\n // rewrite the attribute name, assert that we're in a valid attribute\n // position - either in a tag, or a quoted attribute value.\n console.assert(attrNameEndIndex === -1 ||\n regex === tagEndRegex ||\n regex === singleQuoteAttrEndRegex ||\n regex === doubleQuoteAttrEndRegex, 'unexpected parse state B');\n }\n // We have four cases:\n // 1. We're in text position, and not in a raw text element\n // (regex === textEndRegex): insert a comment marker.\n // 2. We have a non-negative attrNameEndIndex which means we need to\n // rewrite the attribute name to add a bound attribute suffix.\n // 3. We're at the non-first binding in a multi-binding attribute, use a\n // plain marker.\n // 4. We're somewhere else inside the tag. If we're in attribute name\n // position (attrNameEndIndex === -2), add a sequential suffix to\n // generate a unique attribute name.\n // Detect a binding next to self-closing tag end and insert a space to\n // separate the marker from the tag end:\n const end = regex === tagEndRegex && strings[i + 1].startsWith('/>') ? ' ' : '';\n html +=\n regex === textEndRegex\n ? s + nodeMarker\n : attrNameEndIndex >= 0\n ? (attrNames.push(attrName),\n s.slice(0, attrNameEndIndex) +\n boundAttributeSuffix +\n s.slice(attrNameEndIndex)) +\n marker +\n end\n : s + marker + (attrNameEndIndex === -2 ? i : end);\n }\n const htmlResult = html +\n (strings[l] || '<?>') +\n (type === SVG_RESULT ? '</svg>' : type === MATHML_RESULT ? '</math>' : '');\n // Returned as an array for terseness\n return [trustFromTemplateString(strings, htmlResult), attrNames];\n};\nclass Template {\n constructor(\n // This property needs to remain unminified.\n { strings, ['_$litType$']: type }, options) {\n this.parts = [];\n let node;\n let nodeIndex = 0;\n let attrNameIndex = 0;\n const partCount = strings.length - 1;\n const parts = this.parts;\n // Create template element\n const [html, attrNames] = getTemplateHtml(strings, type);\n this.el = Template.createElement(html, options);\n walker.currentNode = this.el.content;\n // Re-parent SVG or MathML nodes into template root\n if (type === SVG_RESULT || type === MATHML_RESULT) {\n const wrapper = this.el.content.firstChild;\n wrapper.replaceWith(...wrapper.childNodes);\n }\n // Walk the template to find binding markers and create TemplateParts\n while ((node = walker.nextNode()) !== null && parts.length < partCount) {\n if (node.nodeType === 1) {\n if (DEV_MODE) {\n const tag = node.localName;\n // Warn if `textarea` includes an expression and throw if `template`\n // does since these are not supported. We do this by checking\n // innerHTML for anything that looks like a marker. This catches\n // cases like bindings in textarea there markers turn into text nodes.\n if (/^(?:textarea|template)$/i.test(tag) &&\n node.innerHTML.includes(marker)) {\n const m = `Expressions are not supported inside \\`${tag}\\` ` +\n `elements. See https://lit.dev/msg/expression-in-${tag} for more ` +\n `information.`;\n if (tag === 'template') {\n throw new Error(m);\n }\n else\n issueWarning('', m);\n }\n }\n // TODO (justinfagnani): for attempted dynamic tag names, we don't\n // increment the bindingIndex, and it'll be off by 1 in the element\n // and off by two after it.\n if (node.hasAttributes()) {\n for (const name of node.getAttributeNames()) {\n if (name.endsWith(boundAttributeSuffix)) {\n const realName = attrNames[attrNameIndex++];\n const value = node.getAttribute(name);\n const statics = value.split(marker);\n const m = /([.?@])?(.*)/.exec(realName);\n parts.push({\n type: ATTRIBUTE_PART,\n index: nodeIndex,\n name: m[2],\n strings: statics,\n ctor: m[1] === '.'\n ? PropertyPart\n : m[1] === '?'\n ? BooleanAttributePart\n : m[1] === '@'\n ? EventPart\n : AttributePart,\n });\n node.removeAttribute(name);\n }\n else if (name.startsWith(marker)) {\n parts.push({\n type: ELEMENT_PART,\n index: nodeIndex,\n });\n node.removeAttribute(name);\n }\n }\n }\n // TODO (justinfagnani): benchmark the regex against testing for each\n // of the 3 raw text element names.\n if (rawTextElement.test(node.tagName)) {\n // For raw text elements we need to split the text content on\n // markers, create a Text node for each segment, and create\n // a TemplatePart for each marker.\n const strings = node.textContent.split(marker);\n const lastIndex = strings.length - 1;\n if (lastIndex > 0) {\n node.textContent = trustedTypes\n ? trustedTypes.emptyScript\n : '';\n // Generate a new text node for each literal section\n // These nodes are also used as the markers for child parts\n for (let i = 0; i < lastIndex; i++) {\n node.append(strings[i], createMarker());\n // Walk past the marker node we just added\n walker.nextNode();\n parts.push({ type: CHILD_PART, index: ++nodeIndex });\n }\n // Note because this marker is added after the walker's current\n // node, it will be walked to in the outer loop (and ignored), so\n // we don't need to adjust nodeIndex here\n node.append(strings[lastIndex], createMarker());\n }\n }\n }\n else if (node.nodeType === 8) {\n const data = node.data;\n if (data === markerMatch) {\n parts.push({ type: CHILD_PART, index: nodeIndex });\n }\n else {\n let i = -1;\n while ((i = node.data.indexOf(marker, i + 1)) !== -1) {\n // Comment node has a binding marker inside, make an inactive part\n // The binding won't work, but subsequent bindings will\n parts.push({ type: COMMENT_PART, index: nodeIndex });\n // Move to the end of the match\n i += marker.length - 1;\n }\n }\n }\n nodeIndex++;\n }\n if (DEV_MODE) {\n // If there was a duplicate attribute on a tag, then when the tag is\n // parsed into an element the attribute gets de-duplicated. We can detect\n // this mismatch if we haven't precisely consumed every attribute name\n // when preparing the template. This works because `attrNames` is built\n // from the template string and `attrNameIndex` comes from processing the\n // resulting DOM.\n if (attrNames.length !== attrNameIndex) {\n throw new Error(`Detected duplicate attribute bindings. This occurs if your template ` +\n `has duplicate attributes on an element tag. For example ` +\n `\"<input ?disabled=\\${true} ?disabled=\\${false}>\" contains a ` +\n `duplicate \"disabled\" attribute. The error was detected in ` +\n `the following template: \\n` +\n '`' +\n strings.join('${...}') +\n '`');\n }\n }\n // We could set walker.currentNode to another node here to prevent a memory\n // leak, but every time we prepare a template, we immediately render it\n // and re-use the walker in new TemplateInstance._clone().\n debugLogEvent &&\n debugLogEvent({\n kind: 'template prep',\n template: this,\n clonableTemplate: this.el,\n parts: this.parts,\n strings,\n });\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @nocollapse */\n static createElement(html, _options) {\n const el = d.createElement('template');\n el.innerHTML = html;\n return el;\n }\n}\nfunction resolveDirective(part, value, parent = part, attributeIndex) {\n // Bail early if the value is explicitly noChange. Note, this means any\n // nested directive is still attached and is not run.\n if (value === noChange) {\n return value;\n }\n let currentDirective = attributeIndex !== undefined\n ? parent.__directives?.[attributeIndex]\n : parent.__directive;\n const nextDirectiveConstructor = isPrimitive(value)\n ? undefined\n : // This property needs to remain unminified.\n value['_$litDirective$'];\n if (currentDirective?.constructor !== nextDirectiveConstructor) {\n // This property needs to remain unminified.\n currentDirective?.['_$notifyDirectiveConnectionChanged']?.(false);\n if (nextDirectiveConstructor === undefined) {\n currentDirective = undefined;\n }\n else {\n currentDirective = new nextDirectiveConstructor(part);\n currentDirective._$initialize(part, parent, attributeIndex);\n }\n if (attributeIndex !== undefined) {\n (parent.__directives ??= [])[attributeIndex] =\n currentDirective;\n }\n else {\n parent.__directive = currentDirective;\n }\n }\n if (currentDirective !== undefined) {\n value = resolveDirective(part, currentDirective._$resolve(part, value.values), currentDirective, attributeIndex);\n }\n return value;\n}\n/**\n * An updateable instance of a Template. Holds references to the Parts used to\n * update the template instance.\n */\nclass TemplateInstance {\n constructor(template, parent) {\n this._$parts = [];\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$template = template;\n this._$parent = parent;\n }\n // Called by ChildPart parentNode getter\n get parentNode() {\n return this._$parent.parentNode;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n // This method is separate from the constructor because we need to return a\n // DocumentFragment and we don't want to hold onto it with an instance field.\n _clone(options) {\n const { el: { content }, parts: parts, } = this._$template;\n const fragment = (options?.creationScope ?? d).importNode(content, true);\n walker.currentNode = fragment;\n let node = walker.nextNode();\n let nodeIndex = 0;\n let partIndex = 0;\n let templatePart = parts[0];\n while (templatePart !== undefined) {\n if (nodeIndex === templatePart.index) {\n let part;\n if (templatePart.type === CHILD_PART) {\n part = new ChildPart(node, node.nextSibling, this, options);\n }\n else if (templatePart.type === ATTRIBUTE_PART) {\n part = new templatePart.ctor(node, templatePart.name, templatePart.strings, this, options);\n }\n else if (templatePart.type === ELEMENT_PART) {\n part = new ElementPart(node, this, options);\n }\n this._$parts.push(part);\n templatePart = parts[++partIndex];\n }\n if (nodeIndex !== templatePart?.index) {\n node = walker.nextNode();\n nodeIndex++;\n }\n }\n // We need to set the currentNode away from the cloned tree so that we\n // don't hold onto the tree even if the tree is detached and should be\n // freed.\n walker.currentNode = d;\n return fragment;\n }\n _update(values) {\n let i = 0;\n for (const part of this._$parts) {\n if (part !== undefined) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'set part',\n part,\n value: values[i],\n valueIndex: i,\n values,\n templateInstance: this,\n });\n if (part.strings !== undefined) {\n part._$setValue(values, part, i);\n // The number of values the part consumes is part.strings.length - 1\n // since values are in between template spans. We increment i by 1\n // later in the loop, so increment it by part.strings.length - 2 here\n i += part.strings.length - 2;\n }\n else {\n part._$setValue(values[i]);\n }\n }\n i++;\n }\n }\n}\nclass ChildPart {\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n // ChildParts that are not at the root should always be created with a\n // parent; only RootChildNode's won't, so they return the local isConnected\n // state\n return this._$parent?._$isConnected ?? this.__isConnected;\n }\n constructor(startNode, endNode, parent, options) {\n this.type = CHILD_PART;\n this._$committedValue = nothing;\n // The following fields will be patched onto ChildParts when required by\n // AsyncDirective\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$startNode = startNode;\n this._$endNode = endNode;\n this._$parent = parent;\n this.options = options;\n // Note __isConnected is only ever accessed on RootParts (i.e. when there is\n // no _$parent); the value on a non-root-part is \"don't care\", but checking\n // for parent would be more code\n this.__isConnected = options?.isConnected ?? true;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n // Explicitly initialize for consistent class shape.\n this._textSanitizer = undefined;\n }\n }\n /**\n * The parent node into which the part renders its content.\n *\n * A ChildPart's content consists of a range of adjacent child nodes of\n * `.parentNode`, possibly bordered by 'marker nodes' (`.startNode` and\n * `.endNode`).\n *\n * - If both `.startNode` and `.endNode` are non-null, then the part's content\n * consists of all siblings between `.startNode` and `.endNode`, exclusively.\n *\n * - If `.startNode` is non-null but `.endNode` is null, then the part's\n * content consists of all siblings following `.startNode`, up to and\n * including the last child of `.parentNode`. If `.endNode` is non-null, then\n * `.startNode` will always be non-null.\n *\n * - If both `.endNode` and `.startNode` are null, then the part's content\n * consists of all child nodes of `.parentNode`.\n */\n get parentNode() {\n let parentNode = wrap(this._$startNode).parentNode;\n const parent = this._$parent;\n if (parent !== undefined &&\n parentNode?.nodeType === 11 /* Node.DOCUMENT_FRAGMENT */) {\n // If the parentNode is a DocumentFragment, it may be because the DOM is\n // still in the cloned fragment during initial render; if so, get the real\n // parentNode the part will be committed into by asking the parent.\n parentNode = parent.parentNode;\n }\n return parentNode;\n }\n /**\n * The part's leading marker node, if any. See `.parentNode` for more\n * information.\n */\n get startNode() {\n return this._$startNode;\n }\n /**\n * The part's trailing marker node, if any. See `.parentNode` for more\n * information.\n */\n get endNode() {\n return this._$endNode;\n }\n _$setValue(value, directiveParent = this) {\n if (DEV_MODE && this.parentNode === null) {\n throw new Error(`This \\`ChildPart\\` has no \\`parentNode\\` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's \\`innerHTML\\` or \\`textContent\\` can do this.`);\n }\n value = resolveDirective(this, value, directiveParent);\n if (isPrimitive(value)) {\n // Non-rendering child values. It's important that these do not render\n // empty text nodes to avoid issues with preventing default <slot>\n // fallback content.\n if (value === nothing || value == null || value === '') {\n if (this._$committedValue !== nothing) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit nothing to child',\n start: this._$startNode,\n end: this._$endNode,\n parent: this._$parent,\n options: this.options,\n });\n this._$clear();\n }\n this._$committedValue = nothing;\n }\n else if (value !== this._$committedValue && value !== noChange) {\n this._commitText(value);\n }\n // This property needs to remain unminified.\n }\n else if (value['_$litType$'] !== undefined) {\n this._commitTemplateResult(value);\n }\n else if (value.nodeType !== undefined) {\n if (DEV_MODE && this.options?.host === value) {\n this._commitText(`[probable mistake: rendered a template's host in itself ` +\n `(commonly caused by writing \\${this} in a template]`);\n console.warn(`Attempted to render the template host`, value, `inside itself. This is almost always a mistake, and in dev mode `, `we render some warning text. In production however, we'll `, `render it, which will usually result in an error, and sometimes `, `in the element disappearing from the DOM.`);\n return;\n }\n this._commitNode(value);\n }\n else if (isIterable(value)) {\n this._commitIterable(value);\n }\n else {\n // Fallback, will render the string representation\n this._commitText(value);\n }\n }\n _insert(node) {\n return wrap(wrap(this._$startNode).parentNode).insertBefore(node, this._$endNode);\n }\n _commitNode(value) {\n if (this._$committedValue !== value) {\n this._$clear();\n if (ENABLE_EXTRA_SECURITY_HOOKS &&\n sanitizerFactoryInternal !== noopSanitizer) {\n const parentNodeName = this._$startNode.parentNode?.nodeName;\n if (parentNodeName === 'STYLE' || parentNodeName === 'SCRIPT') {\n let message = 'Forbidden';\n if (DEV_MODE) {\n if (parentNodeName === 'STYLE') {\n message =\n `Lit does not support binding inside style nodes. ` +\n `This is a security risk, as style injection attacks can ` +\n `exfiltrate data and spoof UIs. ` +\n `Consider instead using css\\`...\\` literals ` +\n `to compose styles, and do dynamic styling with ` +\n `css custom properties, ::parts, <slot>s, ` +\n `and by mutating the DOM rather than stylesheets.`;\n }\n else {\n message =\n `Lit does not support binding inside script nodes. ` +\n `This is a security risk, as it could allow arbitrary ` +\n `code execution.`;\n }\n }\n throw new Error(message);\n }\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit node',\n start: this._$startNode,\n parent: this._$parent,\n value: value,\n options: this.options,\n });\n this._$committedValue = this._insert(value);\n }\n }\n _commitText(value) {\n // If the committed value is a primitive it means we called _commitText on\n // the previous render, and we know that this._$startNode.nextSibling is a\n // Text node. We can now just replace the text content (.data) of the node.\n if (this._$committedValue !== nothing &&\n isPrimitive(this._$committedValue)) {\n const node = wrap(this._$startNode).nextSibling;\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(node, 'data', 'property');\n }\n value = this._textSanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node,\n value,\n options: this.options,\n });\n node.data = value;\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n const textNode = d.createTextNode('');\n this._commitNode(textNode);\n // When setting text content, for security purposes it matters a lot\n // what the parent is. For example, <style> and <script> need to be\n // handled with care, while <span> does not. So first we need to put a\n // text node into the document, then we can sanitize its content.\n if (this._textSanitizer === undefined) {\n this._textSanitizer = createSanitizer(textNode, 'data', 'property');\n }\n value = this._textSanitizer(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: textNode,\n value,\n options: this.options,\n });\n textNode.data = value;\n }\n else {\n this._commitNode(d.createTextNode(value));\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit text',\n node: wrap(this._$startNode).nextSibling,\n value,\n options: this.options,\n });\n }\n }\n this._$committedValue = value;\n }\n _commitTemplateResult(result) {\n // This property needs to remain unminified.\n const { values, ['_$litType$']: type } = result;\n // If $litType$ is a number, result is a plain TemplateResult and we get\n // the template from the template cache. If not, result is a\n // CompiledTemplateResult and _$litType$ is a CompiledTemplate and we need\n // to create the <template> element the first time we see it.\n const template = typeof type === 'number'\n ? this._$getTemplate(result)\n : (type.el === undefined &&\n (type.el = Template.createElement(trustFromTemplateString(type.h, type.h[0]), this.options)),\n type);\n if (this._$committedValue?._$template === template) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'template updating',\n template,\n instance: this._$committedValue,\n parts: this._$committedValue._$parts,\n options: this.options,\n values,\n });\n this._$committedValue._update(values);\n }\n else {\n const instance = new TemplateInstance(template, this);\n const fragment = instance._clone(this.options);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n instance._update(values);\n debugLogEvent &&\n debugLogEvent({\n kind: 'template instantiated and updated',\n template,\n instance,\n parts: instance._$parts,\n options: this.options,\n fragment,\n values,\n });\n this._commitNode(fragment);\n this._$committedValue = instance;\n }\n }\n // Overridden via `litHtmlPolyfillSupport` to provide platform support.\n /** @internal */\n _$getTemplate(result) {\n let template = templateCache.get(result.strings);\n if (template === undefined) {\n templateCache.set(result.strings, (template = new Template(result)));\n }\n return template;\n }\n _commitIterable(value) {\n // For an Iterable, we create a new InstancePart per item, then set its\n // value to the item. This is a little bit of overhead for every item in\n // an Iterable, but it lets us recurse easily and efficiently update Arrays\n // of TemplateResults that will be commonly returned from expressions like:\n // array.map((i) => html`${i}`), by reusing existing TemplateInstances.\n // If value is an array, then the previous render was of an\n // iterable and value will contain the ChildParts from the previous\n // render. If value is not an array, clear this part and make a new\n // array for ChildParts.\n if (!isArray(this._$committedValue)) {\n this._$committedValue = [];\n this._$clear();\n }\n // Lets us keep track of how many items we stamped so we can clear leftover\n // items from a previous render\n const itemParts = this._$committedValue;\n let partIndex = 0;\n let itemPart;\n for (const item of value) {\n if (partIndex === itemParts.length) {\n // If no existing part, create a new one\n // TODO (justinfagnani): test perf impact of always creating two parts\n // instead of sharing parts between nodes\n // https://github.com/lit/lit/issues/1266\n itemParts.push((itemPart = new ChildPart(this._insert(createMarker()), this._insert(createMarker()), this, this.options)));\n }\n else {\n // Reuse an existing part\n itemPart = itemParts[partIndex];\n }\n itemPart._$setValue(item);\n partIndex++;\n }\n if (partIndex < itemParts.length) {\n // itemParts always have end nodes\n this._$clear(itemPart && wrap(itemPart._$endNode).nextSibling, partIndex);\n // Truncate the parts array so _value reflects the current state\n itemParts.length = partIndex;\n }\n }\n /**\n * Removes the nodes contained within this Part from the DOM.\n *\n * @param start Start node to clear from, for clearing a subset of the part's\n * DOM (used when truncating iterables)\n * @param from When `start` is specified, the index within the iterable from\n * which ChildParts are being removed, used for disconnecting directives\n * in those Parts.\n *\n * @internal\n */\n _$clear(start = wrap(this._$startNode).nextSibling, from) {\n this._$notifyConnectionChanged?.(false, true, from);\n while (start !== this._$endNode) {\n // The non-null assertion is safe because if _$startNode.nextSibling is\n // null, then _$endNode is also null, and we would not have entered this\n // loop.\n const n = wrap(start).nextSibling;\n wrap(start).remove();\n start = n;\n }\n }\n /**\n * Implementation of RootPart's `isConnected`. Note that this method\n * should only be called on `RootPart`s (the `ChildPart` returned from a\n * top-level `render()` call). It has no effect on non-root ChildParts.\n * @param isConnected Whether to set\n * @internal\n */\n setConnected(isConnected) {\n if (this._$parent === undefined) {\n this.__isConnected = isConnected;\n this._$notifyConnectionChanged?.(isConnected);\n }\n else if (DEV_MODE) {\n throw new Error('part.setConnected() may only be called on a ' +\n 'RootPart returned from render().');\n }\n }\n}\nclass AttributePart {\n get tagName() {\n return this.element.tagName;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n constructor(element, name, strings, parent, options) {\n this.type = ATTRIBUTE_PART;\n /** @internal */\n this._$committedValue = nothing;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this.element = element;\n this.name = name;\n this._$parent = parent;\n this.options = options;\n if (strings.length > 2 || strings[0] !== '' || strings[1] !== '') {\n this._$committedValue = new Array(strings.length - 1).fill(new String());\n this.strings = strings;\n }\n else {\n this._$committedValue = nothing;\n }\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n this._sanitizer = undefined;\n }\n }\n /**\n * Sets the value of this part by resolving the value from possibly multiple\n * values and static strings and committing it to the DOM.\n * If this part is single-valued, `this._strings` will be undefined, and the\n * method will be called with a single value argument. If this part is\n * multi-value, `this._strings` will be defined, and the method is called\n * with the value array of the part's owning TemplateInstance, and an offset\n * into the value array from which the values should be read.\n * This method is overloaded this way to eliminate short-lived array slices\n * of the template instance values, and allow a fast-path for single-valued\n * parts.\n *\n * @param value The part value, or an array of values for multi-valued parts\n * @param valueIndex the index to start reading values from. `undefined` for\n * single-valued parts\n * @param noCommit causes the part to not commit its value to the DOM. Used\n * in hydration to prime attribute parts with their first-rendered value,\n * but not set the attribute, and in SSR to no-op the DOM operation and\n * capture the value for serialization.\n *\n * @internal\n */\n _$setValue(value, directiveParent = this, valueIndex, noCommit) {\n const strings = this.strings;\n // Whether any of the values has changed, for dirty-checking\n let change = false;\n if (strings === undefined) {\n // Single-value binding case\n value = resolveDirective(this, value, directiveParent, 0);\n change =\n !isPrimitive(value) ||\n (value !== this._$committedValue && value !== noChange);\n if (change) {\n this._$committedValue = value;\n }\n }\n else {\n // Interpolation case\n const values = value;\n value = strings[0];\n let i, v;\n for (i = 0; i < strings.length - 1; i++) {\n v = resolveDirective(this, values[valueIndex + i], directiveParent, i);\n if (v === noChange) {\n // If the user-provided value is `noChange`, use the previous value\n v = this._$committedValue[i];\n }\n change ||=\n !isPrimitive(v) || v !== this._$committedValue[i];\n if (v === nothing) {\n value = nothing;\n }\n else if (value !== nothing) {\n value += (v ?? '') + strings[i + 1];\n }\n // We always record each value, even if one is `nothing`, for future\n // change detection.\n this._$committedValue[i] = v;\n }\n }\n if (change && !noCommit) {\n this._commitValue(value);\n }\n }\n /** @internal */\n _commitValue(value) {\n if (value === nothing) {\n wrap(this.element).removeAttribute(this.name);\n }\n else {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'attribute');\n }\n value = this._sanitizer(value ?? '');\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit attribute',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n wrap(this.element).setAttribute(this.name, (value ?? ''));\n }\n }\n}\nclass PropertyPart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = PROPERTY_PART;\n }\n /** @internal */\n _commitValue(value) {\n if (ENABLE_EXTRA_SECURITY_HOOKS) {\n if (this._sanitizer === undefined) {\n this._sanitizer = sanitizerFactoryInternal(this.element, this.name, 'property');\n }\n value = this._sanitizer(value);\n }\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit property',\n element: this.element,\n name: this.name,\n value,\n options: this.options,\n });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.element[this.name] = value === nothing ? undefined : value;\n }\n}\nclass BooleanAttributePart extends AttributePart {\n constructor() {\n super(...arguments);\n this.type = BOOLEAN_ATTRIBUTE_PART;\n }\n /** @internal */\n _commitValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit boolean attribute',\n element: this.element,\n name: this.name,\n value: !!(value && value !== nothing),\n options: this.options,\n });\n wrap(this.element).toggleAttribute(this.name, !!value && value !== nothing);\n }\n}\nclass EventPart extends AttributePart {\n constructor(element, name, strings, parent, options) {\n super(element, name, strings, parent, options);\n this.type = EVENT_PART;\n if (DEV_MODE && this.strings !== undefined) {\n throw new Error(`A \\`<${element.localName}>\\` has a \\`@${name}=...\\` listener with ` +\n 'invalid content. Event listeners in templates must have exactly ' +\n 'one expression and no surrounding text.');\n }\n }\n // EventPart does not use the base _$setValue/_resolveValue implementation\n // since the dirty checking is more complex\n /** @internal */\n _$setValue(newListener, directiveParent = this) {\n newListener =\n resolveDirective(this, newListener, directiveParent, 0) ?? nothing;\n if (newListener === noChange) {\n return;\n }\n const oldListener = this._$committedValue;\n // If the new value is nothing or any options change we have to remove the\n // part as a listener.\n const shouldRemoveListener = (newListener === nothing && oldListener !== nothing) ||\n newListener.capture !==\n oldListener.capture ||\n newListener.once !==\n oldListener.once ||\n newListener.passive !==\n oldListener.passive;\n // If the new value is not nothing and we removed the listener, we have\n // to add the part as a listener.\n const shouldAddListener = newListener !== nothing &&\n (oldListener === nothing || shouldRemoveListener);\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit event listener',\n element: this.element,\n name: this.name,\n value: newListener,\n options: this.options,\n removeListener: shouldRemoveListener,\n addListener: shouldAddListener,\n oldListener,\n });\n if (shouldRemoveListener) {\n this.element.removeEventListener(this.name, this, oldListener);\n }\n if (shouldAddListener) {\n this.element.addEventListener(this.name, this, newListener);\n }\n this._$committedValue = newListener;\n }\n handleEvent(event) {\n if (typeof this._$committedValue === 'function') {\n this._$committedValue.call(this.options?.host ?? this.element, event);\n }\n else {\n this._$committedValue.handleEvent(event);\n }\n }\n}\nclass ElementPart {\n constructor(element, parent, options) {\n this.element = element;\n this.type = ELEMENT_PART;\n /** @internal */\n this._$disconnectableChildren = undefined;\n this._$parent = parent;\n this.options = options;\n }\n // See comment in Disconnectable interface for why this is a getter\n get _$isConnected() {\n return this._$parent._$isConnected;\n }\n _$setValue(value) {\n debugLogEvent &&\n debugLogEvent({\n kind: 'commit to element binding',\n element: this.element,\n value,\n options: this.options,\n });\n resolveDirective(this, value);\n }\n}\n/**\n * END USERS SHOULD NOT RELY ON THIS OBJECT.\n *\n * Private exports for use by other Lit packages, not intended for use by\n * external users.\n *\n * We currently do not make a mangled rollup build of the lit-ssr code. In order\n * to keep a number of (otherwise private) top-level exports mangled in the\n * client side code, we export a _$LH object containing those members (or\n * helper methods for accessing private fields of those members), and then\n * re-export them for use in lit-ssr. This keeps lit-ssr agnostic to whether the\n * client-side code is being used in `dev` mode or `prod` mode.\n *\n * This has a unique name, to disambiguate it from private exports in\n * lit-element, which re-exports all of lit-html.\n *\n * @private\n */\nexport const _$LH = {\n // Used in lit-ssr\n _boundAttributeSuffix: boundAttributeSuffix,\n _marker: marker,\n _markerMatch: markerMatch,\n _HTML_RESULT: HTML_RESULT,\n _getTemplateHtml: getTemplateHtml,\n // Used in tests and private-ssr-support\n _TemplateInstance: TemplateInstance,\n _isIterable: isIterable,\n _resolveDirective: resolveDirective,\n _ChildPart: ChildPart,\n _AttributePart: AttributePart,\n _BooleanAttributePart: BooleanAttributePart,\n _EventPart: EventPart,\n _PropertyPart: PropertyPart,\n _ElementPart: ElementPart,\n};\n// Apply polyfills if available\nconst polyfillSupport = DEV_MODE\n ? global.litHtmlPolyfillSupportDevMode\n : global.litHtmlPolyfillSupport;\npolyfillSupport?.(Template, ChildPart);\n// IMPORTANT: do not change the property name or the assignment expression.\n// This line will be used in regexes to search for lit-html usage.\n(global.litHtmlVersions ??= []).push('3.3.1');\nif (DEV_MODE && global.litHtmlVersions.length > 1) {\n queueMicrotask(() => {\n issueWarning('multiple-versions', `Multiple versions of Lit loaded. ` +\n `Loading multiple versions is not recommended.`);\n });\n}\n/**\n * Renders a value, usually a lit-html TemplateResult, to the container.\n *\n * This example renders the text \"Hello, Zoe!\" inside a paragraph tag, appending\n * it to the container `document.body`.\n *\n * ```js\n * import {html, render} from 'lit';\n *\n * const name = \"Zoe\";\n * render(html`<p>Hello, ${name}!</p>`, document.body);\n * ```\n *\n * @param value Any [renderable\n * value](https://lit.dev/docs/templates/expressions/#child-expressions),\n * typically a {@linkcode TemplateResult} created by evaluating a template tag\n * like {@linkcode html} or {@linkcode svg}.\n * @param container A DOM container to render to. The first render will append\n * the rendered value to the container, and subsequent renders will\n * efficiently update the rendered value if the same result type was\n * previously rendered there.\n * @param options See {@linkcode RenderOptions} for options documentation.\n * @see\n * {@link https://lit.dev/docs/libraries/standalone-templates/#rendering-lit-html-templates| Rendering Lit HTML Templates}\n */\nexport const render = (value, container, options) => {\n if (DEV_MODE && container == null) {\n // Give a clearer error message than\n // Uncaught TypeError: Cannot read properties of null (reading\n // '_$litPart$')\n // which reads like an internal Lit error.\n throw new TypeError(`The container to render into may not be ${container}`);\n }\n const renderId = DEV_MODE ? debugLogRenderId++ : 0;\n const partOwnerNode = options?.renderBefore ?? container;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let part = partOwnerNode['_$litPart$'];\n debugLogEvent &&\n debugLogEvent({\n kind: 'begin render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n if (part === undefined) {\n const endNode = options?.renderBefore ?? null;\n // This property needs to remain unminified.\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n partOwnerNode['_$litPart$'] = part = new ChildPart(container.insertBefore(createMarker(), endNode), endNode, undefined, options ?? {});\n }\n part._$setValue(value);\n debugLogEvent &&\n debugLogEvent({\n kind: 'end render',\n id: renderId,\n value,\n container,\n options,\n part,\n });\n return part;\n};\nif (ENABLE_EXTRA_SECURITY_HOOKS) {\n render.setSanitizer = setSanitizer;\n render.createSanitizer = createSanitizer;\n if (DEV_MODE) {\n render._testOnlyClearSanitizerFactoryDoNotCallOrElse =\n _testOnlyClearSanitizerFactoryDoNotCallOrElse;\n }\n}\n//# sourceMappingURL=lit-html.js.map",
6
+ "import { CSSObject } from './Types';\n\n/**\n * Calls a function asynchronously and returns a Promise with its result\n * @param callable - The function to call\n * @param context - The context (this) to use when calling the function\n * @param args - Additional arguments to pass to the function\n */\nexport function callAsync<T>(callable: (...args: any[]) => T, context: any, ...args: any[]): Promise<T> {\n try {\n const result = callable.apply(context, args);\n return result instanceof Promise ? result : Promise.resolve(result);\n } catch (e) {\n return Promise.reject(e);\n }\n}\n\n/**\n * Checks if a value is a lit-html TemplateResult\n * This allows Components to detect whether render() returned a string or a TemplateResult\n * and handle them appropriately.\n *\n * @param value - The value to check\n * @returns True if the value is a lit-html TemplateResult\n */\nexport function isTemplateResult(value: unknown): boolean {\n return (\n value !== null &&\n typeof value === 'object' &&\n '_$litType$' in (value as object)\n );\n}\n\n/**\n * Converts a CSS object to a CSS string\n * @param object - The CSS object to convert\n * @param encapsulation - Optional selector to encapsulate the CSS\n * @param level - Current nesting level for indentation\n */\nexport function deserializeCSS(object: CSSObject, encapsulation: string = '', level: number = 0): string {\n const keys = Object.keys(object);\n let css = '';\n\n for (const key of keys) {\n const value = object[key];\n\n if (typeof value === 'object' && value !== null) {\n if (encapsulation && !key.startsWith('@')) {\n if (key.startsWith('&')) {\n css += `${key.replace(/&/g, encapsulation)} {\\n`;\n } else {\n css += `${encapsulation} ${key} {\\n`;\n }\n } else {\n css += `${key} {\\n`;\n }\n\n const properties = Object.keys(value);\n for (const property of properties) {\n css += '\\t'.repeat(level);\n const propValue = value[property];\n\n if (typeof propValue === 'object' && propValue !== null) {\n const temp: CSSObject = {};\n temp[property] = propValue;\n css += deserializeCSS(temp, encapsulation, level + 1);\n } else {\n css += `\\t${property}: ${propValue};\\n`;\n }\n }\n css += '}\\n';\n } else {\n css += '\\t'.repeat(level);\n css += `\\t${key}: ${value};\\n`;\n }\n }\n\n return css;\n}",
7
+ "import { render as litRender, TemplateResult, nothing } from 'lit-html';\nimport { callAsync, deserializeCSS, isTemplateResult } from './Util';\nimport { Properties, Style, ReadyCallback } from './Types';\n\n/**\n * A component represents a custom HTML element, and has all of its functionality\n * as well as its general structure and representation self contained on it.\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass Component<P extends Properties = Properties, S extends Properties = Properties> extends HTMLElement {\n public _children: string;\n public _state: S;\n public _props: P;\n public _ready: ReadyCallback[];\n public _connected: boolean;\n public _isReady: boolean;\n public _style: Style;\n\n // This is the tag name for the component\n static _tag?: string;\n\n // Template can be a string, a function returning string, or a function returning lit-html TemplateResult\n static _template?: string | ((context: any) => string | TemplateResult | typeof nothing);\n\n // List of attributes to observe for changes\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_custom_elements#responding_to_attribute_changes\n static _observedAttributes: string[] = [];\n\n // Registry integration hooks. These are set by the Registry.\n static _onMount?: (component: Component, tag: string) => void;\n static _onUnmount?: (component: Component, tag: string) => void;\n static _onError?: (error: Error, component: Component, tag: string, lifecycle: string) => void;\n static _applyMiddleware?: (type: string, component: Component, value: any, renderType?: 'string' | 'lit') => any;\n static _hasMiddleware?: (type: string) => boolean;\n\n /**\n * Returns the list of attributes to observe for changes.\n * Override this in subclasses to specify which attributes should trigger attributeChangedCallback.\n *\n * @returns {string[]} - Array of attribute names to observe\n */\n static get observedAttributes(): string[] {\n return this._observedAttributes;\n }\n\n /**\n * Sets the list of attributes to observe for changes.\n *\n * @param value - The new list of attributes to observe\n */\n static set observedAttributes(value: string[]) {\n this._observedAttributes = value;\n }\n\n static get tag(): string {\n if (typeof this._tag === 'undefined') {\n let tag = this.name;\n\n const matches = tag.match(/([A-Z])/g);\n\n if (matches !== null) {\n for (const match of matches) {\n tag = tag.replace(match, `-${match}`.toLowerCase());\n }\n }\n\n this._tag = tag.slice(1);\n }\n\n return this._tag;\n }\n\n static set tag(value: string) {\n this._tag = value;\n }\n\n /**\n * Set or get the static template for this component class.\n *\n * Templates can be:\n * - A string: `'<div>Hello</div>'`\n * - A function returning string: `(ctx) => \\`<div>\\${ctx.props.name}</div>\\``\n * - A function returning lit-html: `(ctx) => html\\`<div>\\${ctx.props.name}</div>\\``\n *\n * @param html - The template to set, or null to get the current template result\n * @param context - The context to use when calling template functions (usually the component instance)\n * @returns The rendered template when getting, void when setting\n */\n static template(\n html: string | ((context: any) => string | TemplateResult | typeof nothing) | null = null,\n context: any = null\n ): string | TemplateResult | typeof nothing | undefined | void {\n if (html !== null) {\n this._template = html;\n\n document.querySelectorAll(this.tag).forEach((instance) => {\n if (instance instanceof Component && instance._isReady) {\n instance.forceRender();\n }\n });\n } else {\n // Check if no parameters were set but the HTML is still a function to be called\n if (typeof this._template === 'function') {\n return this._template.call(context, context);\n }\n\n // If this is reached, the HTML was just a string\n return this._template;\n }\n }\n\n constructor() {\n super();\n\n this._children = this.innerHTML.trim();\n\n // State Object for the component\n this._state = {} as S;\n\n // Props Object for the component\n this._props = {} as P;\n\n // List of callbacks to run once the component has been mounted successfully\n this._ready = [];\n\n // Whether the component is connected to the DOM\n this._connected = false;\n this._isReady = false;\n\n // Style Object for the component\n this._style = {};\n }\n\n // Determines the real (computed) width of the element\n get width(): number {\n return parseInt(getComputedStyle(this).width.replace('px', ''));\n }\n\n set width(value: number | string) {\n this.style.width = typeof value === 'number' ? `${value}px` : value;\n }\n\n // Determines the real (computed) height of the element\n get height(): number {\n return parseInt(getComputedStyle(this).height.replace('px', ''));\n }\n\n set height(value: number | string) {\n this.style.height = typeof value === 'number' ? `${value}px` : value;\n }\n\n get static(): typeof Component {\n return this.constructor as typeof Component;\n }\n\n set static(value: typeof Component) {\n throw new Error('Component static properties cannot be reassigned.');\n }\n\n get props(): P {\n return new Proxy(this._props, {\n get: (target, key: string) => {\n // Check internal props first\n if (key in target) {\n return target[key as keyof P];\n }\n\n // Fallback to DOM attributes\n if (this.hasAttribute(key)) {\n let value: any = this.getAttribute(key);\n\n if (typeof value === 'string') {\n if (value === 'false') {\n value = false;\n } else if (value === 'true' || value === '') {\n value = true;\n } else if (!isNaN(Number(value))) {\n value = value.includes('.') ? parseFloat(value) : parseInt(value);\n }\n }\n\n return value;\n }\n\n // Return undefined for missing props\n return undefined;\n },\n set: () => {\n throw new Error('Component props should be set using the `setProps` function.');\n }\n }) as P;\n }\n\n set props(value: P) {\n if (!this._connected) {\n this._props = { ...this._props, ...value };\n } else {\n throw new Error('Component props cannot be directly assigned. Use the `setProps` function instead.');\n }\n }\n\n get state(): S {\n return new Proxy(this._state, {\n get: (target, key: string) => target[key as keyof S],\n set: (target, key: string, value) => {\n if (!this._connected) {\n (target as any)[key] = value;\n return true;\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n }) as S;\n }\n\n set state(value: S) {\n if (!this._connected) {\n this._state = { ...this._state, ...value };\n } else {\n throw new Error('Component state should be set using the `setState` function instead.');\n }\n }\n\n get dom(): HTMLElement {\n return this;\n }\n\n set dom(value: HTMLElement) {\n throw new Error('Component DOM can not be overwritten.');\n }\n\n /**\n * Returns the original innerHTML content that was present before the component rendered.\n *\n * This is an alias for `_children`\n *\n * @example\n * // String template\n * render() {\n * return `<div class=\"wrapper\">${this.slotContent}</div>`;\n * }\n *\n * @example\n * // lit-html template\n * render() {\n * return html`<div class=\"wrapper\">${this.slotContent}</div>`;\n * }\n */\n get slotContent(): string {\n return this._children;\n }\n\n /**\n * Returns whether the component is currently connected to the DOM.\n */\n get isConnected(): boolean {\n return this._connected;\n }\n\n /**\n * Returns whether the component has completed its initial mount cycle.\n */\n get isReady(): boolean {\n return this._isReady;\n }\n\n /**\n\t * register - Register the component as a custom HTML element\n\t * using the component's tag as the actual element tag.\n\t *\n\t * This action cannot be reverted nor the controller class for\n\t * the element can be changed.\n\t */\n static register(): void {\n window.customElements.define(this.tag, this);\n }\n\n /**\n * Instance method to set or get the template.\n * Delegates to the static template() method with this instance as context.\n *\n * @param html - The template to set, or null to get the current template result\n * @returns The rendered template when getting, void when setting\n */\n template(\n html: string | ((context: any) => string | TemplateResult | typeof nothing) | null = null\n ): string | TemplateResult | typeof nothing | undefined | void {\n return (this.constructor as typeof Component).template(html, this);\n }\n\n // Cache for the stylesheet to avoid recreating it per instance.\n // Each subclass gets its own stylesheet via the constructor reference.\n static _styleSheet: CSSStyleSheet | null = null;\n\n /**\n * Sets the component style. For normal components, styles are scoped to the\n * component's tag name as a selector prefix and shared across all instances\n * of the same component class.\n *\n * @param style - CSS object or string to apply\n * @param reset - If true, replaces all styles; if false, merges with existing\n * @returns The current style object\n */\n setStyle(style: Style | string, reset: boolean = false): Style {\n // Get the constructor to access the static stylesheet for this specific class\n const staticComponent = this.constructor as typeof Component;\n\n // Initialize the stylesheet if it doesn't exist for this class\n if (!staticComponent._styleSheet) {\n staticComponent._styleSheet = new CSSStyleSheet();\n }\n\n // Build the CSS text\n let cssText = '';\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n cssText = deserializeCSS(this._style, staticComponent.tag);\n } else if (typeof style === 'string') {\n if (!reset) {\n // Append to existing rules\n const existingRules = Array.from(staticComponent._styleSheet.cssRules || [])\n .map(rule => rule.cssText)\n .join('\\n');\n cssText = existingRules + '\\n' + style;\n } else {\n cssText = style;\n }\n }\n\n // Update the stylesheet\n staticComponent._styleSheet.replaceSync(cssText);\n\n // Adopt the stylesheet into the document\n if (!document.adoptedStyleSheets.includes(staticComponent._styleSheet)) {\n document.adoptedStyleSheets = [...document.adoptedStyleSheets, staticComponent._styleSheet];\n }\n\n return this._style;\n }\n\n setState(state: Partial<S>): void {\n // Apply middleware if available\n let processedState = state;\n\n if (Component._hasMiddleware?.('state') && Component._applyMiddleware) {\n processedState = Component._applyMiddleware('state', this, state);\n }\n\n const oldState = { ...this._state };\n this._state = { ...this._state, ...processedState };\n\n for (const key of Object.keys(processedState)) {\n this.updateCallback(key, oldState[key as keyof S], this._state[key as keyof S], 'state', oldState, this._state);\n }\n }\n\n setProps(props: Partial<P>): void {\n // Apply middleware if available\n let processedProps = props;\n\n if (Component._hasMiddleware?.('props') && Component._applyMiddleware) {\n processedProps = Component._applyMiddleware('props', this, props);\n }\n\n const oldProps = { ...this._props };\n this._props = { ...this._props, ...processedProps };\n\n for (const key of Object.keys(processedProps)) {\n this.updateCallback(key, oldProps[key as keyof P], this._props[key as keyof P], 'props', oldProps, this._props);\n }\n\n this._setPropAttributes(true);\n }\n\n public _setPropAttributes(update: boolean = false): void {\n for (const [key, value] of Object.entries(this._props)) {\n const valueType = typeof value;\n\n if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') {\n if (update) {\n this.setAttribute(key, String(value));\n } else {\n (this._props as Record<string, unknown>)[key] = this.props[key as keyof P];\n this.setAttribute(key, String(this.props[key as keyof P]));\n }\n }\n }\n }\n\n /*\n * =========================\n * Event Helpers\n * =========================\n */\n\n /**\n * Adds an event listener to the component.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n on<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n on(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n this.addEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Removes an event listener from the component.\n *\n * @param event - The event type to remove the listener for\n * @param callback - The callback function to remove\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n off<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | EventListenerOptions\n ): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this;\n off(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): this {\n this.removeEventListener(event, callback, options);\n return this;\n }\n\n /**\n * Adds a one-time event listener that removes itself after the first trigger.\n *\n * @param event - The event type to listen for\n * @param callback - The callback function to execute when the event occurs\n * @param options - Optional event listener options\n * @returns The component instance for chaining\n */\n once<K extends keyof HTMLElementEventMap>(\n event: K,\n callback: (this: this, ev: HTMLElementEventMap[K]) => any,\n options?: boolean | AddEventListenerOptions\n ): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this;\n once(event: string, callback: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): this {\n const opts = typeof options === 'boolean' ? { capture: options, once: true } : { ...options, once: true };\n this.addEventListener(event, callback, opts);\n return this;\n }\n\n /**\n * Emits a custom event from the component.\n *\n * @param event - The event name to emit\n * @param detail - Optional data to include with the event\n * @param options - Optional CustomEvent init options (bubbles, cancelable, composed)\n * @returns Whether the event was not cancelled\n */\n emit<T = unknown>(event: string, detail?: T, options?: Omit<CustomEventInit<T>, 'detail'>): boolean {\n const customEvent = new CustomEvent(event, {\n detail,\n bubbles: true,\n cancelable: true,\n composed: true,\n ...options\n });\n return this.dispatchEvent(customEvent);\n }\n\n /*\n * =========================\n * Query Helpers\n * =========================\n */\n\n /**\n * Queries for a single element within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n query<E extends Element = Element>(selector: string): E | null {\n return this.dom.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the component's DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this.dom.querySelectorAll<E>(selector);\n }\n\n /*\n * =========================\n * Update Cycle\n * =========================\n */\n\n /**\n * Called before the component updates due to state or props changes.\n * Override this method to perform actions before an update occurs.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the pre-update logic completes\n */\n public willUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component updates due to state or props changes.\n * Override this method to perform actions during an update.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the update logic completes\n */\n public update(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component updates due to state or props changes.\n * Override this method to perform actions after an update completes.\n *\n * @param origin - Whether the update was triggered by 'state' or 'props'\n * @param property - The name of the property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state/props object\n * @param newObject - The new state/props object\n * @returns A promise that resolves when the post-update logic completes\n */\n public didUpdate(origin: string, property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's state updates.\n * Override this method to react specifically to state changes.\n *\n * @param property - The name of the state property that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous state object\n * @param newObject - The new state object\n * @returns A promise that resolves when the state update logic completes\n */\n public onStateUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component's props update.\n * Override this method to react specifically to props changes.\n *\n * @param property - The name of the prop that changed\n * @param oldValue - The previous value of the property\n * @param newValue - The new value of the property\n * @param oldObject - The previous props object\n * @param newObject - The new props object\n * @returns A promise that resolves when the props update logic completes\n */\n public onPropsUpdate(property: string, oldValue: unknown, newValue: unknown, oldObject: unknown, newObject: unknown): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Mount Cycle\n * =========================\n */\n\n /**\n * Called before the component is mounted to the DOM.\n * Override this method to perform setup before rendering.\n *\n * @returns A promise that resolves when the pre-mount logic completes\n */\n public willMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is mounted to the DOM.\n * Override this method to perform actions after the component is rendered.\n *\n * @returns A promise that resolves when the post-mount logic completes\n */\n public didMount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Unmount Cycle\n * =========================\n */\n\n /**\n * Called before the component is removed from the DOM.\n * Override this method to perform cleanup before unmounting.\n *\n * @returns A promise that resolves when the pre-unmount logic completes\n */\n public willUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called when the component is being removed from the DOM.\n * Override this method to perform cleanup during unmounting.\n *\n * @returns A promise that resolves when the unmount logic completes\n */\n public unmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /**\n * Called after the component is removed from the DOM.\n * Override this method to perform final cleanup after unmounting.\n *\n * @returns A promise that resolves when the post-unmount logic completes\n */\n public didUnmount(): Promise<void> {\n return Promise.resolve();\n }\n\n /*\n * =========================\n * Render Cycle\n * =========================\n */\n\n /**\n * Forces the component to be rendered again.\n *\n * @returns A promise that resolves when rendering is complete\n */\n forceRender(): Promise<void> {\n return this._render();\n }\n\n /**\n * Returns the content for the component.\n * Override this method to define the component's template.\n *\n * You can return either:\n * - A string (traditional HTML string)\n * - A lit-html TemplateResult (for efficient DOM diffing)\n * - `nothing` from lit-html (to render nothing)\n *\n * @example\n * // String-based rendering\n * render() {\n * return `<div>Hello ${this.state.name}</div>`;\n * }\n *\n * @example\n * // lit-html rendering\n * import { html } from '@aegis-framework/pandora';\n *\n * render() {\n * return html`<div>Hello ${this.state.name}</div>`;\n * }\n *\n * @returns The HTML string or lit-html TemplateResult to render\n */\n render(): string | TemplateResult | typeof nothing {\n return '';\n }\n\n public async _render(): Promise<void> {\n let renderFn: () => string | TemplateResult | typeof nothing = this.render;\n\n // Use static template if defined\n if ((this.constructor as typeof Component)._template !== undefined) {\n renderFn = this.template as () => string | TemplateResult | typeof nothing;\n }\n\n let result = await callAsync(renderFn, this);\n\n // Determine render type for middleware\n const renderType: 'string' | 'lit' = isTemplateResult(result) || result === nothing ? 'lit' : 'string';\n\n // Apply render middleware if available\n if (Component._hasMiddleware?.('render') && Component._applyMiddleware) {\n result = Component._applyMiddleware('render', this, result, renderType);\n }\n\n // Handle lit-html TemplateResult\n if (isTemplateResult(result) || result === nothing) {\n // Clear any non-lit-html content on first render\n if (!this.hasAttribute('data-lit-rendered')) {\n this.innerHTML = '';\n this.setAttribute('data-lit-rendered', '');\n }\n litRender(result as TemplateResult | typeof nothing, this, { host: this });\n return;\n }\n\n // Handle string-based rendering\n const html = (result as string).trim();\n\n if (html === '') {\n return;\n }\n\n const slot = this.dom.querySelector('slot');\n\n if (slot !== null) {\n slot.replaceWith(html);\n } else {\n this.innerHTML = html;\n\n if (this._children !== '' && html.indexOf(this._children) === -1) {\n this.innerHTML += this._children;\n }\n }\n }\n\n async connectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Set the state as connected\n this._connected = true;\n\n // Add a data property with the tag of the component\n this.dataset.component = tag;\n\n // Check if a template for this component was set. The contents on this\n // if block will only be run once.\n if (typeof this.static._template === 'undefined') {\n\n // Check if there is an HTML template for this component\n const template = document.querySelector(`template#${tag}`);\n\n if (template !== null) {\n // If there is, set is as the template for the component\n this.template(template.innerHTML);\n } else {\n // If not, set is as null\n this.static._template = undefined;\n }\n }\n\n // Set the initial prop attributes for the component using the given props\n this._setPropAttributes(false);\n\n // Run the Mount Cycle\n await this.willMount();\n await this._render();\n await this.didMount();\n\n // Set the component as ready\n this._isReady = true;\n\n // Execute and clear ready callbacks\n const callbacks = [...this._ready];\n this._ready = [];\n\n for (const callback of callbacks) {\n callback.call(this);\n }\n\n // Notify Registry of mount\n if (Component._onMount) {\n Component._onMount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'connectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n ready(callback: ReadyCallback): void {\n this._ready.push(callback);\n\n if (this._isReady) {\n callback.call(this);\n }\n }\n\n async disconnectedCallback(): Promise<void> {\n const tag = this.static.tag;\n\n try {\n // Run the Unmount Cycle\n await this.willUnmount();\n await this.unmount();\n await this.didUnmount();\n\n // Set the state as disconnected\n this._connected = false;\n\n // Notify Registry of unmount\n if (Component._onUnmount) {\n Component._onUnmount(this, tag);\n }\n\n } catch (error) {\n if (Component._onError) {\n Component._onError(error as Error, this, tag, 'disconnectedCallback');\n } else {\n throw error;\n }\n }\n }\n\n public async updateCallback(\n property: string,\n oldValue: unknown,\n newValue: unknown,\n origin: 'props' | 'state' | 'attribute' = 'props',\n oldObject: P | S = {} as P | S,\n newObject: P | S = {} as P | S\n ): Promise<void> {\n await this.willUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n await this.update(origin, property, oldValue, newValue, oldObject, newObject);\n\n if (origin === 'state') {\n await this.onStateUpdate(property, oldValue, newValue, oldObject, newObject);\n } else if (origin === 'props' || origin === 'attribute') {\n await this.onPropsUpdate(property, oldValue, newValue, oldObject, newObject);\n }\n\n await this.didUpdate(origin, property, oldValue, newValue, oldObject, newObject);\n }\n\n /**\n * Called when an observed attribute changes.\n * This is a Web Components lifecycle callback.\n *\n * @param property - The name of the attribute that changed\n * @param oldValue - The previous value of the attribute\n * @param newValue - The new value of the attribute\n */\n attributeChangedCallback(property: string, oldValue: string | null, newValue: string | null): void {\n if (oldValue !== newValue) {\n this.updateCallback(property, oldValue, newValue, 'attribute');\n }\n }\n}\n\nexport default Component;",
8
+ "import { render as litRender, TemplateResult, nothing } from 'lit-html';\nimport Component from './Component';\nimport { callAsync, deserializeCSS, isTemplateResult } from './Util';\nimport { Properties, Style } from './Types';\n\n/**\n * A component that uses Shadow DOM for encapsulation.\n * Uses Constructable Stylesheets for high-performance styling.\n *\n * @template P - The type of the component's props (defaults to Properties)\n * @template S - The type of the component's state (defaults to Properties)\n */\nclass ShadowComponent<P extends Properties = Properties, S extends Properties = Properties> extends Component<P, S> {\n public _shadowDOM: ShadowRoot;\n\n // Cache for the stylesheet to avoid recreating it per instance.\n // Each subclass gets its own stylesheet via the constructor reference.\n static _styleSheet: CSSStyleSheet | null = null;\n\n constructor() {\n super();\n\n // Create the shadow DOM for the component\n this._shadowDOM = this.attachShadow({ mode: 'open' });\n }\n\n /**\n * Sets the component style, these are scoped to the component's shadow root\n * and shared across all instances of the same component class.\n *\n * @param style - CSS object or string to apply\n * @param reset - If true, replaces all styles; if false, merges with existing\n * @returns The current style object\n */\n override setStyle(style: Style | string, reset: boolean = false): Style {\n // Get the constructor to access the static stylesheet for this specific class\n const staticComponent = this.constructor as typeof ShadowComponent;\n\n // Initialize the stylesheet if it doesn't exist for this class\n if (!staticComponent._styleSheet) {\n staticComponent._styleSheet = new CSSStyleSheet();\n }\n\n // Build the CSS text\n let cssText = '';\n\n if (typeof style === 'object') {\n if (!reset) {\n this._style = { ...this._style, ...style };\n } else {\n this._style = { ...style };\n }\n\n cssText = deserializeCSS(this._style);\n } else if (typeof style === 'string') {\n if (!reset) {\n // Append to existing rules\n const existingRules = Array.from(staticComponent._styleSheet.cssRules || [])\n .map(rule => rule.cssText)\n .join('\\n');\n cssText = existingRules + '\\n' + style;\n } else {\n cssText = style;\n }\n }\n\n // Update the stylesheet\n staticComponent._styleSheet.replaceSync(cssText);\n\n // Adopt the stylesheet into this instance's shadow root\n this._shadowDOM.adoptedStyleSheets = [staticComponent._styleSheet];\n\n return this._style;\n }\n\n\n public override async _render(): Promise<void> {\n let renderFn: () => string | TemplateResult | typeof nothing = this.render;\n\n // Use static template if defined\n if ((this.constructor as typeof Component)._template !== undefined) {\n renderFn = this.template as () => string | TemplateResult | typeof nothing;\n }\n\n // Call the render function asynchronously\n let result = await callAsync(renderFn, this);\n\n // Determine render type for middleware\n const renderType: 'string' | 'lit' = isTemplateResult(result) || result === nothing ? 'lit' : 'string';\n\n // Apply render middleware if available\n if (Component._hasMiddleware?.('render') && Component._applyMiddleware) {\n result = Component._applyMiddleware('render', this, result, renderType);\n }\n\n // Handle lit-html TemplateResult\n if (isTemplateResult(result) || result === nothing) {\n litRender(result as TemplateResult | typeof nothing, this._shadowDOM, { host: this });\n return;\n }\n\n // Handle string-based rendering\n const html = (result as string).trim();\n\n // Remove all children\n const children = Array.from(this._shadowDOM.childNodes);\n\n for (const child of children) {\n child.remove();\n }\n\n if (html === '') {\n return;\n }\n\n // Create a template to parse the HTML and append the content\n const template = document.createElement('template');\n template.innerHTML = html;\n\n this._shadowDOM.appendChild(template.content);\n }\n\n get dom(): HTMLElement {\n throw new Error('ShadowComponent DOM can not be accessed. Use the `shadowRoot` property instead.');\n }\n\n set dom(value: HTMLElement) {\n throw new Error('ShadowComponent DOM can not be overwritten.');\n }\n\n get shadowRoot(): ShadowRoot {\n return this._shadowDOM;\n }\n\n set shadowRoot(value: ShadowRoot) {\n throw new Error('ShadowComponent shadowRoot can not be overwritten.');\n }\n\n /**\n * Queries for a single element within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns The first matching element or null\n */\n override query<E extends Element = Element>(selector: string): E | null {\n return this._shadowDOM.querySelector<E>(selector);\n }\n\n /**\n * Queries for all matching elements within the shadow DOM.\n *\n * @param selector - CSS selector to query for\n * @returns A NodeList of all matching elements\n */\n override queryAll<E extends Element = Element>(selector: string): NodeListOf<E> {\n return this._shadowDOM.querySelectorAll<E>(selector);\n }\n}\n\nexport default ShadowComponent;",
9
+ "import Component from './Component';\n\ntype ComponentClass = typeof Component & {\n tag: string;\n _registered?: boolean;\n};\n\ntype StateSubscriber<T = unknown> = (newValue: T, oldValue: T | undefined) => void;\ntype LifecycleCallback = (component: Component, tag: string) => void;\ntype ErrorCallback = (error: Error, component: Component, tag: string, lifecycle: string) => void;\ntype MiddlewareType = 'props' | 'state' | 'render';\ntype RenderType = 'string' | 'lit';\ntype Middleware = (component: Component, value: any, renderType?: RenderType) => any;\ntype ComponentLoader = () => Promise<ComponentClass | { default: ComponentClass }>;\n\ninterface ComponentStats {\n tag: string;\n instanceCount: number;\n isRegistered: boolean;\n isLazy: boolean;\n}\n\n/**\n * Registry for managing web components and global state\n */\nclass Registry {\n // We won't show logs by default\n private static _debug: boolean = false;\n\n private static components: Record<string, ComponentClass> = {};\n\n private static implementations: Record<string, ComponentClass> = {};\n\n private static state: Record<string, unknown> = {};\n private static subscribers: Record<string, Set<StateSubscriber>> = {};\n\n private static mountCallbacks: Set<LifecycleCallback> = new Set();\n private static unmountCallbacks: Set<LifecycleCallback> = new Set();\n private static errorCallbacks: Set<ErrorCallback> = new Set();\n private static aliases: Record<string, string> = {};\n private static lazyLoaders: Record<string, ComponentLoader> = {};\n\n private static middleware: Record<MiddlewareType, Set<Middleware>> = {\n props: new Set(),\n state: new Set(),\n render: new Set()\n };\n\n private static _initialized = false;\n\n /**\n * Initialize Registry hooks on the Component class. Called automatically on first use\n */\n private static _init(): void {\n if (this._initialized) return;\n this._initialized = true;\n\n // Set up Component hooks\n Component._onMount = (component, tag) => this._notifyMount(component, tag);\n Component._onUnmount = (component, tag) => this._notifyUnmount(component, tag);\n Component._onError = (error, component, tag, lifecycle) => this._notifyError(error, component, tag, lifecycle);\n Component._applyMiddleware = (type, component, value, renderType) => this._applyMiddleware(type as MiddlewareType, component, value, renderType);\n Component._hasMiddleware = (type) => this._hasMiddleware(type as MiddlewareType);\n }\n\n /**\n * Register a new component with a specific tag name\n *\n * @param tag - The tag name for the component\n * @param component - The component constructor\n */\n static register(tag: string, component: ComponentClass): void {\n this._init();\n\n if (typeof this.components[tag] === 'undefined') {\n this.components[tag] = component;\n this.implementations[tag] = component;\n component._tag = tag;\n\n window.customElements.define(tag, component);\n\n this.components[tag]._registered = true;\n this.log(`Registered: <${tag}>`);\n } else {\n throw new Error('A component with this tag has already been registered. Use the evolve() function to modify the component.');\n }\n }\n\n /**\n * Get the current implementation for a tag\n *\n * @internal\n */\n static getImplementation(tag: string): ComponentClass | undefined {\n return this.implementations[tag] || this.components[tag];\n }\n\n /**\n * Update an existing component with a new implementation\n *\n * @param tag - The tag name of the component to update\n * @param component - The new component constructor\n * @param rerender - Whether to re-render all existing instances (default: false)\n */\n static evolve(tag: string, component: ComponentClass, rerender: boolean = false): void {\n if (typeof this.components[tag] === 'undefined') {\n throw new Error('No component with this tag has been registered. Cannot Evolve.');\n }\n\n // Store the new implementation\n this.implementations[tag] = component;\n component._registered = true;\n\n this.log(`Evolved: <${tag}>`);\n\n // Update all existing instances with the new implementation\n if (rerender) {\n const proto = component.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n\n // Create a temporary instance to get default state/props. This avoids calling\n // the constructor's side effects\n const tempInstance = Object.create(proto);\n\n try {\n component.call(tempInstance);\n } catch {\n // Just skip state/props merging if the constructor fails\n }\n\n document.querySelectorAll(tag).forEach((instance) => {\n if (instance instanceof Component && (instance as Component).isReady) {\n const inst = instance as unknown as Record<string, unknown>;\n\n // Copy all prototype methods from the new component to the instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(instance);\n }\n }\n\n // Merge new default state properties\n if (tempInstance._state) {\n const existingState = inst._state as Record<string, unknown> || {};\n const newDefaults = tempInstance._state as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingState)) {\n existingState[key] = newDefaults[key];\n }\n }\n inst._state = existingState;\n }\n\n // Merge new default props properties\n if (tempInstance._props) {\n const existingProps = inst._props as Record<string, unknown> || {};\n const newDefaults = tempInstance._props as Record<string, unknown>;\n for (const key of Object.keys(newDefaults)) {\n if (!(key in existingProps)) {\n existingProps[key] = newDefaults[key];\n }\n }\n inst._props = existingProps;\n }\n\n // _connected, _isReady, _ready are preserved as we do want to keep\n // the state of the component on those.\n\n (instance as Component).forceRender();\n }\n });\n }\n }\n\n /**\n * Get all instances of a component or execute a callback on them\n *\n * @param tag - The tag name of the component\n * @param callback - Optional callback to execute on each instance\n */\n static instances(tag: string, callback?: (instance: Element) => void): NodeListOf<Element> | void {\n if (typeof this.components[tag] !== 'undefined') {\n if (typeof callback === 'function') {\n document.querySelectorAll(tag).forEach(callback);\n } else {\n return document.querySelectorAll(tag);\n }\n } else {\n throw new Error('No component with the provided tag has been registered.');\n }\n }\n\n /**\n * Create a new instance of a component\n *\n * @param tag - The tag name of the component\n * @param props - Properties to set on the component\n * @returns The created component instance\n */\n static instantiate(tag: string, props: Record<string, any>): Component {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n if (!this.components[tag]._registered) {\n this.register(tag, this.components[tag]);\n }\n\n const element = document.createElement(this.components[tag].tag) as Component;\n\n element.setProps(props);\n\n return element;\n }\n\n /**\n * Check if a component is registered with the given tag\n *\n * @param tag - The tag name to check\n * @returns True if a component is registered with the tag\n */\n static has(tag: string): boolean {\n return typeof this.components[tag] !== 'undefined';\n }\n\n /**\n * Get the component class registered with the given tag\n *\n * @param tag - The tag name of the component\n * @returns The component class or undefined if not registered\n */\n static get(tag: string): ComponentClass | undefined {\n return this.components[tag];\n }\n\n /*\n * =========================\n * Global State Management\n * =========================\n */\n\n /**\n * Set a global state value\n *\n * @param key - The state key\n * @param value - The value to set\n */\n static setState<T>(key: string, value: T): void {\n const oldValue = this.state[key] as T | undefined;\n this.state[key] = value;\n\n // Notify subscribers\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(value, oldValue);\n });\n }\n }\n\n /**\n * Get a global state value\n *\n * @param key - The state key\n * @returns The state value or undefined if not set\n */\n static getState<T>(key: string): T | undefined {\n return this.state[key] as T | undefined;\n }\n\n /**\n * Check if a global state key exists\n *\n * @param key - The state key to check\n * @returns True if the state key exists\n */\n static hasState(key: string): boolean {\n return key in this.state;\n }\n\n /**\n * Delete a global state value\n *\n * @param key - The state key to delete\n * @returns True if the key existed and was deleted\n */\n static deleteState(key: string): boolean {\n if (key in this.state) {\n const oldValue = this.state[key];\n delete this.state[key];\n\n // Notify subscribers with undefined as new value\n if (this.subscribers[key]) {\n this.subscribers[key].forEach((callback) => {\n callback(undefined, oldValue);\n });\n }\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Subscribe to changes on a global state key\n *\n * @param key - The state key to subscribe to\n * @param callback - Function called when the state changes\n * @returns An unsubscribe function\n */\n static subscribe<T>(key: string, callback: StateSubscriber<T>): () => void {\n if (!this.subscribers[key]) {\n this.subscribers[key] = new Set();\n }\n\n this.subscribers[key].add(callback as StateSubscriber);\n\n // Return unsubscribe function\n return () => {\n this.unsubscribe(key, callback);\n };\n }\n\n /**\n * Unsubscribe from changes on a global state key\n *\n * @param key - The state key to unsubscribe from\n * @param callback - The callback function to remove\n */\n static unsubscribe<T>(key: string, callback: StateSubscriber<T>): void {\n if (this.subscribers[key]) {\n this.subscribers[key].delete(callback as StateSubscriber);\n }\n }\n\n /**\n * Get all global state as an object\n *\n * @returns A copy of the global state object\n */\n static getAllState(): Record<string, unknown> {\n return { ...this.state };\n }\n\n /**\n * Clear all global state and notify subscribers\n */\n static clearState(): void {\n const keys = Object.keys(this.state);\n\n for (const key of keys) {\n this.deleteState(key);\n }\n }\n\n /*\n * =========================\n * Debugging Tools\n * =========================\n */\n\n /**\n * Enable or disable debug mode.\n * When enabled, lifecycle events are logged to the console.\n */\n static get debug(): boolean {\n return this._debug;\n }\n\n static set debug(value: boolean) {\n this._debug = value;\n }\n\n /**\n * Log a debug message if debug mode is enabled\n *\n * @param message - The message to log\n * @param data - Optional data to include\n */\n static log(message: string, data?: unknown): void {\n if (this._debug) {\n if (data !== undefined) {\n console.log(`[Pandora] ${message}`, data);\n } else {\n console.log(`[Pandora] ${message}`);\n }\n }\n }\n\n /**\n * List all registered component tags\n *\n * @returns Array of registered component tag names\n */\n static list(): string[] {\n return Object.keys(this.components);\n }\n\n /**\n * Get statistics for a specific component or all components\n *\n * @param tag - Optional tag to get stats for a specific component\n * @returns Component stats or array of all component stats\n */\n static stats(tag?: string): ComponentStats | ComponentStats[] {\n if (tag) {\n if (!this.has(tag)) {\n throw new Error(`No component with tag \"${tag}\" has been registered.`);\n }\n\n return {\n tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n };\n }\n\n return this.list().map((tag) => ({\n tag: tag,\n instanceCount: document.querySelectorAll(tag).length,\n isRegistered: this.components[tag]?._registered ?? false,\n isLazy: tag in this.lazyLoaders\n }));\n }\n\n /*\n * =========================\n * Global Lifecycle Hooks\n * =========================\n */\n\n /**\n * Register a callback to be called when any component mounts\n *\n * @param callback - Function called with (component, tag) when a component mounts\n * @returns Unsubscribe function\n */\n static onMount(callback: LifecycleCallback): () => void {\n this._init();\n this.mountCallbacks.add(callback);\n\n return () => this.mountCallbacks.delete(callback);\n }\n\n /**\n * Register a callback to be called when any component unmounts\n *\n * @param callback - Function called with (component, tag) when a component unmounts\n * @returns Unsubscribe function\n */\n static onUnmount(callback: LifecycleCallback): () => void {\n this._init();\n this.unmountCallbacks.add(callback);\n\n return () => this.unmountCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that a component has mounted\n * @internal\n */\n static _notifyMount(component: Component, tag: string): void {\n this.log(`Mounted: <${tag}>`);\n this.mountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onMount callback:', error);\n }\n });\n }\n\n /**\n * Notify Registry that a component has unmounted\n *\n * @internal\n */\n static _notifyUnmount(component: Component, tag: string): void {\n this.log(`Unmounted: <${tag}>`);\n this.unmountCallbacks.forEach((callback) => {\n try {\n callback(component, tag);\n } catch (error) {\n console.error('[Pandora] Error in onUnmount callback:', error);\n }\n });\n }\n\n /*\n * =========================\n * Error Boundaries\n * =========================\n */\n\n /**\n * Register a global error handler for component errors\n *\n * @param callback - Function called with (error, component, tag, lifecycle) when an error occurs\n * @returns Unsubscribe function\n */\n static onError(callback: ErrorCallback): () => void {\n this._init();\n this.errorCallbacks.add(callback);\n\n return () => this.errorCallbacks.delete(callback);\n }\n\n /**\n * Notify Registry that an error occurred in a component\n *\n * @internal\n */\n static _notifyError(error: Error, component: Component, tag: string, lifecycle: string): void {\n this.log(`Error in <${tag}> during ${lifecycle}:`, error);\n\n if (this.errorCallbacks.size === 0) {\n // No error handlers registered, re-throw\n throw error;\n }\n\n this.errorCallbacks.forEach((callback) => {\n try {\n callback(error, component, tag, lifecycle);\n } catch (callbackError) {\n console.error('[Pandora] Error in onError callback:', callbackError);\n }\n });\n }\n\n /*\n * =========================\n * Component Aliases\n * =========================\n */\n\n /**\n * Create an alias for an existing component tag\n *\n * @param aliasTag - The new tag name to use as an alias\n * @param originalTag - The original component tag name\n */\n static alias(aliasTag: string, originalTag: string): void {\n if (!this.has(originalTag)) {\n throw new Error(`Cannot create alias: no component with tag \"${originalTag}\" has been registered.`);\n }\n\n if (this.has(aliasTag)) {\n throw new Error(`Cannot create alias: a component with tag \"${aliasTag}\" already exists.`);\n }\n\n this.aliases[aliasTag] = originalTag;\n\n // Create a subclass that inherits from the original component\n const OriginalClass = this.components[originalTag];\n\n // Create a subclass with a different tag\n const AliasClass = class extends (OriginalClass as typeof Component) {\n static _tag = aliasTag;\n };\n\n this.components[aliasTag] = AliasClass as unknown as ComponentClass;\n window.customElements.define(aliasTag, AliasClass);\n\n this.log(`Created alias: <${aliasTag}> -> <${originalTag}>`);\n }\n\n /**\n * Get the original tag for an alias\n *\n * @param aliasTag - The alias tag name\n * @returns The original tag name or undefined if not an alias\n */\n static getOriginalTag(aliasTag: string): string | undefined {\n return this.aliases[aliasTag];\n }\n\n /**\n * Check if a tag is an alias\n *\n * @param tag - The tag name to check\n * @returns True if the tag is an alias\n */\n static isAlias(tag: string): boolean {\n return tag in this.aliases;\n }\n\n /*\n * =========================\n * Lazy Loading\n * =========================\n */\n\n /**\n * Register a component to be lazily loaded on first use\n *\n * @param tag - The tag name for the component\n * @param loader - Async function that returns the component class\n */\n static lazy(tag: string, loader: ComponentLoader): void {\n this._init();\n\n if (this.has(tag)) {\n throw new Error(`Cannot register lazy component: a component with tag \"${tag}\" already exists.`);\n }\n\n this.lazyLoaders[tag] = loader;\n\n // Store reference to Registry for use in the class\n const registry = Registry;\n\n // Create a placeholder class that will load and delegate to the real component\n class LazyComponent extends Component {\n static _tag = tag;\n private _lazyLoaded = false;\n\n async connectedCallback(): Promise<void> {\n // Load the real component on first mount\n await registry._loadLazyComponent(tag);\n\n // Get the loaded implementation\n const RealComponent = registry.getImplementation(tag);\n if (RealComponent && RealComponent !== LazyComponent) {\n const proto = RealComponent.prototype as unknown as Record<string, unknown>;\n const protoMethods = Object.getOwnPropertyNames(proto);\n const inst = this as unknown as Record<string, unknown>;\n\n // Copy prototype methods from the real component to this instance\n for (const method of protoMethods) {\n if (method !== 'constructor' && typeof proto[method] === 'function') {\n const fn = proto[method] as (...args: unknown[]) => unknown;\n inst[method] = fn.bind(this);\n }\n }\n\n // Get default state/props from the real component\n const tempInstance = Object.create(proto);\n\n try {\n RealComponent.call(tempInstance);\n } catch {\n // If constructor fails, skip state/props initialization\n }\n\n // Apply default state from real component\n if (tempInstance._state) {\n inst._state = { ...(tempInstance._state as object) };\n }\n\n // Apply default props from real component\n if (tempInstance._props) {\n inst._props = { ...(tempInstance._props as object) };\n }\n\n this._lazyLoaded = true;\n }\n\n // Now run the normal connected callback\n await super.connectedCallback();\n }\n }\n\n this.components[tag] = LazyComponent as unknown as ComponentClass;\n window.customElements.define(tag, LazyComponent);\n this.log(`Registered lazy component: <${tag}>`);\n }\n\n /**\n * Load a lazy component\n *\n * @internal\n */\n static async _loadLazyComponent(tag: string): Promise<void> {\n if (!(tag in this.lazyLoaders)) {\n return;\n }\n\n const loader = this.lazyLoaders[tag];\n this.log(`Loading lazy component: <${tag}>`);\n\n try {\n const result = await loader();\n const componentClass = 'default' in result ? result.default : result;\n\n // Remove from lazy loaders\n delete this.lazyLoaders[tag];\n\n // Store as the implementation\n this.implementations[tag] = componentClass;\n componentClass._registered = true;\n\n this.log(`Loaded lazy component: <${tag}>`);\n } catch (error) {\n console.error(`[Pandora] Failed to load lazy component <${tag}>:`, error);\n throw error;\n }\n }\n\n /**\n * Check if a component is lazy (not yet loaded)\n *\n * @param tag - The tag name to check\n * @returns True if the component is registered as lazy and not yet loaded\n */\n static isLazy(tag: string): boolean {\n return tag in this.lazyLoaders;\n }\n\n /**\n * Preload a lazy component without mounting it\n *\n * @param tag - The tag name of the lazy component to preload\n */\n static async preload(tag: string): Promise<void> {\n if (this.isLazy(tag)) {\n await this._loadLazyComponent(tag);\n }\n }\n\n /*\n * =========================\n * Middleware\n * =========================\n */\n\n /**\n * Register middleware to intercept props, state, or render operations\n *\n * @param type - The type of middleware: 'props', 'state', or 'render'\n * @param middleware - Function that receives (component, value, renderType?) and returns the modified value.\n *\n * @returns Unsubscribe function\n *\n * @example\n * // Type-aware render middleware\n * Registry.use('render', (component, value, renderType) => {\n * if (renderType === 'string') {\n * return value.toUpperCase();\n * }\n * // For lit-html, return as-is or wrap\n * return value;\n * });\n */\n static use(type: MiddlewareType, middleware: Middleware): () => void {\n this._init();\n this.middleware[type].add(middleware);\n\n return () => this.middleware[type].delete(middleware);\n }\n\n /**\n * Apply middleware to a value\n *\n * @param type - The middleware type\n * @param component - The component instance\n * @param value - The value to process\n * @param renderType - For 'render' middleware, indicates if template is 'string' or 'lit'\n * @internal\n */\n static _applyMiddleware(type: MiddlewareType, component: Component, value: any, renderType?: RenderType): any {\n let result = value;\n\n this.middleware[type].forEach((middleware) => {\n try {\n result = middleware(component, result, renderType);\n } catch (error) {\n console.error(`[Pandora] Error in ${type} middleware:`, error);\n }\n });\n\n return result;\n }\n\n /**\n * Check if there are any middleware registered for a type\n *\n * @internal\n */\n static _hasMiddleware(type: MiddlewareType): boolean {\n return this.middleware[type].size > 0;\n }\n}\n\nexport default Registry;",
10
+ "import Component from './Component';\nimport Registry from './Registry';\n\n// ==========================================\n// Types\n// ==========================================\n\ntype ComponentConstructor = typeof Component & {\n tag: string;\n _registered?: boolean;\n};\n\n// ==========================================\n// @Register Decorator\n// ==========================================\n\n/**\n * Class Decorator: Automatically registers the component with the CustomElementsRegistry.\n *\n * @example\n * ```typescript\n * @Register('my-component')\n * class MyComponent extends Component {\n * render() {\n * return '<div>Hello World</div>';\n * }\n * }\n * ```\n *\n * @param tagName - The custom element tag name (must contain a hyphen)\n */\nexport function Register(tagName: string) {\n return function <T extends ComponentConstructor>(constructor: T): T {\n Registry.register(tagName, constructor);\n return constructor;\n };\n}\n\n// ==========================================\n// @Consumer Decorator\n// ==========================================\n\n/**\n * Property Decorator: Binds a class property to a Global Registry state key.\n *\n * This decorator:\n * 1. On component connect, sets the property to the current global value\n * 2. Subscribes to global state changes and updates the property automatically\n * 3. When the property is set internally, updates the global state\n * 4. Automatically unsubscribes when the component disconnects\n *\n * @example\n * ```typescript\n * class UserProfile extends Component {\n * @Consumer('user.theme')\n * theme!: string;\n *\n * @Consumer('app.language')\n * language!: string;\n *\n * render() {\n * return `<div>Theme: ${this.theme}, Language: ${this.language}</div>`;\n * }\n * }\n * ```\n *\n * @param stateKey - The global state key in the Registry to bind to\n */\nexport function Consumer(stateKey: string) {\n return function (target: any, propertyKey: string) {\n // Store the original lifecycle methods\n const originalConnected = target.connectedCallback;\n const originalDisconnected = target.disconnectedCallback;\n\n // Create unique symbols to store per-instance data without collisions\n const unsubKey = Symbol(`__pandora_unsub_${propertyKey}`);\n const valueKey = Symbol(`__pandora_value_${propertyKey}`);\n\n // Override connectedCallback to set up the subscription\n target.connectedCallback = async function (this: Component & Record<symbol, any>) {\n // Subscribe to Registry state changes\n this[unsubKey] = Registry.subscribe(stateKey, (newVal: unknown) => {\n // Update the property value (this won't trigger Registry.setState due to equality check)\n this[valueKey] = newVal;\n\n // Trigger a re-render if the component is ready\n if (this._isReady) {\n this.forceRender();\n }\n });\n\n // Initial sync: Registry -> Component\n const currentGlobal = Registry.getState(stateKey);\n if (currentGlobal !== undefined) {\n this[valueKey] = currentGlobal;\n }\n\n // Call the original connectedCallback\n if (originalConnected) {\n await originalConnected.call(this);\n }\n };\n\n // Override disconnectedCallback to clean up the subscription\n target.disconnectedCallback = async function (this: Component & Record<symbol, any>) {\n // Unsubscribe to prevent memory leaks\n if (this[unsubKey]) {\n this[unsubKey]();\n this[unsubKey] = undefined;\n }\n\n // Call the original disconnectedCallback\n if (originalDisconnected) {\n await originalDisconnected.call(this);\n }\n };\n\n // Define the property getter/setter on the prototype\n Object.defineProperty(target, propertyKey, {\n get: function (this: Component & Record<symbol, any>) {\n return this[valueKey];\n },\n set: function (this: Component & Record<symbol, any>, newVal: unknown) {\n const oldVal = this[valueKey];\n\n // Only update if the value actually changed\n if (oldVal === newVal) return;\n\n this[valueKey] = newVal;\n\n // Sync to global state (Registry.setState checks equality to prevent loops)\n Registry.setState(stateKey, newVal);\n\n // Trigger a re-render if the component is ready\n if (this._isReady) {\n this.forceRender();\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n\n// ==========================================\n// @Prop Decorator (Bonus utility)\n// ==========================================\n\n/**\n * Property Decorator: Declares a property that syncs with a DOM attribute.\n *\n * When the attribute changes, the property updates automatically.\n * When the property is set, the attribute is updated.\n *\n * @example\n * ```typescript\n * class MyButton extends Component {\n * @Prop()\n * disabled: boolean = false;\n *\n * @Prop('button-type')\n * type: string = 'primary';\n * }\n * ```\n *\n * @param attributeName - Optional custom attribute name (defaults to property name)\n */\nexport function Prop(attributeName?: string) {\n return function (target: any, propertyKey: string) {\n const attrName = attributeName || propertyKey;\n const valueKey = Symbol(`__pandora_prop_${propertyKey}`);\n\n // Store attribute name for observedAttributes\n if (!target.constructor._observedAttributes) {\n target.constructor._observedAttributes = [];\n }\n if (!target.constructor._observedAttributes.includes(attrName)) {\n target.constructor._observedAttributes.push(attrName);\n }\n\n Object.defineProperty(target, propertyKey, {\n get: function (this: Component & Record<symbol, any>) {\n // Return the cached value or try to get from attribute\n if (this[valueKey] !== undefined) {\n return this[valueKey];\n }\n\n // Try to read from attribute\n if (this.hasAttribute(attrName)) {\n const attrValue = this.getAttribute(attrName);\n return parseAttributeValue(attrValue);\n }\n\n return undefined;\n },\n set: function (this: Component & Record<symbol, any>, newVal: unknown) {\n this[valueKey] = newVal;\n\n // Reflect to attribute if it's a primitive\n if (typeof newVal === 'string' || typeof newVal === 'number' || typeof newVal === 'boolean') {\n if (typeof newVal === 'boolean') {\n if (newVal) {\n this.setAttribute(attrName, '');\n } else {\n this.removeAttribute(attrName);\n }\n } else {\n this.setAttribute(attrName, String(newVal));\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n };\n}\n\n/**\n * Helper function to parse attribute values into appropriate types\n */\nfunction parseAttributeValue(value: string | null): unknown {\n if (value === null) {\n return undefined;\n }\n\n if (value === '' || value === 'true') {\n return true;\n }\n\n if (value === 'false') {\n return false;\n }\n\n if (!isNaN(Number(value))) {\n return value.includes('.') ? parseFloat(value) : parseInt(value, 10);\n }\n\n return value;\n}\n\n",
9
11
  "// This file is basically just a hack to expose the Pandora namespace in the\n// window object. Once/if bun adds support for this, we can remove this file.\n\nimport * as Pandora from './index';\n\ndeclare global {\n interface Window {\n Pandora: typeof Pandora;\n }\n}\n\nif (typeof window === 'object') {\n window.Pandora = Pandora;\n}"
10
12
  ],
11
- "mappings": "+QAQO,SAAS,CAAY,CAAC,EAAiC,KAAiB,EAAyB,CACtG,GAAI,CACF,IAAM,EAAS,EAAS,MAAM,EAAS,CAAI,EAC3C,OAAO,aAAkB,QAAU,EAAS,QAAQ,QAAQ,CAAM,EAClE,MAAO,EAAG,CACV,OAAO,QAAQ,OAAO,CAAC,GAUpB,SAAS,CAAc,CAAC,EAAmB,EAAwB,GAAI,EAAgB,EAA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