{"version":3,"file":"myra.mjs","names":[],"sources":["../src/contract.ts","../src/component.ts","../src/fragment.ts","../src/queue.ts","../src/helpers.ts","../src/hooks.ts","../src/context.ts","../src/jsxFactory.ts","../src/memo.ts","../src/myra.ts"],"sourcesContent":["declare global {\n\n    namespace JSX {\n\n        type GlobalHtmlAttributes<TElement extends HTMLElement> = GlobalAttributes<TElement>\n\n        export type Element = VNode\n\n        export interface ElementClass<TProps> {\n            props: TProps\n        }\n        export interface ElementAttributesProperty<TProps> {\n            props: TProps\n        }\n        export interface ElementChildrenAttribute { children: unknown }\n\n        interface IntrinsicAttributes {\n            key?: string | number\n        }\n\n        export interface IntrinsicElements {\n            nothing: Record<string, never>\n\n            a: AAttributes\n            abbr: GlobalHtmlAttributes<HTMLElement>\n            address: GlobalHtmlAttributes<HTMLElement>\n            area: AreaAttributes\n            article: GlobalHtmlAttributes<HTMLElement>\n            aside: GlobalHtmlAttributes<HTMLElement>\n            audio: AudioAttributes\n\n            b: GlobalHtmlAttributes<HTMLElement>\n            bdi: GlobalHtmlAttributes<HTMLElement>\n            bdo: GlobalHtmlAttributes<HTMLElement>\n            blockquote: GlobalHtmlAttributes<HTMLElement>\n            br: GlobalHtmlAttributes<HTMLBRElement>\n            button: ButtonAttributes\n\n            canvas: CanvasAttributes\n            caption: GlobalHtmlAttributes<HTMLTableCaptionElement>\n            cite: GlobalHtmlAttributes<HTMLElement>\n            code: GlobalHtmlAttributes<HTMLElement>\n            col: ColAttributes\n            colgroup: ColGroupAttributes\n\n            data: GlobalHtmlAttributes<HTMLElement>\n            datalist: GlobalHtmlAttributes<HTMLDataListElement>\n            dd: GlobalHtmlAttributes<HTMLElement>\n            del: DelAttributes\n            details: DetailsAttributes\n            dfn: GlobalHtmlAttributes<HTMLElement>\n            div: GlobalHtmlAttributes<HTMLDivElement>\n            dl: GlobalHtmlAttributes<HTMLDListElement>\n            dt: GlobalHtmlAttributes<HTMLElement>\n\n            em: GlobalHtmlAttributes<HTMLElement>\n            embed: EmbedAttributes\n\n            fieldset: FieldsetAttributes\n            figcaption: GlobalHtmlAttributes<HTMLElement>\n            figure: GlobalHtmlAttributes<HTMLElement>\n            footer: GlobalHtmlAttributes<HTMLElement>\n            form: FormAttributes\n\n            h1: GlobalHtmlAttributes<HTMLHeadingElement>\n            h2: GlobalHtmlAttributes<HTMLHeadingElement>\n            h3: GlobalHtmlAttributes<HTMLHeadingElement>\n            h4: GlobalHtmlAttributes<HTMLHeadingElement>\n            h5: GlobalHtmlAttributes<HTMLHeadingElement>\n            h6: GlobalHtmlAttributes<HTMLHeadingElement>\n            header: GlobalHtmlAttributes<HTMLElement>\n            hr: GlobalHtmlAttributes<HTMLHRElement>\n\n            i: GlobalHtmlAttributes<HTMLElement>\n            iframe: IframeAttributes\n            img: ImgAttributes\n            input: InputAttributes\n            ins: InsAttributes\n\n            kbd: GlobalHtmlAttributes<HTMLElement>\n\n            label: LabelAttributes\n            legend: GlobalHtmlAttributes<HTMLLegendElement>\n            li: LiAttributes\n\n            main: GlobalHtmlAttributes<HTMLElement>\n            map: MapAttributes\n            mark: GlobalHtmlAttributes<HTMLElement>\n            meter: MeterAttributes\n\n            nav: GlobalHtmlAttributes<HTMLElement>\n\n            object: ObjectAttributes\n            ol: GlobalHtmlAttributes<HTMLOListElement>\n            optgroup: OptgroupAttributes\n            option: OptionAttributes\n            output: GlobalHtmlAttributes<HTMLElement>\n\n            p: GlobalHtmlAttributes<HTMLParagraphElement>\n            param: ParamAttributes\n            picture: GlobalHtmlAttributes<HTMLPictureElement>\n            pre: GlobalHtmlAttributes<HTMLPreElement>\n            progress: ProgressAttributes\n\n            q: QAttributes\n\n            rb: GlobalHtmlAttributes<HTMLElement>\n            rp: GlobalHtmlAttributes<HTMLElement>\n            rt: GlobalHtmlAttributes<HTMLElement>\n            rtc: GlobalHtmlAttributes<HTMLElement>\n            ruby: GlobalHtmlAttributes<HTMLElement>\n\n            s: GlobalHtmlAttributes<HTMLElement>\n            samp: GlobalHtmlAttributes<HTMLElement>\n            section: GlobalHtmlAttributes<HTMLElement>\n            select: SelectAttributes\n            small: GlobalHtmlAttributes<HTMLElement>\n            source: SourceAttributes\n            span: GlobalHtmlAttributes<HTMLElement>\n            strong: GlobalHtmlAttributes<HTMLElement>\n            sub: GlobalHtmlAttributes<HTMLElement>\n            summary: GlobalHtmlAttributes<HTMLElement>\n            sup: GlobalHtmlAttributes<HTMLElement>\n\n            table: GlobalHtmlAttributes<HTMLTableElement>\n            tbody: GlobalHtmlAttributes<HTMLTableSectionElement>\n            td: TdAttributes\n            textarea: TextareaAttributes\n            tfoot: GlobalHtmlAttributes<HTMLTableSectionElement>\n            th: ThAttributes\n            thead: GlobalHtmlAttributes<HTMLTableSectionElement>\n            time: TimeAttributes\n            tr: GlobalHtmlAttributes<HTMLTableRowElement>\n            track: TrackAttributes\n\n            u: GlobalHtmlAttributes<HTMLElement>\n            ul: GlobalHtmlAttributes<HTMLUListElement>\n\n            var: GlobalHtmlAttributes<HTMLElement>\n            video: VideoAttributes\n\n            wbr: GlobalHtmlAttributes<HTMLElement>\n\n            // SVG\n            altGlyph: SvgAttributes\n            altGlyphDef: SvgAttributes\n            altGlyphItem: SvgAttributes\n            animate: SvgAttributes\n            animateColor: SvgAttributes\n            animateMotion: SvgAttributes\n            animateTransform: SvgAttributes\n\n            circle: SvgAttributes\n            clipPath: SvgAttributes\n            'color-profile': SvgAttributes\n            cursor: SvgAttributes\n\n            defs: SvgAttributes\n            desc: SvgAttributes\n            discard: SvgAttributes\n\n            ellipse: SvgAttributes\n\n            feBlend: SvgAttributes\n            feColorMatrix: SvgAttributes\n            feComponentTransfer: SvgAttributes\n            feComposite: SvgAttributes\n            feConvolveMatrix: SvgAttributes\n            feDiffuseLighting: SvgAttributes\n            feDisplacementMap: SvgAttributes\n            feDistantLight: SvgAttributes\n            feDropShadow: SvgAttributes\n            feFlood: SvgAttributes\n            feFuncA: SvgAttributes\n            feFuncB: SvgAttributes\n            feFuncG: SvgAttributes\n            feFuncR: SvgAttributes\n            feGaussianBlur: SvgAttributes\n            feImage: SvgAttributes\n            feMerge: SvgAttributes\n            feMergeNode: SvgAttributes\n            feMorphology: SvgAttributes\n            feOffset: SvgAttributes\n            fePointLight: SvgAttributes\n            feSpecularLighting: SvgAttributes\n            feSpotLight: SvgAttributes\n            feTile: SvgAttributes\n            feTurbulence: SvgAttributes\n            filter: SvgAttributes\n            font: SvgAttributes\n            'font-face': SvgAttributes\n            'font-face-format': SvgAttributes\n            'font-face-name': SvgAttributes\n            'font-face-src': SvgAttributes\n            'font-face-uri': SvgAttributes\n            foreignObject: SvgAttributes\n\n            g: SvgAttributes\n            glyph: SvgAttributes\n            glyphRef: SvgAttributes\n\n            hatch: SvgAttributes\n            hatchpath: SvgAttributes\n            hkern: SvgAttributes\n\n            image: SvgAttributes\n\n            line: SvgAttributes\n            linearGradient: SvgAttributes\n\n            marker: SvgAttributes\n            mask: SvgAttributes\n            mesh: SvgAttributes\n            meshgradient: SvgAttributes\n            meshpatch: SvgAttributes\n            meshrow: SvgAttributes\n            metadata: SvgAttributes\n            'missing-glyph': SvgAttributes\n            mpath: SvgAttributes\n\n            path: SvgAttributes\n            pattern: SvgAttributes\n            polygon: SvgAttributes\n            polyline: SvgAttributes\n\n            radialGradient: SvgAttributes\n            rect: SvgAttributes\n\n            script: SvgAttributes\n            set: SvgAttributes\n            solidcolor: SvgAttributes\n            stop: SvgAttributes\n            style: SvgAttributes\n            svg: SvgAttributes\n            switch: SvgAttributes\n            symbol: SvgAttributes\n\n            text: SvgAttributes\n            textPath: SvgAttributes\n            title: SvgAttributes\n            tref: SvgAttributes\n            tspan: SvgAttributes\n\n            unknown: SvgAttributes\n            use: SvgAttributes\n\n            view: SvgAttributes\n            vkern: SvgAttributes\n        }\n    }\n\n}\n\nexport type TextNode = string | number\n\nexport type Key = string | number\n\ntype MyraChild = VNode | TextNode\n\nexport type MyraNode = MyraChild | Array<MyraNode> | boolean | null | undefined\n\nexport type UpdateState<TState> = TState | ((s: TState) => TState)\nexport type Evolve<TState> = (update: UpdateState<TState>) => TState\n\nexport type ComponentFactory<TProps> = (props: TProps) => MyraNode\n\nexport type JSXElementFactory<TProps> = (props: TProps) => VNode\n\nexport type ErrorHandler = (error: unknown) => VNode\n\nexport interface Ref<T> {\n    current: T\n}\n\nexport interface ContextBinding<T> {\n    getValue: () => T\n    subscribe: (callback: () => void) => (() => void)\n}\n\nexport interface ProviderProps<T> extends ComponentProps {\n    value: T\n}\n\nexport interface Context<T> {\n    readonly Provider: (props: ProviderProps<T> & ComponentProps) => VNode\n}\n\nexport type Effect = () => EffectCleanupCallback\nexport type EffectCleanupCallback = (() => void) | void\n\n\nexport interface ComponentProps {\n    children?: MyraNode\n    key?: Key\n}\n\nexport const enum VNodeType {\n    Nothing,\n    Text,\n    Element,\n    Fragment,\n    Component,\n}\n\n/**\n * A virtual node representing nothing. Will be rendered as a comment DOM\n * node.\n */\nexport interface NothingVNode {\n    readonly _: VNodeType.Nothing\n}\n\n/**\n * A virtual node that represents a text DOM node.\n */\nexport interface TextVNode {\n    readonly _: VNodeType.Text\n    readonly text: string\n}\n\n/**\n * A virtual node representing a DOM Element.\n */\nexport interface ElementVNode<TElement extends Element> {\n    readonly _: VNodeType.Element\n    readonly tagName: string\n    readonly props: GlobalAttributes<TElement> & { children: VNode[] }\n}\n\nexport interface FragmentVNode {\n    readonly _: VNodeType.Fragment\n    readonly props: {\n        children: VNode[]\n        key?: Key\n    }\n}\n\n\n/**\n * A virtual node representing a component.\n */\nexport interface ComponentVNode<TProps> {\n    readonly _: VNodeType.Component\n    props: TProps\n    /** The function that generates a VNode tree for the component. */\n    readonly view: ComponentFactory<TProps>\n}\n\n/**\n * Union type of the different types of virtual nodes.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type VNode = TextVNode | ElementVNode<any> | FragmentVNode | ComponentVNode<any> | NothingVNode\n\nexport interface GenericEvent<T extends EventTarget> extends Event {\n    currentTarget: T\n}\nexport interface GenericClipboardEvent<T extends EventTarget> extends ClipboardEvent {\n    currentTarget: T\n}\nexport interface GenericCompositionEvent<T extends EventTarget> extends CompositionEvent {\n    currentTarget: T\n}\nexport interface GenericDragEvent<T extends EventTarget> extends DragEvent {\n    currentTarget: T\n}\nexport interface GenericFocusEvent<T extends EventTarget> extends FocusEvent {\n    currentTarget: T\n}\nexport interface GenericInputEvent<T extends EventTarget> extends InputEvent {\n    currentTarget: T\n}\nexport interface GenericKeyboardEvent<T extends EventTarget> extends KeyboardEvent {\n    currentTarget: T\n}\nexport interface GenericMouseEvent<T extends EventTarget> extends MouseEvent {\n    currentTarget: T\n}\nexport interface GenericTouchEvent<T extends EventTarget> extends TouchEvent {\n    currentTarget: T\n}\nexport interface GenericWheelEvent<T extends EventTarget> extends WheelEvent {\n    currentTarget: T\n}\n\n/**\n * A function used as callback for event triggers.\n */\nexport type EventListener<TEvent extends Event> = (event: TEvent) => void\n\nexport interface GlobalAttributes<TElement extends Element> {\n\n    children?: MyraNode\n    key?: Key\n    ref?: Ref<TElement>\n\n    accesskey?: string\n    autocapitalize?: string\n    'class'?: string\n    contenteditable?: boolean | '' | 'true' | 'false'\n    contextmenu?: string\n    dir?: 'ltr' | 'rtl' | 'auto'\n    draggable?: boolean | 'true' | 'false'\n    hidden?: boolean | 'true' | 'false'\n    id?: string\n    inputmode?: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url'\n    is?: string\n    itemid?: string\n    itemprop?: string\n    itemref?: string\n    itemscope?: boolean | 'true' | 'false'\n    itemtype?: string\n    lang?: string\n    part?: string\n    slot?: string\n    spellcheck?: boolean | 'default' | 'true' | 'false'\n    style?: string\n    tabindex?: number | string\n    title?: string\n    translate?: '' | 'yes' | 'no'\n\n    onauxclick?: EventListener<GenericMouseEvent<TElement>>\n    onblur?: EventListener<GenericEvent<TElement>>\n    onclick?: EventListener<GenericMouseEvent<TElement>>\n    oncontextmenu?: EventListener<GenericEvent<TElement>>\n    ondblclick?: EventListener<GenericMouseEvent<TElement>>\n    onerror?: EventListener<GenericEvent<TElement>>\n    onfocus?: EventListener<GenericFocusEvent<TElement>>\n    onfocusin?: EventListener<GenericFocusEvent<TElement>>\n    onfocusout?: EventListener<GenericFocusEvent<TElement>>\n    onfullscreenchange?: EventListener<GenericEvent<TElement>>\n    onfullscreenerror?: EventListener<GenericEvent<TElement>>\n    oninput?: EventListener<GenericInputEvent<HTMLInputElement>>\n    onkeydown?: EventListener<GenericKeyboardEvent<TElement>>\n    onkeypress?: EventListener<GenericKeyboardEvent<TElement>>\n    onkeyup?: EventListener<GenericKeyboardEvent<TElement>>\n    onmousedown?: EventListener<GenericMouseEvent<TElement>>\n    onmouseenter?: EventListener<GenericMouseEvent<TElement>>\n    onmouseleave?: EventListener<GenericMouseEvent<TElement>>\n    onmousemove?: EventListener<GenericMouseEvent<TElement>>\n    onmouseout?: EventListener<GenericMouseEvent<TElement>>\n    onmouseover?: EventListener<GenericMouseEvent<TElement>>\n    onmouseup?: EventListener<GenericMouseEvent<TElement>>\n    onselect?: EventListener<GenericEvent<TElement>>\n    onwheel?: EventListener<GenericWheelEvent<TElement>>\n\n    oncompositionend?: EventListener<GenericCompositionEvent<TElement>>\n    oncompositionstart?: EventListener<GenericCompositionEvent<TElement>>\n    oncompositionupdate?: EventListener<GenericCompositionEvent<TElement>>\n\n    oncopy?: EventListener<GenericClipboardEvent<TElement>>\n    oncut?: EventListener<GenericClipboardEvent<TElement>>\n    onpaste?: EventListener<GenericClipboardEvent<TElement>>\n\n    ondrag?: EventListener<GenericDragEvent<TElement>>\n    ondragend?: EventListener<GenericDragEvent<TElement>>\n    ondragenter?: EventListener<GenericDragEvent<TElement>>\n    ondragexit?: EventListener<GenericDragEvent<TElement>>\n    ondragleave?: EventListener<GenericDragEvent<TElement>>\n    ondragover?: EventListener<GenericDragEvent<TElement>>\n    ondragstart?: EventListener<GenericDragEvent<TElement>>\n    ondrop?: EventListener<GenericDragEvent<TElement>>\n\n    ontouchcancel?: EventListener<GenericTouchEvent<TElement>>\n    ontouchend?: EventListener<GenericTouchEvent<TElement>>\n    ontouchmove?: EventListener<GenericTouchEvent<TElement>>\n    ontouchstart?: EventListener<GenericTouchEvent<TElement>>\n\n    role?: string\n\n    // Widget attributes\n\n    'aria-autocomplete'?: string | boolean | number\n    'aria-checked'?: string | boolean | number\n    'aria-disabled'?: string | boolean | number\n    'aria-expanded'?: string | boolean | number\n    'aria-haspopup'?: string | boolean | number\n    'aria-hidden'?: string | boolean | number\n    'aria-invalid'?: string | boolean | number\n    'aria-label'?: string | boolean | number\n    'aria-level'?: string | boolean | number\n    'aria-multiline'?: string | boolean | number\n    'aria-multiselectable'?: string | boolean | number\n    'aria-orientation'?: string | boolean | number\n    'aria-pressed'?: string | boolean | number\n    'aria-readonly'?: string | boolean | number\n    'aria-required'?: string | boolean | number\n    'aria-selected'?: string | boolean | number\n    'aria-sort'?: string | boolean | number\n    'aria-valuemax'?: string | boolean | number\n    'aria-valuemin'?: string | boolean | number\n    'aria-valuenow'?: string | boolean | number\n    'aria-valuetext'?: string | boolean | number\n\n    // Live region attributes\n\n    'aria-live'?: string | boolean | number\n    'aria-relevant'?: string | boolean | number\n    'aria-atomic'?: string | boolean | number\n    'aria-busy'?: string | boolean | number\n\n    // Drag & drop attributes\n\n    'aria-dropeffect'?: string | boolean | number\n    'aria-dragged'?: string | boolean | number\n\n    // Relationship attributes\n\n    'aria-activedescendant'?: string | boolean | number\n    'aria-controls'?: string | boolean | number\n    'aria-describedby'?: string | boolean | number\n    'aria-flowto'?: string | boolean | number\n    'aria-labelledby'?: string | boolean | number\n    'aria-owns'?: string | boolean | number\n    'aria-posinset'?: string | boolean | number\n    'aria-setsize'?: string | boolean | number\n\n    // [name: string]: any\n}\n\nexport interface AAttributes extends GlobalAttributes<HTMLAnchorElement> {\n    download?: string\n    href?: string\n    hreflang?: string\n    rel?: string\n    target?: string\n    type?: string\n}\n\nexport interface AreaAttributes extends GlobalAttributes<HTMLAreaElement> {\n    alt?: string\n    coords?: string\n    download?: string\n    href?: string\n    hreflang?: string\n    media?: string\n    rel?: string\n    shape?: string\n    target?: string\n    type?: string\n}\nexport interface AudioAttributes extends GlobalAttributes<HTMLAudioElement> {\n    autoplay?: boolean | 'true' | 'false'\n    buffered?: string | boolean | number\n    controls?: string | boolean | number\n    loop?: boolean | 'true' | 'false'\n    muted?: boolean | 'true' | 'false'\n    played?: string | boolean | number\n    preload?: '' | 'none' | 'metadata' | 'auto'\n    src?: string\n    volume?: number | string\n}\nexport interface ButtonAttributes extends GlobalAttributes<HTMLButtonElement> {\n    autofocus?: boolean | 'true' | 'false'\n    disabled?: boolean | 'true' | 'false'\n    form?: string\n    formaction?: string\n    formenctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain'\n    formmethod?: 'post' | 'get'\n    formnovalidate?: boolean | 'true' | 'false'\n    formtarget?: string\n    name?: string\n    type?: 'submit' | 'reset' | 'button'\n    value?: string | number\n}\nexport interface CanvasAttributes extends GlobalAttributes<HTMLCanvasElement> {\n    height?: number | string\n    width?: number | string\n}\nexport interface ColAttributes extends GlobalAttributes<HTMLTableColElement> {\n    span?: number | string\n}\nexport interface ColGroupAttributes extends GlobalAttributes<HTMLTableColElement> {\n    span?: number | string\n}\nexport interface DelAttributes extends GlobalAttributes<HTMLElement> {\n    cite?: string\n    datetime?: string\n}\nexport interface DetailsAttributes extends GlobalAttributes<HTMLElement> {\n    open?: boolean | 'true' | 'false'\n}\nexport interface EmbedAttributes extends GlobalAttributes<HTMLEmbedElement> {\n    height?: number | string\n    src?: string\n    type?: string\n    width?: number | string\n}\nexport interface FieldsetAttributes extends GlobalAttributes<HTMLFieldSetElement> {\n    disabled?: boolean | 'true' | 'false'\n    form?: string\n    name?: string\n}\nexport interface FormAttributes extends GlobalAttributes<HTMLFormElement> {\n    accept?: string\n    'accept-charset'?: string\n    action?: string\n    autocomplete?: 'on' | 'off'\n    enctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain'\n    method?: 'post' | 'get'\n    name?: string\n    novalidate?: boolean | 'true' | 'false'\n    target?: string\n\n    onreset?: EventListener<GenericEvent<HTMLFormElement>>\n    onsubmit?: EventListener<GenericEvent<HTMLFormElement>> // FormElementEventAttributeArguments\n    onchange?: EventListener<GenericEvent<HTMLFormElement>> // FormElementEventAttributeArguments\n}\nexport interface IframeAttributes extends GlobalAttributes<HTMLIFrameElement> {\n    allow?: string\n    allowfullscreen?: boolean | 'true' | 'false'\n    allowpaymentrequest?: boolean | 'true' | 'false'\n    height?: number | string\n    loading?: 'eager' | 'lazy'\n    name?: string\n    referrerpolicy?: string\n    sandbox?: string\n    src?: string\n    srcdoc?: string\n    width?: number | string\n}\nexport interface ImgAttributes extends GlobalAttributes<HTMLImageElement> {\n    alt?: string\n    crossorigin?: 'anonymous' | 'use-credentials'\n    height?: number | string\n    ismap?: boolean | 'true' | 'false'\n    longdesc?: string\n    sizes?: string\n    src: string\n    srcset?: string\n    width?: number | string\n    usemap?: string\n}\nexport interface InputAttributes extends Omit<GlobalAttributes<HTMLInputElement>, 'oninput'> {\n    type?: 'button' | 'checkbox' | 'color' | 'date' | 'datetime-local' | 'email' | 'file' | 'hidden' | 'image' | 'month' | 'number' | 'password' | 'radio' | 'range' | 'reset' | 'search' | 'submit' | 'tel' | 'text' | 'time' | 'url' | 'week'\n    accept?: string\n    autocomplete?: string\n    autofocus?: boolean | 'true' | 'false'\n    capture?: boolean | 'true' | 'false'\n    checked?: boolean | 'true' | 'false'\n    disabled?: boolean | 'true' | 'false'\n    form?: string\n    formaction?: string\n    formenctype?: 'application/x-www-form-urlencoded' | 'multipart/form-data' | 'text/plain'\n    formmethod?: 'post' | 'get'\n    formnovalidate?: boolean | 'true' | 'false'\n    formtarget?: string\n    height?: number | string\n    list?: string\n    max?: number | string\n    maxlength?: number | string\n    min?: number | string\n    minlength?: number | string\n    multiple?: boolean | 'true' | 'false'\n    name?: string\n    pattern?: string\n    placeholder?: string\n    readonly?: boolean | 'true' | 'false'\n    required?: boolean | 'true' | 'false'\n    selectionDirection?: string\n    size?: number | string\n    spellcheck?: boolean | 'true' | 'false'\n    src?: string\n    step?: number | string\n    value?: string | number\n    width?: number | string\n\n    onchange?: EventListener<GenericEvent<HTMLInputElement>>\n    oninput?: EventListener<GenericEvent<HTMLInputElement>>\n}\nexport interface InsAttributes extends GlobalAttributes<HTMLElement> {\n    cite?: string\n    datetime?: string\n}\nexport interface LabelAttributes extends GlobalAttributes<HTMLLabelElement> {\n    for?: string\n    form?: string\n}\nexport interface LiAttributes extends GlobalAttributes<HTMLLIElement> {\n    value?: number | string\n}\nexport interface MapAttributes extends GlobalAttributes<HTMLMapElement> {\n    name?: string\n}\nexport interface MeterAttributes extends GlobalAttributes<HTMLMeterElement> {\n    value?: number | string\n    min?: number | string\n    max?: number | string\n    low?: number | string\n    high?: number | string\n    optimum?: number | string\n    form?: string\n}\nexport interface ObjectAttributes extends GlobalAttributes<HTMLObjectElement> {\n    data?: string\n    height?: number | string\n    name?: string\n    type?: string\n    usemap?: string\n    width?: number | string\n}\nexport interface OptgroupAttributes extends GlobalAttributes<HTMLOptGroupElement> {\n    disabled?: boolean | 'true' | 'false'\n    label?: string\n}\nexport interface OptionAttributes extends GlobalAttributes<HTMLOptionElement> {\n    disabled?: boolean | 'true' | 'false'\n    label?: string\n    selected?: boolean | 'true' | 'false'\n    value?: string | number\n}\nexport interface ParamAttributes extends GlobalAttributes<HTMLParamElement> {\n    name?: string\n    value?: string\n}\nexport interface ProgressAttributes extends GlobalAttributes<HTMLProgressElement> {\n    max?: number | string\n    value?: number | string\n}\nexport interface QAttributes extends GlobalAttributes<HTMLQuoteElement> {\n    cite?: string\n}\nexport interface SelectAttributes extends GlobalAttributes<HTMLSelectElement> {\n    autofocus?: boolean | 'true' | 'false'\n    disabled?: boolean | 'true' | 'false'\n    form?: string\n    multiple?: boolean | 'true' | 'false'\n    name?: string\n    required?: boolean | 'true' | 'false'\n    size?: number | string\n\n    onchange?: EventListener<GenericEvent<HTMLSelectElement>>\n}\nexport interface SourceAttributes extends GlobalAttributes<HTMLSourceElement> {\n    src?: string\n    type?: string\n}\nexport interface TdAttributes extends GlobalAttributes<HTMLTableCellElement> {\n    colspan?: number | string\n    headers?: string\n    rowspan?: number | string\n}\nexport interface TextareaAttributes extends Omit<GlobalAttributes<HTMLTextAreaElement>, 'oninput'> {\n    autocomplete?: 'on' | 'off'\n    autofocus?: boolean | 'true' | 'false'\n    cols?: number | string\n    disabled?: boolean | 'true' | 'false'\n    form?: string\n    maxlength?: number | string\n    minlength?: number | string\n    name?: string\n    placeholder?: string\n    required?: boolean | 'true' | 'false'\n    rows?: number | string\n    selectionDirection?: string\n    selectionEnd?: number | string\n    selectionStart?: number | string\n    value?: string\n    wrap?: 'soft' | 'hard'\n\n    onchange?: EventListener<GenericEvent<HTMLTextAreaElement>>\n    oninput?: EventListener<GenericEvent<HTMLTextAreaElement>>\n}\nexport interface ThAttributes extends GlobalAttributes<HTMLTableHeaderCellElement> {\n    colspan?: number | string\n    headers?: string\n    rowspan?: number | string\n    scope?: 'row' | 'col' | 'rowgroup' | 'colgroup' | 'auto'\n}\nexport interface TimeAttributes extends GlobalAttributes<HTMLElement> {\n    datetime?: string\n}\nexport interface TrackAttributes extends GlobalAttributes<HTMLTrackElement> {\n    default?: boolean | 'true' | 'false'\n    kind?: 'subtitles' | 'captions' | 'descriptions' | 'chapters' | 'metadata'\n    label?: string\n    src?: string\n    srclang?: string\n}\nexport interface VideoAttributes extends GlobalAttributes<HTMLVideoElement> {\n    autoplay?: boolean | 'true' | 'false'\n    buffered?: string | boolean | number\n    controls?: boolean | 'true' | 'false'\n    crossorigin?: 'anonymous' | 'use-credentials'\n    height?: number | string\n    loop?: boolean | 'true' | 'false'\n    muted?: boolean | 'true' | 'false'\n    playsinline?: boolean\n    poster?: string\n    preload?: 'none' | 'metadata' | 'auto' | ''\n    src?: string\n    width?: number | string\n}\n\n// TODO: explicit attributes\nexport interface SvgAttributes {\n    // eslint-disable-next-line @typescript-eslint/no-explicit-any\n    [name: string]: any\n}\n","import {\n    ComponentProps,\n    ComponentVNode,\n    ElementVNode,\n    FragmentVNode,\n    NothingVNode,\n    TextVNode,\n    VNode,\n    VNodeType,\n} from './contract'\nimport { ComponentLink, EffectWrapper, RenderNode } from './internal'\n\ninterface IRenderingContext {\n    hookIndex: number\n    /**\n     * Set to the current RenderNode when this is a same-component update from a\n     * parent re-render (allows memo to skip re-render). Undefined for initial\n     * renders, type changes, and state-change re-renders.\n     */\n    oldRenderNode: RenderNode | undefined\n    renderNode: RenderNode\n    memo?: boolean\n}\n\n/**\n * The renderingContext is used to obtain context variables from within \"hooks\".\n */\nlet renderingContext: IRenderingContext | undefined\n\nfunction isEventProp(name: string): boolean {\n    return name.indexOf('on') === 0\n}\n\n/**\n * Tracks the component vNode currently rendering its subtree, used to set\n * parent references on child component vNodes.\n */\nlet currentParentVNode: RenderNode | undefined\n\nexport function getRenderingContext() {\n    return renderingContext\n}\n\n/**\n * An array of DOM nodes to use as DOM hierarchy references\n * when rendering nodes within fragment nodes. When a fragment\n * is rendered, any \"nextSibling\" will be pushed to this array,\n * and will then be used to insert other nodes. When the fragment\n * has been rendered, the last DOM node will be removed.\n */\nconst fragmentNextSiblings: Node[] = []\n\n/**\n * Calls the error handler (if any) and renders the returned view.\n */\nexport function tryHandleComponentError(parentElement: Element, renderNode: RenderNode, isSvg: boolean, err: Error) {\n\n    // Do nothing if the parentElement is not longer connected to the DOM\n    if (parentElement.parentNode === null) {\n        return\n    }\n\n    if (renderNode.errorHandler !== undefined) {\n\n        renderingContext = undefined\n\n        try {\n            const errorView = renderNode.errorHandler(err)\n            const oldRendition = renderNode.rendition\n            const newRenditionNodes = render(parentElement, [errorView], oldRendition !== undefined ? [oldRendition] : [], isSvg)\n            renderNode.rendition = newRenditionNodes[0]\n        } catch (handlerErr) {\n            console.error('An error occurred in the error handler: ' + handlerErr)\n            throw err\n        }\n    } else {\n        throw err\n    }\n}\n\nexport function render(parentElement: Element, newChildVNodes: VNode[], oldNodes: RenderNode[], isSvg = false): RenderNode[] {\n\n    const result: RenderNode[] = []\n\n    if (newChildVNodes.length > 0) {\n        // Create a map holding references to all the old child\n        // RenderNodes indexed by key\n        const keyMap: Record<string, [RenderNode, Node | undefined] | undefined> = {}\n\n        // Node \"pool\" for reuse\n        const unkeyedNodes = new Set<Node>()\n\n        let anyKeyedNodes = false\n\n        if (oldNodes.length > 0) {\n            // Prepare the map with the keys from the new nodes\n            for (let i = 0; i < newChildVNodes.length; i++) {\n                const newChildVNode = newChildVNodes[i] as ElementVNode<Element>\n                const props = newChildVNode.props\n                if (props !== undefined && props !== null && props.key !== undefined) {\n                    keyMap[props.key] = undefined\n                    anyKeyedNodes = true\n                }\n            }\n\n            // Go through the old RenderNodes to see if there are any matching the new VNodes\n            if (anyKeyedNodes) {\n                for (let i = 0; i < oldNodes.length; i++) {\n                    const oldNode = oldNodes[i]\n                    const oldVNode = oldNode.vNode\n                    const props = (oldVNode as ElementVNode<HTMLElement>)?.props\n\n                    if (props !== undefined && props !== null && props.key !== undefined) {\n                        // For Component nodes, domRef is undefined — resolve through the rendition chain.\n                        let oldDOMNode: Node | undefined = getRenderNodeDomRef(oldNode)\n\n                        // In the case of a fragment, group all its DOM nodes into a DocumentFragment\n                        if (oldVNode?._ === VNodeType.Fragment ||\n                            oldVNode?._ === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n                            const fragmentNodes = getFragmentChildNodesRec(\n                                oldVNode?._ === VNodeType.Component ? oldNode.rendition! : oldNode\n                            )\n                            const documentFragment = document.createDocumentFragment()\n                            const fragmentDOMNodes = Array<Node>(fragmentNodes.length)\n\n                            for (let j = 0; j < fragmentNodes.length; j++) {\n                                fragmentDOMNodes[j] = getRenderNodeDomRef(fragmentNodes[j])!\n                            }\n\n                            documentFragment.append(...fragmentDOMNodes)\n\n                            oldDOMNode = documentFragment\n                        }\n\n                        // If the key has been added (from a new VNode), update its value\n                        if (props.key in keyMap) {\n                            keyMap[props.key] = [oldNode, oldDOMNode]\n                        }\n                        // else save the DOM node for reuse or removal\n                        else if (oldDOMNode?.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n                            const nodes = (oldDOMNode as DocumentFragment).childNodes\n                            for (let j = 0; j < nodes.length; j++) {\n                                unkeyedNodes.add(nodes.item(j))\n                            }\n                        }\n                        else if (oldDOMNode !== undefined) {\n                            unkeyedNodes.add(oldDOMNode)\n                        }\n                    }\n                }\n            }\n        }\n\n        let domNodeAtIndex: Node | null = parentElement.firstChild\n        let nextDomNode: Node | null = null\n\n        const oldNodesToRemove = new Set<RenderNode>(oldNodes)\n\n        for (let i = 0; i < newChildVNodes.length; i++) {\n            const newChildVNode = newChildVNodes[i]\n            let oldNode: RenderNode | undefined = oldNodes[i]\n\n            if (domNodeAtIndex !== null) {\n                nextDomNode = domNodeAtIndex.nextSibling\n            }\n\n            const newProps = (newChildVNode as ElementVNode<Element>).props\n            // Check if the new VNode is \"keyed\"\n            if (anyKeyedNodes && newProps !== undefined && newProps.key !== undefined && oldNodes.length > 0) {\n\n                const newChildVNodeKey = newProps.key\n\n                // Fetch the old keyed item from the key map\n                const keyMapEntry = keyMap[newChildVNodeKey]\n\n                // If there was no old matching key, reset oldNode so\n                // a new DOM node will be added\n                if (keyMapEntry === undefined) {\n                    if (domNodeAtIndex === null) {\n                        oldNode = undefined\n                    }\n                    else if (unkeyedNodes.size > 0) {\n\n                        const domNode = unkeyedNodes.values().next().value!\n                        unkeyedNodes.delete(domNode)\n                        // ...reuse an old unkeyed node, if any available\n                        oldNode = {\n                            children: [],\n                            domRef: domNode\n                        }\n\n                        parentElement.replaceChild(domNode, domNodeAtIndex)\n\n                        nextDomNode = domNode.nextSibling\n                    } else {\n                        oldNode = {\n                            children: [],\n                            domRef: domNodeAtIndex\n                        }\n                    }\n                }\n                // If there was a matching key, use the old RenderNode\n                else {\n\n                    const [mappedNode, domNode] = keyMapEntry\n\n                    oldNodesToRemove.delete(mappedNode)\n\n                    oldNode = mappedNode\n\n                    // Move the matching dom node to its new position\n                    if (domNode !== undefined && domNode !== domNodeAtIndex) {\n                        const lastFragmentChild = domNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE\n                            ? domNode.lastChild\n                            : null\n\n                        if (domNodeAtIndex === null) {\n                            parentElement.appendChild(domNode)\n                        }\n                        else if (parentElement.contains(domNode)) {\n\n                            parentElement.replaceChild(domNode, domNodeAtIndex)\n\n                            nextDomNode = lastFragmentChild !== null ? lastFragmentChild.nextSibling : domNode.nextSibling\n                        }\n                        else {\n                            parentElement.insertBefore(domNode, domNodeAtIndex)\n\n                            nextDomNode = lastFragmentChild !== null ? lastFragmentChild.nextSibling : domNode.nextSibling\n                        }\n                    }\n                }\n            } else {\n                if (oldNode !== undefined) {\n                    oldNodesToRemove.delete(oldNode)\n                }\n\n                // Remove the current DOM node from unkeyedNodes to make sure it's not reused!\n                unkeyedNodes.delete(domNodeAtIndex!)\n            }\n\n            let newNode: RenderNode\n            switch (newChildVNode._) {\n                case VNodeType.Component:\n                    newNode = renderComponentVNode(oldNode, newChildVNode, parentElement, isSvg)\n                    break\n\n                case VNodeType.Element:\n                    newNode = renderElementVNode(oldNode, newChildVNode, parentElement, isSvg)\n                    break\n\n                case VNodeType.Fragment:\n                    newNode = renderFragmentVNode(oldNode, newChildVNode, parentElement, isSvg)\n                    break\n\n                case VNodeType.Nothing:\n                    newNode = renderNothingVNode(oldNode, newChildVNode, parentElement)\n                    break\n\n                case VNodeType.Text:\n                    newNode = renderTextVNode(oldNode, newChildVNode, parentElement)\n                    break\n            }\n\n            result.push(newNode!)\n            domNodeAtIndex = nextDomNode\n        }\n\n        oldNodesToRemove.forEach(oldNode => {\n            // Make sure any sub-components are \"unmounted\"\n            cleanupRecursively(oldNode, false)\n\n            const vNodeType = oldNode.vNode?._\n            if (vNodeType === VNodeType.Fragment) {\n                removeFragmentDOMNodes(parentElement, oldNode)\n            } else if (vNodeType === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n                removeFragmentDOMNodes(parentElement, oldNode.rendition!)\n            } else {\n                const domRef = getRenderNodeDomRef(oldNode)\n                if (domRef !== undefined && parentElement.contains(domRef)) {\n                    parentElement.removeChild(domRef)\n                }\n            }\n        })\n\n    } else if (oldNodes.length > 0) {\n        // no new nodes, clear DOM and clean up\n        parentElement.replaceChildren()\n\n        for (let i = 0; i < oldNodes.length; i++) {\n            // Make sure any sub-components are \"unmounted\"\n            cleanupRecursively(oldNodes[i], false)\n        }\n    }\n\n    return result\n}\n\nfunction renderTextVNode(oldNode: RenderNode | undefined, newChildVNode: TextVNode, parentElement: Element): RenderNode {\n    const newRenderNode: RenderNode = { children: [], vNode: newChildVNode }\n\n    if (oldNode === undefined) {\n        const el = document.createTextNode(newChildVNode.text)\n        newRenderNode.domRef = el\n        insertOrAppendDOMNode(parentElement, el)\n    }\n\n    // Reuse the old DOM node and update its text content if changed\n    else if (oldNode.vNode?._ === VNodeType.Text) {\n        const domRef = oldNode.domRef!\n        if (domRef.nodeType !== Node.TEXT_NODE) {\n            const el = document.createTextNode(newChildVNode.text)\n            newRenderNode.domRef = el\n            parentElement.replaceChild(el, domRef)\n        } else {\n            newRenderNode.domRef = domRef\n        }\n        if (domRef.textContent !== newChildVNode.text) {\n            domRef.textContent = newChildVNode.text\n        }\n    }\n    else if (oldNode.vNode?._ === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n        replaceFragmentWithTextNode(parentElement, newChildVNode, oldNode.rendition!, newRenderNode)\n    }\n    else if (oldNode.vNode?._ === VNodeType.Fragment) {\n        replaceFragmentWithTextNode(parentElement, newChildVNode, oldNode, newRenderNode)\n    }\n    else {\n        replaceNode(parentElement, newChildVNode, oldNode, getRenderNodeDomRef(oldNode), undefined, newRenderNode)\n    }\n\n    return newRenderNode\n}\n\nfunction renderNothingVNode(oldNode: RenderNode | undefined, newChildVNode: NothingVNode, parentElement: Element): RenderNode {\n    const newRenderNode: RenderNode = { children: [], vNode: newChildVNode }\n\n    if (oldNode === undefined) {\n        const el = document.createComment('Nothing')\n        newRenderNode.domRef = el\n        insertOrAppendDOMNode(parentElement, el)\n    }\n\n    // Reuse the old DOM node\n    else if (oldNode.vNode?._ === VNodeType.Nothing) {\n        const domRef = oldNode.domRef\n        if (domRef!.nodeType !== Node.COMMENT_NODE) {\n            const el = document.createComment('Nothing')\n            newRenderNode.domRef = el\n            parentElement.replaceChild(el, domRef!)\n        } else {\n            newRenderNode.domRef = domRef\n        }\n    }\n    else if (oldNode.vNode?._ === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n        replaceFragmentWithNothingNode(parentElement, newChildVNode, oldNode.rendition!, newRenderNode)\n    }\n    else if (oldNode.vNode?._ === VNodeType.Fragment) {\n        replaceFragmentWithNothingNode(parentElement, newChildVNode, oldNode, newRenderNode)\n    }\n    else {\n        replaceNode(parentElement, newChildVNode, oldNode, getRenderNodeDomRef(oldNode), undefined, newRenderNode)\n    }\n\n    return newRenderNode\n}\n\nfunction renderElementVNode(oldNode: RenderNode | undefined, newChildVNode: ElementVNode<Element>, parentElement: Element, isSvg: boolean): RenderNode {\n    if (newChildVNode.tagName === 'svg') {\n        isSvg = true\n    }\n\n    const newRenderNode: RenderNode = { children: [], vNode: newChildVNode }\n\n    // Create a new DOM element, add it to the parent DOM element\n    // and render the children.\n    if (oldNode === undefined) {\n        const newElement = createAndSetElement(newChildVNode, isSvg, newRenderNode)\n\n        insertOrAppendDOMNode(parentElement, newElement)\n\n        newRenderNode.children = render(newElement, newChildVNode.props.children, [], isSvg)\n    }\n    // If the node type has not changed, reuse the old DOM node and\n    // update its attributes\n    else if (oldNode.vNode?._ === VNodeType.Element && (oldNode.vNode as ElementVNode<Element>).tagName === newChildVNode.tagName) {\n\n        const domRef = oldNode.domRef!\n\n        if (domRef.nodeType !== Node.ELEMENT_NODE) {\n            createAndSetElement(newChildVNode, isSvg, newRenderNode)\n            parentElement.replaceChild(newRenderNode.domRef!, domRef)\n        } else {\n            // Reuse the same DOM element\n            newRenderNode.domRef = domRef\n        }\n\n        // Update/remove/add any attributes\n        updateElementAttributes(newChildVNode, oldNode.vNode as ElementVNode<Element>, domRef as Element)\n\n        // Render the element's children\n        newRenderNode.children = render(domRef as Element, newChildVNode.props.children, oldNode.children, isSvg)\n    }\n    else if (oldNode.vNode?._ === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n        newRenderNode.children = replaceFragmentWithElementNode(parentElement, newChildVNode, oldNode.rendition!, isSvg, newRenderNode)\n    }\n    else if (oldNode.vNode?._ === VNodeType.Fragment) {\n        newRenderNode.children = replaceFragmentWithElementNode(parentElement, newChildVNode, oldNode, isSvg, newRenderNode)\n    }\n    // Replace the old DOM node with a new element and render its children\n    else {\n        replaceNode(parentElement, newChildVNode, oldNode, getRenderNodeDomRef(oldNode), isSvg, newRenderNode)\n        newRenderNode.children = render(newRenderNode.domRef as Element, newChildVNode.props.children, [], isSvg)\n    }\n\n    return newRenderNode\n}\n\nfunction renderFragmentVNode(oldNode: RenderNode | undefined, newChildVNode: FragmentVNode, parentElement: Element, isSvg: boolean): RenderNode {\n    const newRenderNode: RenderNode = { children: [], vNode: newChildVNode }\n\n    if (oldNode === undefined) {\n        newRenderNode.children = render(parentElement, newChildVNode.props.children, [], isSvg)\n    }\n    else if (oldNode.vNode?._ === VNodeType.Fragment) {\n        const newChildren = newChildVNode.props.children\n        const oldChildren = oldNode.children\n\n        let nextSibling: Node | null = null\n        const allOldChildren = getFragmentChildNodesRec(oldNode)\n        for (let i = allOldChildren.length - 1; i > -1; i--) {\n            const child = allOldChildren[i]\n            const childDomRef = getRenderNodeDomRef(child)\n            if (childDomRef !== undefined && childDomRef.parentElement === parentElement) {\n                nextSibling = childDomRef.nextSibling\n                break\n            }\n        }\n        if (nextSibling !== null) {\n            fragmentNextSiblings.push(nextSibling)\n        }\n\n        try {\n            newRenderNode.children = render(parentElement, newChildren, oldChildren, isSvg)\n        } finally {\n            if (fragmentNextSiblings[fragmentNextSiblings.length - 1] === nextSibling) {\n                fragmentNextSiblings.pop()\n            }\n        }\n    }\n    else if (oldNode.vNode?._ === VNodeType.Component && oldNode.rendition?.vNode?._ === VNodeType.Fragment) {\n        cleanupRecursively(oldNode, false)\n\n        const documentFragment = document.createDocumentFragment()\n\n        newRenderNode.children = render(documentFragment as unknown as Element, newChildVNode.props.children, [], isSvg)\n\n        const oldFragmentNodes = getFragmentChildNodesRec(oldNode.rendition!)\n        const firstDomRef = oldFragmentNodes.length > 0 ? getRenderNodeDomRef(oldFragmentNodes[0]) : undefined\n        if (firstDomRef !== undefined) {\n            parentElement.insertBefore(documentFragment, firstDomRef)\n        } else {\n            parentElement.appendChild(documentFragment)\n        }\n        for (let i = 0; i < oldFragmentNodes.length; i++) {\n            const domRef = getRenderNodeDomRef(oldFragmentNodes[i])\n            if (domRef !== undefined && parentElement.contains(domRef)) {\n                parentElement.removeChild(domRef)\n            }\n        }\n    }\n    else {\n        cleanupRecursively(oldNode, false)\n\n        const documentFragment = document.createDocumentFragment()\n\n        newRenderNode.children = render(documentFragment as unknown as Element, newChildVNode.props.children, [], isSvg)\n\n        const oldDomRef = getRenderNodeDomRef(oldNode)\n        if (oldDomRef !== undefined && parentElement.contains(oldDomRef)) {\n            parentElement.replaceChild(documentFragment, oldDomRef)\n        } else {\n            insertOrAppendDOMNode(parentElement, documentFragment)\n        }\n    }\n\n    return newRenderNode\n}\n\nfunction renderComponentVNode(oldNode: RenderNode | undefined, newChildVNode: ComponentVNode<ComponentProps>, parentElement: Element, isSvg: boolean): RenderNode {\n    let renderNode: RenderNode\n    let replaceOrUpdateNode: RenderNode | undefined\n    let allowMemo = false\n\n    if (oldNode !== undefined) {\n        const oldVNode = oldNode.vNode\n        if (oldVNode?._ === VNodeType.Component) {\n            const oldComponentVNode = oldVNode as ComponentVNode<ComponentProps>\n            if (newChildVNode.view === oldComponentVNode.view && (newChildVNode.props as ComponentProps).key === (oldComponentVNode.props as ComponentProps).key && !oldNode.stale) {\n                // Same component — reuse the render node, update the VNode reference\n                renderNode = oldNode\n                renderNode.vNode = newChildVNode\n                allowMemo = true\n            } else {\n                cleanupRecursively(oldNode, true)\n                renderNode = { children: [], vNode: newChildVNode }\n                renderNode.link = { renderNode }\n            }\n\n            replaceOrUpdateNode = oldNode.rendition\n\n        }\n        else if (oldVNode?._ === VNodeType.Fragment) {\n            const oldFragmentNodes = getFragmentChildNodesRec(oldNode)\n\n            renderNode = { children: [], vNode: newChildVNode }\n            renderNode.link = { renderNode }\n\n            for (let i = 0; i < oldFragmentNodes.length; i++) {\n                const oldFragChild = oldFragmentNodes[i]\n                const domRef = getRenderNodeDomRef(oldFragChild)\n\n                if (replaceOrUpdateNode === undefined && domRef !== undefined) {\n                    cleanupRecursively(oldFragChild, false)\n                    replaceOrUpdateNode = oldFragChild\n                }\n                else if (domRef !== undefined) {\n                    cleanupRecursively(oldFragChild, false)\n                    parentElement.removeChild(domRef)\n                }\n            }\n        }\n        else {\n            cleanupRecursively(oldNode, true)\n            renderNode = { children: [], vNode: newChildVNode }\n            renderNode.link = { renderNode }\n            replaceOrUpdateNode = oldNode\n        }\n    } else {\n        renderNode = { children: [], vNode: newChildVNode }\n        renderNode.link = { renderNode }\n    }\n\n    renderComponent(\n        parentElement,\n        newChildVNode,\n        renderNode,\n        replaceOrUpdateNode,\n        isSvg,\n        allowMemo\n    )\n\n    return renderNode\n}\n\n/**\n * Renders a component and then triggers any effects.\n */\nexport function renderComponent(\n    parentElement: Element,\n    vNode: ComponentVNode<ComponentProps>,\n    renderNode: RenderNode,\n    replaceOrUpdateNode: RenderNode | undefined,\n    isSvg: boolean,\n    allowMemo = false\n) {\n    if (renderingContext === undefined && !renderNode.stale) {\n        if (currentParentVNode !== undefined || renderNode.parent === undefined) {\n            renderNode.parent = currentParentVNode\n        }\n        renderNode.parentElement = parentElement\n        renderNode.isSvg = isSvg\n        try {\n            renderingContext = {\n                renderNode,\n                // For memo: set to the current renderNode if this is a\n                // same-component update from a parent re-render. Undefined\n                // for initial renders, type changes, and state-change\n                // re-renders so that memo is never skipped in those cases.\n                oldRenderNode: allowMemo ? renderNode : undefined,\n                hookIndex: 0\n            }\n\n            const rawView = vNode.view(vNode.props)\n            let newView: VNode\n            if (rawView === null || rawView === undefined || typeof rawView === 'boolean') {\n                newView = { _: VNodeType.Nothing }\n            } else if (typeof rawView === 'string' || typeof rawView === 'number') {\n                newView = { _: VNodeType.Text, text: String(rawView) }\n            } else {\n                newView = rawView as VNode\n            }\n\n            if (renderingContext!.memo) {\n                // Props are equal — rendition is already preserved on\n                // renderNode from the previous render cycle; just return.\n                renderingContext = undefined\n                return\n            }\n\n            renderingContext = undefined\n\n            const prevParentVNode = currentParentVNode\n            currentParentVNode = renderNode\n            let newRenditionNodes: RenderNode[]\n            try {\n                newRenditionNodes = render(parentElement, [newView], replaceOrUpdateNode !== undefined ? [replaceOrUpdateNode] : [], isSvg)\n            } finally {\n                currentParentVNode = prevParentVNode\n            }\n\n            renderNode.rendition = newRenditionNodes[0]\n\n            // Trigger synchronous effects (useLayoutEffect)\n            triggerEffects(renderNode, parentElement, isSvg, true)\n\n            // Trigger asynchronous effects (useEffect)\n            triggerEffects(renderNode, parentElement, isSvg, false)\n        }\n        catch (err) {\n            // Ensure renderingContext is always cleared even when the component's\n            // view function throws before the normal renderingContext = undefined\n            // at line 597. Leaving it set would cause the guard at the top of\n            // renderComponent to silently drop all subsequent renders.\n            renderingContext = undefined\n            tryHandleComponentError(parentElement, renderNode, isSvg, err as Error)\n        }\n    }\n}\n\nfunction insertOrAppendDOMNode(parentElement: Element, newNode: Node) {\n    const nextSibling = fragmentNextSiblings[fragmentNextSiblings.length - 1]\n    if (nextSibling !== undefined && nextSibling.parentElement === parentElement) {\n        parentElement.insertBefore(newNode, nextSibling)\n    }\n    else {\n        parentElement.appendChild(newNode)\n    }\n}\n\nfunction removeFragmentDOMNodes(parentElement: Element, fragmentRenderNode: RenderNode) {\n    const oldNodes = getFragmentChildNodesRec(fragmentRenderNode)\n    for (let i = oldNodes.length; i > 0; i--) {\n        const oldNode = oldNodes[i - 1]\n        const domRef = getRenderNodeDomRef(oldNode)\n        if (domRef !== undefined && parentElement.contains(domRef)) {\n            parentElement.removeChild(domRef)\n        }\n    }\n}\n\nfunction scanFragmentForReuse(\n    parentElement: Element,\n    oldFragmentNode: RenderNode,\n    canReuse: (node: RenderNode) => boolean\n): { reuseNode: RenderNode | undefined, replaceDomRef: Node | undefined } {\n    const oldNodes = getFragmentChildNodesRec(oldFragmentNode)\n    let reuseNode: RenderNode | undefined\n    let replaceDomRef: Node | undefined\n    for (let i = 0; i < oldNodes.length; i++) {\n        const oldNode = oldNodes[i]\n        const doReuseNode = reuseNode === undefined && canReuse(oldNode)\n        // Never strip event listeners from the reused node — updateElementAttributes\n        // handles removing/replacing changed handlers. Stripping them here then\n        // skipping re-add (stable reference) is what causes handlers to go dead.\n        cleanupRecursively(oldNode, false)\n        if (doReuseNode) {\n            reuseNode = oldNode\n        } else {\n            const domRef = getRenderNodeDomRef(oldNode)\n            if (replaceDomRef === undefined && domRef !== undefined) {\n                replaceDomRef = domRef\n            } else if (domRef !== undefined) {\n                parentElement.removeChild(domRef)\n            }\n        }\n    }\n    return { reuseNode, replaceDomRef }\n}\n\nfunction replaceFragmentWithElementNode(parentElement: Element, newChildVNode: ElementVNode<Element>, oldFragmentNode: RenderNode, isSvg: boolean, newRenderNode: RenderNode): RenderNode[] {\n    const { reuseNode, replaceDomRef } = scanFragmentForReuse(\n        parentElement,\n        oldFragmentNode,\n        n => n.vNode?._ === VNodeType.Element && (n.vNode as ElementVNode<Element>).tagName === newChildVNode.tagName\n    )\n\n    let oldChildren: RenderNode[] = []\n    if (reuseNode !== undefined) {\n        if (replaceDomRef !== undefined) {\n            parentElement.removeChild(replaceDomRef)\n        }\n        newRenderNode.domRef = reuseNode.domRef\n        updateElementAttributes(newChildVNode, reuseNode.vNode as ElementVNode<Element>, reuseNode.domRef as Element)\n        oldChildren = reuseNode.children\n    } else {\n        const newElement = createAndSetElement(newChildVNode, isSvg, newRenderNode)\n        if (replaceDomRef !== undefined && parentElement.contains(replaceDomRef)) {\n            parentElement.replaceChild(newElement, replaceDomRef)\n        } else {\n            insertOrAppendDOMNode(parentElement, newElement)\n        }\n    }\n\n    return render(newRenderNode.domRef as Element, newChildVNode.props.children, oldChildren, isSvg)\n}\n\nfunction replaceFragmentWithNothingNode(parentElement: Element, _newChildVNode: NothingVNode, oldFragmentNode: RenderNode, newRenderNode: RenderNode) {\n    const { reuseNode, replaceDomRef } = scanFragmentForReuse(\n        parentElement, oldFragmentNode, n => n.vNode?._ === VNodeType.Nothing\n    )\n\n    if (reuseNode !== undefined) {\n        if (replaceDomRef !== undefined) {\n            parentElement.removeChild(replaceDomRef)\n        }\n        newRenderNode.domRef = reuseNode.domRef\n    } else {\n        const el = document.createComment('Nothing')\n        newRenderNode.domRef = el\n        if (replaceDomRef !== undefined && parentElement.contains(replaceDomRef)) {\n            parentElement.replaceChild(el, replaceDomRef)\n        } else {\n            insertOrAppendDOMNode(parentElement, el)\n        }\n    }\n}\n\nfunction replaceFragmentWithTextNode(parentElement: Element, newChildVNode: TextVNode, oldFragmentNode: RenderNode, newRenderNode: RenderNode) {\n    const { reuseNode, replaceDomRef } = scanFragmentForReuse(\n        parentElement, oldFragmentNode, n => n.vNode?._ === VNodeType.Text\n    )\n\n    if (reuseNode !== undefined) {\n        if (replaceDomRef !== undefined) {\n            parentElement.removeChild(replaceDomRef)\n        }\n        const domRef = reuseNode.domRef!\n        domRef.textContent = newChildVNode.text\n        newRenderNode.domRef = domRef\n    } else {\n        const el = document.createTextNode(newChildVNode.text)\n        newRenderNode.domRef = el\n        if (replaceDomRef !== undefined && parentElement.contains(replaceDomRef)) {\n            parentElement.replaceChild(el, replaceDomRef)\n        } else {\n            insertOrAppendDOMNode(parentElement, el)\n        }\n    }\n}\n\nfunction replaceNode(parentElement: Element, newChildVNode: NothingVNode | TextVNode | ElementVNode<Element>, oldNode: RenderNode, oldDomNode: Node | undefined, isSvg: boolean | undefined, newRenderNode: RenderNode) {\n\n    cleanupRecursively(oldNode, false)\n\n    let newNode: Node\n    switch (newChildVNode._) {\n        case VNodeType.Element:\n            newNode = createAndSetElement(newChildVNode, isSvg ?? false, newRenderNode)\n            break\n        case VNodeType.Text:\n            newNode = document.createTextNode((newChildVNode as TextVNode).text)\n            newRenderNode.domRef = newNode\n            break\n        case VNodeType.Nothing:\n            newNode = document.createComment('Nothing')\n            newRenderNode.domRef = newNode\n            break\n    }\n\n    if (oldDomNode !== undefined && parentElement.contains(oldDomNode)) {\n        parentElement.replaceChild(newNode!, oldDomNode)\n    } else {\n        insertOrAppendDOMNode(parentElement, newNode!)\n    }\n}\n\n/**\n * Traverses the render node hierarchy and unmounts any components.\n */\nfunction cleanupRecursively(renderNode: RenderNode | undefined, removeEventListeners: boolean) {\n    if (renderNode === undefined) {\n        return\n    }\n\n    const vNode = renderNode.vNode\n\n    if (vNode?._ === VNodeType.Component) {\n        // Attempt to call any \"cleanup\" function for all effects before unmount.\n        const effects = renderNode.effects\n        if (effects !== undefined) {\n            for (const i in effects) {\n                attemptEffectCleanup(effects[i])\n            }\n        }\n\n        renderNode.stale = true\n\n        cleanupRecursively(renderNode.rendition, removeEventListeners)\n    }\n    else if (vNode?._ === VNodeType.Element || vNode?._ === VNodeType.Fragment) {\n        if (vNode._ === VNodeType.Element && removeEventListeners) {\n\n            // If the old VNode is an element node, remove old event listeners\n            for (const attr in (vNode as ElementVNode<Element>).props) {\n                if (isEventProp(attr)) {\n                    removeElementAttribute(attr, renderNode.domRef as Element)\n                }\n            }\n        }\n\n        for (const c of renderNode.children) {\n            cleanupRecursively(c, removeEventListeners)\n        }\n    }\n}\n\n/**\n * Recursively traverses the RenderNode tree, finds all fragment child nodes\n * and returns them as a flattened array.\n */\nfunction getFragmentChildNodesRec(fragmentNode: RenderNode, acc: RenderNode[] = []): RenderNode[] {\n    for (const child of fragmentNode.children) {\n        const vNodeType = child.vNode?._\n        if (vNodeType === VNodeType.Fragment) {\n            getFragmentChildNodesRec(child, acc)\n        }\n        else if (vNodeType === VNodeType.Component) {\n            const innerFragment = getComponentRenderedFragment(child)\n            if (innerFragment !== undefined) {\n                getFragmentChildNodesRec(innerFragment, acc)\n            } else {\n                acc.push(child)\n            }\n        } else {\n            acc.push(child)\n        }\n    }\n    return acc\n}\n\n/**\n * Follows a component's rendition chain and returns the first non-Component\n * RenderNode encountered (the leaf), or undefined if the component has not rendered.\n */\nfunction getLeafFromComponent(renderNode: RenderNode): RenderNode | undefined {\n    const rendition = renderNode.rendition\n    if (rendition === undefined) {\n        return undefined\n    }\n    if (rendition.vNode?._ === VNodeType.Component) {\n        return getLeafFromComponent(rendition)\n    }\n    return rendition\n}\n\n/**\n * Returns the DOM node associated with a RenderNode, resolving through\n * component rendition chains when the RenderNode is for a component.\n */\nfunction getRenderNodeDomRef(renderNode: RenderNode): Node | undefined {\n    if (renderNode.vNode?._ === VNodeType.Component) {\n        return getLeafFromComponent(renderNode)?.domRef\n    }\n    return renderNode.domRef\n}\n\n/**\n * Follows a component's rendition chain and returns the first fragment\n * RenderNode encountered, or undefined if the component renders a non-fragment.\n */\nfunction getComponentRenderedFragment(renderNode: RenderNode): RenderNode | undefined {\n    const rendition = renderNode.rendition\n    if (rendition === undefined) {\n        return undefined\n    }\n    if (rendition.vNode?._ === VNodeType.Fragment) {\n        return rendition\n    }\n    if (rendition.vNode?._ === VNodeType.Component) {\n        return getComponentRenderedFragment(rendition)\n    }\n    return undefined\n}\n\n/**\n * Sets an attribute or event listener on an Element.\n */\nfunction setElementAttribute(el: Element, attributeName: string, attributeValue: string) {\n    if (attributeName === 'value' && (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' || el.tagName === 'SELECT')) {\n        if ((el as HTMLInputElement).value !== attributeValue) {\n            (el as HTMLInputElement).value = attributeValue\n        }\n    }\n    else if (attributeName in el) {\n        try {\n            (el as unknown as Record<string, unknown>)[attributeName] = attributeValue\n            return\n        }\n        // eslint-disable-next-line @typescript-eslint/no-unused-vars\n        catch (_) {\n            /** Ignore and use setAttribute instead  */\n        }\n    }\n\n    const attrValueType = typeof attributeValue\n    if (attrValueType !== 'function' && attrValueType !== 'object') {\n        el.setAttribute(attributeName, attributeValue)\n    }\n}\n\n/**\n * Removes an attribute or event listener from an HTMLElement.\n */\nfunction removeElementAttribute(a: string, el: Element) {\n    if (isEventProp(a)) {\n        (el as unknown as Record<string, unknown>)[a] = null\n    }\n    else if (el.hasAttribute(a)) {\n        el.removeAttribute(a)\n    }\n}\n\n\n/**\n * Sets/removes attributes on a DOM element node.\n */\nfunction updateElementAttributes(newVNode: ElementVNode<Element>, oldVNode: ElementVNode<Element>, existingDomNode: Element) {\n    const newProps = newVNode.props\n    const oldProps = oldVNode.props\n    // remove any attributes that were in the old virtual node but are absent in\n    // the new one, or whose event handler reference has changed.\n    for (const attributeName in oldProps) {\n        if (attributeName === 'children' || attributeName === 'key' || attributeName === 'ref') {\n            continue\n        }\n        const newPropsRecord = newProps as unknown as Record<string, unknown>\n        const oldPropsRecord = oldProps as unknown as Record<string, unknown>\n        if (newPropsRecord[attributeName] === undefined ||\n            (isEventProp(attributeName) && newPropsRecord[attributeName] !== oldPropsRecord[attributeName])) {\n            removeElementAttribute(attributeName, existingDomNode)\n        }\n    }\n\n    const newPropsRecord = newProps as unknown as Record<string, unknown>\n    const oldPropsRecord = oldProps as unknown as Record<string, unknown>\n\n    // update any attribute where the attribute value has changed\n    for (const name in newProps) {\n        if (name === 'children' || name === 'key') {\n            continue\n        } else if (name === 'ref') {\n            (newPropsRecord[name] as { current: unknown }).current = existingDomNode\n            continue\n        }\n        const attributeValue = newPropsRecord[name] as string\n        const oldAttributeValue = (name === 'value' && name in existingDomNode)\n            ? (existingDomNode as HTMLInputElement).value\n            : oldPropsRecord[name] as string\n\n        if (isEventProp(name)) {\n            if (attributeValue !== oldAttributeValue && attributeValue !== undefined) {\n                setElementAttribute(existingDomNode, name, attributeValue)\n            }\n        } else {\n            const hasAttr = existingDomNode.hasAttribute(name)\n            if ((attributeValue !== oldAttributeValue || !hasAttr) && attributeValue !== undefined) {\n                setElementAttribute(existingDomNode, name, attributeValue)\n            } else if (attributeValue === undefined && hasAttr) {\n                existingDomNode.removeAttribute(name)\n            }\n        }\n    }\n}\n\n/**\n * Triggers all invokeable effects.\n */\nfunction triggerEffects(renderNode: RenderNode, parentElement: Element, isSvg: boolean, sync: boolean) {\n    const effects = renderNode.effects\n    if (effects !== undefined) {\n        for (const i in effects) {\n            const t = effects[i]\n            if (t.invoke) {\n                if (t.sync && sync) {\n                    attemptEffectCleanup(t)\n                    t.cleanup = t.effect()\n                    t.invoke = false\n                } else if (!sync) {\n                    setTimeout(() => {\n                        if (renderNode.stale) {\n                            return\n                        }\n                        try {\n                            attemptEffectCleanup(t)\n\n                            t.cleanup = t.effect()\n                        } catch (err) {\n                            tryHandleComponentError(parentElement, renderNode, isSvg, err as Error)\n                        }\n                    }, 0)\n                    t.invoke = false\n                }\n            }\n        }\n    }\n}\n\n/**\n * Calls the cleanup function if it's set and then removes it from the wrapper.\n */\nfunction attemptEffectCleanup(t: EffectWrapper) {\n    if (t.cleanup !== undefined) {\n        try {\n            t.cleanup()\n        } catch (err) {\n            console.error('An error occurred during effect cleanup: ' + err)\n        }\n        t.cleanup = undefined\n    }\n}\n\n/**\n * Creates a DOM element, sets its attributes from vNode.props, and sets the\n * new Element to renderNode.domRef.\n */\nfunction createAndSetElement(vNode: ElementVNode<Element>, isSvg: boolean, renderNode: RenderNode): Element {\n\n    const attributes = vNode.props\n    const tagName = vNode.tagName\n\n    let el: Element\n    if (isSvg) {\n        el = document.createElementNS('http://www.w3.org/2000/svg', tagName)\n    } else {\n        el = document.createElement(tagName)\n    }\n\n    for (const name in attributes) {\n        if (name === 'children' || name === 'key') {\n            continue\n        } else if (name === 'ref') {\n            const attributesRecord = attributes as unknown as Record<string, { current: unknown }>\n            attributesRecord[name].current = el\n        }\n        const attributeValue = (attributes as unknown as Record<string, unknown>)[name]\n\n        if (attributeValue !== undefined) {\n            setElementAttribute(\n                el,\n                name,\n                attributeValue as string\n            )\n        }\n    }\n\n    renderNode.domRef = el\n\n    return el\n}\n\nexport type { ComponentLink }\n","import { FragmentVNode, Key, MyraNode, NothingVNode, VNode, VNodeType } from './contract'\n\ninterface IProps {\n    children?: MyraNode\n    key?: Key\n}\n\nexport function Fragment(props: IProps): FragmentVNode | NothingVNode {\n    const children = props.children as VNode[] ?? []\n    if (!children.length) {\n        return {\n            _: VNodeType.Nothing\n        }\n    }\n    return {\n        _: VNodeType.Fragment,\n        props: {\n            children,\n            key: props.key\n        }\n    }\n}","import { ComponentProps, ComponentVNode } from './contract'\nimport { RenderNode } from './internal'\nimport { renderComponent } from './component'\n\nconst renderQueue: RenderNode[] = []\nlet flushScheduled = false\n\nexport function enqueueRender(\n    renderNode: RenderNode\n): void {\n    if (!renderNode.renderPending) {\n        renderQueue.push(renderNode)\n        renderNode.renderPending = true\n    }\n    if (!flushScheduled) {\n        flushScheduled = true\n        setTimeout(flushRenderQueue)\n    }\n}\n\nfunction flushRenderQueue(): void {\n    flushScheduled = false\n    // Snapshot and clear before flushing so renders triggered during the flush\n    // (e.g. cascading setState) go into the next batch rather than this one.\n    const batch = renderQueue.splice(0)\n    for (const entry of batch) {\n        // Reset before rendering so any setState called during render can re-enqueue\n        // for the next batch (see splice(0) above).\n        entry.renderPending = false\n        const vNode = entry.vNode\n        if (vNode !== undefined) {\n            renderComponent(\n                entry.parentElement!,\n                vNode as ComponentVNode<ComponentProps>,\n                entry,\n                entry.rendition,\n                entry.isSvg ?? false,\n                // allowMemo is always false for state-change re-renders\n                false\n            )\n        }\n    }\n}\n","export type Type = 'array' | 'object' | 'string' | 'date' | 'regexp' | 'function' | 'boolean' | 'number' | 'null' | 'undefined'\n\n/**\n * Better \"typeof\" which identifies arrays.\n */\nexport function typeOf(obj: unknown): Type {\n    const objType = typeof obj\n    if (objType === 'string' || objType === 'number' || objType === 'boolean' || objType === 'function') {\n        return objType\n    }\n    if (obj === undefined) {\n        return 'undefined'\n    }\n    if (obj === null) {\n        return 'null'\n    }\n    return ({}).toString.call(obj).slice(8, -1).toLowerCase() as Type\n}\n\n/**\n * Does a deep equality check.\n */\nexport function equal<T>(a: T, b: T): boolean {\n    if (a === b) {\n        return true\n    }\n    const ta = typeOf(a)\n    if (ta !== typeOf(b)) {\n        return false\n    }\n    if (ta === 'array') {\n        const aa = a as unknown as unknown[]\n        const ba = b as unknown as unknown[]\n        return aa.length === ba.length && aa.every((v, i) => equal(v, ba[i]))\n    }\n    if (ta === 'object') {\n        const ka = Object.keys(a as object)\n        return ka.length === Object.keys(b as object).length &&\n            ka.every(k => equal((a as Record<string, unknown>)[k], (b as Record<string, unknown>)[k]))\n    }\n    if (ta === 'date') {\n        return (a as unknown as Date).getTime() === (b as unknown as Date).getTime()\n    }\n    if (ta === 'regexp') {\n        return (a as unknown as RegExp).toString() === (b as unknown as RegExp).toString()\n    }\n    return false\n}\n","import { getRenderingContext, tryHandleComponentError } from './component'\nimport { enqueueRender } from './queue'\nimport { Context, ContextBinding, Effect, ErrorHandler, Evolve, Ref, UpdateState } from './contract'\nimport { equal } from './helpers'\nimport { ComponentLink, RenderNode } from './internal'\n\n\ntype LazyStateInitialization<TState> = () => TState\n\n/**\n *\n * @param initialState the initial state\n */\nexport function useState<TState>(initialState: TState | LazyStateInitialization<TState>): [TState, Evolve<TState>] {\n\n    const renderingContext = getRenderingContext()\n    const { hookIndex, renderNode } = renderingContext!\n    if (renderNode.data === undefined) {\n        renderNode.data = []\n    }\n\n    if (renderNode.data[hookIndex] === undefined) {\n\n        const link = renderNode.link!\n\n        const evolve = (update: UpdateState<unknown>) => {\n            const currentRenderNode = link.renderNode\n            try {\n                if (typeof update === 'function') {\n                    update = update(currentRenderNode.data![hookIndex][0])\n                }\n\n                currentRenderNode.data![hookIndex] = [update, evolve]\n\n                enqueueRender(currentRenderNode)\n            } catch (err) {\n                setTimeout(() => {\n                    tryHandleComponentError(currentRenderNode.parentElement!, currentRenderNode, currentRenderNode.isSvg ?? false, err as Error)\n                })\n            }\n            return currentRenderNode.data![hookIndex][0]\n        }\n\n        if (typeof initialState === 'function') {\n            initialState = (initialState as LazyStateInitialization<TState>)()\n        }\n        renderNode.data[hookIndex] = [initialState, evolve]\n    }\n\n    const state = renderNode.data[hookIndex]\n    renderingContext!.hookIndex++\n\n    return state\n}\n\n/**\n *\n * @param current an optional value\n */\nexport function useRef<T>(current?: T): Ref<T> {\n    const renderingContext = getRenderingContext()\n    const { hookIndex, renderNode } = renderingContext!\n    if (renderNode.data === undefined) {\n        renderNode.data = []\n    }\n\n    if (renderNode.data[hookIndex] === undefined) {\n        renderNode.data[hookIndex] = {\n            current\n        }\n    }\n    renderingContext!.hookIndex++\n    return renderNode.data[hookIndex]\n}\n\n/**\n *\n * @param handler\n */\nexport function useErrorHandler(handler: ErrorHandler) {\n    const renderingContext = getRenderingContext()\n    const renderNode = renderingContext!.renderNode as RenderNode\n    renderNode.errorHandler = handler\n}\n\n/**\n *\n * @param effect\n * @param arg\n */\nexport function useLayoutEffect<TArg extends unknown[]>(effect: Effect, arg?: TArg) {\n    useEffectInternal(true, effect, arg)\n}\n\n/**\n *\n * @param effect\n * @param arg\n */\nexport function useEffect<TArg extends unknown[]>(effect: Effect, arg?: TArg) {\n    useEffectInternal(false, effect, arg)\n}\n\nfunction useEffectInternal<TArg>(sync: boolean, effect: Effect, arg?: TArg) {\n\n    const renderingContext = getRenderingContext()\n    const { hookIndex, renderNode } = renderingContext!\n\n    if (renderNode.effects === undefined) {\n        renderNode.effects = []\n    }\n\n    const t = renderNode.effects[hookIndex]\n\n    if (t === undefined) {\n        renderNode.effects[hookIndex] = {\n            arg,\n            sync,\n            invoke: true,\n            effect,\n        }\n    } else if (arg === undefined || !equal(t.arg, arg)) {\n        t.arg = arg\n        t.effect = effect\n        t.invoke = true\n    }\n\n    renderingContext!.hookIndex++\n}\n\n/**\n *\n * @param fn\n * @param deps\n */\nexport function useMemo<TMemoization>(fn: () => TMemoization, deps: unknown[]): TMemoization {\n\n    const renderingContext = getRenderingContext()\n    const { hookIndex, renderNode } = renderingContext!\n\n    if (renderNode.data === undefined) {\n        renderNode.data = []\n    }\n\n    let res: TMemoization\n    if (renderNode.data[hookIndex] === undefined) {\n        res = fn()\n        renderNode.data[hookIndex] = [res, deps]\n    }\n    else {\n        const [prevRes, prevDeps] = renderNode.data[hookIndex]\n        if (equal(prevDeps, deps)) {\n            res = prevRes\n        }\n        else {\n            res = fn()\n            renderNode.data[hookIndex] = [res, deps]\n        }\n    }\n\n    renderingContext!.hookIndex++\n    return res\n}\n\n/**\n *\n * @param callback\n * @param deps\n */\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport function useCallback<TCallback extends Function>(callback: TCallback, deps: unknown[]): TCallback {\n    return useMemo(() => callback, deps)\n}\n\n/**\n *\n * @param context\n */\nexport function useContext<T>(context: Context<T>): T {\n    const rc = getRenderingContext()!\n    const { hookIndex, renderNode } = rc\n\n    if (renderNode.effects === undefined) {\n        renderNode.effects = []\n    }\n\n    const binding = findContextBinding(renderNode, context)\n\n    // One effects slot: arg tracks the binding for change detection, cleanup\n    // holds the unsubscribe function. invoke is always false so the effect\n    // itself never runs — cleanup fires only via cleanupRecursively on unmount.\n    let slot = renderNode.effects[hookIndex]\n    if (slot === undefined) {\n        slot = {\n            arg: binding,\n            cleanup: binding?.subscribe(makeReRenderCallback(renderNode.link!)),\n            effect: () => { /* never invoked */ },\n            invoke: false,\n            sync: false,\n        }\n        renderNode.effects[hookIndex] = slot\n    } else if (slot.arg !== binding) {\n        slot.cleanup?.()\n        slot.arg = binding\n        slot.cleanup = binding?.subscribe(makeReRenderCallback(renderNode.link!))\n    }\n    rc.hookIndex++\n\n    return binding !== undefined ? binding.getValue() : (context as unknown as { _defaultValue: T })._defaultValue\n}\n\nfunction findContextBinding<T>(renderNode: RenderNode, context: Context<T>): ContextBinding<T> | undefined {\n    let current = renderNode.parent\n    while (current !== undefined) {\n        const b = current.contextBindings?.get(context)\n        if (b !== undefined) {\n            return b as ContextBinding<T>\n        }\n        current = current.parent\n    }\n    return undefined\n}\n\nfunction makeReRenderCallback(\n    link: ComponentLink\n): () => void {\n    return () => {\n        const currentRenderNode = link.renderNode\n        if (currentRenderNode.stale) {\n            return\n        }\n        enqueueRender(currentRenderNode)\n    }\n}\n\n/**\n *\n * @param reducer\n * @param initialState\n */\nexport function useReducer<TState, TAction>(\n    reducer: (state: TState, action: TAction) => TState,\n    initialState: TState\n): [TState, (action: TAction) => void] {\n    const [state, setState] = useState(initialState)\n    const reducerRef = useRef(reducer)\n    reducerRef.current = reducer\n    const dispatch = useCallback((action: TAction) => setState(s => reducerRef.current(s, action)), [])\n    return [state, dispatch]\n}\n","import { getRenderingContext } from './component'\nimport { ComponentProps, Context, ContextBinding, ProviderProps, VNode } from './contract'\nimport { Fragment } from './fragment'\nimport { useLayoutEffect, useRef } from './hooks'\n\nfunction registerContextBinding<T>(context: Context<T>, binding: ContextBinding<T>): void {\n    const rc = getRenderingContext()!\n    if (rc.renderNode.contextBindings === undefined) {\n        rc.renderNode.contextBindings = new Map()\n    }\n    rc.renderNode.contextBindings.set(context, binding)\n}\n\nexport function createContext<T>(defaultValue: T): Context<T> {\n    const context: { _defaultValue: T, Provider?: (props: ProviderProps<T> & ComponentProps) => VNode } = {\n        _defaultValue: defaultValue\n    }\n\n    const Provider = (props: ProviderProps<T> & ComponentProps): VNode => {\n        const valueRef = useRef<T>(props.value)\n        const subscribersRef = useRef(new Set<() => void>())\n        const bindingRef = useRef<ContextBinding<T>>({\n            getValue: () => valueRef.current,\n            subscribe: (cb: () => void) => {\n                subscribersRef.current.add(cb)\n                return () => subscribersRef.current.delete(cb)\n            }\n        })\n\n        // Update synchronously so getValue() is never stale when consumers read\n        // it during the same render pass (before the layout effect fires).\n        valueRef.current = props.value\n\n        useLayoutEffect(() => {\n            subscribersRef.current.forEach(cb => cb())\n        }, [props.value])\n\n        registerContextBinding(context as Context<T>, bindingRef.current)\n\n        return Fragment({ children: props.children })\n    }\n\n    context.Provider = Provider\n\n    return context as Context<T>\n}\n","import {\n    ComponentFactory,\n    ComponentVNode,\n    MyraNode,\n    TextNode,\n    TextVNode,\n    VNode,\n    VNodeType\n} from './contract'\nimport { Fragment } from './fragment'\n\n/**\n * Creates a JSX.Element/VNode from a JSX tag.\n */\nexport function h<TProps>(\n    tagNameOrComponent: string | ComponentFactory<object> | undefined | null,\n    props: TProps,\n    ...children: Array<MyraNode>): JSX.Element {\n\n    if (tagNameOrComponent === 'nothing' ||\n        tagNameOrComponent === undefined ||\n        tagNameOrComponent === null ||\n        typeof tagNameOrComponent === 'boolean') {\n\n        return { _: VNodeType.Nothing }\n    }\n\n    if (props === null) {\n        props = {} as TProps\n    } else {\n        delete (props as Record<string, unknown>)['__self']\n        delete (props as Record<string, unknown>)['__source']\n    }\n\n    (props as unknown as { children: VNode[] }).children = flattenChildren(children)\n\n    if (typeof tagNameOrComponent === 'string') {\n\n        return {\n            _: VNodeType.Element,\n            tagName: tagNameOrComponent,\n            props: props as unknown as { children: Array<VNode> }\n        }\n    } else if (tagNameOrComponent === Fragment) {\n        return tagNameOrComponent(props as object) as VNode\n    }\n\n    return {\n        _: VNodeType.Component,\n        props,\n        view: tagNameOrComponent\n    } as ComponentVNode<object>\n}\n\nfunction flattenChildren(children: MyraNode[]) {\n    if (children.length === 0) {\n        return children as VNode[]\n    }\n\n    const flattenedChildren = Array(children.length) as Array<VNode | TextNode>\n    let childIndex = 0\n    let targetIndex = 0\n    while (true) {\n\n        const child = children[childIndex++]\n        if (child === null || child === undefined || typeof child === 'boolean') {\n            flattenedChildren[targetIndex++] = { _: VNodeType.Nothing }\n        }\n        else if (Array.isArray(child)) {\n            const subChildren = flattenChildren(child)\n            if (subChildren.length === 0) {\n                flattenedChildren.length--\n            }\n            else if (subChildren.length > 1) {\n                flattenedChildren.length += subChildren.length - 1\n                for (let j = 0; j < subChildren.length; j++) {\n                    flattenedChildren[targetIndex++] = subChildren[j]\n                }\n            } else {\n                flattenedChildren[targetIndex++] = subChildren[0]\n            }\n        }\n        else if ((child as VNode)._ === undefined) {\n            // Any node which is not a vNode will be converted to a TextVNode\n            flattenedChildren[targetIndex++] = {\n                _: VNodeType.Text,\n                text: child as unknown as string\n            } as TextVNode\n        }\n        else {\n            flattenedChildren[targetIndex++] = child\n        }\n\n        if (childIndex == children.length) {\n            return flattenedChildren as VNode[]\n        }\n    }\n}\n","import { getRenderingContext } from './component'\nimport { ComponentFactory, ComponentProps, JSXElementFactory, VNode, VNodeType } from './contract'\nimport { useRef } from './hooks'\n\ntype CompareFn<TProps> = (newProps: TProps, oldProps: TProps) => boolean\n\n/**\n * Memoizes a component view, preventing unnecessary renders.\n *\n * If no custom compare function is supplied, a shallow comparison of the props'\n * properties will decide whether the component will be rerendered or not.\n *\n * @param factory A component factory function\n * @param compare An optional props equality comparer function. If true is\n *                returned the memoized view will be kept, otherwise the view\n *                will be rerendered.\n */\nexport function memo<TProps>(factory: ComponentFactory<TProps & ComponentProps>, compare?: CompareFn<TProps>): JSXElementFactory<TProps & ComponentProps> {\n\n    compare = compare ?? shallowCompareProps as CompareFn<TProps>\n\n    return (props: TProps) => {\n\n        const ref = useRef<TProps>({} as TProps)\n        const oldProps = ref.current\n\n        ref.current = props\n\n        const renderingContext = getRenderingContext()!\n\n        if (renderingContext.oldRenderNode === undefined || !compare!(props, oldProps)) {\n            return factory(props as TProps & ComponentProps) as VNode\n        }\n\n        renderingContext!.memo = true\n\n        return {\n            _: VNodeType.Nothing\n        }\n    }\n}\n\n/**\n * Default compare implementation that performs a shallow comparison of props.\n *\n * @param newProps\n * @param oldProps\n * @returns true if no changes are found\n */\nfunction shallowCompareProps<TProps extends ComponentProps & Record<string, unknown>>(newProps: TProps, oldProps: TProps): boolean {\n    const newPropsKeys = Object.keys(newProps)\n    if (newPropsKeys.length !== Object.keys(oldProps).length) {\n        return false\n    }\n    for (const k of newPropsKeys) {\n        if (k === 'children') {\n            continue\n        }\n        if (newProps[k] !== oldProps[k]) {\n            return false\n        }\n    }\n    return true\n}\n","import { render } from './component'\nimport {\n    ComponentProps,\n    JSXElementFactory,\n    VNode\n} from './contract'\n\nexport type * from './contract'\nexport * from './context'\nexport * from './fragment'\nexport * from './jsxFactory'\nexport * from './hooks'\nexport * from './memo'\nexport * from './helpers'\n\n/**\n * Convenience function for type hinting\n * \n * @param fn \n */\nexport function define<TProps>(fn: JSXElementFactory<TProps & ComponentProps>) {\n    return fn\n}\n\n/** \n * Mounts a virtual DOM node onto the supplied element.\n */\nexport function mount(vNode: VNode, element: Element) {\n    render(element, [vNode], [])\n}\n"],"mappings":";;AAwSA,IAAkB,YAAX,yBAAA,WAAA;AACH,WAAA,UAAA,aAAA,KAAA;AACA,WAAA,UAAA,UAAA,KAAA;AACA,WAAA,UAAA,aAAA,KAAA;AACA,WAAA,UAAA,cAAA,KAAA;AACA,WAAA,UAAA,eAAA,KAAA;;KACH;;;;;;ACnRD,IAAI;AAEJ,SAAS,YAAY,MAAuB;AACxC,QAAO,KAAK,QAAQ,KAAK,KAAK;;;;;;AAOlC,IAAI;AAEJ,SAAgB,sBAAsB;AAClC,QAAO;;;;;;;;;AAUX,IAAM,uBAA+B,EAAE;;;;AAKvC,SAAgB,wBAAwB,eAAwB,YAAwB,OAAgB,KAAY;AAGhH,KAAI,cAAc,eAAe,KAC7B;AAGJ,KAAI,WAAW,iBAAiB,KAAA,GAAW;AAEvC,qBAAmB,KAAA;AAEnB,MAAI;GACA,MAAM,YAAY,WAAW,aAAa,IAAI;GAC9C,MAAM,eAAe,WAAW;AAEhC,cAAW,YADe,OAAO,eAAe,CAAC,UAAU,EAAE,iBAAiB,KAAA,IAAY,CAAC,aAAa,GAAG,EAAE,EAAE,MAAM,CAC5E;WACpC,YAAY;AACjB,WAAQ,MAAM,6CAA6C,WAAW;AACtE,SAAM;;OAGV,OAAM;;AAId,SAAgB,OAAO,eAAwB,gBAAyB,UAAwB,QAAQ,OAAqB;CAEzH,MAAM,SAAuB,EAAE;AAE/B,KAAI,eAAe,SAAS,GAAG;EAG3B,MAAM,SA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