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nE,GAAmB2K,GAAe,CAACtI,EAFnB,QAE8CqI,GAAajB,WAAWpH,GAAQtO,YAAY4W","sources":["webpack://frontend/./node_modules/@vonage/vivid/shared/index.js"],"sourcesContent":["/**\n * A reference to globalThis, with support\n * for browsers that don't yet support the spec.\n * @public\n */\nconst $global = (function () {\n if (typeof globalThis !== \"undefined\") {\n // We're running in a modern environment.\n return globalThis;\n }\n if (typeof global !== \"undefined\") {\n // We're running in NodeJS\n return global;\n }\n if (typeof self !== \"undefined\") {\n // We're running in a worker.\n return self;\n }\n if (typeof window !== \"undefined\") {\n // We're running in the browser's main thread.\n return window;\n }\n try {\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 return new Function(\"return this\")();\n }\n catch (_a) {\n // If all fails, give up and create an object.\n // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n return {};\n }\n})();\n// API-only Polyfill for trustedTypes\nif ($global.trustedTypes === void 0) {\n $global.trustedTypes = { createPolicy: (n, r) => r };\n}\nconst propConfig = {\n configurable: false,\n enumerable: false,\n writable: false,\n};\nif ($global.FAST === void 0) {\n Reflect.defineProperty($global, \"FAST\", Object.assign({ value: Object.create(null) }, propConfig));\n}\n/**\n * The FAST global.\n * @internal\n */\nconst FAST = $global.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}\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 * @internal\n */\nconst emptyArray = Object.freeze([]);\n/**\n * Creates a function capable of locating metadata associated with a type.\n * @returns A metadata locator function.\n * @internal\n */\nfunction 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\nconst updateQueue = $global.FAST.getById(1 /* updateQueue */, () => {\n const tasks = [];\n const pendingErrors = [];\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 pendingErrors.push(error);\n setTimeout(throwFirstError, 0);\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 `DOM.queueUpdate`.\n // If we call `DOM.queueUpdate` within a task scheduled by `DOM.queueUpdate`, 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 if (tasks.length < 1) {\n $global.requestAnimationFrame(process);\n }\n tasks.push(callable);\n }\n return Object.freeze({\n enqueue,\n process,\n });\n});\n/* eslint-disable */\nconst fastHTMLPolicy = $global.trustedTypes.createPolicy(\"fast-html\", {\n createHTML: html => html,\n});\n/* eslint-enable */\nlet htmlPolicy = fastHTMLPolicy;\nconst marker = `fast-${Math.random().toString(36).substring(2, 8)}`;\n/** @internal */\nconst _interpolationStart = `${marker}{`;\n/** @internal */\nconst _interpolationEnd = `}${marker}`;\n/**\n * Common DOM APIs.\n * @public\n */\nconst DOM = Object.freeze({\n /**\n * Indicates whether the DOM supports the adoptedStyleSheets feature.\n */\n supportsAdoptedStyleSheets: Array.isArray(document.adoptedStyleSheets) &&\n \"replace\" in CSSStyleSheet.prototype,\n /**\n * Sets the HTML trusted types policy used by the templating engine.\n * @param policy - The policy to set for HTML.\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 setHTMLPolicy(policy) {\n if (htmlPolicy !== fastHTMLPolicy) {\n throw new Error(\"The HTML policy can only be set once.\");\n }\n htmlPolicy = policy;\n },\n /**\n * Turns a string into trusted HTML using the configured trusted types policy.\n * @param html - The string to turn into trusted HTML.\n * @remarks\n * Used internally by the template engine when creating templates\n * and setting innerHTML.\n */\n createHTML(html) {\n return htmlPolicy.createHTML(html);\n },\n /**\n * Determines if the provided node is a template marker used by the runtime.\n * @param node - The node to test.\n */\n isMarker(node) {\n return node && node.nodeType === 8 && node.data.startsWith(marker);\n },\n /**\n * Given a marker node, extract the {@link HTMLDirective} index from the placeholder.\n * @param node - The marker node to extract the index from.\n */\n extractDirectiveIndexFromMarker(node) {\n return parseInt(node.data.replace(`${marker}:`, \"\"));\n },\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 createInterpolationPlaceholder(index) {\n return `${_interpolationStart}${index}${_interpolationEnd}`;\n },\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 createCustomAttributePlaceholder(attributeName, index) {\n return `${attributeName}=\"${this.createInterpolationPlaceholder(index)}\"`;\n },\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 createBlockPlaceholder(index) {\n return ``;\n },\n /**\n * Schedules DOM update work in the next async batch.\n * @param callable - The callable function or object to queue.\n */\n queueUpdate: updateQueue.enqueue,\n /**\n * Immediately processes all work previously scheduled\n * through queueUpdate.\n * @remarks\n * This also forces nextUpdate promises\n * to resolve.\n */\n processUpdates: updateQueue.process,\n /**\n * Resolves with the next DOM update.\n */\n nextUpdate() {\n return new Promise(updateQueue.enqueue);\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 if (value === null || value === undefined) {\n element.removeAttribute(attributeName);\n }\n else {\n element.setAttribute(attributeName, value);\n }\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 * Removes all the child nodes of the provided parent node.\n * @param parent - The node to remove the children from.\n */\n removeChildNodes(parent) {\n for (let child = parent.firstChild; child !== null; child = parent.firstChild) {\n parent.removeChild(child);\n }\n },\n /**\n * Creates a TreeWalker configured to walk a template fragment.\n * @param fragment - The fragment to walk.\n */\n createTemplateWalker(fragment) {\n return document.createTreeWalker(fragment, 133, // element, text, comment\n null, false);\n },\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 source.\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 */\nclass SubscriberSet {\n /**\n * Creates an instance of SubscriberSet for the specified source.\n * @param source - The object source that subscribers will receive notifications from.\n * @param initialSubscriber - An initial subscriber to changes.\n */\n constructor(source, initialSubscriber) {\n this.sub1 = void 0;\n this.sub2 = void 0;\n this.spillover = void 0;\n this.source = source;\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 source = this.source;\n if (spillover === void 0) {\n const sub1 = this.sub1;\n const sub2 = this.sub2;\n if (sub1 !== void 0) {\n sub1.handleChange(source, args);\n }\n if (sub2 !== void 0) {\n sub2.handleChange(source, args);\n }\n }\n else {\n for (let i = 0, ii = spillover.length; i < ii; ++i) {\n spillover[i].handleChange(source, 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 */\nclass PropertyChangeNotifier {\n /**\n * Creates an instance of PropertyChangeNotifier for the specified source.\n * @param source - The object source that subscribers will receive notifications from.\n */\n constructor(source) {\n this.subscribers = {};\n this.sourceSubscribers = null;\n this.source = source;\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;\n const subscribers = this.subscribers[propertyName];\n if (subscribers !== void 0) {\n subscribers.notify(propertyName);\n }\n (_a = this.sourceSubscribers) === null || _a === void 0 ? void 0 : _a.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;\n if (propertyToWatch) {\n let subscribers = this.subscribers[propertyToWatch];\n if (subscribers === void 0) {\n this.subscribers[propertyToWatch] = subscribers = new SubscriberSet(this.source);\n }\n subscribers.subscribe(subscriber);\n }\n else {\n this.sourceSubscribers =\n (_a = this.sourceSubscribers) !== null && _a !== void 0 ? _a : new SubscriberSet(this.source);\n this.sourceSubscribers.subscribe(subscriber);\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 * @param propertyToUnwatch - The name of the property that the subscriber is no longer interested in watching.\n */\n unsubscribe(subscriber, propertyToUnwatch) {\n var _a;\n if (propertyToUnwatch) {\n const subscribers = this.subscribers[propertyToUnwatch];\n if (subscribers !== void 0) {\n subscribers.unsubscribe(subscriber);\n }\n }\n else {\n (_a = this.sourceSubscribers) === null || _a === void 0 ? void 0 : _a.unsubscribe(subscriber);\n }\n }\n}\n\n/**\n * Common Observable APIs.\n * @public\n */\nconst Observable = FAST.getById(2 /* observable */, () => {\n const volatileRegex = /(:|&&|\\|\\||if)/;\n const notifierLookup = new WeakMap();\n const queueUpdate = DOM.queueUpdate;\n let watcher = void 0;\n let createArrayObserver = (array) => {\n throw new Error(\"Must call enableArrayObservation before observing arrays.\");\n };\n function getNotifier(source) {\n let found = source.$fastController || notifierLookup.get(source);\n if (found === void 0) {\n if (Array.isArray(source)) {\n found = createArrayObserver(source);\n }\n else {\n notifierLookup.set(source, (found = new PropertyChangeNotifier(source)));\n }\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 (typeof callback === \"function\") {\n callback.call(source, oldValue, newValue);\n }\n getNotifier(source).notify(this.name);\n }\n }\n }\n class BindingObserverImplementation extends SubscriberSet {\n constructor(binding, initialSubscriber, isVolatileBinding = false) {\n super(binding, initialSubscriber);\n this.binding = binding;\n this.isVolatileBinding = isVolatileBinding;\n this.needsRefresh = true;\n this.needsQueue = 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 observe(source, context) {\n if (this.needsRefresh && this.last !== null) {\n this.disconnect();\n }\n const previousWatcher = watcher;\n watcher = this.needsRefresh ? this : void 0;\n this.needsRefresh = this.isVolatileBinding;\n const result = this.binding(source, context);\n watcher = previousWatcher;\n return result;\n }\n disconnect() {\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 = true;\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 @typescript-eslint/no-this-alias */\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 }\n call() {\n if (this.last !== null) {\n this.needsQueue = true;\n this.notify(this);\n }\n }\n records() {\n let next = this.first;\n return {\n next: () => {\n const current = next;\n if (current === undefined) {\n return { value: void 0, done: true };\n }\n else {\n next = next.next;\n return {\n value: current,\n done: false,\n };\n }\n },\n [Symbol.iterator]: function () {\n return this;\n },\n };\n }\n }\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 if (watcher !== void 0) {\n watcher.watch(source, propertyName);\n }\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 if (watcher !== void 0) {\n watcher.needsRefresh = true;\n }\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 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 (typeof nameOrAccessor === \"string\") {\n nameOrAccessor = new DefaultObservableAccessor(nameOrAccessor);\n }\n getAccessors(target).push(nameOrAccessor);\n Reflect.defineProperty(target, nameOrAccessor.name, {\n enumerable: true,\n get: function () {\n return nameOrAccessor.getValue(this);\n },\n set: function (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 BindingObserver} that can watch the\n * provided {@link Binding} for changes.\n * @param binding - 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(binding, initialSubscriber, isVolatileBinding = this.isVolatileBinding(binding)) {\n return new BindingObserverImplementation(binding, 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 binding - The binding to inspect.\n */\n isVolatileBinding(binding) {\n return volatileRegex.test(binding.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 */\nfunction 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 */\nfunction volatile(target, name, descriptor) {\n return Object.assign({}, descriptor, {\n get: function () {\n Observable.trackVolatile();\n return descriptor.get.apply(this);\n },\n });\n}\nconst contextEvent = FAST.getById(3 /* 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 */\nclass ExecutionContext {\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 * The parent data object within a repeat context.\n */\n this.parent = null;\n /**\n * The parent execution context when in nested context scenarios.\n */\n this.parentContext = null;\n }\n /**\n * The current event within an event handler.\n */\n get event() {\n return contextEvent.get();\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 * Sets the event for the current execution context.\n * @param event - The event to set.\n * @internal\n */\n static setEvent(event) {\n contextEvent.set(event);\n }\n}\nObservable.defineProperty(ExecutionContext.prototype, \"index\");\nObservable.defineProperty(ExecutionContext.prototype, \"length\");\n/**\n * The default execution context used in binding expressions.\n * @public\n */\nconst defaultExecutionContext = Object.seal(new ExecutionContext());\n\n/**\n * Instructs the template engine to apply behavior to a node.\n * @public\n */\nclass HTMLDirective {\n constructor() {\n /**\n * The index of the DOM node to which the created behavior will apply.\n */\n this.targetIndex = 0;\n }\n}\n/**\n * A {@link HTMLDirective} that targets a named attribute or property on a node.\n * @public\n */\nclass TargetedHTMLDirective extends HTMLDirective {\n constructor() {\n super(...arguments);\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 this.createPlaceholder = DOM.createInterpolationPlaceholder;\n }\n}\n/**\n * A directive that attaches special behavior to an element via a custom attribute.\n * @public\n */\nclass AttachedBehaviorHTMLDirective extends HTMLDirective {\n /**\n *\n * @param name - The name of the behavior; used as a custom attribute on the element.\n * @param behavior - The behavior to instantiate and attach to the element.\n * @param options - Options to pass to the behavior during creation.\n */\n constructor(name, behavior, options) {\n super();\n this.name = name;\n this.behavior = behavior;\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 createPlaceholder(index) {\n return DOM.createCustomAttributePlaceholder(this.name, index);\n }\n /**\n * Creates a behavior for the provided target node.\n * @param target - The node instance to create the behavior for.\n * @remarks\n * Creates an instance of the `behavior` type this directive was constructed with\n * and passes the target and options to that `behavior`'s constructor.\n */\n createBehavior(target) {\n return new this.behavior(target, this.options);\n }\n}\n\nfunction normalBind(source, context) {\n this.source = source;\n this.context = context;\n if (this.bindingObserver === null) {\n this.bindingObserver = Observable.binding(this.binding, this, this.isBindingVolatile);\n }\n this.updateTarget(this.bindingObserver.observe(source, context));\n}\nfunction triggerBind(source, context) {\n this.source = source;\n this.context = context;\n this.target.addEventListener(this.targetName, this);\n}\nfunction normalUnbind() {\n this.bindingObserver.disconnect();\n this.source = null;\n this.context = null;\n}\nfunction contentUnbind() {\n this.bindingObserver.disconnect();\n this.source = null;\n this.context = null;\n const view = this.target.$fastView;\n if (view !== void 0 && view.isComposed) {\n view.unbind();\n view.needsBindOnly = true;\n }\n}\nfunction triggerUnbind() {\n this.target.removeEventListener(this.targetName, this);\n this.source = null;\n this.context = null;\n}\nfunction updateAttributeTarget(value) {\n DOM.setAttribute(this.target, this.targetName, value);\n}\nfunction updateBooleanAttributeTarget(value) {\n DOM.setBooleanAttribute(this.target, this.targetName, value);\n}\nfunction updateContentTarget(value) {\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 template-like.\n if (value.create) {\n this.target.textContent = \"\";\n let view = this.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 view = value.create();\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 (this.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(this.source, this.context);\n view.insertBefore(this.target);\n this.target.$fastView = view;\n this.target.$fastTemplate = value;\n }\n else if (view.needsBindOnly) {\n view.needsBindOnly = false;\n view.bind(this.source, this.context);\n }\n }\n else {\n const view = this.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 this.target.textContent = value;\n }\n}\nfunction updatePropertyTarget(value) {\n this.target[this.targetName] = value;\n}\nfunction updateClassTarget(value) {\n const classVersions = this.classVersions || Object.create(null);\n const target = this.target;\n let version = this.version || 0;\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 target.classList.add(currentName);\n }\n }\n this.classVersions = classVersions;\n this.version = 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 target.classList.remove(name);\n }\n }\n}\n/**\n * A directive that configures data binding to element content and attributes.\n * @public\n */\nclass HTMLBindingDirective extends TargetedHTMLDirective {\n /**\n * Creates an instance of BindingDirective.\n * @param binding - A binding that returns the data used to update the DOM.\n */\n constructor(binding) {\n super();\n this.binding = binding;\n this.bind = normalBind;\n this.unbind = normalUnbind;\n this.updateTarget = updateAttributeTarget;\n this.isBindingVolatile = Observable.isVolatileBinding(this.binding);\n }\n /**\n * Gets/sets the name of the attribute or property that this\n * binding is targeting.\n */\n get targetName() {\n return this.originalTargetName;\n }\n set targetName(value) {\n this.originalTargetName = value;\n if (value === void 0) {\n return;\n }\n switch (value[0]) {\n case \":\":\n this.cleanedTargetName = value.substr(1);\n this.updateTarget = updatePropertyTarget;\n if (this.cleanedTargetName === \"innerHTML\") {\n const binding = this.binding;\n this.binding = (s, c) => DOM.createHTML(binding(s, c));\n }\n break;\n case \"?\":\n this.cleanedTargetName = value.substr(1);\n this.updateTarget = updateBooleanAttributeTarget;\n break;\n case \"@\":\n this.cleanedTargetName = value.substr(1);\n this.bind = triggerBind;\n this.unbind = triggerUnbind;\n break;\n default:\n this.cleanedTargetName = value;\n if (value === \"class\") {\n this.updateTarget = updateClassTarget;\n }\n break;\n }\n }\n /**\n * Makes this binding target the content of an element rather than\n * a particular attribute or property.\n */\n targetAtContent() {\n this.updateTarget = updateContentTarget;\n this.unbind = contentUnbind;\n }\n /**\n * Creates the runtime BindingBehavior instance based on the configuration\n * information stored in the BindingDirective.\n * @param target - The target node that the binding behavior should attach to.\n */\n createBehavior(target) {\n /* eslint-disable-next-line @typescript-eslint/no-use-before-define */\n return new BindingBehavior(target, this.binding, this.isBindingVolatile, this.bind, this.unbind, this.updateTarget, this.cleanedTargetName);\n }\n}\n/**\n * A behavior that updates content and attributes based on a configured\n * BindingDirective.\n * @public\n */\nclass BindingBehavior {\n /**\n * Creates an instance of BindingBehavior.\n * @param target - The target of the data updates.\n * @param binding - The binding that returns the latest value for an update.\n * @param isBindingVolatile - Indicates whether the binding has volatile dependencies.\n * @param bind - The operation to perform during binding.\n * @param unbind - The operation to perform during unbinding.\n * @param updateTarget - The operation to perform when updating.\n * @param targetName - The name of the target attribute or property to update.\n */\n constructor(target, binding, isBindingVolatile, bind, unbind, updateTarget, targetName) {\n /** @internal */\n this.source = null;\n /** @internal */\n this.context = null;\n /** @internal */\n this.bindingObserver = null;\n this.target = target;\n this.binding = binding;\n this.isBindingVolatile = isBindingVolatile;\n this.bind = bind;\n this.unbind = unbind;\n this.updateTarget = updateTarget;\n this.targetName = targetName;\n }\n /** @internal */\n handleChange() {\n this.updateTarget(this.bindingObserver.observe(this.source, this.context));\n }\n /** @internal */\n handleEvent(event) {\n ExecutionContext.setEvent(event);\n const result = this.binding(this.source, this.context);\n ExecutionContext.setEvent(null);\n if (result !== true) {\n event.preventDefault();\n }\n }\n}\n\nlet sharedContext = null;\nclass CompilationContext {\n addFactory(factory) {\n factory.targetIndex = this.targetIndex;\n this.behaviorFactories.push(factory);\n }\n captureContentBinding(directive) {\n directive.targetAtContent();\n this.addFactory(directive);\n }\n reset() {\n this.behaviorFactories = [];\n this.targetIndex = -1;\n }\n release() {\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n sharedContext = this;\n }\n static borrow(directives) {\n const shareable = sharedContext || new CompilationContext();\n shareable.directives = directives;\n shareable.reset();\n sharedContext = null;\n return shareable;\n }\n}\nfunction createAggregateBinding(parts) {\n if (parts.length === 1) {\n return parts[0];\n }\n let targetName;\n const partCount = parts.length;\n const finalParts = parts.map((x) => {\n if (typeof x === \"string\") {\n return () => x;\n }\n targetName = x.targetName || targetName;\n return x.binding;\n });\n const binding = (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(binding);\n directive.targetName = targetName;\n return directive;\n}\nconst interpolationEndLength = _interpolationEnd.length;\nfunction parseContent(context, value) {\n const valueParts = value.split(_interpolationStart);\n if (valueParts.length === 1) {\n return null;\n }\n const bindingParts = [];\n for (let i = 0, ii = valueParts.length; i < ii; ++i) {\n const current = valueParts[i];\n const index = current.indexOf(_interpolationEnd);\n let literal;\n if (index === -1) {\n literal = current;\n }\n else {\n const directiveIndex = parseInt(current.substring(0, index));\n bindingParts.push(context.directives[directiveIndex]);\n literal = current.substring(index + interpolationEndLength);\n }\n if (literal !== \"\") {\n bindingParts.push(literal);\n }\n }\n return bindingParts;\n}\nfunction compileAttributes(context, node, includeBasicValues = false) {\n const attributes = node.attributes;\n for (let i = 0, ii = attributes.length; i < ii; ++i) {\n const attr = attributes[i];\n const attrValue = attr.value;\n const parseResult = parseContent(context, attrValue);\n let result = null;\n if (parseResult === null) {\n if (includeBasicValues) {\n result = new HTMLBindingDirective(() => attrValue);\n result.targetName = attr.name;\n }\n }\n else {\n result = createAggregateBinding(parseResult);\n }\n if (result !== null) {\n node.removeAttributeNode(attr);\n i--;\n ii--;\n context.addFactory(result);\n }\n }\n}\nfunction compileContent(context, node, walker) {\n const parseResult = parseContent(context, node.textContent);\n if (parseResult !== null) {\n let lastNode = node;\n for (let i = 0, ii = parseResult.length; i < ii; ++i) {\n const currentPart = parseResult[i];\n const currentNode = i === 0\n ? node\n : lastNode.parentNode.insertBefore(document.createTextNode(\"\"), lastNode.nextSibling);\n if (typeof currentPart === \"string\") {\n currentNode.textContent = currentPart;\n }\n else {\n currentNode.textContent = \" \";\n context.captureContentBinding(currentPart);\n }\n lastNode = currentNode;\n context.targetIndex++;\n if (currentNode !== node) {\n walker.nextNode();\n }\n }\n context.targetIndex--;\n }\n}\n/**\n * Compiles a template and associated directives into a raw compilation\n * result which include a cloneable DocumentFragment and factories capable\n * of attaching runtime behavior to nodes within the fragment.\n * @param template - The template to compile.\n * @param directives - The directives referenced by the template.\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 */\nfunction compileTemplate(template, directives) {\n const fragment = template.content;\n // https://bugs.chromium.org/p/chromium/issues/detail?id=1111864\n document.adoptNode(fragment);\n const context = CompilationContext.borrow(directives);\n compileAttributes(context, template, true);\n const hostBehaviorFactories = context.behaviorFactories;\n context.reset();\n const walker = DOM.createTemplateWalker(fragment);\n let node;\n while ((node = walker.nextNode())) {\n context.targetIndex++;\n switch (node.nodeType) {\n case 1: // element node\n compileAttributes(context, node);\n break;\n case 3: // text node\n compileContent(context, node, walker);\n break;\n case 8: // comment\n if (DOM.isMarker(node)) {\n context.addFactory(directives[DOM.extractDirectiveIndexFromMarker(node)]);\n }\n }\n }\n let targetOffset = 0;\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 DOM.isMarker(fragment.firstChild) ||\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 && directives.length)) {\n fragment.insertBefore(document.createComment(\"\"), fragment.firstChild);\n targetOffset = -1;\n }\n const viewBehaviorFactories = context.behaviorFactories;\n context.release();\n return {\n fragment,\n viewBehaviorFactories,\n hostBehaviorFactories,\n targetOffset,\n };\n}\n\n// A singleton Range instance used to efficiently remove ranges of DOM nodes.\n// See the implementation of HTMLView below for further details.\nconst range = document.createRange();\n/**\n * The standard View implementation, which also implements ElementView and SyntheticView.\n * @public\n */\nclass HTMLView {\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, behaviors) {\n this.fragment = fragment;\n this.behaviors = behaviors;\n /**\n * The data that the view is bound to.\n */\n this.source = null;\n /**\n * The execution context the view is running within.\n */\n this.context = null;\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 const parent = this.firstChild.parentNode;\n const end = this.lastChild;\n let current = this.firstChild;\n let next;\n while (current !== end) {\n next = current.nextSibling;\n parent.removeChild(current);\n current = next;\n }\n parent.removeChild(end);\n const behaviors = this.behaviors;\n const oldSource = this.source;\n for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n behaviors[i].unbind(oldSource);\n }\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) {\n const behaviors = this.behaviors;\n if (this.source === source) {\n return;\n }\n else if (this.source !== null) {\n const oldSource = this.source;\n this.source = source;\n this.context = context;\n for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n const current = behaviors[i];\n current.unbind(oldSource);\n current.bind(source, context);\n }\n }\n else {\n this.source = source;\n this.context = context;\n for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n behaviors[i].bind(source, context);\n }\n }\n }\n /**\n * Unbinds a view's behaviors from its binding source.\n */\n unbind() {\n if (this.source === null) {\n return;\n }\n const behaviors = this.behaviors;\n const oldSource = this.source;\n for (let i = 0, ii = behaviors.length; i < ii; ++i) {\n behaviors[i].unbind(oldSource);\n }\n this.source = null;\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 range.setStartBefore(views[0].firstChild);\n range.setEndAfter(views[views.length - 1].lastChild);\n range.deleteContents();\n for (let i = 0, ii = views.length; i < ii; ++i) {\n const view = views[i];\n const behaviors = view.behaviors;\n const oldSource = view.source;\n for (let j = 0, jj = behaviors.length; j < jj; ++j) {\n behaviors[j].unbind(oldSource);\n }\n }\n }\n}\n\n/**\n * A template capable of creating HTMLView instances or rendering directly to DOM.\n * @public\n */\n/* eslint-disable-next-line @typescript-eslint/no-unused-vars */\nclass 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 directives - The directives that will be connected to placeholders in the html.\n */\n constructor(html, directives) {\n this.behaviorCount = 0;\n this.hasHostBehaviors = false;\n this.fragment = null;\n this.targetOffset = 0;\n this.viewBehaviorFactories = null;\n this.hostBehaviorFactories = null;\n this.html = html;\n this.directives = directives;\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 if (this.fragment === null) {\n let template;\n const html = this.html;\n if (typeof html === \"string\") {\n template = document.createElement(\"template\");\n template.innerHTML = DOM.createHTML(html);\n const fec = template.content.firstElementChild;\n if (fec !== null && fec.tagName === \"TEMPLATE\") {\n template = fec;\n }\n }\n else {\n template = html;\n }\n const result = compileTemplate(template, this.directives);\n this.fragment = result.fragment;\n this.viewBehaviorFactories = result.viewBehaviorFactories;\n this.hostBehaviorFactories = result.hostBehaviorFactories;\n this.targetOffset = result.targetOffset;\n this.behaviorCount =\n this.viewBehaviorFactories.length + this.hostBehaviorFactories.length;\n this.hasHostBehaviors = this.hostBehaviorFactories.length > 0;\n }\n const fragment = this.fragment.cloneNode(true);\n const viewFactories = this.viewBehaviorFactories;\n const behaviors = new Array(this.behaviorCount);\n const walker = DOM.createTemplateWalker(fragment);\n let behaviorIndex = 0;\n let targetIndex = this.targetOffset;\n let node = walker.nextNode();\n for (let ii = viewFactories.length; behaviorIndex < ii; ++behaviorIndex) {\n const factory = viewFactories[behaviorIndex];\n const factoryIndex = factory.targetIndex;\n while (node !== null) {\n if (targetIndex === factoryIndex) {\n behaviors[behaviorIndex] = factory.createBehavior(node);\n break;\n }\n else {\n node = walker.nextNode();\n targetIndex++;\n }\n }\n }\n if (this.hasHostBehaviors) {\n const hostFactories = this.hostBehaviorFactories;\n for (let i = 0, ii = hostFactories.length; i < ii; ++i, ++behaviorIndex) {\n behaviors[behaviorIndex] = hostFactories[i].createBehavior(hostBindingTarget);\n }\n }\n return new HTMLView(fragment, behaviors);\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 if (typeof host === \"string\") {\n host = document.getElementById(host);\n }\n if (hostBindingTarget === void 0) {\n hostBindingTarget = host;\n }\n const view = this.create(hostBindingTarget);\n view.bind(source, defaultExecutionContext);\n view.appendTo(host);\n return view;\n }\n}\n// Much thanks to LitHTML for working this out!\nconst lastAttributeNameRegex = \n/* eslint-disable-next-line no-control-regex */\n/([ \\x09\\x0a\\x0c\\x0d])([^\\0-\\x1F\\x7F-\\x9F \"'>=/]+)([ \\x09\\x0a\\x0c\\x0d]*=[ \\x09\\x0a\\x0c\\x0d]*(?:[^ \\x09\\x0a\\x0c\\x0d\"'`<>=]*|\"[^\"]*|'[^']*))$/;\n/**\n * Transforms a template literal string into a renderable 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 */\nfunction html(strings, ...values) {\n const directives = [];\n let html = \"\";\n for (let i = 0, ii = strings.length - 1; i < ii; ++i) {\n const currentString = strings[i];\n let value = values[i];\n html += currentString;\n if (value instanceof ViewTemplate) {\n const template = value;\n value = () => template;\n }\n if (typeof value === \"function\") {\n value = new HTMLBindingDirective(value);\n }\n if (value instanceof TargetedHTMLDirective) {\n const match = lastAttributeNameRegex.exec(currentString);\n if (match !== null) {\n value.targetName = match[2];\n }\n }\n if (value instanceof HTMLDirective) {\n // Since not all values are directives, we can't use i\n // as the index for the placeholder. Instead, we need to\n // use directives.length to get the next index.\n html += value.createPlaceholder(directives.length);\n directives.push(value);\n }\n else {\n html += value;\n }\n }\n html += strings[strings.length - 1];\n return new ViewTemplate(html, directives);\n}\n\n/**\n * Represents styles that can be applied to a custom element.\n * @public\n */\nclass ElementStyles {\n constructor() {\n this.targets = new WeakSet();\n }\n /** @internal */\n addStylesTo(target) {\n this.targets.add(target);\n }\n /** @internal */\n 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/**\n * Create ElementStyles from ComposableStyles.\n */\nElementStyles.create = (() => {\n if (DOM.supportsAdoptedStyleSheets) {\n const styleSheetCache = new Map();\n return (styles) => \n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n new AdoptedStyleSheetsStyles(styles, styleSheetCache);\n }\n // eslint-disable-next-line @typescript-eslint/no-use-before-define\n return (styles) => new StyleElementStyles(styles);\n})();\nfunction reduceStyles(styles) {\n return styles\n .map((x) => x instanceof ElementStyles ? reduceStyles(x.styles) : [x])\n .reduce((prev, curr) => prev.concat(curr), []);\n}\nfunction reduceBehaviors(styles) {\n return styles\n .map((x) => (x instanceof ElementStyles ? x.behaviors : null))\n .reduce((prev, curr) => {\n if (curr === null) {\n return prev;\n }\n if (prev === null) {\n prev = [];\n }\n return prev.concat(curr);\n }, null);\n}\n/**\n * A Symbol that can be added to a CSSStyleSheet to cause it to be prepended (rather than appended) to adoptedStyleSheets.\n * @public\n */\nconst prependToAdoptedStyleSheetsSymbol = Symbol(\"prependToAdoptedStyleSheets\");\nfunction separateSheetsToPrepend(sheets) {\n const prepend = [];\n const append = [];\n sheets.forEach(x => (x[prependToAdoptedStyleSheetsSymbol] ? prepend : append).push(x));\n return { prepend, append };\n}\nlet addAdoptedStyleSheets = (target, sheets) => {\n const { prepend, append } = separateSheetsToPrepend(sheets);\n target.adoptedStyleSheets = [...prepend, ...target.adoptedStyleSheets, ...append];\n};\nlet removeAdoptedStyleSheets = (target, sheets) => {\n target.adoptedStyleSheets = target.adoptedStyleSheets.filter((x) => sheets.indexOf(x) === -1);\n};\nif (DOM.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 const { prepend, append } = separateSheetsToPrepend(sheets);\n target.adoptedStyleSheets.splice(0, 0, ...prepend);\n target.adoptedStyleSheets.push(...append);\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}\n/**\n * https://wicg.github.io/construct-stylesheets/\n * https://developers.google.com/web/updates/2019/02/constructable-stylesheets\n *\n * @internal\n */\nclass AdoptedStyleSheetsStyles extends ElementStyles {\n constructor(styles, styleSheetCache) {\n super();\n this.styles = styles;\n this.styleSheetCache = styleSheetCache;\n this._styleSheets = void 0;\n this.behaviors = reduceBehaviors(styles);\n }\n get styleSheets() {\n if (this._styleSheets === void 0) {\n const styles = this.styles;\n const styleSheetCache = this.styleSheetCache;\n this._styleSheets = reduceStyles(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 return this._styleSheets;\n }\n addStylesTo(target) {\n addAdoptedStyleSheets(target, this.styleSheets);\n super.addStylesTo(target);\n }\n removeStylesFrom(target) {\n removeAdoptedStyleSheets(target, this.styleSheets);\n super.removeStylesFrom(target);\n }\n}\nlet styleClassId = 0;\nfunction getNextStyleClass() {\n return `fast-style-class-${++styleClassId}`;\n}\n/**\n * @internal\n */\nclass StyleElementStyles extends ElementStyles {\n constructor(styles) {\n super();\n this.styles = styles;\n this.behaviors = null;\n this.behaviors = reduceBehaviors(styles);\n this.styleSheets = reduceStyles(styles);\n this.styleClass = getNextStyleClass();\n }\n addStylesTo(target) {\n const styleSheets = this.styleSheets;\n const styleClass = this.styleClass;\n target = this.normalizeTarget(target);\n for (let i = 0; i < styleSheets.length; i++) {\n const element = document.createElement(\"style\");\n element.innerHTML = styleSheets[i];\n element.className = styleClass;\n target.append(element);\n }\n super.addStylesTo(target);\n }\n removeStylesFrom(target) {\n target = this.normalizeTarget(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 super.removeStylesFrom(target);\n }\n isAttachedTo(target) {\n return super.isAttachedTo(this.normalizeTarget(target));\n }\n normalizeTarget(target) {\n return target === document ? document.body : target;\n }\n}\n\n/**\n * Metadata used to configure a custom attribute's behavior.\n * @public\n */\nconst 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 */\nconst booleanConverter = {\n toView(value) {\n return value ? \"true\" : \"false\";\n },\n fromView(value) {\n if (value === null ||\n value === void 0 ||\n value === \"false\" ||\n value === false ||\n value === 0) {\n return false;\n }\n return true;\n },\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 */\nconst nullableNumberConverter = {\n toView(value) {\n if (value === null || value === undefined) {\n return null;\n }\n const number = value * 1;\n return isNaN(number) ? null : number.toString();\n },\n fromView(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/**\n * An implementation of {@link Accessor} that supports reactivity,\n * change callbacks, attribute reflection, and type conversion for\n * custom elements.\n * @public\n */\nclass 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 = \"reflect\", 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 === \"boolean\" && 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 value - 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 DOM.queueUpdate(() => {\n guards.add(element);\n const latestValue = element[this.fieldName];\n switch (mode) {\n case \"reflect\":\n const converter = this.converter;\n DOM.setAttribute(element, this.attribute, converter !== void 0 ? converter.toView(latestValue) : latestValue);\n break;\n case \"boolean\":\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 (typeof config === \"string\") {\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}\nfunction 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\nconst defaultShadowOptions = { mode: \"open\" };\nconst defaultElementOptions = {};\nconst fastRegistry = FAST.getById(4 /* elementRegistry */, () => {\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 });\n});\n/**\n * Defines metadata for a FASTElement.\n * @public\n */\nclass FASTElementDefinition {\n /**\n * Creates an instance of FASTElementDefinition.\n * @param type - The type this definition is being created for.\n * @param nameOrConfig - The name of the element to define or a config object\n * that describes the element to define.\n */\n constructor(type, nameOrConfig = type.definition) {\n if (typeof nameOrConfig === \"string\") {\n nameOrConfig = { name: nameOrConfig };\n }\n this.type = type;\n this.name = nameOrConfig.name;\n this.template = nameOrConfig.template;\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 }\n this.attributes = attributes;\n this.observedAttributes = observedAttributes;\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 =\n nameOrConfig.styles === void 0\n ? void 0\n : Array.isArray(nameOrConfig.styles)\n ? ElementStyles.create(nameOrConfig.styles)\n : nameOrConfig.styles instanceof ElementStyles\n ? nameOrConfig.styles\n : ElementStyles.create([nameOrConfig.styles]);\n }\n /**\n * Indicates if this element has been defined in at least one registry.\n */\n get isDefined() {\n return !!fastRegistry.getByType(this.type);\n }\n /**\n * Defines a custom element based on this definition.\n * @param registry - The element registry to define the element in.\n */\n define(registry = customElements) {\n const type = this.type;\n if (fastRegistry.register(this)) {\n const attributes = this.attributes;\n const proto = type.prototype;\n for (let i = 0, ii = attributes.length; i < ii; ++i) {\n Observable.defineProperty(proto, attributes[i]);\n }\n Reflect.defineProperty(type, \"observedAttributes\", {\n value: this.observedAttributes,\n enumerable: true,\n });\n }\n if (!registry.get(this.name)) {\n registry.define(this.name, type, this.elementOptions);\n }\n return this;\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.forType = fastRegistry.getByType;\n\nconst shadowRoots = new WeakMap();\nconst defaultEventOptions = {\n bubbles: true,\n composed: true,\n cancelable: true,\n};\nfunction getShadowRoot(element) {\n return element.shadowRoot || shadowRoots.get(element) || null;\n}\n/**\n * Controls the lifecycle and rendering of a `FASTElement`.\n * @public\n */\nclass Controller 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.behaviors = null;\n this.needsInitialization = true;\n this._template = null;\n this._styles = null;\n this._isConnected = false;\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.element = element;\n this.definition = definition;\n const shadowOptions = definition.shadowOptions;\n if (shadowOptions !== void 0) {\n const shadowRoot = element.attachShadow(shadowOptions);\n if (shadowOptions.mode === \"closed\") {\n shadowRoots.set(element, shadowRoot);\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, \"isConnected\");\n return this._isConnected;\n }\n setIsConnected(value) {\n this._isConnected = value;\n Observable.notify(this, \"isConnected\");\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 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 * Gets/sets the primary styles used for the component.\n * @remarks\n * This value can only be accurately read after connect but can be set at any time.\n */\n get styles() {\n return this._styles;\n }\n set styles(value) {\n if (this._styles === value) {\n return;\n }\n if (this._styles !== null) {\n this.removeStyles(this._styles);\n }\n this._styles = value;\n if (!this.needsInitialization && value !== null) {\n this.addStyles(value);\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 const target = getShadowRoot(this.element) ||\n this.element.getRootNode();\n if (styles instanceof HTMLStyleElement) {\n target.append(styles);\n }\n else if (!styles.isAttachedTo(target)) {\n const sourceBehaviors = styles.behaviors;\n styles.addStylesTo(target);\n if (sourceBehaviors !== null) {\n this.addBehaviors(sourceBehaviors);\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 const target = getShadowRoot(this.element) ||\n this.element.getRootNode();\n if (styles instanceof HTMLStyleElement) {\n target.removeChild(styles);\n }\n else if (styles.isAttachedTo(target)) {\n const sourceBehaviors = styles.behaviors;\n styles.removeStylesFrom(target);\n if (sourceBehaviors !== null) {\n this.removeBehaviors(sourceBehaviors);\n }\n }\n }\n /**\n * Adds behaviors to this element.\n * @param behaviors - The behaviors to add.\n */\n addBehaviors(behaviors) {\n const targetBehaviors = this.behaviors || (this.behaviors = new Map());\n const length = behaviors.length;\n const behaviorsToBind = [];\n for (let i = 0; i < length; ++i) {\n const behavior = behaviors[i];\n if (targetBehaviors.has(behavior)) {\n targetBehaviors.set(behavior, targetBehaviors.get(behavior) + 1);\n }\n else {\n targetBehaviors.set(behavior, 1);\n behaviorsToBind.push(behavior);\n }\n }\n if (this._isConnected) {\n const element = this.element;\n for (let i = 0; i < behaviorsToBind.length; ++i) {\n behaviorsToBind[i].bind(element, defaultExecutionContext);\n }\n }\n }\n /**\n * Removes behaviors from this element.\n * @param behaviors - The behaviors to remove.\n * @param force - Forces unbinding of behaviors.\n */\n removeBehaviors(behaviors, force = false) {\n const targetBehaviors = this.behaviors;\n if (targetBehaviors === null) {\n return;\n }\n const length = behaviors.length;\n const behaviorsToUnbind = [];\n for (let i = 0; i < length; ++i) {\n const behavior = behaviors[i];\n if (targetBehaviors.has(behavior)) {\n const count = targetBehaviors.get(behavior) - 1;\n count === 0 || force\n ? targetBehaviors.delete(behavior) && behaviorsToUnbind.push(behavior)\n : targetBehaviors.set(behavior, count);\n }\n }\n if (this._isConnected) {\n const element = this.element;\n for (let i = 0; i < behaviorsToUnbind.length; ++i) {\n behaviorsToUnbind[i].unbind(element);\n }\n }\n }\n /**\n * Runs connected lifecycle behavior on the associated element.\n */\n onConnectedCallback() {\n if (this._isConnected) {\n return;\n }\n const element = this.element;\n if (this.needsInitialization) {\n this.finishInitialization();\n }\n else if (this.view !== null) {\n this.view.bind(element, defaultExecutionContext);\n }\n const behaviors = this.behaviors;\n if (behaviors !== null) {\n for (const [behavior] of behaviors) {\n behavior.bind(element, defaultExecutionContext);\n }\n }\n this.setIsConnected(true);\n }\n /**\n * Runs disconnected lifecycle behavior on the associated element.\n */\n onDisconnectedCallback() {\n if (!this._isConnected) {\n return;\n }\n this.setIsConnected(false);\n const view = this.view;\n if (view !== null) {\n view.unbind();\n }\n const behaviors = this.behaviors;\n if (behaviors !== null) {\n const element = this.element;\n for (const [behavior] of behaviors) {\n behavior.unbind(element);\n }\n }\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.element, 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._isConnected) {\n return this.element.dispatchEvent(new CustomEvent(type, Object.assign(Object.assign({ detail }, defaultEventOptions), options)));\n }\n return false;\n }\n finishInitialization() {\n const element = this.element;\n const boundObservables = this.boundObservables;\n // If we have any observables that were bound, re-apply their values.\n if (boundObservables !== null) {\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 const definition = this.definition;\n // 1. Template overrides take top precedence.\n if (this._template === null) {\n if (this.element.resolveTemplate) {\n // 2. Allow for element instance overrides next.\n this._template = this.element.resolveTemplate();\n }\n else if (definition.template) {\n // 3. Default to the static definition.\n this._template = definition.template || null;\n }\n }\n // If we have a template after the above process, render it.\n // If there's no template, then the element author has opted into\n // custom rendering and they will managed the shadow root's content themselves.\n if (this._template !== null) {\n this.renderTemplate(this._template);\n }\n // 1. Styles overrides take top precedence.\n if (this._styles === null) {\n if (this.element.resolveStyles) {\n // 2. Allow for element instance overrides next.\n this._styles = this.element.resolveStyles();\n }\n else if (definition.styles) {\n // 3. Default to the static definition.\n this._styles = definition.styles || null;\n }\n }\n // If we have styles after the above process, add them.\n if (this._styles !== null) {\n this.addStyles(this._styles);\n }\n this.needsInitialization = false;\n }\n renderTemplate(template) {\n const element = this.element;\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 host = getShadowRoot(element) || 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) {\n // If there was previous custom rendering, we need to clear out the host.\n DOM.removeChildNodes(host);\n }\n if (template) {\n // If a new template was provided, render it.\n this.view = template.render(element, host, element);\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.forType(element.constructor);\n if (definition === void 0) {\n throw new Error(\"Missing FASTElement definition.\");\n }\n return (element.$fastController = new Controller(element, definition));\n }\n}\n\n/* eslint-disable-next-line @typescript-eslint/explicit-function-return-type */\nfunction createFASTElement(BaseType) {\n return class extends BaseType {\n constructor() {\n /* eslint-disable-next-line */\n super();\n Controller.forCustomElement(this);\n }\n $emit(type, detail, options) {\n return this.$fastController.emit(type, detail, options);\n }\n connectedCallback() {\n this.$fastController.onConnectedCallback();\n }\n disconnectedCallback() {\n this.$fastController.onDisconnectedCallback();\n }\n attributeChangedCallback(name, oldValue, newValue) {\n this.$fastController.onAttributeChangedCallback(name, oldValue, newValue);\n }\n };\n}\n/**\n * A minimal base class for FASTElements that also provides\n * static helpers for working with FASTElements.\n * @public\n */\nconst 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(BaseType) {\n return createFASTElement(BaseType);\n },\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(type, nameOrDef) {\n return new FASTElementDefinition(type, nameOrDef).define().type;\n },\n});\n\n/**\n * Directive for use in {@link css}.\n *\n * @public\n */\nclass CSSDirective {\n /**\n * Creates a CSS fragment to interpolate into the CSS document.\n * @returns - the string to interpolate into CSS\n */\n createCSS() {\n return \"\";\n }\n /**\n * Creates a behavior to bind to the host element.\n * @returns - the behavior to bind to the host element, or undefined.\n */\n createBehavior() {\n return undefined;\n }\n}\n\n/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\n\r\nfunction __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\n\n/**\n * Big thanks to https://github.com/fkleuver and the https://github.com/aurelia/aurelia project\n * for the bulk of this code and many of the associated tests.\n */\n// Tiny polyfill for TypeScript's Reflect metadata API.\nconst metadataByTarget = new Map();\nif (!(\"metadata\" in Reflect)) {\n Reflect.metadata = function (key, value) {\n return function (target) {\n Reflect.defineMetadata(key, value, target);\n };\n };\n Reflect.defineMetadata = function (key, value, target) {\n let metadata = metadataByTarget.get(target);\n if (metadata === void 0) {\n metadataByTarget.set(target, (metadata = new Map()));\n }\n metadata.set(key, value);\n };\n Reflect.getOwnMetadata = function (key, target) {\n const metadata = metadataByTarget.get(target);\n if (metadata !== void 0) {\n return metadata.get(key);\n }\n return void 0;\n };\n}\n/**\n * A utility class used that constructs and registers resolvers for a dependency\n * injection container. Supports a standard set of object lifetimes.\n * @public\n */\nclass ResolverBuilder {\n /**\n *\n * @param container - The container to create resolvers for.\n * @param key - The key to register resolvers under.\n */\n constructor(container, key) {\n this.container = container;\n this.key = key;\n }\n /**\n * Creates a resolver for an existing object instance.\n * @param value - The instance to resolve.\n * @returns The resolver.\n */\n instance(value) {\n return this.registerResolver(0 /* instance */, value);\n }\n /**\n * Creates a resolver that enforces a singleton lifetime.\n * @param value - The type to create and cache the singleton for.\n * @returns The resolver.\n */\n singleton(value) {\n return this.registerResolver(1 /* singleton */, value);\n }\n /**\n * Creates a resolver that creates a new instance for every dependency request.\n * @param value - The type to create instances of.\n * @returns - The resolver.\n */\n transient(value) {\n return this.registerResolver(2 /* transient */, value);\n }\n /**\n * Creates a resolver that invokes a callback function for every dependency resolution\n * request, allowing custom logic to return the dependency.\n * @param value - The callback to call during resolution.\n * @returns The resolver.\n */\n callback(value) {\n return this.registerResolver(3 /* callback */, value);\n }\n /**\n * Creates a resolver that invokes a callback function the first time that a dependency\n * resolution is requested. The returned value is then cached and provided for all\n * subsequent requests.\n * @param value - The callback to call during the first resolution.\n * @returns The resolver.\n */\n cachedCallback(value) {\n return this.registerResolver(3 /* callback */, cacheCallbackResult(value));\n }\n /**\n * Aliases the current key to a different key.\n * @param destinationKey - The key to point the alias to.\n * @returns The resolver.\n */\n aliasTo(destinationKey) {\n return this.registerResolver(5 /* alias */, destinationKey);\n }\n registerResolver(strategy, state) {\n const { container, key } = this;\n /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */\n this.container = this.key = (void 0);\n return container.registerResolver(key, new ResolverImpl(key, strategy, state));\n }\n}\nfunction cloneArrayWithPossibleProps(source) {\n const clone = source.slice();\n const keys = Object.keys(source);\n const len = keys.length;\n let key;\n for (let i = 0; i < len; ++i) {\n key = keys[i];\n if (!isArrayIndex(key)) {\n clone[key] = source[key];\n }\n }\n return clone;\n}\n/**\n * A set of default resolvers useful in configuring a container.\n * @public\n */\nconst DefaultResolver = Object.freeze({\n /**\n * Disables auto-registration and throws for all un-registered dependencies.\n * @param key - The key to create the resolver for.\n */\n none(key) {\n throw Error(`${key.toString()} not registered, did you forget to add @singleton()?`);\n },\n /**\n * Provides default singleton resolution behavior during auto-registration.\n * @param key - The key to create the resolver for.\n * @returns The resolver.\n */\n singleton(key) {\n return new ResolverImpl(key, 1 /* singleton */, key);\n },\n /**\n * Provides default transient resolution behavior during auto-registration.\n * @param key - The key to create the resolver for.\n * @returns The resolver.\n */\n transient(key) {\n return new ResolverImpl(key, 2 /* transient */, key);\n },\n});\n/**\n * Configuration for a dependency injection container.\n * @public\n */\nconst ContainerConfiguration = Object.freeze({\n /**\n * The default configuration used when creating a DOM-disconnected container.\n * @remarks\n * The default creates a root container, with no parent container. It does not handle\n * owner requests and it uses singleton resolution behavior for auto-registration.\n */\n default: Object.freeze({\n parentLocator: () => null,\n responsibleForOwnerRequests: false,\n defaultResolver: DefaultResolver.singleton,\n }),\n});\nconst dependencyLookup = new Map();\nfunction getParamTypes(key) {\n return (Type) => {\n return Reflect.getOwnMetadata(key, Type);\n };\n}\nlet rootDOMContainer = null;\n/**\n * The gateway to dependency injection APIs.\n * @public\n */\nconst DI = Object.freeze({\n /**\n * Creates a new dependency injection container.\n * @param config - The configuration for the container.\n * @returns A newly created dependency injection container.\n */\n createContainer(config) {\n return new ContainerImpl(null, Object.assign({}, ContainerConfiguration.default, config));\n },\n /**\n * Finds the dependency injection container responsible for providing dependencies\n * to the specified node.\n * @param node - The node to find the responsible container for.\n * @returns The container responsible for providing dependencies to the node.\n * @remarks\n * This will be the same as the parent container if the specified node\n * does not itself host a container configured with responsibleForOwnerRequests.\n */\n findResponsibleContainer(node) {\n const owned = node.$$container$$;\n if (owned && owned.responsibleForOwnerRequests) {\n return owned;\n }\n return DI.findParentContainer(node);\n },\n /**\n * Find the dependency injection container up the DOM tree from this node.\n * @param node - The node to find the parent container for.\n * @returns The parent container of this node.\n * @remarks\n * This will be the same as the responsible container if the specified node\n * does not itself host a container configured with responsibleForOwnerRequests.\n */\n findParentContainer(node) {\n const event = new CustomEvent(DILocateParentEventType, {\n bubbles: true,\n composed: true,\n cancelable: true,\n detail: { container: void 0 },\n });\n node.dispatchEvent(event);\n return event.detail.container || DI.getOrCreateDOMContainer();\n },\n /**\n * Returns a dependency injection container if one is explicitly owned by the specified\n * node. If one is not owned, then a new container is created and assigned to the node.\n * @param node - The node to find or create the container for.\n * @param config - The configuration for the container if one needs to be created.\n * @returns The located or created container.\n * @remarks\n * This API does not search for a responsible or parent container. It looks only for a container\n * directly defined on the specified node and creates one at that location if one does not\n * already exist.\n */\n getOrCreateDOMContainer(node, config) {\n if (!node) {\n return (rootDOMContainer ||\n (rootDOMContainer = new ContainerImpl(null, Object.assign({}, ContainerConfiguration.default, config, {\n parentLocator: () => null,\n }))));\n }\n return (node.$$container$$ ||\n new ContainerImpl(node, Object.assign({}, ContainerConfiguration.default, config, {\n parentLocator: DI.findParentContainer,\n })));\n },\n /**\n * Gets the \"design:paramtypes\" metadata for the specified type.\n * @param Type - The type to get the metadata for.\n * @returns The metadata array or undefined if no metadata is found.\n */\n getDesignParamtypes: getParamTypes(\"design:paramtypes\"),\n /**\n * Gets the \"di:paramtypes\" metadata for the specified type.\n * @param Type - The type to get the metadata for.\n * @returns The metadata array or undefined if no metadata is found.\n */\n getAnnotationParamtypes: getParamTypes(\"di:paramtypes\"),\n /**\n *\n * @param Type - Gets the \"di:paramtypes\" metadata for the specified type. If none is found,\n * an empty metadata array is created and added.\n * @returns The metadata array.\n */\n getOrCreateAnnotationParamTypes(Type) {\n let annotationParamtypes = this.getAnnotationParamtypes(Type);\n if (annotationParamtypes === void 0) {\n Reflect.defineMetadata(\"di:paramtypes\", (annotationParamtypes = []), Type);\n }\n return annotationParamtypes;\n },\n /**\n * Gets the dependency keys representing what is needed to instantiate the specified type.\n * @param Type - The type to get the dependencies for.\n * @returns An array of dependency keys.\n */\n getDependencies(Type) {\n // Note: Every detail of this getDependencies method is pretty deliberate at the moment, and probably not yet 100% tested from every possible angle,\n // so be careful with making changes here as it can have a huge impact on complex end user apps.\n // Preferably, only make changes to the dependency resolution process via a RFC.\n let dependencies = dependencyLookup.get(Type);\n if (dependencies === void 0) {\n // Type.length is the number of constructor parameters. If this is 0, it could mean the class has an empty constructor\n // but it could also mean the class has no constructor at all (in which case it inherits the constructor from the prototype).\n // Non-zero constructor length + no paramtypes means emitDecoratorMetadata is off, or the class has no decorator.\n // We're not doing anything with the above right now, but it's good to keep in mind for any future issues.\n const inject = Type.inject;\n if (inject === void 0) {\n // design:paramtypes is set by tsc when emitDecoratorMetadata is enabled.\n const designParamtypes = DI.getDesignParamtypes(Type);\n // di:paramtypes is set by the parameter decorator from DI.createInterface or by @inject\n const annotationParamtypes = DI.getAnnotationParamtypes(Type);\n if (designParamtypes === void 0) {\n if (annotationParamtypes === void 0) {\n // Only go up the prototype if neither static inject nor any of the paramtypes is defined, as\n // there is no sound way to merge a type's deps with its prototype's deps\n const Proto = Object.getPrototypeOf(Type);\n if (typeof Proto === \"function\" && Proto !== Function.prototype) {\n dependencies = cloneArrayWithPossibleProps(DI.getDependencies(Proto));\n }\n else {\n dependencies = [];\n }\n }\n else {\n // No design:paramtypes so just use the di:paramtypes\n dependencies = cloneArrayWithPossibleProps(annotationParamtypes);\n }\n }\n else if (annotationParamtypes === void 0) {\n // No di:paramtypes so just use the design:paramtypes\n dependencies = cloneArrayWithPossibleProps(designParamtypes);\n }\n else {\n // We've got both, so merge them (in case of conflict on same index, di:paramtypes take precedence)\n dependencies = cloneArrayWithPossibleProps(designParamtypes);\n let len = annotationParamtypes.length;\n let auAnnotationParamtype;\n for (let i = 0; i < len; ++i) {\n auAnnotationParamtype = annotationParamtypes[i];\n if (auAnnotationParamtype !== void 0) {\n dependencies[i] = auAnnotationParamtype;\n }\n }\n const keys = Object.keys(annotationParamtypes);\n len = keys.length;\n let key;\n for (let i = 0; i < len; ++i) {\n key = keys[i];\n if (!isArrayIndex(key)) {\n dependencies[key] = annotationParamtypes[key];\n }\n }\n }\n }\n else {\n // Ignore paramtypes if we have static inject\n dependencies = cloneArrayWithPossibleProps(inject);\n }\n dependencyLookup.set(Type, dependencies);\n }\n return dependencies;\n },\n /**\n * Defines a property on a web component class. The value of this property will\n * be resolved from the dependency injection container responsible for the element\n * instance, based on where it is connected in the DOM.\n * @param target - The target to define the property on.\n * @param propertyName - The name of the property to define.\n * @param key - The dependency injection key.\n * @param respectConnection - Indicates whether or not to update the property value if the\n * hosting component is disconnected and then re-connected at a different location in the DOM.\n * @remarks\n * The respectConnection option is only applicable to elements that descend from FASTElement.\n */\n defineProperty(target, propertyName, key, respectConnection = false) {\n const diPropertyKey = `$di_${propertyName}`;\n Reflect.defineProperty(target, propertyName, {\n get: function () {\n let value = this[diPropertyKey];\n if (value === void 0) {\n const container = this instanceof HTMLElement\n ? DI.findResponsibleContainer(this)\n : DI.getOrCreateDOMContainer();\n value = container.get(key);\n this[diPropertyKey] = value;\n if (respectConnection && this instanceof FASTElement) {\n const notifier = this.$fastController;\n const handleChange = () => {\n const newContainer = DI.findResponsibleContainer(this);\n const newValue = newContainer.get(key);\n const oldValue = this[diPropertyKey];\n if (newValue !== oldValue) {\n this[diPropertyKey] = value;\n notifier.notify(propertyName);\n }\n };\n notifier.subscribe({ handleChange }, \"isConnected\");\n }\n }\n return value;\n },\n });\n },\n /**\n * Creates a dependency injection key.\n * @param nameConfigOrCallback - A friendly name for the key or a lambda that configures a\n * default resolution for the dependency.\n * @param configuror - If a friendly name was provided for the first parameter, then an optional\n * lambda that configures a default resolution for the dependency can be provided second.\n * @returns The created key.\n * @remarks\n * The created key can be used as a property decorator or constructor parameter decorator,\n * in addition to its standard use in an inject array or through direct container APIs.\n */\n createInterface(nameConfigOrCallback, configuror) {\n const configure = typeof nameConfigOrCallback === \"function\"\n ? nameConfigOrCallback\n : configuror;\n const friendlyName = typeof nameConfigOrCallback === \"string\"\n ? nameConfigOrCallback\n : nameConfigOrCallback && \"friendlyName\" in nameConfigOrCallback\n ? nameConfigOrCallback.friendlyName || defaultFriendlyName\n : defaultFriendlyName;\n const respectConnection = typeof nameConfigOrCallback === \"string\"\n ? false\n : nameConfigOrCallback && \"respectConnection\" in nameConfigOrCallback\n ? nameConfigOrCallback.respectConnection || false\n : false;\n const Interface = function (target, property, index) {\n if (target == null || new.target !== undefined) {\n throw new Error(`No registration for interface: '${Interface.friendlyName}'`);\n }\n if (property) {\n DI.defineProperty(target, property, Interface, respectConnection);\n }\n else {\n const annotationParamtypes = DI.getOrCreateAnnotationParamTypes(target);\n annotationParamtypes[index] = Interface;\n }\n };\n Interface.$isInterface = true;\n Interface.friendlyName = friendlyName == null ? \"(anonymous)\" : friendlyName;\n if (configure != null) {\n Interface.register = function (container, key) {\n return configure(new ResolverBuilder(container, key !== null && key !== void 0 ? key : Interface));\n };\n }\n Interface.toString = function toString() {\n return `InterfaceSymbol<${Interface.friendlyName}>`;\n };\n return Interface;\n },\n /**\n * A decorator that specifies what to inject into its target.\n * @param dependencies - The dependencies to inject.\n * @returns The decorator to be applied to the target class.\n * @remarks\n * The decorator can be used to decorate a class, listing all of the classes dependencies.\n * Or it can be used to decorate a constructor paramter, indicating what to inject for that\n * parameter.\n * Or it can be used for a web component property, indicating what that property should resolve to.\n */\n inject(...dependencies) {\n return function (target, key, descriptor) {\n if (typeof descriptor === \"number\") {\n // It's a parameter decorator.\n const annotationParamtypes = DI.getOrCreateAnnotationParamTypes(target);\n const dep = dependencies[0];\n if (dep !== void 0) {\n annotationParamtypes[descriptor] = dep;\n }\n }\n else if (key) {\n DI.defineProperty(target, key, dependencies[0]);\n }\n else {\n const annotationParamtypes = descriptor\n ? DI.getOrCreateAnnotationParamTypes(descriptor.value)\n : DI.getOrCreateAnnotationParamTypes(target);\n let dep;\n for (let i = 0; i < dependencies.length; ++i) {\n dep = dependencies[i];\n if (dep !== void 0) {\n annotationParamtypes[i] = dep;\n }\n }\n }\n };\n },\n /**\n * Registers the `target` class as a transient dependency; each time the dependency is resolved\n * a new instance will be created.\n *\n * @param target - The class / constructor function to register as transient.\n * @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.\n *\n * @example\n * On an existing class\n * ```ts\n * class Foo { }\n * DI.transient(Foo);\n * ```\n *\n * @example\n * Inline declaration\n *\n * ```ts\n * const Foo = DI.transient(class { });\n * // Foo is now strongly typed with register\n * Foo.register(container);\n * ```\n *\n * @public\n */\n transient(target) {\n target.register = function register(container) {\n const registration = Registration.transient(target, target);\n return registration.register(container);\n };\n target.registerInRequestor = false;\n return target;\n },\n /**\n * Registers the `target` class as a singleton dependency; the class will only be created once. Each\n * consecutive time the dependency is resolved, the same instance will be returned.\n *\n * @param target - The class / constructor function to register as a singleton.\n * @returns The same class, with a static `register` method that takes a container and returns the appropriate resolver.\n * @example\n * On an existing class\n * ```ts\n * class Foo { }\n * DI.singleton(Foo);\n * ```\n *\n * @example\n * Inline declaration\n * ```ts\n * const Foo = DI.singleton(class { });\n * // Foo is now strongly typed with register\n * Foo.register(container);\n * ```\n *\n * @public\n */\n singleton(target, options = defaultSingletonOptions) {\n target.register = function register(container) {\n const registration = Registration.singleton(target, target);\n return registration.register(container);\n };\n target.registerInRequestor = options.scoped;\n return target;\n },\n});\n/**\n * The interface key that resolves the dependency injection container itself.\n * @public\n */\nconst Container = DI.createInterface(\"Container\");\n/**\n * A decorator that specifies what to inject into its target.\n * @param dependencies - The dependencies to inject.\n * @returns The decorator to be applied to the target class.\n * @remarks\n * The decorator can be used to decorate a class, listing all of the classes dependencies.\n * Or it can be used to decorate a constructor paramter, indicating what to inject for that\n * parameter.\n * Or it can be used for a web component property, indicating what that property should resolve to.\n *\n * @public\n */\nDI.inject;\nconst defaultSingletonOptions = { scoped: false };\n/** @internal */\nclass ResolverImpl {\n constructor(key, strategy, state) {\n this.key = key;\n this.strategy = strategy;\n this.state = state;\n this.resolving = false;\n }\n get $isResolver() {\n return true;\n }\n register(container) {\n return container.registerResolver(this.key, this);\n }\n resolve(handler, requestor) {\n switch (this.strategy) {\n case 0 /* instance */:\n return this.state;\n case 1 /* singleton */: {\n if (this.resolving) {\n throw new Error(`Cyclic dependency found: ${this.state.name}`);\n }\n this.resolving = true;\n this.state = handler\n .getFactory(this.state)\n .construct(requestor);\n this.strategy = 0 /* instance */;\n this.resolving = false;\n return this.state;\n }\n case 2 /* transient */: {\n // Always create transients from the requesting container\n const factory = handler.getFactory(this.state);\n if (factory === null) {\n throw new Error(`Resolver for ${String(this.key)} returned a null factory`);\n }\n return factory.construct(requestor);\n }\n case 3 /* callback */:\n return this.state(handler, requestor, this);\n case 4 /* array */:\n return this.state[0].resolve(handler, requestor);\n case 5 /* alias */:\n return requestor.get(this.state);\n default:\n throw new Error(`Invalid resolver strategy specified: ${this.strategy}.`);\n }\n }\n getFactory(container) {\n var _a, _b, _c;\n switch (this.strategy) {\n case 1 /* singleton */:\n case 2 /* transient */:\n return container.getFactory(this.state);\n case 5 /* alias */:\n return (_c = (_b = (_a = container.getResolver(this.state)) === null || _a === void 0 ? void 0 : _a.getFactory) === null || _b === void 0 ? void 0 : _b.call(_a, container)) !== null && _c !== void 0 ? _c : null;\n default:\n return null;\n }\n }\n}\nfunction containerGetKey(d) {\n return this.get(d);\n}\nfunction transformInstance(inst, transform) {\n return transform(inst);\n}\n/** @internal */\nclass FactoryImpl {\n constructor(Type, dependencies) {\n this.Type = Type;\n this.dependencies = dependencies;\n this.transformers = null;\n }\n construct(container, dynamicDependencies) {\n let instance;\n if (dynamicDependencies === void 0) {\n instance = new this.Type(...this.dependencies.map(containerGetKey, container));\n }\n else {\n instance = new this.Type(...this.dependencies.map(containerGetKey, container), ...dynamicDependencies);\n }\n if (this.transformers == null) {\n return instance;\n }\n return this.transformers.reduce(transformInstance, instance);\n }\n registerTransformer(transformer) {\n (this.transformers || (this.transformers = [])).push(transformer);\n }\n}\nconst containerResolver = {\n $isResolver: true,\n resolve(handler, requestor) {\n return requestor;\n },\n};\nfunction isRegistry(obj) {\n return typeof obj.register === \"function\";\n}\nfunction isSelfRegistry(obj) {\n return isRegistry(obj) && typeof obj.registerInRequestor === \"boolean\";\n}\nfunction isRegisterInRequester(obj) {\n return isSelfRegistry(obj) && obj.registerInRequestor;\n}\nfunction isClass(obj) {\n return obj.prototype !== void 0;\n}\nconst InstrinsicTypeNames = new Set([\n \"Array\",\n \"ArrayBuffer\",\n \"Boolean\",\n \"DataView\",\n \"Date\",\n \"Error\",\n \"EvalError\",\n \"Float32Array\",\n \"Float64Array\",\n \"Function\",\n \"Int8Array\",\n \"Int16Array\",\n \"Int32Array\",\n \"Map\",\n \"Number\",\n \"Object\",\n \"Promise\",\n \"RangeError\",\n \"ReferenceError\",\n \"RegExp\",\n \"Set\",\n \"SharedArrayBuffer\",\n \"String\",\n \"SyntaxError\",\n \"TypeError\",\n \"Uint8Array\",\n \"Uint8ClampedArray\",\n \"Uint16Array\",\n \"Uint32Array\",\n \"URIError\",\n \"WeakMap\",\n \"WeakSet\",\n]);\nconst DILocateParentEventType = \"__DI_LOCATE_PARENT__\";\nconst factories = new Map();\n/**\n * @internal\n */\nclass ContainerImpl {\n constructor(owner, config) {\n this.owner = owner;\n this.config = config;\n this._parent = void 0;\n this.registerDepth = 0;\n this.context = null;\n if (owner !== null) {\n owner.$$container$$ = this;\n }\n this.resolvers = new Map();\n this.resolvers.set(Container, containerResolver);\n if (owner instanceof Node) {\n owner.addEventListener(DILocateParentEventType, (e) => {\n if (e.composedPath()[0] !== this.owner) {\n e.detail.container = this;\n e.stopImmediatePropagation();\n }\n });\n }\n }\n get parent() {\n if (this._parent === void 0) {\n this._parent = this.config.parentLocator(this.owner);\n }\n return this._parent;\n }\n get depth() {\n return this.parent === null ? 0 : this.parent.depth + 1;\n }\n get responsibleForOwnerRequests() {\n return this.config.responsibleForOwnerRequests;\n }\n registerWithContext(context, ...params) {\n this.context = context;\n this.register(...params);\n this.context = null;\n return this;\n }\n register(...params) {\n if (++this.registerDepth === 100) {\n throw new Error(\"Unable to autoregister dependency\");\n // Most likely cause is trying to register a plain object that does not have a\n // register method and is not a class constructor\n }\n let current;\n let keys;\n let value;\n let j;\n let jj;\n const context = this.context;\n for (let i = 0, ii = params.length; i < ii; ++i) {\n current = params[i];\n if (!isObject(current)) {\n continue;\n }\n if (isRegistry(current)) {\n current.register(this, context);\n }\n else if (isClass(current)) {\n Registration.singleton(current, current).register(this);\n }\n else {\n keys = Object.keys(current);\n j = 0;\n jj = keys.length;\n for (; j < jj; ++j) {\n value = current[keys[j]];\n if (!isObject(value)) {\n continue;\n }\n // note: we could remove this if-branch and call this.register directly\n // - the extra check is just a perf tweak to create fewer unnecessary arrays by the spread operator\n if (isRegistry(value)) {\n value.register(this, context);\n }\n else {\n this.register(value);\n }\n }\n }\n }\n --this.registerDepth;\n return this;\n }\n registerResolver(key, resolver) {\n validateKey(key);\n const resolvers = this.resolvers;\n const result = resolvers.get(key);\n if (result == null) {\n resolvers.set(key, resolver);\n }\n else if (result instanceof ResolverImpl &&\n result.strategy === 4 /* array */) {\n result.state.push(resolver);\n }\n else {\n resolvers.set(key, new ResolverImpl(key, 4 /* array */, [result, resolver]));\n }\n return resolver;\n }\n registerTransformer(key, transformer) {\n const resolver = this.getResolver(key);\n if (resolver == null) {\n return false;\n }\n if (resolver.getFactory) {\n const factory = resolver.getFactory(this);\n if (factory == null) {\n return false;\n }\n // This type cast is a bit of a hacky one, necessary due to the duplicity of IResolverLike.\n // Problem is that that interface's type arg can be of type Key, but the getFactory method only works on\n // type Constructable. So the return type of that optional method has this additional constraint, which\n // seems to confuse the type checker.\n factory.registerTransformer(transformer);\n return true;\n }\n return false;\n }\n getResolver(key, autoRegister = true) {\n validateKey(key);\n if (key.resolve !== void 0) {\n return key;\n }\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let current = this;\n let resolver;\n while (current != null) {\n resolver = current.resolvers.get(key);\n if (resolver == null) {\n if (current.parent == null) {\n const handler = isRegisterInRequester(key)\n ? this\n : current;\n return autoRegister ? this.jitRegister(key, handler) : null;\n }\n current = current.parent;\n }\n else {\n return resolver;\n }\n }\n return null;\n }\n has(key, searchAncestors = false) {\n return this.resolvers.has(key)\n ? true\n : searchAncestors && this.parent != null\n ? this.parent.has(key, true)\n : false;\n }\n get(key) {\n validateKey(key);\n if (key.$isResolver) {\n return key.resolve(this, this);\n }\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n let current = this;\n let resolver;\n while (current != null) {\n resolver = current.resolvers.get(key);\n if (resolver == null) {\n if (current.parent == null) {\n const handler = isRegisterInRequester(key)\n ? this\n : current;\n resolver = this.jitRegister(key, handler);\n return resolver.resolve(current, this);\n }\n current = current.parent;\n }\n else {\n return resolver.resolve(current, this);\n }\n }\n throw new Error(`Unable to resolve key: ${String(key)}`);\n }\n getAll(key, searchAncestors = false) {\n validateKey(key);\n /* eslint-disable-next-line @typescript-eslint/no-this-alias */\n const requestor = this;\n let current = requestor;\n let resolver;\n if (searchAncestors) {\n let resolutions = emptyArray;\n while (current != null) {\n resolver = current.resolvers.get(key);\n if (resolver != null) {\n resolutions = resolutions.concat(\n /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */\n buildAllResponse(resolver, current, requestor));\n }\n current = current.parent;\n }\n return resolutions;\n }\n else {\n while (current != null) {\n resolver = current.resolvers.get(key);\n if (resolver == null) {\n current = current.parent;\n if (current == null) {\n return emptyArray;\n }\n }\n else {\n return buildAllResponse(resolver, current, requestor);\n }\n }\n }\n return emptyArray;\n }\n getFactory(Type) {\n let factory = factories.get(Type);\n if (factory === void 0) {\n if (isNativeFunction(Type)) {\n throw new Error(`${Type.name} is a native function and therefore cannot be safely constructed by DI. If this is intentional, please use a callback or cachedCallback resolver.`);\n }\n factories.set(Type, (factory = new FactoryImpl(Type, DI.getDependencies(Type))));\n }\n return factory;\n }\n registerFactory(key, factory) {\n factories.set(key, factory);\n }\n createChild(config) {\n return new ContainerImpl(null, Object.assign({}, this.config, config, { parentLocator: () => this }));\n }\n jitRegister(keyAsValue, handler) {\n if (typeof keyAsValue !== \"function\") {\n throw new Error(`Attempted to jitRegister something that is not a constructor: '${keyAsValue}'. Did you forget to register this dependency?`);\n }\n if (InstrinsicTypeNames.has(keyAsValue.name)) {\n throw new Error(`Attempted to jitRegister an intrinsic type: ${keyAsValue.name}. Did you forget to add @inject(Key)`);\n }\n if (isRegistry(keyAsValue)) {\n const registrationResolver = keyAsValue.register(handler);\n if (!(registrationResolver instanceof Object) ||\n registrationResolver.resolve == null) {\n const newResolver = handler.resolvers.get(keyAsValue);\n if (newResolver != void 0) {\n return newResolver;\n }\n throw new Error(\"A valid resolver was not returned from the static register method\");\n }\n return registrationResolver;\n }\n else if (keyAsValue.$isInterface) {\n throw new Error(`Attempted to jitRegister an interface: ${keyAsValue.friendlyName}`);\n }\n else {\n const resolver = this.config.defaultResolver(keyAsValue, handler);\n handler.resolvers.set(keyAsValue, resolver);\n return resolver;\n }\n }\n}\nconst cache = new WeakMap();\nfunction cacheCallbackResult(fun) {\n return function (handler, requestor, resolver) {\n if (cache.has(resolver)) {\n return cache.get(resolver);\n }\n const t = fun(handler, requestor, resolver);\n cache.set(resolver, t);\n return t;\n };\n}\n/**\n * You can use the resulting Registration of any of the factory methods\n * to register with the container.\n *\n * @example\n * ```\n * class Foo {}\n * const container = DI.createContainer();\n * container.register(Registration.instance(Foo, new Foo()));\n * container.get(Foo);\n * ```\n *\n * @public\n */\nconst Registration = Object.freeze({\n /**\n * Allows you to pass an instance.\n * Every time you request this {@link Key} you will get this instance back.\n *\n * @example\n * ```\n * Registration.instance(Foo, new Foo()));\n * ```\n *\n * @param key - The key to register the instance under.\n * @param value - The instance to return when the key is requested.\n */\n instance(key, value) {\n return new ResolverImpl(key, 0 /* instance */, value);\n },\n /**\n * Creates an instance from the class.\n * Every time you request this {@link Key} you will get the same one back.\n *\n * @example\n * ```\n * Registration.singleton(Foo, Foo);\n * ```\n *\n * @param key - The key to register the singleton under.\n * @param value - The class to instantiate as a singleton when first requested.\n */\n singleton(key, value) {\n return new ResolverImpl(key, 1 /* singleton */, value);\n },\n /**\n * Creates an instance from a class.\n * Every time you request this {@link Key} you will get a new instance.\n *\n * @example\n * ```\n * Registration.instance(Foo, Foo);\n * ```\n *\n * @param key - The key to register the instance type under.\n * @param value - The class to instantiate each time the key is requested.\n */\n transient(key, value) {\n return new ResolverImpl(key, 2 /* transient */, value);\n },\n /**\n * Delegates to a callback function to provide the dependency.\n * Every time you request this {@link Key} the callback will be invoked to provide\n * the dependency.\n *\n * @example\n * ```\n * Registration.callback(Foo, () => new Foo());\n * Registration.callback(Bar, (c: Container) => new Bar(c.get(Foo)));\n * ```\n *\n * @param key - The key to register the callback for.\n * @param callback - The function that is expected to return the dependency.\n */\n callback(key, callback) {\n return new ResolverImpl(key, 3 /* callback */, callback);\n },\n /**\n * Delegates to a callback function to provide the dependency and then caches the\n * dependency for future requests.\n *\n * @example\n * ```\n * Registration.cachedCallback(Foo, () => new Foo());\n * Registration.cachedCallback(Bar, (c: Container) => new Bar(c.get(Foo)));\n * ```\n *\n * @param key - The key to register the callback for.\n * @param callback - The function that is expected to return the dependency.\n * @remarks\n * If you pass the same Registration to another container, the same cached value will be used.\n * Should all references to the resolver returned be removed, the cache will expire.\n */\n cachedCallback(key, callback) {\n return new ResolverImpl(key, 3 /* callback */, cacheCallbackResult(callback));\n },\n /**\n * Creates an alternate {@link Key} to retrieve an instance by.\n *\n * @example\n * ```\n * Register.singleton(Foo, Foo)\n * Register.aliasTo(Foo, MyFoos);\n *\n * container.getAll(MyFoos) // contains an instance of Foo\n * ```\n *\n * @param originalKey - The original key that has been registered.\n * @param aliasKey - The alias to the original key.\n */\n aliasTo(originalKey, aliasKey) {\n return new ResolverImpl(aliasKey, 5 /* alias */, originalKey);\n },\n});\n/** @internal */\nfunction validateKey(key) {\n if (key === null || key === void 0) {\n throw new Error(\"key/value cannot be null or undefined. Are you trying to inject/register something that doesn't exist with DI?\");\n }\n}\nfunction buildAllResponse(resolver, handler, requestor) {\n if (resolver instanceof ResolverImpl &&\n resolver.strategy === 4 /* array */) {\n const state = resolver.state;\n let i = state.length;\n const results = new Array(i);\n while (i--) {\n results[i] = state[i].resolve(handler, requestor);\n }\n return results;\n }\n return [resolver.resolve(handler, requestor)];\n}\nconst defaultFriendlyName = \"(anonymous)\";\nfunction isObject(value) {\n return (typeof value === \"object\" && value !== null) || typeof value === \"function\";\n}\n/**\n * Determine whether the value is a native function.\n *\n * @param fn - The function to check.\n * @returns `true` is the function is a native function, otherwise `false`\n */\nconst isNativeFunction = (function () {\n const lookup = new WeakMap();\n let isNative = false;\n let sourceText = \"\";\n let i = 0;\n return function (fn) {\n isNative = lookup.get(fn);\n if (isNative === void 0) {\n sourceText = fn.toString();\n i = sourceText.length;\n // http://www.ecma-international.org/ecma-262/#prod-NativeFunction\n isNative =\n // 29 is the length of 'function () { [native code] }' which is the smallest length of a native function string\n i >= 29 &&\n // 100 seems to be a safe upper bound of the max length of a native function. In Chrome and FF it's 56, in Edge it's 61.\n i <= 100 &&\n // This whole heuristic *could* be tricked by a comment. Do we need to care about that?\n sourceText.charCodeAt(i - 1) === 0x7d && // }\n // TODO: the spec is a little vague about the precise constraints, so we do need to test this across various browsers to make sure just one whitespace is a safe assumption.\n sourceText.charCodeAt(i - 2) <= 0x20 && // whitespace\n sourceText.charCodeAt(i - 3) === 0x5d && // ]\n sourceText.charCodeAt(i - 4) === 0x65 && // e\n sourceText.charCodeAt(i - 5) === 0x64 && // d\n sourceText.charCodeAt(i - 6) === 0x6f && // o\n sourceText.charCodeAt(i - 7) === 0x63 && // c\n sourceText.charCodeAt(i - 8) === 0x20 && //\n sourceText.charCodeAt(i - 9) === 0x65 && // e\n sourceText.charCodeAt(i - 10) === 0x76 && // v\n sourceText.charCodeAt(i - 11) === 0x69 && // i\n sourceText.charCodeAt(i - 12) === 0x74 && // t\n sourceText.charCodeAt(i - 13) === 0x61 && // a\n sourceText.charCodeAt(i - 14) === 0x6e && // n\n sourceText.charCodeAt(i - 15) === 0x58; // [\n lookup.set(fn, isNative);\n }\n return isNative;\n };\n})();\nconst isNumericLookup = {};\nfunction isArrayIndex(value) {\n switch (typeof value) {\n case \"number\":\n return value >= 0 && (value | 0) === value;\n case \"string\": {\n const result = isNumericLookup[value];\n if (result !== void 0) {\n return result;\n }\n const length = value.length;\n if (length === 0) {\n return (isNumericLookup[value] = false);\n }\n let ch = 0;\n for (let i = 0; i < length; ++i) {\n ch = value.charCodeAt(i);\n if ((i === 0 && ch === 0x30 && length > 1) /* must not start with 0 */ ||\n ch < 0x30 /* 0 */ ||\n ch > 0x39 /* 9 */) {\n return (isNumericLookup[value] = false);\n }\n }\n return (isNumericLookup[value] = true);\n }\n default:\n return false;\n }\n}\n\nfunction presentationKeyFromTag(tagName) {\n return `${tagName.toLowerCase()}:presentation`;\n}\nconst presentationRegistry = new Map();\n/**\n * An API gateway to component presentation features.\n * @public\n */\nconst ComponentPresentation = Object.freeze({\n /**\n * Defines a component presentation for an element.\n * @param tagName - The element name to define the presentation for.\n * @param presentation - The presentation that will be applied to matching elements.\n * @param container - The dependency injection container to register the configuration in.\n * @public\n */\n define(tagName, presentation, container) {\n const key = presentationKeyFromTag(tagName);\n const existing = presentationRegistry.get(key);\n if (existing === void 0) {\n presentationRegistry.set(key, presentation);\n }\n else {\n // false indicates that we have more than one presentation\n // registered for a tagName and we must resolve through DI\n presentationRegistry.set(key, false);\n }\n container.register(Registration.instance(key, presentation));\n },\n /**\n * Finds a component presentation for the specified element name,\n * searching the DOM hierarchy starting from the provided element.\n * @param tagName - The name of the element to locate the presentation for.\n * @param element - The element to begin the search from.\n * @returns The component presentation or null if none is found.\n * @public\n */\n forTag(tagName, element) {\n const key = presentationKeyFromTag(tagName);\n const existing = presentationRegistry.get(key);\n if (existing === false) {\n const container = DI.findResponsibleContainer(element);\n return container.get(key);\n }\n return existing || null;\n },\n});\n/**\n * The default implementation of ComponentPresentation, used by FoundationElement.\n * @public\n */\nclass DefaultComponentPresentation {\n /**\n * Creates an instance of DefaultComponentPresentation.\n * @param template - The template to apply to the element.\n * @param styles - The styles to apply to the element.\n * @public\n */\n constructor(template, styles) {\n this.template = template || null;\n this.styles =\n styles === void 0\n ? null\n : Array.isArray(styles)\n ? ElementStyles.create(styles)\n : styles instanceof ElementStyles\n ? styles\n : ElementStyles.create([styles]);\n }\n /**\n * Applies the presentation details to the specified element.\n * @param element - The element to apply the presentation details to.\n * @public\n */\n applyTo(element) {\n const controller = element.$fastController;\n if (controller.template === null) {\n controller.template = this.template;\n }\n if (controller.styles === null) {\n controller.styles = this.styles;\n }\n }\n}\n\n/**\n * Defines a foundation element class that:\n * 1. Connects the element to its ComponentPresentation\n * 2. Allows resolving the element template from the instance or ComponentPresentation\n * 3. Allows resolving the element styles from the instance or ComponentPresentation\n *\n * @public\n */\nclass FoundationElement extends FASTElement {\n constructor() {\n super(...arguments);\n this._presentation = void 0;\n }\n /**\n * A property which resolves the ComponentPresentation instance\n * for the current component.\n * @public\n */\n get $presentation() {\n if (this._presentation === void 0) {\n this._presentation = ComponentPresentation.forTag(this.tagName, this);\n }\n return this._presentation;\n }\n templateChanged() {\n if (this.template !== undefined) {\n this.$fastController.template = this.template;\n }\n }\n stylesChanged() {\n if (this.styles !== undefined) {\n this.$fastController.styles = this.styles;\n }\n }\n /**\n * The connected callback for this FASTElement.\n * @remarks\n * This method is invoked by the platform whenever this FoundationElement\n * becomes connected to the document.\n * @public\n */\n connectedCallback() {\n if (this.$presentation !== null) {\n this.$presentation.applyTo(this);\n }\n super.connectedCallback();\n }\n /**\n * Defines an element registry function with a set of element definition defaults.\n * @param elementDefinition - The definition of the element to create the registry\n * function for.\n * @public\n */\n static compose(elementDefinition) {\n return (overrideDefinition = {}) => new FoundationElementRegistry(this === FoundationElement\n ? class extends FoundationElement {\n }\n : this, elementDefinition, overrideDefinition);\n }\n}\n__decorate([\n observable\n], FoundationElement.prototype, \"template\", void 0);\n__decorate([\n observable\n], FoundationElement.prototype, \"styles\", void 0);\nfunction resolveOption(option, context, definition) {\n if (typeof option === \"function\") {\n return option(context, definition);\n }\n return option;\n}\n/**\n * Registry capable of defining presentation properties for a DOM Container hierarchy.\n *\n * @internal\n */\n/* eslint-disable @typescript-eslint/no-unused-vars */\nclass FoundationElementRegistry {\n constructor(type, elementDefinition, overrideDefinition) {\n this.type = type;\n this.elementDefinition = elementDefinition;\n this.overrideDefinition = overrideDefinition;\n this.definition = Object.assign(Object.assign({}, this.elementDefinition), this.overrideDefinition);\n }\n register(container, context) {\n const definition = this.definition;\n const overrideDefinition = this.overrideDefinition;\n const prefix = definition.prefix || context.elementPrefix;\n const name = `${prefix}-${definition.baseName}`;\n context.tryDefineElement({\n name,\n type: this.type,\n baseClass: this.elementDefinition.baseClass,\n callback: x => {\n const presentation = new DefaultComponentPresentation(resolveOption(definition.template, x, definition), resolveOption(definition.styles, x, definition));\n x.definePresentation(presentation);\n let shadowOptions = resolveOption(definition.shadowOptions, x, definition);\n if (x.shadowRootMode) {\n // If the design system has overridden the shadow root mode, we need special handling.\n if (shadowOptions) {\n // If there are shadow options present in the definition, then\n // either the component itself has specified an option or the\n // registry function has overridden it.\n if (!overrideDefinition.shadowOptions) {\n // There were shadow options provided by the component and not overridden by\n // the registry.\n shadowOptions.mode = x.shadowRootMode;\n }\n }\n else if (shadowOptions !== null) {\n // If the component author did not provide shadow options,\n // and did not null them out (light dom opt-in) then they\n // were relying on the FASTElement default. So, if the\n // design system provides a mode, we need to create the options\n // to override the default.\n shadowOptions = { mode: x.shadowRootMode };\n }\n }\n x.defineElement({\n elementOptions: resolveOption(definition.elementOptions, x, definition),\n shadowOptions,\n attributes: resolveOption(definition.attributes, x, definition),\n });\n },\n });\n }\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n\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 */\nfunction 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/**\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 exist 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 */\nfunction 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\nconst defaultElement = document.createElement(\"div\");\nfunction isFastElement(element) {\n return element instanceof FASTElement;\n}\nclass QueuedStyleSheetTarget {\n setProperty(name, value) {\n DOM.queueUpdate(() => this.target.setProperty(name, value));\n }\n removeProperty(name) {\n DOM.queueUpdate(() => this.target.removeProperty(name));\n }\n}\n/**\n * Handles setting properties for a FASTElement using Constructable Stylesheets\n */\nclass ConstructableStyleSheetTarget extends QueuedStyleSheetTarget {\n constructor(source) {\n super();\n const sheet = new CSSStyleSheet();\n sheet[prependToAdoptedStyleSheetsSymbol] = true;\n this.target = sheet.cssRules[sheet.insertRule(\":host{}\")].style;\n source.$fastController.addStyles(ElementStyles.create([sheet]));\n }\n}\nclass DocumentStyleSheetTarget extends QueuedStyleSheetTarget {\n constructor() {\n super();\n const sheet = new CSSStyleSheet();\n this.target = sheet.cssRules[sheet.insertRule(\":root{}\")].style;\n document.adoptedStyleSheets = [\n ...document.adoptedStyleSheets,\n sheet,\n ];\n }\n}\nclass HeadStyleElementStyleSheetTarget extends QueuedStyleSheetTarget {\n constructor() {\n super();\n this.style = document.createElement(\"style\");\n document.head.appendChild(this.style);\n const { sheet } = this.style;\n // Because the HTMLStyleElement has been appended,\n // there shouldn't exist a case where `sheet` is null,\n // but if-check it just in case.\n if (sheet) {\n // https://github.com/jsdom/jsdom uses https://github.com/NV/CSSOM for it's CSSOM implementation,\n // which implements the DOM Level 2 spec for CSSStyleSheet where insertRule() requires an index argument.\n const index = sheet.insertRule(\":root{}\", sheet.cssRules.length);\n this.target = sheet.cssRules[index].style;\n }\n }\n}\n/**\n * Handles setting properties for a FASTElement using an HTMLStyleElement\n */\nclass StyleElementStyleSheetTarget {\n constructor(target) {\n this.store = new Map();\n this.target = null;\n const controller = target.$fastController;\n this.style = document.createElement(\"style\");\n controller.addStyles(this.style);\n Observable.getNotifier(controller).subscribe(this, \"isConnected\");\n this.handleChange(controller, \"isConnected\");\n }\n targetChanged() {\n if (this.target !== null) {\n for (const [key, value] of this.store.entries()) {\n this.target.setProperty(key, value);\n }\n }\n }\n setProperty(name, value) {\n this.store.set(name, value);\n DOM.queueUpdate(() => {\n if (this.target !== null) {\n this.target.setProperty(name, value);\n }\n });\n }\n removeProperty(name) {\n this.store.delete(name);\n DOM.queueUpdate(() => {\n if (this.target !== null) {\n this.target.removeProperty(name);\n }\n });\n }\n handleChange(source, key) {\n // HTMLStyleElement.sheet is null if the element isn't connected to the DOM,\n // so this method reacts to changes in DOM connection for the element hosting\n // the HTMLStyleElement.\n //\n // All rules applied via the CSSOM also get cleared when the element disconnects,\n // so we need to add a new rule each time and populate it with the stored properties\n const { sheet } = this.style;\n if (sheet) {\n // Safari will throw if we try to use the return result of insertRule()\n // to index the rule inline, so store as a const prior to indexing.\n // https://github.com/jsdom/jsdom uses https://github.com/NV/CSSOM for it's CSSOM implementation,\n // which implements the DOM Level 2 spec for CSSStyleSheet where insertRule() requires an index argument.\n const index = sheet.insertRule(\":host{}\", sheet.cssRules.length);\n this.target = sheet.cssRules[index].style;\n }\n else {\n this.target = null;\n }\n }\n}\n__decorate([\n observable\n], StyleElementStyleSheetTarget.prototype, \"target\", void 0);\n/**\n * Handles setting properties for a normal HTMLElement\n */\nclass ElementStyleSheetTarget {\n constructor(source) {\n this.target = source.style;\n }\n setProperty(name, value) {\n DOM.queueUpdate(() => this.target.setProperty(name, value));\n }\n removeProperty(name) {\n DOM.queueUpdate(() => this.target.removeProperty(name));\n }\n}\n/**\n * Controls emission for default values. This control is capable\n * of emitting to multiple {@link PropertyTarget | PropertyTargets},\n * and only emits if it has at least one root.\n *\n * @internal\n */\nclass RootStyleSheetTarget {\n setProperty(name, value) {\n RootStyleSheetTarget.properties[name] = value;\n for (const target of RootStyleSheetTarget.roots.values()) {\n PropertyTargetManager.getOrCreate(RootStyleSheetTarget.normalizeRoot(target)).setProperty(name, value);\n }\n }\n removeProperty(name) {\n delete RootStyleSheetTarget.properties[name];\n for (const target of RootStyleSheetTarget.roots.values()) {\n PropertyTargetManager.getOrCreate(RootStyleSheetTarget.normalizeRoot(target)).removeProperty(name);\n }\n }\n static registerRoot(root) {\n const { roots } = RootStyleSheetTarget;\n if (!roots.has(root)) {\n roots.add(root);\n const target = PropertyTargetManager.getOrCreate(this.normalizeRoot(root));\n for (const key in RootStyleSheetTarget.properties) {\n target.setProperty(key, RootStyleSheetTarget.properties[key]);\n }\n }\n }\n static unregisterRoot(root) {\n const { roots } = RootStyleSheetTarget;\n if (roots.has(root)) {\n roots.delete(root);\n const target = PropertyTargetManager.getOrCreate(RootStyleSheetTarget.normalizeRoot(root));\n for (const key in RootStyleSheetTarget.properties) {\n target.removeProperty(key);\n }\n }\n }\n /**\n * Returns the document when provided the default element,\n * otherwise is a no-op\n * @param root - the root to normalize\n */\n static normalizeRoot(root) {\n return root === defaultElement ? document : root;\n }\n}\nRootStyleSheetTarget.roots = new Set();\nRootStyleSheetTarget.properties = {};\n// Caches PropertyTarget instances\nconst propertyTargetCache = new WeakMap();\n// Use Constructable StyleSheets for FAST elements when supported, otherwise use\n// HTMLStyleElement instances\nconst propertyTargetCtor = DOM.supportsAdoptedStyleSheets\n ? ConstructableStyleSheetTarget\n : StyleElementStyleSheetTarget;\n/**\n * Manages creation and caching of PropertyTarget instances.\n *\n * @internal\n */\nconst PropertyTargetManager = Object.freeze({\n getOrCreate(source) {\n if (propertyTargetCache.has(source)) {\n /* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */\n return propertyTargetCache.get(source);\n }\n let target;\n if (source === defaultElement) {\n target = new RootStyleSheetTarget();\n }\n else if (source instanceof Document) {\n target = DOM.supportsAdoptedStyleSheets\n ? new DocumentStyleSheetTarget()\n : new HeadStyleElementStyleSheetTarget();\n }\n else if (isFastElement(source)) {\n target = new propertyTargetCtor(source);\n }\n else {\n target = new ElementStyleSheetTarget(source);\n }\n propertyTargetCache.set(source, target);\n return target;\n },\n});\n\n/**\n * Implementation of {@link (DesignToken:interface)}\n */\nclass DesignTokenImpl extends CSSDirective {\n constructor(configuration) {\n super();\n this.subscribers = new WeakMap();\n this._appliedTo = new Set();\n this.name = configuration.name;\n if (configuration.cssCustomPropertyName !== null) {\n this.cssCustomProperty = `--${configuration.cssCustomPropertyName}`;\n this.cssVar = `var(${this.cssCustomProperty})`;\n }\n this.id = DesignTokenImpl.uniqueId();\n DesignTokenImpl.tokensById.set(this.id, this);\n }\n get appliedTo() {\n return [...this._appliedTo];\n }\n static from(nameOrConfig) {\n return new DesignTokenImpl({\n name: typeof nameOrConfig === \"string\" ? nameOrConfig : nameOrConfig.name,\n cssCustomPropertyName: typeof nameOrConfig === \"string\"\n ? nameOrConfig\n : nameOrConfig.cssCustomPropertyName === void 0\n ? nameOrConfig.name\n : nameOrConfig.cssCustomPropertyName,\n });\n }\n static isCSSDesignToken(token) {\n return typeof token.cssCustomProperty === \"string\";\n }\n static isDerivedDesignTokenValue(value) {\n return typeof value === \"function\";\n }\n /**\n * Gets a token by ID. Returns undefined if the token was not found.\n * @param id - The ID of the token\n * @returns\n */\n static getTokenById(id) {\n return DesignTokenImpl.tokensById.get(id);\n }\n getOrCreateSubscriberSet(target = this) {\n return (this.subscribers.get(target) ||\n (this.subscribers.set(target, new Set()) && this.subscribers.get(target)));\n }\n createCSS() {\n return this.cssVar || \"\";\n }\n getValueFor(element) {\n const value = DesignTokenNode.getOrCreate(element).get(this);\n if (value !== undefined) {\n return value;\n }\n throw new Error(`Value could not be retrieved for token named \"${this.name}\". Ensure the value is set for ${element} or an ancestor of ${element}.`);\n }\n setValueFor(element, value) {\n this._appliedTo.add(element);\n if (value instanceof DesignTokenImpl) {\n value = this.alias(value);\n }\n DesignTokenNode.getOrCreate(element).set(this, value);\n return this;\n }\n deleteValueFor(element) {\n this._appliedTo.delete(element);\n if (DesignTokenNode.existsFor(element)) {\n DesignTokenNode.getOrCreate(element).delete(this);\n }\n return this;\n }\n withDefault(value) {\n this.setValueFor(defaultElement, value);\n return this;\n }\n subscribe(subscriber, target) {\n const subscriberSet = this.getOrCreateSubscriberSet(target);\n if (target && !DesignTokenNode.existsFor(target)) {\n DesignTokenNode.getOrCreate(target);\n }\n if (!subscriberSet.has(subscriber)) {\n subscriberSet.add(subscriber);\n }\n }\n unsubscribe(subscriber, target) {\n const list = this.subscribers.get(target || this);\n if (list && list.has(subscriber)) {\n list.delete(subscriber);\n }\n }\n /**\n * Notifies subscribers that the value for an element has changed.\n * @param element - The element to emit a notification for\n */\n notify(element) {\n const record = Object.freeze({ token: this, target: element });\n if (this.subscribers.has(this)) {\n this.subscribers.get(this).forEach(sub => sub.handleChange(record));\n }\n if (this.subscribers.has(element)) {\n this.subscribers.get(element).forEach(sub => sub.handleChange(record));\n }\n }\n /**\n * Alias the token to the provided token.\n * @param token - the token to alias to\n */\n alias(token) {\n return ((target) => token.getValueFor(target));\n }\n}\nDesignTokenImpl.uniqueId = (() => {\n let id = 0;\n return () => {\n id++;\n return id.toString(16);\n };\n})();\n/**\n * Token storage by token ID\n */\nDesignTokenImpl.tokensById = new Map();\nclass CustomPropertyReflector {\n startReflection(token, target) {\n token.subscribe(this, target);\n this.handleChange({ token, target });\n }\n stopReflection(token, target) {\n token.unsubscribe(this, target);\n this.remove(token, target);\n }\n handleChange(record) {\n const { token, target } = record;\n this.add(token, target);\n }\n add(token, target) {\n PropertyTargetManager.getOrCreate(target).setProperty(token.cssCustomProperty, this.resolveCSSValue(DesignTokenNode.getOrCreate(target).get(token)));\n }\n remove(token, target) {\n PropertyTargetManager.getOrCreate(target).removeProperty(token.cssCustomProperty);\n }\n resolveCSSValue(value) {\n return value && typeof value.createCSS === \"function\" ? value.createCSS() : value;\n }\n}\n/**\n * A light wrapper around BindingObserver to handle value caching and\n * token notification\n */\nclass DesignTokenBindingObserver {\n constructor(source, token, node) {\n this.source = source;\n this.token = token;\n this.node = node;\n this.dependencies = new Set();\n this.observer = Observable.binding(source, this, false);\n // This is a little bit hacky because it's using internal APIs of BindingObserverImpl.\n // BindingObserverImpl queues updates to batch it's notifications which doesn't work for this\n // scenario because the DesignToken.getValueFor API is not async. Without this, using DesignToken.getValueFor()\n // after DesignToken.setValueFor() when setting a dependency of the value being retrieved can return a stale\n // value. Assigning .handleChange to .call forces immediate invocation of this classes handleChange() method,\n // allowing resolution of values synchronously.\n // TODO: https://github.com/microsoft/fast/issues/5110\n this.observer.handleChange = this.observer.call;\n this.handleChange();\n }\n disconnect() {\n this.observer.disconnect();\n }\n /**\n * @internal\n */\n handleChange() {\n this.node.store.set(this.token, this.observer.observe(this.node.target, defaultExecutionContext));\n }\n}\n/**\n * Stores resolved token/value pairs and notifies on changes\n */\nclass Store {\n constructor() {\n this.values = new Map();\n }\n set(token, value) {\n if (this.values.get(token) !== value) {\n this.values.set(token, value);\n Observable.getNotifier(this).notify(token.id);\n }\n }\n get(token) {\n Observable.track(this, token.id);\n return this.values.get(token);\n }\n delete(token) {\n this.values.delete(token);\n }\n all() {\n return this.values.entries();\n }\n}\nconst nodeCache = new WeakMap();\nconst childToParent = new WeakMap();\n/**\n * A node responsible for setting and getting token values,\n * emitting values to CSS custom properties, and maintaining\n * inheritance structures.\n */\nclass DesignTokenNode {\n constructor(target) {\n this.target = target;\n /**\n * Stores all resolved token values for a node\n */\n this.store = new Store();\n /**\n * All children assigned to the node\n */\n this.children = [];\n /**\n * All values explicitly assigned to the node in their raw form\n */\n this.assignedValues = new Map();\n /**\n * Tokens currently being reflected to CSS custom properties\n */\n this.reflecting = new Set();\n /**\n * Binding observers for assigned and inherited derived values.\n */\n this.bindingObservers = new Map();\n /**\n * Emits notifications to token when token values\n * change the DesignTokenNode\n */\n this.tokenValueChangeHandler = {\n handleChange: (source, arg) => {\n const token = DesignTokenImpl.getTokenById(arg);\n if (token) {\n // Notify any token subscribers\n token.notify(this.target);\n this.updateCSSTokenReflection(source, token);\n }\n },\n };\n nodeCache.set(target, this);\n // Map store change notifications to token change notifications\n Observable.getNotifier(this.store).subscribe(this.tokenValueChangeHandler);\n if (target instanceof FASTElement) {\n target.$fastController.addBehaviors([this]);\n }\n else if (target.isConnected) {\n this.bind();\n }\n }\n /**\n * Returns a DesignTokenNode for an element.\n * Creates a new instance if one does not already exist for a node,\n * otherwise returns the cached instance\n *\n * @param target - The HTML element to retrieve a DesignTokenNode for\n */\n static getOrCreate(target) {\n return nodeCache.get(target) || new DesignTokenNode(target);\n }\n /**\n * Determines if a DesignTokenNode has been created for a target\n * @param target - The element to test\n */\n static existsFor(target) {\n return nodeCache.has(target);\n }\n /**\n * Searches for and return the nearest parent DesignTokenNode.\n * Null is returned if no node is found or the node provided is for a default element.\n */\n static findParent(node) {\n if (!(defaultElement === node.target)) {\n let parent = composedParent(node.target);\n while (parent !== null) {\n if (nodeCache.has(parent)) {\n return nodeCache.get(parent);\n }\n parent = composedParent(parent);\n }\n return DesignTokenNode.getOrCreate(defaultElement);\n }\n return null;\n }\n /**\n * Finds the closest node with a value explicitly assigned for a token, otherwise null.\n * @param token - The token to look for\n * @param start - The node to start looking for value assignment\n * @returns\n */\n static findClosestAssignedNode(token, start) {\n let current = start;\n do {\n if (current.has(token)) {\n return current;\n }\n current = current.parent\n ? current.parent\n : current.target !== defaultElement\n ? DesignTokenNode.getOrCreate(defaultElement)\n : null;\n } while (current !== null);\n return null;\n }\n /**\n * The parent DesignTokenNode, or null.\n */\n get parent() {\n return childToParent.get(this) || null;\n }\n updateCSSTokenReflection(source, token) {\n if (DesignTokenImpl.isCSSDesignToken(token)) {\n const parent = this.parent;\n const reflecting = this.isReflecting(token);\n if (parent) {\n const parentValue = parent.get(token);\n const sourceValue = source.get(token);\n if (parentValue !== sourceValue && !reflecting) {\n this.reflectToCSS(token);\n }\n else if (parentValue === sourceValue && reflecting) {\n this.stopReflectToCSS(token);\n }\n }\n else if (!reflecting) {\n this.reflectToCSS(token);\n }\n }\n }\n /**\n * Checks if a token has been assigned an explicit value the node.\n * @param token - the token to check.\n */\n has(token) {\n return this.assignedValues.has(token);\n }\n /**\n * Gets the value of a token for a node\n * @param token - The token to retrieve the value for\n * @returns\n */\n get(token) {\n const value = this.store.get(token);\n if (value !== undefined) {\n return value;\n }\n const raw = this.getRaw(token);\n if (raw !== undefined) {\n this.hydrate(token, raw);\n return this.get(token);\n }\n }\n /**\n * Retrieves the raw assigned value of a token from the nearest assigned node.\n * @param token - The token to retrieve a raw value for\n * @returns\n */\n getRaw(token) {\n var _a;\n if (this.assignedValues.has(token)) {\n return this.assignedValues.get(token);\n }\n return (_a = DesignTokenNode.findClosestAssignedNode(token, this)) === null || _a === void 0 ? void 0 : _a.getRaw(token);\n }\n /**\n * Sets a token to a value for a node\n * @param token - The token to set\n * @param value - The value to set the token to\n */\n set(token, value) {\n if (DesignTokenImpl.isDerivedDesignTokenValue(this.assignedValues.get(token))) {\n this.tearDownBindingObserver(token);\n }\n this.assignedValues.set(token, value);\n if (DesignTokenImpl.isDerivedDesignTokenValue(value)) {\n this.setupBindingObserver(token, value);\n }\n else {\n this.store.set(token, value);\n }\n }\n /**\n * Deletes a token value for the node.\n * @param token - The token to delete the value for\n */\n delete(token) {\n this.assignedValues.delete(token);\n this.tearDownBindingObserver(token);\n const upstream = this.getRaw(token);\n if (upstream) {\n this.hydrate(token, upstream);\n }\n else {\n this.store.delete(token);\n }\n }\n /**\n * Invoked when the DesignTokenNode.target is attached to the document\n */\n bind() {\n const parent = DesignTokenNode.findParent(this);\n if (parent) {\n parent.appendChild(this);\n }\n for (const key of this.assignedValues.keys()) {\n key.notify(this.target);\n }\n }\n /**\n * Invoked when the DesignTokenNode.target is detached from the document\n */\n unbind() {\n if (this.parent) {\n const parent = childToParent.get(this);\n parent.removeChild(this);\n }\n }\n /**\n * Appends a child to a parent DesignTokenNode.\n * @param child - The child to append to the node\n */\n appendChild(child) {\n if (child.parent) {\n childToParent.get(child).removeChild(child);\n }\n const reParent = this.children.filter(x => child.contains(x));\n childToParent.set(child, this);\n this.children.push(child);\n reParent.forEach(x => child.appendChild(x));\n Observable.getNotifier(this.store).subscribe(child);\n // How can we not notify *every* subscriber?\n for (const [token, value] of this.store.all()) {\n child.hydrate(token, this.bindingObservers.has(token) ? this.getRaw(token) : value);\n }\n }\n /**\n * Removes a child from a node.\n * @param child - The child to remove.\n */\n removeChild(child) {\n const childIndex = this.children.indexOf(child);\n if (childIndex !== -1) {\n this.children.splice(childIndex, 1);\n }\n Observable.getNotifier(this.store).unsubscribe(child);\n return child.parent === this ? childToParent.delete(child) : false;\n }\n /**\n * Tests whether a provided node is contained by\n * the calling node.\n * @param test - The node to test\n */\n contains(test) {\n return composedContains(this.target, test.target);\n }\n /**\n * Instructs the node to reflect a design token for the provided token.\n * @param token - The design token to reflect\n */\n reflectToCSS(token) {\n if (!this.isReflecting(token)) {\n this.reflecting.add(token);\n DesignTokenNode.cssCustomPropertyReflector.startReflection(token, this.target);\n }\n }\n /**\n * Stops reflecting a DesignToken to CSS\n * @param token - The design token to stop reflecting\n */\n stopReflectToCSS(token) {\n if (this.isReflecting(token)) {\n this.reflecting.delete(token);\n DesignTokenNode.cssCustomPropertyReflector.stopReflection(token, this.target);\n }\n }\n /**\n * Determines if a token is being reflected to CSS for a node.\n * @param token - The token to check for reflection\n * @returns\n */\n isReflecting(token) {\n return this.reflecting.has(token);\n }\n /**\n * Handle changes to upstream tokens\n * @param source - The parent DesignTokenNode\n * @param property - The token ID that changed\n */\n handleChange(source, property) {\n const token = DesignTokenImpl.getTokenById(property);\n if (!token) {\n return;\n }\n this.hydrate(token, this.getRaw(token));\n this.updateCSSTokenReflection(this.store, token);\n }\n /**\n * Hydrates a token with a DesignTokenValue, making retrieval available.\n * @param token - The token to hydrate\n * @param value - The value to hydrate\n */\n hydrate(token, value) {\n if (!this.has(token)) {\n const observer = this.bindingObservers.get(token);\n if (DesignTokenImpl.isDerivedDesignTokenValue(value)) {\n if (observer) {\n // If the binding source doesn't match, we need\n // to update the binding\n if (observer.source !== value) {\n this.tearDownBindingObserver(token);\n this.setupBindingObserver(token, value);\n }\n }\n else {\n this.setupBindingObserver(token, value);\n }\n }\n else {\n if (observer) {\n this.tearDownBindingObserver(token);\n }\n this.store.set(token, value);\n }\n }\n }\n /**\n * Sets up a binding observer for a derived token value that notifies token\n * subscribers on change.\n *\n * @param token - The token to notify when the binding updates\n * @param source - The binding source\n */\n setupBindingObserver(token, source) {\n const binding = new DesignTokenBindingObserver(source, token, this);\n this.bindingObservers.set(token, binding);\n return binding;\n }\n /**\n * Tear down a binding observer for a token.\n */\n tearDownBindingObserver(token) {\n if (this.bindingObservers.has(token)) {\n this.bindingObservers.get(token).disconnect();\n this.bindingObservers.delete(token);\n return true;\n }\n return false;\n }\n}\n/**\n * Responsible for reflecting tokens to CSS custom properties\n */\nDesignTokenNode.cssCustomPropertyReflector = new CustomPropertyReflector();\n__decorate([\n observable\n], DesignTokenNode.prototype, \"children\", void 0);\nfunction create(nameOrConfig) {\n return DesignTokenImpl.from(nameOrConfig);\n}\n/* eslint-enable @typescript-eslint/no-unused-vars */\n/**\n * Factory object for creating {@link (DesignToken:interface)} instances.\n * @public\n */\nconst DesignToken = Object.freeze({\n create,\n /**\n * Informs DesignToken that an HTMLElement for which tokens have\n * been set has been connected to the document.\n *\n * The browser does not provide a reliable mechanism to observe an HTMLElement's connectedness\n * in all scenarios, so invoking this method manually is necessary when:\n *\n * 1. Token values are set for an HTMLElement.\n * 2. The HTMLElement does not inherit from FASTElement.\n * 3. The HTMLElement is not connected to the document when token values are set.\n *\n * @param element - The element to notify\n * @returns - true if notification was successful, otherwise false.\n */\n notifyConnection(element) {\n if (!element.isConnected || !DesignTokenNode.existsFor(element)) {\n return false;\n }\n DesignTokenNode.getOrCreate(element).bind();\n return true;\n },\n /**\n * Informs DesignToken that an HTMLElement for which tokens have\n * been set has been disconnected to the document.\n *\n * The browser does not provide a reliable mechanism to observe an HTMLElement's connectedness\n * in all scenarios, so invoking this method manually is necessary when:\n *\n * 1. Token values are set for an HTMLElement.\n * 2. The HTMLElement does not inherit from FASTElement.\n *\n * @param element - The element to notify\n * @returns - true if notification was successful, otherwise false.\n */\n notifyDisconnection(element) {\n if (element.isConnected || !DesignTokenNode.existsFor(element)) {\n return false;\n }\n DesignTokenNode.getOrCreate(element).unbind();\n return true;\n },\n /**\n * Registers and element or document as a DesignToken root.\n * {@link CSSDesignToken | CSSDesignTokens} with default values assigned via\n * {@link (DesignToken:interface).withDefault} will emit CSS custom properties to all\n * registered roots.\n * @param target - The root to register\n */\n registerRoot(target = defaultElement) {\n RootStyleSheetTarget.registerRoot(target);\n },\n /**\n * Unregister an element or document as a DesignToken root.\n * @param target - The root to deregister\n */\n unregisterRoot(target = defaultElement) {\n RootStyleSheetTarget.unregisterRoot(target);\n },\n});\n/* eslint-enable @typescript-eslint/no-non-null-assertion */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion */\n/**\n * Indicates what to do with an ambiguous (duplicate) element.\n * @public\n */\nconst ElementDisambiguation = Object.freeze({\n /**\n * Skip defining the element but still call the provided callback passed\n * to DesignSystemRegistrationContext.tryDefineElement\n */\n definitionCallbackOnly: null,\n /**\n * Ignore the duplicate element entirely.\n */\n ignoreDuplicate: Symbol(),\n});\nconst elementTypesByTag = new Map();\nconst elementTagsByType = new Map();\nlet rootDesignSystem = null;\nconst designSystemKey = DI.createInterface(x => x.cachedCallback(handler => {\n if (rootDesignSystem === null) {\n rootDesignSystem = new DefaultDesignSystem(null, handler);\n }\n return rootDesignSystem;\n}));\n/**\n * An API gateway to design system features.\n * @public\n */\nconst DesignSystem = Object.freeze({\n /**\n * Returns the HTML element name that the type is defined as.\n * @param type - The type to lookup.\n * @public\n */\n tagFor(type) {\n return elementTagsByType.get(type);\n },\n /**\n * Searches the DOM hierarchy for the design system that is responsible\n * for the provided element.\n * @param element - The element to locate the design system for.\n * @returns The located design system.\n * @public\n */\n responsibleFor(element) {\n const owned = element.$$designSystem$$;\n if (owned) {\n return owned;\n }\n const container = DI.findResponsibleContainer(element);\n return container.get(designSystemKey);\n },\n /**\n * Gets the DesignSystem if one is explicitly defined on the provided element;\n * otherwise creates a design system defined directly on the element.\n * @param element - The element to get or create a design system for.\n * @returns The design system.\n * @public\n */\n getOrCreate(node) {\n if (!node) {\n if (rootDesignSystem === null) {\n rootDesignSystem = DI.getOrCreateDOMContainer().get(designSystemKey);\n }\n return rootDesignSystem;\n }\n const owned = node.$$designSystem$$;\n if (owned) {\n return owned;\n }\n const container = DI.getOrCreateDOMContainer(node);\n if (container.has(designSystemKey, false)) {\n return container.get(designSystemKey);\n }\n else {\n const system = new DefaultDesignSystem(node, container);\n container.register(Registration.instance(designSystemKey, system));\n return system;\n }\n },\n});\nfunction extractTryDefineElementParams(params, elementDefinitionType, elementDefinitionCallback) {\n if (typeof params === \"string\") {\n return {\n name: params,\n type: elementDefinitionType,\n callback: elementDefinitionCallback,\n };\n }\n else {\n return params;\n }\n}\nclass DefaultDesignSystem {\n constructor(owner, container) {\n this.owner = owner;\n this.container = container;\n this.designTokensInitialized = false;\n this.prefix = \"fast\";\n this.shadowRootMode = undefined;\n this.disambiguate = () => ElementDisambiguation.definitionCallbackOnly;\n if (owner !== null) {\n owner.$$designSystem$$ = this;\n }\n }\n withPrefix(prefix) {\n this.prefix = prefix;\n return this;\n }\n withShadowRootMode(mode) {\n this.shadowRootMode = mode;\n return this;\n }\n withElementDisambiguation(callback) {\n this.disambiguate = callback;\n return this;\n }\n withDesignTokenRoot(root) {\n this.designTokenRoot = root;\n return this;\n }\n register(...registrations) {\n const container = this.container;\n const elementDefinitionEntries = [];\n const disambiguate = this.disambiguate;\n const shadowRootMode = this.shadowRootMode;\n const context = {\n elementPrefix: this.prefix,\n tryDefineElement(params, elementDefinitionType, elementDefinitionCallback) {\n const extractedParams = extractTryDefineElementParams(params, elementDefinitionType, elementDefinitionCallback);\n const { name, callback, baseClass } = extractedParams;\n let { type } = extractedParams;\n let elementName = name;\n let typeFoundByName = elementTypesByTag.get(elementName);\n let needsDefine = true;\n while (typeFoundByName) {\n const result = disambiguate(elementName, type, typeFoundByName);\n switch (result) {\n case ElementDisambiguation.ignoreDuplicate:\n return;\n case ElementDisambiguation.definitionCallbackOnly:\n needsDefine = false;\n typeFoundByName = void 0;\n break;\n default:\n elementName = result;\n typeFoundByName = elementTypesByTag.get(elementName);\n break;\n }\n }\n if (needsDefine) {\n if (elementTagsByType.has(type) || type === FoundationElement) {\n type = class extends type {\n };\n }\n elementTypesByTag.set(elementName, type);\n elementTagsByType.set(type, elementName);\n if (baseClass) {\n elementTagsByType.set(baseClass, elementName);\n }\n }\n elementDefinitionEntries.push(new ElementDefinitionEntry(container, elementName, type, shadowRootMode, callback, needsDefine));\n },\n };\n if (!this.designTokensInitialized) {\n this.designTokensInitialized = true;\n if (this.designTokenRoot !== null) {\n DesignToken.registerRoot(this.designTokenRoot);\n }\n }\n container.registerWithContext(context, ...registrations);\n for (const entry of elementDefinitionEntries) {\n entry.callback(entry);\n if (entry.willDefine && entry.definition !== null) {\n entry.definition.define();\n }\n }\n return this;\n }\n}\nclass ElementDefinitionEntry {\n constructor(container, name, type, shadowRootMode, callback, willDefine) {\n this.container = container;\n this.name = name;\n this.type = type;\n this.shadowRootMode = shadowRootMode;\n this.callback = callback;\n this.willDefine = willDefine;\n this.definition = null;\n }\n definePresentation(presentation) {\n ComponentPresentation.define(this.name, presentation, this.container);\n }\n defineElement(definition) {\n this.definition = new FASTElementDefinition(this.type, Object.assign(Object.assign({}, definition), { name: this.name }));\n }\n tagFor(type) {\n return DesignSystem.tagFor(type);\n }\n}\n/* eslint-enable @typescript-eslint/no-non-null-assertion */\n\nconst defaultPrefix = \"vwc\";\nconst designSystem = DesignSystem.getOrCreate();\nconst registerFactory = (registries) => (prefix = defaultPrefix) => designSystem.withPrefix(prefix).register(...registries);\n\nexport { AttributeConfiguration as A, DOM as D, FoundationElement as F, HTMLDirective as H, Observable as O, SubscriberSet as S, __decorate as _, attr as a, AttachedBehaviorHTMLDirective as b, booleanConverter as c, designSystem as d, emptyArray as e, HTMLView as f, html as h, nullableNumberConverter as n, observable as o, registerFactory as r, volatile as v };\n"],"names":["$global","globalThis","global","self","window","Function","_a","trustedTypes","createPolicy","n","r","propConfig","configurable","enumerable","writable","FAST","Reflect","defineProperty","Object","assign","value","create","getById","storage","id","initialize","found","emptyArray","freeze","createMetadataLocator","metadataLookup","WeakMap","target","metadata","get","currentTarget","getPrototypeOf","slice","set","updateQueue","tasks","pendingErrors","throwFirstError","length","shift","tryRunTask","task","call","error","push","setTimeout","process","index","scan","newLength","enqueue","callable","requestAnimationFrame","fastHTMLPolicy","createHTML","html","htmlPolicy","marker","Math","random","toString","substring","_interpolationStart","_interpolationEnd","DOM","supportsAdoptedStyleSheets","Array","isArray","document","adoptedStyleSheets","CSSStyleSheet","prototype","setHTMLPolicy","policy","Error","isMarker","node","nodeType","data","startsWith","extractDirectiveIndexFromMarker","parseInt","replace","createInterpolationPlaceholder","createCustomAttributePlaceholder","attributeName","this","createBlockPlaceholder","queueUpdate","processUpdates","nextUpdate","Promise","setAttribute","element","removeAttribute","setBooleanAttribute","removeChildNodes","parent","child","firstChild","removeChild","createTemplateWalker","fragment","createTreeWalker","SubscriberSet","constructor","source","initialSubscriber","sub1","sub2","spillover","has","subscriber","indexOf","subscribe","unsubscribe","splice","notify","args","handleChange","i","ii","PropertyChangeNotifier","subscribers","sourceSubscribers","propertyName","propertyToWatch","propertyToUnwatch","Observable","volatileRegex","notifierLookup","watcher","createArrayObserver","array","getNotifier","$fastController","getAccessors","DefaultObservableAccessor","name","field","callback","getValue","watch","setValue","newValue","oldValue","BindingObserverImplementation","binding","isVolatileBinding","super","needsRefresh","needsQueue","first","last","propertySource","notifier","next","observe","context","disconnect","previousWatcher","result","current","prev","prevValue","records","undefined","done","Symbol","iterator","setArrayObserverFactory","factory","track","trackVolatile","nameOrAccessor","test","observable","volatile","descriptor","apply","contextEvent","event","ExecutionContext","parentContext","isEven","isOdd","isFirst","isInMiddle","isLast","setEvent","defaultExecutionContext","seal","HTMLDirective","targetIndex","TargetedHTMLDirective","arguments","createPlaceholder","AttachedBehaviorHTMLDirective","behavior","options","createBehavior","normalBind","bindingObserver","isBindingVolatile","updateTarget","triggerBind","addEventListener","targetName","normalUnbind","contentUnbind","view","$fastView","isComposed","unbind","needsBindOnly","triggerUnbind","removeEventListener","updateAttributeTarget","updateBooleanAttributeTarget","updateContentTarget","textContent","$fastTemplate","remove","bind","insertBefore","updatePropertyTarget","updateClassTarget","classVersions","version","names","split","currentName","classList","add","HTMLBindingDirective","originalTargetName","cleanedTargetName","substr","s","c","targetAtContent","BindingBehavior","handleEvent","preventDefault","sharedContext","CompilationContext","addFactory","behaviorFactories","captureContentBinding","directive","reset","release","borrow","directives","shareable","createAggregateBinding","parts","partCount","finalParts","map","x","scope","output","interpolationEndLength","parseContent","valueParts","bindingParts","literal","directiveIndex","compileAttributes","includeBasicValues","attributes","attr","attrValue","parseResult","removeAttributeNode","compileContent","walker","lastNode","currentPart","currentNode","parentNode","createTextNode","nextSibling","nextNode","range","createRange","HTMLView","behaviors","lastChild","appendTo","appendChild","hasChildNodes","end","previousSibling","dispose","oldSource","disposeContiguousBatch","views","setStartBefore","setEndAfter","deleteContents","j","jj","ViewTemplate","behaviorCount","hasHostBehaviors","targetOffset","viewBehaviorFactories","hostBehaviorFactories","hostBindingTarget","template","createElement","innerHTML","fec","content","firstElementChild","tagName","adoptNode","childNodes","createComment","compileTemplate","cloneNode","viewFactories","behaviorIndex","factoryIndex","hostFactories","render","host","getElementById","lastAttributeNameRegex","strings","values","currentString","match","exec","ElementStyles","targets","WeakSet","addStylesTo","removeStylesFrom","delete","isAttachedTo","withBehaviors","concat","reduceStyles","styles","reduce","curr","reduceBehaviors","styleSheetCache","Map","AdoptedStyleSheetsStyles","StyleElementStyles","prependToAdoptedStyleSheetsSymbol","separateSheetsToPrepend","sheets","prepend","append","forEach","addAdoptedStyleSheets","removeAdoptedStyleSheets","filter","sheet","e","_styleSheets","styleSheets","replaceSync","styleClassId","styleClass","normalizeTarget","className","querySelectorAll","body","AttributeConfiguration","locate","booleanConverter","toView","fromView","nullableNumberConverter","number","isNaN","AttributeDefinition","Owner","attribute","toLowerCase","mode","converter","guards","Set","fieldName","callbackName","hasCallback","tryReflectToAttribute","onAttributeChangedCallback","latestValue","collect","attributeLists","list","config","property","configOrTarget","prop","decorator","$target","$prop","defaultShadowOptions","defaultElementOptions","fastRegistry","typeToDefinition","register","definition","type","getByType","key","FASTElementDefinition","nameOrConfig","observedAttributes","propertyLookup","attributeLookup","shadowOptions","elementOptions","isDefined","define","registry","customElements","proto","forType","shadowRoots","defaultEventOptions","bubbles","composed","cancelable","getShadowRoot","shadowRoot","Controller","boundObservables","needsInitialization","_template","_styles","_isConnected","attachShadow","accessors","isConnected","setIsConnected","renderTemplate","removeStyles","addStyles","getRootNode","HTMLStyleElement","sourceBehaviors","addBehaviors","removeBehaviors","targetBehaviors","behaviorsToBind","force","behaviorsToUnbind","count","onConnectedCallback","finishInitialization","onDisconnectedCallback","attrDef","emit","detail","dispatchEvent","CustomEvent","propertyNames","keys","resolveTemplate","resolveStyles","forCustomElement","controller","createFASTElement","BaseType","$emit","connectedCallback","disconnectedCallback","attributeChangedCallback","FASTElement","HTMLElement","from","nameOrDef","CSSDirective","createCSS","__decorate","decorators","desc","d","getOwnPropertyDescriptor","decorate","metadataByTarget","defineMetadata","getOwnMetadata","ResolverBuilder","container","instance","registerResolver","singleton","transient","cachedCallback","cacheCallbackResult","aliasTo","destinationKey","strategy","state","ResolverImpl","cloneArrayWithPossibleProps","clone","len","isArrayIndex","DefaultResolver","none","ContainerConfiguration","default","parentLocator","responsibleForOwnerRequests","defaultResolver","dependencyLookup","getParamTypes","Type","rootDOMContainer","DI","createContainer","ContainerImpl","findResponsibleContainer","owned","$$container$$","findParentContainer","DILocateParentEventType","getOrCreateDOMContainer","getDesignParamtypes","getAnnotationParamtypes","getOrCreateAnnotationParamTypes","annotationParamtypes","getDependencies","dependencies","inject","designParamtypes","Proto","auAnnotationParamtype","respectConnection","diPropertyKey","createInterface","nameConfigOrCallback","configuror","configure","friendlyName","defaultFriendlyName","Interface","$isInterface","dep","Registration","registerInRequestor","defaultSingletonOptions","scoped","Container","resolving","$isResolver","resolve","handler","requestor","getFactory","construct","String","_b","_c","getResolver","containerGetKey","transformInstance","inst","transform","FactoryImpl","transformers","dynamicDependencies","registerTransformer","transformer","containerResolver","isRegistry","obj","isRegisterInRequester","isSelfRegistry","InstrinsicTypeNames","factories","owner","_parent","registerDepth","resolvers","Node","composedPath","stopImmediatePropagation","depth","registerWithContext","params","isObject","resolver","validateKey","autoRegister","jitRegister","searchAncestors","getAll","resolutions","buildAllResponse","isNativeFunction","registerFactory","createChild","keyAsValue","registrationResolver","newResolver","cache","fun","t","originalKey","aliasKey","results","lookup","isNative","sourceText","fn","charCodeAt","isNumericLookup","ch","presentationKeyFromTag","presentationRegistry","ComponentPresentation","presentation","forTag","existing","DefaultComponentPresentation","applyTo","FoundationElement","_presentation","$presentation","templateChanged","stylesChanged","compose","elementDefinition","overrideDefinition","FoundationElementRegistry","resolveOption","option","prefix","elementPrefix","baseName","tryDefineElement","baseClass","definePresentation","shadowRootMode","defineElement","composedParent","parentElement","rootNode","defaultElement","QueuedStyleSheetTarget","setProperty","removeProperty","DocumentStyleSheetTarget","cssRules","insertRule","style","HeadStyleElementStyleSheetTarget","head","StyleElementStyleSheetTarget","store","targetChanged","entries","ElementStyleSheetTarget","RootStyleSheetTarget","properties","roots","PropertyTargetManager","getOrCreate","normalizeRoot","registerRoot","root","unregisterRoot","propertyTargetCache","propertyTargetCtor","Document","DesignTokenImpl","configuration","_appliedTo","cssCustomPropertyName","cssCustomProperty","cssVar","uniqueId","tokensById","appliedTo","isCSSDesignToken","token","isDerivedDesignTokenValue","getTokenById","getOrCreateSubscriberSet","getValueFor","DesignTokenNode","setValueFor","alias","deleteValueFor","existsFor","withDefault","subscriberSet","record","sub","DesignTokenBindingObserver","observer","Store","all","nodeCache","childToParent","children","assignedValues","reflecting","bindingObservers","tokenValueChangeHandler","arg","updateCSSTokenReflection","findParent","findClosestAssignedNode","start","isReflecting","parentValue","sourceValue","stopReflectToCSS","reflectToCSS","raw","getRaw","hydrate","tearDownBindingObserver","setupBindingObserver","upstream","reParent","contains","childIndex","reference","composedContains","cssCustomPropertyReflector","startReflection","stopReflection","resolveCSSValue","DesignToken","notifyConnection","notifyDisconnection","ElementDisambiguation","definitionCallbackOnly","ignoreDuplicate","elementTypesByTag","elementTagsByType","rootDesignSystem","designSystemKey","DefaultDesignSystem","DesignSystem","tagFor","responsibleFor","$$designSystem$$","system","designTokensInitialized","disambiguate","withPrefix","withShadowRootMode","withElementDisambiguation","withDesignTokenRoot","designTokenRoot","registrations","elementDefinitionEntries","elementDefinitionType","elementDefinitionCallback","extractedParams","extractTryDefineElementParams","elementName","typeFoundByName","needsDefine","ElementDefinitionEntry","entry","willDefine","designSystem","registries"],"sourceRoot":""}