{"version":3,"sources":["jsdelivr-header.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/interfaces.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/polyfills.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/platform.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/dom.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/observation/update-queue.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/observation/notifier.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/observation/observable.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/observation/arrays.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/binding/binding.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/binding/one-way.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/binding/one-time.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/binding/normalize.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/styles/element-styles.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/styles/css-directive.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/styles/css-binding-directive.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/styles/css.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/components/hydration.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/markup.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/html-directive.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/hydration/target-builder.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/view.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/html-binding-directive.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/compiler.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/template.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/ref.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/when.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/repeat.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/node-observation.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/slotted.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/children.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/components/attributes.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/components/fast-definitions.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/templating/render.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/utilities.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/components/element-controller.js","/npm/@microsoft/fast-element@2.0.1/dist/esm/components/fast-element.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,EACJ,MAAM,EAAa,cACnB,IACI,GAAI,SAAS,cACT,EAAa,SAAS,cAAc,aAAa,OAEhD,CACD,MAAM,EAAU,SAAS,qBAAqB,UAE9C,EADsB,EAAQ,EAAQ,OAAS,GACpB,aAAa,EAChD,CACA,CACA,MAAO,GACH,EAAa,SACjB,CACA,IAAI,EACJ,OAAQ,GACJ,IAAK,QACD,EAAkB,OAAO,OAAO,CAC5B,YAAa,EACb,WAAY,EACZ,aAAc,EACd,gBAAiB,IAErB,MACJ,IAAK,WACD,EAAkB,OAAO,OAAO,CAC5B,YAAa,IACb,WAAY,IACZ,aAAc,IACd,gBAAiB,MAErB,MACJ,QAEI,MAAM,EAAU,IAAI,KAAK,SAAS,SAAS,IAAI,UAAU,EAAG,KAC5D,EAAkB,OAAO,OAAO,CAC5B,YAAa,MAAM,IACnB,WAAY,MAAM,IAClB,aAAc,MAAM,IACpB,gBAAiB,MAAM,MAS5B,MAAM,EAAc,GAA6B,mBAAX,EAKhC,EAAY,GAA6B,iBAAX,EAK9B,EAAO,KAAY,E,sJC1DhC,WACI,GAA0B,oBAAf,WAKX,QAAsB,IAAX,EAGP,EAAO,WAAa,OAEnB,GAAoB,oBAAT,KACZ,KAAK,WAAa,UAEjB,GAAsB,oBAAX,OAEZ,OAAO,WAAa,WAEnB,CAID,MAAM,EAAS,IAAI,SAAS,cA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,GAAM,SAAS,IAC9D,CDgmBA,GAA4B,kBAAoB,IAAI,GAA6B,GAA4B,0BCvlBjG,MAAC,GAAc,OAAO,OAAO,GAAkB,aAAc,CAMrE,KAdJ,SAAc,GACV,OAAO,GAAkB,EAC7B,EAmBI,UAKA,QAtCJ,SAAiB,EAAM,GACnB,OAAI,EAAW,GACJ,GAAsB,QAAQ,EAAM,GAExC,GAAsB,QAAQ,KAAM,EAC/C,IAyCO,SAAS,GAAc,GAE1B,OAAO,SAAU,GACb,GAAO,EAAM,EACrB,CACA,Q","file":"/npm/@microsoft/fast-element@2.0.1/dist/esm/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@microsoft/fast-element@2.0.1/dist/esm/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","let kernelMode;\nconst kernelAttr = \"fast-kernel\";\ntry {\n    if (document.currentScript) {\n        kernelMode = document.currentScript.getAttribute(kernelAttr);\n    }\n    else {\n        const scripts = document.getElementsByTagName(\"script\");\n        const currentScript = scripts[scripts.length - 1];\n        kernelMode = currentScript.getAttribute(kernelAttr);\n    }\n}\ncatch (e) {\n    kernelMode = \"isolate\";\n}\nlet KernelServiceId;\nswitch (kernelMode) {\n    case \"share\": // share the kernel across major versions\n        KernelServiceId = Object.freeze({\n            updateQueue: 1,\n            observable: 2,\n            contextEvent: 3,\n            elementRegistry: 4,\n        });\n        break;\n    case \"share-v2\": // only share the kernel with other v2 instances\n        KernelServiceId = Object.freeze({\n            updateQueue: 1.2,\n            observable: 2.2,\n            contextEvent: 3.2,\n            elementRegistry: 4.2,\n        });\n        break;\n    default:\n        // fully isolate the kernel from all other FAST instances\n        const postfix = `-${Math.random().toString(36).substring(2, 8)}`;\n        KernelServiceId = Object.freeze({\n            updateQueue: `1.2${postfix}`,\n            observable: `2.2${postfix}`,\n            contextEvent: `3.2${postfix}`,\n            elementRegistry: `4.2${postfix}`,\n        });\n        break;\n}\nexport { KernelServiceId };\n/**\n * Determines whether or not an object is a function.\n * @public\n */\nexport const isFunction = (object) => typeof object === \"function\";\n/**\n * Determines whether or not an object is a string.\n * @public\n */\nexport const isString = (object) => typeof object === \"string\";\n/**\n * A function which does nothing.\n * @public\n */\nexport const noop = () => void 0;\n","/* eslint-disable @typescript-eslint/ban-ts-comment */\n(function ensureGlobalThis() {\n    if (typeof globalThis !== \"undefined\") {\n        // We're running in a modern environment.\n        return;\n    }\n    // @ts-ignore\n    if (typeof global !== \"undefined\") {\n        // We're running in NodeJS\n        // @ts-ignore\n        global.globalThis = global;\n    }\n    else if (typeof self !== \"undefined\") {\n        self.globalThis = self;\n    }\n    else if (typeof window !== \"undefined\") {\n        // We're running in the browser's main thread.\n        window.globalThis = window;\n    }\n    else {\n        // Hopefully we never get here...\n        // Not all environments allow eval and Function. Use only as a last resort:\n        // eslint-disable-next-line no-new-func\n        const result = new Function(\"return this\")();\n        result.globalThis = result;\n    }\n})();\n","import { noop } from \"./interfaces.js\";\nimport \"./polyfills.js\";\n// ensure FAST global - duplicated debug.ts\nconst propConfig = {\n    configurable: false,\n    enumerable: false,\n    writable: false,\n};\nif (globalThis.FAST === void 0) {\n    Reflect.defineProperty(globalThis, \"FAST\", Object.assign({ value: Object.create(null) }, propConfig));\n}\n/**\n * The FAST global.\n * @public\n */\nexport const FAST = globalThis.FAST;\nif (FAST.getById === void 0) {\n    const storage = Object.create(null);\n    Reflect.defineProperty(FAST, \"getById\", Object.assign({ value(id, initialize) {\n            let found = storage[id];\n            if (found === void 0) {\n                found = initialize ? (storage[id] = initialize()) : null;\n            }\n            return found;\n        } }, propConfig));\n}\nif (FAST.error === void 0) {\n    Object.assign(FAST, {\n        warn() { },\n        error(code) {\n            return new Error(`Error ${code}`);\n        },\n        addMessages() { },\n    });\n}\n/**\n * A readonly, empty array.\n * @remarks\n * Typically returned by APIs that return arrays when there are\n * no actual items to return.\n * @public\n */\nexport const emptyArray = Object.freeze([]);\n/**\n * Do not change. Part of shared kernel contract.\n * @internal\n */\nexport function createTypeRegistry() {\n    const typeToDefinition = new Map();\n    return Object.freeze({\n        register(definition) {\n            if (typeToDefinition.has(definition.type)) {\n                return false;\n            }\n            typeToDefinition.set(definition.type, definition);\n            return true;\n        },\n        getByType(key) {\n            return typeToDefinition.get(key);\n        },\n        getForInstance(object) {\n            if (object === null || object === void 0) {\n                return void 0;\n            }\n            return typeToDefinition.get(object.constructor);\n        },\n    });\n}\n/**\n * Creates a function capable of locating metadata associated with a type.\n * @returns A metadata locator function.\n * @internal\n */\nexport function createMetadataLocator() {\n    const metadataLookup = new WeakMap();\n    return function (target) {\n        let metadata = metadataLookup.get(target);\n        if (metadata === void 0) {\n            let currentTarget = Reflect.getPrototypeOf(target);\n            while (metadata === void 0 && currentTarget !== null) {\n                metadata = metadataLookup.get(currentTarget);\n                currentTarget = Reflect.getPrototypeOf(currentTarget);\n            }\n            metadata = metadata === void 0 ? [] : metadata.slice(0);\n            metadataLookup.set(target, metadata);\n        }\n        return metadata;\n    };\n}\n/**\n * Makes a type noop for JSON serialization.\n * @param type - The type to make noop for JSON serialization.\n * @internal\n */\nexport function makeSerializationNoop(type) {\n    type.prototype.toJSON = noop;\n}\n","import \"./interfaces.js\";\nimport { FAST } from \"./platform.js\";\n/**\n * The type of HTML aspect to target.\n * @public\n */\nexport const DOMAspect = Object.freeze({\n    /**\n     * Not aspected.\n     */\n    none: 0,\n    /**\n     * An attribute.\n     */\n    attribute: 1,\n    /**\n     * A boolean attribute.\n     */\n    booleanAttribute: 2,\n    /**\n     * A property.\n     */\n    property: 3,\n    /**\n     * Content\n     */\n    content: 4,\n    /**\n     * A token list.\n     */\n    tokenList: 5,\n    /**\n     * An event.\n     */\n    event: 6,\n});\nconst createHTML = html => html;\nconst fastTrustedType = globalThis.trustedTypes\n    ? globalThis.trustedTypes.createPolicy(\"fast-html\", { createHTML })\n    : { createHTML };\nlet defaultPolicy = Object.freeze({\n    createHTML(value) {\n        return fastTrustedType.createHTML(value);\n    },\n    protect(tagName, aspect, aspectName, sink) {\n        return sink;\n    },\n});\nconst fastPolicy = defaultPolicy;\n/**\n * Common DOM APIs.\n * @public\n */\nexport const DOM = Object.freeze({\n    /**\n     * Gets the dom policy used by the templating system.\n     */\n    get policy() {\n        return defaultPolicy;\n    },\n    /**\n     * Sets the dom policy used by the templating system.\n     * @param policy - The policy to set.\n     * @remarks\n     * This API can only be called once, for security reasons. It should be\n     * called by the application developer at the start of their program.\n     */\n    setPolicy(value) {\n        if (defaultPolicy !== fastPolicy) {\n            throw FAST.error(1201 /* Message.onlySetDOMPolicyOnce */);\n        }\n        defaultPolicy = value;\n    },\n    /**\n     * Sets an attribute value on an element.\n     * @param element - The element to set the attribute value on.\n     * @param attributeName - The attribute name to set.\n     * @param value - The value of the attribute to set.\n     * @remarks\n     * If the value is `null` or `undefined`, the attribute is removed, otherwise\n     * it is set to the provided value using the standard `setAttribute` API.\n     */\n    setAttribute(element, attributeName, value) {\n        value === null || value === undefined\n            ? element.removeAttribute(attributeName)\n            : element.setAttribute(attributeName, value);\n    },\n    /**\n     * Sets a boolean attribute value.\n     * @param element - The element to set the boolean attribute value on.\n     * @param attributeName - The attribute name to set.\n     * @param value - The value of the attribute to set.\n     * @remarks\n     * If the value is true, the attribute is added; otherwise it is removed.\n     */\n    setBooleanAttribute(element, attributeName, value) {\n        value\n            ? element.setAttribute(attributeName, \"\")\n            : element.removeAttribute(attributeName);\n    },\n});\n","import { KernelServiceId } from \"../interfaces.js\";\nimport { FAST } from \"../platform.js\";\n/**\n * The default UpdateQueue.\n * @public\n */\nexport const Updates = FAST.getById(KernelServiceId.updateQueue, () => {\n    const tasks = [];\n    const pendingErrors = [];\n    const rAF = globalThis.requestAnimationFrame;\n    let updateAsync = true;\n    function throwFirstError() {\n        if (pendingErrors.length) {\n            throw pendingErrors.shift();\n        }\n    }\n    function tryRunTask(task) {\n        try {\n            task.call();\n        }\n        catch (error) {\n            if (updateAsync) {\n                pendingErrors.push(error);\n                setTimeout(throwFirstError, 0);\n            }\n            else {\n                tasks.length = 0;\n                throw error;\n            }\n        }\n    }\n    function process() {\n        const capacity = 1024;\n        let index = 0;\n        while (index < tasks.length) {\n            tryRunTask(tasks[index]);\n            index++;\n            // Prevent leaking memory for long chains of recursive calls to `enqueue`.\n            // If we call `enqueue` within a task scheduled by `enqueue`, the queue will\n            // grow, but to avoid an O(n) walk for every task we execute, we don't\n            // shift tasks off the queue after they have been executed.\n            // Instead, we periodically shift 1024 tasks off the queue.\n            if (index > capacity) {\n                // Manually shift all values starting at the index back to the\n                // beginning of the queue.\n                for (let scan = 0, newLength = tasks.length - index; scan < newLength; scan++) {\n                    tasks[scan] = tasks[scan + index];\n                }\n                tasks.length -= index;\n                index = 0;\n            }\n        }\n        tasks.length = 0;\n    }\n    function enqueue(callable) {\n        tasks.push(callable);\n        if (tasks.length < 2) {\n            updateAsync ? rAF(process) : process();\n        }\n    }\n    return Object.freeze({\n        enqueue,\n        next: () => new Promise(enqueue),\n        process,\n        setMode: (isAsync) => (updateAsync = isAsync),\n    });\n});\n","/**\n * An implementation of {@link Notifier} that efficiently keeps track of\n * subscribers interested in a specific change notification on an\n * observable subject.\n *\n * @remarks\n * This set is optimized for the most common scenario of 1 or 2 subscribers.\n * With this in mind, it can store a subscriber in an internal field, allowing it to avoid Array#push operations.\n * If the set ever exceeds two subscribers, it upgrades to an array automatically.\n * @public\n */\nexport class SubscriberSet {\n    /**\n     * Creates an instance of SubscriberSet for the specified subject.\n     * @param subject - The subject that subscribers will receive notifications from.\n     * @param initialSubscriber - An initial subscriber to changes.\n     */\n    constructor(subject, initialSubscriber) {\n        this.sub1 = void 0;\n        this.sub2 = void 0;\n        this.spillover = void 0;\n        this.subject = subject;\n        this.sub1 = initialSubscriber;\n    }\n    /**\n     * Checks whether the provided subscriber has been added to this set.\n     * @param subscriber - The subscriber to test for inclusion in this set.\n     */\n    has(subscriber) {\n        return this.spillover === void 0\n            ? this.sub1 === subscriber || this.sub2 === subscriber\n            : this.spillover.indexOf(subscriber) !== -1;\n    }\n    /**\n     * Subscribes to notification of changes in an object's state.\n     * @param subscriber - The object that is subscribing for change notification.\n     */\n    subscribe(subscriber) {\n        const spillover = this.spillover;\n        if (spillover === void 0) {\n            if (this.has(subscriber)) {\n                return;\n            }\n            if (this.sub1 === void 0) {\n                this.sub1 = subscriber;\n                return;\n            }\n            if (this.sub2 === void 0) {\n                this.sub2 = subscriber;\n                return;\n            }\n            this.spillover = [this.sub1, this.sub2, subscriber];\n            this.sub1 = void 0;\n            this.sub2 = void 0;\n        }\n        else {\n            const index = spillover.indexOf(subscriber);\n            if (index === -1) {\n                spillover.push(subscriber);\n            }\n        }\n    }\n    /**\n     * Unsubscribes from notification of changes in an object's state.\n     * @param subscriber - The object that is unsubscribing from change notification.\n     */\n    unsubscribe(subscriber) {\n        const spillover = this.spillover;\n        if (spillover === void 0) {\n            if (this.sub1 === subscriber) {\n                this.sub1 = void 0;\n            }\n            else if (this.sub2 === subscriber) {\n                this.sub2 = void 0;\n            }\n        }\n        else {\n            const index = spillover.indexOf(subscriber);\n            if (index !== -1) {\n                spillover.splice(index, 1);\n            }\n        }\n    }\n    /**\n     * Notifies all subscribers.\n     * @param args - Data passed along to subscribers during notification.\n     */\n    notify(args) {\n        const spillover = this.spillover;\n        const subject = this.subject;\n        if (spillover === void 0) {\n            const sub1 = this.sub1;\n            const sub2 = this.sub2;\n            if (sub1 !== void 0) {\n                sub1.handleChange(subject, args);\n            }\n            if (sub2 !== void 0) {\n                sub2.handleChange(subject, args);\n            }\n        }\n        else {\n            for (let i = 0, ii = spillover.length; i < ii; ++i) {\n                spillover[i].handleChange(subject, args);\n            }\n        }\n    }\n}\n/**\n * An implementation of Notifier that allows subscribers to be notified\n * of individual property changes on an object.\n * @public\n */\nexport class PropertyChangeNotifier {\n    /**\n     * Creates an instance of PropertyChangeNotifier for the specified subject.\n     * @param subject - The object that subscribers will receive notifications for.\n     */\n    constructor(subject) {\n        this.subscribers = {};\n        this.subjectSubscribers = null;\n        this.subject = subject;\n    }\n    /**\n     * Notifies all subscribers, based on the specified property.\n     * @param propertyName - The property name, passed along to subscribers during notification.\n     */\n    notify(propertyName) {\n        var _a, _b;\n        (_a = this.subscribers[propertyName]) === null || _a === void 0 ? void 0 : _a.notify(propertyName);\n        (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.notify(propertyName);\n    }\n    /**\n     * Subscribes to notification of changes in an object's state.\n     * @param subscriber - The object that is subscribing for change notification.\n     * @param propertyToWatch - The name of the property that the subscriber is interested in watching for changes.\n     */\n    subscribe(subscriber, propertyToWatch) {\n        var _a, _b;\n        let subscribers;\n        if (propertyToWatch) {\n            subscribers =\n                (_a = this.subscribers[propertyToWatch]) !== null && _a !== void 0 ? _a : (this.subscribers[propertyToWatch] = new SubscriberSet(this.subject));\n        }\n        else {\n            subscribers =\n                (_b = this.subjectSubscribers) !== null && _b !== void 0 ? _b : (this.subjectSubscribers = new SubscriberSet(this.subject));\n        }\n        subscribers.subscribe(subscriber);\n    }\n    /**\n     * Unsubscribes from notification of changes in an object's state.\n     * @param subscriber - The object that is unsubscribing from change notification.\n     * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.\n     */\n    unsubscribe(subscriber, propertyToUnwatch) {\n        var _a, _b;\n        if (propertyToUnwatch) {\n            (_a = this.subscribers[propertyToUnwatch]) === null || _a === void 0 ? void 0 : _a.unsubscribe(subscriber);\n        }\n        else {\n            (_b = this.subjectSubscribers) === null || _b === void 0 ? void 0 : _b.unsubscribe(subscriber);\n        }\n    }\n}\n","import { isFunction, isString, KernelServiceId, } from \"../interfaces.js\";\nimport { createMetadataLocator, FAST, makeSerializationNoop } from \"../platform.js\";\nimport { Updates } from \"./update-queue.js\";\nimport { PropertyChangeNotifier, SubscriberSet } from \"./notifier.js\";\n/**\n * Describes how the source's lifetime relates to its controller's lifetime.\n * @public\n */\nexport const SourceLifetime = Object.freeze({\n    /**\n     * The source to controller lifetime relationship is unknown.\n     */\n    unknown: void 0,\n    /**\n     * The source and controller lifetimes are coupled to one another.\n     * They can/will be GC'd together.\n     */\n    coupled: 1,\n});\n/**\n * Common Observable APIs.\n * @public\n */\nexport const Observable = FAST.getById(KernelServiceId.observable, () => {\n    const queueUpdate = Updates.enqueue;\n    const volatileRegex = /(:|&&|\\|\\||if|\\?\\.)/;\n    const notifierLookup = new WeakMap();\n    let watcher = void 0;\n    let createArrayObserver = (array) => {\n        throw FAST.error(1101 /* Message.needsArrayObservation */);\n    };\n    function getNotifier(source) {\n        var _a;\n        let found = (_a = source.$fastController) !== null && _a !== void 0 ? _a : notifierLookup.get(source);\n        if (found === void 0) {\n            Array.isArray(source)\n                ? (found = createArrayObserver(source))\n                : notifierLookup.set(source, (found = new PropertyChangeNotifier(source)));\n        }\n        return found;\n    }\n    const getAccessors = createMetadataLocator();\n    class DefaultObservableAccessor {\n        constructor(name) {\n            this.name = name;\n            this.field = `_${name}`;\n            this.callback = `${name}Changed`;\n        }\n        getValue(source) {\n            if (watcher !== void 0) {\n                watcher.watch(source, this.name);\n            }\n            return source[this.field];\n        }\n        setValue(source, newValue) {\n            const field = this.field;\n            const oldValue = source[field];\n            if (oldValue !== newValue) {\n                source[field] = newValue;\n                const callback = source[this.callback];\n                if (isFunction(callback)) {\n                    callback.call(source, oldValue, newValue);\n                }\n                getNotifier(source).notify(this.name);\n            }\n        }\n    }\n    class ExpressionNotifierImplementation extends SubscriberSet {\n        constructor(expression, initialSubscriber, isVolatileBinding = false) {\n            super(expression, initialSubscriber);\n            this.expression = expression;\n            this.isVolatileBinding = isVolatileBinding;\n            this.needsRefresh = true;\n            this.needsQueue = true;\n            this.isAsync = true;\n            this.first = this;\n            this.last = null;\n            this.propertySource = void 0;\n            this.propertyName = void 0;\n            this.notifier = void 0;\n            this.next = void 0;\n        }\n        setMode(isAsync) {\n            this.isAsync = this.needsQueue = isAsync;\n        }\n        bind(controller) {\n            this.controller = controller;\n            const value = this.observe(controller.source, controller.context);\n            if (!controller.isBound && this.requiresUnbind(controller)) {\n                controller.onUnbind(this);\n            }\n            return value;\n        }\n        requiresUnbind(controller) {\n            return (controller.sourceLifetime !== SourceLifetime.coupled ||\n                this.first !== this.last ||\n                this.first.propertySource !== controller.source);\n        }\n        unbind(controller) {\n            this.dispose();\n        }\n        observe(source, context) {\n            if (this.needsRefresh && this.last !== null) {\n                this.dispose();\n            }\n            const previousWatcher = watcher;\n            watcher = this.needsRefresh ? this : void 0;\n            this.needsRefresh = this.isVolatileBinding;\n            let result;\n            try {\n                result = this.expression(source, context);\n            }\n            finally {\n                watcher = previousWatcher;\n            }\n            return result;\n        }\n        // backwards compat with v1 kernel\n        disconnect() {\n            this.dispose();\n        }\n        dispose() {\n            if (this.last !== null) {\n                let current = this.first;\n                while (current !== void 0) {\n                    current.notifier.unsubscribe(this, current.propertyName);\n                    current = current.next;\n                }\n                this.last = null;\n                this.needsRefresh = this.needsQueue = this.isAsync;\n            }\n        }\n        watch(propertySource, propertyName) {\n            const prev = this.last;\n            const notifier = getNotifier(propertySource);\n            const current = prev === null ? this.first : {};\n            current.propertySource = propertySource;\n            current.propertyName = propertyName;\n            current.notifier = notifier;\n            notifier.subscribe(this, propertyName);\n            if (prev !== null) {\n                if (!this.needsRefresh) {\n                    // Declaring the variable prior to assignment below circumvents\n                    // a bug in Angular's optimization process causing infinite recursion\n                    // of this watch() method. Details https://github.com/microsoft/fast/issues/4969\n                    let prevValue;\n                    watcher = void 0;\n                    /* eslint-disable-next-line */\n                    prevValue = prev.propertySource[prev.propertyName];\n                    /* eslint-disable-next-line */\n                    watcher = this;\n                    if (propertySource === prevValue) {\n                        this.needsRefresh = true;\n                    }\n                }\n                prev.next = current;\n            }\n            this.last = current;\n        }\n        handleChange() {\n            if (this.needsQueue) {\n                this.needsQueue = false;\n                queueUpdate(this);\n            }\n            else if (!this.isAsync) {\n                this.call();\n            }\n        }\n        call() {\n            if (this.last !== null) {\n                this.needsQueue = this.isAsync;\n                this.notify(this);\n            }\n        }\n        *records() {\n            let next = this.first;\n            while (next !== void 0) {\n                yield next;\n                next = next.next;\n            }\n        }\n    }\n    makeSerializationNoop(ExpressionNotifierImplementation);\n    return Object.freeze({\n        /**\n         * @internal\n         * @param factory - The factory used to create array observers.\n         */\n        setArrayObserverFactory(factory) {\n            createArrayObserver = factory;\n        },\n        /**\n         * Gets a notifier for an object or Array.\n         * @param source - The object or Array to get the notifier for.\n         */\n        getNotifier,\n        /**\n         * Records a property change for a source object.\n         * @param source - The object to record the change against.\n         * @param propertyName - The property to track as changed.\n         */\n        track(source, propertyName) {\n            watcher && watcher.watch(source, propertyName);\n        },\n        /**\n         * Notifies watchers that the currently executing property getter or function is volatile\n         * with respect to its observable dependencies.\n         */\n        trackVolatile() {\n            watcher && (watcher.needsRefresh = true);\n        },\n        /**\n         * Notifies subscribers of a source object of changes.\n         * @param source - the object to notify of changes.\n         * @param args - The change args to pass to subscribers.\n         */\n        notify(source, args) {\n            /* eslint-disable-next-line @typescript-eslint/no-use-before-define */\n            getNotifier(source).notify(args);\n        },\n        /**\n         * Defines an observable property on an object or prototype.\n         * @param target - The target object to define the observable on.\n         * @param nameOrAccessor - The name of the property to define as observable;\n         * or a custom accessor that specifies the property name and accessor implementation.\n         */\n        defineProperty(target, nameOrAccessor) {\n            if (isString(nameOrAccessor)) {\n                nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);\n            }\n            getAccessors(target).push(nameOrAccessor);\n            Reflect.defineProperty(target, nameOrAccessor.name, {\n                enumerable: true,\n                get() {\n                    return nameOrAccessor.getValue(this);\n                },\n                set(newValue) {\n                    nameOrAccessor.setValue(this, newValue);\n                },\n            });\n        },\n        /**\n         * Finds all the observable accessors defined on the target,\n         * including its prototype chain.\n         * @param target - The target object to search for accessor on.\n         */\n        getAccessors,\n        /**\n         * Creates a {@link ExpressionNotifier} that can watch the\n         * provided {@link Expression} for changes.\n         * @param expression - The binding to observe.\n         * @param initialSubscriber - An initial subscriber to changes in the binding value.\n         * @param isVolatileBinding - Indicates whether the binding's dependency list must be re-evaluated on every value evaluation.\n         */\n        binding(expression, initialSubscriber, isVolatileBinding = this.isVolatileBinding(expression)) {\n            return new ExpressionNotifierImplementation(expression, initialSubscriber, isVolatileBinding);\n        },\n        /**\n         * Determines whether a binding expression is volatile and needs to have its dependency list re-evaluated\n         * on every evaluation of the value.\n         * @param expression - The binding to inspect.\n         */\n        isVolatileBinding(expression) {\n            return volatileRegex.test(expression.toString());\n        },\n    });\n});\n/**\n * Decorator: Defines an observable property on the target.\n * @param target - The target to define the observable on.\n * @param nameOrAccessor - The property name or accessor to define the observable as.\n * @public\n */\nexport function observable(target, nameOrAccessor) {\n    Observable.defineProperty(target, nameOrAccessor);\n}\n/**\n * Decorator: Marks a property getter as having volatile observable dependencies.\n * @param target - The target that the property is defined on.\n * @param name - The property name.\n * @param name - The existing descriptor.\n * @public\n */\nexport function volatile(target, name, descriptor) {\n    return Object.assign({}, descriptor, {\n        get() {\n            Observable.trackVolatile();\n            return descriptor.get.apply(this);\n        },\n    });\n}\nconst contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {\n    let current = null;\n    return {\n        get() {\n            return current;\n        },\n        set(event) {\n            current = event;\n        },\n    };\n});\n/**\n * Provides additional contextual information available to behaviors and expressions.\n * @public\n */\nexport const ExecutionContext = Object.freeze({\n    /**\n     * A default execution context.\n     */\n    default: {\n        index: 0,\n        length: 0,\n        get event() {\n            return ExecutionContext.getEvent();\n        },\n        eventDetail() {\n            return this.event.detail;\n        },\n        eventTarget() {\n            return this.event.target;\n        },\n    },\n    /**\n     * Gets the current event.\n     * @returns An event object.\n     */\n    getEvent() {\n        return contextEvent.get();\n    },\n    /**\n     * Sets the current event.\n     * @param event - An event object.\n     */\n    setEvent(event) {\n        contextEvent.set(event);\n    },\n});\n","import { emptyArray } from \"../platform.js\";\nimport { SubscriberSet } from \"./notifier.js\";\nimport { Observable } from \"./observable.js\";\nimport { Updates } from \"./update-queue.js\";\n/**\n * A splice map is a representation of how a previous array of items\n * was transformed into a new array of items. Conceptually it is a list of\n * tuples of\n *\n *   (index, removed, addedCount)\n *\n * which are kept in ascending index order of. The tuple represents that at\n * the |index|, |removed| sequence of items were removed, and counting forward\n * from |index|, |addedCount| items were added.\n * @public\n */\nexport class Splice {\n    /**\n     * Creates a splice.\n     * @param index - The index that the splice occurs at.\n     * @param removed - The items that were removed.\n     * @param addedCount - The  number of items that were added.\n     */\n    constructor(index, removed, addedCount) {\n        this.index = index;\n        this.removed = removed;\n        this.addedCount = addedCount;\n    }\n    /**\n     * Adjusts the splice index based on the provided array.\n     * @param array - The array to adjust to.\n     * @returns The same splice, mutated based on the reference array.\n     */\n    adjustTo(array) {\n        let index = this.index;\n        const arrayLength = array.length;\n        if (index > arrayLength) {\n            index = arrayLength - this.addedCount;\n        }\n        else if (index < 0) {\n            index = arrayLength + this.removed.length + index - this.addedCount;\n        }\n        this.index = index < 0 ? 0 : index;\n        return this;\n    }\n}\n/**\n * Indicates what level of feature support the splice\n * strategy provides.\n * @public\n */\nexport const SpliceStrategySupport = Object.freeze({\n    /**\n     * Only supports resets.\n     */\n    reset: 1,\n    /**\n     * Supports tracking splices and resets.\n     */\n    splice: 2,\n    /**\n     * Supports tracking splices and resets, while applying some form\n     * of optimization, such as merging, to the splices.\n     */\n    optimized: 3,\n});\nconst reset = new Splice(0, emptyArray, 0);\nreset.reset = true;\nconst resetSplices = [reset];\n// Note: This function is *based* on the computation of the Levenshtein\n// \"edit\" distance. The one change is that \"updates\" are treated as two\n// edits - not one. With Array splices, an update is really a delete\n// followed by an add. By retaining this, we optimize for \"keeping\" the\n// maximum array items in the original array. For example:\n//\n//   'xxxx123' to '123yyyy'\n//\n// With 1-edit updates, the shortest path would be just to update all seven\n// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This\n// leaves the substring '123' intact.\nfunction calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd) {\n    // \"Deletion\" columns\n    const rowCount = oldEnd - oldStart + 1;\n    const columnCount = currentEnd - currentStart + 1;\n    const distances = new Array(rowCount);\n    let north;\n    let west;\n    // \"Addition\" rows. Initialize null column.\n    for (let i = 0; i < rowCount; ++i) {\n        distances[i] = new Array(columnCount);\n        distances[i][0] = i;\n    }\n    // Initialize null row\n    for (let j = 0; j < columnCount; ++j) {\n        distances[0][j] = j;\n    }\n    for (let i = 1; i < rowCount; ++i) {\n        for (let j = 1; j < columnCount; ++j) {\n            if (current[currentStart + j - 1] === old[oldStart + i - 1]) {\n                distances[i][j] = distances[i - 1][j - 1];\n            }\n            else {\n                north = distances[i - 1][j] + 1;\n                west = distances[i][j - 1] + 1;\n                distances[i][j] = north < west ? north : west;\n            }\n        }\n    }\n    return distances;\n}\n// This starts at the final weight, and walks \"backward\" by finding\n// the minimum previous weight recursively until the origin of the weight\n// matrix.\nfunction spliceOperationsFromEditDistances(distances) {\n    let i = distances.length - 1;\n    let j = distances[0].length - 1;\n    let current = distances[i][j];\n    const edits = [];\n    while (i > 0 || j > 0) {\n        if (i === 0) {\n            edits.push(2 /* Edit.add */);\n            j--;\n            continue;\n        }\n        if (j === 0) {\n            edits.push(3 /* Edit.delete */);\n            i--;\n            continue;\n        }\n        const northWest = distances[i - 1][j - 1];\n        const west = distances[i - 1][j];\n        const north = distances[i][j - 1];\n        let min;\n        if (west < north) {\n            min = west < northWest ? west : northWest;\n        }\n        else {\n            min = north < northWest ? north : northWest;\n        }\n        if (min === northWest) {\n            if (northWest === current) {\n                edits.push(0 /* Edit.leave */);\n            }\n            else {\n                edits.push(1 /* Edit.update */);\n                current = northWest;\n            }\n            i--;\n            j--;\n        }\n        else if (min === west) {\n            edits.push(3 /* Edit.delete */);\n            i--;\n            current = west;\n        }\n        else {\n            edits.push(2 /* Edit.add */);\n            j--;\n            current = north;\n        }\n    }\n    return edits.reverse();\n}\nfunction sharedPrefix(current, old, searchLength) {\n    for (let i = 0; i < searchLength; ++i) {\n        if (current[i] !== old[i]) {\n            return i;\n        }\n    }\n    return searchLength;\n}\nfunction sharedSuffix(current, old, searchLength) {\n    let index1 = current.length;\n    let index2 = old.length;\n    let count = 0;\n    while (count < searchLength && current[--index1] === old[--index2]) {\n        count++;\n    }\n    return count;\n}\nfunction intersect(start1, end1, start2, end2) {\n    // Disjoint\n    if (end1 < start2 || end2 < start1) {\n        return -1;\n    }\n    // Adjacent\n    if (end1 === start2 || end2 === start1) {\n        return 0;\n    }\n    // Non-zero intersect, span1 first\n    if (start1 < start2) {\n        if (end1 < end2) {\n            return end1 - start2; // Overlap\n        }\n        return end2 - start2; // Contained\n    }\n    // Non-zero intersect, span2 first\n    if (end2 < end1) {\n        return end2 - start1; // Overlap\n    }\n    return end1 - start1; // Contained\n}\n/**\n * @remarks\n * Lacking individual splice mutation information, the minimal set of\n * splices can be synthesized given the previous state and final state of an\n * array. The basic approach is to calculate the edit distance matrix and\n * choose the shortest path through it.\n *\n * Complexity: O(l * p)\n *   l: The length of the current array\n *   p: The length of the old array\n */\nfunction calc(current, currentStart, currentEnd, old, oldStart, oldEnd) {\n    let prefixCount = 0;\n    let suffixCount = 0;\n    const minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);\n    if (currentStart === 0 && oldStart === 0) {\n        prefixCount = sharedPrefix(current, old, minLength);\n    }\n    if (currentEnd === current.length && oldEnd === old.length) {\n        suffixCount = sharedSuffix(current, old, minLength - prefixCount);\n    }\n    currentStart += prefixCount;\n    oldStart += prefixCount;\n    currentEnd -= suffixCount;\n    oldEnd -= suffixCount;\n    if (currentEnd - currentStart === 0 && oldEnd - oldStart === 0) {\n        return emptyArray;\n    }\n    if (currentStart === currentEnd) {\n        const splice = new Splice(currentStart, [], 0);\n        while (oldStart < oldEnd) {\n            splice.removed.push(old[oldStart++]);\n        }\n        return [splice];\n    }\n    else if (oldStart === oldEnd) {\n        return [new Splice(currentStart, [], currentEnd - currentStart)];\n    }\n    const ops = spliceOperationsFromEditDistances(calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));\n    const splices = [];\n    let splice = void 0;\n    let index = currentStart;\n    let oldIndex = oldStart;\n    for (let i = 0; i < ops.length; ++i) {\n        switch (ops[i]) {\n            case 0 /* Edit.leave */:\n                if (splice !== void 0) {\n                    splices.push(splice);\n                    splice = void 0;\n                }\n                index++;\n                oldIndex++;\n                break;\n            case 1 /* Edit.update */:\n                if (splice === void 0) {\n                    splice = new Splice(index, [], 0);\n                }\n                splice.addedCount++;\n                index++;\n                splice.removed.push(old[oldIndex]);\n                oldIndex++;\n                break;\n            case 2 /* Edit.add */:\n                if (splice === void 0) {\n                    splice = new Splice(index, [], 0);\n                }\n                splice.addedCount++;\n                index++;\n                break;\n            case 3 /* Edit.delete */:\n                if (splice === void 0) {\n                    splice = new Splice(index, [], 0);\n                }\n                splice.removed.push(old[oldIndex]);\n                oldIndex++;\n                break;\n            // no default\n        }\n    }\n    if (splice !== void 0) {\n        splices.push(splice);\n    }\n    return splices;\n}\nfunction merge(splice, splices) {\n    let inserted = false;\n    let insertionOffset = 0;\n    for (let i = 0; i < splices.length; i++) {\n        const current = splices[i];\n        current.index += insertionOffset;\n        if (inserted) {\n            continue;\n        }\n        const intersectCount = intersect(splice.index, splice.index + splice.removed.length, current.index, current.index + current.addedCount);\n        if (intersectCount >= 0) {\n            // Merge the two splices\n            splices.splice(i, 1);\n            i--;\n            insertionOffset -= current.addedCount - current.removed.length;\n            splice.addedCount += current.addedCount - intersectCount;\n            const deleteCount = splice.removed.length + current.removed.length - intersectCount;\n            if (!splice.addedCount && !deleteCount) {\n                // merged splice is a noop. discard.\n                inserted = true;\n            }\n            else {\n                let currentRemoved = current.removed;\n                if (splice.index < current.index) {\n                    // some prefix of splice.removed is prepended to current.removed.\n                    const prepend = splice.removed.slice(0, current.index - splice.index);\n                    prepend.push(...currentRemoved);\n                    currentRemoved = prepend;\n                }\n                if (splice.index + splice.removed.length >\n                    current.index + current.addedCount) {\n                    // some suffix of splice.removed is appended to current.removed.\n                    const append = splice.removed.slice(current.index + current.addedCount - splice.index);\n                    currentRemoved.push(...append);\n                }\n                splice.removed = currentRemoved;\n                if (current.index < splice.index) {\n                    splice.index = current.index;\n                }\n            }\n        }\n        else if (splice.index < current.index) {\n            // Insert splice here.\n            inserted = true;\n            splices.splice(i, 0, splice);\n            i++;\n            const offset = splice.addedCount - splice.removed.length;\n            current.index += offset;\n            insertionOffset += offset;\n        }\n    }\n    if (!inserted) {\n        splices.push(splice);\n    }\n}\nfunction project(array, changes) {\n    let splices = [];\n    const initialSplices = [];\n    for (let i = 0, ii = changes.length; i < ii; i++) {\n        merge(changes[i], initialSplices);\n    }\n    for (let i = 0, ii = initialSplices.length; i < ii; ++i) {\n        const splice = initialSplices[i];\n        if (splice.addedCount === 1 && splice.removed.length === 1) {\n            if (splice.removed[0] !== array[splice.index]) {\n                splices.push(splice);\n            }\n            continue;\n        }\n        splices = splices.concat(calc(array, splice.index, splice.index + splice.addedCount, splice.removed, 0, splice.removed.length));\n    }\n    return splices;\n}\n/**\n * A SpliceStrategy that attempts to merge all splices into the minimal set of\n * splices needed to represent the change from the old array to the new array.\n * @public\n */\nlet defaultSpliceStrategy = Object.freeze({\n    support: SpliceStrategySupport.optimized,\n    normalize(previous, current, changes) {\n        if (previous === void 0) {\n            if (changes === void 0) {\n                return emptyArray;\n            }\n            return project(current, changes);\n        }\n        return resetSplices;\n    },\n    pop(array, observer, pop, args) {\n        const notEmpty = array.length > 0;\n        const result = pop.apply(array, args);\n        if (notEmpty) {\n            observer.addSplice(new Splice(array.length, [result], 0));\n        }\n        return result;\n    },\n    push(array, observer, push, args) {\n        const result = push.apply(array, args);\n        observer.addSplice(new Splice(array.length - args.length, [], args.length).adjustTo(array));\n        return result;\n    },\n    reverse(array, observer, reverse, args) {\n        const result = reverse.apply(array, args);\n        observer.reset(array);\n        return result;\n    },\n    shift(array, observer, shift, args) {\n        const notEmpty = array.length > 0;\n        const result = shift.apply(array, args);\n        if (notEmpty) {\n            observer.addSplice(new Splice(0, [result], 0));\n        }\n        return result;\n    },\n    sort(array, observer, sort, args) {\n        const result = sort.apply(array, args);\n        observer.reset(array);\n        return result;\n    },\n    splice(array, observer, splice, args) {\n        const result = splice.apply(array, args);\n        observer.addSplice(new Splice(+args[0], result, args.length > 2 ? args.length - 2 : 0).adjustTo(array));\n        return result;\n    },\n    unshift(array, observer, unshift, args) {\n        const result = unshift.apply(array, args);\n        observer.addSplice(new Splice(0, [], args.length).adjustTo(array));\n        return result;\n    },\n});\n/**\n * Functionality related to tracking changes in arrays.\n * @public\n */\nexport const SpliceStrategy = Object.freeze({\n    /**\n     * A set of changes that represent a full array reset.\n     */\n    reset: resetSplices,\n    /**\n     * Sets the default strategy to use for array observers.\n     * @param strategy - The splice strategy to use.\n     */\n    setDefaultStrategy(strategy) {\n        defaultSpliceStrategy = strategy;\n    },\n});\nfunction setNonEnumerable(target, property, value) {\n    Reflect.defineProperty(target, property, {\n        value,\n        enumerable: false,\n    });\n}\nclass DefaultArrayObserver extends SubscriberSet {\n    constructor(subject) {\n        super(subject);\n        this.oldCollection = void 0;\n        this.splices = void 0;\n        this.needsQueue = true;\n        this._strategy = null;\n        this._lengthObserver = void 0;\n        this.call = this.flush;\n        setNonEnumerable(subject, \"$fastController\", this);\n    }\n    get strategy() {\n        return this._strategy;\n    }\n    set strategy(value) {\n        this._strategy = value;\n    }\n    get lengthObserver() {\n        let observer = this._lengthObserver;\n        if (observer === void 0) {\n            const array = this.subject;\n            this._lengthObserver = observer = {\n                length: array.length,\n                handleChange() {\n                    if (this.length !== array.length) {\n                        this.length = array.length;\n                        Observable.notify(observer, \"length\");\n                    }\n                },\n            };\n            this.subscribe(observer);\n        }\n        return observer;\n    }\n    subscribe(subscriber) {\n        this.flush();\n        super.subscribe(subscriber);\n    }\n    addSplice(splice) {\n        if (this.splices === void 0) {\n            this.splices = [splice];\n        }\n        else {\n            this.splices.push(splice);\n        }\n        this.enqueue();\n    }\n    reset(oldCollection) {\n        this.oldCollection = oldCollection;\n        this.enqueue();\n    }\n    flush() {\n        var _a;\n        const splices = this.splices;\n        const oldCollection = this.oldCollection;\n        if (splices === void 0 && oldCollection === void 0) {\n            return;\n        }\n        this.needsQueue = true;\n        this.splices = void 0;\n        this.oldCollection = void 0;\n        this.notify(((_a = this._strategy) !== null && _a !== void 0 ? _a : defaultSpliceStrategy).normalize(oldCollection, this.subject, splices));\n    }\n    enqueue() {\n        if (this.needsQueue) {\n            this.needsQueue = false;\n            Updates.enqueue(this);\n        }\n    }\n}\nlet enabled = false;\n/**\n * An observer for arrays.\n * @public\n */\nexport const ArrayObserver = Object.freeze({\n    /**\n     * Enables the array observation mechanism.\n     * @remarks\n     * Array observation is enabled automatically when using the\n     * {@link RepeatDirective}, so calling this API manually is\n     * not typically necessary.\n     */\n    enable() {\n        if (enabled) {\n            return;\n        }\n        enabled = true;\n        Observable.setArrayObserverFactory((collection) => new DefaultArrayObserver(collection));\n        const proto = Array.prototype;\n        if (!proto.$fastPatch) {\n            setNonEnumerable(proto, \"$fastPatch\", 1);\n            [\n                proto.pop,\n                proto.push,\n                proto.reverse,\n                proto.shift,\n                proto.sort,\n                proto.splice,\n                proto.unshift,\n            ].forEach(method => {\n                proto[method.name] = function (...args) {\n                    var _a;\n                    const o = this.$fastController;\n                    return o === void 0\n                        ? method.apply(this, args)\n                        : ((_a = o.strategy) !== null && _a !== void 0 ? _a : defaultSpliceStrategy)[method.name](this, o, method, args);\n                };\n            });\n        }\n    },\n});\n/**\n * Enables observing the length of an array.\n * @param array - The array to observe the length of.\n * @returns The length of the array.\n * @public\n */\nexport function lengthOf(array) {\n    if (!array) {\n        return 0;\n    }\n    let arrayObserver = array.$fastController;\n    if (arrayObserver === void 0) {\n        ArrayObserver.enable();\n        arrayObserver = Observable.getNotifier(array);\n    }\n    Observable.track(arrayObserver.lengthObserver, \"length\");\n    return array.length;\n}\n","/**\n * Captures a binding expression along with related information and capabilities.\n *\n * @public\n */\nexport class Binding {\n    /**\n     * Creates a binding.\n     * @param evaluate - Evaluates the binding.\n     * @param policy - The security policy to associate with this binding.\n     * @param isVolatile - Indicates whether the binding is volatile.\n     */\n    constructor(evaluate, policy, isVolatile = false) {\n        this.evaluate = evaluate;\n        this.policy = policy;\n        this.isVolatile = isVolatile;\n    }\n}\n","import { Observable } from \"../observation/observable.js\";\nimport { Binding } from \"./binding.js\";\nclass OneWayBinding extends Binding {\n    createObserver(subscriber) {\n        return Observable.binding(this.evaluate, subscriber, this.isVolatile);\n    }\n}\n/**\n * Creates an standard binding.\n * @param expression - The binding to refresh when changed.\n * @param policy - The security policy to associate with th binding.\n * @param isVolatile - Indicates whether the binding is volatile or not.\n * @returns A binding configuration.\n * @public\n */\nexport function oneWay(expression, policy, isVolatile = Observable.isVolatileBinding(expression)) {\n    return new OneWayBinding(expression, policy, isVolatile);\n}\n/**\n * Creates an event listener binding.\n * @param expression - The binding to invoke when the event is raised.\n * @param options - Event listener options.\n * @returns A binding configuration.\n * @public\n */\nexport function listener(expression, options) {\n    const config = new OneWayBinding(expression);\n    config.options = options;\n    return config;\n}\n","import { makeSerializationNoop } from \"../platform.js\";\nimport { Binding } from \"./binding.js\";\nclass OneTimeBinding extends Binding {\n    createObserver() {\n        return this;\n    }\n    bind(controller) {\n        return this.evaluate(controller.source, controller.context);\n    }\n}\nmakeSerializationNoop(OneTimeBinding);\n/**\n * Creates a one time binding\n * @param expression - The binding to refresh when signaled.\n * @param policy - The security policy to associate with th binding.\n * @returns A binding configuration.\n * @public\n */\nexport function oneTime(expression, policy) {\n    return new OneTimeBinding(expression, policy);\n}\n","import { isFunction } from \"../interfaces.js\";\nimport { Binding } from \"./binding.js\";\nimport { oneWay } from \"./one-way.js\";\nimport { oneTime } from \"./one-time.js\";\n/**\n * Normalizes the input value into a binding.\n * @param value - The value to create the default binding for.\n * @returns A binding configuration for the provided value.\n * @public\n */\nexport function normalizeBinding(value) {\n    return isFunction(value)\n        ? oneWay(value)\n        : value instanceof Binding\n            ? value\n            : oneTime(() => value);\n}\n","let DefaultStyleStrategy;\nfunction reduceStyles(styles) {\n    return styles\n        .map((x) => x instanceof ElementStyles ? reduceStyles(x.styles) : [x])\n        .reduce((prev, curr) => prev.concat(curr), []);\n}\n/**\n * Represents styles that can be applied to a custom element.\n * @public\n */\nexport class ElementStyles {\n    /**\n     * Creates an instance of ElementStyles.\n     * @param styles - The styles that will be associated with elements.\n     */\n    constructor(styles) {\n        this.styles = styles;\n        this.targets = new WeakSet();\n        this._strategy = null;\n        this.behaviors = styles\n            .map((x) => x instanceof ElementStyles ? x.behaviors : null)\n            .reduce((prev, curr) => (curr === null ? prev : prev === null ? curr : prev.concat(curr)), null);\n    }\n    /**\n     * Gets the StyleStrategy associated with these element styles.\n     */\n    get strategy() {\n        if (this._strategy === null) {\n            this.withStrategy(DefaultStyleStrategy);\n        }\n        return this._strategy;\n    }\n    /** @internal */\n    addStylesTo(target) {\n        this.strategy.addStylesTo(target);\n        this.targets.add(target);\n    }\n    /** @internal */\n    removeStylesFrom(target) {\n        this.strategy.removeStylesFrom(target);\n        this.targets.delete(target);\n    }\n    /** @internal */\n    isAttachedTo(target) {\n        return this.targets.has(target);\n    }\n    /**\n     * Associates behaviors with this set of styles.\n     * @param behaviors - The behaviors to associate.\n     */\n    withBehaviors(...behaviors) {\n        this.behaviors =\n            this.behaviors === null ? behaviors : this.behaviors.concat(behaviors);\n        return this;\n    }\n    /**\n     * Sets the strategy that handles adding/removing these styles for an element.\n     * @param strategy - The strategy to use.\n     */\n    withStrategy(Strategy) {\n        this._strategy = new Strategy(reduceStyles(this.styles));\n        return this;\n    }\n    /**\n     * Sets the default strategy type to use when creating style strategies.\n     * @param Strategy - The strategy type to construct.\n     */\n    static setDefaultStrategy(Strategy) {\n        DefaultStyleStrategy = Strategy;\n    }\n    /**\n     * Normalizes a set of composable style options.\n     * @param styles - The style options to normalize.\n     * @returns A singular ElementStyles instance or undefined.\n     */\n    static normalize(styles) {\n        return styles === void 0\n            ? void 0\n            : Array.isArray(styles)\n                ? new ElementStyles(styles)\n                : styles instanceof ElementStyles\n                    ? styles\n                    : new ElementStyles([styles]);\n    }\n}\n/**\n * Indicates whether the DOM supports the adoptedStyleSheets feature.\n */\nElementStyles.supportsAdoptedStyleSheets = Array.isArray(document.adoptedStyleSheets) &&\n    \"replace\" in CSSStyleSheet.prototype;\n","import { createTypeRegistry } from \"../platform.js\";\nconst registry = createTypeRegistry();\n/**\n * Instructs the css engine to provide dynamic styles or\n * associate behaviors with styles.\n * @public\n */\nexport const CSSDirective = Object.freeze({\n    /**\n     * Gets the directive definition associated with the instance.\n     * @param instance - The directive instance to retrieve the definition for.\n     */\n    getForInstance: registry.getForInstance,\n    /**\n     * Gets the directive definition associated with the specified type.\n     * @param type - The directive type to retrieve the definition for.\n     */\n    getByType: registry.getByType,\n    /**\n     * Defines a CSSDirective.\n     * @param type - The type to define as a directive.\n     */\n    define(type) {\n        registry.register({ type });\n        return type;\n    },\n});\n/**\n * Decorator: Defines a CSSDirective.\n * @public\n */\nexport function cssDirective() {\n    /* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */\n    return function (type) {\n        CSSDirective.define(type);\n    };\n}\n","import { CSSDirective } from \"./css-directive.js\";\nfunction handleChange(directive, controller, observer) {\n    controller.source.style.setProperty(directive.targetAspect, observer.bind(controller));\n}\n/**\n * Enables bindings in CSS.\n *\n * @public\n */\nexport class CSSBindingDirective {\n    /**\n     * Creates an instance of CSSBindingDirective.\n     * @param dataBinding - The binding to use in CSS.\n     * @param targetAspect - The CSS property to target.\n     */\n    constructor(dataBinding, targetAspect) {\n        this.dataBinding = dataBinding;\n        this.targetAspect = targetAspect;\n    }\n    /**\n     * Creates a CSS fragment to interpolate into the CSS document.\n     * @returns - the string to interpolate into CSS\n     */\n    createCSS(add) {\n        add(this);\n        return `var(${this.targetAspect})`;\n    }\n    /**\n     * Executed when this behavior is attached to a controller.\n     * @param controller - Controls the behavior lifecycle.\n     */\n    addedCallback(controller) {\n        var _a;\n        const element = controller.source;\n        if (!element.$cssBindings) {\n            element.$cssBindings = new Map();\n            const setAttribute = element.setAttribute;\n            element.setAttribute = (attr, value) => {\n                setAttribute.call(element, attr, value);\n                if (attr === \"style\") {\n                    element.$cssBindings.forEach((v, k) => handleChange(k, v.controller, v.observer));\n                }\n            };\n        }\n        const observer = (_a = controller[this.targetAspect]) !== null && _a !== void 0 ? _a : (controller[this.targetAspect] = this.dataBinding.createObserver(this, this));\n        observer.controller = controller;\n        controller.source.$cssBindings.set(this, { controller, observer });\n    }\n    /**\n     * Executed when this behavior's host is connected.\n     * @param controller - Controls the behavior lifecycle.\n     */\n    connectedCallback(controller) {\n        handleChange(this, controller, controller[this.targetAspect]);\n    }\n    /**\n     * Executed when this behavior is detached from a controller.\n     * @param controller - Controls the behavior lifecycle.\n     */\n    removedCallback(controller) {\n        if (controller.source.$cssBindings) {\n            controller.source.$cssBindings.delete(this);\n        }\n    }\n    /**\n     * Called when a subject this instance has subscribed to changes.\n     * @param subject - The subject of the change.\n     * @param args - The event args detailing the change that occurred.\n     *\n     * @internal\n     */\n    handleChange(_, observer) {\n        handleChange(this, observer.controller, observer);\n    }\n}\nCSSDirective.define(CSSBindingDirective);\n","import { isFunction, isString } from \"../interfaces.js\";\nimport { Binding } from \"../binding/binding.js\";\nimport { oneWay } from \"../binding/one-way.js\";\nimport { CSSDirective } from \"./css-directive.js\";\nimport { ElementStyles } from \"./element-styles.js\";\nimport { CSSBindingDirective } from \"./css-binding-directive.js\";\nconst marker = `${Math.random().toString(36).substring(2, 8)}`;\nlet varId = 0;\nconst nextCSSVariable = () => `--v${marker}${++varId}`;\nfunction collectStyles(strings, values) {\n    const styles = [];\n    let cssString = \"\";\n    const behaviors = [];\n    const add = (behavior) => {\n        behaviors.push(behavior);\n    };\n    for (let i = 0, ii = strings.length - 1; i < ii; ++i) {\n        cssString += strings[i];\n        let value = values[i];\n        if (isFunction(value)) {\n            value = new CSSBindingDirective(oneWay(value), nextCSSVariable()).createCSS(add);\n        }\n        else if (value instanceof Binding) {\n            value = new CSSBindingDirective(value, nextCSSVariable()).createCSS(add);\n        }\n        else if (CSSDirective.getForInstance(value) !== void 0) {\n            value = value.createCSS(add);\n        }\n        if (value instanceof ElementStyles || value instanceof CSSStyleSheet) {\n            if (cssString.trim() !== \"\") {\n                styles.push(cssString);\n                cssString = \"\";\n            }\n            styles.push(value);\n        }\n        else {\n            cssString += value;\n        }\n    }\n    cssString += strings[strings.length - 1];\n    if (cssString.trim() !== \"\") {\n        styles.push(cssString);\n    }\n    return {\n        styles,\n        behaviors,\n    };\n}\n/**\n * Transforms a template literal string into styles.\n * @param strings - The string fragments that are interpolated with the values.\n * @param values - The values that are interpolated with the string fragments.\n * @remarks\n * The css helper supports interpolation of strings and ElementStyle instances.\n * @public\n */\nexport const css = ((strings, ...values) => {\n    const { styles, behaviors } = collectStyles(strings, values);\n    const elementStyles = new ElementStyles(styles);\n    return behaviors.length ? elementStyles.withBehaviors(...behaviors) : elementStyles;\n});\nclass CSSPartial {\n    constructor(styles, behaviors) {\n        this.behaviors = behaviors;\n        this.css = \"\";\n        const stylesheets = styles.reduce((accumulated, current) => {\n            if (isString(current)) {\n                this.css += current;\n            }\n            else {\n                accumulated.push(current);\n            }\n            return accumulated;\n        }, []);\n        if (stylesheets.length) {\n            this.styles = new ElementStyles(stylesheets);\n        }\n    }\n    createCSS(add) {\n        this.behaviors.forEach(add);\n        if (this.styles) {\n            add(this);\n        }\n        return this.css;\n    }\n    addedCallback(controller) {\n        controller.addStyles(this.styles);\n    }\n    removedCallback(controller) {\n        controller.removeStyles(this.styles);\n    }\n}\nCSSDirective.define(CSSPartial);\ncss.partial = (strings, ...values) => {\n    const { styles, behaviors } = collectStyles(strings, values);\n    return new CSSPartial(styles, behaviors);\n};\n","const bindingStartMarker = /fe-b\\$\\$start\\$\\$(\\d+)\\$\\$(.+)\\$\\$fe-b/;\nconst bindingEndMarker = /fe-b\\$\\$end\\$\\$(\\d+)\\$\\$(.+)\\$\\$fe-b/;\nconst repeatViewStartMarker = /fe-repeat\\$\\$start\\$\\$(\\d+)\\$\\$fe-repeat/;\nconst repeatViewEndMarker = /fe-repeat\\$\\$end\\$\\$(\\d+)\\$\\$fe-repeat/;\nconst elementBoundaryStartMarker = /^(?:.{0,1000})fe-eb\\$\\$start\\$\\$(.+?)\\$\\$fe-eb/;\nconst elementBoundaryEndMarker = /fe-eb\\$\\$end\\$\\$(.{0,1000})\\$\\$fe-eb(?:.{0,1000})$/;\nfunction isComment(node) {\n    return node && node.nodeType === Node.COMMENT_NODE;\n}\n/**\n * Markup utilities to aid in template hydration.\n * @internal\n */\nexport const HydrationMarkup = Object.freeze({\n    attributeMarkerName: \"data-fe-b\",\n    attributeBindingSeparator: \" \",\n    contentBindingStartMarker(index, uniqueId) {\n        return `fe-b$$start$$${index}$$${uniqueId}$$fe-b`;\n    },\n    contentBindingEndMarker(index, uniqueId) {\n        return `fe-b$$end$$${index}$$${uniqueId}$$fe-b`;\n    },\n    repeatStartMarker(index) {\n        return `fe-repeat$$start$$${index}$$fe-repeat`;\n    },\n    repeatEndMarker(index) {\n        return `fe-repeat$$end$$${index}$$fe-repeat`;\n    },\n    isContentBindingStartMarker(content) {\n        return bindingStartMarker.test(content);\n    },\n    isContentBindingEndMarker(content) {\n        return bindingEndMarker.test(content);\n    },\n    isRepeatViewStartMarker(content) {\n        return repeatViewStartMarker.test(content);\n    },\n    isRepeatViewEndMarker(content) {\n        return repeatViewEndMarker.test(content);\n    },\n    isElementBoundaryStartMarker(node) {\n        return isComment(node) && elementBoundaryStartMarker.test(node.data.trim());\n    },\n    isElementBoundaryEndMarker(node) {\n        return isComment(node) && elementBoundaryEndMarker.test(node.data);\n    },\n    /**\n     * Returns the indexes of the ViewBehaviorFactories affecting\n     * attributes for the element, or null if no factories were found.\n     */\n    parseAttributeBinding(node) {\n        const attr = node.getAttribute(this.attributeMarkerName);\n        return attr === null\n            ? attr\n            : attr.split(this.attributeBindingSeparator).map(i => parseInt(i));\n    },\n    /**\n     * Parses the ViewBehaviorFactory index from string data. Returns\n     * the binding index or null if the index cannot be retrieved.\n     */\n    parseContentBindingStartMarker(content) {\n        return parseIndexAndIdMarker(bindingStartMarker, content);\n    },\n    parseContentBindingEndMarker(content) {\n        return parseIndexAndIdMarker(bindingEndMarker, content);\n    },\n    /**\n     * Parses the index of a repeat directive from a content string.\n     */\n    parseRepeatStartMarker(content) {\n        return parseIntMarker(repeatViewStartMarker, content);\n    },\n    parseRepeatEndMarker(content) {\n        return parseIntMarker(repeatViewEndMarker, content);\n    },\n    /**\n     * Parses element Id from element boundary markers\n     */\n    parseElementBoundaryStartMarker(content) {\n        return parseStringMarker(elementBoundaryStartMarker, content.trim());\n    },\n    parseElementBoundaryEndMarker(content) {\n        return parseStringMarker(elementBoundaryEndMarker, content);\n    },\n});\nfunction parseIntMarker(regex, content) {\n    const match = regex.exec(content);\n    return match === null ? match : parseInt(match[1]);\n}\nfunction parseStringMarker(regex, content) {\n    const match = regex.exec(content);\n    return match === null ? match : match[1];\n}\nfunction parseIndexAndIdMarker(regex, content) {\n    const match = regex.exec(content);\n    return match === null ? match : [parseInt(match[1]), match[2]];\n}\n/**\n * @internal\n */\nexport const Hydratable = Symbol.for(\"fe-hydration\");\nexport function isHydratable(value) {\n    return value[Hydratable] === Hydratable;\n}\n","const marker = `fast-${Math.random().toString(36).substring(2, 8)}`;\nconst interpolationStart = `${marker}{`;\nconst interpolationEnd = `}${marker}`;\nconst interpolationEndLength = interpolationEnd.length;\nlet id = 0;\n/** @internal */\nexport const nextId = () => `${marker}-${++id}`;\n/**\n * Common APIs related to markup generation.\n * @public\n */\nexport const Markup = Object.freeze({\n    /**\n     * Creates a placeholder string suitable for marking out a location *within*\n     * an attribute value or HTML content.\n     * @param index - The directive index to create the placeholder for.\n     * @remarks\n     * Used internally by binding directives.\n     */\n    interpolation: (id) => `${interpolationStart}${id}${interpolationEnd}`,\n    /**\n     * Creates a placeholder that manifests itself as an attribute on an\n     * element.\n     * @param attributeName - The name of the custom attribute.\n     * @param index - The directive index to create the placeholder for.\n     * @remarks\n     * Used internally by attribute directives such as `ref`, `slotted`, and `children`.\n     */\n    attribute: (id) => `${nextId()}=\"${interpolationStart}${id}${interpolationEnd}\"`,\n    /**\n     * Creates a placeholder that manifests itself as a marker within the DOM structure.\n     * @param index - The directive index to create the placeholder for.\n     * @remarks\n     * Used internally by structural directives such as `repeat`.\n     */\n    comment: (id) => `<!--${interpolationStart}${id}${interpolationEnd}-->`,\n});\n/**\n * Common APIs related to content parsing.\n * @public\n */\nexport const Parser = Object.freeze({\n    /**\n     * Parses text content or HTML attribute content, separating out the static strings\n     * from the directives.\n     * @param value - The content or attribute string to parse.\n     * @param factories - A list of directives to search for in the string.\n     * @returns A heterogeneous array of static strings interspersed with\n     * directives or null if no directives are found in the string.\n     */\n    parse(value, factories) {\n        const parts = value.split(interpolationStart);\n        if (parts.length === 1) {\n            return null;\n        }\n        const result = [];\n        for (let i = 0, ii = parts.length; i < ii; ++i) {\n            const current = parts[i];\n            const index = current.indexOf(interpolationEnd);\n            let literal;\n            if (index === -1) {\n                literal = current;\n            }\n            else {\n                const factoryId = current.substring(0, index);\n                result.push(factories[factoryId]);\n                literal = current.substring(index + interpolationEndLength);\n            }\n            if (literal !== \"\") {\n                result.push(literal);\n            }\n        }\n        return result;\n    },\n});\n","import { DOMAspect } from \"../dom.js\";\nimport { createTypeRegistry, makeSerializationNoop } from \"../platform.js\";\nimport { Markup } from \"./markup.js\";\nconst registry = createTypeRegistry();\n/**\n * Instructs the template engine to apply behavior to a node.\n * @public\n */\nexport const HTMLDirective = Object.freeze({\n    /**\n     * Gets the directive definition associated with the instance.\n     * @param instance - The directive instance to retrieve the definition for.\n     */\n    getForInstance: registry.getForInstance,\n    /**\n     * Gets the directive definition associated with the specified type.\n     * @param type - The directive type to retrieve the definition for.\n     */\n    getByType: registry.getByType,\n    /**\n     * Defines an HTMLDirective based on the options.\n     * @param type - The type to define as a directive.\n     * @param options - Options that specify the directive's application.\n     */\n    define(type, options) {\n        options = options || {};\n        options.type = type;\n        registry.register(options);\n        return type;\n    },\n    /**\n     *\n     * @param directive - The directive to assign the aspect to.\n     * @param value - The value to base the aspect determination on.\n     * @remarks\n     * If a falsy value is provided, then the content aspect will be assigned.\n     */\n    assignAspect(directive, value) {\n        if (!value) {\n            directive.aspectType = DOMAspect.content;\n            return;\n        }\n        directive.sourceAspect = value;\n        switch (value[0]) {\n            case \":\":\n                directive.targetAspect = value.substring(1);\n                directive.aspectType =\n                    directive.targetAspect === \"classList\"\n                        ? DOMAspect.tokenList\n                        : DOMAspect.property;\n                break;\n            case \"?\":\n                directive.targetAspect = value.substring(1);\n                directive.aspectType = DOMAspect.booleanAttribute;\n                break;\n            case \"@\":\n                directive.targetAspect = value.substring(1);\n                directive.aspectType = DOMAspect.event;\n                break;\n            default:\n                directive.targetAspect = value;\n                directive.aspectType = DOMAspect.attribute;\n                break;\n        }\n    },\n});\n/**\n * Decorator: Defines an HTMLDirective.\n * @param options - Provides options that specify the directive's application.\n * @public\n */\nexport function htmlDirective(options) {\n    /* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */\n    return function (type) {\n        HTMLDirective.define(type, options);\n    };\n}\n/**\n * A base class used for attribute directives that don't need internal state.\n * @public\n */\nexport class StatelessAttachedAttributeDirective {\n    /**\n     * Creates an instance of RefDirective.\n     * @param options - The options to use in configuring the directive.\n     */\n    constructor(options) {\n        this.options = options;\n    }\n    /**\n     * Creates a placeholder string based on the directive's index within the template.\n     * @param index - The index of the directive within the template.\n     * @remarks\n     * Creates a custom attribute placeholder.\n     */\n    createHTML(add) {\n        return Markup.attribute(add(this));\n    }\n    /**\n     * Creates a behavior.\n     * @param targets - The targets available for behaviors to be attached to.\n     */\n    createBehavior() {\n        return this;\n    }\n}\nmakeSerializationNoop(StatelessAttachedAttributeDirective);\n","import { HydrationMarkup } from \"../components/hydration.js\";\nexport class HydrationTargetElementError extends Error {\n    constructor(\n    /**\n     * The error message\n     */\n    message, \n    /**\n     * The Compiled View Behavior Factories that belong to the view.\n     */\n    factories, \n    /**\n     * The node to target factory.\n     */\n    node) {\n        super(message);\n        this.factories = factories;\n        this.node = node;\n    }\n}\nfunction isComment(node) {\n    return node.nodeType === Node.COMMENT_NODE;\n}\nfunction isText(node) {\n    return node.nodeType === Node.TEXT_NODE;\n}\n/**\n * Returns a range object inclusive of all nodes including and between the\n * provided first and last node.\n * @param first - The first node\n * @param last - This last node\n * @returns\n */\nexport function createRangeForNodes(first, last) {\n    const range = document.createRange();\n    range.setStart(first, 0);\n    // The lastIndex should be inclusive of the end of the lastChild. Obtain offset based\n    // on usageNotes:  https://developer.mozilla.org/en-US/docs/Web/API/Range/setEnd#usage_notes\n    range.setEnd(last, isComment(last) || isText(last) ? last.data.length : last.childNodes.length);\n    return range;\n}\nfunction isShadowRoot(node) {\n    return node instanceof DocumentFragment && \"mode\" in node;\n}\n/**\n * Maps {@link CompiledViewBehaviorFactory} ids to the corresponding node targets for the view.\n * @param firstNode - The first node of the view.\n * @param lastNode -  The last node of the view.\n * @param factories - The Compiled View Behavior Factories that belong to the view.\n * @returns - A {@link ViewBehaviorTargets } object for the factories in the view.\n */\nexport function buildViewBindingTargets(firstNode, lastNode, factories) {\n    const range = createRangeForNodes(firstNode, lastNode);\n    const treeRoot = range.commonAncestorContainer;\n    const walker = document.createTreeWalker(treeRoot, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_COMMENT + NodeFilter.SHOW_TEXT, {\n        acceptNode(node) {\n            return range.comparePoint(node, 0) === 0\n                ? NodeFilter.FILTER_ACCEPT\n                : NodeFilter.FILTER_REJECT;\n        },\n    });\n    const targets = {};\n    const boundaries = {};\n    let node = (walker.currentNode = firstNode);\n    while (node !== null) {\n        switch (node.nodeType) {\n            case Node.ELEMENT_NODE: {\n                targetElement(node, factories, targets);\n                break;\n            }\n            case Node.COMMENT_NODE: {\n                targetComment(node, walker, factories, targets, boundaries);\n                break;\n            }\n        }\n        node = walker.nextNode();\n    }\n    range.detach();\n    return { targets, boundaries };\n}\nfunction targetElement(node, factories, targets) {\n    // Check for attributes and map any factories.\n    const attrFactoryIds = HydrationMarkup.parseAttributeBinding(node);\n    if (attrFactoryIds !== null) {\n        for (const id of attrFactoryIds) {\n            if (!factories[id]) {\n                throw new HydrationTargetElementError(`HydrationView was unable to successfully target factory on ${node.nodeName} inside ${node.getRootNode().host.nodeName}. This likely indicates a template mismatch between SSR rendering and hydration.`, factories, node);\n            }\n            targetFactory(factories[id], node, targets);\n        }\n        node.removeAttribute(HydrationMarkup.attributeMarkerName);\n    }\n}\nfunction targetComment(node, walker, factories, targets, boundaries) {\n    if (HydrationMarkup.isElementBoundaryStartMarker(node)) {\n        skipToElementBoundaryEndMarker(node, walker);\n        return;\n    }\n    if (HydrationMarkup.isContentBindingStartMarker(node.data)) {\n        const parsed = HydrationMarkup.parseContentBindingStartMarker(node.data);\n        if (parsed === null) {\n            return;\n        }\n        const [index, id] = parsed;\n        const factory = factories[index];\n        const nodes = [];\n        let current = walker.nextSibling();\n        node.data = \"\";\n        const first = current;\n        // Search for the binding end marker that closes the binding.\n        while (current !== null) {\n            if (isComment(current)) {\n                const parsed = HydrationMarkup.parseContentBindingEndMarker(current.data);\n                if (parsed && parsed[1] === id) {\n                    break;\n                }\n            }\n            nodes.push(current);\n            current = walker.nextSibling();\n        }\n        if (current === null) {\n            const root = node.getRootNode();\n            throw new Error(`Error hydrating Comment node inside \"${isShadowRoot(root) ? root.host.nodeName : root.nodeName}\".`);\n        }\n        current.data = \"\";\n        if (nodes.length === 1 && isText(nodes[0])) {\n            targetFactory(factory, nodes[0], targets);\n        }\n        else {\n            // If current === first, it means there is no content in\n            // the view. This happens when a `when` directive evaluates false,\n            // or whenever a content binding returns null or undefined.\n            // In that case, there will never be any content\n            // to hydrate and Binding can simply create a HTMLView\n            // whenever it needs to.\n            if (current !== first && current.previousSibling !== null) {\n                boundaries[factory.targetNodeId] = {\n                    first,\n                    last: current.previousSibling,\n                };\n            }\n            // Binding evaluates to null / undefined or a template.\n            // If binding revaluates to string, it will replace content in target\n            // So we always insert a text node to ensure that\n            // text content binding will be written to this text node instead of comment\n            const dummyTextNode = current.parentNode.insertBefore(document.createTextNode(\"\"), current);\n            targetFactory(factory, dummyTextNode, targets);\n        }\n    }\n}\n/**\n * Moves TreeWalker to element boundary end marker\n * @param node - element boundary start marker node\n * @param walker - tree walker\n */\nfunction skipToElementBoundaryEndMarker(node, walker) {\n    const id = HydrationMarkup.parseElementBoundaryStartMarker(node.data);\n    let current = walker.nextSibling();\n    while (current !== null) {\n        if (isComment(current)) {\n            const parsed = HydrationMarkup.parseElementBoundaryEndMarker(current.data);\n            if (parsed && parsed === id) {\n                break;\n            }\n        }\n        current = walker.nextSibling();\n    }\n}\nexport function targetFactory(factory, node, targets) {\n    if (factory.targetNodeId === undefined) {\n        // Dev error, this shouldn't ever be thrown\n        throw new Error(\"Factory could not be target to the node\");\n    }\n    targets[factory.targetNodeId] = node;\n}\n","var _a;\nimport { Hydratable } from \"../components/hydration.js\";\nimport { buildViewBindingTargets, createRangeForNodes, HydrationTargetElementError, targetFactory, } from \"../hydration/target-builder.js\";\nimport { ExecutionContext, Observable, SourceLifetime, } from \"../observation/observable.js\";\nimport { makeSerializationNoop } from \"../platform.js\";\nfunction removeNodeSequence(firstNode, lastNode) {\n    const parent = firstNode.parentNode;\n    let current = firstNode;\n    let next;\n    while (current !== lastNode) {\n        next = current.nextSibling;\n        if (!next) {\n            throw new Error(`Unmatched first/last child inside \"${lastNode.getRootNode().host.nodeName}\".`);\n        }\n        parent.removeChild(current);\n        current = next;\n    }\n    parent.removeChild(lastNode);\n}\nclass DefaultExecutionContext {\n    constructor() {\n        /**\n         * The index of the current item within a repeat context.\n         */\n        this.index = 0;\n        /**\n         * The length of the current collection within a repeat context.\n         */\n        this.length = 0;\n    }\n    /**\n     * The current event within an event handler.\n     */\n    get event() {\n        return ExecutionContext.getEvent();\n    }\n    /**\n     * Indicates whether the current item within a repeat context\n     * has an even index.\n     */\n    get isEven() {\n        return this.index % 2 === 0;\n    }\n    /**\n     * Indicates whether the current item within a repeat context\n     * has an odd index.\n     */\n    get isOdd() {\n        return this.index % 2 !== 0;\n    }\n    /**\n     * Indicates whether the current item within a repeat context\n     * is the first item in the collection.\n     */\n    get isFirst() {\n        return this.index === 0;\n    }\n    /**\n     * Indicates whether the current item within a repeat context\n     * is somewhere in the middle of the collection.\n     */\n    get isInMiddle() {\n        return !this.isFirst && !this.isLast;\n    }\n    /**\n     * Indicates whether the current item within a repeat context\n     * is the last item in the collection.\n     */\n    get isLast() {\n        return this.index === this.length - 1;\n    }\n    /**\n     * Returns the typed event detail of a custom event.\n     */\n    eventDetail() {\n        return this.event.detail;\n    }\n    /**\n     * Returns the typed event target of the event.\n     */\n    eventTarget() {\n        return this.event.target;\n    }\n}\n/**\n * The standard View implementation, which also implements ElementView and SyntheticView.\n * @public\n */\nexport class HTMLView extends DefaultExecutionContext {\n    /**\n     * Constructs an instance of HTMLView.\n     * @param fragment - The html fragment that contains the nodes for this view.\n     * @param behaviors - The behaviors to be applied to this view.\n     */\n    constructor(fragment, factories, targets) {\n        super();\n        this.fragment = fragment;\n        this.factories = factories;\n        this.targets = targets;\n        this.behaviors = null;\n        this.unbindables = [];\n        /**\n         * The data that the view is bound to.\n         */\n        this.source = null;\n        /**\n         * Indicates whether the controller is bound.\n         */\n        this.isBound = false;\n        /**\n         * Indicates how the source's lifetime relates to the controller's lifetime.\n         */\n        this.sourceLifetime = SourceLifetime.unknown;\n        /**\n         * The execution context the view is running within.\n         */\n        this.context = this;\n        this.firstChild = fragment.firstChild;\n        this.lastChild = fragment.lastChild;\n    }\n    /**\n     * Appends the view's DOM nodes to the referenced node.\n     * @param node - The parent node to append the view's DOM nodes to.\n     */\n    appendTo(node) {\n        node.appendChild(this.fragment);\n    }\n    /**\n     * Inserts the view's DOM nodes before the referenced node.\n     * @param node - The node to insert the view's DOM before.\n     */\n    insertBefore(node) {\n        if (this.fragment.hasChildNodes()) {\n            node.parentNode.insertBefore(this.fragment, node);\n        }\n        else {\n            const end = this.lastChild;\n            if (node.previousSibling === end)\n                return;\n            const parentNode = node.parentNode;\n            let current = this.firstChild;\n            let next;\n            while (current !== end) {\n                next = current.nextSibling;\n                parentNode.insertBefore(current, node);\n                current = next;\n            }\n            parentNode.insertBefore(end, node);\n        }\n    }\n    /**\n     * Removes the view's DOM nodes.\n     * The nodes are not disposed and the view can later be re-inserted.\n     */\n    remove() {\n        const fragment = this.fragment;\n        const end = this.lastChild;\n        let current = this.firstChild;\n        let next;\n        while (current !== end) {\n            next = current.nextSibling;\n            fragment.appendChild(current);\n            current = next;\n        }\n        fragment.appendChild(end);\n    }\n    /**\n     * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.\n     * Once a view has been disposed, it cannot be inserted or bound again.\n     */\n    dispose() {\n        removeNodeSequence(this.firstChild, this.lastChild);\n        this.unbind();\n    }\n    onUnbind(behavior) {\n        this.unbindables.push(behavior);\n    }\n    /**\n     * Binds a view's behaviors to its binding source.\n     * @param source - The binding source for the view's binding behaviors.\n     * @param context - The execution context to run the behaviors within.\n     */\n    bind(source, context = this) {\n        if (this.source === source) {\n            return;\n        }\n        let behaviors = this.behaviors;\n        if (behaviors === null) {\n            this.source = source;\n            this.context = context;\n            this.behaviors = behaviors = new Array(this.factories.length);\n            const factories = this.factories;\n            for (let i = 0, ii = factories.length; i < ii; ++i) {\n                const behavior = factories[i].createBehavior();\n                behavior.bind(this);\n                behaviors[i] = behavior;\n            }\n        }\n        else {\n            if (this.source !== null) {\n                this.evaluateUnbindables();\n            }\n            this.isBound = false;\n            this.source = source;\n            this.context = context;\n            for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n                behaviors[i].bind(this);\n            }\n        }\n        this.isBound = true;\n    }\n    /**\n     * Unbinds a view's behaviors from its binding source.\n     */\n    unbind() {\n        if (!this.isBound || this.source === null) {\n            return;\n        }\n        this.evaluateUnbindables();\n        this.source = null;\n        this.context = this;\n        this.isBound = false;\n    }\n    evaluateUnbindables() {\n        const unbindables = this.unbindables;\n        for (let i = 0, ii = unbindables.length; i < ii; ++i) {\n            unbindables[i].unbind(this);\n        }\n        unbindables.length = 0;\n    }\n    /**\n     * Efficiently disposes of a contiguous range of synthetic view instances.\n     * @param views - A contiguous range of views to be disposed.\n     */\n    static disposeContiguousBatch(views) {\n        if (views.length === 0) {\n            return;\n        }\n        removeNodeSequence(views[0].firstChild, views[views.length - 1].lastChild);\n        for (let i = 0, ii = views.length; i < ii; ++i) {\n            views[i].unbind();\n        }\n    }\n}\nmakeSerializationNoop(HTMLView);\nObservable.defineProperty(HTMLView.prototype, \"index\");\nObservable.defineProperty(HTMLView.prototype, \"length\");\nexport const HydrationStage = {\n    unhydrated: \"unhydrated\",\n    hydrating: \"hydrating\",\n    hydrated: \"hydrated\",\n};\n/** @public */\nexport class HydrationBindingError extends Error {\n    constructor(\n    /**\n     * The error message\n     */\n    message, \n    /**\n     * The factory that was unable to be bound\n     */\n    factory, \n    /**\n     * A DocumentFragment containing a clone of the\n     * view's Nodes.\n     */\n    fragment, \n    /**\n     * String representation of the HTML in the template that\n     * threw the binding error.\n     */\n    templateString) {\n        super(message);\n        this.factory = factory;\n        this.fragment = fragment;\n        this.templateString = templateString;\n    }\n}\nexport class HydrationView extends DefaultExecutionContext {\n    constructor(firstChild, lastChild, sourceTemplate, hostBindingTarget) {\n        super();\n        this.firstChild = firstChild;\n        this.lastChild = lastChild;\n        this.sourceTemplate = sourceTemplate;\n        this.hostBindingTarget = hostBindingTarget;\n        this[_a] = Hydratable;\n        this.context = this;\n        this.source = null;\n        this.isBound = false;\n        this.sourceLifetime = SourceLifetime.unknown;\n        this.unbindables = [];\n        this.fragment = null;\n        this.behaviors = null;\n        this._hydrationStage = HydrationStage.unhydrated;\n        this._bindingViewBoundaries = {};\n        this._targets = {};\n        this.factories = sourceTemplate.compile().factories;\n    }\n    get hydrationStage() {\n        return this._hydrationStage;\n    }\n    get targets() {\n        return this._targets;\n    }\n    get bindingViewBoundaries() {\n        return this._bindingViewBoundaries;\n    }\n    /**\n     * no-op. Hydrated views are don't need to be moved from a documentFragment\n     * to the target node.\n     */\n    insertBefore(node) {\n        // No-op in cases where this is called before the view is removed,\n        // because the nodes will already be in the document and just need hydrating.\n        if (this.fragment === null) {\n            return;\n        }\n        if (this.fragment.hasChildNodes()) {\n            node.parentNode.insertBefore(this.fragment, node);\n        }\n        else {\n            const end = this.lastChild;\n            if (node.previousSibling === end)\n                return;\n            const parentNode = node.parentNode;\n            let current = this.firstChild;\n            let next;\n            while (current !== end) {\n                next = current.nextSibling;\n                parentNode.insertBefore(current, node);\n                current = next;\n            }\n            parentNode.insertBefore(end, node);\n        }\n    }\n    /**\n     * Appends the view to a node. In cases where this is called before the\n     * view has been removed, the method will no-op.\n     * @param node - the node to append the view to.\n     */\n    appendTo(node) {\n        if (this.fragment !== null) {\n            node.appendChild(this.fragment);\n        }\n    }\n    remove() {\n        const fragment = this.fragment || (this.fragment = document.createDocumentFragment());\n        const end = this.lastChild;\n        let current = this.firstChild;\n        let next;\n        while (current !== end) {\n            next = current.nextSibling;\n            if (!next) {\n                throw new Error(`Unmatched first/last child inside \"${end.getRootNode().host.nodeName}\".`);\n            }\n            fragment.appendChild(current);\n            current = next;\n        }\n        fragment.appendChild(end);\n    }\n    bind(source, context = this) {\n        var _b, _c;\n        if (this.hydrationStage !== HydrationStage.hydrated) {\n            this._hydrationStage = HydrationStage.hydrating;\n        }\n        if (this.source === source) {\n            return;\n        }\n        let behaviors = this.behaviors;\n        if (behaviors === null) {\n            this.source = source;\n            this.context = context;\n            try {\n                const { targets, boundaries } = buildViewBindingTargets(this.firstChild, this.lastChild, this.factories);\n                this._targets = targets;\n                this._bindingViewBoundaries = boundaries;\n            }\n            catch (error) {\n                if (error instanceof HydrationTargetElementError) {\n                    let templateString = this.sourceTemplate.html;\n                    if (typeof templateString !== \"string\") {\n                        templateString = templateString.innerHTML;\n                    }\n                    error.templateString = templateString;\n                }\n                throw error;\n            }\n            this.behaviors = behaviors = new Array(this.factories.length);\n            const factories = this.factories;\n            for (let i = 0, ii = factories.length; i < ii; ++i) {\n                const factory = factories[i];\n                if (factory.targetNodeId === \"h\" && this.hostBindingTarget) {\n                    targetFactory(factory, this.hostBindingTarget, this._targets);\n                }\n                // If the binding has been targeted or it is a host binding and the view has a hostBindingTarget\n                if (factory.targetNodeId in this.targets) {\n                    const behavior = factory.createBehavior();\n                    behavior.bind(this);\n                    behaviors[i] = behavior;\n                }\n                else {\n                    let templateString = this.sourceTemplate.html;\n                    if (typeof templateString !== \"string\") {\n                        templateString = templateString.innerHTML;\n                    }\n                    throw new HydrationBindingError(`HydrationView was unable to successfully target bindings inside \"${(_c = ((_b = this.firstChild) === null || _b === void 0 ? void 0 : _b.getRootNode()).host) === null || _c === void 0 ? void 0 : _c.nodeName}\".`, factory, createRangeForNodes(this.firstChild, this.lastChild).cloneContents(), templateString);\n                }\n            }\n        }\n        else {\n            if (this.source !== null) {\n                this.evaluateUnbindables();\n            }\n            this.isBound = false;\n            this.source = source;\n            this.context = context;\n            for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n                behaviors[i].bind(this);\n            }\n        }\n        this.isBound = true;\n        this._hydrationStage = HydrationStage.hydrated;\n    }\n    unbind() {\n        if (!this.isBound || this.source === null) {\n            return;\n        }\n        this.evaluateUnbindables();\n        this.source = null;\n        this.context = this;\n        this.isBound = false;\n    }\n    /**\n     * Removes the view and unbinds its behaviors, disposing of DOM nodes afterward.\n     * Once a view has been disposed, it cannot be inserted or bound again.\n     */\n    dispose() {\n        removeNodeSequence(this.firstChild, this.lastChild);\n        this.unbind();\n    }\n    onUnbind(behavior) {\n        this.unbindables.push(behavior);\n    }\n    evaluateUnbindables() {\n        const unbindables = this.unbindables;\n        for (let i = 0, ii = unbindables.length; i < ii; ++i) {\n            unbindables[i].unbind(this);\n        }\n        unbindables.length = 0;\n    }\n}\n_a = Hydratable;\nmakeSerializationNoop(HydrationView);\n","import { isHydratable } from \"../components/hydration.js\";\nimport { DOM, DOMAspect } from \"../dom.js\";\nimport \"../interfaces.js\";\nimport { ExecutionContext, } from \"../observation/observable.js\";\nimport { FAST } from \"../platform.js\";\nimport { HTMLDirective, } from \"./html-directive.js\";\nimport { Markup } from \"./markup.js\";\nimport { HydrationStage } from \"./view.js\";\nfunction isContentTemplate(value) {\n    return value.create !== undefined;\n}\nfunction updateContent(target, aspect, value, controller) {\n    // If there's no actual value, then this equates to the\n    // empty string for the purposes of content bindings.\n    if (value === null || value === undefined) {\n        value = \"\";\n    }\n    // If the value has a \"create\" method, then it's a ContentTemplate.\n    if (isContentTemplate(value)) {\n        target.textContent = \"\";\n        let view = target.$fastView;\n        // If there's no previous view that we might be able to\n        // reuse then create a new view from the template.\n        if (view === void 0) {\n            if (isHydratable(controller) &&\n                isHydratable(value) &&\n                controller.bindingViewBoundaries[this.targetNodeId] !== undefined &&\n                controller.hydrationStage !== HydrationStage.hydrated) {\n                const viewNodes = controller.bindingViewBoundaries[this.targetNodeId];\n                view = value.hydrate(viewNodes.first, viewNodes.last);\n            }\n            else {\n                view = value.create();\n            }\n        }\n        else {\n            // If there is a previous view, but it wasn't created\n            // from the same template as the new value, then we\n            // need to remove the old view if it's still in the DOM\n            // and create a new view from the template.\n            if (target.$fastTemplate !== value) {\n                if (view.isComposed) {\n                    view.remove();\n                    view.unbind();\n                }\n                view = value.create();\n            }\n        }\n        // It's possible that the value is the same as the previous template\n        // and that there's actually no need to compose it.\n        if (!view.isComposed) {\n            view.isComposed = true;\n            view.bind(controller.source, controller.context);\n            view.insertBefore(target);\n            target.$fastView = view;\n            target.$fastTemplate = value;\n        }\n        else if (view.needsBindOnly) {\n            view.needsBindOnly = false;\n            view.bind(controller.source, controller.context);\n        }\n    }\n    else {\n        const view = target.$fastView;\n        // If there is a view and it's currently composed into\n        // the DOM, then we need to remove it.\n        if (view !== void 0 && view.isComposed) {\n            view.isComposed = false;\n            view.remove();\n            if (view.needsBindOnly) {\n                view.needsBindOnly = false;\n            }\n            else {\n                view.unbind();\n            }\n        }\n        target.textContent = value;\n    }\n}\nfunction updateTokenList(target, aspect, value) {\n    var _a;\n    const lookup = `${this.id}-t`;\n    const state = (_a = target[lookup]) !== null && _a !== void 0 ? _a : (target[lookup] = { v: 0, cv: Object.create(null) });\n    const classVersions = state.cv;\n    let version = state.v;\n    const tokenList = target[aspect];\n    // Add the classes, tracking the version at which they were added.\n    if (value !== null && value !== undefined && value.length) {\n        const names = value.split(/\\s+/);\n        for (let i = 0, ii = names.length; i < ii; ++i) {\n            const currentName = names[i];\n            if (currentName === \"\") {\n                continue;\n            }\n            classVersions[currentName] = version;\n            tokenList.add(currentName);\n        }\n    }\n    state.v = version + 1;\n    // If this is the first call to add classes, there's no need to remove old ones.\n    if (version === 0) {\n        return;\n    }\n    // Remove classes from the previous version.\n    version -= 1;\n    for (const name in classVersions) {\n        if (classVersions[name] === version) {\n            tokenList.remove(name);\n        }\n    }\n}\nconst sinkLookup = {\n    [DOMAspect.attribute]: DOM.setAttribute,\n    [DOMAspect.booleanAttribute]: DOM.setBooleanAttribute,\n    [DOMAspect.property]: (t, a, v) => (t[a] = v),\n    [DOMAspect.content]: updateContent,\n    [DOMAspect.tokenList]: updateTokenList,\n    [DOMAspect.event]: () => void 0,\n};\n/**\n * A directive that applies bindings.\n * @public\n */\nexport class HTMLBindingDirective {\n    /**\n     * Creates an instance of HTMLBindingDirective.\n     * @param dataBinding - The binding configuration to apply.\n     */\n    constructor(dataBinding) {\n        this.dataBinding = dataBinding;\n        this.updateTarget = null;\n        /**\n         * The type of aspect to target.\n         */\n        this.aspectType = DOMAspect.content;\n    }\n    /**\n     * Creates HTML to be used within a template.\n     * @param add - Can be used to add  behavior factories to a template.\n     */\n    createHTML(add) {\n        return Markup.interpolation(add(this));\n    }\n    /**\n     * Creates a behavior.\n     */\n    createBehavior() {\n        var _a;\n        if (this.updateTarget === null) {\n            const sink = sinkLookup[this.aspectType];\n            const policy = (_a = this.dataBinding.policy) !== null && _a !== void 0 ? _a : this.policy;\n            if (!sink) {\n                throw FAST.error(1205 /* Message.unsupportedBindingBehavior */);\n            }\n            this.data = `${this.id}-d`;\n            this.updateTarget = policy.protect(this.targetTagName, this.aspectType, this.targetAspect, sink);\n        }\n        return this;\n    }\n    /** @internal */\n    bind(controller) {\n        var _a;\n        const target = controller.targets[this.targetNodeId];\n        const isHydrating = isHydratable(controller) &&\n            controller.hydrationStage &&\n            controller.hydrationStage !== HydrationStage.hydrated;\n        switch (this.aspectType) {\n            case DOMAspect.event:\n                target[this.data] = controller;\n                target.addEventListener(this.targetAspect, this, this.dataBinding.options);\n                break;\n            case DOMAspect.content:\n                controller.onUnbind(this);\n            // intentional fall through\n            default:\n                const observer = (_a = target[this.data]) !== null && _a !== void 0 ? _a : (target[this.data] = this.dataBinding.createObserver(this, this));\n                observer.target = target;\n                observer.controller = controller;\n                if (isHydrating &&\n                    (this.aspectType === DOMAspect.attribute ||\n                        this.aspectType === DOMAspect.booleanAttribute)) {\n                    observer.bind(controller);\n                    // Skip updating target during bind for attributes\n                    break;\n                }\n                this.updateTarget(target, this.targetAspect, observer.bind(controller), controller);\n                break;\n        }\n    }\n    /** @internal */\n    unbind(controller) {\n        const target = controller.targets[this.targetNodeId];\n        const view = target.$fastView;\n        if (view !== void 0 && view.isComposed) {\n            view.unbind();\n            view.needsBindOnly = true;\n        }\n    }\n    /** @internal */\n    handleEvent(event) {\n        const controller = event.currentTarget[this.data];\n        if (controller.isBound) {\n            ExecutionContext.setEvent(event);\n            const result = this.dataBinding.evaluate(controller.source, controller.context);\n            ExecutionContext.setEvent(null);\n            if (result !== true) {\n                event.preventDefault();\n            }\n        }\n    }\n    /** @internal */\n    handleChange(binding, observer) {\n        const target = observer.target;\n        const controller = observer.controller;\n        this.updateTarget(target, this.targetAspect, observer.bind(controller), controller);\n    }\n}\nHTMLDirective.define(HTMLBindingDirective, { aspected: true });\n","import { isFunction, isString } from \"../interfaces.js\";\nimport { FAST } from \"../platform.js\";\nimport { DOM } from \"../dom.js\";\nimport { oneTime } from \"../binding/one-time.js\";\nimport { oneWay } from \"../binding/one-way.js\";\nimport { nextId, Parser } from \"./markup.js\";\nimport { HTMLBindingDirective } from \"./html-binding-directive.js\";\nimport { HTMLDirective, } from \"./html-directive.js\";\nimport { HTMLView } from \"./view.js\";\nconst targetIdFrom = (parentId, nodeIndex) => `${parentId}.${nodeIndex}`;\nconst descriptorCache = {};\n// used to prevent creating lots of objects just to track node and index while compiling\nconst next = {\n    index: 0,\n    node: null,\n};\nfunction tryWarn(name) {\n    if (!name.startsWith(\"fast-\")) {\n        FAST.warn(1204 /* Message.hostBindingWithoutHost */, { name });\n    }\n}\nconst warningHost = new Proxy(document.createElement(\"div\"), {\n    get(target, property) {\n        tryWarn(property);\n        const value = Reflect.get(target, property);\n        return isFunction(value) ? value.bind(target) : value;\n    },\n    set(target, property, value) {\n        tryWarn(property);\n        return Reflect.set(target, property, value);\n    },\n});\nclass CompilationContext {\n    constructor(fragment, directives, policy) {\n        this.fragment = fragment;\n        this.directives = directives;\n        this.policy = policy;\n        this.proto = null;\n        this.nodeIds = new Set();\n        this.descriptors = {};\n        this.factories = [];\n    }\n    addFactory(factory, parentId, nodeId, targetIndex, tagName) {\n        var _a, _b;\n        if (!this.nodeIds.has(nodeId)) {\n            this.nodeIds.add(nodeId);\n            this.addTargetDescriptor(parentId, nodeId, targetIndex);\n        }\n        factory.id = (_a = factory.id) !== null && _a !== void 0 ? _a : nextId();\n        factory.targetNodeId = nodeId;\n        factory.targetTagName = tagName;\n        factory.policy = (_b = factory.policy) !== null && _b !== void 0 ? _b : this.policy;\n        this.factories.push(factory);\n    }\n    freeze() {\n        this.proto = Object.create(null, this.descriptors);\n        return this;\n    }\n    addTargetDescriptor(parentId, targetId, targetIndex) {\n        const descriptors = this.descriptors;\n        if (targetId === \"r\" || // root\n            targetId === \"h\" || // host\n            descriptors[targetId]) {\n            return;\n        }\n        if (!descriptors[parentId]) {\n            const index = parentId.lastIndexOf(\".\");\n            const grandparentId = parentId.substring(0, index);\n            const childIndex = parseInt(parentId.substring(index + 1));\n            this.addTargetDescriptor(grandparentId, parentId, childIndex);\n        }\n        let descriptor = descriptorCache[targetId];\n        if (!descriptor) {\n            const field = `_${targetId}`;\n            descriptorCache[targetId] = descriptor = {\n                get() {\n                    var _a;\n                    return ((_a = this[field]) !== null && _a !== void 0 ? _a : (this[field] = this[parentId].childNodes[targetIndex]));\n                },\n            };\n        }\n        descriptors[targetId] = descriptor;\n    }\n    createView(hostBindingTarget) {\n        const fragment = this.fragment.cloneNode(true);\n        const targets = Object.create(this.proto);\n        targets.r = fragment;\n        targets.h = hostBindingTarget !== null && hostBindingTarget !== void 0 ? hostBindingTarget : warningHost;\n        for (const id of this.nodeIds) {\n            targets[id]; // trigger locator\n        }\n        return new HTMLView(fragment, this.factories, targets);\n    }\n}\nfunction compileAttributes(context, parentId, node, nodeId, nodeIndex, includeBasicValues = false) {\n    const attributes = node.attributes;\n    const directives = context.directives;\n    for (let i = 0, ii = attributes.length; i < ii; ++i) {\n        const attr = attributes[i];\n        const attrValue = attr.value;\n        const parseResult = Parser.parse(attrValue, directives);\n        let result = null;\n        if (parseResult === null) {\n            if (includeBasicValues) {\n                result = new HTMLBindingDirective(oneTime(() => attrValue, context.policy));\n                HTMLDirective.assignAspect(result, attr.name);\n            }\n        }\n        else {\n            /* eslint-disable-next-line @typescript-eslint/no-use-before-define */\n            result = Compiler.aggregate(parseResult, context.policy);\n        }\n        if (result !== null) {\n            node.removeAttributeNode(attr);\n            i--;\n            ii--;\n            context.addFactory(result, parentId, nodeId, nodeIndex, node.tagName);\n        }\n    }\n}\nfunction compileContent(context, node, parentId, nodeId, nodeIndex) {\n    const parseResult = Parser.parse(node.textContent, context.directives);\n    if (parseResult === null) {\n        next.node = node.nextSibling;\n        next.index = nodeIndex + 1;\n        return next;\n    }\n    let currentNode;\n    let lastNode = (currentNode = node);\n    for (let i = 0, ii = parseResult.length; i < ii; ++i) {\n        const currentPart = parseResult[i];\n        if (i !== 0) {\n            nodeIndex++;\n            nodeId = targetIdFrom(parentId, nodeIndex);\n            currentNode = lastNode.parentNode.insertBefore(document.createTextNode(\"\"), lastNode.nextSibling);\n        }\n        if (isString(currentPart)) {\n            currentNode.textContent = currentPart;\n        }\n        else {\n            currentNode.textContent = \" \";\n            HTMLDirective.assignAspect(currentPart);\n            context.addFactory(currentPart, parentId, nodeId, nodeIndex, null);\n        }\n        lastNode = currentNode;\n    }\n    next.index = nodeIndex + 1;\n    next.node = lastNode.nextSibling;\n    return next;\n}\nfunction compileChildren(context, parent, parentId) {\n    let nodeIndex = 0;\n    let childNode = parent.firstChild;\n    while (childNode) {\n        /* eslint-disable-next-line @typescript-eslint/no-use-before-define */\n        const result = compileNode(context, parentId, childNode, nodeIndex);\n        childNode = result.node;\n        nodeIndex = result.index;\n    }\n}\nfunction compileNode(context, parentId, node, nodeIndex) {\n    const nodeId = targetIdFrom(parentId, nodeIndex);\n    switch (node.nodeType) {\n        case 1: // element node\n            compileAttributes(context, parentId, node, nodeId, nodeIndex);\n            compileChildren(context, node, nodeId);\n            break;\n        case 3: // text node\n            return compileContent(context, node, parentId, nodeId, nodeIndex);\n        case 8: // comment\n            const parts = Parser.parse(node.data, context.directives);\n            if (parts !== null) {\n                context.addFactory(\n                /* eslint-disable-next-line @typescript-eslint/no-use-before-define */\n                Compiler.aggregate(parts), parentId, nodeId, nodeIndex, null);\n            }\n            break;\n    }\n    next.index = nodeIndex + 1;\n    next.node = node.nextSibling;\n    return next;\n}\nfunction isMarker(node, directives) {\n    return (node &&\n        node.nodeType == 8 &&\n        Parser.parse(node.data, directives) !== null);\n}\nconst templateTag = \"TEMPLATE\";\n/**\n * Common APIs related to compilation.\n * @public\n */\nexport const Compiler = {\n    /**\n     * Compiles a template and associated directives into a compilation\n     * result which can be used to create views.\n     * @param html - The html string or template element to compile.\n     * @param factories - The behavior factories referenced by the template.\n     * @param policy - The security policy to compile the html with.\n     * @remarks\n     * The template that is provided for compilation is altered in-place\n     * and cannot be compiled again. If the original template must be preserved,\n     * it is recommended that you clone the original and pass the clone to this API.\n     * @public\n     */\n    compile(html, factories, policy = DOM.policy) {\n        let template;\n        if (isString(html)) {\n            template = document.createElement(templateTag);\n            template.innerHTML = policy.createHTML(html);\n            const fec = template.content.firstElementChild;\n            if (fec !== null && fec.tagName === templateTag) {\n                template = fec;\n            }\n        }\n        else {\n            template = html;\n        }\n        if (!template.content.firstChild && !template.content.lastChild) {\n            template.content.appendChild(document.createComment(\"\"));\n        }\n        // https://bugs.chromium.org/p/chromium/issues/detail?id=1111864\n        const fragment = document.adoptNode(template.content);\n        const context = new CompilationContext(fragment, factories, policy);\n        compileAttributes(context, \"\", template, /* host */ \"h\", 0, true);\n        if (\n        // If the first node in a fragment is a marker, that means it's an unstable first node,\n        // because something like a when, repeat, etc. could add nodes before the marker.\n        // To mitigate this, we insert a stable first node. However, if we insert a node,\n        // that will alter the result of the TreeWalker. So, we also need to offset the target index.\n        isMarker(fragment.firstChild, factories) ||\n            // Or if there is only one node and a directive, it means the template's content\n            // is *only* the directive. In that case, HTMLView.dispose() misses any nodes inserted by\n            // the directive. Inserting a new node ensures proper disposal of nodes added by the directive.\n            (fragment.childNodes.length === 1 && Object.keys(factories).length > 0)) {\n            fragment.insertBefore(document.createComment(\"\"), fragment.firstChild);\n        }\n        compileChildren(context, fragment, /* root */ \"r\");\n        next.node = null; // prevent leaks\n        return context.freeze();\n    },\n    /**\n     * Sets the default compilation strategy that will be used by the ViewTemplate whenever\n     * it needs to compile a view preprocessed with the html template function.\n     * @param strategy - The compilation strategy to use when compiling templates.\n     */\n    setDefaultStrategy(strategy) {\n        this.compile = strategy;\n    },\n    /**\n     * Aggregates an array of strings and directives into a single directive.\n     * @param parts - A heterogeneous array of static strings interspersed with\n     * directives.\n     * @param policy - The security policy to use with the aggregated bindings.\n     * @returns A single inline directive that aggregates the behavior of all the parts.\n     */\n    aggregate(parts, policy = DOM.policy) {\n        if (parts.length === 1) {\n            return parts[0];\n        }\n        let sourceAspect;\n        let isVolatile = false;\n        let bindingPolicy = void 0;\n        const partCount = parts.length;\n        const finalParts = parts.map((x) => {\n            if (isString(x)) {\n                return () => x;\n            }\n            sourceAspect = x.sourceAspect || sourceAspect;\n            isVolatile = isVolatile || x.dataBinding.isVolatile;\n            bindingPolicy = bindingPolicy || x.dataBinding.policy;\n            return x.dataBinding.evaluate;\n        });\n        const expression = (scope, context) => {\n            let output = \"\";\n            for (let i = 0; i < partCount; ++i) {\n                output += finalParts[i](scope, context);\n            }\n            return output;\n        };\n        const directive = new HTMLBindingDirective(oneWay(expression, bindingPolicy !== null && bindingPolicy !== void 0 ? bindingPolicy : policy, isVolatile));\n        HTMLDirective.assignAspect(directive, sourceAspect);\n        return directive;\n    },\n};\n","import { isFunction, isString } from \"../interfaces.js\";\nimport { Binding } from \"../binding/binding.js\";\nimport { FAST, makeSerializationNoop } from \"../platform.js\";\nimport { oneWay } from \"../binding/one-way.js\";\nimport { oneTime } from \"../binding/one-time.js\";\nimport { HTMLBindingDirective } from \"./html-binding-directive.js\";\nimport { Compiler } from \"./compiler.js\";\nimport { HTMLDirective, } from \"./html-directive.js\";\nimport { nextId } from \"./markup.js\";\n// Much thanks to LitHTML for working this out!\nconst lastAttributeNameRegex = \n/* eslint-disable-next-line no-control-regex, max-len */\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\nconst noFactories = Object.create(null);\n/**\n * Inlines a template into another template.\n * @public\n */\nexport class InlineTemplateDirective {\n    /**\n     * Creates an instance of InlineTemplateDirective.\n     * @param template - The template to inline.\n     */\n    constructor(html, factories = noFactories) {\n        this.html = html;\n        this.factories = factories;\n    }\n    /**\n     * Creates HTML to be used within a template.\n     * @param add - Can be used to add  behavior factories to a template.\n     */\n    createHTML(add) {\n        const factories = this.factories;\n        for (const key in factories) {\n            add(factories[key]);\n        }\n        return this.html;\n    }\n}\n/**\n * An empty template partial.\n */\nInlineTemplateDirective.empty = new InlineTemplateDirective(\"\");\nHTMLDirective.define(InlineTemplateDirective);\nfunction createHTML(value, prevString, add, definition = HTMLDirective.getForInstance(value)) {\n    if (definition.aspected) {\n        const match = lastAttributeNameRegex.exec(prevString);\n        if (match !== null) {\n            HTMLDirective.assignAspect(value, match[2]);\n        }\n    }\n    return value.createHTML(add);\n}\n/**\n * A template capable of creating HTMLView instances or rendering directly to DOM.\n * @public\n */\nexport class ViewTemplate {\n    /**\n     * Creates an instance of ViewTemplate.\n     * @param html - The html representing what this template will instantiate, including placeholders for directives.\n     * @param factories - The directives that will be connected to placeholders in the html.\n     * @param policy - The security policy to use when compiling this template.\n     */\n    constructor(html, factories = {}, policy) {\n        this.policy = policy;\n        this.result = null;\n        this.html = html;\n        this.factories = factories;\n    }\n    /**\n     * @internal\n     */\n    compile() {\n        if (this.result === null) {\n            this.result = Compiler.compile(this.html, this.factories, this.policy);\n        }\n        return this.result;\n    }\n    /**\n     * Creates an HTMLView instance based on this template definition.\n     * @param hostBindingTarget - The element that host behaviors will be bound to.\n     */\n    create(hostBindingTarget) {\n        return this.compile().createView(hostBindingTarget);\n    }\n    /**\n     * Returns a directive that can inline the template.\n     */\n    inline() {\n        return new InlineTemplateDirective(isString(this.html) ? this.html : this.html.innerHTML, this.factories);\n    }\n    /**\n     * Sets the DOMPolicy for this template.\n     * @param policy - The policy to associated with this template.\n     * @returns The modified template instance.\n     * @remarks\n     * The DOMPolicy can only be set once for a template and cannot be\n     * set after the template is compiled.\n     */\n    withPolicy(policy) {\n        if (this.result) {\n            throw FAST.error(1208 /* Message.cannotSetTemplatePolicyAfterCompilation */);\n        }\n        if (this.policy) {\n            throw FAST.error(1207 /* Message.onlySetTemplatePolicyOnce */);\n        }\n        this.policy = policy;\n        return this;\n    }\n    /**\n     * Creates an HTMLView from this template, binds it to the source, and then appends it to the host.\n     * @param source - The data source to bind the template to.\n     * @param host - The Element where the template will be rendered.\n     * @param hostBindingTarget - An HTML element to target the host bindings at if different from the\n     * host that the template is being attached to.\n     */\n    render(source, host, hostBindingTarget) {\n        const view = this.create(hostBindingTarget);\n        view.bind(source);\n        view.appendTo(host);\n        return view;\n    }\n    /**\n     * Creates a template based on a set of static strings and dynamic values.\n     * @param strings - The static strings to create the template with.\n     * @param values - The dynamic values to create the template with.\n     * @param policy - The DOMPolicy to associated with the template.\n     * @returns A ViewTemplate.\n     * @remarks\n     * This API should not be used directly under normal circumstances because constructing\n     * a template in this way, if not done properly, can open up the application to XSS\n     * attacks. When using this API, provide a strong DOMPolicy that can properly sanitize\n     * and also be sure to manually sanitize all static strings particularly if they can\n     * come from user input.\n     */\n    static create(strings, values, policy) {\n        let html = \"\";\n        const factories = Object.create(null);\n        const add = (factory) => {\n            var _a;\n            const id = (_a = factory.id) !== null && _a !== void 0 ? _a : (factory.id = nextId());\n            factories[id] = factory;\n            return id;\n        };\n        for (let i = 0, ii = strings.length - 1; i < ii; ++i) {\n            const currentString = strings[i];\n            let currentValue = values[i];\n            let definition;\n            html += currentString;\n            if (isFunction(currentValue)) {\n                currentValue = new HTMLBindingDirective(oneWay(currentValue));\n            }\n            else if (currentValue instanceof Binding) {\n                currentValue = new HTMLBindingDirective(currentValue);\n            }\n            else if (!(definition = HTMLDirective.getForInstance(currentValue))) {\n                const staticValue = currentValue;\n                currentValue = new HTMLBindingDirective(oneTime(() => staticValue));\n            }\n            html += createHTML(currentValue, currentString, add, definition);\n        }\n        return new ViewTemplate(html + strings[strings.length - 1], factories, policy);\n    }\n}\nmakeSerializationNoop(ViewTemplate);\n/**\n * Transforms a template literal string into a ViewTemplate.\n * @param strings - The string fragments that are interpolated with the values.\n * @param values - The values that are interpolated with the string fragments.\n * @remarks\n * The html helper supports interpolation of strings, numbers, binding expressions,\n * other template instances, and Directive instances.\n * @public\n */\nexport const html = ((strings, ...values) => {\n    if (Array.isArray(strings) && Array.isArray(strings.raw)) {\n        return ViewTemplate.create(strings, values);\n    }\n    throw FAST.error(1206 /* Message.directCallToHTMLTagNotAllowed */);\n});\nhtml.partial = (html) => {\n    return new InlineTemplateDirective(html);\n};\n","import { HTMLDirective, StatelessAttachedAttributeDirective, } from \"./html-directive.js\";\n/**\n * The runtime behavior for template references.\n * @public\n */\nexport class RefDirective extends StatelessAttachedAttributeDirective {\n    /**\n     * Bind this behavior.\n     * @param controller - The view controller that manages the lifecycle of this behavior.\n     */\n    bind(controller) {\n        controller.source[this.options] = controller.targets[this.targetNodeId];\n    }\n}\nHTMLDirective.define(RefDirective);\n/**\n * A directive that observes the updates a property with a reference to the element.\n * @param propertyName - The name of the property to assign the reference to.\n * @public\n */\nexport const ref = (propertyName) => new RefDirective(propertyName);\n","import { isFunction } from \"../interfaces.js\";\nconst noTemplate = () => null;\nfunction normalizeBinding(value) {\n    return value === undefined ? noTemplate : isFunction(value) ? value : () => value;\n}\n/**\n * A directive that enables basic conditional rendering in a template.\n * @param condition - The condition to test for rendering.\n * @param templateOrTemplateBinding - The template or a binding that gets\n * the template to render when the condition is true.\n * @param elseTemplateOrTemplateBinding - Optional template or binding that that\n * gets the template to render when the conditional is false.\n * @public\n */\nexport function when(condition, templateOrTemplateBinding, elseTemplateOrTemplateBinding) {\n    const dataBinding = isFunction(condition) ? condition : () => condition;\n    const templateBinding = normalizeBinding(templateOrTemplateBinding);\n    const elseBinding = normalizeBinding(elseTemplateOrTemplateBinding);\n    return (source, context) => dataBinding(source, context)\n        ? templateBinding(source, context)\n        : elseBinding(source, context);\n}\n","import { HydrationMarkup, isHydratable } from \"../components/hydration.js\";\nimport { ArrayObserver } from \"../observation/arrays.js\";\nimport { Observable } from \"../observation/observable.js\";\nimport { emptyArray } from \"../platform.js\";\nimport { normalizeBinding } from \"../binding/normalize.js\";\nimport { HTMLDirective, } from \"./html-directive.js\";\nimport { Markup } from \"./markup.js\";\nimport { HTMLView, HydrationStage } from \"./view.js\";\nconst defaultRepeatOptions = Object.freeze({\n    positioning: false,\n    recycle: true,\n});\nfunction bindWithoutPositioning(view, items, index, controller) {\n    view.context.parent = controller.source;\n    view.context.parentContext = controller.context;\n    view.bind(items[index]);\n}\nfunction bindWithPositioning(view, items, index, controller) {\n    view.context.parent = controller.source;\n    view.context.parentContext = controller.context;\n    view.context.length = items.length;\n    view.context.index = index;\n    view.bind(items[index]);\n}\nfunction isCommentNode(node) {\n    return node.nodeType === Node.COMMENT_NODE;\n}\nexport class HydrationRepeatError extends Error {\n    constructor(\n    /**\n     * The error message\n     */\n    message, propertyBag) {\n        super(message);\n        this.propertyBag = propertyBag;\n    }\n}\n/**\n * A behavior that renders a template for each item in an array.\n * @public\n */\nexport class RepeatBehavior {\n    /**\n     * Creates an instance of RepeatBehavior.\n     * @param location - The location in the DOM to render the repeat.\n     * @param dataBinding - The array to render.\n     * @param isItemsBindingVolatile - Indicates whether the items binding has volatile dependencies.\n     * @param templateBinding - The template to render for each item.\n     * @param isTemplateBindingVolatile - Indicates whether the template binding has volatile dependencies.\n     * @param options - Options used to turn on special repeat features.\n     */\n    constructor(directive) {\n        this.directive = directive;\n        this.items = null;\n        this.itemsObserver = null;\n        this.bindView = bindWithoutPositioning;\n        /** @internal */\n        this.views = [];\n        this.itemsBindingObserver = directive.dataBinding.createObserver(this, directive);\n        this.templateBindingObserver = directive.templateBinding.createObserver(this, directive);\n        if (directive.options.positioning) {\n            this.bindView = bindWithPositioning;\n        }\n    }\n    /**\n     * Bind this behavior.\n     * @param controller - The view controller that manages the lifecycle of this behavior.\n     */\n    bind(controller) {\n        this.location = controller.targets[this.directive.targetNodeId];\n        this.controller = controller;\n        this.items = this.itemsBindingObserver.bind(controller);\n        this.template = this.templateBindingObserver.bind(controller);\n        this.observeItems(true);\n        if (isHydratable(this.template) &&\n            isHydratable(controller) &&\n            controller.hydrationStage !== HydrationStage.hydrated) {\n            this.hydrateViews(this.template);\n        }\n        else {\n            this.refreshAllViews();\n        }\n        controller.onUnbind(this);\n    }\n    /**\n     * Unbinds this behavior.\n     */\n    unbind() {\n        if (this.itemsObserver !== null) {\n            this.itemsObserver.unsubscribe(this);\n        }\n        this.unbindAllViews();\n    }\n    /**\n     * Handles changes in the array, its items, and the repeat template.\n     * @param source - The source of the change.\n     * @param args - The details about what was changed.\n     */\n    handleChange(source, args) {\n        if (args === this.itemsBindingObserver) {\n            this.items = this.itemsBindingObserver.bind(this.controller);\n            this.observeItems();\n            this.refreshAllViews();\n        }\n        else if (args === this.templateBindingObserver) {\n            this.template = this.templateBindingObserver.bind(this.controller);\n            this.refreshAllViews(true);\n        }\n        else if (!args[0]) {\n            return;\n        }\n        else if (args[0].reset) {\n            this.refreshAllViews();\n        }\n        else {\n            this.updateViews(args);\n        }\n    }\n    observeItems(force = false) {\n        if (!this.items) {\n            this.items = emptyArray;\n            return;\n        }\n        const oldObserver = this.itemsObserver;\n        const newObserver = (this.itemsObserver = Observable.getNotifier(this.items));\n        const hasNewObserver = oldObserver !== newObserver;\n        if (hasNewObserver && oldObserver !== null) {\n            oldObserver.unsubscribe(this);\n        }\n        if (hasNewObserver || force) {\n            newObserver.subscribe(this);\n        }\n    }\n    updateViews(splices) {\n        const views = this.views;\n        const bindView = this.bindView;\n        const items = this.items;\n        const template = this.template;\n        const controller = this.controller;\n        const recycle = this.directive.options.recycle;\n        const leftoverViews = [];\n        let leftoverIndex = 0;\n        let availableViews = 0;\n        for (let i = 0, ii = splices.length; i < ii; ++i) {\n            const splice = splices[i];\n            const removed = splice.removed;\n            let removeIndex = 0;\n            let addIndex = splice.index;\n            const end = addIndex + splice.addedCount;\n            const removedViews = views.splice(splice.index, removed.length);\n            const totalAvailableViews = (availableViews =\n                leftoverViews.length + removedViews.length);\n            for (; addIndex < end; ++addIndex) {\n                const neighbor = views[addIndex];\n                const location = neighbor ? neighbor.firstChild : this.location;\n                let view;\n                if (recycle && availableViews > 0) {\n                    if (removeIndex <= totalAvailableViews && removedViews.length > 0) {\n                        view = removedViews[removeIndex];\n                        removeIndex++;\n                    }\n                    else {\n                        view = leftoverViews[leftoverIndex];\n                        leftoverIndex++;\n                    }\n                    availableViews--;\n                }\n                else {\n                    view = template.create();\n                }\n                views.splice(addIndex, 0, view);\n                bindView(view, items, addIndex, controller);\n                view.insertBefore(location);\n            }\n            if (removedViews[removeIndex]) {\n                leftoverViews.push(...removedViews.slice(removeIndex));\n            }\n        }\n        for (let i = leftoverIndex, ii = leftoverViews.length; i < ii; ++i) {\n            leftoverViews[i].dispose();\n        }\n        if (this.directive.options.positioning) {\n            for (let i = 0, viewsLength = views.length; i < viewsLength; ++i) {\n                const context = views[i].context;\n                context.length = viewsLength;\n                context.index = i;\n            }\n        }\n    }\n    refreshAllViews(templateChanged = false) {\n        const items = this.items;\n        const template = this.template;\n        const location = this.location;\n        const bindView = this.bindView;\n        const controller = this.controller;\n        let itemsLength = items.length;\n        let views = this.views;\n        let viewsLength = views.length;\n        if (itemsLength === 0 || templateChanged || !this.directive.options.recycle) {\n            // all views need to be removed\n            HTMLView.disposeContiguousBatch(views);\n            viewsLength = 0;\n        }\n        if (viewsLength === 0) {\n            // all views need to be created\n            this.views = views = new Array(itemsLength);\n            for (let i = 0; i < itemsLength; ++i) {\n                const view = template.create();\n                bindView(view, items, i, controller);\n                views[i] = view;\n                view.insertBefore(location);\n            }\n        }\n        else {\n            // attempt to reuse existing views with new data\n            let i = 0;\n            for (; i < itemsLength; ++i) {\n                if (i < viewsLength) {\n                    const view = views[i];\n                    if (!view) {\n                        const serializer = new XMLSerializer();\n                        throw new HydrationRepeatError(`View is null or undefined inside \"${this.location.getRootNode().host.nodeName}\".`, {\n                            index: i,\n                            hydrationStage: this.controller\n                                .hydrationStage,\n                            itemsLength,\n                            viewsState: views.map(v => (v ? \"hydrated\" : \"empty\")),\n                            viewTemplateString: serializer.serializeToString(template.create().fragment),\n                            rootNodeContent: serializer.serializeToString(this.location.getRootNode()),\n                        });\n                    }\n                    bindView(view, items, i, controller);\n                }\n                else {\n                    const view = template.create();\n                    bindView(view, items, i, controller);\n                    views.push(view);\n                    view.insertBefore(location);\n                }\n            }\n            const removed = views.splice(i, viewsLength - i);\n            for (i = 0, itemsLength = removed.length; i < itemsLength; ++i) {\n                removed[i].dispose();\n            }\n        }\n    }\n    unbindAllViews() {\n        const views = this.views;\n        for (let i = 0, ii = views.length; i < ii; ++i) {\n            const view = views[i];\n            if (!view) {\n                const serializer = new XMLSerializer();\n                throw new HydrationRepeatError(`View is null or undefined inside \"${this.location.getRootNode().host.nodeName}\".`, {\n                    index: i,\n                    hydrationStage: this.controller.hydrationStage,\n                    viewsState: views.map(v => (v ? \"hydrated\" : \"empty\")),\n                    rootNodeContent: serializer.serializeToString(this.location.getRootNode()),\n                });\n            }\n            view.unbind();\n        }\n    }\n    hydrateViews(template) {\n        if (!this.items) {\n            return;\n        }\n        this.views = new Array(this.items.length);\n        let current = this.location.previousSibling;\n        while (current !== null) {\n            if (!isCommentNode(current)) {\n                current = current.previousSibling;\n                continue;\n            }\n            const index = HydrationMarkup.parseRepeatEndMarker(current.data);\n            if (index === null) {\n                current = current.previousSibling;\n                continue;\n            }\n            current.data = \"\";\n            // end of repeat is the previousSibling of end comment\n            const end = current.previousSibling;\n            if (!end) {\n                throw new Error(`Error when hydrating inside \"${this.location.getRootNode().host.nodeName}\": end should never be null.`);\n            }\n            // find start marker\n            let start = end;\n            // How many unmatched end markers we've encountered\n            let unmatchedEndMarkers = 0;\n            while (start !== null) {\n                if (isCommentNode(start)) {\n                    if (HydrationMarkup.isRepeatViewEndMarker(start.data)) {\n                        unmatchedEndMarkers++;\n                    }\n                    else if (HydrationMarkup.isRepeatViewStartMarker(start.data)) {\n                        if (unmatchedEndMarkers) {\n                            unmatchedEndMarkers--;\n                        }\n                        else {\n                            if (HydrationMarkup.parseRepeatStartMarker(start.data) !==\n                                index) {\n                                throw new Error(`Error when hydrating inside \"${this.location.getRootNode().host\n                                    .nodeName}\": Mismatched start and end markers.`);\n                            }\n                            start.data = \"\";\n                            current = start.previousSibling;\n                            // start of repeat content is the nextSibling of start comment\n                            start = start.nextSibling;\n                            const view = template.hydrate(start, end);\n                            this.views[index] = view;\n                            this.bindView(view, this.items, index, this.controller);\n                            break;\n                        }\n                    }\n                }\n                start = start.previousSibling;\n            }\n            if (!start) {\n                throw new Error(`Error when hydrating inside \"${this.location.getRootNode().host.nodeName}\": start should never be null.`);\n            }\n        }\n    }\n}\n/**\n * A directive that configures list rendering.\n * @public\n */\nexport class RepeatDirective {\n    /**\n     * Creates an instance of RepeatDirective.\n     * @param dataBinding - The binding that provides the array to render.\n     * @param templateBinding - The template binding used to obtain a template to render for each item in the array.\n     * @param options - Options used to turn on special repeat features.\n     */\n    constructor(dataBinding, templateBinding, options) {\n        this.dataBinding = dataBinding;\n        this.templateBinding = templateBinding;\n        this.options = options;\n        ArrayObserver.enable();\n    }\n    /**\n     * Creates a placeholder string based on the directive's index within the template.\n     * @param index - The index of the directive within the template.\n     */\n    createHTML(add) {\n        return Markup.comment(add(this));\n    }\n    /**\n     * Creates a behavior for the provided target node.\n     * @param target - The node instance to create the behavior for.\n     */\n    createBehavior() {\n        return new RepeatBehavior(this);\n    }\n}\nHTMLDirective.define(RepeatDirective);\n/**\n * A directive that enables list rendering.\n * @param items - The array to render.\n * @param template - The template or a template binding used obtain a template\n * to render for each item in the array.\n * @param options - Options used to turn on special repeat features.\n * @public\n */\nexport function repeat(items, template, options = defaultRepeatOptions) {\n    const dataBinding = normalizeBinding(items);\n    const templateBinding = normalizeBinding(template);\n    return new RepeatDirective(dataBinding, templateBinding, Object.assign(Object.assign({}, defaultRepeatOptions), options));\n}\n","import { emptyArray } from \"../platform.js\";\nimport { StatelessAttachedAttributeDirective } from \"./html-directive.js\";\nconst selectElements = (value) => value.nodeType === 1;\n/**\n * Creates a function that can be used to filter a Node array, selecting only elements.\n * @param selector - An optional selector to restrict the filter to.\n * @public\n */\nexport const elements = (selector) => selector\n    ? value => value.nodeType === 1 && value.matches(selector)\n    : selectElements;\n/**\n * A base class for node observation.\n * @public\n * @remarks\n * Internally used by the SlottedDirective and the ChildrenDirective.\n */\nexport class NodeObservationDirective extends StatelessAttachedAttributeDirective {\n    /**\n     * The unique id of the factory.\n     */\n    get id() {\n        return this._id;\n    }\n    set id(value) {\n        this._id = value;\n        this._controllerProperty = `${value}-c`;\n    }\n    /**\n     * Bind this behavior to the source.\n     * @param source - The source to bind to.\n     * @param context - The execution context that the binding is operating within.\n     * @param targets - The targets that behaviors in a view can attach to.\n     */\n    bind(controller) {\n        const target = controller.targets[this.targetNodeId];\n        target[this._controllerProperty] = controller;\n        this.updateTarget(controller.source, this.computeNodes(target));\n        this.observe(target);\n        controller.onUnbind(this);\n    }\n    /**\n     * Unbinds this behavior from the source.\n     * @param source - The source to unbind from.\n     * @param context - The execution context that the binding is operating within.\n     * @param targets - The targets that behaviors in a view can attach to.\n     */\n    unbind(controller) {\n        const target = controller.targets[this.targetNodeId];\n        this.updateTarget(controller.source, emptyArray);\n        this.disconnect(target);\n        target[this._controllerProperty] = null;\n    }\n    /**\n     * Gets the data source for the target.\n     * @param target - The target to get the source for.\n     * @returns The source.\n     */\n    getSource(target) {\n        return target[this._controllerProperty].source;\n    }\n    /**\n     * Updates the source property with the computed nodes.\n     * @param source - The source object to assign the nodes property to.\n     * @param value - The nodes to assign to the source object property.\n     */\n    updateTarget(source, value) {\n        source[this.options.property] = value;\n    }\n    /**\n     * Computes the set of nodes that should be assigned to the source property.\n     * @param target - The target to compute the nodes for.\n     * @returns The computed nodes.\n     * @remarks\n     * Applies filters if provided.\n     */\n    computeNodes(target) {\n        let nodes = this.getNodes(target);\n        if (\"filter\" in this.options) {\n            nodes = nodes.filter(this.options.filter);\n        }\n        return nodes;\n    }\n}\n","import { isString } from \"../interfaces.js\";\nimport { HTMLDirective } from \"./html-directive.js\";\nimport { NodeObservationDirective } from \"./node-observation.js\";\nconst slotEvent = \"slotchange\";\n/**\n * The runtime behavior for slotted node observation.\n * @public\n */\nexport class SlottedDirective extends NodeObservationDirective {\n    /**\n     * Begins observation of the nodes.\n     * @param target - The target to observe.\n     */\n    observe(target) {\n        target.addEventListener(slotEvent, this);\n    }\n    /**\n     * Disconnects observation of the nodes.\n     * @param target - The target to unobserve.\n     */\n    disconnect(target) {\n        target.removeEventListener(slotEvent, this);\n    }\n    /**\n     * Retrieves the raw nodes that should be assigned to the source property.\n     * @param target - The target to get the node to.\n     */\n    getNodes(target) {\n        return target.assignedNodes(this.options);\n    }\n    /** @internal */\n    handleEvent(event) {\n        const target = event.currentTarget;\n        this.updateTarget(this.getSource(target), this.computeNodes(target));\n    }\n}\nHTMLDirective.define(SlottedDirective);\n/**\n * A directive that observes the `assignedNodes()` of a slot and updates a property\n * whenever they change.\n * @param propertyOrOptions - The options used to configure slotted node observation.\n * @public\n */\nexport function slotted(propertyOrOptions) {\n    if (isString(propertyOrOptions)) {\n        propertyOrOptions = { property: propertyOrOptions };\n    }\n    return new SlottedDirective(propertyOrOptions);\n}\n","import { isString, noop } from \"../interfaces.js\";\nimport { HTMLDirective } from \"./html-directive.js\";\nimport { NodeObservationDirective } from \"./node-observation.js\";\n/**\n * The runtime behavior for child node observation.\n * @public\n */\nexport class ChildrenDirective extends NodeObservationDirective {\n    /**\n     * Creates an instance of ChildrenDirective.\n     * @param options - The options to use in configuring the child observation behavior.\n     */\n    constructor(options) {\n        super(options);\n        this.observerProperty = Symbol();\n        this.handleEvent = (mutations, observer) => {\n            const target = observer.target;\n            this.updateTarget(this.getSource(target), this.computeNodes(target));\n        };\n        options.childList = true;\n    }\n    /**\n     * Begins observation of the nodes.\n     * @param target - The target to observe.\n     */\n    observe(target) {\n        let observer = target[this.observerProperty];\n        if (!observer) {\n            observer = new MutationObserver(this.handleEvent);\n            observer.toJSON = noop;\n            target[this.observerProperty] = observer;\n        }\n        observer.target = target;\n        observer.observe(target, this.options);\n    }\n    /**\n     * Disconnects observation of the nodes.\n     * @param target - The target to unobserve.\n     */\n    disconnect(target) {\n        const observer = target[this.observerProperty];\n        observer.target = null;\n        observer.disconnect();\n    }\n    /**\n     * Retrieves the raw nodes that should be assigned to the source property.\n     * @param target - The target to get the node to.\n     */\n    getNodes(target) {\n        if (\"selector\" in this.options) {\n            return Array.from(target.querySelectorAll(this.options.selector));\n        }\n        return Array.from(target.childNodes);\n    }\n}\nHTMLDirective.define(ChildrenDirective);\n/**\n * A directive that observes the `childNodes` of an element and updates a property\n * whenever they change.\n * @param propertyOrOptions - The options used to configure child node observation.\n * @public\n */\nexport function children(propertyOrOptions) {\n    if (isString(propertyOrOptions)) {\n        propertyOrOptions = {\n            property: propertyOrOptions,\n        };\n    }\n    return new ChildrenDirective(propertyOrOptions);\n}\n","import { Observable } from \"../observation/observable.js\";\nimport { isString } from \"../interfaces.js\";\nimport { Updates } from \"../observation/update-queue.js\";\nimport { DOM } from \"../dom.js\";\nimport { createMetadataLocator } from \"../platform.js\";\nconst booleanMode = \"boolean\";\nconst reflectMode = \"reflect\";\n/**\n * Metadata used to configure a custom attribute's behavior.\n * @public\n */\nexport const AttributeConfiguration = Object.freeze({\n    /**\n     * Locates all attribute configurations associated with a type.\n     */\n    locate: createMetadataLocator(),\n});\n/**\n * A {@link ValueConverter} that converts to and from `boolean` values.\n * @remarks\n * Used automatically when the `boolean` {@link AttributeMode} is selected.\n * @public\n */\nexport const booleanConverter = {\n    toView(value) {\n        return value ? \"true\" : \"false\";\n    },\n    fromView(value) {\n        return !(value === null ||\n            value === void 0 ||\n            value === \"false\" ||\n            value === false ||\n            value === 0);\n    },\n};\n/**\n * A {@link ValueConverter} that converts to and from `boolean` values. `null`, `undefined`, `\"\"`,\n * and `void` values are converted to `null`.\n * @public\n */\nexport const nullableBooleanConverter = {\n    toView(value) {\n        return typeof value === \"boolean\" ? value.toString() : \"\";\n    },\n    fromView(value) {\n        return [null, undefined, void 0].includes(value)\n            ? null\n            : booleanConverter.fromView(value);\n    },\n};\nfunction toNumber(value) {\n    if (value === null || value === undefined) {\n        return null;\n    }\n    const number = value * 1;\n    return isNaN(number) ? null : number;\n}\n/**\n * A {@link ValueConverter} that converts to and from `number` values.\n * @remarks\n * This converter allows for nullable numbers, returning `null` if the\n * input was `null`, `undefined`, or `NaN`.\n * @public\n */\nexport const nullableNumberConverter = {\n    toView(value) {\n        const output = toNumber(value);\n        return output ? output.toString() : output;\n    },\n    fromView: toNumber,\n};\n/**\n * An implementation of {@link Accessor} that supports reactivity,\n * change callbacks, attribute reflection, and type conversion for\n * custom elements.\n * @public\n */\nexport class AttributeDefinition {\n    /**\n     * Creates an instance of AttributeDefinition.\n     * @param Owner - The class constructor that owns this attribute.\n     * @param name - The name of the property associated with the attribute.\n     * @param attribute - The name of the attribute in HTML.\n     * @param mode - The {@link AttributeMode} that describes the behavior of this attribute.\n     * @param converter - A {@link ValueConverter} that integrates with the property getter/setter\n     * to convert values to and from a DOM string.\n     */\n    constructor(Owner, name, attribute = name.toLowerCase(), mode = reflectMode, converter) {\n        this.guards = new Set();\n        this.Owner = Owner;\n        this.name = name;\n        this.attribute = attribute;\n        this.mode = mode;\n        this.converter = converter;\n        this.fieldName = `_${name}`;\n        this.callbackName = `${name}Changed`;\n        this.hasCallback = this.callbackName in Owner.prototype;\n        if (mode === booleanMode && converter === void 0) {\n            this.converter = booleanConverter;\n        }\n    }\n    /**\n     * Sets the value of the attribute/property on the source element.\n     * @param source - The source element to access.\n     * @param newValue - The value to set the attribute/property to.\n     */\n    setValue(source, newValue) {\n        const oldValue = source[this.fieldName];\n        const converter = this.converter;\n        if (converter !== void 0) {\n            newValue = converter.fromView(newValue);\n        }\n        if (oldValue !== newValue) {\n            source[this.fieldName] = newValue;\n            this.tryReflectToAttribute(source);\n            if (this.hasCallback) {\n                source[this.callbackName](oldValue, newValue);\n            }\n            source.$fastController.notify(this.name);\n        }\n    }\n    /**\n     * Gets the value of the attribute/property on the source element.\n     * @param source - The source element to access.\n     */\n    getValue(source) {\n        Observable.track(source, this.name);\n        return source[this.fieldName];\n    }\n    /** @internal */\n    onAttributeChangedCallback(element, value) {\n        if (this.guards.has(element)) {\n            return;\n        }\n        this.guards.add(element);\n        this.setValue(element, value);\n        this.guards.delete(element);\n    }\n    tryReflectToAttribute(element) {\n        const mode = this.mode;\n        const guards = this.guards;\n        if (guards.has(element) || mode === \"fromView\") {\n            return;\n        }\n        Updates.enqueue(() => {\n            guards.add(element);\n            const latestValue = element[this.fieldName];\n            switch (mode) {\n                case reflectMode:\n                    const converter = this.converter;\n                    DOM.setAttribute(element, this.attribute, converter !== void 0 ? converter.toView(latestValue) : latestValue);\n                    break;\n                case booleanMode:\n                    DOM.setBooleanAttribute(element, this.attribute, latestValue);\n                    break;\n            }\n            guards.delete(element);\n        });\n    }\n    /**\n     * Collects all attribute definitions associated with the owner.\n     * @param Owner - The class constructor to collect attribute for.\n     * @param attributeLists - Any existing attributes to collect and merge with those associated with the owner.\n     * @internal\n     */\n    static collect(Owner, ...attributeLists) {\n        const attributes = [];\n        attributeLists.push(AttributeConfiguration.locate(Owner));\n        for (let i = 0, ii = attributeLists.length; i < ii; ++i) {\n            const list = attributeLists[i];\n            if (list === void 0) {\n                continue;\n            }\n            for (let j = 0, jj = list.length; j < jj; ++j) {\n                const config = list[j];\n                if (isString(config)) {\n                    attributes.push(new AttributeDefinition(Owner, config));\n                }\n                else {\n                    attributes.push(new AttributeDefinition(Owner, config.property, config.attribute, config.mode, config.converter));\n                }\n            }\n        }\n        return attributes;\n    }\n}\nexport function attr(configOrTarget, prop) {\n    let config;\n    function decorator($target, $prop) {\n        if (arguments.length > 1) {\n            // Non invocation:\n            // - @attr\n            // Invocation with or w/o opts:\n            // - @attr()\n            // - @attr({...opts})\n            config.property = $prop;\n        }\n        AttributeConfiguration.locate($target.constructor).push(config);\n    }\n    if (arguments.length > 1) {\n        // Non invocation:\n        // - @attr\n        config = {};\n        decorator(configOrTarget, prop);\n        return;\n    }\n    // Invocation with or w/o opts:\n    // - @attr()\n    // - @attr({...opts})\n    config = configOrTarget === void 0 ? {} : configOrTarget;\n    return decorator;\n}\n","import { isString, KernelServiceId } from \"../interfaces.js\";\nimport { Observable } from \"../observation/observable.js\";\nimport { createTypeRegistry, FAST } from \"../platform.js\";\nimport { ElementStyles } from \"../styles/element-styles.js\";\nimport { AttributeDefinition } from \"./attributes.js\";\nconst defaultShadowOptions = { mode: \"open\" };\nconst defaultElementOptions = {};\nconst fastElementBaseTypes = new Set();\nconst fastElementRegistry = FAST.getById(KernelServiceId.elementRegistry, () => createTypeRegistry());\n/**\n * Defines metadata for a FASTElement.\n * @public\n */\nexport class FASTElementDefinition {\n    constructor(type, nameOrConfig = type.definition) {\n        var _a;\n        this.platformDefined = false;\n        if (isString(nameOrConfig)) {\n            nameOrConfig = { name: nameOrConfig };\n        }\n        this.type = type;\n        this.name = nameOrConfig.name;\n        this.template = nameOrConfig.template;\n        this.registry = (_a = nameOrConfig.registry) !== null && _a !== void 0 ? _a : customElements;\n        const proto = type.prototype;\n        const attributes = AttributeDefinition.collect(type, nameOrConfig.attributes);\n        const observedAttributes = new Array(attributes.length);\n        const propertyLookup = {};\n        const attributeLookup = {};\n        for (let i = 0, ii = attributes.length; i < ii; ++i) {\n            const current = attributes[i];\n            observedAttributes[i] = current.attribute;\n            propertyLookup[current.name] = current;\n            attributeLookup[current.attribute] = current;\n            Observable.defineProperty(proto, current);\n        }\n        Reflect.defineProperty(type, \"observedAttributes\", {\n            value: observedAttributes,\n            enumerable: true,\n        });\n        this.attributes = attributes;\n        this.propertyLookup = propertyLookup;\n        this.attributeLookup = attributeLookup;\n        this.shadowOptions =\n            nameOrConfig.shadowOptions === void 0\n                ? defaultShadowOptions\n                : nameOrConfig.shadowOptions === null\n                    ? void 0\n                    : Object.assign(Object.assign({}, defaultShadowOptions), nameOrConfig.shadowOptions);\n        this.elementOptions =\n            nameOrConfig.elementOptions === void 0\n                ? defaultElementOptions\n                : Object.assign(Object.assign({}, defaultElementOptions), nameOrConfig.elementOptions);\n        this.styles = ElementStyles.normalize(nameOrConfig.styles);\n        fastElementRegistry.register(this);\n    }\n    /**\n     * Indicates if this element has been defined in at least one registry.\n     */\n    get isDefined() {\n        return this.platformDefined;\n    }\n    /**\n     * Defines a custom element based on this definition.\n     * @param registry - The element registry to define the element in.\n     * @remarks\n     * This operation is idempotent per registry.\n     */\n    define(registry = this.registry) {\n        const type = this.type;\n        if (!registry.get(this.name)) {\n            this.platformDefined = true;\n            registry.define(this.name, type, this.elementOptions);\n        }\n        return this;\n    }\n    /**\n     * Creates an instance of FASTElementDefinition.\n     * @param type - The type this definition is being created for.\n     * @param nameOrDef - The name of the element to define or a config object\n     * that describes the element to define.\n     */\n    static compose(type, nameOrDef) {\n        if (fastElementBaseTypes.has(type) || fastElementRegistry.getByType(type)) {\n            return new FASTElementDefinition(class extends type {\n            }, nameOrDef);\n        }\n        return new FASTElementDefinition(type, nameOrDef);\n    }\n    /**\n     * Registers a FASTElement base type.\n     * @param type - The type to register as a base type.\n     * @internal\n     */\n    static registerBaseType(type) {\n        fastElementBaseTypes.add(type);\n    }\n}\n/**\n * Gets the element definition associated with the specified type.\n * @param type - The custom element type to retrieve the definition for.\n */\nFASTElementDefinition.getByType = fastElementRegistry.getByType;\n/**\n * Gets the element definition associated with the instance.\n * @param instance - The custom element instance to retrieve the definition for.\n */\nFASTElementDefinition.getForInstance = fastElementRegistry.getForInstance;\n","import { FASTElementDefinition } from \"../components/fast-definitions.js\";\nimport { isHydratable } from \"../components/hydration.js\";\nimport { isFunction, isString } from \"../interfaces.js\";\nimport { Binding } from \"../binding/binding.js\";\nimport { oneTime } from \"../binding/one-time.js\";\nimport { oneWay } from \"../binding/one-way.js\";\nimport { normalizeBinding } from \"../binding/normalize.js\";\nimport { HTMLDirective, } from \"./html-directive.js\";\nimport { Markup } from \"./markup.js\";\nimport { html, ViewTemplate, } from \"./template.js\";\nimport { HydrationStage } from \"./view.js\";\n/**\n * A Behavior that enables advanced rendering.\n * @public\n */\nexport class RenderBehavior {\n    /**\n     * Creates an instance of RenderBehavior.\n     * @param directive - The render directive that created this behavior.\n     */\n    constructor(directive) {\n        this.directive = directive;\n        this.location = null;\n        this.controller = null;\n        this.view = null;\n        this.data = null;\n        this.dataBindingObserver = directive.dataBinding.createObserver(this, directive);\n        this.templateBindingObserver = directive.templateBinding.createObserver(this, directive);\n    }\n    /**\n     * Bind this behavior.\n     * @param controller - The view controller that manages the lifecycle of this behavior.\n     */\n    bind(controller) {\n        this.location = controller.targets[this.directive.targetNodeId];\n        this.controller = controller;\n        this.data = this.dataBindingObserver.bind(controller);\n        this.template = this.templateBindingObserver.bind(controller);\n        controller.onUnbind(this);\n        if (isHydratable(this.template) &&\n            isHydratable(controller) &&\n            controller.hydrationStage !== HydrationStage.hydrated &&\n            !this.view) {\n            const viewNodes = controller.bindingViewBoundaries[this.directive.targetNodeId];\n            if (viewNodes) {\n                this.view = this.template.hydrate(viewNodes.first, viewNodes.last);\n                this.bindView(this.view);\n            }\n        }\n        else {\n            this.refreshView();\n        }\n    }\n    /**\n     * Unbinds this behavior.\n     * @param controller - The view controller that manages the lifecycle of this behavior.\n     */\n    unbind(controller) {\n        const view = this.view;\n        if (view !== null && view.isComposed) {\n            view.unbind();\n            view.needsBindOnly = true;\n        }\n    }\n    /** @internal */\n    handleChange(source, observer) {\n        if (observer === this.dataBindingObserver) {\n            this.data = this.dataBindingObserver.bind(this.controller);\n        }\n        if (this.directive.templateBindingDependsOnData ||\n            observer === this.templateBindingObserver) {\n            this.template = this.templateBindingObserver.bind(this.controller);\n        }\n        this.refreshView();\n    }\n    bindView(view) {\n        // It's possible that the value is the same as the previous template\n        // and that there's actually no need to compose it.\n        if (!view.isComposed) {\n            view.isComposed = true;\n            view.bind(this.data);\n            view.insertBefore(this.location);\n            view.$fastTemplate = this.template;\n        }\n        else if (view.needsBindOnly) {\n            view.needsBindOnly = false;\n            view.bind(this.data);\n        }\n    }\n    refreshView() {\n        let view = this.view;\n        const template = this.template;\n        if (view === null) {\n            this.view = view = template.create();\n            this.view.context.parent = this.controller.source;\n            this.view.context.parentContext = this.controller.context;\n        }\n        else {\n            // If there is a previous view, but it wasn't created\n            // from the same template as the new value, then we\n            // need to remove the old view if it's still in the DOM\n            // and create a new view from the template.\n            if (view.$fastTemplate !== template) {\n                if (view.isComposed) {\n                    view.remove();\n                    view.unbind();\n                }\n                this.view = view = template.create();\n                this.view.context.parent = this.controller.source;\n                this.view.context.parentContext = this.controller.context;\n            }\n        }\n        this.bindView(view);\n    }\n}\n/**\n * A Directive that enables use of the RenderBehavior.\n * @public\n */\nexport class RenderDirective {\n    /**\n     * Creates an instance of RenderDirective.\n     * @param dataBinding - A binding expression that returns the data to render.\n     * @param templateBinding - A binding expression that returns the template to use to render the data.\n     */\n    constructor(dataBinding, templateBinding, templateBindingDependsOnData) {\n        this.dataBinding = dataBinding;\n        this.templateBinding = templateBinding;\n        this.templateBindingDependsOnData = templateBindingDependsOnData;\n    }\n    /**\n     * Creates HTML to be used within a template.\n     * @param add - Can be used to add  behavior factories to a template.\n     */\n    createHTML(add) {\n        return Markup.comment(add(this));\n    }\n    /**\n     * Creates a behavior.\n     * @param targets - The targets available for behaviors to be attached to.\n     */\n    createBehavior() {\n        return new RenderBehavior(this);\n    }\n}\nHTMLDirective.define(RenderDirective);\nfunction isElementRenderOptions(object) {\n    return !!object.element || !!object.tagName;\n}\nconst typeToInstructionLookup = new Map();\n/* eslint @typescript-eslint/naming-convention: \"off\"*/\nconst defaultAttributes = { \":model\": (x) => x };\nconst brand = Symbol(\"RenderInstruction\");\nconst defaultViewName = \"default-view\";\nconst nullTemplate = html `\n    &nbsp;\n`;\nfunction instructionToTemplate(def) {\n    if (def === void 0) {\n        return nullTemplate;\n    }\n    return def.template;\n}\nfunction createElementTemplate(tagName, options) {\n    const markup = [];\n    const values = [];\n    const { attributes, directives, content, policy } = options !== null && options !== void 0 ? options : {};\n    markup.push(`<${tagName}`);\n    if (attributes) {\n        const attrNames = Object.getOwnPropertyNames(attributes);\n        for (let i = 0, ii = attrNames.length; i < ii; ++i) {\n            const name = attrNames[i];\n            if (i === 0) {\n                markup[0] = `${markup[0]} ${name}=\"`;\n            }\n            else {\n                markup.push(`\" ${name}=\"`);\n            }\n            values.push(attributes[name]);\n        }\n        markup.push(`\"`);\n    }\n    if (directives) {\n        markup[markup.length - 1] += \" \";\n        for (let i = 0, ii = directives.length; i < ii; ++i) {\n            const directive = directives[i];\n            markup.push(i > 0 ? \"\" : \" \");\n            values.push(directive);\n        }\n    }\n    markup[markup.length - 1] += \">\";\n    if (content && isFunction(content.create)) {\n        values.push(content);\n        markup.push(`</${tagName}>`);\n    }\n    else {\n        const lastIndex = markup.length - 1;\n        markup[lastIndex] = `${markup[lastIndex]}${content !== null && content !== void 0 ? content : \"\"}</${tagName}>`;\n    }\n    return ViewTemplate.create(markup, values, policy);\n}\nfunction create(options) {\n    var _a;\n    const name = (_a = options.name) !== null && _a !== void 0 ? _a : defaultViewName;\n    let template;\n    if (isElementRenderOptions(options)) {\n        let tagName = options.tagName;\n        if (!tagName) {\n            const def = FASTElementDefinition.getByType(options.element);\n            if (def) {\n                tagName = def.name;\n            }\n            else {\n                throw new Error(\"Invalid element for model rendering.\");\n            }\n        }\n        if (!options.attributes) {\n            options.attributes = defaultAttributes;\n        }\n        template = createElementTemplate(tagName, options);\n    }\n    else {\n        template = options.template;\n    }\n    return {\n        brand,\n        type: options.type,\n        name,\n        template,\n    };\n}\nfunction instanceOf(object) {\n    return object && object.brand === brand;\n}\nfunction register(optionsOrInstruction) {\n    let lookup = typeToInstructionLookup.get(optionsOrInstruction.type);\n    if (lookup === void 0) {\n        typeToInstructionLookup.set(optionsOrInstruction.type, (lookup = Object.create(null)));\n    }\n    const instruction = instanceOf(optionsOrInstruction)\n        ? optionsOrInstruction\n        : create(optionsOrInstruction);\n    return (lookup[instruction.name] = instruction);\n}\nfunction getByType(type, name) {\n    const entries = typeToInstructionLookup.get(type);\n    if (entries === void 0) {\n        return void 0;\n    }\n    return entries[name !== null && name !== void 0 ? name : defaultViewName];\n}\nfunction getForInstance(object, name) {\n    if (object) {\n        return getByType(object.constructor, name);\n    }\n    return void 0;\n}\n/**\n * Provides APIs for creating and interacting with render instructions.\n * @public\n */\nexport const RenderInstruction = Object.freeze({\n    /**\n     * Checks whether the provided object is a RenderInstruction.\n     * @param object - The object to check.\n     * @returns true if the object is a RenderInstruction; false otherwise\n     */\n    instanceOf,\n    /**\n     * Creates a RenderInstruction for a set of options.\n     * @param options - The options to use when creating the RenderInstruction.\n     * @remarks\n     * This API should be used with caution. When providing attributes or content,\n     * if not done properly, you can open up the application to XSS attacks. When using this API,\n     * provide a strong DOMPolicy that can properly sanitize and also be sure to manually sanitize\n     * content and attribute values particularly if they can come from user input.\n     */\n    create,\n    /**\n     * Creates a template based on a tag name.\n     * @param tagName - The tag name to use when creating the template.\n     * @param attributes - The attributes to apply to the element.\n     * @param content - The content to insert into the element.\n     * @param policy - The DOMPolicy to create the template with.\n     * @returns A template based on the provided specifications.\n     * @remarks\n     * This API should be used with caution. When providing attributes or content,\n     * if not done properly, you can open up the application to XSS attacks. When using this API,\n     * provide a strong DOMPolicy that can properly sanitize and also be sure to manually sanitize\n     * content and attribute values particularly if they can come from user input.\n     */\n    createElementTemplate,\n    /**\n     * Creates and registers an instruction.\n     * @param options The options to use when creating the RenderInstruction.\n     * @remarks\n     * A previously created RenderInstruction can also be registered.\n     */\n    register,\n    /**\n     * Finds a previously registered RenderInstruction by type and optionally by name.\n     * @param type - The type to retrieve the RenderInstruction for.\n     * @param name - An optional name used in differentiating between multiple registered instructions.\n     * @returns The located RenderInstruction that matches the criteria or undefined if none is found.\n     */\n    getByType,\n    /**\n     * Finds a previously registered RenderInstruction for the instance's type and optionally by name.\n     * @param object - The instance to retrieve the RenderInstruction for.\n     * @param name - An optional name used in differentiating between multiple registered instructions.\n     * @returns The located RenderInstruction that matches the criteria or undefined if none is found.\n     */\n    getForInstance,\n});\nexport function renderWith(value, name) {\n    return function (type) {\n        if (isFunction(value)) {\n            register({ type, element: value, name });\n        }\n        else if (isFunction(value.create)) {\n            register({ type, template: value, name });\n        }\n        else {\n            register(Object.assign({ type }, value));\n        }\n    };\n}\n/**\n * @internal\n */\nexport class NodeTemplate {\n    constructor(node) {\n        this.node = node;\n        node.$fastTemplate = this;\n    }\n    get context() {\n        // HACK\n        return this;\n    }\n    bind(source) { }\n    unbind() { }\n    insertBefore(refNode) {\n        refNode.parentNode.insertBefore(this.node, refNode);\n    }\n    remove() {\n        this.node.parentNode.removeChild(this.node);\n    }\n    create() {\n        return this;\n    }\n    hydrate(first, last) {\n        return this;\n    }\n}\n/**\n * Creates a RenderDirective for use in advanced rendering scenarios.\n * @param value - The binding expression that returns the data to be rendered. The expression\n * can also return a Node to render directly.\n * @param template - A template to render the data with\n * or a string to indicate which RenderInstruction to use when looking up a RenderInstruction.\n * Expressions can also be provided to dynamically determine either the template or the name.\n * @returns A RenderDirective suitable for use in a template.\n * @remarks\n * If no binding is provided, then a default binding that returns the source is created.\n * If no template is provided, then a binding is created that will use registered\n * RenderInstructions to determine the view.\n * If the template binding returns a string, then it will be used to look up a\n * RenderInstruction to determine the view.\n * @public\n */\nexport function render(value, template) {\n    let dataBinding;\n    if (value === void 0) {\n        dataBinding = oneTime((source) => source);\n    }\n    else {\n        dataBinding = normalizeBinding(value);\n    }\n    let templateBinding;\n    let templateBindingDependsOnData = false;\n    if (template === void 0) {\n        templateBindingDependsOnData = true;\n        templateBinding = oneTime((s, c) => {\n            var _a;\n            const data = dataBinding.evaluate(s, c);\n            if (data instanceof Node) {\n                return (_a = data.$fastTemplate) !== null && _a !== void 0 ? _a : new NodeTemplate(data);\n            }\n            return instructionToTemplate(getForInstance(data));\n        });\n    }\n    else if (isFunction(template)) {\n        templateBinding = oneWay((s, c) => {\n            var _a;\n            let result = template(s, c);\n            if (isString(result)) {\n                result = instructionToTemplate(getForInstance(dataBinding.evaluate(s, c), result));\n            }\n            else if (result instanceof Node) {\n                result = (_a = result.$fastTemplate) !== null && _a !== void 0 ? _a : new NodeTemplate(result);\n            }\n            return result;\n        }, void 0, true);\n    }\n    else if (isString(template)) {\n        templateBindingDependsOnData = true;\n        templateBinding = oneTime((s, c) => {\n            var _a;\n            const data = dataBinding.evaluate(s, c);\n            if (data instanceof Node) {\n                return (_a = data.$fastTemplate) !== null && _a !== void 0 ? _a : new NodeTemplate(data);\n            }\n            return instructionToTemplate(getForInstance(data, template));\n        });\n    }\n    else if (template instanceof Binding) {\n        const evaluateTemplate = template.evaluate;\n        template.evaluate = (s, c) => {\n            var _a;\n            let result = evaluateTemplate(s, c);\n            if (isString(result)) {\n                result = instructionToTemplate(getForInstance(dataBinding.evaluate(s, c), result));\n            }\n            else if (result instanceof Node) {\n                result = (_a = result.$fastTemplate) !== null && _a !== void 0 ? _a : new NodeTemplate(result);\n            }\n            return result;\n        };\n        templateBinding = template;\n    }\n    else {\n        templateBinding = oneTime((s, c) => template);\n    }\n    return new RenderDirective(dataBinding, templateBinding, templateBindingDependsOnData);\n}\n","import { DOM } from \"./dom.js\";\nimport { ExecutionContext } from \"./observation/observable.js\";\nimport { nextId } from \"./templating/markup.js\";\n/**\n * Retrieves the \"composed parent\" element of a node, ignoring DOM tree boundaries.\n * When the parent of a node is a shadow-root, it will return the host\n * element of the shadow root. Otherwise it will return the parent node or null if\n * no parent node exists.\n * @param element - The element for which to retrieve the composed parent\n *\n * @public\n */\nexport function composedParent(element) {\n    const parentNode = element.parentElement;\n    if (parentNode) {\n        return parentNode;\n    }\n    else {\n        const rootNode = element.getRootNode();\n        if (rootNode.host instanceof HTMLElement) {\n            // this is shadow-root\n            return rootNode.host;\n        }\n    }\n    return null;\n}\n/**\n * Determines if the reference element contains the test element in a \"composed\" DOM tree that\n * ignores shadow DOM boundaries.\n *\n * Returns true of the test element is a descendent of the reference, or exists in\n * a shadow DOM that is a logical descendent of the reference. Otherwise returns false.\n * @param reference - The element to test for containment against.\n * @param test - The element being tested for containment.\n *\n * @public\n */\nexport function composedContains(reference, test) {\n    let current = test;\n    while (current !== null) {\n        if (current === reference) {\n            return true;\n        }\n        current = composedParent(current);\n    }\n    return false;\n}\n/**\n * An extension of MutationObserver that supports unobserving nodes.\n * @internal\n */\nexport class UnobservableMutationObserver extends MutationObserver {\n    /**\n     * Creates an instance of UnobservableMutationObserver.\n     * @param callback - The callback to invoke when observed nodes are changed.\n     */\n    constructor(callback) {\n        function handler(mutations) {\n            this.callback.call(null, mutations.filter(record => this.observedNodes.has(record.target)));\n        }\n        super(handler);\n        this.callback = callback;\n        this.observedNodes = new Set();\n    }\n    observe(target, options) {\n        this.observedNodes.add(target);\n        super.observe(target, options);\n    }\n    unobserve(target) {\n        this.observedNodes.delete(target);\n        if (this.observedNodes.size < 1) {\n            this.disconnect();\n        }\n    }\n}\n/**\n * Bridges between ViewBehaviors and HostBehaviors, enabling a host to\n * control ViewBehaviors.\n * @public\n */\nexport const ViewBehaviorOrchestrator = Object.freeze({\n    /**\n     * Creates a ViewBehaviorOrchestrator.\n     * @param source - The source to to associate behaviors with.\n     * @returns A ViewBehaviorOrchestrator.\n     */\n    create(source) {\n        const behaviors = [];\n        const targets = {};\n        let unbindables = null;\n        let isConnected = false;\n        return {\n            source,\n            context: ExecutionContext.default,\n            targets,\n            get isBound() {\n                return isConnected;\n            },\n            addBehaviorFactory(factory, target) {\n                var _a, _b, _c, _d;\n                const compiled = factory;\n                compiled.id = (_a = compiled.id) !== null && _a !== void 0 ? _a : nextId();\n                compiled.targetNodeId = (_b = compiled.targetNodeId) !== null && _b !== void 0 ? _b : nextId();\n                compiled.targetTagName = (_c = target.tagName) !== null && _c !== void 0 ? _c : null;\n                compiled.policy = (_d = compiled.policy) !== null && _d !== void 0 ? _d : DOM.policy;\n                this.addTarget(compiled.targetNodeId, target);\n                this.addBehavior(compiled.createBehavior());\n            },\n            addTarget(nodeId, target) {\n                targets[nodeId] = target;\n            },\n            addBehavior(behavior) {\n                behaviors.push(behavior);\n                if (isConnected) {\n                    behavior.bind(this);\n                }\n            },\n            onUnbind(unbindable) {\n                if (unbindables === null) {\n                    unbindables = [];\n                }\n                unbindables.push(unbindable);\n            },\n            connectedCallback(controller) {\n                if (!isConnected) {\n                    isConnected = true;\n                    behaviors.forEach(x => x.bind(this));\n                }\n            },\n            disconnectedCallback(controller) {\n                if (isConnected) {\n                    isConnected = false;\n                    if (unbindables !== null) {\n                        unbindables.forEach(x => x.unbind(this));\n                    }\n                }\n            },\n        };\n    },\n});\n","import \"../interfaces.js\";\nimport { PropertyChangeNotifier } from \"../observation/notifier.js\";\nimport { ExecutionContext, Observable, SourceLifetime, } from \"../observation/observable.js\";\nimport { FAST, makeSerializationNoop } from \"../platform.js\";\nimport { ElementStyles } from \"../styles/element-styles.js\";\nimport { UnobservableMutationObserver } from \"../utilities.js\";\nimport { FASTElementDefinition } from \"./fast-definitions.js\";\nimport { HydrationMarkup, isHydratable } from \"./hydration.js\";\nconst defaultEventOptions = {\n    bubbles: true,\n    composed: true,\n    cancelable: true,\n};\nconst isConnectedPropertyName = \"isConnected\";\nconst shadowRoots = new WeakMap();\nfunction getShadowRoot(element) {\n    var _a, _b;\n    return (_b = (_a = element.shadowRoot) !== null && _a !== void 0 ? _a : shadowRoots.get(element)) !== null && _b !== void 0 ? _b : null;\n}\nlet elementControllerStrategy;\n/**\n * Controls the lifecycle and rendering of a `FASTElement`.\n * @public\n */\nexport class ElementController extends PropertyChangeNotifier {\n    /**\n     * Creates a Controller to control the specified element.\n     * @param element - The element to be controlled by this controller.\n     * @param definition - The element definition metadata that instructs this\n     * controller in how to handle rendering and other platform integrations.\n     * @internal\n     */\n    constructor(element, definition) {\n        super(element);\n        this.boundObservables = null;\n        this.needsInitialization = true;\n        this.hasExistingShadowRoot = false;\n        this._template = null;\n        this.stage = 3 /* Stages.disconnected */;\n        /**\n         * A guard against connecting behaviors multiple times\n         * during connect in scenarios where a behavior adds\n         * another behavior during it's connectedCallback\n         */\n        this.guardBehaviorConnection = false;\n        this.behaviors = null;\n        /**\n         * Tracks whether behaviors are connected so that\n         * behaviors cant be connected multiple times\n         */\n        this.behaviorsConnected = false;\n        this._mainStyles = null;\n        /**\n         * This allows Observable.getNotifier(...) to return the Controller\n         * when the notifier for the Controller itself is being requested. The\n         * result is that the Observable system does not need to create a separate\n         * instance of Notifier for observables on the Controller. The component and\n         * the controller will now share the same notifier, removing one-object construct\n         * per web component instance.\n         */\n        this.$fastController = this;\n        /**\n         * The view associated with the custom element.\n         * @remarks\n         * If `null` then the element is managing its own rendering.\n         */\n        this.view = null;\n        this.source = element;\n        this.definition = definition;\n        const shadowOptions = definition.shadowOptions;\n        if (shadowOptions !== void 0) {\n            let shadowRoot = element.shadowRoot;\n            if (shadowRoot) {\n                this.hasExistingShadowRoot = true;\n            }\n            else {\n                shadowRoot = element.attachShadow(shadowOptions);\n                if (shadowOptions.mode === \"closed\") {\n                    shadowRoots.set(element, shadowRoot);\n                }\n            }\n        }\n        // Capture any observable values that were set by the binding engine before\n        // the browser upgraded the element. Then delete the property since it will\n        // shadow the getter/setter that is required to make the observable operate.\n        // Later, in the connect callback, we'll re-apply the values.\n        const accessors = Observable.getAccessors(element);\n        if (accessors.length > 0) {\n            const boundObservables = (this.boundObservables = Object.create(null));\n            for (let i = 0, ii = accessors.length; i < ii; ++i) {\n                const propertyName = accessors[i].name;\n                const value = element[propertyName];\n                if (value !== void 0) {\n                    delete element[propertyName];\n                    boundObservables[propertyName] = value;\n                }\n            }\n        }\n    }\n    /**\n     * Indicates whether or not the custom element has been\n     * connected to the document.\n     */\n    get isConnected() {\n        Observable.track(this, isConnectedPropertyName);\n        return this.stage === 1 /* Stages.connected */;\n    }\n    /**\n     * The context the expression is evaluated against.\n     */\n    get context() {\n        var _a, _b;\n        return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.context) !== null && _b !== void 0 ? _b : ExecutionContext.default;\n    }\n    /**\n     * Indicates whether the controller is bound.\n     */\n    get isBound() {\n        var _a, _b;\n        return (_b = (_a = this.view) === null || _a === void 0 ? void 0 : _a.isBound) !== null && _b !== void 0 ? _b : false;\n    }\n    /**\n     * Indicates how the source's lifetime relates to the controller's lifetime.\n     */\n    get sourceLifetime() {\n        var _a;\n        return (_a = this.view) === null || _a === void 0 ? void 0 : _a.sourceLifetime;\n    }\n    /**\n     * Gets/sets the template used to render the component.\n     * @remarks\n     * This value can only be accurately read after connect but can be set at any time.\n     */\n    get template() {\n        var _a;\n        // 1. Template overrides take top precedence.\n        if (this._template === null) {\n            const definition = this.definition;\n            if (this.source.resolveTemplate) {\n                // 2. Allow for element instance overrides next.\n                this._template = this.source.resolveTemplate();\n            }\n            else if (definition.template) {\n                // 3. Default to the static definition.\n                this._template = (_a = definition.template) !== null && _a !== void 0 ? _a : null;\n            }\n        }\n        return this._template;\n    }\n    set template(value) {\n        if (this._template === value) {\n            return;\n        }\n        this._template = value;\n        if (!this.needsInitialization) {\n            this.renderTemplate(value);\n        }\n    }\n    /**\n     * The main set of styles used for the component, independent\n     * of any dynamically added styles.\n     */\n    get mainStyles() {\n        var _a;\n        // 1. Styles overrides take top precedence.\n        if (this._mainStyles === null) {\n            const definition = this.definition;\n            if (this.source.resolveStyles) {\n                // 2. Allow for element instance overrides next.\n                this._mainStyles = this.source.resolveStyles();\n            }\n            else if (definition.styles) {\n                // 3. Default to the static definition.\n                this._mainStyles = (_a = definition.styles) !== null && _a !== void 0 ? _a : null;\n            }\n        }\n        return this._mainStyles;\n    }\n    set mainStyles(value) {\n        if (this._mainStyles === value) {\n            return;\n        }\n        if (this._mainStyles !== null) {\n            this.removeStyles(this._mainStyles);\n        }\n        this._mainStyles = value;\n        if (!this.needsInitialization) {\n            this.addStyles(value);\n        }\n    }\n    /**\n     * Registers an unbind handler with the controller.\n     * @param behavior - An object to call when the controller unbinds.\n     */\n    onUnbind(behavior) {\n        var _a;\n        (_a = this.view) === null || _a === void 0 ? void 0 : _a.onUnbind(behavior);\n    }\n    /**\n     * Adds the behavior to the component.\n     * @param behavior - The behavior to add.\n     */\n    addBehavior(behavior) {\n        var _a, _b;\n        const targetBehaviors = (_a = this.behaviors) !== null && _a !== void 0 ? _a : (this.behaviors = new Map());\n        const count = (_b = targetBehaviors.get(behavior)) !== null && _b !== void 0 ? _b : 0;\n        if (count === 0) {\n            targetBehaviors.set(behavior, 1);\n            behavior.addedCallback && behavior.addedCallback(this);\n            if (behavior.connectedCallback &&\n                !this.guardBehaviorConnection &&\n                (this.stage === 1 /* Stages.connected */ || this.stage === 0 /* Stages.connecting */)) {\n                behavior.connectedCallback(this);\n            }\n        }\n        else {\n            targetBehaviors.set(behavior, count + 1);\n        }\n    }\n    /**\n     * Removes the behavior from the component.\n     * @param behavior - The behavior to remove.\n     * @param force - Forces removal even if this behavior was added more than once.\n     */\n    removeBehavior(behavior, force = false) {\n        const targetBehaviors = this.behaviors;\n        if (targetBehaviors === null) {\n            return;\n        }\n        const count = targetBehaviors.get(behavior);\n        if (count === void 0) {\n            return;\n        }\n        if (count === 1 || force) {\n            targetBehaviors.delete(behavior);\n            if (behavior.disconnectedCallback && this.stage !== 3 /* Stages.disconnected */) {\n                behavior.disconnectedCallback(this);\n            }\n            behavior.removedCallback && behavior.removedCallback(this);\n        }\n        else {\n            targetBehaviors.set(behavior, count - 1);\n        }\n    }\n    /**\n     * Adds styles to this element. Providing an HTMLStyleElement will attach the element instance to the shadowRoot.\n     * @param styles - The styles to add.\n     */\n    addStyles(styles) {\n        var _a;\n        if (!styles) {\n            return;\n        }\n        const source = this.source;\n        if (styles instanceof HTMLElement) {\n            const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : this.source;\n            target.append(styles);\n        }\n        else if (!styles.isAttachedTo(source)) {\n            const sourceBehaviors = styles.behaviors;\n            styles.addStylesTo(source);\n            if (sourceBehaviors !== null) {\n                for (let i = 0, ii = sourceBehaviors.length; i < ii; ++i) {\n                    this.addBehavior(sourceBehaviors[i]);\n                }\n            }\n        }\n    }\n    /**\n     * Removes styles from this element. Providing an HTMLStyleElement will detach the element instance from the shadowRoot.\n     * @param styles - the styles to remove.\n     */\n    removeStyles(styles) {\n        var _a;\n        if (!styles) {\n            return;\n        }\n        const source = this.source;\n        if (styles instanceof HTMLElement) {\n            const target = (_a = getShadowRoot(source)) !== null && _a !== void 0 ? _a : source;\n            target.removeChild(styles);\n        }\n        else if (styles.isAttachedTo(source)) {\n            const sourceBehaviors = styles.behaviors;\n            styles.removeStylesFrom(source);\n            if (sourceBehaviors !== null) {\n                for (let i = 0, ii = sourceBehaviors.length; i < ii; ++i) {\n                    this.removeBehavior(sourceBehaviors[i]);\n                }\n            }\n        }\n    }\n    /**\n     * Runs connected lifecycle behavior on the associated element.\n     */\n    connect() {\n        if (this.stage !== 3 /* Stages.disconnected */) {\n            return;\n        }\n        this.stage = 0 /* Stages.connecting */;\n        this.bindObservables();\n        this.connectBehaviors();\n        if (this.needsInitialization) {\n            this.renderTemplate(this.template);\n            this.addStyles(this.mainStyles);\n            this.needsInitialization = false;\n        }\n        else if (this.view !== null) {\n            this.view.bind(this.source);\n        }\n        this.stage = 1 /* Stages.connected */;\n        Observable.notify(this, isConnectedPropertyName);\n    }\n    bindObservables() {\n        if (this.boundObservables !== null) {\n            const element = this.source;\n            const boundObservables = this.boundObservables;\n            const propertyNames = Object.keys(boundObservables);\n            for (let i = 0, ii = propertyNames.length; i < ii; ++i) {\n                const propertyName = propertyNames[i];\n                element[propertyName] = boundObservables[propertyName];\n            }\n            this.boundObservables = null;\n        }\n    }\n    connectBehaviors() {\n        if (this.behaviorsConnected === false) {\n            const behaviors = this.behaviors;\n            if (behaviors !== null) {\n                this.guardBehaviorConnection = true;\n                for (const key of behaviors.keys()) {\n                    key.connectedCallback && key.connectedCallback(this);\n                }\n                this.guardBehaviorConnection = false;\n            }\n            this.behaviorsConnected = true;\n        }\n    }\n    disconnectBehaviors() {\n        if (this.behaviorsConnected === true) {\n            const behaviors = this.behaviors;\n            if (behaviors !== null) {\n                for (const key of behaviors.keys()) {\n                    key.disconnectedCallback && key.disconnectedCallback(this);\n                }\n            }\n            this.behaviorsConnected = false;\n        }\n    }\n    /**\n     * Runs disconnected lifecycle behavior on the associated element.\n     */\n    disconnect() {\n        if (this.stage !== 1 /* Stages.connected */) {\n            return;\n        }\n        this.stage = 2 /* Stages.disconnecting */;\n        Observable.notify(this, isConnectedPropertyName);\n        if (this.view !== null) {\n            this.view.unbind();\n        }\n        this.disconnectBehaviors();\n        this.stage = 3 /* Stages.disconnected */;\n    }\n    /**\n     * Runs the attribute changed callback for the associated element.\n     * @param name - 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    onAttributeChangedCallback(name, oldValue, newValue) {\n        const attrDef = this.definition.attributeLookup[name];\n        if (attrDef !== void 0) {\n            attrDef.onAttributeChangedCallback(this.source, newValue);\n        }\n    }\n    /**\n     * Emits a custom HTML event.\n     * @param type - The type name of the event.\n     * @param detail - The event detail object to send with the event.\n     * @param options - The event options. By default bubbles and composed.\n     * @remarks\n     * Only emits events if connected.\n     */\n    emit(type, detail, options) {\n        if (this.stage === 1 /* Stages.connected */) {\n            return this.source.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));\n        }\n        return false;\n    }\n    renderTemplate(template) {\n        var _a;\n        // When getting the host to render to, we start by looking\n        // up the shadow root. If there isn't one, then that means\n        // we're doing a Light DOM render to the element's direct children.\n        const element = this.source;\n        const host = (_a = getShadowRoot(element)) !== null && _a !== void 0 ? _a : element;\n        if (this.view !== null) {\n            // If there's already a view, we need to unbind and remove through dispose.\n            this.view.dispose();\n            this.view = null;\n        }\n        else if (!this.needsInitialization || this.hasExistingShadowRoot) {\n            this.hasExistingShadowRoot = false;\n            // If there was previous custom rendering, we need to clear out the host.\n            for (let child = host.firstChild; child !== null; child = host.firstChild) {\n                host.removeChild(child);\n            }\n        }\n        if (template) {\n            // If a new template was provided, render it.\n            this.view = template.render(element, host, element);\n            this.view.sourceLifetime =\n                SourceLifetime.coupled;\n        }\n    }\n    /**\n     * Locates or creates a controller for the specified element.\n     * @param element - The element to return the controller for.\n     * @remarks\n     * The specified element must have a {@link FASTElementDefinition}\n     * registered either through the use of the {@link customElement}\n     * decorator or a call to `FASTElement.define`.\n     */\n    static forCustomElement(element) {\n        const controller = element.$fastController;\n        if (controller !== void 0) {\n            return controller;\n        }\n        const definition = FASTElementDefinition.getForInstance(element);\n        if (definition === void 0) {\n            throw FAST.error(1401 /* Message.missingElementDefinition */);\n        }\n        return (element.$fastController = new elementControllerStrategy(element, definition));\n    }\n    /**\n     * Sets the strategy that ElementController.forCustomElement uses to construct\n     * ElementController instances for an element.\n     * @param strategy - The strategy to use.\n     */\n    static setStrategy(strategy) {\n        elementControllerStrategy = strategy;\n    }\n}\nmakeSerializationNoop(ElementController);\n// Set default strategy for ElementController\nElementController.setStrategy(ElementController);\n/**\n * Converts a styleTarget into the operative target. When the provided target is an Element\n * that is a FASTElement, the function will return the ShadowRoot for that element. Otherwise,\n * it will return the root node for the element.\n * @param target\n * @returns\n */\nfunction normalizeStyleTarget(target) {\n    var _a;\n    if (\"adoptedStyleSheets\" in target) {\n        return target;\n    }\n    else {\n        return ((_a = getShadowRoot(target)) !== null && _a !== void 0 ? _a : target.getRootNode());\n    }\n}\n// Default StyleStrategy implementations are defined in this module because they\n// require access to element shadowRoots, and we don't want to leak shadowRoot\n// objects out of this module.\n/**\n * https://wicg.github.io/construct-stylesheets/\n * https://developers.google.com/web/updates/2019/02/constructable-stylesheets\n *\n * @internal\n */\nexport class AdoptedStyleSheetsStrategy {\n    constructor(styles) {\n        const styleSheetCache = AdoptedStyleSheetsStrategy.styleSheetCache;\n        this.sheets = styles.map((x) => {\n            if (x instanceof CSSStyleSheet) {\n                return x;\n            }\n            let sheet = styleSheetCache.get(x);\n            if (sheet === void 0) {\n                sheet = new CSSStyleSheet();\n                sheet.replaceSync(x);\n                styleSheetCache.set(x, sheet);\n            }\n            return sheet;\n        });\n    }\n    addStylesTo(target) {\n        addAdoptedStyleSheets(normalizeStyleTarget(target), this.sheets);\n    }\n    removeStylesFrom(target) {\n        removeAdoptedStyleSheets(normalizeStyleTarget(target), this.sheets);\n    }\n}\nAdoptedStyleSheetsStrategy.styleSheetCache = new Map();\nlet id = 0;\nconst nextStyleId = () => `fast-${++id}`;\nfunction usableStyleTarget(target) {\n    return target === document ? document.body : target;\n}\n/**\n * @internal\n */\nexport class StyleElementStrategy {\n    constructor(styles) {\n        this.styles = styles;\n        this.styleClass = nextStyleId();\n    }\n    addStylesTo(target) {\n        target = usableStyleTarget(normalizeStyleTarget(target));\n        const styles = this.styles;\n        const styleClass = this.styleClass;\n        for (let i = 0; i < styles.length; i++) {\n            const element = document.createElement(\"style\");\n            element.innerHTML = styles[i];\n            element.className = styleClass;\n            target.append(element);\n        }\n    }\n    removeStylesFrom(target) {\n        target = usableStyleTarget(normalizeStyleTarget(target));\n        const styles = target.querySelectorAll(`.${this.styleClass}`);\n        for (let i = 0, ii = styles.length; i < ii; ++i) {\n            target.removeChild(styles[i]);\n        }\n    }\n}\nlet addAdoptedStyleSheets = (target, sheets) => {\n    target.adoptedStyleSheets = [...target.adoptedStyleSheets, ...sheets];\n};\nlet removeAdoptedStyleSheets = (target, sheets) => {\n    target.adoptedStyleSheets = target.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);\n};\nif (ElementStyles.supportsAdoptedStyleSheets) {\n    try {\n        // Test if browser implementation uses FrozenArray.\n        // If not, use push / splice to alter the stylesheets\n        // in place. This circumvents a bug in Safari 16.4 where\n        // periodically, assigning the array would previously\n        // cause sheets to be removed.\n        document.adoptedStyleSheets.push();\n        document.adoptedStyleSheets.splice();\n        addAdoptedStyleSheets = (target, sheets) => {\n            target.adoptedStyleSheets.push(...sheets);\n        };\n        removeAdoptedStyleSheets = (target, sheets) => {\n            for (const sheet of sheets) {\n                const index = target.adoptedStyleSheets.indexOf(sheet);\n                if (index !== -1) {\n                    target.adoptedStyleSheets.splice(index, 1);\n                }\n            }\n        };\n    }\n    catch (e) {\n        // Do nothing if an error is thrown, the default\n        // case handles FrozenArray.\n    }\n    ElementStyles.setDefaultStrategy(AdoptedStyleSheetsStrategy);\n}\nelse {\n    ElementStyles.setDefaultStrategy(StyleElementStrategy);\n}\nconst deferHydrationAttribute = \"defer-hydration\";\nconst needsHydrationAttribute = \"needs-hydration\";\n/**\n * An ElementController capable of hydrating FAST elements from\n * Declarative Shadow DOM.\n *\n * @beta\n */\nexport class HydratableElementController extends ElementController {\n    static hydrationObserverHandler(records) {\n        for (const record of records) {\n            HydratableElementController.hydrationObserver.unobserve(record.target);\n            record.target.$fastController.connect();\n        }\n    }\n    connect() {\n        var _a, _b;\n        // Initialize needsHydration on first connect\n        if (this.needsHydration === undefined) {\n            this.needsHydration =\n                this.source.getAttribute(needsHydrationAttribute) !== null;\n        }\n        // If the `defer-hydration` attribute exists on the source,\n        // wait for it to be removed before continuing connection behavior.\n        if (this.source.hasAttribute(deferHydrationAttribute)) {\n            HydratableElementController.hydrationObserver.observe(this.source, {\n                attributeFilter: [deferHydrationAttribute],\n            });\n            return;\n        }\n        // If the controller does not need to be hydrated, defer connection behavior\n        // to the base-class. This case handles element re-connection and initial connection\n        // of elements that did not get declarative shadow-dom emitted, as well as if an extending\n        // class\n        if (!this.needsHydration) {\n            super.connect();\n            return;\n        }\n        if (this.stage !== 3 /* Stages.disconnected */) {\n            return;\n        }\n        this.stage = 0 /* Stages.connecting */;\n        this.bindObservables();\n        this.connectBehaviors();\n        const element = this.source;\n        const host = (_a = getShadowRoot(element)) !== null && _a !== void 0 ? _a : element;\n        if (this.template) {\n            if (isHydratable(this.template)) {\n                let firstChild = host.firstChild;\n                let lastChild = host.lastChild;\n                if (element.shadowRoot === null) {\n                    // handle element boundary markers when shadowRoot is not present\n                    if (HydrationMarkup.isElementBoundaryStartMarker(firstChild)) {\n                        firstChild.data = \"\";\n                        firstChild = firstChild.nextSibling;\n                    }\n                    if (HydrationMarkup.isElementBoundaryEndMarker(lastChild)) {\n                        lastChild.data = \"\";\n                        lastChild = lastChild.previousSibling;\n                    }\n                }\n                this.view = this.template.hydrate(firstChild, lastChild, element);\n                (_b = this.view) === null || _b === void 0 ? void 0 : _b.bind(this.source);\n            }\n            else {\n                this.renderTemplate(this.template);\n            }\n        }\n        this.addStyles(this.mainStyles);\n        this.stage = 1 /* Stages.connected */;\n        this.source.removeAttribute(needsHydrationAttribute);\n        this.needsInitialization = this.needsHydration = false;\n        Observable.notify(this, isConnectedPropertyName);\n    }\n    disconnect() {\n        super.disconnect();\n        HydratableElementController.hydrationObserver.unobserve(this.source);\n    }\n    static install() {\n        ElementController.setStrategy(HydratableElementController);\n    }\n}\nHydratableElementController.hydrationObserver = new UnobservableMutationObserver(HydratableElementController.hydrationObserverHandler);\n","import { isFunction } from \"../interfaces.js\";\nimport { ElementController } from \"./element-controller.js\";\nimport { FASTElementDefinition, } from \"./fast-definitions.js\";\n/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */\nfunction createFASTElement(BaseType) {\n    const type = class extends BaseType {\n        constructor() {\n            /* eslint-disable-next-line */\n            super();\n            ElementController.forCustomElement(this);\n        }\n        $emit(type, detail, options) {\n            return this.$fastController.emit(type, detail, options);\n        }\n        connectedCallback() {\n            this.$fastController.connect();\n        }\n        disconnectedCallback() {\n            this.$fastController.disconnect();\n        }\n        attributeChangedCallback(name, oldValue, newValue) {\n            this.$fastController.onAttributeChangedCallback(name, oldValue, newValue);\n        }\n    };\n    FASTElementDefinition.registerBaseType(type);\n    return type;\n}\nfunction compose(type, nameOrDef) {\n    if (isFunction(type)) {\n        return FASTElementDefinition.compose(type, nameOrDef);\n    }\n    return FASTElementDefinition.compose(this, type);\n}\nfunction define(type, nameOrDef) {\n    if (isFunction(type)) {\n        return FASTElementDefinition.compose(type, nameOrDef).define().type;\n    }\n    return FASTElementDefinition.compose(this, type).define().type;\n}\nfunction from(BaseType) {\n    return createFASTElement(BaseType);\n}\n/**\n * A minimal base class for FASTElements that also provides\n * static helpers for working with FASTElements.\n * @public\n */\nexport const FASTElement = Object.assign(createFASTElement(HTMLElement), {\n    /**\n     * Creates a new FASTElement base class inherited from the\n     * provided base type.\n     * @param BaseType - The base element type to inherit from.\n     */\n    from,\n    /**\n     * Defines a platform custom element based on the provided type and definition.\n     * @param type - The custom element type to define.\n     * @param nameOrDef - The name of the element to define or a definition object\n     * that describes the element to define.\n     */\n    define,\n    /**\n     * Defines metadata for a FASTElement which can be used to later define the element.\n     * @public\n     */\n    compose,\n});\n/**\n * Decorator: Defines a platform custom element based on `FASTElement`.\n * @param nameOrDef - The name of the element to define or a definition object\n * that describes the element to define.\n * @public\n */\nexport function customElement(nameOrDef) {\n    /* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */\n    return function (type) {\n        define(type, nameOrDef);\n    };\n}\n"]}